[gnome-control-center/wip/rancell/g-define-type] phase 3



commit 4fb7556f00e4c63e899dd9edf8f23aa2051649cf
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Sep 4 19:53:08 2017 +1200

    phase 3

 panels/wacom/calibrator/cc-clock-actor.c     |    7 ++
 panels/wacom/calibrator/cc-clock-actor.h     |   25 +----
 panels/wacom/calibrator/cc-target-actor.c    |   30 ++----
 panels/wacom/calibrator/cc-target-actor.h    |   29 +-----
 panels/wacom/cc-wacom-mapping-panel.c        |  130 +++++++++++-------------
 panels/wacom/cc-wacom-mapping-panel.h        |   39 +-------
 panels/wacom/cc-wacom-nav-button.c           |  120 ++++++++++------------
 panels/wacom/cc-wacom-nav-button.h           |   38 +-------
 panels/wacom/gsd-wacom-key-shortcut-button.c |  140 +++++++++++---------------
 panels/wacom/gsd-wacom-key-shortcut-button.h |   29 +-----
 10 files changed, 207 insertions(+), 380 deletions(-)
---
diff --git a/panels/wacom/calibrator/cc-clock-actor.c b/panels/wacom/calibrator/cc-clock-actor.c
index afe2d9d..c84fb5b 100644
--- a/panels/wacom/calibrator/cc-clock-actor.c
+++ b/panels/wacom/calibrator/cc-clock-actor.c
@@ -27,6 +27,13 @@
 #define ANGLE                          "angle"
 #define EXTRA_SPACE                    2
 
+struct _CcClockActor
+{
+  ClutterActor parent_instance;
+
+  gfloat angle;
+};
+
 G_DEFINE_TYPE (CcClockActor, cc_clock_actor, CLUTTER_TYPE_ACTOR);
 
 enum {
diff --git a/panels/wacom/calibrator/cc-clock-actor.h b/panels/wacom/calibrator/cc-clock-actor.h
index 5ba1a81..dc2245b 100644
--- a/panels/wacom/calibrator/cc-clock-actor.h
+++ b/panels/wacom/calibrator/cc-clock-actor.h
@@ -25,31 +25,12 @@
 
 G_BEGIN_DECLS
 
-#define CC_CLOCK_ACTOR_TYPE            (cc_clock_actor_get_type ())
-#define CC_CLOCK_ACTOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_CLOCK_ACTOR_TYPE, 
CcClockActor))
-#define CC_IS_CLOCK_ACTOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_CLOCK_ACTOR_TYPE))
-#define CC_CLOCK_ACTOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CC_CLOCK_ACTOR_TYPE, 
CcClockActorClass))
-#define CC_IS_CLOCK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_CLOCK_ACTOR_TYPE))
-#define CC_CLOCK_ACTOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_CLOCK_ACTOR_TYPE, 
CcClockActorClass))
+#define CC_CLOCK_ACTOR_TYPE cc_clock_actor_get_type ()
 
-typedef struct _CcClockActor      CcClockActor;
-typedef struct _CcClockActorClass CcClockActorClass;
-
-struct _CcClockActor
-{
-  ClutterActor parent_instance;
-
-  /*< private >*/
-  gfloat angle;
-};
-
-struct _CcClockActorClass
-{
-  ClutterActorClass parent_class;
-};
+G_DECLARE_FINAL_TYPE (CcClockActor, cc_clock_actor, CC, CLOCK_ACTOR, ClutterActor)
 
 ClutterActor * cc_clock_actor_new      (void);
 
-GType          cc_clock_actor_get_type (void);
+G_END_DECLS
 
 #endif /* __CC_CLOCK_ACTOR_H__ */
diff --git a/panels/wacom/calibrator/cc-target-actor.c b/panels/wacom/calibrator/cc-target-actor.c
index 34fa1e3..b75d877 100644
--- a/panels/wacom/calibrator/cc-target-actor.c
+++ b/panels/wacom/calibrator/cc-target-actor.c
@@ -20,8 +20,6 @@
 #include <math.h>
 #include "cc-target-actor.h"
 
-#define CC_TARGET_ACTOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TARGET_ACTOR_TYPE, 
CcTargetActorPrivate))
-
 #define CROSS_LINES                    47
 #define TARGET_DIMENSION               (CROSS_LINES * 2)
 #define CROSS_CIRCLE                   7
@@ -29,8 +27,10 @@
 #define TARGET_SHOW_ANIMATION_DURATION 500
 #define TARGET_HIDE_ANIMATION_DURATION 200
 
-struct _CcTargetActorPrivate
+struct _CcTargetActor
 {
+  ClutterActor parent_instance;
+
   gdouble pos_x;
   gdouble pos_y;
 };
@@ -87,13 +87,10 @@ static void
 on_target_animation_complete (ClutterTimeline *timeline,
                               CcTargetActor   *self)
 {
-  CcTargetActorPrivate *priv;
-  priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
-
   clutter_actor_show (CLUTTER_ACTOR (self));
   clutter_actor_set_position (CLUTTER_ACTOR (self),
-                              priv->pos_x,
-                              priv->pos_y);
+                              self->pos_x,
+                              self->pos_y);
 
   show_target (self);
 }
@@ -132,11 +129,9 @@ cc_target_actor_init (CcTargetActor *self)
 {
   ClutterContent *content;
   ClutterPoint anchor;
-  CcTargetActorPrivate *priv;
 
-  priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
-  priv->pos_x = .0;
-  priv->pos_y = .0;
+  self->pos_x = .0;
+  self->pos_y = .0;
 
   content = clutter_canvas_new ();
   clutter_actor_set_content (CLUTTER_ACTOR (self), content);
@@ -185,8 +180,6 @@ cc_target_actor_class_init (CcTargetActorClass *klass)
 
   clutter_actor_class->get_preferred_width = cc_target_actor_get_preferred_width;
   clutter_actor_class->get_preferred_height = cc_target_actor_get_preferred_height;
-
-  g_type_class_add_private (klass, sizeof (CcTargetActorPrivate));
 }
 
 
