[gnome-control-center] panels: add register macro
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] panels: add register macro
- Date: Tue, 21 Aug 2012 18:32:39 +0000 (UTC)
commit b0e7a5efa819525bf6709ac3a009b12bb145d601
Author: Ray Strode <rstrode redhat com>
Date: Tue Aug 21 14:29:22 2012 -0400
panels: add register macro
Bastien says he doesn't like the blank class_finalize
functions in every panel and he would like a wrapper
macro to hide them.
This commit does that.
panels/background/cc-background-panel.c | 7 +------
panels/bluetooth/cc-bluetooth-panel.c | 7 +------
panels/color/cc-color-panel.c | 7 +------
panels/datetime/cc-datetime-panel.c | 8 +-------
panels/display/cc-display-panel.c | 7 +------
panels/info/cc-info-panel.c | 7 +------
panels/keyboard/cc-keyboard-panel.c | 7 +------
panels/mouse/cc-mouse-panel.c | 7 +------
panels/network/cc-network-panel.c | 7 +------
panels/online-accounts/cc-online-accounts-panel.c | 7 +------
panels/power/cc-power-panel.c | 7 +------
panels/printers/cc-printers-panel.c | 2 +-
panels/region/cc-region-panel.c | 7 +------
panels/screen/cc-screen-panel.c | 7 +------
panels/sound/cc-sound-panel.c | 7 +------
panels/universal-access/cc-ua-panel.c | 7 +------
panels/user-accounts/um-user-panel.c | 7 +------
panels/wacom/cc-wacom-panel.c | 7 +------
shell/cc-panel.h | 14 ++++++++++++++
19 files changed, 32 insertions(+), 104 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index ce29727..206b94d 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -42,7 +42,7 @@
#define WP_PCOLOR_KEY "primary-color"
#define WP_SCOLOR_KEY "secondary-color"
-G_DEFINE_DYNAMIC_TYPE (CcBackgroundPanel, cc_background_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcBackgroundPanel, cc_background_panel)
#define BACKGROUND_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_PANEL, CcBackgroundPanelPrivate))
@@ -131,11 +131,6 @@ cc_background_panel_class_init (CcBackgroundPanelClass *klass)
}
static void
-cc_background_panel_class_finalize (CcBackgroundPanelClass *klass)
-{
-}
-
-static void
update_preview (CcBackgroundPanelPrivate *priv,
CcBackgroundItem *item)
{
diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c
index de94931..17616e9 100644
--- a/panels/bluetooth/cc-bluetooth-panel.c
+++ b/panels/bluetooth/cc-bluetooth-panel.c
@@ -36,7 +36,7 @@
#include <bluetooth-chooser.h>
#include <bluetooth-plugin-manager.h>
-G_DEFINE_DYNAMIC_TYPE (CcBluetoothPanel, cc_bluetooth_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcBluetoothPanel, cc_bluetooth_panel)
#define BLUETOOTH_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelPrivate))
@@ -88,11 +88,6 @@ cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass)
}
static void
-cc_bluetooth_panel_class_finalize (CcBluetoothPanelClass *klass)
-{
-}
-
-static void
cc_bluetooth_panel_finalize (GObject *object)
{
CcBluetoothPanel *self;
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 72c46b0..de82dca 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -30,7 +30,7 @@
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
-G_DEFINE_DYNAMIC_TYPE (CcColorPanel, cc_color_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcColorPanel, cc_color_panel)
#define COLOR_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_COLOR_PANEL, CcColorPanelPrivate))
@@ -2377,11 +2377,6 @@ cc_color_panel_class_init (CcColorPanelClass *klass)
}
static void
-cc_color_panel_class_finalize (CcColorPanelClass *klass)
-{
-}
-
-static void
cc_color_panel_init (CcColorPanel *prefs)
{
CcColorPanelPrivate *priv;
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index f1cbec6..8465dc3 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -40,7 +40,7 @@
#define DEFAULT_TZ "Europe/London"
#define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones"
-G_DEFINE_DYNAMIC_TYPE (CcDateTimePanel, cc_date_time_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcDateTimePanel, cc_date_time_panel)
#define DATE_TIME_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DATE_TIME_PANEL, CcDateTimePanelPrivate))
@@ -197,12 +197,6 @@ cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
panel_class->get_help_uri = cc_date_time_panel_get_help_uri;
}
-static void
-cc_date_time_panel_class_finalize (CcDateTimePanelClass *klass)
-{
-
-}
-
static void clock_settings_changed_cb (GSettings *settings,
gchar *key,
CcDateTimePanel *panel);
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index b7a92dc..78e06aa 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -37,7 +37,7 @@
#include <glib/gi18n.h>
#include <gdesktop-enums.h>
-G_DEFINE_DYNAMIC_TYPE (CcDisplayPanel, cc_display_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcDisplayPanel, cc_display_panel)
#define DISPLAY_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DISPLAY_PANEL, CcDisplayPanelPrivate))
@@ -203,11 +203,6 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
}
static void
-cc_display_panel_class_finalize (CcDisplayPanelClass *klass)
-{
-}
-
-static void
error_message (CcDisplayPanel *self, const char *primary_text, const char *secondary_text)
{
GtkWidget *toplevel;
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index e64d868..9b3c32d 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -56,7 +56,7 @@
#define WID(w) (GtkWidget *) gtk_builder_get_object (self->priv->builder, w)
-G_DEFINE_DYNAMIC_TYPE (CcInfoPanel, cc_info_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcInfoPanel, cc_info_panel)
#define INFO_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_INFO_PANEL, CcInfoPanelPrivate))
@@ -567,11 +567,6 @@ cc_info_panel_class_init (CcInfoPanelClass *klass)
object_class->finalize = cc_info_panel_finalize;
}
-static void
-cc_info_panel_class_finalize (CcInfoPanelClass *klass)
-{
-}
-
static char *
get_os_type (void)
{
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index b2a6ed5..8c386bf 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -23,7 +23,7 @@
#include "keyboard-general.h"
#include "keyboard-shortcuts.h"
-G_DEFINE_DYNAMIC_TYPE (CcKeyboardPanel, cc_keyboard_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcKeyboardPanel, cc_keyboard_panel)
#define KEYBOARD_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelPrivate))
@@ -172,11 +172,6 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
}
static void
-cc_keyboard_panel_class_finalize (CcKeyboardPanelClass *klass)
-{
-}
-
-static void
cc_keyboard_panel_init (CcKeyboardPanel *self)
{
const gchar *uifile = GNOMECC_UI_DIR "/gnome-keyboard-panel.ui";
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index e61eb4b..3e6b3fa 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
-G_DEFINE_DYNAMIC_TYPE (CcMousePanel, cc_mouse_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcMousePanel, cc_mouse_panel)
#define MOUSE_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_MOUSE_PANEL, CcMousePanelPrivate))
@@ -125,11 +125,6 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
object_class->dispose = cc_mouse_panel_dispose;
}
-static void
-cc_mouse_panel_class_finalize (CcMousePanelClass *klass)
-{
-}
-
/* Toggle between mouse panel properties and testing area. */
static void
shell_test_button_toggle_event (GtkToggleButton *button, CcMousePanel *panel)
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index dda71df..6568cb1 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -42,7 +42,7 @@
#include "network-dialogs.h"
-G_DEFINE_DYNAMIC_TYPE (CcNetworkPanel, cc_network_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcNetworkPanel, cc_network_panel)
#define NETWORK_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_NETWORK_PANEL, CcNetworkPanelPrivate))
@@ -222,11 +222,6 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
g_object_class_override_property (object_class, PROP_ARGV, "argv");
}
-static void
-cc_network_panel_class_finalize (CcNetworkPanelClass *klass)
-{
-}
-
static NetObject *
get_selected_object (CcNetworkPanel *panel)
{
diff --git a/panels/online-accounts/cc-online-accounts-panel.c b/panels/online-accounts/cc-online-accounts-panel.c
index 1833e1c..fefb01e 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -85,7 +85,7 @@ static void on_account_changed (GoaClient *client,
static gboolean select_account_by_id (GoaPanel *panel,
const gchar *account_id);
-G_DEFINE_DYNAMIC_TYPE (GoaPanel, goa_panel, CC_TYPE_PANEL);
+CC_PANEL_REGISTER (GoaPanel, goa_panel);
enum {
PROP_0,
@@ -285,11 +285,6 @@ goa_panel_class_init (GoaPanelClass *klass)
g_object_class_override_property (object_class, PROP_ARGV, "argv");
}
-static void
-goa_panel_class_finalize (GoaPanelClass *klass)
-{
-}
-
/* ---------------------------------------------------------------------------------------------------- */
static void
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index e69f812..2b7e0ae 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -30,7 +30,7 @@
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
-G_DEFINE_DYNAMIC_TYPE (CcPowerPanel, cc_power_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcPowerPanel, cc_power_panel)
#define POWER_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_POWER_PANEL, CcPowerPanelPrivate))
@@ -150,11 +150,6 @@ cc_power_panel_class_init (CcPowerPanelClass *klass)
panel_class->get_help_uri = cc_power_panel_get_help_uri;
}
-static void
-cc_power_panel_class_finalize (CcPowerPanelClass *klass)
-{
-}
-
static gchar *
get_timestring (guint64 time_secs)
{
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 202a5b8..bd06639 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -38,7 +38,7 @@
#include "pp-jobs-dialog.h"
#include "pp-utils.h"
-G_DEFINE_DYNAMIC_TYPE (CcPrintersPanel, cc_printers_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcPrintersPanel, cc_printers_panel)
#define PRINTERS_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_PRINTERS_PANEL, CcPrintersPanelPrivate))
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index d67ad48..4c310d0 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -27,7 +27,7 @@
#include "gnome-region-panel-formats.h"
#include "gnome-region-panel-system.h"
-G_DEFINE_DYNAMIC_TYPE (CcRegionPanel, cc_region_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcRegionPanel, cc_region_panel)
#define REGION_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate))
@@ -130,11 +130,6 @@ cc_region_panel_class_init (CcRegionPanelClass * klass)
}
static void
-cc_region_panel_class_finalize (CcRegionPanelClass * klass)
-{
-}
-
-static void
cc_region_panel_init (CcRegionPanel * self)
{
CcRegionPanelPrivate *priv;
diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c
index 8ce9b2a..9c10932 100644
--- a/panels/screen/cc-screen-panel.c
+++ b/panels/screen/cc-screen-panel.c
@@ -21,7 +21,7 @@
#include "cc-screen-panel.h"
-G_DEFINE_DYNAMIC_TYPE (CcScreenPanel, cc_screen_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcScreenPanel, cc_screen_panel)
#define SCREEN_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SCREEN_PANEL, CcScreenPanelPrivate))
@@ -173,11 +173,6 @@ cc_screen_panel_class_init (CcScreenPanelClass *klass)
}
static void
-cc_screen_panel_class_finalize (CcScreenPanelClass *klass)
-{
-}
-
-static void
set_brightness_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GError *error = NULL;
diff --git a/panels/sound/cc-sound-panel.c b/panels/sound/cc-sound-panel.c
index 498ab66..1a5b552 100644
--- a/panels/sound/cc-sound-panel.c
+++ b/panels/sound/cc-sound-panel.c
@@ -34,7 +34,7 @@
#include "cc-sound-panel.h"
#include "gvc-mixer-dialog.h"
-G_DEFINE_DYNAMIC_TYPE (CcSoundPanel, cc_sound_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcSoundPanel, cc_sound_panel)
enum {
PROP_0,
@@ -88,11 +88,6 @@ cc_sound_panel_class_init (CcSoundPanelClass *klass)
}
static void
-cc_sound_panel_class_finalize (CcSoundPanelClass *klass)
-{
-}
-
-static void
cc_sound_panel_finalize (GObject *object)
{
CcSoundPanel *panel = CC_SOUND_PANEL (object);
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 6102d24..8bee6b1 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -42,7 +42,7 @@
#define KEY_ICON_THEME "icon-theme"
-G_DEFINE_DYNAMIC_TYPE (CcUaPanel, cc_ua_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcUaPanel, cc_ua_panel)
#define UA_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_UA_PANEL, CcUaPanelPrivate))
@@ -178,11 +178,6 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
object_class->finalize = cc_ua_panel_finalize;
}
-static void
-cc_ua_panel_class_finalize (CcUaPanelClass *klass)
-{
-}
-
static gchar *sticky_keys_section[] = {
"typing_sticky_keys_disable_two_keys_checkbutton",
"typing_sticky_keys_beep_modifier_checkbutton",
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index aca5b3c..fe10856 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -56,7 +56,7 @@
#define USER_ACCOUNTS_PERMISSION "org.gnome.controlcenter.user-accounts.administration"
-G_DEFINE_DYNAMIC_TYPE (UmUserPanel, um_user_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (UmUserPanel, um_user_panel)
#define UM_USER_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), UM_TYPE_USER_PANEL, UmUserPanelPrivate))
@@ -1385,11 +1385,6 @@ um_user_panel_class_init (UmUserPanelClass *klass)
g_type_class_add_private (klass, sizeof (UmUserPanelPrivate));
}
-static void
-um_user_panel_class_finalize (UmUserPanelClass *klass)
-{
-}
-
void
um_user_panel_register (GIOModule *module)
{
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 10b0df6..02a521a 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -31,7 +31,7 @@
#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
-G_DEFINE_DYNAMIC_TYPE (CcWacomPanel, cc_wacom_panel, CC_TYPE_PANEL)
+CC_PANEL_REGISTER (CcWacomPanel, cc_wacom_panel)
#define WACOM_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_PANEL, CcWacomPanelPrivate))
@@ -133,11 +133,6 @@ cc_wacom_panel_class_init (CcWacomPanelClass *klass)
}
static void
-cc_wacom_panel_class_finalize (CcWacomPanelClass *klass)
-{
-}
-
-static void
remove_page (GtkNotebook *notebook,
GtkWidget *widget)
{
diff --git a/shell/cc-panel.h b/shell/cc-panel.h
index 48979c6..5c440e5 100644
--- a/shell/cc-panel.h
+++ b/shell/cc-panel.h
@@ -38,6 +38,20 @@ G_BEGIN_DECLS
#define CC_IS_PANEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_PANEL))
#define CC_PANEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_PANEL, CcPanelClass))
+/*â
+ * Utility macro used to register panels
+ *
+ * use: CC_PANEL_REGISTER (PluginName, plugin_name)
+ */
+#define CC_PANEL_REGISTER(PluginName, plugin_name) \
+ G_DEFINE_DYNAMIC_TYPE (PluginName, \
+ plugin_name, \
+ CC_TYPE_PANEL) \
+static void \
+plugin_name##_class_finalize (PluginName##Class *plugin_name##_class) \
+{ \
+}
+
typedef struct CcPanelPrivate CcPanelPrivate;
typedef struct _CcPanel CcPanel;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]