From b0e7a5efa819525bf6709ac3a009b12bb145d601 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 21 Aug 2012 14:29:22 -0400 Subject: [PATCH] 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 ce2972707..206b94d36 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)) @@ -130,11 +130,6 @@ cc_background_panel_class_init (CcBackgroundPanelClass *klass) object_class->finalize = cc_background_panel_finalize; } -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 de9493191..17616e918 100644 --- a/panels/bluetooth/cc-bluetooth-panel.c +++ b/panels/bluetooth/cc-bluetooth-panel.c @@ -36,7 +36,7 @@ #include #include -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)) @@ -87,11 +87,6 @@ cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass) g_type_class_add_private (klass, sizeof (CcBluetoothPanelPrivate)); } -static void -cc_bluetooth_panel_class_finalize (CcBluetoothPanelClass *klass) -{ -} - static void cc_bluetooth_panel_finalize (GObject *object) { diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c index 72c46b038..de82dca0c 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)) @@ -2376,11 +2376,6 @@ cc_color_panel_class_init (CcColorPanelClass *klass) object_class->finalize = cc_color_panel_finalize; } -static void -cc_color_panel_class_finalize (CcColorPanelClass *klass) -{ -} - static void cc_color_panel_init (CcColorPanel *prefs) { diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c index f1cbec6ca..8465dc3e5 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 b7a92dc05..78e06aa76 100644 --- a/panels/display/cc-display-panel.c +++ b/panels/display/cc-display-panel.c @@ -37,7 +37,7 @@ #include #include -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)) @@ -202,11 +202,6 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass) object_class->finalize = cc_display_panel_finalize; } -static void -cc_display_panel_class_finalize (CcDisplayPanelClass *klass) -{ -} - static void error_message (CcDisplayPanel *self, const char *primary_text, const char *secondary_text) { diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c index e64d86804..9b3c32d3a 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 b2a6ed536..8c386bffb 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)) @@ -171,11 +171,6 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass) g_object_class_override_property (object_class, PROP_ARGV, "argv"); } -static void -cc_keyboard_panel_class_finalize (CcKeyboardPanelClass *klass) -{ -} - static void cc_keyboard_panel_init (CcKeyboardPanel *self) { diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c index e61eb4b08..3e6b3fa2d 100644 --- a/panels/mouse/cc-mouse-panel.c +++ b/panels/mouse/cc-mouse-panel.c @@ -29,7 +29,7 @@ #include -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 dda71df13..6568cb1d5 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 1833e1c85..fefb01e2c 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 e69f81224..2b7e0ae2d 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 202a5b8c9..bd06639fa 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 d67ad485f..4c310d069 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)) @@ -129,11 +129,6 @@ cc_region_panel_class_init (CcRegionPanelClass * klass) g_object_class_override_property (object_class, PROP_ARGV, "argv"); } -static void -cc_region_panel_class_finalize (CcRegionPanelClass * klass) -{ -} - static void cc_region_panel_init (CcRegionPanel * self) { diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c index 8ce9b2a31..9c109321b 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)) @@ -172,11 +172,6 @@ cc_screen_panel_class_init (CcScreenPanelClass *klass) panel_class->get_help_uri = cc_screen_panel_get_help_uri; } -static void -cc_screen_panel_class_finalize (CcScreenPanelClass *klass) -{ -} - static void set_brightness_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { diff --git a/panels/sound/cc-sound-panel.c b/panels/sound/cc-sound-panel.c index 498ab66de..1a5b55264 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, @@ -87,11 +87,6 @@ cc_sound_panel_class_init (CcSoundPanelClass *klass) g_object_class_override_property (object_class, PROP_ARGV, "argv"); } -static void -cc_sound_panel_class_finalize (CcSoundPanelClass *klass) -{ -} - static void cc_sound_panel_finalize (GObject *object) { diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c index 6102d24c5..8bee6b1db 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 aca5b3cc1..fe108565b 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 10b0df64c..02a521ae7 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)) @@ -132,11 +132,6 @@ cc_wacom_panel_class_init (CcWacomPanelClass *klass) object_class->dispose = cc_wacom_panel_dispose; } -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 48979c6b6..5c440e5b0 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;