@@ -196,14 +189,11 @@ cc_target_actor_move_center (CcTargetActor *self, gdouble x, gdouble y)
 {
   g_return_if_fail (CC_IS_TARGET_ACTOR (self));
 
-  CcTargetActorPrivate *priv;
   ClutterTransition *transition;
   gboolean target_visible;
 
-  priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
-
-  priv->pos_x = x - (TARGET_DIMENSION / 2);
-  priv->pos_y = y - (TARGET_DIMENSION / 2);
+  self->pos_x = x - (TARGET_DIMENSION / 2);
+  self->pos_y = y - (TARGET_DIMENSION / 2);
 
   g_object_get (self, "visible", &target_visible, NULL);
 
@@ -223,7 +213,7 @@ cc_target_actor_move_center (CcTargetActor *self, gdouble x, gdouble y)
     {
       clutter_actor_show (CLUTTER_ACTOR (self));
 
-      clutter_actor_set_position (CLUTTER_ACTOR (self), priv->pos_x, priv->pos_y);
+      clutter_actor_set_position (CLUTTER_ACTOR (self), self->pos_x, self->pos_y);
 
       show_target (self);
     }
diff --git a/panels/wacom/calibrator/cc-target-actor.h b/panels/wacom/calibrator/cc-target-actor.h
index 891f48c..306bae1 100644
--- a/panels/wacom/calibrator/cc-target-actor.h
+++ b/panels/wacom/calibrator/cc-target-actor.h
@@ -25,35 +25,16 @@
 
 G_BEGIN_DECLS
 
-#define CC_TARGET_ACTOR_TYPE            (cc_target_actor_get_type ())
-#define CC_TARGET_ACTOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TARGET_ACTOR_TYPE, 
CcTargetActor))
-#define CC_IS_TARGET_ACTOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TARGET_ACTOR_TYPE))
-#define CC_TARGET_ACTOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TARGET_ACTOR_TYPE, 
CcTargetActorClass))
-#define CC_IS_TARGET_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TARGET_ACTOR_TYPE))
-#define CC_TARGET_ACTOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TARGET_ACTOR_TYPE, 
CcTargetActorClass))
-
-typedef struct _CcTargetActor        CcTargetActor;
-typedef struct _CcTargetActorClass   CcTargetActorClass;
-typedef struct _CcTargetActorPrivate CcTargetActorPrivate;
-
-struct _CcTargetActor
-{
-  ClutterActor parent_instance;
-
-  /*< private >*/
-  CcTargetActorPrivate *priv;
-};
-
-struct _CcTargetActorClass
-{
-  ClutterActorClass parent_class;
-};
+#define CC_TARGET_ACTOR_TYPE cc_target_actor_get_type ()
+
+G_DECLARE_FINAL_TYPE (CcTargetActor, cc_target_actor, CC, TARGET_ACTOR, ClutterActor)
 
 ClutterActor * cc_target_actor_new         (void);
+
 void           cc_target_actor_move_center (CcTargetActor *target,
                                             gdouble        x,
                                             gdouble        y);
 
-GType          cc_target_actor_get_type    (void);
+G_END_DECLS
 
 #endif /* __CC_TARGET_ACTOR_H__ */
diff --git a/panels/wacom/cc-wacom-mapping-panel.c b/panels/wacom/cc-wacom-mapping-panel.c
index 506a4e8..60664d3 100644
--- a/panels/wacom/cc-wacom-mapping-panel.c
+++ b/panels/wacom/cc-wacom-mapping-panel.c
@@ -31,13 +31,10 @@
 #include "cc-wacom-device.h"
 #include "cc-wacom-mapping-panel.h"
 
-G_DEFINE_TYPE (CcWacomMappingPanel, cc_wacom_mapping_panel, GTK_TYPE_BOX)
-
-#define WACOM_MAPPING_PANEL_PRIVATE(o) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_MAPPING_PANEL, CcWacomMappingPanelPrivate))
-
-struct _CcWacomMappingPanelPrivate
+struct _CcWacomMappingPanel
 {
+       GtkBox          parent_instance;
+
        CcWacomDevice  *device;
        GtkWidget      *label;
        GtkWidget      *combobox;
@@ -48,6 +45,8 @@ struct _CcWacomMappingPanelPrivate
        GnomeRRScreen  *rr_screen;
 };
 
