[easytag/wip/future-gtk: 66/67] Use G_DEFINE_TYPE_WITH_PRIVATE



commit 6fe8f453cbc0c740bd5c56971d7ac68d530ad362
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             |    4 ++--
 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  |   35 ++++++++++++++---------------------
 src/load_files_dialog.h  |    2 --
 src/log.c                |   15 +++++----------
 src/log.h                |    2 --
 src/playlist_dialog.c    |   19 ++++++-------------
 src/playlist_dialog.h    |    2 --
 src/preferences_dialog.c |   19 ++++++-------------
 src/preferences_dialog.h |    2 --
 src/scan_dialog.c        |   15 ++++-----------
 src/scan_dialog.h        |    2 --
 src/search_dialog.c      |   33 +++++++++++++--------------------
 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, 79 insertions(+), 212 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 382f4ad..45c8dec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -334,9 +334,9 @@ AS_IF([test "x$have_libnautilus_extension" = "xno"],
 AM_CONDITIONAL([ENABLE_NAUTILUS_ACTIONS], [test x"$have_libnautilus_extension" != x"no"])
 
 dnl Check the pkg-config dependencies
-GIO_DEPS="gio-2.0 >= 2.32.0" dnl For g_file_new_tmp()
+GIO_DEPS="gio-2.0 >= 2.38.0"
 AC_SUBST([GLIB_DEPRECATION_FLAGS],
-         ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"])
+         ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"])
 GTK_DEPS="gtk+-3.0 >= 3.10.0"
 AC_SUBST([GTK_DEPRECATION_FLAGS],
          ["-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_10 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_10"])
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 2953871..68a1780 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -60,12 +60,7 @@
 #include "wavpack_header.h"
 #endif
 
-/* 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;
 
@@ -90,7 +85,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;
@@ -1617,16 +1614,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);
@@ -1745,8 +1733,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 8bd8153..c6f4bb0 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 fa0809a..af16612 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)
 
 /*
  * EtPathState:
@@ -5080,17 +5077,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);
 }
 
@@ -5099,8 +5085,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 c71bfd3..e40c882 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
@@ -3768,12 +3765,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);
 }
 
@@ -3781,8 +3772,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 ef3ebc2..7612d45 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
@@ -1079,16 +1076,12 @@ create_load_files_dialog (EtLoadFilesDialog *self)
 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_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 f28bf1e..8ba4668 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
@@ -778,16 +775,12 @@ create_playlist_dialog (EtPlaylistDialog *self)
 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_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 32138fb..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 *
@@ -1201,16 +1198,12 @@ et_preferences_on_response (GtkDialog *dialog, gint response_id,
 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_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 efd9b61..0c254d5 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)
 
 /* Some predefined masks -- IMPORTANT: Null-terminate me! */
 static const gchar *Scan_Masks [] =
@@ -2987,16 +2984,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 069cb87..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
@@ -698,16 +695,12 @@ et_search_dialog_apply_changes (EtSearchDialog *self)
 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_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 7801684..f611fd8 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
 {
@@ -2433,8 +2430,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));
@@ -2443,7 +2438,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]