[easytag/wip/future-gtk: 41/42] Use G_DEFINE_TYPE_WITH_PRIVATE



commit d6bdbda9f5fe602a2e6b539c5450685b30fbbbf6
Author: David King <amigadave amigadave com>
Date:   Fri Jan 9 21:47:47 2015 +0000

    Use G_DEFINE_TYPE_WITH_PRIVATE
    
    Added in GLib 2.38.

 configure.ac             |    2 +-
 src/application.c        |   15 ++++-----------
 src/application.h        |    2 --
 src/application_window.c |   24 +++++-------------------
 src/application_window.h |    2 --
 src/browser.c            |   24 ++++--------------------
 src/browser.h            |    2 --
 src/cddb_dialog.c        |   19 ++++---------------
 src/cddb_dialog.h        |    2 --
 src/file_area.c          |   14 ++++----------
 src/file_area.h          |    2 --
 src/load_files_dialog.c  |   43 ++++++++++++++-----------------------------
 src/load_files_dialog.h  |    2 --
 src/log.c                |   15 +++++----------
 src/log.h                |    2 --
 src/playlist_dialog.c    |   27 ++++++---------------------
 src/playlist_dialog.h    |    2 --
 src/preferences_dialog.c |   27 ++++++---------------------
 src/preferences_dialog.h |    2 --
 src/scan_dialog.c        |   15 ++++-----------
 src/scan_dialog.h        |    2 --
 src/search_dialog.c      |   41 +++++++++++++----------------------------
 src/search_dialog.h      |    2 --
 src/status_bar.c         |   15 ++++-----------
 src/status_bar.h         |    2 --
 src/tag_area.c           |   14 ++++----------
 src/tag_area.h           |    2 --
 27 files changed, 78 insertions(+), 243 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ad3b729..9604b06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -335,7 +335,7 @@ AM_CONDITIONAL([ENABLE_NAUTILUS_ACTIONS], [test x"$have_libnautilus_extension" !
 
 dnl Check the pkg-config dependencies
 GIO_DEPS="gio-2.0 >= 2.32.0" dnl For g_file_new_tmp()
-GLIB_DEPRECATION_FLAGS="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 
-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
+GLIB_DEPRECATION_FLAGS="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38 
-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"
 GTK_DEPS="gtk+-3.0 >= 3.10.0"
 GTK_DEPRECATION_FLAGS="-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4"
 PKG_CHECK_MODULES([EASYTAG], [$GIO_DEPS $GTK_DEPS $OPUS_DEPS $OGG_DEPS $SPEEX_DEPS $FLAC_DEPS $ID3TAG_DEPS 
$TAGLIB_DEPS $WAVPACK_DEPS])
diff --git a/src/application.c b/src/application.c
index 30ed234..99d06e7 100644
--- a/src/application.c
+++ b/src/application.c
@@ -30,16 +30,13 @@
 #include "misc.h"
 #include "setting.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtApplication, et_application, GTK_TYPE_APPLICATION)
-
-#define et_application_get_instance_private(app) (app->priv)
-
-struct _EtApplicationPrivate
+typedef struct
 {
     guint idle_handler;
     gchar *init_directory;
-};
+} EtApplicationPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtApplication, et_application, GTK_TYPE_APPLICATION)
 
 static const GOptionEntry entries[] =
 {
@@ -596,8 +593,6 @@ et_application_finalize (GObject *object)
 static void
 et_application_init (EtApplication *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_APPLICATION,
-                                              EtApplicationPrivate);
 }
 
 static void
@@ -616,8 +611,6 @@ et_application_class_init (EtApplicationClass *klass)
     gapplication_class->open = et_application_open;
     gapplication_class->shutdown = et_application_shutdown;
     gapplication_class->startup = et_application_startup;
-
-    g_type_class_add_private (klass, sizeof (EtApplicationPrivate));
 }
 
 /*
diff --git a/src/application.h b/src/application.h
index 3a7f5cd..652dba9 100644
--- a/src/application.h
+++ b/src/application.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtApplication EtApplication;
 typedef struct _EtApplicationClass EtApplicationClass;
-typedef struct _EtApplicationPrivate EtApplicationPrivate;
 
 struct _EtApplication
 {
     /*< private >*/
     GtkApplication parent_instance;
-    EtApplicationPrivate *priv;
 };
 
 struct _EtApplicationClass