+G_DEFINE_TYPE (CcWacomMappingPanel, cc_wacom_mapping_panel, GTK_TYPE_BOX)
+
 enum {
        MONITOR_NAME_COLUMN,
        MONITOR_PTR_COLUMN,
@@ -62,10 +61,10 @@ static void
 set_combobox_sensitive (CcWacomMappingPanel *self,
                        gboolean             sensitive)
 {
-       gtk_widget_set_sensitive (GTK_WIDGET(self->priv->combobox), sensitive);
-       gtk_widget_set_sensitive (GTK_WIDGET(self->priv->label), sensitive);
-       gtk_widget_set_sensitive (GTK_WIDGET(self->priv->aspectswitch), sensitive);
-       gtk_widget_set_sensitive (GTK_WIDGET(self->priv->aspectlabel), sensitive);
+       gtk_widget_set_sensitive (GTK_WIDGET(self->combobox), sensitive);
+       gtk_widget_set_sensitive (GTK_WIDGET(self->label), sensitive);
+       gtk_widget_set_sensitive (GTK_WIDGET(self->aspectswitch), sensitive);
+       gtk_widget_set_sensitive (GTK_WIDGET(self->aspectlabel), sensitive);
 }
 
 /* Update the display of available monitors based on the latest
@@ -85,32 +84,32 @@ update_monitor_chooser (CcWacomMappingPanel *self)
        guint i;
 
        store = gtk_list_store_new (MONITOR_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
-       gtk_combo_box_set_model (GTK_COMBO_BOX(self->priv->combobox), GTK_TREE_MODEL(store));
+       gtk_combo_box_set_model (GTK_COMBO_BOX(self->combobox), GTK_TREE_MODEL(store));
 
-       if (self->priv->device == NULL) {
+       if (self->device == NULL) {
                set_combobox_sensitive (self, FALSE);
                g_object_unref (store);
                return;
        }
 
-       settings = cc_wacom_device_get_settings (self->priv->device);
-       cur_output = cc_wacom_device_get_output (self->priv->device,
-                                                self->priv->rr_screen);
+       settings = cc_wacom_device_get_settings (self->device);
+       cur_output = cc_wacom_device_get_output (self->device,
+                                                self->rr_screen);
 
-       g_signal_handlers_block_by_func (G_OBJECT (self->priv->checkbutton), checkbutton_toggled_cb, self);
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(self->priv->checkbutton), cur_output != NULL);
-       g_signal_handlers_unblock_by_func (G_OBJECT (self->priv->checkbutton), checkbutton_toggled_cb, self);
+       g_signal_handlers_block_by_func (G_OBJECT (self->checkbutton), checkbutton_toggled_cb, self);
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(self->checkbutton), cur_output != NULL);
+       g_signal_handlers_unblock_by_func (G_OBJECT (self->checkbutton), checkbutton_toggled_cb, self);
 
-       g_signal_handlers_block_by_func (G_OBJECT (self->priv->aspectswitch), aspectswitch_toggled_cb, self);
-       gtk_switch_set_active (GTK_SWITCH(self->priv->aspectswitch), g_settings_get_boolean (settings, 
"keep-aspect"));
-       g_signal_handlers_unblock_by_func (G_OBJECT (self->priv->aspectswitch), aspectswitch_toggled_cb, 
self);
+       g_signal_handlers_block_by_func (G_OBJECT (self->aspectswitch), aspectswitch_toggled_cb, self);
+       gtk_switch_set_active (GTK_SWITCH(self->aspectswitch), g_settings_get_boolean (settings, 
"keep-aspect"));
+       g_signal_handlers_unblock_by_func (G_OBJECT (self->aspectswitch), aspectswitch_toggled_cb, self);
 
-       if (!self->priv->rr_screen) {
+       if (!self->rr_screen) {
                cur_output = NULL;
                goto bail;
        }
 
-       outputs = gnome_rr_screen_list_outputs (self->priv->rr_screen);
+       outputs = gnome_rr_screen_list_outputs (self->rr_screen);
 
        for (i = 0; outputs[i] != NULL; i++) {
                GnomeRROutput *output = outputs[i];
@@ -130,9 +129,9 @@ update_monitor_chooser (CcWacomMappingPanel *self)
                        gtk_list_store_set (store, &iter, MONITOR_NAME_COLUMN, text, MONITOR_PTR_COLUMN, 
output, -1);
 
                        if (i == 0 || output == cur_output) {
-                               g_signal_handlers_block_by_func (G_OBJECT (self->priv->combobox), 
combobox_changed_cb, self);
-                               gtk_combo_box_set_active_iter (GTK_COMBO_BOX(self->priv->combobox), &iter);
-                               g_signal_handlers_unblock_by_func (G_OBJECT (self->priv->combobox), 
combobox_changed_cb, self);
+                               g_signal_handlers_block_by_func (G_OBJECT (self->combobox), 
combobox_changed_cb, self);
+                               gtk_combo_box_set_active_iter (GTK_COMBO_BOX(self->combobox), &iter);
+                               g_signal_handlers_unblock_by_func (G_OBJECT (self->combobox), 
combobox_changed_cb, self);
                        }
 
                        g_free (text);
@@ -147,18 +146,18 @@ bail:
 static void
 update_ui (CcWacomMappingPanel *self)
 {
-       if (self->priv->device == NULL) {
-               gtk_widget_set_sensitive (GTK_WIDGET(self->priv->checkbutton), FALSE);
-               gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->priv->checkbutton), TRUE);
+       if (self->device == NULL) {
+               gtk_widget_set_sensitive (GTK_WIDGET(self->checkbutton), FALSE);
+               gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->checkbutton), TRUE);
        } else {
                gboolean is_screen_tablet;
 
                is_screen_tablet =
-                       cc_wacom_device_get_integration_flags (self->priv->device) &
+                       cc_wacom_device_get_integration_flags (self->device) &
                        WACOM_DEVICE_INTEGRATED_DISPLAY;
 
-               gtk_widget_set_sensitive (GTK_WIDGET(self->priv->checkbutton), !is_screen_tablet);
-               gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->priv->checkbutton), FALSE);
+               gtk_widget_set_sensitive (GTK_WIDGET(self->checkbutton), !is_screen_tablet);
+               gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->checkbutton), FALSE);
        }
 
        update_monitor_chooser (self);
@@ -169,13 +168,13 @@ update_mapping (CcWacomMappingPanel *self)
 {
        GnomeRROutput *output = NULL;
 
-       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->checkbutton))) {
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbutton))) {
                GtkTreeIter iter;
                GtkTreeModel *model;
                char *name;
 
-               model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->combobox));
-               if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self->priv->combobox), &iter)) {
+               model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->combobox));
+               if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self->combobox), &iter)) {
                        g_warning ("Map to single monitor checked, but no screen selected.");
                        return;
                }
@@ -183,14 +182,14 @@ update_mapping (CcWacomMappingPanel *self)
                gtk_tree_model_get (model, &iter, MONITOR_NAME_COLUMN, &name, MONITOR_PTR_COLUMN, &output, 
-1);
        }
 
-       cc_wacom_device_set_output (self->priv->device, output);
+       cc_wacom_device_set_output (self->device, output);
 }
 
 void
 cc_wacom_mapping_panel_set_device (CcWacomMappingPanel *self,
                                    CcWacomDevice       *device)
 {
-       self->priv->device = device;
+       self->device = device;
        update_ui (self);
 }
 
@@ -203,7 +202,7 @@ checkbutton_toggled_cb (GtkWidget           *widget,
        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
        set_combobox_sensitive (self, active);
        if (!active)
-               gtk_switch_set_active (GTK_SWITCH(self->priv->aspectswitch), FALSE);
+               gtk_switch_set_active (GTK_SWITCH(self->aspectswitch), FALSE);
        update_mapping (self);
 }
 
@@ -214,7 +213,7 @@ aspectswitch_toggled_cb (GtkWidget           *widget,
 {
        GSettings *settings;
 
-       settings = cc_wacom_device_get_settings (self->priv->device);
+       settings = cc_wacom_device_get_settings (self->device);
        g_settings_set_boolean (settings,
                                "keep-aspect",
                                gtk_switch_get_active (GTK_SWITCH (widget)));
@@ -230,21 +229,18 @@ combobox_changed_cb (GtkWidget           *widget,
 static void
 cc_wacom_mapping_panel_init (CcWacomMappingPanel *self)
 {
-       CcWacomMappingPanelPrivate *priv;
        GtkWidget *vbox, *grid;
        GtkCellRenderer *renderer;
        GError *error = NULL;
 
-       priv = self->priv = WACOM_MAPPING_PANEL_PRIVATE (self);
-
-       priv->rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
+       self->rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
 
        if (error) {
                g_warning ("Could not get RR screen: %s", error->message);
                g_error_free (error);
        }
 
-       g_signal_connect_swapped (priv->rr_screen, "changed",
+       g_signal_connect_swapped (self->rr_screen, "changed",
                                  G_CALLBACK (update_monitor_chooser), self);
 
        vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
@@ -257,35 +253,35 @@ cc_wacom_mapping_panel_init (CcWacomMappingPanel *self)
        grid = gtk_grid_new();
        gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
        gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
-       priv->label = gtk_label_new (_("Output:"));
-       gtk_widget_set_halign (priv->label, GTK_ALIGN_END);
-       priv->combobox = gtk_combo_box_new ();
-       g_signal_connect (G_OBJECT (priv->combobox), "changed",
+       self->label = gtk_label_new (_("Output:"));
+       gtk_widget_set_halign (self->label, GTK_ALIGN_END);
+       self->combobox = gtk_combo_box_new ();
+       g_signal_connect (G_OBJECT (self->combobox), "changed",
                              G_CALLBACK (combobox_changed_cb), self);
        renderer = gtk_cell_renderer_text_new ();
-       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(priv->combobox), renderer, TRUE);
-       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(priv->combobox), renderer, "text", 0);
-       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->label), 0, 0, 1, 1);
-       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->combobox), 1, 0, 1, 1);
+       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(self->combobox), renderer, TRUE);
+       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(self->combobox), renderer, "text", 0);
+       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(self->label), 0, 0, 1, 1);
+       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(self->combobox), 1, 0, 1, 1);
 
        /* Keep ratio switch */
-       priv->aspectlabel = gtk_label_new (_("Keep aspect ratio (letterbox):"));
-       gtk_widget_set_halign (priv->aspectlabel, GTK_ALIGN_END);
-       priv->aspectswitch = gtk_switch_new ();
-       gtk_widget_set_halign (priv->aspectswitch, GTK_ALIGN_START);
-       gtk_switch_set_active (GTK_SWITCH (priv->aspectswitch), FALSE);
-       g_signal_connect (GTK_SWITCH (priv->aspectswitch), "notify::active",
+       self->aspectlabel = gtk_label_new (_("Keep aspect ratio (letterbox):"));
+       gtk_widget_set_halign (self->aspectlabel, GTK_ALIGN_END);
+       self->aspectswitch = gtk_switch_new ();
+       gtk_widget_set_halign (self->aspectswitch, GTK_ALIGN_START);
+       gtk_switch_set_active (GTK_SWITCH (self->aspectswitch), FALSE);
+       g_signal_connect (GTK_SWITCH (self->aspectswitch), "notify::active",
                       G_CALLBACK (aspectswitch_toggled_cb), self);
-       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->aspectlabel), 0, 1, 1, 1);
-       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->aspectswitch), 1, 1, 1, 1);
+       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(self->aspectlabel), 0, 1, 1, 1);
+       gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(self->aspectswitch), 1, 1, 1, 1);
 
        /* Whole-desktop checkbox */
