diff options
author | Felix Riemann <[email protected]> | 2013-10-04 12:07:29 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-07-17 21:53:38 +0200 |
commit | 5a5612ab8ec4fb31464fa35e049a4a3b7cb64393 (patch) | |
tree | 0eee4a38e9d5f8f5d39beb5132c57a84c50a0e09 /src | |
parent | a3c97eb293bfff825c43bd10d5584ae5a20f5495 (diff) | |
download | eom-5a5612ab8ec4fb31464fa35e049a4a3b7cb64393.tar.bz2 eom-5a5612ab8ec4fb31464fa35e049a4a3b7cb64393.tar.xz |
Convert to G_DEFINE_TYPE_WITH_PRIVATE part 1
origin commits:
https://gitlab.gnome.org/GNOME/eog/commit/35c3864
https://gitlab.gnome.org/GNOME/eog/commit/842775b
https://gitlab.gnome.org/GNOME/eog/commit/3fe0bd4
https://gitlab.gnome.org/GNOME/eog/commit/2b25632
https://gitlab.gnome.org/GNOME/eog/commit/f0c977d
https://gitlab.gnome.org/GNOME/eog/commit/5cdb1b8
https://gitlab.gnome.org/GNOME/eog/commit/dba0bd4
https://gitlab.gnome.org/GNOME/eog/commit/8e31683
https://gitlab.gnome.org/GNOME/eog/commit/3945bb1
Diffstat (limited to 'src')
-rw-r--r-- | src/eom-properties-dialog.c | 11 | ||||
-rw-r--r-- | src/eom-scroll-view.c | 9 | ||||
-rw-r--r-- | src/eom-sidebar.c | 9 | ||||
-rw-r--r-- | src/eom-statusbar.c | 13 | ||||
-rw-r--r-- | src/eom-thumb-nav.c | 15 | ||||
-rw-r--r-- | src/eom-thumb-view.c | 14 | ||||
-rw-r--r-- | src/eom-transform.c | 9 | ||||
-rw-r--r-- | src/eom-uri-converter.c | 11 | ||||
-rw-r--r-- | src/eom-window.c | 11 |
9 files changed, 30 insertions, 72 deletions
diff --git a/src/eom-properties-dialog.c b/src/eom-properties-dialog.c index 1550971..1999040 100644 --- a/src/eom-properties-dialog.c +++ b/src/eom-properties-dialog.c @@ -51,11 +51,6 @@ #include "eom-exif-details.h" #endif -#define EOM_PROPERTIES_DIALOG_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PROPERTIES_DIALOG, EomPropertiesDialogPrivate)) - -G_DEFINE_TYPE (EomPropertiesDialog, eom_properties_dialog, EOM_TYPE_DIALOG); - enum { PROP_0, PROP_THUMBVIEW, @@ -112,6 +107,8 @@ struct _EomPropertiesDialogPrivate { gboolean netbook_mode; }; +G_DEFINE_TYPE_WITH_PRIVATE (EomPropertiesDialog, eom_properties_dialog, EOM_TYPE_DIALOG); + static void pd_update_general_tab (EomPropertiesDialog *prop_dlg, EomImage *image) @@ -594,8 +591,6 @@ eom_properties_dialog_class_init (EomPropertiesDialogClass *class) FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_type_class_add_private (g_object_class, sizeof (EomPropertiesDialogPrivate)); } static void @@ -610,7 +605,7 @@ eom_properties_dialog_init (EomPropertiesDialog *prop_dlg) GtkWidget *sw; #endif - prop_dlg->priv = EOM_PROPERTIES_DIALOG_GET_PRIVATE (prop_dlg); + prop_dlg->priv = eom_properties_dialog_get_instance_private (prop_dlg); priv = prop_dlg->priv; diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index 0b070b9..1458c18 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -165,12 +165,9 @@ static void view_on_drag_data_get_cb (GtkWidget *widget, GtkSelectionData *data, guint info, guint time, gpointer user_data); -#define EOM_SCROLL_VIEW_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_SCROLL_VIEW, EomScrollViewPrivate)) - static gboolean _eom_gdk_rgba_equal0 (const GdkRGBA *a, const GdkRGBA *b); -G_DEFINE_TYPE (EomScrollView, eom_scroll_view, GTK_TYPE_GRID) +G_DEFINE_TYPE_WITH_PRIVATE (EomScrollView, eom_scroll_view, GTK_TYPE_GRID) /*=================================== widget size changing handler & @@ -1815,7 +1812,7 @@ eom_scroll_view_init (EomScrollView *view) GSettings *settings; EomScrollViewPrivate *priv; - priv = view->priv = EOM_SCROLL_VIEW_GET_PRIVATE (view); + priv = view->priv = eom_scroll_view_get_instance_private (view); settings = g_settings_new (EOM_CONF_VIEW); priv->zoom = 1.0; @@ -2171,8 +2168,6 @@ eom_scroll_view_class_init (EomScrollViewClass *klass) G_TYPE_DOUBLE); widget_class->size_allocate = eom_scroll_view_size_allocate; - - g_type_class_add_private (klass, sizeof (EomScrollViewPrivate)); } static void diff --git a/src/eom-sidebar.c b/src/eom-sidebar.c index 37a7cf4..18e86ec 100644 --- a/src/eom-sidebar.c +++ b/src/eom-sidebar.c @@ -64,10 +64,7 @@ struct _EomSidebarPrivate { GtkTreeModel *page_model; }; -G_DEFINE_TYPE (EomSidebar, eom_sidebar, GTK_TYPE_BOX) - -#define EOM_SIDEBAR_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_SIDEBAR, EomSidebarPrivate)) +G_DEFINE_TYPE_WITH_PRIVATE (EomSidebar, eom_sidebar, GTK_TYPE_BOX) static void eom_sidebar_destroy (GtkWidget *object) @@ -185,8 +182,6 @@ eom_sidebar_class_init (EomSidebarClass *eom_sidebar_class) g_object_class = G_OBJECT_CLASS (eom_sidebar_class); widget_class = GTK_WIDGET_CLASS (eom_sidebar_class); - g_type_class_add_private (g_object_class, sizeof (EomSidebarPrivate)); - widget_class->destroy = eom_sidebar_destroy; g_object_class->get_property = eom_sidebar_get_property; g_object_class->set_property = eom_sidebar_set_property; @@ -350,7 +345,7 @@ eom_sidebar_init (EomSidebar *eom_sidebar) GtkWidget *arrow; GtkWidget *image; - eom_sidebar->priv = EOM_SIDEBAR_GET_PRIVATE (eom_sidebar); + eom_sidebar->priv = eom_sidebar_get_instance_private (eom_sidebar); /* data model */ eom_sidebar->priv->page_model = (GtkTreeModel *) diff --git a/src/eom-statusbar.c b/src/eom-statusbar.c index b13ad0b..7ed9412 100644 --- a/src/eom-statusbar.c +++ b/src/eom-statusbar.c @@ -30,23 +30,18 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#define EOM_STATUSBAR_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_STATUSBAR, EomStatusbarPrivate)) - -G_DEFINE_TYPE (EomStatusbar, eom_statusbar, GTK_TYPE_STATUSBAR) - struct _EomStatusbarPrivate { GtkWidget *progressbar; GtkWidget *img_num_label; }; +G_DEFINE_TYPE_WITH_PRIVATE (EomStatusbar, eom_statusbar, GTK_TYPE_STATUSBAR) + static void eom_statusbar_class_init (EomStatusbarClass *klass) { - GObjectClass *g_object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (g_object_class, sizeof (EomStatusbarPrivate)); + /* empty */ } static void @@ -55,7 +50,7 @@ eom_statusbar_init (EomStatusbar *statusbar) EomStatusbarPrivate *priv; GtkWidget *vbox; - statusbar->priv = EOM_STATUSBAR_GET_PRIVATE (statusbar); + statusbar->priv = eom_statusbar_get_instance_private (statusbar); priv = statusbar->priv; gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0); diff --git a/src/eom-thumb-nav.c b/src/eom-thumb-nav.c index 73d2193..54da189 100644 --- a/src/eom-thumb-nav.c +++ b/src/eom-thumb-nav.c @@ -33,11 +33,6 @@ #include <math.h> #include <string.h> -#define EOM_THUMB_NAV_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_THUMB_NAV, EomThumbNavPrivate)) - -G_DEFINE_TYPE (EomThumbNav, eom_thumb_nav, GTK_TYPE_BOX); - #define EOM_THUMB_NAV_SCROLL_INC 20 #define EOM_THUMB_NAV_SCROLL_MOVE 20 #define EOM_THUMB_NAV_SCROLL_TIMEOUT 20 @@ -65,6 +60,8 @@ struct _EomThumbNavPrivate { GtkAdjustment *adj; }; +G_DEFINE_TYPE_WITH_PRIVATE (EomThumbNav, eom_thumb_nav, GTK_TYPE_BOX); + static gboolean eom_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { @@ -122,7 +119,7 @@ eom_thumb_nav_adj_changed (GtkAdjustment *adj, gpointer user_data) gboolean ltr; nav = EOM_THUMB_NAV (user_data); - priv = EOM_THUMB_NAV_GET_PRIVATE (nav); + priv = eom_thumb_nav_get_instance_private (nav); ltr = gtk_widget_get_direction (priv->sw) == GTK_TEXT_DIR_LTR; gtk_widget_set_sensitive (ltr ? priv->button_right : priv->button_left, @@ -139,7 +136,7 @@ eom_thumb_nav_adj_value_changed (GtkAdjustment *adj, gpointer user_data) gboolean ltr; nav = EOM_THUMB_NAV (user_data); - priv = EOM_THUMB_NAV_GET_PRIVATE (nav); + priv = eom_thumb_nav_get_instance_private (nav); ltr = gtk_widget_get_direction (priv->sw) == GTK_TEXT_DIR_LTR; gtk_widget_set_sensitive (ltr ? priv->button_left : priv->button_right, @@ -334,8 +331,6 @@ eom_thumb_nav_class_init (EomThumbNavClass *class) EOM_THUMB_NAV_MODE_MULTIPLE_ROWS, EOM_THUMB_NAV_MODE_ONE_ROW, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_type_class_add_private (g_object_class, sizeof (EomThumbNavPrivate)); } static void @@ -347,7 +342,7 @@ eom_thumb_nav_init (EomThumbNav *nav) gtk_orientable_set_orientation (GTK_ORIENTABLE (nav), GTK_ORIENTATION_HORIZONTAL); - nav->priv = EOM_THUMB_NAV_GET_PRIVATE (nav); + nav->priv = eom_thumb_nav_get_instance_private (nav); priv = nav->priv; diff --git a/src/eom-thumb-view.c b/src/eom-thumb-view.c index a85c2d0..b4f9c67 100644 --- a/src/eom-thumb-view.c +++ b/src/eom-thumb-view.c @@ -45,9 +45,6 @@ enum { #define EOM_THUMB_VIEW_SPACING 0 -#define EOM_THUMB_VIEW_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_THUMB_VIEW, EomThumbViewPrivate)) - static void eom_thumb_view_init (EomThumbView *thumbview); static EomImage* eom_thumb_view_get_image_from_path (EomThumbView *thumbview, @@ -58,9 +55,6 @@ static void eom_thumb_view_popup_menu (EomThumbView *widget, static void eom_thumb_view_update_columns (EomThumbView *view); -G_DEFINE_TYPE_WITH_CODE (EomThumbView, eom_thumb_view, GTK_TYPE_ICON_VIEW, - G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)); - static gboolean thumbview_on_query_tooltip_cb (GtkWidget *widget, gint x, @@ -94,6 +88,10 @@ struct _EomThumbViewPrivate { gulong image_removed_id; }; +G_DEFINE_TYPE_WITH_CODE (EomThumbView, eom_thumb_view, GTK_TYPE_ICON_VIEW, + G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL) \ + G_ADD_PRIVATE (EomThumbView)); + /* Drag 'n Drop */ static void @@ -237,8 +235,6 @@ eom_thumb_view_class_init (EomThumbViewClass *class) g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation"); - - g_type_class_add_private (class, sizeof (EomThumbViewPrivate)); } static void @@ -640,7 +636,7 @@ thumbview_on_query_tooltip_cb (GtkWidget *widget, static void eom_thumb_view_init (EomThumbView *thumbview) { - thumbview->priv = EOM_THUMB_VIEW_GET_PRIVATE (thumbview); + thumbview->priv = eom_thumb_view_get_instance_private (thumbview); thumbview->priv->visible_range_changed_id = 0; thumbview->priv->image_add_id = 0; diff --git a/src/eom-transform.c b/src/eom-transform.c index 5009fab..04e6de0 100644 --- a/src/eom-transform.c +++ b/src/eom-transform.c @@ -47,21 +47,18 @@ typedef struct { /* Convert degrees into radians */ #define EOM_DEG_TO_RAD(degree) ((degree) * (G_PI/180.0)) -#define EOM_TRANSFORM_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_TRANSFORM, EomTransformPrivate)) - -G_DEFINE_TYPE (EomTransform, eom_transform, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (EomTransform, eom_transform, G_TYPE_OBJECT) static void eom_transform_init (EomTransform *trans) { - trans->priv = EOM_TRANSFORM_GET_PRIVATE (trans); + trans->priv = eom_transform_get_instance_private (trans); } static void eom_transform_class_init (EomTransformClass *klass) { - g_type_class_add_private (klass, sizeof (EomTransformPrivate)); + } /** diff --git a/src/eom-uri-converter.c b/src/eom-uri-converter.c index 15f519a..2397a28 100644 --- a/src/eom-uri-converter.c +++ b/src/eom-uri-converter.c @@ -51,10 +51,7 @@ static void eom_uri_converter_get_property (GObject *object, GValue *value, GParamSpec *pspec); -#define EOM_URI_CONVERTER_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_URI_CONVERTER, EomURIConverterPrivate)) - -G_DEFINE_TYPE (EomURIConverter, eom_uri_converter, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (EomURIConverter, eom_uri_converter, G_TYPE_OBJECT) static void free_token (gpointer data) @@ -97,11 +94,11 @@ eom_uri_converter_dispose (GObject *object) } static void -eom_uri_converter_init (EomURIConverter *obj) +eom_uri_converter_init (EomURIConverter *conv) { EomURIConverterPrivate *priv; - priv = obj->priv = EOM_URI_CONVERTER_GET_PRIVATE (obj); + priv = conv->priv = eom_uri_converter_get_instance_private (conv); priv->convert_spaces = FALSE; priv->space_character = '_'; @@ -161,8 +158,6 @@ eom_uri_converter_class_init (EomURIConverterClass *klass) G_MAXUINT, 1, G_PARAM_WRITABLE)); - - g_type_class_add_private (klass, sizeof (EomURIConverterPrivate)); } GQuark diff --git a/src/eom-window.c b/src/eom-window.c index 787c116..b2a8c94 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -85,11 +85,6 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include <libmate-desktop/mate-desktop-utils.h> -#define EOM_WINDOW_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_WINDOW, EomWindowPrivate)) - -G_DEFINE_TYPE (EomWindow, eom_window, GTK_TYPE_APPLICATION_WINDOW); - #define EOM_WINDOW_MIN_WIDTH 440 #define EOM_WINDOW_MIN_HEIGHT 350 @@ -199,6 +194,8 @@ struct _EomWindowPrivate { #endif }; +G_DEFINE_TYPE_WITH_PRIVATE (EomWindow, eom_window, GTK_TYPE_APPLICATION_WINDOW); + static void eom_window_cmd_fullscreen (GtkAction *action, gpointer user_data); static void eom_window_run_fullscreen (EomWindow *window, gboolean slideshow); static void eom_window_cmd_slideshow (GtkAction *action, gpointer user_data); @@ -4597,7 +4594,7 @@ eom_window_init (EomWindow *window) screen = gtk_widget_get_screen (GTK_WIDGET (window)); - priv = window->priv = EOM_WINDOW_GET_PRIVATE (window); + priv = window->priv = eom_window_get_instance_private (window); priv->view_settings = g_settings_new (EOM_CONF_VIEW); priv->ui_settings = g_settings_new (EOM_CONF_UI); @@ -5215,8 +5212,6 @@ eom_window_class_init (EomWindowClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - - g_type_class_add_private (g_object_class, sizeof (EomWindowPrivate)); } /** |