diff --git a/src/application_window.c b/src/application_window.c
index b527e59..ed089bd 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -41,12 +41,7 @@
 #include "status_bar.h"
 #include "tag_area.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtApplicationWindow, et_application_window, GTK_TYPE_APPLICATION_WINDOW)
-
-#define et_application_window_get_instance_private(window) (window->priv)
-
-struct _EtApplicationWindowPrivate
+typedef struct
 {
     GtkWidget *browser;
 
@@ -71,7 +66,9 @@ struct _EtApplicationWindowPrivate
     gboolean is_maximized;
     gint height;
     gint width;
-};
+} EtApplicationWindowPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtApplicationWindow, et_application_window, GTK_TYPE_APPLICATION_WINDOW)
 
 /* Used to force to hide the msgbox when deleting file */
 static gboolean SF_HideMsgbox_Delete_File;
@@ -1650,16 +1647,7 @@ et_application_window_init (EtApplicationWindow *self)
     GtkWidget *hbox;
     GtkWidget *grid;
 
-    priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                                     ET_TYPE_APPLICATION_WINDOW,
-                                                     EtApplicationWindowPrivate);
-
-    priv->cddb_dialog = NULL;
-    priv->load_files_dialog = NULL;
-    priv->playlist_dialog = NULL;
-    priv->preferences_dialog = NULL;
-    priv->scan_dialog = NULL;
-    priv->search_dialog = NULL;
+    priv = et_application_window_get_instance_private (self);
 
     g_action_map_add_action_entries (G_ACTION_MAP (self), actions,
                                      G_N_ELEMENTS (actions), self);
@@ -1778,8 +1766,6 @@ static void
 et_application_window_class_init (EtApplicationWindowClass *klass)
 {
     G_OBJECT_CLASS (klass)->dispose = et_application_window_dispose;
-
-    g_type_class_add_private (klass, sizeof (EtApplicationWindowPrivate));
 }
 
 /*
diff --git a/src/application_window.h b/src/application_window.h
index 2a3a623..4764b2f 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtApplicationWindow EtApplicationWindow;
 typedef struct _EtApplicationWindowClass EtApplicationWindowClass;
-typedef struct _EtApplicationWindowPrivate EtApplicationWindowPrivate;
 
 struct _EtApplicationWindow
 {
     /*< private >*/
     GtkApplicationWindow parent_instance;
-    EtApplicationWindowPrivate *priv;
 };
 
 struct _EtApplicationWindowClass
diff --git a/src/browser.c b/src/browser.c
index a088230..4a70c0c 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -49,12 +49,7 @@
 
 #include "win32/win32dep.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtBrowser, et_browser, GTK_TYPE_BIN)
-
-#define et_browser_get_instance_private(browser) (browser->priv)
-
-struct _EtBrowserPrivate
+typedef struct
 {
     GtkWidget *label;
     GtkWidget *button;
@@ -100,7 +95,9 @@ struct _EtBrowserPrivate
     GtkWidget *rename_directory_preview_label;
 
     gchar *current_path;
-};
+} EtBrowserPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtBrowser, et_browser, GTK_TYPE_BIN)
 
 /****************
  * Declarations *
@@ -5088,17 +5085,6 @@ et_browser_finalize (GObject *object)
 static void
 et_browser_init (EtBrowser *self)
 {
-    EtBrowserPrivate *priv;
-
-    priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_BROWSER,
-                                                     EtBrowserPrivate);
-
-    priv->open_directory_with_dialog = NULL;
-    priv->open_directory_with_combobox = NULL;
-    priv->open_files_with_dialog = NULL;
-    priv->open_files_with_combobox = NULL;
-    priv->current_path = NULL;
-
     create_browser (self);
 }
 
@@ -5107,8 +5093,6 @@ et_browser_class_init (EtBrowserClass *klass)
 {
     G_OBJECT_CLASS (klass)->finalize = et_browser_finalize;
     GTK_WIDGET_CLASS (klass)->destroy = et_browser_destroy;
-
-    g_type_class_add_private (klass, sizeof (EtBrowserPrivate));
 }
 
 /*
diff --git a/src/browser.h b/src/browser.h
index 92cf503..c617c0f 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -32,13 +32,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtBrowser EtBrowser;
 typedef struct _EtBrowserClass EtBrowserClass;
-typedef struct _EtBrowserPrivate EtBrowserPrivate;
 
 struct _EtBrowser
 {
     /*< private >*/
     GtkBin parent_instance;
