From 419613671dcf6ec55d8dc49f7bbbb9d11c19d54c Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Sat, 26 Jan 2019 12:16:47 +0800 Subject: Avoid deprecated g_type_class_add_private under src Changed CajaConnectServerOperation, CajaDesktopWindow and CajaImagePropertiesPage --- src/caja-connect-server-operation.c | 14 +++++--------- src/caja-connect-server-operation.h | 6 +++--- src/caja-desktop-window.c | 13 +++++-------- src/caja-desktop-window.h | 4 ++-- src/caja-image-properties-page.c | 10 +++------- src/caja-image-properties-page.h | 8 ++++++-- 6 files changed, 24 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/caja-connect-server-operation.c b/src/caja-connect-server-operation.c index 73daa364..d48d03b8 100644 --- a/src/caja-connect-server-operation.c +++ b/src/caja-connect-server-operation.c @@ -28,18 +28,18 @@ #include "caja-connect-server-dialog.h" -G_DEFINE_TYPE (CajaConnectServerOperation, - caja_connect_server_operation, GTK_TYPE_MOUNT_OPERATION); - enum { PROP_DIALOG = 1, NUM_PROPERTIES }; -struct _CajaConnectServerOperationDetails { +struct _CajaConnectServerOperationPrivate { CajaConnectServerDialog *dialog; }; +G_DEFINE_TYPE_WITH_PRIVATE (CajaConnectServerOperation, + caja_connect_server_operation, GTK_TYPE_MOUNT_OPERATION); + static void fill_details_async_cb (GObject *source, GAsyncResult *result, @@ -119,16 +119,12 @@ caja_connect_server_operation_class_init (CajaConnectServerOperationClass *klass CAJA_TYPE_CONNECT_SERVER_DIALOG, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_DIALOG, pspec); - - g_type_class_add_private (klass, sizeof (CajaConnectServerOperationDetails)); } static void caja_connect_server_operation_init (CajaConnectServerOperation *self) { - self->details = G_TYPE_INSTANCE_GET_PRIVATE (self, - CAJA_TYPE_CONNECT_SERVER_OPERATION, - CajaConnectServerOperationDetails); + self->details = caja_connect_server_operation_get_instance_private (self); } GMountOperation * diff --git a/src/caja-connect-server-operation.h b/src/caja-connect-server-operation.h index 8a81ec1f..84df443d 100644 --- a/src/caja-connect-server-operation.h +++ b/src/caja-connect-server-operation.h @@ -42,12 +42,12 @@ #define CAJA_IS_CONNECT_SERVER_OPERATION(obj)\ (G_TYPE_INSTANCE_CHECK_TYPE ((obj), CAJA_TYPE_CONNECT_SERVER_OPERATION) -typedef struct _CajaConnectServerOperationDetails - CajaConnectServerOperationDetails; +typedef struct _CajaConnectServerOperationPrivate + CajaConnectServerOperationPrivate; typedef struct { GtkMountOperation parent; - CajaConnectServerOperationDetails *details; + CajaConnectServerOperationPrivate *details; } CajaConnectServerOperation; typedef struct { diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c index 2e8ad5bd..50305b97 100644 --- a/src/caja-desktop-window.c +++ b/src/caja-desktop-window.c @@ -72,14 +72,14 @@ caja_desktop_window_accessible_class_init (CajaDesktopWindowAccessibleClass *kla aclass->get_attributes = desktop_get_attributes; } -struct CajaDesktopWindowDetails +struct _CajaDesktopWindowPrivate { gulong size_changed_id; gboolean loaded; }; -G_DEFINE_TYPE (CajaDesktopWindow, caja_desktop_window, +G_DEFINE_TYPE_WITH_PRIVATE (CajaDesktopWindow, caja_desktop_window, CAJA_TYPE_SPATIAL_WINDOW); static void @@ -88,8 +88,7 @@ caja_desktop_window_init (CajaDesktopWindow *window) GtkAction *action; AtkObject *accessible; - window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_DESKTOP_WINDOW, - CajaDesktopWindowDetails); + window->details = caja_desktop_window_get_instance_private (window); GtkStyleContext *context; @@ -222,7 +221,7 @@ static void unrealize (GtkWidget *widget) { CajaDesktopWindow *window; - CajaDesktopWindowDetails *details; + CajaDesktopWindowPrivate *details; GdkWindow *root_window; window = CAJA_DESKTOP_WINDOW (widget); @@ -280,7 +279,7 @@ static void realize (GtkWidget *widget) { CajaDesktopWindow *window; - CajaDesktopWindowDetails *details; + CajaDesktopWindowPrivate *details; window = CAJA_DESKTOP_WINDOW (widget); details = window->details; @@ -339,8 +338,6 @@ caja_desktop_window_class_init (CajaDesktopWindowClass *klass) nclass->window_type = CAJA_WINDOW_DESKTOP; nclass->get_title = real_get_title; nclass->get_icon = real_get_icon; - - g_type_class_add_private (klass, sizeof (CajaDesktopWindowDetails)); } gboolean diff --git a/src/caja-desktop-window.h b/src/caja-desktop-window.h index 5692177b..32b4f795 100644 --- a/src/caja-desktop-window.h +++ b/src/caja-desktop-window.h @@ -46,12 +46,12 @@ #define CAJA_DESKTOP_WINDOW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_DESKTOP_WINDOW, CajaDesktopWindowClass)) -typedef struct CajaDesktopWindowDetails CajaDesktopWindowDetails; +typedef struct _CajaDesktopWindowPrivate CajaDesktopWindowPrivate; typedef struct { CajaSpatialWindow parent_spot; - CajaDesktopWindowDetails *details; + CajaDesktopWindowPrivate *details; gboolean affect_desktop_on_next_location_change; } CajaDesktopWindow; diff --git a/src/caja-image-properties-page.c b/src/caja-image-properties-page.c index 465145df..8a6078e2 100644 --- a/src/caja-image-properties-page.c +++ b/src/caja-image-properties-page.c @@ -46,7 +46,7 @@ #define LOAD_BUFFER_SIZE 8192 -struct CajaImagePropertiesPageDetails +struct _CajaImagePropertiesPagePrivate { GCancellable *cancellable; GtkWidget *vbox; @@ -93,7 +93,7 @@ typedef struct static GType caja_image_properties_page_provider_get_type (void); static void property_page_provider_iface_init (CajaPropertyPageProviderIface *iface); -G_DEFINE_TYPE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_BOX); +G_DEFINE_TYPE_WITH_PRIVATE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_BOX); G_DEFINE_TYPE_WITH_CODE (CajaImagePropertiesPageProvider, caja_image_properties_page_provider, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (CAJA_TYPE_PROPERTY_PAGE_PROVIDER, @@ -635,16 +635,12 @@ caja_image_properties_page_class_init (CajaImagePropertiesPageClass *class) object_class = G_OBJECT_CLASS (class); object_class->finalize = caja_image_properties_page_finalize; - - g_type_class_add_private (object_class, sizeof(CajaImagePropertiesPageDetails)); } static void caja_image_properties_page_init (CajaImagePropertiesPage *page) { - page->details = G_TYPE_INSTANCE_GET_PRIVATE (page, - CAJA_TYPE_IMAGE_PROPERTIES_PAGE, - CajaImagePropertiesPageDetails); + page->details = caja_image_properties_page_get_instance_private (page); gtk_orientable_set_orientation (GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL); diff --git a/src/caja-image-properties-page.h b/src/caja-image-properties-page.h index 9725ffa4..0c0db793 100644 --- a/src/caja-image-properties-page.h +++ b/src/caja-image-properties-page.h @@ -26,6 +26,8 @@ #include +G_BEGIN_DECLS + #define CAJA_TYPE_IMAGE_PROPERTIES_PAGE caja_image_properties_page_get_type() #define CAJA_IMAGE_PROPERTIES_PAGE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_IMAGE_PROPERTIES_PAGE, CajaImagePropertiesPage)) @@ -38,12 +40,12 @@ #define CAJA_IMAGE_PROPERTIES_PAGE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_IMAGE_PROPERTIES_PAGE, CajaImagePropertiesPageClass)) -typedef struct CajaImagePropertiesPageDetails CajaImagePropertiesPageDetails; +typedef struct _CajaImagePropertiesPagePrivate CajaImagePropertiesPagePrivate; typedef struct { GtkBox parent; - CajaImagePropertiesPageDetails *details; + CajaImagePropertiesPagePrivate *details; } CajaImagePropertiesPage; typedef struct @@ -54,4 +56,6 @@ typedef struct GType caja_image_properties_page_get_type (void); void caja_image_properties_page_register (void); +G_END_DECLS + #endif /* CAJA_IMAGE_PROPERTIES_PAGE_H */ -- cgit v1.2.1