summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Riemann <[email protected]>2013-10-04 14:21:20 +0200
committerraveit65 <[email protected]>2018-07-17 21:53:38 +0200
commitfb7c5396f68f03f634a57654267a67191031e75d (patch)
treef634486c039fa81b6953abc192fffa02dca3d6a4
parent5a5612ab8ec4fb31464fa35e049a4a3b7cb64393 (diff)
downloadeom-fb7c5396f68f03f634a57654267a67191031e75d.tar.bz2
eom-fb7c5396f68f03f634a57654267a67191031e75d.tar.xz
Convert to G_DEFINE_TYPE_WITH_PRIVATE part 2
origin commits: https://gitlab.gnome.org/GNOME/eog/commit/ffc4137 https://gitlab.gnome.org/GNOME/eog/commit/ad8c963 https://gitlab.gnome.org/GNOME/eog/commit/afa0dc8 https://gitlab.gnome.org/GNOME/eog/commit/119a768 https://gitlab.gnome.org/GNOME/eog/commit/7725a55 https://gitlab.gnome.org/GNOME/eog/commit/80cf422
-rw-r--r--src/eom-metadata-reader-jpg.c12
-rw-r--r--src/eom-metadata-reader-png.c12
-rw-r--r--src/eom-metadata-sidebar.c9
-rw-r--r--src/eom-plugin-engine.c24
-rw-r--r--src/eom-preferences-dialog.c11
-rw-r--r--src/eom-print-image-setup.c10
-rw-r--r--src/eom-print-preview.c11
7 files changed, 28 insertions, 61 deletions
diff --git a/src/eom-metadata-reader-jpg.c b/src/eom-metadata-reader-jpg.c
index 9fc79b7..f965861 100644
--- a/src/eom-metadata-reader-jpg.c
+++ b/src/eom-metadata-reader-jpg.c
@@ -86,9 +86,6 @@ struct _EomMetadataReaderJpgPrivate {
int bytes_read;
};
-#define EOM_METADATA_READER_JPG_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_METADATA_READER_JPG, EomMetadataReaderJpgPrivate))
-
static void
eom_metadata_reader_jpg_init_emr_iface (gpointer g_iface, gpointer iface_data);
@@ -96,7 +93,8 @@ eom_metadata_reader_jpg_init_emr_iface (gpointer g_iface, gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (EomMetadataReaderJpg, eom_metadata_reader_jpg,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (EOM_TYPE_METADATA_READER,
- eom_metadata_reader_jpg_init_emr_iface))
+ eom_metadata_reader_jpg_init_emr_iface) \
+ G_ADD_PRIVATE (EomMetadataReaderJpg))
static void
@@ -128,11 +126,11 @@ eom_metadata_reader_jpg_dispose (GObject *object)
}
static void
-eom_metadata_reader_jpg_init (EomMetadataReaderJpg *obj)
+eom_metadata_reader_jpg_init (EomMetadataReaderJpg *emr)
{
EomMetadataReaderJpgPrivate *priv;
- priv = obj->priv = EOM_METADATA_READER_JPG_GET_PRIVATE (obj);
+ priv = emr->priv = eom_metadata_reader_jpg_get_instance_private (emr);
priv->exif_chunk = NULL;
priv->exif_len = 0;
priv->iptc_chunk = NULL;
@@ -147,8 +145,6 @@ eom_metadata_reader_jpg_class_init (EomMetadataReaderJpgClass *klass)
GObjectClass *object_class = (GObjectClass*) klass;
object_class->dispose = eom_metadata_reader_jpg_dispose;
-
- g_type_class_add_private (klass, sizeof (EomMetadataReaderJpgPrivate));
}
static gboolean
diff --git a/src/eom-metadata-reader-png.c b/src/eom-metadata-reader-png.c
index c475e06..8ad2405 100644
--- a/src/eom-metadata-reader-png.c
+++ b/src/eom-metadata-reader-png.c
@@ -85,16 +85,14 @@ struct _EomMetadataReaderPngPrivate {
gboolean hasIHDR;
};
-#define EOM_METADATA_READER_PNG_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_METADATA_READER_PNG, EomMetadataReaderPngPrivate))
-
static void
eom_metadata_reader_png_init_emr_iface (gpointer g_iface, gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (EomMetadataReaderPng, eom_metadata_reader_png,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (EOM_TYPE_METADATA_READER,
- eom_metadata_reader_png_init_emr_iface))
+ eom_metadata_reader_png_init_emr_iface) \
+ G_ADD_PRIVATE(EomMetadataReaderPng))
static void
eom_metadata_reader_png_dispose (GObject *object)
@@ -121,11 +119,11 @@ eom_metadata_reader_png_dispose (GObject *object)
}
static void
-eom_metadata_reader_png_init (EomMetadataReaderPng *obj)
+eom_metadata_reader_png_init (EomMetadataReaderPng *emr)
{
EomMetadataReaderPngPrivate *priv;
- priv = obj->priv = EOM_METADATA_READER_PNG_GET_PRIVATE (obj);
+ priv = emr->priv = eom_metadata_reader_png_get_instance_private (emr);
priv->icc_chunk = NULL;
priv->icc_len = 0;
priv->xmp_chunk = NULL;
@@ -148,8 +146,6 @@ eom_metadata_reader_png_class_init (EomMetadataReaderPngClass *klass)
GObjectClass *object_class = (GObjectClass*) klass;
object_class->dispose = eom_metadata_reader_png_dispose;
-
- g_type_class_add_private (klass, sizeof (EomMetadataReaderPngPrivate));
}
static gboolean
diff --git a/src/eom-metadata-sidebar.c b/src/eom-metadata-sidebar.c
index 1c01abd..018269b 100644
--- a/src/eom-metadata-sidebar.c
+++ b/src/eom-metadata-sidebar.c
@@ -101,10 +101,7 @@ struct _EomMetadataSidebarPrivate {
#endif
};
-#define EOM_METADATA_SIDEBAR_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_METADATA_SIDEBAR, EomMetadataSidebarPrivate))
-
-G_DEFINE_TYPE(EomMetadataSidebar, eom_metadata_sidebar, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE_WITH_PRIVATE(EomMetadataSidebar, eom_metadata_sidebar, GTK_TYPE_SCROLLED_WINDOW)
static GtkWidget*
_gtk_grid_append_title_line (GtkGrid *grid, GtkWidget *sibling,
@@ -492,7 +489,7 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
EomMetadataSidebarPrivate *priv;
GtkWidget *label;
- priv = sidebar->priv = EOM_METADATA_SIDEBAR_GET_PRIVATE (sidebar);
+ priv = sidebar->priv = eom_metadata_sidebar_get_instance_private (sidebar);
priv->grid = gtk_grid_new ();
g_object_set (G_OBJECT (priv->grid),
"row-spacing", 6,
@@ -655,8 +652,6 @@ eom_metadata_sidebar_class_init (EomMetadataSidebarClass *klass)
{
GObjectClass *g_obj_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof(EomMetadataSidebarPrivate));
-
g_obj_class->constructed = eom_metadata_sidebar_constructed;
g_obj_class->get_property = eom_metadata_sidebar_get_property;
g_obj_class->set_property = eom_metadata_sidebar_set_property;
diff --git a/src/eom-plugin-engine.c b/src/eom-plugin-engine.c
index 534b28c..dc434f2 100644
--- a/src/eom-plugin-engine.c
+++ b/src/eom-plugin-engine.c
@@ -38,23 +38,11 @@
#define USER_EOM_PLUGINS_LOCATION "plugins/"
-G_DEFINE_TYPE (EomPluginEngine, eom_plugin_engine, PEAS_TYPE_ENGINE)
-
struct _EomPluginEnginePrivate {
GSettings *plugins_settings;
};
-static void
-eom_plugin_engine_init (EomPluginEngine *engine)
-{
- eom_debug (DEBUG_PLUGINS);
-
- engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
- EOM_TYPE_PLUGIN_ENGINE,
- EomPluginEnginePrivate);
-
- engine->priv->plugins_settings = g_settings_new (EOM_CONF_PLUGINS);
-}
+G_DEFINE_TYPE_WITH_PRIVATE (EomPluginEngine, eom_plugin_engine, PEAS_TYPE_ENGINE)
static void
eom_plugin_engine_dispose (GObject *object)
@@ -76,8 +64,16 @@ eom_plugin_engine_class_init (EomPluginEngineClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = eom_plugin_engine_dispose;
+}
+
+static void
+eom_plugin_engine_init (EomPluginEngine *engine)
+{
+ eom_debug (DEBUG_PLUGINS);
- g_type_class_add_private (klass, sizeof (EomPluginEnginePrivate));
+ engine->priv = eom_plugin_engine_get_instance_private (engine);
+
+ engine->priv->plugins_settings = g_settings_new (EOM_CONF_PLUGINS);
}
EomPluginEngine *
diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c
index 1c2eb5b..d4a59ad 100644
--- a/src/eom-preferences-dialog.c
+++ b/src/eom-preferences-dialog.c
@@ -38,11 +38,6 @@
#include <gio/gio.h>
#include <libpeas-gtk/peas-gtk-plugin-manager.h>
-#define EOM_PREFERENCES_DIALOG_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PREFERENCES_DIALOG, EomPreferencesDialogPrivate))
-
-G_DEFINE_TYPE (EomPreferencesDialog, eom_preferences_dialog, EOM_TYPE_DIALOG);
-
#define GSETTINGS_OBJECT_KEY "GSETTINGS_KEY"
#define GSETTINGS_OBJECT_VALUE "GSETTINGS_VALUE"
@@ -54,6 +49,8 @@ struct _EomPreferencesDialogPrivate {
static GObject *instance = NULL;
+G_DEFINE_TYPE_WITH_PRIVATE (EomPreferencesDialog, eom_preferences_dialog, EOM_TYPE_DIALOG);
+
static gboolean
pd_string_to_rgba_mapping (GValue *value,
GVariant *variant,
@@ -329,14 +326,12 @@ eom_preferences_dialog_class_init (EomPreferencesDialogClass *class)
g_object_class->constructor = eom_preferences_dialog_constructor;
g_object_class->dispose = eom_preferences_dialog_dispose;
-
- g_type_class_add_private (g_object_class, sizeof (EomPreferencesDialogPrivate));
}
static void
eom_preferences_dialog_init (EomPreferencesDialog *pref_dlg)
{
- pref_dlg->priv = EOM_PREFERENCES_DIALOG_GET_PRIVATE (pref_dlg);
+ pref_dlg->priv = eom_preferences_dialog_get_instance_private (pref_dlg);
pref_dlg->priv->view_settings = g_settings_new (EOM_CONF_VIEW);
pref_dlg->priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN);
diff --git a/src/eom-print-image-setup.c b/src/eom-print-image-setup.c
index b396750..588e72c 100644
--- a/src/eom-print-image-setup.c
+++ b/src/eom-print-image-setup.c
@@ -48,11 +48,6 @@
* interactively.
*/
-#define EOM_PRINT_IMAGE_SETUP_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PRINT_IMAGE_SETUP, EomPrintImageSetupPrivate))
-
-G_DEFINE_TYPE (EomPrintImageSetup, eom_print_image_setup, GTK_TYPE_GRID);
-
struct _EomPrintImageSetupPrivate {
GtkWidget *left;
GtkWidget *right;
@@ -114,6 +109,7 @@ static void on_bottom_value_changed (GtkSpinButton *spinbutton, gpointer user_da
static void on_width_value_changed (GtkSpinButton *spinbutton, gpointer user_data);
static void on_height_value_changed (GtkSpinButton *spinbutton, gpointer user_data);
+G_DEFINE_TYPE_WITH_PRIVATE (EomPrintImageSetup, eom_print_image_setup, GTK_TYPE_GRID);
static void
block_handlers (EomPrintImageSetup *setup)
@@ -836,8 +832,6 @@ eom_print_image_setup_class_init (EomPrintImageSetupClass *class)
_("The information for the page where the image will be printed"),
GTK_TYPE_PAGE_SETUP,
G_PARAM_READWRITE));
-
- g_type_class_add_private (class, sizeof (EomPrintImageSetupPrivate));
}
static void
@@ -854,7 +848,7 @@ eom_print_image_setup_init (EomPrintImageSetup *setup)
gchar *locale_scale = NULL;
#endif
- priv = setup->priv = EOM_PRINT_IMAGE_SETUP_GET_PRIVATE (setup);
+ priv = setup->priv = eom_print_image_setup_get_instance_private (setup);
priv->image = NULL;
diff --git a/src/eom-print-preview.c b/src/eom-print-preview.c
index 02f4927..214d285 100644
--- a/src/eom-print-preview.c
+++ b/src/eom-print-preview.c
@@ -26,11 +26,6 @@
#include "eom-image.h"
#include "eom-print-preview.h"
-#define EOM_PRINT_PREVIEW_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PRINT_PREVIEW, EomPrintPreviewPrivate))
-
-G_DEFINE_TYPE (EomPrintPreview, eom_print_preview, GTK_TYPE_ASPECT_FRAME)
-
struct _EomPrintPreviewPrivate {
GtkWidget *area;
GdkPixbuf *image;
@@ -96,6 +91,8 @@ enum {
PROP_PAGE_BOTTOM_MARGIN
};
+G_DEFINE_TYPE_WITH_PRIVATE (EomPrintPreview, eom_print_preview, GTK_TYPE_ASPECT_FRAME)
+
static void eom_print_preview_draw (EomPrintPreview *preview, cairo_t *cr);
static void eom_print_preview_finalize (GObject *object);
static void update_relative_sizes (EomPrintPreview *preview);
@@ -389,8 +386,6 @@ eom_print_preview_class_init (EomPrintPreviewClass *klass)
G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
0, NULL);
-
- g_type_class_add_private (klass, sizeof (EomPrintPreviewPrivate));
}
static void
@@ -424,7 +419,7 @@ eom_print_preview_init (EomPrintPreview *preview)
EomPrintPreviewPrivate *priv;
gfloat ratio;
- priv = preview->priv = EOM_PRINT_PREVIEW_GET_PRIVATE (preview);
+ priv = preview->priv = eom_print_preview_get_instance_private (preview);
priv->area = GTK_WIDGET (gtk_drawing_area_new ());