-    EtBrowserPrivate *priv;
 };
 
 struct _EtBrowserClass
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 8b96939..f963511 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -51,12 +51,7 @@
 #include "setting.h"
 #include "charset.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtCDDBDialog, et_cddb_dialog, GTK_TYPE_DIALOG)
-
-#define et_cddb_dialog_get_instance_private(dialog) (dialog->priv)
-
-struct _EtCDDBDialogPrivate
+typedef struct
 {
     GtkWidget *album_list_view;
     GtkWidget *track_list_view;
@@ -79,7 +74,9 @@ struct _EtCDDBDialogPrivate
 
     GtkWidget *run_scanner_toggle;
     GtkWidget *use_dlm2_toggle; /* '2' as also used in prefs.c */
-};
+} EtCDDBDialogPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtCDDBDialog, et_cddb_dialog, GTK_TYPE_DIALOG)
 
 /*
  * Structure used for each item of the album list. Aslo attached to each row of
@@ -3764,12 +3761,6 @@ et_cddb_dialog_finalize (GObject *object)
 static void
 et_cddb_dialog_init (EtCDDBDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_CDDB_DIALOG,
-                                              EtCDDBDialogPrivate);
-
-    self->priv->album_list = NULL;
-    self->priv->stop_searching = FALSE;
-
     create_cddb_dialog (self);
 }
 
@@ -3777,8 +3768,6 @@ static void
 et_cddb_dialog_class_init (EtCDDBDialogClass *klass)
 {
     G_OBJECT_CLASS (klass)->finalize = et_cddb_dialog_finalize;
-
-    g_type_class_add_private (klass, sizeof (EtCDDBDialogPrivate));
 }
 
 /*
diff --git a/src/cddb_dialog.h b/src/cddb_dialog.h
index dddf2b4..ec540bb 100644
--- a/src/cddb_dialog.h
+++ b/src/cddb_dialog.h
@@ -29,13 +29,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtCDDBDialog EtCDDBDialog;
 typedef struct _EtCDDBDialogClass EtCDDBDialogClass;
-typedef struct _EtCDDBDialogPrivate EtCDDBDialogPrivate;
 
 struct _EtCDDBDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtCDDBDialogPrivate *priv;
 };
 
 struct _EtCDDBDialogClass
diff --git a/src/file_area.c b/src/file_area.c
index be9849a..b0028c0 100644
--- a/src/file_area.c
+++ b/src/file_area.c
@@ -28,12 +28,7 @@
 #include "setting.h"
 #include "tag_area.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtFileArea, et_file_area, GTK_TYPE_BIN)
-
-#define et_file_area_get_instance_private(area) (area->priv)
-
-struct _EtFileAreaPrivate
+typedef struct
 {
     GtkWidget *file_label;
 
@@ -54,7 +49,9 @@ struct _EtFileAreaPrivate
     GtkWidget *size_value_label;
     GtkWidget *duration_label;
     GtkWidget *duration_value_label;
-};
+} EtFileAreaPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtFileArea, et_file_area, GTK_TYPE_BIN)
 
 static void
 on_file_show_header_changed (EtFileArea *self,
@@ -155,15 +152,12 @@ create_file_area (EtFileArea *self)
 static void
 et_file_area_init (EtFileArea *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_FILE_AREA,
-                                              EtFileAreaPrivate);
     create_file_area (self);
 }
 
 static void
 et_file_area_class_init (EtFileAreaClass *klass)
 {
-    g_type_class_add_private (klass, sizeof (EtFileAreaPrivate));
 }
 
 /*
diff --git a/src/file_area.h b/src/file_area.h
index df70a56..9ef44f3 100644
--- a/src/file_area.h
+++ b/src/file_area.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtFileArea EtFileArea;
 typedef struct _EtFileAreaClass EtFileAreaClass;
-typedef struct _EtFileAreaPrivate EtFileAreaPrivate;
 
 struct _EtFileArea
 {
     /*< private >*/
     GtkBin parent_instance;
-    EtFileAreaPrivate *priv;
 };
 
 struct _EtFileAreaClass
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 1d562a1..524dff5 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -33,10 +33,21 @@
 #include "scan_dialog.h"
 #include "setting.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtLoadFilesDialog, et_load_files_dialog, GTK_TYPE_DIALOG)
