diff options
author | Michael Meeks <michael@ximian.com> | 2002-02-19 09:11:16 +0000 |
---|---|---|
committer | Michael Meeks <michael@src.gnome.org> | 2002-02-19 09:11:16 +0000 |
commit | b99fa35032b4bfae4b4ea1d7d5721ba187efb104 (patch) | |
tree | ee3413c672c6bef512071d1787b6a39e39a85827 /libnautilus-private | |
parent | cad4a60e3293a226f2e73d57d1b1a1ebc1b8b6f7 (diff) | |
download | nautilus-b99fa35032b4bfae4b4ea1d7d5721ba187efb104.tar.gz |
setup both the rgba and GdkColor variants. (update_label_color): upd.
2002-02-17 Michael Meeks <michael@ximian.com>
* libnautilus-private/nautilus-icon-container.c
(nautilus_icon_container_theme_changed): setup both
the rgba and GdkColor variants.
(update_label_color): upd. color handling.
(alloc_colors): allocate the colors on realize
2002-02-15 Michael Meeks <michael@ximian.com>
* libnautilus-private/nautilus-icon-container.c
(nautilus_icon_container_get_label_color): return
the colors we need, grab them from the style's text
information though.
2002-02-14 Michael Meeks <michael@ximian.com>
* libnautilus-private/nautilus-icon-canvas-item.c
(nautilus_icon_canvas_item_get_property),
(nautilus_icon_canvas_item_set_property): port to
properties.
(draw_or_measure_label_text): update color handling,
could we re-use the gc here ?
(draw_stretch_handles): upd gc unref.
(nautilus_icon_canvas_item_class_init): upd.
* libnautilus-private/nautilus-theme.c
(nautilus_pixmap_file_may_be_local),
(nautilus_theme_install_user_theme),
(nautilus_theme_make_preview_pixbuf),
(theme_get_property),
(load_theme_document): upd. file tests.
* libnautilus-private/nautilus-monitor.c
(get_event_uri): use g_build_filename.
* libnautilus-private/nautilus-find-icon-image.c
(get_user_emblem_path, make_full_icon_path),
(make_full_icon_path): upd. file test.
* libnautilus-private/nautilus-file-utilities.c
(nautilus_pixmap_file),
(nautilus_get_data_file_path),
(nautilus_get_user_directory),
(nautilus_get_desktop_directory): upd. file tests.
* libnautilus-private/nautilus-directory-metafile.c
(nautilus_directory_get_boolean_file_metadata): use
strcasecmp not ascii_strdown to save yet more malloc
locking penalty.
* libnautilus-private/nautilus-directory-background.c
(nautilus_file_background_receive_root_window_changes),
(desktop_background_destroyed_callback): upd. root
window macro.
(nautilus_connect_background_to_file_metadata),
(initialize_background_from_settings),
(image_loading_done_callback): upd g_signal bits.
* libnautilus-private/nautilus-volume-monitor.c
(nautilus_volume_monitor_class_init): upd file test.
* libnautilus-private/nautilus-undo-signal-handlers.c
(nautilus_undo_tear_down_nautilus_entry_for_undo): upd.
* libnautilus-private/nautilus-undo-manager.c
(nautilus_undo_manager_class_init): upd. signal bits.
* libnautilus-private/nautilus-trash-monitor.c
(nautilus_trash_monitor_class_init): g_cclosureize.
(nautilus_trash_monitor_init): g_signal upds.
* libnautilus-private/nautilus-trash-file.c
(trash_destroy, nautilus_trash_file_init),
(remove_real_file): upd. g_signal bits.
* libnautilus-private/nautilus-trash-directory.c
(nautilus_trash_directory_init): upd. signal connect.
(trash_destroy): upd. signal bits.
* libnautilus-private/nautilus-program-choosing.c
(get_xalf_prefix): upd. find_program_in_path.
* libnautilus-private/nautilus-program-chooser.c
(nautilus_program_chooser_init): upd. window policy
* libnautilus-private/nautilus-merged-directory.c
(merged_remove_real_directory): upd. g_signal.
(nautilus_merged_directory_class_init): upd. g_closure
* libnautilus-private/nautilus-link-desktop-file.c
(nautilus_link_desktop_file_get_link_icon_from_desktop):
upd. pixmap location.
* libnautilus-private/nautilus-icon-factory.c
(nautilus_icon_factory_class_init): upd. marshallers
(is_theme_in_user_directory): upd. file test.
* libnautilus-private/nautilus-icon-dnd.c
(auto_scroll_timeout_callback): do a queue_draw_area
instead of a widget_draw.
* libnautilus-private/nautilus-icon-container.c
(nautilus_icon_container_init),
(set_pending_icon_to_reveal): g_signal updates.
(nautilus_icon_container_new): remove visual
push/pop.
* libnautilus-private/nautilus-file.c
(nautilus_file_fit_date_as_string): upd. julian date get.
(nautilus_file_class_init): upd. marshallers.
* libnautilus-private/nautilus-file-operations.c
(extract_and_ellipsize_file_name_for_dialog): use
get_basename.
(nautilus_file_operations_copy_move): use gtk stock.
* libnautilus-private/nautilus-file-operations-progress.c
(nautilus_file_operations_progress_update): use
progress_bar_set_fraction.
(nautilus_file_operations_progress_init): prune
progress setup - these are the defaults.
* libnautilus-private/nautilus-entry.c
(nautilus_entry_key_press): upd select_region.
* libnautilus-private/nautilus-drag-window.c
(get_ancestor_blocked_by): upd type_is_a.
* libnautilus-private/nautilus-dnd.c
(nautilus_drag_finalize),
(nautilus_drag_init): g_object ref upd.
* libnautilus-private/nautilus-directory.c
(nautilus_directory_class_init): marshaller upd..
(nautilus_directory_schedule_metadata_remove),
(nautilus_directory_schedule_metadata_copy),
(nautilus_directory_schedule_metadata_move):
basename upd.
* libnautilus-private/nautilus-directory-background.c
(desktop_background_realized): g_signal upd.
(theme_image_path_to_uri): file test upd.
(image_loading_done_callback): object unref on gc & pixmap.
(background_changed_callback): g_signal upd.
* libnautilus-private/nautilus-bookmark.c
(nautilus_bookmark_disconnect_file): g_signal upd.
(nautilus_bookmark_uri_known_not_to_exist): upd
file test.
* libnautilus-private/nautilus-authn-manager.c
(authentication_dialog_button_clicked): use
GTK_RESPONSE_OK
* libnautilus-private/Makefile.am: add deprc.
CFLAGS.
* libnautilus/Makefile.am: ditto.
* configure.in (DISABLE_DEPRECATED_CFLAGS): add.
2002-02-13 Michael Meeks <michael@ximian.com>
* libnautilus-private/nautilus-icon-dnd.c
(nautilus_icon_container_free_drag_data):
re-enterancy protection.
Diffstat (limited to 'libnautilus-private')
31 files changed, 430 insertions, 311 deletions
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am index 7b8be6878..f9be570d3 100644 --- a/libnautilus-private/Makefile.am +++ b/libnautilus-private/Makefile.am @@ -6,6 +6,7 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ $(CORE_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ -DDATADIR=\""$(datadir)"\" \ -DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" \ $(NULL) diff --git a/libnautilus-private/nautilus-authn-manager.c b/libnautilus-private/nautilus-authn-manager.c index d4e9061fd..114520949 100644 --- a/libnautilus-private/nautilus-authn-manager.c +++ b/libnautilus-private/nautilus-authn-manager.c @@ -124,7 +124,7 @@ authentication_dialog_button_clicked (GtkDialog *dialog, { DEBUG_MSG (("+%s button: %d\n", G_GNUC_FUNCTION, button_number)); - if (button_number == GNOME_OK) { + if (button_number == GTK_RESPONSE_OK) { info->out_args->username = eel_password_dialog_get_username (EEL_PASSWORD_DIALOG (dialog)); info->out_args->password diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c index 0b6628b92..fd7b7bf11 100644 --- a/libnautilus-private/nautilus-bookmark.c +++ b/libnautilus-private/nautilus-bookmark.c @@ -472,9 +472,10 @@ nautilus_bookmark_disconnect_file (NautilusBookmark *bookmark) g_assert (NAUTILUS_IS_BOOKMARK (bookmark)); if (bookmark->details->file != NULL) { - gtk_signal_disconnect_by_func (GTK_OBJECT (bookmark->details->file), - G_CALLBACK (bookmark_file_changed_callback), - bookmark); + g_signal_handlers_disconnect_by_func ( + bookmark->details->file, + G_CALLBACK (bookmark_file_changed_callback), + bookmark); nautilus_file_unref (bookmark->details->file); bookmark->details->file = NULL; } @@ -601,7 +602,8 @@ nautilus_bookmark_uri_known_not_to_exist (NautilusBookmark *bookmark) } /* Now check if the file exists (sync. call OK because it is local). */ - exists = g_file_exists (path_name); + exists = g_file_test (path_name, G_FILE_TEST_EXISTS); g_free (path_name); + return !exists; } diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index d906c61c6..91c8307b9 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -69,9 +69,10 @@ desktop_background_realized (NautilusIconContainer *icon_container, void *discon EelBackground *background; if ((gboolean) GPOINTER_TO_INT (disconnect_signal)) { - gtk_signal_disconnect_by_func (GTK_OBJECT (icon_container), - G_CALLBACK (desktop_background_realized), - disconnect_signal); + g_signal_handlers_disconnect_by_func ( + icon_container, + G_CALLBACK (desktop_background_realized), + disconnect_signal); } background = eel_get_widget_background (GTK_WIDGET (icon_container)); @@ -154,7 +155,7 @@ theme_image_path_to_uri (char *image_file, const char *theme_name) image_path = g_strdup_printf ("%s/%s", NAUTILUS_DATADIR, image_file); } - if (image_path && g_file_exists (image_path)) { + if (image_path && g_file_test (image_path, G_FILE_TEST_EXISTS)) { image_uri = gnome_vfs_get_uri_from_local_path (image_path); } else { image_uri = NULL; @@ -519,7 +520,9 @@ nautilus_file_background_event_filter (GdkXEvent *gdk_xevent, GdkEvent *event, g static void desktop_background_destroyed_callback (EelBackground *background, void *georgeWBush) { - gdk_window_remove_filter (GDK_ROOT_PARENT(), nautilus_file_background_event_filter, background); + gdk_window_remove_filter ( + gdk_get_default_root_window (), + nautilus_file_background_event_filter, background); } static void @@ -528,7 +531,9 @@ nautilus_file_background_receive_root_window_changes (EelBackground *background) XWindowAttributes attribs = { 0 }; /* set up a filter on the root window to get notified about property changes */ - gdk_window_add_filter (GDK_ROOT_PARENT(), nautilus_file_background_event_filter, background); + gdk_window_add_filter ( + gdk_get_default_root_window (), + nautilus_file_background_event_filter, background); gdk_error_trap_push (); @@ -640,9 +645,10 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load GdkWindow *background_window; if ((gboolean) GPOINTER_TO_INT (disconnect_signal)) { - gtk_signal_disconnect_by_func (GTK_OBJECT (background), - G_CALLBACK (image_loading_done_callback), - disconnect_signal); + g_signal_handlers_disconnect_by_func + (background, + G_CALLBACK (image_loading_done_callback), + disconnect_signal); } width = gdk_screen_width (); @@ -651,7 +657,7 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load pixmap = make_root_pixmap (width, height); gc = gdk_gc_new (pixmap); eel_background_draw_to_drawable (background, pixmap, gc, 0, 0, width, height, width, height); - gdk_gc_unref (gc); + g_object_unref (gc); set_root_pixmap (pixmap); @@ -662,7 +668,7 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load #endif } - gdk_pixmap_unref (pixmap); + g_object_unref (pixmap); } static void @@ -753,9 +759,8 @@ background_changed_callback (EelBackground *background, /* Block the other handler while we are writing metadata so it doesn't * try to change the background. */ - gtk_signal_handler_block_by_func (GTK_OBJECT (file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_block_by_func ( + file, G_CALLBACK (saved_settings_changed_callback), background); nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR, @@ -768,9 +773,8 @@ background_changed_callback (EelBackground *background, image); /* Unblock the handler. */ - gtk_signal_handler_unblock_by_func (GTK_OBJECT (file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_unblock_by_func ( + file, G_CALLBACK (saved_settings_changed_callback), background); } g_free (color); @@ -816,9 +820,10 @@ initialize_background_from_settings (NautilusFile *file, /* Block the other handler while we are responding to changes * in the metadata so it doesn't try to change the metadata. */ - gtk_signal_handler_block_by_func (GTK_OBJECT (background), - G_CALLBACK (background_changed_callback), - file); + g_signal_handlers_block_by_func + (background, + G_CALLBACK (background_changed_callback), + file); eel_background_set_color (background, color); if (background_is_desktop(background)) { @@ -830,9 +835,10 @@ initialize_background_from_settings (NautilusFile *file, eel_background_set_image_placement (background, placement); /* Unblock the handler. */ - gtk_signal_handler_unblock_by_func (GTK_OBJECT (background), - G_CALLBACK (background_changed_callback), - file); + g_signal_handlers_unblock_by_func + (background, + G_CALLBACK (background_changed_callback), + file); g_free (color); g_free (image); @@ -867,7 +873,7 @@ nautilus_file_background_theme_changed (gpointer user_data) /* handle the background reset signal by setting values from the current theme */ static void background_reset_callback (EelBackground *background, - NautilusFile *file) + NautilusFile *file) { if (background_is_desktop (background)) { nautilus_file_background_write_desktop_default_settings (); @@ -875,9 +881,10 @@ background_reset_callback (EelBackground *background, /* Block the other handler while we are writing metadata so it doesn't * try to change the background. */ - gtk_signal_handler_block_by_func (GTK_OBJECT (file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_block_by_func ( + file, + G_CALLBACK (saved_settings_changed_callback), + background); /* reset the metadata */ nautilus_file_set_metadata (file, @@ -890,9 +897,10 @@ background_reset_callback (EelBackground *background, NULL, NULL); /* Unblock the handler. */ - gtk_signal_handler_unblock_by_func (GTK_OBJECT (file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_unblock_by_func ( + file, + G_CALLBACK (saved_settings_changed_callback), + background); } saved_settings_changed_callback (file, background); @@ -903,9 +911,10 @@ static void background_destroyed_callback (EelBackground *background, NautilusFile *file) { - gtk_signal_disconnect_by_func (GTK_OBJECT (file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_disconnect_by_func ( + file, + G_CALLBACK (saved_settings_changed_callback), + background); nautilus_file_monitor_remove (file, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_file_background_theme_changed, @@ -933,18 +942,22 @@ nautilus_connect_background_to_file_metadata (GtkWidget *widget, /* Disconnect old signal handlers. */ if (old_file != NULL) { g_assert (NAUTILUS_IS_FILE (old_file)); - gtk_signal_disconnect_by_func (GTK_OBJECT (background), - G_CALLBACK (background_changed_callback), - old_file); - gtk_signal_disconnect_by_func (GTK_OBJECT (background), - G_CALLBACK (background_destroyed_callback), - old_file); - gtk_signal_disconnect_by_func (GTK_OBJECT (background), - G_CALLBACK (background_reset_callback), - old_file); - gtk_signal_disconnect_by_func (GTK_OBJECT (old_file), - G_CALLBACK (saved_settings_changed_callback), - background); + g_signal_handlers_disconnect_by_func + (background, + G_CALLBACK (background_changed_callback), + old_file); + g_signal_handlers_disconnect_by_func + (background, + G_CALLBACK (background_destroyed_callback), + old_file); + g_signal_handlers_disconnect_by_func + (background, + G_CALLBACK (background_reset_callback), + old_file); + g_signal_handlers_disconnect_by_func + (old_file, + G_CALLBACK (saved_settings_changed_callback), + background); nautilus_file_monitor_remove (old_file, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_file_background_theme_changed, diff --git a/libnautilus-private/nautilus-directory-metafile.c b/libnautilus-private/nautilus-directory-metafile.c index 985db1cc8..a87384375 100644 --- a/libnautilus-private/nautilus-directory-metafile.c +++ b/libnautilus-private/nautilus-directory-metafile.c @@ -366,10 +366,9 @@ nautilus_directory_get_boolean_file_metadata (NautilusDirectory *directory, (directory, file_name, key, default_metadata ? "true" : "false"); - g_strdown (result_as_string); - if (strcmp (result_as_string, "true") == 0) { + if (g_ascii_strcasecmp (result_as_string, "true") == 0) { result = TRUE; - } else if (strcmp (result_as_string, "false") == 0) { + } else if (g_ascii_strcasecmp (result_as_string, "false") == 0) { result = FALSE; } else { if (result_as_string != NULL) { diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index e45e71ff9..d66d945c8 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -90,7 +90,7 @@ nautilus_directory_class_init (NautilusDirectoryClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusDirectoryClass, files_added), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[FILES_CHANGED] = g_signal_new ("files_changed", @@ -98,7 +98,7 @@ nautilus_directory_class_init (NautilusDirectoryClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusDirectoryClass, files_changed), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[DONE_LOADING] = g_signal_new ("done_loading", @@ -106,7 +106,7 @@ nautilus_directory_class_init (NautilusDirectoryClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusDirectoryClass, done_loading), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[LOAD_ERROR] = g_signal_new ("load_error", @@ -114,7 +114,7 @@ nautilus_directory_class_init (NautilusDirectoryClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusDirectoryClass, load_error), NULL, NULL, - gtk_marshal_VOID__INT, + g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); klass->get_name_for_self_as_new_file = real_get_name_for_self_as_new_file; @@ -1301,7 +1301,7 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs) GList *p; URIPair *pair; NautilusDirectory *source_directory, *destination_directory; - const char *source_relative_uri, *destination_relative_uri; + char *source_relative_uri, *destination_relative_uri; for (p = uri_pairs; p != NULL; p = p->next) { pair = (URIPair *) p->data; @@ -1309,13 +1309,16 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs) source_directory = get_parent_directory (pair->from_uri); destination_directory = get_parent_directory (pair->to_uri); - source_relative_uri = g_basename (pair->from_uri); - destination_relative_uri = g_basename (pair->to_uri); + source_relative_uri = g_path_get_basename (pair->from_uri); + destination_relative_uri = g_path_get_basename (pair->to_uri); nautilus_directory_copy_file_metadata (source_directory, source_relative_uri, destination_directory, destination_relative_uri); + + g_free (source_relative_uri); + g_free (destination_relative_uri); nautilus_directory_unref (source_directory); nautilus_directory_unref (destination_directory); @@ -1328,7 +1331,7 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs) GList *p; URIPair *pair; NautilusDirectory *source_directory, *destination_directory; - const char *source_relative_uri, *destination_relative_uri; + char *source_relative_uri, *destination_relative_uri; for (p = uri_pairs; p != NULL; p = p->next) { pair = (URIPair *) p->data; @@ -1336,8 +1339,8 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs) source_directory = get_parent_directory (pair->from_uri); destination_directory = get_parent_directory (pair->to_uri); - source_relative_uri = g_basename (pair->from_uri); - destination_relative_uri = g_basename (pair->to_uri); + source_relative_uri = g_path_get_basename (pair->from_uri); + destination_relative_uri = g_path_get_basename (pair->to_uri); nautilus_directory_copy_file_metadata (source_directory, source_relative_uri, @@ -1346,6 +1349,9 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs) nautilus_directory_remove_file_metadata (source_directory, source_relative_uri); + g_free (source_relative_uri); + g_free (destination_relative_uri); + nautilus_directory_unref (source_directory); nautilus_directory_unref (destination_directory); } @@ -1357,16 +1363,18 @@ nautilus_directory_schedule_metadata_remove (GList *uris) GList *p; const char *uri; NautilusDirectory *directory; - const char *relative_uri; + char *relative_uri; for (p = uris; p != NULL; p = p->next) { uri = (const char *) p->data; directory = get_parent_directory (uri); - relative_uri = g_basename (uri); + relative_uri = g_path_get_basename (uri); nautilus_directory_remove_file_metadata (directory, relative_uri); + + g_free (relative_uri); nautilus_directory_unref (directory); } diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c index d6289d8e3..209585255 100644 --- a/libnautilus-private/nautilus-dnd.c +++ b/libnautilus-private/nautilus-dnd.c @@ -67,15 +67,16 @@ #define MAX_AUTOSCROLL_DELTA 50 void -nautilus_drag_init (NautilusDragInfo *drag_info, - const GtkTargetEntry *drag_types, int drag_type_count, - GdkBitmap *stipple) +nautilus_drag_init (NautilusDragInfo *drag_info, + const GtkTargetEntry *drag_types, + int drag_type_count, + GdkBitmap *stipple) { drag_info->target_list = gtk_target_list_new (drag_types, drag_type_count); if (stipple != NULL) { - drag_info->stipple = gdk_bitmap_ref (stipple); + drag_info->stipple = g_object_ref (stipple); } drag_info->drop_occured = FALSE; @@ -89,7 +90,7 @@ nautilus_drag_finalize (NautilusDragInfo *drag_info) nautilus_drag_destroy_selection_list (drag_info->selection_list); if (drag_info->stipple != NULL) { - gdk_bitmap_unref (drag_info->stipple); + g_object_unref (drag_info->stipple); } g_free (drag_info); diff --git a/libnautilus-private/nautilus-drag-window.c b/libnautilus-private/nautilus-drag-window.c index 756acaf90..2de0bd0c3 100644 --- a/libnautilus-private/nautilus-drag-window.c +++ b/libnautilus-private/nautilus-drag-window.c @@ -65,18 +65,19 @@ static Atom sawfish_wm_raise_window = 0; */ static GtkWidget * get_ancestor_blocked_by (GtkWidget *widget, - GtkType widget_type, - GtkType blocking_type) + GType widget_type, + GType blocking_type) { - g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); while (widget != NULL) { - if (gtk_type_is_a (GTK_WIDGET_TYPE (widget), widget_type)) + if (g_type_is_a (GTK_WIDGET_TYPE (widget), widget_type)) return widget; - else if (gtk_type_is_a (GTK_WIDGET_TYPE (widget), blocking_type)) + + else if (g_type_is_a (GTK_WIDGET_TYPE (widget), blocking_type)) return NULL; + widget = widget->parent; } diff --git a/libnautilus-private/nautilus-entry.c b/libnautilus-private/nautilus-entry.c index 937a57690..fee8e963a 100644 --- a/libnautilus-private/nautilus-entry.c +++ b/libnautilus-private/nautilus-entry.c @@ -139,7 +139,7 @@ nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event) */ if (entry->details->special_tab_handling && gtk_editable_get_selection_bounds (editable, NULL, NULL)) { position = strlen (gtk_entry_get_text (GTK_ENTRY (editable))); - gtk_entry_select_region (GTK_ENTRY (editable), position, position); + gtk_editable_select_region (editable, position, position); return TRUE; } break; @@ -424,7 +424,7 @@ nautilus_entry_class_init (NautilusEntryClass *class) G_STRUCT_OFFSET (NautilusEntryClass, user_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[SELECTION_CHANGED] = g_signal_new ("selection_changed", @@ -433,7 +433,7 @@ nautilus_entry_class_init (NautilusEntryClass *class) G_STRUCT_OFFSET (NautilusEntryClass, selection_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } diff --git a/libnautilus-private/nautilus-file-operations-progress.c b/libnautilus-private/nautilus-file-operations-progress.c index e706edb69..5e65ca143 100644 --- a/libnautilus-private/nautilus-file-operations-progress.c +++ b/libnautilus-private/nautilus-file-operations-progress.c @@ -97,10 +97,10 @@ nautilus_file_operations_progress_update (NautilusFileOperationsProgress *progre return; } - gtk_progress_configure (GTK_PROGRESS (progress->details->progress_bar), - progress->details->bytes_copied, - 0.0, - progress->details->bytes_total); + gtk_progress_bar_set_fraction + (GTK_PROGRESS_BAR (progress->details->progress_bar), + (double) progress->details->bytes_copied / + progress->details->bytes_total); } static void @@ -240,11 +240,9 @@ nautilus_file_operations_progress_init (NautilusFileOperationsProgress *progress /* progress bar */ progress->details->progress_bar = gtk_progress_bar_new (); - gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (progress->details->progress_bar), - GTK_PROGRESS_CONTINUOUS); - gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (progress->details->progress_bar), - GTK_PROGRESS_LEFT_TO_RIGHT); +#ifdef GNOME2_CONVERSION_COMPLETE gtk_widget_set_usize (progress->details->progress_bar, PROGRESS_BAR_WIDTH, -1); +#endif gtk_box_pack_start (vbox, progress->details->progress_bar, FALSE, TRUE, 0); gtk_widget_show (progress->details->progress_bar); diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 15e3965ac..195bdb670 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -25,6 +25,7 @@ */ #include <config.h> +#include <string.h> #include "nautilus-file-operations.h" #include "nautilus-file-operations-progress.h" @@ -269,15 +270,16 @@ format_and_ellipsize_uri_for_dialog (const char *uri) static char * extract_and_ellipsize_file_name_for_dialog (const char *uri) { - const char *last_part; + char *basename; char *unescaped, *result; - last_part = g_basename (uri); - g_return_val_if_fail (last_part != NULL, NULL); + basename = g_path_get_basename (uri); + g_return_val_if_fail (basename != NULL, NULL); - unescaped = gnome_vfs_unescape_string_for_display (last_part); + unescaped = gnome_vfs_unescape_string_for_display (basename); result = ellipsize_string_for_dialog (unescaped); g_free (unescaped); + g_free (basename); return result; } @@ -292,6 +294,8 @@ parent_for_error_dialog (TransferInfo *transfer_info) return transfer_info->parent_view; } +#ifdef GNOME2_CONVERSION_COMPLETE +/* This needs testing with a working WM - metacity ? */ static void fit_rect_on_screen (GdkRectangle *rect) { @@ -325,10 +329,12 @@ center_dialog_over_rect (GtkWindow *window, GdkRectangle rect) rect.y + rect.height / 2 - GTK_WIDGET (window)->allocation.height / 2); } +#endif static void center_dialog_over_window (GtkWindow *window, GtkWindow *over) { +#ifdef GNOME2_CONVERSION_COMPLETE GdkRectangle rect; int x, y, w, h; @@ -343,6 +349,15 @@ center_dialog_over_window (GtkWindow *window, GtkWindow *over) rect.height = h; center_dialog_over_rect (window, rect); +#endif + GdkGeometry geometry = { 0 }; + + geometry.win_gravity = GDK_GRAVITY_CENTER; + + gtk_window_set_geometry_hints (window, + GTK_WIDGET (over), + &geometry, + GDK_HINT_WIN_GRAVITY); } static void @@ -1968,7 +1983,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, FALSE, _("You cannot copy items into the Trash."), _("Can't Copy to Trash"), - GNOME_STOCK_BUTTON_OK, NULL, NULL); + GTK_STOCK_OK, NULL); result = GNOME_VFS_ERROR_NOT_PERMITTED; } } @@ -2002,7 +2017,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("Can't Change Trash Location") : _("Can't Copy Trash"), - GNOME_STOCK_BUTTON_OK, NULL, NULL); + GTK_STOCK_OK, NULL, NULL); result = GNOME_VFS_ERROR_NOT_PERMITTED; break; @@ -2029,7 +2044,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("Can't Move Into Self") : _("Can't Copy Into Self"), - GNOME_STOCK_BUTTON_OK, NULL, NULL); + GTK_STOCK_OK, NULL, NULL); result = GNOME_VFS_ERROR_NOT_PERMITTED; break; @@ -2042,7 +2057,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, FALSE, _("You cannot copy a file over itself."), _("Can't Copy Over Self"), - GNOME_STOCK_BUTTON_OK, NULL, NULL); + GTK_STOCK_OK, NULL, NULL); result = GNOME_VFS_ERROR_NOT_PERMITTED; break; @@ -2302,7 +2317,7 @@ confirm_empty_trash (GtkWidget *parent_view) "all of the items in the Trash?"), _("Delete Trash Contents?"), _("Empty"), - GNOME_STOCK_BUTTON_CANCEL, + GTK_STOCK_CANCEL, parent_window); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CANCEL); diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c index 19d2a8f67..357ddeca8 100644 --- a/libnautilus-private/nautilus-file-utilities.c +++ b/libnautilus-private/nautilus-file-utilities.c @@ -111,7 +111,7 @@ nautilus_get_user_directory (void) user_directory = nautilus_make_path (g_get_home_dir (), NAUTILUS_USER_DIRECTORY_NAME); - if (!g_file_exists (user_directory)) { + if (!g_file_test (user_directory, G_FILE_TEST_EXISTS)) { mkdir (user_directory, DEFAULT_NAUTILUS_DIRECTORY_MODE); /* FIXME bugzilla.gnome.org 41286: * How should we handle the case where this mkdir fails? @@ -141,7 +141,7 @@ nautilus_get_desktop_directory (void) desktop_directory = g_strdup (g_get_home_dir()); } else { desktop_directory = nautilus_get_gmc_desktop_directory (); - if (!g_file_exists (desktop_directory)) { + if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS)) { mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE); /* FIXME bugzilla.gnome.org 41286: * How should we handle the case where this mkdir fails? @@ -192,7 +192,7 @@ nautilus_pixmap_file (const char *partial_path) char *path; path = nautilus_make_path (DATADIR "/pixmaps/nautilus", partial_path); - if (g_file_exists (path)) { + if (g_file_test (path, G_FILE_TEST_EXISTS)) { return path; } g_free (path); @@ -209,14 +209,14 @@ nautilus_get_data_file_path (const char *partial_path) user_directory = nautilus_get_user_directory (); path = nautilus_make_path (user_directory, partial_path); g_free (user_directory); - if (g_file_exists (path)) { + if (g_file_test (path, G_FILE_TEST_EXISTS)) { return path; } g_free (path); /* next try the shared directory */ path = nautilus_make_path (NAUTILUS_DATADIR, partial_path); - if (g_file_exists (path)) { + if (g_file_test (path, G_FILE_TEST_EXISTS)) { return path; } g_free (path); diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index 5f52a2021..9ef482a60 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -2451,7 +2451,8 @@ nautilus_file_fit_date_as_string (NautilusFile *file, g_date_set_time (today, time (NULL)); /* Overflow results in a large number; fine for our purposes. */ - file_date_age = g_date_julian (today) - g_date_julian (file_date); + file_date_age = (g_date_get_julian (today) - + g_date_get_julian (file_date)); g_date_free (file_date); g_date_free (today); @@ -5041,7 +5042,7 @@ nautilus_file_class_init (NautilusFileClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusFileClass, changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[UPDATED_DEEP_COUNT_IN_PROGRESS] = @@ -5050,7 +5051,7 @@ nautilus_file_class_init (NautilusFileClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusFileClass, updated_deep_count_in_progress), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } diff --git a/libnautilus-private/nautilus-find-icon-image.c b/libnautilus-private/nautilus-find-icon-image.c index 70128ee89..76f8a5897 100644 --- a/libnautilus-private/nautilus-find-icon-image.c +++ b/libnautilus-private/nautilus-find-icon-image.c @@ -68,13 +68,13 @@ make_full_icon_path (const char *path, g_free (user_directory); g_free (themes_directory); - if (!g_file_exists (full_path)) { + if (!g_file_test (full_path, G_FILE_TEST_EXISTS)) { g_free (full_path); full_path = NULL; } } else if (document_type_icon) { full_path = nautilus_make_path (DATADIR "/pixmaps/document-icons/", partial_path); - if (!g_file_exists (full_path)) { + if (!g_file_test (full_path, G_FILE_TEST_EXISTS)) { g_free (full_path); full_path = NULL; } @@ -310,7 +310,7 @@ get_user_emblem_path (const char *name, guint icon_size) user_directory, name + strlen (NAUTILUS_EMBLEM_NAME_PREFIX), icon_file_name_suffixes[i]); - if (g_file_exists (path)) { + if (g_file_test (path, G_FILE_TEST_EXISTS)) { break; } g_free (path); diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c index 2d0185080..992cb6532 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.c +++ b/libnautilus-private/nautilus-icon-canvas-item.c @@ -60,10 +60,6 @@ #define MAX_TEXT_WIDTH_STANDARD 135 #define MAX_TEXT_WIDTH_TIGHTER 80 -/* The list of characters that cause line breaks can be localized. */ -static const char untranslated_line_break_characters[] = N_(" -_,;.?/&"); -#define LINE_BREAK_CHARACTERS _(untranslated_line_break_characters) - /* Private part of the NautilusIconCanvasItem structure. */ struct NautilusIconCanvasItemDetails { /* The image, text, font. */ @@ -106,13 +102,13 @@ struct NautilusIconCanvasItemDetails { /* Object argument IDs. */ enum { - ARG_0, - ARG_EDITABLE_TEXT, - ARG_ADDITIONAL_TEXT, - ARG_HIGHLIGHTED_FOR_SELECTION, - ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS, - ARG_HIGHLIGHTED_FOR_DROP, - ARG_MODIFIER, + PROP_0, + PROP_EDITABLE_TEXT, + PROP_ADDITIONAL_TEXT, + PROP_HIGHLIGHTED_FOR_SELECTION, + PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS, + PROP_HIGHLIGHTED_FOR_DROP, + PROP_MODIFIER, }; typedef enum { @@ -139,9 +135,6 @@ enum { static guint signals[LAST_SIGNAL]; static gboolean antialias_selection_rectangle = TRUE; -static guint32 highlight_background_color = EEL_RGBA_COLOR_PACK (0x00, 0x00, 0x00, 0xFF); -static guint32 highlight_text_color = EEL_RGBA_COLOR_PACK (0xFF, 0xFF, 0xFF, 0xFF); -static guint32 highlight_text_info_color = EEL_RGBA_COLOR_PACK (0xCC, 0xCC, 0xCC, 0xFF); static int click_policy_auto_value; @@ -263,59 +256,64 @@ nautilus_icon_canvas_item_invalidate_label_size (NautilusIconCanvasItem *item) } } -/* Set_arg handler for the icon item. */ +/* Set property handler for the icon item. */ static void -nautilus_icon_canvas_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_icon_canvas_item_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { NautilusIconCanvasItem *item; NautilusIconCanvasItemDetails *details; - item = NAUTILUS_ICON_CANVAS_ITEM (object); + item = NAUTILUS_ICON_CANVAS_ITEM (object); details = item->details; - switch (arg_id) { + switch (property_id) { - case ARG_EDITABLE_TEXT: - if (eel_strcmp (details->editable_text, GTK_VALUE_STRING (*arg)) == 0) { + case PROP_EDITABLE_TEXT: + if (eel_strcmp (details->editable_text, + g_value_get_string (value)) == 0) { return; } g_free (details->editable_text); - details->editable_text = g_strdup (GTK_VALUE_STRING (*arg)); + details->editable_text = g_strdup (g_value_get_string (value)); nautilus_icon_canvas_item_invalidate_label_size (item); break; - case ARG_ADDITIONAL_TEXT: - if (eel_strcmp (details->additional_text, GTK_VALUE_STRING (*arg)) == 0) { + case PROP_ADDITIONAL_TEXT: + if (eel_strcmp (details->additional_text, + g_value_get_string (value)) == 0) { return; } g_free (details->additional_text); - details->additional_text = g_strdup (GTK_VALUE_STRING (*arg)); + details->additional_text = g_strdup (g_value_get_string (value)); nautilus_icon_canvas_item_invalidate_label_size (item); break; - case ARG_HIGHLIGHTED_FOR_SELECTION: - if (!details->is_highlighted_for_selection == !GTK_VALUE_BOOL (*arg)) { + case PROP_HIGHLIGHTED_FOR_SELECTION: + if (!details->is_highlighted_for_selection == !g_value_get_boolean (value)) { return; } - details->is_highlighted_for_selection = GTK_VALUE_BOOL (*arg); + details->is_highlighted_for_selection = g_value_get_boolean (value); break; - case ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS: - if (!details->is_highlighted_as_keyboard_focus == !GTK_VALUE_BOOL (*arg)) { + case PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS: + if (!details->is_highlighted_as_keyboard_focus == !g_value_get_boolean (value)) { return; } - details->is_highlighted_as_keyboard_focus = GTK_VALUE_BOOL (*arg); + details->is_highlighted_as_keyboard_focus = g_value_get_boolean (value); break; - case ARG_HIGHLIGHTED_FOR_DROP: - if (!details->is_highlighted_for_drop == !GTK_VALUE_BOOL (*arg)) { + case PROP_HIGHLIGHTED_FOR_DROP: + if (!details->is_highlighted_for_drop == !g_value_get_boolean (value)) { return; } - details->is_highlighted_for_drop = GTK_VALUE_BOOL (*arg); + details->is_highlighted_for_drop = g_value_get_boolean (value); break; default: @@ -326,38 +324,41 @@ nautilus_icon_canvas_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (object)); } -/* Get_arg handler for the icon item */ +/* Get property handler for the icon item */ static void -nautilus_icon_canvas_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_icon_canvas_item_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) { NautilusIconCanvasItemDetails *details; details = NAUTILUS_ICON_CANVAS_ITEM (object)->details; - switch (arg_id) { + switch (property_id) { - case ARG_EDITABLE_TEXT: - GTK_VALUE_STRING (*arg) = g_strdup (details->editable_text); + case PROP_EDITABLE_TEXT: + g_value_set_string (value, details->editable_text); break; - case ARG_ADDITIONAL_TEXT: - GTK_VALUE_STRING (*arg) = g_strdup (details->additional_text); + case PROP_ADDITIONAL_TEXT: + g_value_set_string (value, details->additional_text); break; - case ARG_HIGHLIGHTED_FOR_SELECTION: - GTK_VALUE_BOOL (*arg) = details->is_highlighted_for_selection; + case PROP_HIGHLIGHTED_FOR_SELECTION: + g_value_set_boolean (value, details->is_highlighted_for_selection); break; - case ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS: - GTK_VALUE_BOOL (*arg) = details->is_highlighted_as_keyboard_focus; + case PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS: + g_value_set_boolean (value, details->is_highlighted_as_keyboard_focus); break; - case ARG_HIGHLIGHTED_FOR_DROP: - GTK_VALUE_BOOL (*arg) = details->is_highlighted_for_drop; + case PROP_HIGHLIGHTED_FOR_DROP: + g_value_set_boolean (value, details->is_highlighted_for_drop); break; default: - arg->type = G_TYPE_INVALID; + g_warning ("invalid property %d", property_id); break; } } @@ -576,7 +577,7 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, GnomeCanvasItem *canvas_item; GdkPixbuf *selection_pixbuf; PangoLayout *layout; - guint32 label_color; + GdkColor *label_color; int layout_width, layout_height; int icon_width; gboolean have_editable, have_additional, needs_highlight; @@ -631,6 +632,8 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, height_so_far = 0; max_text_width = floor (nautilus_icon_canvas_item_get_max_text_width (item)); + + container = NAUTILUS_ICON_CONTAINER (GNOME_CANVAS_ITEM (item)->canvas); /* if the icon is highlighted, do some set-up */ if (needs_highlight && drawable != NULL && !details->is_renaming && @@ -641,17 +644,16 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, 8, details->text_width, details->text_height); - container = NAUTILUS_ICON_CONTAINER (GNOME_CANVAS_ITEM (item)->canvas); eel_gdk_pixbuf_fill_rectangle_with_color (selection_pixbuf, eel_gdk_pixbuf_whole_pixbuf, - container->details->highlight_color); + container->details->highlight_color_rgba); clear_rounded_corners (selection_pixbuf, container->details->highlight_frame, 5); draw_pixbuf (selection_pixbuf, drawable, icon_left + (icon_width - details->text_width) / 2, icon_bottom); g_object_unref (selection_pixbuf); } else { - gdk_rgb_gc_set_foreground (gc, highlight_background_color); + gdk_gc_set_foreground (gc, &container->details->highlight_color); gdk_draw_rectangle (drawable, GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas)->style->black_gc, TRUE, @@ -666,13 +668,11 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, layout = get_label_layout (&details->editable_text_layout, item, details->editable_text); if (drawable != NULL) { - if (needs_highlight) { - label_color = highlight_text_color; - } else { - label_color = nautilus_icon_container_get_label_color (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), TRUE); - } + label_color = nautilus_icon_container_get_label_color + (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), + TRUE, needs_highlight); - gdk_rgb_gc_set_foreground (gc, label_color); + gdk_gc_set_foreground (gc, label_color); draw_label_layout (item, drawable, layout, needs_highlight, @@ -692,13 +692,11 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, layout = get_label_layout (&details->additional_text_layout, item, details->additional_text); if (drawable != NULL) { - if (needs_highlight) { - label_color = highlight_text_info_color; - } else { - label_color = nautilus_icon_container_get_label_color (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), FALSE); - } + label_color = nautilus_icon_container_get_label_color + (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), + FALSE, needs_highlight); - gdk_rgb_gc_set_foreground (gc, label_color); + gdk_gc_set_foreground (gc, label_color); draw_label_layout (item, drawable, layout, needs_highlight, @@ -818,7 +816,7 @@ draw_stretch_handles (NautilusIconCanvasItem *item, GdkDrawable *drawable, g_free (knob_filename); g_object_unref (knob_pixbuf); - gdk_gc_unref (gc); + g_object_unref (gc); } static void @@ -1668,27 +1666,56 @@ nautilus_icon_canvas_item_get_max_text_width (NautilusIconCanvasItem *item) static void nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; GnomeCanvasItemClass *item_class; - object_class = GTK_OBJECT_CLASS (class); + object_class = G_OBJECT_CLASS (class); item_class = GNOME_CANVAS_ITEM_CLASS (class); - gtk_object_add_arg_type ("NautilusIconCanvasItem::editable_text", - G_TYPE_STRING, GTK_ARG_READWRITE, ARG_EDITABLE_TEXT); - gtk_object_add_arg_type ("NautilusIconCanvasItem::additional_text", - G_TYPE_STRING, GTK_ARG_READWRITE, ARG_ADDITIONAL_TEXT); - gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_for_selection", - G_TYPE_BOOLEAN, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_FOR_SELECTION); - gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_as_keyboard_focus", - G_TYPE_BOOLEAN, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS); - gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_for_drop", - G_TYPE_BOOLEAN, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_FOR_DROP); - - G_OBJECT_CLASS (class)->finalize = nautilus_icon_canvas_item_finalize; - - object_class->set_arg = nautilus_icon_canvas_item_set_arg; - object_class->get_arg = nautilus_icon_canvas_item_get_arg; + object_class->finalize = nautilus_icon_canvas_item_finalize; + object_class->set_property = nautilus_icon_canvas_item_set_property; + object_class->get_property = nautilus_icon_canvas_item_get_property; + + g_object_class_install_property ( + object_class, + PROP_EDITABLE_TEXT, + g_param_spec_string ("editable_text", + _("editable text"), + _("the editable label"), + "", G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_ADDITIONAL_TEXT, + g_param_spec_string ("additional_text", + _("additional text"), + _("some more text"), + "", G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HIGHLIGHTED_FOR_SELECTION, + g_param_spec_boolean ("highlighted_for_selection", + _("highlighted for selection"), + _("whether we are highlighted for a selection"), + FALSE, G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS, + g_param_spec_boolean ("highlighted_as_keyboard_focus", + _("highlighted as keyboard focus"), + _("whether we are highlighted to render keyboard focus"), + FALSE, G_PARAM_READWRITE)); + + + g_object_class_install_property ( + object_class, + PROP_HIGHLIGHTED_FOR_DROP, + g_param_spec_boolean ("highlighted_for_drop", + _("highlighted for drop"), + _("whether we are highlighted for a D&D drop"), + FALSE, G_PARAM_READWRITE)); signals[BOUNDS_CHANGED] = g_signal_new ("bounds_changed", @@ -1697,7 +1724,7 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class) G_STRUCT_OFFSET (NautilusIconCanvasItemClass, bounds_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); item_class->update = nautilus_icon_canvas_item_update; diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index 433156c04..f256557bf 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -445,14 +445,16 @@ set_pending_icon_to_reveal (NautilusIconContainer *container, NautilusIcon *icon } if (cur_pending != NULL) { - gtk_signal_disconnect_by_func (GTK_OBJECT (cur_pending->item), - G_CALLBACK (pending_icon_to_reveal_destroy_callback), - container); + g_signal_handlers_disconnect_by_func ( + cur_pending->item, + G_CALLBACK (pending_icon_to_reveal_destroy_callback), + container); } if (icon != NULL) { g_signal_connect (icon->item, "destroy", - G_CALLBACK (pending_icon_to_reveal_destroy_callback), container); + G_CALLBACK (pending_icon_to_reveal_destroy_callback), + container); } container->details->pending_icon_to_reveal = icon; @@ -2363,6 +2365,33 @@ size_allocate (GtkWidget *widget, } static void +alloc_colors (NautilusIconContainer *container) +{ + GtkWidget *widget = GTK_WIDGET (container); + + gdk_colormap_alloc_color ( + gtk_widget_get_colormap (widget), + &container->details->highlight_color, + TRUE, TRUE); + gdk_colormap_alloc_color ( + gtk_widget_get_colormap (widget), + &container->details->label_color, + TRUE, TRUE); + g_assert (gdk_colormap_alloc_color ( + gtk_widget_get_colormap (widget), + &container->details->label_color_highlight, + TRUE, TRUE)); + g_assert (gdk_colormap_alloc_color ( + gtk_widget_get_colormap (widget), + &container->details->label_info_color, + TRUE, TRUE)); + g_assert (gdk_colormap_alloc_color ( + gtk_widget_get_colormap (widget), + &container->details->label_info_color_highlight, + TRUE, TRUE)); +} + +static void realize (GtkWidget *widget) { GtkStyle *style; @@ -2386,6 +2415,8 @@ realize (GtkWidget *widget) g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget))); window = GTK_WINDOW (gtk_widget_get_toplevel (widget)); gtk_window_set_focus (window, widget); + + alloc_colors (NAUTILUS_ICON_CONTAINER (widget)); } static void @@ -3016,7 +3047,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, selection_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[BUTTON_PRESS] = g_signal_new ("button_press", @@ -3035,9 +3066,9 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, activate), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, - G_TYPE_POINTER); + G_TYPE_POINTER); signals[CONTEXT_CLICK_SELECTION] = g_signal_new ("context_click_selection", G_TYPE_FROM_CLASS (class), @@ -3045,9 +3076,9 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, context_click_selection), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, - G_TYPE_POINTER); + G_TYPE_POINTER); signals[CONTEXT_CLICK_BACKGROUND] = g_signal_new ("context_click_background", G_TYPE_FROM_CLASS (class), @@ -3055,7 +3086,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, context_click_background), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[MIDDLE_CLICK] @@ -3065,7 +3096,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, middle_click), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[ICON_POSITION_CHANGED] @@ -3097,7 +3128,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, icon_stretch_started), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[ICON_STRETCH_ENDED] @@ -3107,7 +3138,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, icon_stretch_ended), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[RENAMING_ICON] @@ -3117,7 +3148,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, renaming_icon), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[GET_ICON_IMAGES] @@ -3139,7 +3170,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, get_icon_text), NULL, NULL, - gtk_marshal_VOID__POINTER_POINTER_POINTER, + eel_marshal_VOID__POINTER_POINTER_POINTER, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, @@ -3253,7 +3284,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, layout_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[PREVIEW] = g_signal_new ("preview", @@ -3273,7 +3304,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, band_select_started), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[BAND_SELECT_ENDED] = g_signal_new ("band_select_ended", @@ -3282,7 +3313,7 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class) G_STRUCT_OFFSET (NautilusIconContainerClass, band_select_ended), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /* GtkWidget class. */ @@ -3332,24 +3363,20 @@ nautilus_icon_container_init (NautilusIconContainer *container) nautilus_icon_dnd_init (container, stipple); /* Make sure that we find out if the icons change. */ - gtk_signal_connect_object_while_alive + g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed", G_CALLBACK (nautilus_icon_container_request_update_all), - GTK_OBJECT (container)); + container, 0); /* when the background changes, we must set up the label text color */ background = eel_get_widget_background (GTK_WIDGET (container)); - gtk_signal_connect - (GTK_OBJECT (background), - "appearance_changed", - G_CALLBACK (update_label_color), - GTK_OBJECT (container)); - + g_signal_connect (background, "appearance_changed", + G_CALLBACK (update_label_color), container); g_signal_connect (container, "focus-out-event", - G_CALLBACK (handle_focus_out_event), NULL); + G_CALLBACK (handle_focus_out_event), NULL); /* FIXME: The code to extract colors from the theme should be * in FMDirectoryView, not here. The NautilusIconContainer @@ -3528,15 +3555,7 @@ item_event_callback (GnomeCanvasItem *item, GtkWidget * nautilus_icon_container_new (void) { - GtkWidget *container; - - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - container = gtk_widget_new (nautilus_icon_container_get_type (), NULL); - - gtk_widget_pop_colormap (); - - return container; + return gtk_widget_new (nautilus_icon_container_get_type (), NULL); } /* Clear all of the icons in the container. */ @@ -4693,9 +4712,10 @@ set_pending_icon_to_rename (NautilusIconContainer *container, NautilusIcon *icon } if (cur_pending != NULL) { - gtk_signal_disconnect_by_func (GTK_OBJECT (cur_pending->item), - G_CALLBACK (pending_icon_to_rename_destroy_callback), - container); + g_signal_handlers_disconnect_by_func + (cur_pending->item, + G_CALLBACK (pending_icon_to_rename_destroy_callback), + container); } if (icon != NULL) { @@ -4928,22 +4948,34 @@ nautilus_icon_container_set_single_click_mode (NautilusIconContainer *container, /* update the label color when the background changes */ -guint32 +GdkColor * nautilus_icon_container_get_label_color (NautilusIconContainer *container, - gboolean is_name) + gboolean is_name, + gboolean is_highlight) { + GtkStyle *style; + g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), 0); + style = gtk_widget_get_style (GTK_WIDGET (container)); + if (is_name) { - return container->details->label_color; + if (is_highlight) { + return &container->details->label_color_highlight; + } else { + return &container->details->label_color; + } } else { - return container->details->label_info_color; + if (is_highlight) { + return &container->details->label_color_highlight; + } else { + return &container->details->label_info_color; + } } - } static void -update_label_color (EelBackground *background, +update_label_color (EelBackground *background, NautilusIconContainer *container) { char *light_info_color, *dark_info_color; @@ -4951,7 +4983,7 @@ update_label_color (EelBackground *background, g_assert (EEL_IS_BACKGROUND (background)); g_assert (NAUTILUS_IS_ICON_CONTAINER (container)); - + /* FIXME: The code to extract colors from the theme should be in FMDirectoryView, not here. * The NautilusIconContainer class should simply provide calls to set the colors. */ @@ -4973,12 +5005,19 @@ update_label_color (EelBackground *background, } if (eel_background_is_dark (background)) { - container->details->label_color = 0xEFEFEF; - container->details->label_info_color = light_info_value; - } else { - container->details->label_color = 0x000000; - container->details->label_info_color = dark_info_value; + container->details->label_color = eel_gdk_rgb_to_color (0xEFEFEF); + container->details->label_color_highlight = eel_gdk_rgb_to_color (0x000000); + container->details->label_info_color = eel_gdk_rgb_to_color (light_info_value); + container->details->label_info_color_highlight = eel_gdk_rgb_to_color (dark_info_value); + } else { /* converse */ + container->details->label_color = eel_gdk_rgb_to_color (0x000000); + container->details->label_color_highlight = eel_gdk_rgb_to_color (0xEFEFEF); + container->details->label_info_color = eel_gdk_rgb_to_color (dark_info_value); + container->details->label_info_color_highlight = eel_gdk_rgb_to_color (light_info_value); } + + if (GTK_WIDGET_REALIZED (container)) + alloc_colors (container); } @@ -5045,11 +5084,13 @@ nautilus_icon_container_theme_changed (gpointer user_data) highlight_color_str = nautilus_theme_get_theme_data ("directory", "highlight_color_rgba"); if (highlight_color_str == NULL) { - container->details->highlight_color = EEL_RGBA_COLOR_PACK (0, 0, 0, 102); + container->details->highlight_color_rgba = EEL_RGBA_COLOR_PACK (0, 0, 0, 102); } else { - container->details->highlight_color = strtoul (highlight_color_str, NULL, 0); + container->details->highlight_color_rgba = strtoul (highlight_color_str, NULL, 0); g_free (highlight_color_str); } + container->details->highlight_color = eel_gdk_rgb_to_color ( + container->details->highlight_color_rgba); } #if ! defined (NAUTILUS_OMIT_SELF_CHECK) diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c index a9cc2e2d0..2c044c835 100644 --- a/libnautilus-private/nautilus-icon-dnd.c +++ b/libnautilus-private/nautilus-icon-dnd.c @@ -736,7 +736,11 @@ auto_scroll_timeout_callback (gpointer data) exposed_area.x -= widget->allocation.x; exposed_area.y -= widget->allocation.y; - gtk_widget_draw (widget, &exposed_area); + gtk_widget_queue_draw_area (widget, + exposed_area.x, + exposed_area.y, + exposed_area.width, + exposed_area.height); return TRUE; } @@ -1180,7 +1184,7 @@ nautilus_icon_container_free_drag_data (NautilusIconContainer *container) dnd_info = container->details->dnd_info; dnd_info->drag_info.got_drop_data_type = FALSE; - + if (dnd_info->shadow != NULL) { gtk_object_destroy (GTK_OBJECT (dnd_info->shadow)); dnd_info->shadow = NULL; diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index c723cb097..3d0461c8b 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -371,7 +371,7 @@ nautilus_icon_factory_class_init (NautilusIconFactoryClass *class) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); object_class->destroy = nautilus_icon_factory_destroy; @@ -661,7 +661,7 @@ is_theme_in_user_directory (const char *theme_name) themes_directory = nautilus_make_path (user_directory, "themes"); this_theme_directory = nautilus_make_path (themes_directory, theme_name); - result = g_file_exists (this_theme_directory); + result = g_file_test (this_theme_directory, G_FILE_TEST_EXISTS); g_free (user_directory); g_free (themes_directory); @@ -1901,7 +1901,7 @@ get_icon_from_cache (NautilusScalableIcon *scalable_icon, icon = NULL; } } - + if (icon == NULL) { /* Not in the table, so load the image. */ /* If we're picky, then we want the image only if this exact @@ -1948,7 +1948,7 @@ get_icon_from_cache (NautilusScalableIcon *scalable_icon, nautilus_scalable_icon_ref (scalable_icon); key->scalable_icon = scalable_icon; key->size = *size; - + /* Add the item to the hash table. */ g_assert (g_hash_table_lookup (hash_table, key) == NULL); g_hash_table_insert (hash_table, key, icon); diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h index 5c5036595..32838c502 100644 --- a/libnautilus-private/nautilus-icon-private.h +++ b/libnautilus-private/nautilus-icon-private.h @@ -169,11 +169,14 @@ struct NautilusIconContainerDetails { /* pixbuf and color for label highlighting */ GdkPixbuf *highlight_frame; - guint32 highlight_color; + GdkColor highlight_color; + guint32 highlight_color_rgba; /* color for text labels */ - guint32 label_color; - guint32 label_info_color; + GdkColor label_color; + GdkColor label_color_highlight; + GdkColor label_info_color; + GdkColor label_info_color_highlight; /* State used so arrow keys don't wander if icons aren't lined up. * Keeps track of last axis arrow key was used on. @@ -239,7 +242,8 @@ gboolean nautilus_icon_container_scroll (NautilusIconC void nautilus_icon_container_update_scroll_region (NautilusIconContainer *container); /* label color for items */ -guint32 nautilus_icon_container_get_label_color (NautilusIconContainer *container, - gboolean first_line); +GdkColor *nautilus_icon_container_get_label_color (NautilusIconContainer *container, + gboolean first_line, + gboolean needs_highlight); #endif /* NAUTILUS_ICON_CONTAINER_PRIVATE_H */ diff --git a/libnautilus-private/nautilus-link-desktop-file.c b/libnautilus-private/nautilus-link-desktop-file.c index 1a454b2b9..c5e79be03 100644 --- a/libnautilus-private/nautilus-link-desktop-file.c +++ b/libnautilus-private/nautilus-link-desktop-file.c @@ -384,7 +384,8 @@ nautilus_link_desktop_file_get_link_icon_from_desktop (NautilusDesktopFile *desk return NULL; } - absolute = gnome_pixmap_file (icon_name); + absolute = gnome_program_locate_file ( + NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); if (absolute != NULL) { g_free (icon_name); icon_name = absolute; diff --git a/libnautilus-private/nautilus-merged-directory.c b/libnautilus-private/nautilus-merged-directory.c index e839514c3..8498c17a6 100644 --- a/libnautilus-private/nautilus-merged-directory.c +++ b/libnautilus-private/nautilus-merged-directory.c @@ -586,7 +586,9 @@ merged_remove_real_directory (NautilusMergedDirectory *merged, real_directory); /* Disconnect all the signals. */ - gtk_signal_disconnect_by_data (GTK_OBJECT (real_directory), merged); + g_signal_handlers_disconnect_matched ( + real_directory, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, merged); /* Remove from our list of directories. */ merged->details->directories = g_list_remove @@ -651,17 +653,17 @@ nautilus_merged_directory_class_init (gpointer klass) G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusMergedDirectoryClass, - add_real_directory), + add_real_directory), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[REMOVE_REAL_DIRECTORY] = g_signal_new ("remove_real_directory", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusMergedDirectoryClass, - remove_real_directory), + remove_real_directory), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); } diff --git a/libnautilus-private/nautilus-monitor.c b/libnautilus-private/nautilus-monitor.c index 3545a4c13..63c2cc82a 100644 --- a/libnautilus-private/nautilus-monitor.c +++ b/libnautilus-private/nautilus-monitor.c @@ -118,7 +118,7 @@ get_event_uri (const FAMEvent *event) return NULL; } - path = g_concat_dir_and_file (base_path, event->filename); + path = g_build_filename (base_path, event->filename, NULL); uri = gnome_vfs_get_uri_from_local_path (path); g_free (path); return uri; diff --git a/libnautilus-private/nautilus-program-chooser.c b/libnautilus-private/nautilus-program-chooser.c index 7832e35df..14a1047b9 100644 --- a/libnautilus-private/nautilus-program-chooser.c +++ b/libnautilus-private/nautilus-program-chooser.c @@ -1292,7 +1292,8 @@ nautilus_program_chooser_init (NautilusProgramChooser *program_chooser) _("Done"), GTK_RESPONSE_CANCEL); gtk_container_set_border_width (GTK_CONTAINER (program_chooser), GNOME_PAD); - gtk_window_set_policy (GTK_WINDOW (program_chooser), FALSE, TRUE, FALSE); + + gtk_window_set_resizable (GTK_WINDOW (program_chooser), TRUE); gtk_window_set_default_size (GTK_WINDOW (program_chooser), -1, PROGRAM_CHOOSER_DEFAULT_HEIGHT); gtk_window_set_wmclass (GTK_WINDOW (program_chooser), "program_chooser", "Nautilus"); diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c index 78170090c..3d6042e4d 100644 --- a/libnautilus-private/nautilus-program-choosing.c +++ b/libnautilus-private/nautilus-program-choosing.c @@ -614,7 +614,7 @@ get_xalf_prefix (const char *name) if (!gnome_config_get_bool ("/xalf/settings/enabled=true")) { return g_strdup (""); } - xalf_executable = gnome_is_program_in_path ("xalf"); + xalf_executable = g_find_program_in_path ("xalf"); if (xalf_executable == NULL) { return g_strdup (""); } diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c index 69314fdd7..12f0fdb45 100644 --- a/libnautilus-private/nautilus-theme.c +++ b/libnautilus-private/nautilus-theme.c @@ -113,7 +113,7 @@ load_theme_document (const char *theme_name) g_free (user_themes_directory); g_free (temp_str); - if (!g_file_exists (theme_path)) { + if (!g_file_test (theme_path, G_FILE_TEST_EXISTS)) { g_free (theme_path); theme_path = NULL; } @@ -209,7 +209,7 @@ nautilus_pixmap_file_may_be_local (const char *themed_image) user_themes_directory = nautilus_theme_get_user_themes_directory (); image_path = nautilus_make_path (user_themes_directory, themed_image); - if (!g_file_exists (image_path)) { + if (!g_file_test (image_path, G_FILE_TEST_EXISTS)) { g_free (image_path); image_path = NULL; } @@ -308,7 +308,7 @@ nautilus_theme_make_preview_pixbuf (const char *theme_name) pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name); g_free (user_themes_directory); - if (g_file_exists (pixbuf_file)) { + if (g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) { pixbuf = gdk_pixbuf_new_from_file (pixbuf_file, NULL); g_free (pixbuf_file); return pixbuf; @@ -336,13 +336,13 @@ nautilus_theme_make_preview_pixbuf (const char *theme_name) pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name); g_free (theme_preview_name); - if (!g_file_exists (pixbuf_file)) { + if (!g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) { g_free (pixbuf_file); theme_preview_name = g_strdup_printf ("%s/i-directory.svg", theme_name); pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name); g_free (theme_preview_name); - if (!g_file_exists (pixbuf_file)) { + if (!g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) { g_free (pixbuf_file); pixbuf_file = NULL; } @@ -444,7 +444,8 @@ theme_get_property (const char *themes_location_uri, theme_file_name = gnome_vfs_get_local_path_from_uri (theme_file_uri); g_free (theme_file_uri); - g_return_val_if_fail (g_file_exists (theme_file_name), NULL); + g_return_val_if_fail (g_file_test (theme_file_name, + G_FILE_TEST_EXISTS), NULL); /* read the xml document */ theme_document = xmlParseFile (theme_file_name); @@ -733,7 +734,7 @@ nautilus_theme_install_user_theme (const char *theme_to_install_path) theme_to_install_path, theme_name); - if (!g_file_exists (theme_xml_path)) { + if (!g_file_test (theme_xml_path, G_FILE_TEST_EXISTS)) { g_free (theme_name); return NAUTILUS_THEME_INSTALL_NOT_A_THEME_DIRECTORY; } @@ -742,7 +743,7 @@ nautilus_theme_install_user_theme (const char *theme_to_install_path) user_themes_directory = nautilus_theme_get_user_themes_directory (); /* Create the user themes directory if it doesn't exist */ - if (!g_file_exists (user_themes_directory)) { + if (!g_file_test (user_themes_directory, G_FILE_TEST_EXISTS)) { result = gnome_vfs_make_directory (user_themes_directory, GNOME_VFS_PERM_USER_ALL | GNOME_VFS_PERM_GROUP_ALL diff --git a/libnautilus-private/nautilus-trash-directory.c b/libnautilus-private/nautilus-trash-directory.c index 9835754fd..d7bd26a22 100644 --- a/libnautilus-private/nautilus-trash-directory.c +++ b/libnautilus-private/nautilus-trash-directory.c @@ -317,11 +317,11 @@ nautilus_trash_directory_init (gpointer object, gpointer klass) volume_monitor = nautilus_volume_monitor_get (); - gtk_signal_connect - (GTK_OBJECT (volume_monitor), "volume_mounted", + g_signal_connect + (volume_monitor, "volume_mounted", G_CALLBACK (volume_mounted_callback), trash); - gtk_signal_connect - (GTK_OBJECT (volume_monitor), "volume_unmount_started", + g_signal_connect + (volume_monitor, "volume_unmount_started", G_CALLBACK (volume_unmount_started_callback), trash); } @@ -337,8 +337,8 @@ nautilus_trash_directory_finish_initializing (NautilusTrashDirectory *trash) volume_monitor = nautilus_volume_monitor_get (); - gtk_signal_connect - (GTK_OBJECT (nautilus_trash_monitor_get ()), "check_trash_directory_added", + g_signal_connect + (nautilus_trash_monitor_get (), "check_trash_directory_added", G_CALLBACK (check_trash_directory_added_callback), trash); nautilus_volume_monitor_each_mounted_volume (volume_monitor, add_one_volume, trash); @@ -368,8 +368,10 @@ trash_destroy (GtkObject *object) trash = NAUTILUS_TRASH_DIRECTORY (object); - gtk_signal_disconnect_by_data - (GTK_OBJECT (nautilus_volume_monitor_get ()), trash); + g_signal_handlers_disconnect_matched ( + nautilus_volume_monitor_get (), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, trash); eel_g_hash_table_safe_for_each (trash->details->volumes, diff --git a/libnautilus-private/nautilus-trash-file.c b/libnautilus-private/nautilus-trash-file.c index db6689f64..4784691f1 100644 --- a/libnautilus-private/nautilus-trash-file.c +++ b/libnautilus-private/nautilus-trash-file.c @@ -330,9 +330,8 @@ remove_real_file (NautilusTrashFile *trash, monitor_remove_file, real_file); - gtk_signal_disconnect_by_func (GTK_OBJECT (real_file), - G_CALLBACK (real_file_changed_callback), - trash); + g_signal_handlers_disconnect_by_func ( + real_file, G_CALLBACK (real_file_changed_callback), trash); trash->details->files = g_list_remove (trash->details->files, real_file); @@ -751,13 +750,13 @@ nautilus_trash_file_init (gpointer object, gpointer klass) (trash_callback_hash, trash_callback_equal); trash_file->details->monitors = g_hash_table_new (NULL, NULL); - trash_file->details->add_directory_connection_id = gtk_signal_connect - (GTK_OBJECT (trash_directory), + trash_file->details->add_directory_connection_id = g_signal_connect + (trash_directory, "add_real_directory", G_CALLBACK (add_directory_callback), trash_file); - trash_file->details->remove_directory_connection_id = gtk_signal_connect - (GTK_OBJECT (trash_directory), + trash_file->details->remove_directory_connection_id = g_signal_connect + (trash_directory, "remove_real_directory", G_CALLBACK (remove_directory_callback), trash_file); @@ -788,10 +787,10 @@ trash_destroy (GtkObject *object) g_warning ("file monitor still active when trash virtual file is destroyed"); } - gtk_signal_disconnect (GTK_OBJECT (trash_directory), - trash_file->details->add_directory_connection_id); - gtk_signal_disconnect (GTK_OBJECT (trash_directory), - trash_file->details->remove_directory_connection_id); + g_signal_handler_disconnect (trash_directory, + trash_file->details->add_directory_connection_id); + g_signal_handler_disconnect (trash_directory, + trash_file->details->remove_directory_connection_id); g_hash_table_destroy (trash_file->details->callbacks); g_hash_table_destroy (trash_file->details->monitors); diff --git a/libnautilus-private/nautilus-trash-monitor.c b/libnautilus-private/nautilus-trash-monitor.c index 2ce804423..47d571733 100644 --- a/libnautilus-private/nautilus-trash-monitor.c +++ b/libnautilus-private/nautilus-trash-monitor.c @@ -74,7 +74,7 @@ nautilus_trash_monitor_class_init (NautilusTrashMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusTrashMonitorClass, trash_state_changed), NULL, NULL, - gtk_marshal_VOID__BOOLEAN, + g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); @@ -84,7 +84,7 @@ nautilus_trash_monitor_class_init (NautilusTrashMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusTrashMonitorClass, check_trash_directory_added), NULL, NULL, - gtk_marshal_VOID__POINTER, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); } @@ -145,18 +145,14 @@ nautilus_trash_monitor_init (gpointer object, gpointer klass) g_list_free (attributes); - gtk_signal_connect_while_alive - (GTK_OBJECT (trash_directory), - "files_added", + g_signal_connect_object + (trash_directory, "files_added", G_CALLBACK (nautilus_trash_files_changed_callback), - trash_monitor, - GTK_OBJECT (trash_monitor)); - gtk_signal_connect_while_alive - (GTK_OBJECT (trash_directory), - "files_changed", + trash_monitor, 0); + g_signal_connect_object + (trash_directory, "files_changed", G_CALLBACK (nautilus_trash_files_changed_callback), - trash_monitor, - GTK_OBJECT (trash_monitor)); + trash_monitor, 0); } static void diff --git a/libnautilus-private/nautilus-undo-manager.c b/libnautilus-private/nautilus-undo-manager.c index 0cbbcda65..ee2db6ddf 100644 --- a/libnautilus-private/nautilus-undo-manager.c +++ b/libnautilus-private/nautilus-undo-manager.c @@ -340,9 +340,9 @@ nautilus_undo_manager_class_init (NautilusUndoManagerClass *class) G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusUndoManagerClass, - changed), + changed), NULL, NULL, - gtk_marshal_NONE__NONE, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); class->epv.append = corba_append; diff --git a/libnautilus-private/nautilus-undo-signal-handlers.c b/libnautilus-private/nautilus-undo-signal-handlers.c index 2ad988334..0bbf6d7fc 100644 --- a/libnautilus-private/nautilus-undo-signal-handlers.c +++ b/libnautilus-private/nautilus-undo-signal-handlers.c @@ -94,9 +94,10 @@ nautilus_undo_tear_down_nautilus_entry_for_undo (NautilusEntry *entry) } /* Disconnect from entry signals */ - gtk_signal_disconnect_by_func (GTK_OBJECT (entry), - G_CALLBACK (nautilus_entry_user_changed_callback), - NULL); + g_signal_handlers_disconnect_by_func + (entry, + G_CALLBACK (nautilus_entry_user_changed_callback), + NULL); } @@ -217,11 +218,11 @@ nautilus_undo_tear_down_editable_for_undo (GtkEditable *editable) } /* Disconnect from entry signals */ - gtk_signal_disconnect_by_func (GTK_OBJECT (editable), + g_signal_handlers_disconnect_by_func (editable, G_CALLBACK (editable_insert_text_callback), NULL); - gtk_signal_disconnect_by_func (GTK_OBJECT (editable), + g_signal_handlers_disconnect_by_func (editable, G_CALLBACK (editable_delete_text_callback), NULL); } diff --git a/libnautilus-private/nautilus-volume-monitor.c b/libnautilus-private/nautilus-volume-monitor.c index d0788c097..141ad5c09 100644 --- a/libnautilus-private/nautilus-volume-monitor.c +++ b/libnautilus-private/nautilus-volume-monitor.c @@ -339,17 +339,18 @@ nautilus_volume_monitor_class_init (NautilusVolumeMonitorClass *klass) G_TYPE_NONE, 1, G_TYPE_POINTER); /* Check environment a bit. */ - if (g_file_exists ("/vol/dev")) { + if (g_file_test ("/vol/dev", G_FILE_TEST_EXISTS)) { floppy_device_path_prefix = "/vol/dev/diskette/"; } else { floppy_device_path_prefix = "/dev/fd"; } - if (g_file_exists ("/vol")) { + if (g_file_test ("/vol", G_FILE_TEST_EXISTS)) { noauto_string = "/vol/"; } else { noauto_string = "/dev/fd"; } - mnttab_exists = g_file_exists ("/etc/mnttab"); + mnttab_exists = g_file_test ("/etc/mnttab", + G_FILE_TEST_EXISTS); } static void @@ -1378,7 +1379,7 @@ find_command (const char **known_locations) int i; for (i = 0; known_locations [i]; i++){ - if (g_file_exists (known_locations [i])) + if (g_file_test (known_locations [i], G_FILE_TEST_EXISTS)) return known_locations [i]; } return NULL; |