[Xfce4-commits] [apps/xfburn] 04/06: moving type declaration to GTK+3 macros (75%)
noreply at xfce.org
noreply at xfce.org
Thu Oct 17 02:56:53 CEST 2019
This is an automated email from the git hooks/post-receive script.
k a t a n a s t e e l p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfburn.
commit 5480f571632aa57f671ce78320e57a811c973f82
Author: Rene Kjellerup <rk.katana.steel at gmail.com>
Date: Wed Oct 16 16:19:16 2019 -0700
moving type declaration to GTK+3 macros (75%)
fixing deprecation of call to g_type_class_add_private
---
xfburn/xfburn-device-list.c | 5 ++---
xfburn/xfburn-device.c | 13 +++++--------
xfburn/xfburn-directory-browser.c | 33 +++------------------------------
xfburn/xfburn-file-browser.c | 35 ++++-------------------------------
xfburn/xfburn-notebook-tab.c | 39 ++++++---------------------------------
5 files changed, 20 insertions(+), 105 deletions(-)
diff --git a/xfburn/xfburn-device-list.c b/xfburn/xfburn-device-list.c
index c59571f..84b676d 100644
--- a/xfburn/xfburn-device-list.c
+++ b/xfburn/xfburn-device-list.c
@@ -94,10 +94,10 @@ static guint signals[LAST_SIGNAL];
/*- class setup -*/
/*****************/
-G_DEFINE_TYPE (XfburnDeviceList, xfburn_device_list, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfburnDeviceList, xfburn_device_list, G_TYPE_OBJECT)
#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFBURN_TYPE_DEVICE_LIST, XfburnDeviceListPrivate))
+ (xfburn_device_list_get_instance_private (XFBURN_DEVICE_LIST (o)))
static void
xfburn_device_list_get_property (GObject *object, guint property_id,
@@ -185,7 +185,6 @@ xfburn_device_list_class_init (XfburnDeviceListClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (XfburnDeviceListPrivate));
object_class->get_property = xfburn_device_list_get_property;
object_class->set_property = xfburn_device_list_set_property;
diff --git a/xfburn/xfburn-device.c b/xfburn/xfburn-device.c
index f520d65..8d9b546 100644
--- a/xfburn/xfburn-device.c
+++ b/xfburn/xfburn-device.c
@@ -60,12 +60,6 @@ enum {
/*****************/
/*- class setup -*/
/*****************/
-
-G_DEFINE_TYPE (XfburnDevice, xfburn_device, G_TYPE_OBJECT)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFBURN_TYPE_DEVICE, XfburnDevicePrivate))
-
typedef struct _XfburnDevicePrivate XfburnDevicePrivate;
struct _XfburnDevicePrivate {
@@ -96,6 +90,11 @@ struct _XfburnDevicePrivate {
int is_erasable;
};
+G_DEFINE_TYPE_WITH_PRIVATE (XfburnDevice, xfburn_device, G_TYPE_OBJECT)
+
+#define GET_PRIVATE(o) \
+ (xfburn_device_get_instance_private (o))
+
static void
xfburn_device_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
@@ -240,8 +239,6 @@ xfburn_device_class_init (XfburnDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (XfburnDevicePrivate));
-
object_class->get_property = xfburn_device_get_property;
object_class->set_property = xfburn_device_set_property;
object_class->finalize = xfburn_device_finalize;
diff --git a/xfburn/xfburn-directory-browser.c b/xfburn/xfburn-directory-browser.c
index dedd225..4b8a172 100644
--- a/xfburn/xfburn-directory-browser.c
+++ b/xfburn/xfburn-directory-browser.c
@@ -44,8 +44,6 @@ typedef struct
} XfburnDirectoryBrowserPrivate;
/* prototypes */
-static void xfburn_directory_browser_class_init (XfburnDirectoryBrowserClass *, gpointer);
-static void xfburn_directory_browser_init (XfburnDirectoryBrowser *, gpointer);
static void cb_browser_drag_data_get (GtkWidget *, GdkDragContext *, GtkSelectionData *, guint, guint, gpointer);
static gint directory_tree_sortfunc (GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gpointer);
@@ -58,31 +56,7 @@ static const gchar *DIRECTORY = N_("Folder");
/********************************/
static ExoTreeViewClass *parent_class = NULL;
-GType
-xfburn_directory_browser_get_type (void)
-{
- static GType directory_browser_type = 0;
-
- if (!directory_browser_type) {
- static const GTypeInfo directory_browser_info = {
- sizeof (XfburnDirectoryBrowserClass),
- NULL,
- NULL,
- (GClassInitFunc) xfburn_directory_browser_class_init,
- NULL,
- NULL,
- sizeof (XfburnDirectoryBrowser),
- 0,
- (GInstanceInitFunc) xfburn_directory_browser_init,
- NULL
- };
-
- directory_browser_type =
- g_type_register_static (EXO_TYPE_TREE_VIEW, "XfburnDirectoryBrowser", &directory_browser_info, 0);
- }
-
- return directory_browser_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(XfburnDirectoryBrowser, xfburn_directory_browser, EXO_TYPE_TREE_VIEW);
static void
xfburn_directory_browser_finalize (GObject * object)
@@ -95,18 +69,17 @@ xfburn_directory_browser_finalize (GObject * object)
}
static void
-xfburn_directory_browser_class_init (XfburnDirectoryBrowserClass * klass, gpointer data)
+xfburn_directory_browser_class_init (XfburnDirectoryBrowserClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (XfburnDirectoryBrowserPrivate));
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = xfburn_directory_browser_finalize;
}
static void
-xfburn_directory_browser_init (XfburnDirectoryBrowser * browser, gpointer data)
+xfburn_directory_browser_init (XfburnDirectoryBrowser * browser)
{
GtkListStore *model;
GtkTreeViewColumn *column_file;
diff --git a/xfburn/xfburn-file-browser.c b/xfburn/xfburn-file-browser.c
index fbd4bff..96cec64 100644
--- a/xfburn/xfburn-file-browser.c
+++ b/xfburn/xfburn-file-browser.c
@@ -32,7 +32,7 @@
#include "xfburn-directory-browser.h"
#include "xfburn-main.h"
-#define XFBURN_FILE_BROWSER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_FILE_BROWSER, XfburnFileBrowserPrivate))
+#define XFBURN_FILE_BROWSER_GET_PRIVATE(obj) (xfburn_file_browser_get_instance_private (obj))
typedef enum {
FS_BROWSER,
@@ -45,8 +45,6 @@ typedef struct {
} XfburnFileBrowserPrivate;
/* prototypes */
-static void xfburn_file_browser_class_init (XfburnFileBrowserClass *, gpointer);
-static void xfburn_file_browser_init (XfburnFileBrowser *, gpointer);
static void cb_fs_browser_selection_changed (GtkTreeSelection *, XfburnFileBrowser *);
static void cb_directory_browser_row_activated (GtkWidget *, GtkTreePath *, GtkTreeViewColumn *, XfburnFileBrowser *);
@@ -57,41 +55,16 @@ static gboolean cb_focus_in_event (GtkWidget *widget, GdkEventFocus *event, Xfbu
/***************************/
static GtkPanedClass *parent_class = NULL;
-GType
-xfburn_file_browser_get_type (void)
-{
- static GType file_browser_type = 0;
-
- if (!file_browser_type) {
- static const GTypeInfo file_browser_info = {
- sizeof (XfburnFileBrowserClass),
- NULL,
- NULL,
- (GClassInitFunc) xfburn_file_browser_class_init,
- NULL,
- NULL,
- sizeof (XfburnFileBrowser),
- 0,
- (GInstanceInitFunc) xfburn_file_browser_init,
- NULL
- };
-
- file_browser_type = g_type_register_static (GTK_TYPE_PANED, "XfburnFileBrowser", &file_browser_info, 0);
- }
-
- return file_browser_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(XfburnFileBrowser, xfburn_file_browser, GTK_TYPE_PANED);
static void
-xfburn_file_browser_class_init (XfburnFileBrowserClass * klass, gpointer data)
+xfburn_file_browser_class_init (XfburnFileBrowserClass * klass)
{
- g_type_class_add_private (klass, sizeof (XfburnFileBrowserPrivate));
-
parent_class = g_type_class_peek_parent (klass);
}
static void
-xfburn_file_browser_init (XfburnFileBrowser * file_browser, gpointer data)
+xfburn_file_browser_init (XfburnFileBrowser * file_browser)
{
GtkWidget *scrolled_window;
GtkTreeSelection *selection;
diff --git a/xfburn/xfburn-notebook-tab.c b/xfburn/xfburn-notebook-tab.c
index 4a4ce98..205f0c6 100644
--- a/xfburn/xfburn-notebook-tab.c
+++ b/xfburn/xfburn-notebook-tab.c
@@ -26,7 +26,7 @@
#include "xfburn-notebook-tab.h"
-#define XFBURN_NOTEBOOK_TAB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_NOTEBOOK_TAB, XfburnNotebookTabPrivate))
+#define XFBURN_NOTEBOOK_TAB_GET_PRIVATE(obj) (xfburn_notebook_tab_get_instance_private (obj))
enum {
BUTTON_CLOSE_CLICKED,
@@ -48,8 +48,6 @@ typedef struct
/* prototypes */
-static void xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass, gpointer data);
-static void xfburn_notebook_tab_init (XfburnNotebookTab * tab, gpointer data);
static void xfburn_notebook_tab_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void xfburn_notebook_tab_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
@@ -62,38 +60,13 @@ static guint notebook_tab_signals[LAST_SIGNAL];
/************************/
/* class initiliazation */
/************************/
-GType
-xfburn_notebook_tab_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo our_info = {
- sizeof (XfburnNotebookTabClass),
- NULL,
- NULL,
- (GClassInitFunc) xfburn_notebook_tab_class_init,
- NULL,
- NULL,
- sizeof (XfburnNotebookTab),
- 0,
- (GInstanceInitFunc) xfburn_notebook_tab_init,
- NULL
- };
-
- type = g_type_register_static (GTK_TYPE_BOX, "XfburnNotebookTab", &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(XfburnNotebookTab, xfburn_notebook_tab, GTK_TYPE_BOX);
static void
-xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass, gpointer data)
+xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (XfburnNotebookTabPrivate));
-
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = xfburn_notebook_tab_set_property;
@@ -113,7 +86,7 @@ xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass, gpointer data)
}
static void
-xfburn_notebook_tab_init (XfburnNotebookTab * tab, gpointer data)
+xfburn_notebook_tab_init (XfburnNotebookTab * tab)
{
XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (tab);
GtkBox *hbox = GTK_BOX (tab);
@@ -139,7 +112,7 @@ xfburn_notebook_tab_init (XfburnNotebookTab * tab, gpointer data)
static void
xfburn_notebook_tab_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
- XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (object);
+ XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (XFBURN_NOTEBOOK_TAB (object));
switch (prop_id) {
case PROP_LABEL:
@@ -157,7 +130,7 @@ xfburn_notebook_tab_get_property (GObject *object, guint prop_id, GValue *value,
static void
xfburn_notebook_tab_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (object);
+ XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (XFBURN_NOTEBOOK_TAB (object));
switch (prop_id) {
case PROP_LABEL:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list