+typedef struct
+{
+    GtkWidget *file_chooser;
+    GtkWidget *load_file_content_view;
+    GtkListStore *load_file_content_model;
+    GtkWidget *load_file_content_menu;
+    GtkWidget *load_file_name_view;
+    GtkListStore *load_file_name_model;
+    GtkWidget *load_file_name_menu;
+
+    GtkWidget *selected_line_entry;
+} EtLoadFilesDialogPrivate;
 
-#define et_load_files_dialog_get_instance_private(dialog) (dialog->priv)
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtLoadFilesDialog, et_load_files_dialog, GTK_TYPE_DIALOG)
 
 static const guint BOX_SPACING = 6;
 
@@ -53,20 +64,6 @@ enum
     LOAD_FILE_NAME_COUNT
 };
 
-struct _EtLoadFilesDialogPrivate
-{
-    GtkWidget *file_chooser;
-    GtkWidget *load_file_content_view;
-    GtkListStore *load_file_content_model;
-    GtkWidget *load_file_content_menu;
-    GtkWidget *load_file_name_view;
-    GtkListStore *load_file_name_model;
-    GtkWidget *load_file_name_menu;
-
-    GtkWidget *selected_line_entry;
-};
-
-
 /*
  * Set the new filename of each file.
  * Associate lines from priv->load_file_content_view with priv->load_file_name_view
@@ -1075,26 +1072,14 @@ create_load_files_dialog (EtLoadFilesDialog *self)
 }
 
 static void
-et_load_files_dialog_finalize (GObject *object)
-{
-    G_OBJECT_CLASS (et_load_files_dialog_parent_class)->finalize (object);
-}
-
-static void
 et_load_files_dialog_init (EtLoadFilesDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_LOAD_FILES_DIALOG,
-                                              EtLoadFilesDialogPrivate);
-
     create_load_files_dialog (self);
 }
 
 static void
 et_load_files_dialog_class_init (EtLoadFilesDialogClass *klass)
 {
-    G_OBJECT_CLASS (klass)->finalize = et_load_files_dialog_finalize;
-
-    g_type_class_add_private (klass, sizeof (EtLoadFilesDialogPrivate));
 }
 
 /*
diff --git a/src/load_files_dialog.h b/src/load_files_dialog.h
index d455b1d..56cce97 100644
--- a/src/load_files_dialog.h
+++ b/src/load_files_dialog.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtLoadFilesDialog EtLoadFilesDialog;
 typedef struct _EtLoadFilesDialogClass EtLoadFilesDialogClass;
-typedef struct _EtLoadFilesDialogPrivate EtLoadFilesDialogPrivate;
 
 struct _EtLoadFilesDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtLoadFilesDialogPrivate *priv;
 };
 
 struct _EtLoadFilesDialogClass
diff --git a/src/log.c b/src/log.c
index c347120..e043746 100644
--- a/src/log.c
+++ b/src/log.c
@@ -31,19 +31,16 @@
 
 #include "win32/win32dep.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtLogArea, et_log_area, GTK_TYPE_BIN)
-
-#define et_log_area_get_instance_private(self) (self->priv)
-
-struct _EtLogAreaPrivate
+typedef struct
 {
     GtkWidget *log_view;
     GtkListStore *log_model;
 
     /* Popup menu. */
     GtkWidget *menu;
