Commit b0e7a5ef authored by Ray Strode's avatar Ray Strode
Browse files

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.
parent 0c1a76df
......@@ -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)
......
......@@ -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))
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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))
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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)
{
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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))
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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",
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment