diff options
Diffstat (limited to 'src')
33 files changed, 591 insertions, 800 deletions
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 18425f310..ca01dcc83 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -84,7 +84,6 @@ struct FMDesktopIconViewDetails /* For the desktop rescanning */ gulong delayed_init_signal; - gulong done_loading_signal; guint reload_desktop_timeout; gboolean pending_rescan; }; @@ -235,16 +234,6 @@ fm_desktop_icon_view_finalize (GObject *object) gtk_timeout_remove (icon_view->details->reload_desktop_timeout); } - if (icon_view->details->done_loading_signal != 0) { - g_signal_handler_disconnect (fm_directory_view_get_model (FM_DIRECTORY_VIEW (icon_view)), - icon_view->details->done_loading_signal); - } - - if (icon_view->details->delayed_init_signal != 0) { - g_signal_handler_disconnect (icon_view, - icon_view->details->delayed_init_signal); - } - /* Delete all of the link files. */ delete_all_mount_links (); @@ -521,10 +510,9 @@ static void delayed_init (FMDesktopIconView *desktop_icon_view) { /* Keep track of the load time. */ - desktop_icon_view->details->done_loading_signal = - g_signal_connect (fm_directory_view_get_model (FM_DIRECTORY_VIEW (desktop_icon_view)), - "done_loading", - G_CALLBACK (done_loading), desktop_icon_view); + g_signal_connect_object (fm_directory_view_get_model (FM_DIRECTORY_VIEW (desktop_icon_view)), + "done_loading", + G_CALLBACK (done_loading), desktop_icon_view, 0); /* Monitor desktop directory. */ desktop_icon_view->details->reload_desktop_timeout = @@ -560,9 +548,9 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) * way to keep track of the items on the desktop. */ if (!nautilus_monitor_active ()) { - desktop_icon_view->details->delayed_init_signal = g_signal_connect + desktop_icon_view->details->delayed_init_signal = g_signal_connect_object (desktop_icon_view, "begin_loading", - G_CALLBACK (delayed_init), desktop_icon_view); + G_CALLBACK (delayed_init), desktop_icon_view, 0); } nautilus_icon_container_set_is_fixed_size (icon_container, TRUE); @@ -600,21 +588,16 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) create_one_mount_link, desktop_icon_view); - g_signal_connect (icon_container, "middle_click", - G_CALLBACK (fm_desktop_icon_view_handle_middle_click), desktop_icon_view); - - g_signal_connect (icon_container, "compare_icons", - G_CALLBACK (desktop_icons_compare_callback), desktop_icon_view); - - g_signal_connect (desktop_icon_view, "event", - G_CALLBACK (event_callback), desktop_icon_view); - + g_signal_connect_object (icon_container, "middle_click", + G_CALLBACK (fm_desktop_icon_view_handle_middle_click), desktop_icon_view, 0); + g_signal_connect_object (icon_container, "compare_icons", + G_CALLBACK (desktop_icons_compare_callback), desktop_icon_view, 0); + g_signal_connect_object (desktop_icon_view, "event", + G_CALLBACK (event_callback), desktop_icon_view, 0); g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed", - G_CALLBACK (fm_desktop_icon_view_trash_state_changed_callback), desktop_icon_view, 0); - + G_CALLBACK (fm_desktop_icon_view_trash_state_changed_callback), desktop_icon_view, 0); g_signal_connect_object (nautilus_volume_monitor_get (), "volume_mounted", G_CALLBACK (volume_mounted_callback), desktop_icon_view, 0); - g_signal_connect_object (nautilus_volume_monitor_get (), "volume_unmounted", G_CALLBACK (volume_unmounted_callback), desktop_icon_view, 0); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index bc4b387d1..2bacd5740 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -1148,11 +1148,10 @@ add_directory_to_scripts_directory_list (FMDirectoryView *view, g_list_free (attributes); - g_signal_connect (directory, "files_added", - G_CALLBACK (scripts_added_or_changed_callback), view); - - g_signal_connect (directory, "files_changed", - G_CALLBACK (scripts_added_or_changed_callback), view); + g_signal_connect_object (directory, "files_added", + G_CALLBACK (scripts_added_or_changed_callback), view, 0); + g_signal_connect_object (directory, "files_changed", + G_CALLBACK (scripts_added_or_changed_callback), view, 0); view->details->scripts_directory_list = g_list_append (view->details->scripts_directory_list, directory); @@ -1228,30 +1227,29 @@ fm_directory_view_init (FMDirectoryView *view) view->details->sort_directories_first = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST); - g_signal_connect (view->details->nautilus_view, "stop_loading", - G_CALLBACK (stop_loading_callback), view); - g_signal_connect (view->details->nautilus_view, "load_location", - G_CALLBACK (load_location_callback), view); - - nautilus_view_set_listener_mask ( - NAUTILUS_VIEW (view->details->nautilus_view), - NAUTILUS_VIEW_LISTEN_SELECTION); - - g_signal_connect (view->details->nautilus_view, "selection_changed", - G_CALLBACK (selection_changed_callback), view); - g_signal_connect (fm_directory_view_get_bonobo_control (view), "activate", - G_CALLBACK (bonobo_control_activate_callback), view); - g_signal_connect (view->details->zoomable, "zoom_in", - G_CALLBACK (zoomable_zoom_in_callback), view); - g_signal_connect (view->details->zoomable, "zoom_out", - G_CALLBACK (zoomable_zoom_out_callback), view); - g_signal_connect (view->details->zoomable, "set_zoom_level", - G_CALLBACK (zoomable_set_zoom_level_callback), view); - g_signal_connect (view->details->zoomable, "zoom_to_fit", - G_CALLBACK (zoomable_zoom_to_fit_callback), view); + g_signal_connect_object (view->details->nautilus_view, "stop_loading", + G_CALLBACK (stop_loading_callback), view, 0); + g_signal_connect_object (view->details->nautilus_view, "load_location", + G_CALLBACK (load_location_callback), view, 0); + + nautilus_view_set_listener_mask + (NAUTILUS_VIEW (view->details->nautilus_view), + NAUTILUS_VIEW_LISTEN_SELECTION); + + g_signal_connect_object (view->details->nautilus_view, "selection_changed", + G_CALLBACK (selection_changed_callback), view, 0); + g_signal_connect_object (fm_directory_view_get_bonobo_control (view), "activate", + G_CALLBACK (bonobo_control_activate_callback), view, 0); + g_signal_connect_object (view->details->zoomable, "zoom_in", + G_CALLBACK (zoomable_zoom_in_callback), view, 0); + g_signal_connect_object (view->details->zoomable, "zoom_out", + G_CALLBACK (zoomable_zoom_out_callback), view, 0); + g_signal_connect_object (view->details->zoomable, "set_zoom_level", + G_CALLBACK (zoomable_set_zoom_level_callback), view, 0); + g_signal_connect_object (view->details->zoomable, "zoom_to_fit", + G_CALLBACK (zoomable_zoom_to_fit_callback), view, 0); g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed", - G_CALLBACK (fm_directory_view_trash_state_changed_callback), - view, 0); + G_CALLBACK (fm_directory_view_trash_state_changed_callback), view, 0); /* React to icon theme changes. */ g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed", @@ -2296,7 +2294,10 @@ queue_pending_files (FMDirectoryView *view, *pending_list = g_list_concat (*pending_list, nautilus_file_list_copy (files)); - schedule_timeout_display_of_pending_files (view); + if (view->details->loading) + schedule_timeout_display_of_pending_files (view); + else + schedule_idle_display_of_pending_files (view); } static void @@ -4150,10 +4151,9 @@ real_merge_menus (FMDirectoryView *view) bonobo_ui_component_add_verb_list_with_data (view->details->ui, verbs, view); - g_signal_connect_swapped (fm_directory_view_get_background (view), - "settings_changed", - G_CALLBACK (schedule_update_menus), - view); + g_signal_connect_object (fm_directory_view_get_background (view), "settings_changed", + G_CALLBACK (schedule_update_menus), G_OBJECT (view), + G_CONNECT_SWAPPED); /* Do one-time state changes here; context-dependent ones go in update_menus */ if (!fm_directory_view_supports_zooming (view)) { @@ -4933,10 +4933,8 @@ load_directory (FMDirectoryView *view, g_list_free (attributes); view->details->file_changed_handler_id = g_signal_connect - (view->details->directory_as_file, - "changed", - G_CALLBACK (file_changed_callback), - view); + (view->details->directory_as_file, "changed", + G_CALLBACK (file_changed_callback), view); } static void @@ -4958,12 +4956,10 @@ finish_loading (FMDirectoryView *view) /* Connect handlers to learn about loading progress. */ view->details->done_loading_handler_id = g_signal_connect - (view->details->model, - "done_loading", + (view->details->model, "done_loading", G_CALLBACK (done_loading_callback), view); view->details->load_error_handler_id = g_signal_connect - (view->details->model, - "load_error", + (view->details->model, "load_error", G_CALLBACK (load_error_callback), view); /* Monitor the things needed to get the right icon. Also @@ -4991,12 +4987,10 @@ finish_loading (FMDirectoryView *view) g_list_free (attributes); view->details->files_added_handler_id = g_signal_connect - (view->details->model, - "files_added", + (view->details->model, "files_added", G_CALLBACK (files_added_callback), view); view->details->files_changed_handler_id = g_signal_connect - (view->details->model, - "files_changed", + (view->details->model, "files_changed", G_CALLBACK (files_changed_callback), view); } diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index eb9fa1d33..fc1eaa234 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -46,6 +46,7 @@ #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-config.h> #include <libgnome/gnome-desktop-item.h> +#include <libgnome/gnome-macros.h> #include <libgnomevfs/gnome-vfs-ops.h> #include <libgnomevfs/gnome-vfs-async-ops.h> #include <libgnomevfs/gnome-vfs-uri.h> @@ -118,58 +119,25 @@ typedef enum { MENU_ITEM_TYPE_TREE } MenuItemType; -/* forward declarations */ -static void create_icon_container (FMIconView *icon_view); -static void fm_icon_view_init (FMIconView *icon_view); -static void fm_icon_view_class_init (FMIconViewClass *klass); -static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view, - NautilusFile *file, - const char *sort_by); -static void fm_icon_view_set_zoom_level (FMIconView *view, - NautilusZoomLevel new_level, - gboolean always_set_level); -gboolean fm_icon_view_supports_auto_layout (FMIconView *view); -static void fm_icon_view_update_icon_container_fonts (FMIconView *icon_view); -static void fm_icon_view_update_icon_container_font_size_table (FMIconView *icon_view); -static void fm_icon_view_update_click_mode (FMIconView *icon_view); -static gboolean fm_icon_view_using_tighter_layout (FMIconView *icon_view); -static gboolean fm_icon_view_get_directory_tighter_layout (FMIconView *icon_view, - NautilusFile *file); -static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view, - NautilusFile *file, - gboolean tighter_layout); -static gboolean real_supports_auto_layout (FMIconView *view); -static const SortCriterion *get_sort_criterion_by_id (const char *id); -static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type); -static void set_sort_criterion_by_id (FMIconView *icon_view, - const char *id); -static gboolean set_sort_reversed (FMIconView *icon_view, - gboolean new_value); -static void switch_to_manual_layout (FMIconView *view); -static void preview_audio (FMIconView *icon_view, - NautilusFile *file, - gboolean start_flag); -static void update_layout_menus (FMIconView *view); -static void default_sort_in_reverse_order_changed_callback (gpointer callback_data); -static void default_sort_order_changed_callback (gpointer callback_data); -static void default_use_tighter_layout_changed_callback (gpointer callback_data); -static void default_use_manual_layout_changed_callback (gpointer callback_data); -static void default_zoom_level_changed_callback (gpointer callback_data); -static void default_zoom_level_font_size_changed_callback (gpointer callback_data); -static void font_changed_callback (gpointer callback_data); -static void icon_view_handle_uri_list (NautilusIconContainer *container, - const char *item_uris, - GdkDragAction action, - int x, - int y, - FMIconView *view); +struct FMIconViewDetails +{ + GList *icons_not_positioned; + + guint react_to_icon_change_idle_id; + gboolean menus_ready; + gboolean loading; -static int preview_sound_auto_value; + const SortCriterion *sort; + gboolean sort_reversed; + + BonoboUIComponent *ui; + + NautilusAudioPlayerData *audio_player_data; + int audio_preview_timeout; + NautilusFile *audio_preview_file; +}; -EEL_CLASS_BOILERPLATE (FMIconView, - fm_icon_view, - FM_TYPE_DIRECTORY_VIEW) /* Note that the first item in this list is the default sort, * and that the items show up in the menu in the order they @@ -213,24 +181,35 @@ static const SortCriterion sort_criteria[] = { } }; -struct FMIconViewDetails -{ - GList *icons_not_positioned; - - guint react_to_icon_change_idle_id; - gboolean menus_ready; - - gboolean loading; +static gboolean default_sort_in_reverse_order = FALSE; +static int preview_sound_auto_value; - const SortCriterion *sort; - gboolean sort_reversed; - - BonoboUIComponent *ui; - - NautilusAudioPlayerData *audio_player_data; - int audio_preview_timeout; - NautilusFile *audio_preview_file; -}; +static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view, + NautilusFile *file, + const char *sort_by); +static void fm_icon_view_set_zoom_level (FMIconView *view, + NautilusZoomLevel new_level, + gboolean always_set_level); +static void fm_icon_view_update_icon_container_fonts (FMIconView *icon_view); +static void fm_icon_view_update_icon_container_font_size_table (FMIconView *icon_view); +static void fm_icon_view_update_click_mode (FMIconView *icon_view); +static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view, + NautilusFile *file, + gboolean tighter_layout); +static const SortCriterion *get_sort_criterion_by_id (const char *id); +static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type); +static void set_sort_criterion_by_id (FMIconView *icon_view, + const char *id); +static gboolean set_sort_reversed (FMIconView *icon_view, + gboolean new_value); +static void switch_to_manual_layout (FMIconView *view); +static void preview_audio (FMIconView *icon_view, + NautilusFile *file, + gboolean start_flag); +static void update_layout_menus (FMIconView *view); + +GNOME_CLASS_BOILERPLATE (FMIconView, fm_icon_view, + FMDirectoryView, FM_TYPE_DIRECTORY_VIEW) static void fm_icon_view_finalize (GObject *object) @@ -528,6 +507,16 @@ fm_icon_view_file_changed (FMDirectoryView *view, NautilusFile *file) NAUTILUS_ICON_CONTAINER_ICON_DATA (file)); } +static gboolean +fm_icon_view_supports_auto_layout (FMIconView *view) +{ + g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); + + return EEL_CALL_METHOD_WITH_RETURN_VALUE + (FM_ICON_VIEW_CLASS, view, + supports_auto_layout, (view)); +} + static void update_layout_menus (FMIconView *view) { @@ -654,8 +643,6 @@ fm_icon_view_get_directory_sort_reversed (FMIconView *icon_view, get_directory_sort_reversed, (icon_view, file)); } -static gboolean default_sort_in_reverse_order = FALSE; - static gboolean get_default_sort_in_reverse_order (void) { @@ -664,7 +651,7 @@ get_default_sort_in_reverse_order (void) if (auto_storaged_added == FALSE) { auto_storaged_added = TRUE; eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - &default_sort_in_reverse_order); + &default_sort_in_reverse_order); } return default_sort_in_reverse_order; @@ -735,7 +722,6 @@ fm_icon_view_get_directory_auto_layout (FMIconView *icon_view, get_directory_auto_layout, (icon_view, file)); } - static gboolean fm_icon_view_real_get_directory_auto_layout (FMIconView *icon_view, NautilusFile *file) @@ -824,16 +810,6 @@ fm_icon_view_real_set_directory_tighter_layout (FMIconView *icon_view, tighter_layout); } -gboolean -fm_icon_view_supports_auto_layout (FMIconView *view) -{ - g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); - - return EEL_CALL_METHOD_WITH_RETURN_VALUE - (FM_ICON_VIEW_CLASS, view, - supports_auto_layout, (view)); -} - static gboolean real_supports_auto_layout (FMIconView *view) { @@ -1328,8 +1304,8 @@ fm_icon_view_merge_menus (FMDirectoryView *view) icon_view = FM_ICON_VIEW (view); icon_view->details->ui = bonobo_ui_component_new ("Icon View"); - g_signal_connect (icon_view->details->ui, - "ui_event", G_CALLBACK (handle_ui_event), icon_view); + g_signal_connect_object (icon_view->details->ui, + "ui_event", G_CALLBACK (handle_ui_event), icon_view, 0); ui_container = fm_directory_view_get_bonobo_ui_container (view); bonobo_ui_component_set_container (icon_view->details->ui, ui_container, NULL); @@ -1697,7 +1673,7 @@ should_preview_sound (NautilusFile *file) { client = gconf_client_get_default (); enable_esd = gconf_client_get_bool (client, "/desktop/gnome/sound/enable_esd", NULL); - g_object_unref (G_OBJECT (client)); + g_object_unref (client); /* Check gnome config sound preference */ if (!enable_esd) { @@ -2437,97 +2413,59 @@ static void create_icon_container (FMIconView *icon_view) { NautilusIconContainer *icon_container; - FMDirectoryView *directory_view; icon_container = NAUTILUS_ICON_CONTAINER (nautilus_icon_container_new ()); - directory_view = FM_DIRECTORY_VIEW (icon_view); GTK_WIDGET_SET_FLAGS (icon_container, GTK_CAN_FOCUS); - g_signal_connect (icon_container, - "activate", - G_CALLBACK (icon_container_activate_callback), - icon_view); - g_signal_connect (icon_container, - "band_select_started", - G_CALLBACK (band_select_started_callback), - icon_view); - g_signal_connect (icon_container, - "band_select_ended", - G_CALLBACK (band_select_ended_callback), - icon_view); - g_signal_connect (icon_container, - "compare_icons", - G_CALLBACK (icon_container_compare_icons_callback), - icon_view); - g_signal_connect (icon_container, - "compare_icons_by_name", - G_CALLBACK (icon_container_compare_icons_by_name_callback), - icon_view); - g_signal_connect (icon_container, - "context_click_selection", - G_CALLBACK (icon_container_context_click_selection_callback), - icon_view); - g_signal_connect (icon_container, - "context_click_background", - G_CALLBACK (icon_container_context_click_background_callback), - icon_view); - g_signal_connect (icon_container, - "icon_position_changed", - G_CALLBACK (icon_position_changed_callback), - icon_view); - g_signal_connect (icon_container, - "icon_text_changed", - G_CALLBACK (fm_icon_view_icon_text_changed_callback), - icon_view); - g_signal_connect (icon_container, - "selection_changed", - G_CALLBACK (selection_changed_callback), - icon_view); - g_signal_connect (icon_container, - "get_icon_images", - G_CALLBACK (get_icon_images_callback), - icon_view); - g_signal_connect (icon_container, - "get_icon_uri", - G_CALLBACK (get_icon_uri_callback), - icon_view); - g_signal_connect (icon_container, - "get_icon_drop_target_uri", - G_CALLBACK (get_icon_drop_target_uri_callback), - icon_view); - g_signal_connect (icon_container, - "get_icon_text", - G_CALLBACK (get_icon_text_callback), - icon_view); - g_signal_connect (icon_container, - "move_copy_items", - G_CALLBACK (icon_view_move_copy_items), - directory_view); - g_signal_connect (icon_container, - "get_container_uri", - G_CALLBACK (icon_view_get_container_uri), - directory_view); - g_signal_connect (icon_container, - "can_accept_item", - G_CALLBACK (icon_view_can_accept_item), - directory_view); - g_signal_connect (icon_container, - "get_stored_icon_position", - G_CALLBACK (get_stored_icon_position_callback), - directory_view); - g_signal_connect (icon_container, - "layout_changed", - G_CALLBACK (layout_changed_callback), - directory_view); - g_signal_connect (icon_container, "preview", - G_CALLBACK (icon_container_preview_callback), icon_view); - g_signal_connect (icon_container, "renaming_icon", - G_CALLBACK (renaming_icon_callback), directory_view); - g_signal_connect_swapped (icon_container, "icon_stretch_started", - G_CALLBACK (fm_directory_view_update_menus), directory_view); - g_signal_connect_swapped (icon_container, "icon_stretch_ended", - G_CALLBACK (fm_directory_view_update_menus), directory_view); + g_signal_connect_object (icon_container, "activate", + G_CALLBACK (icon_container_activate_callback), icon_view, 0); + g_signal_connect_object (icon_container, "band_select_started", + G_CALLBACK (band_select_started_callback), icon_view, 0); + g_signal_connect_object (icon_container, "band_select_ended", + G_CALLBACK (band_select_ended_callback), icon_view, 0); + g_signal_connect_object (icon_container, "compare_icons", + G_CALLBACK (icon_container_compare_icons_callback), icon_view, 0); + g_signal_connect_object (icon_container, "compare_icons_by_name", + G_CALLBACK (icon_container_compare_icons_by_name_callback), icon_view, 0); + g_signal_connect_object (icon_container, "context_click_selection", + G_CALLBACK (icon_container_context_click_selection_callback), icon_view, 0); + g_signal_connect_object (icon_container, "context_click_background", + G_CALLBACK (icon_container_context_click_background_callback), icon_view, 0); + g_signal_connect_object (icon_container, "icon_position_changed", + G_CALLBACK (icon_position_changed_callback), icon_view, 0); + g_signal_connect_object (icon_container, "icon_text_changed", + G_CALLBACK (fm_icon_view_icon_text_changed_callback), icon_view, 0); + g_signal_connect_object (icon_container, "selection_changed", + G_CALLBACK (selection_changed_callback), icon_view, 0); + g_signal_connect_object (icon_container, "get_icon_images", + G_CALLBACK (get_icon_images_callback), icon_view, 0); + g_signal_connect_object (icon_container, "get_icon_uri", + G_CALLBACK (get_icon_uri_callback), icon_view, 0); + g_signal_connect_object (icon_container, "get_icon_drop_target_uri", + G_CALLBACK (get_icon_drop_target_uri_callback), icon_view, 0); + g_signal_connect_object (icon_container, "get_icon_text", + G_CALLBACK (get_icon_text_callback), icon_view, 0); + g_signal_connect_object (icon_container, "move_copy_items", + G_CALLBACK (icon_view_move_copy_items), icon_view, 0); + g_signal_connect_object (icon_container, "get_container_uri", + G_CALLBACK (icon_view_get_container_uri), icon_view, 0); + g_signal_connect_object (icon_container, "can_accept_item", + G_CALLBACK (icon_view_can_accept_item), icon_view, 0); + g_signal_connect_object (icon_container, "get_stored_icon_position", + G_CALLBACK (get_stored_icon_position_callback), icon_view, 0); + g_signal_connect_object (icon_container, "layout_changed", + G_CALLBACK (layout_changed_callback), icon_view, 0); + g_signal_connect_object (icon_container, "preview", + G_CALLBACK (icon_container_preview_callback), icon_view, 0); + g_signal_connect_object (icon_container, "renaming_icon", + G_CALLBACK (renaming_icon_callback), icon_view, 0); + g_signal_connect_object (icon_container, "icon_stretch_started", + G_CALLBACK (fm_directory_view_update_menus), icon_view, + G_CONNECT_SWAPPED); + g_signal_connect_object (icon_container, "icon_stretch_ended", + G_CALLBACK (fm_directory_view_update_menus), icon_view, + G_CONNECT_SWAPPED); gtk_container_add (GTK_CONTAINER (icon_view), GTK_WIDGET (icon_container)); @@ -2741,10 +2679,9 @@ fm_icon_view_class_init (FMIconViewClass *klass) } static void -fm_icon_view_init (FMIconView *icon_view) +fm_icon_view_instance_init (FMIconView *icon_view) { static gboolean setup_sound_preview = FALSE; - NautilusIconContainer *icon_container; g_return_if_fail (GTK_BIN (icon_view)->child == NULL); @@ -2761,37 +2698,27 @@ fm_icon_view_init (FMIconView *icon_view) eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_FONT, font_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE, default_zoom_level_font_size_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER, default_sort_order_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, default_sort_in_reverse_order_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT, default_use_tighter_layout_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT, default_use_manual_layout_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, default_zoom_level_changed_callback, - icon_view, - G_OBJECT (icon_view)); + icon_view, G_OBJECT (icon_view)); - icon_container = get_icon_container (icon_view); - g_signal_connect (icon_container, - "handle_uri_list", - G_CALLBACK (icon_view_handle_uri_list), - icon_view); + g_signal_connect_object (get_icon_container (icon_view), "handle_uri_list", + G_CALLBACK (icon_view_handle_uri_list), icon_view, 0); } diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 3160c9b58..f53025d85 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -156,15 +156,16 @@ create_and_set_up_tree_view (FMListView *view) GtkTreeViewColumn *column; view->details->tree_view = GTK_TREE_VIEW (gtk_tree_view_new ()); - g_signal_connect (gtk_tree_view_get_selection (view->details->tree_view), - "changed", G_CALLBACK (list_selection_changed_callback), view); - - g_signal_connect (view->details->tree_view, "row_activated", - G_CALLBACK (list_activate_callback), view); - g_signal_connect (view->details->tree_view, "event-after", - G_CALLBACK (event_after_callback), view); - g_signal_connect (view->details->tree_view, "button_press_event", - G_CALLBACK (button_press_callback), view); + g_signal_connect_object (gtk_tree_view_get_selection (view->details->tree_view), + "changed", + G_CALLBACK (list_selection_changed_callback), view, 0); + + g_signal_connect_object (view->details->tree_view, "row_activated", + G_CALLBACK (list_activate_callback), view, 0); + g_signal_connect_object (view->details->tree_view, "event-after", + G_CALLBACK (event_after_callback), view, 0); + g_signal_connect_object (view->details->tree_view, "button_press_event", + G_CALLBACK (button_press_callback), view, 0); view->details->model = g_object_new (FM_TYPE_LIST_MODEL, NULL); gtk_tree_view_set_model (view->details->tree_view, GTK_TREE_MODEL (view->details->model)); diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 46cdcd2cb..ee8e21915 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -31,7 +31,6 @@ #include <eel/eel-glib-extensions.h> #include <eel/eel-gnome-extensions.h> #include <eel/eel-gtk-extensions.h> -#include <eel/eel-gtk-macros.h> #include <eel/eel-labeled-image.h> #include <eel/eel-stock-dialogs.h> #include <eel/eel-string.h> @@ -54,6 +53,7 @@ #include <gtk/gtktable.h> #include <gtk/gtkvbox.h> #include <libgnome/gnome-i18n.h> +#include <libgnome/gnome-macros.h> #include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-uidefs.h> #include <libgnomevfs/gnome-vfs.h> @@ -145,10 +145,6 @@ static GtkTargetEntry target_table[] = { #define STANDARD_EMBLEM_HEIGHT 52 #define EMBLEM_LABEL_SPACING 2 -static void real_destroy (GtkObject *object); -static void real_finalize (GObject *object); -static void fm_properties_window_class_init (FMPropertiesWindowClass *class); -static void fm_properties_window_init (FMPropertiesWindow *window); static void create_properties_window_callback (NautilusFile *file, gpointer data); static void cancel_group_change_callback (gpointer callback_data); @@ -166,23 +162,8 @@ static void remove_pending_file (StartupData *data gboolean cancel_timed_wait, gboolean cancel_destroy_handler); -EEL_CLASS_BOILERPLATE (FMPropertiesWindow, fm_properties_window, GTK_TYPE_WINDOW) - -static void -fm_properties_window_class_init (FMPropertiesWindowClass *class) -{ - G_OBJECT_CLASS (class)->finalize = real_finalize; - - GTK_OBJECT_CLASS (class)->destroy = real_destroy; -} - -static void -fm_properties_window_init (FMPropertiesWindow *window) -{ - window->details = g_new0 (FMPropertiesWindowDetails, 1); - - eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (window)); -} +GNOME_CLASS_BOILERPLATE (FMPropertiesWindow, fm_properties_window, + GtkWindow, GTK_TYPE_WINDOW) typedef struct { NautilusFile *file; @@ -361,10 +342,8 @@ create_image_widget_for_file (NautilusFile *file) g_object_unref (pixbuf); nautilus_file_ref (file); - g_object_set_data_full (G_OBJECT (image), - "nautilus_file", - file, - (GtkDestroyNotify) nautilus_file_unref); + g_object_set_data_full (G_OBJECT (image), "nautilus_file", + file, (GDestroyNotify) nautilus_file_unref); /* React to icon theme changes. */ g_signal_connect_object (nautilus_icon_factory_get (), @@ -641,8 +620,7 @@ value_field_update_internal (GtkLabel *label, attribute_value = nautilus_file_get_string_attribute_with_default (file, attribute_name); if (ellipsize_text) { - eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (label), - attribute_value); + eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (label), attribute_value); } else { gtk_label_set_text (label, attribute_value); } @@ -825,7 +803,7 @@ create_group_menu_item (NautilusFile *file, const char *group_name) "activate", G_CALLBACK (activate_group_callback), file_name_pair_new (file, group_name), - (GtkDestroyNotify)file_name_pair_free); + (GDestroyNotify)file_name_pair_free); return menu_item; } @@ -997,7 +975,7 @@ create_owner_menu_item (NautilusFile *file, const char *user_name) "activate", G_CALLBACK (activate_owner_callback), file_name_pair_new (file, name_array[0]), - (GtkDestroyNotify)file_name_pair_free); + (GDestroyNotify)file_name_pair_free); g_strfreev (name_array); return menu_item; } @@ -1562,10 +1540,8 @@ create_basic_page (FMPropertiesWindow *window) /* Attach parameters and signal handler. */ nautilus_file_ref (original_file); - g_object_set_data_full (G_OBJECT (name_field), - "nautilus_file", - original_file, - (GtkDestroyNotify) nautilus_file_unref); + g_object_set_data_full (G_OBJECT (name_field),"nautilus_file", + original_file, (GDestroyNotify) nautilus_file_unref); /* Update name field initially before hooking up changed signal. */ name_field_update_to_match_file (NAUTILUS_ENTRY (name_field)); @@ -1584,13 +1560,10 @@ create_basic_page (FMPropertiesWindow *window) nautilus_undo_editable_set_undo_key (GTK_EDITABLE (name_field), TRUE); #endif - g_signal_connect (name_field, "focus_out_event", - G_CALLBACK (name_field_focus_out), - window); - - g_signal_connect (name_field, "activate", - G_CALLBACK (name_field_activate), - window); + g_signal_connect_object (name_field, "focus_out_event", + G_CALLBACK (name_field_focus_out), window, 0); + g_signal_connect_object (name_field, "activate", + G_CALLBACK (name_field_activate), window, 0); /* Start with name field selected, if it's sensitive. */ if (GTK_WIDGET_SENSITIVE (name_field)) { @@ -1639,13 +1612,13 @@ create_basic_page (FMPropertiesWindow *window) gtk_widget_show (temp_button); gtk_box_pack_start (GTK_BOX (button_box), temp_button, FALSE, FALSE, 4); - g_signal_connect(temp_button, "clicked", G_CALLBACK (select_image_button_callback), window); + g_signal_connect_object (temp_button, "clicked", G_CALLBACK (select_image_button_callback), window, 0); temp_button = gtk_button_new_with_mnemonic (_("_Remove Custom Icon")); gtk_widget_show (temp_button); gtk_box_pack_start (GTK_BOX(button_box), temp_button, FALSE, FALSE, 4); - g_signal_connect (temp_button, "clicked", G_CALLBACK (remove_image_button_callback), window); + g_signal_connect_object (temp_button, "clicked", G_CALLBACK (remove_image_button_callback), window, 0); window->details->remove_image_button = temp_button; @@ -1739,7 +1712,7 @@ create_emblems_page (FMPropertiesWindow *window) nautilus_file_ref (file); g_object_set_data_full (G_OBJECT (button), "nautilus_file", - file, (GtkDestroyNotify) nautilus_file_unref); + file, (GDestroyNotify) nautilus_file_unref); g_signal_connect (button, "toggled", G_CALLBACK (property_button_toggled), NULL); @@ -1783,7 +1756,7 @@ static void update_permissions_check_button_state (GtkWidget *check_button, NautilusFile *file) { GnomeVFSFilePermissions file_permissions, permission; - guint toggled_signal_id; + gulong toggled_signal_id; g_assert (GTK_IS_CHECK_BUTTON (check_button)); g_assert (NAUTILUS_IS_FILE (file)); @@ -1794,11 +1767,11 @@ update_permissions_check_button_state (GtkWidget *check_button, NautilusFile *fi g_assert (nautilus_file_can_get_permissions (file)); - toggled_signal_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (check_button), + toggled_signal_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (check_button), "toggled_signal_id")); permission = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (check_button), "permission")); - g_assert (toggled_signal_id > 0); + g_assert (toggled_signal_id != 0); g_assert (permission != 0); file_permissions = nautilus_file_get_permissions (file); @@ -1806,12 +1779,10 @@ update_permissions_check_button_state (GtkWidget *check_button, NautilusFile *fi nautilus_file_can_set_permissions (file)); /* Don't react to the "toggled" signal here to avoid recursion. */ - g_signal_handler_block (check_button, - toggled_signal_id); + g_signal_handler_block (check_button, toggled_signal_id); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), (file_permissions & permission) != 0); - g_signal_handler_unblock (check_button, - toggled_signal_id); + g_signal_handler_unblock (check_button, toggled_signal_id); } static void @@ -1859,26 +1830,23 @@ set_up_permissions_checkbox (GtkWidget *check_button, NautilusFile *file, GnomeVFSFilePermissions permission) { - guint toggled_signal_id; + gulong toggled_signal_id; toggled_signal_id = g_signal_connect (check_button, "toggled", - G_CALLBACK (permissions_check_button_toggled), - file); + G_CALLBACK (permissions_check_button_toggled), + file); /* Load up the check_button with data we'll need when updating its state. */ - g_object_set_data (G_OBJECT (check_button), - "toggled_signal_id", - GINT_TO_POINTER (toggled_signal_id)); - g_object_set_data (G_OBJECT (check_button), - "permission", - GINT_TO_POINTER (permission)); + g_object_set_data (G_OBJECT (check_button), "toggled_signal_id", + GUINT_TO_POINTER (toggled_signal_id)); + g_object_set_data (G_OBJECT (check_button), "permission", + GINT_TO_POINTER (permission)); /* Set initial state. */ update_permissions_check_button_state (check_button, file); /* Update state later if file changes. */ - g_signal_connect_object (file, - "changed", + g_signal_connect_object (file, "changed", G_CALLBACK (update_permissions_check_button_state), check_button, G_CONNECT_SWAPPED); } @@ -2225,10 +2193,9 @@ create_properties_window (StartupData *startup_data) /* React to future property changes and file deletions. */ window->details->file_changed_handler_id = - g_signal_connect_swapped (window->details->target_file, - "changed", - G_CALLBACK (properties_window_file_changed_callback), - window); + g_signal_connect_object (window->details->target_file, "changed", + G_CALLBACK (properties_window_file_changed_callback), + window, G_CONNECT_SWAPPED); /* Create the notebook tabs. */ window->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ()); @@ -2400,10 +2367,8 @@ fm_properties_window_present (NautilusFile *original_file, FMDirectoryView *dire */ g_hash_table_insert (pending_files, target_file, target_file); - g_signal_connect (directory_view, - "destroy", - G_CALLBACK (directory_view_destroyed_callback), - startup_data); + g_signal_connect (directory_view, "destroy", + G_CALLBACK (directory_view_destroyed_callback), startup_data); parent_window = gtk_widget_get_ancestor (GTK_WIDGET (directory_view), GTK_TYPE_WINDOW); eel_timed_wait_start @@ -2456,7 +2421,7 @@ real_destroy (GtkObject *object) window->details->update_directory_contents_timeout_id = 0; } - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -2469,7 +2434,7 @@ real_finalize (GObject *object) g_free (window->details->pending_name); g_free (window->details); - EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); + G_OBJECT_CLASS (parent_class)->finalize (object); } /* icon selection callback to set the image of the file object to the selected file */ @@ -2524,3 +2489,18 @@ remove_image_button_callback (GtkWidget *widget, FMPropertiesWindow *properties_ gtk_widget_set_sensitive (widget, FALSE); } + +static void +fm_properties_window_class_init (FMPropertiesWindowClass *class) +{ + G_OBJECT_CLASS (class)->finalize = real_finalize; + GTK_OBJECT_CLASS (class)->destroy = real_destroy; +} + +static void +fm_properties_window_instance_init (FMPropertiesWindow *window) +{ + window->details = g_new0 (FMPropertiesWindowDetails, 1); + + eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (window)); +} diff --git a/src/file-manager/fm-search-list-view.c b/src/file-manager/fm-search-list-view.c index e655c71af..5dae8e8e5 100644 --- a/src/file-manager/fm-search-list-view.c +++ b/src/file-manager/fm-search-list-view.c @@ -386,10 +386,8 @@ fm_search_list_view_init (gpointer object, nautilus_view = fm_directory_view_get_nautilus_view (directory_view); - g_signal_connect (nautilus_view, - "load_location", - G_CALLBACK (load_location_callback), - NULL); + g_signal_connect (nautilus_view, "load_location", + G_CALLBACK (load_location_callback), NULL); } static void @@ -632,10 +630,9 @@ real_adding_file (FMListView *view, NautilusFile *file) * and won't be specific to the search directory. Is that OK? */ - g_signal_connect_swapped (GTK_OBJECT (file), - "changed", - G_CALLBACK (fm_directory_view_queue_file_change), - view); + g_signal_connect_object (GTK_OBJECT (file), "changed", + G_CALLBACK (fm_directory_view_queue_file_change), + view, G_CONNECT_SWAPPED); /* Monitor the things needed to get the right * icon. Also monitor a directory's item count because diff --git a/src/file-manager/nautilus-indexing-info.c b/src/file-manager/nautilus-indexing-info.c index 53c335985..f570856a3 100644 --- a/src/file-manager/nautilus-indexing-info.c +++ b/src/file-manager/nautilus-indexing-info.c @@ -131,8 +131,7 @@ show_index_progress_dialog (void) gtk_widget_show_all (GTK_WIDGET (dialogs->index_in_progress_dialog)); callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover, dialogs->index_in_progress_dialog); - g_signal_connect_swapped (dialogs->index_in_progress_dialog, - "destroy", + g_signal_connect_swapped (dialogs->index_in_progress_dialog, "destroy", G_CALLBACK (medusa_remove_state_changed_function), GINT_TO_POINTER (callback_id)); } @@ -149,8 +148,7 @@ show_last_index_time_dialog (void) gtk_widget_show_all (GTK_WIDGET (dialogs->last_index_time_dialog)); callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover, dialogs->last_index_time_dialog); - g_signal_connect_swapped (dialogs->last_index_time_dialog, - "destroy", + g_signal_connect_swapped (dialogs->last_index_time_dialog, "destroy", G_CALLBACK (medusa_remove_state_changed_function), GINT_TO_POINTER (callback_id)); } @@ -236,10 +234,9 @@ index_progress_dialog_new (void) NULL, progress_data, g_free); - g_signal_connect (progress_bar_hbox, - "destroy", - G_CALLBACK (timeout_remove_callback), - GUINT_TO_POINTER (timeout_id)); + g_signal_connect (progress_bar_hbox, "destroy", /* FIXME: will be called twice */ + G_CALLBACK (timeout_remove_callback), + GLONG_TO_POINTER (timeout_id)); return dialog; } @@ -273,8 +270,7 @@ show_indexing_info_dialog (void) callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover, dialog_shown); - g_signal_connect_swapped (G_OBJECT (dialog_shown), - "destroy", + g_signal_connect_swapped (dialog_shown, "destroy", G_CALLBACK (medusa_remove_state_changed_function), GINT_TO_POINTER (callback_id)); return; diff --git a/src/nautilus-application.c b/src/nautilus-application.c index b79ed67ab..67d5b9adb 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -142,12 +142,12 @@ nautilus_application_instance_init (NautilusApplication *application) application->undo_manager = nautilus_undo_manager_new (); /* Watch for volume mounts so we can restore open windows */ - g_signal_connect (nautilus_volume_monitor_get (), "volume_mounted", - G_CALLBACK (volume_mounted_callback), application); + g_signal_connect_object (nautilus_volume_monitor_get (), "volume_mounted", + G_CALLBACK (volume_mounted_callback), application, 0); /* Watch for volume unmounts so we can close open windows */ - g_signal_connect (nautilus_volume_monitor_get (), "volume_unmounted", - G_CALLBACK (volume_unmounted_callback), application); + g_signal_connect_object (nautilus_volume_monitor_get (), "volume_unmounted", + G_CALLBACK (volume_unmounted_callback), application, 0); } NautilusApplication * @@ -635,16 +635,14 @@ nautilus_application_create_window (NautilusApplication *application) g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL); window = NAUTILUS_WINDOW (gtk_widget_new (nautilus_window_get_type (), - "app", G_OBJECT (application), + "app", application, "app_id", "nautilus", NULL)); - g_signal_connect (window, - "delete_event", G_CALLBACK (nautilus_window_delete_event_callback), - NULL); + g_signal_connect (window, "delete_event", + G_CALLBACK (nautilus_window_delete_event_callback), NULL); - g_signal_connect (window, - "destroy", G_CALLBACK (nautilus_application_destroyed_window), - application); + g_signal_connect_object (window, "destroy", + G_CALLBACK (nautilus_application_destroyed_window), application, 0); nautilus_application_window_list = g_list_prepend (nautilus_application_window_list, window); @@ -874,12 +872,10 @@ init_session (void) client = gnome_master_client (); g_signal_connect (client, "save_yourself", - (GtkSignalFunc) save_session, - NULL); + G_CALLBACK (save_session), NULL); g_signal_connect (client, "die", - (GtkSignalFunc) removed_from_session, - NULL); + G_CALLBACK (removed_from_session), NULL); eel_preferences_add_callback (NAUTILUS_PREFERENCES_ADD_TO_SESSION, diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c index 0f81b2012..a25b07af0 100644 --- a/src/nautilus-bookmark-list.c +++ b/src/nautilus-bookmark-list.c @@ -183,19 +183,12 @@ insert_bookmark_internal (NautilusBookmarkList *bookmarks, NautilusBookmark *bookmark, int index) { - bookmarks->list = g_list_insert (bookmarks->list, - bookmark, - index); - - g_signal_connect (bookmark, - "appearance_changed", - G_CALLBACK (bookmark_in_list_changed_callback), - bookmarks); - - g_signal_connect (bookmark, - "contents_changed", - G_CALLBACK (bookmark_in_list_changed_callback), - bookmarks); + bookmarks->list = g_list_insert (bookmarks->list, bookmark, index); + + g_signal_connect_object (bookmark, "appearance_changed", + G_CALLBACK (bookmark_in_list_changed_callback), bookmarks, 0); + g_signal_connect_object (bookmark, "contents_changed", + G_CALLBACK (bookmark_in_list_changed_callback), bookmarks, 0); } /** diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c index 68fe6f690..f14663bdc 100644 --- a/src/nautilus-bookmarks-window.c +++ b/src/nautilus-bookmarks-window.c @@ -248,24 +248,19 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc g_signal_connect (window, "delete_event", G_CALLBACK (on_window_delete_event), NULL); - g_signal_connect (window, "hide", - G_CALLBACK (on_window_hide_event), NULL); - + G_CALLBACK (on_window_hide_event), NULL); g_signal_connect (window, "destroy", G_CALLBACK (on_window_destroy_event), NULL); - g_signal_connect (window, "response", G_CALLBACK (nautilus_bookmarks_window_response_callback), NULL); name_field_changed_signal_id = g_signal_connect (name_field, "changed", - G_CALLBACK (on_name_field_changed), - NULL); + G_CALLBACK (on_name_field_changed), NULL); g_signal_connect (name_field, "focus_out_event", - G_CALLBACK (on_text_field_focus_out_event), NULL); - + G_CALLBACK (on_text_field_focus_out_event), NULL); g_signal_connect (name_field, "activate", G_CALLBACK (name_or_uri_field_activate), NULL); @@ -275,10 +270,8 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc g_signal_connect (uri_field, "focus_out_event", G_CALLBACK (on_text_field_focus_out_event), NULL); - g_signal_connect (uri_field, "activate", G_CALLBACK (name_or_uri_field_activate), NULL); - g_signal_connect (remove_button, "clicked", G_CALLBACK (on_remove_button_clicked), NULL); @@ -287,8 +280,7 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc G_CALLBACK (repopulate), window, G_CONNECT_SWAPPED); - gtk_tree_selection_set_mode (bookmark_selection, - GTK_SELECTION_BROWSE); + gtk_tree_selection_set_mode (bookmark_selection, GTK_SELECTION_BROWSE); /* Fill in list widget with bookmarks, must be after signals are wired up. */ repopulate(); diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c index 165e9b693..061e01a56 100644 --- a/src/nautilus-complex-search-bar.c +++ b/src/nautilus-complex-search-bar.c @@ -104,10 +104,8 @@ search_bar_criterion_type_changed_callback (GObject *old_criterion_object, new_type = GPOINTER_TO_INT (g_object_get_data (old_criterion_object, "type")); new_criterion = nautilus_search_bar_criterion_new_with_type (new_type, bar); - g_signal_connect (new_criterion, - "criterion_type_changed", - G_CALLBACK (search_bar_criterion_type_changed_callback), - bar); + g_signal_connect_object (new_criterion, "criterion_type_changed", + G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0); old_criterion_location = g_slist_find (bar->details->search_criteria, criterion); old_criterion_location->data = new_criterion; @@ -179,10 +177,8 @@ nautilus_complex_search_bar_init (NautilusComplexSearchBar *bar) file_name_criterion = nautilus_search_bar_criterion_first_new (bar); - g_signal_connect (file_name_criterion, - "criterion_type_changed", - G_CALLBACK (search_bar_criterion_type_changed_callback), - bar); + g_signal_connect_object (file_name_criterion, "criterion_type_changed", + G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0); bar->details->search_criteria = g_slist_prepend (NULL, file_name_criterion); @@ -198,24 +194,21 @@ nautilus_complex_search_bar_init (NautilusComplexSearchBar *bar) hbox = gtk_hwrap_box_new (FALSE); - g_signal_connect (hbox, - "need_reallocation", - G_CALLBACK (queue_search_bar_resize_callback), - bar); + g_signal_connect_object (hbox, "need_reallocation", + G_CALLBACK (queue_search_bar_resize_callback), bar, 0); bar->details->more_options = gtk_button_new_with_label (_("More Options")); - g_signal_connect (bar->details->more_options, "clicked", - G_CALLBACK (more_options_callback), bar); - - + g_signal_connect_object (bar->details->more_options, "clicked", + G_CALLBACK (more_options_callback), bar, 0); + gtk_wrap_box_pack (GTK_WRAP_BOX (hbox), bar->details->more_options, FALSE, FALSE, FALSE, FALSE); gtk_widget_show (bar->details->more_options); bar->details->fewer_options = gtk_button_new_with_label (_("Fewer Options")); - g_signal_connect (bar->details->fewer_options, "clicked", - G_CALLBACK (fewer_options_callback), bar); + g_signal_connect_object (bar->details->fewer_options, "clicked", + G_CALLBACK (fewer_options_callback), bar, 0); gtk_wrap_box_pack (GTK_WRAP_BOX (hbox), bar->details->fewer_options, @@ -239,9 +232,9 @@ nautilus_complex_search_bar_init (NautilusComplexSearchBar *bar) 1); gtk_container_add (GTK_CONTAINER (bar->details->find_them), find_them_box); - g_signal_connect_swapped (bar->details->find_them, "clicked", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); + g_signal_connect_object (bar->details->find_them, "clicked", + G_CALLBACK (nautilus_navigation_bar_location_changed), + bar, G_CONNECT_SWAPPED); gtk_wrap_box_pack (GTK_WRAP_BOX (hbox), bar->details->find_them, @@ -390,17 +383,14 @@ attach_criterion_to_search_bar (NautilusComplexSearchBar *bar, if (criterion->details->use_value_entry) { /* We want to track whether the entry text is empty or not. */ - g_signal_connect_swapped (criterion->details->value_entry, - "changed", - G_CALLBACK (update_find_button_state), - bar); + g_signal_connect_object (criterion->details->value_entry, "changed", + G_CALLBACK (update_find_button_state), bar, G_CONNECT_SWAPPED); /* We want to activate the "Find" button when any entry text is not empty */ g_assert (GTK_IS_BUTTON (bar->details->find_them)); - g_signal_connect_swapped (criterion->details->value_entry, - "activate", - G_CALLBACK (gtk_widget_activate), - bar->details->find_them); + g_signal_connect_object (criterion->details->value_entry, "activate", + G_CALLBACK (gtk_widget_activate), + bar->details->find_them, G_CONNECT_SWAPPED); } nautilus_complex_search_bar_queue_resize (bar); } @@ -482,10 +472,8 @@ more_options_callback (GtkObject *object, last_criterion = (NautilusSearchBarCriterion *)((g_slist_last (list))->data); criterion = nautilus_search_bar_criterion_next_new (last_criterion->details->type, bar); - g_signal_connect (criterion, - "criterion_type_changed", - G_CALLBACK (search_bar_criterion_type_changed_callback), - bar); + g_signal_connect_object (criterion, "criterion_type_changed", + G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0); bar->details->search_criteria = g_slist_append (list, criterion); nautilus_search_bar_criterion_show (criterion); diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index e0194ce85..c6d0b4722 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -84,7 +84,7 @@ struct NautilusSidebarDetails { gboolean has_buttons; char *uri; NautilusFile *file; - gulong file_changed_connection; + guint file_changed_connection; char *default_background_color; char *default_background_image; int selected_index; @@ -342,8 +342,6 @@ nautilus_sidebar_finalize (GObject *object) sidebar = NAUTILUS_SIDEBAR (object); if (sidebar->details->file != NULL) { - g_signal_handler_disconnect (sidebar->details->file, - sidebar->details->file_changed_connection); nautilus_file_monitor_remove (sidebar->details->file, sidebar); nautilus_file_unref (sidebar->details->file); } @@ -509,17 +507,13 @@ sidebar_for_each_sidebar_panel (const char *name, gtk_widget_show (menu_item); g_object_set_data (G_OBJECT (menu_item), "user_data", data->sidebar); gtk_menu_shell_append (GTK_MENU_SHELL (data->menu), menu_item); - g_signal_connect_data (menu_item, - "activate", + g_signal_connect_data (menu_item, "activate", G_CALLBACK (toggle_sidebar_panel), - g_strdup (iid), - (GClosureNotify)g_free, - 0); + g_strdup (iid), (GClosureNotify) g_free, 0); g_object_set_data_full (G_OBJECT (menu_item), "nautilus-sidebar/preference-key", - g_strdup (preference_key), - g_free); + g_strdup (preference_key), g_free); } /* utility routine to add a menu item for each potential sidebar panel */ @@ -574,8 +568,8 @@ nautilus_sidebar_create_context_menu (NautilusSidebar *sidebar) gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); gtk_widget_set_sensitive (menu_item, has_background); - g_signal_connect (menu_item, "activate", - G_CALLBACK (reset_background_callback), sidebar); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (reset_background_callback), sidebar, 0); /* add a separator */ menu_item = gtk_menu_item_new (); @@ -944,8 +938,8 @@ nautilus_sidebar_add_panel (NautilusSidebar *sidebar, NautilusViewFrame *panel) gtk_widget_show (label); - g_signal_connect (panel, "view_loaded", - G_CALLBACK (view_loaded_callback), sidebar); + g_signal_connect_object (panel, "view_loaded", + G_CALLBACK (view_loaded_callback), sidebar, 0); gtk_notebook_append_page (GTK_NOTEBOOK (sidebar->details->notebook), GTK_WIDGET (panel), label); @@ -1398,7 +1392,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list) /* Catch-all button after all the others. */ temp_button = gtk_button_new_with_label (_("Open with...")); g_signal_connect (temp_button, "clicked", - G_CALLBACK (open_with_callback), NULL); + G_CALLBACK (open_with_callback), NULL); g_object_set_data (G_OBJECT (temp_button), "user_data", sidebar); gtk_widget_show (temp_button); gtk_box_pack_start (GTK_BOX (sidebar->details->button_box), @@ -1554,14 +1548,10 @@ nautilus_sidebar_update_appearance (NautilusSidebar *sidebar) background = eel_get_widget_background (GTK_WIDGET (sidebar)); if (!sidebar->details->background_connected) { sidebar->details->background_connected = TRUE; - g_signal_connect (background, - "settings_changed", - G_CALLBACK (background_settings_changed_callback), - sidebar); - g_signal_connect (background, - "reset", - G_CALLBACK (background_reset_callback), - sidebar); + g_signal_connect_object (background,"settings_changed", + G_CALLBACK (background_settings_changed_callback), sidebar, 0); + g_signal_connect_object (background, "reset", + G_CALLBACK (background_reset_callback), sidebar, 0); } /* Set up the background color and image from the metadata. */ @@ -1650,7 +1640,6 @@ nautilus_sidebar_set_uri (NautilusSidebar *sidebar, if (sidebar->details->file != NULL) { g_signal_handler_disconnect (sidebar->details->file, sidebar->details->file_changed_connection); - nautilus_file_monitor_remove (sidebar->details->file, sidebar); } @@ -1662,10 +1651,9 @@ nautilus_sidebar_set_uri (NautilusSidebar *sidebar, sidebar->details->file = file; sidebar->details->file_changed_connection = - g_signal_connect_swapped (sidebar->details->file, - "changed", - G_CALLBACK (background_metadata_changed_callback), - sidebar); + g_signal_connect_object (sidebar->details->file, "changed", + G_CALLBACK (background_metadata_changed_callback), + sidebar, G_CONNECT_SWAPPED); attributes = nautilus_mime_actions_get_minimum_file_attributes (); nautilus_file_monitor_add (sidebar->details->file, sidebar, attributes); diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c index 7ab1a93a7..4fdaeb70f 100644 --- a/src/nautilus-location-bar.c +++ b/src/nautilus-location-bar.c @@ -669,12 +669,11 @@ nautilus_location_bar_init (NautilusLocationBar *bar) nautilus_entry_set_special_tab_handling (NAUTILUS_ENTRY (entry), TRUE); - g_signal_connect_swapped (entry, "activate", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); - g_signal_connect (GTK_OBJECT (entry), "event_after", - G_CALLBACK (editable_event_after_callback), - bar); + g_signal_connect_object (entry, "activate", + G_CALLBACK (nautilus_navigation_bar_location_changed), + bar, G_CONNECT_SWAPPED); + g_signal_connect_object (entry, "event_after", + G_CALLBACK (editable_event_after_callback), bar, 0); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); @@ -685,9 +684,8 @@ nautilus_location_bar_init (NautilusLocationBar *bar) GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, drag_types, G_N_ELEMENTS (drag_types), GDK_ACTION_LINK); - g_signal_connect (event_box, "drag_data_get", - G_CALLBACK (drag_data_get_callback), - bar); + g_signal_connect_object (event_box, "drag_data_get", + G_CALLBACK (drag_data_get_callback), bar, 0); /* Drag dest. */ gtk_drag_dest_set (GTK_WIDGET (bar), @@ -695,8 +693,7 @@ nautilus_location_bar_init (NautilusLocationBar *bar) drop_types, G_N_ELEMENTS (drop_types), GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); g_signal_connect (bar, "drag_data_received", - G_CALLBACK (drag_data_received_callback), - NULL); + G_CALLBACK (drag_data_received_callback), NULL); gtk_widget_show_all (hbox); diff --git a/src/nautilus-main.c b/src/nautilus-main.c index ad0d8651c..75db63e8a 100644 --- a/src/nautilus-main.c +++ b/src/nautilus-main.c @@ -99,7 +99,6 @@ eel_gtk_main_quit_all (void) static void event_loop_unregister (GtkObject *object) { - g_assert (g_slist_find (event_loop_registrants, object) != NULL); event_loop_registrants = g_slist_remove (event_loop_registrants, object); if (!is_event_loop_needed ()) { eel_gtk_main_quit_all (); diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c index a93870e5a..6fc34d2c2 100644 --- a/src/nautilus-navigation-window-menus.c +++ b/src/nautilus-navigation-window-menus.c @@ -138,11 +138,11 @@ bookmark_holder_new (NautilusBookmark *bookmark, new_bookmark_holder->prompt_for_removal = is_bookmarks_menu; new_bookmark_holder->changed_handler_id = - g_signal_connect_swapped (bookmark, "appearance_changed", - is_bookmarks_menu - ? G_CALLBACK (schedule_refresh_bookmarks_menu) - : G_CALLBACK (schedule_refresh_go_menu), - window); + g_signal_connect_object (bookmark, "appearance_changed", + is_bookmarks_menu + ? G_CALLBACK (schedule_refresh_bookmarks_menu) + : G_CALLBACK (schedule_refresh_go_menu), + window, G_CONNECT_SWAPPED); return new_bookmark_holder; } @@ -353,10 +353,8 @@ forget_history_if_confirmed (NautilusWindow *window) GTK_WINDOW (window)); g_free (prompt); - g_signal_connect (dialog, - "response", - G_CALLBACK (forget_history_if_yes), - NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (forget_history_if_yes), NULL); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_NO); } @@ -1151,8 +1149,8 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window) nautilus_window_update_show_hide_menu_items (window); /* Register to catch Bonobo UI events so we can notice View As changes */ - g_signal_connect (window->details->shell_ui, "ui_event", - G_CALLBACK (nautilus_window_handle_ui_event_callback), window); + g_signal_connect_object (window->details->shell_ui, "ui_event", + G_CALLBACK (nautilus_window_handle_ui_event_callback), window, 0); bonobo_ui_component_thaw (window->details->shell_ui, NULL); diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 787c9f170..d04614497 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -572,11 +572,10 @@ nautilus_window_constructed (NautilusWindow *window) window->navigation_bar = nautilus_switchable_navigation_bar_new (window); gtk_widget_show (GTK_WIDGET (window->navigation_bar)); - g_signal_connect (window->navigation_bar, "location_changed", - G_CALLBACK (navigation_bar_location_changed_callback), window); - - g_signal_connect (window->navigation_bar, "mode_changed", - G_CALLBACK (navigation_bar_mode_changed_callback), window); + g_signal_connect_object (window->navigation_bar, "location_changed", + G_CALLBACK (navigation_bar_location_changed_callback), window, 0); + g_signal_connect_object (window->navigation_bar, "mode_changed", + G_CALLBACK (navigation_bar_mode_changed_callback), window, 0); gtk_box_pack_start (GTK_BOX (location_bar_box), window->navigation_bar, TRUE, TRUE, GNOME_PAD_SMALL); @@ -600,14 +599,18 @@ nautilus_window_constructed (NautilusWindow *window) * It gets shown later, if the view-frame contains something zoomable. */ window->zoom_control = nautilus_zoom_control_new (); - g_signal_connect_swapped (window->zoom_control, "zoom_in", - G_CALLBACK (nautilus_window_zoom_in), window); - g_signal_connect_swapped (window->zoom_control, "zoom_out", - G_CALLBACK (nautilus_window_zoom_out), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_level", - G_CALLBACK (nautilus_window_zoom_to_level), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_fit", - G_CALLBACK (nautilus_window_zoom_to_fit), window); + g_signal_connect_object (window->zoom_control, "zoom_in", + G_CALLBACK (nautilus_window_zoom_in), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_out", + G_CALLBACK (nautilus_window_zoom_out), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_level", + G_CALLBACK (nautilus_window_zoom_to_level), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_fit", + G_CALLBACK (nautilus_window_zoom_to_fit), + window, G_CONNECT_SWAPPED); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show (location_bar_box); @@ -626,8 +629,8 @@ nautilus_window_constructed (NautilusWindow *window) /* set up the sidebar */ window->sidebar = nautilus_sidebar_new (); gtk_widget_show (GTK_WIDGET (window->sidebar)); - g_signal_connect (window->sidebar, "location_changed", - G_CALLBACK (go_to_callback), window); + g_signal_connect_object (window->sidebar, "location_changed", + G_CALLBACK (go_to_callback), window, 0); gtk_paned_pack1 (GTK_PANED (window->content_hbox), GTK_WIDGET (window->sidebar), FALSE, TRUE); @@ -1045,14 +1048,11 @@ create_view_as_menu_item (NautilusWindow *window, menu_item = gtk_menu_item_new_with_label (menu_label); g_free (menu_label); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_switch_views_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_switch_views_callback), + window, 0); - g_object_set_data (G_OBJECT (menu_item), - "viewer index", - GINT_TO_POINTER (index)); + g_object_set_data (G_OBJECT (menu_item), "viewer index", GINT_TO_POINTER (index)); gtk_widget_show (menu_item); @@ -1382,10 +1382,8 @@ load_view_as_menus_callback (NautilusFile *file, /* Add "View as..." extra bonus choice. */ menu_item = gtk_menu_item_new_with_label (_("View as...")); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_choose_view_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_choose_view_callback), window, 0); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item); diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 787c9f170..d04614497 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -572,11 +572,10 @@ nautilus_window_constructed (NautilusWindow *window) window->navigation_bar = nautilus_switchable_navigation_bar_new (window); gtk_widget_show (GTK_WIDGET (window->navigation_bar)); - g_signal_connect (window->navigation_bar, "location_changed", - G_CALLBACK (navigation_bar_location_changed_callback), window); - - g_signal_connect (window->navigation_bar, "mode_changed", - G_CALLBACK (navigation_bar_mode_changed_callback), window); + g_signal_connect_object (window->navigation_bar, "location_changed", + G_CALLBACK (navigation_bar_location_changed_callback), window, 0); + g_signal_connect_object (window->navigation_bar, "mode_changed", + G_CALLBACK (navigation_bar_mode_changed_callback), window, 0); gtk_box_pack_start (GTK_BOX (location_bar_box), window->navigation_bar, TRUE, TRUE, GNOME_PAD_SMALL); @@ -600,14 +599,18 @@ nautilus_window_constructed (NautilusWindow *window) * It gets shown later, if the view-frame contains something zoomable. */ window->zoom_control = nautilus_zoom_control_new (); - g_signal_connect_swapped (window->zoom_control, "zoom_in", - G_CALLBACK (nautilus_window_zoom_in), window); - g_signal_connect_swapped (window->zoom_control, "zoom_out", - G_CALLBACK (nautilus_window_zoom_out), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_level", - G_CALLBACK (nautilus_window_zoom_to_level), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_fit", - G_CALLBACK (nautilus_window_zoom_to_fit), window); + g_signal_connect_object (window->zoom_control, "zoom_in", + G_CALLBACK (nautilus_window_zoom_in), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_out", + G_CALLBACK (nautilus_window_zoom_out), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_level", + G_CALLBACK (nautilus_window_zoom_to_level), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_fit", + G_CALLBACK (nautilus_window_zoom_to_fit), + window, G_CONNECT_SWAPPED); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show (location_bar_box); @@ -626,8 +629,8 @@ nautilus_window_constructed (NautilusWindow *window) /* set up the sidebar */ window->sidebar = nautilus_sidebar_new (); gtk_widget_show (GTK_WIDGET (window->sidebar)); - g_signal_connect (window->sidebar, "location_changed", - G_CALLBACK (go_to_callback), window); + g_signal_connect_object (window->sidebar, "location_changed", + G_CALLBACK (go_to_callback), window, 0); gtk_paned_pack1 (GTK_PANED (window->content_hbox), GTK_WIDGET (window->sidebar), FALSE, TRUE); @@ -1045,14 +1048,11 @@ create_view_as_menu_item (NautilusWindow *window, menu_item = gtk_menu_item_new_with_label (menu_label); g_free (menu_label); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_switch_views_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_switch_views_callback), + window, 0); - g_object_set_data (G_OBJECT (menu_item), - "viewer index", - GINT_TO_POINTER (index)); + g_object_set_data (G_OBJECT (menu_item), "viewer index", GINT_TO_POINTER (index)); gtk_widget_show (menu_item); @@ -1382,10 +1382,8 @@ load_view_as_menus_callback (NautilusFile *file, /* Add "View as..." extra bonus choice. */ menu_item = gtk_menu_item_new_with_label (_("View as...")); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_choose_view_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_choose_view_callback), window, 0); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item); diff --git a/src/nautilus-preferences-dialog.c b/src/nautilus-preferences-dialog.c index d12573f29..4b27df619 100644 --- a/src/nautilus-preferences-dialog.c +++ b/src/nautilus-preferences-dialog.c @@ -535,8 +535,8 @@ preferences_dialog_populate_themes_group (EelPreferencesGroup *group) /* Have the custom preferences item tell us when its time to update the displayed * with with the one stored in preferences */ - g_signal_connect (item, "custom_update_displayed_value", - G_CALLBACK (update_theme_selector_displayed_value_callback), child); + g_signal_connect_object (item, "custom_update_displayed_value", + G_CALLBACK (update_theme_selector_displayed_value_callback), child, 0); update_theme_selector_displayed_value_callback (EEL_PREFERENCES_ITEM (item), child); } diff --git a/src/nautilus-profiler.c b/src/nautilus-profiler.c index 7ee014159..3a242b1f4 100644 --- a/src/nautilus-profiler.c +++ b/src/nautilus-profiler.c @@ -197,10 +197,8 @@ dump_dialog_new (const char *title) dump_dialog->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (dump_dialog->window)); - g_signal_connect (dump_dialog->window, - "delete_event", - G_CALLBACK (window_delete_event), - dump_dialog->window); + g_signal_connect (dump_dialog->window, "delete_event", + G_CALLBACK (window_delete_event), dump_dialog->window); gtk_widget_set_usize (dump_dialog->window, 700, 700); @@ -214,15 +212,10 @@ dump_dialog_new (const char *title) gtk_widget_set_sensitive (print_button, FALSE); gtk_widget_set_sensitive (save_button, FALSE); - g_signal_connect (print_button, - "clicked", - G_CALLBACK (window_print_button_callback), - dump_dialog); - - g_signal_connect (save_button, - "clicked", - G_CALLBACK (window_save_button_callback), - dump_dialog); + g_signal_connect_object (print_button, "clicked", + G_CALLBACK (window_print_button_callback), dump_dialog, 0); + g_signal_connect_object (save_button, "clicked", + G_CALLBACK (window_save_button_callback), dump_dialog, 0); gtk_container_add (GTK_CONTAINER (dump_dialog->window), main_box); diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c index e88bb2537..bf46b6dc6 100644 --- a/src/nautilus-property-browser.c +++ b/src/nautilus-property-browser.c @@ -355,7 +355,7 @@ nautilus_property_browser_init (GtkObject *object) gtk_widget_show(temp_button); gtk_box_pack_end (GTK_BOX(property_browser->details->bottom_box), temp_button, FALSE, FALSE, GNOME_PAD_SMALL); - g_signal_connect(temp_button, "clicked", G_CALLBACK (done_button_callback), property_browser); + g_signal_connect_object (temp_button, "clicked", G_CALLBACK (done_button_callback), property_browser, 0); /* create the "add new" button */ property_browser->details->add_button = gtk_button_new (); @@ -369,8 +369,8 @@ nautilus_property_browser_init (GtkObject *object) gtk_box_pack_end (GTK_BOX(property_browser->details->bottom_box), property_browser->details->add_button, FALSE, FALSE, GNOME_PAD_SMALL); - g_signal_connect (property_browser->details->add_button, "clicked", - G_CALLBACK (add_new_button_callback), property_browser); + g_signal_connect_object (property_browser->details->add_button, "clicked", + G_CALLBACK (add_new_button_callback), property_browser, 0); /* now create the "remove" button */ property_browser->details->remove_button = gtk_button_new(); @@ -388,10 +388,8 @@ nautilus_property_browser_init (GtkObject *object) FALSE, GNOME_PAD_SMALL); - g_signal_connect (property_browser->details->remove_button, - "clicked", - G_CALLBACK (remove_button_callback), - property_browser); + g_signal_connect_object (property_browser->details->remove_button, "clicked", + G_CALLBACK (remove_button_callback), property_browser, 0); /* now create the actual content, with the category pane and the content frame */ @@ -409,12 +407,9 @@ nautilus_property_browser_init (GtkObject *object) property_browser); g_signal_connect (property_browser, "delete_event", - G_CALLBACK (nautilus_property_browser_delete_event_callback), - NULL); - + G_CALLBACK (nautilus_property_browser_delete_event_callback), NULL); g_signal_connect (property_browser, "hide", - G_CALLBACK (nautilus_property_browser_hide_callback), - NULL); + G_CALLBACK (nautilus_property_browser_hide_callback), NULL); /* initially, display the top level */ nautilus_property_browser_set_path(property_browser, BROWSER_CATEGORIES_FILE_NAME); @@ -1191,8 +1186,8 @@ show_color_selection_window (GtkWidget *widget, gpointer *data) eel_add_weak_pointer (&property_browser->details->dialog); - g_signal_connect (property_browser->details->dialog, "clicked", - G_CALLBACK (add_color_to_browser), property_browser); + g_signal_connect_object (property_browser->details->dialog, "clicked", + G_CALLBACK (add_color_to_browser), property_browser, 0); gtk_window_set_position (GTK_WINDOW (property_browser->details->dialog), GTK_WIN_POS_MOUSE); gtk_widget_show (GTK_WIDGET(property_browser->details->dialog)); @@ -1217,10 +1212,10 @@ add_new_color (NautilusPropertyBrowser *property_browser) eel_add_weak_pointer (&property_browser->details->dialog); - g_signal_connect (color_dialog->ok_button, "clicked", - G_CALLBACK (show_color_selection_window), property_browser); - g_signal_connect_swapped (color_dialog->cancel_button, "clicked", - G_CALLBACK (gtk_widget_destroy), color_dialog); + g_signal_connect_object (color_dialog->ok_button, "clicked", + G_CALLBACK (show_color_selection_window), property_browser, 0); + g_signal_connect_object (color_dialog->cancel_button, "clicked", + G_CALLBACK (gtk_widget_destroy), color_dialog, G_CONNECT_SWAPPED); gtk_widget_hide(color_dialog->help_button); gtk_window_set_position (GTK_WINDOW (color_dialog), GTK_WIN_POS_MOUSE); @@ -1382,8 +1377,8 @@ add_new_emblem (NautilusPropertyBrowser *property_browser) eel_add_weak_pointer (&property_browser->details->dialog); - g_signal_connect (property_browser->details->dialog, "clicked", - G_CALLBACK (emblem_dialog_clicked), property_browser); + g_signal_connect_object (property_browser->details->dialog, "clicked", + G_CALLBACK (emblem_dialog_clicked), property_browser, 0); gtk_window_set_position (GTK_WINDOW (property_browser->details->dialog), GTK_WIN_POS_MOUSE); gtk_widget_show (GTK_WIDGET(property_browser->details->dialog)); } @@ -1870,11 +1865,9 @@ make_category_link (NautilusPropertyBrowser *property_browser, /* add a signal to handle clicks */ g_object_set_data (G_OBJECT(button), "user_data", property_browser); g_signal_connect_data - (button, - "clicked", + (button, "clicked", G_CALLBACK (category_clicked_callback), - g_strdup (name), - (GClosureNotify)g_free, 0); + g_strdup (name), (GClosureNotify) g_free, 0); } /* update_contents populates the property browser with information specified by the path and other state variables */ @@ -1919,10 +1912,8 @@ nautilus_property_browser_update_contents (NautilusPropertyBrowser *property_bro eel_wrap_table_set_y_spacing (EEL_WRAP_TABLE (property_browser->details->content_table), IMAGE_TABLE_Y_SPACING); - g_signal_connect (property_browser->details->content_table, - "child_pressed", - G_CALLBACK (element_clicked_callback), - property_browser); + g_signal_connect_object (property_browser->details->content_table, "child_pressed", + G_CALLBACK (element_clicked_callback), property_browser, 0); gtk_container_add(GTK_CONTAINER(viewport), property_browser->details->content_table); gtk_container_add (GTK_CONTAINER (property_browser->details->content_frame), viewport); diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c index c65b38c1d..f1db7fccd 100644 --- a/src/nautilus-search-bar-criterion.c +++ b/src/nautilus-search-bar-criterion.c @@ -233,8 +233,6 @@ nautilus_search_bar_criterion_destroy (GtkObject *object) criterion = NAUTILUS_SEARCH_BAR_CRITERION (object); /* FIXME bugzilla.gnome.org 42437: need more freeage */ - g_signal_handlers_disconnect_by_func (nautilus_signaller_get_current (), - G_CALLBACK (emblems_changed_callback), criterion); /* nautilus_undo_editable_set_undo_key (GTK_EDITABLE (criterion->details->value_entry), FALSE); nautilus_undo_tear_down_nautilus_entry_for_undo (criterion->details->value_entry); */ @@ -297,10 +295,10 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty details->bar = bar; details->box = gtk_hwrap_box_new (FALSE); - g_signal_connect (details->box, "need_reallocation", - G_CALLBACK (queue_bar_resize_callback), bar); - g_signal_connect (nautilus_signaller_get_current (), "emblems_changed", - G_CALLBACK (emblems_changed_callback), criterion); + g_signal_connect_object (details->box, "need_reallocation", + G_CALLBACK (queue_bar_resize_callback), bar, 0); + g_signal_connect_object (nautilus_signaller_get_current (), "emblems_changed", + G_CALLBACK (emblems_changed_callback), criterion, 0); search_criteria_option_menu = gtk_option_menu_new (); @@ -313,8 +311,8 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty g_free (context_stripped_criteria_title); g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i)); - g_signal_connect (item, "activate", - G_CALLBACK (criterion_type_changed_callback), criterion); + g_signal_connect_object (item, "activate", + G_CALLBACK (criterion_type_changed_callback), criterion, 0); gtk_menu_shell_append (GTK_MENU_SHELL (search_criteria_menu), item); gtk_widget_show (item); @@ -349,14 +347,12 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty don't need a date, like "yesterday" */ if (details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) { if (modified_relation_should_show_value (i)) { - g_signal_connect (item, "activate", - G_CALLBACK (show_date_widget), - criterion); + g_signal_connect_object (item, "activate", + G_CALLBACK (show_date_widget), criterion, 0); } else { - g_signal_connect (item, "activate", - G_CALLBACK (hide_date_widget), - criterion); + g_signal_connect_object (item, "activate", + G_CALLBACK (hide_date_widget), criterion, 0); } } gtk_menu_shell_append (GTK_MENU_SHELL (relation_menu), @@ -712,8 +708,8 @@ nautilus_search_bar_criterion_update_valid_criteria_choices (NautilusSearchBarCr g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i)); - g_signal_connect (item, "activate", - G_CALLBACK (criterion_type_changed_callback), criterion); + g_signal_connect_object (item, "activate", + G_CALLBACK (criterion_type_changed_callback), criterion, 0); gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), item); gtk_widget_show (item); diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c index a7d924847..b1192a7f5 100644 --- a/src/nautilus-sidebar-title.c +++ b/src/nautilus-sidebar-title.c @@ -84,16 +84,18 @@ static const char *default_font_name; struct NautilusSidebarTitleDetails { NautilusFile *file; - guint file_changed_connection; + guint file_changed_connection; + gboolean monitoring_count; + char *title_text; GtkWidget *icon; GtkWidget *title_label; GtkWidget *more_info_label; GtkWidget *emblem_box; GtkWidget *notes; - - int shadow_offset; - gboolean determined_icon; + + int shadow_offset; + gboolean determined_icon; }; EEL_CLASS_BOILERPLATE (NautilusSidebarTitle, nautilus_sidebar_title, gtk_vbox_get_type ()) @@ -129,11 +131,8 @@ realize_callback (NautilusSidebarTitle *sidebar_title) g_return_if_fail (background != NULL); - g_signal_connect_object (background, - "appearance_changed", - G_CALLBACK (appearance_changed_callback), - sidebar_title, - 0); + g_signal_connect_object (background, "appearance_changed", + G_CALLBACK (appearance_changed_callback), sidebar_title, 0); } static void @@ -166,7 +165,7 @@ nautilus_sidebar_title_init (NautilusSidebarTitle *sidebar_title) /* Register to find out about icon theme changes */ g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed", - G_CALLBACK (update_icon), G_OBJECT (sidebar_title), G_CONNECT_SWAPPED); + G_CALLBACK (update_icon), sidebar_title, G_CONNECT_SWAPPED); g_signal_connect (sidebar_title, "realize", G_CALLBACK (realize_callback), NULL); @@ -707,6 +706,44 @@ nautilus_sidebar_title_set_text (NautilusSidebarTitle *sidebar_title, update_title (sidebar_title); } +static gboolean +item_count_ready (NautilusSidebarTitle *sidebar_title) +{ + return sidebar_title->details->file != NULL + && nautilus_file_get_directory_item_count + (sidebar_title->details->file, NULL, NULL) != 0; +} + +static void +monitor_add (NautilusSidebarTitle *sidebar_title) +{ + GList *attributes; + + /* Monitor the things needed to get the right icon. Don't + * monitor a directory's item count at first even though the + * "size" attribute is based on that, because the main view + * will get it for us in most cases, and in other cases it's + * OK to not show the size -- if we did monitor it, we'd be in + * a race with the main view and could cause it to have to + * load twice. Once we have a size, though, we want to monitor + * the size to guarantee it stays up to date. + */ + + sidebar_title->details->monitoring_count = item_count_ready (sidebar_title); + + attributes = nautilus_icon_factory_get_required_file_attributes (); + attributes = g_list_prepend (attributes, + NAUTILUS_FILE_ATTRIBUTE_METADATA); + if (sidebar_title->details->monitoring_count) { + attributes = g_list_prepend (attributes, + NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT); + } + + nautilus_file_monitor_add (sidebar_title->details->file, sidebar_title, attributes); + + g_list_free (attributes); +} + static void update_all (NautilusSidebarTitle *sidebar_title) { @@ -718,6 +755,12 @@ update_all (NautilusSidebarTitle *sidebar_title) update_emblems (sidebar_title); update_notes (sidebar_title); + + /* Redo monitor once the count is ready. */ + if (!sidebar_title->details->monitoring_count && item_count_ready (sidebar_title)) { + nautilus_file_monitor_remove (sidebar_title->details->file, sidebar_title); + monitor_add (sidebar_title); + } } void @@ -725,8 +768,6 @@ nautilus_sidebar_title_set_file (NautilusSidebarTitle *sidebar_title, NautilusFile *file, const char *initial_text) { - GList *attributes; - if (file != sidebar_title->details->file) { release_file (sidebar_title); sidebar_title->details->file = file; @@ -736,24 +777,10 @@ nautilus_sidebar_title_set_file (NautilusSidebarTitle *sidebar_title, /* attach file */ if (file != NULL) { sidebar_title->details->file_changed_connection = - g_signal_connect_swapped (sidebar_title->details->file, - "changed", - G_CALLBACK (update_all), - sidebar_title); - - /* Monitor the things needed to get the right - * icon. Don't monitor a directory's item - * count even though the "size" attribute is - * based on that, because the main view will - * get it for us in most cases, and in other - * cases it's OK to now show the size. - */ - attributes = nautilus_icon_factory_get_required_file_attributes (); - attributes = g_list_prepend (attributes, - NAUTILUS_FILE_ATTRIBUTE_METADATA); - nautilus_file_monitor_add (sidebar_title->details->file, sidebar_title, - attributes); - g_list_free (attributes); + g_signal_connect_object + (sidebar_title->details->file, "changed", + G_CALLBACK (update_all), sidebar_title, G_CONNECT_SWAPPED); + monitor_add (sidebar_title); } } diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index e0194ce85..c6d0b4722 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -84,7 +84,7 @@ struct NautilusSidebarDetails { gboolean has_buttons; char *uri; NautilusFile *file; - gulong file_changed_connection; + guint file_changed_connection; char *default_background_color; char *default_background_image; int selected_index; @@ -342,8 +342,6 @@ nautilus_sidebar_finalize (GObject *object) sidebar = NAUTILUS_SIDEBAR (object); if (sidebar->details->file != NULL) { - g_signal_handler_disconnect (sidebar->details->file, - sidebar->details->file_changed_connection); nautilus_file_monitor_remove (sidebar->details->file, sidebar); nautilus_file_unref (sidebar->details->file); } @@ -509,17 +507,13 @@ sidebar_for_each_sidebar_panel (const char *name, gtk_widget_show (menu_item); g_object_set_data (G_OBJECT (menu_item), "user_data", data->sidebar); gtk_menu_shell_append (GTK_MENU_SHELL (data->menu), menu_item); - g_signal_connect_data (menu_item, - "activate", + g_signal_connect_data (menu_item, "activate", G_CALLBACK (toggle_sidebar_panel), - g_strdup (iid), - (GClosureNotify)g_free, - 0); + g_strdup (iid), (GClosureNotify) g_free, 0); g_object_set_data_full (G_OBJECT (menu_item), "nautilus-sidebar/preference-key", - g_strdup (preference_key), - g_free); + g_strdup (preference_key), g_free); } /* utility routine to add a menu item for each potential sidebar panel */ @@ -574,8 +568,8 @@ nautilus_sidebar_create_context_menu (NautilusSidebar *sidebar) gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); gtk_widget_set_sensitive (menu_item, has_background); - g_signal_connect (menu_item, "activate", - G_CALLBACK (reset_background_callback), sidebar); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (reset_background_callback), sidebar, 0); /* add a separator */ menu_item = gtk_menu_item_new (); @@ -944,8 +938,8 @@ nautilus_sidebar_add_panel (NautilusSidebar *sidebar, NautilusViewFrame *panel) gtk_widget_show (label); - g_signal_connect (panel, "view_loaded", - G_CALLBACK (view_loaded_callback), sidebar); + g_signal_connect_object (panel, "view_loaded", + G_CALLBACK (view_loaded_callback), sidebar, 0); gtk_notebook_append_page (GTK_NOTEBOOK (sidebar->details->notebook), GTK_WIDGET (panel), label); @@ -1398,7 +1392,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list) /* Catch-all button after all the others. */ temp_button = gtk_button_new_with_label (_("Open with...")); g_signal_connect (temp_button, "clicked", - G_CALLBACK (open_with_callback), NULL); + G_CALLBACK (open_with_callback), NULL); g_object_set_data (G_OBJECT (temp_button), "user_data", sidebar); gtk_widget_show (temp_button); gtk_box_pack_start (GTK_BOX (sidebar->details->button_box), @@ -1554,14 +1548,10 @@ nautilus_sidebar_update_appearance (NautilusSidebar *sidebar) background = eel_get_widget_background (GTK_WIDGET (sidebar)); if (!sidebar->details->background_connected) { sidebar->details->background_connected = TRUE; - g_signal_connect (background, - "settings_changed", - G_CALLBACK (background_settings_changed_callback), - sidebar); - g_signal_connect (background, - "reset", - G_CALLBACK (background_reset_callback), - sidebar); + g_signal_connect_object (background,"settings_changed", + G_CALLBACK (background_settings_changed_callback), sidebar, 0); + g_signal_connect_object (background, "reset", + G_CALLBACK (background_reset_callback), sidebar, 0); } /* Set up the background color and image from the metadata. */ @@ -1650,7 +1640,6 @@ nautilus_sidebar_set_uri (NautilusSidebar *sidebar, if (sidebar->details->file != NULL) { g_signal_handler_disconnect (sidebar->details->file, sidebar->details->file_changed_connection); - nautilus_file_monitor_remove (sidebar->details->file, sidebar); } @@ -1662,10 +1651,9 @@ nautilus_sidebar_set_uri (NautilusSidebar *sidebar, sidebar->details->file = file; sidebar->details->file_changed_connection = - g_signal_connect_swapped (sidebar->details->file, - "changed", - G_CALLBACK (background_metadata_changed_callback), - sidebar); + g_signal_connect_object (sidebar->details->file, "changed", + G_CALLBACK (background_metadata_changed_callback), + sidebar, G_CONNECT_SWAPPED); attributes = nautilus_mime_actions_get_minimum_file_attributes (); nautilus_file_monitor_add (sidebar->details->file, sidebar, attributes); diff --git a/src/nautilus-simple-search-bar.c b/src/nautilus-simple-search-bar.c index 651c15922..7efef4218 100644 --- a/src/nautilus-simple-search-bar.c +++ b/src/nautilus-simple-search-bar.c @@ -132,17 +132,15 @@ nautilus_simple_search_bar_new (NautilusWindow *window) nautilus_window_get_ui_container (window), TRUE); - g_signal_connect_swapped (bar->details->entry, "activate", - G_CALLBACK (gtk_widget_activate), - bar->details->find_button); - g_signal_connect_swapped (bar->details->entry, "changed", - G_CALLBACK (update_simple_find_button_state), bar); + g_signal_connect_object (bar->details->entry, "activate", + G_CALLBACK (gtk_widget_activate), bar->details->find_button, G_CONNECT_SWAPPED); + g_signal_connect_object (bar->details->entry, "changed", + G_CALLBACK (update_simple_find_button_state), bar, G_CONNECT_SWAPPED); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (bar->details->entry), TRUE, TRUE, 0); - g_signal_connect_swapped (bar->details->find_button, "clicked", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); + g_signal_connect_object (bar->details->find_button, "clicked", + G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED); gtk_box_pack_start (GTK_BOX (hbox), bar->details->find_button, FALSE, TRUE, 1); update_simple_find_button_state (bar); diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 787c9f170..d04614497 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -572,11 +572,10 @@ nautilus_window_constructed (NautilusWindow *window) window->navigation_bar = nautilus_switchable_navigation_bar_new (window); gtk_widget_show (GTK_WIDGET (window->navigation_bar)); - g_signal_connect (window->navigation_bar, "location_changed", - G_CALLBACK (navigation_bar_location_changed_callback), window); - - g_signal_connect (window->navigation_bar, "mode_changed", - G_CALLBACK (navigation_bar_mode_changed_callback), window); + g_signal_connect_object (window->navigation_bar, "location_changed", + G_CALLBACK (navigation_bar_location_changed_callback), window, 0); + g_signal_connect_object (window->navigation_bar, "mode_changed", + G_CALLBACK (navigation_bar_mode_changed_callback), window, 0); gtk_box_pack_start (GTK_BOX (location_bar_box), window->navigation_bar, TRUE, TRUE, GNOME_PAD_SMALL); @@ -600,14 +599,18 @@ nautilus_window_constructed (NautilusWindow *window) * It gets shown later, if the view-frame contains something zoomable. */ window->zoom_control = nautilus_zoom_control_new (); - g_signal_connect_swapped (window->zoom_control, "zoom_in", - G_CALLBACK (nautilus_window_zoom_in), window); - g_signal_connect_swapped (window->zoom_control, "zoom_out", - G_CALLBACK (nautilus_window_zoom_out), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_level", - G_CALLBACK (nautilus_window_zoom_to_level), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_fit", - G_CALLBACK (nautilus_window_zoom_to_fit), window); + g_signal_connect_object (window->zoom_control, "zoom_in", + G_CALLBACK (nautilus_window_zoom_in), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_out", + G_CALLBACK (nautilus_window_zoom_out), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_level", + G_CALLBACK (nautilus_window_zoom_to_level), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_fit", + G_CALLBACK (nautilus_window_zoom_to_fit), + window, G_CONNECT_SWAPPED); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show (location_bar_box); @@ -626,8 +629,8 @@ nautilus_window_constructed (NautilusWindow *window) /* set up the sidebar */ window->sidebar = nautilus_sidebar_new (); gtk_widget_show (GTK_WIDGET (window->sidebar)); - g_signal_connect (window->sidebar, "location_changed", - G_CALLBACK (go_to_callback), window); + g_signal_connect_object (window->sidebar, "location_changed", + G_CALLBACK (go_to_callback), window, 0); gtk_paned_pack1 (GTK_PANED (window->content_hbox), GTK_WIDGET (window->sidebar), FALSE, TRUE); @@ -1045,14 +1048,11 @@ create_view_as_menu_item (NautilusWindow *window, menu_item = gtk_menu_item_new_with_label (menu_label); g_free (menu_label); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_switch_views_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_switch_views_callback), + window, 0); - g_object_set_data (G_OBJECT (menu_item), - "viewer index", - GINT_TO_POINTER (index)); + g_object_set_data (G_OBJECT (menu_item), "viewer index", GINT_TO_POINTER (index)); gtk_widget_show (menu_item); @@ -1382,10 +1382,8 @@ load_view_as_menus_callback (NautilusFile *file, /* Add "View as..." extra bonus choice. */ menu_item = gtk_menu_item_new_with_label (_("View as...")); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_choose_view_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_choose_view_callback), window, 0); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item); diff --git a/src/nautilus-switchable-navigation-bar.c b/src/nautilus-switchable-navigation-bar.c index de2467bdb..fb64783d2 100644 --- a/src/nautilus-switchable-navigation-bar.c +++ b/src/nautilus-switchable-navigation-bar.c @@ -121,10 +121,8 @@ create_search_bar_if_non_existant (NautilusSwitchableNavigationBar *bar) bar->details->search_bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (nautilus_switchable_search_bar_new (bar->details->window)); - g_signal_connect_swapped (bar->details->search_bar, - "location_changed", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); + g_signal_connect_object (bar->details->search_bar, "location_changed", + G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED); gtk_box_pack_start (GTK_BOX (bar->details->hbox), GTK_WIDGET (bar->details->search_bar), TRUE, TRUE, 0); } @@ -144,10 +142,8 @@ nautilus_switchable_navigation_bar_new (NautilusWindow *window) switchable_navigation_bar->details->window = window; switchable_navigation_bar->details->location_bar = NAUTILUS_LOCATION_BAR (nautilus_location_bar_new (window)); - g_signal_connect_swapped (switchable_navigation_bar->details->location_bar, - "location_changed", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); + g_signal_connect_object (switchable_navigation_bar->details->location_bar, "location_changed", + G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED); gtk_box_pack_start (GTK_BOX (switchable_navigation_bar->details->hbox), GTK_WIDGET (switchable_navigation_bar->details->location_bar), TRUE, TRUE, 0); diff --git a/src/nautilus-switchable-search-bar.c b/src/nautilus-switchable-search-bar.c index 99b185605..962957ab3 100644 --- a/src/nautilus-switchable-search-bar.c +++ b/src/nautilus-switchable-search-bar.c @@ -133,20 +133,16 @@ nautilus_switchable_search_bar_new (NautilusWindow *window) bar->complex_search_bar = nautilus_complex_search_bar_new (window); bar->simple_search_bar = nautilus_simple_search_bar_new (window); - g_signal_connect_swapped (bar->complex_search_bar, - "location_changed", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); - g_signal_connect_swapped (bar->simple_search_bar, - "location_changed", - G_CALLBACK (nautilus_navigation_bar_location_changed), - bar); + g_signal_connect_object (bar->complex_search_bar, "location_changed", + G_CALLBACK (nautilus_navigation_bar_location_changed), + bar, G_CONNECT_SWAPPED); + g_signal_connect_object (bar->simple_search_bar, "location_changed", + G_CALLBACK (nautilus_navigation_bar_location_changed), + bar, G_CONNECT_SWAPPED); - gtk_box_pack_start (GTK_BOX (hbox), bar->complex_search_bar, TRUE, TRUE, - 0); - gtk_box_pack_start (GTK_BOX (hbox), bar->simple_search_bar, TRUE, TRUE, - 0); + gtk_box_pack_start (GTK_BOX (hbox), bar->complex_search_bar, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), bar->simple_search_bar, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (bar), hbox); diff --git a/src/nautilus-theme-selector.c b/src/nautilus-theme-selector.c index 19dc6109c..924761857 100644 --- a/src/nautilus-theme-selector.c +++ b/src/nautilus-theme-selector.c @@ -55,7 +55,7 @@ struct NautilusThemeSelectorDetails EelImageChooser *remove_theme_selector; GtkWidget *scrolled_window; GtkWidget *remove_scrolled_window; - guint theme_selector_changed_connection; + gulong remove_theme_selector_changed_connection; GtkWindow *parent_window; guint remove_idle_id; }; @@ -191,15 +191,13 @@ install_theme_button_clicked_callback (GtkWidget *button, THEME_SELECTOR_DATA_KEY, callback_data); - g_signal_connect (GTK_FILE_SELECTION (file_selection_dialog)->ok_button, - "clicked", - G_CALLBACK (file_selection_ok_clicked_callback), - file_selection_dialog); + g_signal_connect_object (GTK_FILE_SELECTION (file_selection_dialog)->ok_button, "clicked", + G_CALLBACK (file_selection_ok_clicked_callback), + file_selection_dialog, 0); - g_signal_connect (GTK_FILE_SELECTION (file_selection_dialog)->cancel_button, - "clicked", - G_CALLBACK (file_selection_cancel_clicked_callback), - file_selection_dialog); + g_signal_connect_object (GTK_FILE_SELECTION (file_selection_dialog)->cancel_button, "clicked", + G_CALLBACK (file_selection_cancel_clicked_callback), + file_selection_dialog, 0); gtk_window_set_position (GTK_WINDOW (file_selection_dialog), GTK_WIN_POS_MOUSE); if (theme_selector->details->parent_window != NULL) { @@ -288,10 +286,10 @@ remove_theme_selector_idle_callback (gpointer callback_data) theme_to_remove_position)); g_signal_handler_block (theme_selector->details->remove_theme_selector, - theme_selector->details->theme_selector_changed_connection); + theme_selector->details->remove_theme_selector_changed_connection); theme_selector_finish_remove (theme_selector); g_signal_handler_unblock (theme_selector->details->remove_theme_selector, - theme_selector->details->theme_selector_changed_connection); + theme_selector->details->remove_theme_selector_changed_connection); selected_theme = nautilus_theme_selector_get_selected_theme (theme_selector); @@ -514,22 +512,19 @@ nautilus_theme_selector_instance_init (NautilusThemeSelector *theme_selector) gtk_box_pack_end (GTK_BOX (alignment_box), button_box, FALSE, FALSE, 2); theme_selector->details->install_theme_button = gtk_button_new_with_label (_("Add New Theme...")); - g_signal_connect (theme_selector->details->install_theme_button, - "clicked", - G_CALLBACK (install_theme_button_clicked_callback), - theme_selector); + g_signal_connect_object (theme_selector->details->install_theme_button, "clicked", + G_CALLBACK (install_theme_button_clicked_callback), + theme_selector, 0); theme_selector->details->remove_theme_button = gtk_button_new_with_label (_("Remove Theme...")); - g_signal_connect (theme_selector->details->remove_theme_button, - "clicked", - G_CALLBACK (remove_theme_button_clicked_callback), - theme_selector); + g_signal_connect_object (theme_selector->details->remove_theme_button, "clicked", + G_CALLBACK (remove_theme_button_clicked_callback), + theme_selector, 0); theme_selector->details->cancel_remove_button = gtk_button_new_with_label (_("Cancel Remove")); - g_signal_connect (theme_selector->details->cancel_remove_button, - "clicked", - G_CALLBACK (cancel_remove_button_clicked_callback), - theme_selector); + g_signal_connect_object (theme_selector->details->cancel_remove_button, "clicked", + G_CALLBACK (cancel_remove_button_clicked_callback), + theme_selector, 0); gtk_box_pack_start (GTK_BOX (button_box), theme_selector->details->cancel_remove_button, TRUE, FALSE, 0); gtk_box_pack_start (GTK_BOX (button_box), theme_selector->details->install_theme_button, TRUE, FALSE, 4); @@ -557,16 +552,14 @@ nautilus_theme_selector_instance_init (NautilusThemeSelector *theme_selector) theme_selector_update_remove_theme_button (theme_selector); - g_signal_connect (theme_selector->details->theme_selector, - "selection_changed", - G_CALLBACK (theme_selector_changed_callback), - theme_selector); + g_signal_connect_object (theme_selector->details->theme_selector, "selection_changed", + G_CALLBACK (theme_selector_changed_callback), + theme_selector, 0); - theme_selector->details->theme_selector_changed_connection = - g_signal_connect (theme_selector->details->remove_theme_selector, - "selection_changed", - G_CALLBACK (remove_theme_selector_changed_callback), - theme_selector); + theme_selector->details->remove_theme_selector_changed_connection = + g_signal_connect_object (theme_selector->details->remove_theme_selector, "selection_changed", + G_CALLBACK (remove_theme_selector_changed_callback), + theme_selector, 0); } static void diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 7753fbace..ec675085b 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -599,9 +599,8 @@ update_for_new_location (NautilusWindow *window) nautilus_window_set_viewed_file (window, file); window->details->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file); nautilus_file_monitor_add (file, &window->details->viewed_file, NULL); - g_signal_connect (file, "changed", - G_CALLBACK (viewed_file_changed_callback), - window); + g_signal_connect_object (file, "changed", + G_CALLBACK (viewed_file_changed_callback), window, 0); nautilus_file_unref (file); /* Check if we can go up. */ diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index a93870e5a..6fc34d2c2 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -138,11 +138,11 @@ bookmark_holder_new (NautilusBookmark *bookmark, new_bookmark_holder->prompt_for_removal = is_bookmarks_menu; new_bookmark_holder->changed_handler_id = - g_signal_connect_swapped (bookmark, "appearance_changed", - is_bookmarks_menu - ? G_CALLBACK (schedule_refresh_bookmarks_menu) - : G_CALLBACK (schedule_refresh_go_menu), - window); + g_signal_connect_object (bookmark, "appearance_changed", + is_bookmarks_menu + ? G_CALLBACK (schedule_refresh_bookmarks_menu) + : G_CALLBACK (schedule_refresh_go_menu), + window, G_CONNECT_SWAPPED); return new_bookmark_holder; } @@ -353,10 +353,8 @@ forget_history_if_confirmed (NautilusWindow *window) GTK_WINDOW (window)); g_free (prompt); - g_signal_connect (dialog, - "response", - G_CALLBACK (forget_history_if_yes), - NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (forget_history_if_yes), NULL); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_NO); } @@ -1151,8 +1149,8 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window) nautilus_window_update_show_hide_menu_items (window); /* Register to catch Bonobo UI events so we can notice View As changes */ - g_signal_connect (window->details->shell_ui, "ui_event", - G_CALLBACK (nautilus_window_handle_ui_event_callback), window); + g_signal_connect_object (window->details->shell_ui, "ui_event", + G_CALLBACK (nautilus_window_handle_ui_event_callback), window, 0); bonobo_ui_component_thaw (window->details->shell_ui, NULL); diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c index acd363231..bbb77bbff 100644 --- a/src/nautilus-window-toolbars.c +++ b/src/nautilus-window-toolbars.c @@ -107,13 +107,11 @@ create_back_or_forward_menu (NautilusWindow *window, gboolean back) menu_item = nautilus_bookmark_menu_item_new (NAUTILUS_BOOKMARK (list_link->data)); g_object_set_data (G_OBJECT (menu_item), "user_data", GINT_TO_POINTER (index)); gtk_widget_show (GTK_WIDGET (menu_item)); - g_signal_connect - (menu_item, - "activate", - back - ? G_CALLBACK (activate_back_menu_item_callback) - : G_CALLBACK (activate_forward_menu_item_callback), - window); + g_signal_connect_object (menu_item, "activate", + back + ? G_CALLBACK (activate_back_menu_item_callback) + : G_CALLBACK (activate_forward_menu_item_callback), + window, 0); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); list_link = g_list_next (list_link); @@ -370,14 +368,12 @@ create_back_or_forward_toolbar_item (NautilusWindow *window, gtk_widget_show (GTK_WIDGET (item)); button = bonobo_ui_toolbar_button_item_get_button_widget (item); - g_signal_connect (button, - "button_press_event", - G_CALLBACK (back_or_forward_button_pressed_callback), - window); - g_signal_connect (button, - "clicked", - G_CALLBACK (back_or_forward_button_clicked_callback), - window); + g_signal_connect_object (button, "button_press_event", + G_CALLBACK (back_or_forward_button_pressed_callback), + window, 0); + g_signal_connect_object (button, "clicked", + G_CALLBACK (back_or_forward_button_clicked_callback), + window, 0); wrapper = bonobo_control_new (GTK_WIDGET (item)); pb = bonobo_property_bag_new ( diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 787c9f170..d04614497 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -572,11 +572,10 @@ nautilus_window_constructed (NautilusWindow *window) window->navigation_bar = nautilus_switchable_navigation_bar_new (window); gtk_widget_show (GTK_WIDGET (window->navigation_bar)); - g_signal_connect (window->navigation_bar, "location_changed", - G_CALLBACK (navigation_bar_location_changed_callback), window); - - g_signal_connect (window->navigation_bar, "mode_changed", - G_CALLBACK (navigation_bar_mode_changed_callback), window); + g_signal_connect_object (window->navigation_bar, "location_changed", + G_CALLBACK (navigation_bar_location_changed_callback), window, 0); + g_signal_connect_object (window->navigation_bar, "mode_changed", + G_CALLBACK (navigation_bar_mode_changed_callback), window, 0); gtk_box_pack_start (GTK_BOX (location_bar_box), window->navigation_bar, TRUE, TRUE, GNOME_PAD_SMALL); @@ -600,14 +599,18 @@ nautilus_window_constructed (NautilusWindow *window) * It gets shown later, if the view-frame contains something zoomable. */ window->zoom_control = nautilus_zoom_control_new (); - g_signal_connect_swapped (window->zoom_control, "zoom_in", - G_CALLBACK (nautilus_window_zoom_in), window); - g_signal_connect_swapped (window->zoom_control, "zoom_out", - G_CALLBACK (nautilus_window_zoom_out), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_level", - G_CALLBACK (nautilus_window_zoom_to_level), window); - g_signal_connect_swapped (window->zoom_control, "zoom_to_fit", - G_CALLBACK (nautilus_window_zoom_to_fit), window); + g_signal_connect_object (window->zoom_control, "zoom_in", + G_CALLBACK (nautilus_window_zoom_in), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_out", + G_CALLBACK (nautilus_window_zoom_out), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_level", + G_CALLBACK (nautilus_window_zoom_to_level), + window, G_CONNECT_SWAPPED); + g_signal_connect_object (window->zoom_control, "zoom_to_fit", + G_CALLBACK (nautilus_window_zoom_to_fit), + window, G_CONNECT_SWAPPED); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show (location_bar_box); @@ -626,8 +629,8 @@ nautilus_window_constructed (NautilusWindow *window) /* set up the sidebar */ window->sidebar = nautilus_sidebar_new (); gtk_widget_show (GTK_WIDGET (window->sidebar)); - g_signal_connect (window->sidebar, "location_changed", - G_CALLBACK (go_to_callback), window); + g_signal_connect_object (window->sidebar, "location_changed", + G_CALLBACK (go_to_callback), window, 0); gtk_paned_pack1 (GTK_PANED (window->content_hbox), GTK_WIDGET (window->sidebar), FALSE, TRUE); @@ -1045,14 +1048,11 @@ create_view_as_menu_item (NautilusWindow *window, menu_item = gtk_menu_item_new_with_label (menu_label); g_free (menu_label); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_switch_views_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_switch_views_callback), + window, 0); - g_object_set_data (G_OBJECT (menu_item), - "viewer index", - GINT_TO_POINTER (index)); + g_object_set_data (G_OBJECT (menu_item), "viewer index", GINT_TO_POINTER (index)); gtk_widget_show (menu_item); @@ -1382,10 +1382,8 @@ load_view_as_menus_callback (NautilusFile *file, /* Add "View as..." extra bonus choice. */ menu_item = gtk_menu_item_new_with_label (_("View as...")); - g_signal_connect (menu_item, - "activate", - G_CALLBACK (view_as_menu_choose_view_callback), - window); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (view_as_menu_choose_view_callback), window, 0); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item); diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c index 3b211ea3f..1a7b69b6c 100644 --- a/src/nautilus-zoom-control.c +++ b/src/nautilus-zoom-control.c @@ -556,9 +556,8 @@ create_zoom_menu_item (GtkMenu *menu, GtkWidget *widget, float zoom_level, zoom_level == zoom_control->details->zoom_level); g_object_set_data_full (G_OBJECT (menu_item), "zoom_level", zoom_level_ptr, g_free); - g_signal_connect (menu_item, "activate", - G_CALLBACK (zoom_menu_callback), - zoom_control); + g_signal_connect_object (menu_item, "activate", + G_CALLBACK (zoom_menu_callback), zoom_control, 0); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); |