-};
+} EtLogAreaPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtLogArea, et_log_area, GTK_TYPE_BIN)
 
 enum
 {
@@ -125,7 +122,6 @@ on_button_press_event (GtkWidget *treeview,
 static void
 et_log_area_class_init (EtLogAreaClass *klass)
 {
-    g_type_class_add_private (klass, sizeof (EtLogAreaPrivate));
 }
 
 static void
@@ -137,8 +133,7 @@ et_log_area_init (EtLogArea *self)
     GError *error = NULL;
     GMenuModel *menu_model;
 
-    priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_LOG_AREA,
-                                                     EtLogAreaPrivate);
+    priv = et_log_area_get_instance_private (self);
 
     gtk_container_set_border_width (GTK_CONTAINER (self), 2);
 
diff --git a/src/log.h b/src/log.h
index 871316d..883a4db 100644
--- a/src/log.h
+++ b/src/log.h
@@ -29,13 +29,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtLogArea EtLogArea;
 typedef struct _EtLogAreaClass EtLogAreaClass;
-typedef struct _EtLogAreaPrivate EtLogAreaPrivate;
 
 struct _EtLogArea
 {
     /*< private >*/
     GtkBin parent_instance;
-    EtLogAreaPrivate *priv;
 };
 
 struct _EtLogAreaClass
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index 9ee4b52..3515d5d 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -33,18 +33,15 @@
 #include "scan_dialog.h"
 #include "setting.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtPlaylistDialog, et_playlist_dialog, GTK_TYPE_DIALOG)
-
-#define et_playlist_dialog_get_instance_private(dialog) (dialog->priv)
-
-static const guint BOX_SPACING = 6;
-
-struct _EtPlaylistDialogPrivate
+typedef struct
 {
     GtkWidget *name_mask_entry;
     GtkWidget *content_mask_entry;
-};
+} EtPlaylistDialogPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtPlaylistDialog, et_playlist_dialog, GTK_TYPE_DIALOG)
+
+static const guint BOX_SPACING = 6;
 
 /*
  * Function to replace UNIX ForwardSlash with a DOS BackSlash
@@ -775,26 +772,14 @@ create_playlist_dialog (EtPlaylistDialog *self)
 }
 
 static void
-et_playlist_dialog_finalize (GObject *object)
-{
-    G_OBJECT_CLASS (et_playlist_dialog_parent_class)->finalize (object);
-}
-
-static void
 et_playlist_dialog_init (EtPlaylistDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_PLAYLIST_DIALOG,
-                                              EtPlaylistDialogPrivate);
-
     create_playlist_dialog (self);
 }
 
 static void
 et_playlist_dialog_class_init (EtPlaylistDialogClass *klass)
 {
-    G_OBJECT_CLASS (klass)->finalize = et_playlist_dialog_finalize;
-
-    g_type_class_add_private (klass, sizeof (EtPlaylistDialogPrivate));
 }
 
 /*
diff --git a/src/playlist_dialog.h b/src/playlist_dialog.h
index a6d1b9d..4395936 100644
--- a/src/playlist_dialog.h
+++ b/src/playlist_dialog.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtPlaylistDialog EtPlaylistDialog;
 typedef struct _EtPlaylistDialogClass EtPlaylistDialogClass;
-typedef struct _EtPlaylistDialogPrivate EtPlaylistDialogPrivate;
 
 struct _EtPlaylistDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtPlaylistDialogPrivate *priv;
 };
 
 struct _EtPlaylistDialogClass
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 112cba9..97adf1b 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -37,14 +37,7 @@
 #include "charset.h"
 #include "win32/win32dep.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtPreferencesDialog, et_preferences_dialog, GTK_TYPE_DIALOG)
-
-#define et_preferences_dialog_get_instance_private(dialog) (dialog->priv)
-
-static const guint BOX_SPACING = 6;
-
-struct _EtPreferencesDialogPrivate
+typedef struct
 {
     GtkListStore *default_path_model;
     GtkListStore *file_player_model;
@@ -76,7 +69,11 @@ struct _EtPreferencesDialogPrivate
 
     GtkWidget *options_notebook;
     gint options_notebook_scanner;
-};
+} EtPreferencesDialogPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtPreferencesDialog, et_preferences_dialog, GTK_TYPE_DIALOG)
+
+static const guint BOX_SPACING = 6;
 
 /**************
  * Prototypes *
@@ -1199,26 +1196,14 @@ et_preferences_on_response (GtkDialog *dialog, gint response_id,
 }
 
 static void
-et_preferences_dialog_finalize (GObject *object)
-{
-    G_OBJECT_CLASS (et_preferences_dialog_parent_class)->finalize (object);
-}
-
-static void
 et_preferences_dialog_init (EtPreferencesDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_PREFERENCES_DIALOG,
-                                              EtPreferencesDialogPrivate);
-
     create_preferences_dialog (self);
 }
 
 static void
 et_preferences_dialog_class_init (EtPreferencesDialogClass *klass)
 {
-    G_OBJECT_CLASS (klass)->finalize = et_preferences_dialog_finalize;
-
-    g_type_class_add_private (klass, sizeof (EtPreferencesDialogPrivate));
 }
 
 /*
diff --git a/src/preferences_dialog.h b/src/preferences_dialog.h
index 71612da..f57c3aa 100644
--- a/src/preferences_dialog.h
+++ b/src/preferences_dialog.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtPreferencesDialog EtPreferencesDialog;
 typedef struct _EtPreferencesDialogClass EtPreferencesDialogClass;
-typedef struct _EtPreferencesDialogPrivate EtPreferencesDialogPrivate;
 
 struct _EtPreferencesDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtPreferencesDialogPrivate *priv;
 };
 
 struct _EtPreferencesDialogClass
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 263270f..49d1b62 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -40,12 +40,7 @@
 #include "crc32.h"
 #include "charset.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtScanDialog, et_scan_dialog, GTK_TYPE_DIALOG)
-
-#define et_scan_dialog_get_instance_private(dialog) (dialog->priv)
-
-struct _EtScanDialogPrivate
+typedef struct
 {
     GtkListStore *rename_masks_model;
     GtkListStore *scan_tag_masks_model;
@@ -86,7 +81,9 @@ struct _EtScanDialogPrivate
 
     GtkWidget *fill_tag_preview_label;
     GtkWidget *rename_file_preview_label;
-};
+} EtScanDialogPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtScanDialog, et_scan_dialog, GTK_TYPE_DIALOG)
 
 static const guint BOX_SPACING = 6;
 
@@ -2986,16 +2983,12 @@ et_scan_on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
 static void
 et_scan_dialog_init (EtScanDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_SCAN_DIALOG,
-                                              EtScanDialogPrivate);
-
     create_scan_dialog (self);
 }
 
 static void
 et_scan_dialog_class_init (EtScanDialogClass *klass)
 {
-    g_type_class_add_private (klass, sizeof (EtScanDialogPrivate));
 }
 
 /*
diff --git a/src/scan_dialog.h b/src/scan_dialog.h
index 70a6021..d17372c 100644
--- a/src/scan_dialog.h
+++ b/src/scan_dialog.h
@@ -33,13 +33,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtScanDialog EtScanDialog;
 typedef struct _EtScanDialogClass EtScanDialogClass;
-typedef struct _EtScanDialogPrivate EtScanDialogPrivate;
 
 struct _EtScanDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtScanDialogPrivate *priv;
 };
 
 struct _EtScanDialogClass
diff --git a/src/search_dialog.c b/src/search_dialog.c
index 1170afe..e0b73e0 100644
--- a/src/search_dialog.c
+++ b/src/search_dialog.c
@@ -32,10 +32,20 @@
 #include "scan_dialog.h"
 #include "setting.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtSearchDialog, et_search_dialog, GTK_TYPE_DIALOG)
+typedef struct
+{
+    GtkWidget *search_string_combo;
+    GtkListStore *search_string_model;
+    GtkWidget *search_in_filename;
+    GtkWidget *search_in_tag;
+    GtkWidget *search_case_sensitive;
+    GtkWidget *search_results_view;
+    GtkListStore *search_results_model;
+    GtkWidget *status_bar;
+    guint status_bar_context;
+} EtSearchDialogPrivate;
 
-#define et_search_dialog_get_instance_private(dialog) (dialog->priv)
+G_DEFINE_TYPE_WITH_PRIVATE (EtSearchDialog, et_search_dialog, GTK_TYPE_DIALOG)
 
 static const guint BOX_SPACING = 6;
 
@@ -96,19 +106,6 @@ enum
     SEARCH_COLUMN_COUNT
 };
 
-struct _EtSearchDialogPrivate
-{
-    GtkWidget *search_string_combo;
-    GtkListStore *search_string_model;
-    GtkWidget *search_in_filename;
-    GtkWidget *search_in_tag;
-    GtkWidget *search_case_sensitive;
-    GtkWidget *search_results_view;
-    GtkListStore *search_results_model;
-    GtkWidget *status_bar;
-    guint status_bar_context;
-};
-
 /*
  * Callback to select-row event
  * Select all results that are selected in the search result list also in the browser list
@@ -696,26 +693,14 @@ et_search_dialog_apply_changes (EtSearchDialog *self)
 }
 
 static void
-et_search_dialog_finalize (GObject *object)
-{
-    G_OBJECT_CLASS (et_search_dialog_parent_class)->finalize (object);
-}
-
-static void
 et_search_dialog_init (EtSearchDialog *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_SEARCH_DIALOG,
-                                              EtSearchDialogPrivate);
-
     create_search_dialog (self);
 }
 
 static void
 et_search_dialog_class_init (EtSearchDialogClass *klass)
 {
-    G_OBJECT_CLASS (klass)->finalize = et_search_dialog_finalize;
-
-    g_type_class_add_private (klass, sizeof (EtSearchDialogPrivate));
 }
 
 /*
diff --git a/src/search_dialog.h b/src/search_dialog.h
index 848c450..0cf6eac 100644
--- a/src/search_dialog.h
+++ b/src/search_dialog.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtSearchDialog EtSearchDialog;
 typedef struct _EtSearchDialogClass EtSearchDialogClass;
-typedef struct _EtSearchDialogPrivate EtSearchDialogPrivate;
 
 struct _EtSearchDialog
 {
     /*< private >*/
     GtkDialog parent_instance;
