[gnome-control-center/wip/rancell/g-define-type] phase 6
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/rancell/g-define-type] phase 6
- Date: Mon, 4 Sep 2017 10:26:08 +0000 (UTC)
commit 97f4f143b511231d444a35c92d9a3f1a718a1791
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Sep 4 22:25:41 2017 +1200
phase 6
panels/common/gsd-device-manager-udev.c | 5 -----
panels/common/gsd-device-manager-udev.h | 12 ++----------
panels/common/gsd-device-manager-x11.c | 5 -----
panels/common/gsd-device-manager-x11.h | 12 ++----------
panels/common/gsd-device-manager.c | 10 ++++------
panels/common/gsd-device-manager.h | 30 +++++-------------------------
panels/mouse/cc-mouse-panel.h | 1 -
7 files changed, 13 insertions(+), 62 deletions(-)
---
diff --git a/panels/common/gsd-device-manager-udev.c b/panels/common/gsd-device-manager-udev.c
index aa93042..3b00164 100644
--- a/panels/common/gsd-device-manager-udev.c
+++ b/panels/common/gsd-device-manager-udev.c
@@ -34,11 +34,6 @@ struct _GsdUdevDeviceManager
GUdevClient *udev_client;
};
-struct _GsdUdevDeviceManagerClass
-{
- GsdDeviceManagerClass parent_class;
-};
-
G_DEFINE_TYPE (GsdUdevDeviceManager, gsd_udev_device_manager, GSD_TYPE_DEVICE_MANAGER)
/* Index matches GsdDeviceType */
diff --git a/panels/common/gsd-device-manager-udev.h b/panels/common/gsd-device-manager-udev.h
index 2004e97..46b8f9c 100644
--- a/panels/common/gsd-device-manager-udev.h
+++ b/panels/common/gsd-device-manager-udev.h
@@ -26,17 +26,9 @@
G_BEGIN_DECLS
-#define GSD_TYPE_UDEV_DEVICE_MANAGER (gsd_udev_device_manager_get_type ())
-#define GSD_UDEV_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UDEV_DEVICE_MANAGER,
GsdUdevDeviceManager))
-#define GSD_UDEV_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_UDEV_DEVICE_MANAGER,
GsdUdevDeviceManagerClass))
-#define GSD_IS_UDEV_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UDEV_DEVICE_MANAGER))
-#define GSD_IS_UDEV_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UDEV_DEVICE_MANAGER))
-#define GSD_UDEV_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UDEV_DEVICE_MANAGER,
GsdUdevDeviceManagerClass))
+#define GSD_TYPE_UDEV_DEVICE_MANAGER gsd_udev_device_manager_get_type ()
-typedef struct _GsdUdevDeviceManager GsdUdevDeviceManager;
-typedef struct _GsdUdevDeviceManagerClass GsdUdevDeviceManagerClass;
-
-GType gsd_udev_device_manager_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (GsdUdevDeviceManager, gsd_udev_device_manager, GSD, UDEV_DEVICE_MANAGER,
GsdDeviceManager)
G_END_DECLS
diff --git a/panels/common/gsd-device-manager-x11.c b/panels/common/gsd-device-manager-x11.c
index a2704d1..97a5e29 100644
--- a/panels/common/gsd-device-manager-x11.c
+++ b/panels/common/gsd-device-manager-x11.c
@@ -36,11 +36,6 @@ struct _GsdX11DeviceManager
GHashTable *gdk_devices;
};
-struct _GsdX11DeviceManagerClass
-{
- GsdDeviceManagerClass parent_class;
-};
-
GsdDevice * gsd_x11_device_manager_lookup_gdk_device (GsdDeviceManager *manager,
GdkDevice *gdk_device);
diff --git a/panels/common/gsd-device-manager-x11.h b/panels/common/gsd-device-manager-x11.h
index a5ea724..7eef4c9 100644
--- a/panels/common/gsd-device-manager-x11.h
+++ b/panels/common/gsd-device-manager-x11.h
@@ -27,17 +27,9 @@
G_BEGIN_DECLS
-#define GSD_TYPE_X11_DEVICE_MANAGER (gsd_x11_device_manager_get_type ())
-#define GSD_X11_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_X11_DEVICE_MANAGER,
GsdX11DeviceManager))
-#define GSD_X11_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_X11_DEVICE_MANAGER,
GsdX11DeviceManagerClass))
-#define GSD_IS_X11_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_X11_DEVICE_MANAGER))
-#define GSD_IS_X11_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_X11_DEVICE_MANAGER))
-#define GSD_X11_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_X11_DEVICE_MANAGER,
GsdX11DeviceManagerClass))
+#define GSD_TYPE_X11_DEVICE_MANAGER gsd_x11_device_manager_get_type ()
-typedef struct _GsdX11DeviceManager GsdX11DeviceManager;
-typedef struct _GsdX11DeviceManagerClass GsdX11DeviceManagerClass;
-
-GType gsd_x11_device_manager_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (GsdX11DeviceManager, gsd_x11_device_manager, GSD, X11_DEVICE_MANAGER, GsdDeviceManager)
G_END_DECLS
diff --git a/panels/common/gsd-device-manager.c b/panels/common/gsd-device-manager.c
index 541f294..2f5386b 100644
--- a/panels/common/gsd-device-manager.c
+++ b/panels/common/gsd-device-manager.c
@@ -28,10 +28,7 @@
#include "gsd-common-enums.h"
#include "gnome-settings-bus.h"
-typedef struct _GsdDevicePrivate GsdDevicePrivate;
-typedef struct _GsdDeviceManagerPrivate GsdDeviceManagerPrivate;
-
-struct _GsdDevicePrivate
+typedef struct
{
gchar *name;
gchar *device_file;
@@ -40,7 +37,9 @@ struct _GsdDevicePrivate
GsdDeviceType type;
guint width;
guint height;
-};
+} GsdDevicePrivate;
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GsdDevice, gsd_device, G_TYPE_OBJECT)
enum {
PROP_NAME = 1,
@@ -61,7 +60,6 @@ enum {
static guint signals[N_SIGNALS] = { 0 };
-G_DEFINE_TYPE_WITH_PRIVATE (GsdDevice, gsd_device, G_TYPE_OBJECT)
G_DEFINE_TYPE (GsdDeviceManager, gsd_device_manager, G_TYPE_OBJECT)
static void
diff --git a/panels/common/gsd-device-manager.h b/panels/common/gsd-device-manager.h
index 1eb5c13..daac646 100644
--- a/panels/common/gsd-device-manager.h
+++ b/panels/common/gsd-device-manager.h
@@ -26,24 +26,13 @@
G_BEGIN_DECLS
-#define GSD_TYPE_DEVICE (gsd_device_get_type ())
-#define GSD_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DEVICE, GsdDevice))
-#define GSD_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DEVICE, GsdDeviceClass))
-#define GSD_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DEVICE))
-#define GSD_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DEVICE))
-#define GSD_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DEVICE, GsdDeviceClass))
-
-#define GSD_TYPE_DEVICE_MANAGER (gsd_device_manager_get_type ())
-#define GSD_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DEVICE_MANAGER,
GsdDeviceManager))
-#define GSD_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DEVICE_MANAGER,
GsdDeviceManagerClass))
-#define GSD_IS_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DEVICE_MANAGER))
-#define GSD_IS_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DEVICE_MANAGER))
-#define GSD_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DEVICE_MANAGER,
GsdDeviceManagerClass))
-
-typedef struct _GsdDevice GsdDevice;
-typedef struct _GsdDeviceClass GsdDeviceClass;
-typedef struct _GsdDeviceManager GsdDeviceManager;
-typedef struct _GsdDeviceManagerClass GsdDeviceManagerClass;
+#define GSD_TYPE_DEVICE gsd_device_get_type ()
+
+G_DECLARE_DERIVABLE_TYPE (GsdDevice, gsd_device, GSD, DEVICE, GObject)
+
+#define GSD_TYPE_DEVICE_MANAGER gsd_device_manager_get_type ()
+
+G_DECLARE_DERIVABLE_TYPE (GsdDeviceManager, gsd_device_manager, GSD, DEVICE_MANAGER, GObject)
typedef enum {
GSD_DEVICE_TYPE_MOUSE = 1 << 0,
@@ -54,19 +43,10 @@ typedef enum {
GSD_DEVICE_TYPE_PAD = 1 << 5
} GsdDeviceType;
-struct _GsdDevice {
- GObject parent_instance;
-};
-
struct _GsdDeviceClass {
GObjectClass parent_class;
};
-struct _GsdDeviceManager
-{
- GObject parent_instance;
-};
-
struct _GsdDeviceManagerClass
{
GObjectClass parent_class;
diff --git a/panels/mouse/cc-mouse-panel.h b/panels/mouse/cc-mouse-panel.h
index c08ad05..b44aec2 100644
--- a/panels/mouse/cc-mouse-panel.h
+++ b/panels/mouse/cc-mouse-panel.h
@@ -18,7 +18,6 @@
*
*/
-
#ifndef _CC_MOUSE_PANEL_H
#define _CC_MOUSE_PANEL_H
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]