diff options
author | Wu Xiaotian <[email protected]> | 2019-01-24 17:49:38 +0800 |
---|---|---|
committer | lukefromdc <[email protected]> | 2019-01-28 03:13:55 +0000 |
commit | e8f124db938d82554f98a325dc23e9e09e195eb4 (patch) | |
tree | 181b91a8b83ac64a9e86efc5b3b4266c33d3512b /src/file-manager | |
parent | 331a0e15750c92795aedb05a5e4178c6acc16bc1 (diff) | |
download | caja-e8f124db938d82554f98a325dc23e9e09e195eb4.tar.bz2 caja-e8f124db938d82554f98a325dc23e9e09e195eb4.tar.xz |
Avoid deprecated g_type_class_add_private
- caja-connect-server-dialog
- caja-navigation-window
- caja-property-browser
- caja-sidebar-title
- caja-trash-bar
- caja-window
- caja-zoom-action
- caja-zoom-control
- fm-desktop-icon-view
- fm-properties-window
Diffstat (limited to 'src/file-manager')
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 52 | ||||
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.h | 4 | ||||
-rw-r--r-- | src/file-manager/fm-properties-window.c | 10 | ||||
-rw-r--r-- | src/file-manager/fm-properties-window.h | 4 |
4 files changed, 31 insertions, 39 deletions
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index f6b563c3..01060fe5 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -62,7 +62,7 @@ /* Timeout to check the desktop directory for updates */ #define RESCAN_TIMEOUT 4 -struct FMDesktopIconViewDetails +struct _FMDesktopIconViewPrivate { GdkWindow *root_window; GtkActionGroup *desktop_action_group; @@ -86,7 +86,7 @@ static gboolean real_supports_zooming (FMDirectoryVi static void fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *view); static void font_changed_callback (gpointer callback_data); -G_DEFINE_TYPE (FMDesktopIconView, fm_desktop_icon_view, FM_TYPE_ICON_VIEW) +G_DEFINE_TYPE_WITH_PRIVATE (FMDesktopIconView, fm_desktop_icon_view, FM_TYPE_ICON_VIEW) static char *desktop_directory; static time_t desktop_dir_modify_time; @@ -267,18 +267,18 @@ fm_desktop_icon_view_dispose (GObject *object) icon_view = FM_DESKTOP_ICON_VIEW (object); /* Remove desktop rescan timeout. */ - if (icon_view->details->reload_desktop_timeout != 0) + if (icon_view->priv->reload_desktop_timeout != 0) { - g_source_remove (icon_view->details->reload_desktop_timeout); - icon_view->details->reload_desktop_timeout = 0; + g_source_remove (icon_view->priv->reload_desktop_timeout); + icon_view->priv->reload_desktop_timeout = 0; } ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view)); if (ui_manager != NULL) { caja_ui_unmerge_ui (ui_manager, - &icon_view->details->desktop_merge_id, - &icon_view->details->desktop_action_group); + &icon_view->priv->desktop_merge_id, + &icon_view->priv->desktop_action_group); } g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, @@ -311,8 +311,6 @@ fm_desktop_icon_view_class_init (FMDesktopIconViewClass *class) FM_ICON_VIEW_CLASS (class)->supports_scaling = real_supports_scaling; FM_ICON_VIEW_CLASS (class)->supports_keep_aligned = real_supports_keep_aligned; FM_ICON_VIEW_CLASS (class)->supports_labels_beside_icons = real_supports_labels_beside_icons; - - g_type_class_add_private (class, sizeof (FMDesktopIconViewDetails)); } static void @@ -381,13 +379,13 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, static void unrealized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view) { - g_return_if_fail (desktop_icon_view->details->root_window != NULL); + g_return_if_fail (desktop_icon_view->priv->root_window != NULL); /* Remove the property filter */ - gdk_window_remove_filter (desktop_icon_view->details->root_window, + gdk_window_remove_filter (desktop_icon_view->priv->root_window, desktop_icon_view_property_filter, desktop_icon_view); - desktop_icon_view->details->root_window = NULL; + desktop_icon_view->priv->root_window = NULL; } static void @@ -398,7 +396,7 @@ realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view) GtkAllocation allocation; gint scale; - g_return_if_fail (desktop_icon_view->details->root_window == NULL); + g_return_if_fail (desktop_icon_view->priv->root_window == NULL); screen = gtk_widget_get_screen (widget); scale = gtk_widget_get_scale_factor (widget); @@ -418,7 +416,7 @@ realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view) root_window = gdk_screen_get_root_window (screen); - desktop_icon_view->details->root_window = root_window; + desktop_icon_view->priv->root_window = root_window; /* Read out the workarea geometry and update the icon container accordingly */ net_workarea_changed (desktop_icon_view, root_window); @@ -468,7 +466,7 @@ do_desktop_rescan (gpointer data) struct stat buf; desktop_icon_view = FM_DESKTOP_ICON_VIEW (data); - if (desktop_icon_view->details->pending_rescan) + if (desktop_icon_view->priv->pending_rescan) { return TRUE; } @@ -483,7 +481,7 @@ do_desktop_rescan (gpointer data) return TRUE; } - desktop_icon_view->details->pending_rescan = TRUE; + desktop_icon_view->priv->pending_rescan = TRUE; caja_directory_force_reload ( fm_directory_view_get_model ( @@ -497,7 +495,7 @@ done_loading (CajaDirectory *model, { struct stat buf; - desktop_icon_view->details->pending_rescan = FALSE; + desktop_icon_view->priv->pending_rescan = FALSE; if (stat (desktop_directory, &buf) == -1) { return; @@ -519,13 +517,13 @@ delayed_init (FMDesktopIconView *desktop_icon_view) G_CALLBACK (done_loading), desktop_icon_view, 0); /* Monitor desktop directory. */ - desktop_icon_view->details->reload_desktop_timeout = + desktop_icon_view->priv->reload_desktop_timeout = g_timeout_add_seconds (RESCAN_TIMEOUT, do_desktop_rescan, desktop_icon_view); g_signal_handler_disconnect (desktop_icon_view, - desktop_icon_view->details->delayed_init_signal); + desktop_icon_view->priv->delayed_init_signal); - desktop_icon_view->details->delayed_init_signal = 0; + desktop_icon_view->priv->delayed_init_signal = 0; } static void @@ -559,9 +557,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) GtkAllocation allocation; GtkAdjustment *hadj, *vadj; - desktop_icon_view->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_icon_view, - FM_TYPE_DESKTOP_ICON_VIEW, - FMDesktopIconViewDetails); + desktop_icon_view->priv = fm_desktop_icon_view_get_instance_private (desktop_icon_view); if (desktop_directory == NULL) { @@ -581,7 +577,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) */ if (!caja_monitor_active ()) { - desktop_icon_view->details->delayed_init_signal = g_signal_connect_object + desktop_icon_view->priv->delayed_init_signal = g_signal_connect_object (desktop_icon_view, "begin_loading", G_CALLBACK (delayed_init), desktop_icon_view, 0); } @@ -737,14 +733,14 @@ real_update_menus (FMDirectoryView *view) /* New Launcher */ disable_command_line = g_settings_get_boolean (mate_lockdown_preferences, CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE); - action = gtk_action_group_get_action (desktop_view->details->desktop_action_group, + action = gtk_action_group_get_action (desktop_view->priv->desktop_action_group, FM_ACTION_NEW_LAUNCHER_DESKTOP); gtk_action_set_visible (action, !disable_command_line); /* Empty Trash */ include_empty_trash = trash_link_is_selection (view); - action = gtk_action_group_get_action (desktop_view->details->desktop_action_group, + action = gtk_action_group_get_action (desktop_view->priv->desktop_action_group, FM_ACTION_EMPTY_TRASH_CONDITIONAL); gtk_action_set_visible (action, include_empty_trash); @@ -805,7 +801,7 @@ real_merge_menus (FMDirectoryView *view) action_group = gtk_action_group_new ("DesktopViewActions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); - desktop_view->details->desktop_action_group = action_group; + desktop_view->priv->desktop_action_group = action_group; gtk_action_group_add_actions (action_group, desktop_view_entries, G_N_ELEMENTS (desktop_view_entries), view); @@ -814,7 +810,7 @@ real_merge_menus (FMDirectoryView *view) g_object_unref (action_group); /* owned by ui manager */ ui = caja_ui_string_get ("caja-desktop-icon-view-ui.xml"); - desktop_view->details->desktop_merge_id = + desktop_view->priv->desktop_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL); } diff --git a/src/file-manager/fm-desktop-icon-view.h b/src/file-manager/fm-desktop-icon-view.h index f0ed0f1f..c29d125d 100644 --- a/src/file-manager/fm-desktop-icon-view.h +++ b/src/file-manager/fm-desktop-icon-view.h @@ -41,11 +41,11 @@ #define FM_DESKTOP_ICON_VIEW_ID "OAFIID:Caja_File_Manager_Desktop_Icon_View" -typedef struct FMDesktopIconViewDetails FMDesktopIconViewDetails; +typedef struct _FMDesktopIconViewPrivate FMDesktopIconViewPrivate; typedef struct { FMIconView parent; - FMDesktopIconViewDetails *details; + FMDesktopIconViewPrivate *priv; } FMDesktopIconView; typedef struct diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 90d97717..7eafb9a5 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -83,7 +83,7 @@ static GHashTable *windows; static GHashTable *pending_lists; -struct FMPropertiesWindowDetails { +struct _FMPropertiesWindowPrivate { GList *original_files; GList *target_files; @@ -231,7 +231,7 @@ static GtkLabel *attach_ellipsizing_value_label (GtkGrid *grid, static GtkWidget* create_pie_widget (FMPropertiesWindow *window); -G_DEFINE_TYPE (FMPropertiesWindow, fm_properties_window, GTK_TYPE_DIALOG); +G_DEFINE_TYPE_WITH_PRIVATE (FMPropertiesWindow, fm_properties_window, GTK_TYPE_DIALOG); static gboolean is_multi_file_window (FMPropertiesWindow *window) @@ -5762,14 +5762,10 @@ fm_properties_window_class_init (FMPropertiesWindowClass *class) binding_set = gtk_binding_set_by_class (class); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); - - g_type_class_add_private (class, sizeof (FMPropertiesWindowDetails)); } static void fm_properties_window_init (FMPropertiesWindow *window) { - window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, FM_TYPE_PROPERTIES_WINDOW, - FMPropertiesWindowDetails); - + window->details = fm_properties_window_get_instance_private (window); } diff --git a/src/file-manager/fm-properties-window.h b/src/file-manager/fm-properties-window.h index 38eb0e15..860b76bb 100644 --- a/src/file-manager/fm-properties-window.h +++ b/src/file-manager/fm-properties-window.h @@ -43,12 +43,12 @@ typedef struct FMPropertiesWindow FMPropertiesWindow; #define FM_PROPERTIES_WINDOW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_PROPERTIES_WINDOW, FMPropertiesWindowClass)) -typedef struct FMPropertiesWindowDetails FMPropertiesWindowDetails; +typedef struct _FMPropertiesWindowPrivate FMPropertiesWindowPrivate; struct FMPropertiesWindow { GtkDialog window; - FMPropertiesWindowDetails *details; + FMPropertiesWindowPrivate *details; }; struct FMPropertiesWindowClass |