-       priv->checkbutton = gtk_check_button_new_with_label (_("Map to single monitor"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbutton), FALSE);
-       g_signal_connect (G_OBJECT (priv->checkbutton), "toggled",
+       self->checkbutton = gtk_check_button_new_with_label (_("Map to single monitor"));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->checkbutton), FALSE);
+       g_signal_connect (G_OBJECT (self->checkbutton), "toggled",
                       G_CALLBACK (checkbutton_toggled_cb), self);
 
-       gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(priv->checkbutton),
+       gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(self->checkbutton),
                                FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(grid),
                                FALSE, FALSE, 8);
@@ -301,7 +297,7 @@ cc_wacom_mapping_panel_new (void)
        CcWacomMappingPanel *panel;
 
        panel = CC_WACOM_MAPPING_PANEL(g_object_new (CC_TYPE_WACOM_MAPPING_PANEL, NULL));
-       panel->priv->device = NULL;
+       panel->device = NULL;
 
        return GTK_WIDGET(panel);
 }
@@ -337,7 +333,7 @@ cc_wacom_mapping_panel_dispose (GObject *object)
 {
        CcWacomMappingPanel *self = CC_WACOM_MAPPING_PANEL (object);
 
-       g_clear_object (&self->priv->rr_screen);
+       g_clear_object (&self->rr_screen);
 
        G_OBJECT_CLASS (cc_wacom_mapping_panel_parent_class)->dispose (object);
 }
@@ -347,8 +343,6 @@ cc_wacom_mapping_panel_class_init (CcWacomMappingPanelClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       g_type_class_add_private (klass, sizeof (CcWacomMappingPanelPrivate));
-
        object_class->get_property = cc_wacom_mapping_panel_get_property;
        object_class->set_property = cc_wacom_mapping_panel_set_property;
        object_class->dispose = cc_wacom_mapping_panel_dispose;
diff --git a/panels/wacom/cc-wacom-mapping-panel.h b/panels/wacom/cc-wacom-mapping-panel.h
index ae9dabb..74211ef 100644
--- a/panels/wacom/cc-wacom-mapping-panel.h
+++ b/panels/wacom/cc-wacom-mapping-panel.h
@@ -28,47 +28,10 @@ G_BEGIN_DECLS
 
 #define CC_TYPE_WACOM_MAPPING_PANEL cc_wacom_mapping_panel_get_type()
 
-#define CC_WACOM_MAPPING_PANEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  CC_TYPE_WACOM_MAPPING_PANEL, CcWacomMappingPanel))
-
-#define CC_WACOM_MAPPING_PANEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-  CC_TYPE_WACOM_MAPPING_PANEL, CcWacomMappignPanelClass))
-
-#define CC_IS_WACOM_MAPPING_PANEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  CC_TYPE_WACOM_MAPPING_PANEL))
-
-#define CC_IS_WACOM_MAPPING_PANEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-  CC_TYPE_WACOM_MAPPING_PANEL))
-
-#define CC_WACOM_MAPPING_PANEL_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-  CC_TYPE_WACOM_MAPPING_PANEL, CcWacomMappingPanelClass))
-
-typedef struct _CcWacomMappingPanel CcWacomMappingPanel;
-typedef struct _CcWacomMappingPanelClass CcWacomMappingPanelClass;
-typedef struct _CcWacomMappingPanelPrivate CcWacomMappingPanelPrivate;
-
-struct _CcWacomMappingPanel
-{
-  GtkBox parent;
-
-  CcWacomMappingPanelPrivate *priv;
-};
-
-struct _CcWacomMappingPanelClass
-{
-  GtkBoxClass parent_class;
-};
-
-GType cc_wacom_mapping_panel_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcWacomMappingPanel, cc_wacom_mapping_panel, CC, WACOM_MAPPING_PANEL, GtkBox)
 
 GtkWidget * cc_wacom_mapping_panel_new (void);
 
-
 void cc_wacom_mapping_panel_set_device (CcWacomMappingPanel *self,
                                         CcWacomDevice       *device);
 
diff --git a/panels/wacom/cc-wacom-nav-button.c b/panels/wacom/cc-wacom-nav-button.c
index ae7a89d..938f79f 100644
--- a/panels/wacom/cc-wacom-nav-button.c
+++ b/panels/wacom/cc-wacom-nav-button.c
@@ -25,13 +25,10 @@
 
 #include "cc-wacom-nav-button.h"
 
-G_DEFINE_TYPE (CcWacomNavButton, cc_wacom_nav_button, GTK_TYPE_BOX)
-
-#define WACOM_NAV_BUTTON_PRIVATE(o) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_NAV_BUTTON, CcWacomNavButtonPrivate))
-
-struct _CcWacomNavButtonPrivate
+struct _CcWacomNavButton
 {
+       GtkBox       parent_instance;
+
        GtkNotebook *notebook;
        GtkWidget   *label;
        GtkWidget   *prev;
@@ -42,6 +39,8 @@ struct _CcWacomNavButtonPrivate
        gboolean     ignore_first_page;
 };
 
+G_DEFINE_TYPE (CcWacomNavButton, cc_wacom_nav_button, GTK_TYPE_BOX)
+
 enum {
        PROP_0,
        PROP_NOTEBOOK,
@@ -51,23 +50,22 @@ enum {
 static void
 cc_wacom_nav_button_update (CcWacomNavButton *nav)
 {
-       CcWacomNavButtonPrivate *priv = nav->priv;
        int num_pages;
        int current_page;
        char *text;
 
-       if (priv->notebook == NULL) {
+       if (nav->notebook == NULL) {
                gtk_widget_hide (GTK_WIDGET (nav));
                return;
        }
 
-       num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook));
+       num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nav->notebook));
        if (num_pages == 0)
                return;
-       if (priv->ignore_first_page && num_pages == 1)
+       if (nav->ignore_first_page && num_pages == 1)
                return;
 
-       if (priv->ignore_first_page)
+       if (nav->ignore_first_page)
                num_pages--;
 
        g_assert (num_pages >= 1);
@@ -75,18 +73,18 @@ cc_wacom_nav_button_update (CcWacomNavButton *nav)
        gtk_revealer_set_reveal_child (GTK_REVEALER (gtk_widget_get_parent (GTK_WIDGET (nav))),
                                       num_pages > 1);
 