-    EtSearchDialogPrivate *priv;
 };
 
 struct _EtSearchDialogClass
diff --git a/src/status_bar.c b/src/status_bar.c
index a9be060..ffde1e2 100644
--- a/src/status_bar.c
+++ b/src/status_bar.c
@@ -25,17 +25,14 @@
 
 #include "charset.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtStatusBar, et_status_bar, GTK_TYPE_STATUSBAR)
-
-#define et_status_bar_get_instance_private(bar) (bar->priv)
-
-struct _EtStatusBarPrivate
+typedef struct
 {
     guint message_context;
     guint timer_context;
     guint timer_id;
-};
+} EtStatusBarPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtStatusBar, et_status_bar, GTK_TYPE_STATUSBAR)
 
 static void et_status_bar_remove_timer (EtStatusBar *self);
 
@@ -149,16 +146,12 @@ create_status_bar (EtStatusBar *self)
 static void
 et_status_bar_init (EtStatusBar *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_STATUS_BAR,
-                                              EtStatusBarPrivate);
-
     create_status_bar (self);
 }
 
 static void
 et_status_bar_class_init (EtStatusBarClass *klass)
 {
-    g_type_class_add_private (klass, sizeof (EtStatusBarPrivate));
 }
 
 /*
diff --git a/src/status_bar.h b/src/status_bar.h
index abd038f..b7de1cc 100644
--- a/src/status_bar.h
+++ b/src/status_bar.h
@@ -28,13 +28,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtStatusBar EtStatusBar;
 typedef struct _EtStatusBarClass EtStatusBarClass;
-typedef struct _EtStatusBarPrivate EtStatusBarPrivate;
 
 struct _EtStatusBar
 {
     /*< private >*/
     GtkStatusbar parent_instance;