-       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
+       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->notebook));
        if (current_page < 0)
                return;
-       if (priv->ignore_first_page)
+       if (nav->ignore_first_page)
                current_page--;
-       gtk_widget_set_sensitive (priv->prev, current_page == 0 ? FALSE : TRUE);
-       gtk_widget_set_sensitive (priv->next, current_page + 1 == num_pages ? FALSE : TRUE);
+       gtk_widget_set_sensitive (nav->prev, current_page == 0 ? FALSE : TRUE);
+       gtk_widget_set_sensitive (nav->next, current_page + 1 == num_pages ? FALSE : TRUE);
 
        text = g_strdup_printf (_("%d of %d"),
                                current_page + 1,
                                num_pages);
-       gtk_label_set_text (GTK_LABEL (priv->label), text);
+       gtk_label_set_text (GTK_LABEL (nav->label), text);
 }
 
 static void
@@ -112,9 +110,9 @@ next_clicked (GtkButton        *button,
 {
        int current_page;
 
-       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->priv->notebook));
+       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->notebook));
        current_page++;
-       gtk_notebook_set_current_page (GTK_NOTEBOOK (nav->priv->notebook), current_page);
+       gtk_notebook_set_current_page (GTK_NOTEBOOK (nav->notebook), current_page);
 }
 
 static void
@@ -123,9 +121,9 @@ prev_clicked (GtkButton        *button,
 {
        int current_page;
 
-       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->priv->notebook));
+       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->notebook));
        current_page--;
-       gtk_notebook_set_current_page (GTK_NOTEBOOK (nav->priv->notebook), current_page--);
+       gtk_notebook_set_current_page (GTK_NOTEBOOK (nav->notebook), current_page--);
 }
 
 static void
@@ -135,27 +133,26 @@ cc_wacom_nav_button_set_property (GObject      *object,
                                  GParamSpec   *pspec)
 {
        CcWacomNavButton *nav = CC_WACOM_NAV_BUTTON (object);
-       CcWacomNavButtonPrivate *priv = nav->priv;
 
        switch (property_id) {
        case PROP_NOTEBOOK:
-               if (priv->notebook) {
-                       g_signal_handler_disconnect (priv->notebook, priv->page_added_id);
-                       g_signal_handler_disconnect (priv->notebook, priv->page_removed_id);
-                       g_signal_handler_disconnect (priv->notebook, priv->page_switched_id);
-                       g_object_unref (priv->notebook);
+               if (nav->notebook) {
+                       g_signal_handler_disconnect (nav->notebook, nav->page_added_id);
+                       g_signal_handler_disconnect (nav->notebook, nav->page_removed_id);
+                       g_signal_handler_disconnect (nav->notebook, nav->page_switched_id);
+                       g_object_unref (nav->notebook);
                }
-               priv->notebook = g_value_dup_object (value);
-               priv->page_added_id = g_signal_connect (G_OBJECT (priv->notebook), "page-added",
-                                                       G_CALLBACK (pages_changed), nav);
-               priv->page_removed_id = g_signal_connect (G_OBJECT (priv->notebook), "page-removed",
-                                                         G_CALLBACK (pages_changed), nav);
-               priv->page_switched_id = g_signal_connect (G_OBJECT (priv->notebook), "notify::page",
-                                                          G_CALLBACK (page_switched), nav);
+               nav->notebook = g_value_dup_object (value);
+               nav->page_added_id = g_signal_connect (G_OBJECT (nav->notebook), "page-added",
+                                                      G_CALLBACK (pages_changed), nav);
+               nav->page_removed_id = g_signal_connect (G_OBJECT (nav->notebook), "page-removed",
+                                                        G_CALLBACK (pages_changed), nav);
+               nav->page_switched_id = g_signal_connect (G_OBJECT (nav->notebook), "notify::page",
+                                                         G_CALLBACK (page_switched), nav);
                cc_wacom_nav_button_update (nav);
                break;
        case PROP_IGNORE_FIRST:
-               priv->ignore_first_page = g_value_get_boolean (value);
+               nav->ignore_first_page = g_value_get_boolean (value);
                cc_wacom_nav_button_update (nav);
                break;
        default:
@@ -166,17 +163,17 @@ cc_wacom_nav_button_set_property (GObject      *object,
 static void
 cc_wacom_nav_button_dispose (GObject *object)
 {
-       CcWacomNavButtonPrivate *priv = CC_WACOM_NAV_BUTTON (object)->priv;
-
-       if (priv->notebook) {
-               g_signal_handler_disconnect (priv->notebook, priv->page_added_id);
-               priv->page_added_id = 0;
-               g_signal_handler_disconnect (priv->notebook, priv->page_removed_id);
-               priv->page_removed_id = 0;
-               g_signal_handler_disconnect (priv->notebook, priv->page_switched_id);
-               priv->page_switched_id = 0;
-               g_object_unref (priv->notebook);
-               priv->notebook = NULL;
+       CcWacomNavButton *self = CC_WACOM_NAV_BUTTON (object);
+
+       if (self->notebook) {
+               g_signal_handler_disconnect (self->notebook, self->page_added_id);
+               self->page_added_id = 0;
+               g_signal_handler_disconnect (self->notebook, self->page_removed_id);
+               self->page_removed_id = 0;
+               g_signal_handler_disconnect (self->notebook, self->page_switched_id);
+               self->page_switched_id = 0;
+               g_object_unref (self->notebook);
+               self->notebook = NULL;
        }
 
        G_OBJECT_CLASS (cc_wacom_nav_button_parent_class)->dispose (object);
@@ -187,8 +184,6 @@ cc_wacom_nav_button_class_init (CcWacomNavButtonClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       g_type_class_add_private (klass, sizeof (CcWacomNavButtonPrivate));
-
        object_class->set_property = cc_wacom_nav_button_set_property;
        object_class->dispose = cc_wacom_nav_button_dispose;
 
@@ -205,16 +200,13 @@ cc_wacom_nav_button_class_init (CcWacomNavButtonClass *klass)
 static void
 cc_wacom_nav_button_init (CcWacomNavButton *self)
 {
-       CcWacomNavButtonPrivate *priv;
        GtkStyleContext *context;
        GtkWidget *image, *box;
 
-       priv = self->priv = WACOM_NAV_BUTTON_PRIVATE (self);
-
        /* Label */
-       priv->label = gtk_label_new (NULL);
-       gtk_style_context_add_class (gtk_widget_get_style_context (priv->label), "dim-label");
-       gtk_box_pack_start (GTK_BOX (self), priv->label,
+       self->label = gtk_label_new (NULL);
+       gtk_style_context_add_class (gtk_widget_get_style_context (self->label), "dim-label");
+       gtk_box_pack_start (GTK_BOX (self), self->label,
                            FALSE, FALSE, 8);
 
        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -224,27 +216,27 @@ cc_wacom_nav_button_init (CcWacomNavButton *self)
                            FALSE, FALSE, 0);
 
        /* Prev button */
-       priv->prev = gtk_button_new ();
+       self->prev = gtk_button_new ();
        image = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);
-       gtk_container_add (GTK_CONTAINER (priv->prev), image);
-       g_signal_connect (G_OBJECT (priv->prev), "clicked",
+       gtk_container_add (GTK_CONTAINER (self->prev), image);
+       g_signal_connect (G_OBJECT (self->prev), "clicked",
                          G_CALLBACK (prev_clicked), self);
-       gtk_widget_set_valign (priv->prev, GTK_ALIGN_CENTER);
+       gtk_widget_set_valign (self->prev, GTK_ALIGN_CENTER);
 
        /* Next button */
-       priv->next = gtk_button_new ();
+       self->next = gtk_button_new ();
        image = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU);
-       gtk_container_add (GTK_CONTAINER (priv->next), image);
-       g_signal_connect (G_OBJECT (priv->next), "clicked",
+       gtk_container_add (GTK_CONTAINER (self->next), image);
+       g_signal_connect (G_OBJECT (self->next), "clicked",
                          G_CALLBACK (next_clicked), self);
-       gtk_widget_set_valign (priv->next, GTK_ALIGN_CENTER);
+       gtk_widget_set_valign (self->next, GTK_ALIGN_CENTER);
 
-       gtk_box_pack_start (GTK_BOX (box), priv->prev,
+       gtk_box_pack_start (GTK_BOX (box), self->prev,
                            FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (box), priv->next,
+       gtk_box_pack_start (GTK_BOX (box), self->next,
                            FALSE, FALSE, 0);
 
-       gtk_widget_show (priv->label);
+       gtk_widget_show (self->label);
        gtk_widget_show_all (box);
 }
 
diff --git a/panels/wacom/cc-wacom-nav-button.h b/panels/wacom/cc-wacom-nav-button.h
index 325a5eb..9d72fb2 100644
--- a/panels/wacom/cc-wacom-nav-button.h
+++ b/panels/wacom/cc-wacom-nav-button.h
@@ -27,43 +27,7 @@ G_BEGIN_DECLS
 
 #define CC_TYPE_WACOM_NAV_BUTTON cc_wacom_nav_button_get_type()
 
-#define CC_WACOM_NAV_BUTTON(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  CC_TYPE_WACOM_NAV_BUTTON, CcWacomNavButton))
-
-#define CC_WACOM_NAV_BUTTON_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-  CC_TYPE_WACOM_NAV_BUTTON, CcWacomNavButtonClass))
-
-#define CC_IS_WACOM_NAV_BUTTON(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  CC_TYPE_WACOM_NAV_BUTTON))
-
-#define CC_IS_WACOM_NAV_BUTTON_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-  CC_TYPE_WACOM_NAV_BUTTON))
-
-#define CC_WACOM_NAV_BUTTON_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-  CC_TYPE_WACOM_NAV_BUTTON, CcWacomNavButtonClass))
-
-typedef struct _CcWacomNavButton CcWacomNavButton;
-typedef struct _CcWacomNavButtonClass CcWacomNavButtonClass;
-typedef struct _CcWacomNavButtonPrivate CcWacomNavButtonPrivate;
-
-struct _CcWacomNavButton
-{
-  GtkBox parent;
-
-  CcWacomNavButtonPrivate *priv;
-};
-
-struct _CcWacomNavButtonClass
-{
-  GtkBoxClass parent_class;
-};
-
-GType cc_wacom_nav_button_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcWacomNavButton, cc_wacom_nav_button, CC, WACOM_NAV_BUTTON, GtkBox)
 
 GtkWidget * cc_wacom_nav_button_new (void);
 
diff --git a/panels/wacom/gsd-wacom-key-shortcut-button.c b/panels/wacom/gsd-wacom-key-shortcut-button.c
index 925c8c1..13287ac 100644
--- a/panels/wacom/gsd-wacom-key-shortcut-button.c
+++ b/panels/wacom/gsd-wacom-key-shortcut-button.c
@@ -38,10 +38,6 @@
 #define DEFAULT_CANCEL_KEY GDK_KEY_Escape
 #define DEFAULT_CLEAR_KEY  GDK_KEY_BackSpace
 
-#define GSD_WACOM_KEY_SHORTCUT_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON, GsdWacomKeyShortcutButtonPrivate))
-
-G_DEFINE_TYPE (GsdWacomKeyShortcutButton, gsd_wacom_key_shortcut_button, GTK_TYPE_BUTTON);
-
 enum {
   KEY_SHORTCUT_EDITED,
   KEY_SHORTCUT_CLEARED,
@@ -58,8 +54,10 @@ enum {
   N_PROPERTIES
 };
 
-struct _GsdWacomKeyShortcutButtonPrivate
+struct _GsdWacomKeyShortcutButton
 {
+  GtkButton parent_instance;
+
   gboolean editing_mode;
 
   GdkDevice *grab_keyboard;
@@ -81,6 +79,8 @@ struct _GsdWacomKeyShortcutButtonPrivate
   guint clear_keyval;
 };
 
+G_DEFINE_TYPE (GsdWacomKeyShortcutButton, gsd_wacom_key_shortcut_button, GTK_TYPE_BUTTON);
+
 static guint signals[LAST_SIGNAL] = { 0 };
 
 static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
@@ -99,25 +99,25 @@ gsd_wacom_key_shortcut_button_set_property (GObject      *object,
   switch (property_id)
     {
     case PROP_SHORTCUT_KEY_VAL:
-      self->priv->keyval = g_value_get_uint (value);
+      self->keyval = g_value_get_uint (value);
       changed = TRUE;
       break;
 
     case PROP_SHORTCUT_KEY_MODS:
-      self->priv->mods = g_value_get_uint (value);
+      self->mods = g_value_get_uint (value);
       changed = TRUE;
       break;
 
     case PROP_SHORTCUT_MODE:
-      self->priv->mode = g_value_get_enum (value);
+      self->mode = g_value_get_enum (value);
       break;
 
     case PROP_SHORTCUT_CANCEL_KEY:
-      self->priv->cancel_keyval = g_value_get_uint (value);
+      self->cancel_keyval = g_value_get_uint (value);
       break;
 
     case PROP_SHORTCUT_CLEAR_KEY:
-      self->priv->clear_keyval = g_value_get_uint (value);
+      self->clear_keyval = g_value_get_uint (value);
       break;
 
     default:
@@ -140,23 +140,23 @@ gsd_wacom_key_shortcut_button_get_property (GObject      *object,
   switch (property_id)
     {
     case PROP_SHORTCUT_KEY_VAL:
-      g_value_set_uint (value, self->priv->keyval);
+      g_value_set_uint (value, self->keyval);
       break;
 
     case PROP_SHORTCUT_KEY_MODS:
-      g_value_set_uint (value, self->priv->mods);
+      g_value_set_uint (value, self->mods);
       break;
 
     case PROP_SHORTCUT_MODE:
-      g_value_set_enum (value, self->priv->mode);
+      g_value_set_enum (value, self->mode);
       break;
 
     case PROP_SHORTCUT_CANCEL_KEY:
-      g_value_set_uint (value, self->priv->cancel_keyval);
+      g_value_set_uint (value, self->cancel_keyval);
       break;
 
     case PROP_SHORTCUT_CLEAR_KEY:
-      g_value_set_uint (value, self->priv->clear_keyval);
+      g_value_set_uint (value, self->clear_keyval);
       break;
 
     default:
@@ -169,7 +169,6 @@ static void
 gsd_wacom_key_shortcut_set_editing_mode (GsdWacomKeyShortcutButton *self,
                                          GdkEvent                  *event)
 {
-  GsdWacomKeyShortcutButtonPrivate *priv;
   GdkDevice *kbd = NULL, *pointer = NULL;
   GdkDeviceManager *device_manager;
   GdkDisplay *display;
@@ -177,9 +176,7 @@ gsd_wacom_key_shortcut_set_editing_mode (GsdWacomKeyShortcutButton *self,
   GdkWindow *window;
   guint32 time;
 
-  priv = GSD_WACOM_KEY_SHORTCUT_BUTTON (self)->priv;
-
-  priv->editing_mode = TRUE;
+  self->editing_mode = TRUE;
   gsd_wacom_key_shortcut_button_changed (self);
 
   window = gtk_widget_get_window (GTK_WIDGET (self));
@@ -224,33 +221,29 @@ gsd_wacom_key_shortcut_set_editing_mode (GsdWacomKeyShortcutButton *self,
 
   gtk_widget_grab_focus (GTK_WIDGET (self));
 
-  priv->grab_keyboard = kbd;
-  priv->grab_pointer = pointer;
+  self->grab_keyboard = kbd;
+  self->grab_pointer = pointer;
 }
 
 static void
 gsd_wacom_key_shortcut_remove_editing_mode (GsdWacomKeyShortcutButton *self)
 {
-  GsdWacomKeyShortcutButtonPrivate *priv;
-
-  priv = GSD_WACOM_KEY_SHORTCUT_BUTTON (self)->priv;
+  self->editing_mode = FALSE;
 
-  priv->editing_mode = FALSE;
-
-  if (priv->grab_keyboard != NULL)
+  if (self->grab_keyboard != NULL)
     {
-      gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
-      priv->grab_keyboard = NULL;
+      gdk_device_ungrab (self->grab_keyboard, GDK_CURRENT_TIME);
+      self->grab_keyboard = NULL;
     }
-  if (priv->grab_pointer != NULL)
+  if (self->grab_pointer != NULL)
     {
-      gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
-      priv->grab_pointer = NULL;
+      gdk_device_ungrab (self->grab_pointer, GDK_CURRENT_TIME);
+      self->grab_pointer = NULL;
     }
 
-  priv->tmp_shortcut_keyval = 0;
-  priv->tmp_shortcut_mods = 0;
-  priv->tmp_shortcut_time = 0;
+  self->tmp_shortcut_keyval = 0;
+  self->tmp_shortcut_mods = 0;
+  self->tmp_shortcut_time = 0;
 }
 
 static void
@@ -258,7 +251,7 @@ gsd_wacom_key_shortcut_button_changed (GsdWacomKeyShortcutButton *self)
 {
   gchar *text;
 
-  if (self->priv->editing_mode)
+  if (self->editing_mode)
     {
       gtk_button_set_label (GTK_BUTTON (self), _("New shortcut…"));
 
@@ -269,13 +262,13 @@ gsd_wacom_key_shortcut_button_changed (GsdWacomKeyShortcutButton *self)
       return;
     }
 
-  if (self->priv->keyval == 0 && self->priv->mods == 0)
+  if (self->keyval == 0 && self->mods == 0)
     {
       gtk_button_set_label (GTK_BUTTON (self), "");
       return;
     }
 
-  text = gtk_accelerator_get_label (self->priv->keyval, self->priv->mods);
+  text = gtk_accelerator_get_label (self->keyval, self->mods);
   gtk_button_set_label (GTK_BUTTON (self), text);
   g_free (text);
 }
@@ -291,27 +284,23 @@ gsd_wacom_key_shortcut_button_activate (GtkButton *self)
 static void
 gsd_wacom_key_shortcut_button_init (GsdWacomKeyShortcutButton *self)
 {
-  self->priv = GSD_WACOM_KEY_SHORTCUT_BUTTON_GET_PRIVATE (self);
-
   gtk_button_set_relief (GTK_BUTTON (self), GTK_RELIEF_NONE);
 
-  self->priv->cancel_keyval = DEFAULT_CANCEL_KEY;
-  self->priv->clear_keyval = DEFAULT_CLEAR_KEY;
+  self->cancel_keyval = DEFAULT_CANCEL_KEY;
+  self->clear_keyval = DEFAULT_CLEAR_KEY;
 }
 
 static void
 key_shortcut_finished_editing (GsdWacomKeyShortcutButton *self,
                                guint32                    time)
 {
-  GsdWacomKeyShortcutButtonPrivate *priv = self->priv;
+  gdk_device_ungrab (self->grab_keyboard, time);
+  gdk_device_ungrab (self->grab_pointer, time);
 
-  gdk_device_ungrab (priv->grab_keyboard, time);
-  gdk_device_ungrab (priv->grab_pointer, time);
+  self->grab_keyboard = NULL;
+  self->grab_pointer = NULL;
 
-  priv->grab_keyboard = NULL;
-  priv->grab_pointer = NULL;
-
-  priv->editing_mode = FALSE;
+  self->editing_mode = FALSE;
 
   gsd_wacom_key_shortcut_remove_editing_mode (self);
 
@@ -323,19 +312,18 @@ gsd_wacom_key_shortcut_button_key_release (GtkWidget            *widget,
                                            GdkEventKey          *event)
 {
   GsdWacomKeyShortcutButton *self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget);
-  GsdWacomKeyShortcutButtonPrivate *priv = self->priv;
 
-  if (priv->tmp_shortcut_keyval == 0)
+  if (self->tmp_shortcut_keyval == 0)
     {
       GTK_WIDGET_CLASS (gsd_wacom_key_shortcut_button_parent_class)->key_release_event (widget, event);
 
       return FALSE;
     }
 
-  priv->keyval = priv->tmp_shortcut_keyval;
-  priv->mods = priv->tmp_shortcut_mods;
+  self->keyval = self->tmp_shortcut_keyval;
+  self->mods = self->tmp_shortcut_mods;
 
-  key_shortcut_finished_editing (self, priv->tmp_shortcut_time);
+  key_shortcut_finished_editing (self, self->tmp_shortcut_time);
 
   g_signal_emit (self, signals[KEY_SHORTCUT_EDITED], 0);
 
@@ -347,22 +335,18 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget   *widget,
                                          GdkEventKey *event)
 {
   /* This code is based on the gtk_cell_renderer_accel_start_editing */
-  GsdWacomKeyShortcutButton *self;
-  GsdWacomKeyShortcutButtonPrivate *priv;
+  GsdWacomKeyShortcutButton *self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget);
   GdkModifierType mods = 0;
   guint shortcut_keyval;
   guint keyval;
   gboolean edited;
   gboolean cleared;
 
-  self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget);
-  priv = self->priv;
-
   /* GTK and OTHER modes don't allow modifier keyvals */
-  if (event->is_modifier && priv->mode != GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL)
+  if (event->is_modifier && self->mode != GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL)
     return TRUE;
 
-  if (!priv->editing_mode)
+  if (!self->editing_mode)
     {
       GTK_WIDGET_CLASS (gsd_wacom_key_shortcut_button_parent_class)->key_press_event (widget, event);
 
@@ -398,12 +382,12 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget   *widget,
 
   if (mods == 0)
     {
-      if (keyval == priv->cancel_keyval)
+      if (keyval == self->cancel_keyval)
         {
           /* cancel the edition */
           goto out;
         }
-      else if (keyval == priv->clear_keyval)
+      else if (keyval == self->clear_keyval)
         {
          /* clear the current shortcut */
          cleared = TRUE;
@@ -411,9 +395,9 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget   *widget,
        }
     }
 
-  priv->tmp_shortcut_keyval = 0;
-  priv->tmp_shortcut_mods = 0;
-  priv->tmp_shortcut_time = 0;
+  self->tmp_shortcut_keyval = 0;
+  self->tmp_shortcut_mods = 0;
+  self->tmp_shortcut_time = 0;
 
   if (event->is_modifier)
     {
@@ -423,9 +407,9 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget   *widget,
        * key because the user might assign e.g. Alt, Alt+Ctrl, Alt+Ctrl+Shift, etc.
        * So, we keep track of the pressed shortcut's (keyval, mods and time) if
        * it is a modifier shortcut and assign them when a key-release happens */
-      priv->tmp_shortcut_keyval = shortcut_keyval;
-      priv->tmp_shortcut_mods = mods;
-      priv->tmp_shortcut_time = event->time;
+      self->tmp_shortcut_keyval = shortcut_keyval;
+      self->tmp_shortcut_mods = mods;
+      self->tmp_shortcut_time = event->time;
 
       return TRUE;
     }
@@ -436,14 +420,14 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget   *widget,
 
   if (edited)
     {
-      priv->keyval = shortcut_keyval;
-      priv->mods = mods;
+      self->keyval = shortcut_keyval;
+      self->mods = mods;
     }
 
   if (cleared)
     {
-      priv->keyval = 0;
-      priv->mods = 0;
+      self->keyval = 0;
+      self->mods = 0;
     }
 
   key_shortcut_finished_editing (GSD_WACOM_KEY_SHORTCUT_BUTTON (widget), event->time);
@@ -464,7 +448,7 @@ gsd_wacom_key_shortcut_button_button_press (GtkWidget      *widget,
 
   self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget);
 
-  if (self->priv->editing_mode)
+  if (self->editing_mode)
     return TRUE;
 
   gsd_wacom_key_shortcut_set_editing_mode (self, NULL);
@@ -577,8 +561,7 @@ gsd_wacom_key_shortcut_button_class_init (GsdWacomKeyShortcutButtonClass *klass)
   signals[KEY_SHORTCUT_EDITED] = g_signal_new ("key-shortcut-edited",
                                                GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON,
                                                G_SIGNAL_RUN_LAST,
-                                               G_STRUCT_OFFSET (GsdWacomKeyShortcutButtonClass,
-                                                                key_shortcut_edited),
+                                               0,
                                                NULL, NULL,
                                                g_cclosure_marshal_VOID__VOID,
                                                G_TYPE_NONE, 0);
@@ -592,13 +575,10 @@ gsd_wacom_key_shortcut_button_class_init (GsdWacomKeyShortcutButtonClass *klass)
   signals[KEY_SHORTCUT_CLEARED] = g_signal_new ("key-shortcut-cleared",
                                                 GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON,
                                                 G_SIGNAL_RUN_LAST,
-                                                G_STRUCT_OFFSET (GsdWacomKeyShortcutButtonClass,
-                                                                 key_shortcut_cleared),
+                                                0,
                                                 NULL, NULL,
                                                 g_cclosure_marshal_VOID__VOID,
                                                 G_TYPE_NONE, 0);
-
-  g_type_class_add_private (klass, sizeof (GsdWacomKeyShortcutButtonPrivate));
 }
 
 /**
diff --git a/panels/wacom/gsd-wacom-key-shortcut-button.h b/panels/wacom/gsd-wacom-key-shortcut-button.h
index eebae0f..2432f1f 100644
--- a/panels/wacom/gsd-wacom-key-shortcut-button.h
+++ b/panels/wacom/gsd-wacom-key-shortcut-button.h
@@ -26,16 +26,9 @@
 
 G_BEGIN_DECLS
 
-#define GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON            (gsd_wacom_key_shortcut_button_get_type ())
-#define GSD_WACOM_KEY_SHORTCUT_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON, GsdWacomKeyShortcutButton))
-#define GSD_WACOM_IS_KEY_SHORTCUT_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON))
-#define GSD_WACOM_KEY_SHORTCUT_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON, GsdWacomKeyShortcutButtonClass))
-#define GSD_WACOM_IS_KEY_SHORTCUT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON))
-#define GSD_WACOM_KEY_SHORTCUT_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON, GsdWacomKeyShortcutButtonClass))
+#define GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON gsd_wacom_key_shortcut_button_get_type ()
 
-typedef struct _GsdWacomKeyShortcutButton        GsdWacomKeyShortcutButton;
-typedef struct _GsdWacomKeyShortcutButtonClass   GsdWacomKeyShortcutButtonClass;
-typedef struct _GsdWacomKeyShortcutButtonPrivate GsdWacomKeyShortcutButtonPrivate;
+G_DECLARE_FINAL_TYPE (GsdWacomKeyShortcutButton, gsd_wacom_key_shortcut_button, GSD, 
WACOM_KEY_SHORTCUT_BUTTON, GtkButton)
 
 GType gsd_wacom_key_shortcut_button_mode_type (void) G_GNUC_CONST;
 #define GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON_MODE (gsd_wacom_key_shortcut_button_mode_type())
@@ -46,24 +39,6 @@ typedef enum
   GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL
 } GsdWacomKeyShortcutButtonMode;
 
-struct _GsdWacomKeyShortcutButton
-{
-  GtkButton parent_instance;
-
-  /*< private >*/
-  GsdWacomKeyShortcutButtonPrivate *priv;
-};
-
-struct _GsdWacomKeyShortcutButtonClass
-{
-  GtkButtonClass parent_class;
-
-  void (* key_shortcut_edited)  (GsdWacomKeyShortcutButton *key_shortcut_button);
-
-  void (* key_shortcut_cleared) (GsdWacomKeyShortcutButton *key_shortcut_button);
-};
-
-GType          gsd_wacom_key_shortcut_button_get_type        (void) G_GNUC_CONST;
 GtkWidget    * gsd_wacom_key_shortcut_button_new             (void);
 
 #endif /* __GSD_WACOM_KEY_SHORTCUT_BUTTON_H__ */



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