-    EtStatusBarPrivate *priv;
 };
 
 struct _EtStatusBarClass
diff --git a/src/tag_area.c b/src/tag_area.c
index 9cfaa56..4c1305d 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -33,12 +33,7 @@
 #include "scan.h"
 #include "scan_dialog.h"
 
-/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtTagArea, et_tag_area, GTK_TYPE_BIN)
-
-#define et_tag_area_get_instance_private(area) (area->priv)
-
-struct _EtTagAreaPrivate
+typedef struct
 {
     GtkWidget *label;
     GtkWidget *notebook;
@@ -94,7 +89,9 @@ struct _EtTagAreaPrivate
     GtkWidget *track_sequence_button;
     GtkWidget *track_number_button;
     GtkWidget *apply_image_toolitem;
-};
+} EtTagAreaPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EtTagArea, et_tag_area, GTK_TYPE_BIN)
 
 enum
 {
@@ -2401,8 +2398,6 @@ create_tag_area (EtTagArea *self)
 static void
 et_tag_area_init (EtTagArea *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_TAG_AREA,
-                                              EtTagAreaPrivate);
     create_tag_area (self);
 
     gtk_widget_show_all (GTK_WIDGET (self));
@@ -2411,7 +2406,6 @@ et_tag_area_init (EtTagArea *self)
 static void
 et_tag_area_class_init (EtTagAreaClass *klass)
 {
-    g_type_class_add_private (klass, sizeof (EtTagAreaPrivate));
 }
 
 /*
diff --git a/src/tag_area.h b/src/tag_area.h
index 249125d..b693fd9 100644
--- a/src/tag_area.h
+++ b/src/tag_area.h
@@ -30,13 +30,11 @@ G_BEGIN_DECLS
 
 typedef struct _EtTagArea EtTagArea;
 typedef struct _EtTagAreaClass EtTagAreaClass;
-typedef struct _EtTagAreaPrivate EtTagAreaPrivate;
 
 struct _EtTagArea
 {
     /*< private >*/
     GtkBin parent_instance;
-    EtTagAreaPrivate *priv;
 };
 
 struct _EtTagAreaClass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]