summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2017-09-04 16:12:07 +1200
committerRobert Ancell <robert.ancell@canonical.com>2017-09-25 14:17:24 -0400
commitc6981636dc38a9fdc844db40964c5d89cf10615e (patch)
tree4f132f929d2f2de633fbf3a6a180e57d9d6967ec
parent045b1f03b9339c9a696277f6bc1194dbc0bb1c6b (diff)
downloadgnome-control-center-wip/rancell/g-define-type.tar.gz
Replace old-fashioned GObject boilerplate with G_DEFINE_TYPEwip/rancell/g-define-type
As well as simplifying the code this allows us to make use of the g_auto memory management macros.
-rw-r--r--panels/background/bg-colors-source.c8
-rw-r--r--panels/background/bg-colors-source.h38
-rw-r--r--panels/background/bg-pictures-source.c82
-rw-r--r--panels/background/bg-pictures-source.h41
-rw-r--r--panels/background/bg-source.c46
-rw-r--r--panels/background/bg-source.h36
-rw-r--r--panels/background/bg-wallpapers-source.c36
-rw-r--r--panels/background/bg-wallpapers-source.h41
-rw-r--r--panels/background/cc-background-chooser-dialog.c114
-rw-r--r--panels/background/cc-background-chooser-dialog.h26
-rw-r--r--panels/background/cc-background-grilo-miner.c10
-rw-r--r--panels/background/cc-background-grilo-miner.h28
-rw-r--r--panels/background/cc-background-item.c322
-rw-r--r--panels/background/cc-background-item.h23
-rw-r--r--panels/background/cc-background-panel.c234
-rw-r--r--panels/background/cc-background-panel.h41
-rw-r--r--panels/background/cc-background-xml.c55
-rw-r--r--panels/background/cc-background-xml.h24
-rw-r--r--panels/bluetooth/cc-bluetooth-panel.c108
-rw-r--r--panels/bluetooth/cc-bluetooth-panel.h23
-rw-r--r--panels/color/cc-color-calibrate.c276
-rw-r--r--panels/color/cc-color-calibrate.h24
-rw-r--r--panels/color/cc-color-cell-renderer-text.c7
-rw-r--r--panels/color/cc-color-cell-renderer-text.h27
-rw-r--r--panels/color/cc-color-device.c136
-rw-r--r--panels/color/cc-color-device.h28
-rw-r--r--panels/color/cc-color-panel.c493
-rw-r--r--panels/color/cc-color-panel.h41
-rw-r--r--panels/color/cc-color-profile.c140
-rw-r--r--panels/color/cc-color-profile.h26
-rw-r--r--panels/common/gsd-device-manager-udev.c5
-rw-r--r--panels/common/gsd-device-manager-udev.h13
-rw-r--r--panels/common/gsd-device-manager-x11.c5
-rw-r--r--panels/common/gsd-device-manager-x11.h13
-rw-r--r--panels/common/gsd-device-manager.c10
-rw-r--r--panels/common/gsd-device-manager.h34
-rw-r--r--panels/datetime/cc-datetime-panel.c340
-rw-r--r--panels/datetime/cc-datetime-panel.h41
-rw-r--r--panels/datetime/cc-timezone-map.c171
-rw-r--r--panels/datetime/cc-timezone-map.h41
-rw-r--r--panels/display/cc-display-panel.c468
-rw-r--r--panels/display/cc-display-panel.h41
-rw-r--r--panels/display/scrollarea.c273
-rw-r--r--panels/display/scrollarea.h52
-rw-r--r--panels/info/cc-info-default-apps-panel.h1
-rw-r--r--panels/info/cc-info-overview-panel.h1
-rw-r--r--panels/info/cc-info-panel.c26
-rw-r--r--panels/info/cc-info-panel.h41
-rw-r--r--panels/info/cc-info-removable-media-panel.h1
-rw-r--r--panels/keyboard/cc-keyboard-item.c162
-rw-r--r--panels/keyboard/cc-keyboard-item.h65
-rw-r--r--panels/keyboard/cc-keyboard-manager.c36
-rw-r--r--panels/keyboard/cc-keyboard-manager.h3
-rw-r--r--panels/keyboard/cc-keyboard-option.c19
-rw-r--r--panels/keyboard/cc-keyboard-option.h3
-rw-r--r--panels/keyboard/cc-keyboard-panel.c18
-rw-r--r--panels/keyboard/cc-keyboard-panel.h3
-rw-r--r--panels/keyboard/cc-keyboard-shortcut-editor.c30
-rw-r--r--panels/keyboard/cc-keyboard-shortcut-editor.h5
-rw-r--r--panels/mouse/cc-mouse-panel.c30
-rw-r--r--panels/mouse/cc-mouse-panel.h42
-rw-r--r--panels/mouse/gnome-mouse-properties.c189
-rw-r--r--panels/mouse/gnome-mouse-properties.h26
-rw-r--r--panels/mouse/gnome-mouse-test.c161
-rw-r--r--panels/mouse/gnome-mouse-test.h26
-rw-r--r--panels/network/cc-network-panel.h3
-rw-r--r--panels/network/cc-wifi-panel.h3
-rw-r--r--panels/network/connection-editor/ce-page-8021x-security.c20
-rw-r--r--panels/network/connection-editor/ce-page-8021x-security.h27
-rw-r--r--panels/network/connection-editor/ce-page-details.c42
-rw-r--r--panels/network/connection-editor/ce-page-details.h28
-rw-r--r--panels/network/connection-editor/ce-page-ethernet.c28
-rw-r--r--panels/network/connection-editor/ce-page-ethernet.h33
-rw-r--r--panels/network/connection-editor/ce-page-ip4.c48
-rw-r--r--panels/network/connection-editor/ce-page-ip4.h34
-rw-r--r--panels/network/connection-editor/ce-page-ip6.c50
-rw-r--r--panels/network/connection-editor/ce-page-ip6.h35
-rw-r--r--panels/network/connection-editor/ce-page-security.c22
-rw-r--r--panels/network/connection-editor/ce-page-security.h28
-rw-r--r--panels/network/connection-editor/ce-page-vpn.c26
-rw-r--r--panels/network/connection-editor/ce-page-vpn.h33
-rw-r--r--panels/network/connection-editor/ce-page-wifi.c31
-rw-r--r--panels/network/connection-editor/ce-page-wifi.h25
-rw-r--r--panels/network/connection-editor/ce-page.c131
-rw-r--r--panels/network/connection-editor/ce-page.h33
-rw-r--r--panels/network/connection-editor/net-connection-editor.c29
-rw-r--r--panels/network/connection-editor/net-connection-editor.h46
-rw-r--r--panels/network/net-device-ethernet.c16
-rw-r--r--panels/network/net-device-ethernet.h35
-rw-r--r--panels/network/net-device-mobile.c137
-rw-r--r--panels/network/net-device-mobile.h25
-rw-r--r--panels/network/net-device-simple.c42
-rw-r--r--panels/network/net-device-simple.h18
-rw-r--r--panels/network/net-device-wifi.c128
-rw-r--r--panels/network/net-device-wifi.h27
-rw-r--r--panels/network/net-device.c26
-rw-r--r--panels/network/net-device.h19
-rw-r--r--panels/network/net-object.c87
-rw-r--r--panels/network/net-object.h21
-rw-r--r--panels/network/net-proxy.c98
-rw-r--r--panels/network/net-proxy.h26
-rw-r--r--panels/network/net-vpn.c97
-rw-r--r--panels/network/net-vpn.h26
-rw-r--r--panels/notifications/cc-notifications-panel.h7
-rw-r--r--panels/power/cc-power-panel.c603
-rw-r--r--panels/power/cc-power-panel.h41
-rw-r--r--panels/printers/cc-printers-panel.c470
-rw-r--r--panels/printers/cc-printers-panel.h41
-rw-r--r--panels/printers/pp-cups.c5
-rw-r--r--panels/printers/pp-cups.h23
-rw-r--r--panels/printers/pp-details-dialog.h7
-rw-r--r--panels/printers/pp-host.c50
-rw-r--r--panels/printers/pp-host.h30
-rw-r--r--panels/printers/pp-ipp-option-widget.c264
-rw-r--r--panels/printers/pp-ipp-option-widget.h31
-rw-r--r--panels/printers/pp-job.c42
-rw-r--r--panels/printers/pp-job.h5
-rw-r--r--panels/printers/pp-maintenance-command.c65
-rw-r--r--panels/printers/pp-maintenance-command.h25
-rw-r--r--panels/printers/pp-new-printer-dialog.c519
-rw-r--r--panels/printers/pp-new-printer-dialog.h33
-rw-r--r--panels/printers/pp-new-printer.c225
-rw-r--r--panels/printers/pp-new-printer.h24
-rw-r--r--panels/printers/pp-ppd-option-widget.c255
-rw-r--r--panels/printers/pp-ppd-option-widget.h28
-rw-r--r--panels/printers/pp-print-device.c145
-rw-r--r--panels/printers/pp-print-device.h8
-rw-r--r--panels/printers/pp-printer-entry.c4
-rw-r--r--panels/printers/pp-printer-entry.h7
-rw-r--r--panels/printers/pp-printer.c27
-rw-r--r--panels/printers/pp-printer.h1
-rw-r--r--panels/printers/pp-samba.c67
-rw-r--r--panels/printers/pp-samba.h25
-rw-r--r--panels/privacy/cc-privacy-panel.c279
-rw-r--r--panels/privacy/cc-privacy-panel.h41
-rw-r--r--panels/region/cc-region-panel.c581
-rw-r--r--panels/region/cc-region-panel.h41
-rw-r--r--panels/search/cc-search-locations-dialog.h11
-rw-r--r--panels/search/cc-search-panel.c133
-rw-r--r--panels/search/cc-search-panel.h41
-rw-r--r--panels/sharing/cc-sharing-networks.c138
-rw-r--r--panels/sharing/cc-sharing-networks.h25
-rw-r--r--panels/sharing/cc-sharing-panel.c185
-rw-r--r--panels/sharing/cc-sharing-panel.h41
-rw-r--r--panels/sharing/cc-sharing-switch.c16
-rw-r--r--panels/sharing/cc-sharing-switch.h25
-rw-r--r--panels/sound/cc-sound-panel.c8
-rw-r--r--panels/sound/cc-sound-panel.h26
-rw-r--r--panels/sound/gvc-balance-bar.c150
-rw-r--r--panels/sound/gvc-balance-bar.h23
-rw-r--r--panels/sound/gvc-channel-bar.c405
-rw-r--r--panels/sound/gvc-channel-bar.h23
-rw-r--r--panels/sound/gvc-combo-box.c124
-rw-r--r--panels/sound/gvc-combo-box.h25
-rw-r--r--panels/sound/gvc-level-bar.c224
-rw-r--r--panels/sound/gvc-level-bar.h23
-rw-r--r--panels/sound/gvc-mixer-dialog.c499
-rw-r--r--panels/sound/gvc-mixer-dialog.h23
-rw-r--r--panels/sound/gvc-sound-theme-chooser.c82
-rw-r--r--panels/sound/gvc-sound-theme-chooser.h23
-rw-r--r--panels/sound/gvc-speaker-test.c58
-rw-r--r--panels/sound/gvc-speaker-test.h23
-rw-r--r--panels/universal-access/cc-ua-panel.c236
-rw-r--r--panels/universal-access/cc-ua-panel.h41
-rw-r--r--panels/universal-access/zoom-options.c285
-rw-r--r--panels/universal-access/zoom-options.h39
-rw-r--r--panels/user-accounts/cc-crop-area.c301
-rw-r--r--panels/user-accounts/cc-crop-area.h24
-rw-r--r--panels/user-accounts/um-account-dialog.c7
-rw-r--r--panels/user-accounts/um-account-dialog.h9
-rw-r--r--panels/user-accounts/um-carousel.h4
-rw-r--r--panels/user-accounts/um-cell-renderer-user-image.c27
-rw-r--r--panels/user-accounts/um-cell-renderer-user-image.h24
-rw-r--r--panels/user-accounts/um-realm-manager.c7
-rw-r--r--panels/user-accounts/um-realm-manager.h9
-rw-r--r--panels/user-accounts/um-user-image.c20
-rw-r--r--panels/user-accounts/um-user-image.h25
-rw-r--r--panels/user-accounts/um-user-panel.c562
-rw-r--r--panels/user-accounts/um-user-panel.h27
-rw-r--r--panels/wacom/calibrator/cc-clock-actor.c7
-rw-r--r--panels/wacom/calibrator/cc-clock-actor.h26
-rw-r--r--panels/wacom/calibrator/cc-target-actor.c30
-rw-r--r--panels/wacom/calibrator/cc-target-actor.h28
-rw-r--r--panels/wacom/cc-drawing-area.h7
-rw-r--r--panels/wacom/cc-tablet-tool-map.h1
-rw-r--r--panels/wacom/cc-wacom-button-row.c55
-rw-r--r--panels/wacom/cc-wacom-button-row.h24
-rw-r--r--panels/wacom/cc-wacom-device.h1
-rw-r--r--panels/wacom/cc-wacom-mapping-panel.c130
-rw-r--r--panels/wacom/cc-wacom-mapping-panel.h42
-rw-r--r--panels/wacom/cc-wacom-nav-button.c120
-rw-r--r--panels/wacom/cc-wacom-nav-button.h41
-rw-r--r--panels/wacom/cc-wacom-page.c265
-rw-r--r--panels/wacom/cc-wacom-page.h41
-rw-r--r--panels/wacom/cc-wacom-panel.c267
-rw-r--r--panels/wacom/cc-wacom-panel.h41
-rw-r--r--panels/wacom/cc-wacom-stylus-page.c115
-rw-r--r--panels/wacom/cc-wacom-stylus-page.h41
-rw-r--r--panels/wacom/cc-wacom-tool.h1
-rw-r--r--panels/wacom/gsd-wacom-key-shortcut-button.c140
-rw-r--r--panels/wacom/gsd-wacom-key-shortcut-button.h32
201 files changed, 6583 insertions, 9404 deletions
diff --git a/panels/background/bg-colors-source.c b/panels/background/bg-colors-source.c
index afe58683e..f46acb6d0 100644
--- a/panels/background/bg-colors-source.c
+++ b/panels/background/bg-colors-source.c
@@ -28,10 +28,12 @@
#include <glib/gi18n-lib.h>
#include <gdesktop-enums.h>
-G_DEFINE_TYPE (BgColorsSource, bg_colors_source, BG_TYPE_SOURCE)
+struct _BgColorsSource
+{
+ BgSource parent_instance;
+};
-#define COLORS_SOURCE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_COLORS_SOURCE, BgColorsSourcePrivate))
+G_DEFINE_TYPE (BgColorsSource, bg_colors_source, BG_TYPE_SOURCE)
struct {
GDesktopBackgroundShading type;
diff --git a/panels/background/bg-colors-source.h b/panels/background/bg-colors-source.h
index 032d16669..de1d93c50 100644
--- a/panels/background/bg-colors-source.h
+++ b/panels/background/bg-colors-source.h
@@ -27,42 +27,8 @@
G_BEGIN_DECLS
-#define BG_TYPE_COLORS_SOURCE bg_colors_source_get_type()
-
-#define BG_COLORS_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- BG_TYPE_COLORS_SOURCE, BgColorsSource))
-
-#define BG_COLORS_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- BG_TYPE_COLORS_SOURCE, BgColorsSourceClass))
-
-#define BG_IS_COLORS_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- BG_TYPE_COLORS_SOURCE))
-
-#define BG_IS_COLORS_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- BG_TYPE_COLORS_SOURCE))
-
-#define BG_COLORS_SOURCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- BG_TYPE_COLORS_SOURCE, BgColorsSourceClass))
-
-typedef struct _BgColorsSource BgColorsSource;
-typedef struct _BgColorsSourceClass BgColorsSourceClass;
-
-struct _BgColorsSource
-{
- BgSource parent;
-};
-
-struct _BgColorsSourceClass
-{
- BgSourceClass parent_class;
-};
-
-GType bg_colors_source_get_type (void) G_GNUC_CONST;
+#define BG_TYPE_COLORS_SOURCE (bg_colors_source_get_type ())
+G_DECLARE_FINAL_TYPE (BgColorsSource, bg_colors_source, BG, COLORS_SOURCE, BgSource)
BgColorsSource *bg_colors_source_new (GtkWindow *window);
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index a3b35f3a4..0dd2b7aeb 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -33,17 +33,14 @@
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include <gdesktop-enums.h>
-G_DEFINE_TYPE (BgPicturesSource, bg_pictures_source, BG_TYPE_SOURCE)
-
-#define PICTURES_SOURCE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_PICTURES_SOURCE, BgPicturesSourcePrivate))
-
#define ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_NAME "," \
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," \
G_FILE_ATTRIBUTE_TIME_MODIFIED
-struct _BgPicturesSourcePrivate
+struct _BgPicturesSource
{
+ BgSource parent_instance;
+
GCancellable *cancellable;
CcBackgroundGriloMiner *grl_miner;
@@ -56,6 +53,8 @@ struct _BgPicturesSourcePrivate
GHashTable *known_items;
};
+G_DEFINE_TYPE (BgPicturesSource, bg_pictures_source, BG_TYPE_SOURCE)
+
const char * const content_types[] = {
"image/png",
"image/jp2",
@@ -78,16 +77,16 @@ static void picture_opened_for_read (GObject *source_object, GAsyncResult *res,
static void
bg_pictures_source_dispose (GObject *object)
{
- BgPicturesSourcePrivate *priv = BG_PICTURES_SOURCE (object)->priv;
+ BgPicturesSource *source = BG_PICTURES_SOURCE (object);
- if (priv->cancellable)
+ if (source->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (source->cancellable);
+ g_clear_object (&source->cancellable);
}
- g_clear_object (&priv->grl_miner);
- g_clear_object (&priv->thumb_factory);
+ g_clear_object (&source->grl_miner);
+ g_clear_object (&source->thumb_factory);
G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object);
}
@@ -97,12 +96,12 @@ bg_pictures_source_finalize (GObject *object)
{
BgPicturesSource *bg_source = BG_PICTURES_SOURCE (object);
- g_clear_object (&bg_source->priv->thumb_factory);
+ g_clear_object (&bg_source->thumb_factory);
- g_clear_pointer (&bg_source->priv->known_items, g_hash_table_destroy);
+ g_clear_pointer (&bg_source->known_items, g_hash_table_destroy);
- g_clear_object (&bg_source->priv->picture_dir_monitor);
- g_clear_object (&bg_source->priv->cache_dir_monitor);
+ g_clear_object (&bg_source->picture_dir_monitor);
+ g_clear_object (&bg_source->cache_dir_monitor);
G_OBJECT_CLASS (bg_pictures_source_parent_class)->finalize (object);
}
@@ -112,8 +111,6 @@ bg_pictures_source_class_init (BgPicturesSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (BgPicturesSourcePrivate));
-
object_class->dispose = bg_pictures_source_dispose;
object_class->finalize = bg_pictures_source_finalize;
}
@@ -231,7 +228,7 @@ picture_scaled (GObject *source_object,
g_object_set_data (G_OBJECT (item), "needs-rotation", GINT_TO_POINTER (TRUE));
g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
g_file_read_async (G_FILE (file), G_PRIORITY_DEFAULT,
- bg_source->priv->cancellable,
+ bg_source->cancellable,
picture_opened_for_read, bg_source);
g_object_unref (file);
goto out;
@@ -264,7 +261,7 @@ picture_scaled (GObject *source_object,
}
}
- g_hash_table_insert (bg_source->priv->known_items,
+ g_hash_table_insert (bg_source->known_items,
bg_pictures_source_get_unique_filename (uri),
GINT_TO_POINTER (TRUE));
@@ -326,7 +323,7 @@ picture_opened_for_read (GObject *source_object,
gdk_pixbuf_new_from_stream_at_scale_async (G_INPUT_STREAM (stream),
thumbnail_width, thumbnail_height,
TRUE,
- bg_source->priv->cancellable,
+ bg_source->cancellable,
picture_scaled, bg_source);
g_object_unref (stream);
}
@@ -364,7 +361,7 @@ picture_copied_for_read (GObject *source_object,
g_object_set_data_full (G_OBJECT (native_file), "item", g_object_ref (item), g_object_unref);
g_file_read_async (native_file,
G_PRIORITY_DEFAULT,
- bg_source->priv->cancellable,
+ bg_source->cancellable,
picture_opened_for_read,
bg_source);
@@ -543,7 +540,7 @@ add_single_file (BgPicturesSource *bg_source,
{
g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
g_file_read_async (file, G_PRIORITY_DEFAULT,
- bg_source->priv->cancellable,
+ bg_source->cancellable,
picture_opened_for_read, bg_source);
}
else
@@ -576,7 +573,7 @@ add_single_file (BgPicturesSource *bg_source,
native_file,
G_FILE_COPY_ALL_METADATA,
G_PRIORITY_DEFAULT,
- bg_source->priv->cancellable,
+ bg_source->cancellable,
NULL,
NULL,
picture_copied_for_read,
@@ -689,7 +686,7 @@ bg_pictures_source_remove (BgPicturesSource *bg_source,
{
char *uuid;
uuid = bg_pictures_source_get_unique_filename (uri);
- g_hash_table_insert (bg_source->priv->known_items,
+ g_hash_table_insert (bg_source->known_items,
uuid, NULL);
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
@@ -763,15 +760,15 @@ file_info_async_ready (GObject *source,
}
static void
-dir_enum_async_ready (GObject *source,
+dir_enum_async_ready (GObject *s,
GAsyncResult *res,
gpointer user_data)
{
- BgPicturesSourcePrivate *priv;
+ BgPicturesSource *source = (BgPicturesSource *) user_data;
GFileEnumerator *enumerator;
GError *err = NULL;
- enumerator = g_file_enumerate_children_finish (G_FILE (source), res, &err);
+ enumerator = g_file_enumerate_children_finish (G_FILE (s), res, &err);
if (err)
{
@@ -781,13 +778,11 @@ dir_enum_async_ready (GObject *source,
return;
}
- priv = BG_PICTURES_SOURCE (user_data)->priv;
-
/* get the files */
g_file_enumerator_next_files_async (enumerator,
G_MAXINT,
G_PRIORITY_LOW,
- priv->cancellable,
+ source->cancellable,
file_info_async_ready,
user_data);
g_object_unref (enumerator);
@@ -846,7 +841,7 @@ bg_pictures_source_is_known (BgPicturesSource *bg_source,
char *uuid;
uuid = bg_pictures_source_get_unique_filename (uri);
- retval = (GPOINTER_TO_INT (g_hash_table_lookup (bg_source->priv->known_items, uuid)));
+ retval = (GPOINTER_TO_INT (g_hash_table_lookup (bg_source->known_items, uuid)));
g_free (uuid);
return retval;
@@ -969,12 +964,12 @@ monitor_path (BgPicturesSource *self,
g_file_enumerate_children_async (dir,
ATTRIBUTES,
G_FILE_QUERY_INFO_NONE,
- G_PRIORITY_LOW, self->priv->cancellable,
+ G_PRIORITY_LOW, self->cancellable,
dir_enum_async_ready, self);
monitor = g_file_monitor_directory (dir,
G_FILE_MONITOR_NONE,
- self->priv->cancellable,
+ self->cancellable,
NULL);
if (monitor)
@@ -1004,14 +999,11 @@ static void
bg_pictures_source_init (BgPicturesSource *self)
{
const gchar *pictures_path;
- BgPicturesSourcePrivate *priv;
char *cache_path;
GtkListStore *store;
- priv = self->priv = PICTURES_SOURCE_PRIVATE (self);
-
- priv->cancellable = g_cancellable_new ();
- priv->known_items = g_hash_table_new_full (g_str_hash,
+ self->cancellable = g_cancellable_new ();
+ self->known_items = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
NULL);
@@ -1020,17 +1012,17 @@ bg_pictures_source_init (BgPicturesSource *self)
if (pictures_path == NULL)
pictures_path = g_get_home_dir ();
- priv->picture_dir_monitor = monitor_path (self, pictures_path);
+ self->picture_dir_monitor = monitor_path (self, pictures_path);
cache_path = bg_pictures_source_get_cache_path ();
- priv->cache_dir_monitor = monitor_path (self, cache_path);
+ self->cache_dir_monitor = monitor_path (self, cache_path);
g_free (cache_path);
- priv->grl_miner = cc_background_grilo_miner_new ();
- g_signal_connect_swapped (priv->grl_miner, "media-found", G_CALLBACK (media_found_cb), self);
- cc_background_grilo_miner_start (priv->grl_miner);
+ self->grl_miner = cc_background_grilo_miner_new ();
+ g_signal_connect_swapped (self->grl_miner, "media-found", G_CALLBACK (media_found_cb), self);
+ cc_background_grilo_miner_start (self->grl_miner);
- priv->thumb_factory =
+ self->thumb_factory =
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
store = bg_source_get_liststore (BG_SOURCE (self));
diff --git a/panels/background/bg-pictures-source.h b/panels/background/bg-pictures-source.h
index e1174d799..476ecb749 100644
--- a/panels/background/bg-pictures-source.h
+++ b/panels/background/bg-pictures-source.h
@@ -29,45 +29,8 @@
G_BEGIN_DECLS
-#define BG_TYPE_PICTURES_SOURCE bg_pictures_source_get_type()
-
-#define BG_PICTURES_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- BG_TYPE_PICTURES_SOURCE, BgPicturesSource))
-
-#define BG_PICTURES_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- BG_TYPE_PICTURES_SOURCE, BgPicturesSourceClass))
-
-#define BG_IS_PICTURES_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- BG_TYPE_PICTURES_SOURCE))
-
-#define BG_IS_PICTURES_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- BG_TYPE_PICTURES_SOURCE))
-
-#define BG_PICTURES_SOURCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- BG_TYPE_PICTURES_SOURCE, BgPicturesSourceClass))
-
-typedef struct _BgPicturesSource BgPicturesSource;
-typedef struct _BgPicturesSourceClass BgPicturesSourceClass;
-typedef struct _BgPicturesSourcePrivate BgPicturesSourcePrivate;
-
-struct _BgPicturesSource
-{
- BgSource parent;
-
- BgPicturesSourcePrivate *priv;
-};
-
-struct _BgPicturesSourceClass
-{
- BgSourceClass parent_class;
-};
-
-GType bg_pictures_source_get_type (void) G_GNUC_CONST;
+#define BG_TYPE_PICTURES_SOURCE (bg_pictures_source_get_type ())
+G_DECLARE_FINAL_TYPE (BgPicturesSource, bg_pictures_source, BG, PICTURES_SOURCE, BgSource)
BgPicturesSource *bg_pictures_source_new (GtkWindow *window);
char *bg_pictures_source_get_cache_path (void);
diff --git a/panels/background/bg-source.c b/panels/background/bg-source.c
index b0127f9a8..e48daf0f2 100644
--- a/panels/background/bg-source.c
+++ b/panels/background/bg-source.c
@@ -26,18 +26,15 @@
#define THUMBNAIL_WIDTH 256
#define THUMBNAIL_HEIGHT (THUMBNAIL_WIDTH * 3 / 4)
-G_DEFINE_ABSTRACT_TYPE (BgSource, bg_source, G_TYPE_OBJECT)
-
-#define SOURCE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_SOURCE, BgSourcePrivate))
-
-struct _BgSourcePrivate
+typedef struct
{
GtkListStore *store;
GtkWidget *window;
gint thumbnail_height;
gint thumbnail_width;
-};
+} BgSourcePrivate;
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (BgSource, bg_source, G_TYPE_OBJECT)
enum
{
@@ -49,7 +46,7 @@ enum
static void
bg_source_calculate_thumbnail_dimensions (BgSource *source)
{
- BgSourcePrivate *priv = source->priv;
+ BgSourcePrivate *priv = bg_source_get_instance_private (source);
gint scale_factor;
priv->thumbnail_height = THUMBNAIL_HEIGHT;
@@ -99,7 +96,8 @@ bg_source_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- BgSourcePrivate *priv = BG_SOURCE (object)->priv;
+ BgSource *source = BG_SOURCE (object);
+ BgSourcePrivate *priv = bg_source_get_instance_private (source);
switch (property_id)
{
@@ -115,7 +113,8 @@ bg_source_set_property (GObject *object,
static void
bg_source_dispose (GObject *object)
{
- BgSourcePrivate *priv = BG_SOURCE (object)->priv;
+ BgSource *source = BG_SOURCE (object);
+ BgSourcePrivate *priv = bg_source_get_instance_private (source);
g_clear_object (&priv->store);
@@ -128,8 +127,6 @@ bg_source_class_init (BgSourceClass *klass)
GParamSpec *pspec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (BgSourcePrivate));
-
object_class->constructed = bg_source_constructed;
object_class->get_property = bg_source_get_property;
object_class->set_property = bg_source_set_property;
@@ -153,41 +150,50 @@ bg_source_class_init (BgSourceClass *klass)
static void
bg_source_init (BgSource *self)
{
- BgSourcePrivate *priv;
-
- priv = self->priv = SOURCE_PRIVATE (self);
-
+ BgSourcePrivate *priv = bg_source_get_instance_private (self);
priv->store = gtk_list_store_new (3, CAIRO_GOBJECT_TYPE_SURFACE, G_TYPE_OBJECT, G_TYPE_STRING);
}
GtkListStore*
bg_source_get_liststore (BgSource *source)
{
+ BgSourcePrivate *priv;
+
g_return_val_if_fail (BG_IS_SOURCE (source), NULL);
- return source->priv->store;
+ priv = bg_source_get_instance_private (source);
+ return priv->store;
}
gint
bg_source_get_scale_factor (BgSource *source)
{
+ BgSourcePrivate *priv;
+
g_return_val_if_fail (BG_IS_SOURCE (source), 1);
- return gtk_widget_get_scale_factor (source->priv->window);
+ priv = bg_source_get_instance_private (source);
+ return gtk_widget_get_scale_factor (priv->window);
}
gint
bg_source_get_thumbnail_height (BgSource *source)
{
+ BgSourcePrivate *priv;
+
g_return_val_if_fail (BG_IS_SOURCE (source), THUMBNAIL_HEIGHT);
- return source->priv->thumbnail_height;
+ priv = bg_source_get_instance_private (source);
+ return priv->thumbnail_height;
}
gint
bg_source_get_thumbnail_width (BgSource *source)
{
+ BgSourcePrivate *priv;
+
g_return_val_if_fail (BG_IS_SOURCE (source), THUMBNAIL_WIDTH);
- return source->priv->thumbnail_width;
+ priv = bg_source_get_instance_private (source);
+ return priv->thumbnail_width;
}
diff --git a/panels/background/bg-source.h b/panels/background/bg-source.h
index 5719247ef..c6f9b4005 100644
--- a/panels/background/bg-source.h
+++ b/panels/background/bg-source.h
@@ -25,46 +25,14 @@
G_BEGIN_DECLS
-#define BG_TYPE_SOURCE bg_source_get_type()
-
-#define BG_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- BG_TYPE_SOURCE, BgSource))
-
-#define BG_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- BG_TYPE_SOURCE, BgSourceClass))
-
-#define BG_IS_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- BG_TYPE_SOURCE))
-
-#define BG_IS_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- BG_TYPE_SOURCE))
-
-#define BG_SOURCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- BG_TYPE_SOURCE, BgSourceClass))
-
-typedef struct _BgSource BgSource;
-typedef struct _BgSourceClass BgSourceClass;
-typedef struct _BgSourcePrivate BgSourcePrivate;
-
-struct _BgSource
-{
- GObject parent;
-
- BgSourcePrivate *priv;
-};
+#define BG_TYPE_SOURCE (bg_source_get_type ())
+G_DECLARE_DERIVABLE_TYPE (BgSource, bg_source, BG, SOURCE, GObject)
struct _BgSourceClass
{
GObjectClass parent_class;
};
-GType bg_source_get_type (void) G_GNUC_CONST;
-
GtkListStore* bg_source_get_liststore (BgSource *source);
gint bg_source_get_scale_factor (BgSource *source);
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index 8ea171a4d..cfb032c72 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -19,7 +19,6 @@
*
*/
-
#include "bg-wallpapers-source.h"
#include "cc-background-item.h"
@@ -29,24 +28,20 @@
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include <gio/gio.h>
-G_DEFINE_TYPE (BgWallpapersSource, bg_wallpapers_source, BG_TYPE_SOURCE)
-
-#define WALLPAPERS_SOURCE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_WALLPAPERS_SOURCE, BgWallpapersSourcePrivate))
-
-struct _BgWallpapersSourcePrivate
+struct _BgWallpapersSource
{
+ BgSource parent_instance;
GnomeDesktopThumbnailFactory *thumb_factory;
CcBackgroundXml *xml;
};
+G_DEFINE_TYPE (BgWallpapersSource, bg_wallpapers_source, BG_TYPE_SOURCE)
static void
load_wallpapers (gchar *key,
CcBackgroundItem *item,
BgWallpapersSource *source)
{
- BgWallpapersSourcePrivate *priv = source->priv;
GtkTreeIter iter;
GdkPixbuf *pixbuf;
GtkListStore *store = bg_source_get_liststore (BG_SOURCE (source));
@@ -66,7 +61,7 @@ load_wallpapers (gchar *key,
scale_factor = bg_source_get_scale_factor (BG_SOURCE (source));
thumbnail_height = bg_source_get_thumbnail_height (BG_SOURCE (source));
thumbnail_width = bg_source_get_thumbnail_width (BG_SOURCE (source));
- pixbuf = cc_background_item_get_thumbnail (item, priv->thumb_factory,
+ pixbuf = cc_background_item_get_thumbnail (item, source->thumb_factory,
thumbnail_width, thumbnail_height,
scale_factor);
if (pixbuf == NULL)
@@ -116,7 +111,7 @@ load_default_bg (BgWallpapersSource *self)
"gnome-background-properties",
"adwaita.xml",
NULL);
- if (cc_background_xml_load_xml (self->priv->xml, filename)) {
+ if (cc_background_xml_load_xml (self->xml, filename)) {
g_free (filename);
break;
}
@@ -128,26 +123,25 @@ static void
bg_wallpapers_source_constructed (GObject *object)
{
BgWallpapersSource *self = BG_WALLPAPERS_SOURCE (object);
- BgWallpapersSourcePrivate *priv = self->priv;
G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->constructed (object);
- g_signal_connect (G_OBJECT (priv->xml), "added",
+ g_signal_connect (G_OBJECT (self->xml), "added",
G_CALLBACK (item_added), self);
/* Try adding the default background first */
load_default_bg (self);
- cc_background_xml_load_list_async (priv->xml, NULL, list_load_cb, self);
+ cc_background_xml_load_list_async (self->xml, NULL, list_load_cb, self);
}
static void
bg_wallpapers_source_dispose (GObject *object)
{
- BgWallpapersSourcePrivate *priv = BG_WALLPAPERS_SOURCE (object)->priv;
+ BgWallpapersSource *self = BG_WALLPAPERS_SOURCE (object);
- g_clear_object (&priv->thumb_factory);
- g_clear_object (&priv->xml);
+ g_clear_object (&self->thumb_factory);
+ g_clear_object (&self->xml);
G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->dispose (object);
}
@@ -155,13 +149,9 @@ bg_wallpapers_source_dispose (GObject *object)
static void
bg_wallpapers_source_init (BgWallpapersSource *self)
{
- BgWallpapersSourcePrivate *priv;
-
- priv = self->priv = WALLPAPERS_SOURCE_PRIVATE (self);
-
- priv->thumb_factory =
+ self->thumb_factory =
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
- priv->xml = cc_background_xml_new ();
+ self->xml = cc_background_xml_new ();
}
static void
@@ -169,8 +159,6 @@ bg_wallpapers_source_class_init (BgWallpapersSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (BgWallpapersSourcePrivate));
-
object_class->constructed = bg_wallpapers_source_constructed;
object_class->dispose = bg_wallpapers_source_dispose;
}
diff --git a/panels/background/bg-wallpapers-source.h b/panels/background/bg-wallpapers-source.h
index b27c6776a..129c24931 100644
--- a/panels/background/bg-wallpapers-source.h
+++ b/panels/background/bg-wallpapers-source.h
@@ -28,45 +28,8 @@
G_BEGIN_DECLS
-#define BG_TYPE_WALLPAPERS_SOURCE bg_wallpapers_source_get_type()
-
-#define BG_WALLPAPERS_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- BG_TYPE_WALLPAPERS_SOURCE, BgWallpapersSource))
-
-#define BG_WALLPAPERS_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- BG_TYPE_WALLPAPERS_SOURCE, BgWallpapersSourceClass))
-
-#define BG_IS_WALLPAPERS_SOURCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- BG_TYPE_WALLPAPERS_SOURCE))
-
-#define BG_IS_WALLPAPERS_SOURCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- BG_TYPE_WALLPAPERS_SOURCE))
-
-#define BG_WALLPAPERS_SOURCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- BG_TYPE_WALLPAPERS_SOURCE, BgWallpapersSourceClass))
-
-typedef struct _BgWallpapersSource BgWallpapersSource;
-typedef struct _BgWallpapersSourceClass BgWallpapersSourceClass;
-typedef struct _BgWallpapersSourcePrivate BgWallpapersSourcePrivate;
-
-struct _BgWallpapersSource
-{
- BgSource parent;
-
- BgWallpapersSourcePrivate *priv;
-};
-
-struct _BgWallpapersSourceClass
-{
- BgSourceClass parent_class;
-};
-
-GType bg_wallpapers_source_get_type (void) G_GNUC_CONST;
+#define BG_TYPE_WALLPAPERS_SOURCE (bg_wallpapers_source_get_type ())
+G_DECLARE_FINAL_TYPE (BgWallpapersSource, bg_wallpapers_source, BG, WALLPAPERS_SOURCE, BgSource)
BgWallpapersSource *bg_wallpapers_source_new (GtkWindow *window);
diff --git a/panels/background/cc-background-chooser-dialog.c b/panels/background/cc-background-chooser-dialog.c
index c5332896f..da4a05732 100644
--- a/panels/background/cc-background-chooser-dialog.c
+++ b/panels/background/cc-background-chooser-dialog.c
@@ -44,8 +44,10 @@ enum
SOURCE_COLORS,
};
-struct _CcBackgroundChooserDialogPrivate
+struct _CcBackgroundChooserDialog
{
+ GtkDialog parent_instance;
+
GtkListStore *sources;
GtkWidget *stack;
GtkWidget *pictures_stack;
@@ -67,7 +69,7 @@ struct _CcBackgroundChooserDialogPrivate
gulong row_modified_id;
};
-#define CC_CHOOSER_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TYPE_BACKGROUND_CHOOSER_DIALOG, CcBackgroundChooserDialogPrivate))
+G_DEFINE_TYPE (CcBackgroundChooserDialog, cc_background_chooser_dialog, GTK_TYPE_DIALOG)
enum
{
@@ -85,8 +87,6 @@ static const GtkTargetEntry color_targets[] =
{ "application/x-color", 0, COLOR }
};
-G_DEFINE_TYPE (CcBackgroundChooserDialog, cc_background_chooser_dialog, GTK_TYPE_DIALOG)
-
static void on_visible_child_notify (CcBackgroundChooserDialog *chooser);
static void
@@ -117,14 +117,13 @@ static void
cc_background_chooser_dialog_dispose (GObject *object)
{
CcBackgroundChooserDialog *chooser = CC_BACKGROUND_CHOOSER_DIALOG (object);
- CcBackgroundChooserDialogPrivate *priv = chooser->priv;
- if (priv->copy_cancellable)
+ if (chooser->copy_cancellable)
{
/* cancel any copy operation */
- g_cancellable_cancel (priv->copy_cancellable);
+ g_cancellable_cancel (chooser->copy_cancellable);
- g_clear_object (&priv->copy_cancellable);
+ g_clear_object (&chooser->copy_cancellable);
}
/* GtkStack triggers notify::visible-child during dispose and this
@@ -133,17 +132,17 @@ cc_background_chooser_dialog_dispose (GObject *object)
* on_visible_child_notify() will get called while we're in an
* inconsistent state.
*/
- if (priv->stack != NULL)
+ if (chooser->stack != NULL)
{
- g_signal_handlers_disconnect_by_func (priv->stack, on_visible_child_notify, chooser);
- priv->stack = NULL;
+ g_signal_handlers_disconnect_by_func (chooser->stack, on_visible_child_notify, chooser);
+ chooser->stack = NULL;
}
- g_clear_pointer (&chooser->priv->item_to_focus, gtk_tree_row_reference_free);
- g_clear_object (&priv->pictures_source);
- g_clear_object (&priv->colors_source);
- g_clear_object (&priv->wallpapers_source);
- g_clear_object (&priv->thumb_factory);
+ g_clear_pointer (&chooser->item_to_focus, gtk_tree_row_reference_free);
+ g_clear_object (&chooser->pictures_source);
+ g_clear_object (&chooser->colors_source);
+ g_clear_object (&chooser->wallpapers_source);
+ g_clear_object (&chooser->thumb_factory);
G_OBJECT_CLASS (cc_background_chooser_dialog_parent_class)->dispose (object);
}
@@ -151,11 +150,10 @@ cc_background_chooser_dialog_dispose (GObject *object)
static GtkWidget *
get_visible_view (CcBackgroundChooserDialog *chooser)
{
- CcBackgroundChooserDialogPrivate *priv = chooser->priv;
GtkWidget *visible;
GtkWidget *icon_view = NULL;
- visible = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
+ visible = gtk_stack_get_visible_child (GTK_STACK (chooser->stack));
if (GTK_IS_STACK (visible))
{
GtkWidget *sw;
@@ -183,11 +181,11 @@ possibly_show_empty_pictures_box (GtkTreeModel *model,
if (gtk_tree_model_get_iter_first (model, &iter))
{
- gtk_stack_set_visible_child_name (GTK_STACK (chooser->priv->pictures_stack), "view");
+ gtk_stack_set_visible_child_name (GTK_STACK (chooser->pictures_stack), "view");
}
else
{
- gtk_stack_set_visible_child_name (GTK_STACK (chooser->priv->pictures_stack), "empty");
+ gtk_stack_set_visible_child_name (GTK_STACK (chooser->pictures_stack), "empty");
}
}
@@ -197,28 +195,27 @@ on_source_modified_cb (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer user_data)
{
+ CcBackgroundChooserDialog *chooser = user_data;
GtkTreePath *to_focus_path;
GtkWidget *icon_view;
- CcBackgroundChooserDialog *chooser = user_data;
- CcBackgroundChooserDialogPrivate *priv = chooser->priv;
- if (chooser->priv->item_to_focus == NULL)
+ if (chooser->item_to_focus == NULL)
return;
- to_focus_path = gtk_tree_row_reference_get_path (chooser->priv->item_to_focus);
+ to_focus_path = gtk_tree_row_reference_get_path (chooser->item_to_focus);
if (gtk_tree_path_compare (to_focus_path, path) != 0)
goto out;
/* Change source */
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "pictures");
+ gtk_stack_set_visible_child_name (GTK_STACK (chooser->stack), "pictures");
/* And select the newly added item */
icon_view = get_visible_view (chooser);
gtk_icon_view_select_path (GTK_ICON_VIEW (icon_view), to_focus_path);
gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (icon_view),
to_focus_path, TRUE, 1.0, 1.0);
- g_clear_pointer (&chooser->priv->item_to_focus, gtk_tree_row_reference_free);
+ g_clear_pointer (&chooser->item_to_focus, gtk_tree_row_reference_free);
out:
gtk_tree_path_free (to_focus_path);
@@ -247,7 +244,7 @@ monitor_pictures_model (CcBackgroundChooserDialog *chooser)
{
GtkTreeModel *model;
- model = GTK_TREE_MODEL (bg_source_get_liststore (BG_SOURCE (chooser->priv->pictures_source)));
+ model = GTK_TREE_MODEL (bg_source_get_liststore (BG_SOURCE (chooser->pictures_source)));
g_signal_connect (model, "row-inserted", G_CALLBACK (on_source_added_cb), chooser);
g_signal_connect (model, "row-deleted", G_CALLBACK (on_source_removed_cb), chooser);
@@ -292,9 +289,9 @@ static void
add_custom_wallpaper (CcBackgroundChooserDialog *chooser,
const char *uri)
{
- g_clear_pointer (&chooser->priv->item_to_focus, gtk_tree_row_reference_free);
+ g_clear_pointer (&chooser->item_to_focus, gtk_tree_row_reference_free);
- bg_pictures_source_add (chooser->priv->pictures_source, uri, &chooser->priv->item_to_focus);
+ bg_pictures_source_add (chooser->pictures_source, uri, &chooser->item_to_focus);
/* and wait for the item to get added */
}
@@ -326,11 +323,11 @@ cc_background_panel_drag_color (CcBackgroundChooserDialog *chooser,
rgba.blue = dropped[2] / 65535.;
rgba.alpha = dropped[3] / 65535.;
- if (bg_colors_source_add (chooser->priv->colors_source, &rgba, &row_ref) == FALSE)
+ if (bg_colors_source_add (chooser->colors_source, &rgba, &row_ref) == FALSE)
return FALSE;
/* Change source */
- gtk_stack_set_visible_child_name (GTK_STACK (chooser->priv->stack), "colors");
+ gtk_stack_set_visible_child_name (GTK_STACK (chooser->stack), "colors");
/* And select the newly added item */
to_focus_path = gtk_tree_row_reference_get_path (row_ref);
@@ -368,7 +365,7 @@ cc_background_panel_drag_items (GtkWidget *widget,
for (i = 0; uris[i] != NULL; i++)
{
uri = uris[i];
- if (!bg_pictures_source_is_known (chooser->priv->pictures_source, uri))
+ if (!bg_pictures_source_is_known (chooser->pictures_source, uri))
{
add_custom_wallpaper (chooser, uri);
ret = TRUE;
@@ -418,37 +415,35 @@ static void
cc_background_chooser_dialog_constructed (GObject *object)
{
CcBackgroundChooserDialog *chooser = CC_BACKGROUND_CHOOSER_DIALOG (object);
- CcBackgroundChooserDialogPrivate *priv = chooser->priv;
GtkListStore *model;
GtkWidget *sw;
GtkWidget *vbox;
G_OBJECT_CLASS (cc_background_chooser_dialog_parent_class)->constructed (object);
- model = bg_source_get_liststore (BG_SOURCE (priv->wallpapers_source));
+ model = bg_source_get_liststore (BG_SOURCE (chooser->wallpapers_source));
sw = create_view (chooser, GTK_TREE_MODEL (model));
- gtk_stack_add_titled (GTK_STACK (priv->stack), sw, "wallpapers", _("Wallpapers"));
- gtk_container_child_set (GTK_CONTAINER (priv->stack), sw, "position", 0, NULL);
+ gtk_stack_add_titled (GTK_STACK (chooser->stack), sw, "wallpapers", _("Wallpapers"));
+ gtk_container_child_set (GTK_CONTAINER (chooser->stack), sw, "position", 0, NULL);
- model = bg_source_get_liststore (BG_SOURCE (priv->pictures_source));
+ model = bg_source_get_liststore (BG_SOURCE (chooser->pictures_source));
sw = create_view (chooser, GTK_TREE_MODEL (model));
- gtk_stack_add_named (GTK_STACK (priv->pictures_stack), sw, "view");
+ gtk_stack_add_named (GTK_STACK (chooser->pictures_stack), sw, "view");
- model = bg_source_get_liststore (BG_SOURCE (priv->colors_source));
+ model = bg_source_get_liststore (BG_SOURCE (chooser->colors_source));
sw = create_view (chooser, GTK_TREE_MODEL (model));
- gtk_stack_add_titled (GTK_STACK (priv->stack), sw, "colors", _("Colors"));
+ gtk_stack_add_titled (GTK_STACK (chooser->stack), sw, "colors", _("Colors"));
vbox = gtk_dialog_get_content_area (GTK_DIALOG (chooser));
gtk_widget_show_all (vbox);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "wallpapers");
+ gtk_stack_set_visible_child_name (GTK_STACK (chooser->stack), "wallpapers");
monitor_pictures_model (chooser);
}
static void
cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
{
- CcBackgroundChooserDialogPrivate *priv;
GtkWidget *empty_pictures_box;
GtkWidget *vbox;
GtkWidget *headerbar;
@@ -463,12 +458,9 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
gchar *pictures_dir_uri;
GtkTargetList *target_list;
- chooser->priv = CC_CHOOSER_DIALOG_GET_PRIVATE (chooser);
- priv = chooser->priv;
-
- priv->wallpapers_source = bg_wallpapers_source_new (GTK_WINDOW (chooser));
- priv->pictures_source = bg_pictures_source_new (GTK_WINDOW (chooser));
- priv->colors_source = bg_colors_source_new (GTK_WINDOW (chooser));
+ chooser->wallpapers_source = bg_wallpapers_source_new (GTK_WINDOW (chooser));
+ chooser->pictures_source = bg_pictures_source_new (GTK_WINDOW (chooser));
+ chooser->colors_source = bg_colors_source_new (GTK_WINDOW (chooser));
gtk_window_set_modal (GTK_WINDOW (chooser), TRUE);
gtk_window_set_resizable (GTK_WINDOW (chooser), FALSE);
@@ -478,30 +470,30 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
vbox = gtk_dialog_get_content_area (GTK_DIALOG (chooser));
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
- priv->stack = gtk_stack_new ();
- gtk_stack_set_homogeneous (GTK_STACK (priv->stack), TRUE);
- gtk_container_add (GTK_CONTAINER (vbox), priv->stack);
- g_signal_connect_swapped (priv->stack, "notify::visible-child", G_CALLBACK (on_visible_child_notify), chooser);
+ chooser->stack = gtk_stack_new ();
+ gtk_stack_set_homogeneous (GTK_STACK (chooser->stack), TRUE);
+ gtk_container_add (GTK_CONTAINER (vbox), chooser->stack);
+ g_signal_connect_swapped (chooser->stack, "notify::visible-child", G_CALLBACK (on_visible_child_notify), chooser);
/* Add drag and drop support for bg images */
- gtk_drag_dest_set (priv->stack, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
+ gtk_drag_dest_set (chooser->stack, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_uri_targets (target_list, URI_LIST);
gtk_target_list_add_table (target_list, color_targets, 1);
- gtk_drag_dest_set_target_list (priv->stack, target_list);
+ gtk_drag_dest_set_target_list (chooser->stack, target_list);
gtk_target_list_unref (target_list);
- g_signal_connect (priv->stack, "drag-data-received", G_CALLBACK (cc_background_panel_drag_items), chooser);
+ g_signal_connect (chooser->stack, "drag-data-received", G_CALLBACK (cc_background_panel_drag_items), chooser);
headerbar = gtk_dialog_get_header_bar (GTK_DIALOG (chooser));
switcher = gtk_stack_switcher_new ();
- gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (priv->stack));
+ gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (chooser->stack));
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (headerbar), switcher);
gtk_widget_show (switcher);
- priv->pictures_stack = gtk_stack_new ();
- gtk_stack_set_homogeneous (GTK_STACK (priv->pictures_stack), TRUE);
- gtk_stack_add_titled (GTK_STACK (priv->stack), priv->pictures_stack, "pictures", _("Pictures"));
+ chooser->pictures_stack = gtk_stack_new ();
+ gtk_stack_set_homogeneous (GTK_STACK (chooser->pictures_stack), TRUE);
+ gtk_stack_add_titled (GTK_STACK (chooser->stack), chooser->pictures_stack, "pictures", _("Pictures"));
empty_pictures_box = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (empty_pictures_box), 12);
@@ -509,7 +501,7 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
GTK_ORIENTATION_HORIZONTAL);
context = gtk_widget_get_style_context (empty_pictures_box);
gtk_style_context_add_class (context, "dim-label");
- gtk_stack_add_named (GTK_STACK (priv->pictures_stack), empty_pictures_box, "empty");
+ gtk_stack_add_named (GTK_STACK (chooser->pictures_stack), empty_pictures_box, "empty");
img = gtk_image_new_from_icon_name ("emblem-photos-symbolic", GTK_ICON_SIZE_DIALOG);
gtk_image_set_pixel_size (GTK_IMAGE (img), 64);
gtk_widget_set_halign (img, GTK_ALIGN_END);
@@ -588,8 +580,6 @@ cc_background_chooser_dialog_class_init (CcBackgroundChooserDialogClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->realize = cc_background_chooser_dialog_realize;
-
- g_type_class_add_private (object_class, sizeof (CcBackgroundChooserDialogPrivate));
}
GtkWidget *
diff --git a/panels/background/cc-background-chooser-dialog.h b/panels/background/cc-background-chooser-dialog.h
index 70cd91aac..82f789d4f 100644
--- a/panels/background/cc-background-chooser-dialog.h
+++ b/panels/background/cc-background-chooser-dialog.h
@@ -26,29 +26,9 @@
G_BEGIN_DECLS
-#define CC_TYPE_BACKGROUND_CHOOSER_DIALOG (cc_background_chooser_dialog_get_type ())
-#define CC_BACKGROUND_CHOOSER_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), CC_TYPE_BACKGROUND_CHOOSER_DIALOG, CcBackgroundChooserDialog))
-#define CC_BACKGROUND_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_BACKGROUND_CHOOSER_DIALOG, CcBackgroundChooserDialogClass))
-#define CC_IS_BACKGROUND_CHOOSER_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), CC_TYPE_BACKGROUND_CHOOSER_DIALOG))
-#define CC_IS_BACKGROUND_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_BACKGROUND_CHOOSER_DIALOG))
-#define CC_BACKGROUND_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_BACKGROUND_CHOOSER_DIALOG, CcBackgroundChooserDialogClass))
-
-typedef struct _CcBackgroundChooserDialog CcBackgroundChooserDialog;
-typedef struct _CcBackgroundChooserDialogClass CcBackgroundChooserDialogClass;
-typedef struct _CcBackgroundChooserDialogPrivate CcBackgroundChooserDialogPrivate;
-
-struct _CcBackgroundChooserDialog
-{
- GtkDialog parent_instance;
- CcBackgroundChooserDialogPrivate *priv;
-};
-
-struct _CcBackgroundChooserDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-GType cc_background_chooser_dialog_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_BACKGROUND_CHOOSER_DIALOG (cc_background_chooser_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (CcBackgroundChooserDialog, cc_background_chooser_dialog, CC, BACKGROUND_CHOOSER_DIALOG, GtkDialog)
+
GtkWidget * cc_background_chooser_dialog_new (GtkWindow *transient_for);
CcBackgroundItem * cc_background_chooser_dialog_get_item (CcBackgroundChooserDialog *chooser);
diff --git a/panels/background/cc-background-grilo-miner.c b/panels/background/cc-background-grilo-miner.c
index 4b6d7cbaf..34995626b 100644
--- a/panels/background/cc-background-grilo-miner.c
+++ b/panels/background/cc-background-grilo-miner.c
@@ -28,15 +28,13 @@
struct _CcBackgroundGriloMiner
{
- GObject parent;
+ GObject parent_instance;
+
GCancellable *cancellable;
GList *accounts;
};
-struct _CcBackgroundGriloMinerClass
-{
- GObjectClass parent_class;
-};
+G_DEFINE_TYPE (CcBackgroundGriloMiner, cc_background_grilo_miner, G_TYPE_OBJECT)
enum
{
@@ -46,8 +44,6 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (CcBackgroundGriloMiner, cc_background_grilo_miner, G_TYPE_OBJECT)
-
#define REMOTE_ITEM_COUNT 50
static gchar *
diff --git a/panels/background/cc-background-grilo-miner.h b/panels/background/cc-background-grilo-miner.h
index 97d03756c..647d307cf 100644
--- a/panels/background/cc-background-grilo-miner.h
+++ b/panels/background/cc-background-grilo-miner.h
@@ -23,32 +23,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_BACKGROUND_GRILO_MINER cc_background_grilo_miner_get_type()
-
-#define CC_BACKGROUND_GRILO_MINER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_BACKGROUND_GRILO_MINER, CcBackgroundGriloMiner))
-
-#define CC_BACKGROUND_GRILO_MINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_BACKGROUND_GRILO_MINER, CcBackgroundGriloMinerClass))
-
-#define CC_IS_BACKGROUND_GRILO_MINER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_BACKGROUND_GRILO_MINER))
-
-#define CC_IS_BACKGROUND_GRILO_MINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_BACKGROUND_GRILO_MINER))
-
-#define CC_BACKGROUND_GRILO_MINER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_BACKGROUND_GRILO_MINER, CcBackgroundGriloMinerClass))
-
-typedef struct _CcBackgroundGriloMiner CcBackgroundGriloMiner;
-typedef struct _CcBackgroundGriloMinerClass CcBackgroundGriloMinerClass;
-
-GType cc_background_grilo_miner_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_BACKGROUND_GRILO_MINER (cc_background_grilo_miner_get_type ())
+G_DECLARE_FINAL_TYPE (CcBackgroundGriloMiner, cc_background_grilo_miner, CC, BACKGROUND_GRILO_MINER, GObject);
CcBackgroundGriloMiner *cc_background_grilo_miner_new (void);
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index 92220f823..8d9698ab4 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -32,10 +32,10 @@
#include "cc-background-item.h"
#include "gdesktop-enums-types.h"
-#define CC_BACKGROUND_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_ITEM, CcBackgroundItemPrivate))
-
-struct CcBackgroundItemPrivate
+struct _CcBackgroundItem
{
+ GObject parent_instance;
+
/* properties */
char *name;
char *uri;
@@ -99,7 +99,7 @@ get_emblemed_pixbuf (CcBackgroundItem *item, GdkPixbuf *pixbuf, gint scale_facto
retval = g_object_ref (pixbuf);
- if (item->priv->slideshow_emblem == NULL) {
+ if (item->slideshow_emblem == NULL) {
if (slideshow_emblem == NULL) {
GError *error = NULL;
GtkIconTheme *theme;
@@ -126,9 +126,9 @@ get_emblemed_pixbuf (CcBackgroundItem *item, GdkPixbuf *pixbuf, gint scale_facto
}
g_object_add_weak_pointer (G_OBJECT (slideshow_emblem), (gpointer *) (&slideshow_emblem));
- item->priv->slideshow_emblem = slideshow_emblem;
+ item->slideshow_emblem = slideshow_emblem;
} else {
- item->priv->slideshow_emblem = g_object_ref (slideshow_emblem);
+ item->slideshow_emblem = g_object_ref (slideshow_emblem);
}
}
@@ -153,27 +153,27 @@ set_bg_properties (CcBackgroundItem *item)
GdkColor pcolor = { 0, 0, 0, 0 };
GdkColor scolor = { 0, 0, 0, 0 };
- if (item->priv->uri) {
+ if (item->uri) {
GFile *file;
char *filename;
- file = g_file_new_for_commandline_arg (item->priv->uri);
+ file = g_file_new_for_commandline_arg (item->uri);
filename = g_file_get_path (file);
g_object_unref (file);
- gnome_bg_set_filename (item->priv->bg, filename);
+ gnome_bg_set_filename (item->bg, filename);
g_free (filename);
}
- if (item->priv->primary_color != NULL) {
- gdk_color_parse (item->priv->primary_color, &pcolor);
+ if (item->primary_color != NULL) {
+ gdk_color_parse (item->primary_color, &pcolor);
}
- if (item->priv->secondary_color != NULL) {
- gdk_color_parse (item->priv->secondary_color, &scolor);
+ if (item->secondary_color != NULL) {
+ gdk_color_parse (item->secondary_color, &scolor);
}
- gnome_bg_set_color (item->priv->bg, item->priv->shading, &pcolor, &scolor);
- gnome_bg_set_placement (item->priv->bg, item->priv->placement);
+ gnome_bg_set_color (item->bg, item->shading, &pcolor, &scolor);
+ gnome_bg_set_placement (item->bg, item->placement);
}
@@ -185,8 +185,8 @@ cc_background_item_changes_with_time (CcBackgroundItem *item)
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), FALSE);
changes = FALSE;
- if (item->priv->bg != NULL) {
- changes = gnome_bg_changes_with_time (item->priv->bg);
+ if (item->bg != NULL) {
+ changes = gnome_bg_changes_with_time (item->bg);
}
return changes;
}
@@ -194,19 +194,19 @@ cc_background_item_changes_with_time (CcBackgroundItem *item)
static void
update_size (CcBackgroundItem *item)
{
- g_clear_pointer (&item->priv->size, g_free);
+ g_clear_pointer (&item->size, g_free);
- if (item->priv->uri == NULL) {
- item->priv->size = g_strdup ("");
+ if (item->uri == NULL) {
+ item->size = g_strdup ("");
} else {
- if (gnome_bg_has_multiple_sizes (item->priv->bg) || gnome_bg_changes_with_time (item->priv->bg)) {
- item->priv->size = g_strdup (_("multiple sizes"));
+ if (gnome_bg_has_multiple_sizes (item->bg) || gnome_bg_changes_with_time (item->bg)) {
+ item->size = g_strdup (_("multiple sizes"));
} else {
/* translators: 100 × 100px
* Note that this is not an "x", but U+00D7 MULTIPLICATION SIGN */
- item->priv->size = g_strdup_printf (_("%d × %d"),
- item->priv->width,
- item->priv->height);
+ item->size = g_strdup_printf (_("%d × %d"),
+ item->width,
+ item->height);
}
}
}
@@ -249,17 +249,17 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem *item,
* the slideshow frame though, so we can't do much better than this
* for now.
*/
- pixbuf = render_at_size (item->priv->bg, width, height);
+ pixbuf = render_at_size (item->bg, width, height);
} else {
if (frame >= 0) {
- pixbuf = gnome_bg_create_frame_thumbnail (item->priv->bg,
+ pixbuf = gnome_bg_create_frame_thumbnail (item->bg,
thumbs,
gdk_screen_get_default (),
width,
height,
frame);
} else {
- pixbuf = gnome_bg_create_thumbnail (item->priv->bg,
+ pixbuf = gnome_bg_create_thumbnail (item->bg,
thumbs,
gdk_screen_get_default (),
width,
@@ -269,19 +269,19 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem *item,
if (pixbuf != NULL
&& frame != -2
- && gnome_bg_changes_with_time (item->priv->bg)) {
+ && gnome_bg_changes_with_time (item->bg)) {
retval = get_emblemed_pixbuf (item, pixbuf, scale_factor);
g_object_unref (pixbuf);
} else {
retval = pixbuf;
}
- gnome_bg_get_image_size (item->priv->bg,
+ gnome_bg_get_image_size (item->bg,
thumbs,
width,
height,
- &item->priv->width,
- &item->priv->height);
+ &item->width,
+ &item->height);
update_size (item);
@@ -307,7 +307,7 @@ update_info (CcBackgroundItem *item,
GFileInfo *info;
if (_info == NULL) {
- file = g_file_new_for_uri (item->priv->uri);
+ file = g_file_new_for_uri (item->uri);
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
@@ -323,22 +323,22 @@ update_info (CcBackgroundItem *item,
info = g_object_ref (_info);
}
- g_clear_pointer (&item->priv->mime_type, g_free);
+ g_clear_pointer (&item->mime_type, g_free);
if (info == NULL
|| g_file_info_get_content_type (info) == NULL) {
- if (item->priv->uri == NULL) {
- item->priv->mime_type = g_strdup ("image/x-no-data");
- g_free (item->priv->name);
- item->priv->name = g_strdup (_("No Desktop Background"));
+ if (item->uri == NULL) {
+ item->mime_type = g_strdup ("image/x-no-data");
+ g_free (item->name);
+ item->name = g_strdup (_("No Desktop Background"));
}
} else {
- if (item->priv->name == NULL)
- item->priv->name = g_strdup (g_file_info_get_display_name (info));
+ if (item->name == NULL)
+ item->name = g_strdup (g_file_info_get_display_name (info));
- item->priv->mime_type = g_strdup (g_file_info_get_content_type (info));
- if (item->priv->modified == 0)
- item->priv->modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ item->mime_type = g_strdup (g_file_info_get_content_type (info));
+ if (item->modified == 0)
+ item->modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
}
if (info != NULL)
@@ -351,28 +351,28 @@ cc_background_item_load (CcBackgroundItem *item,
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), FALSE);
- if (item->priv->uri == NULL)
+ if (item->uri == NULL)
return TRUE;
update_info (item, info);
- if (item->priv->mime_type != NULL
- && (g_str_has_prefix (item->priv->mime_type, "image/")
- || strcmp (item->priv->mime_type, "application/xml") == 0)) {
+ if (item->mime_type != NULL
+ && (g_str_has_prefix (item->mime_type, "image/")
+ || strcmp (item->mime_type, "application/xml") == 0)) {
set_bg_properties (item);
} else {
return FALSE;
}
/* FIXME we should handle XML files as well */
- if (item->priv->mime_type != NULL &&
- g_str_has_prefix (item->priv->mime_type, "image/")) {
+ if (item->mime_type != NULL &&
+ g_str_has_prefix (item->mime_type, "image/")) {
char *filename;
- filename = g_filename_from_uri (item->priv->uri, NULL, NULL);
+ filename = g_filename_from_uri (item->uri, NULL, NULL);
gdk_pixbuf_get_file_info (filename,
- &item->priv->width,
- &item->priv->height);
+ &item->width,
+ &item->height);
g_free (filename);
update_size (item);
}
@@ -384,8 +384,8 @@ static void
_set_name (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->name);
- item->priv->name = g_strdup (value);
+ g_free (item->name);
+ item->name = g_strdup (value);
}
const char *
@@ -393,20 +393,20 @@ cc_background_item_get_name (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->name;
+ return item->name;
}
static void
_set_uri (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->uri);
+ g_free (item->uri);
if (value && *value == '\0') {
- item->priv->uri = NULL;
+ item->uri = NULL;
} else {
if (value && strstr (value, "://") == NULL)
g_warning ("URI '%s' is invalid", value);
- item->priv->uri = g_strdup (value);
+ item->uri = g_strdup (value);
}
}
@@ -415,29 +415,29 @@ cc_background_item_get_uri (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->uri;
+ return item->uri;
}
static void
_set_placement (CcBackgroundItem *item,
GDesktopBackgroundStyle value)
{
- item->priv->placement = value;
+ item->placement = value;
}
static void
_set_shading (CcBackgroundItem *item,
GDesktopBackgroundShading value)
{
- item->priv->shading = value;
+ item->shading = value;
}
static void
_set_primary_color (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->primary_color);
- item->priv->primary_color = g_strdup (value);
+ g_free (item->primary_color);
+ item->primary_color = g_strdup (value);
}
const char *
@@ -445,15 +445,15 @@ cc_background_item_get_pcolor (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->primary_color;
+ return item->primary_color;
}
static void
_set_secondary_color (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->secondary_color);
- item->priv->secondary_color = g_strdup (value);
+ g_free (item->secondary_color);
+ item->secondary_color = g_strdup (value);
}
const char *
@@ -461,7 +461,7 @@ cc_background_item_get_scolor (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->secondary_color;
+ return item->secondary_color;
}
GDesktopBackgroundStyle
@@ -469,7 +469,7 @@ cc_background_item_get_placement (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), G_DESKTOP_BACKGROUND_STYLE_SCALED);
- return item->priv->placement;
+ return item->placement;
}
GDesktopBackgroundShading
@@ -477,22 +477,22 @@ cc_background_item_get_shading (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), G_DESKTOP_BACKGROUND_SHADING_SOLID);
- return item->priv->shading;
+ return item->shading;
}
static void
_set_is_deleted (CcBackgroundItem *item,
gboolean value)
{
- item->priv->is_deleted = value;
+ item->is_deleted = value;
}
static void
_set_source_url (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->source_url);
- item->priv->source_url = g_strdup (value);
+ g_free (item->source_url);
+ item->source_url = g_strdup (value);
}
const char *
@@ -500,15 +500,15 @@ cc_background_item_get_source_url (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->source_url;
+ return item->source_url;
}
static void
_set_source_xml (CcBackgroundItem *item,
const char *value)
{
- g_free (item->priv->source_xml);
- item->priv->source_xml = g_strdup (value);
+ g_free (item->source_xml);
+ item->source_xml = g_strdup (value);
}
const char *
@@ -516,14 +516,14 @@ cc_background_item_get_source_xml (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->source_xml;
+ return item->source_xml;
}
static void
_set_flags (CcBackgroundItem *item,
CcBackgroundItemFlags value)
{
- item->priv->flags = value;
+ item->flags = value;
}
CcBackgroundItemFlags
@@ -531,7 +531,7 @@ cc_background_item_get_flags (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), 0);
- return item->priv->flags;
+ return item->flags;
}
const char *
@@ -539,14 +539,14 @@ cc_background_item_get_size (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
- return item->priv->size;
+ return item->size;
}
static void
_set_needs_download (CcBackgroundItem *item,
gboolean value)
{
- item->priv->needs_download = value;
+ item->needs_download = value;
}
gboolean
@@ -554,14 +554,14 @@ cc_background_item_get_needs_download (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), 0);
- return item->priv->needs_download;
+ return item->needs_download;
}
static void
_set_modified (CcBackgroundItem *item,
guint64 value)
{
- item->priv->modified = value;
+ item->modified = value;
}
guint64
@@ -569,7 +569,7 @@ cc_background_item_get_modified (CcBackgroundItem *item)
{
g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), 0);
- return item->priv->modified;
+ return item->modified;
}
static void
@@ -637,43 +637,43 @@ cc_background_item_get_property (GObject *object,
switch (prop_id) {
case PROP_NAME:
- g_value_set_string (value, self->priv->name);
+ g_value_set_string (value, self->name);
break;
case PROP_URI:
- g_value_set_string (value, self->priv->uri);
+ g_value_set_string (value, self->uri);
break;
case PROP_PLACEMENT:
- g_value_set_enum (value, self->priv->placement);
+ g_value_set_enum (value, self->placement);
break;
case PROP_SHADING:
- g_value_set_enum (value, self->priv->shading);
+ g_value_set_enum (value, self->shading);
break;
case PROP_PRIMARY_COLOR:
- g_value_set_string (value, self->priv->primary_color);
+ g_value_set_string (value, self->primary_color);
break;
case PROP_SECONDARY_COLOR:
- g_value_set_string (value, self->priv->secondary_color);
+ g_value_set_string (value, self->secondary_color);
break;
case PROP_IS_DELETED:
- g_value_set_boolean (value, self->priv->is_deleted);
+ g_value_set_boolean (value, self->is_deleted);
break;
case PROP_SOURCE_URL:
- g_value_set_string (value, self->priv->source_url);
+ g_value_set_string (value, self->source_url);
break;
case PROP_SOURCE_XML:
- g_value_set_string (value, self->priv->source_xml);
+ g_value_set_string (value, self->source_xml);
break;
case PROP_FLAGS:
- g_value_set_flags (value, self->priv->flags);
+ g_value_set_flags (value, self->flags);
break;
case PROP_SIZE:
- g_value_set_string (value, self->priv->size);
+ g_value_set_string (value, self->size);
break;
case PROP_NEEDS_DOWNLOAD:
- g_value_set_boolean (value, self->priv->needs_download);
+ g_value_set_boolean (value, self->needs_download);
break;
case PROP_MODIFIED:
- g_value_set_uint64 (value, self->priv->modified);
+ g_value_set_uint64 (value, self->modified);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -809,25 +809,20 @@ cc_background_item_class_init (CcBackgroundItemClass *klass)
G_MAXUINT64,
0,
G_PARAM_READWRITE));
-
-
- g_type_class_add_private (klass, sizeof (CcBackgroundItemPrivate));
}
static void
cc_background_item_init (CcBackgroundItem *item)
{
- item->priv = CC_BACKGROUND_ITEM_GET_PRIVATE (item);
-
- item->priv->bg = gnome_bg_new ();
-
- item->priv->shading = G_DESKTOP_BACKGROUND_SHADING_SOLID;
- item->priv->placement = G_DESKTOP_BACKGROUND_STYLE_SCALED;
- item->priv->primary_color = g_strdup ("#000000000000");
- item->priv->secondary_color = g_strdup ("#000000000000");
- item->priv->needs_download = TRUE;
- item->priv->flags = 0;
- item->priv->modified = 0;
+ item->bg = gnome_bg_new ();
+
+ item->shading = G_DESKTOP_BACKGROUND_SHADING_SOLID;
+ item->placement = G_DESKTOP_BACKGROUND_STYLE_SCALED;
+ item->primary_color = g_strdup ("#000000000000");
+ item->secondary_color = g_strdup ("#000000000000");
+ item->needs_download = TRUE;
+ item->flags = 0;
+ item->modified = 0;
}
static void
@@ -840,21 +835,21 @@ cc_background_item_finalize (GObject *object)
item = CC_BACKGROUND_ITEM (object);
- g_return_if_fail (item->priv != NULL);
+ g_return_if_fail (item != NULL);
- g_free (item->priv->name);
- g_free (item->priv->uri);
- g_free (item->priv->primary_color);
- g_free (item->priv->secondary_color);
- g_free (item->priv->mime_type);
- g_free (item->priv->size);
- g_free (item->priv->source_url);
- g_free (item->priv->source_xml);
+ g_free (item->name);
+ g_free (item->uri);
+ g_free (item->primary_color);
+ g_free (item->secondary_color);
+ g_free (item->mime_type);
+ g_free (item->size);
+ g_free (item->source_url);
+ g_free (item->source_xml);
- if (item->priv->bg != NULL)
- g_object_unref (item->priv->bg);
+ if (item->bg != NULL)
+ g_object_unref (item->bg);
- g_clear_object (&item->priv->slideshow_emblem);
+ g_clear_object (&item->slideshow_emblem);
G_OBJECT_CLASS (cc_background_item_parent_class)->finalize (object);
}
@@ -876,18 +871,18 @@ cc_background_item_copy (CcBackgroundItem *item)
{
CcBackgroundItem *ret;
- ret = cc_background_item_new (item->priv->uri);
- ret->priv->name = g_strdup (item->priv->name);
- ret->priv->size = g_strdup (item->priv->size);
- ret->priv->placement = item->priv->placement;
- ret->priv->shading = item->priv->shading;
- ret->priv->primary_color = g_strdup (item->priv->primary_color);
- ret->priv->secondary_color = g_strdup (item->priv->secondary_color);
- ret->priv->source_url = g_strdup (item->priv->source_url);
- ret->priv->source_xml = g_strdup (item->priv->source_xml);
- ret->priv->is_deleted = item->priv->is_deleted;
- ret->priv->needs_download = item->priv->needs_download;
- ret->priv->flags = item->priv->flags;
+ ret = cc_background_item_new (item->uri);
+ ret->name = g_strdup (item->name);
+ ret->size = g_strdup (item->size);
+ ret->placement = item->placement;
+ ret->shading = item->shading;
+ ret->primary_color = g_strdup (item->primary_color);
+ ret->secondary_color = g_strdup (item->secondary_color);
+ ret->source_url = g_strdup (item->source_url);
+ ret->source_xml = g_strdup (item->source_xml);
+ ret->is_deleted = item->is_deleted;
+ ret->needs_download = item->needs_download;
+ ret->flags = item->flags;
return ret;
}
@@ -924,21 +919,18 @@ enum_to_str (GType type,
void
cc_background_item_dump (CcBackgroundItem *item)
{
- CcBackgroundItemPrivate *priv;
GString *flags;
int i;
g_return_if_fail (CC_IS_BACKGROUND_ITEM (item));
- priv = item->priv;
-
- g_debug ("name:\t\t\t%s", priv->name);
- g_debug ("URI:\t\t\t%s", priv->uri ? priv->uri : "NULL");
- if (priv->size)
- g_debug ("size:\t\t\t'%s'", priv->size);
+ g_debug ("name:\t\t\t%s", item->name);
+ g_debug ("URI:\t\t\t%s", item->uri ? item->uri : "NULL");
+ if (item->size)
+ g_debug ("size:\t\t\t'%s'", item->size);
flags = g_string_new (NULL);
for (i = 0; i < 5; i++) {
- if (priv->flags & (1 << i)) {
+ if (item->flags & (1 << i)) {
g_string_append (flags, flags_to_str (1 << i));
g_string_append_c (flags, ' ');
}
@@ -947,21 +939,21 @@ cc_background_item_dump (CcBackgroundItem *item)
g_string_append (flags, "-none-");
g_debug ("flags:\t\t\t%s", flags->str);
g_string_free (flags, TRUE);
- if (priv->primary_color)
- g_debug ("pcolor:\t\t\t%s", priv->primary_color);
- if (priv->secondary_color)
- g_debug ("scolor:\t\t\t%s", priv->secondary_color);
- g_debug ("placement:\t\t%s", enum_to_str (G_DESKTOP_TYPE_DESKTOP_BACKGROUND_STYLE, priv->placement));
- g_debug ("shading:\t\t%s", enum_to_str (G_DESKTOP_TYPE_DESKTOP_BACKGROUND_SHADING, priv->shading));
- if (priv->source_url)
- g_debug ("source URL:\t\t%s", priv->source_url);
- if (priv->source_xml)
- g_debug ("source XML:\t\t%s", priv->source_xml);
- g_debug ("deleted:\t\t%s", priv->is_deleted ? "yes" : "no");
- if (priv->mime_type)
- g_debug ("mime-type:\t\t%s", priv->mime_type);
- g_debug ("dimensions:\t\t%d x %d", priv->width, priv->height);
- g_debug ("modified: %"G_GUINT64_FORMAT, priv->modified);
+ if (item->primary_color)
+ g_debug ("pcolor:\t\t\t%s", item->primary_color);
+ if (item->secondary_color)
+ g_debug ("scolor:\t\t\t%s", item->secondary_color);
+ g_debug ("placement:\t\t%s", enum_to_str (G_DESKTOP_TYPE_DESKTOP_BACKGROUND_STYLE, item->placement));
+ g_debug ("shading:\t\t%s", enum_to_str (G_DESKTOP_TYPE_DESKTOP_BACKGROUND_SHADING, item->shading));
+ if (item->source_url)
+ g_debug ("source URL:\t\t%s", item->source_url);
+ if (item->source_xml)
+ g_debug ("source XML:\t\t%s", item->source_xml);
+ g_debug ("deleted:\t\t%s", item->is_deleted ? "yes" : "no");
+ if (item->mime_type)
+ g_debug ("mime-type:\t\t%s", item->mime_type);
+ g_debug ("dimensions:\t\t%d x %d", item->width, item->height);
+ g_debug ("modified: %"G_GUINT64_FORMAT, item->modified);
g_debug (" ");
}
@@ -1010,31 +1002,31 @@ cc_background_item_compare (CcBackgroundItem *saved,
{
CcBackgroundItemFlags flags;
- flags = saved->priv->flags;
+ flags = saved->flags;
if (flags == 0)
return FALSE;
if (flags & CC_BACKGROUND_ITEM_HAS_URI) {
- if (files_equal (saved->priv->uri, configured->priv->uri) == FALSE)
+ if (files_equal (saved->uri, configured->uri) == FALSE)
return FALSE;
}
if (flags & CC_BACKGROUND_ITEM_HAS_SHADING) {
- if (saved->priv->shading != configured->priv->shading)
+ if (saved->shading != configured->shading)
return FALSE;
}
if (flags & CC_BACKGROUND_ITEM_HAS_PLACEMENT) {
- if (saved->priv->placement != configured->priv->placement)
+ if (saved->placement != configured->placement)
return FALSE;
}
if (flags & CC_BACKGROUND_ITEM_HAS_PCOLOR) {
- if (colors_equal (saved->priv->primary_color,
- configured->priv->primary_color) == FALSE) {
+ if (colors_equal (saved->primary_color,
+ configured->primary_color) == FALSE) {
return FALSE;
}
}
if (flags & CC_BACKGROUND_ITEM_HAS_SCOLOR) {
- if (colors_equal (saved->priv->secondary_color,
- configured->priv->secondary_color) == FALSE) {
+ if (colors_equal (saved->secondary_color,
+ configured->secondary_color) == FALSE) {
return FALSE;
}
}
diff --git a/panels/background/cc-background-item.h b/panels/background/cc-background-item.h
index 6c9f5c43e..b97c7a006 100644
--- a/panels/background/cc-background-item.h
+++ b/panels/background/cc-background-item.h
@@ -28,12 +28,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_BACKGROUND_ITEM (cc_background_item_get_type ())
-#define CC_BACKGROUND_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_BACKGROUND_ITEM, CcBackgroundItem))
-#define CC_BACKGROUND_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CC_TYPE_BACKGROUND_ITEM, CcBackgroundItemClass))
-#define CC_IS_BACKGROUND_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_BACKGROUND_ITEM))
-#define CC_IS_BACKGROUND_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_BACKGROUND_ITEM))
-#define CC_BACKGROUND_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_BACKGROUND_ITEM, CcBackgroundItemClass))
+#define CC_TYPE_BACKGROUND_ITEM (cc_background_item_get_type ())
+G_DECLARE_FINAL_TYPE (CcBackgroundItem, cc_background_item, CC, BACKGROUND_ITEM, GObject)
typedef enum {
CC_BACKGROUND_ITEM_HAS_SHADING = 1 << 0,
@@ -49,21 +45,6 @@ typedef enum {
CC_BACKGROUND_ITEM_HAS_SCOLOR & \
CC_BACKGROUND_ITEM_HAS_FNAME)
-typedef struct CcBackgroundItemPrivate CcBackgroundItemPrivate;
-
-typedef struct
-{
- GObject parent;
- CcBackgroundItemPrivate *priv;
-} CcBackgroundItem;
-
-typedef struct
-{
- GObjectClass parent_class;
-} CcBackgroundItemClass;
-
-GType cc_background_item_get_type (void);
-
CcBackgroundItem * cc_background_item_new (const char *uri);
CcBackgroundItem * cc_background_item_copy (CcBackgroundItem *item);
gboolean cc_background_item_load (CcBackgroundItem *item,
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 363b79adb..43acc9758 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -44,13 +44,10 @@
#define WP_PCOLOR_KEY "primary-color"
#define WP_SCOLOR_KEY "secondary-color"
-CC_PANEL_REGISTER (CcBackgroundPanel, cc_background_panel)
-
-#define BACKGROUND_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_PANEL, CcBackgroundPanelPrivate))
-
-struct _CcBackgroundPanelPrivate
+struct _CcBackgroundPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GDBusConnection *connection;
@@ -72,9 +69,11 @@ struct _CcBackgroundPanelPrivate
char *screenshot_path;
};
-#define WID(y) (GtkWidget *) gtk_builder_get_object (priv->builder, y)
-#define CURRENT_BG (settings == priv->settings ? priv->current_background : priv->current_lock_background)
-#define SAVE_PATH (settings == priv->settings ? "last-edited.xml" : "last-edited-lock.xml")
+CC_PANEL_REGISTER (CcBackgroundPanel, cc_background_panel)
+
+#define WID(y) (GtkWidget *) gtk_builder_get_object (panel->builder, y)
+#define CURRENT_BG (settings == panel->settings ? panel->current_background : panel->current_lock_background)
+#define SAVE_PATH (settings == panel->settings ? "last-edited.xml" : "last-edited-lock.xml")
static const char *
cc_background_panel_get_help_uri (CcPanel *panel)
@@ -85,42 +84,42 @@ cc_background_panel_get_help_uri (CcPanel *panel)
static void
cc_background_panel_dispose (GObject *object)
{
- CcBackgroundPanelPrivate *priv = CC_BACKGROUND_PANEL (object)->priv;
+ CcBackgroundPanel *panel = CC_BACKGROUND_PANEL (object);
- g_clear_object (&priv->builder);
+ g_clear_object (&panel->builder);
/* destroying the builder object will also destroy the spinner */
- priv->spinner = NULL;
+ panel->spinner = NULL;
- g_clear_object (&priv->settings);
- g_clear_object (&priv->lock_settings);
+ g_clear_object (&panel->settings);
+ g_clear_object (&panel->lock_settings);
- if (priv->copy_cancellable)
+ if (panel->copy_cancellable)
{
/* cancel any copy operation */
- g_cancellable_cancel (priv->copy_cancellable);
+ g_cancellable_cancel (panel->copy_cancellable);
- g_clear_object (&priv->copy_cancellable);
+ g_clear_object (&panel->copy_cancellable);
}
- if (priv->capture_cancellable)
+ if (panel->capture_cancellable)
{
/* cancel screenshot operations */
- g_cancellable_cancel (priv->capture_cancellable);
+ g_cancellable_cancel (panel->capture_cancellable);
- g_clear_object (&priv->capture_cancellable);
+ g_clear_object (&panel->capture_cancellable);
}
- if (priv->chooser)
+ if (panel->chooser)
{
- gtk_widget_destroy (priv->chooser);
- priv->chooser = NULL;
+ gtk_widget_destroy (panel->chooser);
+ panel->chooser = NULL;
}
- g_clear_object (&priv->thumb_factory);
- g_clear_object (&priv->display_screenshot);
+ g_clear_object (&panel->thumb_factory);
+ g_clear_object (&panel->display_screenshot);
- g_clear_pointer (&priv->screenshot_path, g_free);
+ g_clear_pointer (&panel->screenshot_path, g_free);
G_OBJECT_CLASS (cc_background_panel_parent_class)->dispose (object);
}
@@ -128,10 +127,10 @@ cc_background_panel_dispose (GObject *object)
static void
cc_background_panel_finalize (GObject *object)
{
- CcBackgroundPanelPrivate *priv = CC_BACKGROUND_PANEL (object)->priv;
+ CcBackgroundPanel *panel = CC_BACKGROUND_PANEL (object);
- g_clear_object (&priv->current_background);
- g_clear_object (&priv->current_lock_background);
+ g_clear_object (&panel->current_background);
+ g_clear_object (&panel->current_lock_background);
G_OBJECT_CLASS (cc_background_panel_parent_class)->finalize (object);
}
@@ -142,8 +141,6 @@ cc_background_panel_class_init (CcBackgroundPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcBackgroundPanelPrivate));
-
panel_class->get_help_uri = cc_background_panel_get_help_uri;
object_class->dispose = cc_background_panel_dispose;
@@ -151,9 +148,9 @@ cc_background_panel_class_init (CcBackgroundPanelClass *klass)
}
static void
-update_preview (CcBackgroundPanelPrivate *priv,
- GSettings *settings,
- CcBackgroundItem *item)
+update_preview (CcBackgroundPanel *panel,
+ GSettings *settings,
+ CcBackgroundItem *item)
{
gboolean changes_with_time;
CcBackgroundItem *current_background;
@@ -164,10 +161,10 @@ update_preview (CcBackgroundPanelPrivate *priv,
{
g_object_unref (current_background);
current_background = cc_background_item_copy (item);
- if (settings == priv->settings)
- priv->current_background = current_background;
+ if (settings == panel->settings)
+ panel->current_background = current_background;
else
- priv->current_lock_background = current_background;
+ panel->current_lock_background = current_background;
cc_background_item_load (current_background, NULL);
}
@@ -178,7 +175,7 @@ update_preview (CcBackgroundPanelPrivate *priv,
changes_with_time = cc_background_item_changes_with_time (current_background);
}
- if (settings == priv->settings)
+ if (settings == panel->settings)
{
gtk_widget_set_visible (WID ("slide_image"), changes_with_time);
gtk_widget_set_visible (WID ("slide-label"), changes_with_time);
@@ -209,7 +206,6 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
GtkWidget *widget,
CcBackgroundItem *background)
{
- CcBackgroundPanelPrivate *priv = panel->priv;
GtkAllocation allocation;
const gint preview_width = 309;
const gint preview_height = 168;
@@ -219,10 +215,10 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
pixbuf = g_object_get_data (G_OBJECT (background), "pixbuf");
if (pixbuf == NULL)
{
- if (background == priv->current_background &&
- priv->display_screenshot != NULL)
+ if (background == panel->current_background &&
+ panel->display_screenshot != NULL)
{
- pixbuf = gdk_pixbuf_scale_simple (priv->display_screenshot,
+ pixbuf = gdk_pixbuf_scale_simple (panel->display_screenshot,
preview_width,
preview_height,
GDK_INTERP_BILINEAR);
@@ -232,7 +228,7 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
gtk_widget_get_allocation (widget, &allocation);
scale_factor = gtk_widget_get_scale_factor (widget);
pixbuf = cc_background_item_get_frame_thumbnail (background,
- priv->thumb_factory,
+ panel->thumb_factory,
preview_width,
preview_height,
scale_factor,
@@ -276,7 +272,6 @@ on_screenshot_finished (GObject *source,
{
ScreenshotData *data = user_data;
CcBackgroundPanel *panel = data->panel;
- CcBackgroundPanelPrivate *priv;
GError *error;
GdkPixbuf *pixbuf;
cairo_surface_t *surface;
@@ -298,14 +293,11 @@ on_screenshot_finished (GObject *source,
error->message);
g_error_free (error);
/* fallback? */
- priv = panel->priv;
goto out;
}
g_variant_unref (result);
- priv = panel->priv;
-
- pixbuf = gdk_pixbuf_new_from_file (panel->priv->screenshot_path, &error);
+ pixbuf = gdk_pixbuf_new_from_file (panel->screenshot_path, &error);
if (pixbuf == NULL)
{
g_debug ("Unable to use GNOME Shell's builtin screenshot interface: %s",
@@ -335,23 +327,23 @@ on_screenshot_finished (GObject *source,
cairo_restore (cr);
}
- g_clear_object (&panel->priv->display_screenshot);
- panel->priv->display_screenshot = gdk_pixbuf_get_from_surface (surface,
+ g_clear_object (&panel->display_screenshot);
+ panel->display_screenshot = gdk_pixbuf_get_from_surface (surface,
0, 0,
data->monitor_rect.width,
data->monitor_rect.height);
/* invalidate existing cached pixbuf */
- g_object_set_data (G_OBJECT (priv->current_background), "pixbuf", NULL);
+ g_object_set_data (G_OBJECT (panel->current_background), "pixbuf", NULL);
/* remove the temporary file created by the shell */
- g_unlink (panel->priv->screenshot_path);
- g_clear_pointer (&priv->screenshot_path, g_free);
+ g_unlink (panel->screenshot_path);
+ g_clear_pointer (&panel->screenshot_path, g_free);
cairo_destroy (cr);
cairo_surface_destroy (surface);
out:
- update_display_preview (panel, WID ("background-desktop-drawingarea"), priv->current_background);
+ update_display_preview (panel, WID ("background-desktop-drawingarea"), panel->current_background);
g_free (data);
}
@@ -376,7 +368,6 @@ calculate_contiguous_workarea (ScreenshotData *data)
static void
get_screenshot_async (CcBackgroundPanel *panel)
{
- CcBackgroundPanelPrivate *priv = panel->priv;
gchar *path, *tmpname;
const gchar *method_name;
GVariant *method_params;
@@ -406,8 +397,8 @@ get_screenshot_async (CcBackgroundPanel *panel)
g_mkdir_with_parents (path, USER_DIR_MODE);
tmpname = g_strdup_printf ("scr-%d.png", g_random_int ());
- g_free (panel->priv->screenshot_path);
- panel->priv->screenshot_path = g_build_filename (path, tmpname, NULL);
+ g_free (panel->screenshot_path);
+ panel->screenshot_path = g_build_filename (path, tmpname, NULL);
g_free (path);
g_free (tmpname);
@@ -416,9 +407,9 @@ get_screenshot_async (CcBackgroundPanel *panel)
data->capture_rect.x, data->capture_rect.y,
data->capture_rect.width, data->capture_rect.height,
FALSE, /* flash */
- panel->priv->screenshot_path);
+ panel->screenshot_path);
- g_dbus_connection_call (panel->priv->connection,
+ g_dbus_connection_call (panel->connection,
"org.gnome.Shell.Screenshot",
"/org/gnome/Shell/Screenshot",
"org.gnome.Shell.Screenshot",
@@ -427,7 +418,7 @@ get_screenshot_async (CcBackgroundPanel *panel)
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->capture_cancellable,
+ panel->capture_cancellable,
on_screenshot_finished,
data);
}
@@ -437,15 +428,14 @@ on_preview_draw (GtkWidget *widget,
cairo_t *cr,
CcBackgroundPanel *panel)
{
- CcBackgroundPanelPrivate *priv = panel->priv;
/* we have another shot in flight or an existing cache */
- if (panel->priv->display_screenshot == NULL
- && panel->priv->screenshot_path == NULL)
+ if (panel->display_screenshot == NULL
+ && panel->screenshot_path == NULL)
{
get_screenshot_async (panel);
}
else
- update_display_preview (panel, widget, priv->current_background);
+ update_display_preview (panel, widget, panel->current_background);
return TRUE;
}
@@ -455,21 +445,17 @@ on_lock_preview_draw (GtkWidget *widget,
cairo_t *cr,
CcBackgroundPanel *panel)
{
- CcBackgroundPanelPrivate *priv = panel->priv;
- update_display_preview (panel, widget, priv->current_lock_background);
+ update_display_preview (panel, widget, panel->current_lock_background);
return TRUE;
}
static void
-reload_current_bg (CcBackgroundPanel *self,
+reload_current_bg (CcBackgroundPanel *panel,
GSettings *settings)
{
- CcBackgroundPanelPrivate *priv;
CcBackgroundItem *saved, *configured;
gchar *uri, *pcolor, *scolor;
- priv = self->priv;
-
/* Load the saved configuration */
uri = get_save_path (SAVE_PATH);
saved = cc_background_xml_get_item (uri);
@@ -520,15 +506,15 @@ reload_current_bg (CcBackgroundPanel *self,
if (saved != NULL)
g_object_unref (saved);
- if (settings == priv->settings)
+ if (settings == panel->settings)
{
- g_clear_object (&priv->current_background);
- priv->current_background = configured;
+ g_clear_object (&panel->current_background);
+ panel->current_background = configured;
}
else
{
- g_clear_object (&priv->current_lock_background);
- priv->current_lock_background = configured;
+ g_clear_object (&panel->current_lock_background);
+ panel->current_lock_background = configured;
}
cc_background_item_load (configured, NULL);
}
@@ -559,7 +545,6 @@ copy_finished_cb (GObject *source_object,
{
GError *err = NULL;
CcBackgroundPanel *panel = (CcBackgroundPanel *) pointer;
- CcBackgroundPanelPrivate *priv = panel->priv;
CcBackgroundItem *item;
CcBackgroundItem *current_background;
GSettings *settings;
@@ -582,20 +567,20 @@ copy_finished_cb (GObject *source_object,
/* the panel may have been destroyed before the callback is run, so be sure
* to check the widgets are not NULL */
- if (priv->spinner)
+ if (panel->spinner)
{
- gtk_widget_destroy (GTK_WIDGET (priv->spinner));
- priv->spinner = NULL;
+ gtk_widget_destroy (GTK_WIDGET (panel->spinner));
+ panel->spinner = NULL;
}
if (current_background)
cc_background_item_load (current_background, NULL);
- if (priv->builder)
+ if (panel->builder)
{
char *filename;
- update_preview (priv, settings, item);
+ update_preview (panel, settings, item);
current_background = CURRENT_BG;
/* Save the source XML if there is one */
@@ -613,7 +598,6 @@ set_background (CcBackgroundPanel *panel,
GSettings *settings,
CcBackgroundItem *item)
{
- CcBackgroundPanelPrivate *priv = panel->priv;
GDesktopBackgroundStyle style;
gboolean save_settings = TRUE;
const char *uri;
@@ -663,24 +647,24 @@ set_background (CcBackgroundPanel *panel,
g_object_unref (pixbuf);
g_free (dest_path);
- if (priv->copy_cancellable)
+ if (panel->copy_cancellable)
{
- g_cancellable_cancel (priv->copy_cancellable);
- g_cancellable_reset (priv->copy_cancellable);
+ g_cancellable_cancel (panel->copy_cancellable);
+ g_cancellable_reset (panel->copy_cancellable);
}
- if (priv->spinner)
+ if (panel->spinner)
{
- gtk_widget_destroy (GTK_WIDGET (priv->spinner));
- priv->spinner = NULL;
+ gtk_widget_destroy (GTK_WIDGET (panel->spinner));
+ panel->spinner = NULL;
}
/* create a spinner while the file downloads */
- priv->spinner = gtk_spinner_new ();
- gtk_spinner_start (GTK_SPINNER (priv->spinner));
- gtk_box_pack_start (GTK_BOX (WID ("bottom-hbox")), priv->spinner, FALSE,
+ panel->spinner = gtk_spinner_new ();
+ gtk_spinner_start (GTK_SPINNER (panel->spinner));
+ gtk_box_pack_start (GTK_BOX (WID ("bottom-hbox")), panel->spinner, FALSE,
FALSE, 6);
- gtk_widget_show (priv->spinner);
+ gtk_widget_show (panel->spinner);
/* reference the panel in case it is removed before the copy is
* finished */
@@ -688,7 +672,7 @@ set_background (CcBackgroundPanel *panel,
g_object_set_data_full (G_OBJECT (source), "item", g_object_ref (item), g_object_unref);
g_object_set_data (G_OBJECT (source), "settings", settings);
g_file_copy_async (source, dest, G_FILE_COPY_OVERWRITE,
- G_PRIORITY_DEFAULT, priv->copy_cancellable,
+ G_PRIORITY_DEFAULT, panel->copy_cancellable,
NULL, NULL,
copy_finished_cb, panel);
g_object_unref (source);
@@ -764,32 +748,31 @@ on_chooser_dialog_response (GtkDialog *dialog,
}
static void
-launch_chooser (CcBackgroundPanel *self,
+launch_chooser (CcBackgroundPanel *panel,
GSettings *settings)
{
- CcBackgroundPanelPrivate *priv = self->priv;
GtkWidget *dialog;
dialog = cc_background_chooser_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (WID ("background-panel"))));
g_object_set_data (G_OBJECT (dialog), "settings", settings);
gtk_widget_show (dialog);
- g_signal_connect (dialog, "response", G_CALLBACK (on_chooser_dialog_response), self);
- priv->chooser = dialog;
- g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &priv->chooser);
+ g_signal_connect (dialog, "response", G_CALLBACK (on_chooser_dialog_response), panel);
+ panel->chooser = dialog;
+ g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &panel->chooser);
}
static void
on_background_button_clicked (GtkButton *button,
CcBackgroundPanel *self)
{
- launch_chooser (self, self->priv->settings);
+ launch_chooser (self, self->settings);
}
static void
on_lock_button_clicked (GtkButton *button,
CcBackgroundPanel *self)
{
- launch_chooser (self, self->priv->lock_settings);
+ launch_chooser (self, self->lock_settings);
}
static void
@@ -798,24 +781,21 @@ on_settings_changed (GSettings *settings,
CcBackgroundPanel *self)
{
reload_current_bg (self, settings);
- update_preview (self->priv, settings, NULL);
+ update_preview (self, settings, NULL);
}
static void
-cc_background_panel_init (CcBackgroundPanel *self)
+cc_background_panel_init (CcBackgroundPanel *panel)
{
- CcBackgroundPanelPrivate *priv;
gchar *objects[] = {"background-panel", NULL };
GError *err = NULL;
GtkWidget *widget;
- priv = self->priv = BACKGROUND_PANEL_PRIVATE (self);
-
- priv->connection = g_application_get_dbus_connection (g_application_get_default ());
+ panel->connection = g_application_get_dbus_connection (g_application_get_default ());
g_resources_register (cc_background_get_resource ());
- priv->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_resource (priv->builder,
+ panel->builder = gtk_builder_new ();
+ gtk_builder_add_objects_from_resource (panel->builder,
"/org/gnome/control-center/background/background.ui",
objects, &err);
@@ -826,42 +806,42 @@ cc_background_panel_init (CcBackgroundPanel *self)
return;
}
- priv->settings = g_settings_new (WP_PATH_ID);
- g_settings_delay (priv->settings);
+ panel->settings = g_settings_new (WP_PATH_ID);
+ g_settings_delay (panel->settings);
- priv->lock_settings = g_settings_new (WP_LOCK_PATH_ID);
- g_settings_delay (priv->lock_settings);
+ panel->lock_settings = g_settings_new (WP_LOCK_PATH_ID);
+ g_settings_delay (panel->lock_settings);
/* add the top level widget */
widget = WID ("background-panel");
- gtk_container_add (GTK_CONTAINER (self), widget);
- gtk_widget_show_all (GTK_WIDGET (self));
+ gtk_container_add (GTK_CONTAINER (panel), widget);
+ gtk_widget_show_all (GTK_WIDGET (panel));
/* setup preview area */
widget = WID ("background-desktop-drawingarea");
- g_signal_connect (widget, "draw", G_CALLBACK (on_preview_draw), self);
+ g_signal_connect (widget, "draw", G_CALLBACK (on_preview_draw), panel);
widget = WID ("background-lock-drawingarea");
- g_signal_connect (widget, "draw", G_CALLBACK (on_lock_preview_draw), self);
+ g_signal_connect (widget, "draw", G_CALLBACK (on_lock_preview_draw), panel);
- priv->copy_cancellable = g_cancellable_new ();
- priv->capture_cancellable = g_cancellable_new ();
+ panel->copy_cancellable = g_cancellable_new ();
+ panel->capture_cancellable = g_cancellable_new ();
- priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
+ panel->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
/* Load the backgrounds */
- reload_current_bg (self, priv->settings);
- update_preview (priv, priv->settings, NULL);
- reload_current_bg (self, priv->lock_settings);
- update_preview (priv, priv->lock_settings, NULL);
+ reload_current_bg (panel, panel->settings);
+ update_preview (panel, panel->settings, NULL);
+ reload_current_bg (panel, panel->lock_settings);
+ update_preview (panel, panel->lock_settings, NULL);
/* Background settings */
- g_signal_connect (priv->settings, "changed", G_CALLBACK (on_settings_changed), self);
- g_signal_connect (priv->lock_settings, "changed", G_CALLBACK (on_settings_changed), self);
+ g_signal_connect (panel->settings, "changed", G_CALLBACK (on_settings_changed), panel);
+ g_signal_connect (panel->lock_settings, "changed", G_CALLBACK (on_settings_changed), panel);
/* Background buttons */
widget = WID ("background-set-button");
- g_signal_connect (widget, "clicked", G_CALLBACK (on_background_button_clicked), self);
+ g_signal_connect (widget, "clicked", G_CALLBACK (on_background_button_clicked), panel);
widget = WID ("background-lock-set-button");
- g_signal_connect (widget, "clicked", G_CALLBACK (on_lock_button_clicked), self);
+ g_signal_connect (widget, "clicked", G_CALLBACK (on_lock_button_clicked), panel);
}
diff --git a/panels/background/cc-background-panel.h b/panels/background/cc-background-panel.h
index ded0b1d17..42ea8c2e8 100644
--- a/panels/background/cc-background-panel.h
+++ b/panels/background/cc-background-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_BACKGROUND_PANEL cc_background_panel_get_type()
-
-#define CC_BACKGROUND_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_BACKGROUND_PANEL, CcBackgroundPanel))
-
-#define CC_BACKGROUND_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_BACKGROUND_PANEL, CcBackgroundPanelClass))
-
-#define CC_IS_BACKGROUND_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_BACKGROUND_PANEL))
-
-#define CC_IS_BACKGROUND_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_BACKGROUND_PANEL))
-
-#define CC_BACKGROUND_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_BACKGROUND_PANEL, CcBackgroundPanelClass))
-
-typedef struct _CcBackgroundPanel CcBackgroundPanel;
-typedef struct _CcBackgroundPanelClass CcBackgroundPanelClass;
-typedef struct _CcBackgroundPanelPrivate CcBackgroundPanelPrivate;
-
-struct _CcBackgroundPanel
-{
- CcPanel parent;
-
- CcBackgroundPanelPrivate *priv;
-};
-
-struct _CcBackgroundPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_background_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_BACKGROUND_PANEL (cc_background_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcBackgroundPanel, cc_background_panel, CC, BACKGROUND_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/background/cc-background-xml.c b/panels/background/cc-background-xml.c
index 60498d5ec..e525ddb28 100644
--- a/panels/background/cc-background-xml.c
+++ b/panels/background/cc-background-xml.c
@@ -33,16 +33,16 @@
* returning to the main loop */
#define NUM_ITEMS_PER_BATCH 1
-struct CcBackgroundXmlPrivate
+struct _CcBackgroundXml
{
+ GObject parent_instance;
+
GHashTable *wp_hash;
GAsyncQueue *item_added_queue;
guint item_added_id;
GSList *monitors; /* GSList of GFileMonitor */
};
-#define CC_BACKGROUND_XML_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_XML, CcBackgroundXmlPrivate))
-
enum {
ADDED,
LAST_SIGNAL
@@ -118,20 +118,20 @@ idle_emit (CcBackgroundXml *xml)
GObject *item;
guint i = NUM_ITEMS_PER_BATCH;
- g_async_queue_lock (xml->priv->item_added_queue);
+ g_async_queue_lock (xml->item_added_queue);
- while (i > 0 && (item = g_async_queue_try_pop_unlocked (xml->priv->item_added_queue)) != NULL) {
+ while (i > 0 && (item = g_async_queue_try_pop_unlocked (xml->item_added_queue)) != NULL) {
g_signal_emit (G_OBJECT (xml), signals[ADDED], 0, item);
g_object_unref (item);
i--;
}
- g_async_queue_unlock (xml->priv->item_added_queue);
+ g_async_queue_unlock (xml->item_added_queue);
- if (g_async_queue_length (xml->priv->item_added_queue) > 0) {
+ if (g_async_queue_length (xml->item_added_queue) > 0) {
return TRUE;
} else {
- xml->priv->item_added_id = 0;
+ xml->item_added_id = 0;
return FALSE;
}
}
@@ -140,11 +140,11 @@ static void
emit_added_in_idle (CcBackgroundXml *xml,
GObject *object)
{
- g_async_queue_lock (xml->priv->item_added_queue);
- g_async_queue_push_unlocked (xml->priv->item_added_queue, object);
- if (xml->priv->item_added_id == 0)
- xml->priv->item_added_id = g_idle_add ((GSourceFunc) idle_emit, xml);
- g_async_queue_unlock (xml->priv->item_added_queue);
+ g_async_queue_lock (xml->item_added_queue);
+ g_async_queue_push_unlocked (xml->item_added_queue, object);
+ if (xml->item_added_id == 0)
+ xml->item_added_id = g_idle_add ((GSourceFunc) idle_emit, xml);
+ g_async_queue_unlock (xml->item_added_queue);
}
#define NONE "(none)"
@@ -305,14 +305,14 @@ cc_background_xml_load_xml_internal (CcBackgroundXml *xml,
g_free (uri);
/* Make sure we don't already have this one and that filename exists */
- if (g_hash_table_lookup (xml->priv->wp_hash, id) != NULL) {
+ if (g_hash_table_lookup (xml->wp_hash, id) != NULL) {
g_object_unref (item);
g_free (id);
continue;
}
g_object_set (G_OBJECT (item), "flags", flags, NULL);
- g_hash_table_insert (xml->priv->wp_hash,
+ g_hash_table_insert (xml->wp_hash,
g_strdup (id),
g_object_ref (item));
if (in_thread)
@@ -377,7 +377,7 @@ cc_background_xml_add_monitor (GFile *directory,
G_CALLBACK (gnome_wp_file_changed),
data);
- data->priv->monitors = g_slist_prepend (data->priv->monitors, monitor);
+ data->monitors = g_slist_prepend (data->monitors, monitor);
}
static void
@@ -460,7 +460,7 @@ cc_background_xml_load_list_finish (GAsyncResult *async_result)
g_warn_if_fail (g_simple_async_result_get_source_tag (result) == cc_background_xml_load_list_async);
data = CC_BACKGROUND_XML (g_simple_async_result_get_op_res_gpointer (result));
- return data->priv->wp_hash;
+ return data->wp_hash;
}
static void
@@ -631,16 +631,14 @@ cc_background_xml_finalize (GObject *object)
xml = CC_BACKGROUND_XML (object);
- g_return_if_fail (xml->priv != NULL);
+ g_slist_free_full (xml->monitors, g_object_unref);
- g_slist_free_full (xml->priv->monitors, g_object_unref);
-
- g_clear_pointer (&xml->priv->wp_hash, g_hash_table_destroy);
- if (xml->priv->item_added_id != 0) {
- g_source_remove (xml->priv->item_added_id);
- xml->priv->item_added_id = 0;
+ g_clear_pointer (&xml->wp_hash, g_hash_table_destroy);
+ if (xml->item_added_id != 0) {
+ g_source_remove (xml->item_added_id);
+ xml->item_added_id = 0;
}
- g_clear_pointer (&xml->priv->item_added_queue, g_async_queue_unref);
+ g_clear_pointer (&xml->item_added_queue, g_async_queue_unref);
}
static void
@@ -657,19 +655,16 @@ cc_background_xml_class_init (CcBackgroundXmlClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, CC_TYPE_BACKGROUND_ITEM);
-
- g_type_class_add_private (klass, sizeof (CcBackgroundXmlPrivate));
}
static void
cc_background_xml_init (CcBackgroundXml *xml)
{
- xml->priv = CC_BACKGROUND_XML_GET_PRIVATE (xml);
- xml->priv->wp_hash = g_hash_table_new_full (g_str_hash,
+ xml->wp_hash = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
- xml->priv->item_added_queue = g_async_queue_new_full ((GDestroyNotify) g_object_unref);
+ xml->item_added_queue = g_async_queue_new_full ((GDestroyNotify) g_object_unref);
}
CcBackgroundXml *
diff --git a/panels/background/cc-background-xml.h b/panels/background/cc-background-xml.h
index 67f522e8e..bf0687f78 100644
--- a/panels/background/cc-background-xml.h
+++ b/panels/background/cc-background-xml.h
@@ -26,28 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_BACKGROUND_XML (cc_background_xml_get_type ())
-#define CC_BACKGROUND_XML(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_BACKGROUND_XML, CcBackgroundXml))
-#define CC_BACKGROUND_XML_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CC_TYPE_BACKGROUND_XML, CcBackgroundXmlClass))
-#define CC_IS_BACKGROUND_XML(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_BACKGROUND_XML))
-#define CC_IS_BACKGROUND_XML_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_BACKGROUND_XML))
-#define CC_BACKGROUND_XML_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_BACKGROUND_XML, CcBackgroundXmlClass))
-
-typedef struct CcBackgroundXmlPrivate CcBackgroundXmlPrivate;
-
-typedef struct
-{
- GObject parent;
- CcBackgroundXmlPrivate *priv;
-} CcBackgroundXml;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (*added) (CcBackgroundXml *xml, GObject *item);
-} CcBackgroundXmlClass;
-
-GType cc_background_xml_get_type (void);
+#define CC_TYPE_BACKGROUND_XML (cc_background_xml_get_type ())
+G_DECLARE_FINAL_TYPE (CcBackgroundXml, cc_background_xml, CC, BACKGROUND_XML, GObject)
CcBackgroundXml *cc_background_xml_new (void);
diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c
index c4c558f06..819364016 100644
--- a/panels/bluetooth/cc-bluetooth-panel.c
+++ b/panels/bluetooth/cc-bluetooth-panel.c
@@ -29,12 +29,7 @@
#include "cc-bluetooth-panel.h"
#include "cc-bluetooth-resources.h"
-
-CC_PANEL_REGISTER (CcBluetoothPanel, cc_bluetooth_panel)
-
-#define BLUETOOTH_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelPrivate))
-
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->builder, s))
#define BLUETOOTH_NO_DEVICES_PAGE "no-devices-page"
#define BLUETOOTH_DISABLED_PAGE "disabled-page"
@@ -42,7 +37,9 @@ CC_PANEL_REGISTER (CcBluetoothPanel, cc_bluetooth_panel)
#define BLUETOOTH_HW_AIRPLANE_PAGE "hw-airplane-page"
#define BLUETOOTH_WORKING_PAGE "working-page"
-struct CcBluetoothPanelPrivate {
+struct _CcBluetoothPanel {
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *stack;
GtkWidget *widget;
@@ -57,6 +54,8 @@ struct CcBluetoothPanelPrivate {
gboolean has_airplane_mode;
};
+CC_PANEL_REGISTER (CcBluetoothPanel, cc_bluetooth_panel)
+
static void cc_bluetooth_panel_finalize (GObject *object);
static void cc_bluetooth_panel_constructed (GObject *object);
@@ -76,8 +75,6 @@ cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass)
object_class->finalize = cc_bluetooth_panel_finalize;
panel_class->get_help_uri = cc_bluetooth_panel_get_help_uri;
-
- g_type_class_add_private (klass, sizeof (CcBluetoothPanelPrivate));
}
static void
@@ -87,12 +84,12 @@ cc_bluetooth_panel_finalize (GObject *object)
self = CC_BLUETOOTH_PANEL (object);
- g_cancellable_cancel (self->priv->cancellable);
- g_clear_object (&self->priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
- g_clear_object (&self->priv->properties);
- g_clear_object (&self->priv->rfkill);
- g_clear_object (&self->priv->kill_switch_header);
+ g_clear_object (&self->properties);
+ g_clear_object (&self->rfkill);
+ g_clear_object (&self->kill_switch_header);
G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->finalize (object);
}
@@ -105,10 +102,10 @@ cc_bluetooth_panel_constructed (GObject *object)
G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->constructed (object);
/* add kill switch widgets */
- self->priv->kill_switch_header = g_object_ref (WID ("box_power"));
+ self->kill_switch_header = g_object_ref (WID ("box_power"));
cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (self)),
- self->priv->kill_switch_header);
- gtk_widget_show_all (self->priv->kill_switch_header);
+ self->kill_switch_header);
+ gtk_widget_show_all (self->kill_switch_header);
}
static void
@@ -120,13 +117,13 @@ power_callback (GObject *object,
state = gtk_switch_get_active (GTK_SWITCH (WID ("switch_bluetooth")));
g_debug ("Power switched to %s", state ? "on" : "off");
- g_dbus_proxy_call (self->priv->properties,
+ g_dbus_proxy_call (self->properties,
"Set",
g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill', 'BluetoothAirplaneMode', %v)",
g_variant_new_boolean (!state)),
G_DBUS_CALL_FLAGS_NONE,
-1,
- self->priv->cancellable,
+ self->cancellable,
NULL, NULL);
}
@@ -139,28 +136,28 @@ cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
const char *page;
g_debug ("Updating airplane mode: BluetoothHasAirplaneMode %d, BluetoothHardwareAirplaneMode %d, BluetoothAirplaneMode %d, AirplaneMode %d",
- self->priv->has_airplane_mode, self->priv->hardware_airplane_mode, self->priv->bt_airplane_mode, self->priv->airplane_mode);
+ self->has_airplane_mode, self->hardware_airplane_mode, self->bt_airplane_mode, self->airplane_mode);
change_powered = TRUE;
valign = GTK_ALIGN_CENTER;
- if (self->priv->has_airplane_mode == FALSE) {
+ if (self->has_airplane_mode == FALSE) {
g_debug ("No Bluetooth available");
sensitive = FALSE;
powered = FALSE;
page = BLUETOOTH_NO_DEVICES_PAGE;
- } else if (self->priv->hardware_airplane_mode) {
+ } else if (self->hardware_airplane_mode) {
g_debug ("Bluetooth is Hard blocked");
sensitive = FALSE;
powered = FALSE;
page = BLUETOOTH_HW_AIRPLANE_PAGE;
- } else if (self->priv->airplane_mode) {
+ } else if (self->airplane_mode) {
g_debug ("Airplane mode is on, Wi-Fi and Bluetooth are disabled");
sensitive = FALSE;
powered = FALSE;
page = BLUETOOTH_AIRPLANE_PAGE;
- } else if (self->priv->bt_airplane_mode ||
- !bluetooth_settings_widget_get_default_adapter_powered (BLUETOOTH_SETTINGS_WIDGET (self->priv->widget))) {
+ } else if (self->bt_airplane_mode ||
+ !bluetooth_settings_widget_get_default_adapter_powered (BLUETOOTH_SETTINGS_WIDGET (self->widget))) {
g_debug ("Default adapter is unpowered, but should be available");
sensitive = TRUE;
change_powered = FALSE;
@@ -173,7 +170,7 @@ cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
valign = GTK_ALIGN_FILL;
}
- gtk_widget_set_valign (self->priv->stack, valign);
+ gtk_widget_set_valign (self->stack, valign);
gtk_widget_set_sensitive (WID ("box_power") , sensitive);
toggle = G_OBJECT (WID ("switch_bluetooth"));
@@ -183,7 +180,7 @@ cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
g_signal_handlers_unblock_by_func (toggle, power_callback, self);
}
- gtk_stack_set_visible_child_name (GTK_STACK (self->priv->stack), page);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->stack), page);
}
static void
@@ -194,20 +191,20 @@ airplane_mode_changed (GDBusProxy *proxy,
{
GVariant *v;
- v = g_dbus_proxy_get_cached_property (self->priv->rfkill, "AirplaneMode");
- self->priv->airplane_mode = g_variant_get_boolean (v);
+ v = g_dbus_proxy_get_cached_property (self->rfkill, "AirplaneMode");
+ self->airplane_mode = g_variant_get_boolean (v);
g_variant_unref (v);
- v = g_dbus_proxy_get_cached_property (self->priv->rfkill, "BluetoothAirplaneMode");
- self->priv->bt_airplane_mode = g_variant_get_boolean (v);
+ v = g_dbus_proxy_get_cached_property (self->rfkill, "BluetoothAirplaneMode");
+ self->bt_airplane_mode = g_variant_get_boolean (v);
g_variant_unref (v);
- v = g_dbus_proxy_get_cached_property (self->priv->rfkill, "BluetoothHardwareAirplaneMode");
- self->priv->hardware_airplane_mode = g_variant_get_boolean (v);
+ v = g_dbus_proxy_get_cached_property (self->rfkill, "BluetoothHardwareAirplaneMode");
+ self->hardware_airplane_mode = g_variant_get_boolean (v);
g_variant_unref (v);
- v = g_dbus_proxy_get_cached_property (self->priv->rfkill, "BluetoothHasAirplaneMode");
- self->priv->has_airplane_mode = g_variant_get_boolean (v);
+ v = g_dbus_proxy_get_cached_property (self->rfkill, "BluetoothHasAirplaneMode");
+ self->has_airplane_mode = g_variant_get_boolean (v);
g_variant_unref (v);
cc_bluetooth_panel_update_power (self);
@@ -218,14 +215,14 @@ on_airplane_mode_off_clicked (GtkButton *button,
CcBluetoothPanel *self)
{
g_debug ("Airplane Mode Off clicked, disabling airplane mode");
- g_dbus_proxy_call (self->priv->rfkill,
+ g_dbus_proxy_call (self->rfkill,
"org.freedesktop.DBus.Properties.Set",
g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill',"
"'AirplaneMode', %v)",
g_variant_new_boolean (FALSE)),
G_DBUS_CALL_FLAGS_NONE,
-1,
- self->priv->cancellable,
+ self->cancellable,
NULL, NULL);
}
@@ -273,7 +270,7 @@ add_stack_page (CcBluetoothPanel *self,
gtk_box_pack_start (GTK_BOX (box), alignment, FALSE, FALSE, 24);
}
- gtk_stack_add_named (GTK_STACK (self->priv->stack), box, name);
+ gtk_stack_add_named (GTK_STACK (self->stack), box, name);
gtk_widget_show_all (box);
}
@@ -297,12 +294,11 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
{
GError *error = NULL;
- self->priv = BLUETOOTH_PANEL_PRIVATE (self);
g_resources_register (cc_bluetooth_get_resource ());
- self->priv->builder = gtk_builder_new ();
- gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
- gtk_builder_add_from_resource (self->priv->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_set_translation_domain (self->builder, GETTEXT_PACKAGE);
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/bluetooth/bluetooth.ui",
&error);
if (error != NULL) {
@@ -311,17 +307,17 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
return;
}
- self->priv->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
/* RFKill */
- self->priv->rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ self->rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.gnome.SettingsDaemon.Rfkill",
"/org/gnome/SettingsDaemon/Rfkill",
"org.gnome.SettingsDaemon.Rfkill",
NULL, NULL);
- self->priv->properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ self->properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.gnome.SettingsDaemon.Rfkill",
@@ -329,27 +325,27 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
"org.freedesktop.DBus.Properties",
NULL, NULL);
- self->priv->stack = gtk_stack_new ();
- gtk_stack_set_homogeneous (GTK_STACK (self->priv->stack), TRUE);
+ self->stack = gtk_stack_new ();
+ gtk_stack_set_homogeneous (GTK_STACK (self->stack), TRUE);
add_stack_page (self, _("No Bluetooth Found"), _("Plug in a dongle to use Bluetooth."), BLUETOOTH_NO_DEVICES_PAGE);
add_stack_page (self, _("Bluetooth Turned Off"), _("Turn on to connect devices and receive file transfers."), BLUETOOTH_DISABLED_PAGE);
add_stack_page (self, _("Airplane Mode is on"), _("Bluetooth is disabled when airplane mode is on."), BLUETOOTH_AIRPLANE_PAGE);
add_stack_page (self, _("Hardware Airplane Mode is on"), _("Turn off the Airplane mode switch to enable Bluetooth."), BLUETOOTH_HW_AIRPLANE_PAGE);
- self->priv->widget = bluetooth_settings_widget_new ();
- g_signal_connect (G_OBJECT (self->priv->widget), "panel-changed",
+ self->widget = bluetooth_settings_widget_new ();
+ g_signal_connect (G_OBJECT (self->widget), "panel-changed",
G_CALLBACK (panel_changed), self);
- gtk_stack_add_named (GTK_STACK (self->priv->stack),
- self->priv->widget, BLUETOOTH_WORKING_PAGE);
- gtk_widget_show (self->priv->widget);
- gtk_widget_show (self->priv->stack);
+ gtk_stack_add_named (GTK_STACK (self->stack),
+ self->widget, BLUETOOTH_WORKING_PAGE);
+ gtk_widget_show (self->widget);
+ gtk_widget_show (self->stack);
- gtk_container_add (GTK_CONTAINER (self), self->priv->stack);
+ gtk_container_add (GTK_CONTAINER (self), self->stack);
airplane_mode_changed (NULL, NULL, NULL, self);
- g_signal_connect (self->priv->rfkill, "g-properties-changed",
+ g_signal_connect (self->rfkill, "g-properties-changed",
G_CALLBACK (airplane_mode_changed), self);
- g_signal_connect_swapped (G_OBJECT (self->priv->widget), "adapter-status-changed",
+ g_signal_connect_swapped (G_OBJECT (self->widget), "adapter-status-changed",
G_CALLBACK (cc_bluetooth_panel_update_power), self);
g_signal_connect (G_OBJECT (WID ("switch_bluetooth")), "notify::active",
diff --git a/panels/bluetooth/cc-bluetooth-panel.h b/panels/bluetooth/cc-bluetooth-panel.h
index bfcf84208..c4cc468f0 100644
--- a/panels/bluetooth/cc-bluetooth-panel.h
+++ b/panels/bluetooth/cc-bluetooth-panel.h
@@ -29,27 +29,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_BLUETOOTH_PANEL cc_bluetooth_panel_get_type()
-#define CC_BLUETOOTH_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanel))
-#define CC_BLUETOOTH_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelClass))
-#define CC_IS_BLUETOOTH_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_BLUETOOTH_PANEL))
-#define CC_IS_BLUETOOTH_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_BLUETOOTH_PANEL))
-#define CC_BLUETOOTH_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelClass))
-
-typedef struct CcBluetoothPanel CcBluetoothPanel;
-typedef struct CcBluetoothPanelClass CcBluetoothPanelClass;
-typedef struct CcBluetoothPanelPrivate CcBluetoothPanelPrivate;
-
-struct CcBluetoothPanel {
- CcPanel parent;
- CcBluetoothPanelPrivate *priv;
-};
-
-struct CcBluetoothPanelClass {
- CcPanelClass parent_class;
-};
-
-GType cc_bluetooth_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_BLUETOOTH_PANEL (cc_bluetooth_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcBluetoothPanel, cc_bluetooth_panel, CC, BLUETOOTH_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/color/cc-color-calibrate.c b/panels/color/cc-color-calibrate.c
index 411bcb0bc..4da5931c0 100644
--- a/panels/color/cc-color-calibrate.c
+++ b/panels/color/cc-color-calibrate.c
@@ -33,12 +33,12 @@
#include "cc-color-calibrate.h"
-#define CC_COLOR_CALIBRATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_COLOR_CALIBRATE, CcColorCalibratePrivate))
-
#define CALIBRATE_WINDOW_OPACITY 0.9
-struct _CcColorCalibratePrivate
+struct _CcColorCalibrate
{
+ GObject parent_instance;
+
CdDevice *device;
CdSensorCap device_kind;
CdSensor *sensor;
@@ -80,71 +80,71 @@ void
cc_color_calibrate_set_kind (CcColorCalibrate *calibrate,
CdSensorCap kind)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
- calibrate->priv->device_kind = kind;
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
+ calibrate->device_kind = kind;
}
void
cc_color_calibrate_set_temperature (CcColorCalibrate *calibrate,
guint temperature)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
g_return_if_fail (temperature < 10000);
- calibrate->priv->target_whitepoint = temperature;
+ calibrate->target_whitepoint = temperature;
}
void
cc_color_calibrate_set_quality (CcColorCalibrate *calibrate,
CdProfileQuality quality)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
- calibrate->priv->quality = quality;
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
+ calibrate->quality = quality;
}
CdProfileQuality
cc_color_calibrate_get_quality (CcColorCalibrate *calibrate)
{
- g_return_val_if_fail (CC_IS_COLOR_CALIB (calibrate), 0);
- return calibrate->priv->quality;
+ g_return_val_if_fail (CC_IS_COLOR_CALIBRATE (calibrate), 0);
+ return calibrate->quality;
}
void
cc_color_calibrate_set_device (CcColorCalibrate *calibrate,
CdDevice *device)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
g_return_if_fail (CD_IS_DEVICE (device));
- if (calibrate->priv->device != NULL)
- g_object_unref (calibrate->priv->device);
- calibrate->priv->device = g_object_ref (device);
+ if (calibrate->device != NULL)
+ g_object_unref (calibrate->device);
+ calibrate->device = g_object_ref (device);
}
void
cc_color_calibrate_set_sensor (CcColorCalibrate *calibrate,
CdSensor *sensor)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
g_return_if_fail (CD_IS_SENSOR (sensor));
- if (calibrate->priv->sensor != NULL)
- g_object_unref (calibrate->priv->sensor);
- calibrate->priv->sensor = g_object_ref (sensor);
+ if (calibrate->sensor != NULL)
+ g_object_unref (calibrate->sensor);
+ calibrate->sensor = g_object_ref (sensor);
}
void
cc_color_calibrate_set_title (CcColorCalibrate *calibrate,
const gchar *title)
{
- g_return_if_fail (CC_IS_COLOR_CALIB (calibrate));
+ g_return_if_fail (CC_IS_COLOR_CALIBRATE (calibrate));
g_return_if_fail (title != NULL);
- g_free (calibrate->priv->title);
- calibrate->priv->title = g_strdup (title);
+ g_free (calibrate->title);
+ calibrate->title = g_strdup (title);
}
CdProfile *
cc_color_calibrate_get_profile (CcColorCalibrate *calibrate)
{
- g_return_val_if_fail (CC_IS_COLOR_CALIB (calibrate), NULL);
- return calibrate->priv->profile;
+ g_return_val_if_fail (CC_IS_COLOR_CALIBRATE (calibrate), NULL);
+ return calibrate->profile;
}
static guint
@@ -167,21 +167,20 @@ cc_color_calibrate_calib_setup_screen (CcColorCalibrate *calibrate,
const gchar *name,
GError **error)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
gboolean ret = TRUE;
/* get screen */
- priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
- if (priv->x11_screen == NULL)
+ calibrate->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
+ if (calibrate->x11_screen == NULL)
{
ret = FALSE;
goto out;
}
/* get the output */
- priv->output = gnome_rr_screen_get_output_by_name (priv->x11_screen,
+ calibrate->output = gnome_rr_screen_get_output_by_name (calibrate->x11_screen,
name);
- if (priv->output == NULL)
+ if (calibrate->output == NULL)
{
ret = FALSE;
g_set_error_literal (error,
@@ -192,8 +191,8 @@ cc_color_calibrate_calib_setup_screen (CcColorCalibrate *calibrate,
}
/* create a lookup table */
- priv->gamma_size = _gnome_rr_output_get_gamma_size (priv->output);
- if (priv->gamma_size == 0)
+ calibrate->gamma_size = _gnome_rr_output_get_gamma_size (calibrate->output);
+ if (calibrate->gamma_size == 0)
{
ret = FALSE;
g_set_error_literal (error,
@@ -222,7 +221,6 @@ cc_color_calibrate_calib_set_output_gamma (CcColorCalibrate *calibrate,
GPtrArray *array,
GError **error)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
CdColorRGB *p1;
CdColorRGB *p2;
CdColorRGB result;
@@ -246,14 +244,14 @@ cc_color_calibrate_calib_set_output_gamma (CcColorCalibrate *calibrate,
}
/* convert to a type X understands of the right size */
- red = g_new (guint16, priv->gamma_size);
- green = g_new (guint16, priv->gamma_size);
- blue = g_new (guint16, priv->gamma_size);
+ red = g_new (guint16, calibrate->gamma_size);
+ green = g_new (guint16, calibrate->gamma_size);
+ blue = g_new (guint16, calibrate->gamma_size);
cd_color_rgb_set (&result, 1.0, 1.0, 1.0);
- for (i = 0; i < priv->gamma_size; i++)
+ for (i = 0; i < calibrate->gamma_size; i++)
{
mix = (gdouble) (array->len - 1) /
- (gdouble) (priv->gamma_size - 1) *
+ (gdouble) (calibrate->gamma_size - 1) *
(gdouble) i;
p1 = g_ptr_array_index (array, (guint) floor (mix));
p2 = g_ptr_array_index (array, (guint) ceil (mix));
@@ -267,7 +265,7 @@ cc_color_calibrate_calib_set_output_gamma (CcColorCalibrate *calibrate,
}
/* send to LUT */
- crtc = gnome_rr_output_get_crtc (priv->output);
+ crtc = gnome_rr_output_get_crtc (calibrate->output);
if (crtc == NULL)
{
ret = FALSE;
@@ -275,10 +273,10 @@ cc_color_calibrate_calib_set_output_gamma (CcColorCalibrate *calibrate,
CD_SESSION_ERROR,
CD_SESSION_ERROR_INTERNAL,
"failed to get ctrc for %s",
- gnome_rr_output_get_name (priv->output));
+ gnome_rr_output_get_name (calibrate->output));
goto out;
}
- gnome_rr_crtc_set_gamma (crtc, priv->gamma_size,
+ gnome_rr_crtc_set_gamma (crtc, calibrate->gamma_size,
red, green, blue);
out:
g_free (red);
@@ -293,7 +291,6 @@ cc_color_calibrate_property_changed_cb (GDBusProxy *proxy,
GStrv invalidated_properties,
CcColorCalibrate *calibrate)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
gboolean ret;
GtkWidget *widget;
guint value;
@@ -303,7 +300,7 @@ cc_color_calibrate_property_changed_cb (GDBusProxy *proxy,
"u", &value);
if (ret)
{
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"progressbar_status"));
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget),
value / 100.0f);
@@ -316,7 +313,6 @@ cc_color_calibrate_interaction_required (CcColorCalibrate *calibrate,
const gchar *message,
const gchar *image_path)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
const gchar *message_transl;
gboolean show_button_start = FALSE;
GdkPixbuf *pixbuf;
@@ -329,7 +325,7 @@ cc_color_calibrate_interaction_required (CcColorCalibrate *calibrate,
image_path = "preferences-color-symbolic";
/* set image */
- img = GTK_IMAGE (gtk_builder_get_object (priv->builder,
+ img = GTK_IMAGE (gtk_builder_get_object (calibrate->builder,
"image_status"));
if (image_path != NULL && image_path[0] != '\0')
{
@@ -343,13 +339,13 @@ cc_color_calibrate_interaction_required (CcColorCalibrate *calibrate,
g_object_unref (pixbuf);
}
gtk_widget_set_visible (GTK_WIDGET (img), TRUE);
- gtk_widget_set_visible (GTK_WIDGET (priv->sample_widget), FALSE);
+ gtk_widget_set_visible (GTK_WIDGET (calibrate->sample_widget), FALSE);
}
else
{
g_debug ("hiding image");
gtk_widget_set_visible (GTK_WIDGET (img), FALSE);
- gtk_widget_set_visible (GTK_WIDGET (priv->sample_widget), TRUE);
+ gtk_widget_set_visible (GTK_WIDGET (calibrate->sample_widget), TRUE);
}
/* set new status */
@@ -382,15 +378,15 @@ cc_color_calibrate_interaction_required (CcColorCalibrate *calibrate,
message_transl = message;
break;
}
- label = GTK_LABEL (gtk_builder_get_object (priv->builder,
+ label = GTK_LABEL (gtk_builder_get_object (calibrate->builder,
"label_status"));
gtk_label_set_label (label, message_transl);
/* show the correct button */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_start"));
gtk_widget_set_visible (widget, show_button_start);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_resume"));
gtk_widget_set_visible (widget, !show_button_start);
}
@@ -440,22 +436,21 @@ cc_color_calibrate_finished (CcColorCalibrate *calibrate,
GtkWidget *widget;
GString *str;
const gchar *tmp;
- CcColorCalibratePrivate *priv = calibrate->priv;
/* save failure so we can get this after we've quit the loop */
- calibrate->priv->session_error_code = code;
+ calibrate->session_error_code = code;
/* show correct buttons */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_cancel"));
gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_start"));
gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_resume"));
gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_done"));
gtk_widget_set_visible (widget, TRUE);
@@ -481,7 +476,7 @@ cc_color_calibrate_finished (CcColorCalibrate *calibrate,
/* TRANSLATORS: The user can now remove the sensor from the screen */
g_string_append (str, _("You can remove the calibration device."));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"label_status"));
gtk_label_set_label (GTK_LABEL (widget), str->str);
g_string_free (str, TRUE);
@@ -494,7 +489,6 @@ cc_color_calibrate_signal_cb (GDBusProxy *proxy,
GVariant *parameters,
CcColorCalibrate *calibrate)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
CdColorRGB color;
CdColorRGB *color_tmp;
CdSessionInteraction code;
@@ -518,7 +512,7 @@ cc_color_calibrate_signal_cb (GDBusProxy *proxy,
g_variant_lookup (dict, "ErrorDetails", "&s", &str);
ret = g_variant_lookup (dict, "ProfilePath", "&s", &profile_path);
if (ret)
- priv->profile = cd_profile_new_with_object_path (profile_path);
+ calibrate->profile = cd_profile_new_with_object_path (profile_path);
cc_color_calibrate_finished (calibrate, code, str);
goto out;
}
@@ -528,24 +522,24 @@ cc_color_calibrate_signal_cb (GDBusProxy *proxy,
&color.R,
&color.G,
&color.B);
- img = GTK_IMAGE (gtk_builder_get_object (priv->builder,
+ img = GTK_IMAGE (gtk_builder_get_object (calibrate->builder,
"image_status"));
gtk_widget_set_visible (GTK_WIDGET (img), FALSE);
- gtk_widget_set_visible (GTK_WIDGET (priv->sample_widget), TRUE);
- cd_sample_widget_set_color (CD_SAMPLE_WIDGET (priv->sample_widget),
+ gtk_widget_set_visible (GTK_WIDGET (calibrate->sample_widget), TRUE);
+ cd_sample_widget_set_color (CD_SAMPLE_WIDGET (calibrate->sample_widget),
&color);
/* for Lenovo W700 and W520 laptops we almost fullscreen the
* sample widget as the device is actually embedded in the
* palmrest! */
- if (cd_sensor_get_embedded (priv->sensor))
+ if (cd_sensor_get_embedded (calibrate->sensor))
{
g_debug ("Making sample window larger for embedded sensor");
- gtk_widget_set_size_request (priv->sample_widget, 1000, 600);
+ gtk_widget_set_size_request (calibrate->sample_widget, 1000, 600);
}
/* set the generic label too */
- label = GTK_LABEL (gtk_builder_get_object (priv->builder,
+ label = GTK_LABEL (gtk_builder_get_object (calibrate->builder,
"label_status"));
/* TRANSLATORS: The user has to be careful not to knock the
* display off the screen (although we do cope if this is
@@ -608,7 +602,7 @@ cc_color_calibrate_cancel (CcColorCalibrate *calibrate)
GError *error = NULL;
/* cancel the calibration to ensure the helper quits */
- retval = g_dbus_proxy_call_sync (calibrate->priv->proxy_helper,
+ retval = g_dbus_proxy_call_sync (calibrate->proxy_helper,
"Cancel",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -622,7 +616,7 @@ cc_color_calibrate_cancel (CcColorCalibrate *calibrate)
}
/* return */
- g_main_loop_quit (calibrate->priv->loop);
+ g_main_loop_quit (calibrate->loop);
if (retval != NULL)
g_variant_unref (retval);
}
@@ -700,7 +694,7 @@ cc_color_calibrate_window_state_cb (GtkWidget *widget,
/* resize to the correct screen */
ret = cc_color_calibrate_move_and_resize_window (window,
- calibrate->priv->device,
+ calibrate->device,
&error);
if (!ret)
{
@@ -714,27 +708,26 @@ static void
cc_color_calibrate_button_done_cb (GtkWidget *widget,
CcColorCalibrate *calibrate)
{
- g_main_loop_quit (calibrate->priv->loop);
+ g_main_loop_quit (calibrate->loop);
}
static void
cc_color_calibrate_button_start_cb (GtkWidget *widget,
CcColorCalibrate *calibrate)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
GError *error = NULL;
GVariant *retval;
/* set correct buttons */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_start"));
gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_resume"));
gtk_widget_set_visible (widget, FALSE);
/* continue */
- retval = g_dbus_proxy_call_sync (calibrate->priv->proxy_helper,
+ retval = g_dbus_proxy_call_sync (calibrate->proxy_helper,
"Resume",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -791,20 +784,19 @@ cc_color_calibrate_alpha_screen_changed_cb (GtkWindow *window,
static void
cc_color_calibrate_uninhibit (CcColorCalibrate *calibrate)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
GtkApplication *application;
- if (priv->inhibit_fd != -1)
+ if (calibrate->inhibit_fd != -1)
{
- close (priv->inhibit_fd);
- priv->inhibit_fd = -1;
+ close (calibrate->inhibit_fd);
+ calibrate->inhibit_fd = -1;
}
- if (priv->inhibit_cookie != 0)
+ if (calibrate->inhibit_cookie != 0)
{
application = GTK_APPLICATION (g_application_get_default ());
- gtk_application_uninhibit (application, priv->inhibit_cookie);
- priv->inhibit_cookie = 0;
+ gtk_application_uninhibit (application, calibrate->inhibit_cookie);
+ calibrate->inhibit_cookie = 0;
}
}
@@ -816,11 +808,10 @@ cc_color_calibrate_inhibit (CcColorCalibrate *calibrate, GtkWindow *window)
GUnixFDList *fd_list = NULL;
GVariant *retval;
GtkApplication *application;
- CcColorCalibratePrivate *priv = calibrate->priv;
/* inhibit basically everything we can */
application = GTK_APPLICATION (g_application_get_default ());
- priv->inhibit_cookie = gtk_application_inhibit (application,
+ calibrate->inhibit_cookie = gtk_application_inhibit (application,
window,
GTK_APPLICATION_INHIBIT_LOGOUT |
GTK_APPLICATION_INHIBIT_SWITCH |
@@ -829,7 +820,7 @@ cc_color_calibrate_inhibit (CcColorCalibrate *calibrate, GtkWindow *window)
"Display calibration in progress");
/* tell logind to disallow the lid switch */
- retval = g_dbus_proxy_call_with_unix_fd_list_sync (priv->proxy_inhibit,
+ retval = g_dbus_proxy_call_with_unix_fd_list_sync (calibrate->proxy_inhibit,
"Inhibit",
g_variant_new ("(ssss)",
"shutdown:"
@@ -852,14 +843,14 @@ cc_color_calibrate_inhibit (CcColorCalibrate *calibrate, GtkWindow *window)
goto out;
}
g_variant_get (retval, "(h)", &idx);
- priv->inhibit_fd = g_unix_fd_list_get (fd_list, idx, &error);
- if (priv->inhibit_fd == -1)
+ calibrate->inhibit_fd = g_unix_fd_list_get (fd_list, idx, &error);
+ if (calibrate->inhibit_fd == -1)
{
g_warning ("Failed to receive system inhibitor fd: %s", error->message);
g_error_free (error);
goto out;
}
- g_debug ("System inhibitor fd is %d", priv->inhibit_fd);
+ g_debug ("System inhibitor fd is %d", calibrate->inhibit_fd);
out:
if (fd_list != NULL)
g_object_unref (fd_list);
@@ -871,14 +862,13 @@ gboolean
cc_color_calibrate_setup (CcColorCalibrate *calibrate,
GError **error)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
gboolean ret = TRUE;
- g_return_val_if_fail (CC_IS_COLOR_CALIB (calibrate), FALSE);
- g_return_val_if_fail (calibrate->priv->device_kind != CD_SENSOR_CAP_UNKNOWN, FALSE);
+ g_return_val_if_fail (CC_IS_COLOR_CALIBRATE (calibrate), FALSE);
+ g_return_val_if_fail (calibrate->device_kind != CD_SENSOR_CAP_UNKNOWN, FALSE);
/* use logind to disable system state idle */
- priv->proxy_inhibit = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ calibrate->proxy_inhibit = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.login1",
@@ -886,14 +876,14 @@ cc_color_calibrate_setup (CcColorCalibrate *calibrate,
"org.freedesktop.login1.Manager",
NULL,
error);
- if (priv->proxy_inhibit == NULL)
+ if (calibrate->proxy_inhibit == NULL)
{
ret = FALSE;
goto out;
}
/* start the calibration session daemon */
- priv->proxy_helper = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ calibrate->proxy_helper = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
CD_SESSION_DBUS_SERVICE,
@@ -901,16 +891,16 @@ cc_color_calibrate_setup (CcColorCalibrate *calibrate,
CD_SESSION_DBUS_INTERFACE_DISPLAY,
NULL,
error);
- if (priv->proxy_helper == NULL)
+ if (calibrate->proxy_helper == NULL)
{
ret = FALSE;
goto out;
}
- g_signal_connect (priv->proxy_helper,
+ g_signal_connect (calibrate->proxy_helper,
"g-properties-changed",
G_CALLBACK (cc_color_calibrate_property_changed_cb),
calibrate);
- g_signal_connect (priv->proxy_helper,
+ g_signal_connect (calibrate->proxy_helper,
"g-signal",
G_CALLBACK (cc_color_calibrate_signal_cb),
calibrate);
@@ -923,7 +913,6 @@ cc_color_calibrate_start (CcColorCalibrate *calibrate,
GtkWindow *parent,
GError **error)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
const gchar *name;
gboolean ret;
GtkWidget *widget;
@@ -931,10 +920,10 @@ cc_color_calibrate_start (CcColorCalibrate *calibrate,
GVariantBuilder builder;
GVariant *retval = NULL;
- g_return_val_if_fail (CC_IS_COLOR_CALIB (calibrate), FALSE);
+ g_return_val_if_fail (CC_IS_COLOR_CALIBRATE (calibrate), FALSE);
/* get screen */
- name = cd_device_get_metadata_item (priv->device,
+ name = cd_device_get_metadata_item (calibrate->device,
CD_DEVICE_METADATA_XRANDR_NAME);
ret = cc_color_calibrate_calib_setup_screen (calibrate, name, error);
if (!ret)
@@ -944,28 +933,28 @@ cc_color_calibrate_start (CcColorCalibrate *calibrate,
g_variant_builder_add (&builder,
"{sv}",
"Quality",
- g_variant_new_uint32 (priv->quality));
+ g_variant_new_uint32 (calibrate->quality));
g_variant_builder_add (&builder,
"{sv}",
"Whitepoint",
- g_variant_new_uint32 (priv->target_whitepoint));
+ g_variant_new_uint32 (calibrate->target_whitepoint));
g_variant_builder_add (&builder,
"{sv}",
"Gamma",
- g_variant_new_double (priv->target_gamma));
+ g_variant_new_double (calibrate->target_gamma));
g_variant_builder_add (&builder,
"{sv}",
"Title",
- g_variant_new_string (priv->title));
+ g_variant_new_string (calibrate->title));
g_variant_builder_add (&builder,
"{sv}",
"DeviceKind",
- g_variant_new_uint32 (priv->device_kind));
- retval = g_dbus_proxy_call_sync (priv->proxy_helper,
+ g_variant_new_uint32 (calibrate->device_kind));
+ retval = g_dbus_proxy_call_sync (calibrate->proxy_helper,
"Start",
g_variant_new ("(ssa{sv})",
- cd_device_get_id (priv->device),
- cd_sensor_get_id (priv->sensor),
+ cd_device_get_id (calibrate->device),
+ cd_sensor_get_id (calibrate->sensor),
&builder),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -978,36 +967,36 @@ cc_color_calibrate_start (CcColorCalibrate *calibrate,
}
/* set this above our parent */
- window = GTK_WINDOW (gtk_builder_get_object (priv->builder,
+ window = GTK_WINDOW (gtk_builder_get_object (calibrate->builder,
"dialog_calibrate"));
gtk_window_set_modal (window, TRUE);
gtk_widget_show (GTK_WIDGET (window));
/* show correct buttons */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_cancel"));
gtk_widget_set_visible (widget, TRUE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_start"));
gtk_widget_set_visible (widget, TRUE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_resume"));
gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_done"));
gtk_widget_set_visible (widget, FALSE);
/* stop the computer from auto-suspending or turning off the screen */
cc_color_calibrate_inhibit (calibrate, parent);
- g_main_loop_run (priv->loop);
+ g_main_loop_run (calibrate->loop);
gtk_widget_hide (GTK_WIDGET (window));
/* we can go idle now */
cc_color_calibrate_uninhibit (calibrate);
/* see if we failed */
- if (calibrate->priv->session_error_code != CD_SESSION_ERROR_NONE)
+ if (calibrate->session_error_code != CD_SESSION_ERROR_NONE)
{
ret = FALSE;
g_set_error_literal (error,
@@ -1035,17 +1024,16 @@ static void
cc_color_calibrate_finalize (GObject *object)
{
CcColorCalibrate *calibrate = CC_COLOR_CALIBRATE (object);
- CcColorCalibratePrivate *priv = calibrate->priv;
-
- g_clear_pointer (&priv->window, gtk_widget_destroy);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->device);
- g_clear_object (&priv->proxy_helper);
- g_clear_object (&priv->proxy_inhibit);
- g_clear_object (&priv->sensor);
- g_clear_object (&priv->x11_screen);
- g_free (priv->title);
- g_main_loop_unref (priv->loop);
+
+ g_clear_pointer (&calibrate->window, gtk_widget_destroy);
+ g_clear_object (&calibrate->builder);
+ g_clear_object (&calibrate->device);
+ g_clear_object (&calibrate->proxy_helper);
+ g_clear_object (&calibrate->proxy_inhibit);
+ g_clear_object (&calibrate->sensor);
+ g_clear_object (&calibrate->x11_screen);
+ g_free (calibrate->title);
+ g_main_loop_unref (calibrate->loop);
G_OBJECT_CLASS (cc_color_calibrate_parent_class)->finalize (object);
}
@@ -1055,14 +1043,11 @@ cc_color_calibrate_class_init (CcColorCalibrateClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = cc_color_calibrate_finalize;
-
- g_type_class_add_private (klass, sizeof (CcColorCalibratePrivate));
}
static void
cc_color_calibrate_init (CcColorCalibrate *calibrate)
{
- CcColorCalibratePrivate *priv = calibrate->priv;
GError *error = NULL;
gint retval;
GSettings *settings;
@@ -1070,13 +1055,12 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
GtkWidget *widget;
GtkWindow *window;
- calibrate->priv = priv = CC_COLOR_CALIBRATE_GET_PRIVATE (calibrate);
- calibrate->priv->loop = g_main_loop_new (NULL, FALSE);
- calibrate->priv->inhibit_fd = -1;
+ calibrate->loop = g_main_loop_new (NULL, FALSE);
+ calibrate->inhibit_fd = -1;
/* load UI */
- priv->builder = gtk_builder_new ();
- retval = gtk_builder_add_from_resource (priv->builder,
+ calibrate->builder = gtk_builder_new ();
+ retval = gtk_builder_add_from_resource (calibrate->builder,
"/org/gnome/control-center/color/color-calibrate.ui",
&error);
if (retval == 0)
@@ -1086,42 +1070,42 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
}
/* add sample widget */
- box = GTK_BOX (gtk_builder_get_object (priv->builder,
+ box = GTK_BOX (gtk_builder_get_object (calibrate->builder,
"vbox_status"));
- priv->sample_widget = cd_sample_widget_new ();
- gtk_widget_set_size_request (priv->sample_widget, 400, 400);
- gtk_box_pack_start (box, priv->sample_widget, FALSE, FALSE, 0);
- gtk_box_reorder_child (box, priv->sample_widget, 0);
- gtk_widget_set_vexpand (priv->sample_widget, FALSE);
- gtk_widget_set_hexpand (priv->sample_widget, FALSE);
+ calibrate->sample_widget = cd_sample_widget_new ();
+ gtk_widget_set_size_request (calibrate->sample_widget, 400, 400);
+ gtk_box_pack_start (box, calibrate->sample_widget, FALSE, FALSE, 0);
+ gtk_box_reorder_child (box, calibrate->sample_widget, 0);
+ gtk_widget_set_vexpand (calibrate->sample_widget, FALSE);
+ gtk_widget_set_hexpand (calibrate->sample_widget, FALSE);
/* get defaults */
settings = g_settings_new (COLORD_SETTINGS_SCHEMA);
- calibrate->priv->target_whitepoint = g_settings_get_int (settings, "display-whitepoint");
- calibrate->priv->target_gamma = g_settings_get_double (settings, "display-gamma");
+ calibrate->target_whitepoint = g_settings_get_int (settings, "display-whitepoint");
+ calibrate->target_gamma = g_settings_get_double (settings, "display-gamma");
g_object_unref (settings);
/* connect to buttons */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_start"));
g_signal_connect (widget, "clicked",
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_resume"));
g_signal_connect (widget, "clicked",
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_done"));
g_signal_connect (widget, "clicked",
G_CALLBACK (cc_color_calibrate_button_done_cb), calibrate);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
"button_cancel"));
g_signal_connect (widget, "clicked",
G_CALLBACK (cc_color_calibrate_button_cancel_cb), calibrate);
gtk_widget_show (widget);
/* setup the specialist calibration window */
- window = GTK_WINDOW (gtk_builder_get_object (priv->builder,
+ window = GTK_WINDOW (gtk_builder_get_object (calibrate->builder,
"dialog_calibrate"));
g_signal_connect (window, "draw",
G_CALLBACK (cc_color_calibrate_alpha_window_draw), calibrate);
@@ -1136,7 +1120,7 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
cc_color_calibrate_alpha_screen_changed_cb (GTK_WINDOW (window), NULL, calibrate);
g_signal_connect (window, "screen-changed",
G_CALLBACK (cc_color_calibrate_alpha_screen_changed_cb), calibrate);
- priv->window = window;
+ calibrate->window = window;
}
CcColorCalibrate *
diff --git a/panels/color/cc-color-calibrate.h b/panels/color/cc-color-calibrate.h
index d834c7957..4fb6d3749 100644
--- a/panels/color/cc-color-calibrate.h
+++ b/panels/color/cc-color-calibrate.h
@@ -28,30 +28,10 @@
G_BEGIN_DECLS
-#define CC_TYPE_COLOR_CALIBRATE (cc_color_calibrate_get_type ())
-#define CC_COLOR_CALIBRATE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_COLOR_CALIBRATE, CcColorCalibrate))
-#define CC_COLOR_CALIBRATE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CC_TYPE_COLOR_CALIBRATE, CcColorCalibrateClass))
-#define CC_IS_COLOR_CALIB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_COLOR_CALIBRATE))
-#define CC_IS_COLOR_CALIB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_COLOR_CALIBRATE))
-#define CC_COLOR_CALIBRATE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_COLOR_CALIBRATE, CcColorCalibrateClass))
-
-typedef struct _CcColorCalibratePrivate CcColorCalibratePrivate;
-typedef struct _CcColorCalibrate CcColorCalibrate;
-typedef struct _CcColorCalibrateClass CcColorCalibrateClass;
-
-struct _CcColorCalibrate
-{
- GObject parent;
- CcColorCalibratePrivate *priv;
-};
-
-struct _CcColorCalibrateClass
-{
- GObjectClass parent_class;
-};
+#define CC_TYPE_COLOR_CALIBRATE (cc_color_calibrate_get_type ())
+G_DECLARE_FINAL_TYPE (CcColorCalibrate, cc_color_calibrate, CC, COLOR_CALIBRATE, GObject)
CcColorCalibrate *cc_color_calibrate_new (void);
-GType cc_color_calibrate_get_type (void);
void cc_color_calibrate_set_kind (CcColorCalibrate *calibrate,
CdSensorCap kind);
void cc_color_calibrate_set_temperature (CcColorCalibrate *calibrate,
diff --git a/panels/color/cc-color-cell-renderer-text.c b/panels/color/cc-color-cell-renderer-text.c
index 265eeff66..8e64ecfe7 100644
--- a/panels/color/cc-color-cell-renderer-text.c
+++ b/panels/color/cc-color-cell-renderer-text.c
@@ -31,6 +31,13 @@ enum {
PROP_LAST
};
+struct _CcColorCellRendererText
+{
+ GtkCellRendererText parent_instance;
+
+ gboolean is_dim_label;
+};
+
G_DEFINE_TYPE (CcColorCellRendererText, cc_color_cell_renderer_text, GTK_TYPE_CELL_RENDERER_TEXT)
static gpointer parent_class = NULL;
diff --git a/panels/color/cc-color-cell-renderer-text.h b/panels/color/cc-color-cell-renderer-text.h
index b79d3ca1e..f30936173 100644
--- a/panels/color/cc-color-cell-renderer-text.h
+++ b/panels/color/cc-color-cell-renderer-text.h
@@ -24,31 +24,10 @@
#include <gtk/gtk.h>
-#define CC_COLOR_TYPE_CELL_RENDERER_TEXT (cc_color_cell_renderer_text_get_type())
-#define CC_COLOR_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CC_COLOR_TYPE_CELL_RENDERER_TEXT, CcColorCellRendererText))
-#define CC_COLOR_CELL_RENDERER_TEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), CC_COLOR_TYPE_CELL_RENDERER_TEXT, CcColorCellRendererTextClass))
-#define CC_COLOR_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CC_COLOR_TYPE_CELL_RENDERER_TEXT))
-#define CC_COLOR_IS_CELL_RENDERER_TEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), CC_COLOR_TYPE_CELL_RENDERER_TEXT))
-#define CC_COLOR_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CC_COLOR_TYPE_CELL_RENDERER_TEXT, CcColorCellRendererTextClass))
+#define CC_COLOR_TYPE_CELL_RENDERER_TEXT (cc_color_cell_renderer_text_get_type ())
+G_DECLARE_FINAL_TYPE (CcColorCellRendererText, cc_color_cell_renderer_text, CC_COLOR, CELL_RENDERER_TEXT, GtkCellRendererText)
-G_BEGIN_DECLS
-
-typedef struct _CcColorCellRendererText CcColorCellRendererText;
-typedef struct _CcColorCellRendererTextClass CcColorCellRendererTextClass;
-
-struct _CcColorCellRendererText
-{
- GtkCellRendererText parent;
- gboolean is_dim_label;
-};
-
-struct _CcColorCellRendererTextClass
-{
- GtkCellRendererTextClass parent_class;
-};
-
-GType cc_color_cell_renderer_text_get_type (void);
-GtkCellRenderer *cc_color_cell_renderer_text_new (void);
+GtkCellRenderer *cc_color_cell_renderer_text_new (void);
G_END_DECLS
diff --git a/panels/color/cc-color-device.c b/panels/color/cc-color-device.c
index b31a8260f..2d1223086 100644
--- a/panels/color/cc-color-device.c
+++ b/panels/color/cc-color-device.c
@@ -27,8 +27,10 @@
#include "cc-color-common.h"
#include "cc-color-device.h"
-struct _CcColorDevicePrivate
+struct _CcColorDevice
{
+ GtkListBoxRow parent_instance;
+
CdDevice *device;
gboolean expanded;
gchar *sortable;
@@ -60,38 +62,37 @@ static guint signals [SIGNAL_LAST] = { 0 };
static void
cc_color_device_refresh (CcColorDevice *color_device)
{
- CcColorDevicePrivate *priv = color_device->priv;
gchar *title = NULL;
GPtrArray *profiles = NULL;
AtkObject *accessible;
gchar *name = NULL;
/* add switch and expander if there are profiles, otherwise use a label */
- profiles = cd_device_get_profiles (priv->device);
+ profiles = cd_device_get_profiles (color_device->device);
if (profiles == NULL)
goto out;
- title = cc_color_device_get_title (priv->device);
- gtk_label_set_label (GTK_LABEL (priv->widget_description), title);
- gtk_widget_set_visible (priv->widget_description, TRUE);
+ title = cc_color_device_get_title (color_device->device);
+ gtk_label_set_label (GTK_LABEL (color_device->widget_description), title);
+ gtk_widget_set_visible (color_device->widget_description, TRUE);
- gtk_widget_set_visible (priv->widget_switch, profiles->len > 0);
- gtk_widget_set_visible (priv->widget_button, profiles->len > 0);
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->widget_arrow),
- priv->expanded ? "pan-down-symbolic" : "pan-end-symbolic",
+ gtk_widget_set_visible (color_device->widget_switch, profiles->len > 0);
+ gtk_widget_set_visible (color_device->widget_button, profiles->len > 0);
+ gtk_image_set_from_icon_name (GTK_IMAGE (color_device->widget_arrow),
+ color_device->expanded ? "pan-down-symbolic" : "pan-end-symbolic",
GTK_ICON_SIZE_BUTTON);
- gtk_widget_set_visible (priv->widget_nocalib, profiles->len == 0);
- gtk_widget_set_sensitive (priv->widget_button, cd_device_get_enabled (priv->device));
- gtk_switch_set_active (GTK_SWITCH (priv->widget_switch),
- cd_device_get_enabled (priv->device));
+ gtk_widget_set_visible (color_device->widget_nocalib, profiles->len == 0);
+ gtk_widget_set_sensitive (color_device->widget_button, cd_device_get_enabled (color_device->device));
+ gtk_switch_set_active (GTK_SWITCH (color_device->widget_switch),
+ cd_device_get_enabled (color_device->device));
- accessible = gtk_widget_get_accessible (priv->widget_switch);
+ accessible = gtk_widget_get_accessible (color_device->widget_switch);
name = g_strdup_printf (_("Enable color management for %s"), title);
atk_object_set_name (accessible, name);
g_free (name);
name = g_strdup_printf (_("Show color profiles for %s"), title);
- accessible = gtk_widget_get_accessible (priv->widget_button);
+ accessible = gtk_widget_get_accessible (color_device->widget_button);
atk_object_set_name (accessible, name);
g_free (name);
@@ -105,14 +106,14 @@ CdDevice *
cc_color_device_get_device (CcColorDevice *color_device)
{
g_return_val_if_fail (CC_IS_COLOR_DEVICE (color_device), NULL);
- return color_device->priv->device;
+ return color_device->device;
}
const gchar *
cc_color_device_get_sortable (CcColorDevice *color_device)
{
g_return_val_if_fail (CC_IS_COLOR_DEVICE (color_device), NULL);
- return color_device->priv->sortable;
+ return color_device->sortable;
}
static void
@@ -123,7 +124,7 @@ cc_color_device_get_property (GObject *object, guint param_id,
switch (param_id)
{
case PROP_DEVICE:
- g_value_set_object (value, color_device->priv->device);
+ g_value_set_object (value, color_device->device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -140,7 +141,7 @@ cc_color_device_set_property (GObject *object, guint param_id,
switch (param_id)
{
case PROP_DEVICE:
- color_device->priv->device = g_value_dup_object (value);
+ color_device->device = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -152,13 +153,12 @@ static void
cc_color_device_finalize (GObject *object)
{
CcColorDevice *color_device = CC_COLOR_DEVICE (object);
- CcColorDevicePrivate *priv = color_device->priv;
- if (priv->device_changed_id > 0)
- g_signal_handler_disconnect (priv->device, priv->device_changed_id);
+ if (color_device->device_changed_id > 0)
+ g_signal_handler_disconnect (color_device->device, color_device->device_changed_id);
- g_free (priv->sortable);
- g_object_unref (priv->device);
+ g_free (color_device->sortable);
+ g_object_unref (color_device->device);
G_OBJECT_CLASS (cc_color_device_parent_class)->finalize (object);
}
@@ -167,17 +167,15 @@ void
cc_color_device_set_expanded (CcColorDevice *color_device,
gboolean expanded)
{
- CcColorDevicePrivate *priv = color_device->priv;
-
/* same as before */
- if (priv->expanded == expanded)
+ if (color_device->expanded == expanded)
return;
/* refresh */
- priv->expanded = expanded;
+ color_device->expanded = expanded;
g_signal_emit (color_device,
signals[SIGNAL_EXPANDED_CHANGED], 0,
- priv->expanded);
+ color_device->expanded);
cc_color_device_refresh (color_device);
}
@@ -187,14 +185,13 @@ cc_color_device_notify_enable_device_cb (GtkSwitch *sw,
gpointer user_data)
{
CcColorDevice *color_device = CC_COLOR_DEVICE (user_data);
- CcColorDevicePrivate *priv = color_device->priv;
gboolean enable;
gboolean ret;
GError *error = NULL;
enable = gtk_switch_get_active (sw);
- g_debug ("Set %s to %i", cd_device_get_id (priv->device), enable);
- ret = cd_device_set_enabled_sync (priv->device,
+ g_debug ("Set %s to %i", cd_device_get_id (color_device->device), enable);
+ ret = cd_device_set_enabled_sync (color_device->device,
enable, NULL, &error);
if (!ret)
{
@@ -218,25 +215,24 @@ static void
cc_color_device_constructed (GObject *object)
{
CcColorDevice *color_device = CC_COLOR_DEVICE (object);
- CcColorDevicePrivate *priv = color_device->priv;
gchar *sortable_tmp;
/* watch the device for changes */
- priv->device_changed_id =
- g_signal_connect (priv->device, "changed",
+ color_device->device_changed_id =
+ g_signal_connect (color_device->device, "changed",
G_CALLBACK (cc_color_device_changed_cb), color_device);
/* calculate sortable -- FIXME: we have to hack this as EggListBox
* does not let us specify a GtkSortType:
* https://bugzilla.gnome.org/show_bug.cgi?id=691341 */
- sortable_tmp = cc_color_device_get_sortable_base (priv->device);
- priv->sortable = g_strdup_printf ("%sXX", sortable_tmp);
+ sortable_tmp = cc_color_device_get_sortable_base (color_device->device);
+ color_device->sortable = g_strdup_printf ("%sXX", sortable_tmp);
g_free (sortable_tmp);
cc_color_device_refresh (color_device);
/* watch to see if the user flicked the switch */
- g_signal_connect (priv->widget_switch, "notify::active",
+ g_signal_connect (color_device->widget_switch, "notify::active",
G_CALLBACK (cc_color_device_notify_enable_device_cb),
color_device);
}
@@ -259,11 +255,9 @@ cc_color_device_class_init (CcColorDeviceClass *klass)
signals [SIGNAL_EXPANDED_CHANGED] =
g_signal_new ("expanded-changed",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CcColorDeviceClass, expanded_changed),
+ 0,
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
- g_type_class_add_private (klass, sizeof (CcColorDevicePrivate));
}
static void
@@ -271,60 +265,54 @@ cc_color_device_clicked_expander_cb (GtkButton *button,
gpointer user_data)
{
CcColorDevice *color_device = CC_COLOR_DEVICE (user_data);
- color_device->priv->expanded = !color_device->priv->expanded;
+ color_device->expanded = !color_device->expanded;
cc_color_device_refresh (color_device);
g_signal_emit (color_device, signals[SIGNAL_EXPANDED_CHANGED], 0,
- color_device->priv->expanded);
+ color_device->expanded);
}
static void
cc_color_device_init (CcColorDevice *color_device)
{
- CcColorDevicePrivate *priv;
GtkStyleContext *context;
GtkWidget *box;
- color_device->priv = G_TYPE_INSTANCE_GET_PRIVATE (color_device,
- CC_TYPE_COLOR_DEVICE,
- CcColorDevicePrivate);
- priv = color_device->priv;
-
/* description */
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 9);
- priv->widget_description = gtk_label_new ("");
- gtk_widget_set_margin_start (priv->widget_description, 20);
- gtk_widget_set_margin_top (priv->widget_description, 12);
- gtk_widget_set_margin_bottom (priv->widget_description, 12);
- gtk_widget_set_halign (priv->widget_description, GTK_ALIGN_START);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_description, TRUE, TRUE, 0);
+ color_device->widget_description = gtk_label_new ("");
+ gtk_widget_set_margin_start (color_device->widget_description, 20);
+ gtk_widget_set_margin_top (color_device->widget_description, 12);
+ gtk_widget_set_margin_bottom (color_device->widget_description, 12);
+ gtk_widget_set_halign (color_device->widget_description, GTK_ALIGN_START);
+ gtk_box_pack_start (GTK_BOX (box), color_device->widget_description, TRUE, TRUE, 0);
/* switch */
- priv->widget_switch = gtk_switch_new ();
- gtk_widget_set_valign (priv->widget_switch, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_switch, FALSE, FALSE, 0);
+ color_device->widget_switch = gtk_switch_new ();
+ gtk_widget_set_valign (color_device->widget_switch, GTK_ALIGN_CENTER);
+ gtk_box_pack_start (GTK_BOX (box), color_device->widget_switch, FALSE, FALSE, 0);
/* arrow button */
- priv->widget_arrow = gtk_image_new_from_icon_name ("pan-end-symbolic",
+ color_device->widget_arrow = gtk_image_new_from_icon_name ("pan-end-symbolic",
GTK_ICON_SIZE_BUTTON);
- priv->widget_button = gtk_button_new ();
- g_signal_connect (priv->widget_button, "clicked",
+ color_device->widget_button = gtk_button_new ();
+ g_signal_connect (color_device->widget_button, "clicked",
G_CALLBACK (cc_color_device_clicked_expander_cb),
color_device);
- gtk_widget_set_valign (priv->widget_button, GTK_ALIGN_CENTER);
- gtk_button_set_relief (GTK_BUTTON (priv->widget_button), GTK_RELIEF_NONE);
- gtk_container_add (GTK_CONTAINER (priv->widget_button), priv->widget_arrow);
- gtk_widget_set_visible (priv->widget_arrow, TRUE);
- gtk_widget_set_margin_top (priv->widget_button, 9);
- gtk_widget_set_margin_bottom (priv->widget_button, 9);
- gtk_widget_set_margin_end (priv->widget_button, 12);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_button, FALSE, FALSE, 0);
+ gtk_widget_set_valign (color_device->widget_button, GTK_ALIGN_CENTER);
+ gtk_button_set_relief (GTK_BUTTON (color_device->widget_button), GTK_RELIEF_NONE);
+ gtk_container_add (GTK_CONTAINER (color_device->widget_button), color_device->widget_arrow);
+ gtk_widget_set_visible (color_device->widget_arrow, TRUE);
+ gtk_widget_set_margin_top (color_device->widget_button, 9);
+ gtk_widget_set_margin_bottom (color_device->widget_button, 9);
+ gtk_widget_set_margin_end (color_device->widget_button, 12);
+ gtk_box_pack_start (GTK_BOX (box), color_device->widget_button, FALSE, FALSE, 0);
/* not calibrated */
- priv->widget_nocalib = gtk_label_new (_("Not calibrated"));
- context = gtk_widget_get_style_context (priv->widget_nocalib);
+ color_device->widget_nocalib = gtk_label_new (_("Not calibrated"));
+ context = gtk_widget_get_style_context (color_device->widget_nocalib);
gtk_style_context_add_class (context, "dim-label");
- gtk_widget_set_margin_end (priv->widget_nocalib, 18);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_nocalib, FALSE, FALSE, 0);
+ gtk_widget_set_margin_end (color_device->widget_nocalib, 18);
+ gtk_box_pack_start (GTK_BOX (box), color_device->widget_nocalib, FALSE, FALSE, 0);
/* refresh */
gtk_container_add (GTK_CONTAINER (color_device), box);
diff --git a/panels/color/cc-color-device.h b/panels/color/cc-color-device.h
index 7976d5b2f..736dcbd33 100644
--- a/panels/color/cc-color-device.h
+++ b/panels/color/cc-color-device.h
@@ -25,35 +25,11 @@
#include <gtk/gtk.h>
#include <colord.h>
-#define CC_TYPE_COLOR_DEVICE (cc_color_device_get_type())
-#define CC_COLOR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CC_TYPE_COLOR_DEVICE, CcColorDevice))
-#define CC_COLOR_DEVICE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), CC_TYPE_COLOR_DEVICE, CcColorDeviceClass))
-#define CC_IS_COLOR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CC_TYPE_COLOR_DEVICE))
-#define CC_IS_COLOR_DEVICE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), CC_TYPE_COLOR_DEVICE))
-#define CC_COLOR_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CC_TYPE_COLOR_DEVICE, CcColorDeviceClass))
-
G_BEGIN_DECLS
-typedef struct _CcColorDevice CcColorDevice;
-typedef struct _CcColorDeviceClass CcColorDeviceClass;
-typedef struct _CcColorDevicePrivate CcColorDevicePrivate;
-
-struct _CcColorDevice
-{
- GtkListBoxRow parent;
-
- /*< private >*/
- CcColorDevicePrivate *priv;
-};
-
-struct _CcColorDeviceClass
-{
- GtkListBoxRowClass parent_class;
- void (*expanded_changed) (CcColorDevice *color_device,
- gboolean expanded);
-};
+#define CC_TYPE_COLOR_DEVICE (cc_color_device_get_type ())
+G_DECLARE_FINAL_TYPE (CcColorDevice, cc_color_device, CC, COLOR_DEVICE, GtkListBoxRow)
-GType cc_color_device_get_type (void);
GtkWidget *cc_color_device_new (CdDevice *device);
CdDevice *cc_color_device_get_device (CcColorDevice *color_device);
const gchar *cc_color_device_get_sortable (CcColorDevice *color_device);
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 2bbe41a50..d4117c581 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -37,13 +37,10 @@
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
-CC_PANEL_REGISTER (CcColorPanel, cc_color_panel)
-
-#define COLOR_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_COLOR_PANEL, CcColorPanelPrivate))
-
-struct _CcColorPanelPrivate
+struct _CcColorPanel
{
+ CcPanel parent_instance;
+
CdClient *client;
CdDevice *current_device;
GPtrArray *devices;
@@ -66,6 +63,8 @@ struct _CcColorPanelPrivate
gboolean model_is_changing;
};
+CC_PANEL_REGISTER (CcColorPanel, cc_color_panel)
+
enum {
GCM_PREFS_COMBO_COLUMN_TEXT,
GCM_PREFS_COMBO_COLUMN_PROFILE,
@@ -166,7 +165,7 @@ gcm_prefs_combobox_add_profile (CcColorPanel *prefs,
#endif
escaped = g_markup_escape_text (string->str, -1);
- list_store = GTK_LIST_STORE(gtk_builder_get_object (prefs->priv->builder,
+ list_store = GTK_LIST_STORE(gtk_builder_get_object (prefs->builder,
"liststore_assign"));
gtk_list_store_append (list_store, iter);
gtk_list_store_set (list_store, iter,
@@ -185,16 +184,15 @@ gcm_prefs_default_cb (GtkWidget *widget, CcColorPanel *prefs)
CdProfile *profile;
gboolean ret;
GError *error = NULL;
- CcColorPanelPrivate *priv = prefs->priv;
/* TODO: check if the profile is already systemwide */
- profile = cd_device_get_default_profile (priv->current_device);
+ profile = cd_device_get_default_profile (prefs->current_device);
if (profile == NULL)
goto out;
/* install somewhere out of $HOME */
ret = cd_profile_install_system_wide_sync (profile,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -215,10 +213,9 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
GtkWidget *dialog;
GFile *file = NULL;
GtkFileFilter *filter;
- CcColorPanelPrivate *priv = prefs->priv;
/* create new dialog */
- window = GTK_WINDOW (priv->dialog_assign);
+ window = GTK_WINDOW (prefs->dialog_assign);
/* TRANSLATORS: an ICC profile is a file containing colorspace data */
dialog = gtk_file_chooser_dialog_new (_("Select ICC Profile File"), window,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -258,7 +255,7 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
static void
gcm_prefs_calib_cancel_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- gtk_widget_hide (prefs->priv->assistant_calib);
+ gtk_widget_hide (prefs->assistant_calib);
}
static gboolean
@@ -268,8 +265,8 @@ gcm_prefs_calib_delayed_complete_cb (gpointer user_data)
GtkAssistant *assistant;
GtkWidget *widget;
- assistant = GTK_ASSISTANT (panel->priv->assistant_calib);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ assistant = GTK_ASSISTANT (panel->assistant_calib);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"box_calib_brightness"));
gtk_assistant_set_page_complete (assistant, widget, TRUE);
return FALSE;
@@ -285,7 +282,7 @@ gcm_prefs_calib_prepare_cb (GtkAssistant *assistant,
/* give the user the indication they should actually manually set the
* desired brightness rather than clicking blindly by delaying the
* "Next" button deliberately for a second or so */
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"box_calib_brightness"));
if (widget == page)
{
@@ -306,10 +303,10 @@ gcm_prefs_calib_apply_cb (GtkWidget *widget, CcColorPanel *prefs)
GtkWindow *window = NULL;
/* setup the calibration object with items that can fail */
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_calib_upload"));
gtk_widget_show (widget);
- ret = cc_color_calibrate_setup (prefs->priv->calibrate,
+ ret = cc_color_calibrate_setup (prefs->calibrate,
&error);
if (!ret)
{
@@ -319,8 +316,8 @@ gcm_prefs_calib_apply_cb (GtkWidget *widget, CcColorPanel *prefs)
}
/* actually start the calibration */
- window = GTK_WINDOW (prefs->priv->assistant_calib);
- ret = cc_color_calibrate_start (prefs->priv->calibrate,
+ window = GTK_WINDOW (prefs->assistant_calib);
+ ret = cc_color_calibrate_start (prefs->calibrate,
window,
&error);
if (!ret)
@@ -333,7 +330,7 @@ gcm_prefs_calib_apply_cb (GtkWidget *widget, CcColorPanel *prefs)
/* if we are a LiveCD then don't close the window as there is another
* summary pane with the export button */
- if (!prefs->priv->is_live_cd)
+ if (!prefs->is_live_cd)
gtk_widget_hide (GTK_WIDGET (window));
out:
return;
@@ -353,7 +350,6 @@ static void
gcm_prefs_calib_temp_treeview_clicked_cb (GtkTreeSelection *selection,
CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
gboolean ret;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -363,8 +359,8 @@ gcm_prefs_calib_temp_treeview_clicked_cb (GtkTreeSelection *selection,
/* check to see if anything is selected */
ret = gtk_tree_selection_get_selected (selection, &model, &iter);
- assistant = GTK_ASSISTANT (prefs->priv->assistant_calib);
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ assistant = GTK_ASSISTANT (prefs->assistant_calib);
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_temp"));
gtk_assistant_set_page_complete (assistant, widget, ret);
if (!ret)
@@ -373,14 +369,13 @@ gcm_prefs_calib_temp_treeview_clicked_cb (GtkTreeSelection *selection,
gtk_tree_model_get (model, &iter,
COLUMN_CALIB_TEMP_VALUE_K, &target_whitepoint,
-1);
- cc_color_calibrate_set_temperature (priv->calibrate, target_whitepoint);
+ cc_color_calibrate_set_temperature (prefs->calibrate, target_whitepoint);
}
static void
gcm_prefs_calib_kind_treeview_clicked_cb (GtkTreeSelection *selection,
CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdSensorCap device_kind;
gboolean ret;
GtkTreeIter iter;
@@ -390,8 +385,8 @@ gcm_prefs_calib_kind_treeview_clicked_cb (GtkTreeSelection *selection,
/* check to see if anything is selected */
ret = gtk_tree_selection_get_selected (selection, &model, &iter);
- assistant = GTK_ASSISTANT (prefs->priv->assistant_calib);
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ assistant = GTK_ASSISTANT (prefs->assistant_calib);
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_kind"));
gtk_assistant_set_page_complete (assistant, widget, ret);
if (!ret)
@@ -401,14 +396,13 @@ gcm_prefs_calib_kind_treeview_clicked_cb (GtkTreeSelection *selection,
gtk_tree_model_get (model, &iter,
COLUMN_CALIB_KIND_CAP_VALUE, &device_kind,
-1);
- cc_color_calibrate_set_kind (priv->calibrate, device_kind);
+ cc_color_calibrate_set_kind (prefs->calibrate, device_kind);
}
static void
gcm_prefs_calib_quality_treeview_clicked_cb (GtkTreeSelection *selection,
CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdProfileQuality quality;
gboolean ret;
GtkAssistant *assistant;
@@ -418,8 +412,8 @@ gcm_prefs_calib_quality_treeview_clicked_cb (GtkTreeSelection *selection,
/* check to see if anything is selected */
ret = gtk_tree_selection_get_selected (selection, &model, &iter);
- assistant = GTK_ASSISTANT (prefs->priv->assistant_calib);
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ assistant = GTK_ASSISTANT (prefs->assistant_calib);
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_quality"));
gtk_assistant_set_page_complete (assistant, widget, ret);
if (!ret)
@@ -429,7 +423,7 @@ gcm_prefs_calib_quality_treeview_clicked_cb (GtkTreeSelection *selection,
gtk_tree_model_get (model, &iter,
COLUMN_CALIB_QUALITY_VALUE, &quality,
-1);
- cc_color_calibrate_set_quality (priv->calibrate, quality);
+ cc_color_calibrate_set_quality (prefs->calibrate, quality);
}
static gboolean
@@ -470,24 +464,23 @@ static void
gcm_prefs_calib_set_sensor (CcColorPanel *prefs,
CdSensor *sensor)
{
- CcColorPanelPrivate *priv = prefs->priv;
GtkTreeModel *model;
GtkWidget *page;
guint64 caps;
guint8 i;
/* use this sensor for calibration */
- cc_color_calibrate_set_sensor (priv->calibrate, sensor);
+ cc_color_calibrate_set_sensor (prefs->calibrate, sensor);
/* hide display types the sensor does not support */
- model = GTK_TREE_MODEL (gtk_builder_get_object (priv->builder,
+ model = GTK_TREE_MODEL (gtk_builder_get_object (prefs->builder,
"liststore_calib_kind"));
gtk_tree_model_foreach (model,
gcm_prefs_calib_set_sensor_cap_supported_cb,
sensor);
/* if the sensor only supports one kind then do not show the panel at all */
- page = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ page = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_kind"));
caps = cd_sensor_get_caps (sensor);
if (_cd_bitfield_popcount (caps) == 1)
@@ -496,12 +489,12 @@ gcm_prefs_calib_set_sensor (CcColorPanel *prefs,
for (i = 0; i < CD_SENSOR_CAP_LAST; i++)
{
if (cd_bitfield_contain (caps, i))
- cc_color_calibrate_set_kind (priv->calibrate, i);
+ cc_color_calibrate_set_kind (prefs->calibrate, i);
}
}
else
{
- cc_color_calibrate_set_kind (priv->calibrate, CD_SENSOR_CAP_UNKNOWN);
+ cc_color_calibrate_set_kind (prefs->calibrate, CD_SENSOR_CAP_UNKNOWN);
gtk_widget_set_visible (page, TRUE);
}
}
@@ -519,8 +512,8 @@ gcm_prefs_calib_sensor_treeview_clicked_cb (GtkTreeSelection *selection,
/* check to see if anything is selected */
ret = gtk_tree_selection_get_selected (selection, &model, &iter);
- assistant = GTK_ASSISTANT (prefs->priv->assistant_calib);
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ assistant = GTK_ASSISTANT (prefs->assistant_calib);
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_sensor"));
gtk_assistant_set_page_complete (assistant, widget, ret);
if (!ret)
@@ -537,7 +530,6 @@ gcm_prefs_calib_sensor_treeview_clicked_cb (GtkTreeSelection *selection,
static void
gcm_prefs_calibrate_display (CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdSensor *sensor_tmp;
const gchar *tmp;
GtkListStore *liststore;
@@ -547,19 +539,19 @@ gcm_prefs_calibrate_display (CcColorPanel *prefs)
guint i;
/* set target device */
- cc_color_calibrate_set_device (priv->calibrate, priv->current_device);
+ cc_color_calibrate_set_device (prefs->calibrate, prefs->current_device);
/* add sensors to list */
- liststore = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ liststore = GTK_LIST_STORE (gtk_builder_get_object (prefs->builder,
"liststore_calib_sensor"));
gtk_list_store_clear (liststore);
- page = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ page = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_sensor"));
- if (priv->sensors->len > 1)
+ if (prefs->sensors->len > 1)
{
- for (i = 0; i < priv->sensors->len; i++)
+ for (i = 0; i < prefs->sensors->len; i++)
{
- sensor_tmp = g_ptr_array_index (priv->sensors, i);
+ sensor_tmp = g_ptr_array_index (prefs->sensors, i);
gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter,
COLUMN_CALIB_SENSOR_OBJECT, sensor_tmp,
@@ -570,29 +562,29 @@ gcm_prefs_calibrate_display (CcColorPanel *prefs)
}
else
{
- sensor_tmp = g_ptr_array_index (priv->sensors, 0);
+ sensor_tmp = g_ptr_array_index (prefs->sensors, 0);
gcm_prefs_calib_set_sensor (prefs, sensor_tmp);
gtk_widget_set_visible (page, FALSE);
}
/* set default profile title */
- tmp = cd_device_get_model (priv->current_device);
+ tmp = cd_device_get_model (prefs->current_device);
if (tmp == NULL)
- tmp = cd_device_get_vendor (priv->current_device);
+ tmp = cd_device_get_vendor (prefs->current_device);
if (tmp == NULL)
tmp = _("Screen");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"entry_calib_title"));
gtk_entry_set_text (GTK_ENTRY (widget), tmp);
- cc_color_calibrate_set_title (priv->calibrate, tmp);
+ cc_color_calibrate_set_title (prefs->calibrate, tmp);
/* set the display whitepoint to D65 by default */
//FIXME?
/* show ui */
- widget = GTK_WIDGET (priv->assistant_calib);
+ widget = GTK_WIDGET (prefs->assistant_calib);
gtk_window_set_transient_for (GTK_WINDOW (widget),
- GTK_WINDOW (priv->main_window));
+ GTK_WINDOW (prefs->main_window));
gtk_widget_show (widget);
}
@@ -605,11 +597,11 @@ gcm_prefs_title_entry_changed_cb (GtkWidget *widget,
GtkWidget *page;
const gchar *value;
- assistant = GTK_ASSISTANT (prefs->priv->assistant_calib);
- page = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ assistant = GTK_ASSISTANT (prefs->assistant_calib);
+ page = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_title"));
value = gtk_entry_get_text (GTK_ENTRY (widget));
- cc_color_calibrate_set_title (prefs->priv->calibrate, value);
+ cc_color_calibrate_set_title (prefs->calibrate, value);
gtk_assistant_set_page_complete (assistant, page, value[0] != '\0');
}
@@ -620,23 +612,22 @@ gcm_prefs_calibrate_cb (GtkWidget *widget, CcColorPanel *prefs)
GError *error = NULL;
guint xid;
GPtrArray *argv;
- CcColorPanelPrivate *priv = prefs->priv;
/* use the new-style calibration helper */
- if (cd_device_get_kind (priv->current_device) == CD_DEVICE_KIND_DISPLAY)
+ if (cd_device_get_kind (prefs->current_device) == CD_DEVICE_KIND_DISPLAY)
{
gcm_prefs_calibrate_display (prefs);
return;
}
/* get xid */
- xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (priv->main_window)));
+ xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (prefs->main_window)));
/* run with modal set */
argv = g_ptr_array_new_with_free_func (g_free);
g_ptr_array_add (argv, g_build_filename (BINDIR, "gcm-calibrate", NULL));
g_ptr_array_add (argv, g_strdup ("--device"));
- g_ptr_array_add (argv, g_strdup (cd_device_get_id (priv->current_device)));
+ g_ptr_array_add (argv, g_strdup (cd_device_get_id (prefs->current_device)));
g_ptr_array_add (argv, g_strdup ("--parent-window"));
g_ptr_array_add (argv, g_strdup_printf ("%i", xid));
g_ptr_array_add (argv, NULL);
@@ -765,9 +756,8 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
GtkListStore *list_store;
GtkWidget *widget;
guint i;
- CcColorPanelPrivate *priv = prefs->priv;
- list_store = GTK_LIST_STORE(gtk_builder_get_object (prefs->priv->builder,
+ list_store = GTK_LIST_STORE(gtk_builder_get_object (prefs->builder,
"liststore_assign"));
gtk_list_store_clear (list_store);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
@@ -778,13 +768,13 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
gcm_prefs_combo_sort_func_cb,
list_store, NULL);
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_assign_warning"));
gtk_widget_hide (widget);
/* get profiles */
- profile_array = cd_client_get_profiles_sync (priv->client,
- priv->cancellable,
+ profile_array = cd_client_get_profiles_sync (prefs->client,
+ prefs->cancellable,
&error);
if (profile_array == NULL)
{
@@ -801,7 +791,7 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
/* get properties */
ret = cd_profile_connect_sync (profile_tmp,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -819,7 +809,7 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
/* only add correct types */
ret = gcm_prefs_is_profile_suitable_for_device (profile_tmp,
- priv->current_device);
+ prefs->current_device);
if (!ret)
continue;
@@ -842,7 +832,6 @@ out:
static void
gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdProfile *profile;
const gchar *uri;
gboolean ret;
@@ -857,7 +846,7 @@ gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
SoupMultipart *multipart = NULL;
SoupSession *session = NULL;
- profile = cc_color_calibrate_get_profile (prefs->priv->calibrate);
+ profile = cc_color_calibrate_get_profile (prefs->calibrate);
ret = cd_profile_connect_sync (profile, NULL, &error);
if (!ret)
{
@@ -897,12 +886,12 @@ gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
cd_profile_get_filename (profile),
NULL,
buffer);
- upload_uri = g_settings_get_string (priv->settings_colord, "profile-upload-uri");
+ upload_uri = g_settings_get_string (prefs->settings_colord, "profile-upload-uri");
msg = soup_form_request_new_from_multipart (upload_uri, multipart);
status_code = soup_session_send_message (session, msg);
if (status_code != 201)
{
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_calib_upload_location"));
/* TRANSLATORS: this is when the upload of the profile failed */
msg_result = g_strdup_printf (_("Failed to upload file: %s"), msg->reason_phrase),
@@ -912,7 +901,7 @@ gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
}
/* show instructions to the user */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_calib_upload_location"));
uri = soup_message_headers_get_one (msg->response_headers, "Location");
msg_result = g_strdup_printf ("%s %s\n\n• %s\n• %s\n• %s",
@@ -928,7 +917,7 @@ gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
gtk_widget_show (widget);
/* hide the upload button as duplicate uploads will fail */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_calib_upload"));
gtk_widget_hide (widget);
out:
@@ -958,14 +947,14 @@ gcm_prefs_calib_export_cb (GtkWidget *widget, CcColorPanel *prefs)
/* TRANSLATORS: this is the dialog to save the ICC profile */
dialog = gtk_file_chooser_dialog_new (_("Save Profile"),
- GTK_WINDOW (prefs->priv->main_window),
+ GTK_WINDOW (prefs->main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
- profile = cc_color_calibrate_get_profile (prefs->priv->calibrate);
+ profile = cc_color_calibrate_get_profile (prefs->calibrate);
ret = cd_profile_connect_sync (profile, NULL, &error);
if (!ret)
{
@@ -1008,7 +997,7 @@ gcm_prefs_calib_export_link_cb (GtkLabel *widget,
const gchar *url,
CcColorPanel *prefs)
{
- gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (prefs->priv->main_window)),
+ gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (prefs->main_window)),
"help:gnome-help/color-howtoimport",
GDK_CURRENT_TIME, NULL);
}
@@ -1017,21 +1006,20 @@ static void
gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
{
GPtrArray *profiles;
- CcColorPanelPrivate *priv = prefs->priv;
/* add profiles of the right kind */
- profiles = cd_device_get_profiles (priv->current_device);
+ profiles = cd_device_get_profiles (prefs->current_device);
gcm_prefs_add_profiles_suitable_for_devices (prefs, profiles);
/* make insensitve until we have a selection */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_assign_ok"));
gtk_widget_set_sensitive (widget, FALSE);
/* show the dialog */
- widget = GTK_WIDGET (priv->dialog_assign);
+ widget = GTK_WIDGET (prefs->dialog_assign);
gtk_widget_show (widget);
- gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (priv->main_window));
+ gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (prefs->main_window));
if (profiles != NULL)
g_ptr_array_unref (profiles);
}
@@ -1039,14 +1027,13 @@ gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
static void
gcm_prefs_profile_remove_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdProfile *profile;
gboolean ret = FALSE;
GError *error = NULL;
GtkListBoxRow *row;
/* get the selected profile */
- row = gtk_list_box_get_selected_row (priv->list_box);
+ row = gtk_list_box_get_selected_row (prefs->list_box);
if (row == NULL)
return;
profile = cc_color_profile_get_profile (CC_COLOR_PROFILE (row));
@@ -1057,9 +1044,9 @@ gcm_prefs_profile_remove_cb (GtkWidget *widget, CcColorPanel *prefs)
}
/* just remove it, the list store will get ::changed */
- ret = cd_device_remove_profile_sync (priv->current_device,
+ ret = cd_device_remove_profile_sync (prefs->current_device,
profile,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -1096,12 +1083,11 @@ gcm_prefs_make_profile_default_cb (GObject *object,
static void
gcm_prefs_device_profile_enable_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdProfile *profile;
GtkListBoxRow *row;
/* get the selected profile */
- row = gtk_list_box_get_selected_row (priv->list_box);
+ row = gtk_list_box_get_selected_row (prefs->list_box);
if (row == NULL)
return;
profile = cc_color_profile_get_profile (CC_COLOR_PROFILE (row));
@@ -1114,10 +1100,10 @@ gcm_prefs_device_profile_enable_cb (GtkWidget *widget, CcColorPanel *prefs)
/* just set it default */
g_debug ("setting %s default on %s",
cd_profile_get_id (profile),
- cd_device_get_id (priv->current_device));
- cd_device_make_profile_default (priv->current_device,
+ cd_device_get_id (prefs->current_device));
+ cd_device_make_profile_default (prefs->current_device,
profile,
- priv->cancellable,
+ prefs->cancellable,
(GAsyncReadyCallback) gcm_prefs_make_profile_default_cb,
prefs);
}
@@ -1129,10 +1115,9 @@ gcm_prefs_profile_view (CcColorPanel *prefs, CdProfile *profile)
guint xid;
gboolean ret;
GError *error = NULL;
- CcColorPanelPrivate *priv = prefs->priv;
/* get xid */
- xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (priv->main_window)));
+ xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (prefs->main_window)));
/* open up gcm-viewer as a info pane */
argv = g_ptr_array_new_with_free_func (g_free);
@@ -1158,12 +1143,11 @@ gcm_prefs_profile_assign_link_activate_cb (GtkLabel *label,
const gchar *uri,
CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdProfile *profile;
GtkListBoxRow *row;
/* get the selected profile */
- row = gtk_list_box_get_selected_row (priv->list_box);
+ row = gtk_list_box_get_selected_row (prefs->list_box);
if (row == NULL)
return;
profile = cc_color_profile_get_profile (CC_COLOR_PROFILE (row));
@@ -1184,7 +1168,7 @@ gcm_prefs_profile_view_cb (GtkWidget *widget, CcColorPanel *prefs)
GtkListBoxRow *row;
/* get the selected profile */
- row = gtk_list_box_get_selected_row (prefs->priv->list_box);
+ row = gtk_list_box_get_selected_row (prefs->list_box);
if (row == NULL)
return;
profile = cc_color_profile_get_profile (CC_COLOR_PROFILE (row));
@@ -1201,8 +1185,7 @@ gcm_prefs_profile_view_cb (GtkWidget *widget, CcColorPanel *prefs)
static void
gcm_prefs_button_assign_cancel_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
- gtk_widget_hide (priv->dialog_assign);
+ gtk_widget_hide (prefs->dialog_assign);
}
static void
@@ -1214,14 +1197,13 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
gboolean ret = FALSE;
GError *error = NULL;
GtkTreeSelection *selection;
- CcColorPanelPrivate *priv = prefs->priv;
/* hide window */
- widget = GTK_WIDGET (priv->dialog_assign);
+ widget = GTK_WIDGET (prefs->dialog_assign);
gtk_widget_hide (widget);
/* get the selected profile */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_assign"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -1237,11 +1219,11 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
/* if the device is disabled, enable the device so that we can
* add color profiles to it */
- if (!cd_device_get_enabled (priv->current_device))
+ if (!cd_device_get_enabled (prefs->current_device))
{
- ret = cd_device_set_enabled_sync (priv->current_device,
+ ret = cd_device_set_enabled_sync (prefs->current_device,
TRUE,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -1252,10 +1234,10 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
}
/* just add it, the list store will get ::changed */
- ret = cd_device_add_profile_sync (priv->current_device,
+ ret = cd_device_add_profile_sync (prefs->current_device,
CD_DEVICE_RELATION_HARD,
profile,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -1265,9 +1247,9 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
}
/* make it default */
- cd_device_make_profile_default (priv->current_device,
+ cd_device_make_profile_default (prefs->current_device,
profile,
- priv->cancellable,
+ prefs->cancellable,
(GAsyncReadyCallback) gcm_prefs_make_profile_default_cb,
prefs);
out:
@@ -1318,22 +1300,21 @@ gcm_prefs_set_calibrate_button_sensitivity (CcColorPanel *prefs)
const gchar *tooltip;
CdDeviceKind kind;
CdSensor *sensor_tmp;
- CcColorPanelPrivate *priv = prefs->priv;
/* TRANSLATORS: this is when the button is sensitive */
tooltip = _("Create a color profile for the selected device");
/* no device selected */
- if (priv->current_device == NULL)
+ if (prefs->current_device == NULL)
goto out;
/* are we a display */
- kind = cd_device_get_kind (priv->current_device);
+ kind = cd_device_get_kind (prefs->current_device);
if (kind == CD_DEVICE_KIND_DISPLAY)
{
/* find whether we have hardware installed */
- if (priv->sensors == NULL || priv->sensors->len == 0)
+ if (prefs->sensors == NULL || prefs->sensors->len == 0)
{
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("The measuring instrument is not detected. Please check it is turned on and correctly connected.");
@@ -1357,7 +1338,7 @@ gcm_prefs_set_calibrate_button_sensitivity (CcColorPanel *prefs)
{
/* find whether we have hardware installed */
- if (priv->sensors == NULL || priv->sensors->len == 0)
+ if (prefs->sensors == NULL || prefs->sensors->len == 0)
{
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("The measuring instrument is not detected. Please check it is turned on and correctly connected.");
@@ -1365,7 +1346,7 @@ gcm_prefs_set_calibrate_button_sensitivity (CcColorPanel *prefs)
}
/* find whether we have hardware installed */
- sensor_tmp = g_ptr_array_index (priv->sensors, 0);
+ sensor_tmp = g_ptr_array_index (prefs->sensors, 0);
ret = cd_sensor_has_cap (sensor_tmp, CD_SENSOR_CAP_PRINTER);
if (!ret)
{
@@ -1385,7 +1366,7 @@ gcm_prefs_set_calibrate_button_sensitivity (CcColorPanel *prefs)
}
out:
/* control the tooltip and sensitivity of the button */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_device_calibrate"));
gtk_widget_set_tooltip_text (widget, tooltip);
gtk_widget_set_sensitive (widget, ret);
@@ -1407,14 +1388,13 @@ gcm_prefs_profile_clicked (CcColorPanel *prefs, CdProfile *profile, CdDevice *de
{
GtkWidget *widget;
gchar *s;
- CcColorPanelPrivate *priv = prefs->priv;
/* get profile */
g_debug ("selected profile = %s",
cd_profile_get_filename (profile));
/* allow getting profile info */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_profile_view"));
if (cd_profile_get_filename (profile) != NULL &&
(s = g_find_program_in_path ("gcm-viewer")) != NULL)
@@ -1447,12 +1427,12 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection,
/* as soon as anything is selected, make the Add button sensitive */
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_assign_ok"));
gtk_widget_set_sensitive (widget, TRUE);
/* is the profile faulty */
- widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_assign_warning"));
#if CD_CHECK_VERSION(0,1,25)
warnings = cd_profile_get_warnings (profile);
@@ -1486,21 +1466,20 @@ gcm_prefs_button_assign_import_cb (GtkWidget *widget,
GFile *file = NULL;
GError *error = NULL;
CdProfile *profile = NULL;
- CcColorPanelPrivate *priv = prefs->priv;
file = gcm_prefs_file_chooser_get_icc_profile (prefs);
if (file == NULL)
{
g_warning ("failed to get ICC file");
- widget = GTK_WIDGET (priv->dialog_assign);
+ widget = GTK_WIDGET (prefs->dialog_assign);
gtk_widget_hide (widget);
goto out;
}
#if CD_CHECK_VERSION(0,1,12)
- profile = cd_client_import_profile_sync (priv->client,
+ profile = cd_client_import_profile_sync (prefs->client,
file,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (profile == NULL)
{
@@ -1522,7 +1501,6 @@ out:
static void
gcm_prefs_sensor_coldplug (CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdSensor *sensor_tmp;
gboolean ret;
GError *error = NULL;
@@ -1530,10 +1508,10 @@ gcm_prefs_sensor_coldplug (CcColorPanel *prefs)
guint i;
/* unref old */
- g_clear_pointer (&priv->sensors, g_ptr_array_unref);
+ g_clear_pointer (&prefs->sensors, g_ptr_array_unref);
/* no present */
- sensors = cd_client_get_sensors_sync (priv->client, NULL, &error);
+ sensors = cd_client_get_sensors_sync (prefs->client, NULL, &error);
if (sensors == NULL)
{
g_warning ("%s", error->message);
@@ -1544,7 +1522,7 @@ gcm_prefs_sensor_coldplug (CcColorPanel *prefs)
goto out;
/* save a copy of the sensor list */
- priv->sensors = g_ptr_array_ref (sensors);
+ prefs->sensors = g_ptr_array_ref (sensors);
/* connect to each sensor */
for (i = 0; i < sensors->len; i++)
@@ -1578,14 +1556,13 @@ gcm_prefs_add_device_profile (CcColorPanel *prefs,
CdProfile *profile,
gboolean is_default)
{
- CcColorPanelPrivate *priv = prefs->priv;
gboolean ret;
GError *error = NULL;
GtkWidget *widget;
/* get properties */
ret = cd_profile_connect_sync (profile,
- priv->cancellable,
+ prefs->cancellable,
&error);
if (!ret)
{
@@ -1614,8 +1591,8 @@ gcm_prefs_add_device_profile (CcColorPanel *prefs,
/* add to listbox */
widget = cc_color_profile_new (device, profile, is_default);
gtk_widget_show (widget);
- gtk_container_add (GTK_CONTAINER (priv->list_box), widget);
- gtk_size_group_add_widget (priv->list_box_size, widget);
+ gtk_container_add (GTK_CONTAINER (prefs->list_box), widget);
+ gtk_size_group_add_widget (prefs->list_box_size, widget);
out:
return;
}
@@ -1695,7 +1672,6 @@ gcm_prefs_find_widget_by_object_path (GList *list,
static void
gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdDevice *device_tmp;
CdProfile *profile_tmp;
gboolean ret;
@@ -1706,7 +1682,7 @@ gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
/* remove anything in the list view that's not in Device.Profiles */
profiles = cd_device_get_profiles (device);
- list = gtk_container_get_children (GTK_CONTAINER (priv->list_box));
+ list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
for (l = list; l != NULL; l = l->next)
{
if (!CC_IS_COLOR_PROFILE (l->data))
@@ -1742,7 +1718,7 @@ gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
g_list_free (list);
/* resort */
- gtk_list_box_invalidate_sort (priv->list_box);
+ gtk_list_box_invalidate_sort (prefs->list_box);
}
static void
@@ -1750,22 +1726,21 @@ gcm_prefs_device_expanded_changed_cb (CcColorDevice *widget,
gboolean is_expanded,
CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
GList *l;
GList *list;
/* ignore internal changes */
- if (prefs->priv->model_is_changing)
+ if (prefs->model_is_changing)
return;
- g_free (prefs->priv->list_box_filter);
+ g_free (prefs->list_box_filter);
if (is_expanded)
{
- priv->list_box_filter = g_strdup (cd_device_get_id (cc_color_device_get_device (widget)));
+ prefs->list_box_filter = g_strdup (cd_device_get_id (cc_color_device_get_device (widget)));
/* unexpand other device widgets */
- list = gtk_container_get_children (GTK_CONTAINER (priv->list_box));
- prefs->priv->model_is_changing = TRUE;
+ list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
+ prefs->model_is_changing = TRUE;
for (l = list; l != NULL; l = l->next)
{
if (!CC_IS_COLOR_DEVICE (l->data))
@@ -1773,26 +1748,25 @@ gcm_prefs_device_expanded_changed_cb (CcColorDevice *widget,
if (l->data != widget)
cc_color_device_set_expanded (CC_COLOR_DEVICE (l->data), FALSE);
}
- prefs->priv->model_is_changing = FALSE;
+ prefs->model_is_changing = FALSE;
g_list_free (list);
}
else
{
- priv->list_box_filter = NULL;
+ prefs->list_box_filter = NULL;
}
- gtk_list_box_invalidate_filter (priv->list_box);
+ gtk_list_box_invalidate_filter (prefs->list_box);
}
static void
gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
{
- CcColorPanelPrivate *priv = prefs->priv;
gboolean ret;
GError *error = NULL;
GtkWidget *widget;
/* get device properties */
- ret = cd_device_connect_sync (device, priv->cancellable, &error);
+ ret = cd_device_connect_sync (device, prefs->cancellable, &error);
if (!ret)
{
g_warning ("failed to connect to the device: %s", error->message);
@@ -1805,17 +1779,17 @@ gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
g_signal_connect (widget, "expanded-changed",
G_CALLBACK (gcm_prefs_device_expanded_changed_cb), prefs);
gtk_widget_show (widget);
- gtk_container_add (GTK_CONTAINER (priv->list_box), widget);
- gtk_size_group_add_widget (priv->list_box_size, widget);
+ gtk_container_add (GTK_CONTAINER (prefs->list_box), widget);
+ gtk_size_group_add_widget (prefs->list_box_size, widget);
/* add profiles */
gcm_prefs_add_device_profiles (prefs, device);
/* watch for changes */
- g_ptr_array_add (priv->devices, g_object_ref (device));
+ g_ptr_array_add (prefs->devices, g_object_ref (device));
g_signal_connect (device, "changed",
G_CALLBACK (gcm_prefs_device_changed_cb), prefs);
- gtk_list_box_invalidate_sort (priv->list_box);
+ gtk_list_box_invalidate_sort (prefs->list_box);
out:
return;
}
@@ -1823,12 +1797,11 @@ out:
static void
gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *device)
{
- CcColorPanelPrivate *priv = prefs->priv;
CdDevice *device_tmp;
GList *l;
GList *list;
- list = gtk_container_get_children (GTK_CONTAINER (priv->list_box));
+ list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
for (l = list; l != NULL; l = l->next)
{
if (CC_IS_COLOR_DEVICE (l->data))
@@ -1845,24 +1818,23 @@ gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *device)
g_signal_handlers_disconnect_by_func (device,
G_CALLBACK (gcm_prefs_device_changed_cb),
prefs);
- g_ptr_array_remove (priv->devices, device);
+ g_ptr_array_remove (prefs->devices, device);
}
static void
gcm_prefs_update_device_list_extra_entry (CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv = prefs->priv;
GList *device_widgets;
GtkWidget *widget;
guint number_of_devices;
/* any devices to show? */
- device_widgets = gtk_container_get_children (GTK_CONTAINER (priv->list_box));
+ device_widgets = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
number_of_devices = g_list_length (device_widgets);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_no_devices"));
gtk_widget_set_visible (widget, number_of_devices == 0);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"vbox3"));
gtk_widget_set_visible (widget, number_of_devices > 0);
@@ -1943,62 +1915,61 @@ gcm_prefs_refresh_toolbar_buttons (CcColorPanel *panel)
{
CdProfile *profile = NULL;
GtkWidget *widget;
- CcColorPanelPrivate *priv = panel->priv;
GtkListBoxRow *row;
gboolean is_device;
/* get the selected profile */
- row = gtk_list_box_get_selected_row (priv->list_box);
+ row = gtk_list_box_get_selected_row (panel->list_box);
is_device = CC_IS_COLOR_DEVICE (row);
/* nothing selected */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbar_devices"));
gtk_widget_set_visible (widget, row != NULL);
if (row == NULL)
return;
/* save current device */
- if (priv->current_device != NULL)
- g_object_unref (priv->current_device);
- g_object_get (row, "device", &priv->current_device, NULL);
+ if (panel->current_device != NULL)
+ g_object_unref (panel->current_device);
+ g_object_get (row, "device", &panel->current_device, NULL);
/* device actions */
g_debug ("%s selected", is_device ? "device" : "profile");
if (CC_IS_COLOR_DEVICE (row))
{
- gcm_prefs_device_clicked (panel, priv->current_device);
+ gcm_prefs_device_clicked (panel, panel->current_device);
cc_color_device_set_expanded (CC_COLOR_DEVICE (row), TRUE);
}
else if (CC_IS_COLOR_PROFILE (row))
{
profile = cc_color_profile_get_profile (CC_COLOR_PROFILE (row));
- gcm_prefs_profile_clicked (panel, profile, priv->current_device);
+ gcm_prefs_profile_clicked (panel, profile, panel->current_device);
}
else
g_assert_not_reached ();
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_device_default"));
gtk_widget_set_visible (widget, !is_device && cc_color_profile_get_is_default (CC_COLOR_PROFILE (row)));
if (profile)
gtk_widget_set_sensitive (widget, !cd_profile_get_is_system_wide (profile));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_device_enable"));
gtk_widget_set_visible (widget, !is_device && !cc_color_profile_get_is_default (CC_COLOR_PROFILE (row)));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_device_calibrate"));
gtk_widget_set_visible (widget, is_device);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_profile_add"));
gtk_widget_set_visible (widget, is_device);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_profile_view"));
gtk_widget_set_visible (widget, !is_device);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"toolbutton_profile_remove"));
gtk_widget_set_visible (widget, !is_device);
}
@@ -2019,7 +1990,6 @@ gcm_prefs_connect_cb (GObject *object,
GAsyncResult *res,
gpointer user_data)
{
- CcColorPanelPrivate *priv;
CcColorPanel *prefs;
gboolean ret;
GError *error = NULL;
@@ -2040,15 +2010,14 @@ gcm_prefs_connect_cb (GObject *object,
* the user can potentially already have changed to another panel, effectively
* making user_data invalid. */
prefs = CC_COLOR_PANEL (user_data);
- priv = prefs->priv;
/* set calibrate button sensitivity */
gcm_prefs_sensor_coldplug (prefs);
/* get devices */
- cd_client_get_devices (priv->client,
- priv->cancellable,
+ cd_client_get_devices (prefs->client,
+ prefs->cancellable,
gcm_prefs_get_devices_cb,
prefs);
}
@@ -2087,7 +2056,7 @@ out:
static void
gcm_prefs_window_realize_cb (GtkWidget *widget, CcColorPanel *prefs)
{
- prefs->priv->main_window = gtk_widget_get_toplevel (widget);
+ prefs->main_window = gtk_widget_get_toplevel (widget);
}
static const char *
@@ -2125,50 +2094,50 @@ cc_color_panel_set_property (GObject *object,
static void
cc_color_panel_dispose (GObject *object)
{
- CcColorPanelPrivate *priv = CC_COLOR_PANEL (object)->priv;
+ CcColorPanel *prefs = CC_COLOR_PANEL (object);
CdDevice *device;
guint i;
/* stop the EggListView from firing when it gets disposed */
- if (priv->list_box_selected_id != 0)
+ if (prefs->list_box_selected_id != 0)
{
- g_signal_handler_disconnect (priv->list_box,
- priv->list_box_selected_id);
- priv->list_box_selected_id = 0;
+ g_signal_handler_disconnect (prefs->list_box,
+ prefs->list_box_selected_id);
+ prefs->list_box_selected_id = 0;
/* row-activated event should be connected at this point */
- g_signal_handler_disconnect (priv->list_box,
- priv->list_box_activated_id);
- priv->list_box_activated_id = 0;
+ g_signal_handler_disconnect (prefs->list_box,
+ prefs->list_box_activated_id);
+ prefs->list_box_activated_id = 0;
}
/* stop the devices from emitting after the ListBox has been disposed */
- if (priv->devices != NULL)
+ if (prefs->devices != NULL)
{
- for (i = 0; i < priv->devices->len; i++)
+ for (i = 0; i < prefs->devices->len; i++)
{
- device = g_ptr_array_index (priv->devices, i);
+ device = g_ptr_array_index (prefs->devices, i);
g_signal_handlers_disconnect_by_func (device,
G_CALLBACK (gcm_prefs_device_changed_cb),
CC_COLOR_PANEL (object));
}
- g_ptr_array_unref (priv->devices);
- priv->devices = NULL;
+ g_ptr_array_unref (prefs->devices);
+ prefs->devices = NULL;
}
- if (priv->cancellable != NULL)
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->settings);
- g_clear_object (&priv->settings_colord);
- g_clear_object (&priv->cancellable);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->client);
- g_clear_object (&priv->current_device);
- g_clear_object (&priv->calibrate);
- g_clear_object (&priv->list_box_size);
- g_clear_pointer (&priv->sensors, g_ptr_array_unref);
- g_clear_pointer (&priv->list_box_filter, g_free);
- g_clear_pointer (&priv->dialog_assign, gtk_widget_destroy);
+ if (prefs->cancellable != NULL)
+ g_cancellable_cancel (prefs->cancellable);
+ g_clear_object (&prefs->settings);
+ g_clear_object (&prefs->settings_colord);
+ g_clear_object (&prefs->cancellable);
+ g_clear_object (&prefs->builder);
+ g_clear_object (&prefs->client);
+ g_clear_object (&prefs->current_device);
+ g_clear_object (&prefs->calibrate);
+ g_clear_object (&prefs->list_box_size);
+ g_clear_pointer (&prefs->sensors, g_ptr_array_unref);
+ g_clear_pointer (&prefs->list_box_filter, g_free);
+ g_clear_pointer (&prefs->dialog_assign, gtk_widget_destroy);
G_OBJECT_CLASS (cc_color_panel_parent_class)->dispose (object);
}
@@ -2185,8 +2154,6 @@ cc_color_panel_class_init (CcColorPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcColorPanelPrivate));
-
panel_class->get_help_uri = cc_color_panel_get_help_uri;
object_class->get_property = cc_color_panel_get_property;
@@ -2229,7 +2196,7 @@ cc_color_panel_filter_func (GtkListBoxRow *row, void *user_data)
return TRUE;
g_object_get (row, "device", &device, NULL);
- ret = g_strcmp0 (cd_device_get_id (device), prefs->priv->list_box_filter) == 0;
+ ret = g_strcmp0 (cd_device_get_id (device), prefs->list_box_filter) == 0;
g_object_unref (device);
return ret;
}
@@ -2254,7 +2221,6 @@ cc_color_panel_treeview_quality_default_cb (GtkTreeModel *model,
static void
cc_color_panel_init (CcColorPanel *prefs)
{
- CcColorPanelPrivate *priv;
GError *error = NULL;
GtkCellRenderer *renderer;
GtkStyleContext *context;
@@ -2264,11 +2230,10 @@ cc_color_panel_init (CcColorPanel *prefs)
GtkTreeViewColumn *column;
GtkWidget *widget;
- priv = prefs->priv = COLOR_PANEL_PRIVATE (prefs);
g_resources_register (cc_color_get_resource ());
- priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (priv->builder,
+ prefs->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (prefs->builder,
"/org/gnome/control-center/color/color.ui",
&error);
@@ -2279,39 +2244,39 @@ cc_color_panel_init (CcColorPanel *prefs)
return;
}
- priv->cancellable = g_cancellable_new ();
- priv->devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ prefs->cancellable = g_cancellable_new ();
+ prefs->devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
/* can do native display calibration using colord-session */
- priv->calibrate = cc_color_calibrate_new ();
- cc_color_calibrate_set_quality (priv->calibrate, CD_PROFILE_QUALITY_MEDIUM);
+ prefs->calibrate = cc_color_calibrate_new ();
+ cc_color_calibrate_set_quality (prefs->calibrate, CD_PROFILE_QUALITY_MEDIUM);
/* setup defaults */
- priv->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
- priv->settings_colord = g_settings_new (COLORD_SETTINGS_SCHEMA);
+ prefs->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
+ prefs->settings_colord = g_settings_new (COLORD_SETTINGS_SCHEMA);
/* assign buttons */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_profile_add"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_profile_add_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_profile_remove"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_profile_remove_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_profile_view"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_profile_view_cb), prefs);
/* href */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_assign_warning"));
g_signal_connect (widget, "activate-link",
G_CALLBACK (gcm_prefs_profile_assign_link_activate_cb), prefs);
/* add columns to profile tree view */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_assign"));
gcm_prefs_add_profiles_columns (prefs, GTK_TREE_VIEW (widget));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
@@ -2322,49 +2287,49 @@ cc_color_panel_init (CcColorPanel *prefs)
G_CALLBACK (gcm_prefs_profiles_row_activated_cb),
prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_device_default"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_default_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_device_enable"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_device_profile_enable_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbutton_device_calibrate"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_calibrate_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"toolbar_devices"));
context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
/* set up assign dialog */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"dialog_assign"));
g_signal_connect (widget, "delete-event",
G_CALLBACK (gcm_prefs_profile_delete_event_cb), prefs);
- priv->dialog_assign = widget;
+ prefs->dialog_assign = widget;
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_assign_cancel"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_button_assign_cancel_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_assign_ok"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_button_assign_ok_cb), prefs);
/* setup icc profiles list */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_assign_import"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_button_assign_import_cb), prefs);
/* setup the calibration helper */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"assistant_calib"));
g_signal_connect (widget, "delete-event",
G_CALLBACK (gcm_prefs_calib_delete_event_cb),
@@ -2381,10 +2346,10 @@ cc_color_panel_init (CcColorPanel *prefs)
g_signal_connect (widget, "prepare",
G_CALLBACK (gcm_prefs_calib_prepare_cb),
prefs);
- priv->assistant_calib = widget;
+ prefs->assistant_calib = widget;
/* setup the calibration helper ::TreeView */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_calib_quality"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
@@ -2420,7 +2385,7 @@ cc_color_panel_init (CcColorPanel *prefs)
gtk_tree_view_append_column (GTK_TREE_VIEW (widget),
GTK_TREE_VIEW_COLUMN (column));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_calib_sensor"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (selection, "changed",
@@ -2439,7 +2404,7 @@ cc_color_panel_init (CcColorPanel *prefs)
gtk_tree_view_append_column (GTK_TREE_VIEW (widget),
GTK_TREE_VIEW_COLUMN (column));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_calib_kind"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (selection, "changed",
@@ -2464,7 +2429,7 @@ cc_color_panel_init (CcColorPanel *prefs)
gtk_tree_view_append_column (GTK_TREE_VIEW (widget),
GTK_TREE_VIEW_COLUMN (column));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"treeview_calib_temp"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (selection, "changed",
@@ -2482,59 +2447,59 @@ cc_color_panel_init (CcColorPanel *prefs)
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (widget),
GTK_TREE_VIEW_COLUMN (column));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"entry_calib_title"));
g_signal_connect (widget, "notify::text",
G_CALLBACK (gcm_prefs_title_entry_changed_cb), prefs);
/* use a device client array */
- priv->client = cd_client_new ();
- g_signal_connect_object (priv->client, "device-added",
+ prefs->client = cd_client_new ();
+ g_signal_connect_object (prefs->client, "device-added",
G_CALLBACK (gcm_prefs_device_added_cb), prefs, 0);
- g_signal_connect_object (priv->client, "device-removed",
+ g_signal_connect_object (prefs->client, "device-removed",
G_CALLBACK (gcm_prefs_device_removed_cb), prefs, 0);
/* use a listbox for the main UI */
- priv->list_box = GTK_LIST_BOX (gtk_list_box_new ());
- gtk_list_box_set_filter_func (priv->list_box,
+ prefs->list_box = GTK_LIST_BOX (gtk_list_box_new ());
+ gtk_list_box_set_filter_func (prefs->list_box,
cc_color_panel_filter_func,
prefs,
NULL);
- gtk_list_box_set_sort_func (priv->list_box,
+ gtk_list_box_set_sort_func (prefs->list_box,
cc_color_panel_sort_func,
prefs,
NULL);
- gtk_list_box_set_header_func (priv->list_box,
+ gtk_list_box_set_header_func (prefs->list_box,
cc_list_box_update_header_func,
prefs, NULL);
- gtk_list_box_set_selection_mode (priv->list_box,
+ gtk_list_box_set_selection_mode (prefs->list_box,
GTK_SELECTION_SINGLE);
- gtk_list_box_set_activate_on_single_click (priv->list_box, FALSE);
- priv->list_box_selected_id =
- g_signal_connect (priv->list_box, "row-selected",
+ gtk_list_box_set_activate_on_single_click (prefs->list_box, FALSE);
+ prefs->list_box_selected_id =
+ g_signal_connect (prefs->list_box, "row-selected",
G_CALLBACK (gcm_prefs_list_box_row_selected_cb),
prefs);
- priv->list_box_activated_id =
- g_signal_connect (priv->list_box, "row-activated",
+ prefs->list_box_activated_id =
+ g_signal_connect (prefs->list_box, "row-activated",
G_CALLBACK (gcm_prefs_list_box_row_activated_cb),
prefs);
- priv->list_box_size = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+ prefs->list_box_size = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "frame_devices"));
- gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (priv->list_box));
- gtk_widget_show (GTK_WIDGET (priv->list_box));
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder, "frame_devices"));
+ gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (prefs->list_box));
+ gtk_widget_show (GTK_WIDGET (prefs->list_box));
/* connect to colord */
- cd_client_connect (priv->client,
- priv->cancellable,
+ cd_client_connect (prefs->client,
+ prefs->cancellable,
gcm_prefs_connect_cb,
prefs);
/* use the color sensor */
- g_signal_connect_object (priv->client, "sensor-added",
+ g_signal_connect_object (prefs->client, "sensor-added",
G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
prefs, 0);
- g_signal_connect_object (priv->client, "sensor-removed",
+ g_signal_connect_object (prefs->client, "sensor-removed",
G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
prefs, 0);
@@ -2542,25 +2507,25 @@ cc_color_panel_init (CcColorPanel *prefs)
gcm_prefs_set_calibrate_button_sensitivity (prefs);
/* show the confirmation export page if we are running from a LiveCD */
- priv->is_live_cd = gcm_prefs_is_livecd ();
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ prefs->is_live_cd = gcm_prefs_is_livecd ();
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"box_calib_summary"));
- gtk_widget_set_visible (widget, priv->is_live_cd);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ gtk_widget_set_visible (widget, prefs->is_live_cd);
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_calib_export"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_calib_export_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"button_calib_upload"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_prefs_calib_upload_cb), prefs);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
"label_calib_summary_message"));
g_signal_connect (widget, "activate-link",
G_CALLBACK (gcm_prefs_calib_export_link_cb), prefs);
- widget = WID (priv->builder, "dialog-vbox1");
+ widget = WID (prefs->builder, "dialog-vbox1");
gtk_container_add (GTK_CONTAINER (prefs), widget);
g_signal_connect (widget, "realize",
G_CALLBACK (gcm_prefs_window_realize_cb),
diff --git a/panels/color/cc-color-panel.h b/panels/color/cc-color-panel.h
index 183d01438..cd5f7a6cd 100644
--- a/panels/color/cc-color-panel.h
+++ b/panels/color/cc-color-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_COLOR_PANEL cc_color_panel_get_type()
-
-#define CC_COLOR_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_COLOR_PANEL, CcColorPanel))
-
-#define CC_COLOR_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_COLOR_PANEL, CcColorPanelClass))
-
-#define CC_IS_COLOR_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_COLOR_PANEL))
-
-#define CC_IS_COLOR_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_COLOR_PANEL))
-
-#define CC_COLOR_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_COLOR_PANEL, CcColorPanelClass))
-
-typedef struct _CcColorPanel CcColorPanel;
-typedef struct _CcColorPanelClass CcColorPanelClass;
-typedef struct _CcColorPanelPrivate CcColorPanelPrivate;
-
-struct _CcColorPanel
-{
- CcPanel parent;
-
- CcColorPanelPrivate *priv;
-};
-
-struct _CcColorPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_color_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_COLOR_PANEL (cc_color_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcColorPanel, cc_color_panel, CC, COLOR_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/color/cc-color-profile.c b/panels/color/cc-color-profile.c
index b985ecc3b..95e961f4d 100644
--- a/panels/color/cc-color-profile.c
+++ b/panels/color/cc-color-profile.c
@@ -27,8 +27,10 @@
#include "cc-color-common.h"
#include "cc-color-profile.h"
-struct _CcColorProfilePrivate
+struct _CcColorProfile
{
+ GtkListBoxRow parent_instance;
+
GtkWidget *box;
CdDevice *device;
CdProfile *profile;
@@ -181,41 +183,40 @@ out:
static const gchar *
cc_color_profile_get_warnings (CcColorProfile *color_profile)
{
- CcColorProfilePrivate *priv = color_profile->priv;
const gchar *tooltip = NULL;
const guint seconds_in_one_day = 60 * 60 * 24;
gint num_days;
guint threshold_days = 0;
/* autogenerated printer defaults */
- if (cd_device_get_kind (priv->device) == CD_DEVICE_KIND_PRINTER &&
- cd_profile_get_filename (priv->profile) == NULL)
+ if (cd_device_get_kind (color_profile->device) == CD_DEVICE_KIND_PRINTER &&
+ cd_profile_get_filename (color_profile->profile) == NULL)
{
tooltip = _("Vendor supplied factory calibration data");
goto out;
}
/* autogenerated profiles are crap */
- if (cd_device_get_kind (priv->device) == CD_DEVICE_KIND_DISPLAY &&
- cd_profile_get_kind (priv->profile) == CD_PROFILE_KIND_DISPLAY_DEVICE &&
- !cd_profile_get_has_vcgt (priv->profile))
+ if (cd_device_get_kind (color_profile->device) == CD_DEVICE_KIND_DISPLAY &&
+ cd_profile_get_kind (color_profile->profile) == CD_PROFILE_KIND_DISPLAY_DEVICE &&
+ !cd_profile_get_has_vcgt (color_profile->profile))
{
tooltip = _("Full-screen display correction not possible with this profile");
goto out;
}
/* greater than the calibration threshold for the device type */
- num_days = cd_profile_get_age (priv->profile) / seconds_in_one_day;
- if (cd_device_get_kind (priv->device) == CD_DEVICE_KIND_DISPLAY)
+ num_days = cd_profile_get_age (color_profile->profile) / seconds_in_one_day;
+ if (cd_device_get_kind (color_profile->device) == CD_DEVICE_KIND_DISPLAY)
{
- g_settings_get (priv->settings,
+ g_settings_get (color_profile->settings,
GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD,
"u",
&threshold_days);
}
- else if (cd_device_get_kind (priv->device) == CD_DEVICE_KIND_DISPLAY)
+ else if (cd_device_get_kind (color_profile->device) == CD_DEVICE_KIND_DISPLAY)
{
- g_settings_get (priv->settings,
+ g_settings_get (color_profile->settings,
GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD,
"u",
&threshold_days);
@@ -232,59 +233,58 @@ out:
static void
cc_color_profile_refresh (CcColorProfile *color_profile)
{
- CcColorProfilePrivate *priv = color_profile->priv;
const gchar *warnings;
gchar *title = NULL;
/* show the image if the profile is default */
- gtk_widget_set_visible (priv->widget_image, priv->is_default);
- gtk_widget_set_margin_start (priv->widget_description,
- priv->is_default ? 0 : IMAGE_WIDGET_PADDING * 4);
+ gtk_widget_set_visible (color_profile->widget_image, color_profile->is_default);
+ gtk_widget_set_margin_start (color_profile->widget_description,
+ color_profile->is_default ? 0 : IMAGE_WIDGET_PADDING * 4);
/* set the title */
- title = gcm_prefs_get_profile_title (priv->profile);
- gtk_label_set_markup (GTK_LABEL (priv->widget_description), title);
+ title = gcm_prefs_get_profile_title (color_profile->profile);
+ gtk_label_set_markup (GTK_LABEL (color_profile->widget_description), title);
g_free (title);
/* show any information */
warnings = cc_color_profile_get_warnings (color_profile);
- gtk_widget_set_visible (priv->widget_info, warnings != NULL);
- gtk_widget_set_tooltip_text (priv->widget_info, warnings);
+ gtk_widget_set_visible (color_profile->widget_info, warnings != NULL);
+ gtk_widget_set_tooltip_text (color_profile->widget_info, warnings);
}
CdDevice *
cc_color_profile_get_device (CcColorProfile *color_profile)
{
g_return_val_if_fail (CC_IS_COLOR_PROFILE (color_profile), NULL);
- return color_profile->priv->device;
+ return color_profile->device;
}
CdProfile *
cc_color_profile_get_profile (CcColorProfile *color_profile)
{
g_return_val_if_fail (CC_IS_COLOR_PROFILE (color_profile), NULL);
- return color_profile->priv->profile;
+ return color_profile->profile;
}
const gchar *
cc_color_profile_get_sortable (CcColorProfile *color_profile)
{
g_return_val_if_fail (CC_IS_COLOR_PROFILE (color_profile), NULL);
- return color_profile->priv->sortable;
+ return color_profile->sortable;
}
gboolean
cc_color_profile_get_is_default (CcColorProfile *color_profile)
{
g_return_val_if_fail (CC_IS_COLOR_PROFILE (color_profile), 0);
- return color_profile->priv->is_default;
+ return color_profile->is_default;
}
void
cc_color_profile_set_is_default (CcColorProfile *color_profile, gboolean is_default)
{
g_return_if_fail (CC_IS_COLOR_PROFILE (color_profile));
- color_profile->priv->is_default = is_default;
+ color_profile->is_default = is_default;
cc_color_profile_refresh (color_profile);
}
@@ -296,13 +296,13 @@ cc_color_profile_get_property (GObject *object, guint param_id,
switch (param_id)
{
case PROP_DEVICE:
- g_value_set_object (value, color_profile->priv->device);
+ g_value_set_object (value, color_profile->device);
break;
case PROP_PROFILE:
- g_value_set_object (value, color_profile->priv->profile);
+ g_value_set_object (value, color_profile->profile);
break;
case PROP_IS_DEFAULT:
- g_value_set_boolean (value, color_profile->priv->is_default);
+ g_value_set_boolean (value, color_profile->is_default);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -319,13 +319,13 @@ cc_color_profile_set_property (GObject *object, guint param_id,
switch (param_id)
{
case PROP_DEVICE:
- color_profile->priv->device = g_value_dup_object (value);
+ color_profile->device = g_value_dup_object (value);
break;
case PROP_PROFILE:
- color_profile->priv->profile = g_value_dup_object (value);
+ color_profile->profile = g_value_dup_object (value);
break;
case PROP_IS_DEFAULT:
- color_profile->priv->is_default = g_value_get_boolean (value);
+ color_profile->is_default = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -337,17 +337,16 @@ static void
cc_color_profile_finalize (GObject *object)
{
CcColorProfile *color_profile = CC_COLOR_PROFILE (object);
- CcColorProfilePrivate *priv = color_profile->priv;
- if (priv->device_changed_id > 0)
- g_signal_handler_disconnect (priv->device, priv->device_changed_id);
- if (priv->profile_changed_id > 0)
- g_signal_handler_disconnect (priv->profile, priv->profile_changed_id);
+ if (color_profile->device_changed_id > 0)
+ g_signal_handler_disconnect (color_profile->device, color_profile->device_changed_id);
+ if (color_profile->profile_changed_id > 0)
+ g_signal_handler_disconnect (color_profile->profile, color_profile->profile_changed_id);
- g_free (priv->sortable);
- g_object_unref (priv->device);
- g_object_unref (priv->profile);
- g_object_unref (priv->settings);
+ g_free (color_profile->sortable);
+ g_object_unref (color_profile->device);
+ g_object_unref (color_profile->profile);
+ g_object_unref (color_profile->settings);
G_OBJECT_CLASS (cc_color_profile_parent_class)->finalize (object);
}
@@ -357,14 +356,13 @@ cc_color_profile_changed_cb (CdDevice *device,
CcColorProfile *color_profile)
{
CdProfile *profile;
- CcColorProfilePrivate *priv = color_profile->priv;
/* check to see if the default has changed */
profile = cd_device_get_default_profile (device);
if (profile != NULL)
{
- priv->is_default = g_strcmp0 (cd_profile_get_object_path (profile),
- cd_profile_get_object_path (priv->profile)) == 0;
+ color_profile->is_default = g_strcmp0 (cd_profile_get_object_path (profile),
+ cd_profile_get_object_path (color_profile->profile)) == 0;
g_object_unref (profile);
}
cc_color_profile_refresh (color_profile);
@@ -390,17 +388,16 @@ static void
cc_color_profile_constructed (GObject *object)
{
CcColorProfile *color_profile = CC_COLOR_PROFILE (object);
- CcColorProfilePrivate *priv = color_profile->priv;
const gchar *sortable_data_source;
gchar *sortable_device;
gchar *title;
/* watch to see if the default changes */
- priv->device_changed_id =
- g_signal_connect (priv->device, "changed",
+ color_profile->device_changed_id =
+ g_signal_connect (color_profile->device, "changed",
G_CALLBACK (cc_color_profile_changed_cb), color_profile);
- priv->profile_changed_id =
- g_signal_connect (priv->profile, "changed",
+ color_profile->profile_changed_id =
+ g_signal_connect (color_profile->profile, "changed",
G_CALLBACK (cc_color_profile_changed_cb), color_profile);
/* sort the profiles in the list by:
@@ -409,13 +406,13 @@ cc_color_profile_constructed (GObject *object)
* 3. the date the profiles were created (newest first)
* 4. the alpha sorting of the filename
*/
- title = gcm_prefs_get_profile_title (priv->profile);
- sortable_device = cc_color_device_get_sortable_base (priv->device);
- sortable_data_source = cc_color_profile_get_profile_sort_data_source (priv->profile);
- priv->sortable = g_strdup_printf ("%s-%s-%012" G_GINT64_FORMAT "-%s",
+ title = gcm_prefs_get_profile_title (color_profile->profile);
+ sortable_device = cc_color_device_get_sortable_base (color_profile->device);
+ sortable_data_source = cc_color_profile_get_profile_sort_data_source (color_profile->profile);
+ color_profile->sortable = g_strdup_printf ("%s-%s-%012" G_GINT64_FORMAT "-%s",
sortable_device,
sortable_data_source,
- cd_profile_get_created (priv->profile),
+ cd_profile_get_created (color_profile->profile),
title);
g_free (title);
g_free (sortable_device);
@@ -447,43 +444,36 @@ cc_color_profile_class_init (CcColorProfileClass *klass)
NULL,
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (klass, sizeof (CcColorProfilePrivate));
}
static void
cc_color_profile_init (CcColorProfile *color_profile)
{
- CcColorProfilePrivate *priv;
GtkWidget *box;
- color_profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (color_profile,
- CC_TYPE_COLOR_PROFILE,
- CcColorProfilePrivate);
- priv = color_profile->priv;
- priv->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
+ color_profile->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 9);
/* default tick */
- priv->widget_image = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
- gtk_widget_set_margin_start (priv->widget_image, IMAGE_WIDGET_PADDING);
- gtk_widget_set_margin_end (priv->widget_image, IMAGE_WIDGET_PADDING);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_image, FALSE, FALSE, 0);
+ color_profile->widget_image = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_start (color_profile->widget_image, IMAGE_WIDGET_PADDING);
+ gtk_widget_set_margin_end (color_profile->widget_image, IMAGE_WIDGET_PADDING);
+ gtk_box_pack_start (GTK_BOX (box), color_profile->widget_image, FALSE, FALSE, 0);
/* description */
- priv->widget_description = gtk_label_new ("");
- gtk_widget_set_margin_top (priv->widget_description, 9);
- gtk_widget_set_margin_bottom (priv->widget_description, 9);
- gtk_widget_set_halign (priv->widget_description, GTK_ALIGN_START);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_description, TRUE, TRUE, 0);
- gtk_widget_show (priv->widget_description);
+ color_profile->widget_description = gtk_label_new ("");
+ gtk_widget_set_margin_top (color_profile->widget_description, 9);
+ gtk_widget_set_margin_bottom (color_profile->widget_description, 9);
+ gtk_widget_set_halign (color_profile->widget_description, GTK_ALIGN_START);
+ gtk_box_pack_start (GTK_BOX (box), color_profile->widget_description, TRUE, TRUE, 0);
+ gtk_widget_show (color_profile->widget_description);
/* profile warnings/info */
- priv->widget_info = gtk_image_new_from_icon_name ("dialog-information-symbolic", GTK_ICON_SIZE_MENU);
- gtk_widget_set_margin_start (priv->widget_info, IMAGE_WIDGET_PADDING);
- gtk_widget_set_margin_end (priv->widget_info, IMAGE_WIDGET_PADDING);
- gtk_box_pack_start (GTK_BOX (box), priv->widget_info, FALSE, FALSE, 0);
+ color_profile->widget_info = gtk_image_new_from_icon_name ("dialog-information-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_start (color_profile->widget_info, IMAGE_WIDGET_PADDING);
+ gtk_widget_set_margin_end (color_profile->widget_info, IMAGE_WIDGET_PADDING);
+ gtk_box_pack_start (GTK_BOX (box), color_profile->widget_info, FALSE, FALSE, 0);
/* refresh */
gtk_container_add (GTK_CONTAINER (color_profile), box);
diff --git a/panels/color/cc-color-profile.h b/panels/color/cc-color-profile.h
index 30322fce9..48065117b 100644
--- a/panels/color/cc-color-profile.h
+++ b/panels/color/cc-color-profile.h
@@ -25,33 +25,11 @@
#include <gtk/gtk.h>
#include <colord.h>
-#define CC_TYPE_COLOR_PROFILE (cc_color_profile_get_type())
-#define CC_COLOR_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CC_TYPE_COLOR_PROFILE, CcColorProfile))
-#define CC_COLOR_PROFILE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), CC_TYPE_COLOR_PROFILE, CcColorProfileClass))
-#define CC_IS_COLOR_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CC_TYPE_COLOR_PROFILE))
-#define CC_IS_COLOR_PROFILE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), CC_TYPE_COLOR_PROFILE))
-#define CC_COLOR_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CC_TYPE_COLOR_PROFILE, CcColorProfileClass))
-
G_BEGIN_DECLS
-typedef struct _CcColorProfile CcColorProfile;
-typedef struct _CcColorProfileClass CcColorProfileClass;
-typedef struct _CcColorProfilePrivate CcColorProfilePrivate;
-
-struct _CcColorProfile
-{
- GtkListBoxRow parent;
-
- /*< private >*/
- CcColorProfilePrivate *priv;
-};
-
-struct _CcColorProfileClass
-{
- GtkListBoxRowClass parent_class;
-};
+#define CC_TYPE_COLOR_PROFILE (cc_color_profile_get_type ())
+G_DECLARE_FINAL_TYPE (CcColorProfile, cc_color_profile, CC, COLOR_PROFILE, GtkListBoxRow)
-GType cc_color_profile_get_type (void);
GtkWidget *cc_color_profile_new (CdDevice *device,
CdProfile *profile,
gboolean is_default);
diff --git a/panels/common/gsd-device-manager-udev.c b/panels/common/gsd-device-manager-udev.c
index aa9304232..3b001649a 100644
--- a/panels/common/gsd-device-manager-udev.c
+++ b/panels/common/gsd-device-manager-udev.c
@@ -34,11 +34,6 @@ struct _GsdUdevDeviceManager
GUdevClient *udev_client;
};
-struct _GsdUdevDeviceManagerClass
-{
- GsdDeviceManagerClass parent_class;
-};
-
G_DEFINE_TYPE (GsdUdevDeviceManager, gsd_udev_device_manager, GSD_TYPE_DEVICE_MANAGER)
/* Index matches GsdDeviceType */
diff --git a/panels/common/gsd-device-manager-udev.h b/panels/common/gsd-device-manager-udev.h
index 2004e976f..eec0e5dfa 100644
--- a/panels/common/gsd-device-manager-udev.h
+++ b/panels/common/gsd-device-manager-udev.h
@@ -26,17 +26,8 @@
G_BEGIN_DECLS
-#define GSD_TYPE_UDEV_DEVICE_MANAGER (gsd_udev_device_manager_get_type ())
-#define GSD_UDEV_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UDEV_DEVICE_MANAGER, GsdUdevDeviceManager))
-#define GSD_UDEV_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_UDEV_DEVICE_MANAGER, GsdUdevDeviceManagerClass))
-#define GSD_IS_UDEV_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UDEV_DEVICE_MANAGER))
-#define GSD_IS_UDEV_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UDEV_DEVICE_MANAGER))
-#define GSD_UDEV_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UDEV_DEVICE_MANAGER, GsdUdevDeviceManagerClass))
-
-typedef struct _GsdUdevDeviceManager GsdUdevDeviceManager;
-typedef struct _GsdUdevDeviceManagerClass GsdUdevDeviceManagerClass;
-
-GType gsd_udev_device_manager_get_type (void) G_GNUC_CONST;
+#define GSD_TYPE_UDEV_DEVICE_MANAGER (gsd_udev_device_manager_get_type ())
+G_DECLARE_FINAL_TYPE (GsdUdevDeviceManager, gsd_udev_device_manager, GSD, UDEV_DEVICE_MANAGER, GsdDeviceManager)
G_END_DECLS
diff --git a/panels/common/gsd-device-manager-x11.c b/panels/common/gsd-device-manager-x11.c
index a2704d1a5..97a5e29ea 100644
--- a/panels/common/gsd-device-manager-x11.c
+++ b/panels/common/gsd-device-manager-x11.c
@@ -36,11 +36,6 @@ struct _GsdX11DeviceManager
GHashTable *gdk_devices;
};
-struct _GsdX11DeviceManagerClass
-{
- GsdDeviceManagerClass parent_class;
-};
-
GsdDevice * gsd_x11_device_manager_lookup_gdk_device (GsdDeviceManager *manager,
GdkDevice *gdk_device);
diff --git a/panels/common/gsd-device-manager-x11.h b/panels/common/gsd-device-manager-x11.h
index a5ea724e8..a21e711b9 100644
--- a/panels/common/gsd-device-manager-x11.h
+++ b/panels/common/gsd-device-manager-x11.h
@@ -27,17 +27,8 @@
G_BEGIN_DECLS
-#define GSD_TYPE_X11_DEVICE_MANAGER (gsd_x11_device_manager_get_type ())
-#define GSD_X11_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_X11_DEVICE_MANAGER, GsdX11DeviceManager))
-#define GSD_X11_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_X11_DEVICE_MANAGER, GsdX11DeviceManagerClass))
-#define GSD_IS_X11_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_X11_DEVICE_MANAGER))
-#define GSD_IS_X11_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_X11_DEVICE_MANAGER))
-#define GSD_X11_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_X11_DEVICE_MANAGER, GsdX11DeviceManagerClass))
-
-typedef struct _GsdX11DeviceManager GsdX11DeviceManager;
-typedef struct _GsdX11DeviceManagerClass GsdX11DeviceManagerClass;
-
-GType gsd_x11_device_manager_get_type (void) G_GNUC_CONST;
+#define GSD_TYPE_X11_DEVICE_MANAGER (gsd_x11_device_manager_get_type ())
+G_DECLARE_FINAL_TYPE (GsdX11DeviceManager, gsd_x11_device_manager, GSD, X11_DEVICE_MANAGER, GsdDeviceManager)
G_END_DECLS
diff --git a/panels/common/gsd-device-manager.c b/panels/common/gsd-device-manager.c
index 541f29487..2593b4e2d 100644
--- a/panels/common/gsd-device-manager.c
+++ b/panels/common/gsd-device-manager.c
@@ -28,10 +28,7 @@
#include "gsd-common-enums.h"
#include "gnome-settings-bus.h"
-typedef struct _GsdDevicePrivate GsdDevicePrivate;
-typedef struct _GsdDeviceManagerPrivate GsdDeviceManagerPrivate;
-
-struct _GsdDevicePrivate
+typedef struct
{
gchar *name;
gchar *device_file;
@@ -40,7 +37,9 @@ struct _GsdDevicePrivate
GsdDeviceType type;
guint width;
guint height;
-};
+} GsdDevicePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GsdDevice, gsd_device, G_TYPE_OBJECT)
enum {
PROP_NAME = 1,
@@ -61,7 +60,6 @@ enum {
static guint signals[N_SIGNALS] = { 0 };
-G_DEFINE_TYPE_WITH_PRIVATE (GsdDevice, gsd_device, G_TYPE_OBJECT)
G_DEFINE_TYPE (GsdDeviceManager, gsd_device_manager, G_TYPE_OBJECT)
static void
diff --git a/panels/common/gsd-device-manager.h b/panels/common/gsd-device-manager.h
index 1eb5c1356..68ebfc1f9 100644
--- a/panels/common/gsd-device-manager.h
+++ b/panels/common/gsd-device-manager.h
@@ -26,24 +26,11 @@
G_BEGIN_DECLS
-#define GSD_TYPE_DEVICE (gsd_device_get_type ())
-#define GSD_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DEVICE, GsdDevice))
-#define GSD_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DEVICE, GsdDeviceClass))
-#define GSD_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DEVICE))
-#define GSD_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DEVICE))
-#define GSD_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DEVICE, GsdDeviceClass))
-
-#define GSD_TYPE_DEVICE_MANAGER (gsd_device_manager_get_type ())
-#define GSD_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DEVICE_MANAGER, GsdDeviceManager))
-#define GSD_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DEVICE_MANAGER, GsdDeviceManagerClass))
-#define GSD_IS_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DEVICE_MANAGER))
-#define GSD_IS_DEVICE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DEVICE_MANAGER))
-#define GSD_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DEVICE_MANAGER, GsdDeviceManagerClass))
-
-typedef struct _GsdDevice GsdDevice;
-typedef struct _GsdDeviceClass GsdDeviceClass;
-typedef struct _GsdDeviceManager GsdDeviceManager;
-typedef struct _GsdDeviceManagerClass GsdDeviceManagerClass;
+#define GSD_TYPE_DEVICE (gsd_device_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GsdDevice, gsd_device, GSD, DEVICE, GObject)
+
+#define GSD_TYPE_DEVICE_MANAGER (gsd_device_manager_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GsdDeviceManager, gsd_device_manager, GSD, DEVICE_MANAGER, GObject)
typedef enum {
GSD_DEVICE_TYPE_MOUSE = 1 << 0,
@@ -54,19 +41,10 @@ typedef enum {
GSD_DEVICE_TYPE_PAD = 1 << 5
} GsdDeviceType;
-struct _GsdDevice {
- GObject parent_instance;
-};
-
struct _GsdDeviceClass {
GObjectClass parent_class;
};
-struct _GsdDeviceManager
-{
- GObject parent_instance;
-};
-
struct _GsdDeviceManagerClass
{
GObjectClass parent_class;
@@ -85,8 +63,6 @@ struct _GsdDeviceManagerClass
GdkDevice *gdk_device);
};
-GType gsd_device_get_type (void) G_GNUC_CONST;
-GType gsd_device_manager_get_type (void) G_GNUC_CONST;
GsdDeviceManager * gsd_device_manager_get (void);
GList * gsd_device_manager_list_devices (GsdDeviceManager *manager,
GsdDeviceType type);
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 5500b0503..8d987210a 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -45,18 +45,13 @@
#define DEFAULT_TZ "Europe/London"
#define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones"
-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))
-
enum {
CITY_COL_CITY_HUMAN_READABLE,
CITY_COL_ZONE,
CITY_NUM_COLS
};
-#define W(x) (GtkWidget*) gtk_builder_get_object (priv->builder, x)
+#define W(x) (GtkWidget*) gtk_builder_get_object (self->builder, x)
#define DATETIME_PERMISSION "org.gnome.controlcenter.datetime.configure"
@@ -68,8 +63,10 @@ enum {
#define DATETIME_SCHEMA "org.gnome.desktop.datetime"
#define AUTO_TIMEZONE_KEY "automatic-timezone"
-struct _CcDateTimePanelPrivate
+struct _CcDateTimePanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *map;
@@ -100,6 +97,8 @@ struct _CcDateTimePanelPrivate
GPermission *permission;
};
+CC_PANEL_REGISTER (CcDateTimePanel, cc_date_time_panel)
+
static void update_time (CcDateTimePanel *self);
static void change_time (CcDateTimePanel *self);
@@ -107,39 +106,39 @@ static void change_time (CcDateTimePanel *self);
static void
cc_date_time_panel_dispose (GObject *object)
{
- CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (object)->priv;
+ CcDateTimePanel *panel = CC_DATE_TIME_PANEL (object);
- if (priv->cancellable)
+ if (panel->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (panel->cancellable);
+ g_clear_object (&panel->cancellable);
}
- if (priv->am_pm_visiblity_changed_id != 0)
+ if (panel->am_pm_visiblity_changed_id != 0)
{
- g_signal_handler_disconnect (priv->am_pm_stack,
- priv->am_pm_visiblity_changed_id);
- priv->am_pm_visiblity_changed_id = 0;
+ g_signal_handler_disconnect (panel->am_pm_stack,
+ panel->am_pm_visiblity_changed_id);
+ panel->am_pm_visiblity_changed_id = 0;
}
- if (priv->toplevels)
+ if (panel->toplevels)
{
- g_list_free_full (priv->toplevels, (GDestroyNotify) gtk_widget_destroy);
- priv->toplevels = NULL;
+ g_list_free_full (panel->toplevels, (GDestroyNotify) gtk_widget_destroy);
+ panel->toplevels = NULL;
}
- g_clear_object (&priv->builder);
- g_clear_object (&priv->clock_tracker);
- g_clear_object (&priv->dtm);
- g_clear_object (&priv->permission);
- g_clear_object (&priv->clock_settings);
- g_clear_object (&priv->datetime_settings);
- g_clear_object (&priv->filechooser_settings);
+ g_clear_object (&panel->builder);
+ g_clear_object (&panel->clock_tracker);
+ g_clear_object (&panel->dtm);
+ g_clear_object (&panel->permission);
+ g_clear_object (&panel->clock_settings);
+ g_clear_object (&panel->datetime_settings);
+ g_clear_object (&panel->filechooser_settings);
- g_clear_pointer (&priv->date, g_date_time_unref);
+ g_clear_pointer (&panel->date, g_date_time_unref);
- g_clear_pointer (&priv->listboxes, g_list_free);
- g_clear_pointer (&priv->listboxes_reverse, g_list_free);
+ g_clear_pointer (&panel->listboxes, g_list_free);
+ g_clear_pointer (&panel->listboxes_reverse, g_list_free);
G_OBJECT_CLASS (cc_date_time_panel_parent_class)->dispose (object);
}
@@ -147,9 +146,8 @@ cc_date_time_panel_dispose (GObject *object)
static GPermission *
cc_date_time_panel_get_permission (CcPanel *panel)
{
- CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (panel)->priv;
-
- return priv->permission;
+ CcDateTimePanel *self = CC_DATE_TIME_PANEL (panel);
+ return self->permission;
}
static const char *
@@ -164,8 +162,6 @@ cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcDateTimePanelPrivate));
-
object_class->dispose = cc_date_time_panel_dispose;
panel_class->get_permission = cc_date_time_panel_get_permission;
@@ -181,14 +177,13 @@ static void clock_settings_changed_cb (GSettings *settings,
static void
change_clock_settings (GObject *gobject,
GParamSpec *pspec,
- CcDateTimePanel *panel)
+ CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = panel->priv;
GDesktopClockFormat value;
const char *active_id;
- g_signal_handlers_block_by_func (priv->clock_settings, clock_settings_changed_cb,
- panel);
+ g_signal_handlers_block_by_func (self->clock_settings, clock_settings_changed_cb,
+ self);
active_id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (W ("format_combobox")));
if (!g_strcmp0 (active_id, "24h"))
@@ -196,46 +191,44 @@ change_clock_settings (GObject *gobject,
else
value = G_DESKTOP_CLOCK_FORMAT_12H;
- g_settings_set_enum (priv->clock_settings, CLOCK_FORMAT_KEY, value);
- g_settings_set_enum (priv->filechooser_settings, CLOCK_FORMAT_KEY, value);
- priv->clock_format = value;
+ g_settings_set_enum (self->clock_settings, CLOCK_FORMAT_KEY, value);
+ g_settings_set_enum (self->filechooser_settings, CLOCK_FORMAT_KEY, value);
+ self->clock_format = value;
- update_time (panel);
+ update_time (self);
- g_signal_handlers_unblock_by_func (priv->clock_settings, clock_settings_changed_cb,
- panel);
+ g_signal_handlers_unblock_by_func (self->clock_settings, clock_settings_changed_cb,
+ self);
}
static void
clock_settings_changed_cb (GSettings *settings,
gchar *key,
- CcDateTimePanel *panel)
+ CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = panel->priv;
GtkWidget *format_combo;
GDesktopClockFormat value;
value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
- priv->clock_format = value;
+ self->clock_format = value;
format_combo = W ("format_combobox");
- g_signal_handlers_block_by_func (format_combo, change_clock_settings, panel);
+ g_signal_handlers_block_by_func (format_combo, change_clock_settings, self);
if (value == G_DESKTOP_CLOCK_FORMAT_24H)
gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "24h");
else
gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "12h");
- update_time (panel);
+ update_time (self);
- g_signal_handlers_unblock_by_func (format_combo, change_clock_settings, panel);
+ g_signal_handlers_unblock_by_func (format_combo, change_clock_settings, self);
}
static void
am_pm_stack_visible_child_changed_cb (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
AtkObject *am_pm_button_accessible;
GtkWidget *visible_label;
const gchar *visible_text;
@@ -244,7 +237,7 @@ am_pm_stack_visible_child_changed_cb (CcDateTimePanel *self)
if (am_pm_button_accessible == NULL)
return;
- visible_label = gtk_stack_get_visible_child (GTK_STACK (priv->am_pm_stack));
+ visible_label = gtk_stack_get_visible_child (GTK_STACK (self->am_pm_stack));
visible_text = gtk_label_get_text (GTK_LABEL (visible_label));
atk_object_set_name (am_pm_button_accessible, visible_text);
}
@@ -253,14 +246,13 @@ static gboolean
am_pm_button_clicked (GtkWidget *button,
CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkWidget *visible_child;
- visible_child = gtk_stack_get_visible_child (GTK_STACK (priv->am_pm_stack));
- if (visible_child == priv->am_label)
- gtk_stack_set_visible_child (GTK_STACK (priv->am_pm_stack), priv->pm_label);
+ visible_child = gtk_stack_get_visible_child (GTK_STACK (self->am_pm_stack));
+ if (visible_child == self->am_label)
+ gtk_stack_set_visible_child (GTK_STACK (self->am_pm_stack), self->pm_label);
else
- gtk_stack_set_visible_child (GTK_STACK (priv->am_pm_stack), priv->am_label);
+ gtk_stack_set_visible_child (GTK_STACK (self->am_pm_stack), self->am_label);
change_time (self);
@@ -271,7 +263,6 @@ am_pm_button_clicked (GtkWidget *button,
static void
update_time (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkWidget *h_spinbutton;
GtkWidget *m_spinbutton;
GtkWidget *am_pm_button;
@@ -288,13 +279,13 @@ update_time (CcDateTimePanel *self)
g_signal_handlers_block_by_func (m_spinbutton, change_time, self);
g_signal_handlers_block_by_func (am_pm_button, am_pm_button_clicked, self);
- if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
+ if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
use_ampm = TRUE;
else
use_ampm = FALSE;
- hour = g_date_time_get_hour (priv->date);
- minute = g_date_time_get_minute (priv->date);
+ hour = g_date_time_get_hour (self->date);
+ minute = g_date_time_get_minute (self->date);
if (!use_ampm)
{
@@ -310,9 +301,9 @@ update_time (CcDateTimePanel *self)
/* Update the AM/PM button */
if (is_pm_time)
- gtk_stack_set_visible_child (GTK_STACK (priv->am_pm_stack), priv->pm_label);
+ gtk_stack_set_visible_child (GTK_STACK (self->am_pm_stack), self->pm_label);
else
- gtk_stack_set_visible_child (GTK_STACK (priv->am_pm_stack), priv->am_label);
+ gtk_stack_set_visible_child (GTK_STACK (self->am_pm_stack), self->am_label);
/* Update the hours spinbutton */
if (is_pm_time)
@@ -336,12 +327,12 @@ update_time (CcDateTimePanel *self)
if (use_ampm)
{
/* Translators: This is the full date and time format used in 12-hour mode. */
- label = g_date_time_format (priv->date, _("%e %B %Y, %l:%M %p"));
+ label = g_date_time_format (self->date, _("%e %B %Y, %l:%M %p"));
}
else
{
/* Translators: This is the full date and time format used in 24-hour mode. */
- label = g_date_time_format (priv->date, _("%e %B %Y, %R"));
+ label = g_date_time_format (self->date, _("%e %B %Y, %R"));
}
gtk_label_set_text (GTK_LABEL (W ("datetime_label")), label);
@@ -357,7 +348,7 @@ set_time_cb (GObject *source,
GError *error;
error = NULL;
- if (!timedate1_call_set_time_finish (self->priv->dtm,
+ if (!timedate1_call_set_time_finish (self->dtm,
res,
&error))
{
@@ -380,7 +371,7 @@ set_timezone_cb (GObject *source,
GError *error;
error = NULL;
- if (!timedate1_call_set_timezone_finish (self->priv->dtm,
+ if (!timedate1_call_set_timezone_finish (self->dtm,
res,
&error))
{
@@ -399,7 +390,7 @@ set_using_ntp_cb (GObject *source,
GError *error;
error = NULL;
- if (!timedate1_call_set_ntp_finish (self->priv->dtm,
+ if (!timedate1_call_set_ntp_finish (self->dtm,
res,
&error))
{
@@ -415,13 +406,13 @@ queue_set_datetime (CcDateTimePanel *self)
gint64 unixtime;
/* timedated expects number of microseconds since 1 Jan 1970 UTC */
- unixtime = g_date_time_to_unix (self->priv->date);
+ unixtime = g_date_time_to_unix (self->date);
- timedate1_call_set_time (self->priv->dtm,
+ timedate1_call_set_time (self->dtm,
unixtime * 1000000,
FALSE,
TRUE,
- self->priv->cancellable,
+ self->cancellable,
set_time_cb,
self);
}
@@ -429,15 +420,14 @@ queue_set_datetime (CcDateTimePanel *self)
static void
queue_set_ntp (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
gboolean using_ntp;
/* for now just do it */
using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
- timedate1_call_set_ntp (self->priv->dtm,
+ timedate1_call_set_ntp (self->dtm,
using_ntp,
TRUE,
- self->priv->cancellable,
+ self->cancellable,
set_using_ntp_cb,
self);
}
@@ -446,12 +436,12 @@ static void
queue_set_timezone (CcDateTimePanel *self)
{
/* for now just do it */
- if (self->priv->current_location)
+ if (self->current_location)
{
- timedate1_call_set_timezone (self->priv->dtm,
- self->priv->current_location->zone,
+ timedate1_call_set_timezone (self->dtm,
+ self->current_location->zone,
TRUE,
- self->priv->cancellable,
+ self->cancellable,
set_timezone_cb,
self);
}
@@ -460,17 +450,16 @@ queue_set_timezone (CcDateTimePanel *self)
static void
change_date (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
guint mon, y, d;
GDateTime *old_date;
- old_date = priv->date;
+ old_date = self->date;
mon = 1 + gtk_combo_box_get_active (GTK_COMBO_BOX (W ("month-combobox")));
y = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("year-spinbutton")));
d = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("day-spinbutton")));
- priv->date = g_date_time_new_local (y, mon, d,
+ self->date = g_date_time_new_local (y, mon, d,
g_date_time_get_hour (old_date),
g_date_time_get_minute (old_date),
g_date_time_get_second (old_date));
@@ -489,7 +478,7 @@ city_changed_cb (GtkEntryCompletion *entry_completion,
gtk_tree_model_get (model, iter,
CITY_COL_ZONE, &zone, -1);
- cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), zone);
+ cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->map), zone);
g_free (zone);
entry = gtk_entry_completion_get_entry (GTK_ENTRY_COMPLETION (entry_completion));
@@ -531,7 +520,6 @@ translated_city_name (TzLocation *loc)
static void
update_timezone (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
char *bubble_text;
char *city_country;
char *label;
@@ -540,40 +528,40 @@ update_timezone (CcDateTimePanel *self)
char *tz_desc;
gboolean use_ampm;
- if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
+ if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
use_ampm = TRUE;
else
use_ampm = FALSE;
- city_country = translated_city_name (priv->current_location);
+ city_country = translated_city_name (self->current_location);
/* Update the timezone on the listbow row */
/* Translators: "timezone (details)" */
label = g_strdup_printf (C_("timezone desc", "%s (%s)"),
- g_date_time_get_timezone_abbreviation (self->priv->date),
+ g_date_time_get_timezone_abbreviation (self->date),
city_country);
gtk_label_set_text (GTK_LABEL (W ("timezone_label")), label);
g_free (label);
/* Translators: UTC here means the Coordinated Universal Time.
* %:::z will be replaced by the offset from UTC e.g. UTC+02 */
- utc_label = g_date_time_format (priv->date, _("UTC%:::z"));
+ utc_label = g_date_time_format (self->date, _("UTC%:::z"));
if (use_ampm)
{
/* Translators: This is the time format used in 12-hour mode. */
- time_label = g_date_time_format (priv->date, _("%l:%M %p"));
+ time_label = g_date_time_format (self->date, _("%l:%M %p"));
}
else
{
/* Translators: This is the time format used in 24-hour mode. */
- time_label = g_date_time_format (priv->date, _("%R"));
+ time_label = g_date_time_format (self->date, _("%R"));
}
/* Update the text bubble in the timezone map */
/* Translators: "timezone (utc shift)" */
tz_desc = g_strdup_printf (C_("timezone map", "%s (%s)"),
- g_date_time_get_timezone_abbreviation (self->priv->date),
+ g_date_time_get_timezone_abbreviation (self->date),
utc_label);
bubble_text = g_strdup_printf ("<b>%s</b>\n"
"<small>%s</small>\n"
@@ -581,7 +569,7 @@ update_timezone (CcDateTimePanel *self)
tz_desc,
city_country,
time_label);
- cc_timezone_map_set_bubble_text (CC_TIMEZONE_MAP (priv->map), bubble_text);
+ cc_timezone_map_set_bubble_text (CC_TIMEZONE_MAP (self->map), bubble_text);
g_free (tz_desc);
g_free (bubble_text);
@@ -595,18 +583,17 @@ location_changed_cb (CcTimezoneMap *map,
TzLocation *location,
CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GDateTime *old_date;
GTimeZone *timezone;
g_debug ("location changed to %s/%s", location->country, location->zone);
- priv->current_location = location;
+ self->current_location = location;
- old_date = priv->date;
+ old_date = self->date;
timezone = g_time_zone_new (location->zone);
- priv->date = g_date_time_to_timezone (old_date, timezone);
+ self->date = g_date_time_to_timezone (old_date, timezone);
g_time_zone_unref (timezone);
g_date_time_unref (old_date);
@@ -620,15 +607,15 @@ get_initial_timezone (CcDateTimePanel *self)
{
const gchar *timezone;
- timezone = timedate1_get_timezone (self->priv->dtm);
+ timezone = timedate1_get_timezone (self->dtm);
if (timezone == NULL ||
- !cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone))
+ !cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->map), timezone))
{
g_warning ("Timezone '%s' is unhandled, setting %s as default", timezone ? timezone : "(null)", DEFAULT_TZ);
- cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), DEFAULT_TZ);
+ cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->map), DEFAULT_TZ);
}
- self->priv->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->priv->map));
+ self->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->map));
update_timezone (self);
}
@@ -665,9 +652,8 @@ day_changed (GtkWidget *widget,
static void
month_year_changed (GtkWidget *widget,
- CcDateTimePanel *panel)
+ CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = panel->priv;
guint mon, y;
guint num_days;
GtkAdjustment *adj;
@@ -686,7 +672,7 @@ month_year_changed (GtkWidget *widget,
if (gtk_spin_button_get_value_as_int (day_spin) > num_days)
gtk_spin_button_set_value (day_spin, num_days);
- change_date (panel);
+ change_date (self);
}
static void
@@ -694,33 +680,30 @@ on_clock_changed (GnomeWallClock *clock,
GParamSpec *pspec,
CcDateTimePanel *panel)
{
- CcDateTimePanelPrivate *priv = panel->priv;
-
- g_date_time_unref (priv->date);
- priv->date = g_date_time_new_now_local ();
+ g_date_time_unref (panel->date);
+ panel->date = g_date_time_new_now_local ();
update_time (panel);
update_timezone (panel);
}
static void
-change_time (CcDateTimePanel *panel)
+change_time (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = panel->priv;
guint h, m;
GDateTime *old_date;
- old_date = priv->date;
+ old_date = self->date;
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("h_spinbutton")));
m = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("m_spinbutton")));
- if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
+ if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
{
gboolean is_pm_time;
GtkWidget *visible_child;
- visible_child = gtk_stack_get_visible_child (GTK_STACK (priv->am_pm_stack));
- if (visible_child == priv->pm_label)
+ visible_child = gtk_stack_get_visible_child (GTK_STACK (self->am_pm_stack));
+ if (visible_child == self->pm_label)
is_pm_time = TRUE;
else
is_pm_time = FALSE;
@@ -731,15 +714,15 @@ change_time (CcDateTimePanel *panel)
h += 12;
}
- priv->date = g_date_time_new_local (g_date_time_get_year (old_date),
+ self->date = g_date_time_new_local (g_date_time_get_year (old_date),
g_date_time_get_month (old_date),
g_date_time_get_day_of_month (old_date),
h, m,
g_date_time_get_second (old_date));
g_date_time_unref (old_date);
- update_time (panel);
- queue_set_datetime (panel);
+ update_time (self);
+ queue_set_datetime (self);
}
static void
@@ -759,7 +742,7 @@ is_ntp_available (CcDateTimePanel *self)
/* We need to access this directly so that we can default to TRUE if
* it is not set.
*/
- value = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self->priv->dtm), "CanNTP");
+ value = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self->dtm), "CanNTP");
if (value)
{
if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
@@ -775,10 +758,10 @@ on_permission_changed (GPermission *permission,
GParamSpec *pspec,
gpointer data)
{
- CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
+ CcDateTimePanel *self = CC_DATE_TIME_PANEL (data);
gboolean allowed, auto_timezone, using_ntp;
- allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission));
+ allowed = (self->permission != NULL && g_permission_get_allowed (self->permission));
using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
auto_timezone = gtk_switch_get_active (GTK_SWITCH (W("auto_timezone_switch")));
@@ -799,16 +782,15 @@ on_permission_changed (GPermission *permission,
static void
on_can_ntp_changed (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
gtk_widget_set_visible (W ("auto-datetime-row"), is_ntp_available (self));
}
static void
on_timezone_changed (CcDateTimePanel *self)
{
- g_signal_handlers_block_by_func (self->priv->map, location_changed_cb, self);
+ g_signal_handlers_block_by_func (self->map, location_changed_cb, self);
get_initial_timezone (self);
- g_signal_handlers_unblock_by_func (self->priv->map, location_changed_cb, self);
+ g_signal_handlers_unblock_by_func (self->map, location_changed_cb, self);
}
static void
@@ -849,14 +831,13 @@ keynav_failed (GtkWidget *listbox,
GtkDirectionType direction,
CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GList *item, *listboxes;
/* Find the listbox in the list of GtkListBoxes */
if (direction == GTK_DIR_DOWN)
- listboxes = priv->listboxes;
+ listboxes = self->listboxes;
else
- listboxes = priv->listboxes_reverse;
+ listboxes = self->listboxes_reverse;
item = g_list_find (listboxes, listbox);
g_assert (item);
@@ -873,7 +854,6 @@ static void
run_dialog (CcDateTimePanel *self,
const gchar *dialog_name)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkWidget *dialog, *parent;
dialog = W (dialog_name);
@@ -890,12 +870,11 @@ switch_to_row_transform_func (GBinding *binding,
GValue *target_value,
CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
gboolean active;
gboolean allowed;
active = g_value_get_boolean (source_value);
- allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission));
+ allowed = (self->permission != NULL && g_permission_get_allowed (self->permission));
g_value_set_boolean (target_value, !active && allowed);
@@ -929,7 +908,6 @@ list_box_row_activated (GtkListBox *listbox,
CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
gchar *widget_name, *found;
widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));
@@ -962,8 +940,6 @@ static void
setup_listbox (CcDateTimePanel *self,
GtkWidget *listbox)
{
- CcDateTimePanelPrivate *priv = self->priv;
-
gtk_list_box_set_header_func (GTK_LIST_BOX (listbox), cc_list_box_update_header_func, NULL, NULL);
g_signal_connect (listbox, "row-activated",
G_CALLBACK (list_box_row_activated), self);
@@ -971,8 +947,8 @@ setup_listbox (CcDateTimePanel *self,
g_signal_connect (listbox, "keynav-failed",
G_CALLBACK (keynav_failed), self);
- priv->listboxes = g_list_append (priv->listboxes, listbox);
- priv->listboxes_reverse = g_list_prepend (priv->listboxes_reverse, listbox);
+ self->listboxes = g_list_append (self->listboxes, listbox);
+ self->listboxes_reverse = g_list_prepend (self->listboxes_reverse, listbox);
}
static gboolean
@@ -996,13 +972,12 @@ static gboolean
format_hours_combobox (GtkSpinButton *spin,
CcDateTimePanel *panel)
{
- CcDateTimePanelPrivate *priv = panel->priv;
GtkAdjustment *adjustment;
char *text;
int hour;
gboolean use_ampm;
- if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
+ if (panel->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
use_ampm = TRUE;
else
use_ampm = FALSE;
@@ -1022,17 +997,16 @@ format_hours_combobox (GtkSpinButton *spin,
static void
setup_timezone_dialog (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkEntryCompletion *completion;
GtkTreeModel *completion_model;
GtkWidget *dialog;
GtkWidget *entry;
/* set up timezone map */
- priv->map = (GtkWidget *) cc_timezone_map_new ();
- gtk_widget_show (priv->map);
- gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->builder, "aspectmap")),
- priv->map);
+ self->map = (GtkWidget *) cc_timezone_map_new ();
+ gtk_widget_show (self->map);
+ gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (self->builder, "aspectmap")),
+ self->map);
dialog = W ("timezone-dialog");
entry = W ("timezone-searchentry");
@@ -1045,7 +1019,7 @@ setup_timezone_dialog (CcDateTimePanel *self)
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (completion);
- completion_model = GTK_TREE_MODEL (gtk_builder_get_object (priv->builder,
+ completion_model = GTK_TREE_MODEL (gtk_builder_get_object (self->builder,
"city-modelsort"));
gtk_entry_completion_set_model (completion, completion_model);
@@ -1083,25 +1057,24 @@ format_pm_label ()
static void
setup_am_pm_button (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkCssProvider *provider;
GtkStyleContext *context;
GtkWidget *am_pm_button;
char *text;
text = format_am_label ();
- priv->am_label = gtk_label_new (text);
+ self->am_label = gtk_label_new (text);
g_free (text);
text = format_pm_label ();
- priv->pm_label = gtk_label_new (text);
+ self->pm_label = gtk_label_new (text);
g_free (text);
- priv->am_pm_stack = W ("am_pm_stack");
- gtk_container_add (GTK_CONTAINER (priv->am_pm_stack), priv->am_label);
- gtk_container_add (GTK_CONTAINER (priv->am_pm_stack), priv->pm_label);
- gtk_widget_show_all (priv->am_pm_stack);
- priv->am_pm_visiblity_changed_id = g_signal_connect_swapped (priv->am_pm_stack,
+ self->am_pm_stack = W ("am_pm_stack");
+ gtk_container_add (GTK_CONTAINER (self->am_pm_stack), self->am_label);
+ gtk_container_add (GTK_CONTAINER (self->am_pm_stack), self->pm_label);
+ gtk_widget_show_all (self->am_pm_stack);
+ self->am_pm_visiblity_changed_id = g_signal_connect_swapped (self->am_pm_stack,
"notify::visible-child",
G_CALLBACK (am_pm_stack_visible_child_changed_cb),
self);
@@ -1126,7 +1099,6 @@ setup_am_pm_button (CcDateTimePanel *self)
static void
setup_datetime_dialog (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv = self->priv;
GtkAdjustment *adjustment;
GdkScreen *screen;
GtkCssProvider *provider;
@@ -1161,14 +1133,14 @@ setup_datetime_dialog (CcDateTimePanel *self)
/* Month */
gtk_combo_box_set_active (GTK_COMBO_BOX (W ("month-combobox")),
- g_date_time_get_month (priv->date) - 1);
+ g_date_time_get_month (self->date) - 1);
g_signal_connect (G_OBJECT (W("month-combobox")), "changed",
G_CALLBACK (month_year_changed), self);
/* Day */
- num_days = g_date_get_days_in_month (g_date_time_get_month (priv->date),
- g_date_time_get_year (priv->date));
- adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_day_of_month (priv->date), 1,
+ num_days = g_date_get_days_in_month (g_date_time_get_month (self->date),
+ g_date_time_get_year (self->date));
+ adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_day_of_month (self->date), 1,
num_days + 1, 1, 10, 1);
gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("day-spinbutton")),
adjustment);
@@ -1176,7 +1148,7 @@ setup_datetime_dialog (CcDateTimePanel *self)
G_CALLBACK (day_changed), self);
/* Year */
- adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_year (priv->date),
+ adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_year (self->date),
1, G_MAXDOUBLE, 1,
10, 1);
gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("year-spinbutton")),
@@ -1205,7 +1177,6 @@ setup_datetime_dialog (CcDateTimePanel *self)
static void
cc_date_time_panel_init (CcDateTimePanel *self)
{
- CcDateTimePanelPrivate *priv;
GtkWidget *widget;
GError *error;
GtkTreeModelSort *city_modelsort;
@@ -1213,25 +1184,24 @@ cc_date_time_panel_init (CcDateTimePanel *self)
const char *date_grid_name;
char *tmp;
- priv = self->priv = DATE_TIME_PANEL_PRIVATE (self);
g_resources_register (cc_datetime_get_resource ());
- priv->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
error = NULL;
- priv->dtm = timedate1_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ self->dtm = timedate1_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.timedate1",
"/org/freedesktop/timedate1",
- priv->cancellable,
+ self->cancellable,
&error);
- if (priv->dtm == NULL) {
+ if (self->dtm == NULL) {
g_warning ("could not get proxy for DateTimeMechanism: %s", error->message);
g_clear_error (&error);
return;
}
- priv->builder = gtk_builder_new ();
- ret = gtk_builder_add_from_resource (priv->builder,
+ self->builder = gtk_builder_new ();
+ ret = gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/datetime/datetime.ui",
&error);
@@ -1261,18 +1231,18 @@ cc_date_time_panel_init (CcDateTimePanel *self)
}
tmp = g_strdup_printf ("/org/gnome/control-center/datetime/%s.ui", date_grid_name);
- ret = gtk_builder_add_from_resource (priv->builder, tmp, NULL);
+ ret = gtk_builder_add_from_resource (self->builder, tmp, NULL);
g_free (tmp);
gtk_box_pack_end (GTK_BOX (W ("time-box")), W ("date_grid"), FALSE, TRUE, 0);
/* add the lock button */
- priv->permission = polkit_permission_new_sync (DATETIME_PERMISSION, NULL, NULL, NULL);
- if (priv->permission != NULL)
+ self->permission = polkit_permission_new_sync (DATETIME_PERMISSION, NULL, NULL, NULL);
+ if (self->permission != NULL)
{
- g_signal_connect (priv->permission, "notify",
+ g_signal_connect (self->permission, "notify",
G_CALLBACK (on_permission_changed), self);
- on_permission_changed (priv->permission, NULL, self);
+ on_permission_changed (self->permission, NULL, self);
}
else
{
@@ -1280,11 +1250,11 @@ cc_date_time_panel_init (CcDateTimePanel *self)
DATETIME_PERMISSION);
}
- priv->date = g_date_time_new_now_local ();
+ self->date = g_date_time_new_now_local ();
/* Top level windows from GtkBuilder that need to be destroyed explicitly */
- priv->toplevels = g_list_append (priv->toplevels, W ("datetime-dialog"));
- priv->toplevels = g_list_append (priv->toplevels, W ("timezone-dialog"));
+ self->toplevels = g_list_append (self->toplevels, W ("datetime-dialog"));
+ self->toplevels = g_list_append (self->toplevels, W ("timezone-dialog"));
setup_timezone_dialog (self);
setup_datetime_dialog (self);
@@ -1296,7 +1266,7 @@ cc_date_time_panel_init (CcDateTimePanel *self)
bind_switch_to_row (self,
W ("network_time_switch"),
W ("datetime-button"));
- g_object_bind_property (priv->dtm, "ntp",
+ g_object_bind_property (self->dtm, "ntp",
W ("network_time_switch"), "active",
G_BINDING_SYNC_CREATE);
g_signal_connect (W("network_time_switch"), "notify::active",
@@ -1309,23 +1279,23 @@ cc_date_time_panel_init (CcDateTimePanel *self)
W ("auto_timezone_switch"),
W ("timezone-button"));
- priv->datetime_settings = g_settings_new (DATETIME_SCHEMA);
- g_settings_bind (priv->datetime_settings, AUTO_TIMEZONE_KEY,
+ self->datetime_settings = g_settings_new (DATETIME_SCHEMA);
+ g_settings_bind (self->datetime_settings, AUTO_TIMEZONE_KEY,
W ("auto_timezone_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
/* Clock settings */
- priv->clock_settings = g_settings_new (CLOCK_SCHEMA);
+ self->clock_settings = g_settings_new (CLOCK_SCHEMA);
widget = W ("vbox_datetime");
gtk_container_add (GTK_CONTAINER (self), widget);
/* setup the time itself */
- priv->clock_tracker = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL);
- g_signal_connect (priv->clock_tracker, "notify::clock", G_CALLBACK (on_clock_changed), self);
+ self->clock_tracker = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL);
+ g_signal_connect (self->clock_tracker, "notify::clock", G_CALLBACK (on_clock_changed), self);
- clock_settings_changed_cb (priv->clock_settings, CLOCK_FORMAT_KEY, self);
- g_signal_connect (priv->clock_settings, "changed::" CLOCK_FORMAT_KEY,
+ clock_settings_changed_cb (self->clock_settings, CLOCK_FORMAT_KEY, self);
+ g_signal_connect (self->clock_settings, "changed::" CLOCK_FORMAT_KEY,
G_CALLBACK (clock_settings_changed_cb), self);
g_signal_connect (W("format_combobox"), "notify::active-id",
@@ -1333,10 +1303,10 @@ cc_date_time_panel_init (CcDateTimePanel *self)
update_time (self);
- load_regions_model (GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ load_regions_model (GTK_LIST_STORE (gtk_builder_get_object (self->builder,
"city-liststore")));
- city_modelsort = GTK_TREE_MODEL_SORT (gtk_builder_get_object (priv->builder, "city-modelsort"));
+ city_modelsort = GTK_TREE_MODEL_SORT (gtk_builder_get_object (self->builder, "city-modelsort"));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (city_modelsort), CITY_COL_CITY_HUMAN_READABLE,
GTK_SORT_ASCENDING);
@@ -1344,22 +1314,22 @@ cc_date_time_panel_init (CcDateTimePanel *self)
* the model is filled up */
get_initial_timezone (self);
- widget = (GtkWidget*) gtk_builder_get_object (self->priv->builder,
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder,
"timezone-searchentry");
g_signal_connect (gtk_entry_get_completion (GTK_ENTRY (widget)),
"match-selected", G_CALLBACK (city_changed_cb), self);
- g_signal_connect (self->priv->map, "location-changed",
+ g_signal_connect (self->map, "location-changed",
G_CALLBACK (location_changed_cb), self);
/* Watch changes of timedated remote service properties */
- g_signal_connect (priv->dtm, "g-properties-changed",
+ g_signal_connect (self->dtm, "g-properties-changed",
G_CALLBACK (on_timedated_properties_changed), self);
- g_signal_connect_swapped (priv->dtm, "notify::can-ntp",
+ g_signal_connect_swapped (self->dtm, "notify::can-ntp",
G_CALLBACK (on_can_ntp_changed), self);
- g_signal_connect_swapped (priv->dtm, "notify::timezone",
+ g_signal_connect_swapped (self->dtm, "notify::timezone",
G_CALLBACK (on_timezone_changed), self);
/* We ignore UTC <--> LocalRTC changes at the moment */
- priv->filechooser_settings = g_settings_new (FILECHOOSER_SCHEMA);
+ self->filechooser_settings = g_settings_new (FILECHOOSER_SCHEMA);
}
diff --git a/panels/datetime/cc-datetime-panel.h b/panels/datetime/cc-datetime-panel.h
index e725d0f4f..29c0498b2 100644
--- a/panels/datetime/cc-datetime-panel.h
+++ b/panels/datetime/cc-datetime-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_DATE_TIME_PANEL cc_date_time_panel_get_type()
-
-#define CC_DATE_TIME_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_DATE_TIME_PANEL, CcDateTimePanel))
-
-#define CC_DATE_TIME_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_DATE_TIME_PANEL, CcDateTimePanelClass))
-
-#define CC_IS_DATE_TIME_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_DATE_TIME_PANEL))
-
-#define CC_IS_DATE_TIME_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_DATE_TIME_PANEL))
-
-#define CC_DATE_TIME_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_DATE_TIME_PANEL, CcDateTimePanelClass))
-
-typedef struct _CcDateTimePanel CcDateTimePanel;
-typedef struct _CcDateTimePanelClass CcDateTimePanelClass;
-typedef struct _CcDateTimePanelPrivate CcDateTimePanelPrivate;
-
-struct _CcDateTimePanel
-{
- CcPanel parent;
-
- CcDateTimePanelPrivate *priv;
-};
-
-struct _CcDateTimePanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_date_time_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_DATE_TIME_PANEL (cc_date_time_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcDateTimePanel, cc_date_time_panel, CC, DATE_TIME_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/datetime/cc-timezone-map.c b/panels/datetime/cc-timezone-map.c
index 8b38c9e5b..ed416afb4 100644
--- a/panels/datetime/cc-timezone-map.c
+++ b/panels/datetime/cc-timezone-map.c
@@ -26,11 +26,6 @@
#include <string.h>
#include "tz.h"
-G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
-
-#define TIMEZONE_MAP_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_MAP, CcTimezoneMapPrivate))
-
#define PIN_HOT_POINT_X 8
#define PIN_HOT_POINT_Y 15
@@ -45,8 +40,10 @@ typedef struct
guchar alpha;
} CcTimezoneMapOffset;
-struct _CcTimezoneMapPrivate
+struct _CcTimezoneMap
{
+ GtkWidget parent_instance;
+
GdkPixbuf *orig_background;
GdkPixbuf *orig_background_dim;
GdkPixbuf *orig_color_map;
@@ -66,6 +63,8 @@ struct _CcTimezoneMapPrivate
gchar *bubble_text;
};
+G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
+
enum
{
LOCATION_CHANGED,
@@ -122,21 +121,21 @@ static CcTimezoneMapOffset color_codes[] =
static void
cc_timezone_map_dispose (GObject *object)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
+ CcTimezoneMap *self = CC_TIMEZONE_MAP (object);
- g_clear_object (&priv->orig_background);
- g_clear_object (&priv->orig_background_dim);
- g_clear_object (&priv->orig_color_map);
- g_clear_object (&priv->background);
- g_clear_object (&priv->pin);
- g_clear_pointer (&priv->bubble_text, g_free);
+ g_clear_object (&self->orig_background);
+ g_clear_object (&self->orig_background_dim);
+ g_clear_object (&self->orig_color_map);
+ g_clear_object (&self->background);
+ g_clear_object (&self->pin);
+ g_clear_pointer (&self->bubble_text, g_free);
- if (priv->color_map)
+ if (self->color_map)
{
- g_clear_object (&priv->color_map);
+ g_clear_object (&self->color_map);
- priv->visible_map_pixels = NULL;
- priv->visible_map_rowstride = 0;
+ self->visible_map_pixels = NULL;
+ self->visible_map_rowstride = 0;
}
G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object);
@@ -145,12 +144,12 @@ cc_timezone_map_dispose (GObject *object)
static void
cc_timezone_map_finalize (GObject *object)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
+ CcTimezoneMap *self = CC_TIMEZONE_MAP (object);
- if (priv->tzdb)
+ if (self->tzdb)
{
- tz_db_free (priv->tzdb);
- priv->tzdb = NULL;
+ tz_db_free (self->tzdb);
+ self->tzdb = NULL;
}
@@ -163,10 +162,10 @@ cc_timezone_map_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
gint size;
- size = gdk_pixbuf_get_width (priv->orig_background);
+ size = gdk_pixbuf_get_width (map->orig_background);
if (minimum != NULL)
*minimum = size;
@@ -179,10 +178,10 @@ cc_timezone_map_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
gint size;
- size = gdk_pixbuf_get_height (priv->orig_background);
+ size = gdk_pixbuf_get_height (map->orig_background);
if (minimum != NULL)
*minimum = size;
@@ -194,32 +193,32 @@ static void
cc_timezone_map_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
GdkPixbuf *pixbuf;
- if (priv->background)
- g_object_unref (priv->background);
+ if (map->background)
+ g_object_unref (map->background);
if (!gtk_widget_is_sensitive (widget))
- pixbuf = priv->orig_background_dim;
+ pixbuf = map->orig_background_dim;
else
- pixbuf = priv->orig_background;
-
- priv->background = gdk_pixbuf_scale_simple (pixbuf,
- allocation->width,
- allocation->height,
- GDK_INTERP_BILINEAR);
-
- if (priv->color_map)
- g_object_unref (priv->color_map);
+ pixbuf = map->orig_background;
- priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map,
+ map->background = gdk_pixbuf_scale_simple (pixbuf,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
- priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map);
- priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map);
+ if (map->color_map)
+ g_object_unref (map->color_map);
+
+ map->color_map = gdk_pixbuf_scale_simple (map->orig_color_map,
+ allocation->width,
+ allocation->height,
+ GDK_INTERP_BILINEAR);
+
+ map->visible_map_pixels = gdk_pixbuf_get_pixels (map->color_map);
+ map->visible_map_rowstride = gdk_pixbuf_get_rowstride (map->color_map);
GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->size_allocate (widget,
allocation);
@@ -301,7 +300,7 @@ draw_text_bubble (cairo_t *cr,
static const double margin_left = 24.0;
static const double margin_right = 24.0;
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
GtkAllocation alloc;
PangoLayout *layout;
PangoRectangle text_rect;
@@ -310,7 +309,7 @@ draw_text_bubble (cairo_t *cr,
double width;
double height;
- if (!priv->bubble_text)
+ if (!map->bubble_text)
return;
gtk_widget_get_allocation (widget, &alloc);
@@ -319,7 +318,7 @@ draw_text_bubble (cairo_t *cr,
/* Layout the text */
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
pango_layout_set_spacing (layout, 3);
- pango_layout_set_markup (layout, priv->bubble_text, -1);
+ pango_layout_set_markup (layout, map->bubble_text, -1);
pango_layout_get_pixel_extents (layout, NULL, &text_rect);
@@ -365,7 +364,7 @@ static gboolean
cc_timezone_map_draw (GtkWidget *widget,
cairo_t *cr)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
GdkPixbuf *hilight, *orig_hilight;
GtkAllocation alloc;
gchar *file;
@@ -376,7 +375,7 @@ cc_timezone_map_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &alloc);
/* paint background */
- gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
+ gdk_cairo_set_source_pixbuf (cr, map->background, 0, 0);
cairo_paint (cr);
/* paint hilight */
@@ -384,13 +383,13 @@ cc_timezone_map_draw (GtkWidget *widget,
{
file = g_strdup_printf (DATETIME_RESOURCE_PATH "/timezone_%s.png",
g_ascii_formatd (buf, sizeof (buf),
- "%g", priv->selected_offset));
+ "%g", map->selected_offset));
}
else
{
file = g_strdup_printf (DATETIME_RESOURCE_PATH "/timezone_%s_dim.png",
g_ascii_formatd (buf, sizeof (buf),
- "%g", priv->selected_offset));
+ "%g", map->selected_offset));
}
@@ -417,19 +416,19 @@ cc_timezone_map_draw (GtkWidget *widget,
g_object_unref (orig_hilight);
}
- if (priv->location)
+ if (map->location)
{
- pointx = convert_longitude_to_x (priv->location->longitude, alloc.width);
- pointy = convert_latitude_to_y (priv->location->latitude, alloc.height);
+ pointx = convert_longitude_to_x (map->location->longitude, alloc.width);
+ pointy = convert_latitude_to_y (map->location->latitude, alloc.height);
pointx = CLAMP (floor (pointx), 0, alloc.width);
pointy = CLAMP (floor (pointy), 0, alloc.height);
draw_text_bubble (cr, widget, pointx, pointy);
- if (priv->pin)
+ if (map->pin)
{
- gdk_cairo_set_source_pixbuf (cr, priv->pin,
+ gdk_cairo_set_source_pixbuf (cr, map->pin,
pointx - PIN_HOT_POINT_X,
pointy - PIN_HOT_POINT_Y);
cairo_paint (cr);
@@ -479,8 +478,6 @@ cc_timezone_map_class_init (CcTimezoneMapClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcTimezoneMapPrivate));
-
object_class->dispose = cc_timezone_map_dispose;
object_class->finalize = cc_timezone_map_finalize;
@@ -520,17 +517,16 @@ static void
set_location (CcTimezoneMap *map,
TzLocation *location)
{
- CcTimezoneMapPrivate *priv = map->priv;
TzInfo *info;
- priv->location = location;
+ map->location = location;
- info = tz_info_from_location (priv->location);
+ info = tz_info_from_location (map->location);
- priv->selected_offset = tz_location_get_utc_offset (priv->location)
+ map->selected_offset = tz_location_get_utc_offset (map->location)
/ (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
- g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
+ g_signal_emit (map, signals[LOCATION_CHANGED], 0, map->location);
tz_info_free (info);
}
@@ -539,7 +535,7 @@ static gboolean
button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
gint x, y;
guchar r, g, b, a;
guchar *pixels;
@@ -555,8 +551,8 @@ button_press_event (GtkWidget *widget,
y = event->y;
- rowstride = priv->visible_map_rowstride;
- pixels = priv->visible_map_pixels;
+ rowstride = map->visible_map_rowstride;
+ pixels = map->visible_map_pixels;
r = pixels[(rowstride * y + x * 4)];
g = pixels[(rowstride * y + x * 4) + 1];
@@ -569,7 +565,7 @@ button_press_event (GtkWidget *widget,
if (color_codes[i].red == r && color_codes[i].green == g
&& color_codes[i].blue == b && color_codes[i].alpha == a)
{
- priv->selected_offset = color_codes[i].offset;
+ map->selected_offset = color_codes[i].offset;
}
}
@@ -577,7 +573,7 @@ button_press_event (GtkWidget *widget,
/* work out the co-ordinates */
- array = tz_get_locations (priv->tzdb);
+ array = tz_get_locations (map->tzdb);
gtk_widget_get_allocation (widget, &alloc);
width = alloc.width;
@@ -609,54 +605,51 @@ button_press_event (GtkWidget *widget,
}
static void
-cc_timezone_map_init (CcTimezoneMap *self)
+cc_timezone_map_init (CcTimezoneMap *map)
{
- CcTimezoneMapPrivate *priv;
GError *err = NULL;
- priv = self->priv = TIMEZONE_MAP_PRIVATE (self);
-
- priv->orig_background = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg.png",
- &err);
+ map->orig_background = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg.png",
+ &err);
- if (!priv->orig_background)
+ if (!map->orig_background)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->orig_background_dim = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg_dim.png",
- &err);
+ map->orig_background_dim = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg_dim.png",
+ &err);
- if (!priv->orig_background_dim)
+ if (!map->orig_background_dim)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->orig_color_map = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/cc.png",
- &err);
- if (!priv->orig_color_map)
+ map->orig_color_map = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/cc.png",
+ &err);
+ if (!map->orig_color_map)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->pin = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/pin.png",
- &err);
- if (!priv->pin)
+ map->pin = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/pin.png",
+ &err);
+ if (!map->pin)
{
g_warning ("Could not load pin icon: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->tzdb = tz_load_db ();
+ map->tzdb = tz_load_db ();
- g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
+ g_signal_connect (map, "button-press-event", G_CALLBACK (button_press_event),
NULL);
}
@@ -675,9 +668,9 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
char *real_tz;
gboolean ret;
- real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone);
+ real_tz = tz_info_get_clean_name (map->tzdb, timezone);
- locations = tz_get_locations (map->priv->tzdb);
+ locations = tz_get_locations (map->tzdb);
ret = FALSE;
for (i = 0; i < locations->len; i++)
@@ -704,10 +697,8 @@ void
cc_timezone_map_set_bubble_text (CcTimezoneMap *map,
const gchar *text)
{
- CcTimezoneMapPrivate *priv = TIMEZONE_MAP_PRIVATE (map);
-
- g_free (priv->bubble_text);
- priv->bubble_text = g_strdup (text);
+ g_free (map->bubble_text);
+ map->bubble_text = g_strdup (text);
gtk_widget_queue_draw (GTK_WIDGET (map));
}
@@ -715,5 +706,5 @@ cc_timezone_map_set_bubble_text (CcTimezoneMap *map,
TzLocation *
cc_timezone_map_get_location (CcTimezoneMap *map)
{
- return map->priv->location;
+ return map->location;
}
diff --git a/panels/datetime/cc-timezone-map.h b/panels/datetime/cc-timezone-map.h
index facf133e4..bf6cbc2f0 100644
--- a/panels/datetime/cc-timezone-map.h
+++ b/panels/datetime/cc-timezone-map.h
@@ -27,45 +27,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_TIMEZONE_MAP cc_timezone_map_get_type()
-
-#define CC_TIMEZONE_MAP(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMap))
-
-#define CC_TIMEZONE_MAP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
-
-#define CC_IS_TIMEZONE_MAP(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_TIMEZONE_MAP))
-
-#define CC_IS_TIMEZONE_MAP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_TIMEZONE_MAP))
-
-#define CC_TIMEZONE_MAP_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
-
-typedef struct _CcTimezoneMap CcTimezoneMap;
-typedef struct _CcTimezoneMapClass CcTimezoneMapClass;
-typedef struct _CcTimezoneMapPrivate CcTimezoneMapPrivate;
-
-struct _CcTimezoneMap
-{
- GtkWidget parent;
-
- CcTimezoneMapPrivate *priv;
-};
-
-struct _CcTimezoneMapClass
-{
- GtkWidgetClass parent_class;
-};
-
-GType cc_timezone_map_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_TIMEZONE_MAP (cc_timezone_map_get_type ())
+G_DECLARE_FINAL_TYPE (CcTimezoneMap, cc_timezone_map, CC, TIMEZONE_MAP, GtkWidget)
CcTimezoneMap *cc_timezone_map_new (void);
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 32e5102de..e637d29a2 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -37,11 +37,6 @@
#include "cc-night-light-dialog.h"
#include "cc-display-resources.h"
-CC_PANEL_REGISTER (CcDisplayPanel, cc_display_panel)
-
-#define DISPLAY_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DISPLAY_PANEL, CcDisplayPanelPrivate))
-
#define TOP_BAR_HEIGHT 5
#define PANEL_PADDING 32
@@ -57,8 +52,10 @@ enum
DISPLAY_MODE_OFF
};
-struct _CcDisplayPanelPrivate
+struct _CcDisplayPanel
{
+ CcPanel parent_instance;
+
CcDisplayConfigManager *manager;
CcDisplayConfig *current_config;
CcDisplayMonitor *current_output;
@@ -90,6 +87,8 @@ struct _CcDisplayPanelPrivate
GtkWidget *apply_titlebar;
};
+CC_PANEL_REGISTER (CcDisplayPanel, cc_display_panel)
+
typedef struct
{
int grab_x;
@@ -179,12 +178,10 @@ ensure_output_numbers (CcDisplayConfig *config)
static void
monitor_labeler_hide (CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv = self->priv;
-
- if (!priv->shell_proxy)
+ if (!self->shell_proxy)
return;
- g_dbus_proxy_call (priv->shell_proxy,
+ g_dbus_proxy_call (self->shell_proxy,
"HideMonitorLabels",
NULL, G_DBUS_CALL_FLAGS_NONE,
-1, NULL, NULL, NULL);
@@ -193,21 +190,20 @@ monitor_labeler_hide (CcDisplayPanel *self)
static void
monitor_labeler_show (CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv = self->priv;
GList *outputs, *l;
GVariantBuilder builder;
gint number = 0;
- if (!priv->shell_proxy || !priv->current_config)
+ if (!self->shell_proxy || !self->current_config)
return;
- if (cc_display_config_is_cloning (priv->current_config))
+ if (cc_display_config_is_cloning (self->current_config))
return monitor_labeler_hide (self);
g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
g_variant_builder_open (&builder, G_VARIANT_TYPE_ARRAY);
- outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
+ outputs = g_object_get_data (G_OBJECT (self->current_config), "ui-sorted-outputs");
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
@@ -226,7 +222,7 @@ monitor_labeler_show (CcDisplayPanel *self)
if (number < 2)
return monitor_labeler_hide (self);
- g_dbus_proxy_call (priv->shell_proxy,
+ g_dbus_proxy_call (self->shell_proxy,
"ShowMonitorLabels2",
g_variant_builder_end (&builder),
G_DBUS_CALL_FLAGS_NONE,
@@ -264,16 +260,15 @@ dialog_toplevel_focus_changed (CcDisplayPanel *self)
static void
reset_titlebar (CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv = self->priv;
GtkWidget *toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)));
- if (priv->main_titlebar)
+ if (self->main_titlebar)
{
- gtk_window_set_titlebar (GTK_WINDOW (toplevel), priv->main_titlebar);
- g_clear_object (&priv->main_titlebar);
+ gtk_window_set_titlebar (GTK_WINDOW (toplevel), self->main_titlebar);
+ g_clear_object (&self->main_titlebar);
}
- g_clear_object (&priv->apply_titlebar);
+ g_clear_object (&self->apply_titlebar);
}
static void
@@ -293,49 +288,49 @@ active_panel_changed (CcShell *shell,
static void
cc_display_panel_dispose (GObject *object)
{
- CcDisplayPanelPrivate *priv = CC_DISPLAY_PANEL (object)->priv;
+ CcDisplayPanel *self = CC_DISPLAY_PANEL (object);
CcShell *shell;
GtkWidget *toplevel;
reset_titlebar (CC_DISPLAY_PANEL (object));
- if (priv->sensor_watch_id > 0)
+ if (self->sensor_watch_id > 0)
{
- g_bus_unwatch_name (priv->sensor_watch_id);
- priv->sensor_watch_id = 0;
+ g_bus_unwatch_name (self->sensor_watch_id);
+ self->sensor_watch_id = 0;
}
- g_clear_object (&priv->iio_sensor_proxy);
+ g_clear_object (&self->iio_sensor_proxy);
- if (priv->focus_id)
+ if (self->focus_id)
{
shell = cc_panel_get_shell (CC_PANEL (object));
toplevel = cc_shell_get_toplevel (shell);
if (toplevel != NULL)
g_signal_handler_disconnect (G_OBJECT (toplevel),
- priv->focus_id);
- priv->focus_id = 0;
+ self->focus_id);
+ self->focus_id = 0;
monitor_labeler_hide (CC_DISPLAY_PANEL (object));
}
- g_clear_object (&priv->manager);
- g_clear_object (&priv->current_config);
- g_clear_object (&priv->up_client);
- g_clear_object (&priv->background);
- g_clear_object (&priv->thumbnail_factory);
- g_clear_object (&priv->settings_color);
- g_clear_object (&priv->night_light_dialog);
- g_clear_object (&priv->main_size_group);
+ g_clear_object (&self->manager);
+ g_clear_object (&self->current_config);
+ g_clear_object (&self->up_client);
+ g_clear_object (&self->background);
+ g_clear_object (&self->thumbnail_factory);
+ g_clear_object (&self->settings_color);
+ g_clear_object (&self->night_light_dialog);
+ g_clear_object (&self->main_size_group);
- if (priv->dialog)
+ if (self->dialog)
{
- gtk_widget_destroy (priv->dialog);
- priv->dialog = NULL;
+ gtk_widget_destroy (self->dialog);
+ self->dialog = NULL;
}
- g_cancellable_cancel (priv->shell_cancellable);
- g_clear_object (&priv->shell_cancellable);
- g_clear_object (&priv->shell_proxy);
+ g_cancellable_cancel (self->shell_cancellable);
+ g_clear_object (&self->shell_cancellable);
+ g_clear_object (&self->shell_proxy);
G_OBJECT_CLASS (cc_display_panel_parent_class)->dispose (object);
}
@@ -361,8 +356,6 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcDisplayPanelPrivate));
-
panel_class->get_help_uri = cc_display_panel_get_help_uri;
object_class->constructed = cc_display_panel_constructed;
@@ -380,7 +373,7 @@ static void
set_current_output (CcDisplayPanel *panel,
CcDisplayMonitor *output)
{
- panel->priv->current_output = output;
+ panel->current_output = output;
g_signal_emit (panel, panel_signals[CURRENT_OUTPUT], 0);
}
@@ -437,7 +430,6 @@ paint_output (CcDisplayPanel *panel,
gint allocated_width,
gint allocated_height)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GdkPixbuf *pixbuf;
gint x, y, width, height;
@@ -463,8 +455,8 @@ paint_output (CcDisplayPanel *panel,
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
- pixbuf = gnome_bg_create_thumbnail (priv->background,
- priv->thumbnail_factory,
+ pixbuf = gnome_bg_create_thumbnail (panel->background,
+ panel->thumbnail_factory,
gdk_screen_get_default (), width, height);
if (cc_display_monitor_is_primary (output)
@@ -696,12 +688,10 @@ dialog_closed (GtkWidget *dialog,
GdkEvent *event,
CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
-
- if (priv->dialog == dialog)
+ if (panel->dialog == dialog)
{
gtk_widget_destroy (dialog);
- priv->dialog = NULL;
+ panel->dialog = NULL;
}
else
g_warn_if_reached ();
@@ -713,11 +703,9 @@ static void
show_dialog (CcDisplayPanel *panel,
GtkWidget *dialog)
{
- CcDisplayPanelPrivate *priv = panel->priv;
-
- if (!priv->dialog)
+ if (!panel->dialog)
{
- priv->dialog = dialog;
+ panel->dialog = dialog;
gtk_widget_show_all (dialog);
g_signal_connect_object (dialog, "delete-event", G_CALLBACK (dialog_closed),
panel, 0);
@@ -753,10 +741,9 @@ static void
orientation_row_activated (CcDisplayPanel *panel,
GtkListBoxRow *row)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayRotation rotation = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (row), "rotation"));
- cc_display_monitor_set_rotation (priv->current_output, rotation);
+ cc_display_monitor_set_rotation (panel->current_output, rotation);
update_apply_button (panel);
}
@@ -776,7 +763,6 @@ orientation_row_rotation_changed (GtkListBoxRow *row,
static void
show_orientation_dialog (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *dialog, *listbox;
GtkSizeGroup *size_group;
CcDisplayRotation rotations[] = { CC_DISPLAY_ROTATION_NONE,
@@ -794,13 +780,13 @@ show_orientation_dialog (CcDisplayPanel *panel)
for (i = 0; i < G_N_ELEMENTS (rotations); ++i)
{
CcDisplayRotation rotation = rotations[i];
- if (cc_display_monitor_supports_rotation (priv->current_output, rotation))
+ if (cc_display_monitor_supports_rotation (panel->current_output, rotation))
{
GtkWidget *row, *check;
check = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
- if (cc_display_monitor_get_rotation (priv->current_output) != rotation)
+ if (cc_display_monitor_get_rotation (panel->current_output) != rotation)
gtk_widget_set_opacity (check, 0.0);
row = make_row (size_group, gtk_label_new (string_for_rotation (rotation)), check);
@@ -809,7 +795,7 @@ show_orientation_dialog (CcDisplayPanel *panel)
g_signal_connect_object (row, "activated", G_CALLBACK (orientation_row_activated),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_output, "rotation",
+ g_signal_connect_object (panel->current_output, "rotation",
G_CALLBACK (orientation_row_rotation_changed),
row, G_CONNECT_SWAPPED);
@@ -835,7 +821,7 @@ make_orientation_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
label = gtk_label_new (string_for_rotation (cc_display_monitor_get_rotation (output)));
- row = make_row (panel->priv->rows_size_group, gtk_label_new (_("Orientation")), label);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Orientation")), label);
g_signal_connect_object (row, "activated", G_CALLBACK (show_orientation_dialog),
panel, G_CONNECT_SWAPPED);
g_signal_connect_object (output, "rotation", G_CALLBACK (orientation_label_rotation_changed),
@@ -847,10 +833,9 @@ static void
resolution_row_activated (CcDisplayPanel *panel,
GtkListBoxRow *row)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayMode *mode = g_object_get_data (G_OBJECT (row), "mode");
- cc_display_monitor_set_mode (priv->current_output, mode);
+ cc_display_monitor_set_mode (panel->current_output, mode);
update_apply_button (panel);
}
@@ -871,12 +856,11 @@ resolution_row_mode_changed (GtkListBoxRow *row,
static void
show_resolution_dialog (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *dialog, *listbox, *sw;
GtkSizeGroup *size_group;
GList *resolutions, *l;
- resolutions = g_object_get_data (G_OBJECT (priv->current_output), "res-list");
+ resolutions = g_object_get_data (G_OBJECT (panel->current_output), "res-list");
dialog = make_dialog (panel, _("Resolution"));
listbox = make_list_box ();
@@ -896,7 +880,7 @@ show_resolution_dialog (CcDisplayPanel *panel)
check = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
- if (!g_str_equal (get_resolution_string (cc_display_monitor_get_mode (priv->current_output)),
+ if (!g_str_equal (get_resolution_string (cc_display_monitor_get_mode (panel->current_output)),
get_resolution_string (mode)))
gtk_widget_set_opacity (check, 0.0);
@@ -906,7 +890,7 @@ show_resolution_dialog (CcDisplayPanel *panel)
g_signal_connect_object (row, "activated", G_CALLBACK (resolution_row_activated),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_output, "mode",
+ g_signal_connect_object (panel->current_output, "mode",
G_CALLBACK (resolution_row_mode_changed),
row, G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (listbox), row);
@@ -930,7 +914,7 @@ make_resolution_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
label = gtk_label_new (get_resolution_string (cc_display_monitor_get_mode (output)));
- row = make_row (panel->priv->rows_size_group, gtk_label_new (_("Resolution")), label);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Resolution")), label);
g_signal_connect_object (row, "activated", G_CALLBACK (show_resolution_dialog),
panel, G_CONNECT_SWAPPED);
g_signal_connect_object (output, "mode", G_CALLBACK (resolution_label_mode_changed),
@@ -942,10 +926,9 @@ static void
refresh_rate_row_activated (CcDisplayPanel *panel,
GtkListBoxRow *row)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayMode *mode = g_object_get_data (G_OBJECT (row), "mode");
- cc_display_monitor_set_mode (priv->current_output, mode);
+ cc_display_monitor_set_mode (panel->current_output, mode);
update_apply_button (panel);
}
@@ -965,15 +948,14 @@ refresh_rate_row_mode_changed (GtkListBoxRow *row,
static void
show_refresh_rate_dialog (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *dialog, *listbox, *sw;
GtkSizeGroup *size_group;
GHashTable *res_freqs;
GList *freqs, *l;
- res_freqs = g_object_get_data (G_OBJECT (priv->current_output), "res-freqs");
+ res_freqs = g_object_get_data (G_OBJECT (panel->current_output), "res-freqs");
freqs = g_hash_table_lookup (res_freqs,
- get_resolution_string (cc_display_monitor_get_mode (priv->current_output)));
+ get_resolution_string (cc_display_monitor_get_mode (panel->current_output)));
dialog = make_dialog (panel, _("Refresh Rate"));
listbox = make_list_box ();
@@ -993,7 +975,7 @@ show_refresh_rate_dialog (CcDisplayPanel *panel)
check = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
- if (cc_display_monitor_get_mode (priv->current_output) != mode)
+ if (cc_display_monitor_get_mode (panel->current_output) != mode)
gtk_widget_set_opacity (check, 0.0);
row = make_row (size_group, gtk_label_new (get_frequency_string (mode)), check);
@@ -1002,7 +984,7 @@ show_refresh_rate_dialog (CcDisplayPanel *panel)
g_signal_connect_object (row, "activated", G_CALLBACK (refresh_rate_row_activated),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_output, "mode",
+ g_signal_connect_object (panel->current_output, "mode",
G_CALLBACK (refresh_rate_row_mode_changed),
row, G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (listbox), row);
@@ -1046,7 +1028,7 @@ make_refresh_rate_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
label = gtk_label_new (get_frequency_string (cc_display_monitor_get_mode (output)));
- row = make_row (panel->priv->rows_size_group, gtk_label_new (_("Refresh Rate")), label);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Refresh Rate")), label);
g_signal_connect_object (row, "activated", G_CALLBACK (show_refresh_rate_dialog),
panel, G_CONNECT_SWAPPED);
g_signal_connect_object (output, "mode", G_CALLBACK (refresh_rate_label_mode_changed),
@@ -1100,7 +1082,7 @@ scale_buttons_active (CcDisplayPanel *panel,
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
- cc_display_monitor_set_scale (panel->priv->current_output, scale);
+ cc_display_monitor_set_scale (panel->current_output, scale);
update_apply_button (panel);
}
}
@@ -1189,7 +1171,7 @@ make_scale_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
gtk_widget_set_valign (bbox, GTK_ALIGN_CENTER);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_EXPAND);
- row = make_row (panel->priv->rows_size_group, label, bbox);
+ row = make_row (panel->rows_size_group, label, bbox);
gtk_widget_set_margin_top (gtk_bin_get_child (GTK_BIN (row)), 0);
gtk_widget_set_margin_bottom (gtk_bin_get_child (GTK_BIN (row)), 0);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
@@ -1218,7 +1200,7 @@ underscanning_switch_active (CcDisplayPanel *panel,
GParamSpec *pspec,
GtkWidget *button)
{
- cc_display_monitor_set_underscanning (panel->priv->current_output,
+ cc_display_monitor_set_underscanning (panel->current_output,
gtk_switch_get_active (GTK_SWITCH (button)));
update_apply_button (panel);
}
@@ -1227,7 +1209,6 @@ static GtkWidget *
make_underscanning_row (CcDisplayPanel *panel,
CcDisplayMonitor *output)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *row, *button;
button = gtk_switch_new ();
@@ -1236,7 +1217,7 @@ make_underscanning_row (CcDisplayPanel *panel,
g_signal_connect_object (button, "notify::active", G_CALLBACK (underscanning_switch_active),
panel, G_CONNECT_SWAPPED);
- row = make_row (priv->rows_size_group, gtk_label_new (_("Adjust for TV")), button);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Adjust for TV")), button);
return row;
}
@@ -1306,29 +1287,28 @@ ensure_res_freqs (CcDisplayMonitor *output)
static GtkWidget *
make_output_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *listbox;
- ensure_res_freqs (priv->current_output);
+ ensure_res_freqs (panel->current_output);
listbox = make_list_box ();
- if (should_show_rotation (panel, priv->current_output))
+ if (should_show_rotation (panel, panel->current_output))
gtk_container_add (GTK_CONTAINER (listbox),
- make_orientation_row (panel, priv->current_output));
+ make_orientation_row (panel, panel->current_output));
gtk_container_add (GTK_CONTAINER (listbox),
- make_resolution_row (panel, priv->current_output));
+ make_resolution_row (panel, panel->current_output));
gtk_container_add (GTK_CONTAINER (listbox),
- make_scale_row (panel, priv->current_output));
+ make_scale_row (panel, panel->current_output));
gtk_container_add (GTK_CONTAINER (listbox),
- make_refresh_rate_row (panel, priv->current_output));
+ make_refresh_rate_row (panel, panel->current_output));
- if (cc_display_monitor_supports_underscanning (priv->current_output))
+ if (cc_display_monitor_supports_underscanning (panel->current_output))
gtk_container_add (GTK_CONTAINER (listbox),
- make_underscanning_row (panel, priv->current_output));
+ make_underscanning_row (panel, panel->current_output));
return listbox;
}
@@ -1336,21 +1316,20 @@ make_output_ui (CcDisplayPanel *panel)
static GtkWidget *
make_single_output_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *frame;
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
- vbox = make_main_vbox (priv->main_size_group);
+ vbox = make_main_vbox (panel->main_size_group);
- frame = make_frame (g_object_get_data (G_OBJECT (priv->current_output), "ui-name"), NULL);
+ frame = make_frame (g_object_get_data (G_OBJECT (panel->current_output), "ui-name"), NULL);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_container_add (GTK_CONTAINER (frame), make_output_ui (panel));
gtk_container_add (GTK_CONTAINER (vbox), make_night_light_widget (panel));
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
return make_scrollable (vbox);
}
@@ -1358,12 +1337,11 @@ static void
monitor_output_changes (GtkWidget *area,
CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
const gchar *signals[] = { "rotation", "mode", "primary", "active", "scale" };
GList *outputs, *l;
guint i;
- outputs = cc_display_config_get_monitors (priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l; l = l->next)
{
CcDisplayMonitor *output = l->data;
@@ -1441,12 +1419,11 @@ primary_chooser_row_primary_changed (GtkListBoxRow *row,
static void
show_primary_chooser_dialog (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *dialog, *listbox, *sw;
GtkSizeGroup *size_group;
GList *outputs, *l;
- outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
+ outputs = g_object_get_data (G_OBJECT (panel->current_config), "ui-sorted-outputs");
dialog = make_dialog (panel, _("Primary Display"));
listbox = make_list_box ();
@@ -1490,16 +1467,15 @@ show_primary_chooser_dialog (CcDisplayPanel *panel)
static GtkWidget *
make_primary_chooser_row (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *row, *label;
label = gtk_label_new (NULL);
- row = make_row (priv->rows_size_group, gtk_label_new (_("Primary Display")), label);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Primary Display")), label);
g_signal_connect_object (row, "activated", G_CALLBACK (show_primary_chooser_dialog),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_config, "primary", G_CALLBACK (primary_label_sync),
+ g_signal_connect_object (panel->current_config, "primary", G_CALLBACK (primary_label_sync),
label, G_CONNECT_SWAPPED);
- primary_label_sync (label, priv->current_config);
+ primary_label_sync (label, panel->current_config);
return row;
}
@@ -1508,29 +1484,27 @@ static void
replace_current_output_ui (GtkWidget *frame,
CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (frame)));
gtk_container_add (GTK_CONTAINER (frame), make_output_ui (panel));
gtk_widget_show_all (frame);
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
}
static guint
count_active_outputs (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GList *outputs, *l;
guint active = 0;
- outputs = cc_display_config_get_monitors (priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
if (!cc_display_monitor_is_active (output) ||
- (cc_display_monitor_is_builtin (output) && priv->lid_is_closed))
+ (cc_display_monitor_is_builtin (output) && panel->lid_is_closed))
continue;
else
active++;
@@ -1570,7 +1544,6 @@ static void
two_output_chooser_sync (GtkWidget *box,
CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GList *children, *l;
children = gtk_container_get_children (GTK_CONTAINER (box));
@@ -1578,7 +1551,7 @@ two_output_chooser_sync (GtkWidget *box,
{
GtkWidget *button = l->data;
CcDisplayMonitor *output = g_object_get_data (G_OBJECT (button), "output");
- if (priv->current_output == output)
+ if (panel->current_output == output)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
}
g_list_free (children);
@@ -1587,12 +1560,11 @@ two_output_chooser_sync (GtkWidget *box,
static GtkWidget *
make_two_output_chooser (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *box;
GtkRadioButton *group;
GList *outputs, *l;
- outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
+ outputs = g_object_get_data (G_OBJECT (panel->current_config), "ui-sorted-outputs");
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_EXPAND);
@@ -1624,10 +1596,9 @@ make_two_output_chooser (CcDisplayPanel *panel)
static GtkWidget *
make_two_join_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *frame, *box;
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -1647,7 +1618,7 @@ make_two_join_ui (CcDisplayPanel *panel)
gtk_container_add (GTK_CONTAINER (vbox), make_night_light_widget (panel));
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
return vbox;
}
@@ -1656,7 +1627,6 @@ two_output_chooser_activate_output (CcDisplayPanel *panel,
GParamSpec *pspec,
GtkWidget *button)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayMonitor *output = g_object_get_data (G_OBJECT (button), "output");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
@@ -1665,7 +1635,7 @@ two_output_chooser_activate_output (CcDisplayPanel *panel,
cc_display_monitor_set_active (output, TRUE);
- outputs = cc_display_config_get_monitors (priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l; l = l->next)
{
CcDisplayMonitor *other = l->data;
@@ -1688,10 +1658,9 @@ connect_activate_output (GtkWidget *button,
static GtkWidget *
make_two_single_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *frame, *box;
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -1709,7 +1678,7 @@ make_two_single_ui (CcDisplayPanel *panel)
gtk_container_add (GTK_CONTAINER (vbox), make_night_light_widget (panel));
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
return vbox;
}
@@ -1731,22 +1700,20 @@ static void
mirror_resolution_row_activated (CcDisplayPanel *panel,
GtkListBoxRow *row)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayMode *mode = g_object_get_data (G_OBJECT (row), "mode");
- set_mode_on_all_outputs (priv->current_config, mode);
+ set_mode_on_all_outputs (panel->current_config, mode);
update_apply_button (panel);
}
static void
show_mirror_resolution_dialog (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *dialog, *listbox, *sw;
GtkSizeGroup *size_group;
GList *resolutions, *l;
- resolutions = g_object_get_data (G_OBJECT (priv->current_config), "mirror-res-list");
+ resolutions = g_object_get_data (G_OBJECT (panel->current_config), "mirror-res-list");
dialog = make_dialog (panel, _("Resolution"));
listbox = make_list_box ();
@@ -1766,7 +1733,7 @@ show_mirror_resolution_dialog (CcDisplayPanel *panel)
check = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
- if (!g_str_equal (get_resolution_string (cc_display_monitor_get_mode (priv->current_output)),
+ if (!g_str_equal (get_resolution_string (cc_display_monitor_get_mode (panel->current_output)),
get_resolution_string (mode)))
gtk_widget_set_opacity (check, 0.0);
@@ -1776,7 +1743,7 @@ show_mirror_resolution_dialog (CcDisplayPanel *panel)
g_signal_connect_object (row, "activated", G_CALLBACK (mirror_resolution_row_activated),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_output, "mode",
+ g_signal_connect_object (panel->current_output, "mode",
G_CALLBACK (resolution_row_mode_changed),
row, G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (listbox), row);
@@ -1794,7 +1761,7 @@ make_mirror_resolution_row (CcDisplayPanel *panel,
label = gtk_label_new (get_resolution_string (cc_display_monitor_get_mode (output)));
- row = make_row (panel->priv->rows_size_group, gtk_label_new (_("Resolution")), label);
+ row = make_row (panel->rows_size_group, gtk_label_new (_("Resolution")), label);
g_signal_connect_object (row, "activated", G_CALLBACK (show_mirror_resolution_dialog),
panel, G_CONNECT_SWAPPED);
g_signal_connect_object (output, "mode", G_CALLBACK (resolution_label_mode_changed),
@@ -1834,20 +1801,19 @@ ensure_mirror_res_list (CcDisplayConfig *config)
static GtkWidget *
make_two_mirror_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *listbox, *frame;
- ensure_mirror_res_list (priv->current_config);
- if (!cc_display_config_is_cloning (priv->current_config))
+ ensure_mirror_res_list (panel->current_config);
+ if (!cc_display_config_is_cloning (panel->current_config))
{
GList *modes;
- cc_display_config_set_cloning (priv->current_config, TRUE);
- modes = g_object_get_data (G_OBJECT (priv->current_config), "mirror-res-list");
- set_mode_on_all_outputs (priv->current_config,
+ cc_display_config_set_cloning (panel->current_config, TRUE);
+ modes = g_object_get_data (G_OBJECT (panel->current_config), "mirror-res-list");
+ set_mode_on_all_outputs (panel->current_config,
CC_DISPLAY_MODE (g_list_nth_data (modes, 0)));
}
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
frame = make_frame (NULL, NULL);
@@ -1855,16 +1821,16 @@ make_two_mirror_ui (CcDisplayPanel *panel)
listbox = make_list_box ();
gtk_container_add (GTK_CONTAINER (frame), listbox);
- if (should_show_rotation (panel, priv->current_output))
+ if (should_show_rotation (panel, panel->current_output))
gtk_container_add (GTK_CONTAINER (listbox),
- make_orientation_row (panel, priv->current_output));
+ make_orientation_row (panel, panel->current_output));
gtk_container_add (GTK_CONTAINER (listbox),
- make_mirror_resolution_row (panel, priv->current_output));
+ make_mirror_resolution_row (panel, panel->current_output));
gtk_container_add (GTK_CONTAINER (vbox), make_night_light_widget (panel));
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
return vbox;
}
@@ -1873,7 +1839,6 @@ two_output_visible_child_changed (CcDisplayPanel *panel,
GParamSpec *pspec,
GtkWidget *stack)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *bin;
GList *children, *l;
@@ -1897,16 +1862,16 @@ two_output_visible_child_changed (CcDisplayPanel *panel,
gboolean single;
GList *outputs, *l;
- if (cc_display_config_is_cloning (priv->current_config))
+ if (cc_display_config_is_cloning (panel->current_config))
{
- cc_display_config_set_cloning (priv->current_config, FALSE);
+ cc_display_config_set_cloning (panel->current_config, FALSE);
}
single = g_str_equal (gtk_stack_get_visible_child_name (GTK_STACK (stack)), "single");
- outputs = cc_display_config_get_monitors (priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l; l = l->next)
{
CcDisplayMonitor *output = l->data;
- cc_display_monitor_set_active (output, (!single || output == priv->current_output));
+ cc_display_monitor_set_active (output, (!single || output == panel->current_output));
}
if (single)
@@ -1974,13 +1939,12 @@ add_two_output_page (GtkWidget *switcher,
static GtkWidget *
make_two_output_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *switcher, *stack, *label;
gboolean show_mirror;
- show_mirror = g_list_length (cc_display_config_get_cloning_modes (priv->current_config)) > 0;
+ show_mirror = g_list_length (cc_display_config_get_cloning_modes (panel->current_config)) > 0;
- vbox = make_main_vbox (priv->main_size_group);
+ vbox = make_main_vbox (panel->main_size_group);
label = make_bold_label (_("Display Mode"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
@@ -2013,7 +1977,7 @@ make_two_output_ui (CcDisplayPanel *panel)
G_CALLBACK (two_output_visible_child_changed),
panel, G_CONNECT_SWAPPED);
- if (cc_display_config_is_cloning (priv->current_config) && show_mirror)
+ if (cc_display_config_is_cloning (panel->current_config) && show_mirror)
gtk_stack_set_visible_child_name (GTK_STACK (stack), "mirror");
else if (count_active_outputs (panel) > 1)
gtk_stack_set_visible_child_name (GTK_STACK (stack), "join");
@@ -2028,7 +1992,7 @@ output_switch_active (CcDisplayPanel *panel,
GParamSpec *pspec,
GtkWidget *button)
{
- cc_display_monitor_set_active (panel->priv->current_output,
+ cc_display_monitor_set_active (panel->current_output,
gtk_switch_get_active (GTK_SWITCH (button)));
update_apply_button (panel);
}
@@ -2043,17 +2007,16 @@ output_switch_sync (GtkWidget *button,
static GtkWidget *
make_output_switch (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *button = gtk_switch_new ();
g_signal_connect_object (button, "notify::active", G_CALLBACK (output_switch_active),
panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (priv->current_output, "active", G_CALLBACK (output_switch_sync),
+ g_signal_connect_object (panel->current_output, "active", G_CALLBACK (output_switch_sync),
button, G_CONNECT_SWAPPED);
- output_switch_sync (button, priv->current_output);
+ output_switch_sync (button, panel->current_output);
- if ((count_active_outputs (panel) < 2 && cc_display_monitor_is_active (priv->current_output)) ||
- (cc_display_monitor_is_builtin (priv->current_output) && priv->lid_is_closed))
+ if ((count_active_outputs (panel) < 2 && cc_display_monitor_is_active (panel->current_output)) ||
+ (cc_display_monitor_is_builtin (panel->current_output) && panel->lid_is_closed))
gtk_widget_set_sensitive (button, FALSE);
return button;
@@ -2080,7 +2043,7 @@ static void
output_chooser_sync (GtkWidget *button,
CcDisplayPanel *panel)
{
- gchar *text = g_object_get_data (G_OBJECT (panel->priv->current_output), "ui-number-name");
+ gchar *text = g_object_get_data (G_OBJECT (panel->current_output), "ui-number-name");
GtkWidget *label = gtk_bin_get_child (GTK_BIN (button));
gtk_label_set_text (GTK_LABEL (label), text);
@@ -2090,11 +2053,10 @@ output_chooser_sync (GtkWidget *button,
static GtkWidget *
make_output_chooser_button (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *listbox, *button, *popover;
GList *outputs, *l;
- outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
+ outputs = g_object_get_data (G_OBJECT (panel->current_config), "ui-sorted-outputs");
popover = gtk_popover_new (NULL);
listbox = make_list_box ();
@@ -2133,12 +2095,11 @@ make_output_chooser_button (CcDisplayPanel *panel)
static GtkWidget *
make_multi_output_ui (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *vbox, *frame, *hbox;
- priv->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
- vbox = make_main_vbox (priv->main_size_group);
+ vbox = make_main_vbox (panel->main_size_group);
gtk_container_add (GTK_CONTAINER (vbox), make_arrangement_ui (panel));
@@ -2164,61 +2125,60 @@ make_multi_output_ui (CcDisplayPanel *panel)
gtk_container_add (GTK_CONTAINER (vbox), make_night_light_widget (panel));
- g_clear_object (&priv->rows_size_group);
+ g_clear_object (&panel->rows_size_group);
return make_scrollable (vbox);
}
static void
on_screen_changed (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcDisplayConfig *current;
GList *outputs, *l;
GtkWidget *main_widget;
guint n_outputs;
- if (!priv->manager)
+ if (!panel->manager)
return;
reset_titlebar (panel);
- main_widget = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "main");
+ main_widget = gtk_stack_get_child_by_name (GTK_STACK (panel->stack), "main");
if (main_widget)
gtk_widget_destroy (main_widget);
- if (priv->dialog)
- gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_NONE);
+ if (panel->dialog)
+ gtk_dialog_response (GTK_DIALOG (panel->dialog), GTK_RESPONSE_NONE);
- g_clear_object (&priv->current_config);
+ g_clear_object (&panel->current_config);
- current = cc_display_config_manager_get_current (priv->manager);
+ current = cc_display_config_manager_get_current (panel->manager);
if (!current)
goto show_error;
- priv->current_config = current;
+ panel->current_config = current;
ensure_output_numbers (current);
ensure_monitor_labels (panel);
- priv->current_output = NULL;
+ panel->current_output = NULL;
outputs = g_object_get_data (G_OBJECT (current), "ui-sorted-outputs");
for (l = outputs; l; l = l->next)
{
CcDisplayMonitor *output = l->data;
if (!cc_display_monitor_is_active (output) ||
- (cc_display_monitor_is_builtin (output) && priv->lid_is_closed))
+ (cc_display_monitor_is_builtin (output) && panel->lid_is_closed))
continue;
- priv->current_output = output;
+ panel->current_output = output;
break;
}
- if (!priv->current_output)
+ if (!panel->current_output)
goto show_error;
n_outputs = g_list_length (outputs);
- if (priv->lid_is_closed)
+ if (panel->lid_is_closed)
{
if (n_outputs <= 2)
main_widget = make_single_output_ui (panel);
@@ -2236,12 +2196,12 @@ on_screen_changed (CcDisplayPanel *panel)
}
gtk_widget_show_all (main_widget);
- gtk_stack_add_named (GTK_STACK (priv->stack), main_widget, "main");
- gtk_stack_set_visible_child (GTK_STACK (priv->stack), main_widget);
+ gtk_stack_add_named (GTK_STACK (panel->stack), main_widget, "main");
+ gtk_stack_set_visible_child (GTK_STACK (panel->stack), main_widget);
return;
show_error:
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "error");
+ gtk_stack_set_visible_child_name (GTK_STACK (panel->stack), "error");
}
#define SPACE 15
@@ -2255,7 +2215,7 @@ get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
*total_w = 0;
*total_h = 0;
- outputs = cc_display_config_get_monitors (self->priv->current_config);
+ outputs = cc_display_config_get_monitors (self->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
@@ -2263,7 +2223,7 @@ get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
get_geometry (output, NULL, NULL, &w, &h);
- if (cc_display_config_is_layout_logical (self->priv->current_config))
+ if (cc_display_config_is_layout_logical (self->current_config))
{
double scale = cc_display_monitor_get_scale (output);
w /= scale;
@@ -2287,7 +2247,7 @@ compute_scale (CcDisplayPanel *self, FooScrollArea *area)
get_total_size (self, &total_w, &total_h);
- n_monitors = g_list_length (cc_display_config_get_monitors (self->priv->current_config));
+ n_monitors = g_list_length (cc_display_config_get_monitors (self->current_config));
available_w = viewport.width - 2 * MARGIN - (n_monitors - 1) * SPACE;
available_h = viewport.height - 2 * MARGIN - (n_monitors - 1) * SPACE;
@@ -2350,8 +2310,8 @@ list_edges (CcDisplayPanel *panel, GArray *edges)
GList *outputs, *l;
gboolean should_scale;
- should_scale = cc_display_config_is_layout_logical (panel->priv->current_config);
- outputs = cc_display_config_get_monitors (panel->priv->current_config);
+ should_scale = cc_display_config_is_layout_logical (panel->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l != NULL; l = l->next)
{
@@ -2555,10 +2515,10 @@ output_overlaps (CcDisplayMonitor *output, CcDisplayPanel *panel)
g_assert (output != NULL);
- should_scale = cc_display_config_is_layout_logical (panel->priv->current_config);
+ should_scale = cc_display_config_is_layout_logical (panel->current_config);
get_output_rect (output, &output_rect, should_scale);
- outputs = cc_display_config_get_monitors (panel->priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *o = l->data;
@@ -2580,7 +2540,7 @@ config_is_aligned (CcDisplayPanel *panel, GArray *edges)
gboolean result = TRUE;
GList *outputs, *l;
- outputs = cc_display_config_get_monitors (panel->priv->current_config);
+ outputs = cc_display_config_get_monitors (panel->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
@@ -2682,14 +2642,13 @@ on_toplevel_key_press (GtkWidget *button,
static void
show_apply_titlebar (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWidget *header, *button, *toplevel;
GtkSizeGroup *size_group;
- if (priv->apply_titlebar)
+ if (panel->apply_titlebar)
return;
- priv->apply_titlebar = header = gtk_header_bar_new ();
+ panel->apply_titlebar = header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), _("Apply Changes?"));
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
@@ -2717,28 +2676,27 @@ show_apply_titlebar (CcDisplayPanel *panel)
header = gtk_window_get_titlebar (GTK_WINDOW (toplevel));
if (header)
- priv->main_titlebar = g_object_ref (header);
+ panel->main_titlebar = g_object_ref (header);
- gtk_window_set_titlebar (GTK_WINDOW (toplevel), priv->apply_titlebar);
- g_object_ref (priv->apply_titlebar);
+ gtk_window_set_titlebar (GTK_WINDOW (toplevel), panel->apply_titlebar);
+ g_object_ref (panel->apply_titlebar);
}
static void
update_apply_button (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
gboolean config_equal;
CcDisplayConfig *applied_config;
- if (!cc_display_config_is_applicable (priv->current_config))
+ if (!cc_display_config_is_applicable (panel->current_config))
{
reset_titlebar (panel);
return;
}
- applied_config = cc_display_config_manager_get_current (priv->manager);
+ applied_config = cc_display_config_manager_get_current (panel->manager);
- config_equal = cc_display_config_equal (priv->current_config,
+ config_equal = cc_display_config_equal (panel->current_config,
applied_config);
g_object_unref (applied_config);
@@ -2767,13 +2725,13 @@ on_output_event (FooScrollArea *area,
return;
}
- n_monitors = g_list_length (cc_display_config_get_monitors (self->priv->current_config));
+ n_monitors = g_list_length (cc_display_config_get_monitors (self->current_config));
/* If the mouse is inside the outputs, set the cursor to "you can move me". See
* on_canvas_event() for where we reset the cursor to the default if it
* exits the outputs' area.
*/
- if (!cc_display_config_is_cloning (self->priv->current_config) &&
+ if (!cc_display_config_is_cloning (self->current_config) &&
n_monitors > 1)
set_cursor (GTK_WIDGET (area), GDK_FLEUR);
@@ -2783,7 +2741,7 @@ on_output_event (FooScrollArea *area,
set_current_output (self, output);
- if (!cc_display_config_is_cloning (self->priv->current_config) &&
+ if (!cc_display_config_is_cloning (self->current_config) &&
n_monitors > 1)
{
int output_x, output_y;
@@ -2914,12 +2872,12 @@ on_area_paint (FooScrollArea *area,
paint_background (area, cr);
- if (!self->priv->current_config)
+ if (!self->current_config)
return;
get_total_size (self, &total_w, &total_h);
- connected_outputs = cc_display_config_get_monitors (self->priv->current_config);
+ connected_outputs = cc_display_config_get_monitors (self->current_config);
for (list = connected_outputs; list != NULL; list = list->next)
{
int w, h;
@@ -2930,14 +2888,14 @@ on_area_paint (FooScrollArea *area,
GdkRectangle viewport;
if (!cc_display_monitor_is_active (output) ||
- (cc_display_monitor_is_builtin (output) && self->priv->lid_is_closed))
+ (cc_display_monitor_is_builtin (output) && self->lid_is_closed))
continue;
cairo_save (cr);
foo_scroll_area_get_viewport (area, &viewport);
get_geometry (output, &output_x, &output_y, &w, &h);
- if (cc_display_config_is_layout_logical (self->priv->current_config))
+ if (cc_display_config_is_layout_logical (self->current_config))
{
double scale = cc_display_monitor_get_scale (output);
w /= scale;
@@ -2957,13 +2915,13 @@ on_area_paint (FooScrollArea *area,
cairo_fill (cr);
cairo_translate (cr, x, y);
- paint_output (self, cr, self->priv->current_config, output,
+ paint_output (self, cr, self->current_config, output,
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (output), "ui-number")),
w * scale, h * scale);
cairo_restore (cr);
- if (cc_display_config_is_cloning (self->priv->current_config))
+ if (cc_display_config_is_cloning (self->current_config))
break;
}
}
@@ -2973,7 +2931,7 @@ apply_current_configuration (CcDisplayPanel *self)
{
GError *error = NULL;
- cc_display_config_apply (self->priv->current_config, &error);
+ cc_display_config_apply (self->current_config, &error);
/* re-read the configuration */
on_screen_changed (self);
@@ -3129,7 +3087,6 @@ static gboolean
should_show_rotation (CcDisplayPanel *panel,
CcDisplayMonitor *output)
{
- CcDisplayPanelPrivate *priv = panel->priv;
gboolean supports_rotation;
supports_rotation = cc_display_monitor_supports_rotation (output,
@@ -3146,29 +3103,27 @@ should_show_rotation (CcDisplayPanel *panel,
return TRUE;
/* Only offer rotation if there's no accelerometer */
- return !priv->has_accelerometer;
+ return !panel->has_accelerometer;
}
static void
cc_display_panel_night_light_activated (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
GtkWindow *toplevel;
toplevel = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel))));
- cc_night_light_dialog_present (priv->night_light_dialog, toplevel);
+ cc_night_light_dialog_present (panel->night_light_dialog, toplevel);
}
static void
mapped_cb (CcDisplayPanel *panel)
{
- CcDisplayPanelPrivate *priv = panel->priv;
CcShell *shell;
GtkWidget *toplevel;
shell = cc_panel_get_shell (CC_PANEL (panel));
toplevel = cc_shell_get_toplevel (shell);
- if (toplevel && !priv->focus_id)
- priv->focus_id = g_signal_connect_swapped (toplevel, "notify::has-toplevel-focus",
+ if (toplevel && !panel->focus_id)
+ panel->focus_id = g_signal_connect_swapped (toplevel, "notify::has-toplevel-focus",
G_CALLBACK (dialog_toplevel_focus_changed), panel);
}
@@ -3177,14 +3132,13 @@ cc_display_panel_up_client_changed (UpClient *client,
GParamSpec *pspec,
CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv = self->priv;
gboolean lid_is_closed;
lid_is_closed = up_client_get_lid_is_closed (client);
- if (lid_is_closed != priv->lid_is_closed)
+ if (lid_is_closed != self->lid_is_closed)
{
- priv->lid_is_closed = lid_is_closed;
+ self->lid_is_closed = lid_is_closed;
on_screen_changed (self);
}
@@ -3207,7 +3161,7 @@ shell_proxy_ready (GObject *source,
return;
}
- self->priv->shell_proxy = proxy;
+ self->shell_proxy = proxy;
ensure_monitor_labels (self);
}
@@ -3217,25 +3171,25 @@ update_has_accel (CcDisplayPanel *self)
{
GVariant *v;
- if (self->priv->iio_sensor_proxy == NULL)
+ if (self->iio_sensor_proxy == NULL)
{
g_debug ("Has no accelerometer");
- self->priv->has_accelerometer = FALSE;
+ self->has_accelerometer = FALSE;
return;
}
- v = g_dbus_proxy_get_cached_property (self->priv->iio_sensor_proxy, "HasAccelerometer");
+ v = g_dbus_proxy_get_cached_property (self->iio_sensor_proxy, "HasAccelerometer");
if (v)
{
- self->priv->has_accelerometer = g_variant_get_boolean (v);
+ self->has_accelerometer = g_variant_get_boolean (v);
g_variant_unref (v);
}
else
{
- self->priv->has_accelerometer = FALSE;
+ self->has_accelerometer = FALSE;
}
- g_debug ("Has %saccelerometer", self->priv->has_accelerometer ? "" : "no ");
+ g_debug ("Has %saccelerometer", self->has_accelerometer ? "" : "no ");
}
static void
@@ -3262,7 +3216,7 @@ sensor_proxy_appeared_cb (GDBusConnection *connection,
g_debug ("SensorProxy appeared");
- self->priv->iio_sensor_proxy = g_dbus_proxy_new_sync (connection,
+ self->iio_sensor_proxy = g_dbus_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"net.hadess.SensorProxy",
@@ -3270,9 +3224,9 @@ sensor_proxy_appeared_cb (GDBusConnection *connection,
"net.hadess.SensorProxy",
NULL,
NULL);
- g_return_if_fail (self->priv->iio_sensor_proxy);
+ g_return_if_fail (self->iio_sensor_proxy);
- g_signal_connect (self->priv->iio_sensor_proxy, "g-properties-changed",
+ g_signal_connect (self->iio_sensor_proxy, "g-properties-changed",
G_CALLBACK (sensor_proxy_properties_changed_cb), self);
update_has_accel (self);
}
@@ -3286,7 +3240,7 @@ sensor_proxy_vanished_cb (GDBusConnection *connection,
g_debug ("SensorProxy vanished");
- g_clear_object (&self->priv->iio_sensor_proxy);
+ g_clear_object (&self->iio_sensor_proxy);
update_has_accel (self);
}
@@ -3309,7 +3263,6 @@ settings_color_changed_cb (GSettings *settings, gchar *key, GtkWidget *label)
static GtkWidget *
make_night_light_widget (CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv = DISPLAY_PANEL_PRIVATE (self);
GtkWidget *frame, *row, *label, *state_label;
GtkWidget *night_light_listbox;
@@ -3321,11 +3274,11 @@ make_night_light_widget (CcDisplayPanel *self)
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
state_label = gtk_label_new ("");
- g_signal_connect_object (priv->settings_color, "changed",
+ g_signal_connect_object (self->settings_color, "changed",
G_CALLBACK (settings_color_changed_cb), state_label, 0);
- night_light_sync_label (state_label, priv->settings_color);
+ night_light_sync_label (state_label, self->settings_color);
- row = make_row (priv->rows_size_group, label, state_label);
+ row = make_row (self->rows_size_group, label, state_label);
gtk_container_add (GTK_CONTAINER (night_light_listbox), row);
g_signal_connect_object (row, "activated",
G_CALLBACK (cc_display_panel_night_light_activated),
@@ -3349,14 +3302,14 @@ session_bus_ready (GObject *source,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
g_warning ("Failed to get session bus: %s", error->message);
- gtk_stack_set_visible_child_name (GTK_STACK (self->priv->stack), "error");
+ gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "error");
}
g_error_free (error);
return;
}
- self->priv->manager = cc_display_config_manager_dbus_new ();
- g_signal_connect_object (self->priv->manager, "changed",
+ self->manager = cc_display_config_manager_dbus_new ();
+ g_signal_connect_object (self->manager, "changed",
G_CALLBACK (on_screen_changed),
self,
G_CONNECT_SWAPPED);
@@ -3365,41 +3318,38 @@ session_bus_ready (GObject *source,
static void
cc_display_panel_init (CcDisplayPanel *self)
{
- CcDisplayPanelPrivate *priv;
GSettings *settings;
GtkWidget *bin;
g_resources_register (cc_display_get_resource ());
- priv = self->priv = DISPLAY_PANEL_PRIVATE (self);
-
- priv->stack = gtk_stack_new ();
+ self->stack = gtk_stack_new ();
bin = make_bin ();
gtk_widget_set_size_request (bin, 500, -1);
- gtk_stack_add_named (GTK_STACK (priv->stack), bin, "main-size-group");
- priv->main_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_size_group_add_widget (priv->main_size_group, bin);
+ gtk_stack_add_named (GTK_STACK (self->stack), bin, "main-size-group");
+ self->main_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (self->main_size_group, bin);
- gtk_stack_add_named (GTK_STACK (priv->stack),
+ gtk_stack_add_named (GTK_STACK (self->stack),
gtk_label_new (_("Could not get screen information")),
"error");
- gtk_container_add (GTK_CONTAINER (self), priv->stack);
- gtk_widget_show_all (priv->stack);
+ gtk_container_add (GTK_CONTAINER (self), self->stack);
+ gtk_widget_show_all (self->stack);
settings = g_settings_new ("org.gnome.desktop.background");
- priv->background = gnome_bg_new ();
- gnome_bg_load_from_preferences (priv->background, settings);
+ self->background = gnome_bg_new ();
+ gnome_bg_load_from_preferences (self->background, settings);
g_object_unref (settings);
- priv->thumbnail_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
+ self->thumbnail_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
- priv->night_light_dialog = cc_night_light_dialog_new ();
- priv->settings_color = g_settings_new ("org.gnome.settings-daemon.plugins.color");
+ self->night_light_dialog = cc_night_light_dialog_new ();
+ self->settings_color = g_settings_new ("org.gnome.settings-daemon.plugins.color");
- self->priv->up_client = up_client_new ();
- if (up_client_get_lid_is_present (self->priv->up_client))
+ self->up_client = up_client_new ();
+ if (up_client_get_lid_is_present (self->up_client))
{
/* Connect to the "changed" signal to track changes to "lid-is-closed"
* property. Connecting to "notify::lid-is-closed" would be preferable,
@@ -3407,16 +3357,16 @@ cc_display_panel_init (CcDisplayPanel *self)
* https://bugs.freedesktop.org/show_bug.cgi?id=43001
*/
- g_signal_connect (self->priv->up_client, "notify::lid-is-closed",
+ g_signal_connect (self->up_client, "notify::lid-is-closed",
G_CALLBACK (cc_display_panel_up_client_changed), self);
- cc_display_panel_up_client_changed (self->priv->up_client, NULL, self);
+ cc_display_panel_up_client_changed (self->up_client, NULL, self);
}
else
- g_clear_object (&self->priv->up_client);
+ g_clear_object (&self->up_client);
g_signal_connect (self, "map", G_CALLBACK (mapped_cb), NULL);
- self->priv->shell_cancellable = g_cancellable_new ();
+ self->shell_cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS |
@@ -3425,16 +3375,16 @@ cc_display_panel_init (CcDisplayPanel *self)
"org.gnome.Shell",
"/org/gnome/Shell",
"org.gnome.Shell",
- self->priv->shell_cancellable,
+ self->shell_cancellable,
(GAsyncReadyCallback) shell_proxy_ready,
self);
g_bus_get (G_BUS_TYPE_SESSION,
- self->priv->shell_cancellable,
+ self->shell_cancellable,
(GAsyncReadyCallback) session_bus_ready,
self);
- priv->sensor_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ self->sensor_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"net.hadess.SensorProxy",
G_BUS_NAME_WATCHER_FLAGS_NONE,
sensor_proxy_appeared_cb,
diff --git a/panels/display/cc-display-panel.h b/panels/display/cc-display-panel.h
index 108051053..a6b932b03 100644
--- a/panels/display/cc-display-panel.h
+++ b/panels/display/cc-display-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_DISPLAY_PANEL cc_display_panel_get_type()
-
-#define CC_DISPLAY_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_DISPLAY_PANEL, CcDisplayPanel))
-
-#define CC_DISPLAY_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_DISPLAY_PANEL, CcDisplayPanelClass))
-
-#define CC_IS_DISPLAY_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_DISPLAY_PANEL))
-
-#define CC_IS_DISPLAY_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_DISPLAY_PANEL))
-
-#define CC_DISPLAY_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_DISPLAY_PANEL, CcDisplayPanelClass))
-
-typedef struct _CcDisplayPanel CcDisplayPanel;
-typedef struct _CcDisplayPanelClass CcDisplayPanelClass;
-typedef struct _CcDisplayPanelPrivate CcDisplayPanelPrivate;
-
-struct _CcDisplayPanel
-{
- CcPanel parent;
-
- CcDisplayPanelPrivate *priv;
-};
-
-struct _CcDisplayPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_display_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_DISPLAY_PANEL (cc_display_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcDisplayPanel, cc_display_panel, CC, DISPLAY_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/display/scrollarea.c b/panels/display/scrollarea.c
index e71d2ece8..73736436c 100644
--- a/panels/display/scrollarea.c
+++ b/panels/display/scrollarea.c
@@ -18,9 +18,6 @@
#include <gdk/gdk.h>
-G_DEFINE_TYPE_WITH_CODE (FooScrollArea, foo_scroll_area, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL));
-
static GtkWidgetClass *parent_class;
typedef struct BackingStore BackingStore;
@@ -63,8 +60,10 @@ struct AutoScrollInfo
GTimer *timer;
};
-struct FooScrollAreaPrivate
+struct _FooScrollArea
{
+ GtkContainer parent_instance;
+
GdkWindow *input_window;
int width;
@@ -99,6 +98,9 @@ struct FooScrollAreaPrivate
cairo_region_t *update_region; /* In canvas coordinates */
};
+G_DEFINE_TYPE_WITH_CODE (FooScrollArea, foo_scroll_area, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL));
+
enum
{
VIEWPORT_CHANGED,
@@ -149,8 +151,8 @@ foo_scroll_area_map (GtkWidget *widget)
GTK_WIDGET_CLASS (parent_class)->map (widget);
- if (area->priv->input_window)
- gdk_window_show (area->priv->input_window);
+ if (area->input_window)
+ gdk_window_show (area->input_window);
}
static void
@@ -158,8 +160,8 @@ foo_scroll_area_unmap (GtkWidget *widget)
{
FooScrollArea *area = FOO_SCROLL_AREA (widget);
- if (area->priv->input_window)
- gdk_window_hide (area->priv->input_window);
+ if (area->input_window)
+ gdk_window_hide (area->input_window);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
@@ -169,12 +171,12 @@ foo_scroll_area_finalize (GObject *object)
{
FooScrollArea *scroll_area = FOO_SCROLL_AREA (object);
- g_object_unref (scroll_area->priv->hadj);
- g_object_unref (scroll_area->priv->vadj);
+ g_object_unref (scroll_area->hadj);
+ g_object_unref (scroll_area->vadj);
- g_ptr_array_free (scroll_area->priv->input_regions, TRUE);
+ g_ptr_array_free (scroll_area->input_regions, TRUE);
- g_free (scroll_area->priv);
+ g_free (scroll_area);
G_OBJECT_CLASS (foo_scroll_area_parent_class)->finalize (object);
}
@@ -190,16 +192,16 @@ foo_scroll_area_get_property (GObject *object,
switch (property_id)
{
case PROP_VADJUSTMENT:
- g_value_set_object (value, &scroll_area->priv->vadj);
+ g_value_set_object (value, &scroll_area->vadj);
break;
case PROP_HADJUSTMENT:
- g_value_set_object (value, &scroll_area->priv->hadj);
+ g_value_set_object (value, &scroll_area->hadj);
break;
case PROP_HSCROLL_POLICY:
- g_value_set_enum (value, scroll_area->priv->hscroll_policy);
+ g_value_set_enum (value, scroll_area->hscroll_policy);
break;
case PROP_VSCROLL_POLICY:
- g_value_set_enum (value, scroll_area->priv->vscroll_policy);
+ g_value_set_enum (value, scroll_area->vscroll_policy);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -222,10 +224,10 @@ foo_scroll_area_set_property (GObject *object,
foo_scroll_area_set_hadjustment (FOO_SCROLL_AREA (object), g_value_get_object (value));
break;
case PROP_HSCROLL_POLICY:
- scroll_area->priv->hscroll_policy = g_value_get_enum (value);
+ scroll_area->hscroll_policy = g_value_get_enum (value);
break;
case PROP_VSCROLL_POLICY:
- scroll_area->priv->vscroll_policy = g_value_get_enum (value);
+ scroll_area->vscroll_policy = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -266,8 +268,7 @@ foo_scroll_area_class_init (FooScrollAreaClass *class)
g_signal_new ("viewport_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (FooScrollAreaClass,
- viewport_changed),
+ 0,
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 2,
@@ -278,8 +279,7 @@ foo_scroll_area_class_init (FooScrollAreaClass *class)
g_signal_new ("paint",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (FooScrollAreaClass,
- paint),
+ 0,
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 1,
@@ -302,19 +302,18 @@ foo_scroll_area_init (FooScrollArea *scroll_area)
gtk_widget_set_has_window (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, FALSE);
- scroll_area->priv = g_new0 (FooScrollAreaPrivate, 1);
- scroll_area->priv->width = 0;
- scroll_area->priv->height = 0;
- scroll_area->priv->hadj = g_object_ref_sink (new_adjustment());
- scroll_area->priv->vadj = g_object_ref_sink (new_adjustment());
- scroll_area->priv->x_offset = 0.0;
- scroll_area->priv->y_offset = 0.0;
- scroll_area->priv->min_width = 0;
- scroll_area->priv->min_height = 0;
- scroll_area->priv->auto_scroll_info = NULL;
- scroll_area->priv->input_regions = g_ptr_array_new ();
- scroll_area->priv->surface = NULL;
- scroll_area->priv->update_region = cairo_region_create ();
+ scroll_area->width = 0;
+ scroll_area->height = 0;
+ scroll_area->hadj = g_object_ref_sink (new_adjustment());
+ scroll_area->vadj = g_object_ref_sink (new_adjustment());
+ scroll_area->x_offset = 0.0;
+ scroll_area->y_offset = 0.0;
+ scroll_area->min_width = 0;
+ scroll_area->min_height = 0;
+ scroll_area->auto_scroll_info = NULL;
+ scroll_area->input_regions = g_ptr_array_new ();
+ scroll_area->surface = NULL;
+ scroll_area->update_region = cairo_region_create ();
}
typedef struct
@@ -351,8 +350,8 @@ get_viewport (FooScrollArea *scroll_area,
gtk_widget_get_allocation (widget, &allocation);
- viewport->x = scroll_area->priv->x_offset;
- viewport->y = scroll_area->priv->y_offset;
+ viewport->x = scroll_area->x_offset;
+ viewport->y = scroll_area->y_offset;
viewport->width = allocation.width;
viewport->height = allocation.height;
}
@@ -362,8 +361,8 @@ allocation_to_canvas (FooScrollArea *area,
int *x,
int *y)
{
- *x += area->priv->x_offset;
- *y += area->priv->y_offset;
+ *x += area->x_offset;
+ *y += area->y_offset;
}
static void
@@ -382,16 +381,16 @@ clear_exposed_input_region (FooScrollArea *area,
viewport = cairo_region_create_rectangle (&allocation);
cairo_region_subtract (viewport, exposed);
- for (i = 0; i < area->priv->input_regions->len; ++i)
+ for (i = 0; i < area->input_regions->len; ++i)
{
- InputRegion *region = area->priv->input_regions->pdata[i];
+ InputRegion *region = area->input_regions->pdata[i];
cairo_region_intersect (region->region, viewport);
if (cairo_region_is_empty (region->region))
{
input_region_free (region);
- g_ptr_array_remove_index_fast (area->priv->input_regions, i--);
+ g_ptr_array_remove_index_fast (area->input_regions, i--);
}
}
@@ -449,27 +448,27 @@ foo_scroll_area_draw (GtkWidget *widget,
*/
/* Setup input areas */
- clear_exposed_input_region (scroll_area, scroll_area->priv->update_region);
+ clear_exposed_input_region (scroll_area, scroll_area->update_region);
- scroll_area->priv->current_input = g_new0 (InputRegion, 1);
- scroll_area->priv->current_input->region = cairo_region_copy (scroll_area->priv->update_region);
- scroll_area->priv->current_input->paths = NULL;
- g_ptr_array_add (scroll_area->priv->input_regions,
- scroll_area->priv->current_input);
+ scroll_area->current_input = g_new0 (InputRegion, 1);
+ scroll_area->current_input->region = cairo_region_copy (scroll_area->update_region);
+ scroll_area->current_input->paths = NULL;
+ g_ptr_array_add (scroll_area->input_regions,
+ scroll_area->current_input);
- region = scroll_area->priv->update_region;
- scroll_area->priv->update_region = cairo_region_create ();
+ region = scroll_area->update_region;
+ scroll_area->update_region = cairo_region_create ();
initialize_background (widget, cr);
g_signal_emit (widget, signals[PAINT], 0, cr);
- scroll_area->priv->current_input = NULL;
+ scroll_area->current_input = NULL;
gtk_widget_get_allocation (widget, &widget_allocation);
/* Finally draw the backing surface */
- cairo_set_source_surface (cr, scroll_area->priv->surface,
+ cairo_set_source_surface (cr, scroll_area->surface,
widget_allocation.x, widget_allocation.y);
cairo_fill (cr);
@@ -505,10 +504,10 @@ emit_viewport_changed (FooScrollArea *scroll_area,
g_signal_emit (scroll_area, signals[VIEWPORT_CHANGED], 0,
new_viewport, old_viewport);
- if (scroll_area->priv->input_window == NULL)
+ if (scroll_area->input_window == NULL)
return;
- gdk_window_get_device_position (scroll_area->priv->input_window,
+ gdk_window_get_device_position (scroll_area->input_window,
gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_display_get_default ())),
&px, &py, NULL);
@@ -537,8 +536,8 @@ set_adjustment_values (FooScrollArea *scroll_area)
{
GtkAllocation allocation;
- GtkAdjustment *hadj = scroll_area->priv->hadj;
- GtkAdjustment *vadj = scroll_area->priv->vadj;
+ GtkAdjustment *hadj = scroll_area->hadj;
+ GtkAdjustment *vadj = scroll_area->vadj;
/* Horizontal */
gtk_widget_get_allocation (GTK_WIDGET (scroll_area), &allocation);
@@ -547,7 +546,7 @@ set_adjustment_values (FooScrollArea *scroll_area)
gtk_adjustment_set_step_increment (hadj, 0.1 * allocation.width);
gtk_adjustment_set_page_increment (hadj, 0.9 * allocation.width);
gtk_adjustment_set_lower (hadj, 0.0);
- gtk_adjustment_set_upper (hadj, scroll_area->priv->width);
+ gtk_adjustment_set_upper (hadj, scroll_area->width);
g_object_thaw_notify (G_OBJECT (hadj));
/* Vertical */
@@ -556,7 +555,7 @@ set_adjustment_values (FooScrollArea *scroll_area)
gtk_adjustment_set_step_increment (vadj, 0.1 * allocation.height);
gtk_adjustment_set_page_increment (vadj, 0.9 * allocation.height);
gtk_adjustment_set_lower (vadj, 0.0);
- gtk_adjustment_set_upper (vadj, scroll_area->priv->height);
+ gtk_adjustment_set_upper (vadj, scroll_area->height);
g_object_thaw_notify (G_OBJECT (vadj));
clamp_adjustment (hadj);
@@ -600,17 +599,17 @@ foo_scroll_area_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
g_object_ref (window);
- area->priv->input_window = gdk_window_new (window,
+ area->input_window = gdk_window_new (window,
&attributes, attributes_mask);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
- area->priv->surface = cairo_surface_create_similar (cairo_get_target (cr),
+ area->surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_COLOR,
widget_allocation.width,
widget_allocation.height);
cairo_destroy (cr);
- gdk_window_set_user_data (area->priv->input_window, area);
+ gdk_window_set_user_data (area->input_window, area);
}
static void
@@ -618,11 +617,11 @@ foo_scroll_area_unrealize (GtkWidget *widget)
{
FooScrollArea *area = FOO_SCROLL_AREA (widget);
- if (area->priv->input_window)
+ if (area->input_window)
{
- gdk_window_set_user_data (area->priv->input_window, NULL);
- gdk_window_destroy (area->priv->input_window);
- area->priv->input_window = NULL;
+ gdk_window_set_user_data (area->input_window, NULL);
+ gdk_window_destroy (area->input_window);
+ area->input_window = NULL;
}
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
@@ -664,7 +663,7 @@ static void
allocation_to_canvas_region (FooScrollArea *area,
cairo_region_t *region)
{
- cairo_region_translate (region, area->priv->x_offset, area->priv->y_offset);
+ cairo_region_translate (region, area->x_offset, area->y_offset);
}
static void
@@ -713,18 +712,18 @@ foo_scroll_area_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
- if (scroll_area->priv->input_window)
+ if (scroll_area->input_window)
{
cairo_surface_t *new_surface;
- gdk_window_move_resize (scroll_area->priv->input_window,
+ gdk_window_move_resize (scroll_area->input_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
- new_surface = create_new_surface (widget, scroll_area->priv->surface);
- cairo_surface_destroy (scroll_area->priv->surface);
+ new_surface = create_new_surface (widget, scroll_area->surface);
+ cairo_surface_destroy (scroll_area->surface);
- scroll_area->priv->surface = new_surface;
+ scroll_area->surface = new_surface;
}
get_viewport (scroll_area, &new_viewport);
@@ -763,20 +762,20 @@ process_event (FooScrollArea *scroll_area,
allocation_to_canvas (scroll_area, &x, &y);
- if (scroll_area->priv->grabbed)
+ if (scroll_area->grabbed)
{
emit_input (scroll_area, input_type, x, y,
- scroll_area->priv->grab_func,
- scroll_area->priv->grab_data);
+ scroll_area->grab_func,
+ scroll_area->grab_data);
}
#if 0
- g_print ("number of input regions: %d\n", scroll_area->priv->input_regions->len);
+ g_print ("number of input regions: %d\n", scroll_area->input_regions->len);
#endif
- for (i = 0; i < scroll_area->priv->input_regions->len; ++i)
+ for (i = 0; i < scroll_area->input_regions->len; ++i)
{
- InputRegion *region = scroll_area->priv->input_regions->pdata[i];
+ InputRegion *region = scroll_area->input_regions->pdata[i];
#if 0
g_print ("region %d (looking for %d,%d) ", i, x, y);
@@ -806,7 +805,7 @@ process_event (FooScrollArea *scroll_area,
if (inside)
{
- if (scroll_area->priv->grabbed)
+ if (scroll_area->grabbed)
{
emit_input (scroll_area, FOO_DRAG_HOVER,
x, y,
@@ -895,17 +894,17 @@ foo_scroll_area_set_size_fixed_y (FooScrollArea *scroll_area,
int old_y,
int new_y)
{
- scroll_area->priv->width = width;
- scroll_area->priv->height = height;
+ scroll_area->width = width;
+ scroll_area->height = height;
#if 0
g_print ("diff: %d\n", new_y - old_y);
#endif
- g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
- gtk_adjustment_set_value (scroll_area->priv->vadj, new_y);
+ g_object_thaw_notify (G_OBJECT (scroll_area->vadj));
+ gtk_adjustment_set_value (scroll_area->vadj, new_y);
set_adjustment_values (scroll_area);
- g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
+ g_object_thaw_notify (G_OBJECT (scroll_area->vadj));
}
void
@@ -930,8 +929,8 @@ foo_scroll_area_set_size (FooScrollArea *scroll_area,
* fixed points?
*/
- scroll_area->priv->width = width;
- scroll_area->priv->height = height;
+ scroll_area->width = width;
+ scroll_area->height = height;
set_adjustment_values (scroll_area);
}
@@ -944,10 +943,10 @@ foo_scroll_area_get_preferred_width (GtkWidget *widget,
FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
if (minimum != NULL) {
- *minimum = scroll_area->priv->min_width;
+ *minimum = scroll_area->min_width;
}
if (natural != NULL) {
- *natural = scroll_area->priv->min_width;
+ *natural = scroll_area->min_width;
}
}
@@ -959,10 +958,10 @@ foo_scroll_area_get_preferred_height (GtkWidget *widget,
FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
if (minimum != NULL) {
- *minimum = scroll_area->priv->min_height;
+ *minimum = scroll_area->min_height;
}
if (natural != NULL) {
- *natural = scroll_area->priv->min_height;
+ *natural = scroll_area->min_height;
}
}
@@ -997,7 +996,7 @@ foo_scroll_area_scroll (FooScrollArea *area,
move_area.width, move_area.height,
dx, dy);
#endif
- cr = cairo_create (area->priv->surface);
+ cr = cairo_create (area->surface);
/* Cairo doesn't allow self-copies, so we do this little trick instead:
* 1) Clip so the group size is small.
@@ -1007,7 +1006,7 @@ foo_scroll_area_scroll (FooScrollArea *area,
cairo_clip (cr);
cairo_push_group (cr);
- cairo_set_source_surface (cr, area->priv->surface, dx, dy);
+ cairo_set_source_surface (cr, area->surface, dx, dy);
gdk_cairo_rectangle (cr, &move_area);
cairo_fill (cr);
@@ -1042,18 +1041,18 @@ foo_scrollbar_adjustment_changed (GtkAdjustment *adj,
get_viewport (scroll_area, &old_viewport);
- if (adj == scroll_area->priv->hadj)
+ if (adj == scroll_area->hadj)
{
/* FIXME: do we treat the offset as int or double, and,
* if int, how do we round?
*/
- dx = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->x_offset;
- scroll_area->priv->x_offset = gtk_adjustment_get_value (adj);
+ dx = (int)gtk_adjustment_get_value (adj) - scroll_area->x_offset;
+ scroll_area->x_offset = gtk_adjustment_get_value (adj);
}
- else if (adj == scroll_area->priv->vadj)
+ else if (adj == scroll_area->vadj)
{
- dy = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->y_offset;
- scroll_area->priv->y_offset = gtk_adjustment_get_value (adj);
+ dy = (int)gtk_adjustment_get_value (adj) - scroll_area->y_offset;
+ scroll_area->y_offset = gtk_adjustment_get_value (adj);
}
else
{
@@ -1109,7 +1108,7 @@ static void
foo_scroll_area_set_hadjustment (FooScrollArea *scroll_area,
GtkAdjustment *hadjustment)
{
- set_one_adjustment (scroll_area, hadjustment, &scroll_area->priv->hadj);
+ set_one_adjustment (scroll_area, hadjustment, &scroll_area->hadj);
set_adjustment_values (scroll_area);
}
@@ -1118,7 +1117,7 @@ static void
foo_scroll_area_set_vadjustment (FooScrollArea *scroll_area,
GtkAdjustment *vadjustment)
{
- set_one_adjustment (scroll_area, vadjustment, &scroll_area->priv->vadj);
+ set_one_adjustment (scroll_area, vadjustment, &scroll_area->vadj);
set_adjustment_values (scroll_area);
}
@@ -1134,8 +1133,8 @@ foo_scroll_area_set_min_size (FooScrollArea *scroll_area,
int min_width,
int min_height)
{
- scroll_area->priv->min_width = min_width;
- scroll_area->priv->min_height = min_height;
+ scroll_area->min_width = min_width;
+ scroll_area->min_height = min_height;
/* FIXME: think through invalidation.
*
@@ -1161,8 +1160,8 @@ make_path (FooScrollArea *area,
path->path = cairo_copy_path (cr);
path->func = func;
path->data = data;
- path->next = area->priv->current_input->paths;
- area->priv->current_input->paths = path;
+ path->next = area->current_input->paths;
+ area->current_input->paths = path;
return path;
}
@@ -1181,7 +1180,7 @@ foo_scroll_area_add_input_from_fill (FooScrollArea *scroll_area,
{
g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area));
g_return_if_fail (cr != NULL);
- g_return_if_fail (scroll_area->priv->current_input);
+ g_return_if_fail (scroll_area->current_input);
make_path (scroll_area, cr, FALSE, func, data);
}
@@ -1194,7 +1193,7 @@ foo_scroll_area_add_input_from_stroke (FooScrollArea *scroll_area,
{
g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area));
g_return_if_fail (cr != NULL);
- g_return_if_fail (scroll_area->priv->current_input);
+ g_return_if_fail (scroll_area->current_input);
make_path (scroll_area, cr, TRUE, func, data);
}
@@ -1207,7 +1206,7 @@ foo_scroll_area_invalidate (FooScrollArea *scroll_area)
gtk_widget_get_allocation (widget, &allocation);
foo_scroll_area_invalidate_rect (scroll_area,
- scroll_area->priv->x_offset, scroll_area->priv->y_offset,
+ scroll_area->x_offset, scroll_area->y_offset,
allocation.width,
allocation.height);
}
@@ -1221,8 +1220,8 @@ canvas_to_window (FooScrollArea *area,
gtk_widget_get_allocation (widget, &allocation);
cairo_region_translate (region,
- -area->priv->x_offset + allocation.x,
- -area->priv->y_offset + allocation.y);
+ -area->x_offset + allocation.x,
+ -area->y_offset + allocation.y);
}
static void
@@ -1234,8 +1233,8 @@ window_to_canvas (FooScrollArea *area,
gtk_widget_get_allocation (widget, &allocation);
cairo_region_translate (region,
- area->priv->x_offset - allocation.x,
- area->priv->y_offset - allocation.y);
+ area->x_offset - allocation.x,
+ area->y_offset - allocation.y);
}
void
@@ -1248,7 +1247,7 @@ foo_scroll_area_invalidate_region (FooScrollArea *area,
widget = GTK_WIDGET (area);
- cairo_region_union (area->priv->update_region, region);
+ cairo_region_union (area->update_region, region);
if (gtk_widget_get_realized (widget))
{
@@ -1286,11 +1285,11 @@ foo_scroll_area_begin_grab (FooScrollArea *scroll_area,
gpointer input_data)
{
g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area));
- g_return_if_fail (!scroll_area->priv->grabbed);
+ g_return_if_fail (!scroll_area->grabbed);
- scroll_area->priv->grabbed = TRUE;
- scroll_area->priv->grab_func = func;
- scroll_area->priv->grab_data = input_data;
+ scroll_area->grabbed = TRUE;
+ scroll_area->grab_func = func;
+ scroll_area->grab_data = input_data;
/* FIXME: we should probably take a server grab */
/* Also, maybe there should be support for setting the grab cursor */
@@ -1302,9 +1301,9 @@ foo_scroll_area_end_grab (FooScrollArea *scroll_area,
{
g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area));
- scroll_area->priv->grabbed = FALSE;
- scroll_area->priv->grab_func = NULL;
- scroll_area->priv->grab_data = NULL;
+ scroll_area->grabbed = FALSE;
+ scroll_area->grab_func = NULL;
+ scroll_area->grab_data = NULL;
if (event != NULL)
process_event (scroll_area, FOO_DROP, event->x, event->y);
@@ -1313,7 +1312,7 @@ foo_scroll_area_end_grab (FooScrollArea *scroll_area,
gboolean
foo_scroll_area_is_grabbed (FooScrollArea *scroll_area)
{
- return scroll_area->priv->grabbed;
+ return scroll_area->grabbed;
}
void
@@ -1321,14 +1320,14 @@ foo_scroll_area_set_viewport_pos (FooScrollArea *scroll_area,
int x,
int y)
{
- g_object_freeze_notify (G_OBJECT (scroll_area->priv->hadj));
- g_object_freeze_notify (G_OBJECT (scroll_area->priv->vadj));
- gtk_adjustment_set_value (scroll_area->priv->hadj, x);
- gtk_adjustment_set_value (scroll_area->priv->vadj, y);
+ g_object_freeze_notify (G_OBJECT (scroll_area->hadj));
+ g_object_freeze_notify (G_OBJECT (scroll_area->vadj));
+ gtk_adjustment_set_value (scroll_area->hadj, x);
+ gtk_adjustment_set_value (scroll_area->vadj, y);
set_adjustment_values (scroll_area);
- g_object_thaw_notify (G_OBJECT (scroll_area->priv->hadj));
- g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
+ g_object_thaw_notify (G_OBJECT (scroll_area->hadj));
+ g_object_thaw_notify (G_OBJECT (scroll_area->vadj));
}
static gboolean
@@ -1346,13 +1345,13 @@ stop_scrolling (FooScrollArea *area)
#if 0
g_print ("stop scrolling\n");
#endif
- if (area->priv->auto_scroll_info)
+ if (area->auto_scroll_info)
{
- g_source_remove (area->priv->auto_scroll_info->timeout_id);
- g_timer_destroy (area->priv->auto_scroll_info->timer);
- g_free (area->priv->auto_scroll_info);
+ g_source_remove (area->auto_scroll_info->timeout_id);
+ g_timer_destroy (area->auto_scroll_info->timer);
+ g_free (area->auto_scroll_info);
- area->priv->auto_scroll_info = NULL;
+ area->auto_scroll_info = NULL;
}
}
@@ -1361,7 +1360,7 @@ scroll_idle (gpointer data)
{
GdkRectangle viewport, new_viewport;
FooScrollArea *area = data;
- AutoScrollInfo *info = area->priv->auto_scroll_info;
+ AutoScrollInfo *info = area->auto_scroll_info;
int new_x, new_y;
double elapsed;
@@ -1426,15 +1425,15 @@ ensure_scrolling (FooScrollArea *area,
int dx,
int dy)
{
- if (!area->priv->auto_scroll_info)
+ if (!area->auto_scroll_info)
{
#if 0
g_print ("start scrolling\n");
#endif
- area->priv->auto_scroll_info = g_new0 (AutoScrollInfo, 1);
- area->priv->auto_scroll_info->timeout_id =
+ area->auto_scroll_info = g_new0 (AutoScrollInfo, 1);
+ area->auto_scroll_info->timeout_id =
g_idle_add (scroll_idle, area);
- area->priv->auto_scroll_info->timer = g_timer_new ();
+ area->auto_scroll_info->timer = g_timer_new ();
}
#if 0
@@ -1445,8 +1444,8 @@ ensure_scrolling (FooScrollArea *area,
g_print ("dx, dy: %d %d\n", dx, dy);
#endif
- area->priv->auto_scroll_info->dx = dx;
- area->priv->auto_scroll_info->dy = dy;
+ area->auto_scroll_info->dx = dx;
+ area->auto_scroll_info->dy = dy;
}
void
diff --git a/panels/display/scrollarea.h b/panels/display/scrollarea.h
index b097d3d4c..8ced6d496 100644
--- a/panels/display/scrollarea.h
+++ b/panels/display/scrollarea.h
@@ -13,20 +13,17 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+
+#ifndef _SCROLLAREA_H
+#define _SCROLLAREA_H
+
#include <cairo.h>
#include <gtk/gtk.h>
-#define FOO_TYPE_SCROLL_AREA (foo_scroll_area_get_type ())
-#define FOO_SCROLL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_SCROLL_AREA, FooScrollArea))
-#define FOO_SCROLL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_TYPE_SCROLL_AREA, FooScrollAreaClass))
-#define FOO_IS_SCROLL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_TYPE_SCROLL_AREA))
-#define FOO_IS_SCROLL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOO_TYPE_SCROLL_AREA))
-#define FOO_SCROLL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOO_TYPE_SCROLL_AREA, FooScrollAreaClass))
+G_BEGIN_DECLS
-typedef struct FooScrollArea FooScrollArea;
-typedef struct FooScrollAreaClass FooScrollAreaClass;
-typedef struct FooScrollAreaPrivate FooScrollAreaPrivate;
-typedef struct FooScrollAreaEvent FooScrollAreaEvent;
+#define FOO_TYPE_SCROLL_AREA (foo_scroll_area_get_type ())
+G_DECLARE_FINAL_TYPE (FooScrollArea, foo_scroll_area, FOO, SCROLL_AREA, GtkContainer)
typedef enum
{
@@ -37,44 +34,17 @@ typedef enum
FOO_MOTION
} FooScrollAreaEventType;
-struct FooScrollAreaEvent
+typedef struct
{
FooScrollAreaEventType type;
int x;
int y;
-};
+} FooScrollAreaEvent;
typedef void (* FooScrollAreaEventFunc) (FooScrollArea *area,
FooScrollAreaEvent *event,
gpointer data);
-struct FooScrollArea
-{
- GtkContainer parent_instance;
-
- FooScrollAreaPrivate *priv;
-};
-
-struct FooScrollAreaClass
-{
- GtkContainerClass parent_class;
-
- void (*set_scroll_adjustments) (FooScrollArea *scroll_area,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-
- void (*viewport_changed) (FooScrollArea *scroll_area,
- GdkRectangle *old_viewport,
- GdkRectangle *new_viewport);
-
- void (*paint) (FooScrollArea *scroll_area,
- cairo_t *cr,
- GdkRectangle *extents,
- cairo_region_t *region);
-};
-
-GType foo_scroll_area_get_type (void);
-
FooScrollArea *foo_scroll_area_new (void);
/* Set the requisition for the widget. */
@@ -123,3 +93,7 @@ void foo_scroll_area_begin_auto_scroll (FooScrollArea *scroll_area);
void foo_scroll_area_auto_scroll (FooScrollArea *scroll_area,
FooScrollAreaEvent *event);
void foo_scroll_area_end_auto_scroll (FooScrollArea *scroll_area);
+
+G_END_DECLS
+
+#endif /* _SCROLLAREA_H */
diff --git a/panels/info/cc-info-default-apps-panel.h b/panels/info/cc-info-default-apps-panel.h
index 22fccd8dd..7fb1d7274 100644
--- a/panels/info/cc-info-default-apps-panel.h
+++ b/panels/info/cc-info-default-apps-panel.h
@@ -25,7 +25,6 @@
G_BEGIN_DECLS
#define CC_TYPE_INFO_DEFAULT_APPS_PANEL (cc_info_default_apps_panel_get_type ())
-
G_DECLARE_FINAL_TYPE (CcInfoDefaultAppsPanel, cc_info_default_apps_panel, CC, INFO_DEFAULT_APPS_PANEL, CcPanel)
GtkWidget *cc_info_default_apps_panel_new (void);
diff --git a/panels/info/cc-info-overview-panel.h b/panels/info/cc-info-overview-panel.h
index d9e4ff8eb..d81fe587b 100644
--- a/panels/info/cc-info-overview-panel.h
+++ b/panels/info/cc-info-overview-panel.h
@@ -25,7 +25,6 @@
G_BEGIN_DECLS
#define CC_TYPE_INFO_OVERVIEW_PANEL (cc_info_overview_panel_get_type ())
-
G_DECLARE_FINAL_TYPE (CcInfoOverviewPanel, cc_info_overview_panel, CC, INFO_OVERVIEW_PANEL, CcPanel)
GtkWidget *cc_info_overview_panel_new (void);
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 656171f45..1addd16a4 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -47,24 +47,23 @@
#include "gsd-disk-space-helper.h"
-#define WID(w) (GtkWidget *) gtk_builder_get_object (self->priv->builder, w)
+#define WID(w) (GtkWidget *) gtk_builder_get_object (self->builder, w)
-CC_PANEL_REGISTER (CcInfoPanel, cc_info_panel)
-
-#define INFO_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_INFO_PANEL, CcInfoPanelPrivate))
-
-struct _CcInfoPanelPrivate
+struct _CcInfoPanel
{
- GtkBuilder *builder;
+ CcPanel parent_instance;
+
+ GtkBuilder *builder;
};
+CC_PANEL_REGISTER (CcInfoPanel, cc_info_panel)
+
static void
cc_info_panel_dispose (GObject *object)
{
- CcInfoPanelPrivate *priv = CC_INFO_PANEL (object)->priv;
+ CcInfoPanel *self = CC_INFO_PANEL (object);
- g_clear_object (&priv->builder);
+ g_clear_object (&self->builder);
G_OBJECT_CLASS (cc_info_panel_parent_class)->dispose (object);
}
@@ -74,8 +73,6 @@ cc_info_panel_class_init (CcInfoPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcInfoPanelPrivate));
-
object_class->dispose = cc_info_panel_dispose;
g_type_ensure (CC_TYPE_INFO_OVERVIEW_PANEL);
@@ -179,12 +176,11 @@ cc_info_panel_init (CcInfoPanel *self)
{
GError *error = NULL;
- self->priv = INFO_PANEL_PRIVATE (self);
g_resources_register (cc_info_get_resource ());
- self->priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
- if (gtk_builder_add_from_resource (self->priv->builder,
+ if (gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/info/info.ui",
&error) == 0)
{
diff --git a/panels/info/cc-info-panel.h b/panels/info/cc-info-panel.h
index bf0ebd8d6..48863f5e8 100644
--- a/panels/info/cc-info-panel.h
+++ b/panels/info/cc-info-panel.h
@@ -25,45 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_INFO_PANEL cc_info_panel_get_type()
-
-#define CC_INFO_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_INFO_PANEL, CcInfoPanel))
-
-#define CC_INFO_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_INFO_PANEL, CcInfoPanelClass))
-
-#define CC_IS_INFO_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_INFO_PANEL))
-
-#define CC_IS_INFO_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_INFO_PANEL))
-
-#define CC_INFO_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_INFO_PANEL, CcInfoPanelClass))
-
-typedef struct _CcInfoPanel CcInfoPanel;
-typedef struct _CcInfoPanelClass CcInfoPanelClass;
-typedef struct _CcInfoPanelPrivate CcInfoPanelPrivate;
-
-struct _CcInfoPanel
-{
- CcPanel parent;
-
- CcInfoPanelPrivate *priv;
-};
-
-struct _CcInfoPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_info_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_INFO_PANEL (cc_info_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcInfoPanel, cc_info_panel, CC, INFO_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/info/cc-info-removable-media-panel.h b/panels/info/cc-info-removable-media-panel.h
index dccecde58..d0d1660e6 100644
--- a/panels/info/cc-info-removable-media-panel.h
+++ b/panels/info/cc-info-removable-media-panel.h
@@ -25,7 +25,6 @@
G_BEGIN_DECLS
#define CC_TYPE_INFO_REMOVABLE_MEDIA_PANEL (cc_info_removable_media_panel_get_type ())
-
G_DECLARE_FINAL_TYPE (CcInfoRemovableMediaPanel, cc_info_removable_media_panel, CC, INFO_REMOVABLE_MEDIA_PANEL, CcPanel)
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index a970a18f6..86eef1c5b 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -28,20 +28,38 @@
#include "cc-keyboard-item.h"
-#define CC_KEYBOARD_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemPrivate))
-
#define CUSTOM_KEYS_SCHEMA "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding"
-struct CcKeyboardItemPrivate
+struct _CcKeyboardItem
{
- /* properties */
- /* common */
+ GObject parent_instance;
+
char *binding;
- /* internal */
CcKeyboardItem *reverse_item;
gboolean is_reversed;
gboolean hidden;
+
+ CcKeyboardItemType type;
+
+ CcKeyCombo *primary_combo;
+ BindingGroupType group;
+ GtkTreeModel *model;
+ char *description;
+ gboolean editable;
+ GList *key_combos;
+ GList *default_combos;
+
+ /* GSettings path */
+ char *gsettings_path;
+ gboolean desc_editable;
+ char *command;
+ gboolean cmd_editable;
+
+ /* GSettings */
+ char *schema;
+ char *key;
+ GSettings *settings;
};
enum {
@@ -117,6 +135,14 @@ cc_keyboard_item_get_description (CcKeyboardItem *item)
return item->description;
}
+gboolean
+cc_keyboard_item_get_desc_editable (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), FALSE);
+
+ return item->desc_editable;
+}
+
/* wrapper around g_settings_set_str[ing|v] */
static void
settings_set_binding (GSettings *settings,
@@ -157,13 +183,13 @@ _set_binding (CcKeyboardItem *item,
CcKeyboardItem *reverse;
gboolean enabled;
- reverse = item->priv->reverse_item;
+ reverse = item->reverse_item;
enabled = value && strlen (value) > 0;
- g_clear_pointer (&item->priv->binding, g_free);
- item->priv->binding = enabled ? g_strdup (value) : g_strdup ("");
+ g_clear_pointer (&item->binding, g_free);
+ item->binding = enabled ? g_strdup (value) : g_strdup ("");
- binding_from_string (item->priv->binding, item->primary_combo);
+ binding_from_string (item->binding, item->primary_combo);
/*
* Always treat the pair (item, reverse) as a unit: setting one also
@@ -176,26 +202,26 @@ _set_binding (CcKeyboardItem *item,
reverse_mask = enabled ? item->primary_combo->mask ^ GDK_SHIFT_MASK
: item->primary_combo->mask;
- g_clear_pointer (&reverse->priv->binding, g_free);
+ g_clear_pointer (&reverse->binding, g_free);
if (enabled)
- reverse->priv->binding = gtk_accelerator_name_with_keycode (NULL,
+ reverse->binding = gtk_accelerator_name_with_keycode (NULL,
item->primary_combo->keyval,
item->primary_combo->keycode,
reverse_mask);
- binding_from_string (reverse->priv->binding, reverse->primary_combo);
+ binding_from_string (reverse->binding, reverse->primary_combo);
}
if (set_backend == FALSE)
return;
- settings_set_binding (item->settings, item->key, item->priv->binding);
+ settings_set_binding (item->settings, item->key, item->binding);
g_object_notify (G_OBJECT (item), "is-value-default");
if (reverse)
{
- settings_set_binding (reverse->settings, reverse->key, reverse->priv->binding);
+ settings_set_binding (reverse->settings, reverse->key, reverse->binding);
g_object_notify (G_OBJECT (reverse), "is-value-default");
}
}
@@ -223,6 +249,14 @@ cc_keyboard_item_get_command (CcKeyboardItem *item)
return item->command;
}
+gboolean
+cc_keyboard_item_get_cmd_editable (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), FALSE);
+
+ return item->cmd_editable;
+}
+
static void
cc_keyboard_item_set_property (GObject *object,
guint prop_id,
@@ -267,7 +301,7 @@ cc_keyboard_item_get_property (GObject *object,
g_value_set_string (value, self->description);
break;
case PROP_BINDING:
- g_value_set_string (value, self->priv->binding);
+ g_value_set_string (value, self->binding);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, self->editable);
@@ -342,14 +376,11 @@ cc_keyboard_item_class_init (CcKeyboardItemClass *klass)
"is value default",
TRUE,
G_PARAM_READABLE));
-
- g_type_class_add_private (klass, sizeof (CcKeyboardItemPrivate));
}
static void
cc_keyboard_item_init (CcKeyboardItem *item)
{
- item->priv = CC_KEYBOARD_ITEM_GET_PRIVATE (item);
item->primary_combo = g_new0 (CcKeyCombo, 1);
}
@@ -363,13 +394,11 @@ cc_keyboard_item_finalize (GObject *object)
item = CC_KEYBOARD_ITEM (object);
- g_return_if_fail (item->priv != NULL);
-
if (item->settings != NULL)
g_object_unref (item->settings);
/* Free memory */
- g_free (item->priv->binding);
+ g_free (item->binding);
g_free (item->primary_combo);
g_free (item->gsettings_path);
g_free (item->description);
@@ -509,9 +538,9 @@ cc_keyboard_item_load_from_gsettings_path (CcKeyboardItem *item,
g_list_free_full (item->key_combos, g_free);
item->key_combos = settings_get_key_combos (item->settings, item->key, FALSE);
- g_free (item->priv->binding);
- item->priv->binding = settings_get_binding (item->settings, item->key);
- binding_from_string (item->priv->binding, item->primary_combo);
+ g_free (item->binding);
+ item->binding = settings_get_binding (item->settings, item->key);
+ binding_from_string (item->binding, item->primary_combo);
g_signal_connect (G_OBJECT (item->settings), "changed::binding",
G_CALLBACK (binding_changed), item);
@@ -531,10 +560,10 @@ cc_keyboard_item_load_from_gsettings (CcKeyboardItem *item,
item->description = g_strdup (description);
item->settings = g_settings_new (item->schema);
- g_free (item->priv->binding);
- item->priv->binding = settings_get_binding (item->settings, item->key);
+ g_free (item->binding);
+ item->binding = settings_get_binding (item->settings, item->key);
item->editable = g_settings_is_writable (item->settings, item->key);
- binding_from_string (item->priv->binding, item->primary_combo);
+ binding_from_string (item->binding, item->primary_combo);
g_list_free_full (item->key_combos, g_free);
item->key_combos = settings_get_key_combos (item->settings, item->key, FALSE);
@@ -576,36 +605,36 @@ cc_keyboard_item_add_reverse_item (CcKeyboardItem *item,
{
g_return_if_fail (item->key != NULL);
- item->priv->reverse_item = reverse_item;
- if (reverse_item->priv->reverse_item == NULL)
+ item->reverse_item = reverse_item;
+ if (reverse_item->reverse_item == NULL)
{
- reverse_item->priv->reverse_item = item;
- reverse_item->priv->is_reversed = !is_reversed;
+ reverse_item->reverse_item = item;
+ reverse_item->is_reversed = !is_reversed;
}
else
- g_warn_if_fail (reverse_item->priv->is_reversed == !!is_reversed);
+ g_warn_if_fail (reverse_item->is_reversed == !!is_reversed);
- item->priv->is_reversed = !!is_reversed;
+ item->is_reversed = !!is_reversed;
}
CcKeyboardItem *
cc_keyboard_item_get_reverse_item (CcKeyboardItem *item)
{
- return item->priv->reverse_item;
+ return item->reverse_item;
}
void
cc_keyboard_item_set_hidden (CcKeyboardItem *item, gboolean hidden)
{
- item->priv->hidden = !!hidden;
+ item->hidden = !!hidden;
}
gboolean
cc_keyboard_item_is_hidden (CcKeyboardItem *item)
{
- return item->priv->hidden;
+ return item->hidden;
}
/**
@@ -668,7 +697,7 @@ cc_keyboard_item_reset (CcKeyboardItem *self)
g_return_if_fail (CC_IS_KEYBOARD_ITEM (self));
- reverse = self->priv->reverse_item;
+ reverse = self->reverse_item;
g_settings_reset (self->settings, self->key);
g_object_notify (G_OBJECT (self), "is-value-default");
@@ -681,6 +710,63 @@ cc_keyboard_item_reset (CcKeyboardItem *self)
}
}
+GList *
+cc_keyboard_item_get_key_combos (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->key_combos;
+}
+
+GList *
+cc_keyboard_item_get_default_combos (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->default_combos;
+}
+
+CcKeyCombo *
+cc_keyboard_item_get_primary_combo (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->primary_combo;
+}
+
+const gchar *
+cc_keyboard_item_get_key (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->key;
+}
+
+CcKeyboardItemType
+cc_keyboard_item_get_item_type (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), CC_KEYBOARD_ITEM_TYPE_NONE);
+ return item->type;
+}
+
+void
+cc_keyboard_item_set_model (CcKeyboardItem *item, GtkTreeModel *model, BindingGroupType group)
+{
+ g_return_if_fail (CC_IS_KEYBOARD_ITEM (item));
+ item->model = model;
+ item->group = group;
+}
+
+const gchar *
+cc_keyboard_item_get_gsettings_path (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->gsettings_path;
+}
+
+GSettings *
+cc_keyboard_item_get_settings (CcKeyboardItem *item)
+{
+ g_return_val_if_fail (CC_IS_KEYBOARD_ITEM (item), NULL);
+ return item->settings;
+}
+
/*
* vim: sw=2 ts=8 cindent noai bs=2
*/
diff --git a/panels/keyboard/cc-keyboard-item.h b/panels/keyboard/cc-keyboard-item.h
index 755d46dfa..e167f8863 100644
--- a/panels/keyboard/cc-keyboard-item.h
+++ b/panels/keyboard/cc-keyboard-item.h
@@ -25,12 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_KEYBOARD_ITEM (cc_keyboard_item_get_type ())
-#define CC_KEYBOARD_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItem))
-#define CC_KEYBOARD_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemClass))
-#define CC_IS_KEYBOARD_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_KEYBOARD_ITEM))
-#define CC_IS_KEYBOARD_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_KEYBOARD_ITEM))
-#define CC_KEYBOARD_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemClass))
+#define CC_TYPE_KEYBOARD_ITEM (cc_keyboard_item_get_type ())
+G_DECLARE_FINAL_TYPE (CcKeyboardItem, cc_keyboard_item, CC, KEYBOARD_ITEM, GObject)
typedef enum
{
@@ -52,45 +48,6 @@ typedef struct {
GdkModifierType mask;
} CcKeyCombo;
-typedef struct CcKeyboardItemPrivate CcKeyboardItemPrivate;
-
-typedef struct
-{
- GObject parent;
- CcKeyboardItemPrivate *priv;
-
- /* Move to priv */
- CcKeyboardItemType type;
-
- /* common */
- /* FIXME move to priv? */
- CcKeyCombo *primary_combo;
- BindingGroupType group;
- GtkTreeModel *model;
- char *description;
- gboolean editable;
- GList *key_combos;
- GList *default_combos;
-
- /* GSettings path */
- char *gsettings_path;
- gboolean desc_editable;
- char *command;
- gboolean cmd_editable;
-
- /* GSettings */
- char *schema;
- char *key;
- GSettings *settings;
-} CcKeyboardItem;
-
-typedef struct
-{
- GObjectClass parent_class;
-} CcKeyboardItemClass;
-
-GType cc_keyboard_item_get_type (void);
-
CcKeyboardItem * cc_keyboard_item_new (CcKeyboardItemType type);
gboolean cc_keyboard_item_load_from_gsettings_path (CcKeyboardItem *item,
const char *path,
@@ -101,7 +58,9 @@ gboolean cc_keyboard_item_load_from_gsettings (CcKeyboardItem *item,
const char *key);
const char * cc_keyboard_item_get_description (CcKeyboardItem *item);
+gboolean cc_keyboard_item_get_desc_editable (CcKeyboardItem *item);
const char * cc_keyboard_item_get_command (CcKeyboardItem *item);
+gboolean cc_keyboard_item_get_cmd_editable (CcKeyboardItem *item);
gboolean cc_keyboard_item_equal (CcKeyboardItem *a,
CcKeyboardItem *b);
@@ -119,6 +78,22 @@ gboolean cc_keyboard_item_is_value_default (CcKeyboardItem *self);
void cc_keyboard_item_reset (CcKeyboardItem *self);
+GList * cc_keyboard_item_get_key_combos (CcKeyboardItem *self);
+
+GList * cc_keyboard_item_get_default_combos (CcKeyboardItem *self);
+
+CcKeyCombo * cc_keyboard_item_get_primary_combo (CcKeyboardItem *self);
+
+const gchar * cc_keyboard_item_get_key (CcKeyboardItem *self);
+
+CcKeyboardItemType cc_keyboard_item_get_item_type (CcKeyboardItem *self);
+
+void cc_keyboard_item_set_model (CcKeyboardItem *self, GtkTreeModel *model, BindingGroupType group);
+
+const gchar * cc_keyboard_item_get_gsettings_path (CcKeyboardItem *self);
+
+GSettings * cc_keyboard_item_get_settings (CcKeyboardItem *self);
+
G_END_DECLS
#endif /* __CC_KEYBOARD_ITEM_H */
diff --git a/panels/keyboard/cc-keyboard-manager.c b/panels/keyboard/cc-keyboard-manager.c
index 82f646058..cff9fa72d 100644
--- a/panels/keyboard/cc-keyboard-manager.c
+++ b/panels/keyboard/cc-keyboard-manager.c
@@ -94,7 +94,7 @@ find_conflict (CcUniquenessData *data,
if (data->orig_item && cc_keyboard_item_equal (data->orig_item, item))
return FALSE;
- for (l = item->key_combos; l; l = l->next)
+ for (l = cc_keyboard_item_get_key_combos (item); l; l = l->next)
{
CcKeyCombo *combo = l->data;
@@ -203,8 +203,8 @@ have_key_for_group (CcKeyboardManager *self,
{
CcKeyboardItem *item = g_ptr_array_index (keys, i);
- if (item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS &&
- g_strcmp0 (name, item->key) == 0)
+ if (cc_keyboard_item_get_item_type (item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS &&
+ g_strcmp0 (name, cc_keyboard_item_get_key (item)) == 0)
{
return TRUE;
}
@@ -258,7 +258,7 @@ add_shortcuts (CcKeyboardManager *self)
gtk_list_store_append (self->shortcuts_model, &new_row);
gtk_list_store_set (self->shortcuts_model,
&new_row,
- DETAIL_DESCRIPTION_COLUMN, item->description,
+ DETAIL_DESCRIPTION_COLUMN, cc_keyboard_item_get_description (item),
DETAIL_KEYENTRY_COLUMN, item,
DETAIL_TYPE_COLUMN, SHORTCUT_TYPE_KEY_ENTRY,
-1);
@@ -364,8 +364,7 @@ append_section (CcKeyboardManager *self,
}
cc_keyboard_item_set_hidden (item, keys_list[i].hidden);
- item->model = shortcut_model;
- item->group = group;
+ cc_keyboard_item_set_model (item, shortcut_model, group);
g_ptr_array_add (keys_array, item);
}
@@ -764,8 +763,7 @@ cc_keyboard_manager_create_custom_shortcut (CcKeyboardManager *self)
cc_keyboard_item_load_from_gsettings_path (item, settings_path, TRUE);
g_free (settings_path);
- item->model = GTK_TREE_MODEL (self->shortcuts_model);
- item->group = BINDING_GROUP_USER;
+ cc_keyboard_item_set_model (item, GTK_TREE_MODEL (self->shortcuts_model), BINDING_GROUP_USER);
return item;
}
@@ -811,7 +809,7 @@ cc_keyboard_manager_add_custom_shortcut (CcKeyboardManager *self,
for (i = 0; settings_paths[i]; i++)
g_variant_builder_add (&builder, "s", settings_paths[i]);
- g_variant_builder_add (&builder, "s", item->gsettings_path);
+ g_variant_builder_add (&builder, "s", cc_keyboard_item_get_gsettings_path (item));
g_settings_set_value (self->binding_settings, "custom-keybindings", g_variant_builder_end (&builder));
@@ -838,6 +836,7 @@ cc_keyboard_manager_remove_custom_shortcut (CcKeyboardManager *self,
GPtrArray *keys_array;
GVariantBuilder builder;
gboolean valid;
+ GSettings *settings;
char **settings_paths;
int i;
@@ -863,20 +862,21 @@ cc_keyboard_manager_remove_custom_shortcut (CcKeyboardManager *self,
/* Shortcut not found or not a custom shortcut */
g_assert (valid);
- g_assert (item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH);
-
- g_settings_delay (item->settings);
- g_settings_reset (item->settings, "name");
- g_settings_reset (item->settings, "command");
- g_settings_reset (item->settings, "binding");
- g_settings_apply (item->settings);
+ g_assert (cc_keyboard_item_get_item_type (item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH);
+
+ settings = cc_keyboard_item_get_settings (item);
+ g_settings_delay (settings);
+ g_settings_reset (settings, "name");
+ g_settings_reset (settings, "command");
+ g_settings_reset (settings, "binding");
+ g_settings_apply (settings);
g_settings_sync ();
settings_paths = g_settings_get_strv (self->binding_settings, "custom-keybindings");
g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
for (i = 0; settings_paths[i]; i++)
- if (strcmp (settings_paths[i], item->gsettings_path) != 0)
+ if (strcmp (settings_paths[i], cc_keyboard_item_get_gsettings_path (item)) != 0)
g_variant_builder_add (&builder, "s", settings_paths[i]);
g_settings_set_value (self->binding_settings,
@@ -973,7 +973,7 @@ cc_keyboard_manager_reset_shortcut (CcKeyboardManager *self,
g_return_if_fail (CC_IS_KEYBOARD_ITEM (item));
/* Disables any shortcut that conflicts with the new shortcut's value */
- for (l = item->default_combos; l; l = l->next)
+ for (l = cc_keyboard_item_get_default_combos (item); l; l = l->next)
{
CcKeyCombo *combo = l->data;
CcKeyboardItem *collision;
diff --git a/panels/keyboard/cc-keyboard-manager.h b/panels/keyboard/cc-keyboard-manager.h
index 232c4b28d..ff39f5180 100644
--- a/panels/keyboard/cc-keyboard-manager.h
+++ b/panels/keyboard/cc-keyboard-manager.h
@@ -29,8 +29,7 @@
G_BEGIN_DECLS
-#define CC_TYPE_KEYBOARD_MANAGER (cc_keyboard_manager_get_type())
-
+#define CC_TYPE_KEYBOARD_MANAGER (cc_keyboard_manager_get_type ())
G_DECLARE_FINAL_TYPE (CcKeyboardManager, cc_keyboard_manager, CC, KEYBOARD_MANAGER, GObject)
CcKeyboardManager* cc_keyboard_manager_new (void);
diff --git a/panels/keyboard/cc-keyboard-option.c b/panels/keyboard/cc-keyboard-option.c
index aea0806f6..7935b100c 100644
--- a/panels/keyboard/cc-keyboard-option.c
+++ b/panels/keyboard/cc-keyboard-option.c
@@ -27,13 +27,6 @@
#include "cc-keyboard-option.h"
-#define CC_TYPE_KEYBOARD_OPTION (cc_keyboard_option_get_type ())
-#define CC_KEYBOARD_OPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_KEYBOARD_OPTION, CcKeyboardOption))
-#define CC_KEYBOARD_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_KEYBOARD_OPTION, CcKeyboardOptionClass))
-#define CC_IS_KEYBOARD_OPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_KEYBOARD_OPTION))
-#define CC_IS_KEYBOARD_OPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_KEYBOARD_OPTION))
-#define CC_KEYBOARD_OPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_KEYBOARD_OPTION, CcKeyboardOptionClass))
-
#define INPUT_SOURCES_SCHEMA "org.gnome.desktop.input-sources"
#define XKB_OPTIONS_KEY "xkb-options"
@@ -56,8 +49,6 @@ enum
struct _CcKeyboardOption
{
- GObject parent_object;
-
gchar *group;
gchar *description;
gchar *current_value;
@@ -66,11 +57,7 @@ struct _CcKeyboardOption
const gchar * const *whitelist;
};
-typedef struct _CcKeyboardOptionClass CcKeyboardOptionClass;
-struct _CcKeyboardOptionClass
-{
- GObjectClass parent_class;
-};
+G_DEFINE_TYPE (CcKeyboardOption, cc_keyboard_option, G_TYPE_OBJECT);
static guint keyboard_option_signals[LAST_SIGNAL] = { 0 };
@@ -131,10 +118,6 @@ static const gchar *xkb_option_grp_whitelist[] = {
static GList *objects_list = NULL;
-GType cc_keyboard_option_get_type (void);
-
-G_DEFINE_TYPE (CcKeyboardOption, cc_keyboard_option, G_TYPE_OBJECT);
-
static gboolean
strv_contains (const gchar * const *strv,
const gchar *str)
diff --git a/panels/keyboard/cc-keyboard-option.h b/panels/keyboard/cc-keyboard-option.h
index 011481fcb..a9504e90c 100644
--- a/panels/keyboard/cc-keyboard-option.h
+++ b/panels/keyboard/cc-keyboard-option.h
@@ -33,7 +33,8 @@ enum
XKB_OPTION_N_COLUMNS
};
-typedef struct _CcKeyboardOption CcKeyboardOption;
+#define CC_TYPE_KEYBOARD_OPTION (cc_keyboard_option_get_type ())
+G_DECLARE_FINAL_TYPE (CcKeyboardOption, cc_keyboard_option, CC, KEYBOARD_OPTION, GObject)
GList * cc_keyboard_option_get_all (void);
const gchar * cc_keyboard_option_get_description (CcKeyboardOption *self);
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 02f250a4a..fd1be5aed 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -43,7 +43,7 @@ typedef struct {
struct _CcKeyboardPanel
{
- CcPanel parent;
+ CcPanel parent_instance;
/* Search */
GtkWidget *empty_search_placeholder;
@@ -113,7 +113,7 @@ transform_binding_to_accel (GBinding *binding,
gchar *accelerator;
item = CC_KEYBOARD_ITEM (g_binding_get_source (binding));
- combo = item->primary_combo;
+ combo = cc_keyboard_item_get_primary_combo (item);
/* Embolden the label when the shortcut is modified */
if (!cc_keyboard_item_is_value_default (item))
@@ -159,7 +159,7 @@ reset_all_shortcuts_cb (GtkWidget *widget,
data = g_object_get_data (G_OBJECT (widget), "data");
/* Don't reset custom shortcuts */
- if (data->item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
+ if (cc_keyboard_item_get_item_type (data->item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
return;
/* cc_keyboard_manager_reset_shortcut() already resets conflicting shortcuts,
@@ -238,7 +238,7 @@ add_item (CcKeyboardPanel *self,
NULL);
/* Shortcut title */
- label = gtk_label_new (item->description);
+ label = gtk_label_new (cc_keyboard_item_get_description (item));
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
@@ -394,7 +394,7 @@ static gboolean
search_match_shortcut (CcKeyboardItem *item,
const gchar *search)
{
- CcKeyCombo *combo = item->primary_combo;
+ CcKeyCombo *combo = cc_keyboard_item_get_primary_combo (item);
GStrv shortcut_tokens, search_tokens;
g_autofree gchar *normalized_accel = NULL;
g_autofree gchar *accel = NULL;
@@ -454,9 +454,9 @@ sort_function (GtkListBoxRow *a,
b_data = g_object_get_data (G_OBJECT (b), "data");
/* Put custom shortcuts below everything else */
- if (a_data->item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
+ if (cc_keyboard_item_get_item_type (a_data->item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
return 1;
- else if (b_data->item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
+ else if (cc_keyboard_item_get_item_type (b_data->item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
return -1;
retval = g_strcmp0 (a_data->section_title, b_data->section_title);
@@ -464,7 +464,7 @@ sort_function (GtkListBoxRow *a,
if (retval != 0)
return retval;
- return g_strcmp0 (a_data->item->description, b_data->item->description);
+ return g_strcmp0 (cc_keyboard_item_get_description (a_data->item), cc_keyboard_item_get_description (b_data->item));
}
static void
@@ -558,7 +558,7 @@ filter_function (GtkListBoxRow *row,
data = g_object_get_data (G_OBJECT (row), "data");
item = data->item;
- name = cc_util_normalize_casefold_and_unaccent (item->description);
+ name = cc_util_normalize_casefold_and_unaccent (cc_keyboard_item_get_description (item));
search = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (GTK_ENTRY (self->search_entry)));
terms = g_strsplit (search, " ", -1);
diff --git a/panels/keyboard/cc-keyboard-panel.h b/panels/keyboard/cc-keyboard-panel.h
index cbf8e0d34..431152768 100644
--- a/panels/keyboard/cc-keyboard-panel.h
+++ b/panels/keyboard/cc-keyboard-panel.h
@@ -27,8 +27,7 @@
G_BEGIN_DECLS
-#define CC_TYPE_KEYBOARD_PANEL (cc_keyboard_panel_get_type())
-
+#define CC_TYPE_KEYBOARD_PANEL (cc_keyboard_panel_get_type ())
G_DECLARE_FINAL_TYPE (CcKeyboardPanel, cc_keyboard_panel, CC, KEYBOARD_PANEL, CcPanel)
CcKeyboardItem* cc_keyboard_panel_create_custom_item (CcKeyboardPanel *self);
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index 24eacdf57..96c213c23 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -152,7 +152,7 @@ apply_custom_item_fields (CcKeyboardShortcutEditor *self,
/* Only setup the binding when it was actually edited */
if (self->edited)
{
- CcKeyCombo *combo = item->primary_combo;
+ CcKeyCombo *combo = cc_keyboard_item_get_primary_combo (item);
gchar *binding;
combo->keycode = self->custom_combo->keycode;
@@ -173,10 +173,10 @@ apply_custom_item_fields (CcKeyboardShortcutEditor *self,
}
/* Set the keyboard shortcut name and command for custom entries */
- if (item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
+ if (cc_keyboard_item_get_item_type (item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
{
- g_settings_set_string (item->settings, "name", gtk_entry_get_text (GTK_ENTRY (self->name_entry)));
- g_settings_set_string (item->settings, "command", gtk_entry_get_text (GTK_ENTRY (self->command_entry)));
+ g_settings_set_string (cc_keyboard_item_get_settings (item), "name", gtk_entry_get_text (GTK_ENTRY (self->name_entry)));
+ g_settings_set_string (cc_keyboard_item_get_settings (item), "command", gtk_entry_get_text (GTK_ENTRY (self->command_entry)));
}
}
@@ -427,8 +427,8 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
collision_text = g_strdup_printf (_("%s is already being used for <b>%s</b>. If you "
"replace it, %s will be disabled"),
friendly_accelerator,
- collision_item->description,
- collision_item->description);
+ cc_keyboard_item_get_description (collision_item),
+ cc_keyboard_item_get_description (collision_item));
label = is_custom_shortcut (self) ? self->new_shortcut_conflict_label : self->shortcut_conflict_label;
@@ -555,7 +555,7 @@ reset_item_clicked_cb (CcKeyboardShortcutEditor *self)
/* Reset first, then update the shortcut */
cc_keyboard_manager_reset_shortcut (self->manager, self->item);
- combo = self->item->primary_combo;
+ combo = cc_keyboard_item_get_primary_combo (self->item);
accel = gtk_accelerator_name (combo->keyval, combo->mask);
gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->shortcut_accel_label), accel);
@@ -581,8 +581,8 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
if (!item)
return;
- combo = item->primary_combo;
- is_custom = item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH;
+ combo = cc_keyboard_item_get_primary_combo (item);
+ is_custom = cc_keyboard_item_get_item_type (item) == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH;
accel = gtk_accelerator_name (combo->keyval, combo->mask);
/* To avoid accidentally thinking we unset the current keybinding, set the values
@@ -603,7 +603,7 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
gtk_widget_hide (self->replace_button);
/* Setup the top label */
- text = g_strdup_printf (_("Enter new shortcut to change <b>%s</b>."), item->description);
+ text = g_strdup_printf (_("Enter new shortcut to change <b>%s</b>."), cc_keyboard_item_get_description (item));
gtk_label_set_markup (GTK_LABEL (self->top_info_label), text);
@@ -627,12 +627,12 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
g_signal_handlers_block_by_func (self->name_entry, name_entry_changed_cb, self);
/* Name entry */
- gtk_entry_set_text (GTK_ENTRY (self->name_entry), item->description);
- gtk_widget_set_sensitive (self->name_entry, item->desc_editable);
+ gtk_entry_set_text (GTK_ENTRY (self->name_entry), cc_keyboard_item_get_description (item));
+ gtk_widget_set_sensitive (self->name_entry, cc_keyboard_item_get_desc_editable (item));
/* Command entry */
- gtk_entry_set_text (GTK_ENTRY (self->command_entry), item->command);
- gtk_widget_set_sensitive (self->command_entry, item->cmd_editable);
+ gtk_entry_set_text (GTK_ENTRY (self->command_entry), cc_keyboard_item_get_command (item));
+ gtk_widget_set_sensitive (self->command_entry, cc_keyboard_item_get_cmd_editable (item));
/* If there is no accelerator set for this custom shortcut, show the "Set Shortcut" button. */
is_accel_empty = !accel || accel[0] == '\0';
@@ -824,7 +824,7 @@ grab_idle (gpointer data)
{
CcKeyboardShortcutEditor *self = data;
- if (self->item && self->item->type != CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
+ if (self->item && cc_keyboard_item_get_item_type (self->item) != CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH)
grab_seat (self);
self->grab_idle_id = 0;
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.h b/panels/keyboard/cc-keyboard-shortcut-editor.h
index a9455a8e1..75199bf50 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.h
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.h
@@ -28,7 +28,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_KEYBOARD_SHORTCUT_EDITOR (cc_keyboard_shortcut_editor_get_type())
+#define CC_TYPE_KEYBOARD_SHORTCUT_EDITOR (cc_keyboard_shortcut_editor_get_type ())
+G_DECLARE_FINAL_TYPE (CcKeyboardShortcutEditor, cc_keyboard_shortcut_editor, CC, KEYBOARD_SHORTCUT_EDITOR, GtkDialog)
typedef enum
{
@@ -36,8 +37,6 @@ typedef enum
CC_SHORTCUT_EDITOR_EDIT
} CcShortcutEditorMode;
-G_DECLARE_FINAL_TYPE (CcKeyboardShortcutEditor, cc_keyboard_shortcut_editor, CC, KEYBOARD_SHORTCUT_EDITOR, GtkDialog)
-
GtkWidget* cc_keyboard_shortcut_editor_new (CcKeyboardManager *manager);
CcKeyboardItem* cc_keyboard_shortcut_editor_get_item (CcKeyboardShortcutEditor *self);
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index c365480e8..af3ed17c8 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -30,16 +30,15 @@
#include <glib/gi18n.h>
-CC_PANEL_REGISTER (CcMousePanel, cc_mouse_panel)
-
-#define MOUSE_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_MOUSE_PANEL, CcMousePanelPrivate))
-
-struct _CcMousePanelPrivate
+struct _CcMousePanel
{
- GtkWidget *stack;
+ CcPanel parent_instance;
+
+ GtkWidget *stack;
};
+CC_PANEL_REGISTER (CcMousePanel, cc_mouse_panel)
+
enum {
CC_MOUSE_PAGE_PREFS,
CC_MOUSE_PAGE_TEST
@@ -60,11 +59,10 @@ cc_mouse_panel_get_help_uri (CcPanel *panel)
static void
shell_test_button_toggled (GtkToggleButton *button, CcMousePanel *panel)
{
- CcMousePanelPrivate *priv = panel->priv;
gboolean active;
active = gtk_toggle_button_get_active (button);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), active ? "test_widget" : "prefs_widget");
+ gtk_stack_set_visible_child_name (GTK_STACK (panel->stack), active ? "test_widget" : "prefs_widget");
}
static void
@@ -95,10 +93,8 @@ cc_mouse_panel_constructed (GObject *object)
static void
cc_mouse_panel_init (CcMousePanel *self)
{
- CcMousePanelPrivate *priv;
GtkWidget *prefs_widget, *test_widget;
- priv = self->priv = MOUSE_PANEL_PRIVATE (self);
g_resources_register (cc_mouse_get_resource ());
prefs_widget = cc_mouse_properties_new ();
@@ -106,12 +102,12 @@ cc_mouse_panel_init (CcMousePanel *self)
test_widget = cc_mouse_test_new ();
gtk_widget_show (test_widget);
- priv->stack = gtk_stack_new ();
- gtk_widget_show (priv->stack);
- gtk_stack_add_named (GTK_STACK (priv->stack), prefs_widget, "prefs_widget");
- gtk_stack_add_named (GTK_STACK (priv->stack), test_widget, "test_widget");
+ self->stack = gtk_stack_new ();
+ gtk_widget_show (self->stack);
+ gtk_stack_add_named (GTK_STACK (self->stack), prefs_widget, "prefs_widget");
+ gtk_stack_add_named (GTK_STACK (self->stack), test_widget, "test_widget");
- gtk_container_add (GTK_CONTAINER (self), priv->stack);
+ gtk_container_add (GTK_CONTAINER (self), self->stack);
}
static void
@@ -120,8 +116,6 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcMousePanelPrivate));
-
panel_class->get_help_uri = cc_mouse_panel_get_help_uri;
object_class->dispose = cc_mouse_panel_dispose;
diff --git a/panels/mouse/cc-mouse-panel.h b/panels/mouse/cc-mouse-panel.h
index 9892bb790..e27fca41b 100644
--- a/panels/mouse/cc-mouse-panel.h
+++ b/panels/mouse/cc-mouse-panel.h
@@ -18,7 +18,6 @@
*
*/
-
#ifndef _CC_MOUSE_PANEL_H
#define _CC_MOUSE_PANEL_H
@@ -26,45 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_MOUSE_PANEL cc_mouse_panel_get_type()
-
-#define CC_MOUSE_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_MOUSE_PANEL, CcMousePanel))
-
-#define CC_MOUSE_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_MOUSE_PANEL, CcMousePanelClass))
-
-#define CC_IS_MOUSE_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_MOUSE_PANEL))
-
-#define CC_IS_MOUSE_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_MOUSE_PANEL))
-
-#define CC_MOUSE_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_MOUSE_PANEL, CcMousePanelClass))
-
-typedef struct _CcMousePanel CcMousePanel;
-typedef struct _CcMousePanelClass CcMousePanelClass;
-typedef struct _CcMousePanelPrivate CcMousePanelPrivate;
-
-struct _CcMousePanel
-{
- CcPanel parent;
-
- CcMousePanelPrivate *priv;
-};
-
-struct _CcMousePanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_mouse_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_MOUSE_PANEL (cc_mouse_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcMousePanel, cc_mouse_panel, CC, MOUSE_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 95a74e418..7930db0aa 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -42,12 +42,12 @@
#include <sys/stat.h>
#include <dirent.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (d->builder, x)
+#define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x)
-#define CC_MOUSE_PROPERTIES_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TYPE_MOUSE_PROPERTIES, CcMousePropertiesPrivate))
-
-struct _CcMousePropertiesPrivate
+struct _CcMouseProperties
{
+ GtkBin parent_instance;
+
GtkBuilder *builder;
GSettings *mouse_settings;
@@ -73,7 +73,7 @@ struct _CcMousePropertiesPrivate
G_DEFINE_TYPE (CcMouseProperties, cc_mouse_properties, GTK_TYPE_BIN);
static void
-setup_touchpad_options (CcMousePropertiesPrivate *d)
+setup_touchpad_options (CcMouseProperties *self)
{
gboolean edge_scroll_enabled;
gboolean two_finger_scroll_enabled;
@@ -81,12 +81,12 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
gboolean have_edge_scrolling;
gboolean have_tap_to_click;
- gtk_widget_set_visible (WID ("touchpad-frame"), !d->have_synaptics);
- if (d->have_synaptics)
+ gtk_widget_set_visible (WID ("touchpad-frame"), !self->have_synaptics);
+ if (self->have_synaptics)
return;
- gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);
- if (!d->have_touchpad)
+ gtk_widget_set_visible (WID ("touchpad-frame"), self->have_touchpad);
+ if (!self->have_touchpad)
return;
cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);
@@ -97,19 +97,19 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
gtk_widget_set_visible (WID ("edge-scrolling-row"), have_edge_scrolling);
gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);
- edge_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "edge-scrolling-enabled");
- two_finger_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "two-finger-scrolling-enabled");
+ edge_scroll_enabled = g_settings_get_boolean (self->touchpad_settings, "edge-scrolling-enabled");
+ two_finger_scroll_enabled = g_settings_get_boolean (self->touchpad_settings, "two-finger-scrolling-enabled");
if (edge_scroll_enabled && two_finger_scroll_enabled) {
/* You cunning user set both, but you can only have one set in that UI */
- d->changing_scroll = TRUE;
+ self->changing_scroll = TRUE;
gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")), two_finger_scroll_enabled);
- d->changing_scroll = FALSE;
+ self->changing_scroll = FALSE;
gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), FALSE);
} else {
- d->changing_scroll = TRUE;
+ self->changing_scroll = TRUE;
gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);
gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")), two_finger_scroll_enabled);
- d->changing_scroll = FALSE;
+ self->changing_scroll = FALSE;
}
}
@@ -118,12 +118,12 @@ two_finger_scrolling_changed_event (GtkSwitch *button,
gboolean state,
gpointer user_data)
{
- CcMousePropertiesPrivate *d = user_data;
+ CcMouseProperties *self = user_data;
- if (d->changing_scroll)
+ if (self->changing_scroll)
return;
- g_settings_set_boolean (d->touchpad_settings, "two-finger-scrolling-enabled", state);
+ g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
gtk_switch_set_state (button, state);
if (state && gtk_widget_get_visible (WID ("edge-scrolling-row"))) {
@@ -137,12 +137,12 @@ edge_scrolling_changed_event (GtkSwitch *button,
gboolean state,
gpointer user_data)
{
- CcMousePropertiesPrivate *d = user_data;
+ CcMouseProperties *self = user_data;
- if (d->changing_scroll)
+ if (self->changing_scroll)
return;
- g_settings_set_boolean (d->touchpad_settings, "edge-scrolling-enabled", state);
+ g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
gtk_switch_set_state (button, state);
if (state && gtk_widget_get_visible (WID ("two-finger-scrolling-row"))) {
@@ -162,21 +162,21 @@ get_touchpad_enabled (GSettings *settings)
}
static gboolean
-show_touchpad_enabling_switch (CcMousePropertiesPrivate *d)
+show_touchpad_enabling_switch (CcMouseProperties *self)
{
- if (!d->have_touchpad)
+ if (!self->have_touchpad)
return FALSE;
g_debug ("Should we show the touchpad disable switch: have_mouse: %s have_touchscreen: %s\n",
- d->have_mouse ? "true" : "false",
- d->have_touchscreen ? "true" : "false");
+ self->have_mouse ? "true" : "false",
+ self->have_touchscreen ? "true" : "false");
/* Let's show the button when a mouse or touchscreen is present */
- if (d->have_mouse || d->have_touchscreen)
+ if (self->have_mouse || self->have_touchscreen)
return TRUE;
/* Let's also show when the touchpad is disabled. */
- if (!get_touchpad_enabled (d->touchpad_settings))
+ if (!get_touchpad_enabled (self->touchpad_settings))
return TRUE;
return FALSE;
@@ -208,9 +208,9 @@ touchpad_enabled_set_mapping (const GValue *value,
}
static void
-handle_secondary_button (CcMousePropertiesPrivate *d,
- GtkWidget *button,
- GtkGesture *gesture)
+handle_secondary_button (CcMouseProperties *self,
+ GtkWidget *button,
+ GtkGesture *gesture)
{
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
@@ -222,30 +222,30 @@ handle_secondary_button (CcMousePropertiesPrivate *d,
/* Set up the property editors in the dialog. */
static void
-setup_dialog (CcMousePropertiesPrivate *d)
+setup_dialog (CcMouseProperties *self)
{
GtkWidget *button;
- d->left_handed = g_settings_get_boolean (d->mouse_settings, "left-handed");
- button = WID (d->left_handed ? "primary-button-right" : "primary-button-left");
+ self->left_handed = g_settings_get_boolean (self->mouse_settings, "left-handed");
+ button = WID (self->left_handed ? "primary-button-right" : "primary-button-left");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- g_settings_bind (d->mouse_settings, "left-handed",
+ g_settings_bind (self->mouse_settings, "left-handed",
WID ("primary-button-left"), "active",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
- g_settings_bind (d->mouse_settings, "left-handed",
+ g_settings_bind (self->mouse_settings, "left-handed",
WID ("primary-button-right"), "active",
G_SETTINGS_BIND_DEFAULT);
/* Allow changing orientation with either button */
button = WID ("primary-button-right");
- d->right_gesture = gtk_gesture_multi_press_new (button);
- handle_secondary_button (d, button, d->right_gesture);
+ self->right_gesture = gtk_gesture_multi_press_new (button);
+ handle_secondary_button (self, button, self->right_gesture);
button = WID ("primary-button-left");
- d->left_gesture = gtk_gesture_multi_press_new (button);
- handle_secondary_button (d, button, d->left_gesture);
+ self->left_gesture = gtk_gesture_multi_press_new (button);
+ handle_secondary_button (self, button, self->left_gesture);
- g_settings_bind (d->mouse_settings, "natural-scroll",
+ g_settings_bind (self->mouse_settings, "natural-scroll",
WID ("mouse-natural-scrolling-switch"), "active",
G_SETTINGS_BIND_DEFAULT);
@@ -253,9 +253,9 @@ setup_dialog (CcMousePropertiesPrivate *d)
gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-listbox")), cc_list_box_update_header_func, NULL, NULL);
/* Mouse section */
- gtk_widget_set_visible (WID ("mouse-frame"), d->have_mouse);
+ gtk_widget_set_visible (WID ("mouse-frame"), self->have_mouse);
- g_settings_bind (d->mouse_settings, "speed",
+ g_settings_bind (self->mouse_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (WID ("mouse-speed-scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
@@ -263,39 +263,39 @@ setup_dialog (CcMousePropertiesPrivate *d)
/* Touchpad section */
gtk_widget_set_visible (WID ("touchpad-toggle-switch"),
- show_touchpad_enabling_switch (d));
+ show_touchpad_enabling_switch (self));
- g_settings_bind_with_mapping (d->touchpad_settings, "send-events",
+ g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
WID ("touchpad-toggle-switch"), "active",
G_SETTINGS_BIND_DEFAULT,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
- g_settings_bind_with_mapping (d->touchpad_settings, "send-events",
+ g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
WID ("touchpad-options-listbox"), "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
- g_settings_bind (d->touchpad_settings, "natural-scroll",
+ g_settings_bind (self->touchpad_settings, "natural-scroll",
WID ("touchpad-natural-scrolling-switch"), "active",
G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (d->touchpad_settings, "speed",
+ g_settings_bind (self->touchpad_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad-speed-scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (d->touchpad_settings, "tap-to-click",
+ g_settings_bind (self->touchpad_settings, "tap-to-click",
WID ("tap-to-click-switch"), "active",
G_SETTINGS_BIND_DEFAULT);
- setup_touchpad_options (d);
+ setup_touchpad_options (self);
g_signal_connect (WID ("edge-scrolling-switch"), "state-set",
- G_CALLBACK (edge_scrolling_changed_event), d);
+ G_CALLBACK (edge_scrolling_changed_event), self);
g_signal_connect (WID ("two-finger-scrolling-switch"), "state-set",
- G_CALLBACK (two_finger_scrolling_changed_event), d);
+ G_CALLBACK (two_finger_scrolling_changed_event), self);
gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-options-listbox")), cc_list_box_update_header_func, NULL, NULL);
}
@@ -304,16 +304,16 @@ setup_dialog (CcMousePropertiesPrivate *d)
static void
device_changed (GsdDeviceManager *device_manager,
GsdDevice *device,
- CcMousePropertiesPrivate *d)
+ CcMouseProperties *self)
{
- d->have_touchpad = touchpad_is_present ();
+ self->have_touchpad = touchpad_is_present ();
- setup_touchpad_options (d);
+ setup_touchpad_options (self);
- d->have_mouse = mouse_is_present ();
- gtk_widget_set_visible (WID ("mouse-frame"), d->have_mouse);
+ self->have_mouse = mouse_is_present ();
+ gtk_widget_set_visible (WID ("mouse-frame"), self->have_mouse);
gtk_widget_set_visible (WID ("touchpad-toggle-switch"),
- show_touchpad_enabling_switch (d));
+ show_touchpad_enabling_switch (self));
}
static void
@@ -334,21 +334,21 @@ on_content_size_changed (GtkWidget *widget,
static void
cc_mouse_properties_finalize (GObject *object)
{
- CcMousePropertiesPrivate *d = CC_MOUSE_PROPERTIES (object)->priv;
-
- g_clear_object (&d->mouse_settings);
- g_clear_object (&d->gsd_mouse_settings);
- g_clear_object (&d->touchpad_settings);
- g_clear_object (&d->builder);
- g_clear_object (&d->right_gesture);
- g_clear_object (&d->left_gesture);
-
- if (d->device_manager != NULL) {
- g_signal_handler_disconnect (d->device_manager, d->device_added_id);
- d->device_added_id = 0;
- g_signal_handler_disconnect (d->device_manager, d->device_removed_id);
- d->device_removed_id = 0;
- d->device_manager = NULL;
+ CcMouseProperties *self = CC_MOUSE_PROPERTIES (object);
+
+ g_clear_object (&self->mouse_settings);
+ g_clear_object (&self->gsd_mouse_settings);
+ g_clear_object (&self->touchpad_settings);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->right_gesture);
+ g_clear_object (&self->left_gesture);
+
+ if (self->device_manager != NULL) {
+ g_signal_handler_disconnect (self->device_manager, self->device_added_id);
+ self->device_added_id = 0;
+ g_signal_handler_disconnect (self->device_manager, self->device_removed_id);
+ self->device_removed_id = 0;
+ self->device_manager = NULL;
}
G_OBJECT_CLASS (cc_mouse_properties_parent_class)->finalize (object);
@@ -361,43 +361,40 @@ cc_mouse_properties_class_init (CcMousePropertiesClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->finalize = cc_mouse_properties_finalize;
-
- g_type_class_add_private (class, sizeof (CcMousePropertiesPrivate));
}
static void
-cc_mouse_properties_init (CcMouseProperties *object)
+cc_mouse_properties_init (CcMouseProperties *self)
{
- CcMousePropertiesPrivate *d = object->priv = CC_MOUSE_PROPERTIES_GET_PRIVATE (object);
GError *error = NULL;
- d->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (d->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/mouse/gnome-mouse-properties.ui",
&error);
- d->mouse_settings = g_settings_new ("org.gnome.desktop.peripherals.mouse");
- d->gsd_mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
- d->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
-
- d->device_manager = gsd_device_manager_get ();
- d->device_added_id = g_signal_connect (d->device_manager, "device-added",
- G_CALLBACK (device_changed), d);
- d->device_removed_id = g_signal_connect (d->device_manager, "device-removed",
- G_CALLBACK (device_changed), d);
-
- d->have_mouse = mouse_is_present ();
- d->have_touchpad = touchpad_is_present ();
- d->have_touchscreen = touchscreen_is_present ();
- d->have_synaptics = cc_synaptics_check ();
- if (d->have_synaptics)
+ self->mouse_settings = g_settings_new ("org.gnome.desktop.peripherals.mouse");
+ self->gsd_mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
+ self->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+
+ self->device_manager = gsd_device_manager_get ();
+ self->device_added_id = g_signal_connect (self->device_manager, "device-added",
+ G_CALLBACK (device_changed), self);
+ self->device_removed_id = g_signal_connect (self->device_manager, "device-removed",
+ G_CALLBACK (device_changed), self);
+
+ self->have_mouse = mouse_is_present ();
+ self->have_touchpad = touchpad_is_present ();
+ self->have_touchscreen = touchscreen_is_present ();
+ self->have_synaptics = cc_synaptics_check ();
+ if (self->have_synaptics)
g_warning ("Detected synaptics X driver, please migrate to libinput");
- d->changing_scroll = FALSE;
+ self->changing_scroll = FALSE;
- gtk_container_add (GTK_CONTAINER (object), WID ("scrolled-window"));
+ gtk_container_add (GTK_CONTAINER (self), WID ("scrolled-window"));
- setup_dialog (d);
+ setup_dialog (self);
g_signal_connect (WID ("scrolled-window"), "size-allocate", G_CALLBACK (on_content_size_changed), NULL);
}
diff --git a/panels/mouse/gnome-mouse-properties.h b/panels/mouse/gnome-mouse-properties.h
index c53dc1d16..dd7554d71 100644
--- a/panels/mouse/gnome-mouse-properties.h
+++ b/panels/mouse/gnome-mouse-properties.h
@@ -28,31 +28,9 @@
G_BEGIN_DECLS
-#define CC_TYPE_MOUSE_PROPERTIES cc_mouse_properties_get_type ()
+#define CC_TYPE_MOUSE_PROPERTIES (cc_mouse_properties_get_type ())
+G_DECLARE_FINAL_TYPE (CcMouseProperties, cc_mouse_properties, CC, MOUSE_PROPERTIES, GtkBin)
-#define CC_MOUSE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_MOUSE_PROPERTIES, CcMouseProperties))
-#define CC_MOUSE_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_MOUSE_PROPERTIES, CcMousePropertiesClass))
-#define CC_IS_MOUSE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_MOUSE_PROPERTIES))
-#define CC_IS_MOUSE_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_MOUSE_PROPERTIES))
-#define CC_MOUSE_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_MOUSE_PROPERTIES, CcMousePropertiesClass))
-
-typedef struct _CcMouseProperties CcMouseProperties;
-typedef struct _CcMousePropertiesClass CcMousePropertiesClass;
-typedef struct _CcMousePropertiesPrivate CcMousePropertiesPrivate;
-
-struct _CcMouseProperties
-{
- GtkAlignment parent;
-
- CcMousePropertiesPrivate *priv;
-};
-
-struct _CcMousePropertiesClass
-{
- GtkAlignmentClass parent_class;
-};
-
-GType cc_mouse_properties_get_type (void) G_GNUC_CONST;
GtkWidget *cc_mouse_properties_new (void);
G_END_DECLS
diff --git a/panels/mouse/gnome-mouse-test.c b/panels/mouse/gnome-mouse-test.c
index b0d251ed0..d4dfb7083 100644
--- a/panels/mouse/gnome-mouse-test.c
+++ b/panels/mouse/gnome-mouse-test.c
@@ -32,7 +32,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (d->builder, x)
+#define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x)
/* Click test button sizes. */
#define SHADOW_SIZE (10.0 / 180 * size)
@@ -42,10 +42,8 @@
#define ANNULUS_SIZE (6.0 / 180 * size)
#define INNER_CIRCLE_SIZE (52.0 / 180 * size)
-#define CC_MOUSE_TEST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TYPE_MOUSE_TEST, CcMouseTestPrivate))
-
-static void setup_information_label (CcMouseTestPrivate *d);
-static void setup_scroll_image (CcMouseTestPrivate *d);
+static void setup_information_label (CcMouseTest *self);
+static void setup_scroll_image (CcMouseTest *self);
enum
{
@@ -57,8 +55,10 @@ enum
DOUBLE_CLICK_TEST_GEGL
};
-struct _CcMouseTestPrivate
+struct _CcMouseTest
{
+ GtkBin parent_instance;
+
GtkBuilder *builder;
guint32 double_click_timestamp;
@@ -77,13 +77,13 @@ G_DEFINE_TYPE (CcMouseTest, cc_mouse_test, GTK_TYPE_BIN);
/* Timeout for the double click test */
static gboolean
-test_maybe_timeout (CcMouseTestPrivate *d)
+test_maybe_timeout (CcMouseTest *self)
{
- d->double_click_state = DOUBLE_CLICK_TEST_OFF;
+ self->double_click_state = DOUBLE_CLICK_TEST_OFF;
gtk_widget_queue_draw (WID ("button_drawing_area"));
- d->button_drawing_area_timeout_id = 0;
+ self->button_drawing_area_timeout_id = 0;
return FALSE;
}
@@ -91,11 +91,11 @@ test_maybe_timeout (CcMouseTestPrivate *d)
/* Timeout for the information label */
static gboolean
-information_label_timeout (CcMouseTestPrivate *d)
+information_label_timeout (CcMouseTest *self)
{
- setup_information_label (d);
+ setup_information_label (self);
- d->information_label_timeout_id = 0;
+ self->information_label_timeout_id = 0;
return FALSE;
}
@@ -103,11 +103,11 @@ information_label_timeout (CcMouseTestPrivate *d)
/* Timeout for the scroll image */
static gboolean
-scroll_image_timeout (CcMouseTestPrivate *d)
+scroll_image_timeout (CcMouseTest *self)
{
- setup_scroll_image (d);
+ setup_scroll_image (self);
- d->scroll_image_timeout_id = 0;
+ self->scroll_image_timeout_id = 0;
return FALSE;
}
@@ -115,27 +115,27 @@ scroll_image_timeout (CcMouseTestPrivate *d)
/* Set information label */
static void
-setup_information_label (CcMouseTestPrivate *d)
+setup_information_label (CcMouseTest *self)
{
gchar *message = NULL;
gchar *label_text = NULL;
gboolean double_click;
- if (d->information_label_timeout_id != 0) {
- g_source_remove (d->information_label_timeout_id);
- d->information_label_timeout_id = 0;
+ if (self->information_label_timeout_id != 0) {
+ g_source_remove (self->information_label_timeout_id);
+ self->information_label_timeout_id = 0;
}
- if (d->double_click_state == DOUBLE_CLICK_TEST_OFF) {
+ if (self->double_click_state == DOUBLE_CLICK_TEST_OFF) {
gtk_label_set_label (GTK_LABEL (WID ("information_label")), _("Try clicking, double clicking, scrolling"));
return;
}
- if (d->double_click_state == DOUBLE_CLICK_TEST_GEGL) {
+ if (self->double_click_state == DOUBLE_CLICK_TEST_GEGL) {
message = _("Five clicks, GEGL time!"), "</b>";
} else {
- double_click = (d->double_click_state >= DOUBLE_CLICK_TEST_ON);
- switch (d->button_state) {
+ double_click = (self->double_click_state >= DOUBLE_CLICK_TEST_ON);
+ switch (self->button_state) {
case 1:
message = (double_click) ? _("Double click, primary button") : _("Single click, primary button");
break;
@@ -152,31 +152,31 @@ setup_information_label (CcMouseTestPrivate *d)
gtk_label_set_markup (GTK_LABEL (WID ("information_label")), label_text);
g_free (label_text);
- d->information_label_timeout_id = g_timeout_add (2500, (GSourceFunc) information_label_timeout, d);
+ self->information_label_timeout_id = g_timeout_add (2500, (GSourceFunc) information_label_timeout, self);
}
/* Update scroll image */
static void
-setup_scroll_image (CcMouseTestPrivate *d)
+setup_scroll_image (CcMouseTest *self)
{
const char *resource;
- if (d->scroll_image_timeout_id != 0) {
- g_source_remove (d->scroll_image_timeout_id);
- d->scroll_image_timeout_id = 0;
+ if (self->scroll_image_timeout_id != 0) {
+ g_source_remove (self->scroll_image_timeout_id);
+ self->scroll_image_timeout_id = 0;
}
- if (d->double_click_state == DOUBLE_CLICK_TEST_GEGL)
+ if (self->double_click_state == DOUBLE_CLICK_TEST_GEGL)
resource = "/org/gnome/control-center/mouse/scroll-test-gegl.svg";
else
resource = "/org/gnome/control-center/mouse/scroll-test.svg";
gtk_image_set_from_resource (GTK_IMAGE (WID ("image")), resource);
- if (d->double_click_state != DOUBLE_CLICK_TEST_GEGL)
+ if (self->double_click_state != DOUBLE_CLICK_TEST_GEGL)
return;
- d->scroll_image_timeout_id = g_timeout_add (5000, (GSourceFunc) scroll_image_timeout, d);
+ self->scroll_image_timeout_id = g_timeout_add (5000, (GSourceFunc) scroll_image_timeout, self);
}
/* Callback issued when the user clicks the double click testing area. */
@@ -184,52 +184,52 @@ setup_scroll_image (CcMouseTestPrivate *d)
static gboolean
button_drawing_area_button_press_event (GtkWidget *widget,
GdkEventButton *event,
- CcMouseTestPrivate *d)
+ CcMouseTest *self)
{
gint double_click_time;
if (event->type != GDK_BUTTON_PRESS || event->button > 3)
return FALSE;
- double_click_time = g_settings_get_int (d->mouse_settings, "double-click");
+ double_click_time = g_settings_get_int (self->mouse_settings, "double-click");
- if (d->button_drawing_area_timeout_id != 0) {
- g_source_remove (d->button_drawing_area_timeout_id);
- d->button_drawing_area_timeout_id = 0;
+ if (self->button_drawing_area_timeout_id != 0) {
+ g_source_remove (self->button_drawing_area_timeout_id);
+ self->button_drawing_area_timeout_id = 0;
}
/* Ignore fake double click using different buttons. */
- if (d->double_click_state != DOUBLE_CLICK_TEST_OFF && d->button_state != event->button)
- d->double_click_state = DOUBLE_CLICK_TEST_OFF;
+ if (self->double_click_state != DOUBLE_CLICK_TEST_OFF && self->button_state != event->button)
+ self->double_click_state = DOUBLE_CLICK_TEST_OFF;
- switch (d->double_click_state) {
+ switch (self->double_click_state) {
case DOUBLE_CLICK_TEST_OFF:
- d->double_click_state = DOUBLE_CLICK_TEST_MAYBE;
- d->button_drawing_area_timeout_id = g_timeout_add (double_click_time, (GSourceFunc) test_maybe_timeout, d);
+ self->double_click_state = DOUBLE_CLICK_TEST_MAYBE;
+ self->button_drawing_area_timeout_id = g_timeout_add (double_click_time, (GSourceFunc) test_maybe_timeout, self);
break;
case DOUBLE_CLICK_TEST_MAYBE:
case DOUBLE_CLICK_TEST_ON:
case DOUBLE_CLICK_TEST_STILL_ON:
case DOUBLE_CLICK_TEST_ALMOST_THERE:
- if (event->time - d->double_click_timestamp < double_click_time) {
- d->double_click_state++;
- d->button_drawing_area_timeout_id = g_timeout_add (2500, (GSourceFunc) test_maybe_timeout, d);
+ if (event->time - self->double_click_timestamp < double_click_time) {
+ self->double_click_state++;
+ self->button_drawing_area_timeout_id = g_timeout_add (2500, (GSourceFunc) test_maybe_timeout, self);
} else {
- test_maybe_timeout (d);
+ test_maybe_timeout (self);
}
break;
case DOUBLE_CLICK_TEST_GEGL:
- d->double_click_state = DOUBLE_CLICK_TEST_OFF;
+ self->double_click_state = DOUBLE_CLICK_TEST_OFF;
break;
}
- d->double_click_timestamp = event->time;
+ self->double_click_timestamp = event->time;
gtk_widget_queue_draw (WID ("button_drawing_area"));
- d->button_state = event->button;
- setup_information_label (d);
- setup_scroll_image (d);
+ self->button_state = event->button;
+ setup_information_label (self);
+ setup_scroll_image (self);
return TRUE;
}
@@ -237,7 +237,7 @@ button_drawing_area_button_press_event (GtkWidget *widget,
static gboolean
button_drawing_area_draw_event (GtkWidget *widget,
cairo_t *cr,
- CcMouseTestPrivate *d)
+ CcMouseTest *self)
{
gdouble center_x, center_y, size;
GdkRGBA inner_color, outer_color;
@@ -247,7 +247,7 @@ button_drawing_area_draw_event (GtkWidget *widget,
center_x = gtk_widget_get_allocated_width (widget) / 2.0;
center_y = gtk_widget_get_allocated_height (widget) / 2.0;
- switch (d->double_click_state) {
+ switch (self->double_click_state) {
case DOUBLE_CLICK_TEST_ON:
case DOUBLE_CLICK_TEST_STILL_ON:
case DOUBLE_CLICK_TEST_ALMOST_THERE:
@@ -293,17 +293,17 @@ button_drawing_area_draw_event (GtkWidget *widget,
}
static void
-setup_dialog (CcMouseTestPrivate *d)
+setup_dialog (CcMouseTest *self)
{
GtkAdjustment *adjustment;
GtkStyleProvider *provider;
g_signal_connect (WID ("button_drawing_area"), "button_press_event",
G_CALLBACK (button_drawing_area_button_press_event),
- d);
+ self);
g_signal_connect (WID ("button_drawing_area"), "draw",
G_CALLBACK (button_drawing_area_draw_event),
- d);
+ self);
adjustment = GTK_ADJUSTMENT (WID ("scrolled_window_adjustment"));
gtk_adjustment_set_value (adjustment,
@@ -323,24 +323,24 @@ setup_dialog (CcMouseTestPrivate *d)
static void
cc_mouse_test_finalize (GObject *object)
{
- CcMouseTestPrivate *d = CC_MOUSE_TEST (object)->priv;
+ CcMouseTest *self = CC_MOUSE_TEST (object);
- g_clear_object (&d->mouse_settings);
- g_clear_object (&d->builder);
+ g_clear_object (&self->mouse_settings);
+ g_clear_object (&self->builder);
- if (d->information_label_timeout_id != 0) {
- g_source_remove (d->information_label_timeout_id);
- d->information_label_timeout_id = 0;
+ if (self->information_label_timeout_id != 0) {
+ g_source_remove (self->information_label_timeout_id);
+ self->information_label_timeout_id = 0;
}
- if (d->scroll_image_timeout_id != 0) {
- g_source_remove (d->scroll_image_timeout_id);
- d->scroll_image_timeout_id = 0;
+ if (self->scroll_image_timeout_id != 0) {
+ g_source_remove (self->scroll_image_timeout_id);
+ self->scroll_image_timeout_id = 0;
}
- if (d->button_drawing_area_timeout_id != 0) {
- g_source_remove (d->button_drawing_area_timeout_id);
- d->button_drawing_area_timeout_id = 0;
+ if (self->button_drawing_area_timeout_id != 0) {
+ g_source_remove (self->button_drawing_area_timeout_id);
+ self->button_drawing_area_timeout_id = 0;
}
G_OBJECT_CLASS (cc_mouse_test_parent_class)->finalize (object);
@@ -353,34 +353,31 @@ cc_mouse_test_class_init (CcMouseTestClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->finalize = cc_mouse_test_finalize;
-
- g_type_class_add_private (class, sizeof (CcMouseTestPrivate));
}
static void
-cc_mouse_test_init (CcMouseTest *object)
+cc_mouse_test_init (CcMouseTest *self)
{
- CcMouseTestPrivate *d = object->priv = CC_MOUSE_TEST_GET_PRIVATE (object);
GError *error = NULL;
- d->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (d->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/mouse/gnome-mouse-test.ui",
&error);
- d->double_click_timestamp = 0;
- d->double_click_state = DOUBLE_CLICK_TEST_OFF;
- d->button_state = 0;
+ self->double_click_timestamp = 0;
+ self->double_click_state = DOUBLE_CLICK_TEST_OFF;
+ self->button_state = 0;
- d->mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
+ self->mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
- d->information_label_timeout_id = 0;
- d->button_drawing_area_timeout_id = 0;
- d->scroll_image_timeout_id = 0;
+ self->information_label_timeout_id = 0;
+ self->button_drawing_area_timeout_id = 0;
+ self->scroll_image_timeout_id = 0;
- gtk_container_add (GTK_CONTAINER (object), WID ("test_widget"));
+ gtk_container_add (GTK_CONTAINER (self), WID ("test_widget"));
- setup_dialog (d);
+ setup_dialog (self);
}
GtkWidget *
diff --git a/panels/mouse/gnome-mouse-test.h b/panels/mouse/gnome-mouse-test.h
index d02e10591..d06c9932b 100644
--- a/panels/mouse/gnome-mouse-test.h
+++ b/panels/mouse/gnome-mouse-test.h
@@ -25,31 +25,9 @@
G_BEGIN_DECLS
-#define CC_TYPE_MOUSE_TEST cc_mouse_test_get_type ()
+#define CC_TYPE_MOUSE_TEST (cc_mouse_test_get_type ())
+G_DECLARE_FINAL_TYPE (CcMouseTest, cc_mouse_test, CC, MOUSE_TEST, GtkBin)
-#define CC_MOUSE_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_MOUSE_TEST, CcMouseTest))
-#define CC_MOUSE_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_MOUSE_TEST, CcMouseTestClass))
-#define CC_IS_MOUSE_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_MOUSE_TEST))
-#define CC_IS_MOUSE_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_MOUSE_TEST))
-#define CC_MOUSE_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_MOUSE_TEST, CcMouseTestClass))
-
-typedef struct _CcMouseTest CcMouseTest;
-typedef struct _CcMouseTestClass CcMouseTestClass;
-typedef struct _CcMouseTestPrivate CcMouseTestPrivate;
-
-struct _CcMouseTest
-{
- GtkAlignment parent;
-
- CcMouseTestPrivate *priv;
-};
-
-struct _CcMouseTestClass
-{
- GtkAlignmentClass parent_class;
-};
-
-GType cc_mouse_test_get_type (void) G_GNUC_CONST;
GtkWidget *cc_mouse_test_new (void);
G_END_DECLS
diff --git a/panels/network/cc-network-panel.h b/panels/network/cc-network-panel.h
index bae9d7e2e..6d3b98b1b 100644
--- a/panels/network/cc-network-panel.h
+++ b/panels/network/cc-network-panel.h
@@ -25,8 +25,7 @@
G_BEGIN_DECLS
-#define CC_TYPE_NETWORK_PANEL cc_network_panel_get_type()
-
+#define CC_TYPE_NETWORK_PANEL (cc_network_panel_get_type ())
G_DECLARE_FINAL_TYPE (CcNetworkPanel, cc_network_panel, CC, NETWORK_PANEL, CcPanel)
GPtrArray *cc_network_panel_get_devices (CcNetworkPanel *panel);
diff --git a/panels/network/cc-wifi-panel.h b/panels/network/cc-wifi-panel.h
index 43ad4bf96..57be32ce3 100644
--- a/panels/network/cc-wifi-panel.h
+++ b/panels/network/cc-wifi-panel.h
@@ -24,8 +24,7 @@
G_BEGIN_DECLS
-#define CC_TYPE_WIFI_PANEL (cc_wifi_panel_get_type())
-
+#define CC_TYPE_WIFI_PANEL (cc_wifi_panel_get_type ())
G_DECLARE_FINAL_TYPE (CcWifiPanel, cc_wifi_panel, CC, WIFI_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c b/panels/network/connection-editor/ce-page-8021x-security.c
index f7d31969a..0faa8dcc0 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -33,6 +33,16 @@
#include "ce-page-ethernet.h"
#include "ce-page-8021x-security.h"
+struct _CEPage8021xSecurity {
+ CEPage parent_instance;
+
+ GtkSwitch *enabled;
+ GtkWidget *security_widget;
+ WirelessSecurity *security;
+ GtkSizeGroup *group;
+ gboolean initial_have_8021x;
+};
+
G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
static void
@@ -60,12 +70,12 @@ finish_setup (CEPage8021xSecurity *page, gpointer unused, GError *error, gpointe
if (error)
return;
- vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "vbox"));
- heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_sec"));
+ vbox = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "vbox"));
+ heading = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "heading_sec"));
page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->security = (WirelessSecurity *) ws_wpa_eap_new (CE_PAGE (page)->connection, TRUE, FALSE);
+ page->security = (WirelessSecurity *) ws_wpa_eap_new (ce_page_get_connection (CE_PAGE (page)), TRUE, FALSE);
if (!page->security) {
g_warning ("Could not load 802.1x user interface.");
return;
@@ -103,12 +113,12 @@ ce_page_8021x_security_new (NMConnection *connection,
if (nm_connection_get_setting_802_1x (connection))
page->initial_have_8021x = TRUE;
- page->enabled = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "8021x_switch"));
+ page->enabled = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "8021x_switch"));
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
if (page->initial_have_8021x)
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_802_1X_SETTING_NAME);
return CE_PAGE (page);
}
diff --git a/panels/network/connection-editor/ce-page-8021x-security.h b/panels/network/connection-editor/ce-page-8021x-security.h
index 3bbac2a05..035a72c3f 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.h
+++ b/panels/network/connection-editor/ce-page-8021x-security.h
@@ -31,31 +31,8 @@
#include "ce-page.h"
-#define CE_TYPE_PAGE_8021X_SECURITY (ce_page_8021x_security_get_type ())
-#define CE_PAGE_8021X_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurity))
-#define CE_PAGE_8021X_SECURITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurityClass))
-#define CE_IS_PAGE_8021X_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CE_TYPE_PAGE_8021X_SECURITY))
-#define CE_IS_PAGE_8021X_SECURITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CE_TYPE_PAGE_8021X_SECURITY))
-#define CE_PAGE_8021X_SECURITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurityClass))
-
-typedef struct CEPage8021xSecurity CEPage8021xSecurity;
-typedef struct CEPage8021xSecurityClass CEPage8021xSecurityClass;
-
-struct CEPage8021xSecurity {
- CEPage parent;
-
- GtkSwitch *enabled;
- GtkWidget *security_widget;
- WirelessSecurity *security;
- GtkSizeGroup *group;
- gboolean initial_have_8021x;
-};
-
-struct CEPage8021xSecurityClass {
- CEPageClass parent;
-};
-
-GType ce_page_8021x_security_get_type (void);
+#define CE_TYPE_PAGE_8021X_SECURITY (ce_page_8021x_security_get_type ())
+G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, CEPage)
CEPage *ce_page_8021x_security_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-details.c b/panels/network/connection-editor/ce-page-details.c
index 2d8583677..901e33d15 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -23,12 +23,22 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "../panel-common.h"
#include "ce-page-details.h"
+struct _CEPageDetails
+{
+ CEPage parent_instance;
+
+ NMDevice *device;
+ NMAccessPoint *ap;
+ NetConnectionEditor *editor;
+};
+
G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
static void
@@ -109,7 +119,7 @@ update_last_used (CEPageDetails *page, NMConnection *connection)
else
last_used = g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
out:
- panel_set_device_widget_details (CE_PAGE (page)->builder, "last_used", last_used);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "last_used", last_used);
if (now != NULL)
g_date_time_unref (now);
if (then != NULL)
@@ -123,7 +133,7 @@ all_user_changed (GtkToggleButton *b, CEPageDetails *page)
gboolean all_users;
NMSettingConnection *sc;
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ sc = nm_connection_get_setting_connection (ce_page_get_connection (CE_PAGE (page)));
all_users = gtk_toggle_button_get_active (b);
g_object_set (sc, "permissions", NULL, NULL);
@@ -163,7 +173,7 @@ connect_details_page (CEPageDetails *page)
ac = nm_device_get_active_connection (page->device);
p1 = ac ? nm_active_connection_get_uuid (ac) : NULL;
- p2 = nm_connection_get_uuid (CE_PAGE (page)->connection);
+ p2 = nm_connection_get_uuid (ce_page_get_connection (CE_PAGE (page)));
if (g_strcmp0 (p1, p2) == 0) {
device_is_active = TRUE;
if (NM_IS_DEVICE_WIFI (page->device))
@@ -176,7 +186,7 @@ connect_details_page (CEPageDetails *page)
str = g_strdup_printf (_("%d Mb/s"), speed);
else
str = NULL;
- panel_set_device_widget_details (CE_PAGE (page)->builder, "speed", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "speed", str);
g_clear_pointer (&str, g_free);
if (NM_IS_DEVICE_WIFI (page->device))
@@ -184,12 +194,12 @@ connect_details_page (CEPageDetails *page)
else if (NM_IS_DEVICE_ETHERNET (page->device))
str = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (page->device));
- panel_set_device_widget_details (CE_PAGE (page)->builder, "mac", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "mac", str);
str = NULL;
if (device_is_active && active_ap)
str = get_ap_security_string (active_ap);
- panel_set_device_widget_details (CE_PAGE (page)->builder, "security", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "security", str);
g_clear_pointer (&str, g_free);
strength = 0;
@@ -208,30 +218,30 @@ connect_details_page (CEPageDetails *page)
str = C_("Signal strength", "Good");
else
str = C_("Signal strength", "Excellent");
- panel_set_device_widget_details (CE_PAGE (page)->builder, "strength", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "strength", str);
/* set IP entries */
if (device_is_active)
- panel_set_device_widgets (CE_PAGE (page)->builder, page->device);
+ panel_set_device_widgets (ce_page_get_builder (CE_PAGE (page)), page->device);
else
- panel_unset_device_widgets (CE_PAGE (page)->builder);
+ panel_unset_device_widgets (ce_page_get_builder (CE_PAGE (page)));
- if (!device_is_active && CE_PAGE (page)->connection)
- update_last_used (page, CE_PAGE (page)->connection);
+ if (!device_is_active && ce_page_get_connection (CE_PAGE (page)))
+ update_last_used (page, ce_page_get_connection (CE_PAGE (page)));
else
- panel_set_device_widget_details (CE_PAGE (page)->builder, "last_used", NULL);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "last_used", NULL);
/* Auto connect check */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_connect_check"));
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ sc = nm_connection_get_setting_connection (ce_page_get_connection (CE_PAGE (page)));
g_object_bind_property (sc, "autoconnect",
widget, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* All users check */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"all_user_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
nm_setting_connection_get_num_permissions (sc) == 0);
@@ -240,7 +250,7 @@ connect_details_page (CEPageDetails *page)
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* Forget button */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "button_forget"));
g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
type = nm_setting_connection_get_connection_type (sc);
diff --git a/panels/network/connection-editor/ce-page-details.h b/panels/network/connection-editor/ce-page-details.h
index fb85a2585..744b37135 100644
--- a/panels/network/connection-editor/ce-page-details.h
+++ b/panels/network/connection-editor/ce-page-details.h
@@ -24,37 +24,13 @@
#include <glib-object.h>
-#include <gtk/gtk.h>
#include "net-connection-editor.h"
#include "ce-page.h"
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_DETAILS (ce_page_details_get_type ())
-#define CE_PAGE_DETAILS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_DETAILS, CEPageDetails))
-#define CE_PAGE_DETAILS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_DETAILS, CEPageDetailsClass))
-#define CE_IS_PAGE_DETAILS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_DETAILS))
-#define CE_IS_PAGE_DETAILS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_DETAILS))
-#define CE_PAGE_DETAILS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_DETAILS, CEPageDetailsClass))
-
-typedef struct _CEPageDetails CEPageDetails;
-typedef struct _CEPageDetailsClass CEPageDetailsClass;
-
-struct _CEPageDetails
-{
- CEPage parent;
-
- NMDevice *device;
- NMAccessPoint *ap;
- NetConnectionEditor *editor;
-};
-
-struct _CEPageDetailsClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_details_get_type (void);
+#define CE_TYPE_PAGE_DETAILS (ce_page_details_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
CEPage *ce_page_details_new (NMConnection *connection,
NMClient *client,
diff --git a/panels/network/connection-editor/ce-page-ethernet.c b/panels/network/connection-editor/ce-page-ethernet.c
index 2163cdbb6..af0f671fe 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -24,13 +24,27 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include <net/if_arp.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
-
#include "ce-page-ethernet.h"
#include "ui-helpers.h"
+struct _CEPageEthernet
+{
+ CEPage parent_instance;
+
+ NMSettingConnection *setting_connection;
+ NMSettingWired *setting_wired;
+
+ GtkEntry *name;
+ GtkComboBoxText *device_mac;
+ GtkEntry *cloned_mac;
+ GtkSpinButton *mtu;
+ GtkWidget *mtu_label;
+};
+
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
static void
@@ -56,7 +70,7 @@ connect_ethernet_page (CEPageEthernet *page)
gtk_entry_set_text (page->name, name);
/* Device MAC address */
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_ETHERNET,
+ mac_list = ce_page_get_mac_list (ce_page_get_client (CE_PAGE (page)), NM_TYPE_DEVICE_ETHERNET,
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wired_get_mac_address (setting);
ce_page_setup_mac_combo (page->device_mac, s_mac_str, mac_list);
@@ -172,11 +186,11 @@ ce_page_ethernet_new (NMConnection *connection,
"/org/gnome/control-center/network/ethernet-page.ui",
_("Identity")));
- page->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_name"));
- page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_mac"));
- page->cloned_mac = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
- page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "spin_mtu"));
- page->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "label_mtu"));
+ page->name = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_name"));
+ page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "combo_mac"));
+ page->cloned_mac = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_cloned_mac"));
+ page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "spin_mtu"));
+ page->mtu_label = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "label_mtu"));
page->setting_connection = nm_connection_get_setting_connection (connection);
page->setting_wired = nm_connection_get_setting_wired (connection);
diff --git a/panels/network/connection-editor/ce-page-ethernet.h b/panels/network/connection-editor/ce-page-ethernet.h
index 9c7c07d0d..a7eba3e22 100644
--- a/panels/network/connection-editor/ce-page-ethernet.h
+++ b/panels/network/connection-editor/ce-page-ethernet.h
@@ -26,41 +26,12 @@
#include <NetworkManager.h>
-#include <gtk/gtk.h>
#include "ce-page.h"
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_ETHERNET (ce_page_ethernet_get_type ())
-#define CE_PAGE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_ETHERNET, CEPageEthernet))
-#define CE_PAGE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_ETHERNET, CEPageEthernetClass))
-#define CE_IS_PAGE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_ETHERNET))
-#define CE_IS_PAGE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_ETHERNET))
-#define CE_PAGE_ETHERNET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_ETHERNET, CEPageEthernetClass))
-
-typedef struct _CEPageEthernet CEPageEthernet;
-typedef struct _CEPageEthernetClass CEPageEthernetClass;
-
-struct _CEPageEthernet
-{
- CEPage parent;
-
- NMSettingConnection *setting_connection;
- NMSettingWired *setting_wired;
-
- GtkEntry *name;
- GtkComboBoxText *device_mac;
- GtkEntry *cloned_mac;
- GtkSpinButton *mtu;
- GtkWidget *mtu_label;
-};
-
-struct _CEPageEthernetClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ethernet_get_type (void);
+#define CE_TYPE_PAGE_ETHERNET (ce_page_ethernet_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, CEPage)
CEPage *ce_page_ethernet_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index 0f34f6f63..52bb09257 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -26,17 +26,33 @@
#include <arpa/inet.h>
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip4.h"
#include "ui-helpers.h"
-#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(CE_PAGE (page)->builder, x))))
+#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(ce_page_get_builder (CE_PAGE (page)), x))))
static void ensure_empty_address_row (CEPageIP4 *page);
static void ensure_empty_routes_row (CEPageIP4 *page);
+struct _CEPageIP4
+{
+ CEPage parent_instance;
+
+ NMSettingIPConfig *setting;
+
+ GtkToggleButton *disabled;
+ GtkWidget *address_list;
+ GtkSwitch *auto_dns;
+ GtkWidget *dns_entry;
+ GtkSwitch *auto_routes;
+ GtkWidget *routes_list;
+ GtkWidget *never_default;
+};
+
G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
enum {
@@ -70,7 +86,7 @@ method_changed (GtkToggleButton *radio, CEPageIP4 *page)
routes_enabled = !RADIO_IS_ACTIVE ("radio_local");
}
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_section"));
gtk_widget_set_visible (widget, addr_enabled);
gtk_widget_set_sensitive (page->dns_entry, dns_enabled);
gtk_widget_set_sensitive (page->routes_list, routes_enabled);
@@ -253,7 +269,7 @@ add_address_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "address_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -289,7 +305,7 @@ add_address_section (CEPageIP4 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_section"));
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
@@ -327,11 +343,11 @@ add_dns_section (CEPageIP4 *page)
GString *string;
gint i;
- page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
+ page->auto_dns = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
- page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
+ page->dns_entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
string = g_string_new ("");
@@ -412,7 +428,7 @@ add_route_row (CEPageIP4 *page,
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_metric_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_metric_sizegroup"));
gtk_size_group_add_widget (group, widget);
delete_button = gtk_button_new ();
@@ -426,7 +442,7 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -461,14 +477,14 @@ add_routes_section (CEPageIP4 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_section"));
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (widget), list);
- page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_routes_switch"));
+ page->auto_routes = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes (page->setting));
g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
@@ -519,13 +535,13 @@ connect_ip4_page (CEPageIP4 *page)
add_dns_section (page);
add_routes_section (page);
- page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_disabled"));
+ page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_disabled"));
str_method = nm_setting_ip_config_get_method (page->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0;
gtk_toggle_button_set_active (page->disabled, disabled);
g_signal_connect_swapped (page->disabled, "notify::active", G_CALLBACK (ce_page_changed), page);
- content = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "page_content"));
+ content = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page_content"));
g_object_bind_property (page->disabled, "active",
content, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
@@ -541,15 +557,15 @@ connect_ip4_page (CEPageIP4 *page)
method = IP4_METHOD_DISABLED;
}
- page->never_default = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "never_default_check"));
+ page->never_default = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "never_default_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default),
nm_setting_ip_config_get_never_default (page->setting));
g_signal_connect_swapped (page->never_default, "toggled", G_CALLBACK (ce_page_changed), page);
/* Connect radio buttons */
- radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_automatic"));
- radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_local"));
- radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_manual"));
+ radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_automatic"));
+ radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_local"));
+ radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_manual"));
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
diff --git a/panels/network/connection-editor/ce-page-ip4.h b/panels/network/connection-editor/ce-page-ip4.h
index 31a8eb601..463e29c9a 100644
--- a/panels/network/connection-editor/ce-page-ip4.h
+++ b/panels/network/connection-editor/ce-page-ip4.h
@@ -24,42 +24,12 @@
#include <glib-object.h>
-#include <gtk/gtk.h>
#include "ce-page.h"
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_IP4 (ce_page_ip4_get_type ())
-#define CE_PAGE_IP4(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_IP4, CEPageIP4))
-#define CE_PAGE_IP4_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_IP4, CEPageIP4Class))
-#define CE_IS_PAGE_IP4(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_IP4))
-#define CE_IS_PAGE_IP4_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_IP4))
-#define CE_PAGE_IP4_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_IP4, CEPageIP4Class))
-
-typedef struct _CEPageIP4 CEPageIP4;
-typedef struct _CEPageIP4Class CEPageIP4Class;
-
-struct _CEPageIP4
-{
- CEPage parent;
-
- NMSettingIPConfig *setting;
-
- GtkToggleButton *disabled;
- GtkWidget *address_list;
- GtkSwitch *auto_dns;
- GtkWidget *dns_entry;
- GtkSwitch *auto_routes;
- GtkWidget *routes_list;
- GtkWidget *never_default;
-};
-
-struct _CEPageIP4Class
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ip4_get_type (void);
+#define CE_TYPE_PAGE_IP4 (ce_page_ip4_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, CEPage)
CEPage *ce_page_ip4_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index c9daab1ec..ec6154a52 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -26,17 +26,33 @@
#include <arpa/inet.h>
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip6.h"
#include "ui-helpers.h"
-#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(CE_PAGE (page)->builder, x))))
+#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(ce_page_get_builder (CE_PAGE (page)), x))))
static void ensure_empty_address_row (CEPageIP6 *page);
static void ensure_empty_routes_row (CEPageIP6 *page);
+struct _CEPageIP6
+{
+ CEPage parent_instance;
+
+ NMSettingIPConfig *setting;
+
+ GtkToggleButton *disabled;
+ GtkWidget *address_list;
+ GtkSwitch *auto_dns;
+ GtkWidget *dns_entry;
+ GtkSwitch *auto_routes;
+ GtkWidget *routes_list;
+ GtkWidget *never_default;
+};
+
G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
enum {
@@ -71,7 +87,7 @@ method_changed (GtkToggleButton *button, CEPageIP6 *page)
routes_enabled = !RADIO_IS_ACTIVE ("radio_local");
}
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_section"));
gtk_widget_set_visible (widget, addr_enabled);
gtk_widget_set_sensitive (page->dns_entry, dns_enabled);
gtk_widget_set_sensitive (page->routes_list, routes_enabled);
@@ -232,7 +248,7 @@ add_address_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "address_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -267,7 +283,7 @@ add_address_section (CEPageIP6 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "address_section"));
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
@@ -298,11 +314,11 @@ add_dns_section (CEPageIP6 *page)
GString *string;
gint i;
- page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
+ page->auto_dns = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
- page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
+ page->dns_entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
string = g_string_new ("");
@@ -380,7 +396,7 @@ add_route_row (CEPageIP6 *page,
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_metric_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_metric_sizegroup"));
gtk_size_group_add_widget (group, widget);
delete_button = gtk_button_new ();
@@ -394,7 +410,7 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -435,14 +451,14 @@ add_routes_section (CEPageIP6 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "routes_section"));
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (widget), list);
- page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_routes_switch"));
+ page->auto_routes = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes (page->setting));
g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
@@ -489,13 +505,13 @@ connect_ip6_page (CEPageIP6 *page)
add_dns_section (page);
add_routes_section (page);
- page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_disabled"));
+ page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_disabled"));
str_method = nm_setting_ip_config_get_method (page->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0;
gtk_toggle_button_set_active (page->disabled, disabled);
g_signal_connect_swapped (page->disabled, "notify::active", G_CALLBACK (ce_page_changed), page);
- content = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "page_content"));
+ content = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page_content"));
g_object_bind_property (page->disabled, "active",
content, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
@@ -513,17 +529,17 @@ connect_ip6_page (CEPageIP6 *page)
method = IP6_METHOD_IGNORE;
}
- page->never_default = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "never_default_check"));
+ page->never_default = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "never_default_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default),
nm_setting_ip_config_get_never_default (page->setting));
g_signal_connect_swapped (page->never_default, "toggled", G_CALLBACK (ce_page_changed), page);
/* Connect radio buttons */
- radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_automatic"));
- radios[RADIO_DHCP] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_dhcp"));
- radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_local"));
- radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "radio_manual"));
+ radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_automatic"));
+ radios[RADIO_DHCP] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_dhcp"));
+ radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_local"));
+ radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "radio_manual"));
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
diff --git a/panels/network/connection-editor/ce-page-ip6.h b/panels/network/connection-editor/ce-page-ip6.h
index 57933b7e5..549947847 100644
--- a/panels/network/connection-editor/ce-page-ip6.h
+++ b/panels/network/connection-editor/ce-page-ip6.h
@@ -23,43 +23,14 @@
#define __CE_PAGE_IP6_H
#include <glib-object.h>
+#include <NetworkManager.h>
-#include <gtk/gtk.h>
#include "ce-page.h"
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_IP6 (ce_page_ip6_get_type ())
-#define CE_PAGE_IP6(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_IP6, CEPageIP6))
-#define CE_PAGE_IP6_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_IP6, CEPageIP6Class))
-#define CE_IS_PAGE_IP6(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_IP6))
-#define CE_IS_PAGE_IP6_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_IP6))
-#define CE_PAGE_IP6_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_IP6, CEPageIP6Class))
-
-typedef struct _CEPageIP6 CEPageIP6;
-typedef struct _CEPageIP6Class CEPageIP6Class;
-
-struct _CEPageIP6
-{
- CEPage parent;
-
- NMSettingIPConfig *setting;
-
- GtkToggleButton *disabled;
- GtkWidget *address_list;
- GtkSwitch *auto_dns;
- GtkWidget *dns_entry;
- GtkSwitch *auto_routes;
- GtkWidget *routes_list;
- GtkWidget *never_default;
-};
-
-struct _CEPageIP6Class
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ip6_get_type (void);
+#define CE_TYPE_PAGE_IP6 (ce_page_ip6_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, CEPage)
CEPage *ce_page_ip6_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-security.c b/panels/network/connection-editor/ce-page-security.c
index d06e3aeb1..59b1e32d0 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -29,6 +29,16 @@
#include "wireless-security.h"
#include "ce-page-security.h"
+struct _CEPageSecurity
+{
+ CEPage parent_instance;
+
+ GtkComboBox *security_combo;
+ GtkWidget *security_heading;
+ GtkSizeGroup *group;
+ gboolean adhoc;
+};
+
G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE)
enum {
@@ -129,7 +139,7 @@ security_combo_changed (GtkComboBox *combo,
wsec_size_group_clear (page->group);
- vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "vbox"));
+ vbox = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "vbox"));
children = gtk_container_get_children (GTK_CONTAINER (vbox));
for (l = children; l; l = l->next) {
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (l->data));
@@ -200,7 +210,7 @@ set_sensitive (GtkCellLayout *cell_layout,
static void
finish_setup (CEPageSecurity *page)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = ce_page_get_connection (CE_PAGE (page));
NMSettingWireless *sw;
NMSettingWirelessSecurity *sws;
gboolean is_adhoc = FALSE;
@@ -219,8 +229,8 @@ finish_setup (CEPageSecurity *page)
page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->security_heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_sec"));
- page->security_combo = combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_sec"));
+ page->security_heading = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "heading_sec"));
+ page->security_combo = combo = GTK_COMBO_BOX (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "combo_sec"));
dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
| NM_WIFI_DEVICE_CAP_CIPHER_WEP104
@@ -452,13 +462,13 @@ ce_page_security_new (NMConnection *connection,
default_type == NMU_SEC_LEAP ||
default_type == NMU_SEC_WPA_PSK ||
default_type == NMU_SEC_WPA2_PSK) {
- CE_PAGE (page)->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
}
if (default_type == NMU_SEC_DYNAMIC_WEP ||
default_type == NMU_SEC_WPA_ENTERPRISE ||
default_type == NMU_SEC_WPA2_ENTERPRISE) {
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_802_1X_SETTING_NAME);
}
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
diff --git a/panels/network/connection-editor/ce-page-security.h b/panels/network/connection-editor/ce-page-security.h
index fa7e731a1..a5cfc9b56 100644
--- a/panels/network/connection-editor/ce-page-security.h
+++ b/panels/network/connection-editor/ce-page-security.h
@@ -29,32 +29,8 @@
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_SECURITY (ce_page_security_get_type ())
-#define CE_PAGE_SECURITY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_SECURITY, CEPageSecurity))
-#define CE_PAGE_SECURITY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_SECURITY, CEPageSecurityClass))
-#define CE_IS_PAGE_SECURITY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_SECURITY))
-#define CE_IS_PAGE_SECURITY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_SECURITY))
-#define CE_PAGE_SECURITY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_SECURITY, CEPageSecurityClass))
-
-typedef struct _CEPageSecurity CEPageSecurity;
-typedef struct _CEPageSecurityClass CEPageSecurityClass;
-
-struct _CEPageSecurity
-{
- CEPage parent;
-
- GtkComboBox *security_combo;
- GtkWidget *security_heading;
- GtkSizeGroup *group;
- gboolean adhoc;
-};
-
-struct _CEPageSecurityClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_security_get_type (void);
+#define CE_TYPE_PAGE_SECURITY (ce_page_security_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, CEPage)
CEPage *ce_page_security_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index dd6d42f4b..6393769d8 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -23,12 +23,27 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "ce-page-vpn.h"
#include "vpn-helpers.h"
+struct _CEPageVpn
+{
+ CEPage parent_instance;
+
+ NMSettingConnection *setting_connection;
+ NMSettingVpn *setting_vpn;
+
+ GtkEntry *name;
+ GtkBox *box;
+
+ NMVpnEditorPlugin *plugin;
+ NMVpnEditor *editor;
+};
+
G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
/* Hack to make the plugin-provided editor widget fit in better with
@@ -76,7 +91,6 @@ vpn_gnome3ify_editor (GtkWidget *widget)
static void
load_vpn_plugin (CEPageVpn *page, NMConnection *connection)
{
- CEPage *parent = CE_PAGE (page);
GtkWidget *ui_widget, *failure;
page->editor = nm_vpn_editor_plugin_get_editor (page->plugin,
@@ -93,7 +107,7 @@ load_vpn_plugin (CEPageVpn *page, NMConnection *connection)
}
vpn_gnome3ify_editor (ui_widget);
- failure = GTK_WIDGET (gtk_builder_get_object (parent->builder, "failure_label"));
+ failure = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "failure_label"));
gtk_widget_destroy (failure);
gtk_box_pack_start (page->box, ui_widget, TRUE, TRUE, 0);
@@ -161,7 +175,7 @@ ce_page_vpn_class_init (CEPageVpnClass *class)
static void
finish_setup (CEPageVpn *page, gpointer unused, GError *error, gpointer user_data)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = ce_page_get_connection (CE_PAGE (page));
const char *vpn_type;
page->setting_connection = nm_connection_get_setting_connection (connection);
@@ -187,12 +201,12 @@ ce_page_vpn_new (NMConnection *connection,
"/org/gnome/control-center/network/vpn-page.ui",
_("Identity")));
- page->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_name"));
- page->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "page"));
+ page->name = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_name"));
+ page->box = GTK_BOX (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page"));
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
- CE_PAGE (page)->security_setting = NM_SETTING_VPN_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_VPN_SETTING_NAME);
return CE_PAGE (page);
}
diff --git a/panels/network/connection-editor/ce-page-vpn.h b/panels/network/connection-editor/ce-page-vpn.h
index 9fa706656..78955882e 100644
--- a/panels/network/connection-editor/ce-page-vpn.h
+++ b/panels/network/connection-editor/ce-page-vpn.h
@@ -26,41 +26,12 @@
#include <NetworkManager.h>
-#include <gtk/gtk.h>
#include "ce-page.h"
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_VPN (ce_page_vpn_get_type ())
-#define CE_PAGE_VPN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_VPN, CEPageVpn))
-#define CE_PAGE_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_VPN, CEPageVpnClass))
-#define CE_IS_PAGE_VPN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_VPN))
-#define CE_IS_PAGE_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_VPN))
-#define CE_PAGE_VPN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_VPN, CEPageVpnClass))
-
-typedef struct _CEPageVpn CEPageVpn;
-typedef struct _CEPageVpnClass CEPageVpnClass;
-
-struct _CEPageVpn
-{
- CEPage parent;
-
- NMSettingConnection *setting_connection;
- NMSettingVpn *setting_vpn;
-
- GtkEntry *name;
- GtkBox *box;
-
- NMVpnEditorPlugin *plugin;
- NMVpnEditor *editor;
-};
-
-struct _CEPageVpnClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_vpn_get_type (void);
+#define CE_TYPE_PAGE_VPN (ce_page_vpn_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
CEPage *ce_page_vpn_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index 08e8e3721..27dca5f47 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -31,6 +31,13 @@
#include "ce-page-wifi.h"
#include "ui-helpers.h"
+struct _CEPageWifi
+{
+ CEPage parent_instance;
+
+ NMSettingWireless *setting;
+};
+
G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
static void
@@ -47,7 +54,7 @@ connect_wifi_page (CEPageWifi *page)
const gchar *cloned_mac;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_ssid"));
ssid = nm_setting_wireless_get_ssid (page->setting);
@@ -60,7 +67,7 @@ connect_wifi_page (CEPageWifi *page)
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_bssid"));
bssid_array = g_ptr_array_new ();
@@ -74,9 +81,9 @@ connect_wifi_page (CEPageWifi *page)
g_strfreev (bssid_list);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_mac"));
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_WIFI,
+ mac_list = ce_page_get_mac_list (ce_page_get_client (CE_PAGE (page)), NM_TYPE_DEVICE_WIFI,
NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wireless_get_mac_address (page->setting);
ce_page_setup_mac_combo (GTK_COMBO_BOX_TEXT (widget), s_mac_str, mac_list);
@@ -84,7 +91,7 @@ connect_wifi_page (CEPageWifi *page)
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_cloned_mac"));
cloned_mac = nm_setting_wireless_get_cloned_mac_address (page->setting);
gtk_entry_set_text (GTK_ENTRY (widget), cloned_mac ? cloned_mac : "");
@@ -99,20 +106,20 @@ ui_to_setting (CEPageWifi *page)
GtkWidget *entry;
char *device_mac, *cloned_mac;
- entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_ssid"));
utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry));
if (!utf8_ssid || !*utf8_ssid)
ssid = NULL;
else {
ssid = g_bytes_new_static (utf8_ssid, strlen (utf8_ssid));
}
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_bssid")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "combo_bssid")));
bssid = gtk_entry_get_text (GTK_ENTRY (entry));
if (*bssid == '\0')
bssid = NULL;
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_mac")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "combo_mac")));
device_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry)));
- entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_cloned_mac"));
cloned_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry)));
g_object_set (page->setting,
@@ -136,7 +143,7 @@ validate (CEPage *page,
GtkWidget *entry;
gboolean ret = TRUE;
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (page->builder, "combo_bssid")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (page), "combo_bssid")));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -144,7 +151,7 @@ validate (CEPage *page,
widget_unset_error (entry);
}
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (page->builder, "combo_mac")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (page), "combo_mac")));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -152,7 +159,7 @@ validate (CEPage *page,
widget_unset_error (entry);
}
- entry = GTK_WIDGET (gtk_builder_get_object (page->builder, "entry_cloned_mac"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (page), "entry_cloned_mac"));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
diff --git a/panels/network/connection-editor/ce-page-wifi.h b/panels/network/connection-editor/ce-page-wifi.h
index 28c3024f0..8c1e39e6c 100644
--- a/panels/network/connection-editor/ce-page-wifi.h
+++ b/panels/network/connection-editor/ce-page-wifi.h
@@ -29,29 +29,8 @@
G_BEGIN_DECLS
-#define CE_TYPE_PAGE_WIFI (ce_page_wifi_get_type ())
-#define CE_PAGE_WIFI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_WIFI, CEPageWifi))
-#define CE_PAGE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_WIFI, CEPageWifiClass))
-#define CE_IS_PAGE_WIFI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_WIFI))
-#define CE_IS_PAGE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_WIFI))
-#define CE_PAGE_WIFI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_WIFI, CEPageWifiClass))
-
-typedef struct _CEPageWifi CEPageWifi;
-typedef struct _CEPageWifiClass CEPageWifiClass;
-
-struct _CEPageWifi
-{
- CEPage parent;
-
- NMSettingWireless *setting;
-};
-
-struct _CEPageWifiClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_wifi_get_type (void);
+#define CE_TYPE_PAGE_WIFI (ce_page_wifi_get_type ())
+G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, CEPage)
CEPage *ce_page_wifi_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c
index 1b4e08215..e892419a2 100644
--- a/panels/network/connection-editor/ce-page.c
+++ b/panels/network/connection-editor/ce-page.c
@@ -32,6 +32,18 @@
#include "ce-page.h"
+typedef struct
+{
+ gboolean initialized;
+ GtkBuilder *builder;
+ GtkWidget *page;
+ gchar *title;
+ const gchar *security_setting;
+
+ NMConnection *connection;
+ NMClient *client;
+ GCancellable *cancellable;
+} CEPagePrivate;
G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
@@ -65,10 +77,11 @@ static void
dispose (GObject *object)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
- g_clear_object (&self->page);
- g_clear_object (&self->builder);
- g_clear_object (&self->connection);
+ g_clear_object (&priv->page);
+ g_clear_object (&priv->builder);
+ g_clear_object (&priv->connection);
G_OBJECT_CLASS (ce_page_parent_class)->dispose (object);
}
@@ -77,38 +90,81 @@ static void
finalize (GObject *object)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
- g_free (self->title);
- if (self->cancellable) {
- g_cancellable_cancel (self->cancellable);
- g_object_unref (self->cancellable);
+ g_free (priv->title);
+ if (priv->cancellable) {
+ g_cancellable_cancel (priv->cancellable);
+ g_object_unref (priv->cancellable);
}
G_OBJECT_CLASS (ce_page_parent_class)->finalize (object);
}
+GtkBuilder *
+ce_page_get_builder (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->builder;
+}
+
+NMConnection *
+ce_page_get_connection (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->connection;
+}
+
+NMClient *
+ce_page_get_client (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->client;
+}
+
GtkWidget *
ce_page_get_page (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return self->page;
+ priv = ce_page_get_instance_private (self);
+ return priv->page;
}
const char *
ce_page_get_title (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return self->title;
+ priv = ce_page_get_instance_private (self);
+ return priv->title;
}
gboolean
ce_page_get_initialized (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
- return self->initialized;
+ priv = ce_page_get_instance_private (self);
+ return priv->initialized;
}
void
@@ -126,13 +182,14 @@ get_property (GObject *object,
GParamSpec *pspec)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
switch (prop_id) {
case PROP_CONNECTION:
- g_value_set_object (value, self->connection);
+ g_value_set_object (value, priv->connection);
break;
case PROP_INITIALIZED:
- g_value_set_boolean (value, self->initialized);
+ g_value_set_boolean (value, priv->initialized);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -147,12 +204,13 @@ set_property (GObject *object,
GParamSpec *pspec)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
switch (prop_id) {
case PROP_CONNECTION:
- if (self->connection)
- g_object_unref (self->connection);
- self->connection = g_value_dup_object (value);
+ if (priv->connection)
+ g_object_unref (priv->connection);
+ priv->connection = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -163,8 +221,9 @@ set_property (GObject *object,
static void
ce_page_init (CEPage *self)
{
- self->builder = gtk_builder_new ();
- self->cancellable = g_cancellable_new ();
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
+ priv->builder = gtk_builder_new ();
+ priv->cancellable = g_cancellable_new ();
}
static void
@@ -222,29 +281,31 @@ ce_page_new (GType type,
const gchar *title)
{
CEPage *page;
+ CEPagePrivate *priv;
GError *error = NULL;
page = CE_PAGE (g_object_new (type,
"connection", connection,
NULL));
- page->title = g_strdup (title);
- page->client = client;
+ priv = ce_page_get_instance_private (page);
+ priv->title = g_strdup (title);
+ priv->client = client;
if (ui_resource) {
- if (!gtk_builder_add_from_resource (page->builder, ui_resource, &error)) {
+ if (!gtk_builder_add_from_resource (priv->builder, ui_resource, &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
g_object_unref (page);
return NULL;
}
- page->page = GTK_WIDGET (gtk_builder_get_object (page->builder, "page"));
- if (!page->page) {
+ priv->page = GTK_WIDGET (gtk_builder_get_object (priv->builder, "page"));
+ if (!priv->page) {
g_warning ("Couldn't load page widget from %s", ui_resource);
g_object_unref (page);
return NULL;
}
- g_object_ref_sink (page->page);
+ g_object_ref_sink (priv->page);
}
return page;
@@ -254,7 +315,8 @@ static void
emit_initialized (CEPage *page,
GError *error)
{
- page->initialized = TRUE;
+ CEPagePrivate *priv = ce_page_get_instance_private (page);
+ priv->initialized = TRUE;
g_signal_emit (page, signals[INITIALIZED], 0, error);
g_clear_error (&error);
}
@@ -265,6 +327,7 @@ ce_page_complete_init (CEPage *page,
GVariant *secrets,
GError *error)
{
+ CEPagePrivate *priv = ce_page_get_instance_private (page);
GError *update_error = NULL;
GVariant *setting_dict;
gboolean ignore_error = FALSE;
@@ -299,7 +362,7 @@ ce_page_complete_init (CEPage *page,
g_variant_unref (setting_dict);
/* Update the connection with the new secrets */
- if (nm_connection_update_secrets (page->connection,
+ if (nm_connection_update_secrets (priv->connection,
setting_name,
secrets,
&update_error)) {
@@ -434,7 +497,23 @@ ce_page_address_is_valid (const gchar *addr)
const gchar *
ce_page_get_security_setting (CEPage *page)
{
- return page->security_setting;
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (page), NULL);
+
+ priv = ce_page_get_instance_private (page);
+ return priv->security_setting;
+}
+
+void
+ce_page_set_security_setting (CEPage *page, const gchar *security_setting)
+{
+ CEPagePrivate *priv;
+
+ g_return_if_fail (CE_IS_PAGE (page));
+
+ priv = ce_page_get_instance_private (page);
+ priv->security_setting = g_strdup (security_setting);
}
gint
diff --git a/panels/network/connection-editor/ce-page.h b/panels/network/connection-editor/ce-page.h
index 34cf4afa4..539936c1e 100644
--- a/panels/network/connection-editor/ce-page.h
+++ b/panels/network/connection-editor/ce-page.h
@@ -30,30 +30,8 @@
G_BEGIN_DECLS
-#define CE_TYPE_PAGE (ce_page_get_type ())
-#define CE_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE, CEPage))
-#define CE_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE, CEPageClass))
-#define CE_IS_PAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE))
-#define CE_IS_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE))
-#define CE_PAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE, CEPageClass))
-
-typedef struct _CEPage CEPage;
-typedef struct _CEPageClass CEPageClass;
-
-struct _CEPage
-{
- GObject parent;
-
- gboolean initialized;
- GtkBuilder *builder;
- GtkWidget *page;
- gchar *title;
- const gchar *security_setting;
-
- NMConnection *connection;
- NMClient *client;
- GCancellable *cancellable;
-};
+#define CE_TYPE_PAGE (ce_page_get_type ())
+G_DECLARE_DERIVABLE_TYPE (CEPage, ce_page, CE, PAGE, GObject)
struct _CEPageClass
{
@@ -64,10 +42,13 @@ struct _CEPageClass
void (*initialized) (CEPage *page, GError *error);
};
-GType ce_page_get_type (void);
-
+GtkBuilder *ce_page_get_builder (CEPage *page);
+NMConnection *ce_page_get_connection (CEPage *page);
+NMClient *ce_page_get_client (CEPage *page);
GtkWidget *ce_page_get_page (CEPage *page);
const gchar *ce_page_get_title (CEPage *page);
+void ce_page_set_security_setting (CEPage *page,
+ const gchar *security_setting);
const gchar *ce_page_get_security_setting (CEPage *page);
gboolean ce_page_validate (CEPage *page,
NMConnection *connection,
diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c
index 8c21667c6..195bf76ff 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -47,6 +47,33 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
+struct _NetConnectionEditor
+{
+ GObject parent_instance;
+
+ GtkWidget *parent_window;
+ NMClient *client;
+ NMDevice *device;
+
+ NMConnection *connection;
+ NMConnection *orig_connection;
+ gboolean is_new_connection;
+ gboolean is_changed;
+ NMAccessPoint *ap;
+
+ GtkBuilder *builder;
+ GtkWidget *window;
+
+ GSList *initializing_pages;
+ GSList *pages;
+
+ guint permission_id;
+ NMClientPermissionResult can_modify;
+
+ gboolean title_set;
+ gboolean show_when_initialized;
+};
+
G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, G_TYPE_OBJECT)
static void page_changed (CEPage *page, gpointer user_data);
@@ -217,7 +244,7 @@ net_connection_editor_class_init (NetConnectionEditorClass *class)
signals[DONE] = g_signal_new ("done",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (NetConnectionEditorClass, done),
+ 0,
NULL, NULL,
NULL,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
diff --git a/panels/network/connection-editor/net-connection-editor.h b/panels/network/connection-editor/net-connection-editor.h
index 431edf2d4..fc31d5885 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -29,51 +29,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_CONNECTION_EDITOR (net_connection_editor_get_type ())
-#define NET_CONNECTION_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_CONNECTION_EDITOR, NetConnectionEditor))
-#define NET_CONNECTION_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_CONNECTION_EDITOR, NetConnectionEditorClass))
-#define NET_IS_CONNECTION_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_CONNECTION_EDITOR))
-#define NET_IS_CONNECTION_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_CONNECTION_EDITOR))
-#define NET_CONNECTION_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_CONNECTION_EDITOR, NetConnectionEditorClass))
+#define NET_TYPE_CONNECTION_EDITOR (net_connection_editor_get_type ())
+G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GObject)
-typedef struct _NetConnectionEditor NetConnectionEditor;
-typedef struct _NetConnectionEditorClass NetConnectionEditorClass;
-
-struct _NetConnectionEditor
-{
- GObject parent;
-
- GtkWidget *parent_window;
- NMClient *client;
- NMDevice *device;
-
- NMConnection *connection;
- NMConnection *orig_connection;
- gboolean is_new_connection;
- gboolean is_changed;
- NMAccessPoint *ap;
-
- GtkBuilder *builder;
- GtkWidget *window;
-
- GSList *initializing_pages;
- GSList *pages;
-
- guint permission_id;
- NMClientPermissionResult can_modify;
-
- gboolean title_set;
- gboolean show_when_initialized;
-};
-
-struct _NetConnectionEditorClass
-{
- GObjectClass parent_class;
-
- void (*done) (NetConnectionEditor *details, gboolean success);
-};
-
-GType net_connection_editor_get_type (void);
NetConnectionEditor *net_connection_editor_new (GtkWindow *parent_window,
NMConnection *connection,
NMDevice *device,
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 86689b20e..a0d4aba91 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -34,6 +34,22 @@
#include "net-device-ethernet.h"
+struct _NetDeviceEthernet
+{
+ NetDeviceSimple parent_instance;
+
+ GtkBuilder *builder;
+
+ GtkWidget *list;
+ GtkWidget *scrolled_window;
+ GtkWidget *details;
+ GtkWidget *details_button;
+ GtkWidget *add_profile_button;
+ gboolean updating_device;
+
+ GHashTable *connections;
+};
+
G_DEFINE_TYPE (NetDeviceEthernet, net_device_ethernet, NET_TYPE_DEVICE_SIMPLE)
static char *
diff --git a/panels/network/net-device-ethernet.h b/panels/network/net-device-ethernet.h
index 0d92fd10b..da0070d06 100644
--- a/panels/network/net-device-ethernet.h
+++ b/panels/network/net-device-ethernet.h
@@ -28,39 +28,8 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_ETHERNET (net_device_ethernet_get_type ())
-#define NET_DEVICE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_ETHERNET, NetDeviceEthernet))
-#define NET_DEVICE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_ETHERNET, NetDeviceEthernetClass))
-#define NET_IS_DEVICE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_ETHERNET))
-#define NET_IS_DEVICE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_ETHERNET))
-#define NET_DEVICE_ETHERNET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_ETHERNET, NetDeviceEthernetClass))
-
-typedef struct _NetDeviceEthernetPrivate NetDeviceEthernetPrivate;
-typedef struct _NetDeviceEthernet NetDeviceEthernet;
-typedef struct _NetDeviceEthernetClass NetDeviceEthernetClass;
-
-struct _NetDeviceEthernet
-{
- NetDeviceSimple parent;
-
- GtkBuilder *builder;
-
- GtkWidget *list;
- GtkWidget *scrolled_window;
- GtkWidget *details;
- GtkWidget *details_button;
- GtkWidget *add_profile_button;
- gboolean updating_device;
-
- GHashTable *connections;
-};
-
-struct _NetDeviceEthernetClass
-{
- NetDeviceSimpleClass parent_class;
-};
-
-GType net_device_ethernet_get_type (void);
+#define NET_TYPE_DEVICE_ETHERNET (net_device_ethernet_get_type ())
+G_DECLARE_FINAL_TYPE (NetDeviceEthernet, net_device_ethernet, NET, DEVICE_ETHERNET, NetDeviceSimple)
G_END_DECLS
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 062e4d120..fc25bdc31 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -33,12 +33,12 @@
#include "network-dialogs.h"
#include "net-device-mobile.h"
-#define NET_DEVICE_MOBILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_MOBILE, NetDeviceMobilePrivate))
-
static void nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile);
-struct _NetDeviceMobilePrivate
+struct _NetDeviceMobile
{
+ NetDevice parent_instance;
+
GtkBuilder *builder;
gboolean updating_device;
@@ -76,14 +76,14 @@ device_mobile_proxy_add_to_stack (NetObject *object,
NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"heading_imei"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"heading_network"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"vbox7"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -116,7 +116,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
CcNetworkPanel *panel;
GtkWidget *toplevel;
- if (device_mobile->priv->updating_device)
+ if (device_mobile->updating_device)
goto out;
ret = gtk_combo_box_get_active_iter (combo_box, &iter);
@@ -187,12 +187,12 @@ mobilebb_enabled_toggled (NMClient *client,
}
}
- sw = GTK_SWITCH (gtk_builder_get_object (device_mobile->priv->builder,
+ sw = GTK_SWITCH (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
- device_mobile->priv->updating_device = TRUE;
+ device_mobile->updating_device = TRUE;
gtk_switch_set_active (sw, enabled);
- device_mobile->priv->updating_device = FALSE;
+ device_mobile->updating_device = FALSE;
}
static void
@@ -201,7 +201,6 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
GtkListStore *liststore,
GtkComboBox *combobox)
{
- NetDeviceMobilePrivate *priv = device_mobile->priv;
GSList *list, *l;
GtkTreeIter treeiter;
NMActiveConnection *active_connection;
@@ -224,9 +223,9 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
if (active_connection != NULL &&
g_strcmp0 (nm_connection_get_uuid (connection),
nm_active_connection_get_uuid (active_connection)) == 0) {
- priv->updating_device = TRUE;
+ device_mobile->updating_device = TRUE;
gtk_combo_box_set_active_iter (combobox, &treeiter);
- priv->updating_device = FALSE;
+ device_mobile->updating_device = FALSE;
}
}
@@ -246,17 +245,17 @@ device_mobile_refresh_equipment_id (NetDeviceMobile *device_mobile)
{
const gchar *equipment_id = NULL;
- if (device_mobile->priv->mm_object != NULL) {
+ if (device_mobile->mm_object != NULL) {
MMModem *modem;
/* Modem interface should always be present */
- modem = mm_object_peek_modem (device_mobile->priv->mm_object);
+ modem = mm_object_peek_modem (device_mobile->mm_object);
equipment_id = mm_modem_get_equipment_identifier (modem);
/* Set equipment ID */
if (equipment_id != NULL) {
g_debug ("[%s] Equipment ID set to '%s'",
- mm_object_get_path (device_mobile->priv->mm_object),
+ mm_object_get_path (device_mobile->mm_object),
equipment_id);
}
} else {
@@ -265,7 +264,7 @@ device_mobile_refresh_equipment_id (NetDeviceMobile *device_mobile)
"ControlCenter::EquipmentIdentifier");
}
- panel_set_device_widget_details (device_mobile->priv->builder, "imei", equipment_id);
+ panel_set_device_widget_details (device_mobile->builder, "imei", equipment_id);
}
static gchar *
@@ -276,12 +275,12 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
NMAMobileProvider *provider;
GString *name = NULL;
- if (device_mobile->priv->mpd == NULL) {
+ if (device_mobile->mpd == NULL) {
GError *error = NULL;
/* Use defaults */
- device_mobile->priv->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
- if (device_mobile->priv->mpd == NULL) {
+ device_mobile->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
+ if (device_mobile->mpd == NULL) {
g_debug ("Couldn't load mobile providers database: %s",
error ? error->message : "");
g_clear_error (&error);
@@ -290,13 +289,13 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
}
if (mccmnc != NULL) {
- provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (device_mobile->priv->mpd, mccmnc);
+ provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (device_mobile->mpd, mccmnc);
if (provider != NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
}
if (sid != 0) {
- provider = nma_mobile_providers_database_lookup_cdma_sid (device_mobile->priv->mpd, sid);
+ provider = nma_mobile_providers_database_lookup_cdma_sid (device_mobile->mpd, sid);
if (provider != NULL) {
if (name == NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
@@ -311,13 +310,13 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
static void
device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
{
- if (device_mobile->priv->mm_object != NULL) {
+ if (device_mobile->mm_object != NULL) {
gchar *operator_name = NULL;
MMModem3gpp *modem_3gpp;
MMModemCdma *modem_cdma;
- modem_3gpp = mm_object_peek_modem_3gpp (device_mobile->priv->mm_object);
- modem_cdma = mm_object_peek_modem_cdma (device_mobile->priv->mm_object);
+ modem_3gpp = mm_object_peek_modem_3gpp (device_mobile->mm_object);
+ modem_cdma = mm_object_peek_modem_cdma (device_mobile->mm_object);
if (modem_3gpp != NULL) {
const gchar *operator_name_unsafe;
@@ -343,11 +342,11 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
/* Set operator name */
if (operator_name != NULL) {
g_debug ("[%s] Operator name set to '%s'",
- mm_object_get_path (device_mobile->priv->mm_object),
+ mm_object_get_path (device_mobile->mm_object),
operator_name);
}
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", operator_name);
+ panel_set_device_widget_details (device_mobile->builder, "provider", operator_name);
g_free (operator_name);
} else {
const gchar *gsm;
@@ -363,14 +362,14 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
gchar *both;
both = g_strdup_printf ("%s, %s", gsm, cdma);
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", both);
+ panel_set_device_widget_details (device_mobile->builder, "provider", both);
g_free (both);
} else if (gsm != NULL) {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", gsm);
+ panel_set_device_widget_details (device_mobile->builder, "provider", gsm);
} else if (cdma != NULL) {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", cdma);
+ panel_set_device_widget_details (device_mobile->builder, "provider", cdma);
} else {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", NULL);
+ panel_set_device_widget_details (device_mobile->builder, "provider", NULL);
}
}
}
@@ -381,7 +380,6 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
gboolean is_connected;
GtkListStore *liststore;
GtkWidget *widget;
- NetDeviceMobilePrivate *priv = device_mobile->priv;
NMClient *client;
NMDeviceModemCapabilities caps;
NMDevice *nm_device;
@@ -389,20 +387,20 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
nm_device = net_device_get_nm_device (NET_DEVICE (device_mobile));
/* set device kind */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder, "label_device"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "label_device"));
g_object_bind_property (device_mobile, "title", widget, "label", 0);
/* set up the device on/off switch */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder, "device_off_switch"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "device_off_switch"));
gtk_widget_show (widget);
client = net_object_get_client (NET_OBJECT (device_mobile));
mobilebb_enabled_toggled (client, NULL, device_mobile);
/* set device state, with status */
- panel_set_device_status (device_mobile->priv->builder, "label_status", nm_device, NULL);
+ panel_set_device_status (device_mobile->builder, "label_status", nm_device, NULL);
/* sensitive for other connection types if the device is currently connected */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"button_options"));
is_connected = net_device_get_find_connection (NET_DEVICE (device_mobile)) != NULL;
gtk_widget_set_sensitive (widget, is_connected);
@@ -416,16 +414,16 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
}
/* add possible connections to device */
- liststore = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ liststore = GTK_LIST_STORE (gtk_builder_get_object (device_mobile->builder,
"liststore_mobile_connections"));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "combobox_network"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "combobox_network"));
device_add_device_connections (device_mobile,
nm_device,
liststore,
GTK_COMBO_BOX (widget));
/* set IP entries */
- panel_set_device_widgets (priv->builder, nm_device);
+ panel_set_device_widgets (device_mobile->builder, nm_device);
}
static void
@@ -447,7 +445,7 @@ device_off_toggled (GtkSwitch *sw,
NMConnection *connection;
NMClient *client;
- if (device_mobile->priv->updating_device)
+ if (device_mobile->updating_device)
return;
active = gtk_switch_get_active (sw);
@@ -625,8 +623,8 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
GError *error = NULL;
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
- device_mobile->priv->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->priv->gsm_proxy == NULL) {
+ device_mobile->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (device_mobile->gsm_proxy == NULL) {
g_warning ("Error creating ModemManager GSM proxy: %s\n",
error->message);
g_error_free (error);
@@ -634,13 +632,13 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
}
/* Setup value updates */
- g_signal_connect (device_mobile->priv->gsm_proxy,
+ g_signal_connect (device_mobile->gsm_proxy,
"g-signal",
G_CALLBACK (device_mobile_gsm_signal_cb),
device_mobile);
/* Load initial value */
- g_dbus_proxy_call (device_mobile->priv->gsm_proxy,
+ g_dbus_proxy_call (device_mobile->gsm_proxy,
"GetRegistrationInfo",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -697,8 +695,8 @@ device_mobile_device_got_modem_manager_cdma_cb (GObject *source_object,
GError *error = NULL;
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
- device_mobile->priv->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->priv->cdma_proxy == NULL) {
+ device_mobile->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (device_mobile->cdma_proxy == NULL) {
g_warning ("Error creating ModemManager CDMA proxy: %s\n",
error->message);
g_error_free (error);
@@ -706,7 +704,7 @@ device_mobile_device_got_modem_manager_cdma_cb (GObject *source_object,
}
/* Load initial value */
- g_dbus_proxy_call (device_mobile->priv->cdma_proxy,
+ g_dbus_proxy_call (device_mobile->cdma_proxy,
"GetServingSystem",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -793,17 +791,17 @@ net_device_mobile_setup_modem_object (NetDeviceMobile *self)
{
MMModem3gpp *modem_3gpp;
- if (self->priv->mm_object == NULL)
+ if (self->mm_object == NULL)
return;
/* Load equipment ID initially */
device_mobile_refresh_equipment_id (self);
/* Follow changes in operator name and load initial values */
- modem_3gpp = mm_object_peek_modem_3gpp (self->priv->mm_object);
+ modem_3gpp = mm_object_peek_modem_3gpp (self->mm_object);
if (modem_3gpp != NULL) {
- g_assert (self->priv->operator_name_updated == 0);
- self->priv->operator_name_updated = g_signal_connect (modem_3gpp,
+ g_assert (self->operator_name_updated == 0);
+ self->operator_name_updated = g_signal_connect (modem_3gpp,
"notify::operator-name",
G_CALLBACK (operator_name_updated),
self);
@@ -822,7 +820,7 @@ net_device_mobile_get_property (GObject *device_,
switch (prop_id) {
case PROP_MODEM_OBJECT:
- g_value_set_object (value, self->priv->mm_object);
+ g_value_set_object (value, self->mm_object);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
@@ -840,7 +838,7 @@ net_device_mobile_set_property (GObject *device_,
switch (prop_id) {
case PROP_MODEM_OBJECT:
- self->priv->mm_object = g_value_dup_object (value);
+ self->mm_object = g_value_dup_object (value);
net_device_mobile_setup_modem_object (self);
break;
default:
@@ -853,19 +851,18 @@ static void
net_device_mobile_dispose (GObject *object)
{
NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
- NetDeviceMobilePrivate *priv = device_mobile->priv;
- g_clear_object (&priv->builder);
- g_clear_object (&priv->gsm_proxy);
- g_clear_object (&priv->cdma_proxy);
+ g_clear_object (&device_mobile->builder);
+ g_clear_object (&device_mobile->gsm_proxy);
+ g_clear_object (&device_mobile->cdma_proxy);
- if (priv->operator_name_updated) {
- g_assert (priv->mm_object != NULL);
- g_signal_handler_disconnect (mm_object_peek_modem_3gpp (priv->mm_object), priv->operator_name_updated);
- priv->operator_name_updated = 0;
+ if (device_mobile->operator_name_updated) {
+ g_assert (device_mobile->mm_object != NULL);
+ g_signal_handler_disconnect (mm_object_peek_modem_3gpp (device_mobile->mm_object), device_mobile->operator_name_updated);
+ device_mobile->operator_name_updated = 0;
}
- g_clear_object (&priv->mm_object);
- g_clear_object (&priv->mpd);
+ g_clear_object (&device_mobile->mm_object);
+ g_clear_object (&device_mobile->mpd);
G_OBJECT_CLASS (net_device_mobile_parent_class)->dispose (object);
}
@@ -883,8 +880,6 @@ net_device_mobile_class_init (NetDeviceMobileClass *klass)
parent_class->add_to_stack = device_mobile_proxy_add_to_stack;
parent_class->refresh = device_mobile_refresh;
- g_type_class_add_private (klass, sizeof (NetDeviceMobilePrivate));
-
g_object_class_install_property (object_class,
PROP_MODEM_OBJECT,
g_param_spec_object ("mm-object",
@@ -902,10 +897,8 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
GtkCellRenderer *renderer;
GtkComboBox *combobox;
- device_mobile->priv = NET_DEVICE_MOBILE_GET_PRIVATE (device_mobile);
-
- device_mobile->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_mobile->priv->builder,
+ device_mobile->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (device_mobile->builder,
"/org/gnome/control-center/network/network-mobile.ui",
&error);
if (error != NULL) {
@@ -915,7 +908,7 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
}
/* setup mobile combobox model */
- combobox = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->priv->builder,
+ combobox = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"combobox_network"));
g_signal_connect (combobox, "changed",
G_CALLBACK (mobile_connection_changed_cb),
@@ -928,12 +921,12 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
"text", COLUMN_TITLE,
NULL);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_mobile);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), device_mobile);
diff --git a/panels/network/net-device-mobile.h b/panels/network/net-device-mobile.h
index 4dd2bd8d4..8494af51b 100644
--- a/panels/network/net-device-mobile.h
+++ b/panels/network/net-device-mobile.h
@@ -29,29 +29,8 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_MOBILE (net_device_mobile_get_type ())
-#define NET_DEVICE_MOBILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_MOBILE, NetDeviceMobile))
-#define NET_DEVICE_MOBILE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_MOBILE, NetDeviceMobileClass))
-#define NET_IS_DEVICE_MOBILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_MOBILE))
-#define NET_IS_DEVICE_MOBILE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_MOBILE))
-#define NET_DEVICE_MOBILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_MOBILE, NetDeviceMobileClass))
-
-typedef struct _NetDeviceMobilePrivate NetDeviceMobilePrivate;
-typedef struct _NetDeviceMobile NetDeviceMobile;
-typedef struct _NetDeviceMobileClass NetDeviceMobileClass;
-
-struct _NetDeviceMobile
-{
- NetDevice parent;
- NetDeviceMobilePrivate *priv;
-};
-
-struct _NetDeviceMobileClass
-{
- NetDeviceClass parent_class;
-};
-
-GType net_device_mobile_get_type (void);
+#define NET_TYPE_DEVICE_MOBILE (net_device_mobile_get_type ())
+G_DECLARE_FINAL_TYPE (NetDeviceMobile, net_device_mobile, NET, DEVICE_MOBILE, NetDevice)
G_END_DECLS
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index e1c06c625..8694d4142 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -31,24 +31,23 @@
#include "net-device-simple.h"
-#define NET_DEVICE_SIMPLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_SIMPLE, NetDeviceSimplePrivate))
-
-struct _NetDeviceSimplePrivate
+typedef struct
{
GtkBuilder *builder;
gboolean updating_device;
-};
+} NetDeviceSimplePrivate;
-G_DEFINE_TYPE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
+G_DEFINE_TYPE_WITH_PRIVATE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
void
net_device_simple_set_show_separator (NetDeviceSimple *device_simple,
gboolean show_separator)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkWidget *widget;
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder, "separator"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "separator"));
gtk_widget_set_visible (widget, show_separator);
}
@@ -59,9 +58,10 @@ device_simple_proxy_add_to_stack (NetObject *object,
{
GtkWidget *widget;
NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"vbox6"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -72,7 +72,9 @@ update_off_switch_from_device_state (GtkSwitch *sw,
NMDeviceState state,
NetDeviceSimple *device_simple)
{
- device_simple->priv->updating_device = TRUE;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+
+ priv->updating_device = TRUE;
switch (state) {
case NM_DEVICE_STATE_UNMANAGED:
case NM_DEVICE_STATE_UNAVAILABLE:
@@ -85,13 +87,13 @@ update_off_switch_from_device_state (GtkSwitch *sw,
gtk_switch_set_active (sw, TRUE);
break;
}
- device_simple->priv->updating_device = FALSE;
+ priv->updating_device = FALSE;
}
static void
nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
{
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkWidget *widget;
NMDevice *nm_device;
NMDeviceState state;
@@ -127,6 +129,7 @@ device_off_toggled (GtkSwitch *sw,
GParamSpec *pspec,
NetDeviceSimple *device_simple)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
const GPtrArray *acs;
gboolean active;
gint i;
@@ -134,7 +137,7 @@ device_off_toggled (GtkSwitch *sw,
NMConnection *connection;
NMClient *client;
- if (device_simple->priv->updating_device)
+ if (priv->updating_device)
return;
active = gtk_switch_get_active (sw);
@@ -186,7 +189,7 @@ static void
net_device_simple_finalize (GObject *object)
{
NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
g_object_unref (priv->builder);
@@ -211,20 +214,17 @@ net_device_simple_class_init (NetDeviceSimpleClass *klass)
parent_class->add_to_stack = device_simple_proxy_add_to_stack;
parent_class->refresh = device_simple_refresh;
simple_class->get_speed = device_simple_get_speed;
-
- g_type_class_add_private (klass, sizeof (NetDeviceSimplePrivate));
}
static void
net_device_simple_init (NetDeviceSimple *device_simple)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GError *error = NULL;
GtkWidget *widget;
- device_simple->priv = NET_DEVICE_SIMPLE_GET_PRIVATE (device_simple);
-
- device_simple->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_simple->priv->builder,
+ priv->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (priv->builder,
"/org/gnome/control-center/network/network-simple.ui",
&error);
if (error != NULL) {
@@ -234,12 +234,12 @@ net_device_simple_init (NetDeviceSimple *device_simple)
}
/* setup simple combobox model */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_simple);
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), device_simple);
@@ -258,7 +258,7 @@ net_device_simple_add_row (NetDeviceSimple *device_simple,
const char *label_string,
const char *property_name)
{
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkGrid *grid;
GtkWidget *label, *value;
GtkStyleContext *context;
diff --git a/panels/network/net-device-simple.h b/panels/network/net-device-simple.h
index b2ba642dc..5178332e9 100644
--- a/panels/network/net-device-simple.h
+++ b/panels/network/net-device-simple.h
@@ -29,22 +29,8 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_SIMPLE (net_device_simple_get_type ())
-#define NET_DEVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_SIMPLE, NetDeviceSimple))
-#define NET_DEVICE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_SIMPLE, NetDeviceSimpleClass))
-#define NET_IS_DEVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_SIMPLE))
-#define NET_IS_DEVICE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_SIMPLE))
-#define NET_DEVICE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_SIMPLE, NetDeviceSimpleClass))
-
-typedef struct _NetDeviceSimplePrivate NetDeviceSimplePrivate;
-typedef struct _NetDeviceSimple NetDeviceSimple;
-typedef struct _NetDeviceSimpleClass NetDeviceSimpleClass;
-
-struct _NetDeviceSimple
-{
- NetDevice parent;
- NetDeviceSimplePrivate *priv;
-};
+#define NET_TYPE_DEVICE_SIMPLE (net_device_simple_get_type ())
+G_DECLARE_DERIVABLE_TYPE (NetDeviceSimple, net_device_simple, NET, DEVICE_SIMPLE, NetDevice)
struct _NetDeviceSimpleClass
{
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index a502d1418..ad7c3b317 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -37,8 +37,6 @@
#include "connection-editor/net-connection-editor.h"
#include "net-device-wifi.h"
-#define NET_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifiPrivate))
-
typedef enum {
NM_AP_SEC_UNKNOWN,
NM_AP_SEC_NONE,
@@ -52,8 +50,10 @@ static void show_wifi_list (NetDeviceWifi *device_wifi);
static void populate_ap_list (NetDeviceWifi *device_wifi);
static void show_hotspot_ui (NetDeviceWifi *device_wifi);
-struct _NetDeviceWifiPrivate
+struct _NetDeviceWifi
{
+ NetDevice parent_instance;
+
GtkBuilder *builder;
GtkWidget *details_dialog;
GtkSwitch *hotspot_switch;
@@ -83,13 +83,13 @@ enum {
GtkWidget *
net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi)
{
- return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "header_box"));
+ return GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "header_box"));
}
GtkWidget *
net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi)
{
- return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "center_box"));
+ return GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "center_box"));
}
static GtkWidget *
@@ -104,11 +104,11 @@ device_wifi_proxy_add_to_stack (NetObject *object,
nmdevice = net_device_get_nm_device (NET_DEVICE (object));
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"heading_ipv4"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"notebook_view"));
gtk_stack_add_titled (stack, widget,
net_object_get_id (object),
@@ -277,12 +277,12 @@ wireless_enabled_toggled (NMClient *client,
return;
enabled = nm_client_wireless_get_enabled (client);
- sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->priv->builder,
+ sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
- device_wifi->priv->updating_device = TRUE;
+ device_wifi->updating_device = TRUE;
gtk_switch_set_active (sw, enabled);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = FALSE;
}
static NMConnection *
@@ -454,16 +454,16 @@ nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
g_debug ("Refreshing hotspot labels to name: '%s', security key: '%s', security: '%s'",
hotspot_ssid, hotspot_secret, hotspot_security);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_network_name",
hotspot_ssid);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_security_key",
hotspot_secret);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_security",
hotspot_security);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_connected",
NULL);
@@ -504,7 +504,7 @@ update_last_used (NetDeviceWifi *device_wifi, NMConnection *connection)
else
last_used = g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
out:
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"last_used",
last_used);
if (now != NULL)
@@ -527,7 +527,6 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
NMClient *client;
NMAccessPoint *ap;
NMConnection *connection;
- NetDeviceWifiPrivate *priv = device_wifi->priv;
GtkWidget *dialog;
if (device_is_hotspot (device_wifi)) {
@@ -538,7 +537,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- dialog = device_wifi->priv->details_dialog;
+ dialog = device_wifi->details_dialog;
ap = g_object_get_data (G_OBJECT (dialog), "ap");
connection = g_object_get_data (G_OBJECT (dialog), "connection");
@@ -560,13 +559,13 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
/* Translators: network device speed */
str_tmp = g_strdup_printf (_("%d Mb/s"), speed);
}
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"speed",
str_tmp);
/* device MAC */
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"mac",
str);
/* security */
@@ -574,7 +573,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str_tmp = NULL;
else if (active_ap != NULL)
str_tmp = get_ap_security_string (active_ap);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"security",
str_tmp);
g_free (str_tmp);
@@ -596,7 +595,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str = C_("Signal strength", "Good");
else
str = C_("Signal strength", "Excellent");
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"strength",
str);
@@ -605,20 +604,20 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str = NULL;
else
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
- panel_set_device_widget_details (priv->builder, "mac", str);
+ panel_set_device_widget_details (device_wifi->builder, "mac", str);
/* set IP entries */
if (ap != active_ap)
- panel_unset_device_widgets (priv->builder);
+ panel_unset_device_widgets (device_wifi->builder);
else
- panel_set_device_widgets (priv->builder, nm_device);
+ panel_set_device_widgets (device_wifi->builder, nm_device);
if (ap != active_ap && connection)
update_last_used (device_wifi, connection);
else
- panel_set_device_widget_details (priv->builder, "last_used", NULL);
+ panel_set_device_widget_details (device_wifi->builder, "last_used", NULL);
- panel_set_device_status (priv->builder, "heading_status", nm_device, NULL);
+ panel_set_device_status (device_wifi->builder, "heading_status", nm_device, NULL);
/* update list of APs */
show_wifi_list (device_wifi);
@@ -640,7 +639,7 @@ device_off_toggled (GtkSwitch *sw,
NMClient *client;
gboolean active;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
return;
client = net_object_get_client (NET_OBJECT (device_wifi));
@@ -738,7 +737,7 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
NMSettingWireless *setting_wireless;
NMClient *client;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
goto out;
if (ap_object_path == NULL || ap_object_path[0] == 0)
@@ -991,13 +990,13 @@ show_hotspot_ui (NetDeviceWifi *device_wifi)
GtkWidget *widget;
/* show hotspot tab */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "notebook_view"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "notebook_view"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
/* force switch to on as this succeeded */
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
}
static void
@@ -1353,9 +1352,9 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
if (!found) {
g_warning ("Could not stop hotspot connection as no connection attached to the device could be found.");
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
return;
}
@@ -1368,9 +1367,9 @@ stop_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *devic
if (response == GTK_RESPONSE_OK) {
stop_shared_connection (device_wifi);
} else {
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
}
gtk_widget_destroy (dialog);
}
@@ -1384,7 +1383,7 @@ switch_hotspot_changed_cb (GtkSwitch *sw,
GtkWidget *window;
CcNetworkPanel *panel;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
return;
panel = net_object_get_panel (NET_OBJECT (device_wifi));
@@ -1407,7 +1406,7 @@ static void
show_wifi_list (NetDeviceWifi *device_wifi)
{
GtkWidget *widget;
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "notebook_view"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "notebook_view"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
}
@@ -1441,7 +1440,7 @@ client_connection_removed_cb (NMClient *client,
uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
rows = gtk_container_get_children (GTK_CONTAINER (list));
for (l = rows; l != NULL; l = l->next) {
GtkWidget *row = l->data;
@@ -1487,7 +1486,7 @@ net_device_wifi_constructed (GObject *object)
device_wifi, 0);
/* only enable the button if the user can create a hotspot */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
perm = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN);
caps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (nm_device));
@@ -1506,7 +1505,7 @@ net_device_wifi_constructed (GObject *object)
g_signal_connect (client, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (client_connection_removed_cb), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "heading_list"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "heading_list"));
g_object_bind_property (device_wifi, "title", widget, "label", 0);
nm_device_wifi_refresh_ui (device_wifi);
@@ -1516,13 +1515,12 @@ static void
net_device_wifi_finalize (GObject *object)
{
NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
- NetDeviceWifiPrivate *priv = device_wifi->priv;
- g_clear_pointer (&priv->details_dialog, gtk_widget_destroy);
- g_object_unref (priv->builder);
- g_free (priv->selected_ssid_title);
- g_free (priv->selected_connection_id);
- g_free (priv->selected_ap_id);
+ g_clear_pointer (&device_wifi->details_dialog, gtk_widget_destroy);
+ g_object_unref (device_wifi->builder);
+ g_free (device_wifi->selected_ssid_title);
+ g_free (device_wifi->selected_connection_id);
+ g_free (device_wifi->selected_ap_id);
G_OBJECT_CLASS (net_device_wifi_parent_class)->finalize (object);
}
@@ -1538,7 +1536,7 @@ device_wifi_edit (NetObject *object)
NMRemoteConnection *connection;
client = net_object_get_client (object);
- connection = nm_client_get_connection_by_path (client, device->priv->selected_connection_id);
+ connection = nm_client_get_connection_by_path (client, device->selected_connection_id);
if (connection == NULL) {
g_warning ("failed to get remote connection");
return;
@@ -1564,8 +1562,6 @@ net_device_wifi_class_init (NetDeviceWifiClass *klass)
parent_class->add_to_stack = device_wifi_proxy_add_to_stack;
parent_class->refresh = device_wifi_refresh;
parent_class->edit = device_wifi_edit;
-
- g_type_class_add_private (klass, sizeof (NetDeviceWifiPrivate));
}
static void
@@ -2059,7 +2055,7 @@ populate_ap_list (NetDeviceWifi *device_wifi)
GtkWidget *button;
GList *children, *child;
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
children = gtk_container_get_children (GTK_CONTAINER (list));
for (child = children; child; child = child->next) {
@@ -2163,10 +2159,8 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
GtkSizeGroup *rows;
GtkSizeGroup *icons;
- device_wifi->priv = NET_DEVICE_WIFI_GET_PRIVATE (device_wifi);
-
- device_wifi->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_wifi->priv->builder,
+ device_wifi->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (device_wifi->builder,
"/org/gnome/control-center/network/network-wifi.ui",
&error);
if (error != NULL) {
@@ -2175,17 +2169,17 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
return;
}
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"details_dialog"));
- device_wifi->priv->details_dialog = widget;
+ device_wifi->details_dialog = widget;
/* setup wifi views */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_wifi);
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)ap_sort, NULL, NULL);
g_signal_connect (list, "row-activated",
@@ -2197,29 +2191,29 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
g_object_set_data_full (G_OBJECT (list), "icons", icons, g_object_unref);
/* setup view */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"notebook_view"));
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
g_signal_connect (widget, "clicked",
G_CALLBACK (start_hotspot), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"connect_hidden_button"));
g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (connect_to_hidden_network), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"history_button"));
g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (open_history), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"switch_hotspot_off"));
- device_wifi->priv->hotspot_switch = GTK_SWITCH (widget);
+ device_wifi->hotspot_switch = GTK_SWITCH (widget);
g_signal_connect (widget, "notify::active",
G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
}
diff --git a/panels/network/net-device-wifi.h b/panels/network/net-device-wifi.h
index d8baf5075..1e91c5f6f 100644
--- a/panels/network/net-device-wifi.h
+++ b/panels/network/net-device-wifi.h
@@ -28,30 +28,11 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_WIFI (net_device_wifi_get_type ())
-#define NET_DEVICE_WIFI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifi))
-#define NET_DEVICE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_WIFI, NetDeviceWifiClass))
-#define NET_IS_DEVICE_WIFI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_WIFI))
-#define NET_IS_DEVICE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_WIFI))
-#define NET_DEVICE_WIFI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifiClass))
-
-typedef struct _NetDeviceWifiPrivate NetDeviceWifiPrivate;
-typedef struct _NetDeviceWifi NetDeviceWifi;
-typedef struct _NetDeviceWifiClass NetDeviceWifiClass;
-
-struct _NetDeviceWifi
-{
- NetDevice parent;
- NetDeviceWifiPrivate *priv;
-};
-
-struct _NetDeviceWifiClass
-{
- NetDeviceClass parent_class;
-};
-
-GType net_device_wifi_get_type (void) G_GNUC_CONST;
+#define NET_TYPE_DEVICE_WIFI (net_device_wifi_get_type ())
+G_DECLARE_FINAL_TYPE (NetDeviceWifi, net_device_wifi, NET, DEVICE_WIFI, NetDevice)
+
GtkWidget *net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi);
+
GtkWidget *net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi);
G_END_DECLS
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index 95b556eca..61df7c780 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -30,13 +30,11 @@
#include "net-device.h"
-#define NET_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE, NetDevicePrivate))
-
-struct _NetDevicePrivate
+typedef struct
{
NMDevice *nm_device;
guint changed_id;
-};
+} NetDevicePrivate;
enum {
PROP_0,
@@ -44,7 +42,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (NetDevice, net_device, NET_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (NetDevice, net_device, NET_TYPE_OBJECT)
/* return value must be freed by caller with g_free() */
static gchar *
@@ -124,12 +122,13 @@ compare_mac_device_with_mac_connection (NMDevice *device,
static NMConnection *
net_device_real_get_find_connection (NetDevice *device)
{
+ NetDevicePrivate *priv = net_device_get_instance_private (device);
GSList *list, *iterator;
NMConnection *connection = NULL;
NMActiveConnection *ac;
/* is the device available in a active connection? */
- ac = nm_device_get_active_connection (device->priv->nm_device);
+ ac = nm_device_get_active_connection (priv->nm_device);
if (ac)
return (NMConnection*) nm_active_connection_get_connection (ac);
@@ -145,7 +144,7 @@ net_device_real_get_find_connection (NetDevice *device)
/* is there connection with the MAC address of the device? */
for (iterator = list; iterator; iterator = iterator->next) {
connection = iterator->data;
- if (compare_mac_device_with_mac_connection (device->priv->nm_device,
+ if (compare_mac_device_with_mac_connection (priv->nm_device,
connection)) {
goto out;
}
@@ -179,8 +178,10 @@ state_changed_cb (NMDevice *device,
NMDevice *
net_device_get_nm_device (NetDevice *device)
{
+ NetDevicePrivate *priv;
g_return_val_if_fail (NET_IS_DEVICE (device), NULL);
- return device->priv->nm_device;
+ priv = net_device_get_instance_private (device);
+ return priv->nm_device;
}
static void
@@ -213,7 +214,7 @@ net_device_get_property (GObject *device_,
GParamSpec *pspec)
{
NetDevice *net_device = NET_DEVICE (device_);
- NetDevicePrivate *priv = net_device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
case PROP_DEVICE:
@@ -235,7 +236,7 @@ net_device_set_property (GObject *device_,
GParamSpec *pspec)
{
NetDevice *net_device = NET_DEVICE (device_);
- NetDevicePrivate *priv = net_device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
case PROP_DEVICE:
@@ -262,7 +263,7 @@ static void
net_device_finalize (GObject *object)
{
NetDevice *device = NET_DEVICE (object);
- NetDevicePrivate *priv = device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (device);
if (priv->changed_id != 0) {
g_signal_handler_disconnect (priv->nm_device,
@@ -290,14 +291,11 @@ net_device_class_init (NetDeviceClass *klass)
NM_TYPE_DEVICE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_DEVICE, pspec);
-
- g_type_class_add_private (klass, sizeof (NetDevicePrivate));
}
static void
net_device_init (NetDevice *device)
{
- device->priv = NET_DEVICE_GET_PRIVATE (device);
}
NetDevice *
diff --git a/panels/network/net-device.h b/panels/network/net-device.h
index 136459555..b8cdac6e2 100644
--- a/panels/network/net-device.h
+++ b/panels/network/net-device.h
@@ -29,22 +29,8 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE (net_device_get_type ())
-#define NET_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE, NetDevice))
-#define NET_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE, NetDeviceClass))
-#define NET_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE))
-#define NET_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE))
-#define NET_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE, NetDeviceClass))
-
-typedef struct _NetDevicePrivate NetDevicePrivate;
-typedef struct _NetDevice NetDevice;
-typedef struct _NetDeviceClass NetDeviceClass;
-
-struct _NetDevice
-{
- NetObject parent;
- NetDevicePrivate *priv;
-};
+#define NET_TYPE_DEVICE (net_device_get_type ())
+G_DECLARE_DERIVABLE_TYPE (NetDevice, net_device, NET, DEVICE, NetObject)
struct _NetDeviceClass
{
@@ -53,7 +39,6 @@ struct _NetDeviceClass
NMConnection * (*get_find_connection) (NetDevice *device);
};
-GType net_device_get_type (void);
NetDevice *net_device_new (void);
NMDevice *net_device_get_nm_device (NetDevice *device);
NMConnection *net_device_get_find_connection (NetDevice *device);
diff --git a/panels/network/net-object.c b/panels/network/net-object.c
index cb96d5c05..2b6285354 100644
--- a/panels/network/net-object.c
+++ b/panels/network/net-object.c
@@ -26,9 +26,7 @@
#include "net-object.h"
-#define NET_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_OBJECT, NetObjectPrivate))
-
-struct _NetObjectPrivate
+typedef struct
{
gchar *id;
gchar *title;
@@ -36,7 +34,7 @@ struct _NetObjectPrivate
GCancellable *cancellable;
NMClient *client;
CcNetworkPanel *panel;
-};
+} NetObjectPrivate;
enum {
PROP_0,
@@ -56,82 +54,122 @@ enum {
};
static guint signals[SIGNAL_LAST] = { 0 };
-G_DEFINE_TYPE (NetObject, net_object, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (NetObject, net_object, G_TYPE_OBJECT)
void
net_object_emit_changed (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_debug ("NetObject: %s emit 'changed'", object->priv->id);
+
+ priv = net_object_get_instance_private (object);
+ g_debug ("NetObject: %s emit 'changed'", priv->id);
g_signal_emit (object, signals[SIGNAL_CHANGED], 0);
}
void
net_object_emit_removed (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_debug ("NetObject: %s emit 'removed'", object->priv->id);
+
+ priv = net_object_get_instance_private (object);
+ g_debug ("NetObject: %s emit 'removed'", priv->id);
g_signal_emit (object, signals[SIGNAL_REMOVED], 0);
}
const gchar *
net_object_get_id (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->id;
+
+ priv = net_object_get_instance_private (object);
+ return priv->id;
}
void
net_object_set_id (NetObject *object, const gchar *id)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_clear_pointer (&object->priv->id, g_free);
- object->priv->id = g_strdup (id);
+
+ priv = net_object_get_instance_private (object);
+ g_clear_pointer (&priv->id, g_free);
+ priv->id = g_strdup (id);
g_object_notify (G_OBJECT (object), "id");
}
gboolean
net_object_get_removable (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), FALSE);
- return object->priv->removable;
+
+ priv = net_object_get_instance_private (object);
+ return priv->removable;
}
const gchar *
net_object_get_title (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->title;
+
+ priv = net_object_get_instance_private (object);
+ return priv->title;
}
void
net_object_set_title (NetObject *object, const gchar *title)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_clear_pointer (&object->priv->title, g_free);
- object->priv->title = g_strdup (title);
+
+ priv = net_object_get_instance_private (object);
+ g_clear_pointer (&priv->title, g_free);
+ priv->title = g_strdup (title);
g_object_notify (G_OBJECT (object), "title");
}
NMClient *
net_object_get_client (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->client;
+
+ priv = net_object_get_instance_private (object);
+ return priv->client;
}
GCancellable *
net_object_get_cancellable (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->cancellable;
+
+ priv = net_object_get_instance_private (object);
+ return priv->cancellable;
}
CcNetworkPanel *
net_object_get_panel (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->panel;
+
+ priv = net_object_get_instance_private (object);
+ return priv->panel;
}
GtkWidget *
@@ -139,17 +177,19 @@ net_object_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
GtkWidget *widget;
NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
+
if (klass->add_to_stack != NULL) {
widget = klass->add_to_stack (object, stack, heading_size_group);
g_object_set_data_full (G_OBJECT (widget),
"NetObject::id",
- g_strdup (object->priv->id),
+ g_strdup (priv->id),
g_free);
return widget;
}
- g_debug ("no klass->add_to_stack for %s", object->priv->id);
+ g_debug ("no klass->add_to_stack for %s", priv->id);
return NULL;
}
@@ -187,7 +227,7 @@ net_object_get_property (GObject *object_,
GParamSpec *pspec)
{
NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
switch (prop_id) {
case PROP_ID:
@@ -224,7 +264,7 @@ net_object_set_property (GObject *object_,
GParamSpec *pspec)
{
NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
switch (prop_id) {
case PROP_ID:
@@ -263,7 +303,7 @@ static void
net_object_finalize (GObject *object)
{
NetObject *nm_object = NET_OBJECT (object);
- NetObjectPrivate *priv = nm_object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (nm_object);
g_free (priv->id);
g_free (priv->title);
@@ -327,13 +367,10 @@ net_object_class_init (NetObjectClass *klass)
G_STRUCT_OFFSET (NetObjectClass, changed),
NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- g_type_class_add_private (klass, sizeof (NetObjectPrivate));
}
static void
net_object_init (NetObject *object)
{
- object->priv = NET_OBJECT_GET_PRIVATE (object);
}
diff --git a/panels/network/net-object.h b/panels/network/net-object.h
index 8d98680fe..82e80ca5c 100644
--- a/panels/network/net-object.h
+++ b/panels/network/net-object.h
@@ -30,24 +30,8 @@
G_BEGIN_DECLS
-#define NET_TYPE_OBJECT (net_object_get_type ())
-#define NET_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_OBJECT, NetObject))
-#define NET_OBJECT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_OBJECT, NetObjectClass))
-#define NET_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_OBJECT))
-#define NET_IS_OBJECT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_OBJECT))
-#define NET_OBJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_OBJECT, NetObjectClass))
-
-typedef struct _NetObjectPrivate NetObjectPrivate;
-typedef struct _NetObject NetObject;
-typedef struct _NetObjectClass NetObjectClass;
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (NetObject, g_object_unref)
-
-struct _NetObject
-{
- GObject parent;
- NetObjectPrivate *priv;
-};
+#define NET_TYPE_OBJECT (net_object_get_type ())
+G_DECLARE_DERIVABLE_TYPE (NetObject, net_object, NET, OBJECT, GObject)
struct _NetObjectClass
{
@@ -66,7 +50,6 @@ struct _NetObjectClass
void (* removed) (NetObject *object);
};
-GType net_object_get_type (void);
const gchar *net_object_get_id (NetObject *object);
void net_object_set_id (NetObject *object,
const gchar *id);
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index d1b46026a..2ebd019cd 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -27,8 +27,6 @@
#include "net-proxy.h"
-#define NET_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_PROXY, NetProxyPrivate))
-
typedef enum
{
MODE_DISABLED,
@@ -37,8 +35,10 @@ typedef enum
N_MODES
} ProxyMode;
-struct _NetProxyPrivate
+struct _NetProxy
{
+ NetObject parent_instance;
+
GSettings *settings;
GtkBuilder *builder;
GtkToggleButton *mode_radios[3];
@@ -68,7 +68,7 @@ panel_update_status_label (NetProxy *self,
GtkLabel *label;
/* update the label */
- label = GTK_LABEL (gtk_builder_get_object (self->priv->builder, "status_label"));
+ label = GTK_LABEL (gtk_builder_get_object (self->builder, "status_label"));
gtk_label_set_label (label, panel_get_string_for_value (mode));
}
@@ -84,12 +84,12 @@ check_wpad_warning (NetProxy *proxy)
string = g_string_new ("");
/* check we're using 'Automatic' */
- mode = g_settings_get_enum (proxy->priv->settings, "mode");
+ mode = g_settings_get_enum (proxy->settings, "mode");
if (mode != MODE_AUTOMATIC)
goto out;
/* see if the PAC is blank */
- autoconfig_url = g_settings_get_string (proxy->priv->settings,
+ autoconfig_url = g_settings_get_string (proxy->settings,
"autoconfig-url");
ret = autoconfig_url == NULL ||
autoconfig_url[0] == '\0';
@@ -110,7 +110,7 @@ check_wpad_warning (NetProxy *proxy)
g_string_append (string, _("This is not recommended for untrusted public networks."));
g_string_append (string, "</small>");
out:
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"label_proxy_warning"));
gtk_label_set_markup (GTK_LABEL (widget), string->str);
gtk_widget_set_visible (widget, (string->len > 0));
@@ -132,7 +132,7 @@ panel_proxy_mode_setup_widgets (NetProxy *proxy, ProxyMode value)
{
GtkStack *stack;
- stack = GTK_STACK (gtk_builder_get_object (proxy->priv->builder, "stack"));
+ stack = GTK_STACK (gtk_builder_get_object (proxy->builder, "stack"));
/* hide or show the PAC text box */
switch (value) {
@@ -163,17 +163,17 @@ panel_proxy_mode_radio_changed_cb (GtkToggleButton *radio,
return;
/* get selected radio */
- if (radio == proxy->priv->mode_radios[MODE_DISABLED])
+ if (radio == proxy->mode_radios[MODE_DISABLED])
value = MODE_DISABLED;
- else if (radio == proxy->priv->mode_radios[MODE_MANUAL])
+ else if (radio == proxy->mode_radios[MODE_MANUAL])
value = MODE_MANUAL;
- else if (radio == proxy->priv->mode_radios[MODE_AUTOMATIC])
+ else if (radio == proxy->mode_radios[MODE_AUTOMATIC])
value = MODE_AUTOMATIC;
else
g_assert_not_reached ();
/* set */
- g_settings_set_enum (proxy->priv->settings, "mode", value);
+ g_settings_set_enum (proxy->settings, "mode", value);
/* hide or show the correct widgets */
panel_proxy_mode_setup_widgets (proxy, value);
@@ -190,7 +190,7 @@ show_dialog_cb (GtkWidget *button,
GtkWindow *dialog;
toplevel = gtk_widget_get_toplevel (button);
- dialog = GTK_WINDOW (gtk_builder_get_object (self->priv->builder, "dialog"));
+ dialog = GTK_WINDOW (gtk_builder_get_object (self->builder, "dialog"));
gtk_window_set_transient_for (dialog, GTK_WINDOW (toplevel));
gtk_window_present (dialog);
@@ -204,7 +204,7 @@ net_proxy_add_to_stack (NetObject *object,
GtkWidget *widget;
NetProxy *proxy = NET_PROXY (object);
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"main_widget"));
gtk_size_group_add_widget (heading_size_group, widget);
gtk_stack_add_named (stack, widget, net_object_get_id (object));
@@ -215,10 +215,9 @@ static void
net_proxy_finalize (GObject *object)
{
NetProxy *proxy = NET_PROXY (object);
- NetProxyPrivate *priv = proxy->priv;
- g_clear_object (&priv->settings);
- g_clear_object (&priv->builder);
+ g_clear_object (&proxy->settings);
+ g_clear_object (&proxy->builder);
G_OBJECT_CLASS (net_proxy_parent_class)->finalize (object);
}
@@ -231,7 +230,6 @@ net_proxy_class_init (NetProxyClass *klass)
object_class->finalize = net_proxy_finalize;
parent_class->add_to_stack = net_proxy_add_to_stack;
- g_type_class_add_private (klass, sizeof (NetProxyPrivate));
}
static gboolean
@@ -292,10 +290,8 @@ net_proxy_init (NetProxy *proxy)
GError *error = NULL;
guint i;
- proxy->priv = NET_PROXY_GET_PRIVATE (proxy);
-
- proxy->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (proxy->priv->builder,
+ proxy->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (proxy->builder,
"/org/gnome/control-center/network/network-proxy.ui",
&error);
if (error != NULL) {
@@ -304,30 +300,30 @@ net_proxy_init (NetProxy *proxy)
return;
}
- proxy->priv->settings = g_settings_new ("org.gnome.system.proxy");
- g_signal_connect (proxy->priv->settings,
+ proxy->settings = g_settings_new ("org.gnome.system.proxy");
+ g_signal_connect (proxy->settings,
"changed",
G_CALLBACK (settings_changed_cb),
proxy);
/* actions */
- value = g_settings_get_enum (proxy->priv->settings, "mode");
+ value = g_settings_get_enum (proxy->settings, "mode");
/* bind the proxy values */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_url"));
- g_settings_bind (proxy->priv->settings, "autoconfig-url",
+ g_settings_bind (proxy->settings, "autoconfig-url",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTP proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "http");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "http");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_http"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_http"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -335,13 +331,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the HTTPS proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "https");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "https");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_https"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_https"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -349,13 +345,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the FTP proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "ftp");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "ftp");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_ftp"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_ftp"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -363,13 +359,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the SOCKS proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "socks");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "socks");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_socks"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_socks"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -377,35 +373,35 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the proxy ignore hosts */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_ignore"));
- g_settings_bind_with_mapping (proxy->priv->settings, "ignore-hosts",
+ g_settings_bind_with_mapping (proxy->settings, "ignore-hosts",
widget, "text",
G_SETTINGS_BIND_DEFAULT, get_ignore_hosts, set_ignore_hosts,
NULL, NULL);
/* radio buttons */
- proxy->priv->mode_radios[MODE_DISABLED] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_none"));
- proxy->priv->mode_radios[MODE_MANUAL] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_manual"));
- proxy->priv->mode_radios[MODE_AUTOMATIC] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_automatic"));
+ proxy->mode_radios[MODE_DISABLED] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_none"));
+ proxy->mode_radios[MODE_MANUAL] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_manual"));
+ proxy->mode_radios[MODE_AUTOMATIC] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_automatic"));
/* setup the radio before connecting to the :toggled signal */
- gtk_toggle_button_set_active (proxy->priv->mode_radios[value], TRUE);
+ gtk_toggle_button_set_active (proxy->mode_radios[value], TRUE);
panel_proxy_mode_setup_widgets (proxy, value);
panel_update_status_label (proxy, value);
for (i = MODE_DISABLED; i < N_MODES; i++) {
- g_signal_connect (proxy->priv->mode_radios[i],
+ g_signal_connect (proxy->mode_radios[i],
"toggled",
G_CALLBACK (panel_proxy_mode_radio_changed_cb),
proxy);
}
/* show dialog button */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog_button"));
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog_button"));
g_signal_connect (widget,
"clicked",
@@ -413,7 +409,7 @@ net_proxy_init (NetProxy *proxy)
proxy);
/* prevent the dialog from being destroyed */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog"));
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog"));
g_signal_connect (widget,
"delete-event",
diff --git a/panels/network/net-proxy.h b/panels/network/net-proxy.h
index 5eece5b29..f647e7d75 100644
--- a/panels/network/net-proxy.h
+++ b/panels/network/net-proxy.h
@@ -28,29 +28,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_PROXY (net_proxy_get_type ())
-#define NET_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_PROXY, NetProxy))
-#define NET_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_PROXY, NetProxyClass))
-#define NET_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_PROXY))
-#define NET_IS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_PROXY))
-#define NET_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_PROXY, NetProxyClass))
-
-typedef struct _NetProxyPrivate NetProxyPrivate;
-typedef struct _NetProxy NetProxy;
-typedef struct _NetProxyClass NetProxyClass;
-
-struct _NetProxy
-{
- NetObject parent;
- NetProxyPrivate *priv;
-};
-
-struct _NetProxyClass
-{
- NetObjectClass parent_class;
-};
-
-GType net_proxy_get_type (void);
+#define NET_TYPE_PROXY (net_proxy_get_type ())
+G_DECLARE_FINAL_TYPE (NetProxy, net_proxy, NET, PROXY, NetObject)
+
NetProxy *net_proxy_new (void);
G_END_DECLS
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 47b7391a9..96473dca8 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -31,10 +31,10 @@
#include "connection-editor/net-connection-editor.h"
-#define NET_VPN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_VPN, NetVpnPrivate))
-
-struct _NetVpnPrivate
+struct _NetVpn
{
+ NetObject parent_instance;
+
GtkBuilder *builder;
NMConnection *connection;
NMActiveConnection *active_connection;
@@ -57,7 +57,7 @@ net_vpn_set_show_separator (NetVpn *self,
{
GtkWidget *separator;
- separator = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "separator"));
+ separator = GTK_WIDGET (gtk_builder_get_object (self->builder, "separator"));
gtk_widget_set_visible (separator, show_separator);
}
@@ -82,9 +82,7 @@ connection_removed_cb (NMClient *client,
NMConnection *connection,
NetVpn *vpn)
{
- NetVpnPrivate *priv = vpn->priv;
-
- if (priv->connection == connection)
+ if (vpn->connection == connection)
net_object_emit_removed (NET_OBJECT (vpn));
}
@@ -102,7 +100,6 @@ net_vpn_connection_to_type (NMConnection *connection)
static void
net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
{
- NetVpnPrivate *priv = vpn->priv;
NMClient *client;
/*
@@ -115,7 +112,7 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
* key=IPSec ID, value=rh-vpn
* key=Xauth username, value=rhughes
*/
- priv->connection = g_object_ref (connection);
+ vpn->connection = g_object_ref (connection);
client = net_object_get_client (NET_OBJECT (vpn));
g_signal_connect (client,
@@ -127,30 +124,29 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
G_CALLBACK (connection_changed_cb),
vpn);
- if (NM_IS_VPN_CONNECTION (priv->connection)) {
- g_signal_connect (priv->connection,
+ if (NM_IS_VPN_CONNECTION (vpn->connection)) {
+ g_signal_connect (vpn->connection,
NM_VPN_CONNECTION_VPN_STATE,
G_CALLBACK (connection_vpn_state_changed_cb),
vpn);
}
- priv->service_type = net_vpn_connection_to_type (priv->connection);
+ vpn->service_type = net_vpn_connection_to_type (vpn->connection);
}
static NMVpnConnectionState
net_vpn_get_state (NetVpn *vpn)
{
- NetVpnPrivate *priv = vpn->priv;
- if (!NM_IS_VPN_CONNECTION (priv->connection))
+ if (!NM_IS_VPN_CONNECTION (vpn->connection))
return NM_VPN_CONNECTION_STATE_DISCONNECTED;
- return nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (priv->connection));
+ return nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (vpn->connection));
}
static void
vpn_proxy_delete (NetObject *object)
{
NetVpn *vpn = NET_VPN (object);
- nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (vpn->priv->connection),
+ nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (vpn->connection),
NULL, NULL, vpn);
}
@@ -163,7 +159,7 @@ vpn_proxy_add_to_stack (NetObject *object,
NetVpn *vpn = NET_VPN (object);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"vbox9"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -174,7 +170,6 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
{
GtkWidget *widget;
GtkWidget *sw;
- NetVpnPrivate *priv = vpn->priv;
const GPtrArray *acs;
NMActiveConnection *a;
gint i;
@@ -183,22 +178,22 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
NMClient *client;
/* update title */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"label_device"));
/* Translators: this is the title of the connection details
* window for vpn connections, it is also used to display
* vpn connections in the device list.
*/
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->priv->connection));
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
net_object_set_title (NET_OBJECT (vpn), title);
gtk_label_set_label (GTK_LABEL (widget), title);
g_free (title);
- if (priv->active_connection) {
- g_signal_handlers_disconnect_by_func (vpn->priv->active_connection,
+ if (vpn->active_connection) {
+ g_signal_handlers_disconnect_by_func (vpn->active_connection,
nm_device_refresh_vpn_ui,
vpn);
- g_clear_object (&priv->active_connection);
+ g_clear_object (&vpn->active_connection);
}
@@ -209,7 +204,7 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
if (acs != NULL) {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->priv->connection);
+ uuid = nm_connection_get_uuid (vpn->connection);
for (i = 0; i < acs->len; i++) {
const gchar *auuid;
@@ -217,7 +212,7 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
auuid = nm_active_connection_get_uuid (a);
if (NM_IS_VPN_CONNECTION (a) && strcmp (auuid, uuid) == 0) {
- priv->active_connection = g_object_ref (a);
+ vpn->active_connection = g_object_ref (a);
g_signal_connect_swapped (a, "notify::vpn-state",
G_CALLBACK (nm_device_refresh_vpn_ui),
vpn);
@@ -227,12 +222,12 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
}
}
- priv->updating_device = TRUE;
- sw = GTK_WIDGET (gtk_builder_get_object (priv->builder, "device_off_switch"));
+ vpn->updating_device = TRUE;
+ sw = GTK_WIDGET (gtk_builder_get_object (vpn->builder, "device_off_switch"));
gtk_switch_set_active (GTK_SWITCH (sw),
state != NM_VPN_CONNECTION_STATE_FAILED &&
state != NM_VPN_CONNECTION_STATE_DISCONNECTED);
- priv->updating_device = FALSE;
+ vpn->updating_device = FALSE;
}
static void
@@ -259,19 +254,19 @@ device_off_toggled (GtkSwitch *sw,
NMActiveConnection *a;
NMClient *client;
- if (vpn->priv->updating_device)
+ if (vpn->updating_device)
return;
active = gtk_switch_get_active (sw);
if (active) {
client = net_object_get_client (NET_OBJECT (vpn));
nm_client_activate_connection_async (client,
- vpn->priv->connection, NULL, NULL,
+ vpn->connection, NULL, NULL,
NULL, NULL, NULL);
} else {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->priv->connection);
+ uuid = nm_connection_get_uuid (vpn->connection);
client = net_object_get_client (NET_OBJECT (vpn));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
@@ -309,16 +304,16 @@ vpn_proxy_edit (NetObject *object)
NMClient *client;
gchar *title;
- button = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ button = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"button_options"));
window = gtk_widget_get_toplevel (button);
client = net_object_get_client (object);
editor = net_connection_editor_new (GTK_WINDOW (window),
- vpn->priv->connection,
+ vpn->connection,
NULL, NULL, client);
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->priv->connection));
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
net_connection_editor_set_title (editor, title);
g_free (title);
@@ -336,11 +331,10 @@ net_vpn_get_property (GObject *object,
GParamSpec *pspec)
{
NetVpn *vpn = NET_VPN (object);
- NetVpnPrivate *priv = vpn->priv;
switch (prop_id) {
case PROP_CONNECTION:
- g_value_set_object (value, priv->connection);
+ g_value_set_object (value, vpn->connection);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (vpn, prop_id, pspec);
@@ -390,7 +384,6 @@ static void
net_vpn_finalize (GObject *object)
{
NetVpn *vpn = NET_VPN (object);
- NetVpnPrivate *priv = vpn->priv;
NMClient *client = net_object_get_client (NET_OBJECT (object));
if (client) {
@@ -399,26 +392,26 @@ net_vpn_finalize (GObject *object)
vpn);
}
- if (priv->active_connection) {
- g_signal_handlers_disconnect_by_func (priv->active_connection,
+ if (vpn->active_connection) {
+ g_signal_handlers_disconnect_by_func (vpn->active_connection,
nm_device_refresh_vpn_ui,
vpn);
- g_object_unref (priv->active_connection);
+ g_object_unref (vpn->active_connection);
}
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_vpn_state_changed_cb,
vpn);
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_removed_cb,
vpn);
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_changed_cb,
vpn);
- g_object_unref (priv->connection);
- g_free (priv->service_type);
+ g_object_unref (vpn->connection);
+ g_free (vpn->service_type);
- g_clear_object (&priv->builder);
+ g_clear_object (&vpn->builder);
G_OBJECT_CLASS (net_vpn_parent_class)->finalize (object);
}
@@ -443,8 +436,6 @@ net_vpn_class_init (NetVpnClass *klass)
NM_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_CONNECTION, pspec);
-
- g_type_class_add_private (klass, sizeof (NetVpnPrivate));
}
static void
@@ -453,10 +444,8 @@ net_vpn_init (NetVpn *vpn)
GError *error = NULL;
GtkWidget *widget;
- vpn->priv = NET_VPN_GET_PRIVATE (vpn);
-
- vpn->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (vpn->priv->builder,
+ vpn->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (vpn->builder,
"/org/gnome/control-center/network/network-vpn.ui",
&error);
if (error != NULL) {
@@ -465,12 +454,12 @@ net_vpn_init (NetVpn *vpn)
return;
}
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), vpn);
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), vpn);
diff --git a/panels/network/net-vpn.h b/panels/network/net-vpn.h
index adcf8ad75..e12c377ca 100644
--- a/panels/network/net-vpn.h
+++ b/panels/network/net-vpn.h
@@ -29,29 +29,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_VPN (net_vpn_get_type ())
-#define NET_VPN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_VPN, NetVpn))
-#define NET_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_VPN, NetVpnClass))
-#define NET_IS_VPN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_VPN))
-#define NET_IS_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_VPN))
-#define NET_VPN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_VPN, NetVpnClass))
-
-typedef struct _NetVpnPrivate NetVpnPrivate;
-typedef struct _NetVpn NetVpn;
-typedef struct _NetVpnClass NetVpnClass;
-
-struct _NetVpn
-{
- NetObject parent;
- NetVpnPrivate *priv;
-};
-
-struct _NetVpnClass
-{
- NetObjectClass parent_class;
-};
-
-GType net_vpn_get_type (void);
+#define NET_TYPE_VPN (net_vpn_get_type ())
+G_DECLARE_FINAL_TYPE (NetVpn, net_vpn, NET, VPN, NetObject)
+
void net_vpn_set_show_separator (NetVpn *self,
gboolean show_separator);
diff --git a/panels/notifications/cc-notifications-panel.h b/panels/notifications/cc-notifications-panel.h
index 50365af8b..6d6bcb108 100644
--- a/panels/notifications/cc-notifications-panel.h
+++ b/panels/notifications/cc-notifications-panel.h
@@ -26,13 +26,8 @@
G_BEGIN_DECLS
#define CC_TYPE_NOTIFICATIONS_PANEL (cc_notifications_panel_get_type ())
-#define CC_NOTIFICATIONS_PANEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_NOTIFICATIONS_PANEL, CcNotificationsPanel))
-#define GC_IS_NOTIFICATIONS_PANEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_NOTIFICATIONS_PANEL))
-typedef struct _CcNotificationsPanel CcNotificationsPanel;
-typedef struct _CcNotificationsPanelClass CcNotificationsPanelClass;
-
-GType cc_notifications_panel_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcNotificationsPanel, cc_notifications_panel, CC, NOTIFICATIONS_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index e32d965c8..a0fa1cdb2 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -47,13 +47,10 @@
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
-CC_PANEL_REGISTER (CcPowerPanel, cc_power_panel)
-
-#define POWER_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_POWER_PANEL, CcPowerPanelPrivate))
-
-struct _CcPowerPanelPrivate
+struct _CcPowerPanel
{
+ CcPanel parent_instance;
+
GSettings *gsd_settings;
GSettings *session_settings;
GCancellable *cancellable;
@@ -114,6 +111,8 @@ struct _CcPowerPanelPrivate
GtkAdjustment *focus_adjustment;
};
+CC_PANEL_REGISTER (CcPowerPanel, cc_power_panel)
+
enum
{
ACTION_MODEL_TEXT,
@@ -123,38 +122,38 @@ enum
static void
cc_power_panel_dispose (GObject *object)
{
- CcPowerPanelPrivate *priv = CC_POWER_PANEL (object)->priv;
+ CcPowerPanel *self = CC_POWER_PANEL (object);
- g_clear_pointer (&priv->chassis_type, g_free);
- g_clear_object (&priv->gsd_settings);
- g_clear_object (&priv->session_settings);
- if (priv->cancellable != NULL)
+ g_clear_pointer (&self->chassis_type, g_free);
+ g_clear_object (&self->gsd_settings);
+ g_clear_object (&self->session_settings);
+ if (self->cancellable != NULL)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
- priv->cancellable = NULL;
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
+ self->cancellable = NULL;
}
- g_clear_pointer (&priv->automatic_suspend_dialog, gtk_widget_destroy);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->screen_proxy);
- g_clear_object (&priv->kbd_proxy);
- if (priv->devices)
+ g_clear_pointer (&self->automatic_suspend_dialog, gtk_widget_destroy);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->screen_proxy);
+ g_clear_object (&self->kbd_proxy);
+ if (self->devices)
{
- g_ptr_array_foreach (priv->devices, (GFunc) g_object_unref, NULL);
- g_clear_pointer (&priv->devices, g_ptr_array_unref);
+ g_ptr_array_foreach (self->devices, (GFunc) g_object_unref, NULL);
+ g_clear_pointer (&self->devices, g_ptr_array_unref);
}
- g_clear_object (&priv->up_client);
- g_clear_object (&priv->bt_rfkill);
- g_clear_object (&priv->bt_properties);
- g_clear_object (&priv->iio_proxy);
+ g_clear_object (&self->up_client);
+ g_clear_object (&self->bt_rfkill);
+ g_clear_object (&self->bt_properties);
+ g_clear_object (&self->iio_proxy);
#ifdef HAVE_NETWORK_MANAGER
- g_clear_object (&priv->nm_client);
+ g_clear_object (&self->nm_client);
#endif
- g_clear_pointer (&priv->boxes, g_list_free);
- g_clear_pointer (&priv->boxes_reverse, g_list_free);
- if (priv->iio_proxy_watch_id != 0)
- g_bus_unwatch_name (priv->iio_proxy_watch_id);
- priv->iio_proxy_watch_id = 0;
+ g_clear_pointer (&self->boxes, g_list_free);
+ g_clear_pointer (&self->boxes_reverse, g_list_free);
+ if (self->iio_proxy_watch_id != 0)
+ g_bus_unwatch_name (self->iio_proxy_watch_id);
+ self->iio_proxy_watch_id = 0;
G_OBJECT_CLASS (cc_power_panel_parent_class)->dispose (object);
}
@@ -171,8 +170,6 @@ cc_power_panel_class_init (CcPowerPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcPowerPanelPrivate));
-
object_class->dispose = cc_power_panel_dispose;
panel_class->get_help_uri = cc_power_panel_get_help_uri;
@@ -361,7 +358,6 @@ get_details_string (gdouble percentage, UpDeviceState state, guint64 time)
static void
set_primary (CcPowerPanel *panel, UpDevice *device)
{
- CcPowerPanelPrivate *priv = panel->priv;
gchar *details = NULL;
gdouble percentage;
guint64 time_empty, time_full, time;
@@ -425,21 +421,20 @@ set_primary (CcPowerPanel *panel, UpDevice *device)
ATK_RELATION_LABELLED_BY,
gtk_widget_get_accessible (label));
- gtk_container_add (GTK_CONTAINER (priv->battery_list), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_container_add (GTK_CONTAINER (panel->battery_list), row);
+ gtk_size_group_add_widget (panel->row_sizegroup, row);
gtk_widget_show_all (row);
g_object_set_data (G_OBJECT (row), "primary", GINT_TO_POINTER (TRUE));
g_free (details);
- gtk_widget_set_visible (priv->battery_section, TRUE);
+ gtk_widget_set_visible (panel->battery_section, TRUE);
}
static void
add_battery (CcPowerPanel *panel, UpDevice *device)
{
- CcPowerPanelPrivate *priv = panel->priv;
gdouble percentage;
UpDeviceKind kind;
UpDeviceState state;
@@ -472,7 +467,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
label = gtk_label_new (name);
gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_size_group_add_widget (priv->battery_sizegroup, box2);
+ gtk_size_group_add_widget (panel->battery_sizegroup, box2);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 6);
@@ -501,7 +496,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
- gtk_size_group_add_widget (priv->charge_sizegroup, label);
+ gtk_size_group_add_widget (panel->charge_sizegroup, label);
levelbar = gtk_level_bar_new ();
gtk_level_bar_set_value (GTK_LEVEL_BAR (levelbar), percentage / 100.0);
@@ -509,7 +504,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
gtk_widget_set_halign (levelbar, GTK_ALIGN_FILL);
gtk_widget_set_valign (levelbar, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box2), levelbar, TRUE, TRUE, 0);
- gtk_size_group_add_widget (priv->level_sizegroup, levelbar);
+ gtk_size_group_add_widget (panel->level_sizegroup, levelbar);
gtk_box_pack_start (GTK_BOX (box), box2, TRUE, TRUE, 0);
atk_object_add_relationship (gtk_widget_get_accessible (levelbar),
@@ -518,13 +513,13 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
g_object_set_data (G_OBJECT (row), "kind", GINT_TO_POINTER (kind));
- gtk_container_add (GTK_CONTAINER (priv->battery_list), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_container_add (GTK_CONTAINER (panel->battery_list), row);
+ gtk_size_group_add_widget (panel->row_sizegroup, row);
gtk_widget_show_all (row);
g_free (icon_name);
- gtk_widget_set_visible (priv->battery_section, TRUE);
+ gtk_widget_set_visible (panel->battery_section, TRUE);
}
static const char *
@@ -567,7 +562,6 @@ kind_to_description (UpDeviceKind kind)
static void
add_device (CcPowerPanel *panel, UpDevice *device)
{
- CcPowerPanelPrivate *priv = panel->priv;
UpDeviceKind kind;
UpDeviceState state;
GtkWidget *row;
@@ -659,7 +653,7 @@ add_device (CcPowerPanel *panel, UpDevice *device)
gtk_widget_set_margin_top (widget, 6);
gtk_widget_set_margin_bottom (widget, 6);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, TRUE, 0);
- gtk_size_group_add_widget (priv->battery_sizegroup, widget);
+ gtk_size_group_add_widget (panel->battery_sizegroup, widget);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_margin_start (box2, 20);
@@ -670,7 +664,7 @@ add_device (CcPowerPanel *panel, UpDevice *device)
gtk_widget_set_halign (widget, GTK_ALIGN_END);
gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_DIM_LABEL);
gtk_box_pack_start (GTK_BOX (box2), widget, FALSE, TRUE, 0);
- gtk_size_group_add_widget (priv->charge_sizegroup, widget);
+ gtk_size_group_add_widget (panel->charge_sizegroup, widget);
widget = gtk_level_bar_new ();
gtk_widget_set_halign (widget, TRUE);
@@ -678,18 +672,18 @@ add_device (CcPowerPanel *panel, UpDevice *device)
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), percentage / 100.0f);
gtk_box_pack_start (GTK_BOX (box2), widget, TRUE, TRUE, 0);
- gtk_size_group_add_widget (priv->level_sizegroup, widget);
+ gtk_size_group_add_widget (panel->level_sizegroup, widget);
gtk_box_pack_start (GTK_BOX (hbox), box2, TRUE, TRUE, 0);
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (priv->device_list), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_container_add (GTK_CONTAINER (panel->device_list), row);
+ gtk_size_group_add_widget (panel->row_sizegroup, row);
g_object_set_data (G_OBJECT (row), "kind", GINT_TO_POINTER (kind));
g_string_free (description, TRUE);
g_string_free (status, TRUE);
- gtk_widget_set_visible (priv->device_section, TRUE);
+ gtk_widget_set_visible (panel->device_section, TRUE);
}
static void
@@ -697,7 +691,6 @@ up_client_changed (UpClient *client,
UpDevice *device,
CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GList *children, *l;
gint i;
UpDeviceKind kind;
@@ -706,17 +699,17 @@ up_client_changed (UpClient *client,
UpDevice *composite;
gchar *s;
- children = gtk_container_get_children (GTK_CONTAINER (priv->battery_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->battery_list));
for (l = children; l != NULL; l = l->next)
- gtk_container_remove (GTK_CONTAINER (priv->battery_list), l->data);
+ gtk_container_remove (GTK_CONTAINER (self->battery_list), l->data);
g_list_free (children);
- gtk_widget_hide (priv->battery_section);
+ gtk_widget_hide (self->battery_section);
- children = gtk_container_get_children (GTK_CONTAINER (priv->device_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->device_list));
for (l = children; l != NULL; l = l->next)
- gtk_container_remove (GTK_CONTAINER (priv->device_list), l->data);
+ gtk_container_remove (GTK_CONTAINER (self->device_list), l->data);
g_list_free (children);
- gtk_widget_hide (priv->device_section);
+ gtk_widget_hide (self->device_section);
#ifdef TEST_FAKE_DEVICES
{
@@ -736,7 +729,7 @@ up_client_changed (UpClient *client,
"time-to-empty", 287,
"icon-name", "battery-full-symbolic",
NULL);
- g_ptr_array_add (priv->devices, device);
+ g_ptr_array_add (self->devices, device);
device = up_device_new ();
g_object_set (device,
"kind", UP_DEVICE_KIND_KEYBOARD,
@@ -747,7 +740,7 @@ up_client_changed (UpClient *client,
"time-to-empty", 250,
"icon-name", "battery-good-symbolic",
NULL);
- g_ptr_array_add (priv->devices, device);
+ g_ptr_array_add (self->devices, device);
device = up_device_new ();
g_object_set (device,
"kind", UP_DEVICE_KIND_BATTERY,
@@ -761,14 +754,14 @@ up_client_changed (UpClient *client,
"time-to-empty", 400,
"icon-name", "battery-full-charged-symbolic",
NULL);
- g_ptr_array_add (priv->devices, device);
+ g_ptr_array_add (self->devices, device);
}
}
#endif
on_ups = FALSE;
n_batteries = 0;
- composite = up_client_get_display_device (priv->up_client);
+ composite = up_client_get_display_device (self->up_client);
g_object_get (composite, "kind", &kind, NULL);
if (kind == UP_DEVICE_KIND_UPS)
{
@@ -779,9 +772,9 @@ up_client_changed (UpClient *client,
gboolean is_extra_battery = FALSE;
/* Count the batteries */
- for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
+ for (i = 0; self->devices != NULL && i < self->devices->len; i++)
{
- UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
+ UpDevice *device = (UpDevice*) g_ptr_array_index (self->devices, i);
g_object_get (device, "kind", &kind, NULL);
if (kind == UP_DEVICE_KIND_BATTERY)
{
@@ -799,15 +792,15 @@ up_client_changed (UpClient *client,
s = g_strdup_printf ("<b>%s</b>", _("Batteries"));
else
s = g_strdup_printf ("<b>%s</b>", _("Battery"));
- gtk_label_set_label (GTK_LABEL (priv->battery_heading), s);
+ gtk_label_set_label (GTK_LABEL (self->battery_heading), s);
g_free (s);
if (!on_ups && n_batteries > 1)
set_primary (self, composite);
- for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
+ for (i = 0; self->devices != NULL && i < self->devices->len; i++)
{
- UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
+ UpDevice *device = (UpDevice*) g_ptr_array_index (self->devices, i);
g_object_get (device, "kind", &kind, NULL);
if (kind == UP_DEVICE_KIND_LINE_POWER)
{
@@ -839,25 +832,24 @@ up_client_device_removed (UpClient *client,
const char *object_path,
CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
guint i;
- if (priv->devices == NULL)
+ if (self->devices == NULL)
return;
- for (i = 0; i < priv->devices->len; i++)
+ for (i = 0; i < self->devices->len; i++)
{
- UpDevice *device = g_ptr_array_index (priv->devices, i);
+ UpDevice *device = g_ptr_array_index (self->devices, i);
if (g_strcmp0 (object_path, up_device_get_object_path (device)) == 0)
{
g_object_unref (device);
- g_ptr_array_remove_index (priv->devices, i);
+ g_ptr_array_remove_index (self->devices, i);
break;
}
}
- up_client_changed (self->priv->up_client, NULL, self);
+ up_client_changed (self->up_client, NULL, self);
}
static void
@@ -865,27 +857,25 @@ up_client_device_added (UpClient *client,
UpDevice *device,
CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
-
- g_ptr_array_add (priv->devices, g_object_ref (device));
+ g_ptr_array_add (self->devices, g_object_ref (device));
g_signal_connect (G_OBJECT (device), "notify",
G_CALLBACK (up_client_changed), self);
- up_client_changed (priv->up_client, NULL, self);
+ up_client_changed (self->up_client, NULL, self);
}
static void
set_brightness_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
+ CcPowerPanel *self = CC_POWER_PANEL (user_data);
GError *error = NULL;
GVariant *result;
- CcPowerPanelPrivate *priv = CC_POWER_PANEL (user_data)->priv;
GDBusProxy *proxy = G_DBUS_PROXY (source_object);
/* not setting, so pay attention to changed signals */
- if (proxy == priv->screen_proxy)
- priv->setting_brightness = FALSE;
- else if (proxy == priv->kbd_proxy)
- priv->kbd_setting_brightness = FALSE;
+ if (proxy == self->screen_proxy)
+ self->setting_brightness = FALSE;
+ else if (proxy == self->kbd_proxy)
+ self->kbd_setting_brightness = FALSE;
result = g_dbus_proxy_call_finish (proxy, res, &error);
if (result == NULL)
@@ -900,21 +890,21 @@ set_brightness_cb (GObject *source_object, GAsyncResult *res, gpointer user_data
static void
brightness_slider_value_changed_cb (GtkRange *range, gpointer user_data)
{
+ CcPowerPanel *self = CC_POWER_PANEL (user_data);
guint percentage;
- CcPowerPanelPrivate *priv = CC_POWER_PANEL (user_data)->priv;
GVariant *variant;
GDBusProxy *proxy;
percentage = (guint) gtk_range_get_value (range);
- if (range == GTK_RANGE (priv->brightness_scale))
+ if (range == GTK_RANGE (self->brightness_scale))
{
/* do not loop */
- if (priv->setting_brightness)
+ if (self->setting_brightness)
return;
- priv->setting_brightness = TRUE;
- proxy = priv->screen_proxy;
+ self->setting_brightness = TRUE;
+ proxy = self->screen_proxy;
variant = g_variant_new_parsed ("('org.gnome.SettingsDaemon.Power.Screen',"
"'Brightness', %v)",
@@ -923,11 +913,11 @@ brightness_slider_value_changed_cb (GtkRange *range, gpointer user_data)
else
{
/* do not loop */
- if (priv->kbd_setting_brightness)
+ if (self->kbd_setting_brightness)
return;
- priv->kbd_setting_brightness = TRUE;
- proxy = priv->kbd_proxy;
+ self->kbd_setting_brightness = TRUE;
+ proxy = self->kbd_proxy;
variant = g_variant_new_parsed ("('org.gnome.SettingsDaemon.Power.Keyboard',"
"'Brightness', %v)",
@@ -940,7 +930,7 @@ brightness_slider_value_changed_cb (GtkRange *range, gpointer user_data)
variant,
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->cancellable,
+ self->cancellable,
set_brightness_cb,
user_data);
}
@@ -953,7 +943,7 @@ sync_kbd_brightness (CcPowerPanel *self)
gboolean visible;
GtkRange *range;
- result = g_dbus_proxy_get_cached_property (self->priv->kbd_proxy, "Brightness");
+ result = g_dbus_proxy_get_cached_property (self->kbd_proxy, "Brightness");
if (result)
{
/* set the slider */
@@ -965,16 +955,16 @@ sync_kbd_brightness (CcPowerPanel *self)
visible = FALSE;
}
- gtk_widget_set_visible (self->priv->kbd_brightness_row, visible);
+ gtk_widget_set_visible (self->kbd_brightness_row, visible);
if (visible)
{
- range = GTK_RANGE (self->priv->kbd_brightness_scale);
+ range = GTK_RANGE (self->kbd_brightness_scale);
gtk_range_set_range (range, 0, 100);
gtk_range_set_increments (range, 1, 10);
- self->priv->kbd_setting_brightness = TRUE;
+ self->kbd_setting_brightness = TRUE;
gtk_range_set_value (range, brightness);
- self->priv->kbd_setting_brightness = FALSE;
+ self->kbd_setting_brightness = FALSE;
g_variant_unref (result);
}
}
@@ -987,7 +977,7 @@ sync_screen_brightness (CcPowerPanel *self)
gboolean visible;
GtkRange *range;
- result = g_dbus_proxy_get_cached_property (self->priv->screen_proxy, "Brightness");
+ result = g_dbus_proxy_get_cached_property (self->screen_proxy, "Brightness");
if (result)
{
@@ -1000,17 +990,17 @@ sync_screen_brightness (CcPowerPanel *self)
visible = FALSE;
}
- gtk_widget_set_visible (self->priv->brightness_row, visible);
- gtk_widget_set_visible (self->priv->dim_screen_row, visible);
+ gtk_widget_set_visible (self->brightness_row, visible);
+ gtk_widget_set_visible (self->dim_screen_row, visible);
if (visible)
{
- range = GTK_RANGE (self->priv->brightness_scale);
+ range = GTK_RANGE (self->brightness_scale);
gtk_range_set_range (range, 0, 100);
gtk_range_set_increments (range, 1, 10);
- self->priv->setting_brightness = TRUE;
+ self->setting_brightness = TRUE;
gtk_range_set_value (range, brightness);
- self->priv->setting_brightness = FALSE;
+ self->setting_brightness = FALSE;
g_variant_unref (result);
}
}
@@ -1023,21 +1013,20 @@ als_switch_changed (GtkSwitch *sw,
gboolean enabled;
enabled = gtk_switch_get_active (sw);
g_debug ("Setting ALS enabled %s", enabled ? "on" : "off");
- g_settings_set_boolean (panel->priv->gsd_settings, "ambient-enabled", enabled);
+ g_settings_set_boolean (panel->gsd_settings, "ambient-enabled", enabled);
}
static void
als_enabled_state_changed (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
gboolean enabled;
gboolean has_brightness = FALSE;
gboolean visible = FALSE;
GVariant *v;
- if (priv->screen_proxy != NULL)
+ if (self->screen_proxy != NULL)
{
- v = g_dbus_proxy_get_cached_property (priv->screen_proxy, "Brightness");
+ v = g_dbus_proxy_get_cached_property (self->screen_proxy, "Brightness");
if (v != NULL)
{
has_brightness = g_variant_get_int32 (v) >= 0.0;
@@ -1045,9 +1034,9 @@ als_enabled_state_changed (CcPowerPanel *self)
}
}
- if (priv->iio_proxy != NULL)
+ if (self->iio_proxy != NULL)
{
- v = g_dbus_proxy_get_cached_property (priv->iio_proxy, "HasAmbientLight");
+ v = g_dbus_proxy_get_cached_property (self->iio_proxy, "HasAmbientLight");
if (v != NULL)
{
visible = g_variant_get_boolean (v);
@@ -1055,12 +1044,12 @@ als_enabled_state_changed (CcPowerPanel *self)
}
}
- enabled = g_settings_get_boolean (priv->gsd_settings, "ambient-enabled");
+ enabled = g_settings_get_boolean (self->gsd_settings, "ambient-enabled");
g_debug ("ALS enabled: %s", enabled ? "on" : "off");
- g_signal_handlers_block_by_func (priv->als_switch, als_switch_changed, self);
- gtk_switch_set_active (GTK_SWITCH (priv->als_switch), enabled);
- gtk_widget_set_visible (priv->als_row, visible && has_brightness);
- g_signal_handlers_unblock_by_func (priv->als_switch, als_switch_changed, self);
+ g_signal_handlers_block_by_func (self->als_switch, als_switch_changed, self);
+ gtk_switch_set_active (GTK_SWITCH (self->als_switch), enabled);
+ gtk_widget_set_visible (self->als_row, visible && has_brightness);
+ g_signal_handlers_unblock_by_func (self->als_switch, als_switch_changed, self);
}
static void
@@ -1078,10 +1067,9 @@ got_screen_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_da
{
GError *error = NULL;
CcPowerPanel *self = CC_POWER_PANEL (user_data);
- CcPowerPanelPrivate *priv = self->priv;
- priv->screen_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (priv->screen_proxy == NULL)
+ self->screen_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (self->screen_proxy == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_printerr ("Error creating screen proxy: %s\n", error->message);
@@ -1090,7 +1078,7 @@ got_screen_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_da
}
/* we want to change the bar if the user presses brightness buttons */
- g_signal_connect (priv->screen_proxy, "g-properties-changed",
+ g_signal_connect (self->screen_proxy, "g-properties-changed",
G_CALLBACK (on_screen_property_change), self);
sync_screen_brightness (self);
@@ -1112,10 +1100,9 @@ got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GError *error = NULL;
CcPowerPanel *self = CC_POWER_PANEL (user_data);
- CcPowerPanelPrivate *priv = self->priv;
- priv->kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (priv->kbd_proxy == NULL)
+ self->kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (self->kbd_proxy == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_printerr ("Error creating keyboard proxy: %s\n", error->message);
@@ -1124,7 +1111,7 @@ got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
}
/* we want to change the bar if the user presses brightness buttons */
- g_signal_connect (priv->kbd_proxy, "g-properties-changed",
+ g_signal_connect (self->kbd_proxy, "g-properties-changed",
G_CALLBACK (on_kbd_property_change), self);
sync_kbd_brightness (self);
@@ -1151,7 +1138,7 @@ combo_time_changed_cb (GtkWidget *widget, CcPowerPanel *self)
-1);
/* set both keys */
- g_settings_set_int (self->priv->gsd_settings, key, value);
+ g_settings_set_int (self->gsd_settings, key, value);
}
static void
@@ -1195,7 +1182,7 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
UpDevice *device;
UpDeviceKind kind;
- devices = up_client_get_devices (self->priv->up_client);
+ devices = up_client_get_devices (self->up_client);
g_debug ("got %d devices from upower\n", devices ? devices->len : 0);
for (i = 0; devices != NULL && i < devices->len; i++)
@@ -1215,15 +1202,15 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
has_batteries = FALSE;
#endif
- self->priv->has_batteries = has_batteries;
+ self->has_batteries = has_batteries;
if (!has_batteries)
{
- gtk_widget_hide (WID (self->priv->builder, "suspend_on_battery_switch"));
- gtk_widget_hide (WID (self->priv->builder, "suspend_on_battery_label"));
- gtk_widget_hide (WID (self->priv->builder, "suspend_on_battery_delay_label"));
- gtk_widget_hide (WID (self->priv->builder, "suspend_on_battery_delay_combo"));
- gtk_label_set_label (GTK_LABEL (WID (self->priv->builder, "suspend_on_ac_label")),
+ gtk_widget_hide (WID (self->builder, "suspend_on_battery_switch"));
+ gtk_widget_hide (WID (self->builder, "suspend_on_battery_label"));
+ gtk_widget_hide (WID (self->builder, "suspend_on_battery_delay_label"));
+ gtk_widget_hide (WID (self->builder, "suspend_on_battery_delay_combo"));
+ gtk_label_set_label (GTK_LABEL (WID (self->builder, "suspend_on_ac_label")),
_("When _idle"));
}
}
@@ -1232,13 +1219,13 @@ static void
bt_set_powered (CcPowerPanel *self,
gboolean powered)
{
- g_dbus_proxy_call (self->priv->bt_properties,
+ g_dbus_proxy_call (self->bt_properties,
"Set",
g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill', 'BluetoothAirplaneMode', %v)",
g_variant_new_boolean (!powered)),
G_DBUS_CALL_FLAGS_NONE,
-1,
- self->priv->cancellable,
+ self->cancellable,
NULL, NULL);
}
@@ -1259,32 +1246,31 @@ bt_switch_changed (GtkSwitch *sw,
static void
bt_powered_state_changed (CcPowerPanel *panel)
{
- CcPowerPanelPrivate *priv = panel->priv;
gboolean powered, has_airplane_mode;
GVariant *v;
- v = g_dbus_proxy_get_cached_property (priv->bt_rfkill, "BluetoothHasAirplaneMode");
+ v = g_dbus_proxy_get_cached_property (panel->bt_rfkill, "BluetoothHasAirplaneMode");
has_airplane_mode = g_variant_get_boolean (v);
g_variant_unref (v);
if (!has_airplane_mode)
{
g_debug ("BluetoothHasAirplaneMode is false, hiding Bluetooth power row");
- gtk_widget_hide (priv->bt_row);
+ gtk_widget_hide (panel->bt_row);
return;
}
- v = g_dbus_proxy_get_cached_property (priv->bt_rfkill, "BluetoothAirplaneMode");
+ v = g_dbus_proxy_get_cached_property (panel->bt_rfkill, "BluetoothAirplaneMode");
powered = !g_variant_get_boolean (v);
g_variant_unref (v);
g_debug ("bt powered state changed to %s", powered ? "on" : "off");
- gtk_widget_show (priv->bt_row);
+ gtk_widget_show (panel->bt_row);
- g_signal_handlers_block_by_func (priv->bt_switch, bt_switch_changed, panel);
- gtk_switch_set_active (GTK_SWITCH (priv->bt_switch), powered);
- g_signal_handlers_unblock_by_func (priv->bt_switch, bt_switch_changed, panel);
+ g_signal_handlers_block_by_func (panel->bt_switch, bt_switch_changed, panel);
+ gtk_switch_set_active (GTK_SWITCH (panel->bt_switch), powered);
+ g_signal_handlers_unblock_by_func (panel->bt_switch, bt_switch_changed, panel);
}
#ifdef HAVE_NETWORK_MANAGER
@@ -1326,7 +1312,7 @@ wifi_switch_changed (GtkSwitch *sw,
enabled = gtk_switch_get_active (sw);
g_debug ("Setting wifi %s", enabled ? "enabled" : "disabled");
- nm_client_wireless_set_enabled (panel->priv->nm_client, enabled);
+ nm_client_wireless_set_enabled (panel->nm_client, enabled);
}
static gboolean
@@ -1368,9 +1354,9 @@ mobile_switch_changed (GtkSwitch *sw,
enabled = gtk_switch_get_active (sw);
g_debug ("Setting wwan %s", enabled ? "enabled" : "disabled");
- nm_client_wwan_set_enabled (panel->priv->nm_client, enabled);
+ nm_client_wwan_set_enabled (panel->nm_client, enabled);
g_debug ("Setting wimax %s", enabled ? "enabled" : "disabled");
- nm_client_wimax_set_enabled (panel->priv->nm_client, enabled);
+ nm_client_wimax_set_enabled (panel->nm_client, enabled);
}
static void
@@ -1378,12 +1364,11 @@ nm_client_state_changed (NMClient *client,
GParamSpec *pspec,
CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
gboolean visible;
gboolean active;
gboolean sensitive;
- visible = has_wifi_devices (priv->nm_client);
+ visible = has_wifi_devices (self->nm_client);
active = nm_client_networking_get_enabled (client) &&
nm_client_wireless_get_enabled (client) &&
nm_client_wireless_hardware_get_enabled (client);
@@ -1392,13 +1377,13 @@ nm_client_state_changed (NMClient *client,
g_debug ("wifi state changed to %s", active ? "enabled" : "disabled");
- g_signal_handlers_block_by_func (priv->wifi_switch, wifi_switch_changed, self);
- gtk_switch_set_active (GTK_SWITCH (priv->wifi_switch), active);
- gtk_widget_set_sensitive (priv->wifi_switch, sensitive);
- gtk_widget_set_visible (priv->wifi_row, visible);
- g_signal_handlers_unblock_by_func (priv->wifi_switch, wifi_switch_changed, self);
+ g_signal_handlers_block_by_func (self->wifi_switch, wifi_switch_changed, self);
+ gtk_switch_set_active (GTK_SWITCH (self->wifi_switch), active);
+ gtk_widget_set_sensitive (self->wifi_switch, sensitive);
+ gtk_widget_set_visible (self->wifi_row, visible);
+ g_signal_handlers_unblock_by_func (self->wifi_switch, wifi_switch_changed, self);
- visible = has_mobile_devices (priv->nm_client);
+ visible = has_mobile_devices (self->nm_client);
active = nm_client_networking_get_enabled (client) &&
nm_client_wimax_get_enabled (client) &&
nm_client_wireless_hardware_get_enabled (client);
@@ -1407,11 +1392,11 @@ nm_client_state_changed (NMClient *client,
g_debug ("mobile state changed to %s", active ? "enabled" : "disabled");
- g_signal_handlers_block_by_func (priv->mobile_switch, mobile_switch_changed, self);
- gtk_switch_set_active (GTK_SWITCH (priv->mobile_switch), active);
- gtk_widget_set_sensitive (priv->mobile_switch, sensitive);
- gtk_widget_set_visible (priv->mobile_row, visible);
- g_signal_handlers_unblock_by_func (priv->mobile_switch, mobile_switch_changed, self);
+ g_signal_handlers_block_by_func (self->mobile_switch, mobile_switch_changed, self);
+ gtk_switch_set_active (GTK_SWITCH (self->mobile_switch), active);
+ gtk_widget_set_sensitive (self->mobile_switch, sensitive);
+ gtk_widget_set_visible (self->mobile_row, visible);
+ g_signal_handlers_unblock_by_func (self->mobile_switch, mobile_switch_changed, self);
}
static void
@@ -1419,10 +1404,8 @@ nm_device_changed (NMClient *client,
NMDevice *device,
CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
-
- gtk_widget_set_visible (priv->wifi_row, has_wifi_devices (priv->nm_client));
- gtk_widget_set_visible (priv->mobile_row, has_mobile_devices (priv->nm_client));
+ gtk_widget_set_visible (self->wifi_row, has_wifi_devices (self->nm_client));
+ gtk_widget_set_visible (self->mobile_row, has_mobile_devices (self->nm_client));
}
static void
@@ -1430,8 +1413,7 @@ nm_client_ready_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- CcPowerPanel *self;
- CcPowerPanelPrivate *priv;
+ CcPowerPanel *self = user_data;
NMClient *client;
GError *error = NULL;
@@ -1444,26 +1426,24 @@ nm_client_ready_cb (GObject *source_object,
error->message);
self = user_data;
- gtk_widget_set_sensitive (self->priv->wifi_row, FALSE);
- gtk_widget_set_sensitive (self->priv->mobile_row, FALSE);
+ gtk_widget_set_sensitive (self->wifi_row, FALSE);
+ gtk_widget_set_sensitive (self->mobile_row, FALSE);
}
g_error_free (error);
return;
}
- self = user_data;
- priv = self->priv;
- priv->nm_client = client;
+ self->nm_client = client;
- g_signal_connect (priv->nm_client, "notify",
+ g_signal_connect (self->nm_client, "notify",
G_CALLBACK (nm_client_state_changed), self);
- g_signal_connect (priv->nm_client, "device-added",
+ g_signal_connect (self->nm_client, "device-added",
G_CALLBACK (nm_device_changed), self);
- g_signal_connect (priv->nm_client, "device-removed",
+ g_signal_connect (self->nm_client, "device-removed",
G_CALLBACK (nm_device_changed), self);
- nm_client_state_changed (priv->nm_client, NULL, self);
- nm_device_changed (priv->nm_client, NULL, self);
+ nm_client_state_changed (self->nm_client, NULL, self);
+ nm_device_changed (self->nm_client, NULL, self);
}
#endif
@@ -1471,16 +1451,15 @@ nm_client_ready_cb (GObject *source_object,
static gboolean
keynav_failed (GtkWidget *list, GtkDirectionType direction, CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *next_list = NULL;
GList *item, *boxes_list;
gdouble value, lower, upper, page;
/* Find the list in the list of GtkListBoxes */
if (direction == GTK_DIR_DOWN)
- boxes_list = priv->boxes;
+ boxes_list = self->boxes;
else
- boxes_list = priv->boxes_reverse;
+ boxes_list = self->boxes_reverse;
item = g_list_find (boxes_list, list);
g_assert (item);
@@ -1509,19 +1488,19 @@ keynav_failed (GtkWidget *list, GtkDirectionType direction, CcPowerPanel *self)
return TRUE;
}
- value = gtk_adjustment_get_value (priv->focus_adjustment);
- lower = gtk_adjustment_get_lower (priv->focus_adjustment);
- upper = gtk_adjustment_get_upper (priv->focus_adjustment);
- page = gtk_adjustment_get_page_size (priv->focus_adjustment);
+ value = gtk_adjustment_get_value (self->focus_adjustment);
+ lower = gtk_adjustment_get_lower (self->focus_adjustment);
+ upper = gtk_adjustment_get_upper (self->focus_adjustment);
+ page = gtk_adjustment_get_page_size (self->focus_adjustment);
if (direction == GTK_DIR_UP && value > lower)
{
- gtk_adjustment_set_value (priv->focus_adjustment, lower);
+ gtk_adjustment_set_value (self->focus_adjustment, lower);
return TRUE;
}
else if (direction == GTK_DIR_DOWN && value < upper - page)
{
- gtk_adjustment_set_value (priv->focus_adjustment, upper - page);
+ gtk_adjustment_set_value (self->focus_adjustment, upper - page);
return TRUE;
}
@@ -1548,7 +1527,7 @@ combo_idle_delay_changed_cb (GtkWidget *widget, CcPowerPanel *self)
-1);
/* set both keys */
- g_settings_set_uint (self->priv->session_settings, "idle-delay", value);
+ g_settings_set_uint (self->session_settings, "idle-delay", value);
}
static void
@@ -1571,7 +1550,7 @@ combo_power_button_changed_cb (GtkWidget *widget, CcPowerPanel *self)
-1);
/* set both keys */
- g_settings_set_enum (self->priv->gsd_settings, "power-button-action", value);
+ g_settings_set_enum (self->gsd_settings, "power-button-action", value);
}
static GtkWidget *
@@ -1579,7 +1558,6 @@ add_brightness_row (CcPowerPanel *self,
const char *text,
GtkWidget **brightness_scale)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *row, *box, *label, *box2, *w, *scale;
row = no_prelight_row_new ();
@@ -1594,11 +1572,11 @@ add_brightness_row (CcPowerPanel *self,
gtk_widget_set_margin_top (label, 6);
gtk_widget_set_margin_bottom (label, 6);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0);
- gtk_size_group_add_widget (priv->battery_sizegroup, label);
+ gtk_size_group_add_widget (self->battery_sizegroup, label);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
w = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (box2), w, FALSE, TRUE, 0);
- gtk_size_group_add_widget (priv->charge_sizegroup, w);
+ gtk_size_group_add_widget (self->charge_sizegroup, w);
*brightness_scale = scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), scale);
@@ -1606,7 +1584,7 @@ add_brightness_row (CcPowerPanel *self,
gtk_widget_set_margin_start (scale, 20);
gtk_widget_set_margin_end (scale, 20);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
- gtk_size_group_add_widget (priv->level_sizegroup, scale);
+ gtk_size_group_add_widget (self->level_sizegroup, scale);
g_signal_connect (scale, "value-changed",
G_CALLBACK (brightness_slider_value_changed_cb), self);
@@ -1632,7 +1610,7 @@ iio_proxy_appeared_cb (GDBusConnection *connection,
CcPowerPanel *self = CC_POWER_PANEL (user_data);
GError *error = NULL;
- self->priv->iio_proxy =
+ self->iio_proxy =
g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
@@ -1648,7 +1626,7 @@ iio_proxy_appeared_cb (GDBusConnection *connection,
return;
}
- g_signal_connect_swapped (G_OBJECT (self->priv->iio_proxy), "g-properties-changed",
+ g_signal_connect_swapped (G_OBJECT (self->iio_proxy), "g-properties-changed",
G_CALLBACK (als_enabled_state_changed), self);
als_enabled_state_changed (self);
}
@@ -1659,14 +1637,13 @@ iio_proxy_vanished_cb (GDBusConnection *connection,
gpointer user_data)
{
CcPowerPanel *self = CC_POWER_PANEL (user_data);
- g_clear_object (&self->priv->iio_proxy);
+ g_clear_object (&self->iio_proxy);
als_enabled_state_changed (self);
}
static void
add_power_saving_section (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *vbox;
GtkWidget *widget, *box, *label, *row;
GtkWidget *combo;
@@ -1676,7 +1653,7 @@ add_power_saving_section (CcPowerPanel *self)
int value;
gchar *s;
- vbox = WID (priv->builder, "vbox_power");
+ vbox = WID (self->builder, "vbox_power");
s = g_strdup_printf ("<b>%s</b>", _("Power Saving"));
label = gtk_label_new (s);
@@ -1688,7 +1665,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_widget_show (label);
widget = gtk_list_box_new ();
- priv->boxes_reverse = g_list_prepend (priv->boxes_reverse, widget);
+ self->boxes_reverse = g_list_prepend (self->boxes_reverse, widget);
g_signal_connect (widget, "keynav-failed", G_CALLBACK (keynav_failed), self);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (widget), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (widget),
@@ -1709,23 +1686,23 @@ add_power_saving_section (CcPowerPanel *self)
gtk_container_add (GTK_CONTAINER (box), widget);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE, 0);
- row = add_brightness_row (self, _("_Screen brightness"), &priv->brightness_scale);
- priv->brightness_row = row;
+ row = add_brightness_row (self, _("_Screen brightness"), &self->brightness_scale);
+ self->brightness_row = row;
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
/* ambient light sensor */
- priv->iio_proxy_watch_id =
+ self->iio_proxy_watch_id =
g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"net.hadess.SensorProxy",
G_BUS_NAME_WATCHER_FLAGS_NONE,
iio_proxy_appeared_cb,
iio_proxy_vanished_cb,
self, NULL);
- g_signal_connect (priv->gsd_settings, "changed",
+ g_signal_connect (self->gsd_settings, "changed",
G_CALLBACK (als_enabled_setting_changed), self);
- priv->als_row = row = no_prelight_row_new ();
+ self->als_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
label = gtk_label_new (_("Automatic brightness"));
@@ -1737,24 +1714,24 @@ add_power_saving_section (CcPowerPanel *self)
gtk_widget_set_margin_bottom (label, 6);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
- priv->als_switch = sw = gtk_switch_new ();
+ self->als_switch = sw = gtk_switch_new ();
gtk_widget_set_margin_start (sw, 20);
gtk_widget_set_margin_end (sw, 20);
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
- g_signal_connect (G_OBJECT (priv->als_switch), "notify::active",
+ gtk_size_group_add_widget (self->row_sizegroup, row);
+ g_signal_connect (G_OBJECT (self->als_switch), "notify::active",
G_CALLBACK (als_switch_changed), self);
- row = add_brightness_row (self, _("_Keyboard brightness"), &priv->kbd_brightness_scale);
- priv->kbd_brightness_row = row;
+ row = add_brightness_row (self, _("_Keyboard brightness"), &self->kbd_brightness_scale);
+ self->kbd_brightness_row = row;
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
- priv->dim_screen_row = row = no_prelight_row_new ();
+ self->dim_screen_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1768,7 +1745,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
sw = gtk_switch_new ();
- g_settings_bind (priv->gsd_settings, "idle-dim",
+ g_settings_bind (self->gsd_settings, "idle-dim",
sw, "active",
G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_margin_start (sw, 20);
@@ -1777,7 +1754,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
@@ -1795,8 +1772,8 @@ add_power_saving_section (CcPowerPanel *self)
combo = gtk_combo_box_text_new ();
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo), 0);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo),
- GTK_TREE_MODEL (gtk_builder_get_object (priv->builder, "liststore_idle_time")));
- value = g_settings_get_uint (priv->session_settings, "idle-delay");
+ GTK_TREE_MODEL (gtk_builder_get_object (self->builder, "liststore_idle_time")));
+ value = g_settings_get_uint (self->session_settings, "idle-delay");
set_value_for_combo (GTK_COMBO_BOX (combo), value);
g_signal_connect (combo, "changed",
G_CALLBACK (combo_idle_delay_changed_cb), self);
@@ -1806,10 +1783,10 @@ add_power_saving_section (CcPowerPanel *self)
gtk_box_pack_start (GTK_BOX (box), combo, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
#ifdef HAVE_NETWORK_MANAGER
- priv->wifi_row = row = no_prelight_row_new ();
+ self->wifi_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1830,16 +1807,16 @@ add_power_saving_section (CcPowerPanel *self)
gtk_style_context_add_class (gtk_widget_get_style_context (w), GTK_STYLE_CLASS_DIM_LABEL);
gtk_box_pack_start (GTK_BOX (box2), w, TRUE, TRUE, 0);
- priv->wifi_switch = sw = gtk_switch_new ();
+ self->wifi_switch = sw = gtk_switch_new ();
gtk_widget_set_margin_start (sw, 20);
gtk_widget_set_margin_end (sw, 20);
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
- priv->mobile_row = row = no_prelight_row_new ();
+ self->mobile_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1860,35 +1837,35 @@ add_power_saving_section (CcPowerPanel *self)
gtk_style_context_add_class (gtk_widget_get_style_context (w), GTK_STYLE_CLASS_DIM_LABEL);
gtk_box_pack_start (GTK_BOX (box2), w, TRUE, TRUE, 0);
- priv->mobile_switch = sw = gtk_switch_new ();
+ self->mobile_switch = sw = gtk_switch_new ();
gtk_widget_set_margin_start (sw, 20);
gtk_widget_set_margin_end (sw, 20);
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
- g_signal_connect (G_OBJECT (priv->mobile_switch), "notify::active",
+ g_signal_connect (G_OBJECT (self->mobile_switch), "notify::active",
G_CALLBACK (mobile_switch_changed), self);
- nm_client_new_async (priv->cancellable, nm_client_ready_cb, self);
+ nm_client_new_async (self->cancellable, nm_client_ready_cb, self);
- g_signal_connect (G_OBJECT (priv->wifi_switch), "notify::active",
+ g_signal_connect (G_OBJECT (self->wifi_switch), "notify::active",
G_CALLBACK (wifi_switch_changed), self);
#endif
#ifdef HAVE_BLUETOOTH
- priv->bt_rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ self->bt_rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.gnome.SettingsDaemon.Rfkill",
"/org/gnome/SettingsDaemon/Rfkill",
"org.gnome.SettingsDaemon.Rfkill",
NULL, NULL);
- if (priv->bt_rfkill)
+ if (self->bt_rfkill)
{
- priv->bt_properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ self->bt_properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.gnome.SettingsDaemon.Rfkill",
@@ -1909,20 +1886,20 @@ add_power_saving_section (CcPowerPanel *self)
gtk_widget_set_margin_bottom (label, 6);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
- priv->bt_switch = sw = gtk_switch_new ();
+ self->bt_switch = sw = gtk_switch_new ();
gtk_widget_set_margin_start (sw, 20);
gtk_widget_set_margin_end (sw, 20);
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
gtk_widget_show_all (box);
gtk_widget_set_no_show_all (row, TRUE);
- priv->bt_row = row;
- g_signal_connect_swapped (G_OBJECT (priv->bt_rfkill), "g-properties-changed",
+ self->bt_row = row;
+ g_signal_connect_swapped (G_OBJECT (self->bt_rfkill), "g-properties-changed",
G_CALLBACK (bt_powered_state_changed), self);
- g_signal_connect (G_OBJECT (priv->bt_switch), "notify::active",
+ g_signal_connect (G_OBJECT (self->bt_switch), "notify::active",
G_CALLBACK (bt_switch_changed), self);
bt_powered_state_changed (self);
@@ -1936,17 +1913,16 @@ add_power_saving_section (CcPowerPanel *self)
static void
update_automatic_suspend_label (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GsdPowerActionType ac_action;
GsdPowerActionType battery_action;
gint ac_timeout;
gint battery_timeout;
const gchar *s;
- ac_action = g_settings_get_enum (priv->gsd_settings, "sleep-inactive-ac-type");
- battery_action = g_settings_get_enum (priv->gsd_settings, "sleep-inactive-battery-type");
- ac_timeout = g_settings_get_int (priv->gsd_settings, "sleep-inactive-ac-timeout");
- battery_timeout = g_settings_get_int (priv->gsd_settings, "sleep-inactive-battery-timeout");
+ ac_action = g_settings_get_enum (self->gsd_settings, "sleep-inactive-ac-type");
+ battery_action = g_settings_get_enum (self->gsd_settings, "sleep-inactive-battery-type");
+ ac_timeout = g_settings_get_int (self->gsd_settings, "sleep-inactive-ac-timeout");
+ battery_timeout = g_settings_get_int (self->gsd_settings, "sleep-inactive-battery-timeout");
if (ac_timeout < 0)
g_warning ("Invalid negative timeout for 'sleep-inactive-ac-timeout': %d", ac_timeout);
@@ -1958,7 +1934,7 @@ update_automatic_suspend_label (CcPowerPanel *self)
if (battery_action == GSD_POWER_ACTION_NOTHING || battery_timeout < 0)
battery_timeout = NEVER;
- if (priv->has_batteries)
+ if (self->has_batteries)
{
if (ac_timeout == NEVER && battery_timeout == NEVER)
s = _("Off");
@@ -1977,8 +1953,8 @@ update_automatic_suspend_label (CcPowerPanel *self)
s = _("On");
}
- if (priv->automatic_suspend_label)
- gtk_label_set_label (GTK_LABEL (priv->automatic_suspend_label), s);
+ if (self->automatic_suspend_label)
+ gtk_label_set_label (GTK_LABEL (self->automatic_suspend_label), s);
}
static void
@@ -1996,13 +1972,12 @@ static void
activate_row (CcPowerPanel *self,
GtkListBoxRow *row)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *w;
GtkWidget *toplevel;
- if (row == GTK_LIST_BOX_ROW (priv->automatic_suspend_row))
+ if (row == GTK_LIST_BOX_ROW (self->automatic_suspend_row))
{
- w = priv->automatic_suspend_dialog;
+ w = self->automatic_suspend_dialog;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (toplevel));
gtk_window_set_modal (GTK_WINDOW (w), TRUE);
@@ -2015,7 +1990,7 @@ automatic_suspend_activate (GtkWidget *widget,
gboolean cycle,
CcPowerPanel *self)
{
- activate_row (self, GTK_LIST_BOX_ROW (self->priv->automatic_suspend_row));
+ activate_row (self, GTK_LIST_BOX_ROW (self->automatic_suspend_row));
return TRUE;
}
@@ -2087,7 +2062,6 @@ static gboolean
can_suspend_or_hibernate (CcPowerPanel *self,
const char *method_name)
{
- CcPowerPanelPrivate *priv = self->priv;
GDBusConnection *connection;
GVariant *variant;
gboolean result = FALSE;
@@ -2095,7 +2069,7 @@ can_suspend_or_hibernate (CcPowerPanel *self,
const char *s;
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM,
- priv->cancellable,
+ self->cancellable,
&error);
if (!connection)
{
@@ -2114,7 +2088,7 @@ can_suspend_or_hibernate (CcPowerPanel *self,
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->cancellable,
+ self->cancellable,
&error);
g_object_unref (connection);
@@ -2138,7 +2112,6 @@ can_suspend_or_hibernate (CcPowerPanel *self,
static void
add_suspend_and_power_off_section (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *vbox;
GtkWidget *widget, *box, *label;
GtkWidget *sw, *row;
@@ -2163,18 +2136,18 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
* For our switch/combobox combination, the second choice works
* much better, so translate the first to the second here.
*/
- if (g_settings_get_int (priv->gsd_settings, "sleep-inactive-ac-timeout") == 0)
+ if (g_settings_get_int (self->gsd_settings, "sleep-inactive-ac-timeout") == 0)
{
- g_settings_set_enum (priv->gsd_settings, "sleep-inactive-ac-type", GSD_POWER_ACTION_NOTHING);
- g_settings_set_int (priv->gsd_settings, "sleep-inactive-ac-timeout", 3600);
+ g_settings_set_enum (self->gsd_settings, "sleep-inactive-ac-type", GSD_POWER_ACTION_NOTHING);
+ g_settings_set_int (self->gsd_settings, "sleep-inactive-ac-timeout", 3600);
}
- if (g_settings_get_int (priv->gsd_settings, "sleep-inactive-battery-timeout") == 0)
+ if (g_settings_get_int (self->gsd_settings, "sleep-inactive-battery-timeout") == 0)
{
- g_settings_set_enum (priv->gsd_settings, "sleep-inactive-battery-type", GSD_POWER_ACTION_NOTHING);
- g_settings_set_int (priv->gsd_settings, "sleep-inactive-battery-timeout", 1800);
+ g_settings_set_enum (self->gsd_settings, "sleep-inactive-battery-type", GSD_POWER_ACTION_NOTHING);
+ g_settings_set_int (self->gsd_settings, "sleep-inactive-battery-timeout", 1800);
}
- vbox = WID (priv->builder, "vbox_power");
+ vbox = WID (self->builder, "vbox_power");
/* Frame header */
s = g_markup_printf_escaped ("<b>%s</b>", _("Suspend & Power Button"));
@@ -2187,7 +2160,7 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
gtk_widget_show (label);
widget = gtk_list_box_new ();
- priv->boxes_reverse = g_list_prepend (priv->boxes_reverse, widget);
+ self->boxes_reverse = g_list_prepend (self->boxes_reverse, widget);
g_signal_connect (widget, "keynav-failed", G_CALLBACK (keynav_failed), self);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (widget), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (widget),
@@ -2213,11 +2186,11 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
/* Automatic suspend row */
if (can_suspend)
{
- self->priv->automatic_suspend_row = row = gtk_list_box_row_new ();
+ self->automatic_suspend_row = row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
label = gtk_label_new (_("_Automatic suspend"));
- atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (self->priv->automatic_suspend_row)), _("Automatic suspend"));
+ atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (self->automatic_suspend_row)), _("Automatic suspend"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
gtk_widget_set_margin_start (label, 20);
@@ -2226,7 +2199,7 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
gtk_widget_set_margin_bottom (label, 6);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
- priv->automatic_suspend_label = sw = gtk_label_new ("");
+ self->automatic_suspend_label = sw = gtk_label_new ("");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), sw);
g_signal_connect (sw, "mnemonic-activate",
G_CALLBACK (automatic_suspend_activate), self);
@@ -2235,36 +2208,36 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
gtk_widget_set_margin_end (sw, 24);
gtk_box_pack_start (GTK_BOX (box), sw, FALSE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
- dialog = priv->automatic_suspend_dialog;
+ dialog = self->automatic_suspend_dialog;
g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- g_signal_connect (priv->gsd_settings, "changed", G_CALLBACK (on_suspend_settings_changed), self);
+ g_signal_connect (self->gsd_settings, "changed", G_CALLBACK (on_suspend_settings_changed), self);
- sw = WID (priv->builder, "suspend_on_battery_switch");
- g_settings_bind_with_mapping (priv->gsd_settings, "sleep-inactive-battery-type",
+ sw = WID (self->builder, "suspend_on_battery_switch");
+ g_settings_bind_with_mapping (self->gsd_settings, "sleep-inactive-battery-type",
sw, "active",
G_SETTINGS_BIND_DEFAULT,
get_sleep_type, set_sleep_type, NULL, NULL);
- combo = WID (priv->builder, "suspend_on_battery_delay_combo");
+ combo = WID (self->builder, "suspend_on_battery_delay_combo");
g_object_set_data (G_OBJECT (combo), "_gsettings_key", "sleep-inactive-battery-timeout");
- value = g_settings_get_int (priv->gsd_settings, "sleep-inactive-battery-timeout");
+ value = g_settings_get_int (self->gsd_settings, "sleep-inactive-battery-timeout");
set_value_for_combo (GTK_COMBO_BOX (combo), value);
g_signal_connect (combo, "changed",
G_CALLBACK (combo_time_changed_cb), self);
g_object_bind_property (sw, "active", combo, "sensitive",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- sw = WID (priv->builder, "suspend_on_ac_switch");
- g_settings_bind_with_mapping (priv->gsd_settings, "sleep-inactive-ac-type",
+ sw = WID (self->builder, "suspend_on_ac_switch");
+ g_settings_bind_with_mapping (self->gsd_settings, "sleep-inactive-ac-type",
sw, "active",
G_SETTINGS_BIND_DEFAULT,
get_sleep_type, set_sleep_type, NULL, NULL);
- combo = WID (priv->builder, "suspend_on_ac_delay_combo");
+ combo = WID (self->builder, "suspend_on_ac_delay_combo");
g_object_set_data (G_OBJECT (combo), "_gsettings_key", "sleep-inactive-ac-timeout");
- value = g_settings_get_int (priv->gsd_settings, "sleep-inactive-ac-timeout");
+ value = g_settings_get_int (self->gsd_settings, "sleep-inactive-ac-timeout");
set_value_for_combo (GTK_COMBO_BOX (combo), value);
g_signal_connect (combo, "changed",
G_CALLBACK (combo_time_changed_cb), self);
@@ -2275,8 +2248,8 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
update_automatic_suspend_label (self);
}
- if (g_strcmp0 (priv->chassis_type, "vm") == 0 ||
- g_strcmp0 (priv->chassis_type, "tablet") == 0)
+ if (g_strcmp0 (self->chassis_type, "vm") == 0 ||
+ g_strcmp0 (self->chassis_type, "tablet") == 0)
goto out;
/* Power button row */
@@ -2295,10 +2268,10 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
combo = gtk_combo_box_text_new ();
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo), 0);
- model = GTK_TREE_MODEL (gtk_builder_get_object (priv->builder, "liststore_power_button"));
+ model = GTK_TREE_MODEL (gtk_builder_get_object (self->builder, "liststore_power_button"));
populate_power_button_model (model, can_suspend, can_hibernate);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model);
- button_value = g_settings_get_enum (priv->gsd_settings, "power-button-action");
+ button_value = g_settings_get_enum (self->gsd_settings, "power-button-action");
set_value_for_combo (GTK_COMBO_BOX (combo), button_value);
g_signal_connect (combo, "changed",
G_CALLBACK (combo_power_button_changed_cb), self);
@@ -2308,7 +2281,7 @@ add_suspend_and_power_off_section (CcPowerPanel *self)
gtk_box_pack_start (GTK_BOX (box), combo, FALSE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
gtk_container_add (GTK_CONTAINER (widget), row);
- gtk_size_group_add_widget (priv->row_sizegroup, row);
+ gtk_size_group_add_widget (self->row_sizegroup, row);
out:
gtk_widget_show_all (widget);
@@ -2341,20 +2314,19 @@ battery_sort_func (gconstpointer a, gconstpointer b, gpointer data)
static void
add_battery_section (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *vbox;
GtkWidget *widget, *box;
GtkWidget *frame;
gchar *s;
- vbox = WID (priv->builder, "vbox_power");
+ vbox = WID (self->builder, "vbox_power");
- priv->battery_section = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ self->battery_section = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_bottom (box, 32);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE, 0);
s = g_markup_printf_escaped ("<b>%s</b>", _("Battery"));
- priv->battery_heading = widget = gtk_label_new (s);
+ self->battery_heading = widget = gtk_label_new (s);
g_free (s);
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
gtk_widget_set_halign (widget, GTK_ALIGN_START);
@@ -2362,8 +2334,8 @@ add_battery_section (CcPowerPanel *self)
gtk_widget_set_margin_bottom (box, 32);
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0);
- priv->battery_list = widget = GTK_WIDGET (gtk_list_box_new ());
- priv->boxes_reverse = g_list_prepend (priv->boxes_reverse, priv->battery_list);
+ self->battery_list = widget = GTK_WIDGET (gtk_list_box_new ());
+ self->boxes_reverse = g_list_prepend (self->boxes_reverse, self->battery_list);
g_signal_connect (widget, "keynav-failed", G_CALLBACK (keynav_failed), self);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (widget), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (widget),
@@ -2372,12 +2344,12 @@ add_battery_section (CcPowerPanel *self)
gtk_list_box_set_sort_func (GTK_LIST_BOX (widget),
(GtkListBoxSortFunc)battery_sort_func, NULL, NULL);
- atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (priv->battery_heading)),
+ atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (self->battery_heading)),
ATK_RELATION_LABEL_FOR,
- ATK_OBJECT (gtk_widget_get_accessible (priv->battery_list)));
- atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (priv->battery_list)),
+ ATK_OBJECT (gtk_widget_get_accessible (self->battery_list)));
+ atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (self->battery_list)),
ATK_RELATION_LABELLED_BY,
- ATK_OBJECT (gtk_widget_get_accessible (priv->battery_heading)));
+ ATK_OBJECT (gtk_widget_get_accessible (self->battery_heading)));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
@@ -2390,29 +2362,28 @@ add_battery_section (CcPowerPanel *self)
static void
add_device_section (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv = self->priv;
GtkWidget *vbox;
GtkWidget *widget, *box;
GtkWidget *frame;
gchar *s;
- vbox = WID (priv->builder, "vbox_power");
+ vbox = WID (self->builder, "vbox_power");
- priv->device_section = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ self->device_section = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_top (box, 6);
gtk_widget_set_margin_bottom (box, 32);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE, 0);
s = g_markup_printf_escaped ("<b>%s</b>", _("Devices"));
- priv->device_heading = widget = gtk_label_new (s);
+ self->device_heading = widget = gtk_label_new (s);
g_free (s);
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
gtk_widget_set_halign (widget, GTK_ALIGN_START);
gtk_widget_set_margin_bottom (widget, 12);
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0);
- priv->device_list = widget = gtk_list_box_new ();
- priv->boxes_reverse = g_list_prepend (priv->boxes_reverse, priv->device_list);
+ self->device_list = widget = gtk_list_box_new ();
+ self->boxes_reverse = g_list_prepend (self->boxes_reverse, self->device_list);
g_signal_connect (widget, "keynav-failed", G_CALLBACK (keynav_failed), self);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (widget), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (widget),
@@ -2421,12 +2392,12 @@ add_device_section (CcPowerPanel *self)
gtk_list_box_set_sort_func (GTK_LIST_BOX (widget),
(GtkListBoxSortFunc)battery_sort_func, NULL, NULL);
- atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (priv->device_heading)),
+ atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (self->device_heading)),
ATK_RELATION_LABEL_FOR,
- ATK_OBJECT (gtk_widget_get_accessible (priv->device_list)));
- atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (priv->device_list)),
+ ATK_OBJECT (gtk_widget_get_accessible (self->device_list)));
+ atk_object_add_relationship (ATK_OBJECT (gtk_widget_get_accessible (self->device_list)),
ATK_RELATION_LABELLED_BY,
- ATK_OBJECT (gtk_widget_get_accessible (priv->device_heading)));
+ ATK_OBJECT (gtk_widget_get_accessible (self->device_heading)));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
@@ -2458,19 +2429,17 @@ on_content_size_changed (GtkWidget *widget, GtkAllocation *allocation, gpointer
static void
cc_power_panel_init (CcPowerPanel *self)
{
- CcPowerPanelPrivate *priv;
GError *error;
GtkWidget *widget;
GtkWidget *box;
guint i;
- priv = self->priv = POWER_PANEL_PRIVATE (self);
g_resources_register (cc_power_get_resource ());
- priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
error = NULL;
- gtk_builder_add_from_resource (self->priv->builder,
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/power/power.ui",
&error);
@@ -2481,9 +2450,9 @@ cc_power_panel_init (CcPowerPanel *self)
return;
}
- priv->automatic_suspend_dialog = WID (priv->builder, "automatic_suspend_dialog");
+ self->automatic_suspend_dialog = WID (self->builder, "automatic_suspend_dialog");
- priv->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
@@ -2491,7 +2460,7 @@ cc_power_panel_init (CcPowerPanel *self)
"org.gnome.SettingsDaemon.Power",
"/org/gnome/SettingsDaemon/Power",
"org.gnome.SettingsDaemon.Power.Screen",
- priv->cancellable,
+ self->cancellable,
got_screen_proxy_cb,
self);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
@@ -2500,43 +2469,43 @@ cc_power_panel_init (CcPowerPanel *self)
"org.gnome.SettingsDaemon.Power",
"/org/gnome/SettingsDaemon/Power",
"org.gnome.SettingsDaemon.Power.Keyboard",
- priv->cancellable,
+ self->cancellable,
got_kbd_proxy_cb,
self);
- priv->chassis_type = get_chassis_type (priv->cancellable);
+ self->chassis_type = get_chassis_type (self->cancellable);
- priv->up_client = up_client_new ();
+ self->up_client = up_client_new ();
- priv->gsd_settings = g_settings_new ("org.gnome.settings-daemon.plugins.power");
- priv->session_settings = g_settings_new ("org.gnome.desktop.session");
+ self->gsd_settings = g_settings_new ("org.gnome.settings-daemon.plugins.power");
+ self->session_settings = g_settings_new ("org.gnome.desktop.session");
- priv->row_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
- priv->battery_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- priv->charge_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- priv->level_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->row_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+ self->battery_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->charge_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->level_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
add_battery_section (self);
add_device_section (self);
add_power_saving_section (self);
add_suspend_and_power_off_section (self);
- priv->boxes = g_list_copy (priv->boxes_reverse);
- priv->boxes = g_list_reverse (priv->boxes);
+ self->boxes = g_list_copy (self->boxes_reverse);
+ self->boxes = g_list_reverse (self->boxes);
/* populate batteries */
- g_signal_connect (priv->up_client, "device-added", G_CALLBACK (up_client_device_added), self);
- g_signal_connect (priv->up_client, "device-removed", G_CALLBACK (up_client_device_removed), self);
+ g_signal_connect (self->up_client, "device-added", G_CALLBACK (up_client_device_added), self);
+ g_signal_connect (self->up_client, "device-removed", G_CALLBACK (up_client_device_removed), self);
- priv->devices = up_client_get_devices (priv->up_client);
- for (i = 0; priv->devices != NULL && i < priv->devices->len; i++) {
- UpDevice *device = g_ptr_array_index (priv->devices, i);
+ self->devices = up_client_get_devices (self->up_client);
+ for (i = 0; self->devices != NULL && i < self->devices->len; i++) {
+ UpDevice *device = g_ptr_array_index (self->devices, i);
g_signal_connect (G_OBJECT (device), "notify",
G_CALLBACK (up_client_changed), self);
}
- up_client_changed (priv->up_client, NULL, self);
+ up_client_changed (self->up_client, NULL, self);
- widget = WID (priv->builder, "main_box");
+ widget = WID (self->builder, "main_box");
box = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (box),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -2546,6 +2515,6 @@ cc_power_panel_init (CcPowerPanel *self)
gtk_container_add (GTK_CONTAINER (self), box);
gtk_container_add (GTK_CONTAINER (box), widget);
- priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (box));
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (widget), priv->focus_adjustment);
+ self->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (box));
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (widget), self->focus_adjustment);
}
diff --git a/panels/power/cc-power-panel.h b/panels/power/cc-power-panel.h
index d4b69546e..4ea08a28c 100644
--- a/panels/power/cc-power-panel.h
+++ b/panels/power/cc-power-panel.h
@@ -25,45 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_POWER_PANEL cc_power_panel_get_type()
-
-#define CC_POWER_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_POWER_PANEL, CcPowerPanel))
-
-#define CC_POWER_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_POWER_PANEL, CcPowerPanelClass))
-
-#define CC_IS_POWER_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_POWER_PANEL))
-
-#define CC_IS_POWER_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_POWER_PANEL))
-
-#define CC_POWER_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_POWER_PANEL, CcPowerPanelClass))
-
-typedef struct _CcPowerPanel CcPowerPanel;
-typedef struct _CcPowerPanelClass CcPowerPanelClass;
-typedef struct _CcPowerPanelPrivate CcPowerPanelPrivate;
-
-struct _CcPowerPanel
-{
- CcPanel parent;
-
- CcPowerPanelPrivate *priv;
-};
-
-struct _CcPowerPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_power_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_POWER_PANEL (cc_power_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcPowerPanel, cc_power_panel, CC, POWER_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index cb9b9208b..652e1e3d3 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -42,11 +42,6 @@
#include "cc-util.h"
-CC_PANEL_REGISTER (CcPrintersPanel, cc_printers_panel)
-
-#define PRINTERS_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_PRINTERS_PANEL, CcPrintersPanelPrivate))
-
#define RENEW_INTERVAL 500
#define SUBSCRIPTION_DURATION 600
@@ -66,8 +61,10 @@ CC_PANEL_REGISTER (CcPrintersPanel, cc_printers_panel)
#define ippGetString(attr, element, language) attr->values[element].string.text
#endif
-struct _CcPrintersPanelPrivate
+struct _CcPrintersPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
cups_dest_t *dests;
@@ -111,6 +108,8 @@ struct _CcPrintersPanelPrivate
gpointer dummy;
};
+CC_PANEL_REGISTER (CcPrintersPanel, cc_printers_panel)
+
#define PAGE_LOCK "_lock"
#define PAGE_ADDPRINTER "_addprinter"
@@ -155,25 +154,24 @@ static void
cc_printers_panel_constructed (GObject *object)
{
CcPrintersPanel *self = CC_PRINTERS_PANEL (object);
- CcPrintersPanelPrivate *priv = self->priv;
GtkWidget *widget;
CcShell *shell;
G_OBJECT_CLASS (cc_printers_panel_parent_class)->constructed (object);
shell = cc_panel_get_shell (CC_PANEL (self));
- cc_shell_embed_widget_in_header (shell, priv->headerbar_buttons);
+ cc_shell_embed_widget_in_header (shell, self->headerbar_buttons);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "lock-button");
- gtk_lock_button_set_permission (GTK_LOCK_BUTTON (widget), priv->permission);
+ gtk_builder_get_object (self->builder, "lock-button");
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (widget), self->permission);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "search-button");
+ gtk_builder_get_object (self->builder, "search-button");
cc_shell_embed_widget_in_header (shell, widget);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "search-bar");
+ gtk_builder_get_object (self->builder, "search-bar");
g_signal_connect_object (shell,
"key-press-event",
G_CALLBACK (gtk_search_bar_handle_event),
@@ -201,76 +199,76 @@ printer_removed_cb (GObject *source_object,
static void
cc_printers_panel_dispose (GObject *object)
{
- CcPrintersPanelPrivate *priv = CC_PRINTERS_PANEL (object)->priv;
+ CcPrintersPanel *self = CC_PRINTERS_PANEL (object);
- if (priv->pp_new_printer_dialog)
- g_clear_object (&priv->pp_new_printer_dialog);
+ if (self->pp_new_printer_dialog)
+ g_clear_object (&self->pp_new_printer_dialog);
free_dests (CC_PRINTERS_PANEL (object));
- g_clear_pointer (&priv->new_printer_name, g_free);
- g_clear_pointer (&priv->new_printer_location, g_free);
- g_clear_pointer (&priv->new_printer_make_and_model, g_free);
+ g_clear_pointer (&self->new_printer_name, g_free);
+ g_clear_pointer (&self->new_printer_location, g_free);
+ g_clear_pointer (&self->new_printer_make_and_model, g_free);
- g_clear_pointer (&priv->renamed_printer_name, g_free);
+ g_clear_pointer (&self->renamed_printer_name, g_free);
- if (priv->builder)
+ if (self->builder)
{
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->lockdown_settings)
+ if (self->lockdown_settings)
{
- g_object_unref (priv->lockdown_settings);
- priv->lockdown_settings = NULL;
+ g_object_unref (self->lockdown_settings);
+ self->lockdown_settings = NULL;
}
- if (priv->permission)
+ if (self->permission)
{
- g_object_unref (priv->permission);
- priv->permission = NULL;
+ g_object_unref (self->permission);
+ self->permission = NULL;
}
- g_cancellable_cancel (priv->subscription_renew_cancellable);
- g_clear_object (&priv->subscription_renew_cancellable);
+ g_cancellable_cancel (self->subscription_renew_cancellable);
+ g_clear_object (&self->subscription_renew_cancellable);
- g_cancellable_cancel (priv->actualize_printers_list_cancellable);
- g_clear_object (&priv->actualize_printers_list_cancellable);
+ g_cancellable_cancel (self->actualize_printers_list_cancellable);
+ g_clear_object (&self->actualize_printers_list_cancellable);
detach_from_cups_notifier (CC_PRINTERS_PANEL (object));
- if (priv->cups_status_check_id > 0)
+ if (self->cups_status_check_id > 0)
{
- g_source_remove (priv->cups_status_check_id);
- priv->cups_status_check_id = 0;
+ g_source_remove (self->cups_status_check_id);
+ self->cups_status_check_id = 0;
}
- if (priv->remove_printer_timeout_id > 0)
+ if (self->remove_printer_timeout_id > 0)
{
- g_source_remove (priv->remove_printer_timeout_id);
- priv->remove_printer_timeout_id = 0;
+ g_source_remove (self->remove_printer_timeout_id);
+ self->remove_printer_timeout_id = 0;
}
- if (priv->all_ppds_list)
+ if (self->all_ppds_list)
{
- ppd_list_free (priv->all_ppds_list);
- priv->all_ppds_list = NULL;
+ ppd_list_free (self->all_ppds_list);
+ self->all_ppds_list = NULL;
}
- if (priv->get_all_ppds_cancellable)
+ if (self->get_all_ppds_cancellable)
{
- g_cancellable_cancel (priv->get_all_ppds_cancellable);
- g_object_unref (priv->get_all_ppds_cancellable);
- priv->get_all_ppds_cancellable = NULL;
+ g_cancellable_cancel (self->get_all_ppds_cancellable);
+ g_object_unref (self->get_all_ppds_cancellable);
+ self->get_all_ppds_cancellable = NULL;
}
- if (priv->deleted_printer_name != NULL)
+ if (self->deleted_printer_name != NULL)
{
PpPrinter *printer;
- printer = pp_printer_new (priv->deleted_printer_name);
- g_clear_pointer (&priv->deleted_printer_name, g_free);
+ printer = pp_printer_new (self->deleted_printer_name);
+ g_clear_pointer (&self->deleted_printer_name, g_free);
pp_printer_delete_async (printer,
NULL,
@@ -278,7 +276,7 @@ cc_printers_panel_dispose (GObject *object)
NULL);
}
- g_clear_pointer (&priv->printer_entries, g_hash_table_destroy);
+ g_clear_pointer (&self->printer_entries, g_hash_table_destroy);
G_OBJECT_CLASS (cc_printers_panel_parent_class)->dispose (object);
}
@@ -301,8 +299,6 @@ cc_printers_panel_class_init (CcPrintersPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcPrintersPanelPrivate));
-
object_class->get_property = cc_printers_panel_get_property;
object_class->set_property = cc_printers_panel_set_property;
object_class->constructed = cc_printers_panel_constructed;
@@ -318,7 +314,6 @@ on_get_job_attributes_cb (GObject *source_object,
gpointer user_data)
{
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- CcPrintersPanelPrivate *priv;
const gchar *job_originating_user_name;
const gchar *job_printer_uri;
GVariant *attributes;
@@ -326,8 +321,6 @@ on_get_job_attributes_cb (GObject *source_object,
GVariant *printer_uri;
GError *error = NULL;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
attributes = pp_job_get_attributes_finish (PP_JOB (source_object), res, &error);
g_object_unref (source_object);
@@ -343,13 +336,13 @@ on_get_job_attributes_cb (GObject *source_object,
if (job_originating_user_name != NULL && job_printer_uri != NULL &&
g_strcmp0 (job_originating_user_name, cupsUser ()) == 0 &&
g_strrstr (job_printer_uri, "/") != 0 &&
- priv->dests != NULL)
+ self->dests != NULL)
{
PpPrinterEntry *printer_entry;
gchar *printer_name;
printer_name = g_strrstr (job_printer_uri, "/") + 1;
- printer_entry = PP_PRINTER_ENTRY (g_hash_table_lookup (priv->printer_entries, printer_name));
+ printer_entry = PP_PRINTER_ENTRY (g_hash_table_lookup (self->printer_entries, printer_name));
pp_printer_entry_update_jobs_count (printer_entry);
}
@@ -458,7 +451,6 @@ renew_subscription_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
PpCups *cups = PP_CUPS (source_object);
gint subscription_id;
@@ -467,28 +459,21 @@ renew_subscription_cb (GObject *source_object,
g_object_unref (source_object);
if (subscription_id > 0)
- {
- priv = self->priv;
-
- priv->subscription_id = subscription_id;
- }
+ self->subscription_id = subscription_id;
}
static gboolean
renew_subscription (gpointer data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) data;
PpCups *cups;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
cups = pp_cups_new ();
pp_cups_renew_subscription_async (cups,
- priv->subscription_id,
+ self->subscription_id,
subscription_events,
SUBSCRIPTION_DURATION,
- priv->subscription_renew_cancellable,
+ self->subscription_renew_cancellable,
renew_subscription_cb,
data);
@@ -500,7 +485,6 @@ attach_to_cups_notifier_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
PpCups *cups = PP_CUPS (source_object);
GError *error = NULL;
@@ -511,14 +495,12 @@ attach_to_cups_notifier_cb (GObject *source_object,
if (subscription_id > 0)
{
- priv = self->priv;
-
- priv->subscription_id = subscription_id;
+ self->subscription_id = subscription_id;
- priv->subscription_renewal_id =
+ self->subscription_renewal_id =
g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription, self);
- priv->cups_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ self->cups_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
0,
NULL,
CUPS_DBUS_NAME,
@@ -527,17 +509,17 @@ attach_to_cups_notifier_cb (GObject *source_object,
NULL,
&error);
- if (!priv->cups_proxy)
+ if (!self->cups_proxy)
{
g_warning ("%s", error->message);
g_error_free (error);
return;
}
- priv->cups_bus_connection = g_dbus_proxy_get_connection (priv->cups_proxy);
+ self->cups_bus_connection = g_dbus_proxy_get_connection (self->cups_proxy);
- priv->dbus_subscription_id =
- g_dbus_connection_signal_subscribe (priv->cups_bus_connection,
+ self->dbus_subscription_id =
+ g_dbus_connection_signal_subscribe (self->cups_bus_connection,
NULL,
CUPS_DBUS_INTERFACE,
NULL,
@@ -553,18 +535,15 @@ attach_to_cups_notifier_cb (GObject *source_object,
static void
attach_to_cups_notifier (gpointer data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) data;
PpCups *cups;
- priv = self->priv;
-
cups = pp_cups_new ();
pp_cups_renew_subscription_async (cups,
- priv->subscription_id,
+ self->subscription_id,
subscription_events,
SUBSCRIPTION_DURATION,
- priv->subscription_renew_cancellable,
+ self->subscription_renew_cancellable,
attach_to_cups_notifier_cb,
data);
}
@@ -583,79 +562,65 @@ subscription_cancel_cb (GObject *source_object,
static void
detach_from_cups_notifier (gpointer data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) data;
PpCups *cups;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- if (priv->dbus_subscription_id != 0) {
- g_dbus_connection_signal_unsubscribe (priv->cups_bus_connection,
- priv->dbus_subscription_id);
- priv->dbus_subscription_id = 0;
+ if (self->dbus_subscription_id != 0) {
+ g_dbus_connection_signal_unsubscribe (self->cups_bus_connection,
+ self->dbus_subscription_id);
+ self->dbus_subscription_id = 0;
}
cups = pp_cups_new ();
pp_cups_cancel_subscription_async (cups,
- priv->subscription_id,
+ self->subscription_id,
subscription_cancel_cb,
NULL);
- priv->subscription_id = 0;
+ self->subscription_id = 0;
- if (priv->subscription_renewal_id != 0) {
- g_source_remove (priv->subscription_renewal_id);
- priv->subscription_renewal_id = 0;
+ if (self->subscription_renewal_id != 0) {
+ g_source_remove (self->subscription_renewal_id);
+ self->subscription_renewal_id = 0;
}
- if (priv->cups_proxy != NULL) {
- g_object_unref (priv->cups_proxy);
- priv->cups_proxy = NULL;
+ if (self->cups_proxy != NULL) {
+ g_object_unref (self->cups_proxy);
+ self->cups_proxy = NULL;
}
}
static void
free_dests (CcPrintersPanel *self)
{
- CcPrintersPanelPrivate *priv;
-
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- if (priv->num_dests > 0)
+ if (self->num_dests > 0)
{
- cupsFreeDests (priv->num_dests, priv->dests);
+ cupsFreeDests (self->num_dests, self->dests);
}
- priv->dests = NULL;
- priv->num_dests = 0;
+ self->dests = NULL;
+ self->num_dests = 0;
}
static void
cancel_notification_timeout (CcPrintersPanel *self)
{
- CcPrintersPanelPrivate *priv;
-
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- if (priv->remove_printer_timeout_id == 0)
+ if (self->remove_printer_timeout_id == 0)
return;
- g_source_remove (priv->remove_printer_timeout_id);
+ g_source_remove (self->remove_printer_timeout_id);
- priv->remove_printer_timeout_id = 0;
+ self->remove_printer_timeout_id = 0;
}
static void
on_printer_deletion_undone (GtkButton *button,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- gtk_revealer_set_reveal_child (priv->notification, FALSE);
+ gtk_revealer_set_reveal_child (self->notification, FALSE);
- g_clear_pointer (&priv->deleted_printer_name, g_free);
+ g_clear_pointer (&self->deleted_printer_name, g_free);
actualize_printers_list (self);
cancel_notification_timeout (self);
@@ -665,25 +630,22 @@ static void
on_notification_dismissed (GtkButton *button,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- if (priv->deleted_printer_name != NULL)
+ if (self->deleted_printer_name != NULL)
{
PpPrinter *printer;
- printer = pp_printer_new (priv->deleted_printer_name);
+ printer = pp_printer_new (self->deleted_printer_name);
pp_printer_delete_async (printer,
NULL,
printer_removed_cb,
NULL);
- g_clear_pointer (&priv->deleted_printer_name, g_free);
+ g_clear_pointer (&self->deleted_printer_name, g_free);
}
- gtk_revealer_set_reveal_child (priv->notification, FALSE);
+ gtk_revealer_set_reveal_child (self->notification, FALSE);
}
static gboolean
@@ -698,7 +660,6 @@ static void
on_printer_deleted (PpPrinterEntry *printer_entry,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkLabel *label;
gchar *notification_message;
@@ -706,8 +667,6 @@ on_printer_deleted (PpPrinterEntry *printer_entry,
gtk_widget_hide (GTK_WIDGET (printer_entry));
- priv = PRINTERS_PANEL_PRIVATE (self);
-
on_notification_dismissed (NULL, self);
g_object_get (printer_entry,
@@ -718,17 +677,17 @@ on_printer_deleted (PpPrinterEntry *printer_entry,
notification_message = g_strdup_printf (_("Printer “%s” has been deleted"),
printer_name);
label = (GtkLabel*)
- gtk_builder_get_object (priv->builder, "notification-label");
+ gtk_builder_get_object (self->builder, "notification-label");
gtk_label_set_label (label, notification_message);
g_free (notification_message);
- priv->deleted_printer_name = g_strdup (printer_name);
+ self->deleted_printer_name = g_strdup (printer_name);
g_free (printer_name);
- gtk_revealer_set_reveal_child (priv->notification, TRUE);
+ gtk_revealer_set_reveal_child (self->notification, TRUE);
- priv->remove_printer_timeout_id = g_timeout_add_seconds (10, on_remove_printer_timeout, self);
+ self->remove_printer_timeout_id = g_timeout_add_seconds (10, on_remove_printer_timeout, self);
}
static void
@@ -742,20 +701,17 @@ static void
add_printer_entry (CcPrintersPanel *self,
cups_dest_t printer)
{
- CcPrintersPanelPrivate *priv;
PpPrinterEntry *printer_entry;
GtkWidget *content;
GSList *widgets, *l;
- priv = PRINTERS_PANEL_PRIVATE (self);
+ content = (GtkWidget*) gtk_builder_get_object (self->builder, "content");
- content = (GtkWidget*) gtk_builder_get_object (priv->builder, "content");
-
- printer_entry = pp_printer_entry_new (printer, priv->is_authorized);
+ printer_entry = pp_printer_entry_new (printer, self->is_authorized);
widgets = pp_printer_entry_get_size_group_widgets (printer_entry);
for (l = widgets; l != NULL; l = l->next)
- gtk_size_group_add_widget (priv->size_group, GTK_WIDGET (l->data));
+ gtk_size_group_add_widget (self->size_group, GTK_WIDGET (l->data));
g_slist_free (widgets);
g_signal_connect (printer_entry,
@@ -770,7 +726,7 @@ add_printer_entry (CcPrintersPanel *self,
gtk_list_box_insert (GTK_LIST_BOX (content), GTK_WIDGET (printer_entry), -1);
gtk_widget_show_all (content);
- g_hash_table_insert (priv->printer_entries, g_strdup (printer.name), printer_entry);
+ g_hash_table_insert (self->printer_entries, g_strdup (printer.name), printer_entry);
}
static void
@@ -796,7 +752,6 @@ actualize_printers_list_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkWidget *widget;
PpCups *cups = PP_CUPS (source_object);
@@ -817,41 +772,36 @@ actualize_printers_list_cb (GObject *source_object,
return;
}
- priv = PRINTERS_PANEL_PRIVATE (self);
-
free_dests (self);
- priv->dests = cups_dests->dests;
- priv->num_dests = cups_dests->num_of_dests;
+ self->dests = cups_dests->dests;
+ self->num_dests = cups_dests->num_of_dests;
g_free (cups_dests);
- widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "main-vbox");
- if (priv->num_dests == 0 && !priv->new_printer_name)
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder, "main-vbox");
+ if (self->num_dests == 0 && !self->new_printer_name)
pp_cups_connection_test_async (g_object_ref (cups), set_current_page, widget);
else
gtk_stack_set_visible_child_name (GTK_STACK (widget), "printers-list");
- widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "content");
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder, "content");
gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_destroy, NULL);
- for (i = 0; i < priv->num_dests; i++)
+ for (i = 0; i < self->num_dests; i++)
{
- if (g_strcmp0 (priv->dests[i].name, priv->deleted_printer_name) == 0)
+ if (g_strcmp0 (self->dests[i].name, self->deleted_printer_name) == 0)
continue;
- add_printer_entry (self, priv->dests[i]);
+ add_printer_entry (self, self->dests[i]);
}
}
static void
actualize_printers_list (CcPrintersPanel *self)
{
- CcPrintersPanelPrivate *priv;
PpCups *cups;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
cups = pp_cups_new ();
pp_cups_get_dests_async (cups,
- priv->actualize_printers_list_cancellable,
+ self->actualize_printers_list_cancellable,
actualize_printers_list_cb,
self);
}
@@ -864,15 +814,12 @@ new_printer_dialog_pre_response_cb (PpNewPrinterDialog *dialog,
gboolean is_network_device,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- priv->new_printer_name = g_strdup (device_name);
- priv->new_printer_location = g_strdup (device_location);
- priv->new_printer_make_and_model = g_strdup (device_make_and_model);
- priv->new_printer_on_network = is_network_device;
+ self->new_printer_name = g_strdup (device_name);
+ self->new_printer_location = g_strdup (device_location);
+ self->new_printer_make_and_model = g_strdup (device_make_and_model);
+ self->new_printer_on_network = is_network_device;
actualize_printers_list (self);
}
@@ -882,20 +829,17 @@ new_printer_dialog_response_cb (PpNewPrinterDialog *dialog,
gint response_id,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkScrolledWindow *scrolled_window;
GtkAllocation allocation;
GtkAdjustment *adjustment;
GtkWidget *printer_entry;
- priv = PRINTERS_PANEL_PRIVATE (self);
+ if (self->pp_new_printer_dialog)
+ g_clear_object (&self->pp_new_printer_dialog);
- if (priv->pp_new_printer_dialog)
- g_clear_object (&priv->pp_new_printer_dialog);
-
- g_clear_pointer (&priv->new_printer_location, g_free);
- g_clear_pointer (&priv->new_printer_make_and_model, g_free);
+ g_clear_pointer (&self->new_printer_location, g_free);
+ g_clear_pointer (&self->new_printer_make_and_model, g_free);
if (response_id == GTK_RESPONSE_REJECT)
{
@@ -916,18 +860,18 @@ new_printer_dialog_response_cb (PpNewPrinterDialog *dialog,
actualize_printers_list (self);
- if (priv->new_printer_name == NULL)
+ if (self->new_printer_name == NULL)
return;
/* Scroll the view to show the newly added printer-entry. */
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (priv->builder,
+ scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (self->builder,
"scrolled-window"));
adjustment = gtk_scrolled_window_get_vadjustment (scrolled_window);
- printer_entry = GTK_WIDGET (g_hash_table_lookup (priv->printer_entries,
- priv->new_printer_name));
+ printer_entry = GTK_WIDGET (g_hash_table_lookup (self->printer_entries,
+ self->new_printer_name));
gtk_widget_get_allocation (printer_entry, &allocation);
- g_clear_pointer (&priv->new_printer_name, g_free);
+ g_clear_pointer (&self->new_printer_name, g_free);
gtk_adjustment_set_value (adjustment,
allocation.y - gtk_widget_get_margin_top (printer_entry));
@@ -937,23 +881,20 @@ static void
printer_add_cb (GtkToolButton *toolbutton,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkWidget *toplevel;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
- priv->pp_new_printer_dialog = PP_NEW_PRINTER_DIALOG (
+ self->pp_new_printer_dialog = PP_NEW_PRINTER_DIALOG (
pp_new_printer_dialog_new (GTK_WINDOW (toplevel),
- priv->all_ppds_list));
+ self->all_ppds_list));
- g_signal_connect (priv->pp_new_printer_dialog,
+ g_signal_connect (self->pp_new_printer_dialog,
"pre-response",
G_CALLBACK (new_printer_dialog_pre_response_cb),
self);
- g_signal_connect (priv->pp_new_printer_dialog,
+ g_signal_connect (self->pp_new_printer_dialog,
"response",
G_CALLBACK (new_printer_dialog_response_cb),
self);
@@ -962,25 +903,22 @@ printer_add_cb (GtkToolButton *toolbutton,
static void
update_sensitivity (gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
const char *cups_server = NULL;
GtkWidget *widget;
gboolean local_server = TRUE;
gboolean no_cups = FALSE;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
- priv->is_authorized =
- priv->permission &&
- g_permission_get_allowed (G_PERMISSION (priv->permission)) &&
- priv->lockdown_settings &&
- !g_settings_get_boolean (priv->lockdown_settings, "disable-print-setup");
+ self->is_authorized =
+ self->permission &&
+ g_permission_get_allowed (G_PERMISSION (self->permission)) &&
+ self->lockdown_settings &&
+ !g_settings_get_boolean (self->lockdown_settings, "disable-print-setup");
- gtk_stack_set_visible_child_name (GTK_STACK (priv->headerbar_buttons),
- priv->is_authorized ? PAGE_ADDPRINTER : PAGE_LOCK);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->headerbar_buttons),
+ self->is_authorized ? PAGE_ADDPRINTER : PAGE_LOCK);
- widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "main-vbox");
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder, "main-vbox");
if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (widget)), "no-cups-page") == 0)
no_cups = TRUE;
@@ -992,11 +930,11 @@ update_sensitivity (gpointer user_data)
cups_server[0] != '/')
local_server = FALSE;
- widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-add-button");
- gtk_widget_set_sensitive (widget, local_server && priv->is_authorized && !no_cups && !priv->new_printer_name);
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder, "printer-add-button");
+ gtk_widget_set_sensitive (widget, local_server && self->is_authorized && !no_cups && !self->new_printer_name);
- widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-add-button2");
- gtk_widget_set_sensitive (widget, local_server && priv->is_authorized && !no_cups && !priv->new_printer_name);
+ widget = (GtkWidget*) gtk_builder_get_object (self->builder, "printer-add-button2");
+ gtk_widget_set_sensitive (widget, local_server && self->is_authorized && !no_cups && !self->new_printer_name);
}
static void
@@ -1013,21 +951,18 @@ on_lockdown_settings_changed (GSettings *settings,
const char *key,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
if (g_str_equal (key, "disable-print-setup") == FALSE)
return;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
#if 0
/* FIXME */
- gtk_widget_set_sensitive (priv->lock_button,
- !g_settings_get_boolean (priv->lockdown_settings, "disable-print-setup"));
+ gtk_widget_set_sensitive (self->lock_button,
+ !g_settings_get_boolean (self->lockdown_settings, "disable-print-setup"));
#endif
- on_permission_changed (priv->permission, NULL, user_data);
+ on_permission_changed (self->permission, NULL, user_data);
}
static void
@@ -1035,21 +970,18 @@ cups_status_check_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
gboolean success;
PpCups *cups = PP_CUPS (source_object);
- priv = self->priv;
-
success = pp_cups_connection_test_finish (cups, result);
if (success)
{
actualize_printers_list (self);
attach_to_cups_notifier (self);
- g_source_remove (priv->cups_status_check_id);
- priv->cups_status_check_id = 0;
+ g_source_remove (self->cups_status_check_id);
+ self->cups_status_check_id = 0;
}
g_object_unref (cups);
@@ -1058,16 +990,13 @@ cups_status_check_cb (GObject *source_object,
static gboolean
cups_status_check (gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
PpCups *cups;
- priv = self->priv;
-
cups = pp_cups_new ();
pp_cups_connection_test_async (cups, cups_status_check_cb, self);
- return priv->cups_status_check_id != 0;
+ return self->cups_status_check_id != 0;
}
static void
@@ -1075,17 +1004,14 @@ connection_test_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
gboolean success;
PpCups *cups = PP_CUPS (source_object);
- priv = self->priv;
-
success = pp_cups_connection_test_finish (cups, result);
if (!success)
{
- priv->cups_status_check_id =
+ self->cups_status_check_id =
g_timeout_add_seconds (CUPS_STATUS_CHECK_INTERVAL, cups_status_check, self);
}
@@ -1096,30 +1022,26 @@ static void
get_all_ppds_async_cb (PPDList *ppds,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- priv = self->priv = PRINTERS_PANEL_PRIVATE (self);
+ self->all_ppds_list = ppds;
- priv->all_ppds_list = ppds;
+ if (self->pp_ppd_selection_dialog)
+ pp_ppd_selection_dialog_set_ppd_list (self->pp_ppd_selection_dialog,
+ self->all_ppds_list);
- if (priv->pp_ppd_selection_dialog)
- pp_ppd_selection_dialog_set_ppd_list (priv->pp_ppd_selection_dialog,
- priv->all_ppds_list);
+ if (self->pp_new_printer_dialog)
+ pp_new_printer_dialog_set_ppd_list (self->pp_new_printer_dialog,
+ self->all_ppds_list);
- if (priv->pp_new_printer_dialog)
- pp_new_printer_dialog_set_ppd_list (priv->pp_new_printer_dialog,
- priv->all_ppds_list);
-
- g_object_unref (priv->get_all_ppds_cancellable);
- priv->get_all_ppds_cancellable = NULL;
+ g_object_unref (self->get_all_ppds_cancellable);
+ self->get_all_ppds_cancellable = NULL;
}
static gboolean
filter_function (GtkListBoxRow *row,
gpointer user_data)
{
- CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkWidget *search_entry;
gboolean retval;
@@ -1129,10 +1051,8 @@ filter_function (GtkListBoxRow *row,
gchar *printer_name;
gchar *printer_location;
- priv = PRINTERS_PANEL_PRIVATE (self);
-
search_entry = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "search-entry");
+ gtk_builder_get_object (self->builder, "search-entry");
if (gtk_entry_get_text_length (GTK_ENTRY (search_entry)) == 0)
return TRUE;
@@ -1165,7 +1085,6 @@ filter_function (GtkListBoxRow *row,
static void
cc_printers_panel_init (CcPrintersPanel *self)
{
- CcPrintersPanelPrivate *priv;
GtkWidget *top_widget;
GtkWidget *widget;
PpCups *cups;
@@ -1173,45 +1092,44 @@ cc_printers_panel_init (CcPrintersPanel *self)
gchar *objects[] = { "overlay", "headerbar-buttons", "search-button", NULL };
guint builder_result;
- priv = self->priv = PRINTERS_PANEL_PRIVATE (self);
g_resources_register (cc_printers_get_resource ());
/* initialize main data structure */
- priv->builder = gtk_builder_new ();
- priv->dests = NULL;
- priv->num_dests = 0;
+ self->builder = gtk_builder_new ();
+ self->dests = NULL;
+ self->num_dests = 0;
- priv->pp_new_printer_dialog = NULL;
+ self->pp_new_printer_dialog = NULL;
- priv->subscription_id = 0;
- priv->cups_status_check_id = 0;
- priv->subscription_renewal_id = 0;
- priv->cups_proxy = NULL;
- priv->cups_bus_connection = NULL;
- priv->dbus_subscription_id = 0;
- priv->remove_printer_timeout_id = 0;
+ self->subscription_id = 0;
+ self->cups_status_check_id = 0;
+ self->subscription_renewal_id = 0;
+ self->cups_proxy = NULL;
+ self->cups_bus_connection = NULL;
+ self->dbus_subscription_id = 0;
+ self->remove_printer_timeout_id = 0;
- priv->new_printer_name = NULL;
- priv->new_printer_location = NULL;
- priv->new_printer_make_and_model = NULL;
- priv->new_printer_on_network = FALSE;
+ self->new_printer_name = NULL;
+ self->new_printer_location = NULL;
+ self->new_printer_make_and_model = NULL;
+ self->new_printer_on_network = FALSE;
- priv->renamed_printer_name = NULL;
- priv->deleted_printer_name = NULL;
+ self->renamed_printer_name = NULL;
+ self->deleted_printer_name = NULL;
- priv->permission = NULL;
- priv->lockdown_settings = NULL;
+ self->permission = NULL;
+ self->lockdown_settings = NULL;
- priv->all_ppds_list = NULL;
+ self->all_ppds_list = NULL;
- priv->printer_entries = g_hash_table_new_full (g_str_hash,
+ self->printer_entries = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
NULL);
- priv->actualize_printers_list_cancellable = g_cancellable_new ();
+ self->actualize_printers_list_cancellable = g_cancellable_new ();
- builder_result = gtk_builder_add_objects_from_resource (priv->builder,
+ builder_result = gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/printers/printers.ui",
objects, &error);
@@ -1224,78 +1142,78 @@ cc_printers_panel_init (CcPrintersPanel *self)
}
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "headerbar-buttons");
- priv->headerbar_buttons = widget;
+ gtk_builder_get_object (self->builder, "headerbar-buttons");
+ self->headerbar_buttons = widget;
- priv->notification = (GtkRevealer*)
- gtk_builder_get_object (priv->builder, "notification");
+ self->notification = (GtkRevealer*)
+ gtk_builder_get_object (self->builder, "notification");
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "notification-undo-button");
+ gtk_builder_get_object (self->builder, "notification-undo-button");
g_signal_connect (widget, "clicked", G_CALLBACK (on_printer_deletion_undone), self);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "notification-dismiss-button");
+ gtk_builder_get_object (self->builder, "notification-dismiss-button");
g_signal_connect (widget, "clicked", G_CALLBACK (on_notification_dismissed), self);
/* add the top level widget */
top_widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "overlay");
+ gtk_builder_get_object (self->builder, "overlay");
/* connect signals */
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "printer-add-button");
+ gtk_builder_get_object (self->builder, "printer-add-button");
g_signal_connect (widget, "clicked", G_CALLBACK (printer_add_cb), self);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "printer-add-button2");
+ gtk_builder_get_object (self->builder, "printer-add-button2");
g_signal_connect (widget, "clicked", G_CALLBACK (printer_add_cb), self);
widget = (GtkWidget*)
- gtk_builder_get_object (priv->builder, "content");
+ gtk_builder_get_object (self->builder, "content");
gtk_list_box_set_filter_func (GTK_LIST_BOX (widget),
filter_function,
self,
NULL);
- g_signal_connect_swapped (gtk_builder_get_object (priv->builder, "search-entry"),
+ g_signal_connect_swapped (gtk_builder_get_object (self->builder, "search-entry"),
"search-changed",
G_CALLBACK (gtk_list_box_invalidate_filter),
widget);
- priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
- if (priv->lockdown_settings)
- g_signal_connect_object (priv->lockdown_settings,
+ self->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
+ if (self->lockdown_settings)
+ g_signal_connect_object (self->lockdown_settings,
"changed",
G_CALLBACK (on_lockdown_settings_changed),
self,
G_CONNECT_AFTER);
/* Add unlock button */
- priv->permission = (GPermission *)polkit_permission_new_sync (
+ self->permission = (GPermission *)polkit_permission_new_sync (
"org.opensuse.cupspkhelper.mechanism.all-edit", NULL, NULL, NULL);
- if (priv->permission != NULL)
+ if (self->permission != NULL)
{
- g_signal_connect_object (priv->permission,
+ g_signal_connect_object (self->permission,
"notify",
G_CALLBACK (on_permission_changed),
self,
G_CONNECT_AFTER);
- on_permission_changed (priv->permission, NULL, self);
+ on_permission_changed (self->permission, NULL, self);
}
else
g_warning ("Your system does not have the cups-pk-helper's policy \
\"org.opensuse.cupspkhelper.mechanism.all-edit\" installed. \
Please check your installation");
- priv->subscription_renew_cancellable = g_cancellable_new ();
+ self->subscription_renew_cancellable = g_cancellable_new ();
- priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
actualize_printers_list (self);
attach_to_cups_notifier (self);
- priv->get_all_ppds_cancellable = g_cancellable_new ();
- get_all_ppds_async (priv->get_all_ppds_cancellable,
+ self->get_all_ppds_cancellable = g_cancellable_new ();
+ get_all_ppds_async (self->get_all_ppds_cancellable,
get_all_ppds_async_cb,
self);
diff --git a/panels/printers/cc-printers-panel.h b/panels/printers/cc-printers-panel.h
index 31beca83e..ed5abb29f 100644
--- a/panels/printers/cc-printers-panel.h
+++ b/panels/printers/cc-printers-panel.h
@@ -24,45 +24,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_PRINTERS_PANEL cc_printers_panel_get_type()
-
-#define CC_PRINTERS_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_PRINTERS_PANEL, CcPrintersPanel))
-
-#define CC_PRINTERS_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_PRINTERS_PANEL, CcPrintersPanelClass))
-
-#define CC_IS_PRINTERS_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_PRINTERS_PANEL))
-
-#define CC_IS_PRINTERS_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_PRINTERS_PANEL))
-
-#define CC_PRINTERS_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_PRINTERS_PANEL, CcPrintersPanelClass))
-
-typedef struct _CcPrintersPanel CcPrintersPanel;
-typedef struct _CcPrintersPanelClass CcPrintersPanelClass;
-typedef struct _CcPrintersPanelPrivate CcPrintersPanelPrivate;
-
-struct _CcPrintersPanel
-{
- CcPanel parent;
-
- CcPrintersPanelPrivate *priv;
-};
-
-struct _CcPrintersPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_printers_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_PRINTERS_PANEL (cc_printers_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcPrintersPanel, cc_printers_panel, CC, PRINTERS_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/printers/pp-cups.c b/panels/printers/pp-cups.c
index 0d0d4a52b..c100ee30b 100644
--- a/panels/printers/pp-cups.c
+++ b/panels/printers/pp-cups.c
@@ -29,6 +29,11 @@
#define ippGetStatusCode(ipp) ipp->request.status.status_code
#endif
+struct _PpCups
+{
+ GObject parent_instance;
+};
+
G_DEFINE_TYPE (PpCups, pp_cups, G_TYPE_OBJECT);
static void
diff --git a/panels/printers/pp-cups.h b/panels/printers/pp-cups.h
index 863ca0011..f3ee9e8d3 100644
--- a/panels/printers/pp-cups.h
+++ b/panels/printers/pp-cups.h
@@ -27,33 +27,14 @@
G_BEGIN_DECLS
-#define PP_TYPE_CUPS (pp_cups_get_type ())
-#define PP_CUPS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PP_TYPE_CUPS, PpCups))
-#define PP_CUPS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PP_TYPE_CUPS, PpCupsClass))
-#define PP_IS_CUPS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PP_TYPE_CUPS))
-#define PP_IS_CUPS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PP_TYPE_CUPS))
-#define PP_CUPS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PP_TYPE_CUPS, PpCupsClass))
+#define PP_TYPE_CUPS (pp_cups_get_type ())
+G_DECLARE_FINAL_TYPE (PpCups, pp_cups, PP, CUPS, GObject)
typedef struct{
cups_dest_t *dests;
gint num_of_dests;
} PpCupsDests;
-typedef struct _PpCups PpCups;
-typedef struct _PpCupsClass PpCupsClass;
-
-struct _PpCups
-{
- GObject parent_instance;
-};
-
-struct _PpCupsClass
-{
- GObjectClass parent_class;
-};
-
-GType pp_cups_get_type (void) G_GNUC_CONST;
-
PpCups *pp_cups_new (void);
void pp_cups_get_dests_async (PpCups *cups,
diff --git a/panels/printers/pp-details-dialog.h b/panels/printers/pp-details-dialog.h
index 266ce5afe..499f9dbbb 100644
--- a/panels/printers/pp-details-dialog.h
+++ b/panels/printers/pp-details-dialog.h
@@ -27,12 +27,7 @@
G_BEGIN_DECLS
#define PP_DETAILS_DIALOG_TYPE (pp_details_dialog_get_type ())
-#define PP_DETAILS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PP_DETAILS_DIALOG_TYPE, PpDetailsDialog))
-
-typedef struct _PpDetailsDialog PpDetailsDialog;
-typedef struct _PpDetailsDialogClass PpDetailsDialogClass;
-
-GType pp_details_dialog_get_type (void);
+G_DECLARE_FINAL_TYPE (PpDetailsDialog, pp_details_dialog, PP, DETAILS_DIALOG, GtkDialog)
PpDetailsDialog *pp_details_dialog_new (GtkWindow *parent,
gchar *printer_name,
diff --git a/panels/printers/pp-host.c b/panels/printers/pp-host.c
index 8af77e9a9..00b87bbb5 100644
--- a/panels/printers/pp-host.c
+++ b/panels/printers/pp-host.c
@@ -24,11 +24,11 @@
#define BUFFER_LENGTH 1024
-struct _PpHostPrivate
+typedef struct
{
- gchar *hostname;
- gint port;
-};
+ gchar *hostname;
+ gint port;
+} PpHostPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (PpHost, pp_host, G_TYPE_OBJECT);
@@ -48,9 +48,8 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void
pp_host_finalize (GObject *object)
{
- PpHostPrivate *priv;
-
- priv = PP_HOST (object)->priv;
+ PpHost *self = PP_HOST (object);
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
g_clear_pointer (&priv->hostname, g_free);
@@ -63,17 +62,16 @@ pp_host_get_property (GObject *object,
GValue *value,
GParamSpec *param_spec)
{
- PpHost *self;
-
- self = PP_HOST (object);
+ PpHost *self = PP_HOST (object);
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
switch (prop_id)
{
case PROP_HOSTNAME:
- g_value_set_string (value, self->priv->hostname);
+ g_value_set_string (value, priv->hostname);
break;
case PROP_PORT:
- g_value_set_int (value, self->priv->port);
+ g_value_set_int (value, priv->port);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -90,15 +88,16 @@ pp_host_set_property (GObject *object,
GParamSpec *param_spec)
{
PpHost *self = PP_HOST (object);
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
switch (prop_id)
{
case PROP_HOSTNAME:
- g_free (self->priv->hostname);
- self->priv->hostname = g_value_dup_string (value);
+ g_free (priv->hostname);
+ priv->hostname = g_value_dup_string (value);
break;
case PROP_PORT:
- self->priv->port = g_value_get_int (value);
+ priv->port = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -135,7 +134,7 @@ pp_host_class_init (PpHostClass *klass)
g_signal_new ("authentication-required",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PpHostClass, authentication_required),
+ 0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
@@ -143,10 +142,8 @@ pp_host_class_init (PpHostClass *klass)
static void
pp_host_init (PpHost *host)
{
- host->priv = G_TYPE_INSTANCE_GET_PRIVATE (host,
- PP_TYPE_HOST,
- PpHostPrivate);
- host->priv->port = PP_HOST_UNSET_PORT;
+ PpHostPrivate *priv = pp_host_get_instance_private (host);
+ priv->port = PP_HOST_UNSET_PORT;
}
PpHost *
@@ -252,7 +249,7 @@ _pp_host_get_snmp_devices_thread (GSimpleAsyncResult *res,
GCancellable *cancellable)
{
PpHost *host = (PpHost *) object;
- PpHostPrivate *priv = host->priv;
+ PpHostPrivate *priv = pp_host_get_instance_private (host);
PpPrintDevice *device;
gboolean is_network_device;
GSDData *data;
@@ -385,7 +382,7 @@ _pp_host_get_remote_cups_devices_thread (GSimpleAsyncResult *res,
cups_dest_t *dests = NULL;
GSDData *data;
PpHost *host = (PpHost *) object;
- PpHostPrivate *priv = host->priv;
+ PpHostPrivate *priv = pp_host_get_instance_private (host);
PpPrintDevice *device;
const char *device_location;
http_t *http;
@@ -506,14 +503,15 @@ jetdirect_connection_test_cb (GObject *source_object,
gpointer user_data)
{
GSocketConnection *connection;
- PpHostPrivate *priv;
PpPrintDevice *device;
JetDirectData *data;
gpointer result;
GError *error = NULL;
GTask *task = G_TASK (user_data);
+ PpHostPrivate *priv;
data = g_task_get_task_data (task);
+ priv = pp_host_get_instance_private (data->host);
connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object),
res,
@@ -526,8 +524,6 @@ jetdirect_connection_test_cb (GObject *source_object,
g_io_stream_close (G_IO_STREAM (connection), NULL, NULL);
g_object_unref (connection);
- priv = data->host->priv;
-
device_uri = g_strdup_printf ("socket://%s:%d",
priv->hostname,
data->port);
@@ -562,12 +558,12 @@ pp_host_get_jetdirect_devices_async (PpHost *host,
GAsyncReadyCallback callback,
gpointer user_data)
{
- PpHostPrivate *priv = host->priv;
GSocketClient *client;
JetDirectData *data;
GTask *task;
gchar *address;
gpointer result;
+ PpHostPrivate *priv = pp_host_get_instance_private (host);
data = g_new0 (JetDirectData, 1);
data->host = g_object_ref (host);
@@ -706,7 +702,7 @@ _pp_host_get_lpd_devices_thread (GTask *task,
GSocketConnection *connection;
PpPrintDevice *device;
PpHost *host = (PpHost *) source_object;
- PpHostPrivate *priv = host->priv;
+ PpHostPrivate *priv = pp_host_get_instance_private (host);
GSocketClient *client;
PpDevicesList *result;
GSDData *data = (GSDData *) task_data;
diff --git a/panels/printers/pp-host.h b/panels/printers/pp-host.h
index 9cdbfdda4..cc1410328 100644
--- a/panels/printers/pp-host.h
+++ b/panels/printers/pp-host.h
@@ -27,36 +27,18 @@
G_BEGIN_DECLS
-#define PP_TYPE_HOST (pp_host_get_type ())
-#define PP_HOST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PP_TYPE_HOST, PpHost))
-#define PP_HOST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PP_TYPE_HOST, PpHostClass))
-#define PP_IS_HOST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PP_TYPE_HOST))
-#define PP_IS_HOST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PP_TYPE_HOST))
-#define PP_HOST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PP_TYPE_HOST, PpHostClass))
-
-#define PP_HOST_UNSET_PORT -1
-#define PP_HOST_DEFAULT_IPP_PORT 631
-#define PP_HOST_DEFAULT_JETDIRECT_PORT 9100
-#define PP_HOST_DEFAULT_LPD_PORT 515
-
-typedef struct _PpHost PpHost;
-typedef struct _PpHostClass PpHostClass;
-typedef struct _PpHostPrivate PpHostPrivate;
-
-struct _PpHost
-{
- GObject parent_instance;
- PpHostPrivate *priv;
-};
+#define PP_TYPE_HOST (pp_host_get_type ())
+G_DECLARE_DERIVABLE_TYPE (PpHost, pp_host, PP, HOST, GObject)
struct _PpHostClass
{
GObjectClass parent_class;
-
- void (*authentication_required) (PpHost *host);
};
-GType pp_host_get_type (void) G_GNUC_CONST;
+#define PP_HOST_UNSET_PORT -1
+#define PP_HOST_DEFAULT_IPP_PORT 631
+#define PP_HOST_DEFAULT_JETDIRECT_PORT 9100
+#define PP_HOST_DEFAULT_LPD_PORT 515
PpHost *pp_host_new (const gchar *hostname);
diff --git a/panels/printers/pp-ipp-option-widget.c b/panels/printers/pp-ipp-option-widget.c
index 37e835a85..e02ec68b1 100644
--- a/panels/printers/pp-ipp-option-widget.c
+++ b/panels/printers/pp-ipp-option-widget.c
@@ -28,17 +28,16 @@
#include "pp-ipp-option-widget.h"
#include "pp-utils.h"
-#define PP_IPP_OPTION_WIDGET_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), PP_TYPE_IPP_OPTION_WIDGET, PpIPPOptionWidgetPrivate))
-
static void pp_ipp_option_widget_finalize (GObject *object);
static gboolean construct_widget (PpIPPOptionWidget *widget);
static void update_widget (PpIPPOptionWidget *widget);
static void update_widget_real (PpIPPOptionWidget *widget);
-struct PpIPPOptionWidgetPrivate
+struct _PpIPPOptionWidget
{
+ GtkBox parent_instance;
+
GtkWidget *switch_button;
GtkWidget *spin_button;
GtkWidget *combo;
@@ -102,77 +101,41 @@ pp_ipp_option_widget_class_init (PpIPPOptionWidgetClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->finalize = pp_ipp_option_widget_finalize;
-
- g_type_class_add_private (class, sizeof (PpIPPOptionWidgetPrivate));
}
static void
pp_ipp_option_widget_init (PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv;
-
gtk_orientable_set_orientation (GTK_ORIENTABLE (widget),
GTK_ORIENTATION_HORIZONTAL);
- priv = widget->priv = PP_IPP_OPTION_WIDGET_GET_PRIVATE (widget);
- priv->switch_button = NULL;
- priv->spin_button = NULL;
- priv->combo = NULL;
- priv->box = NULL;
+ widget->switch_button = NULL;
+ widget->spin_button = NULL;
+ widget->combo = NULL;
+ widget->box = NULL;
- priv->printer_name = NULL;
- priv->option_name = NULL;
+ widget->printer_name = NULL;
+ widget->option_name = NULL;
- priv->option_supported = NULL;
- priv->option_default = NULL;
+ widget->option_supported = NULL;
+ widget->option_default = NULL;
- priv->ipp_attribute = NULL;
+ widget->ipp_attribute = NULL;
}
static void
pp_ipp_option_widget_finalize (GObject *object)
{
PpIPPOptionWidget *widget = PP_IPP_OPTION_WIDGET (object);
- PpIPPOptionWidgetPrivate *priv = widget->priv;
-
- if (priv)
- {
- if (priv->option_name)
- {
- g_free (priv->option_name);
- priv->option_name = NULL;
- }
-
- if (priv->printer_name)
- {
- g_free (priv->printer_name);
- priv->printer_name = NULL;
- }
-
- if (priv->option_supported)
- {
- ipp_attribute_free (priv->option_supported);
- priv->option_supported = NULL;
- }
-
- if (priv->option_default)
- {
- ipp_attribute_free (priv->option_default);
- priv->option_default = NULL;
- }
-
- if (priv->ipp_attribute)
- {
- g_hash_table_unref (priv->ipp_attribute);
- priv->ipp_attribute = NULL;
- }
- if (priv->cancellable)
- {
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
- }
- }
+ g_clear_pointer (&widget->option_name, g_free);
+ g_clear_pointer (&widget->printer_name, g_free);
+ g_clear_pointer (&widget->option_supported, ipp_attribute_free);
+ g_clear_pointer (&widget->option_default, ipp_attribute_free);
+ g_clear_pointer (&widget->ipp_attribute, g_hash_table_unref);
+ if (widget->cancellable)
+ g_cancellable_cancel (widget->cancellable);
+ g_clear_object (&widget->cancellable);
G_OBJECT_CLASS (pp_ipp_option_widget_parent_class)->finalize (object);
}
@@ -183,19 +146,16 @@ pp_ipp_option_widget_new (IPPAttribute *attr_supported,
const gchar *option_name,
const gchar *printer)
{
- PpIPPOptionWidgetPrivate *priv;
PpIPPOptionWidget *widget = NULL;
if (attr_supported && option_name && printer)
{
widget = g_object_new (PP_TYPE_IPP_OPTION_WIDGET, NULL);
- priv = PP_IPP_OPTION_WIDGET_GET_PRIVATE (widget);
-
- priv->printer_name = g_strdup (printer);
- priv->option_name = g_strdup (option_name);
- priv->option_supported = ipp_attribute_copy (attr_supported);
- priv->option_default = ipp_attribute_copy (attr_default);
+ widget->printer_name = g_strdup (printer);
+ widget->option_name = g_strdup (option_name);
+ widget->option_supported = ipp_attribute_copy (attr_supported);
+ widget->option_default = ipp_attribute_copy (attr_default);
if (construct_widget (widget))
{
@@ -318,10 +278,9 @@ printer_add_option_async_cb (gboolean success,
gpointer user_data)
{
PpIPPOptionWidget *widget = (PpIPPOptionWidget *) user_data;
- PpIPPOptionWidgetPrivate *priv = widget->priv;
update_widget (user_data);
- g_clear_object (&priv->cancellable);
+ g_clear_object (&widget->cancellable);
}
static void
@@ -329,7 +288,6 @@ switch_changed_cb (GtkWidget *switch_button,
GParamSpec *pspec,
PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
gchar **values;
values = g_new0 (gchar *, 2);
@@ -339,18 +297,18 @@ switch_changed_cb (GtkWidget *switch_button,
else
values[0] = g_strdup ("False");
- if (priv->cancellable)
+ if (widget->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
+ g_cancellable_cancel (widget->cancellable);
+ g_object_unref (widget->cancellable);
}
- priv->cancellable = g_cancellable_new ();
- printer_add_option_async (priv->printer_name,
- priv->option_name,
+ widget->cancellable = g_cancellable_new ();
+ printer_add_option_async (widget->printer_name,
+ widget->option_name,
values,
TRUE,
- priv->cancellable,
+ widget->cancellable,
printer_add_option_async_cb,
widget);
@@ -361,24 +319,23 @@ static void
combo_changed_cb (GtkWidget *combo,
PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = combo_box_get (combo);
- if (priv->cancellable)
+ if (widget->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
+ g_cancellable_cancel (widget->cancellable);
+ g_object_unref (widget->cancellable);
}
- priv->cancellable = g_cancellable_new ();
- printer_add_option_async (priv->printer_name,
- priv->option_name,
+ widget->cancellable = g_cancellable_new ();
+ printer_add_option_async (widget->printer_name,
+ widget->option_name,
values,
TRUE,
- priv->cancellable,
+ widget->cancellable,
printer_add_option_async_cb,
widget);
@@ -389,24 +346,23 @@ static void
spin_button_changed_cb (GtkWidget *spin_button,
PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button)));
- if (priv->cancellable)
+ if (widget->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
+ g_cancellable_cancel (widget->cancellable);
+ g_object_unref (widget->cancellable);
}
- priv->cancellable = g_cancellable_new ();
- printer_add_option_async (priv->printer_name,
- priv->option_name,
+ widget->cancellable = g_cancellable_new ();
+ printer_add_option_async (widget->printer_name,
+ widget->option_name,
values,
TRUE,
- priv->cancellable,
+ widget->cancellable,
printer_add_option_async_cb,
widget);
@@ -416,82 +372,81 @@ spin_button_changed_cb (GtkWidget *spin_button,
static gboolean
construct_widget (PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
gboolean trivial_option = FALSE;
gboolean result = FALSE;
gchar *value;
gint i;
- if (priv->option_supported)
+ if (widget->option_supported)
{
- switch (priv->option_supported->attribute_type)
+ switch (widget->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_INTEGER:
- if (priv->option_supported->num_of_values <= 1)
+ if (widget->option_supported->num_of_values <= 1)
trivial_option = TRUE;
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- if (priv->option_supported->num_of_values <= 1)
+ if (widget->option_supported->num_of_values <= 1)
trivial_option = TRUE;
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- if (priv->option_supported->attribute_values[0].lower_range ==
- priv->option_supported->attribute_values[0].upper_range)
+ if (widget->option_supported->attribute_values[0].lower_range ==
+ widget->option_supported->attribute_values[0].upper_range)
trivial_option = TRUE;
break;
}
if (!trivial_option)
{
- switch (priv->option_supported->attribute_type)
+ switch (widget->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_BOOLEAN:
- priv->switch_button = gtk_switch_new ();
+ widget->switch_button = gtk_switch_new ();
- gtk_box_pack_start (GTK_BOX (widget), priv->switch_button, FALSE, FALSE, 0);
- g_signal_connect (priv->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->switch_button, FALSE, FALSE, 0);
+ g_signal_connect (widget->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- priv->combo = combo_box_new ();
+ widget->combo = combo_box_new ();
- for (i = 0; i < priv->option_supported->num_of_values; i++)
+ for (i = 0; i < widget->option_supported->num_of_values; i++)
{
- value = g_strdup_printf ("%d", priv->option_supported->attribute_values[i].integer_value);
- combo_box_append (priv->combo,
- ipp_choice_translate (priv->option_name,
+ value = g_strdup_printf ("%d", widget->option_supported->attribute_values[i].integer_value);
+ combo_box_append (widget->combo,
+ ipp_choice_translate (widget->option_name,
value),
value);
g_free (value);
}
- gtk_box_pack_start (GTK_BOX (widget), priv->combo, FALSE, FALSE, 0);
- g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
+ g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- priv->combo = combo_box_new ();
+ widget->combo = combo_box_new ();
- for (i = 0; i < priv->option_supported->num_of_values; i++)
- combo_box_append (priv->combo,
- ipp_choice_translate (priv->option_name,
- priv->option_supported->attribute_values[i].string_value),
- priv->option_supported->attribute_values[i].string_value);
+ for (i = 0; i < widget->option_supported->num_of_values; i++)
+ combo_box_append (widget->combo,
+ ipp_choice_translate (widget->option_name,
+ widget->option_supported->attribute_values[i].string_value),
+ widget->option_supported->attribute_values[i].string_value);
- gtk_box_pack_start (GTK_BOX (widget), priv->combo, FALSE, FALSE, 0);
- g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
+ g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- priv->spin_button = gtk_spin_button_new_with_range (
- priv->option_supported->attribute_values[0].lower_range,
- priv->option_supported->attribute_values[0].upper_range,
+ widget->spin_button = gtk_spin_button_new_with_range (
+ widget->option_supported->attribute_values[0].lower_range,
+ widget->option_supported->attribute_values[0].upper_range,
1);
- gtk_box_pack_start (GTK_BOX (widget), priv->spin_button, FALSE, FALSE, 0);
- g_signal_connect (priv->spin_button, "value-changed", G_CALLBACK (spin_button_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->spin_button, FALSE, FALSE, 0);
+ g_signal_connect (widget->spin_button, "value-changed", G_CALLBACK (spin_button_changed_cb), widget);
break;
default:
@@ -508,95 +463,94 @@ construct_widget (PpIPPOptionWidget *widget)
static void
update_widget_real (PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
IPPAttribute *attr = NULL;
gchar *value;
gchar *attr_name;
- if (priv->option_default)
+ if (widget->option_default)
{
- attr = ipp_attribute_copy (priv->option_default);
+ attr = ipp_attribute_copy (widget->option_default);
- ipp_attribute_free (priv->option_default);
- priv->option_default = NULL;
+ ipp_attribute_free (widget->option_default);
+ widget->option_default = NULL;
}
- else if (priv->ipp_attribute)
+ else if (widget->ipp_attribute)
{
- attr_name = g_strdup_printf ("%s-default", priv->option_name);
- attr = ipp_attribute_copy (g_hash_table_lookup (priv->ipp_attribute, attr_name));
+ attr_name = g_strdup_printf ("%s-default", widget->option_name);
+ attr = ipp_attribute_copy (g_hash_table_lookup (widget->ipp_attribute, attr_name));
g_free (attr_name);
- g_hash_table_unref (priv->ipp_attribute);
- priv->ipp_attribute = NULL;
+ g_hash_table_unref (widget->ipp_attribute);
+ widget->ipp_attribute = NULL;
}
- switch (priv->option_supported->attribute_type)
+ switch (widget->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_BOOLEAN:
- g_signal_handlers_block_by_func (priv->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->switch_button, switch_changed_cb, widget);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_BOOLEAN)
{
- gtk_switch_set_active (GTK_SWITCH (priv->switch_button),
+ gtk_switch_set_active (GTK_SWITCH (widget->switch_button),
attr->attribute_values[0].boolean_value);
}
- g_signal_handlers_unblock_by_func (priv->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (widget->switch_button, switch_changed_cb, widget);
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- g_signal_handlers_block_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
{
value = g_strdup_printf ("%d", attr->attribute_values[0].integer_value);
- combo_box_set (priv->combo, value);
+ combo_box_set (widget->combo, value);
g_free (value);
}
else
{
- value = g_strdup_printf ("%d", priv->option_supported->attribute_values[0].integer_value);
- combo_box_set (priv->combo, value);
+ value = g_strdup_printf ("%d", widget->option_supported->attribute_values[0].integer_value);
+ combo_box_set (widget->combo, value);
g_free (value);
}
- g_signal_handlers_unblock_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- g_signal_handlers_block_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_STRING)
{
- combo_box_set (priv->combo, attr->attribute_values[0].string_value);
+ combo_box_set (widget->combo, attr->attribute_values[0].string_value);
}
else
{
- combo_box_set (priv->combo, priv->option_supported->attribute_values[0].string_value);
+ combo_box_set (widget->combo, widget->option_supported->attribute_values[0].string_value);
}
- g_signal_handlers_unblock_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- g_signal_handlers_block_by_func (priv->spin_button, spin_button_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->spin_button, spin_button_changed_cb, widget);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
{
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spin_button),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget->spin_button),
attr->attribute_values[0].integer_value);
}
else
{
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spin_button),
- priv->option_supported->attribute_values[0].lower_range);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget->spin_button),
+ widget->option_supported->attribute_values[0].lower_range);
}
- g_signal_handlers_unblock_by_func (priv->spin_button, spin_button_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (widget->spin_button, spin_button_changed_cb, widget);
break;
default:
@@ -611,12 +565,11 @@ get_ipp_attributes_cb (GHashTable *table,
gpointer user_data)
{
PpIPPOptionWidget *widget = (PpIPPOptionWidget *) user_data;
- PpIPPOptionWidgetPrivate *priv = widget->priv;
- if (priv->ipp_attribute)
- g_hash_table_unref (priv->ipp_attribute);
+ if (widget->ipp_attribute)
+ g_hash_table_unref (widget->ipp_attribute);
- priv->ipp_attribute = table;
+ widget->ipp_attribute = table;
update_widget_real (widget);
}
@@ -624,13 +577,12 @@ get_ipp_attributes_cb (GHashTable *table,
static void
update_widget (PpIPPOptionWidget *widget)
{
- PpIPPOptionWidgetPrivate *priv = widget->priv;
gchar **attributes_names;
attributes_names = g_new0 (gchar *, 2);
- attributes_names[0] = g_strdup_printf ("%s-default", priv->option_name);
+ attributes_names[0] = g_strdup_printf ("%s-default", widget->option_name);
- get_ipp_attributes_async (priv->printer_name,
+ get_ipp_attributes_async (widget->printer_name,
attributes_names,
get_ipp_attributes_cb,
widget);
diff --git a/panels/printers/pp-ipp-option-widget.h b/panels/printers/pp-ipp-option-widget.h
index f5dc2cac6..aa2ffbcb8 100644
--- a/panels/printers/pp-ipp-option-widget.h
+++ b/panels/printers/pp-ipp-option-widget.h
@@ -29,35 +29,8 @@
G_BEGIN_DECLS
-#define PP_TYPE_IPP_OPTION_WIDGET (pp_ipp_option_widget_get_type ())
-#define PP_IPP_OPTION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PP_TYPE_IPP_OPTION_WIDGET, PpIPPOptionWidget))
-#define PP_IPP_OPTION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PP_TYPE_IPP_OPTION_WIDGET, PpIPPOptionWidgetClass))
-#define PP_IS_IPP_OPTION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PP_TYPE_IPP_OPTION_WIDGET))
-#define PP_IS_IPP_OPTION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PP_TYPE_IPP_OPTION_WIDGET))
-#define PP_IPP_OPTION_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PP_TYPE_IPP_OPTION_WIDGET, PpIPPOptionWidgetClass))
-
-typedef struct _PpIPPOptionWidget PpIPPOptionWidget;
-typedef struct _PpIPPOptionWidgetClass PpIPPOptionWidgetClass;
-typedef struct PpIPPOptionWidgetPrivate PpIPPOptionWidgetPrivate;
-
-struct _PpIPPOptionWidget
-{
- GtkHBox parent_instance;
-
- PpIPPOptionWidgetPrivate *priv;
-};
-
-struct _PpIPPOptionWidgetClass
-{
- GtkHBoxClass parent_class;
-
- void (*changed) (PpIPPOptionWidget *widget);
-};
-
-typedef void (*IPPOptionCallback) (GtkWidget *widget,
- gpointer user_data);
-
-GType pp_ipp_option_widget_get_type (void) G_GNUC_CONST;
+#define PP_TYPE_IPP_OPTION_WIDGET (pp_ipp_option_widget_get_type ())
+G_DECLARE_FINAL_TYPE (PpIPPOptionWidget, pp_ipp_option_widget, PP, IPP_OPTION_WIDGET, GtkBox)
GtkWidget *pp_ipp_option_widget_new (IPPAttribute *attr_supported,
IPPAttribute *attr_default,
diff --git a/panels/printers/pp-job.c b/panels/printers/pp-job.c
index 730776064..762377409 100644
--- a/panels/printers/pp-job.c
+++ b/panels/printers/pp-job.c
@@ -43,16 +43,16 @@ ippGetRange (ipp_attribute_t *attr,
}
#endif
-typedef struct
+struct _PpJob
{
- GObject parent;
+ GObject parent_instance;
gint id;
gchar *title;
gint state;
-} PpJobPrivate;
+};
-G_DEFINE_TYPE_WITH_PRIVATE (PpJob, pp_job, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PpJob, pp_job, G_TYPE_OBJECT)
enum
{
@@ -180,20 +180,18 @@ pp_job_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- PpJobPrivate *priv;
-
- priv = pp_job_get_instance_private (PP_JOB (object));
+ PpJob *self = PP_JOB (object);
switch (property_id)
{
case PROP_ID:
- g_value_set_int (value, priv->id);
+ g_value_set_int (value, self->id);
break;
case PROP_TITLE:
- g_value_set_string (value, priv->title);
+ g_value_set_string (value, self->title);
break;
case PROP_STATE:
- g_value_set_int (value, priv->state);
+ g_value_set_int (value, self->state);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -207,21 +205,19 @@ pp_job_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- PpJobPrivate *priv;
-
- priv = pp_job_get_instance_private (PP_JOB (object));
+ PpJob *self = PP_JOB (object);
switch (property_id)
{
case PROP_ID:
- priv->id = g_value_get_int (value);
+ self->id = g_value_get_int (value);
break;
case PROP_TITLE:
- g_free (priv->title);
- priv->title = g_value_dup_string (value);
+ g_free (self->title);
+ self->title = g_value_dup_string (value);
break;
case PROP_STATE:
- priv->state = g_value_get_int (value);
+ self->state = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -232,11 +228,9 @@ pp_job_set_property (GObject *object,
static void
pp_job_finalize (GObject *object)
{
- PpJobPrivate *priv;
+ PpJob *self = PP_JOB (object);
- priv = pp_job_get_instance_private (PP_JOB (object));
-
- g_free (priv->title);
+ g_free (self->title);
G_OBJECT_CLASS (pp_job_parent_class)->finalize (object);
}
@@ -279,19 +273,17 @@ _pp_job_get_attributes_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
+ PpJob *self = PP_JOB (source_object);
ipp_attribute_t *attr = NULL;
GVariantBuilder builder;
GVariant *attributes = NULL;
gchar **attributes_names = task_data;
- PpJobPrivate *priv;
ipp_t *request;
ipp_t *response = NULL;
gchar *job_uri;
gint i, j, length = 0, n_attrs = 0;
- priv = pp_job_get_instance_private (source_object);
-
- job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", priv->id);
+ job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", self->id);
if (attributes_names != NULL)
{
diff --git a/panels/printers/pp-job.h b/panels/printers/pp-job.h
index ba6f46178..529581a44 100644
--- a/panels/printers/pp-job.h
+++ b/panels/printers/pp-job.h
@@ -31,11 +31,6 @@ G_BEGIN_DECLS
#define PP_TYPE_JOB (pp_job_get_type ())
G_DECLARE_FINAL_TYPE (PpJob, pp_job, PP, JOB, GObject)
-struct _PpJob
-{
- GObject parent_instance;
-};
-
void pp_job_set_hold_until_async (PpJob *job,
const gchar *job_hold_until);
diff --git a/panels/printers/pp-maintenance-command.c b/panels/printers/pp-maintenance-command.c
index e7073146b..60dea4d80 100644
--- a/panels/printers/pp-maintenance-command.c
+++ b/panels/printers/pp-maintenance-command.c
@@ -35,8 +35,10 @@
#define ippGetString(attr, element, language) attr->values[element].string.text
#endif
-struct _PpMaintenanceCommandPrivate
+struct _PpMaintenanceCommand
{
+ GObject parent_instance;
+
gchar *printer_name;
gchar *command;
gchar *parameters;
@@ -56,14 +58,12 @@ enum {
static void
pp_maintenance_command_finalize (GObject *object)
{
- PpMaintenanceCommandPrivate *priv;
-
- priv = PP_MAINTENANCE_COMMAND (object)->priv;
+ PpMaintenanceCommand *self = PP_MAINTENANCE_COMMAND (object);
- g_clear_pointer (&priv->printer_name, g_free);
- g_clear_pointer (&priv->command, g_free);
- g_clear_pointer (&priv->parameters, g_free);
- g_clear_pointer (&priv->title, g_free);
+ g_clear_pointer (&self->printer_name, g_free);
+ g_clear_pointer (&self->command, g_free);
+ g_clear_pointer (&self->parameters, g_free);
+ g_clear_pointer (&self->title, g_free);
G_OBJECT_CLASS (pp_maintenance_command_parent_class)->finalize (object);
}
@@ -74,23 +74,21 @@ pp_maintenance_command_get_property (GObject *object,
GValue *value,
GParamSpec *param_spec)
{
- PpMaintenanceCommand *self;
-
- self = PP_MAINTENANCE_COMMAND (object);
+ PpMaintenanceCommand *self = PP_MAINTENANCE_COMMAND (object);
switch (prop_id)
{
case PROP_PRINTER_NAME:
- g_value_set_string (value, self->priv->printer_name);
+ g_value_set_string (value, self->printer_name);
break;
case PROP_COMMAND:
- g_value_set_string (value, self->priv->command);
+ g_value_set_string (value, self->command);
break;
case PROP_PARAMETERS:
- g_value_set_string (value, self->priv->parameters);
+ g_value_set_string (value, self->parameters);
break;
case PROP_TITLE:
- g_value_set_string (value, self->priv->title);
+ g_value_set_string (value, self->title);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -111,20 +109,20 @@ pp_maintenance_command_set_property (GObject *object,
switch (prop_id)
{
case PROP_PRINTER_NAME:
- g_free (self->priv->printer_name);
- self->priv->printer_name = g_value_dup_string (value);
+ g_free (self->printer_name);
+ self->printer_name = g_value_dup_string (value);
break;
case PROP_COMMAND:
- g_free (self->priv->command);
- self->priv->command = g_value_dup_string (value);
+ g_free (self->command);
+ self->command = g_value_dup_string (value);
break;
case PROP_PARAMETERS:
- g_free (self->priv->parameters);
- self->priv->parameters = g_value_dup_string (value);
+ g_free (self->parameters);
+ self->parameters = g_value_dup_string (value);
break;
case PROP_TITLE:
- g_free (self->priv->title);
- self->priv->title = g_value_dup_string (value);
+ g_free (self->title);
+ self->title = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -139,8 +137,6 @@ pp_maintenance_command_class_init (PpMaintenanceCommandClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (PpMaintenanceCommandPrivate));
-
gobject_class->set_property = pp_maintenance_command_set_property;
gobject_class->get_property = pp_maintenance_command_get_property;
gobject_class->finalize = pp_maintenance_command_finalize;
@@ -177,9 +173,6 @@ pp_maintenance_command_class_init (PpMaintenanceCommandClass *klass)
static void
pp_maintenance_command_init (PpMaintenanceCommand *command)
{
- command->priv = G_TYPE_INSTANCE_GET_PRIVATE (command,
- PP_TYPE_MAINTENANCE_COMMAND,
- PpMaintenanceCommandPrivate);
}
PpMaintenanceCommand *
@@ -206,11 +199,10 @@ _pp_maintenance_command_execute_thread (GTask *task,
GCancellable *cancellable)
{
PpMaintenanceCommand *command = PP_MAINTENANCE_COMMAND (source_object);
- PpMaintenanceCommandPrivate *priv = command->priv;
gboolean success = FALSE;
GError *error = NULL;
- if (_pp_maintenance_command_is_supported (priv->printer_name, priv->command))
+ if (_pp_maintenance_command_is_supported (command->printer_name, command->command))
{
ipp_t *request;
ipp_t *response = NULL;
@@ -219,14 +211,14 @@ _pp_maintenance_command_execute_thread (GTask *task,
int fd = -1;
printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
- priv->printer_name);
+ command->printer_name);
request = ippNewRequest (IPP_PRINT_JOB);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
- "job-name", NULL, priv->title);
+ "job-name", NULL, command->title);
ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
"document-format", NULL, "application/vnd.cups-command");
@@ -238,9 +230,9 @@ _pp_maintenance_command_execute_thread (GTask *task,
file = fdopen (fd, "w");
fprintf (file, "#CUPS-COMMAND\n");
- fprintf (file, "%s", priv->command);
- if (priv->parameters)
- fprintf (file, " %s", priv->parameters);
+ fprintf (file, "%s", command->command);
+ if (command->parameters)
+ fprintf (file, " %s", command->parameters);
fprintf (file, "\n");
fclose (file);
@@ -377,10 +369,9 @@ _pp_maintenance_command_is_supported_thread (GTask *task,
GCancellable *cancellable)
{
PpMaintenanceCommand *command = PP_MAINTENANCE_COMMAND (source_object);
- PpMaintenanceCommandPrivate *priv = command->priv;
gboolean success = FALSE;
- success = _pp_maintenance_command_is_supported (priv->printer_name, priv->command);
+ success = _pp_maintenance_command_is_supported (command->printer_name, command->command);
g_task_return_boolean (task, success);
}
diff --git a/panels/printers/pp-maintenance-command.h b/panels/printers/pp-maintenance-command.h
index 5069a0120..5ba0a08d2 100644
--- a/panels/printers/pp-maintenance-command.h
+++ b/panels/printers/pp-maintenance-command.h
@@ -26,29 +26,8 @@
G_BEGIN_DECLS
-#define PP_TYPE_MAINTENANCE_COMMAND (pp_maintenance_command_get_type ())
-#define PP_MAINTENANCE_COMMAND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PP_TYPE_MAINTENANCE_COMMAND, PpMaintenanceCommand))
-#define PP_MAINTENANCE_COMMAND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PP_TYPE_MAINTENANCE_COMMAND, PpMaintenanceCommandClass))
-#define PP_IS_MAINTENANCE_COMMAND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PP_TYPE_MAINTENANCE_COMMAND))
-#define PP_IS_MAINTENANCE_COMMAND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PP_TYPE_MAINTENANCE_COMMAND))
-#define PP_MAINTENANCE_COMMAND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PP_TYPE_MAINTENANCE_COMMAND, PpMaintenanceCommandClass))
-
-typedef struct _PpMaintenanceCommand PpMaintenanceCommand;
-typedef struct _PpMaintenanceCommandClass PpMaintenanceCommandClass;
-typedef struct _PpMaintenanceCommandPrivate PpMaintenanceCommandPrivate;
-
-struct _PpMaintenanceCommand
-{
- GObject parent_instance;
- PpMaintenanceCommandPrivate *priv;
-};
-
-struct _PpMaintenanceCommandClass
-{
- GObjectClass parent_class;
-};
-
-GType pp_maintenance_command_get_type (void) G_GNUC_CONST;
+#define PP_TYPE_MAINTENANCE_COMMAND (pp_maintenance_command_get_type ())
+G_DECLARE_FINAL_TYPE (PpMaintenanceCommand, pp_maintenance_command, PP, MAINTENANCE_COMMAND, GObject)
PpMaintenanceCommand *pp_maintenance_command_new (const gchar *printer_name,
const gchar *command,
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 7a15a455f..6c3f46222 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -53,7 +53,7 @@
*/
#define HOST_SEARCH_DELAY (500 - 150)
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (priv->builder, s))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog->builder, s))
#define AUTHENTICATION_PAGE "authentication-page"
#define ADDPRINTER_PAGE "addprinter-page"
@@ -90,8 +90,10 @@ enum
DEVICE_N_COLUMNS
};
-struct _PpNewPrinterDialogPrivate
+struct _PpNewPrinterDialog
{
+ GObject parent_instance;
+
GtkBuilder *builder;
GList *local_cups_devices;
@@ -134,7 +136,7 @@ struct _PpNewPrinterDialogPrivate
guint host_search_timeout_id;
};
-#define PP_NEW_PRINTER_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PP_TYPE_NEW_PRINTER_DIALOG, PpNewPrinterDialogPrivate))
+G_DEFINE_TYPE (PpNewPrinterDialog, pp_new_printer_dialog, G_TYPE_OBJECT)
static void pp_new_printer_dialog_finalize (GObject *object);
@@ -146,8 +148,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (PpNewPrinterDialog, pp_new_printer_dialog, G_TYPE_OBJECT)
-
static void
pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
{
@@ -156,8 +156,6 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = pp_new_printer_dialog_finalize;
- g_type_class_add_private (object_class, sizeof (PpNewPrinterDialogPrivate));
-
/**
* PpNewPrinterDialog::pre-response:
* @device: the device that is being added
@@ -168,7 +166,7 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
g_signal_new ("pre-response",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PpNewPrinterDialogClass, pre_response),
+ 0,
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
@@ -183,7 +181,7 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
g_signal_new ("response",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PpNewPrinterDialogClass, response),
+ 0,
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 1, G_TYPE_INT);
@@ -194,18 +192,16 @@ PpNewPrinterDialog *
pp_new_printer_dialog_new (GtkWindow *parent,
PPDList *ppd_list)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog;
dialog = g_object_new (PP_TYPE_NEW_PRINTER_DIALOG, NULL);
- priv = dialog->priv;
- priv->list = ppd_list_copy (ppd_list);
- priv->parent = parent;
+ dialog->list = ppd_list_copy (ppd_list);
+ dialog->parent = parent;
- gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), GTK_WINDOW (parent));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (parent));
- gtk_widget_show_all (priv->dialog);
+ gtk_widget_show_all (dialog->dialog);
return PP_NEW_PRINTER_DIALOG (dialog);
}
@@ -214,12 +210,10 @@ void
pp_new_printer_dialog_set_ppd_list (PpNewPrinterDialog *dialog,
PPDList *list)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
-
- priv->list = ppd_list_copy (list);
+ dialog->list = ppd_list_copy (list);
- if (priv->ppd_selection_dialog)
- pp_ppd_selection_dialog_set_ppd_list (priv->ppd_selection_dialog, priv->list);
+ if (dialog->ppd_selection_dialog)
+ pp_ppd_selection_dialog_set_ppd_list (dialog->ppd_selection_dialog, dialog->list);
}
static void
@@ -256,7 +250,6 @@ get_authenticated_samba_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog;
PpDevicesList *result;
PpPrintDevice *device;
@@ -277,9 +270,8 @@ get_authenticated_samba_devices_cb (GObject *source_object,
if (result != NULL)
{
dialog = PP_NEW_PRINTER_DIALOG (data->dialog);
- priv = dialog->priv;
- priv->samba_authenticated_searching = FALSE;
+ dialog->samba_authenticated_searching = FALSE;
for (iter = result->devices; iter; iter = iter->next)
{
@@ -317,11 +309,10 @@ get_authenticated_samba_devices_cb (GObject *source_object,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
dialog = PP_NEW_PRINTER_DIALOG (data->dialog);
- priv = dialog->priv;
g_warning ("%s", error->message);
- priv->samba_authenticated_searching = FALSE;
+ dialog->samba_authenticated_searching = FALSE;
update_dialog_state (dialog);
}
@@ -336,7 +327,6 @@ static void
go_to_page (PpNewPrinterDialog *dialog,
const gchar *page)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkStack *stack;
stack = GTK_STACK (WID ("dialog-stack"));
@@ -353,8 +343,6 @@ static gchar *
get_entry_text (const gchar *object_name,
PpNewPrinterDialog *dialog)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
-
return g_strdup (gtk_entry_get_text (GTK_ENTRY (WID (object_name))));
}
@@ -363,7 +351,6 @@ on_authenticate (GtkWidget *button,
gpointer user_data)
{
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
- PpNewPrinterDialogPrivate *priv = dialog->priv;
gchar *hostname = NULL;
gchar *username = NULL;
gchar *password = NULL;
@@ -379,12 +366,12 @@ on_authenticate (GtkWidget *button,
return;
}
- pp_samba_set_auth_info (PP_SAMBA (priv->samba_host), username, password);
+ pp_samba_set_auth_info (PP_SAMBA (dialog->samba_host), username, password);
gtk_header_bar_set_title (GTK_HEADER_BAR (WID ("headerbar")), _("Add Printer"));
go_to_page (dialog, ADDPRINTER_PAGE);
- g_object_get (PP_HOST (priv->samba_host), "hostname", &hostname, NULL);
+ g_object_get (PP_HOST (dialog->samba_host), "hostname", &hostname, NULL);
remove_device_from_list (dialog, hostname);
}
@@ -392,12 +379,9 @@ static void
on_authentication_required (PpHost *host,
gpointer user_data)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
gchar *text, *hostname;
- priv = dialog->priv;
-
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (WID ("headerbar")), NULL);
gtk_header_bar_set_title (GTK_HEADER_BAR (WID ("headerbar")), _("Unlock Print Server"));
@@ -422,14 +406,11 @@ static void
auth_entries_changed (GtkEditable *editable,
gpointer user_data)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
gboolean can_authenticate = FALSE;
gchar *username = NULL;
gchar *password = NULL;
- priv = dialog->priv;
-
username = get_entry_text ("username-entry", dialog);
password = get_entry_text ("password-entry", dialog);
@@ -447,16 +428,15 @@ on_go_back_button_clicked (GtkButton *button,
gpointer user_data)
{
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
- PpNewPrinterDialogPrivate *priv = dialog->priv;
- pp_samba_set_auth_info (priv->samba_host, NULL, NULL);
- g_clear_object (&priv->samba_host);
+ pp_samba_set_auth_info (dialog->samba_host, NULL, NULL);
+ g_clear_object (&dialog->samba_host);
go_to_page (dialog, ADDPRINTER_PAGE);
gtk_header_bar_set_title (GTK_HEADER_BAR (WID ("headerbar")), _("Add Printer"));
gtk_widget_set_sensitive (WID ("new-printer-add-button"), FALSE);
- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (priv->treeview));
+ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (dialog->treeview));
}
static void
@@ -464,7 +444,6 @@ authenticate_samba_server (GtkButton *button,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeModel *model;
GtkTreeIter iter;
AuthSMBData *data;
@@ -474,7 +453,7 @@ authenticate_samba_server (GtkButton *button,
gtk_widget_set_sensitive (WID ("authenticate-button"), FALSE);
gtk_widget_grab_focus (WID ("username-entry"));
- if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (priv->treeview), &model, &iter))
+ if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview), &model, &iter))
{
gtk_tree_model_get (model, &iter,
DEVICE_NAME_COLUMN, &server_name,
@@ -482,24 +461,24 @@ authenticate_samba_server (GtkButton *button,
if (server_name != NULL)
{
- g_clear_object (&priv->samba_host);
+ g_clear_object (&dialog->samba_host);
- priv->samba_host = pp_samba_new (server_name);
- g_signal_connect_object (priv->samba_host,
+ dialog->samba_host = pp_samba_new (server_name);
+ g_signal_connect_object (dialog->samba_host,
"authentication-required",
G_CALLBACK (on_authentication_required),
dialog, 0);
- priv->samba_authenticated_searching = TRUE;
+ dialog->samba_authenticated_searching = TRUE;
update_dialog_state (dialog);
data = g_new (AuthSMBData, 1);
data->server_name = server_name;
data->dialog = dialog;
- pp_samba_get_devices_async (priv->samba_host,
+ pp_samba_get_devices_async (dialog->samba_host,
TRUE,
- priv->cancellable,
+ dialog->cancellable,
get_authenticated_samba_devices_cb,
data);
}
@@ -509,7 +488,6 @@ authenticate_samba_server (GtkButton *button,
static void
pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
{
- PpNewPrinterDialogPrivate *priv;
GtkStyleContext *context;
GtkWidget *widget;
GError *error = NULL;
@@ -519,12 +497,9 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
NULL };
guint builder_result;
- priv = PP_NEW_PRINTER_DIALOG_GET_PRIVATE (dialog);
- dialog->priv = priv;
+ dialog->builder = gtk_builder_new ();
- priv->builder = gtk_builder_new ();
-
- builder_result = gtk_builder_add_objects_from_resource (priv->builder,
+ builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
"/org/gnome/control-center/printers/new-printer-dialog.ui",
objects, &error);
@@ -535,19 +510,19 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
}
/* GCancellable for cancelling of async operations */
- priv->cancellable = g_cancellable_new ();
+ dialog->cancellable = g_cancellable_new ();
/* Construct dialog */
- priv->dialog = WID ("dialog");
+ dialog->dialog = WID ("dialog");
- priv->treeview = GTK_TREE_VIEW (WID ("devices-treeview"));
+ dialog->treeview = GTK_TREE_VIEW (WID ("devices-treeview"));
- priv->store = GTK_LIST_STORE (gtk_builder_get_object (priv->builder, "devices-liststore"));
+ dialog->store = GTK_LIST_STORE (gtk_builder_get_object (dialog->builder, "devices-liststore"));
- priv->filter = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (priv->builder, "devices-model-filter"));
+ dialog->filter = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (dialog->builder, "devices-model-filter"));
/* Connect signals */
- g_signal_connect (priv->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), dialog);
+ g_signal_connect (dialog->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), dialog);
widget = WID ("search-entry");
g_signal_connect (widget, "activate", G_CALLBACK (search_entry_activated_cb), dialog);
@@ -578,47 +553,46 @@ static void
pp_new_printer_dialog_finalize (GObject *object)
{
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (object);
- PpNewPrinterDialogPrivate *priv = dialog->priv;
- priv->text_renderer = NULL;
- priv->icon_renderer = NULL;
+ dialog->text_renderer = NULL;
+ dialog->icon_renderer = NULL;
- if (priv->host_search_timeout_id != 0)
+ if (dialog->host_search_timeout_id != 0)
{
- g_source_remove (priv->host_search_timeout_id);
- priv->host_search_timeout_id = 0;
+ g_source_remove (dialog->host_search_timeout_id);
+ dialog->host_search_timeout_id = 0;
}
- if (priv->remote_host_cancellable)
+ if (dialog->remote_host_cancellable)
{
- g_cancellable_cancel (priv->remote_host_cancellable);
- g_clear_object (&priv->remote_host_cancellable);
+ g_cancellable_cancel (dialog->remote_host_cancellable);
+ g_clear_object (&dialog->remote_host_cancellable);
}
- if (priv->cancellable)
+ if (dialog->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (dialog->cancellable);
+ g_clear_object (&dialog->cancellable);
}
- g_clear_pointer (&priv->dialog, gtk_widget_destroy);
+ g_clear_pointer (&dialog->dialog, gtk_widget_destroy);
- if (priv->builder)
- g_clear_object (&priv->builder);
+ if (dialog->builder)
+ g_clear_object (&dialog->builder);
- g_list_free_full (priv->local_cups_devices, (GDestroyNotify) g_object_unref);
- priv->local_cups_devices = NULL;
+ g_list_free_full (dialog->local_cups_devices, (GDestroyNotify) g_object_unref);
+ dialog->local_cups_devices = NULL;
- if (priv->num_of_dests > 0)
+ if (dialog->num_of_dests > 0)
{
- cupsFreeDests (priv->num_of_dests, priv->dests);
- priv->num_of_dests = 0;
- priv->dests = NULL;
+ cupsFreeDests (dialog->num_of_dests, dialog->dests);
+ dialog->num_of_dests = 0;
+ dialog->dests = NULL;
}
- g_clear_object (&priv->local_printer_icon);
- g_clear_object (&priv->remote_printer_icon);
- g_clear_object (&priv->authenticated_server_icon);
+ g_clear_object (&dialog->local_printer_icon);
+ g_clear_object (&dialog->remote_printer_icon);
+ g_clear_object (&dialog->authenticated_server_icon);
G_OBJECT_CLASS (pp_new_printer_dialog_parent_class)->finalize (object);
}
@@ -628,7 +602,6 @@ device_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
@@ -636,7 +609,7 @@ device_selection_changed_cb (GtkTreeSelection *selection,
gboolean authentication_needed;
gboolean selected;
- selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (priv->treeview),
+ selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview),
&model,
&iter);
@@ -665,28 +638,27 @@ static void
remove_device_from_list (PpNewPrinterDialog *dialog,
const gchar *device_name)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *device;
GtkTreeIter iter;
gboolean cont;
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
DEVICE_COLUMN, &device,
-1);
if (g_strcmp0 (pp_print_device_get_device_name (device), device_name) == 0)
{
- gtk_list_store_remove (priv->store, &iter);
+ gtk_list_store_remove (dialog->store, &iter);
g_object_unref (device);
break;
}
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
}
update_dialog_state (dialog);
@@ -716,7 +688,6 @@ static void
add_device_to_list (PpNewPrinterDialog *dialog,
PpPrintDevice *device)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *store_device;
GList *original_names_list = NULL;
gchar *canonicalized_name = NULL;
@@ -747,16 +718,16 @@ add_device_to_list (PpNewPrinterDialog *dialog,
"device-original-name", pp_print_device_get_device_name (device),
NULL);
- gtk_tree_model_foreach (GTK_TREE_MODEL (priv->store),
+ gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store),
prepend_original_name,
&original_names_list);
original_names_list = g_list_reverse (original_names_list);
canonicalized_name = canonicalize_device_name (original_names_list,
- priv->local_cups_devices,
- priv->dests,
- priv->num_of_dests,
+ dialog->local_cups_devices,
+ dialog->dests,
+ dialog->num_of_dests,
device);
g_list_free_full (original_names_list, g_free);
@@ -769,7 +740,7 @@ add_device_to_list (PpNewPrinterDialog *dialog,
g_free (canonicalized_name);
if (pp_print_device_get_acquisition_method (device) == ACQUISITION_METHOD_DEFAULT_CUPS_SERVER)
- priv->local_cups_devices = g_list_append (priv->local_cups_devices, g_object_ref (device));
+ dialog->local_cups_devices = g_list_append (dialog->local_cups_devices, g_object_ref (device));
else
set_device (dialog, device, NULL);
}
@@ -853,20 +824,19 @@ device_in_liststore (gchar *device_uri,
static void
update_dialog_state (PpNewPrinterDialog *dialog)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeIter iter;
GtkWidget *header;
GtkWidget *stack;
gboolean searching;
- searching = priv->cups_searching ||
- priv->remote_cups_host != NULL ||
- priv->snmp_host != NULL ||
- priv->socket_host != NULL ||
- priv->lpd_host != NULL ||
- priv->samba_host != NULL ||
- priv->samba_authenticated_searching ||
- priv->samba_searching;
+ searching = dialog->cups_searching ||
+ dialog->remote_cups_host != NULL ||
+ dialog->snmp_host != NULL ||
+ dialog->socket_host != NULL ||
+ dialog->lpd_host != NULL ||
+ dialog->samba_host != NULL ||
+ dialog->samba_authenticated_searching ||
+ dialog->samba_searching;
header = WID ("headerbar");
stack = WID ("stack");
@@ -880,7 +850,7 @@ update_dialog_state (PpNewPrinterDialog *dialog)
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), NULL);
}
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter))
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter))
gtk_stack_set_visible_child_name (GTK_STACK (stack), "standard-page");
else
gtk_stack_set_visible_child_name (GTK_STACK (stack), searching ? "loading-page" : "no-printers-page");
@@ -891,7 +861,6 @@ group_physical_devices_cb (gchar ***device_uris,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *device, *better_device;
GList *iter;
gint i, j;
@@ -906,7 +875,7 @@ group_physical_devices_cb (gchar ***device_uris,
device = NULL;
for (j = 0; device_uris[i][j] != NULL; j++)
{
- device = device_in_liststore (device_uris[i][j], priv->store);
+ device = device_in_liststore (device_uris[i][j], dialog->store);
if (device != NULL)
break;
}
@@ -917,7 +886,7 @@ group_physical_devices_cb (gchar ***device_uris,
/* Is there better device in the sublist? */
if (j != 0)
{
- better_device = device_in_list (device_uris[i][0], priv->local_cups_devices);
+ better_device = device_in_list (device_uris[i][0], dialog->local_cups_devices);
replace_device (dialog, device, better_device);
g_object_unref (better_device);
}
@@ -926,7 +895,7 @@ group_physical_devices_cb (gchar ***device_uris,
}
else
{
- device = device_in_list (device_uris[i][0], priv->local_cups_devices);
+ device = device_in_list (device_uris[i][0], dialog->local_cups_devices);
if (device != NULL)
{
set_device (dialog, device, NULL);
@@ -943,10 +912,10 @@ group_physical_devices_cb (gchar ***device_uris,
}
else
{
- for (iter = priv->local_cups_devices; iter != NULL; iter = iter->next)
+ for (iter = dialog->local_cups_devices; iter != NULL; iter = iter->next)
set_device (dialog, (PpPrintDevice *) iter->data, NULL);
- g_list_free_full (priv->local_cups_devices, g_object_unref);
- priv->local_cups_devices = NULL;
+ g_list_free_full (dialog->local_cups_devices, g_object_unref);
+ dialog->local_cups_devices = NULL;
}
update_dialog_state (dialog);
@@ -1039,7 +1008,6 @@ get_cups_devices_cb (GList *devices,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
GDBusConnection *bus;
GVariantBuilder device_list;
GVariantBuilder device_hash;
@@ -1057,27 +1025,26 @@ get_cups_devices_cb (GList *devices,
if (!cancelled)
{
dialog = (PpNewPrinterDialog *) user_data;
- priv = dialog->priv;
if (finished)
{
- priv->cups_searching = FALSE;
+ dialog->cups_searching = FALSE;
}
if (devices)
{
add_devices_to_list (dialog, devices);
- length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL) + g_list_length (priv->local_cups_devices);
+ length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (dialog->store), NULL) + g_list_length (dialog->local_cups_devices);
if (length > 0)
{
all_devices = g_new0 (PpPrintDevice *, length);
i = 0;
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
DEVICE_COLUMN, &device,
-1);
@@ -1091,10 +1058,10 @@ get_cups_devices_cb (GList *devices,
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
}
- for (liter = priv->local_cups_devices; liter != NULL; liter = liter->next)
+ for (liter = dialog->local_cups_devices; liter != NULL; liter = liter->next)
{
pp_device = (PpPrintDevice *) liter->data;
if (pp_device != NULL)
@@ -1158,7 +1125,7 @@ get_cups_devices_cb (GList *devices,
G_VARIANT_TYPE ("(aas)"),
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->cancellable,
+ dialog->cancellable,
group_physical_devices_dbus_cb,
dialog);
}
@@ -1193,7 +1160,6 @@ get_snmp_devices_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
PpHost *host = (PpHost *) source_object;
GError *error = NULL;
PpDevicesList *result;
@@ -1204,10 +1170,9 @@ get_snmp_devices_cb (GObject *source_object,
if (result)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- if ((gpointer) source_object == (gpointer) priv->snmp_host)
- priv->snmp_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->snmp_host)
+ dialog->snmp_host = NULL;
add_devices_to_list (dialog, result->devices);
@@ -1221,12 +1186,11 @@ get_snmp_devices_cb (GObject *source_object,
error->code != G_IO_ERROR_CANCELLED)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) priv->snmp_host)
- priv->snmp_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->snmp_host)
+ dialog->snmp_host = NULL;
update_dialog_state (dialog);
}
@@ -1241,7 +1205,6 @@ get_remote_cups_devices_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
PpHost *host = (PpHost *) source_object;
GError *error = NULL;
PpDevicesList *result;
@@ -1252,10 +1215,9 @@ get_remote_cups_devices_cb (GObject *source_object,
if (result)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- if ((gpointer) source_object == (gpointer) priv->remote_cups_host)
- priv->remote_cups_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->remote_cups_host)
+ dialog->remote_cups_host = NULL;
add_devices_to_list (dialog, result->devices);
@@ -1269,12 +1231,11 @@ get_remote_cups_devices_cb (GObject *source_object,
error->code != G_IO_ERROR_CANCELLED)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) priv->remote_cups_host)
- priv->remote_cups_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->remote_cups_host)
+ dialog->remote_cups_host = NULL;
update_dialog_state (dialog);
}
@@ -1288,7 +1249,6 @@ get_samba_host_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog;
PpDevicesList *result;
PpSamba *samba = (PpSamba *) source_object;
@@ -1300,10 +1260,9 @@ get_samba_host_devices_cb (GObject *source_object,
if (result)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- if ((gpointer) source_object == (gpointer) priv->samba_host)
- priv->samba_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->samba_host)
+ dialog->samba_host = NULL;
add_devices_to_list (dialog, result->devices);
@@ -1317,12 +1276,11 @@ get_samba_host_devices_cb (GObject *source_object,
error->code != G_IO_ERROR_CANCELLED)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) priv->samba_host)
- priv->samba_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->samba_host)
+ dialog->samba_host = NULL;
update_dialog_state (dialog);
}
@@ -1336,7 +1294,6 @@ get_samba_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialogPrivate *priv;
PpNewPrinterDialog *dialog;
PpDevicesList *result;
PpSamba *samba = (PpSamba *) source_object;
@@ -1348,9 +1305,8 @@ get_samba_devices_cb (GObject *source_object,
if (result)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- priv->samba_searching = FALSE;
+ dialog->samba_searching = FALSE;
add_devices_to_list (dialog, result->devices);
@@ -1364,11 +1320,10 @@ get_samba_devices_cb (GObject *source_object,
error->code != G_IO_ERROR_CANCELLED)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- priv->samba_searching = FALSE;
+ dialog->samba_searching = FALSE;
update_dialog_state (dialog);
}
@@ -1383,7 +1338,6 @@ get_jetdirect_devices_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
PpHost *host = (PpHost *) source_object;
GError *error = NULL;
PpDevicesList *result;
@@ -1394,10 +1348,9 @@ get_jetdirect_devices_cb (GObject *source_object,
if (result != NULL)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- if ((gpointer) source_object == (gpointer) priv->socket_host)
- priv->socket_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->socket_host)
+ dialog->socket_host = NULL;
add_devices_to_list (dialog, result->devices);
@@ -1410,12 +1363,11 @@ get_jetdirect_devices_cb (GObject *source_object,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) priv->socket_host)
- priv->socket_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->socket_host)
+ dialog->socket_host = NULL;
update_dialog_state (dialog);
}
@@ -1430,7 +1382,6 @@ get_lpd_devices_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
PpHost *host = (PpHost *) source_object;
GError *error = NULL;
PpDevicesList *result;
@@ -1441,10 +1392,9 @@ get_lpd_devices_cb (GObject *source_object,
if (result != NULL)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- if ((gpointer) source_object == (gpointer) priv->lpd_host)
- priv->lpd_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->lpd_host)
+ dialog->lpd_host = NULL;
add_devices_to_list (dialog, result->devices);
@@ -1457,12 +1407,11 @@ get_lpd_devices_cb (GObject *source_object,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) priv->lpd_host)
- priv->lpd_host = NULL;
+ if ((gpointer) source_object == (gpointer) dialog->lpd_host)
+ dialog->lpd_host = NULL;
update_dialog_state (dialog);
}
@@ -1474,12 +1423,10 @@ get_lpd_devices_cb (GObject *source_object,
static void
get_cups_devices (PpNewPrinterDialog *dialog)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
-
- priv->cups_searching = TRUE;
+ dialog->cups_searching = TRUE;
update_dialog_state (dialog);
- get_cups_devices_async (priv->cancellable,
+ get_cups_devices_async (dialog->cancellable,
get_cups_devices_cb,
dialog);
}
@@ -1555,69 +1502,69 @@ search_for_remote_printers_free (THostSearchData *data)
static gboolean
search_for_remote_printers (THostSearchData *data)
{
- PpNewPrinterDialogPrivate *priv = data->dialog->priv;
+ PpNewPrinterDialog *dialog = data->dialog;
- if (priv->remote_host_cancellable != NULL)
+ if (dialog->remote_host_cancellable != NULL)
{
- g_cancellable_cancel (priv->remote_host_cancellable);
- g_clear_object (&priv->remote_host_cancellable);
+ g_cancellable_cancel (dialog->remote_host_cancellable);
+ g_clear_object (&dialog->remote_host_cancellable);
}
- priv->remote_host_cancellable = g_cancellable_new ();
+ dialog->remote_host_cancellable = g_cancellable_new ();
- priv->remote_cups_host = pp_host_new (data->host_name);
- priv->snmp_host = pp_host_new (data->host_name);
- priv->socket_host = pp_host_new (data->host_name);
- priv->lpd_host = pp_host_new (data->host_name);
+ dialog->remote_cups_host = pp_host_new (data->host_name);
+ dialog->snmp_host = pp_host_new (data->host_name);
+ dialog->socket_host = pp_host_new (data->host_name);
+ dialog->lpd_host = pp_host_new (data->host_name);
if (data->host_port != PP_HOST_UNSET_PORT)
{
- g_object_set (priv->remote_cups_host, "port", data->host_port, NULL);
- g_object_set (priv->snmp_host, "port", data->host_port, NULL);
+ g_object_set (dialog->remote_cups_host, "port", data->host_port, NULL);
+ g_object_set (dialog->snmp_host, "port", data->host_port, NULL);
/* Accept port different from the default one only if user specifies
* scheme (for socket and lpd printers).
*/
if (data->host_scheme != NULL &&
g_ascii_strcasecmp (data->host_scheme, "socket") == 0)
- g_object_set (priv->socket_host, "port", data->host_port, NULL);
+ g_object_set (dialog->socket_host, "port", data->host_port, NULL);
if (data->host_scheme != NULL &&
g_ascii_strcasecmp (data->host_scheme, "lpd") == 0)
- g_object_set (priv->lpd_host, "port", data->host_port, NULL);
+ g_object_set (dialog->lpd_host, "port", data->host_port, NULL);
}
- priv->samba_host = pp_samba_new (data->host_name);
+ dialog->samba_host = pp_samba_new (data->host_name);
update_dialog_state (data->dialog);
- pp_host_get_remote_cups_devices_async (priv->remote_cups_host,
- priv->remote_host_cancellable,
+ pp_host_get_remote_cups_devices_async (dialog->remote_cups_host,
+ dialog->remote_host_cancellable,
get_remote_cups_devices_cb,
data->dialog);
- pp_host_get_snmp_devices_async (priv->snmp_host,
- priv->remote_host_cancellable,
+ pp_host_get_snmp_devices_async (dialog->snmp_host,
+ dialog->remote_host_cancellable,
get_snmp_devices_cb,
data->dialog);
- pp_host_get_jetdirect_devices_async (priv->socket_host,
- priv->remote_host_cancellable,
+ pp_host_get_jetdirect_devices_async (dialog->socket_host,
+ dialog->remote_host_cancellable,
get_jetdirect_devices_cb,
data->dialog);
- pp_host_get_lpd_devices_async (priv->lpd_host,
- priv->remote_host_cancellable,
+ pp_host_get_lpd_devices_async (dialog->lpd_host,
+ dialog->remote_host_cancellable,
get_lpd_devices_cb,
data->dialog);
- pp_samba_get_devices_async (priv->samba_host,
+ pp_samba_get_devices_async (dialog->samba_host,
TRUE,
- priv->remote_host_cancellable,
+ dialog->remote_host_cancellable,
get_samba_host_devices_cb,
data->dialog);
- priv->host_search_timeout_id = 0;
+ dialog->host_search_timeout_id = 0;
return G_SOURCE_REMOVE;
}
@@ -1627,7 +1574,6 @@ search_address (const gchar *text,
PpNewPrinterDialog *dialog,
gboolean delay_search)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *device;
GtkTreeIter iter;
gboolean found = FALSE;
@@ -1650,10 +1596,10 @@ search_address (const gchar *text,
{
words_length = g_strv_length (words);
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
DEVICE_COLUMN, &device,
-1);
@@ -1674,7 +1620,7 @@ search_address (const gchar *text,
if (subfound)
found = TRUE;
- gtk_list_store_set (GTK_LIST_STORE (priv->store), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (dialog->store), &iter,
DEVICE_VISIBLE_COLUMN, subfound,
-1);
@@ -1682,7 +1628,7 @@ search_address (const gchar *text,
g_free (lowercase_name);
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
}
g_strfreev (words);
@@ -1694,15 +1640,15 @@ search_address (const gchar *text,
*/
if (!found && words_length == 1)
{
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
while (cont)
{
next_set = FALSE;
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
DEVICE_COLUMN, &device,
-1);
- gtk_list_store_set (GTK_LIST_STORE (priv->store), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (dialog->store), &iter,
DEVICE_VISIBLE_COLUMN, TRUE,
-1);
@@ -1714,14 +1660,14 @@ search_address (const gchar *text,
acquisition_method == ACQUISITION_METHOD_LPD ||
acquisition_method == ACQUISITION_METHOD_SAMBA_HOST)
{
- if (!gtk_list_store_remove (priv->store, &iter))
+ if (!gtk_list_store_remove (dialog->store, &iter))
break;
else
next_set = TRUE;
}
if (!next_set)
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
}
if (text && text[0] != '\0')
@@ -1742,15 +1688,15 @@ search_address (const gchar *text,
search_data->host_port = port;
search_data->dialog = dialog;
- if (priv->host_search_timeout_id != 0)
+ if (dialog->host_search_timeout_id != 0)
{
- g_source_remove (priv->host_search_timeout_id);
- priv->host_search_timeout_id = 0;
+ g_source_remove (dialog->host_search_timeout_id);
+ dialog->host_search_timeout_id = 0;
}
if (delay_search)
{
- priv->host_search_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
+ dialog->host_search_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
HOST_SEARCH_DELAY,
(GSourceFunc) search_for_remote_printers,
search_data,
@@ -1825,7 +1771,6 @@ set_device (PpNewPrinterDialog *dialog,
PpPrintDevice *device,
GtkTreeIter *iter)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeIter titer;
gchar *description;
gint acquisition_method;
@@ -1860,10 +1805,10 @@ set_device (PpNewPrinterDialog *dialog,
}
if (iter == NULL)
- gtk_list_store_append (priv->store, &titer);
+ gtk_list_store_append (dialog->store, &titer);
- gtk_list_store_set (priv->store, iter == NULL ? &titer : iter,
- DEVICE_GICON_COLUMN, pp_print_device_is_network_device (device) ? priv->remote_printer_icon : priv->local_printer_icon,
+ gtk_list_store_set (dialog->store, iter == NULL ? &titer : iter,
+ DEVICE_GICON_COLUMN, pp_print_device_is_network_device (device) ? dialog->remote_printer_icon : dialog->local_printer_icon,
DEVICE_NAME_COLUMN, pp_print_device_get_device_name (device),
DEVICE_DISPLAY_NAME_COLUMN, pp_print_device_get_display_name (device),
DEVICE_DESCRIPTION_COLUMN, description,
@@ -1877,10 +1822,10 @@ set_device (PpNewPrinterDialog *dialog,
pp_print_device_get_host_name (device) != NULL)
{
if (iter == NULL)
- gtk_list_store_append (priv->store, &titer);
+ gtk_list_store_append (dialog->store, &titer);
- gtk_list_store_set (priv->store, iter == NULL ? &titer : iter,
- DEVICE_GICON_COLUMN, priv->authenticated_server_icon,
+ gtk_list_store_set (dialog->store, iter == NULL ? &titer : iter,
+ DEVICE_GICON_COLUMN, dialog->authenticated_server_icon,
DEVICE_NAME_COLUMN, pp_print_device_get_host_name (device),
DEVICE_DISPLAY_NAME_COLUMN, pp_print_device_get_host_name (device),
/* Translators: This item is a server which needs authentication to show its printers */
@@ -1898,17 +1843,16 @@ replace_device (PpNewPrinterDialog *dialog,
PpPrintDevice *old_device,
PpPrintDevice *new_device)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *device;
GtkTreeIter iter;
gboolean cont;
if (old_device != NULL && new_device != NULL)
{
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
DEVICE_COLUMN, &device,
-1);
@@ -1921,7 +1865,7 @@ replace_device (PpNewPrinterDialog *dialog,
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
}
}
}
@@ -1932,7 +1876,6 @@ cups_get_dests_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinterDialog *dialog;
- PpNewPrinterDialogPrivate *priv;
PpCupsDests *dests;
PpCups *cups = (PpCups *) source_object;
GError *error = NULL;
@@ -1943,10 +1886,9 @@ cups_get_dests_cb (GObject *source_object,
if (dests)
{
dialog = PP_NEW_PRINTER_DIALOG (user_data);
- priv = dialog->priv;
- priv->dests = dests->dests;
- priv->num_of_dests = dests->num_of_dests;
+ dialog->dests = dests->dests;
+ dialog->num_of_dests = dests->num_of_dests;
get_cups_devices (dialog);
}
@@ -1973,14 +1915,13 @@ row_activated_cb (GtkTreeView *tree_view,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
gboolean authentication_needed;
gboolean selected;
- selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (priv->treeview),
+ selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview),
&model,
&iter);
@@ -1995,7 +1936,7 @@ row_activated_cb (GtkTreeView *tree_view,
}
else
{
- gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
+ gtk_dialog_response (GTK_DIALOG (dialog->dialog), GTK_RESPONSE_OK);
}
}
}
@@ -2008,13 +1949,12 @@ cell_data_func (GtkTreeViewColumn *tree_column,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
gboolean selected = FALSE;
gchar *name = NULL;
gchar *description = NULL;
gchar *text;
- selected = gtk_tree_selection_iter_is_selected (gtk_tree_view_get_selection (priv->treeview), iter);
+ selected = gtk_tree_selection_iter_is_selected (gtk_tree_view_get_selection (dialog->treeview), iter);
gtk_tree_model_get (tree_model, iter,
DEVICE_DISPLAY_NAME_COLUMN, &name,
@@ -2054,60 +1994,59 @@ cell_data_func (GtkTreeViewColumn *tree_column,
static void
populate_devices_list (PpNewPrinterDialog *dialog)
{
- PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeViewColumn *column;
PpSamba *samba;
GEmblem *emblem;
PpCups *cups;
GIcon *icon, *emblem_icon;
- g_signal_connect (gtk_tree_view_get_selection (priv->treeview),
+ g_signal_connect (gtk_tree_view_get_selection (dialog->treeview),
"changed", G_CALLBACK (device_selection_changed_cb), dialog);
- g_signal_connect (priv->treeview,
+ g_signal_connect (dialog->treeview,
"row-activated", G_CALLBACK (row_activated_cb), dialog);
- priv->local_printer_icon = g_themed_icon_new ("printer");
- priv->remote_printer_icon = g_themed_icon_new ("printer-network");
+ dialog->local_printer_icon = g_themed_icon_new ("printer");
+ dialog->remote_printer_icon = g_themed_icon_new ("printer-network");
icon = g_themed_icon_new ("network-server");
emblem_icon = g_themed_icon_new ("changes-prevent");
emblem = g_emblem_new (emblem_icon);
- priv->authenticated_server_icon = g_emblemed_icon_new (icon, emblem);
+ dialog->authenticated_server_icon = g_emblemed_icon_new (icon, emblem);
g_object_unref (icon);
g_object_unref (emblem_icon);
g_object_unref (emblem);
- priv->icon_renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (priv->icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
- gtk_cell_renderer_set_alignment (priv->icon_renderer, 1.0, 0.5);
- gtk_cell_renderer_set_padding (priv->icon_renderer, 4, 4);
- column = gtk_tree_view_column_new_with_attributes ("Icon", priv->icon_renderer,
+ dialog->icon_renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (dialog->icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
+ gtk_cell_renderer_set_alignment (dialog->icon_renderer, 1.0, 0.5);
+ gtk_cell_renderer_set_padding (dialog->icon_renderer, 4, 4);
+ column = gtk_tree_view_column_new_with_attributes ("Icon", dialog->icon_renderer,
"gicon", DEVICE_GICON_COLUMN, NULL);
gtk_tree_view_column_set_max_width (column, -1);
gtk_tree_view_column_set_min_width (column, 80);
- gtk_tree_view_append_column (priv->treeview, column);
+ gtk_tree_view_append_column (dialog->treeview, column);
- priv->text_renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Devices", priv->text_renderer,
+ dialog->text_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Devices", dialog->text_renderer,
NULL);
- gtk_tree_view_column_set_cell_data_func (column, priv->text_renderer, cell_data_func,
+ gtk_tree_view_column_set_cell_data_func (column, dialog->text_renderer, cell_data_func,
dialog, NULL);
- gtk_tree_view_append_column (priv->treeview, column);
+ gtk_tree_view_append_column (dialog->treeview, column);
- gtk_tree_model_filter_set_visible_column (priv->filter, DEVICE_VISIBLE_COLUMN);
+ gtk_tree_model_filter_set_visible_column (dialog->filter, DEVICE_VISIBLE_COLUMN);
cups = pp_cups_new ();
- pp_cups_get_dests_async (cups, priv->cancellable, cups_get_dests_cb, dialog);
+ pp_cups_get_dests_async (cups, dialog->cancellable, cups_get_dests_cb, dialog);
- priv->samba_searching = TRUE;
+ dialog->samba_searching = TRUE;
update_dialog_state (dialog);
samba = pp_samba_new (NULL);
- pp_samba_get_devices_async (samba, FALSE, priv->cancellable, get_samba_devices_cb, dialog);
+ pp_samba_get_devices_async (samba, FALSE, dialog->cancellable, get_samba_devices_cb, dialog);
}
static void
@@ -2154,7 +2093,6 @@ ppd_selection_cb (GtkDialog *_dialog,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpNewPrinter *new_printer;
GList *original_names_list = NULL;
gchar *ppd_name;
@@ -2163,40 +2101,40 @@ ppd_selection_cb (GtkDialog *_dialog,
guint window_id = 0;
gint acquisition_method;
- ppd_name = pp_ppd_selection_dialog_get_ppd_name (priv->ppd_selection_dialog);
- ppd_display_name = pp_ppd_selection_dialog_get_ppd_display_name (priv->ppd_selection_dialog);
- pp_ppd_selection_dialog_free (priv->ppd_selection_dialog);
- priv->ppd_selection_dialog = NULL;
+ ppd_name = pp_ppd_selection_dialog_get_ppd_name (dialog->ppd_selection_dialog);
+ ppd_display_name = pp_ppd_selection_dialog_get_ppd_display_name (dialog->ppd_selection_dialog);
+ pp_ppd_selection_dialog_free (dialog->ppd_selection_dialog);
+ dialog->ppd_selection_dialog = NULL;
if (ppd_name)
{
- g_object_set (priv->new_device, "device-ppd", ppd_name, NULL);
+ g_object_set (dialog->new_device, "device-ppd", ppd_name, NULL);
- acquisition_method = pp_print_device_get_acquisition_method (priv->new_device);
+ acquisition_method = pp_print_device_get_acquisition_method (dialog->new_device);
if ((acquisition_method == ACQUISITION_METHOD_JETDIRECT ||
acquisition_method == ACQUISITION_METHOD_LPD) &&
ppd_display_name != NULL)
{
- g_object_set (priv->new_device,
+ g_object_set (dialog->new_device,
"device-name", ppd_display_name,
"device-original-name", ppd_display_name,
NULL);
- gtk_tree_model_foreach (GTK_TREE_MODEL (priv->store),
+ gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store),
prepend_original_name,
&original_names_list);
original_names_list = g_list_reverse (original_names_list);
printer_name = canonicalize_device_name (original_names_list,
- priv->local_cups_devices,
- priv->dests,
- priv->num_of_dests,
- priv->new_device);
+ dialog->local_cups_devices,
+ dialog->dests,
+ dialog->num_of_dests,
+ dialog->new_device);
g_list_free_full (original_names_list, g_free);
- g_object_set (priv->new_device,
+ g_object_set (dialog->new_device,
"device-name", printer_name,
"device-original-name", printer_name,
NULL);
@@ -2205,37 +2143,37 @@ ppd_selection_cb (GtkDialog *_dialog,
}
emit_pre_response (dialog,
- pp_print_device_get_device_name (priv->new_device),
- pp_print_device_get_device_location (priv->new_device),
- pp_print_device_get_device_make_and_model (priv->new_device),
- pp_print_device_is_network_device (priv->new_device));
+ pp_print_device_get_device_name (dialog->new_device),
+ pp_print_device_get_device_location (dialog->new_device),
+ pp_print_device_get_device_make_and_model (dialog->new_device),
+ pp_print_device_is_network_device (dialog->new_device));
- window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (priv->dialog)))));
+ window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (dialog->dialog)))));
new_printer = pp_new_printer_new ();
g_object_set (new_printer,
- "name", pp_print_device_get_device_name (priv->new_device),
- "original-name", pp_print_device_get_device_original_name (priv->new_device),
- "device-uri", pp_print_device_get_device_uri (priv->new_device),
- "device-id", pp_print_device_get_device_id (priv->new_device),
- "ppd-name", pp_print_device_get_device_ppd (priv->new_device),
- "ppd-file-name", pp_print_device_get_device_ppd (priv->new_device),
- "info", pp_print_device_get_device_info (priv->new_device),
- "location", pp_print_device_get_device_location (priv->new_device),
- "make-and-model", pp_print_device_get_device_make_and_model (priv->new_device),
- "host-name", pp_print_device_get_host_name (priv->new_device),
- "host-port", pp_print_device_get_host_port (priv->new_device),
- "is-network-device", pp_print_device_is_network_device (priv->new_device),
+ "name", pp_print_device_get_device_name (dialog->new_device),
+ "original-name", pp_print_device_get_device_original_name (dialog->new_device),
+ "device-uri", pp_print_device_get_device_uri (dialog->new_device),
+ "device-id", pp_print_device_get_device_id (dialog->new_device),
+ "ppd-name", pp_print_device_get_device_ppd (dialog->new_device),
+ "ppd-file-name", pp_print_device_get_device_ppd (dialog->new_device),
+ "info", pp_print_device_get_device_info (dialog->new_device),
+ "location", pp_print_device_get_device_location (dialog->new_device),
+ "make-and-model", pp_print_device_get_device_make_and_model (dialog->new_device),
+ "host-name", pp_print_device_get_host_name (dialog->new_device),
+ "host-port", pp_print_device_get_host_port (dialog->new_device),
+ "is-network-device", pp_print_device_is_network_device (dialog->new_device),
"window-id", window_id,
NULL);
- priv->cancellable = g_cancellable_new ();
+ dialog->cancellable = g_cancellable_new ();
pp_new_printer_add_async (new_printer,
- priv->cancellable,
+ dialog->cancellable,
printer_add_async_cb,
dialog);
- g_clear_object (&priv->new_device);
+ g_clear_object (&dialog->new_device);
}
}
@@ -2245,7 +2183,6 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
gpointer user_data)
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
- PpNewPrinterDialogPrivate *priv = dialog->priv;
PpPrintDevice *device = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2255,10 +2192,10 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
if (response_id == GTK_RESPONSE_OK)
{
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (dialog->cancellable);
+ g_clear_object (&dialog->cancellable);
- if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (priv->treeview), &model, &iter))
+ if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview), &model, &iter))
{
gtk_tree_model_get (model, &iter,
DEVICE_COLUMN, &device,
@@ -2276,10 +2213,10 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
acquisition_method == ACQUISITION_METHOD_JETDIRECT ||
acquisition_method == ACQUISITION_METHOD_LPD)
{
- priv->new_device = pp_print_device_copy (device);
- priv->ppd_selection_dialog =
- pp_ppd_selection_dialog_new (priv->parent,
- priv->list,
+ dialog->new_device = pp_print_device_copy (device);
+ dialog->ppd_selection_dialog =
+ pp_ppd_selection_dialog_new (dialog->parent,
+ dialog->list,
NULL,
ppd_selection_cb,
dialog);
@@ -2311,10 +2248,10 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
"window-id", window_id,
NULL);
- priv->cancellable = g_cancellable_new ();
+ dialog->cancellable = g_cancellable_new ();
pp_new_printer_add_async (new_printer,
- priv->cancellable,
+ dialog->cancellable,
printer_add_async_cb,
dialog);
}
diff --git a/panels/printers/pp-new-printer-dialog.h b/panels/printers/pp-new-printer-dialog.h
index b30fc8a80..54a0a2300 100644
--- a/panels/printers/pp-new-printer-dialog.h
+++ b/panels/printers/pp-new-printer-dialog.h
@@ -26,38 +26,9 @@
G_BEGIN_DECLS
-#define PP_TYPE_NEW_PRINTER_DIALOG (pp_new_printer_dialog_get_type ())
-#define PP_NEW_PRINTER_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PP_TYPE_NEW_PRINTER_DIALOG, PpNewPrinterDialog))
-#define PP_NEW_PRINTER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PP_TYPE_NEW_PRINTER_DIALOG, PpNewPrinterDialogClass))
-#define PP_IS_NEW_PRINTER_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PP_TYPE_NEW_PRINTER_DIALOG))
-#define PP_IS_NEW_PRINTER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PP_TYPE_NEW_PRINTER_DIALOG))
-#define PP_NEW_PRINTER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PP_TYPE_NEW_PRINTER_DIALOG, PpNewPrinterDialogClass))
+#define PP_TYPE_NEW_PRINTER_DIALOG (pp_new_printer_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (PpNewPrinterDialog, pp_new_printer_dialog, PP, NEW_PRINTER_DIALOG, GObject)
-typedef struct _PpNewPrinterDialog PpNewPrinterDialog;
-typedef struct _PpNewPrinterDialogClass PpNewPrinterDialogClass;
-typedef struct _PpNewPrinterDialogPrivate PpNewPrinterDialogPrivate;
-
-struct _PpNewPrinterDialog
-{
- GObject parent_instance;
- PpNewPrinterDialogPrivate *priv;
-};
-
-struct _PpNewPrinterDialogClass
-{
- GObjectClass parent_class;
-
- void (*pre_response) (PpNewPrinterDialog *dialog,
- const gchar *device_name,
- const gchar *device_location,
- const gchar *device_make_and_model,
- gboolean is_network_device);
-
- void (*response) (PpNewPrinterDialog *dialog,
- gint response_id);
-};
-
-GType pp_new_printer_dialog_get_type (void) G_GNUC_CONST;
PpNewPrinterDialog *pp_new_printer_dialog_new (GtkWindow *parent,
PPDList *ppd_list);
void pp_new_printer_dialog_set_ppd_list (PpNewPrinterDialog *dialog,
diff --git a/panels/printers/pp-new-printer.c b/panels/printers/pp-new-printer.c
index cc0d259ab..e0e216a42 100644
--- a/panels/printers/pp-new-printer.c
+++ b/panels/printers/pp-new-printer.c
@@ -42,8 +42,10 @@
#define ippGetState(ipp) ipp->state
#endif
-struct _PpNewPrinterPrivate
+struct _PpNewPrinter
{
+ GObject parent_instance;
+
gchar *name;
gchar *original_name;
gchar *device_uri;
@@ -85,29 +87,23 @@ enum {
static void
pp_new_printer_finalize (GObject *object)
{
- PpNewPrinterPrivate *priv;
-
- priv = PP_NEW_PRINTER (object)->priv;
-
- if (priv->unlink_ppd_file && priv->ppd_file_name)
- g_unlink (priv->ppd_file_name);
-
- g_clear_pointer (&priv->name, g_free);
- g_clear_pointer (&priv->original_name, g_free);
- g_clear_pointer (&priv->device_uri, g_free);
- g_clear_pointer (&priv->device_id, g_free);
- g_clear_pointer (&priv->ppd_name, g_free);
- g_clear_pointer (&priv->ppd_file_name, g_free);
- g_clear_pointer (&priv->info, g_free);
- g_clear_pointer (&priv->location, g_free);
- g_clear_pointer (&priv->make_and_model, g_free);
- g_clear_pointer (&priv->host_name, g_free);
-
- if (priv->res)
- g_object_unref (priv->res);
+ PpNewPrinter *self = PP_NEW_PRINTER (object);
- if (priv->cancellable)
- g_object_unref (priv->cancellable);
+ if (self->unlink_ppd_file && self->ppd_file_name)
+ g_unlink (self->ppd_file_name);
+
+ g_clear_pointer (&self->name, g_free);
+ g_clear_pointer (&self->original_name, g_free);
+ g_clear_pointer (&self->device_uri, g_free);
+ g_clear_pointer (&self->device_id, g_free);
+ g_clear_pointer (&self->ppd_name, g_free);
+ g_clear_pointer (&self->ppd_file_name, g_free);
+ g_clear_pointer (&self->info, g_free);
+ g_clear_pointer (&self->location, g_free);
+ g_clear_pointer (&self->make_and_model, g_free);
+ g_clear_pointer (&self->host_name, g_free);
+ g_clear_object (&self->res);
+ g_clear_object (&self->cancellable);
G_OBJECT_CLASS (pp_new_printer_parent_class)->finalize (object);
}
@@ -125,43 +121,43 @@ pp_new_printer_get_property (GObject *object,
switch (prop_id)
{
case PROP_NAME:
- g_value_set_string (value, self->priv->name);
+ g_value_set_string (value, self->name);
break;
case PROP_ORIGINAL_NAME:
- g_value_set_string (value, self->priv->original_name);
+ g_value_set_string (value, self->original_name);
break;
case PROP_DEVICE_URI:
- g_value_set_string (value, self->priv->device_uri);
+ g_value_set_string (value, self->device_uri);
break;
case PROP_DEVICE_ID:
- g_value_set_string (value, self->priv->device_id);
+ g_value_set_string (value, self->device_id);
break;
case PROP_PPD_NAME:
- g_value_set_string (value, self->priv->ppd_name);
+ g_value_set_string (value, self->ppd_name);
break;
case PROP_PPD_FILE_NAME:
- g_value_set_string (value, self->priv->ppd_file_name);
+ g_value_set_string (value, self->ppd_file_name);
break;
case PROP_INFO:
- g_value_set_string (value, self->priv->info);
+ g_value_set_string (value, self->info);
break;
case PROP_LOCATION:
- g_value_set_string (value, self->priv->location);
+ g_value_set_string (value, self->location);
break;
case PROP_MAKE_AND_MODEL:
- g_value_set_string (value, self->priv->make_and_model);
+ g_value_set_string (value, self->make_and_model);
break;
case PROP_HOST_NAME:
- g_value_set_string (value, self->priv->host_name);
+ g_value_set_string (value, self->host_name);
break;
case PROP_HOST_PORT:
- g_value_set_int (value, self->priv->host_port);
+ g_value_set_int (value, self->host_port);
break;
case PROP_IS_NETWORK_DEVICE:
- g_value_set_boolean (value, self->priv->is_network_device);
+ g_value_set_boolean (value, self->is_network_device);
break;
case PROP_WINDOW_ID:
- g_value_set_uint (value, self->priv->window_id);
+ g_value_set_uint (value, self->window_id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -182,53 +178,53 @@ pp_new_printer_set_property (GObject *object,
switch (prop_id)
{
case PROP_NAME:
- g_free (self->priv->name);
- self->priv->name = g_value_dup_string (value);
+ g_free (self->name);
+ self->name = g_value_dup_string (value);
break;
case PROP_ORIGINAL_NAME:
- g_free (self->priv->original_name);
- self->priv->original_name = g_value_dup_string (value);
+ g_free (self->original_name);
+ self->original_name = g_value_dup_string (value);
break;
case PROP_DEVICE_URI:
- g_free (self->priv->device_uri);
- self->priv->device_uri = g_value_dup_string (value);
+ g_free (self->device_uri);
+ self->device_uri = g_value_dup_string (value);
break;
case PROP_DEVICE_ID:
- g_free (self->priv->device_id);
- self->priv->device_id = g_value_dup_string (value);
+ g_free (self->device_id);
+ self->device_id = g_value_dup_string (value);
break;
case PROP_PPD_NAME:
- g_free (self->priv->ppd_name);
- self->priv->ppd_name = g_value_dup_string (value);
+ g_free (self->ppd_name);
+ self->ppd_name = g_value_dup_string (value);
break;
case PROP_PPD_FILE_NAME:
- g_free (self->priv->ppd_file_name);
- self->priv->ppd_file_name = g_value_dup_string (value);
+ g_free (self->ppd_file_name);
+ self->ppd_file_name = g_value_dup_string (value);
break;
case PROP_INFO:
- g_free (self->priv->info);
- self->priv->info = g_value_dup_string (value);
+ g_free (self->info);
+ self->info = g_value_dup_string (value);
break;
case PROP_LOCATION:
- g_free (self->priv->location);
- self->priv->location = g_value_dup_string (value);
+ g_free (self->location);
+ self->location = g_value_dup_string (value);
break;
case PROP_MAKE_AND_MODEL:
- g_free (self->priv->make_and_model);
- self->priv->make_and_model = g_value_dup_string (value);
+ g_free (self->make_and_model);
+ self->make_and_model = g_value_dup_string (value);
break;
case PROP_HOST_NAME:
- g_free (self->priv->host_name);
- self->priv->host_name = g_value_dup_string (value);
+ g_free (self->host_name);
+ self->host_name = g_value_dup_string (value);
break;
case PROP_HOST_PORT:
- self->priv->host_port = g_value_get_int (value);
+ self->host_port = g_value_get_int (value);
break;
case PROP_IS_NETWORK_DEVICE:
- self->priv->is_network_device = g_value_get_boolean (value);
+ self->is_network_device = g_value_get_boolean (value);
break;
case PROP_WINDOW_ID:
- self->priv->window_id = g_value_get_uint (value);
+ self->window_id = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -243,8 +239,6 @@ pp_new_printer_class_init (PpNewPrinterClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (PpNewPrinterPrivate));
-
gobject_class->set_property = pp_new_printer_set_property;
gobject_class->get_property = pp_new_printer_get_property;
@@ -345,13 +339,9 @@ pp_new_printer_class_init (PpNewPrinterClass *klass)
static void
pp_new_printer_init (PpNewPrinter *printer)
{
- printer->priv = G_TYPE_INSTANCE_GET_PRIVATE (printer,
- PP_TYPE_NEW_PRINTER,
- PpNewPrinterPrivate);
-
- printer->priv->unlink_ppd_file = FALSE;
- printer->priv->cancellable = NULL;
- printer->priv->res = NULL;
+ printer->unlink_ppd_file = FALSE;
+ printer->cancellable = NULL;
+ printer->res = NULL;
}
PpNewPrinter *
@@ -366,18 +356,16 @@ static void
_pp_new_printer_add_async_cb (gboolean success,
PpNewPrinter *printer)
{
- PpNewPrinterPrivate *priv = printer->priv;
-
if (!success)
{
- g_simple_async_result_set_error (priv->res,
+ g_simple_async_result_set_error (printer->res,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"Installation of the new printer failed.");
}
- g_simple_async_result_set_op_res_gboolean (priv->res, success);
- g_simple_async_result_complete_in_idle (priv->res);
+ g_simple_async_result_set_op_res_gboolean (printer->res, success);
+ g_simple_async_result_complete_in_idle (printer->res);
}
static void
@@ -409,7 +397,6 @@ printer_add_real_async_dbus_cb (GObject *source_object,
gpointer user_data)
{
PpNewPrinter *printer = (PpNewPrinter *) user_data;
- PpNewPrinterPrivate *priv = printer->priv;
GVariant *output;
GError *error = NULL;
@@ -425,7 +412,7 @@ printer_add_real_async_dbus_cb (GObject *source_object,
g_variant_get (output, "(&s)", &ret_error);
if (ret_error[0] != '\0')
{
- g_warning ("cups-pk-helper: addition of printer %s failed: %s", priv->name, ret_error);
+ g_warning ("cups-pk-helper: addition of printer %s failed: %s", printer->name, ret_error);
}
g_variant_unref (output);
@@ -441,7 +428,7 @@ printer_add_real_async_dbus_cb (GObject *source_object,
error->domain != G_IO_ERROR ||
error->code != G_IO_ERROR_CANCELLED)
{
- get_named_dest_async (priv->name,
+ get_named_dest_async (printer->name,
printer_add_real_async_cb,
printer);
}
@@ -453,11 +440,10 @@ printer_add_real_async_dbus_cb (GObject *source_object,
static void
printer_add_real_async (PpNewPrinter *printer)
{
- PpNewPrinterPrivate *priv = printer->priv;
GDBusConnection *bus;
GError *error = NULL;
- if (!priv->ppd_name && !priv->ppd_file_name)
+ if (!printer->ppd_name && !printer->ppd_file_name)
{
_pp_new_printer_add_async_cb (FALSE, printer);
return;
@@ -476,13 +462,13 @@ printer_add_real_async (PpNewPrinter *printer)
MECHANISM_BUS,
"/",
MECHANISM_BUS,
- priv->ppd_name ? "PrinterAdd" : "PrinterAddWithPpdFile",
+ printer->ppd_name ? "PrinterAdd" : "PrinterAddWithPpdFile",
g_variant_new ("(sssss)",
- priv->name,
- priv->device_uri,
- priv->ppd_name ? priv->ppd_name : priv->ppd_file_name,
- priv->info ? priv->info : "",
- priv->location ? priv->location : ""),
+ printer->name,
+ printer->device_uri,
+ printer->ppd_name ? printer->ppd_name : printer->ppd_file_name,
+ printer->info ? printer->info : "",
+ printer->location ? printer->location : ""),
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT,
@@ -557,7 +543,6 @@ printer_add_async_scb3 (GObject *source_object,
gpointer user_data)
{
PpNewPrinter *printer = (PpNewPrinter *) user_data;
- PpNewPrinterPrivate *priv = printer->priv;
GVariant *output;
PPDName *ppd_item = NULL;
GError *error = NULL;
@@ -584,7 +569,7 @@ printer_add_async_scb3 (GObject *source_object,
error->code != G_IO_ERROR_CANCELLED) &&
ppd_item && ppd_item->ppd_name)
{
- priv->ppd_name = g_strdup (ppd_item->ppd_name);
+ printer->ppd_name = g_strdup (ppd_item->ppd_name);
printer_add_real_async (printer);
}
else
@@ -609,7 +594,6 @@ install_printer_drivers_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterPrivate *priv;
PpNewPrinter *printer;
GVariant *output;
GError *error = NULL;
@@ -638,7 +622,6 @@ install_printer_drivers_cb (GObject *source_object,
GError *error = NULL;
printer = (PpNewPrinter *) user_data;
- priv = printer->priv;
/* Try whether CUPS has a driver for the new printer */
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
@@ -650,13 +633,13 @@ install_printer_drivers_cb (GObject *source_object,
SCP_IFACE,
"GetBestDrivers",
g_variant_new ("(sss)",
- priv->device_id,
- priv->make_and_model ? priv->make_and_model : "",
- priv->device_uri ? priv->device_uri : ""),
+ printer->device_id,
+ printer->make_and_model ? printer->make_and_model : "",
+ printer->device_uri ? printer->device_uri : ""),
G_VARIANT_TYPE ("(a(ss))"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT_LONG,
- priv->cancellable,
+ printer->cancellable,
printer_add_async_scb3,
printer);
}
@@ -678,7 +661,6 @@ printer_add_async_scb (GObject *source_object,
gpointer user_data)
{
PpNewPrinter *printer = (PpNewPrinter *) user_data;
- PpNewPrinterPrivate *priv = printer->priv;
GDBusConnection *bus;
GVariantBuilder array_builder;
GVariant *output;
@@ -714,7 +696,7 @@ printer_add_async_scb (GObject *source_object,
if (bus)
{
g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("as"));
- g_variant_builder_add (&array_builder, "s", priv->device_id);
+ g_variant_builder_add (&array_builder, "s", printer->device_id);
g_dbus_connection_call (bus,
PACKAGE_KIT_BUS,
@@ -722,7 +704,7 @@ printer_add_async_scb (GObject *source_object,
PACKAGE_KIT_MODIFY_IFACE,
"InstallPrinterDrivers",
g_variant_new ("(uass)",
- priv->window_id,
+ printer->window_id,
&array_builder,
"hide-finished"),
G_VARIANT_TYPE ("()"),
@@ -741,7 +723,7 @@ printer_add_async_scb (GObject *source_object,
}
else if (ppd_item && ppd_item->ppd_name)
{
- priv->ppd_name = g_strdup (ppd_item->ppd_name);
+ printer->ppd_name = g_strdup (ppd_item->ppd_name);
printer_add_real_async (printer);
}
else
@@ -762,12 +744,11 @@ printer_add_async_scb4 (const gchar *ppd_filename,
gpointer user_data)
{
PpNewPrinter *printer = (PpNewPrinter *) user_data;
- PpNewPrinterPrivate *priv = printer->priv;
- priv->ppd_file_name = g_strdup (ppd_filename);
- if (priv->ppd_file_name)
+ printer->ppd_file_name = g_strdup (ppd_filename);
+ if (printer->ppd_file_name)
{
- priv->unlink_ppd_file = TRUE;
+ printer->unlink_ppd_file = TRUE;
printer_add_real_async (printer);
}
else
@@ -812,11 +793,11 @@ typedef struct
static void
printer_configure_async_finish (PCData *data)
{
- PpNewPrinterPrivate *priv = data->new_printer->priv;
+ PpNewPrinter *printer = data->new_printer;
if (data->set_accept_jobs_finished &&
data->set_enabled_finished &&
- (data->autoconfigure_finished || priv->is_network_device) &&
+ (data->autoconfigure_finished || printer->is_network_device) &&
data->set_media_size_finished &&
data->install_missing_executables_finished)
{
@@ -1243,7 +1224,6 @@ pp_maintenance_command_execute_cb (GObject *source_object,
static void
printer_configure_async (PpNewPrinter *new_printer)
{
- PpNewPrinterPrivate *priv = new_printer->priv;
GDBusConnection *bus;
PCData *data;
IMEData *ime_data;
@@ -1259,7 +1239,7 @@ printer_configure_async (PpNewPrinter *new_printer)
data->install_missing_executables_finished = FALSE;
/* Enable printer and make it accept jobs */
- if (priv->name)
+ if (new_printer->name)
{
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (bus)
@@ -1270,7 +1250,7 @@ printer_configure_async (PpNewPrinter *new_printer)
MECHANISM_BUS,
"PrinterSetAcceptJobs",
g_variant_new ("(sbs)",
- priv->name,
+ new_printer->name,
TRUE,
""),
G_VARIANT_TYPE ("(s)"),
@@ -1286,7 +1266,7 @@ printer_configure_async (PpNewPrinter *new_printer)
MECHANISM_BUS,
"PrinterSetEnabled",
g_variant_new ("(sb)",
- priv->name,
+ new_printer->name,
TRUE),
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
@@ -1310,10 +1290,10 @@ printer_configure_async (PpNewPrinter *new_printer)
}
/* Run autoconfiguration of printer */
- if (!priv->is_network_device)
+ if (!new_printer->is_network_device)
{
PpMaintenanceCommand *command;
- command = pp_maintenance_command_new (priv->name,
+ command = pp_maintenance_command_new (new_printer->name,
"autoconfigure",
NULL,
/* Translators: Name of job which makes printer to autoconfigure itself */
@@ -1329,18 +1309,18 @@ printer_configure_async (PpNewPrinter *new_printer)
values = g_new0 (gchar *, 2);
values[0] = g_strdup (get_page_size_from_locale ());
- printer_add_option_async (priv->name, "PageSize", values, FALSE, NULL, pao_cb, data);
+ printer_add_option_async (new_printer->name, "PageSize", values, FALSE, NULL, pao_cb, data);
g_strfreev (values);
/* Install missing executables for printer */
ime_data = g_new0 (IMEData, 1);
- ime_data->window_id = priv->window_id;
+ ime_data->window_id = new_printer->window_id;
if (data->cancellable)
ime_data->cancellable = g_object_ref (data->cancellable);
ime_data->user_data = data;
- printer_get_ppd_async (priv->name,
+ printer_get_ppd_async (new_printer->name,
NULL,
0,
printer_get_ppd_cb,
@@ -1353,17 +1333,16 @@ _pp_new_printer_add_async (GSimpleAsyncResult *res,
GCancellable *cancellable)
{
PpNewPrinter *printer = PP_NEW_PRINTER (object);
- PpNewPrinterPrivate *priv = printer->priv;
- priv->res = g_object_ref (res);
- priv->cancellable = g_object_ref (cancellable);
+ printer->res = g_object_ref (res);
+ printer->cancellable = g_object_ref (cancellable);
- if (priv->ppd_name || priv->ppd_file_name)
+ if (printer->ppd_name || printer->ppd_file_name)
{
/* We have everything we need */
printer_add_real_async (printer);
}
- else if (priv->device_id)
+ else if (printer->device_id)
{
GDBusConnection *bus;
GError *error = NULL;
@@ -1378,9 +1357,9 @@ _pp_new_printer_add_async (GSimpleAsyncResult *res,
SCP_IFACE,
"GetBestDrivers",
g_variant_new ("(sss)",
- priv->device_id,
- priv->make_and_model ? priv->make_and_model : "",
- priv->device_uri ? priv->device_uri : ""),
+ printer->device_id,
+ printer->make_and_model ? printer->make_and_model : "",
+ printer->device_uri ? printer->device_uri : ""),
G_VARIANT_TYPE ("(a(ss))"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT_LONG,
@@ -1395,12 +1374,12 @@ _pp_new_printer_add_async (GSimpleAsyncResult *res,
_pp_new_printer_add_async_cb (FALSE, printer);
}
}
- else if (priv->original_name && priv->host_name)
+ else if (printer->original_name && printer->host_name)
{
/* Try to get PPD from remote CUPS */
- printer_get_ppd_async (priv->original_name,
- priv->host_name,
- priv->host_port,
+ printer_get_ppd_async (printer->original_name,
+ printer->host_name,
+ printer->host_port,
printer_add_async_scb4,
printer);
}
diff --git a/panels/printers/pp-new-printer.h b/panels/printers/pp-new-printer.h
index 83bcad41a..2f70d4531 100644
--- a/panels/printers/pp-new-printer.h
+++ b/panels/printers/pp-new-printer.h
@@ -26,29 +26,9 @@
G_BEGIN_DECLS
-#define PP_TYPE_NEW_PRINTER (pp_new_printer_get_type ())
-#define PP_NEW_PRINTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PP_TYPE_NEW_PRINTER, PpNewPrinter))
-#define PP_NEW_PRINTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PP_TYPE_NEW_PRINTER, PpNewPrinterClass))
-#define PP_IS_NEW_PRINTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PP_TYPE_NEW_PRINTER))
-#define PP_IS_NEW_PRINTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PP_TYPE_NEW_PRINTER))
-#define PP_NEW_PRINTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PP_TYPE_NEW_PRINTER, PpNewPrinterClass))
+#define PP_TYPE_NEW_PRINTER (pp_new_printer_get_type ())
+G_DECLARE_FINAL_TYPE (PpNewPrinter, pp_new_printer, PP, NEW_PRINTER, GObject)
-typedef struct _PpNewPrinter PpNewPrinter;
-typedef struct _PpNewPrinterClass PpNewPrinterClass;
-typedef struct _PpNewPrinterPrivate PpNewPrinterPrivate;
-
-struct _PpNewPrinter
-{
- GObject parent_instance;
- PpNewPrinterPrivate *priv;
-};
-
-struct _PpNewPrinterClass
-{
- GObjectClass parent_class;
-};
-
-GType pp_new_printer_get_type (void) G_GNUC_CONST;
PpNewPrinter *pp_new_printer_new (void);
void pp_new_printer_add_async (PpNewPrinter *host,
diff --git a/panels/printers/pp-ppd-option-widget.c b/panels/printers/pp-ppd-option-widget.c
index f7d0bf45c..4404a3b75 100644
--- a/panels/printers/pp-ppd-option-widget.c
+++ b/panels/printers/pp-ppd-option-widget.c
@@ -29,17 +29,16 @@
#include "pp-ppd-option-widget.h"
#include "pp-utils.h"
-#define PP_PPD_OPTION_WIDGET_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), PP_TYPE_PPD_OPTION_WIDGET, PpPPDOptionWidgetPrivate))
-
static void pp_ppd_option_widget_finalize (GObject *object);
static gboolean construct_widget (PpPPDOptionWidget *widget);
static void update_widget (PpPPDOptionWidget *widget);
static void update_widget_real (PpPPDOptionWidget *widget);
-struct PpPPDOptionWidgetPrivate
+struct _PpPPDOptionWidget
{
+ GtkBox parent_instance;
+
GtkWidget *switch_button;
GtkWidget *combo;
GtkWidget *image;
@@ -140,79 +139,51 @@ pp_ppd_option_widget_class_init (PpPPDOptionWidgetClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->finalize = pp_ppd_option_widget_finalize;
-
- g_type_class_add_private (class, sizeof (PpPPDOptionWidgetPrivate));
}
static void
pp_ppd_option_widget_init (PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv;
-
gtk_orientable_set_orientation (GTK_ORIENTABLE (widget),
GTK_ORIENTATION_HORIZONTAL);
- priv = widget->priv = PP_PPD_OPTION_WIDGET_GET_PRIVATE (widget);
- priv->switch_button = NULL;
- priv->combo = NULL;
- priv->image = NULL;
- priv->box = NULL;
+ widget->switch_button = NULL;
+ widget->combo = NULL;
+ widget->image = NULL;
+ widget->box = NULL;
- priv->printer_name = NULL;
- priv->option_name = NULL;
+ widget->printer_name = NULL;
+ widget->option_name = NULL;
- priv->destination = NULL;
- priv->destination_set = FALSE;
+ widget->destination = NULL;
+ widget->destination_set = FALSE;
- priv->ppd_filename = NULL;
- priv->ppd_filename_set = FALSE;
+ widget->ppd_filename = NULL;
+ widget->ppd_filename_set = FALSE;
}
static void
pp_ppd_option_widget_finalize (GObject *object)
{
PpPPDOptionWidget *widget = PP_PPD_OPTION_WIDGET (object);
- PpPPDOptionWidgetPrivate *priv = widget->priv;
- if (priv)
+ g_clear_pointer (&widget->option, cups_option_free);
+ g_clear_pointer (&widget->printer_name, g_free);
+ g_clear_pointer (&widget->option_name, g_free);
+ if (widget->destination)
{
- if (priv->option)
- {
- cups_option_free (priv->option);
- priv->option = NULL;
- }
-
- if (priv->printer_name)
- {
- g_free (priv->printer_name);
- priv->printer_name = NULL;
- }
-
- if (priv->option_name)
- {
- g_free (priv->printer_name);
- priv->printer_name = NULL;
- }
-
- if (priv->destination)
- {
- cupsFreeDests (1, priv->destination);
- priv->destination = NULL;
- }
-
- if (priv->ppd_filename)
- {
- g_unlink (priv->ppd_filename);
- g_free (priv->ppd_filename);
- priv->ppd_filename = NULL;
- }
-
- if (priv->cancellable)
- {
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
- }
+ cupsFreeDests (1, widget->destination);
+ widget->destination = NULL;
+ }
+ if (widget->ppd_filename)
+ {
+ g_unlink (widget->ppd_filename);
+ g_free (widget->ppd_filename);
+ widget->ppd_filename = NULL;
}
+ if (widget->cancellable)
+ g_cancellable_cancel (widget->cancellable);
+ g_clear_object (&widget->cancellable);
G_OBJECT_CLASS (pp_ppd_option_widget_parent_class)->finalize (object);
}
@@ -237,18 +208,15 @@ GtkWidget *
pp_ppd_option_widget_new (ppd_option_t *option,
const gchar *printer_name)
{
- PpPPDOptionWidgetPrivate *priv;
PpPPDOptionWidget *widget = NULL;
if (option && printer_name)
{
widget = g_object_new (PP_TYPE_PPD_OPTION_WIDGET, NULL);
- priv = PP_PPD_OPTION_WIDGET_GET_PRIVATE (widget);
-
- priv->printer_name = g_strdup (printer_name);
- priv->option = cups_option_copy (option);
- priv->option_name = g_strdup (option->keyword);
+ widget->printer_name = g_strdup (printer_name);
+ widget->option = cups_option_copy (option);
+ widget->option_name = g_strdup (option->keyword);
if (construct_widget (widget))
{
@@ -371,10 +339,9 @@ printer_add_option_async_cb (gboolean success,
gpointer user_data)
{
PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
- PpPPDOptionWidgetPrivate *priv = widget->priv;
update_widget (user_data);
- g_clear_object (&priv->cancellable);
+ g_clear_object (&widget->cancellable);
}
static void
@@ -382,7 +349,6 @@ switch_changed_cb (GtkWidget *switch_button,
GParamSpec *pspec,
PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv = widget->priv;
gchar **values;
values = g_new0 (gchar *, 2);
@@ -392,18 +358,18 @@ switch_changed_cb (GtkWidget *switch_button,
else
values[0] = g_strdup ("False");
- if (priv->cancellable)
+ if (widget->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
+ g_cancellable_cancel (widget->cancellable);
+ g_object_unref (widget->cancellable);
}
- priv->cancellable = g_cancellable_new ();
- printer_add_option_async (priv->printer_name,
- priv->option_name,
+ widget->cancellable = g_cancellable_new ();
+ printer_add_option_async (widget->printer_name,
+ widget->option_name,
values,
FALSE,
- priv->cancellable,
+ widget->cancellable,
printer_add_option_async_cb,
widget);
@@ -414,24 +380,23 @@ static void
combo_changed_cb (GtkWidget *combo,
PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv = widget->priv;
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = combo_box_get (combo);
- if (priv->cancellable)
+ if (widget->cancellable)
{
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
+ g_cancellable_cancel (widget->cancellable);
+ g_object_unref (widget->cancellable);
}
- priv->cancellable = g_cancellable_new ();
- printer_add_option_async (priv->printer_name,
- priv->option_name,
+ widget->cancellable = g_cancellable_new ();
+ printer_add_option_async (widget->printer_name,
+ widget->option_name,
values,
FALSE,
- priv->cancellable,
+ widget->cancellable,
printer_add_option_async_cb,
widget);
@@ -441,57 +406,56 @@ combo_changed_cb (GtkWidget *combo,
static gboolean
construct_widget (PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv = widget->priv;
gint i;
/* Don't show options which has only one choice */
- if (priv->option && priv->option->num_choices > 1)
+ if (widget->option && widget->option->num_choices > 1)
{
- switch (priv->option->ui)
+ switch (widget->option->ui)
{
case PPD_UI_BOOLEAN:
- priv->switch_button = gtk_switch_new ();
- g_signal_connect (priv->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
- gtk_box_pack_start (GTK_BOX (widget), priv->switch_button, FALSE, FALSE, 0);
+ widget->switch_button = gtk_switch_new ();
+ g_signal_connect (widget->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->switch_button, FALSE, FALSE, 0);
break;
case PPD_UI_PICKONE:
- priv->combo = combo_box_new ();
+ widget->combo = combo_box_new ();
- for (i = 0; i < priv->option->num_choices; i++)
+ for (i = 0; i < widget->option->num_choices; i++)
{
- combo_box_append (priv->combo,
- ppd_choice_translate (&priv->option->choices[i]),
- priv->option->choices[i].choice);
+ combo_box_append (widget->combo,
+ ppd_choice_translate (&widget->option->choices[i]),
+ widget->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (widget), priv->combo, FALSE, FALSE, 0);
- g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
+ g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
break;
case PPD_UI_PICKMANY:
- priv->combo = combo_box_new ();
+ widget->combo = combo_box_new ();
- for (i = 0; i < priv->option->num_choices; i++)
+ for (i = 0; i < widget->option->num_choices; i++)
{
- combo_box_append (priv->combo,
- ppd_choice_translate (&priv->option->choices[i]),
- priv->option->choices[i].choice);
+ combo_box_append (widget->combo,
+ ppd_choice_translate (&widget->option->choices[i]),
+ widget->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (widget), priv->combo, TRUE, TRUE, 0);
- g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (widget), widget->combo, TRUE, TRUE, 0);
+ g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
break;
default:
break;
}
- priv->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
- if (!priv->image)
- priv->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
- gtk_box_pack_start (GTK_BOX (widget), priv->image, FALSE, FALSE, 0);
- gtk_widget_set_no_show_all (GTK_WIDGET (priv->image), TRUE);
+ widget->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
+ if (!widget->image)
+ widget->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (widget), widget->image, FALSE, FALSE, 0);
+ gtk_widget_set_no_show_all (GTK_WIDGET (widget->image), TRUE);
return TRUE;
}
@@ -504,21 +468,20 @@ construct_widget (PpPPDOptionWidget *widget)
static void
update_widget_real (PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv = widget->priv;
ppd_option_t *option = NULL, *iter;
ppd_file_t *ppd_file;
gchar *value = NULL;
gint i;
- if (priv->option)
+ if (widget->option)
{
- option = cups_option_copy (priv->option);
- cups_option_free (priv->option);
- priv->option = NULL;
+ option = cups_option_copy (widget->option);
+ cups_option_free (widget->option);
+ widget->option = NULL;
}
- else if (priv->ppd_filename)
+ else if (widget->ppd_filename)
{
- ppd_file = ppdOpenFile (priv->ppd_filename);
+ ppd_file = ppdOpenFile (widget->ppd_filename);
ppdLocalize (ppd_file);
if (ppd_file)
@@ -527,7 +490,7 @@ update_widget_real (PpPPDOptionWidget *widget)
for (iter = ppdFirstOption(ppd_file); iter; iter = ppdNextOption(ppd_file))
{
- if (g_str_equal (iter->keyword, priv->option_name))
+ if (g_str_equal (iter->keyword, widget->option_name))
{
option = cups_option_copy (iter);
break;
@@ -537,9 +500,9 @@ update_widget_real (PpPPDOptionWidget *widget)
ppdClose (ppd_file);
}
- g_unlink (priv->ppd_filename);
- g_free (priv->ppd_filename);
- priv->ppd_filename = NULL;
+ g_unlink (widget->ppd_filename);
+ g_free (widget->ppd_filename);
+ widget->ppd_filename = NULL;
}
if (option)
@@ -556,24 +519,24 @@ update_widget_real (PpPPDOptionWidget *widget)
switch (option->ui)
{
case PPD_UI_BOOLEAN:
- g_signal_handlers_block_by_func (priv->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->switch_button, switch_changed_cb, widget);
if (g_ascii_strcasecmp (value, "True") == 0)
- gtk_switch_set_active (GTK_SWITCH (priv->switch_button), TRUE);
+ gtk_switch_set_active (GTK_SWITCH (widget->switch_button), TRUE);
else
- gtk_switch_set_active (GTK_SWITCH (priv->switch_button), FALSE);
- g_signal_handlers_unblock_by_func (priv->switch_button, switch_changed_cb, widget);
+ gtk_switch_set_active (GTK_SWITCH (widget->switch_button), FALSE);
+ g_signal_handlers_unblock_by_func (widget->switch_button, switch_changed_cb, widget);
break;
case PPD_UI_PICKONE:
- g_signal_handlers_block_by_func (priv->combo, combo_changed_cb, widget);
- combo_box_set (priv->combo, value);
- g_signal_handlers_unblock_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
+ combo_box_set (widget->combo, value);
+ g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
break;
case PPD_UI_PICKMANY:
- g_signal_handlers_block_by_func (priv->combo, combo_changed_cb, widget);
- combo_box_set (priv->combo, value);
- g_signal_handlers_unblock_by_func (priv->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
+ combo_box_set (widget->combo, value);
+ g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
break;
default:
@@ -584,9 +547,9 @@ update_widget_real (PpPPDOptionWidget *widget)
}
if (option->conflicted)
- gtk_widget_show (priv->image);
+ gtk_widget_show (widget->image);
else
- gtk_widget_hide (priv->image);
+ gtk_widget_hide (widget->image);
}
cups_option_free (option);
@@ -597,15 +560,14 @@ get_named_dest_cb (cups_dest_t *dest,
gpointer user_data)
{
PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
- PpPPDOptionWidgetPrivate *priv = widget->priv;
- if (priv->destination)
- cupsFreeDests (1, priv->destination);
+ if (widget->destination)
+ cupsFreeDests (1, widget->destination);
- priv->destination = dest;
- priv->destination_set = TRUE;
+ widget->destination = dest;
+ widget->destination_set = TRUE;
- if (priv->ppd_filename_set)
+ if (widget->ppd_filename_set)
{
update_widget_real (widget);
}
@@ -616,18 +578,17 @@ printer_get_ppd_cb (const gchar *ppd_filename,
gpointer user_data)
{
PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
- PpPPDOptionWidgetPrivate *priv = widget->priv;
- if (priv->ppd_filename)
+ if (widget->ppd_filename)
{
- g_unlink (priv->ppd_filename);
- g_free (priv->ppd_filename);
+ g_unlink (widget->ppd_filename);
+ g_free (widget->ppd_filename);
}
- priv->ppd_filename = g_strdup (ppd_filename);
- priv->ppd_filename_set = TRUE;
+ widget->ppd_filename = g_strdup (ppd_filename);
+ widget->ppd_filename_set = TRUE;
- if (priv->destination_set)
+ if (widget->destination_set)
{
update_widget_real (widget);
}
@@ -636,16 +597,14 @@ printer_get_ppd_cb (const gchar *ppd_filename,
static void
update_widget (PpPPDOptionWidget *widget)
{
- PpPPDOptionWidgetPrivate *priv = widget->priv;
-
- priv->ppd_filename_set = FALSE;
- priv->destination_set = FALSE;
+ widget->ppd_filename_set = FALSE;
+ widget->destination_set = FALSE;
- get_named_dest_async (priv->printer_name,
+ get_named_dest_async (widget->printer_name,
get_named_dest_cb,
widget);
- printer_get_ppd_async (priv->printer_name,
+ printer_get_ppd_async (widget->printer_name,
NULL,
0,
printer_get_ppd_cb,
diff --git a/panels/printers/pp-ppd-option-widget.h b/panels/printers/pp-ppd-option-widget.h
index 60f38109c..2216a8aa9 100644
--- a/panels/printers/pp-ppd-option-widget.h
+++ b/panels/printers/pp-ppd-option-widget.h
@@ -27,32 +27,8 @@
G_BEGIN_DECLS
-#define PP_TYPE_PPD_OPTION_WIDGET (pp_ppd_option_widget_get_type ())
-#define PP_PPD_OPTION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PP_TYPE_PPD_OPTION_WIDGET, PpPPDOptionWidget))
-#define PP_PPD_OPTION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PP_TYPE_PPD_OPTION_WIDGET, PpPPDOptionWidgetClass))
-#define PP_IS_PPD_OPTION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PP_TYPE_PPD_OPTION_WIDGET))
-#define PP_IS_PPD_OPTION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PP_TYPE_PPD_OPTION_WIDGET))
-#define PP_PPD_OPTION_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PP_TYPE_PPD_OPTION_WIDGET, PpPPDOptionWidgetClass))
-
-typedef struct _PpPPDOptionWidget PpPPDOptionWidget;
-typedef struct _PpPPDOptionWidgetClass PpPPDOptionWidgetClass;
-typedef struct PpPPDOptionWidgetPrivate PpPPDOptionWidgetPrivate;
-
-struct _PpPPDOptionWidget
-{
- GtkHBox parent_instance;
-
- PpPPDOptionWidgetPrivate *priv;
-};
-
-struct _PpPPDOptionWidgetClass
-{
- GtkHBoxClass parent_class;
-
- void (*changed) (PpPPDOptionWidget *widget);
-};
-
-GType pp_ppd_option_widget_get_type (void) G_GNUC_CONST;
+#define PP_TYPE_PPD_OPTION_WIDGET (pp_ppd_option_widget_get_type ())
+G_DECLARE_FINAL_TYPE (PpPPDOptionWidget, pp_ppd_option_widget, PP, PPD_OPTION_WIDGET, GtkBox)
GtkWidget *pp_ppd_option_widget_new (ppd_option_t *source,
const gchar *printer_name);
diff --git a/panels/printers/pp-print-device.c b/panels/printers/pp-print-device.c
index ec22e3b64..a75cbe394 100644
--- a/panels/printers/pp-print-device.c
+++ b/panels/printers/pp-print-device.c
@@ -20,10 +20,10 @@
#include "pp-print-device.h"
-G_DEFINE_TYPE (PpPrintDevice, pp_print_device, G_TYPE_OBJECT);
-
-struct _PpPrintDevicePrivate
+struct _PpPrintDevice
{
+ GObject parent_instance;
+
gchar *device_name;
gchar *display_name;
gchar *device_original_name;
@@ -40,6 +40,8 @@ struct _PpPrintDevicePrivate
gboolean is_network_device;
};
+G_DEFINE_TYPE (PpPrintDevice, pp_print_device, G_TYPE_OBJECT);
+
enum
{
PROP_0 = 0,
@@ -62,20 +64,18 @@ enum
static void
pp_print_device_finalize (GObject *object)
{
- PpPrintDevicePrivate *priv;
-
- priv = PP_PRINT_DEVICE (object)->priv;
+ PpPrintDevice *self = PP_PRINT_DEVICE (object);
- g_clear_pointer (&priv->device_name, g_free);
- g_clear_pointer (&priv->display_name, g_free);
- g_clear_pointer (&priv->device_original_name, g_free);
- g_clear_pointer (&priv->device_make_and_model, g_free);
- g_clear_pointer (&priv->device_location, g_free);
- g_clear_pointer (&priv->device_info, g_free);
- g_clear_pointer (&priv->device_uri, g_free);
- g_clear_pointer (&priv->device_id, g_free);
- g_clear_pointer (&priv->device_ppd, g_free);
- g_clear_pointer (&priv->host_name, g_free);
+ g_clear_pointer (&self->device_name, g_free);
+ g_clear_pointer (&self->display_name, g_free);
+ g_clear_pointer (&self->device_original_name, g_free);
+ g_clear_pointer (&self->device_make_and_model, g_free);
+ g_clear_pointer (&self->device_location, g_free);
+ g_clear_pointer (&self->device_info, g_free);
+ g_clear_pointer (&self->device_uri, g_free);
+ g_clear_pointer (&self->device_id, g_free);
+ g_clear_pointer (&self->device_ppd, g_free);
+ g_clear_pointer (&self->host_name, g_free);
G_OBJECT_CLASS (pp_print_device_parent_class)->finalize (object);
}
@@ -86,53 +86,51 @@ pp_print_device_get_property (GObject *object,
GValue *value,
GParamSpec *param_spec)
{
- PpPrintDevice *self;
-
- self = PP_PRINT_DEVICE (object);
+ PpPrintDevice *self = PP_PRINT_DEVICE (object);
switch (prop_id)
{
case PROP_DEVICE_NAME:
- g_value_set_string (value, self->priv->device_name);
+ g_value_set_string (value, self->device_name);
break;
case PROP_DISPLAY_NAME:
- g_value_set_string (value, self->priv->display_name);
+ g_value_set_string (value, self->display_name);
break;
case PROP_DEVICE_ORIGINAL_NAME:
- g_value_set_string (value, self->priv->device_original_name);
+ g_value_set_string (value, self->device_original_name);
break;
case PROP_DEVICE_MAKE_AND_MODEL:
- g_value_set_string (value, self->priv->device_make_and_model);
+ g_value_set_string (value, self->device_make_and_model);
break;
case PROP_DEVICE_LOCATION:
- g_value_set_string (value, self->priv->device_location);
+ g_value_set_string (value, self->device_location);
break;
case PROP_DEVICE_INFO:
- g_value_set_string (value, self->priv->device_info);
+ g_value_set_string (value, self->device_info);
break;
case PROP_DEVICE_URI:
- g_value_set_string (value, self->priv->device_uri);
+ g_value_set_string (value, self->device_uri);
break;
case PROP_DEVICE_ID:
- g_value_set_string (value, self->priv->device_id);
+ g_value_set_string (value, self->device_id);
break;
case PROP_DEVICE_PPD:
- g_value_set_string (value, self->priv->device_ppd);
+ g_value_set_string (value, self->device_ppd);
break;
case PROP_HOST_NAME:
- g_value_set_string (value, self->priv->host_name);
+ g_value_set_string (value, self->host_name);
break;
case PROP_HOST_PORT:
- g_value_set_int (value, self->priv->host_port);
+ g_value_set_int (value, self->host_port);
break;
case PROP_IS_AUTHENTICATED_SERVER:
- g_value_set_boolean (value, self->priv->is_authenticated_server);
+ g_value_set_boolean (value, self->is_authenticated_server);
break;
case PROP_ACQUISITION_METHOD:
- g_value_set_int (value, self->priv->acquisition_method);
+ g_value_set_int (value, self->acquisition_method);
break;
case PROP_IS_NETWORK_DEVICE:
- g_value_set_boolean (value, self->priv->is_network_device);
+ g_value_set_boolean (value, self->is_network_device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -153,56 +151,56 @@ pp_print_device_set_property (GObject *object,
switch (prop_id)
{
case PROP_DEVICE_NAME:
- g_free (self->priv->device_name);
- self->priv->device_name = g_value_dup_string (value);
+ g_free (self->device_name);
+ self->device_name = g_value_dup_string (value);
break;
case PROP_DISPLAY_NAME:
- g_free (self->priv->display_name);
- self->priv->display_name = g_value_dup_string (value);
+ g_free (self->display_name);
+ self->display_name = g_value_dup_string (value);
break;
case PROP_DEVICE_ORIGINAL_NAME:
- g_free (self->priv->device_original_name);
- self->priv->device_original_name = g_value_dup_string (value);
+ g_free (self->device_original_name);
+ self->device_original_name = g_value_dup_string (value);
break;
case PROP_DEVICE_MAKE_AND_MODEL:
- g_free (self->priv->device_make_and_model);
- self->priv->device_make_and_model = g_value_dup_string (value);
+ g_free (self->device_make_and_model);
+ self->device_make_and_model = g_value_dup_string (value);
break;
case PROP_DEVICE_LOCATION:
- g_free (self->priv->device_location);
- self->priv->device_location = g_value_dup_string (value);
+ g_free (self->device_location);
+ self->device_location = g_value_dup_string (value);
break;
case PROP_DEVICE_INFO:
- g_free (self->priv->device_info);
- self->priv->device_info = g_value_dup_string (value);
+ g_free (self->device_info);
+ self->device_info = g_value_dup_string (value);
break;
case PROP_DEVICE_URI:
- g_free (self->priv->device_uri);
- self->priv->device_uri = g_value_dup_string (value);
+ g_free (self->device_uri);
+ self->device_uri = g_value_dup_string (value);
break;
case PROP_DEVICE_ID:
- g_free (self->priv->device_id);
- self->priv->device_id = g_value_dup_string (value);
+ g_free (self->device_id);
+ self->device_id = g_value_dup_string (value);
break;
case PROP_DEVICE_PPD:
- g_free (self->priv->device_ppd);
- self->priv->device_ppd = g_value_dup_string (value);
+ g_free (self->device_ppd);
+ self->device_ppd = g_value_dup_string (value);
break;
case PROP_HOST_NAME:
- g_free (self->priv->host_name);
- self->priv->host_name = g_value_dup_string (value);
+ g_free (self->host_name);
+ self->host_name = g_value_dup_string (value);
break;
case PROP_HOST_PORT:
- self->priv->host_port = g_value_get_int (value);
+ self->host_port = g_value_get_int (value);
break;
case PROP_IS_AUTHENTICATED_SERVER:
- self->priv->is_authenticated_server = g_value_get_boolean (value);
+ self->is_authenticated_server = g_value_get_boolean (value);
break;
case PROP_ACQUISITION_METHOD:
- self->priv->acquisition_method = g_value_get_int (value);
+ self->acquisition_method = g_value_get_int (value);
break;
case PROP_IS_NETWORK_DEVICE:
- self->priv->is_network_device = g_value_get_boolean (value);
+ self->is_network_device = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -217,8 +215,6 @@ pp_print_device_class_init (PpPrintDeviceClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (PpPrintDevicePrivate));
-
gobject_class->set_property = pp_print_device_set_property;
gobject_class->get_property = pp_print_device_get_property;
@@ -340,9 +336,6 @@ pp_print_device_class_init (PpPrintDeviceClass *klass)
static void
pp_print_device_init (PpPrintDevice *printer)
{
- printer->priv = G_TYPE_INSTANCE_GET_PRIVATE (printer,
- PP_TYPE_PRINT_DEVICE,
- PpPrintDevicePrivate);
}
PpPrintDevice *
@@ -354,85 +347,85 @@ pp_print_device_new ()
gchar *
pp_print_device_get_device_name (PpPrintDevice *device)
{
- return device->priv->device_name;
+ return device->device_name;
}
gchar *
pp_print_device_get_display_name (PpPrintDevice *device)
{
- return device->priv->display_name;
+ return device->display_name;
}
gchar *
pp_print_device_get_device_original_name (PpPrintDevice *device)
{
- return device->priv->device_original_name;
+ return device->device_original_name;
}
gchar *
pp_print_device_get_device_make_and_model (PpPrintDevice *device)
{
- return device->priv->device_make_and_model;
+ return device->device_make_and_model;
}
gchar *
pp_print_device_get_device_location (PpPrintDevice *device)
{
- return device->priv->device_location;
+ return device->device_location;
}
gchar *
pp_print_device_get_device_info (PpPrintDevice *device)
{
- return device->priv->device_info;
+ return device->device_info;
}
gchar *
pp_print_device_get_device_uri (PpPrintDevice *device)
{
- return device->priv->device_uri;
+ return device->device_uri;
}
gchar *
pp_print_device_get_device_id (PpPrintDevice *device)
{
- return device->priv->device_id;
+ return device->device_id;
}
gchar *
pp_print_device_get_device_ppd (PpPrintDevice *device)
{
- return device->priv->device_ppd;
+ return device->device_ppd;
}
gchar *
pp_print_device_get_host_name (PpPrintDevice *device)
{
- return device->priv->host_name;
+ return device->host_name;
}
gint
pp_print_device_get_host_port (PpPrintDevice *device)
{
- return device->priv->host_port;
+ return device->host_port;
}
gboolean
pp_print_device_is_authenticated_server (PpPrintDevice *device)
{
- return device->priv->is_authenticated_server;
+ return device->is_authenticated_server;
}
gint
pp_print_device_get_acquisition_method (PpPrintDevice *device)
{
- return device->priv->acquisition_method;
+ return device->acquisition_method;
}
gboolean
pp_print_device_is_network_device (PpPrintDevice *device)
{
- return device->priv->is_network_device;
+ return device->is_network_device;
}
PpPrintDevice *
diff --git a/panels/printers/pp-print-device.h b/panels/printers/pp-print-device.h
index fde779317..ecf07a3ce 100644
--- a/panels/printers/pp-print-device.h
+++ b/panels/printers/pp-print-device.h
@@ -29,14 +29,6 @@ G_BEGIN_DECLS
#define PP_TYPE_PRINT_DEVICE (pp_print_device_get_type ())
G_DECLARE_FINAL_TYPE (PpPrintDevice, pp_print_device, PP, PRINT_DEVICE, GObject)
-typedef struct _PpPrintDevicePrivate PpPrintDevicePrivate;
-
-struct _PpPrintDevice
-{
- GObject parent_instance;
- PpPrintDevicePrivate *priv;
-};
-
PpPrintDevice *pp_print_device_new (void);
PpPrintDevice *pp_print_device_copy (PpPrintDevice *device);
gchar *pp_print_device_get_device_name (PpPrintDevice *device);
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index ba704b9c7..eaae50d3e 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -1043,7 +1043,7 @@ pp_printer_entry_class_init (PpPrinterEntryClass *klass)
g_signal_new ("printer-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PpPrinterEntryClass, printer_changed),
+ 0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
@@ -1051,7 +1051,7 @@ pp_printer_entry_class_init (PpPrinterEntryClass *klass)
g_signal_new ("printer-delete",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PpPrinterEntryClass, printer_delete),
+ 0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
diff --git a/panels/printers/pp-printer-entry.h b/panels/printers/pp-printer-entry.h
index 05544bc13..dbdfb966e 100644
--- a/panels/printers/pp-printer-entry.h
+++ b/panels/printers/pp-printer-entry.h
@@ -24,12 +24,7 @@
#include <cups/cups.h>
#define PP_PRINTER_ENTRY_TYPE (pp_printer_entry_get_type ())
-#define PP_PRINTER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PP_PRINTER_ENTRY_TYPE, PpPrinterEntry))
-
-typedef struct _PpPrinterEntry PpPrinterEntry;
-typedef struct _PpPrinterEntryClass PpPrinterEntryClass;
-
-GType pp_printer_entry_get_type (void);
+G_DECLARE_FINAL_TYPE (PpPrinterEntry, pp_printer_entry, PP, PRINTER_ENTRY, GtkListBoxRow)
PpPrinterEntry *pp_printer_entry_new (cups_dest_t printer,
gboolean is_authorized);
diff --git a/panels/printers/pp-printer.c b/panels/printers/pp-printer.c
index 79a6301a0..bd6cf49ff 100644
--- a/panels/printers/pp-printer.c
+++ b/panels/printers/pp-printer.c
@@ -22,21 +22,13 @@
#include "pp-job.h"
-typedef struct _PpPrinter PpPrinter;
-typedef struct _PpPrinterPrivate PpPrinterPrivate;
-
struct _PpPrinter
{
- GObject parent_instance;
- PpPrinterPrivate *priv;
+ GObject parent_instance;
+ gchar *printer_name;
};
-struct _PpPrinterPrivate
-{
- gchar *printer_name;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (PpPrinter, pp_printer, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PpPrinter, pp_printer, G_TYPE_OBJECT)
enum
{
@@ -47,9 +39,9 @@ enum
static void
pp_printer_dispose (GObject *object)
{
- PpPrinterPrivate *priv = PP_PRINTER (object)->priv;
+ PpPrinter *self = PP_PRINTER (object);
- g_free (priv->printer_name);
+ g_free (self->printer_name);
G_OBJECT_CLASS (pp_printer_parent_class)->dispose (object);
}
@@ -71,7 +63,7 @@ pp_printer_get_property (GObject *object,
switch (property_id)
{
case PROP_NAME:
- g_value_set_string (value, self->priv->printer_name);
+ g_value_set_string (value, self->printer_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -90,8 +82,8 @@ pp_printer_set_property (GObject *object,
switch (property_id)
{
case PROP_NAME:
- g_free (self->priv->printer_name);
- self->priv->printer_name = g_value_dup_string (value);
+ g_free (self->printer_name);
+ self->printer_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -121,9 +113,6 @@ pp_printer_class_init (PpPrinterClass *klass)
static void
pp_printer_init (PpPrinter *printer)
{
- printer->priv = G_TYPE_INSTANCE_GET_PRIVATE (printer,
- PP_TYPE_PRINTER,
- PpPrinterPrivate);
}
PpPrinter *
diff --git a/panels/printers/pp-printer.h b/panels/printers/pp-printer.h
index 80b6b96c6..17594d3c8 100644
--- a/panels/printers/pp-printer.h
+++ b/panels/printers/pp-printer.h
@@ -29,7 +29,6 @@
G_BEGIN_DECLS
#define PP_TYPE_PRINTER (pp_printer_get_type ())
-
G_DECLARE_FINAL_TYPE (PpPrinter, pp_printer, PP, PRINTER, GObject)
GType pp_printer_get_type (void) G_GNUC_CONST;
diff --git a/panels/printers/pp-samba.c b/panels/printers/pp-samba.c
index 04db2d8ab..47d8d9b57 100644
--- a/panels/printers/pp-samba.c
+++ b/panels/printers/pp-samba.c
@@ -28,8 +28,10 @@
#define POLL_DELAY 100000
-struct _PpSambaPrivate
+struct _PpSamba
{
+ PpHost parent_instance;
+
/* Auth info */
gchar *server;
gchar *share;
@@ -44,15 +46,13 @@ G_DEFINE_TYPE (PpSamba, pp_samba, PP_TYPE_HOST);
static void
pp_samba_finalize (GObject *object)
{
- PpSambaPrivate *priv;
-
- priv = PP_SAMBA (object)->priv;
+ PpSamba *self = PP_SAMBA (object);
- g_free (priv->server);
- g_free (priv->share);
- g_free (priv->workgroup);
- g_free (priv->username);
- g_free (priv->password);
+ g_free (self->server);
+ g_free (self->share);
+ g_free (self->workgroup);
+ g_free (self->username);
+ g_free (self->password);
G_OBJECT_CLASS (pp_samba_parent_class)->finalize (object);
}
@@ -62,17 +62,12 @@ pp_samba_class_init (PpSambaClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (PpSambaPrivate));
-
gobject_class->finalize = pp_samba_finalize;
}
static void
pp_samba_init (PpSamba *samba)
{
- samba->priv = G_TYPE_INSTANCE_GET_PRIVATE (samba,
- PP_TYPE_SAMBA,
- PpSambaPrivate);
}
PpSamba *
@@ -120,21 +115,19 @@ pp_samba_set_auth_info (PpSamba *samba,
const gchar *username,
const gchar *password)
{
- PpSambaPrivate *priv = samba->priv;
-
- g_free (priv->username);
+ g_free (samba->username);
if ((username != NULL) && (username[0] != '\0'))
- priv->username = g_strdup (username);
+ samba->username = g_strdup (username);
else
- priv->username = NULL;
+ samba->username = NULL;
- g_free (priv->password);
+ g_free (samba->password);
if ((password != NULL) && (password[0] != '\0'))
- priv->password = g_strdup (password);
+ samba->password = g_strdup (password);
else
- priv->password = NULL;
+ samba->password = NULL;
- priv->waiting = FALSE;
+ samba->waiting = FALSE;
}
static void
@@ -157,11 +150,11 @@ auth_fn (SMBCCTX *smb_context,
if (!data->cancelled)
{
- samba->priv->server = g_strdup (server);
- samba->priv->share = g_strdup (share);
- samba->priv->workgroup = g_strdup (workgroup);
- samba->priv->username = g_strdup (username);
- samba->priv->password = g_strdup (password);
+ samba->server = g_strdup (server);
+ samba->share = g_strdup (share);
+ samba->workgroup = g_strdup (workgroup);
+ samba->username = g_strdup (username);
+ samba->password = g_strdup (password);
source = g_idle_source_new ();
g_source_set_callback (source,
@@ -171,14 +164,14 @@ auth_fn (SMBCCTX *smb_context,
g_source_attach (source, data->context);
g_source_unref (source);
- samba->priv->waiting = TRUE;
+ samba->waiting = TRUE;
/*
* smbclient needs to get authentication data
* from this synchronous callback so we are blocking
* until we get them
*/
- while (samba->priv->waiting)
+ while (samba->waiting)
{
g_usleep (POLL_DELAY);
}
@@ -186,23 +179,23 @@ auth_fn (SMBCCTX *smb_context,
/* Samba tries to call the auth_fn again if we just set the values
* to NULL when we want to cancel the authentication
*/
- if (samba->priv->username == NULL && samba->priv->password == NULL)
+ if (samba->username == NULL && samba->password == NULL)
data->cancelled = TRUE;
- if (samba->priv->username != NULL)
+ if (samba->username != NULL)
{
- if (g_strcmp0 (username, samba->priv->username) != 0)
- g_strlcpy (username, samba->priv->username, unmaxlen);
+ if (g_strcmp0 (username, samba->username) != 0)
+ g_strlcpy (username, samba->username, unmaxlen);
}
else
{
username[0] = '\0';
}
- if (samba->priv->password != NULL)
+ if (samba->password != NULL)
{
- if (g_strcmp0 (password, samba->priv->password) != 0)
- g_strlcpy (password, samba->priv->password, pwmaxlen);
+ if (g_strcmp0 (password, samba->password) != 0)
+ g_strlcpy (password, samba->password, pwmaxlen);
}
else
{
diff --git a/panels/printers/pp-samba.h b/panels/printers/pp-samba.h
index d0a5023c1..cef347a66 100644
--- a/panels/printers/pp-samba.h
+++ b/panels/printers/pp-samba.h
@@ -26,29 +26,8 @@
G_BEGIN_DECLS
-#define PP_TYPE_SAMBA (pp_samba_get_type ())
-#define PP_SAMBA(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PP_TYPE_SAMBA, PpSamba))
-#define PP_SAMBA_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PP_TYPE_SAMBA, PpSambaClass))
-#define PP_IS_SAMBA(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PP_TYPE_SAMBA))
-#define PP_IS_SAMBA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PP_TYPE_SAMBA))
-#define PP_SAMBA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PP_TYPE_SAMBA, PpSambaClass))
-
-typedef struct _PpSamba PpSamba;
-typedef struct _PpSambaClass PpSambaClass;
-typedef struct _PpSambaPrivate PpSambaPrivate;
-
-struct _PpSamba
-{
- PpHost parent_instance;
- PpSambaPrivate *priv;
-};
-
-struct _PpSambaClass
-{
- PpHostClass parent_class;
-};
-
-GType pp_samba_get_type (void) G_GNUC_CONST;
+#define PP_TYPE_SAMBA (pp_samba_get_type ())
+G_DECLARE_FINAL_TYPE (PpSamba, pp_samba, PP, SAMBA, PpHost)
PpSamba *pp_samba_new (const gchar *hostname);
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index ab367b6ca..cb2e96e1e 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -26,9 +26,7 @@
#include <gio/gdesktopappinfo.h>
#include <glib/gi18n.h>
-CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
-
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->builder, s))
#define REMEMBER_RECENT_FILES "remember-recent-files"
#define RECENT_FILES_MAX_AGE "recent-files-max-age"
@@ -42,8 +40,10 @@ CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
#define APP_PERMISSIONS_TABLE "gnome"
#define APP_PERMISSIONS_ID "geolocation"
-struct _CcPrivacyPanelPrivate
+struct _CcPrivacyPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *recent_dialog;
GtkWidget *screen_lock_dialog;
@@ -77,6 +77,8 @@ struct _CcPrivacyPanelPrivate
GtkSizeGroup *location_icon_size_group;
};
+CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
+
static char *
get_os_name (void)
{
@@ -165,9 +167,9 @@ update_lock_screen_sensitivity (CcPrivacyPanel *self)
GtkWidget *widget;
gboolean locked;
- locked = g_settings_get_boolean (self->priv->lockdown_settings, "disable-lock-screen");
+ locked = g_settings_get_boolean (self->lockdown_settings, "disable-lock-screen");
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "screen_lock_dialog_grid"));
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "screen_lock_dialog_grid"));
gtk_widget_set_sensitive (widget, !locked);
}
@@ -290,7 +292,7 @@ add_row (CcPrivacyPanel *self,
gtk_container_add (GTK_CONTAINER (row), box);
g_object_set_data (G_OBJECT (row), "dialog-id", (gpointer)dialog_id);
gtk_widget_set_hexpand (box, TRUE);
- gtk_container_add (GTK_CONTAINER (self->priv->list_box), row);
+ gtk_container_add (GTK_CONTAINER (self->list_box), row);
w = gtk_label_new (label);
gtk_widget_set_halign (w, GTK_ALIGN_START);
@@ -332,7 +334,7 @@ lock_combo_changed_cb (GtkWidget *widget,
gtk_tree_model_get (model, &iter,
1, &delay,
-1);
- g_settings_set (self->priv->lock_settings, "lock-delay", "u", delay);
+ g_settings_set (self->lock_settings, "lock-delay", "u", delay);
}
static void
@@ -356,7 +358,7 @@ set_lock_value_for_combo (GtkComboBox *combo_box,
i = 0;
/* try to make the UI match the lock setting */
- g_settings_get (self->priv->lock_settings, "lock-delay", "u", &value);
+ g_settings_get (self->lock_settings, "lock-delay", "u", &value);
do
{
gtk_tree_model_get (model, &iter,
@@ -383,24 +385,24 @@ add_screen_lock (CcPrivacyPanel *self)
GtkWidget *dialog;
GtkWidget *label;
- w = get_on_off_label (self->priv->lock_settings, "lock-enabled");
+ w = get_on_off_label (self->lock_settings, "lock-enabled");
add_row (self, _("Screen Lock"), "screen_lock_dialog", w);
- dialog = self->priv->screen_lock_dialog;
+ dialog = self->screen_lock_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "automatic_screen_lock"));
- g_settings_bind (self->priv->lock_settings, "lock-enabled",
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "automatic_screen_lock"));
+ g_settings_bind (self->lock_settings, "lock-enabled",
w, "active",
G_SETTINGS_BIND_DEFAULT);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "lock_after_combo"));
- g_settings_bind (self->priv->lock_settings, "lock-enabled",
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "lock_after_combo"));
+ g_settings_bind (self->lock_settings, "lock-enabled",
w, "sensitive",
G_SETTINGS_BIND_GET);
- label = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "lock_after_label"));
+ label = GTK_WIDGET (gtk_builder_get_object (self->builder, "lock_after_label"));
g_object_bind_property (w, "sensitive", label, "sensitive", G_BINDING_DEFAULT);
@@ -408,8 +410,8 @@ add_screen_lock (CcPrivacyPanel *self)
g_signal_connect (w, "changed",
G_CALLBACK (lock_combo_changed_cb), self);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "show_notifications"));
- g_settings_bind (self->priv->notification_settings, "show-in-lock-screen",
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "show_notifications"));
+ g_settings_bind (self->notification_settings, "show-in-lock-screen",
w, "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -417,15 +419,14 @@ add_screen_lock (CcPrivacyPanel *self)
static void
update_location_label (CcPrivacyPanel *self)
{
- CcPrivacyPanelPrivate *priv = self->priv;
gboolean in_use = FALSE, on;
const gchar *label;
- if (priv->gclue_manager != NULL)
+ if (self->gclue_manager != NULL)
{
GVariant *variant;
- variant = g_dbus_proxy_get_cached_property (priv->gclue_manager, "InUse");
+ variant = g_dbus_proxy_get_cached_property (self->gclue_manager, "InUse");
if (variant != NULL)
{
in_use = g_variant_get_boolean (variant);
@@ -435,14 +436,14 @@ update_location_label (CcPrivacyPanel *self)
if (in_use)
{
- gtk_label_set_label (GTK_LABEL (priv->location_label), _("In use"));
+ gtk_label_set_label (GTK_LABEL (self->location_label), _("In use"));
return;
}
- on = g_settings_get_boolean (priv->location_settings, LOCATION_ENABLED);
+ on = g_settings_get_boolean (self->location_settings, LOCATION_ENABLED);
label = on ? C_("Location services status", "On") :
C_("Location services status", "Off");
- gtk_label_set_label (GTK_LABEL (priv->location_label), label);
+ gtk_label_set_label (GTK_LABEL (self->location_label), label);
}
static void
@@ -473,9 +474,9 @@ on_gclue_manager_ready (GObject *source_object,
return;
}
self = user_data;
- self->priv->gclue_manager = proxy;
+ self->gclue_manager = proxy;
- g_signal_connect (self->priv->gclue_manager,
+ g_signal_connect (self->gclue_manager,
"g-properties-changed",
G_CALLBACK (on_gclue_manager_props_changed),
self);
@@ -545,7 +546,7 @@ on_location_app_state_set (GtkSwitch *widget,
data->changing_state = TRUE;
data->pending_state = state;
- g_variant_iter_init (&iter, self->priv->location_apps_perms);
+ g_variant_iter_init (&iter, self->location_apps_perms);
g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
while (g_variant_iter_loop (&iter, "{s^as}", &key, &value))
{
@@ -572,14 +573,14 @@ on_location_app_state_set (GtkSwitch *widget,
TRUE,
APP_PERMISSIONS_ID,
&builder,
- self->priv->location_apps_data);
+ self->location_apps_data);
- g_dbus_proxy_call (self->priv->perm_store,
+ g_dbus_proxy_call (self->perm_store,
"Set",
params,
G_DBUS_CALL_FLAGS_NONE,
-1,
- self->priv->cancellable,
+ self->cancellable,
on_perm_store_set_done,
data);
@@ -592,7 +593,6 @@ add_location_app (CcPrivacyPanel *self,
gboolean enabled,
gint64 last_used)
{
- CcPrivacyPanelPrivate *priv = self->priv;
GDesktopAppInfo *app_info;
char *desktop_id;
GtkWidget *box, *row, *w;
@@ -601,7 +601,7 @@ add_location_app (CcPrivacyPanel *self,
char *last_used_str;
LocationAppStateData *data;
- w = g_hash_table_lookup (priv->location_app_switches, app_id);
+ w = g_hash_table_lookup (self->location_app_switches, app_id);
if (w != NULL)
{
gtk_switch_set_active (GTK_SWITCH (w), enabled);
@@ -623,13 +623,13 @@ add_location_app (CcPrivacyPanel *self,
gtk_widget_set_margin_bottom (box, 12);
gtk_container_add (GTK_CONTAINER (row), box);
gtk_widget_set_hexpand (box, TRUE);
- gtk_container_add (GTK_CONTAINER (priv->location_apps_list_box), row);
+ gtk_container_add (GTK_CONTAINER (self->location_apps_list_box), row);
icon = g_app_info_get_icon (G_APP_INFO (app_info));
w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
- gtk_size_group_add_widget (priv->location_icon_size_group, w);
+ gtk_size_group_add_widget (self->location_icon_size_group, w);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
w = gtk_label_new (g_app_info_get_name (G_APP_INFO (app_info)));
@@ -656,10 +656,10 @@ add_location_app (CcPrivacyPanel *self,
gtk_widget_set_halign (w, GTK_ALIGN_END);
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
- g_settings_bind (priv->location_settings, LOCATION_ENABLED,
+ g_settings_bind (self->location_settings, LOCATION_ENABLED,
w, "sensitive",
G_SETTINGS_BIND_DEFAULT);
- g_hash_table_insert (priv->location_app_switches,
+ g_hash_table_insert (self->location_app_switches,
g_strdup (app_id),
g_object_ref (w));
@@ -684,18 +684,15 @@ update_perm_store (CcPrivacyPanel *self,
GVariant *permissions,
GVariant *permissions_data)
{
- CcPrivacyPanelPrivate *priv;
GVariantIter iter;
gchar *key;
gchar **value;
GList *children;
- priv = self->priv;
-
- g_clear_pointer (&priv->location_apps_perms, g_variant_unref);
- priv->location_apps_perms = permissions;
- g_clear_pointer (&priv->location_apps_data, g_variant_unref);
- priv->location_apps_data = permissions_data;
+ g_clear_pointer (&self->location_apps_perms, g_variant_unref);
+ self->location_apps_perms = permissions;
+ g_clear_pointer (&self->location_apps_data, g_variant_unref);
+ self->location_apps_data = permissions_data;
g_variant_iter_init (&iter, permissions);
while (g_variant_iter_loop (&iter, "{s^as}", &key, &value))
@@ -715,11 +712,11 @@ update_perm_store (CcPrivacyPanel *self,
add_location_app (self, key, enabled, last_used);
}
- children = gtk_container_get_children (GTK_CONTAINER (priv->location_apps_list_box));
+ children = gtk_container_get_children (GTK_CONTAINER (self->location_apps_list_box));
if (g_list_length (children) > 0)
{
- gtk_widget_set_visible (priv->location_apps_label, TRUE);
- gtk_widget_set_visible (priv->location_apps_frame, TRUE);
+ gtk_widget_set_visible (self->location_apps_label, TRUE);
+ gtk_widget_set_visible (self->location_apps_frame, TRUE);
}
g_list_free (children);
}
@@ -794,17 +791,17 @@ on_perm_store_ready (GObject *source_object,
return;
}
self = user_data;
- self->priv->perm_store = proxy;
+ self->perm_store = proxy;
params = g_variant_new ("(ss)",
APP_PERMISSIONS_TABLE,
APP_PERMISSIONS_ID);
- g_dbus_proxy_call (self->priv->perm_store,
+ g_dbus_proxy_call (self->perm_store,
"Lookup",
params,
G_DBUS_CALL_FLAGS_NONE,
-1,
- self->priv->cancellable,
+ self->cancellable,
on_perm_store_lookup_done,
self);
}
@@ -812,28 +809,27 @@ on_perm_store_ready (GObject *source_object,
static void
add_location (CcPrivacyPanel *self)
{
- CcPrivacyPanelPrivate *priv = self->priv;
GtkWidget *w;
GtkWidget *dialog;
- priv->location_label = gtk_label_new ("");
+ self->location_label = gtk_label_new ("");
update_location_label (self);
add_row (self,
_("Location Services"),
"location_dialog",
- priv->location_label);
+ self->location_label);
- dialog = priv->location_dialog;
+ dialog = self->location_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (priv->builder, "location_services_switch"));
- g_settings_bind (priv->location_settings, LOCATION_ENABLED,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "location_services_switch"));
+ g_settings_bind (self->location_settings, LOCATION_ENABLED,
w, "active",
G_SETTINGS_BIND_DEFAULT);
- priv->location_app_switches = g_hash_table_new_full (g_str_hash,
+ self->location_app_switches = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
@@ -844,7 +840,7 @@ add_location (CcPrivacyPanel *self)
"org.freedesktop.GeoClue2",
"/org/freedesktop/GeoClue2/Manager",
"org.freedesktop.GeoClue2.Manager",
- priv->cancellable,
+ self->cancellable,
on_gclue_manager_ready,
self);
@@ -854,7 +850,7 @@ add_location (CcPrivacyPanel *self)
"org.freedesktop.impl.portal.PermissionStore",
"/org/freedesktop/impl/portal/PermissionStore",
"org.freedesktop.impl.portal.PermissionStore",
- priv->cancellable,
+ self->cancellable,
on_perm_store_ready,
self);
}
@@ -878,7 +874,7 @@ retain_history_combo_changed_cb (GtkWidget *widget,
gtk_tree_model_get (model, &iter,
1, &value,
-1);
- g_settings_set (self->priv->privacy_settings, RECENT_FILES_MAX_AGE, "i", value);
+ g_settings_set (self->privacy_settings, RECENT_FILES_MAX_AGE, "i", value);
}
static void
@@ -902,7 +898,7 @@ set_retain_history_value_for_combo (GtkComboBox *combo_box,
i = 0;
/* try to make the UI match the setting */
- g_settings_get (self->priv->privacy_settings, RECENT_FILES_MAX_AGE, "i", &value);
+ g_settings_get (self->privacy_settings, RECENT_FILES_MAX_AGE, "i", &value);
do
{
gtk_tree_model_get (model, &iter,
@@ -938,31 +934,31 @@ add_usage_history (CcPrivacyPanel *self)
GtkWidget *dialog;
GtkWidget *label;
- w = get_on_off_label (self->priv->privacy_settings, REMEMBER_RECENT_FILES);
+ w = get_on_off_label (self->privacy_settings, REMEMBER_RECENT_FILES);
add_row (self, _("Usage & History"), "recent_dialog", w);
- dialog = self->priv->recent_dialog;
+ dialog = self->recent_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "recently_used_switch"));
- g_settings_bind (self->priv->privacy_settings, REMEMBER_RECENT_FILES,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "recently_used_switch"));
+ g_settings_bind (self->privacy_settings, REMEMBER_RECENT_FILES,
w, "active",
G_SETTINGS_BIND_DEFAULT);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "retain_history_combo"));
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "retain_history_combo"));
set_retain_history_value_for_combo (GTK_COMBO_BOX (w), self);
g_signal_connect (w, "changed",
G_CALLBACK (retain_history_combo_changed_cb), self);
- g_settings_bind (self->priv->privacy_settings, REMEMBER_RECENT_FILES,
+ g_settings_bind (self->privacy_settings, REMEMBER_RECENT_FILES,
w, "sensitive",
G_SETTINGS_BIND_GET);
- label = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "retain_history_label"));
+ label = GTK_WIDGET (gtk_builder_get_object (self->builder, "retain_history_label"));
g_object_bind_property (w, "sensitive", label, "sensitive", G_BINDING_DEFAULT);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "clear_recent_button"));
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "clear_recent_button"));
g_signal_connect_swapped (w, "clicked",
G_CALLBACK (clear_recent), self);
@@ -987,7 +983,7 @@ purge_after_combo_changed_cb (GtkWidget *widget,
gtk_tree_model_get (model, &iter,
1, &value,
-1);
- g_settings_set (self->priv->privacy_settings, OLD_FILES_AGE, "u", value);
+ g_settings_set (self->privacy_settings, OLD_FILES_AGE, "u", value);
}
static void
@@ -1011,7 +1007,7 @@ set_purge_after_value_for_combo (GtkComboBox *combo_box,
i = 0;
/* try to make the UI match the purge setting */
- g_settings_get (self->priv->privacy_settings, OLD_FILES_AGE, "u", &value);
+ g_settings_get (self->privacy_settings, OLD_FILES_AGE, "u", &value);
do
{
gtk_tree_model_get (model, &iter,
@@ -1116,33 +1112,33 @@ add_trash_temp (CcPrivacyPanel *self)
GtkWidget *w;
GtkWidget *dialog;
- w = get_on_off_label2 (self->priv->privacy_settings, REMOVE_OLD_TRASH_FILES, REMOVE_OLD_TEMP_FILES);
+ w = get_on_off_label2 (self->privacy_settings, REMOVE_OLD_TRASH_FILES, REMOVE_OLD_TEMP_FILES);
add_row (self, _("Purge Trash & Temporary Files"), "trash_dialog", w);
- dialog = self->priv->trash_dialog;
+ dialog = self->trash_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "purge_trash_switch"));
- g_settings_bind (self->priv->privacy_settings, REMOVE_OLD_TRASH_FILES,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "purge_trash_switch"));
+ g_settings_bind (self->privacy_settings, REMOVE_OLD_TRASH_FILES,
w, "active",
G_SETTINGS_BIND_DEFAULT);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "purge_temp_switch"));
- g_settings_bind (self->priv->privacy_settings, REMOVE_OLD_TEMP_FILES,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "purge_temp_switch"));
+ g_settings_bind (self->privacy_settings, REMOVE_OLD_TEMP_FILES,
w, "active",
G_SETTINGS_BIND_DEFAULT);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "purge_after_combo"));
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "purge_after_combo"));
set_purge_after_value_for_combo (GTK_COMBO_BOX (w), self);
g_signal_connect (w, "changed",
G_CALLBACK (purge_after_combo_changed_cb), self);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "empty_trash_button"));
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "empty_trash_button"));
g_signal_connect_swapped (w, "clicked", G_CALLBACK (empty_trash), self);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "purge_temp_button"));
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "purge_temp_button"));
g_signal_connect_swapped (w, "clicked", G_CALLBACK (purge_temp), self);
}
@@ -1156,15 +1152,15 @@ add_software (CcPrivacyPanel *self)
* https://bugzilla.gnome.org/show_bug.cgi?id=726234 */
return;
- w = get_on_off_label (self->priv->privacy_settings, SEND_SOFTWARE_USAGE_STATS);
+ w = get_on_off_label (self->privacy_settings, SEND_SOFTWARE_USAGE_STATS);
add_row (self, _("Software Usage"), "software_dialog", w);
- dialog = self->priv->software_dialog;
+ dialog = self->software_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "software_usage_switch"));
- g_settings_bind (self->priv->privacy_settings, SEND_SOFTWARE_USAGE_STATS,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "software_usage_switch"));
+ g_settings_bind (self->privacy_settings, SEND_SOFTWARE_USAGE_STATS,
w, "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -1177,7 +1173,7 @@ abrt_appeared_cb (GDBusConnection *connection,
{
CcPrivacyPanel *self = user_data;
g_debug ("ABRT appeared");
- gtk_widget_show (self->priv->abrt_row);
+ gtk_widget_show (self->abrt_row);
}
static void
@@ -1187,7 +1183,7 @@ abrt_vanished_cb (GDBusConnection *connection,
{
CcPrivacyPanel *self = user_data;
g_debug ("ABRT vanished");
- gtk_widget_hide (self->priv->abrt_row);
+ gtk_widget_hide (self->abrt_row);
}
static void
@@ -1197,16 +1193,16 @@ add_abrt (CcPrivacyPanel *self)
GtkWidget *dialog;
char *os_name, *url, *msg;
- w = get_abrt_label (self->priv->privacy_settings, REPORT_TECHNICAL_PROBLEMS);
- self->priv->abrt_row = add_row (self, _("Problem Reporting"), "abrt_dialog", w);
- gtk_widget_hide (self->priv->abrt_row);
+ w = get_abrt_label (self->privacy_settings, REPORT_TECHNICAL_PROBLEMS);
+ self->abrt_row = add_row (self, _("Problem Reporting"), "abrt_dialog", w);
+ gtk_widget_hide (self->abrt_row);
- dialog = self->priv->abrt_dialog;
+ dialog = self->abrt_dialog;
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "abrt_switch"));
- g_settings_bind (self->priv->privacy_settings, REPORT_TECHNICAL_PROBLEMS,
+ w = GTK_WIDGET (gtk_builder_get_object (self->builder, "abrt_switch"));
+ g_settings_bind (self->privacy_settings, REPORT_TECHNICAL_PROBLEMS,
w, "active",
G_SETTINGS_BIND_DEFAULT);
@@ -1215,7 +1211,7 @@ add_abrt (CcPrivacyPanel *self)
msg = g_strdup_printf (_("Sending reports of technical problems helps us improve %s. Reports are sent anonymously and are scrubbed of personal data."),
os_name);
g_free (os_name);
- gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (self->priv->builder, "abrt_explanation_label")), msg);
+ gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (self->builder, "abrt_explanation_label")), msg);
g_free (msg);
url = get_privacy_policy_url ();
@@ -1226,10 +1222,10 @@ add_abrt (CcPrivacyPanel *self)
}
msg = g_strdup_printf ("<a href=\"%s\">%s</a>", url, _("Privacy Policy"));
g_free (url);
- gtk_label_set_markup (GTK_LABEL (gtk_builder_get_object (self->priv->builder, "abrt_policy_linklabel")), msg);
+ gtk_label_set_markup (GTK_LABEL (gtk_builder_get_object (self->builder, "abrt_policy_linklabel")), msg);
g_free (msg);
- self->priv->abrt_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ self->abrt_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"org.freedesktop.problems.daemon",
G_BUS_NAME_WATCHER_FLAGS_NONE,
abrt_appeared_cb,
@@ -1241,34 +1237,34 @@ add_abrt (CcPrivacyPanel *self)
static void
cc_privacy_panel_finalize (GObject *object)
{
- CcPrivacyPanelPrivate *priv = CC_PRIVACY_PANEL (object)->priv;
+ CcPrivacyPanel *self = CC_PRIVACY_PANEL (object);
- if (priv->abrt_watch_id > 0)
+ if (self->abrt_watch_id > 0)
{
- g_bus_unwatch_name (priv->abrt_watch_id);
- priv->abrt_watch_id = 0;
+ g_bus_unwatch_name (self->abrt_watch_id);
+ self->abrt_watch_id = 0;
}
- g_cancellable_cancel (priv->cancellable);
- g_clear_pointer (&priv->recent_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->screen_lock_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->location_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->trash_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->software_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->abrt_dialog, gtk_widget_destroy);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->lockdown_settings);
- g_clear_object (&priv->lock_settings);
- g_clear_object (&priv->privacy_settings);
- g_clear_object (&priv->notification_settings);
- g_clear_object (&priv->location_settings);
- g_clear_object (&priv->gclue_manager);
- g_clear_object (&priv->cancellable);
- g_clear_object (&priv->perm_store);
- g_clear_object (&priv->location_icon_size_group);
- g_clear_pointer (&priv->location_apps_perms, g_variant_unref);
- g_clear_pointer (&priv->location_apps_data, g_variant_unref);
- g_clear_pointer (&priv->location_app_switches, g_hash_table_unref);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_pointer (&self->recent_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->screen_lock_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->location_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->trash_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->software_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->abrt_dialog, gtk_widget_destroy);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->lockdown_settings);
+ g_clear_object (&self->lock_settings);
+ g_clear_object (&self->privacy_settings);
+ g_clear_object (&self->notification_settings);
+ g_clear_object (&self->location_settings);
+ g_clear_object (&self->gclue_manager);
+ g_clear_object (&self->cancellable);
+ g_clear_object (&self->perm_store);
+ g_clear_object (&self->location_icon_size_group);
+ g_clear_pointer (&self->location_apps_perms, g_variant_unref);
+ g_clear_pointer (&self->location_apps_data, g_variant_unref);
+ g_clear_pointer (&self->location_app_switches, g_hash_table_unref);
G_OBJECT_CLASS (cc_privacy_panel_parent_class)->finalize (object);
}
@@ -1288,7 +1284,7 @@ activate_row (CcPrivacyPanel *self,
GtkWidget *toplevel;
dialog_id = g_object_get_data (G_OBJECT (row), "dialog-id");
- w = gtk_builder_get_object (self->priv->builder, dialog_id);
+ w = gtk_builder_get_object (self->builder, dialog_id);
if (w == NULL)
{
g_warning ("No such dialog: %s", dialog_id);
@@ -1309,14 +1305,13 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
GtkWidget *frame;
guint res;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelPrivate);
g_resources_register (cc_privacy_get_resource ());
- self->priv->cancellable = g_cancellable_new ();
- self->priv->builder = gtk_builder_new ();
+ self->cancellable = g_cancellable_new ();
+ self->builder = gtk_builder_new ();
error = NULL;
- res = gtk_builder_add_from_resource (self->priv->builder,
+ res = gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/privacy/privacy.ui",
&error);
@@ -1328,26 +1323,26 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
return;
}
- self->priv->recent_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "recent_dialog"));
- self->priv->screen_lock_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "screen_lock_dialog"));
- self->priv->location_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "location_dialog"));
- self->priv->trash_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "trash_dialog"));
- self->priv->software_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "software_dialog"));
- self->priv->abrt_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "abrt_dialog"));
+ self->recent_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "recent_dialog"));
+ self->screen_lock_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "screen_lock_dialog"));
+ self->location_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "location_dialog"));
+ self->trash_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "trash_dialog"));
+ self->software_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "software_dialog"));
+ self->abrt_dialog = GTK_WIDGET (gtk_builder_get_object (self->builder, "abrt_dialog"));
frame = WID ("frame");
widget = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (widget), GTK_SELECTION_NONE);
gtk_container_add (GTK_CONTAINER (frame), widget);
- self->priv->list_box = widget;
+ self->list_box = widget;
gtk_widget_show (widget);
- self->priv->location_apps_list_box = WID ("location_apps_list_box");
- gtk_list_box_set_header_func (GTK_LIST_BOX (self->priv->location_apps_list_box),
+ self->location_apps_list_box = WID ("location_apps_list_box");
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->location_apps_list_box),
cc_list_box_update_header_func,
NULL, NULL);
- self->priv->location_apps_frame = WID ("location_apps_frame");
- self->priv->location_apps_label = WID ("location_apps_label");
- self->priv->location_icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ self->location_apps_frame = WID ("location_apps_frame");
+ self->location_apps_label = WID ("location_apps_label");
+ self->location_icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
g_signal_connect_swapped (widget, "row-activated",
G_CALLBACK (activate_row), self);
@@ -1356,11 +1351,11 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
cc_list_box_update_header_func,
NULL, NULL);
- self->priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
- self->priv->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
- self->priv->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
- self->priv->notification_settings = g_settings_new ("org.gnome.desktop.notifications");
- self->priv->location_settings = g_settings_new ("org.gnome.system.location");
+ self->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
+ self->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
+ self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
+ self->notification_settings = g_settings_new ("org.gnome.desktop.notifications");
+ self->location_settings = g_settings_new ("org.gnome.system.location");
add_screen_lock (self);
add_location (self);
@@ -1369,7 +1364,7 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
add_software (self);
add_abrt (self);
- g_signal_connect (self->priv->lockdown_settings, "changed",
+ g_signal_connect (self->lockdown_settings, "changed",
G_CALLBACK (on_lockdown_settings_changed), self);
update_lock_screen_sensitivity (self);
@@ -1386,6 +1381,4 @@ cc_privacy_panel_class_init (CcPrivacyPanelClass *klass)
panel_class->get_help_uri = cc_privacy_panel_get_help_uri;
oclass->finalize = cc_privacy_panel_finalize;
-
- g_type_class_add_private (klass, sizeof (CcPrivacyPanelPrivate));
}
diff --git a/panels/privacy/cc-privacy-panel.h b/panels/privacy/cc-privacy-panel.h
index f56f5ee81..fb206ff63 100644
--- a/panels/privacy/cc-privacy-panel.h
+++ b/panels/privacy/cc-privacy-panel.h
@@ -25,45 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_PRIVACY_PANEL cc_privacy_panel_get_type()
-
-#define CC_PRIVACY_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_PRIVACY_PANEL, CcPrivacyPanel))
-
-#define CC_PRIVACY_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelClass))
-
-#define CC_IS_PRIVACY_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_PRIVACY_PANEL))
-
-#define CC_IS_PRIVACY_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_PRIVACY_PANEL))
-
-#define CC_PRIVACY_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelClass))
-
-typedef struct _CcPrivacyPanel CcPrivacyPanel;
-typedef struct _CcPrivacyPanelClass CcPrivacyPanelClass;
-typedef struct _CcPrivacyPanelPrivate CcPrivacyPanelPrivate;
-
-struct _CcPrivacyPanel
-{
- CcPanel parent;
-
- CcPrivacyPanelPrivate *priv;
-};
-
-struct _CcPrivacyPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_privacy_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_PRIVACY_PANEL (cc_privacy_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcPrivacyPanel, cc_privacy_panel, CC, PRIVACY_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index 48c0d7ac0..9baf192ae 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -58,11 +58,7 @@
#define DEFAULT_LOCALE "en_US.utf-8"
-CC_PANEL_REGISTER (CcRegionPanel, cc_region_panel)
-
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
-
-#define REGION_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->builder, s))
typedef enum {
CHOOSE_LANGUAGE,
@@ -73,7 +69,9 @@ typedef enum {
MOVE_DOWN_INPUT,
} SystemOp;
-struct _CcRegionPanelPrivate {
+struct _CcRegionPanel {
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *login_button;
@@ -123,46 +121,47 @@ struct _CcRegionPanelPrivate {
#endif
};
+CC_PANEL_REGISTER (CcRegionPanel, cc_region_panel)
+
static void
cc_region_panel_finalize (GObject *object)
{
CcRegionPanel *self = CC_REGION_PANEL (object);
- CcRegionPanelPrivate *priv = self->priv;
GtkWidget *chooser;
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
- if (priv->user_manager) {
- g_signal_handlers_disconnect_by_data (priv->user_manager, self);
- priv->user_manager = NULL;
+ if (self->user_manager) {
+ g_signal_handlers_disconnect_by_data (self->user_manager, self);
+ self->user_manager = NULL;
}
- if (priv->user) {
- g_signal_handlers_disconnect_by_data (priv->user, self);
- priv->user = NULL;
+ if (self->user) {
+ g_signal_handlers_disconnect_by_data (self->user, self);
+ self->user = NULL;
}
- g_clear_object (&priv->permission);
- g_clear_object (&priv->localed);
- g_clear_object (&priv->session);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->locale_settings);
- g_clear_object (&priv->input_settings);
- g_clear_object (&priv->xkb_info);
+ g_clear_object (&self->permission);
+ g_clear_object (&self->localed);
+ g_clear_object (&self->session);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->locale_settings);
+ g_clear_object (&self->input_settings);
+ g_clear_object (&self->xkb_info);
#ifdef HAVE_IBUS
- g_clear_object (&priv->ibus);
- if (priv->ibus_cancellable)
- g_cancellable_cancel (priv->ibus_cancellable);
- g_clear_object (&priv->ibus_cancellable);
- g_clear_pointer (&priv->ibus_engines, g_hash_table_destroy);
+ g_clear_object (&self->ibus);
+ if (self->ibus_cancellable)
+ g_cancellable_cancel (self->ibus_cancellable);
+ g_clear_object (&self->ibus_cancellable);
+ g_clear_pointer (&self->ibus_engines, g_hash_table_destroy);
#endif
- g_free (priv->language);
- g_free (priv->region);
- g_free (priv->system_language);
- g_free (priv->system_region);
+ g_free (self->language);
+ g_free (self->region);
+ g_free (self->system_language);
+ g_free (self->system_region);
- g_clear_pointer (&priv->needs_restart_file_path, g_free);
+ g_clear_pointer (&self->needs_restart_file_path, g_free);
chooser = g_object_get_data (G_OBJECT (self), "input-chooser");
if (chooser)
@@ -175,13 +174,12 @@ static void
cc_region_panel_constructed (GObject *object)
{
CcRegionPanel *self = CC_REGION_PANEL (object);
- CcRegionPanelPrivate *priv = self->priv;
G_OBJECT_CLASS (cc_region_panel_parent_class)->constructed (object);
- if (priv->permission)
+ if (self->permission)
cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
- priv->login_button);
+ self->login_button);
}
static const char *
@@ -196,8 +194,6 @@ cc_region_panel_class_init (CcRegionPanelClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass * panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcRegionPanelPrivate));
-
panel_class->get_help_uri = cc_region_panel_get_help_uri;
object_class->constructed = cc_region_panel_constructed;
@@ -207,12 +203,10 @@ cc_region_panel_class_init (CcRegionPanelClass * klass)
static void
restart_now (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- g_file_delete (g_file_new_for_path (priv->needs_restart_file_path),
+ g_file_delete (g_file_new_for_path (self->needs_restart_file_path),
NULL, NULL);
- g_dbus_proxy_call (priv->session,
+ g_dbus_proxy_call (self->session,
"Logout",
g_variant_new ("(u)", 0),
G_DBUS_CALL_FLAGS_NONE,
@@ -224,7 +218,6 @@ set_restart_notification_visible (CcRegionPanel *self,
const gchar *locale,
gboolean visible)
{
- CcRegionPanelPrivate *priv = self->priv;
gchar *current_locale = NULL;
if (locale) {
@@ -232,7 +225,7 @@ set_restart_notification_visible (CcRegionPanel *self,
setlocale (LC_MESSAGES, locale);
}
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->restart_notification), visible);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->restart_notification), visible);
if (locale) {
setlocale (LC_MESSAGES, current_locale);
@@ -240,14 +233,14 @@ set_restart_notification_visible (CcRegionPanel *self,
}
if (!visible) {
- g_file_delete (g_file_new_for_path (priv->needs_restart_file_path),
+ g_file_delete (g_file_new_for_path (self->needs_restart_file_path),
NULL, NULL);
return;
}
- if (!g_file_set_contents (priv->needs_restart_file_path, "", -1, NULL))
- g_warning ("Unable to create %s", priv->needs_restart_file_path);
+ if (!g_file_set_contents (self->needs_restart_file_path, "", -1, NULL))
+ g_warning ("Unable to create %s", self->needs_restart_file_path);
}
typedef struct {
@@ -319,7 +312,6 @@ maybe_notify (CcRegionPanel *self,
int category,
const gchar *target_locale)
{
- CcRegionPanelPrivate *priv = self->priv;
MaybeNotifyData *mnd;
mnd = g_new0 (MaybeNotifyData, 1);
@@ -327,12 +319,12 @@ maybe_notify (CcRegionPanel *self,
mnd->category = category;
mnd->target_locale = g_strdup (target_locale);
- g_dbus_proxy_call (priv->session,
+ g_dbus_proxy_call (self->session,
"GetLocale",
g_variant_new ("(i)", category),
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->cancellable,
+ self->cancellable,
maybe_notify_finish,
mnd);
}
@@ -343,13 +335,11 @@ static void
set_system_language (CcRegionPanel *self,
const gchar *language)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (g_strcmp0 (language, priv->system_language) == 0)
+ if (g_strcmp0 (language, self->system_language) == 0)
return;
- g_free (priv->system_language);
- priv->system_language = g_strdup (language);
+ g_free (self->system_language);
+ self->system_language = g_strdup (language);
set_localed_locale (self);
}
@@ -358,15 +348,13 @@ static void
update_language (CcRegionPanel *self,
const gchar *language)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (priv->login) {
+ if (self->login) {
set_system_language (self, language);
} else {
- if (g_strcmp0 (language, priv->language) == 0)
+ if (g_strcmp0 (language, self->language) == 0)
return;
- act_user_set_language (priv->user, language);
- if (priv->login_auto_apply)
+ act_user_set_language (self->user, language);
+ if (self->login_auto_apply)
set_system_language (self, language);
maybe_notify (self, LC_MESSAGES, language);
}
@@ -391,13 +379,11 @@ static void
set_system_region (CcRegionPanel *self,
const gchar *region)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (g_strcmp0 (region, priv->system_region) == 0)
+ if (g_strcmp0 (region, self->system_region) == 0)
return;
- g_free (priv->system_region);
- priv->system_region = g_strdup (region);
+ g_free (self->system_region);
+ self->system_region = g_strdup (region);
set_localed_locale (self);
}
@@ -406,15 +392,13 @@ static void
update_region (CcRegionPanel *self,
const gchar *region)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (priv->login) {
+ if (self->login) {
set_system_region (self, region);
} else {
- if (g_strcmp0 (region, priv->region) == 0)
+ if (g_strcmp0 (region, self->region) == 0)
return;
- g_settings_set_string (priv->locale_settings, KEY_REGION, region);
- if (priv->login_auto_apply)
+ g_settings_set_string (self->locale_settings, KEY_REGION, region);
+ if (self->login_auto_apply)
set_system_region (self, region);
maybe_notify (self, LC_TIME, region);
}
@@ -438,11 +422,10 @@ format_response (GtkDialog *chooser,
static const gchar *
get_effective_language (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
- if (priv->login)
- return priv->system_language;
+ if (self->login)
+ return self->system_language;
else
- return priv->language;
+ return self->language;
}
static void
@@ -462,13 +445,12 @@ show_language_chooser (CcRegionPanel *self)
static const gchar *
get_effective_region (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
const gchar *region;
- if (priv->login)
- region = priv->system_region;
+ if (self->login)
+ region = self->system_region;
else
- region = priv->region;
+ region = self->region;
/* Region setting might be empty - show the language because
* that's what LC_TIME and others will effectively be when the
@@ -504,11 +486,10 @@ permission_acquired (GObject *source,
gpointer data)
{
CcRegionPanel *self = data;
- CcRegionPanelPrivate *priv = self->priv;
GError *error = NULL;
gboolean allowed;
- allowed = g_permission_acquire_finish (priv->permission, res, &error);
+ allowed = g_permission_acquire_finish (self->permission, res, &error);
if (error) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Failed to acquire permission: %s\n", error->message);
@@ -517,7 +498,7 @@ permission_acquired (GObject *source,
}
if (allowed) {
- switch (priv->op) {
+ switch (self->op) {
case CHOOSE_LANGUAGE:
show_language_chooser (self);
break;
@@ -532,10 +513,10 @@ permission_acquired (GObject *source,
break;
case MOVE_UP_INPUT:
case MOVE_DOWN_INPUT:
- move_selected_input (self, priv->op);
+ move_selected_input (self, self->op);
break;
default:
- g_warning ("Unknown privileged operation: %d\n", priv->op);
+ g_warning ("Unknown privileged operation: %d\n", self->op);
break;
}
}
@@ -545,24 +526,22 @@ static void
activate_language_row (CcRegionPanel *self,
GtkListBoxRow *row)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (row == priv->language_row) {
- if (!priv->login || g_permission_get_allowed (priv->permission)) {
+ if (row == self->language_row) {
+ if (!self->login || g_permission_get_allowed (self->permission)) {
show_language_chooser (self);
- } else if (g_permission_get_can_acquire (priv->permission)) {
- priv->op = CHOOSE_LANGUAGE;
- g_permission_acquire_async (priv->permission,
+ } else if (g_permission_get_can_acquire (self->permission)) {
+ self->op = CHOOSE_LANGUAGE;
+ g_permission_acquire_async (self->permission,
NULL,
permission_acquired,
self);
}
- } else if (row == priv->formats_row) {
- if (!priv->login || g_permission_get_allowed (priv->permission)) {
+ } else if (row == self->formats_row) {
+ if (!self->login || g_permission_get_allowed (self->permission)) {
show_region_chooser (self);
- } else if (g_permission_get_can_acquire (priv->permission)) {
- priv->op = CHOOSE_REGION;
- g_permission_acquire_async (priv->permission,
+ } else if (g_permission_get_can_acquire (self->permission)) {
+ self->op = CHOOSE_REGION;
+ g_permission_acquire_async (self->permission,
NULL,
permission_acquired,
self);
@@ -573,7 +552,6 @@ activate_language_row (CcRegionPanel *self,
static void
update_region_label (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
const gchar *region = get_effective_region (self);
gchar *name = NULL;
@@ -583,24 +561,21 @@ update_region_label (CcRegionPanel *self)
if (!name)
name = gnome_get_country_from_locale (DEFAULT_LOCALE, DEFAULT_LOCALE);
- gtk_label_set_label (GTK_LABEL (priv->formats_label), name);
+ gtk_label_set_label (GTK_LABEL (self->formats_label), name);
g_free (name);
}
static void
update_region_from_setting (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- g_free (priv->region);
- priv->region = g_settings_get_string (priv->locale_settings, KEY_REGION);
+ g_free (self->region);
+ self->region = g_settings_get_string (self->locale_settings, KEY_REGION);
update_region_label (self);
}
static void
update_language_label (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
const gchar *language = get_effective_language (self);
gchar *name = NULL;
@@ -610,7 +585,7 @@ update_language_label (CcRegionPanel *self)
if (!name)
name = gnome_get_language_from_locale (DEFAULT_LOCALE, DEFAULT_LOCALE);
- gtk_label_set_label (GTK_LABEL (priv->language_label), name);
+ gtk_label_set_label (GTK_LABEL (self->language_label), name);
g_free (name);
/* Formats will change too if not explicitly set. */
@@ -620,43 +595,41 @@ update_language_label (CcRegionPanel *self)
static void
update_language_from_user (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
const gchar *language = NULL;
- if (act_user_is_loaded (priv->user))
- language = act_user_get_language (priv->user);
+ if (act_user_is_loaded (self->user))
+ language = act_user_get_language (self->user);
if (language == NULL || *language == '\0')
language = setlocale (LC_MESSAGES, NULL);
- g_free (priv->language);
- priv->language = g_strdup (language);
+ g_free (self->language);
+ self->language = g_strdup (language);
update_language_label (self);
}
static void
setup_language_section (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkWidget *widget;
- priv->user = act_user_manager_get_user_by_id (priv->user_manager, getuid ());
- g_signal_connect_swapped (priv->user, "notify::language",
+ self->user = act_user_manager_get_user_by_id (self->user_manager, getuid ());
+ g_signal_connect_swapped (self->user, "notify::language",
G_CALLBACK (update_language_from_user), self);
- g_signal_connect_swapped (priv->user, "notify::is-loaded",
+ g_signal_connect_swapped (self->user, "notify::is-loaded",
G_CALLBACK (update_language_from_user), self);
- priv->locale_settings = g_settings_new (GNOME_SYSTEM_LOCALE_DIR);
- g_signal_connect_swapped (priv->locale_settings, "changed::" KEY_REGION,
+ self->locale_settings = g_settings_new (GNOME_SYSTEM_LOCALE_DIR);
+ g_signal_connect_swapped (self->locale_settings, "changed::" KEY_REGION,
G_CALLBACK (update_region_from_setting), self);
- priv->language_section = WID ("language_section");
- priv->language_row = GTK_LIST_BOX_ROW (WID ("language_row"));
- priv->language_label = WID ("language_label");
- priv->formats_row = GTK_LIST_BOX_ROW (WID ("formats_row"));
- priv->formats_label = WID ("formats_label");
+ self->language_section = WID ("language_section");
+ self->language_row = GTK_LIST_BOX_ROW (WID ("language_row"));
+ self->language_label = WID ("language_label");
+ self->formats_row = GTK_LIST_BOX_ROW (WID ("formats_row"));
+ self->formats_label = WID ("formats_label");
- priv->restart_notification = WID ("restart-revealer");
+ self->restart_notification = WID ("restart-revealer");
widget = WID ("restart-button");
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (restart_now), self);
@@ -677,7 +650,6 @@ setup_language_section (CcRegionPanel *self)
static void
update_ibus_active_sources (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GList *rows, *l;
GtkWidget *row;
const gchar *type;
@@ -686,7 +658,7 @@ update_ibus_active_sources (CcRegionPanel *self)
gchar *display_name;
GtkWidget *label;
- rows = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ rows = gtk_container_get_children (GTK_CONTAINER (self->input_list));
for (l = rows; l; l = l->next) {
row = l->data;
type = g_object_get_data (G_OBJECT (row), "type");
@@ -694,7 +666,7 @@ update_ibus_active_sources (CcRegionPanel *self)
if (g_strcmp0 (type, INPUT_SOURCE_TYPE_IBUS) != 0)
continue;
- engine_desc = g_hash_table_lookup (priv->ibus_engines, id);
+ engine_desc = g_hash_table_lookup (self->ibus_engines, id);
if (engine_desc) {
display_name = engine_get_display_name (engine_desc);
label = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "label"));
@@ -708,14 +680,13 @@ update_ibus_active_sources (CcRegionPanel *self)
static void
update_input_chooser (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkWidget *chooser;
chooser = g_object_get_data (G_OBJECT (self), "input-chooser");
if (!chooser)
return;
- cc_input_chooser_set_ibus_engines (chooser, priv->ibus_engines);
+ cc_input_chooser_set_ibus_engines (chooser, self->ibus_engines);
}
static void
@@ -723,7 +694,6 @@ fetch_ibus_engines_result (GObject *object,
GAsyncResult *result,
CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv;
GList *list, *l;
GError *error;
@@ -736,11 +706,10 @@ fetch_ibus_engines_result (GObject *object,
return;
}
- priv = self->priv;
- g_clear_object (&priv->ibus_cancellable);
+ g_clear_object (&self->ibus_cancellable);
/* Maps engine ids to engine description objects */
- priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
+ self->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
for (l = list; l; l = l->next) {
IBusEngineDesc *engine = l->data;
@@ -749,7 +718,7 @@ fetch_ibus_engines_result (GObject *object,
if (g_str_has_prefix (engine_id, "xkb:"))
g_object_unref (engine);
else
- g_hash_table_replace (priv->ibus_engines, (gpointer)engine_id, engine);
+ g_hash_table_replace (self->ibus_engines, (gpointer)engine_id, engine);
}
g_list_free (list);
@@ -760,18 +729,16 @@ fetch_ibus_engines_result (GObject *object,
static void
fetch_ibus_engines (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- priv->ibus_cancellable = g_cancellable_new ();
+ self->ibus_cancellable = g_cancellable_new ();
- ibus_bus_list_engines_async (priv->ibus,
+ ibus_bus_list_engines_async (self->ibus,
-1,
- priv->ibus_cancellable,
+ self->ibus_cancellable,
(GAsyncReadyCallback)fetch_ibus_engines_result,
self);
/* We've got everything we needed, don't want to be called again. */
- g_signal_handlers_disconnect_by_func (priv->ibus, fetch_ibus_engines, self);
+ g_signal_handlers_disconnect_by_func (self->ibus, fetch_ibus_engines, self);
}
static void
@@ -831,13 +798,12 @@ add_input_row (CcRegionPanel *self,
const gchar *name,
GDesktopAppInfo *app_info)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkWidget *row;
GtkWidget *box;
GtkWidget *label;
GtkWidget *image;
- remove_no_input_row (GTK_CONTAINER (priv->input_list));
+ remove_no_input_row (GTK_CONTAINER (self->input_list));
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -861,7 +827,7 @@ add_input_row (CcRegionPanel *self,
}
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (self->priv->input_list), row);
+ gtk_container_add (GTK_CONTAINER (self->input_list), row);
g_object_set_data (G_OBJECT (row), "label", label);
g_object_set_data (G_OBJECT (row), "type", (gpointer)type);
@@ -870,7 +836,7 @@ add_input_row (CcRegionPanel *self,
g_object_set_data_full (G_OBJECT (row), "app-info", g_object_ref (app_info), g_object_unref);
}
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (priv->input_list));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->input_list));
return row;
}
@@ -885,7 +851,6 @@ static void
add_input_sources (CcRegionPanel *self,
GVariant *sources)
{
- CcRegionPanelPrivate *priv = self->priv;
GVariantIter iter;
const gchar *type;
const gchar *id;
@@ -904,7 +869,7 @@ add_input_sources (CcRegionPanel *self,
app_info = NULL;
if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) {
- gnome_xkb_info_get_layout_info (priv->xkb_info, id, &name, NULL, NULL, NULL);
+ gnome_xkb_info_get_layout_info (self->xkb_info, id, &name, NULL, NULL, NULL);
if (!name) {
g_warning ("Couldn't find XKB input source '%s'", id);
continue;
@@ -915,8 +880,8 @@ add_input_sources (CcRegionPanel *self,
} else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) {
IBusEngineDesc *engine_desc = NULL;
- if (priv->ibus_engines)
- engine_desc = g_hash_table_lookup (priv->ibus_engines, id);
+ if (self->ibus_engines)
+ engine_desc = g_hash_table_lookup (self->ibus_engines, id);
if (engine_desc)
display_name = engine_get_display_name (engine_desc);
@@ -937,9 +902,8 @@ add_input_sources (CcRegionPanel *self,
static void
add_input_sources_from_settings (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GVariant *sources;
- sources = g_settings_get_value (priv->input_settings, "sources");
+ sources = g_settings_get_value (self->input_settings, "sources");
add_input_sources (self, sources);
g_variant_unref (sources);
}
@@ -947,15 +911,14 @@ add_input_sources_from_settings (CcRegionPanel *self)
static void
clear_input_sources (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GList *list, *l;
- list = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ list = gtk_container_get_children (GTK_CONTAINER (self->input_list));
for (l = list; l; l = l->next) {
- gtk_container_remove (GTK_CONTAINER (priv->input_list), GTK_WIDGET (l->data));
+ gtk_container_remove (GTK_CONTAINER (self->input_list), GTK_WIDGET (l->data));
}
g_list_free (list);
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (priv->input_list));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->input_list));
}
static void
@@ -974,7 +937,7 @@ static void
select_input (CcRegionPanel *self,
const gchar *id)
{
- gtk_container_foreach (GTK_CONTAINER (self->priv->input_list),
+ gtk_container_foreach (GTK_CONTAINER (self->input_list),
select_by_id, (gpointer)id);
}
@@ -983,11 +946,10 @@ input_sources_changed (GSettings *settings,
const gchar *key,
CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
gchar *id = NULL;
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
if (selected)
id = g_strdup (g_object_get_data (G_OBJECT (selected), "id"));
clear_input_sources (self);
@@ -1002,49 +964,47 @@ input_sources_changed (GSettings *settings,
static void
update_buttons (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
GList *children;
guint n_rows;
- children = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->input_list));
n_rows = g_list_length (children);
g_list_free (children);
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
if (selected == NULL) {
- gtk_widget_set_visible (priv->show_config, FALSE);
- gtk_widget_set_sensitive (priv->remove_input, FALSE);
- gtk_widget_set_sensitive (priv->show_layout, FALSE);
- gtk_widget_set_sensitive (priv->move_up_input, FALSE);
- gtk_widget_set_sensitive (priv->move_down_input, FALSE);
+ gtk_widget_set_visible (self->show_config, FALSE);
+ gtk_widget_set_sensitive (self->remove_input, FALSE);
+ gtk_widget_set_sensitive (self->show_layout, FALSE);
+ gtk_widget_set_sensitive (self->move_up_input, FALSE);
+ gtk_widget_set_sensitive (self->move_down_input, FALSE);
} else {
GDesktopAppInfo *app_info;
app_info = (GDesktopAppInfo *)g_object_get_data (G_OBJECT (selected), "app-info");
- gtk_widget_set_visible (priv->show_config, app_info != NULL);
- gtk_widget_set_sensitive (priv->show_layout, TRUE);
- gtk_widget_set_sensitive (priv->remove_input, n_rows > 1);
- gtk_widget_set_sensitive (priv->move_up_input, gtk_list_box_row_get_index (selected) > 0);
- gtk_widget_set_sensitive (priv->move_down_input, gtk_list_box_row_get_index (selected) < n_rows - 1);
+ gtk_widget_set_visible (self->show_config, app_info != NULL);
+ gtk_widget_set_sensitive (self->show_layout, TRUE);
+ gtk_widget_set_sensitive (self->remove_input, n_rows > 1);
+ gtk_widget_set_sensitive (self->move_up_input, gtk_list_box_row_get_index (selected) > 0);
+ gtk_widget_set_sensitive (self->move_down_input, gtk_list_box_row_get_index (selected) < n_rows - 1);
}
- gtk_widget_set_visible (priv->options_button,
- n_rows > 1 && !priv->login);
+ gtk_widget_set_visible (self->options_button,
+ n_rows > 1 && !self->login);
}
static void
set_input_settings (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
const gchar *type;
const gchar *id;
GVariantBuilder builder;
GList *list, *l;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
- list = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ list = gtk_container_get_children (GTK_CONTAINER (self->input_list));
for (l = list; l; l = l->next) {
type = (const gchar *)g_object_get_data (G_OBJECT (l->data), "type");
id = (const gchar *)g_object_get_data (G_OBJECT (l->data), "id");
@@ -1052,8 +1012,8 @@ set_input_settings (CcRegionPanel *self)
}
g_list_free (list);
- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
- g_settings_apply (priv->input_settings);
+ g_settings_set_value (self->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
+ g_settings_apply (self->input_settings);
}
static void set_localed_input (CcRegionPanel *self);
@@ -1061,13 +1021,11 @@ static void set_localed_input (CcRegionPanel *self);
static void
update_input (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (priv->login) {
+ if (self->login) {
set_localed_input (self);
} else {
set_input_settings (self);
- if (priv->login_auto_apply)
+ if (self->login_auto_apply)
set_localed_input (self);
}
}
@@ -1076,11 +1034,10 @@ static gboolean
input_source_already_added (CcRegionPanel *self,
const gchar *id)
{
- CcRegionPanelPrivate *priv = self->priv;
GList *list, *l;
gboolean retval = FALSE;
- list = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ list = gtk_container_get_children (GTK_CONTAINER (self->input_list));
for (l = list; l; l = l->next)
if (g_str_equal (id, (const gchar *) g_object_get_data (G_OBJECT (l->data), "id"))) {
retval = TRUE;
@@ -1128,7 +1085,6 @@ run_input_chooser (CcRegionPanel *self, GtkWidget *chooser)
static void
show_input_chooser (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkWidget *chooser;
GtkWidget *toplevel;
@@ -1137,10 +1093,10 @@ show_input_chooser (CcRegionPanel *self)
if (!chooser) {
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
chooser = cc_input_chooser_new (GTK_WINDOW (toplevel),
- priv->login,
- priv->xkb_info,
+ self->login,
+ self->xkb_info,
#ifdef HAVE_IBUS
- priv->ibus_engines
+ self->ibus_engines
#else
NULL
#endif
@@ -1158,15 +1114,13 @@ show_input_chooser (CcRegionPanel *self)
static void
add_input (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (!priv->login) {
+ if (!self->login) {
show_input_chooser (self);
- } else if (g_permission_get_allowed (priv->permission)) {
+ } else if (g_permission_get_allowed (self->permission)) {
show_input_chooser (self);
- } else if (g_permission_get_can_acquire (priv->permission)) {
- priv->op = ADD_INPUT;
- g_permission_acquire_async (priv->permission,
+ } else if (g_permission_get_can_acquire (self->permission)) {
+ self->op = ADD_INPUT;
+ g_permission_acquire_async (self->permission,
NULL,
permission_acquired,
self);
@@ -1206,19 +1160,18 @@ out:
static void
do_remove_selected_input (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
GtkWidget *sibling;
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
if (selected == NULL)
return;
- sibling = find_sibling (GTK_CONTAINER (priv->input_list), GTK_WIDGET (selected));
- gtk_container_remove (GTK_CONTAINER (priv->input_list), GTK_WIDGET (selected));
- gtk_list_box_select_row (GTK_LIST_BOX (priv->input_list), GTK_LIST_BOX_ROW (sibling));
+ sibling = find_sibling (GTK_CONTAINER (self->input_list), GTK_WIDGET (selected));
+ gtk_container_remove (GTK_CONTAINER (self->input_list), GTK_WIDGET (selected));
+ gtk_list_box_select_row (GTK_LIST_BOX (self->input_list), GTK_LIST_BOX_ROW (sibling));
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (priv->input_list));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->input_list));
update_buttons (self);
update_input (self);
@@ -1227,15 +1180,13 @@ do_remove_selected_input (CcRegionPanel *self)
static void
remove_selected_input (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (!priv->login) {
+ if (!self->login) {
do_remove_selected_input (self);
- } else if (g_permission_get_allowed (priv->permission)) {
+ } else if (g_permission_get_allowed (self->permission)) {
do_remove_selected_input (self);
- } else if (g_permission_get_can_acquire (priv->permission)) {
- priv->op = REMOVE_INPUT;
- g_permission_acquire_async (priv->permission,
+ } else if (g_permission_get_can_acquire (self->permission)) {
+ self->op = REMOVE_INPUT;
+ g_permission_acquire_async (self->permission,
NULL,
permission_acquired,
self);
@@ -1246,13 +1197,12 @@ static void
do_move_selected_input (CcRegionPanel *self,
SystemOp op)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
gint idx;
g_assert (op == MOVE_UP_INPUT || op == MOVE_DOWN_INPUT);
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
g_assert (selected);
idx = gtk_list_box_row_get_index (selected);
@@ -1261,16 +1211,16 @@ do_move_selected_input (CcRegionPanel *self,
else
idx += 1;
- gtk_list_box_unselect_row (GTK_LIST_BOX (priv->input_list), selected);
+ gtk_list_box_unselect_row (GTK_LIST_BOX (self->input_list), selected);
g_object_ref (selected);
- gtk_container_remove (GTK_CONTAINER (priv->input_list), GTK_WIDGET (selected));
- gtk_list_box_insert (GTK_LIST_BOX (priv->input_list), GTK_WIDGET (selected), idx);
+ gtk_container_remove (GTK_CONTAINER (self->input_list), GTK_WIDGET (selected));
+ gtk_list_box_insert (GTK_LIST_BOX (self->input_list), GTK_WIDGET (selected), idx);
g_object_unref (selected);
- gtk_list_box_select_row (GTK_LIST_BOX (priv->input_list), selected);
+ gtk_list_box_select_row (GTK_LIST_BOX (self->input_list), selected);
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (priv->input_list));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->input_list));
update_buttons (self);
update_input (self);
@@ -1280,15 +1230,13 @@ static void
move_selected_input (CcRegionPanel *self,
SystemOp op)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- if (!priv->login) {
+ if (!self->login) {
do_move_selected_input (self, op);
- } else if (g_permission_get_allowed (priv->permission)) {
+ } else if (g_permission_get_allowed (self->permission)) {
do_move_selected_input (self, op);
- } else if (g_permission_get_can_acquire (priv->permission)) {
- priv->op = op;
- g_permission_acquire_async (priv->permission,
+ } else if (g_permission_get_can_acquire (self->permission)) {
+ self->op = op;
+ g_permission_acquire_async (self->permission,
NULL,
permission_acquired,
self);
@@ -1310,14 +1258,13 @@ move_selected_input_down (CcRegionPanel *self)
static void
show_selected_settings (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
GdkAppLaunchContext *ctx;
GDesktopAppInfo *app_info;
const gchar *id;
GError *error = NULL;
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
if (selected == NULL)
return;
@@ -1343,7 +1290,6 @@ show_selected_settings (CcRegionPanel *self)
static void
show_selected_layout (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GtkListBoxRow *selected;
const gchar *type;
const gchar *id;
@@ -1351,7 +1297,7 @@ show_selected_layout (CcRegionPanel *self)
const gchar *variant;
gchar *commandline;
- selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->input_list));
if (selected == NULL)
return;
@@ -1359,7 +1305,7 @@ show_selected_layout (CcRegionPanel *self)
id = (const gchar *)g_object_get_data (G_OBJECT (selected), "id");
if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) {
- gnome_xkb_info_get_layout_info (priv->xkb_info,
+ gnome_xkb_info_get_layout_info (self->xkb_info,
id, NULL, NULL,
&layout, &variant);
@@ -1371,8 +1317,8 @@ show_selected_layout (CcRegionPanel *self)
} else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) {
IBusEngineDesc *engine_desc = NULL;
- if (priv->ibus_engines)
- engine_desc = g_hash_table_lookup (priv->ibus_engines, id);
+ if (self->ibus_engines)
+ engine_desc = g_hash_table_lookup (self->ibus_engines, id);
if (engine_desc) {
layout = ibus_engine_desc_get_layout (engine_desc);
@@ -1423,62 +1369,60 @@ show_input_options (CcRegionPanel *self)
static void
setup_input_section (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
-
- priv->input_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
- g_settings_delay (priv->input_settings);
+ self->input_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
+ g_settings_delay (self->input_settings);
- priv->xkb_info = gnome_xkb_info_new ();
+ self->xkb_info = gnome_xkb_info_new ();
#ifdef HAVE_IBUS
ibus_init ();
- if (!priv->ibus) {
- priv->ibus = ibus_bus_new_async ();
- if (ibus_bus_is_connected (priv->ibus))
+ if (!self->ibus) {
+ self->ibus = ibus_bus_new_async ();
+ if (ibus_bus_is_connected (self->ibus))
fetch_ibus_engines (self);
else
- g_signal_connect_swapped (priv->ibus, "connected",
+ g_signal_connect_swapped (self->ibus, "connected",
G_CALLBACK (fetch_ibus_engines), self);
}
maybe_start_ibus ();
#endif
- priv->input_section = WID ("input_section");
- priv->options_button = WID ("input_options");
- priv->input_list = WID ("input_list");
- priv->add_input = WID ("input_source_add");
- priv->remove_input = WID ("input_source_remove");
- priv->move_up_input = WID ("input_source_up");
- priv->move_down_input = WID ("input_source_down");
- priv->show_config = WID ("input_source_config");
- priv->show_layout = WID ("input_source_layout");
-
- g_signal_connect_swapped (priv->options_button, "clicked",
+ self->input_section = WID ("input_section");
+ self->options_button = WID ("input_options");
+ self->input_list = WID ("input_list");
+ self->add_input = WID ("input_source_add");
+ self->remove_input = WID ("input_source_remove");
+ self->move_up_input = WID ("input_source_up");
+ self->move_down_input = WID ("input_source_down");
+ self->show_config = WID ("input_source_config");
+ self->show_layout = WID ("input_source_layout");
+
+ g_signal_connect_swapped (self->options_button, "clicked",
G_CALLBACK (show_input_options), self);
- g_signal_connect_swapped (priv->add_input, "clicked",
+ g_signal_connect_swapped (self->add_input, "clicked",
G_CALLBACK (add_input), self);
- g_signal_connect_swapped (priv->remove_input, "clicked",
+ g_signal_connect_swapped (self->remove_input, "clicked",
G_CALLBACK (remove_selected_input), self);
- g_signal_connect_swapped (priv->move_up_input, "clicked",
+ g_signal_connect_swapped (self->move_up_input, "clicked",
G_CALLBACK (move_selected_input_up), self);
- g_signal_connect_swapped (priv->move_down_input, "clicked",
+ g_signal_connect_swapped (self->move_down_input, "clicked",
G_CALLBACK (move_selected_input_down), self);
- g_signal_connect_swapped (priv->show_config, "clicked",
+ g_signal_connect_swapped (self->show_config, "clicked",
G_CALLBACK (show_selected_settings), self);
- g_signal_connect_swapped (priv->show_layout, "clicked",
+ g_signal_connect_swapped (self->show_layout, "clicked",
G_CALLBACK (show_selected_layout), self);
- cc_list_box_setup_scrolling (GTK_LIST_BOX (priv->input_list), 5);
+ cc_list_box_setup_scrolling (GTK_LIST_BOX (self->input_list), 5);
- gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->input_list),
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->input_list),
GTK_SELECTION_SINGLE);
- gtk_list_box_set_header_func (GTK_LIST_BOX (priv->input_list),
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->input_list),
cc_list_box_update_header_func,
NULL, NULL);
- g_signal_connect_object (priv->input_list, "row-selected",
+ g_signal_connect_object (self->input_list, "row-selected",
G_CALLBACK (update_buttons), self, G_CONNECT_SWAPPED);
- g_signal_connect (priv->input_settings, "changed::" KEY_INPUT_SOURCES,
+ g_signal_connect (self->input_settings, "changed::" KEY_INPUT_SOURCES,
G_CALLBACK (input_sources_changed), self);
add_input_sources_from_settings (self);
@@ -1491,7 +1435,6 @@ on_localed_properties_changed (GDBusProxy *proxy,
const gchar **invalidated_properties,
CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GVariant *v;
v = g_dbus_proxy_get_cached_property (proxy, "Locale");
@@ -1519,10 +1462,10 @@ on_localed_properties_changed (GDBusProxy *proxy,
if (!messages) {
messages = lang;
}
- g_free (priv->system_language);
- priv->system_language = g_strdup (messages);
- g_free (priv->system_region);
- priv->system_region = g_strdup (time);
+ g_free (self->system_language);
+ self->system_language = g_strdup (messages);
+ g_free (self->system_region);
+ self->system_region = g_strdup (time);
g_variant_unref (v);
g_free (strv);
@@ -1533,24 +1476,23 @@ on_localed_properties_changed (GDBusProxy *proxy,
static void
add_input_sources_from_localed (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GVariant *v;
const gchar *s;
gchar **layouts = NULL;
gchar **variants = NULL;
gint i, n;
- if (!priv->localed)
+ if (!self->localed)
return;
- v = g_dbus_proxy_get_cached_property (priv->localed, "X11Layout");
+ v = g_dbus_proxy_get_cached_property (self->localed, "X11Layout");
if (v) {
s = g_variant_get_string (v, NULL);
layouts = g_strsplit (s, ",", -1);
g_variant_unref (v);
}
- v = g_dbus_proxy_get_cached_property (priv->localed, "X11Variant");
+ v = g_dbus_proxy_get_cached_property (self->localed, "X11Variant");
if (v) {
s = g_variant_get_string (v, NULL);
if (s && *s)
@@ -1574,7 +1516,7 @@ add_input_sources_from_localed (CcRegionPanel *self)
else
id = g_strdup (layouts[i]);
- gnome_xkb_info_get_layout_info (priv->xkb_info, id, &name, NULL, NULL, NULL);
+ gnome_xkb_info_get_layout_info (self->xkb_info, id, &name, NULL, NULL, NULL);
add_input_row (self, INPUT_SOURCE_TYPE_XKB, id, name ? name : id, NULL);
@@ -1591,34 +1533,33 @@ add_input_sources_from_localed (CcRegionPanel *self)
static void
set_localed_locale (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GVariantBuilder *b;
gchar *s;
b = g_variant_builder_new (G_VARIANT_TYPE ("as"));
- s = g_strconcat ("LANG=", priv->system_language, NULL);
+ s = g_strconcat ("LANG=", self->system_language, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
- if (priv->system_region != NULL &&
- g_strcmp0 (priv->system_language, priv->system_region) != 0) {
- s = g_strconcat ("LC_TIME=", priv->system_region, NULL);
+ if (self->system_region != NULL &&
+ g_strcmp0 (self->system_language, self->system_region) != 0) {
+ s = g_strconcat ("LC_TIME=", self->system_region, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
- s = g_strconcat ("LC_NUMERIC=", priv->system_region, NULL);
+ s = g_strconcat ("LC_NUMERIC=", self->system_region, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
- s = g_strconcat ("LC_MONETARY=", priv->system_region, NULL);
+ s = g_strconcat ("LC_MONETARY=", self->system_region, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
- s = g_strconcat ("LC_MEASUREMENT=", priv->system_region, NULL);
+ s = g_strconcat ("LC_MEASUREMENT=", self->system_region, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
- s = g_strconcat ("LC_PAPER=", priv->system_region, NULL);
+ s = g_strconcat ("LC_PAPER=", self->system_region, NULL);
g_variant_builder_add (b, "s", s);
g_free (s);
}
- g_dbus_proxy_call (priv->localed,
+ g_dbus_proxy_call (self->localed,
"SetLocale",
g_variant_new ("(asb)", b, TRUE),
G_DBUS_CALL_FLAGS_NONE,
@@ -1629,7 +1570,6 @@ set_localed_locale (CcRegionPanel *self)
static void
set_localed_input (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GString *layouts;
GString *variants;
const gchar *type, *id;
@@ -1639,14 +1579,14 @@ set_localed_input (CcRegionPanel *self)
layouts = g_string_new ("");
variants = g_string_new ("");
- list = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ list = gtk_container_get_children (GTK_CONTAINER (self->input_list));
for (li = list; li; li = li->next) {
type = (const gchar *)g_object_get_data (G_OBJECT (li->data), "type");
id = (const gchar *)g_object_get_data (G_OBJECT (li->data), "id");
if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS))
continue;
- if (gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &l, &v)) {
+ if (gnome_xkb_info_get_layout_info (self->xkb_info, id, NULL, NULL, &l, &v)) {
if (layouts->str[0]) {
g_string_append_c (layouts, ',');
g_string_append_c (variants, ',');
@@ -1657,7 +1597,7 @@ set_localed_input (CcRegionPanel *self)
}
g_list_free (list);
- g_dbus_proxy_call (priv->localed,
+ g_dbus_proxy_call (self->localed,
"SetX11Keyboard",
g_variant_new ("(ssssbb)", layouts->str, "", variants->str, "", TRUE, TRUE),
G_DBUS_CALL_FLAGS_NONE,
@@ -1673,7 +1613,6 @@ localed_proxy_ready (GObject *source,
gpointer data)
{
CcRegionPanel *self = data;
- CcRegionPanelPrivate *priv;
GDBusProxy *proxy;
GError *error = NULL;
@@ -1686,34 +1625,32 @@ localed_proxy_ready (GObject *source,
return;
}
- priv = self->priv;
- priv->localed = proxy;
+ self->localed = proxy;
- gtk_widget_set_sensitive (priv->login_button, TRUE);
+ gtk_widget_set_sensitive (self->login_button, TRUE);
- g_signal_connect (priv->localed, "g-properties-changed",
+ g_signal_connect (self->localed, "g-properties-changed",
G_CALLBACK (on_localed_properties_changed), self);
- on_localed_properties_changed (priv->localed, NULL, NULL, self);
+ on_localed_properties_changed (self->localed, NULL, NULL, self);
}
static void
login_changed (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
gboolean can_acquire;
- priv->login = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->login_button));
- gtk_widget_set_visible (priv->login_label, priv->login);
+ self->login = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->login_button));
+ gtk_widget_set_visible (self->login_label, self->login);
- can_acquire = priv->permission &&
- (g_permission_get_allowed (priv->permission) ||
- g_permission_get_can_acquire (priv->permission));
+ can_acquire = self->permission &&
+ (g_permission_get_allowed (self->permission) ||
+ g_permission_get_can_acquire (self->permission));
/* FIXME: insensitive doesn't look quite right for this */
- gtk_widget_set_sensitive (priv->language_section, !priv->login || can_acquire);
- gtk_widget_set_sensitive (priv->input_section, !priv->login || can_acquire);
+ gtk_widget_set_sensitive (self->language_section, !self->login || can_acquire);
+ gtk_widget_set_sensitive (self->input_section, !self->login || can_acquire);
clear_input_sources (self);
- if (priv->login)
+ if (self->login)
add_input_sources_from_localed (self);
else
add_input_sources_from_settings (self);
@@ -1725,32 +1662,30 @@ login_changed (CcRegionPanel *self)
static void
set_login_button_visibility (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
gboolean has_multiple_users;
gboolean loaded;
- g_object_get (priv->user_manager, "is-loaded", &loaded, NULL);
+ g_object_get (self->user_manager, "is-loaded", &loaded, NULL);
if (!loaded)
return;
- g_object_get (priv->user_manager, "has-multiple-users", &has_multiple_users, NULL);
+ g_object_get (self->user_manager, "has-multiple-users", &has_multiple_users, NULL);
- priv->login_auto_apply = !has_multiple_users && g_permission_get_allowed (priv->permission);
- gtk_widget_set_visible (priv->login_button, !priv->login_auto_apply);
+ self->login_auto_apply = !has_multiple_users && g_permission_get_allowed (self->permission);
+ gtk_widget_set_visible (self->login_button, !self->login_auto_apply);
- g_signal_handlers_disconnect_by_func (priv->user_manager, set_login_button_visibility, self);
+ g_signal_handlers_disconnect_by_func (self->user_manager, set_login_button_visibility, self);
}
static void
setup_login_button (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv = self->priv;
GDBusConnection *bus;
gboolean loaded;
GError *error = NULL;
- priv->permission = polkit_permission_new_sync ("org.freedesktop.locale1.set-locale", NULL, NULL, &error);
- if (priv->permission == NULL) {
+ self->permission = polkit_permission_new_sync ("org.freedesktop.locale1.set-locale", NULL, NULL, &error);
+ if (self->permission == NULL) {
g_warning ("Could not get 'org.freedesktop.locale1.set-locale' permission: %s",
error->message);
g_error_free (error);
@@ -1764,26 +1699,26 @@ setup_login_button (CcRegionPanel *self)
"org.freedesktop.locale1",
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
- priv->cancellable,
+ self->cancellable,
(GAsyncReadyCallback) localed_proxy_ready,
self);
g_object_unref (bus);
- priv->login_label = WID ("login-label");
- priv->login_button = gtk_toggle_button_new_with_mnemonic (_("Login _Screen"));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->login_button),
+ self->login_label = WID ("login-label");
+ self->login_button = gtk_toggle_button_new_with_mnemonic (_("Login _Screen"));
+ gtk_style_context_add_class (gtk_widget_get_style_context (self->login_button),
"text-button");
- gtk_widget_set_valign (priv->login_button, GTK_ALIGN_CENTER);
- gtk_widget_set_visible (priv->login_button, FALSE);
- gtk_widget_set_sensitive (priv->login_button, FALSE);
- g_signal_connect_swapped (priv->login_button, "notify::active",
+ gtk_widget_set_valign (self->login_button, GTK_ALIGN_CENTER);
+ gtk_widget_set_visible (self->login_button, FALSE);
+ gtk_widget_set_sensitive (self->login_button, FALSE);
+ g_signal_connect_swapped (self->login_button, "notify::active",
G_CALLBACK (login_changed), self);
- g_object_get (priv->user_manager, "is-loaded", &loaded, NULL);
+ g_object_get (self->user_manager, "is-loaded", &loaded, NULL);
if (loaded)
set_login_button_visibility (self);
else
- g_signal_connect_swapped (priv->user_manager, "notify::is-loaded",
+ g_signal_connect_swapped (self->user_manager, "notify::is-loaded",
G_CALLBACK (set_login_button_visibility), self);
}
@@ -1805,21 +1740,19 @@ session_proxy_ready (GObject *source,
return;
}
- self->priv->session = proxy;
+ self->session = proxy;
}
static void
cc_region_panel_init (CcRegionPanel *self)
{
- CcRegionPanelPrivate *priv;
GError *error = NULL;
- priv = self->priv = REGION_PANEL_PRIVATE (self);
g_resources_register (cc_region_get_resource ());
- priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (priv->builder,
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/region/region.ui",
&error);
if (error != NULL) {
@@ -1828,9 +1761,9 @@ cc_region_panel_init (CcRegionPanel *self)
return;
}
- priv->user_manager = act_user_manager_get_default ();
+ self->user_manager = act_user_manager_get_default ();
- priv->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
@@ -1838,7 +1771,7 @@ cc_region_panel_init (CcRegionPanel *self)
"org.gnome.SessionManager",
"/org/gnome/SessionManager",
"org.gnome.SessionManager",
- priv->cancellable,
+ self->cancellable,
session_proxy_ready,
self);
@@ -1847,11 +1780,11 @@ cc_region_panel_init (CcRegionPanel *self)
setup_input_section (self);
gtk_container_add (GTK_CONTAINER (self),
- GTK_WIDGET (gtk_builder_get_object (priv->builder, "vbox_region")));
+ GTK_WIDGET (gtk_builder_get_object (self->builder, "vbox_region")));
- priv->needs_restart_file_path = g_build_filename (g_get_user_runtime_dir (),
+ self->needs_restart_file_path = g_build_filename (g_get_user_runtime_dir (),
"gnome-control-center-region-needs-restart",
NULL);
- if (g_file_query_exists (g_file_new_for_path (priv->needs_restart_file_path), NULL))
+ if (g_file_query_exists (g_file_new_for_path (self->needs_restart_file_path), NULL))
set_restart_notification_visible (self, NULL, TRUE);
}
diff --git a/panels/region/cc-region-panel.h b/panels/region/cc-region-panel.h
index 2476bf1c3..b1f73a7da 100644
--- a/panels/region/cc-region-panel.h
+++ b/panels/region/cc-region-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_REGION_PANEL cc_region_panel_get_type()
-
-#define CC_REGION_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_REGION_PANEL, CcRegionPanel))
-
-#define CC_REGION_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_REGION_PANEL, CcRegionPanelClass))
-
-#define CC_IS_REGION_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_REGION_PANEL))
-
-#define CC_IS_REGION_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_REGION_PANEL))
-
-#define CC_REGION_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_REGION_PANEL, CcRegionPanelClass))
-
-typedef struct _CcRegionPanel CcRegionPanel;
-typedef struct _CcRegionPanelClass CcRegionPanelClass;
-typedef struct _CcRegionPanelPrivate CcRegionPanelPrivate;
-
-struct _CcRegionPanel
-{
- CcPanel parent;
-
- CcRegionPanelPrivate *priv;
-};
-
-struct _CcRegionPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_region_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_REGION_PANEL (cc_region_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcRegionPanel, cc_region_panel, CC, REGION_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/search/cc-search-locations-dialog.h b/panels/search/cc-search-locations-dialog.h
index 7aa489e34..26424d1d5 100644
--- a/panels/search/cc-search-locations-dialog.h
+++ b/panels/search/cc-search-locations-dialog.h
@@ -24,15 +24,10 @@
#include "cc-search-panel.h"
#define CC_SEARCH_LOCATIONS_DIALOG_TYPE (cc_search_locations_dialog_get_type ())
-#define CC_SEARCH_LOCATIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_SEARCH_LOCATIONS_DIALOG_TYPE, CcSearchLocationsDialog))
+G_DECLARE_FINAL_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, CC, SEARCH_LOCATIONS_DIALOG, GtkDialog)
-typedef struct _CcSearchLocationsDialog CcSearchLocationsDialog;
-typedef struct _CcSearchLocationsDialogClass CcSearchLocationsDialogClass;
+CcSearchLocationsDialog *cc_search_locations_dialog_new (CcSearchPanel *panel);
-GType cc_search_locations_dialog_get_type (void);
-
-CcSearchLocationsDialog *cc_search_locations_dialog_new (CcSearchPanel *panel);
-
-gboolean cc_search_locations_dialog_is_available (void);
+gboolean cc_search_locations_dialog_is_available (void);
#endif /* _CC_SEARCH_LOCATIONS_DIALOG_H */
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 67e722556..271c60235 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -26,12 +26,12 @@
#include <gio/gdesktopappinfo.h>
#include <glib/gi18n.h>
-CC_PANEL_REGISTER (CcSearchPanel, cc_search_panel)
-
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->builder, s))
-struct _CcSearchPanelPrivate
+struct _CcSearchPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *list_box;
GtkWidget *up_button;
@@ -44,6 +44,8 @@ struct _CcSearchPanelPrivate
CcSearchLocationsDialog *locations_dialog;
};
+CC_PANEL_REGISTER (CcSearchPanel, cc_search_panel)
+
#define SHELL_PROVIDER_GROUP "Shell Search Provider"
static gint
@@ -67,11 +69,11 @@ list_sort_func (gconstpointer a,
idx_a = -1;
idx_b = -1;
- lookup = g_hash_table_lookup (self->priv->sort_order, id_a);
+ lookup = g_hash_table_lookup (self->sort_order, id_a);
if (lookup)
idx_a = GPOINTER_TO_INT (lookup) - 1;
- lookup = g_hash_table_lookup (self->priv->sort_order, id_b);
+ lookup = g_hash_table_lookup (self->sort_order, id_b);
if (lookup)
idx_b = GPOINTER_TO_INT (lookup) - 1;
@@ -98,8 +100,8 @@ search_panel_invalidate_button_state (CcSearchPanel *self)
gboolean is_first, is_last;
GtkListBoxRow *row;
- row = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->priv->list_box));
- children = gtk_container_get_children (GTK_CONTAINER (self->priv->list_box));
+ row = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->list_box));
+ children = gtk_container_get_children (GTK_CONTAINER (self->list_box));
if (!row || !children)
return;
@@ -107,8 +109,8 @@ search_panel_invalidate_button_state (CcSearchPanel *self)
is_first = (row == g_list_first (children)->data);
is_last = (row == g_list_last (children)->data);
- gtk_widget_set_sensitive (self->priv->up_button, !is_first);
- gtk_widget_set_sensitive (self->priv->down_button, !is_last);
+ gtk_widget_set_sensitive (self->up_button, !is_first);
+ gtk_widget_set_sensitive (self->down_button, !is_last);
g_list_free (children);
}
@@ -119,13 +121,13 @@ search_panel_invalidate_sort_order (CcSearchPanel *self)
gchar **sort_order;
gint idx;
- g_hash_table_remove_all (self->priv->sort_order);
- sort_order = g_settings_get_strv (self->priv->search_settings, "sort-order");
+ g_hash_table_remove_all (self->sort_order);
+ sort_order = g_settings_get_strv (self->search_settings, "sort-order");
for (idx = 0; sort_order[idx] != NULL; idx++)
- g_hash_table_insert (self->priv->sort_order, g_strdup (sort_order[idx]), GINT_TO_POINTER (idx + 1));
+ g_hash_table_insert (self->sort_order, g_strdup (sort_order[idx]), GINT_TO_POINTER (idx + 1));
- gtk_list_box_invalidate_sort (GTK_LIST_BOX (self->priv->list_box));
+ gtk_list_box_invalidate_sort (GTK_LIST_BOX (self->list_box));
g_strfreev (sort_order);
search_panel_invalidate_button_state (self);
@@ -140,8 +142,8 @@ propagate_compare_func (gconstpointer a,
const gchar *key_a = a, *key_b = b;
gint idx_a, idx_b;
- idx_a = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->sort_order, key_a));
- idx_b = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->sort_order, key_b));
+ idx_a = GPOINTER_TO_INT (g_hash_table_lookup (self->sort_order, key_a));
+ idx_b = GPOINTER_TO_INT (g_hash_table_lookup (self->sort_order, key_b));
return (idx_a - idx_b);
}
@@ -153,14 +155,14 @@ search_panel_propagate_sort_order (CcSearchPanel *self)
GPtrArray *sort_order;
sort_order = g_ptr_array_new ();
- keys = g_hash_table_get_keys (self->priv->sort_order);
+ keys = g_hash_table_get_keys (self->sort_order);
keys = g_list_sort_with_data (keys, propagate_compare_func, self);
for (l = keys; l != NULL; l = l->next)
g_ptr_array_add (sort_order, l->data);
g_ptr_array_add (sort_order, NULL);
- g_settings_set_strv (self->priv->search_settings, "sort-order",
+ g_settings_set_strv (self->search_settings, "sort-order",
(const gchar **) sort_order->pdata);
g_ptr_array_unref (sort_order);
@@ -173,12 +175,12 @@ search_panel_set_no_providers (CcSearchPanel *self)
GtkWidget *w;
/* center the list box in the scrolled window */
- gtk_widget_set_valign (self->priv->list_box, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (self->list_box, GTK_ALIGN_CENTER);
w = gtk_label_new (_("No applications found"));
gtk_widget_show (w);
- gtk_container_add (GTK_CONTAINER (self->priv->list_box), w);
+ gtk_container_add (GTK_CONTAINER (self->list_box), w);
}
static void
@@ -194,11 +196,11 @@ search_panel_move_selected (CcSearchPanel *self,
gboolean found;
GList *children, *l, *other;
- row = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->priv->list_box));
+ row = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->list_box));
app_info = g_object_get_data (G_OBJECT (row), "app-info");
app_id = g_app_info_get_id (app_info);
- children = gtk_container_get_children (GTK_CONTAINER (self->priv->list_box));
+ children = gtk_container_get_children (GTK_CONTAINER (self->list_box));
/* The assertions are valid only as long as we don't move the first
or the last item. */
@@ -223,7 +225,7 @@ search_panel_move_selected (CcSearchPanel *self,
one we want to move, if moving up, or the neighbor, if moving down.
*/
last_good_app = target_app = app_id;
- found = g_hash_table_lookup_extended (self->priv->sort_order, last_good_app, NULL, &idx_ptr);
+ found = g_hash_table_lookup_extended (self->sort_order, last_good_app, NULL, &idx_ptr);
while (!found)
{
GAppInfo *tmp;
@@ -240,7 +242,7 @@ search_panel_move_selected (CcSearchPanel *self,
tmp_id = g_app_info_get_id (tmp);
last_good_app = tmp_id;
- found = g_hash_table_lookup_extended (self->priv->sort_order, tmp_id, NULL, &idx_ptr);
+ found = g_hash_table_lookup_extended (self->sort_order, tmp_id, NULL, &idx_ptr);
}
/* For simplicity's sake, set all sort orders to the previously visible state
@@ -272,18 +274,18 @@ search_panel_move_selected (CcSearchPanel *self,
tmp = g_object_get_data (G_OBJECT (l->data), "app-info");
tmp_id = g_app_info_get_id (tmp);
- g_hash_table_replace (self->priv->sort_order, g_strdup (tmp_id), GINT_TO_POINTER (idx));
+ g_hash_table_replace (self->sort_order, g_strdup (tmp_id), GINT_TO_POINTER (idx));
l = g_list_next (l);
idx++;
last_good_app = tmp_id;
}
- other_idx = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->sort_order, app_id));
+ other_idx = GPOINTER_TO_INT (g_hash_table_lookup (self->sort_order, app_id));
idx = down ? (other_idx + 1) : (other_idx - 1);
- g_hash_table_replace (self->priv->sort_order, g_strdup (other_app_id), GINT_TO_POINTER (other_idx));
- g_hash_table_replace (self->priv->sort_order, g_strdup (app_id), GINT_TO_POINTER (idx));
+ g_hash_table_replace (self->sort_order, g_strdup (other_app_id), GINT_TO_POINTER (other_idx));
+ g_hash_table_replace (self->sort_order, g_strdup (app_id), GINT_TO_POINTER (idx));
search_panel_propagate_sort_order (self);
@@ -310,14 +312,14 @@ settings_button_clicked (GtkWidget *widget,
{
CcSearchPanel *self = user_data;
- if (self->priv->locations_dialog == NULL)
+ if (self->locations_dialog == NULL)
{
- self->priv->locations_dialog = cc_search_locations_dialog_new (self);
- g_object_add_weak_pointer (G_OBJECT (self->priv->locations_dialog),
- (gpointer *) &self->priv->locations_dialog);
+ self->locations_dialog = cc_search_locations_dialog_new (self);
+ g_object_add_weak_pointer (G_OBJECT (self->locations_dialog),
+ (gpointer *) &self->locations_dialog);
}
- gtk_window_present (GTK_WINDOW (self->priv->locations_dialog));
+ gtk_window_present (GTK_WINDOW (self->locations_dialog));
}
static GVariant *
@@ -337,7 +339,7 @@ switch_settings_mapping_set_generic (const GValue *value,
remove = !!g_value_get_boolean (value) == !!default_enabled;
found = FALSE;
new_apps = g_ptr_array_new_with_free_func (g_free);
- apps = g_settings_get_strv (self->priv->search_settings,
+ apps = g_settings_get_strv (self->search_settings,
default_enabled ? "disabled" : "enabled");
for (idx = 0; apps[idx] != NULL; idx++)
@@ -446,7 +448,7 @@ search_panel_add_one_app_info (CcSearchPanel *self,
return;
/* reset valignment of the list box */
- gtk_widget_set_valign (self->priv->list_box, GTK_ALIGN_FILL);
+ gtk_widget_set_valign (self->list_box, GTK_ALIGN_FILL);
row = gtk_list_box_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
@@ -456,7 +458,7 @@ search_panel_add_one_app_info (CcSearchPanel *self,
g_object_set_data_full (G_OBJECT (row), "app-info",
g_object_ref (app_info), g_object_unref);
g_object_set_data (G_OBJECT (row), "self", self);
- gtk_container_add (GTK_CONTAINER (self->priv->list_box), row);
+ gtk_container_add (GTK_CONTAINER (self->list_box), row);
icon = g_app_info_get_icon (app_info);
if (icon == NULL)
@@ -479,7 +481,7 @@ search_panel_add_one_app_info (CcSearchPanel *self,
if (default_enabled)
{
- g_settings_bind_with_mapping (self->priv->search_settings, "disabled",
+ g_settings_bind_with_mapping (self->search_settings, "disabled",
w, "active",
G_SETTINGS_BIND_DEFAULT,
switch_settings_mapping_get_default_enabled,
@@ -488,7 +490,7 @@ search_panel_add_one_app_info (CcSearchPanel *self,
}
else
{
- g_settings_bind_with_mapping (self->priv->search_settings, "enabled",
+ g_settings_bind_with_mapping (self->search_settings, "enabled",
w, "active",
G_SETTINGS_BIND_DEFAULT,
switch_settings_mapping_get_default_disabled,
@@ -576,7 +578,7 @@ search_providers_discover_ready (GObject *source,
return;
}
- g_clear_object (&self->priv->load_cancellable);
+ g_clear_object (&self->load_cancellable);
if (providers == NULL)
{
@@ -682,8 +684,8 @@ populate_search_providers (CcSearchPanel *self)
{
GTask *task;
- self->priv->load_cancellable = g_cancellable_new ();
- task = g_task_new (self, self->priv->load_cancellable,
+ self->load_cancellable = g_cancellable_new ();
+ task = g_task_new (self, self->load_cancellable,
search_providers_discover_ready, self);
g_task_run_in_thread (task, search_providers_discover_thread);
g_object_unref (task);
@@ -692,11 +694,11 @@ populate_search_providers (CcSearchPanel *self)
static void
cc_search_panel_dispose (GObject *object)
{
- CcSearchPanelPrivate *priv = CC_SEARCH_PANEL (object)->priv;
+ CcSearchPanel *self = CC_SEARCH_PANEL (object);
- if (priv->load_cancellable != NULL)
- g_cancellable_cancel (priv->load_cancellable);
- g_clear_object (&priv->load_cancellable);
+ if (self->load_cancellable != NULL)
+ g_cancellable_cancel (self->load_cancellable);
+ g_clear_object (&self->load_cancellable);
G_OBJECT_CLASS (cc_search_panel_parent_class)->dispose (object);
}
@@ -704,14 +706,14 @@ cc_search_panel_dispose (GObject *object)
static void
cc_search_panel_finalize (GObject *object)
{
- CcSearchPanelPrivate *priv = CC_SEARCH_PANEL (object)->priv;
+ CcSearchPanel *self = CC_SEARCH_PANEL (object);
- g_clear_object (&priv->builder);
- g_clear_object (&priv->search_settings);
- g_hash_table_destroy (priv->sort_order);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->search_settings);
+ g_hash_table_destroy (self->sort_order);
- if (priv->locations_dialog)
- gtk_widget_destroy (GTK_WIDGET (priv->locations_dialog));
+ if (self->locations_dialog)
+ gtk_widget_destroy (GTK_WIDGET (self->locations_dialog));
G_OBJECT_CLASS (cc_search_panel_parent_class)->finalize (object);
}
@@ -732,7 +734,7 @@ cc_search_panel_constructed (GObject *object)
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 4);
- g_settings_bind (self->priv->search_settings, "disable-external",
+ g_settings_bind (self->search_settings, "disable-external",
widget, "active",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_INVERT_BOOLEAN);
@@ -754,13 +756,12 @@ cc_search_panel_init (CcSearchPanel *self)
GtkWidget *frame;
guint res;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_SEARCH_PANEL, CcSearchPanelPrivate);
g_resources_register (cc_search_get_resource ());
- self->priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
error = NULL;
- res = gtk_builder_add_from_resource (self->priv->builder,
+ res = gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/search/search.ui",
&error);
@@ -778,31 +779,31 @@ cc_search_panel_init (CcSearchPanel *self)
(GtkListBoxSortFunc)list_sort_func, self, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (widget), cc_list_box_update_header_func, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), widget);
- self->priv->list_box = widget;
+ self->list_box = widget;
gtk_widget_show (widget);
g_signal_connect_swapped (widget, "row-selected",
G_CALLBACK (search_panel_invalidate_button_state), self);
- self->priv->up_button = WID ("up_button");
- g_signal_connect (self->priv->up_button, "clicked",
+ self->up_button = WID ("up_button");
+ g_signal_connect (self->up_button, "clicked",
G_CALLBACK (up_button_clicked), self);
- gtk_widget_set_sensitive (self->priv->up_button, FALSE);
+ gtk_widget_set_sensitive (self->up_button, FALSE);
- self->priv->down_button = WID ("down_button");
- g_signal_connect (self->priv->down_button, "clicked",
+ self->down_button = WID ("down_button");
+ g_signal_connect (self->down_button, "clicked",
G_CALLBACK (down_button_clicked), self);
- gtk_widget_set_sensitive (self->priv->down_button, FALSE);
+ gtk_widget_set_sensitive (self->down_button, FALSE);
widget = WID ("settings_button");
g_signal_connect (widget, "clicked",
G_CALLBACK (settings_button_clicked), self);
gtk_widget_set_sensitive (widget, cc_search_locations_dialog_is_available ());
- self->priv->search_settings = g_settings_new ("org.gnome.desktop.search-providers");
- self->priv->sort_order = g_hash_table_new_full (g_str_hash, g_str_equal,
+ self->search_settings = g_settings_new ("org.gnome.desktop.search-providers");
+ self->sort_order = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
- g_signal_connect_swapped (self->priv->search_settings, "changed::sort-order",
+ g_signal_connect_swapped (self->search_settings, "changed::sort-order",
G_CALLBACK (search_panel_invalidate_sort_order), self);
search_panel_invalidate_sort_order (self);
@@ -820,6 +821,4 @@ cc_search_panel_class_init (CcSearchPanelClass *klass)
oclass->constructed = cc_search_panel_constructed;
oclass->dispose = cc_search_panel_dispose;
oclass->finalize = cc_search_panel_finalize;
-
- g_type_class_add_private (klass, sizeof (CcSearchPanelPrivate));
}
diff --git a/panels/search/cc-search-panel.h b/panels/search/cc-search-panel.h
index 9a3ac0d18..39de4695c 100644
--- a/panels/search/cc-search-panel.h
+++ b/panels/search/cc-search-panel.h
@@ -25,45 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_SEARCH_PANEL cc_search_panel_get_type()
-
-#define CC_SEARCH_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_SEARCH_PANEL, CcSearchPanel))
-
-#define CC_SEARCH_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_SEARCH_PANEL, CcSearchPanelClass))
-
-#define CC_IS_SEARCH_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_SEARCH_PANEL))
-
-#define CC_IS_SEARCH_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_SEARCH_PANEL))
-
-#define CC_SEARCH_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_SEARCH_PANEL, CcSearchPanelClass))
-
-typedef struct _CcSearchPanel CcSearchPanel;
-typedef struct _CcSearchPanelClass CcSearchPanelClass;
-typedef struct _CcSearchPanelPrivate CcSearchPanelPrivate;
-
-struct _CcSearchPanel
-{
- CcPanel parent;
-
- CcSearchPanelPrivate *priv;
-};
-
-struct _CcSearchPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_search_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_SEARCH_PANEL (cc_search_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcSearchPanel, cc_search_panel, CC, SEARCH_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/sharing/cc-sharing-networks.c b/panels/sharing/cc-sharing-networks.c
index 10920dee0..a4ff111c4 100644
--- a/panels/sharing/cc-sharing-networks.c
+++ b/panels/sharing/cc-sharing-networks.c
@@ -28,7 +28,9 @@
#include "gsd-sharing-enums.h"
#include "shell/list-box-helper.h"
-struct _CcSharingNetworksPrivate {
+struct _CcSharingNetworks {
+ GtkGrid parent_instance;
+
GtkWidget *listbox;
GtkWidget *current_row;
@@ -46,8 +48,7 @@ struct _CcSharingNetworksPrivate {
};
-G_DEFINE_TYPE_WITH_CODE (CcSharingNetworks, cc_sharing_networks, GTK_TYPE_GRID,
- G_ADD_PRIVATE (CcSharingNetworks))
+G_DEFINE_TYPE (CcSharingNetworks, cc_sharing_networks, GTK_TYPE_GRID)
enum {
PROP_0,
@@ -84,16 +85,16 @@ cc_sharing_networks_update_status (CcSharingNetworks *self)
{
CcSharingStatus status;
- if (self->priv->networks == NULL)
+ if (self->networks == NULL)
status = CC_SHARING_STATUS_OFF;
- else if (gtk_widget_is_visible (self->priv->current_switch) &&
- gtk_switch_get_active (GTK_SWITCH (self->priv->current_switch)))
+ else if (gtk_widget_is_visible (self->current_switch) &&
+ gtk_switch_get_active (GTK_SWITCH (self->current_switch)))
status = CC_SHARING_STATUS_ACTIVE;
else
status = CC_SHARING_STATUS_ENABLED;
- if (status != self->priv->status) {
- self->priv->status = status;
+ if (status != self->status) {
+ self->status = status;
g_object_notify (G_OBJECT (self), "status");
}
}
@@ -106,16 +107,16 @@ cc_sharing_update_networks (CcSharingNetworks *self)
GVariantIter iter;
GError *error = NULL;
- g_list_free_full (self->priv->networks, cc_sharing_network_free);
- self->priv->networks = NULL;
+ g_list_free_full (self->networks, cc_sharing_network_free);
+ self->networks = NULL;
- if (!gsd_sharing_call_list_networks_sync (self->priv->proxy, self->priv->service_name, &networks, NULL, &error)) {
+ if (!gsd_sharing_call_list_networks_sync (self->proxy, self->service_name, &networks, NULL, &error)) {
g_warning ("couldn't list networks: %s", error->message);
- g_dbus_proxy_set_cached_property (G_DBUS_PROXY (self->priv->proxy),
+ g_dbus_proxy_set_cached_property (G_DBUS_PROXY (self->proxy),
"SharingStatus",
g_variant_new_uint32 (GSD_SHARING_STATUS_OFFLINE));
g_error_free (error);
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->priv->listbox));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
return;
}
@@ -127,10 +128,10 @@ cc_sharing_update_networks (CcSharingNetworks *self)
net->uuid = uuid;
net->network_name = network_name;
net->carrier_type = carrier_type;
- self->priv->networks = g_list_prepend (self->priv->networks, net);
+ self->networks = g_list_prepend (self->networks, net);
}
- self->priv->networks = g_list_reverse (self->priv->networks);
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->priv->listbox));
+ self->networks = g_list_reverse (self->networks);
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
g_variant_unref (networks);
}
@@ -147,14 +148,14 @@ cc_sharing_networks_remove_network (GtkWidget *button,
row = g_object_get_data (G_OBJECT (button), "row");
uuid = g_object_get_data (G_OBJECT (row), "uuid");
- ret = gsd_sharing_call_disable_service_sync (self->priv->proxy,
- self->priv->service_name,
+ ret = gsd_sharing_call_disable_service_sync (self->proxy,
+ self->service_name,
uuid,
NULL,
&error);
if (!ret) {
g_warning ("Failed to remove service %s: %s",
- self->priv->service_name, error->message);
+ self->service_name, error->message);
g_error_free (error);
}
@@ -172,14 +173,14 @@ cc_sharing_networks_enable_network (GtkSwitch *widget,
gboolean ret;
if (state) {
- ret = gsd_sharing_call_enable_service_sync (self->priv->proxy,
- self->priv->service_name,
+ ret = gsd_sharing_call_enable_service_sync (self->proxy,
+ self->service_name,
NULL,
&error);
} else {
- ret = gsd_sharing_call_disable_service_sync (self->priv->proxy,
- self->priv->service_name,
- gsd_sharing_get_current_network (self->priv->proxy),
+ ret = gsd_sharing_call_disable_service_sync (self->proxy,
+ self->service_name,
+ gsd_sharing_get_current_network (self->proxy),
NULL,
&error);
}
@@ -188,7 +189,7 @@ cc_sharing_networks_enable_network (GtkSwitch *widget,
gtk_switch_set_state (widget, state);
} else {
g_warning ("Failed to %s service %s: %s", state ? "enable" : "disable",
- self->priv->service_name, error->message);
+ self->service_name, error->message);
g_error_free (error);
g_signal_handlers_block_by_func (widget,
cc_sharing_networks_enable_network, self);
@@ -266,12 +267,12 @@ cc_sharing_networks_new_current_row (CcSharingNetworks *self)
w = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
gtk_widget_set_margin_end (w, 12);
gtk_container_add (GTK_CONTAINER (box), w);
- self->priv->current_icon = w;
+ self->current_icon = w;
/* Label */
w = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (box), w);
- self->priv->current_label = w;
+ self->current_label = w;
w = gtk_switch_new ();
gtk_widget_set_margin_top (w, 3);
@@ -281,7 +282,7 @@ cc_sharing_networks_new_current_row (CcSharingNetworks *self)
gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (w), "state-set",
G_CALLBACK (cc_sharing_networks_enable_network), self);
- self->priv->current_switch = w;
+ self->current_switch = w;
g_object_set_data (G_OBJECT (w), "row", row);
gtk_widget_show_all (box);
@@ -318,34 +319,34 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
const char *current_network;
GList *children, *l;
- children = gtk_container_get_children (GTK_CONTAINER (self->priv->listbox));
+ children = gtk_container_get_children (GTK_CONTAINER (self->listbox));
for (l = children; l != NULL; l = l->next) {
GtkWidget *row = l->data;
- if (row != self->priv->current_row &&
- row != self->priv->no_network_row)
+ if (row != self->current_row &&
+ row != self->no_network_row)
gtk_widget_destroy (row);
}
g_list_free (children);
- current_network = gsd_sharing_get_current_network (self->priv->proxy);
+ current_network = gsd_sharing_get_current_network (self->proxy);
if (current_network != NULL &&
!g_str_equal (current_network, "")) {
gboolean available;
const char *carrier_type, *icon_name, *current_network_name;
- gtk_widget_show (self->priv->current_row);
+ gtk_widget_show (self->current_row);
current_visible = TRUE;
/* Network name */
- g_object_set_data_full (G_OBJECT (self->priv->current_row),
+ g_object_set_data_full (G_OBJECT (self->current_row),
"uuid", g_strdup (current_network), g_free);
- current_network_name = gsd_sharing_get_current_network_name (self->priv->proxy);
- gtk_label_set_label (GTK_LABEL (self->priv->current_label), current_network_name);
+ current_network_name = gsd_sharing_get_current_network_name (self->proxy);
+ gtk_label_set_label (GTK_LABEL (self->current_label), current_network_name);
/* Icon */
- carrier_type = gsd_sharing_get_carrier_type (self->priv->proxy);
+ carrier_type = gsd_sharing_get_carrier_type (self->proxy);
if (g_strcmp0 (carrier_type, "802-11-wireless") == 0) {
icon_name = "network-wireless-signal-excellent-symbolic";
} else if (g_strcmp0 (carrier_type, "802-3-ethernet") == 0) {
@@ -353,26 +354,26 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
} else {
icon_name = "network-wired-symbolic";
}
- gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->current_icon), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->current_icon), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
/* State */
- available = gsd_sharing_get_sharing_status (self->priv->proxy) == GSD_SHARING_STATUS_AVAILABLE;
- gtk_widget_set_sensitive (self->priv->current_switch, available);
+ available = gsd_sharing_get_sharing_status (self->proxy) == GSD_SHARING_STATUS_AVAILABLE;
+ gtk_widget_set_sensitive (self->current_switch, available);
//FIXME add a subtitle explaining why it's disabled
} else {
- gtk_widget_hide (self->priv->current_row);
+ gtk_widget_hide (self->current_row);
current_visible = FALSE;
}
- for (l = self->priv->networks; l != NULL; l = l->next) {
+ for (l = self->networks; l != NULL; l = l->next) {
CcSharingNetwork *net = l->data;
GtkWidget *row;
if (g_strcmp0 (net->uuid, current_network) == 0) {
- g_signal_handlers_block_by_func (self->priv->current_switch,
+ g_signal_handlers_block_by_func (self->current_switch,
cc_sharing_networks_enable_network, self);
- gtk_switch_set_state (GTK_SWITCH (self->priv->current_switch), TRUE);
- g_signal_handlers_unblock_by_func (self->priv->current_switch,
+ gtk_switch_set_state (GTK_SWITCH (self->current_switch), TRUE);
+ g_signal_handlers_unblock_by_func (self->current_switch,
cc_sharing_networks_enable_network, self);
continue;
}
@@ -381,19 +382,19 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
net->network_name,
net->carrier_type,
self);
- gtk_list_box_insert (GTK_LIST_BOX (self->priv->listbox), row, -1);
+ gtk_list_box_insert (GTK_LIST_BOX (self->listbox), row, -1);
}
- if (self->priv->networks == NULL &&
+ if (self->networks == NULL &&
!current_visible) {
- gtk_widget_show (self->priv->no_network_row);
+ gtk_widget_show (self->no_network_row);
} else {
- gtk_widget_hide (self->priv->no_network_row);
+ gtk_widget_hide (self->no_network_row);
}
cc_sharing_networks_update_status (self);
- cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->priv->listbox));
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
}
static void
@@ -414,23 +415,23 @@ cc_sharing_networks_constructed (GObject *object)
self = CC_SHARING_NETWORKS (object);
- gtk_list_box_set_header_func (GTK_LIST_BOX (self->priv->listbox),
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->listbox),
cc_list_box_update_header_func, NULL,
NULL);
- cc_list_box_setup_scrolling (GTK_LIST_BOX (self->priv->listbox), 3);
+ cc_list_box_setup_scrolling (GTK_LIST_BOX (self->listbox), 3);
- self->priv->current_row = cc_sharing_networks_new_current_row (self);
- gtk_list_box_insert (GTK_LIST_BOX (self->priv->listbox), self->priv->current_row, -1);
- g_object_set_data (G_OBJECT (self), "switch", self->priv->current_switch);
+ self->current_row = cc_sharing_networks_new_current_row (self);
+ gtk_list_box_insert (GTK_LIST_BOX (self->listbox), self->current_row, -1);
+ g_object_set_data (G_OBJECT (self), "switch", self->current_switch);
- self->priv->no_network_row = cc_sharing_networks_new_no_network_row (self);
- gtk_list_box_insert (GTK_LIST_BOX (self->priv->listbox), self->priv->no_network_row, -1);
+ self->no_network_row = cc_sharing_networks_new_no_network_row (self);
+ gtk_list_box_insert (GTK_LIST_BOX (self->listbox), self->no_network_row, -1);
cc_sharing_update_networks (self);
cc_sharing_update_networks_box (self);
- g_signal_connect (self->priv->proxy, "notify::current-network",
+ g_signal_connect (self->proxy, "notify::current-network",
G_CALLBACK (current_network_changed), self);
}
@@ -438,7 +439,6 @@ static void
cc_sharing_networks_init (CcSharingNetworks *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- self->priv = cc_sharing_networks_get_instance_private (self);
}
GtkWidget *
@@ -466,10 +466,10 @@ cc_sharing_networks_set_property (GObject *object,
switch (prop_id) {
case PROP_SERVICE_NAME:
- self->priv->service_name = g_value_dup_string (value);
+ self->service_name = g_value_dup_string (value);
break;
case PROP_PROXY:
- self->priv->proxy = g_value_dup_object (value);
+ self->proxy = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -489,7 +489,7 @@ cc_sharing_networks_get_property (GObject *object,
switch (prop_id) {
case PROP_STATUS:
- g_value_set_uint (value, self->priv->status);
+ g_value_set_uint (value, self->status);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -507,14 +507,14 @@ cc_sharing_networks_finalize (GObject *object)
self = CC_SHARING_NETWORKS (object);
- g_return_if_fail (self->priv != NULL);
+ g_return_if_fail (self != NULL);
- g_clear_object (&self->priv->proxy);
- g_clear_pointer (&self->priv->service_name, g_free);
+ g_clear_object (&self->proxy);
+ g_clear_pointer (&self->service_name, g_free);
- if (self->priv->networks != NULL) {
- g_list_free_full (self->priv->networks, cc_sharing_network_free);
- self->priv->networks = NULL;
+ if (self->networks != NULL) {
+ g_list_free_full (self->networks, cc_sharing_network_free);
+ self->networks = NULL;
}
G_OBJECT_CLASS (cc_sharing_networks_parent_class)->finalize (object);
@@ -559,7 +559,7 @@ cc_sharing_networks_class_init (CcSharingNetworksClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/sharing/networks.ui");
- gtk_widget_class_bind_template_child_private (widget_class, CcSharingNetworks, listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcSharingNetworks, listbox);
}
/*
diff --git a/panels/sharing/cc-sharing-networks.h b/panels/sharing/cc-sharing-networks.h
index b1f6c1490..8abe10bf1 100644
--- a/panels/sharing/cc-sharing-networks.h
+++ b/panels/sharing/cc-sharing-networks.h
@@ -24,28 +24,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_SHARING_NETWORKS (cc_sharing_networks_get_type ())
-#define CC_SHARING_NETWORKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_SHARING_NETWORKS, CcSharingNetworks))
-#define CC_SHARING_NETWORKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_SHARING_NETWORKS, CcSharingNetworksClass))
-#define CC_IS_SHARING_NETWORKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_SHARING_NETWORKS))
-#define CC_IS_SHARING_NETWORKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_SHARING_NETWORKS))
-#define CC_SHARING_NETWORKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_SHARING_NETWORKS, CcSharingNetworksClass))
-
-typedef struct _CcSharingNetworks CcSharingNetworks;
-typedef struct _CcSharingNetworksPrivate CcSharingNetworksPrivate;
-typedef struct _CcSharingNetworksClass CcSharingNetworksClass;
-
-struct _CcSharingNetworks
-{
- GtkGrid parent_instance;
-
- CcSharingNetworksPrivate *priv;
-};
-
-struct _CcSharingNetworksClass
-{
- GtkGridClass parent_class;
-};
+#define CC_TYPE_SHARING_NETWORKS (cc_sharing_networks_get_type ())
+G_DECLARE_FINAL_TYPE (CcSharingNetworks, cc_sharing_networks, CC, SHARING_NETWORKS, GtkGrid)
typedef enum {
CC_SHARING_STATUS_UNSET,
@@ -54,7 +34,6 @@ typedef enum {
CC_SHARING_STATUS_ACTIVE
} CcSharingStatus;
-GType cc_sharing_networks_get_type (void) G_GNUC_CONST;
GtkWidget * cc_sharing_networks_new (GDBusProxy *proxy,
const char *service_name);
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 5add11540..4257af601 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -38,12 +38,6 @@
#include <glib/gi18n.h>
#include <config.h>
-CC_PANEL_REGISTER (CcSharingPanel, cc_sharing_panel)
-
-#define PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHARING_PANEL, CcSharingPanelPrivate))
-
-
static void cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self, GtkWidget *label);
static GtkWidget *cc_sharing_panel_new_media_sharing_row (const char *uri_or_path,
CcSharingPanel *self);
@@ -61,14 +55,16 @@ _gtk_builder_get_widget (GtkBuilder *builder,
return w;
}
-#define WID(y) _gtk_builder_get_widget (priv->builder, y)
+#define WID(y) _gtk_builder_get_widget (self->builder, y)
#define VINO_SCHEMA_ID "org.gnome.Vino"
#define FILE_SHARING_SCHEMA_ID "org.gnome.desktop.file-sharing"
#define GNOME_REMOTE_DESKTOP_SCHEMA_ID "org.gnome.desktop.remote-desktop"
-struct _CcSharingPanelPrivate
+struct _CcSharingPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *master_switch;
@@ -91,6 +87,8 @@ struct _CcSharingPanelPrivate
guint remote_desktop_name_watch;
};
+CC_PANEL_REGISTER (CcSharingPanel, cc_sharing_panel)
+
#define OFF_IF_VISIBLE(x) { if (gtk_widget_is_visible(x) && gtk_widget_is_sensitive(x)) gtk_switch_set_active (GTK_SWITCH(x), FALSE); }
static void
@@ -98,7 +96,6 @@ cc_sharing_panel_master_switch_notify (GtkSwitch *gtkswitch,
GParamSpec *pspec,
CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
gboolean active;
active = gtk_switch_get_active (gtkswitch);
@@ -106,9 +103,9 @@ cc_sharing_panel_master_switch_notify (GtkSwitch *gtkswitch,
if (!active)
{
/* disable all services if the master switch is not active */
- OFF_IF_VISIBLE(priv->media_sharing_switch);
- OFF_IF_VISIBLE(priv->personal_file_sharing_switch);
- OFF_IF_VISIBLE(priv->screen_sharing_switch);
+ OFF_IF_VISIBLE(self->media_sharing_switch);
+ OFF_IF_VISIBLE(self->personal_file_sharing_switch);
+ OFF_IF_VISIBLE(self->screen_sharing_switch);
gtk_switch_set_active (GTK_SWITCH (WID ("remote-login-switch")), FALSE);
}
@@ -119,65 +116,65 @@ cc_sharing_panel_master_switch_notify (GtkSwitch *gtkswitch,
static void
cc_sharing_panel_constructed (GObject *object)
{
- CcSharingPanelPrivate *priv = CC_SHARING_PANEL (object)->priv;
+ CcSharingPanel *self = CC_SHARING_PANEL (object);
G_OBJECT_CLASS (cc_sharing_panel_parent_class)->constructed (object);
/* add the master switch */
cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
- gtk_widget_get_parent (priv->master_switch));
+ gtk_widget_get_parent (self->master_switch));
}
static void
cc_sharing_panel_dispose (GObject *object)
{
- CcSharingPanelPrivate *priv = CC_SHARING_PANEL (object)->priv;
+ CcSharingPanel *self = CC_SHARING_PANEL (object);
- if (priv->remote_desktop_name_watch)
- g_bus_unwatch_name (priv->remote_desktop_name_watch);
- priv->remote_desktop_name_watch = 0;
+ if (self->remote_desktop_name_watch)
+ g_bus_unwatch_name (self->remote_desktop_name_watch);
+ self->remote_desktop_name_watch = 0;
- g_clear_object (&priv->builder);
+ g_clear_object (&self->builder);
- if (priv->media_sharing_dialog)
+ if (self->media_sharing_dialog)
{
- gtk_widget_destroy (priv->media_sharing_dialog);
- priv->media_sharing_dialog = NULL;
+ gtk_widget_destroy (self->media_sharing_dialog);
+ self->media_sharing_dialog = NULL;
}
- if (priv->personal_file_sharing_dialog)
+ if (self->personal_file_sharing_dialog)
{
- gtk_widget_destroy (priv->personal_file_sharing_dialog);
- priv->personal_file_sharing_dialog = NULL;
+ gtk_widget_destroy (self->personal_file_sharing_dialog);
+ self->personal_file_sharing_dialog = NULL;
}
- if (priv->remote_login_cancellable)
+ if (self->remote_login_cancellable)
{
- g_cancellable_cancel (priv->remote_login_cancellable);
- g_clear_object (&priv->remote_login_cancellable);
+ g_cancellable_cancel (self->remote_login_cancellable);
+ g_clear_object (&self->remote_login_cancellable);
}
- if (priv->hostname_cancellable)
+ if (self->hostname_cancellable)
{
- g_cancellable_cancel (priv->hostname_cancellable);
- g_clear_object (&priv->hostname_cancellable);
+ g_cancellable_cancel (self->hostname_cancellable);
+ g_clear_object (&self->hostname_cancellable);
}
- if (priv->remote_login_dialog)
+ if (self->remote_login_dialog)
{
- gtk_widget_destroy (priv->remote_login_dialog);
- priv->remote_login_dialog = NULL;
+ gtk_widget_destroy (self->remote_login_dialog);
+ self->remote_login_dialog = NULL;
}
- if (priv->screen_sharing_dialog)
+ if (self->screen_sharing_dialog)
{
- gtk_widget_destroy (priv->screen_sharing_dialog);
- priv->screen_sharing_dialog = NULL;
+ gtk_widget_destroy (self->screen_sharing_dialog);
+ self->screen_sharing_dialog = NULL;
}
- g_cancellable_cancel (priv->sharing_proxy_cancellable);
- g_clear_object (&priv->sharing_proxy_cancellable);
- g_clear_object (&priv->sharing_proxy);
+ g_cancellable_cancel (self->sharing_proxy_cancellable);
+ g_clear_object (&self->sharing_proxy_cancellable);
+ g_clear_object (&self->sharing_proxy);
G_OBJECT_CLASS (cc_sharing_panel_parent_class)->dispose (object);
}
@@ -194,8 +191,6 @@ cc_sharing_panel_class_init (CcSharingPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcSharingPanelPrivate));
-
object_class->constructed = cc_sharing_panel_constructed;
object_class->dispose = cc_sharing_panel_dispose;
@@ -206,7 +201,6 @@ static void
cc_sharing_panel_run_dialog (CcSharingPanel *self,
const gchar *dialog_name)
{
- CcSharingPanelPrivate *priv = self->priv;
GtkWidget *dialog, *parent;
dialog = WID (dialog_name);
@@ -276,7 +270,7 @@ cc_sharing_panel_switch_to_label_transform_func (GBinding *binding,
/* ensure the master switch is active if one of the services is active */
if (active)
- gtk_switch_set_active (GTK_SWITCH (self->priv->master_switch), TRUE);
+ gtk_switch_set_active (GTK_SWITCH (self->master_switch), TRUE);
return TRUE;
}
@@ -313,7 +307,7 @@ cc_sharing_panel_networks_to_label_transform_func (GBinding *binding,
/* ensure the master switch is active if one of the services is active */
if (status != CC_SHARING_STATUS_OFF)
- gtk_switch_set_active (GTK_SWITCH (self->priv->master_switch), TRUE);
+ gtk_switch_set_active (GTK_SWITCH (self->master_switch), TRUE);
return TRUE;
}
@@ -367,7 +361,6 @@ cc_sharing_panel_add_folder (GtkListBox *box,
GtkListBoxRow *row,
CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GtkWidget *dialog;
gchar *folder = NULL;
gboolean matching = FALSE;
@@ -431,7 +424,6 @@ static void
cc_sharing_panel_remove_folder (GtkButton *button,
CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GtkWidget *row;
row = g_object_get_data (G_OBJECT (button), "row");
@@ -444,7 +436,6 @@ cc_sharing_panel_media_sharing_dialog_response (GtkDialog *dialog,
gint reponse_id,
CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GPtrArray *folders;
GtkWidget *box;
GList *rows, *l;
@@ -594,7 +585,6 @@ cc_sharing_panel_new_add_media_sharing_row (CcSharingPanel *self)
static void
cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
gchar **folders, **list;
GtkWidget *box, *networks, *grid, *w;
char *path;
@@ -640,14 +630,14 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
g_strfreev (folders);
- networks = cc_sharing_networks_new (self->priv->sharing_proxy, "rygel");
+ networks = cc_sharing_networks_new (self->sharing_proxy, "rygel");
grid = WID ("grid4");
gtk_grid_attach (GTK_GRID (grid), networks, 0, 4, 2, 1);
gtk_widget_show (networks);
w = cc_sharing_switch_new (networks);
gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("media-sharing-headerbar")), w);
- self->priv->media_sharing_switch = w;
+ self->media_sharing_switch = w;
cc_sharing_panel_bind_networks_to_label (self, networks,
WID ("media-sharing-status-label"));
@@ -683,7 +673,6 @@ cc_sharing_panel_setup_label (CcSharingPanel *self,
GtkWidget *label,
const gchar *hostname)
{
- CcSharingPanelPrivate *priv = self->priv;
gchar *text;
if (label == WID ("personal-file-sharing-label"))
@@ -726,7 +715,7 @@ cc_sharing_panel_get_host_name_fqdn_done (GDBusConnection *connection,
{
gchar *hostname;
- hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->priv->hostname_entry));
+ hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->hostname_entry));
cc_sharing_panel_setup_label (data->panel, data->label, hostname);
@@ -765,7 +754,7 @@ cc_sharing_panel_bus_ready (GObject *object,
{
gchar *hostname;
- hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->priv->hostname_entry));
+ hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->hostname_entry));
cc_sharing_panel_setup_label (data->panel, data->label, hostname);
@@ -786,7 +775,7 @@ cc_sharing_panel_bus_ready (GObject *object,
(GVariantType*)"(s)",
G_DBUS_CALL_FLAGS_NONE,
-1,
- data->panel->priv->hostname_cancellable,
+ data->panel->hostname_cancellable,
(GAsyncReadyCallback) cc_sharing_panel_get_host_name_fqdn_done,
data);
}
@@ -825,7 +814,7 @@ cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self,
get_hostname_data->panel = self;
get_hostname_data->label = label;
g_bus_get (G_BUS_TYPE_SYSTEM,
- self->priv->hostname_cancellable,
+ self->hostname_cancellable,
(GAsyncReadyCallback) cc_sharing_panel_bus_ready,
get_hostname_data);
}
@@ -863,7 +852,6 @@ file_sharing_password_changed (GtkEntry *entry)
static void
cc_sharing_panel_setup_personal_file_sharing_dialog (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GSettings *settings;
GtkWidget *networks, *grid, *w;
@@ -891,14 +879,14 @@ cc_sharing_panel_setup_personal_file_sharing_dialog (CcSharingPanel *self)
"notify::text", G_CALLBACK (file_sharing_password_changed),
NULL);
- networks = cc_sharing_networks_new (self->priv->sharing_proxy, "gnome-user-share-webdav");
+ networks = cc_sharing_networks_new (self->sharing_proxy, "gnome-user-share-webdav");
grid = WID ("grid2");
gtk_grid_attach (GTK_GRID (grid), networks, 0, 3, 2, 1);
gtk_widget_show (networks);
w = cc_sharing_switch_new (networks);
gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("personal-file-sharing-headerbar")), w);
- self->priv->personal_file_sharing_switch = w;
+ self->personal_file_sharing_switch = w;
cc_sharing_panel_bind_networks_to_label (self,
networks,
@@ -910,14 +898,12 @@ remote_login_switch_activate (GtkSwitch *remote_login_switch,
GParamSpec *pspec,
CcSharingPanel *self)
{
- cc_remote_login_set_enabled (self->priv->remote_login_cancellable, remote_login_switch);
+ cc_remote_login_set_enabled (self->remote_login_cancellable, remote_login_switch);
}
static void
cc_sharing_panel_setup_remote_login_dialog (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
-
cc_sharing_panel_bind_switch_to_label (self, WID ("remote-login-switch"),
WID ("remote-login-status-label"));
@@ -927,7 +913,7 @@ cc_sharing_panel_setup_remote_login_dialog (CcSharingPanel *self)
G_CALLBACK (remote_login_switch_activate), self);
gtk_widget_set_sensitive (WID ("remote-login-switch"), FALSE);
- cc_remote_login_get_enabled (self->priv->remote_login_cancellable,
+ cc_remote_login_get_enabled (self->remote_login_cancellable,
GTK_SWITCH (WID ("remote-login-switch")),
WID ("remote-login-button"));
}
@@ -954,8 +940,6 @@ cc_sharing_panel_check_schema_available (CcSharingPanel *self,
static void
screen_sharing_show_cb (GtkWidget *widget, CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
-
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("show-password-checkbutton")),
FALSE);
}
@@ -966,7 +950,6 @@ screen_sharing_hide_cb (GtkWidget *widget, CcSharingPanel *self)
GtkToggleButton *ac_radio;
GtkEntry *pw_entry;
const gchar *password;
- CcSharingPanelPrivate *priv = self->priv;
ac_radio = GTK_TOGGLE_BUTTON (WID ("approve-connections-radiobutton"));
pw_entry = GTK_ENTRY (WID ("remote-control-password-entry"));
@@ -1011,7 +994,6 @@ screen_sharing_password_insert_text_cb (GtkEditable *editable,
static void
cc_sharing_panel_setup_screen_sharing_dialog_vino (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GSettings *settings;
GtkWidget *networks, *box, *w;
@@ -1047,24 +1029,24 @@ cc_sharing_panel_setup_screen_sharing_dialog_vino (CcSharingPanel *self)
G_BINDING_SYNC_CREATE);
/* make sure the password entry is hidden by default */
- g_signal_connect (priv->screen_sharing_dialog, "show",
+ g_signal_connect (self->screen_sharing_dialog, "show",
G_CALLBACK (screen_sharing_show_cb), self);
- g_signal_connect (priv->screen_sharing_dialog, "hide",
+ g_signal_connect (self->screen_sharing_dialog, "hide",
G_CALLBACK (screen_sharing_hide_cb), self);
/* accept at most 8 bytes in password entry */
g_signal_connect (WID ("remote-control-password-entry"), "insert-text",
G_CALLBACK (screen_sharing_password_insert_text_cb), self);
- networks = cc_sharing_networks_new (self->priv->sharing_proxy, "vino-server");
+ networks = cc_sharing_networks_new (self->sharing_proxy, "vino-server");
box = WID ("remote-control-box");
gtk_box_pack_end (GTK_BOX (box), networks, TRUE, TRUE, 0);
gtk_widget_show (networks);
w = cc_sharing_switch_new (networks);
gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("screen-sharing-headerbar")), w);
- self->priv->screen_sharing_switch = w;
+ self->screen_sharing_switch = w;
cc_sharing_panel_bind_networks_to_label (self, networks,
WID ("screen-sharing-status-label"));
@@ -1073,17 +1055,16 @@ cc_sharing_panel_setup_screen_sharing_dialog_vino (CcSharingPanel *self)
static void
cc_sharing_panel_setup_screen_sharing_dialog_gnome_remote_desktop (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
GtkWidget *networks, *w;
- networks = cc_sharing_networks_new (self->priv->sharing_proxy, "gnome-remote-desktop");
+ networks = cc_sharing_networks_new (self->sharing_proxy, "gnome-remote-desktop");
gtk_widget_hide (WID ("remote-control-box"));
gtk_grid_attach (GTK_GRID (WID ("grid3")), networks, 0, 1, 2, 1);
gtk_widget_show (networks);
w = cc_sharing_switch_new (networks);
gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("screen-sharing-headerbar")), w);
- self->priv->screen_sharing_switch = w;
+ self->screen_sharing_switch = w;
cc_sharing_panel_bind_networks_to_label (self, networks,
WID ("screen-sharing-status-label"));
@@ -1096,10 +1077,9 @@ remote_desktop_name_appeared (GDBusConnection *connection,
gpointer user_data)
{
CcSharingPanel *self = CC_SHARING_PANEL (user_data);
- CcSharingPanelPrivate *priv = self->priv;
- g_bus_unwatch_name (priv->remote_desktop_name_watch);
- priv->remote_desktop_name_watch = 0;
+ g_bus_unwatch_name (self->remote_desktop_name_watch);
+ self->remote_desktop_name_watch = 0;
cc_sharing_panel_setup_screen_sharing_dialog_gnome_remote_desktop (self);
gtk_widget_show (WID ("screen-sharing-button"));
@@ -1108,12 +1088,10 @@ remote_desktop_name_appeared (GDBusConnection *connection,
static void
check_remote_desktop_available (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv;
-
if (!cc_sharing_panel_check_schema_available (self, GNOME_REMOTE_DESKTOP_SCHEMA_ID))
return;
- priv->remote_desktop_name_watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
+ self->remote_desktop_name_watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
"org.gnome.Mutter.RemoteDesktop",
G_BUS_NAME_WATCHER_FLAGS_NONE,
remote_desktop_name_appeared,
@@ -1128,7 +1106,6 @@ sharing_proxy_ready (GObject *source,
gpointer user_data)
{
CcSharingPanel *self;
- CcSharingPanelPrivate *priv;
GDBusProxy *proxy;
GError *error = NULL;
@@ -1141,8 +1118,7 @@ sharing_proxy_ready (GObject *source,
}
self = CC_SHARING_PANEL (user_data);
- priv = self->priv;
- priv->sharing_proxy = proxy;
+ self->sharing_proxy = proxy;
/* media sharing */
cc_sharing_panel_setup_media_sharing_dialog (self);
@@ -1174,7 +1150,6 @@ sharing_proxy_ready (GObject *source,
static void
cc_sharing_panel_init (CcSharingPanel *self)
{
- CcSharingPanelPrivate *priv = self->priv = PANEL_PRIVATE (self);
GtkWidget *box;
GError *err = NULL;
gchar *objects[] = {
@@ -1187,37 +1162,37 @@ cc_sharing_panel_init (CcSharingPanel *self)
g_resources_register (cc_sharing_get_resource ());
- priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_resource (priv->builder,
+ gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/sharing/sharing.ui",
objects, &err);
if (err)
g_error ("Error loading CcSharingPanel user interface: %s", err->message);
- priv->hostname_entry = WID ("hostname-entry");
+ self->hostname_entry = WID ("hostname-entry");
gtk_container_add (GTK_CONTAINER (self), WID ("sharing-panel"));
g_signal_connect (WID ("main-list-box"), "row-activated",
G_CALLBACK (cc_sharing_panel_main_list_box_row_activated), self);
- priv->hostname_cancellable = g_cancellable_new ();
+ self->hostname_cancellable = g_cancellable_new ();
- priv->media_sharing_dialog = WID ("media-sharing-dialog");
- priv->personal_file_sharing_dialog = WID ("personal-file-sharing-dialog");
- priv->remote_login_dialog = WID ("remote-login-dialog");
- priv->remote_login_cancellable = g_cancellable_new ();
- priv->screen_sharing_dialog = WID ("screen-sharing-dialog");
+ self->media_sharing_dialog = WID ("media-sharing-dialog");
+ self->personal_file_sharing_dialog = WID ("personal-file-sharing-dialog");
+ self->remote_login_dialog = WID ("remote-login-dialog");
+ self->remote_login_cancellable = g_cancellable_new ();
+ self->screen_sharing_dialog = WID ("screen-sharing-dialog");
- g_signal_connect (priv->media_sharing_dialog, "response",
+ g_signal_connect (self->media_sharing_dialog, "response",
G_CALLBACK (gtk_widget_hide), NULL);
- g_signal_connect (priv->personal_file_sharing_dialog, "response",
+ g_signal_connect (self->personal_file_sharing_dialog, "response",
G_CALLBACK (gtk_widget_hide), NULL);
- g_signal_connect (priv->remote_login_dialog, "response",
+ g_signal_connect (self->remote_login_dialog, "response",
G_CALLBACK (gtk_widget_hide), NULL);
- g_signal_connect (priv->screen_sharing_dialog, "response",
+ g_signal_connect (self->screen_sharing_dialog, "response",
G_CALLBACK (gtk_widget_hide), NULL);
gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (WID ("main-list-box")),
@@ -1229,24 +1204,24 @@ cc_sharing_panel_init (CcSharingPanel *self)
/* create the master switch */
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- priv->master_switch = gtk_switch_new ();
- atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (priv->master_switch)), _("Sharing"));
- gtk_widget_set_valign (priv->master_switch, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (box), priv->master_switch, FALSE, FALSE, 4);
+ self->master_switch = gtk_switch_new ();
+ atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (self->master_switch)), _("Sharing"));
+ gtk_widget_set_valign (self->master_switch, GTK_ALIGN_CENTER);
+ gtk_box_pack_start (GTK_BOX (box), self->master_switch, FALSE, FALSE, 4);
gtk_widget_show_all (box);
/* start the panel in the disabled state */
- gtk_switch_set_active (GTK_SWITCH (priv->master_switch), FALSE);
+ gtk_switch_set_active (GTK_SWITCH (self->master_switch), FALSE);
gtk_widget_set_sensitive (WID ("main-list-box"), FALSE);
- g_signal_connect (priv->master_switch, "notify::active",
+ g_signal_connect (self->master_switch, "notify::active",
G_CALLBACK (cc_sharing_panel_master_switch_notify), self);
- priv->sharing_proxy_cancellable = g_cancellable_new ();
+ self->sharing_proxy_cancellable = g_cancellable_new ();
gsd_sharing_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
"org.gnome.SettingsDaemon.Sharing",
"/org/gnome/SettingsDaemon/Sharing",
- priv->sharing_proxy_cancellable,
+ self->sharing_proxy_cancellable,
sharing_proxy_ready,
self);
diff --git a/panels/sharing/cc-sharing-panel.h b/panels/sharing/cc-sharing-panel.h
index 9004fd8e5..17f84dbde 100644
--- a/panels/sharing/cc-sharing-panel.h
+++ b/panels/sharing/cc-sharing-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_SHARING_PANEL cc_sharing_panel_get_type()
-
-#define CC_SHARING_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_SHARING_PANEL, CcSharingPanel))
-
-#define CC_SHARING_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_SHARING_PANEL, CcSharingPanelClass))
-
-#define CC_SHARING_IS_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_SHARING_PANEL))
-
-#define CC_SHARING_IS_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_SHARING_PANEL))
-
-#define CC_SHARING_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_SHARING_PANEL, CcSharingPanelClass))
-
-typedef struct _CcSharingPanel CcSharingPanel;
-typedef struct _CcSharingPanelClass CcSharingPanelClass;
-typedef struct _CcSharingPanelPrivate CcSharingPanelPrivate;
-
-struct _CcSharingPanel
-{
- CcPanel parent;
-
- CcSharingPanelPrivate *priv;
-};
-
-struct _CcSharingPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_sharing_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_SHARING_PANEL (cc_sharing_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcSharingPanel, cc_sharing_panel, CC, SHARING_PANEL, CcPanel)
CcSharingPanel *cc_sharing_panel_new (void);
diff --git a/panels/sharing/cc-sharing-switch.c b/panels/sharing/cc-sharing-switch.c
index 56e5c2df5..4c752148b 100644
--- a/panels/sharing/cc-sharing-switch.c
+++ b/panels/sharing/cc-sharing-switch.c
@@ -23,12 +23,13 @@
#include <gio/gio.h>
#include "cc-sharing-switch.h"
-struct _CcSharingSwitchPrivate {
+struct _CcSharingSwitch {
+ GtkSwitch parent_instance;
+
GtkWidget *widget;
};
-G_DEFINE_TYPE_WITH_CODE (CcSharingSwitch, cc_sharing_switch, GTK_TYPE_SWITCH,
- G_ADD_PRIVATE (CcSharingSwitch))
+G_DEFINE_TYPE (CcSharingSwitch, cc_sharing_switch, GTK_TYPE_SWITCH)
enum {
PROP_0,
@@ -49,7 +50,7 @@ cc_sharing_switch_constructed (GObject *object)
self = CC_SHARING_SWITCH (object);
- other_sw = g_object_get_data (G_OBJECT (self->priv->widget), "switch");
+ other_sw = g_object_get_data (G_OBJECT (self->widget), "switch");
g_object_bind_property (other_sw, "visible", self, "visible", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (other_sw, "state", self, "state", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
@@ -62,7 +63,6 @@ cc_sharing_switch_constructed (GObject *object)
static void
cc_sharing_switch_init (CcSharingSwitch *self)
{
- self->priv = cc_sharing_switch_get_instance_private (self);
}
GtkWidget *
@@ -87,7 +87,7 @@ cc_sharing_switch_set_property (GObject *object,
switch (prop_id) {
case PROP_WIDGET:
- self->priv->widget = g_value_dup_object (value);
+ self->widget = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -105,9 +105,9 @@ cc_sharing_switch_finalize (GObject *object)
self = CC_SHARING_SWITCH (object);
- g_return_if_fail (self->priv != NULL);
+ g_return_if_fail (self != NULL);
- g_clear_object (&self->priv->widget);
+ g_clear_object (&self->widget);
G_OBJECT_CLASS (cc_sharing_switch_parent_class)->finalize (object);
}
diff --git a/panels/sharing/cc-sharing-switch.h b/panels/sharing/cc-sharing-switch.h
index 7fcc5e4ab..9a42f0ffc 100644
--- a/panels/sharing/cc-sharing-switch.h
+++ b/panels/sharing/cc-sharing-switch.h
@@ -24,30 +24,9 @@
G_BEGIN_DECLS
-#define CC_TYPE_SHARING_SWITCH (cc_sharing_switch_get_type ())
-#define CC_SHARING_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_SHARING_SWITCH, CcSharingSwitch))
-#define CC_SHARING_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_SHARING_SWITCH, CcSharingSwitchClass))
-#define CC_IS_SHARING_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_SHARING_SWITCH))
-#define CC_IS_SHARING_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_SHARING_SWITCH))
-#define CC_SHARING_SWITCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_SHARING_SWITCH, CcSharingSwitchClass))
+#define CC_TYPE_SHARING_SWITCH (cc_sharing_switch_get_type ())
+G_DECLARE_FINAL_TYPE (CcSharingSwitch, cc_sharing_switch, CC, SHARING_SWITCH, GtkSwitch)
-typedef struct _CcSharingSwitch CcSharingSwitch;
-typedef struct _CcSharingSwitchPrivate CcSharingSwitchPrivate;
-typedef struct _CcSharingSwitchClass CcSharingSwitchClass;
-
-struct _CcSharingSwitch
-{
- GtkSwitch parent_instance;
-
- CcSharingSwitchPrivate *priv;
-};
-
-struct _CcSharingSwitchClass
-{
- GtkSwitchClass parent_class;
-};
-
-GType cc_sharing_switch_get_type (void) G_GNUC_CONST;
GtkWidget * cc_sharing_switch_new (GtkWidget *widget);
G_END_DECLS
diff --git a/panels/sound/cc-sound-panel.c b/panels/sound/cc-sound-panel.c
index d715e9a91..2d73f1bd6 100644
--- a/panels/sound/cc-sound-panel.c
+++ b/panels/sound/cc-sound-panel.c
@@ -32,6 +32,14 @@
#include "cc-sound-panel.h"
#include "gvc-mixer-dialog.h"
+struct _CcSoundPanel {
+ CcPanel parent_instance;
+
+ GvcMixerControl *control;
+ GvcMixerDialog *dialog;
+ GtkWidget *connecting_label;
+};
+
CC_PANEL_REGISTER (CcSoundPanel, cc_sound_panel)
enum {
diff --git a/panels/sound/cc-sound-panel.h b/panels/sound/cc-sound-panel.h
index 1fb21b511..dd72ef9e8 100644
--- a/panels/sound/cc-sound-panel.h
+++ b/panels/sound/cc-sound-panel.h
@@ -25,30 +25,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_SOUND_PANEL cc_sound_panel_get_type()
-#define CC_SOUND_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_SOUND_PANEL, CcSoundPanel))
-#define CC_SOUND_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_SOUND_PANEL, CcSoundPanelClass))
-#define CC_IS_SOUND_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_SOUND_PANEL))
-#define CC_IS_SOUND_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_SOUND_PANEL))
-#define CC_SOUND_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_SOUND_PANEL, CcSoundPanelClass))
-
-typedef struct _CcSoundPanel CcSoundPanel;
-typedef struct _CcSoundPanelClass CcSoundPanelClass;
-typedef struct _CcSoundPanelPrivate CcSoundPanelPrivate;
-
-struct _CcSoundPanel {
- CcPanel parent;
-
- GvcMixerControl *control;
- GvcMixerDialog *dialog;
- GtkWidget *connecting_label;
-};
-
-struct _CcSoundPanelClass {
- CcPanelClass parent_class;
-};
-
-GType cc_sound_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_SOUND_PANEL (cc_sound_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcSoundPanel, cc_sound_panel, CC, SOUND_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/sound/gvc-balance-bar.c b/panels/sound/gvc-balance-bar.c
index 3933fd913..5a9a45bf6 100644
--- a/panels/sound/gvc-balance-bar.c
+++ b/panels/sound/gvc-balance-bar.c
@@ -35,10 +35,10 @@
#define SCALE_SIZE 128
#define ADJUSTMENT_MAX_NORMAL 65536.0 /* PA_VOLUME_NORM */
-#define GVC_BALANCE_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_BALANCE_BAR, GvcBalanceBarPrivate))
-
-struct GvcBalanceBarPrivate
+struct _GvcBalanceBar
{
+ GtkBox parent_instance;
+
GvcChannelMap *channel_map;
GvcBalanceType btype;
GtkWidget *scale_box;
@@ -80,27 +80,26 @@ G_DEFINE_TYPE (GvcBalanceBar, gvc_balance_bar, GTK_TYPE_BOX)
static GtkWidget *
_scale_box_new (GvcBalanceBar *bar)
{
- GvcBalanceBarPrivate *priv = bar->priv;
GtkWidget *box;
GtkWidget *sbox;
GtkWidget *ebox;
- GtkAdjustment *adjustment = bar->priv->adjustment;
+ GtkAdjustment *adjustment = bar->adjustment;
char *str_lower, *str_upper;
gdouble lower, upper;
- bar->priv->scale_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- priv->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, priv->adjustment);
- gtk_scale_set_has_origin (GTK_SCALE (priv->scale), FALSE);
- gtk_widget_set_size_request (priv->scale, SCALE_SIZE, -1);
+ bar->scale_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ bar->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, bar->adjustment);
+ gtk_scale_set_has_origin (GTK_SCALE (bar->scale), FALSE);
+ gtk_widget_set_size_request (bar->scale, SCALE_SIZE, -1);
- bar->priv->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ bar->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (sbox), priv->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), bar->label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->scale, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), bar->scale, TRUE, TRUE, 0);
- switch (bar->priv->btype) {
+ switch (bar->btype) {
case BALANCE_TYPE_RL:
str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Left"));
str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Right"));
@@ -118,42 +117,42 @@ _scale_box_new (GvcBalanceBar *bar)
}
lower = gtk_adjustment_get_lower (adjustment);
- gtk_scale_add_mark (GTK_SCALE (priv->scale), lower,
+ gtk_scale_add_mark (GTK_SCALE (bar->scale), lower,
GTK_POS_BOTTOM, str_lower);
g_free (str_lower);
upper = gtk_adjustment_get_upper (adjustment);
- gtk_scale_add_mark (GTK_SCALE (priv->scale), upper,
+ gtk_scale_add_mark (GTK_SCALE (bar->scale), upper,
GTK_POS_BOTTOM, str_upper);
g_free (str_upper);
- if (bar->priv->btype != BALANCE_TYPE_LFE) {
- gtk_scale_add_mark (GTK_SCALE (priv->scale),
+ if (bar->btype != BALANCE_TYPE_LFE) {
+ gtk_scale_add_mark (GTK_SCALE (bar->scale),
(upper - lower)/2 + lower,
GTK_POS_BOTTOM, NULL);
}
- bar->priv->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ bar->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, FALSE, 0);
- ca_gtk_widget_disable_sounds (bar->priv->scale, FALSE);
- gtk_widget_add_events (bar->priv->scale, GDK_SCROLL_MASK);
+ ca_gtk_widget_disable_sounds (bar->scale, FALSE);
+ gtk_widget_add_events (bar->scale, GDK_SCROLL_MASK);
- g_signal_connect (G_OBJECT (bar->priv->scale), "button-press-event",
+ g_signal_connect (G_OBJECT (bar->scale), "button-press-event",
G_CALLBACK (on_scale_button_press_event), bar);
- g_signal_connect (G_OBJECT (bar->priv->scale), "button-release-event",
+ g_signal_connect (G_OBJECT (bar->scale), "button-release-event",
G_CALLBACK (on_scale_button_release_event), bar);
- g_signal_connect (G_OBJECT (bar->priv->scale), "scroll-event",
+ g_signal_connect (G_OBJECT (bar->scale), "scroll-event",
G_CALLBACK (on_scale_scroll_event), bar);
- if (bar->priv->size_group != NULL) {
- gtk_size_group_add_widget (bar->priv->size_group, sbox);
+ if (bar->size_group != NULL) {
+ gtk_size_group_add_widget (bar->size_group, sbox);
- if (bar->priv->symmetric) {
- gtk_size_group_add_widget (bar->priv->size_group, ebox);
+ if (bar->symmetric) {
+ gtk_size_group_add_widget (bar->size_group, ebox);
}
}
- gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
+ gtk_scale_set_draw_value (GTK_SCALE (bar->scale), FALSE);
return box;
}
@@ -165,16 +164,16 @@ gvc_balance_bar_set_size_group (GvcBalanceBar *bar,
{
g_return_if_fail (GVC_IS_BALANCE_BAR (bar));
- bar->priv->size_group = group;
- bar->priv->symmetric = symmetric;
+ bar->size_group = group;
+ bar->symmetric = symmetric;
- if (bar->priv->size_group != NULL) {
- gtk_size_group_add_widget (bar->priv->size_group,
- bar->priv->start_box);
+ if (bar->size_group != NULL) {
+ gtk_size_group_add_widget (bar->size_group,
+ bar->start_box);
- if (bar->priv->symmetric) {
- gtk_size_group_add_widget (bar->priv->size_group,
- bar->priv->end_box);
+ if (bar->symmetric) {
+ gtk_size_group_add_widget (bar->size_group,
+ bar->end_box);
}
}
gtk_widget_queue_draw (GTK_WIDGET (bar));
@@ -204,10 +203,10 @@ update_level_from_map (GvcBalanceBar *bar,
const gdouble *volumes;
gdouble val;
- g_debug ("Volume changed (for %s bar)", btype_to_string (bar->priv->btype));
+ g_debug ("Volume changed (for %s bar)", btype_to_string (bar->btype));
volumes = gvc_channel_map_get_volume (map);
- switch (bar->priv->btype) {
+ switch (bar->btype) {
case BALANCE_TYPE_RL:
val = volumes[BALANCE];
break;
@@ -221,7 +220,7 @@ update_level_from_map (GvcBalanceBar *bar,
g_assert_not_reached ();
}
- gtk_adjustment_set_value (bar->priv->adjustment, val);
+ gtk_adjustment_set_value (bar->adjustment, val);
}
static void
@@ -238,12 +237,12 @@ gvc_balance_bar_set_channel_map (GvcBalanceBar *bar,
{
g_return_if_fail (GVC_BALANCE_BAR (bar));
- if (bar->priv->channel_map != NULL) {
- g_signal_handlers_disconnect_by_func (G_OBJECT (bar->priv->channel_map),
+ if (bar->channel_map != NULL) {
+ g_signal_handlers_disconnect_by_func (G_OBJECT (bar->channel_map),
on_channel_map_volume_changed, bar);
- g_object_unref (bar->priv->channel_map);
+ g_object_unref (bar->channel_map);
}
- bar->priv->channel_map = g_object_ref (map);
+ bar->channel_map = g_object_ref (map);
update_level_from_map (bar, map);
@@ -261,16 +260,16 @@ gvc_balance_bar_set_balance_type (GvcBalanceBar *bar,
g_return_if_fail (GVC_BALANCE_BAR (bar));
- bar->priv->btype = btype;
- if (bar->priv->btype != BALANCE_TYPE_LFE) {
- bar->priv->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->btype = btype;
+ if (bar->btype != BALANCE_TYPE_LFE) {
+ bar->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
-1.0,
1.0,
0.5,
0.5,
0.0));
} else {
- bar->priv->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
0.0,
ADJUSTMENT_MAX_NORMAL,
ADJUSTMENT_MAX_NORMAL/100.0,
@@ -278,27 +277,27 @@ gvc_balance_bar_set_balance_type (GvcBalanceBar *bar,
0.0));
}
- g_object_ref_sink (bar->priv->adjustment);
- g_signal_connect (bar->priv->adjustment,
+ g_object_ref_sink (bar->adjustment);
+ g_signal_connect (bar->adjustment,
"value-changed",
G_CALLBACK (on_adjustment_value_changed),
bar);
switch (btype) {
case BALANCE_TYPE_RL:
- bar->priv->label = gtk_label_new_with_mnemonic (_("_Balance:"));
+ bar->label = gtk_label_new_with_mnemonic (_("_Balance:"));
break;
case BALANCE_TYPE_FR:
- bar->priv->label = gtk_label_new_with_mnemonic (_("_Fade:"));
+ bar->label = gtk_label_new_with_mnemonic (_("_Fade:"));
break;
case BALANCE_TYPE_LFE:
- bar->priv->label = gtk_label_new_with_mnemonic (_("_Subwoofer:"));
+ bar->label = gtk_label_new_with_mnemonic (_("_Subwoofer:"));
break;
default:
g_assert_not_reached ();
}
- gtk_widget_set_halign (bar->priv->label, GTK_ALIGN_START);
- gtk_widget_set_valign (bar->priv->label, GTK_ALIGN_START);
+ gtk_widget_set_halign (bar->label, GTK_ALIGN_START);
+ gtk_widget_set_valign (bar->label, GTK_ALIGN_START);
/* frame */
frame = gtk_frame_new (NULL);
@@ -306,13 +305,13 @@ gvc_balance_bar_set_balance_type (GvcBalanceBar *bar,
gtk_box_pack_start (GTK_BOX (bar), frame, TRUE, TRUE, 0);
/* box with scale */
- bar->priv->scale_box = _scale_box_new (bar);
- gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
+ bar->scale_box = _scale_box_new (bar);
+ gtk_container_add (GTK_CONTAINER (frame), bar->scale_box);
gtk_widget_show_all (frame);
- gtk_widget_set_direction (bar->priv->scale, GTK_TEXT_DIR_LTR);
- gtk_label_set_mnemonic_widget (GTK_LABEL (bar->priv->label),
- bar->priv->scale);
+ gtk_widget_set_direction (bar->scale, GTK_TEXT_DIR_LTR);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (bar->label),
+ bar->scale);
g_object_notify (G_OBJECT (bar), "balance-type");
}
@@ -348,7 +347,7 @@ gvc_balance_bar_get_property (GObject *object,
switch (prop_id) {
case PROP_CHANNEL_MAP:
- g_value_set_object (value, self->priv->channel_map);
+ g_value_set_object (value, self->channel_map);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -388,8 +387,6 @@ gvc_balance_bar_class_init (GvcBalanceBarClass *klass)
"Whether the balance is right-left or front-rear",
BALANCE_TYPE_RL, NUM_BALANCE_TYPES - 1, BALANCE_TYPE_RL,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (klass, sizeof (GvcBalanceBarPrivate));
}
@@ -398,7 +395,7 @@ on_scale_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GvcBalanceBar *bar)
{
- bar->priv->click_lock = TRUE;
+ bar->click_lock = TRUE;
return FALSE;
}
@@ -408,7 +405,7 @@ on_scale_button_release_event (GtkWidget *widget,
GdkEventButton *event,
GvcBalanceBar *bar)
{
- bar->priv->click_lock = FALSE;
+ bar->click_lock = FALSE;
return FALSE;
}
@@ -421,7 +418,7 @@ on_scale_scroll_event (GtkWidget *widget,
gdouble value;
gdouble dx, dy;
- value = gtk_adjustment_get_value (bar->priv->adjustment);
+ value = gtk_adjustment_get_value (bar->adjustment);
if (!gdk_event_get_scroll_deltas ((GdkEvent*)event, &dx, &dy)) {
dx = 0.0;
@@ -441,7 +438,7 @@ on_scale_scroll_event (GtkWidget *widget,
}
}
- if (bar->priv->btype == BALANCE_TYPE_LFE) {
+ if (bar->btype == BALANCE_TYPE_LFE) {
if (dy > 0) {
if (value + dy * ADJUSTMENT_MAX_NORMAL/100.0 > ADJUSTMENT_MAX_NORMAL)
value = ADJUSTMENT_MAX_NORMAL;
@@ -466,7 +463,7 @@ on_scale_scroll_event (GtkWidget *widget,
value = value + dy * 0.01;
}
}
- gtk_adjustment_set_value (bar->priv->adjustment, value);
+ gtk_adjustment_set_value (bar->adjustment, value);
return TRUE;
}
@@ -479,15 +476,15 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
pa_cvolume cv;
const pa_channel_map *pa_map;
- if (bar->priv->channel_map == NULL)
+ if (bar->channel_map == NULL)
return;
- cv = *gvc_channel_map_get_cvolume (bar->priv->channel_map);
+ cv = *gvc_channel_map_get_cvolume (bar->channel_map);
val = gtk_adjustment_get_value (adjustment);
- pa_map = gvc_channel_map_get_pa_channel_map (bar->priv->channel_map);
+ pa_map = gvc_channel_map_get_pa_channel_map (bar->channel_map);
- switch (bar->priv->btype) {
+ switch (bar->btype) {
case BALANCE_TYPE_RL:
pa_cvolume_set_balance (&cv, pa_map, val);
break;
@@ -499,13 +496,12 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
break;
}
- gvc_channel_map_volume_changed (bar->priv->channel_map, &cv, TRUE);
+ gvc_channel_map_volume_changed (bar->channel_map, &cv, TRUE);
}
static void
gvc_balance_bar_init (GvcBalanceBar *bar)
{
- bar->priv = GVC_BALANCE_BAR_GET_PRIVATE (bar);
}
static void
@@ -518,12 +514,12 @@ gvc_balance_bar_finalize (GObject *object)
bar = GVC_BALANCE_BAR (object);
- g_return_if_fail (bar->priv != NULL);
+ g_return_if_fail (bar != NULL);
- if (bar->priv->channel_map != NULL) {
- g_signal_handlers_disconnect_by_func (G_OBJECT (bar->priv->channel_map),
+ if (bar->channel_map != NULL) {
+ g_signal_handlers_disconnect_by_func (G_OBJECT (bar->channel_map),
on_channel_map_volume_changed, bar);
- g_object_unref (bar->priv->channel_map);
+ g_object_unref (bar->channel_map);
}
G_OBJECT_CLASS (gvc_balance_bar_parent_class)->finalize (object);
diff --git a/panels/sound/gvc-balance-bar.h b/panels/sound/gvc-balance-bar.h
index f2204a37d..4638b0697 100644
--- a/panels/sound/gvc-balance-bar.h
+++ b/panels/sound/gvc-balance-bar.h
@@ -26,12 +26,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_BALANCE_BAR (gvc_balance_bar_get_type ())
-#define GVC_BALANCE_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_BALANCE_BAR, GvcBalanceBar))
-#define GVC_BALANCE_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_BALANCE_BAR, GvcBalanceBarClass))
-#define GVC_IS_BALANCE_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_BALANCE_BAR))
-#define GVC_IS_BALANCE_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_BALANCE_BAR))
-#define GVC_BALANCE_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_BALANCE_BAR, GvcBalanceBarClass))
+#define GVC_TYPE_BALANCE_BAR (gvc_balance_bar_get_type ())
+G_DECLARE_FINAL_TYPE (GvcBalanceBar, gvc_balance_bar, GVC, BALANCE_BAR, GtkBox)
typedef enum {
BALANCE_TYPE_RL,
@@ -41,21 +37,6 @@ typedef enum {
#define NUM_BALANCE_TYPES BALANCE_TYPE_LFE + 1
-typedef struct GvcBalanceBarPrivate GvcBalanceBarPrivate;
-
-typedef struct
-{
- GtkBox parent;
- GvcBalanceBarPrivate *priv;
-} GvcBalanceBar;
-
-typedef struct
-{
- GtkBoxClass parent_class;
-} GvcBalanceBarClass;
-
-GType gvc_balance_bar_get_type (void);
-
GtkWidget * gvc_balance_bar_new (const GvcChannelMap *map,
GvcBalanceType btype);
diff --git a/panels/sound/gvc-channel-bar.c b/panels/sound/gvc-channel-bar.c
index 6d5a3191b..e834af189 100644
--- a/panels/sound/gvc-channel-bar.c
+++ b/panels/sound/gvc-channel-bar.c
@@ -36,13 +36,13 @@
#define SCALE_SIZE 128
#define ADJUSTMENT_MAX_NORMAL gvc_mixer_control_get_vol_max_norm(NULL)
#define ADJUSTMENT_MAX_AMPLIFIED gvc_mixer_control_get_vol_max_amplified(NULL)
-#define ADJUSTMENT_MAX (bar->priv->is_amplified ? ADJUSTMENT_MAX_AMPLIFIED : ADJUSTMENT_MAX_NORMAL)
+#define ADJUSTMENT_MAX (bar->is_amplified ? ADJUSTMENT_MAX_AMPLIFIED : ADJUSTMENT_MAX_NORMAL)
#define SCROLLSTEP (ADJUSTMENT_MAX / 100.0 * 5.0)
-#define GVC_CHANNEL_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_BAR, GvcChannelBarPrivate))
-
-struct GvcChannelBarPrivate
+struct _GvcChannelBar
{
+ GtkBox parent_instance;
+
GtkOrientation orientation;
GtkWidget *scale_box;
GtkWidget *start_box;
@@ -102,80 +102,79 @@ G_DEFINE_TYPE (GvcChannelBar, gvc_channel_bar, GTK_TYPE_BOX)
static GtkWidget *
_scale_box_new (GvcChannelBar *bar)
{
- GvcChannelBarPrivate *priv = bar->priv;
GtkWidget *box;
GtkWidget *sbox;
GtkWidget *ebox;
- if (priv->orientation == GTK_ORIENTATION_VERTICAL) {
- bar->priv->scale_box = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
+ bar->scale_box = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- priv->scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, priv->adjustment);
+ bar->scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, bar->adjustment);
- gtk_widget_set_size_request (priv->scale, -1, SCALE_SIZE);
- gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE);
+ gtk_widget_set_size_request (bar->scale, -1, SCALE_SIZE);
+ gtk_range_set_inverted (GTK_RANGE (bar->scale), TRUE);
- bar->priv->start_box = sbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ bar->start_box = sbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (sbox), priv->image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (sbox), priv->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), bar->image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), bar->label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (sbox), priv->high_image, FALSE, FALSE, 0);
- gtk_widget_hide (priv->high_image);
- gtk_box_pack_start (GTK_BOX (box), priv->scale, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), bar->high_image, FALSE, FALSE, 0);
+ gtk_widget_hide (bar->high_image);
+ gtk_box_pack_start (GTK_BOX (box), bar->scale, TRUE, TRUE, 0);
- bar->priv->end_box = ebox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ bar->end_box = ebox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (ebox), priv->low_image, FALSE, FALSE, 0);
- gtk_widget_hide (priv->low_image);
+ gtk_box_pack_start (GTK_BOX (ebox), bar->low_image, FALSE, FALSE, 0);
+ gtk_widget_hide (bar->low_image);
- gtk_box_pack_start (GTK_BOX (ebox), priv->mute_switch, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ebox), bar->mute_switch, FALSE, FALSE, 0);
} else {
- bar->priv->scale_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
+ bar->scale_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (box), bar->image, FALSE, FALSE, 0);
- priv->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, priv->adjustment);
+ bar->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, bar->adjustment);
- gtk_widget_set_size_request (priv->scale, SCALE_SIZE, -1);
+ gtk_widget_set_size_request (bar->scale, SCALE_SIZE, -1);
- bar->priv->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ bar->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (sbox), priv->low_image, FALSE, FALSE, 0);
- gtk_widget_show (priv->low_image);
+ gtk_box_pack_end (GTK_BOX (sbox), bar->low_image, FALSE, FALSE, 0);
+ gtk_widget_show (bar->low_image);
- gtk_box_pack_start (GTK_BOX (sbox), priv->label, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->scale, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), bar->label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), bar->scale, TRUE, TRUE, 0);
- bar->priv->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ bar->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (ebox), priv->high_image, FALSE, FALSE, 0);
- gtk_widget_show (priv->high_image);
- gtk_box_pack_start (GTK_BOX (ebox), priv->mute_switch, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ebox), bar->high_image, FALSE, FALSE, 0);
+ gtk_widget_show (bar->high_image);
+ gtk_box_pack_start (GTK_BOX (ebox), bar->mute_switch, FALSE, FALSE, 0);
}
- ca_gtk_widget_disable_sounds (bar->priv->scale, FALSE);
- gtk_widget_add_events (bar->priv->scale, GDK_SCROLL_MASK);
+ ca_gtk_widget_disable_sounds (bar->scale, FALSE);
+ gtk_widget_add_events (bar->scale, GDK_SCROLL_MASK);
- g_signal_connect (G_OBJECT (bar->priv->scale), "button-press-event",
+ g_signal_connect (G_OBJECT (bar->scale), "button-press-event",
G_CALLBACK (on_scale_button_press_event), bar);
- g_signal_connect (G_OBJECT (bar->priv->scale), "button-release-event",
+ g_signal_connect (G_OBJECT (bar->scale), "button-release-event",
G_CALLBACK (on_scale_button_release_event), bar);
- g_signal_connect (G_OBJECT (bar->priv->scale), "scroll-event",
+ g_signal_connect (G_OBJECT (bar->scale), "scroll-event",
G_CALLBACK (on_scale_scroll_event), bar);
- if (bar->priv->size_group != NULL) {
- gtk_size_group_add_widget (bar->priv->size_group, sbox);
+ if (bar->size_group != NULL) {
+ gtk_size_group_add_widget (bar->size_group, sbox);
- if (bar->priv->symmetric) {
- gtk_size_group_add_widget (bar->priv->size_group, ebox);
+ if (bar->symmetric) {
+ gtk_size_group_add_widget (bar->size_group, ebox);
}
}
- gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
+ gtk_scale_set_draw_value (GTK_SCALE (bar->scale), FALSE);
return box;
}
@@ -183,29 +182,29 @@ _scale_box_new (GvcChannelBar *bar)
static void
update_image (GvcChannelBar *bar)
{
- gtk_image_set_from_icon_name (GTK_IMAGE (bar->priv->image),
- bar->priv->icon_name,
+ gtk_image_set_from_icon_name (GTK_IMAGE (bar->image),
+ bar->icon_name,
GTK_ICON_SIZE_DIALOG);
- if (bar->priv->icon_name != NULL) {
- gtk_widget_show (bar->priv->image);
+ if (bar->icon_name != NULL) {
+ gtk_widget_show (bar->image);
} else {
- gtk_widget_hide (bar->priv->image);
+ gtk_widget_hide (bar->image);
}
}
static void
update_label (GvcChannelBar *bar)
{
- if (bar->priv->name != NULL) {
- gtk_label_set_text_with_mnemonic (GTK_LABEL (bar->priv->label),
- bar->priv->name);
- gtk_label_set_mnemonic_widget (GTK_LABEL (bar->priv->label),
- bar->priv->scale);
- gtk_widget_show (bar->priv->label);
+ if (bar->name != NULL) {
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (bar->label),
+ bar->name);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (bar->label),
+ bar->scale);
+ gtk_widget_show (bar->label);
} else {
- gtk_label_set_text (GTK_LABEL (bar->priv->label), NULL);
- gtk_widget_hide (bar->priv->label);
+ gtk_label_set_text (GTK_LABEL (bar->label), NULL);
+ gtk_widget_hide (bar->label);
}
}
@@ -215,44 +214,44 @@ update_layout (GvcChannelBar *bar)
GtkWidget *box;
GtkWidget *frame;
- if (bar->priv->scale == NULL) {
+ if (bar->scale == NULL) {
return;
}
- box = bar->priv->scale_box;
+ box = bar->scale_box;
frame = gtk_widget_get_parent (box);
- g_object_ref (bar->priv->image);
- g_object_ref (bar->priv->label);
- g_object_ref (bar->priv->mute_switch);
- g_object_ref (bar->priv->low_image);
- g_object_ref (bar->priv->high_image);
+ g_object_ref (bar->image);
+ g_object_ref (bar->label);
+ g_object_ref (bar->mute_switch);
+ g_object_ref (bar->low_image);
+ g_object_ref (bar->high_image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->label);
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->mute_switch);
+ gtk_container_remove (GTK_CONTAINER (bar->start_box), bar->image);
+ gtk_container_remove (GTK_CONTAINER (bar->start_box), bar->label);
+ gtk_container_remove (GTK_CONTAINER (bar->end_box), bar->mute_switch);
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->low_image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->high_image);
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
+ gtk_container_remove (GTK_CONTAINER (bar->start_box), bar->low_image);
+ gtk_container_remove (GTK_CONTAINER (bar->end_box), bar->high_image);
} else {
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->low_image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->high_image);
+ gtk_container_remove (GTK_CONTAINER (bar->end_box), bar->low_image);
+ gtk_container_remove (GTK_CONTAINER (bar->start_box), bar->high_image);
}
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->start_box);
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->scale);
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->end_box);
+ gtk_container_remove (GTK_CONTAINER (box), bar->start_box);
+ gtk_container_remove (GTK_CONTAINER (box), bar->scale);
+ gtk_container_remove (GTK_CONTAINER (box), bar->end_box);
gtk_container_remove (GTK_CONTAINER (frame), box);
- bar->priv->scale_box = _scale_box_new (bar);
- gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
+ bar->scale_box = _scale_box_new (bar);
+ gtk_container_add (GTK_CONTAINER (frame), bar->scale_box);
- g_object_unref (bar->priv->image);
- g_object_unref (bar->priv->label);
- g_object_unref (bar->priv->mute_switch);
- g_object_unref (bar->priv->low_image);
- g_object_unref (bar->priv->high_image);
+ g_object_unref (bar->image);
+ g_object_unref (bar->label);
+ g_object_unref (bar->mute_switch);
+ g_object_unref (bar->low_image);
+ g_object_unref (bar->high_image);
gtk_widget_show_all (frame);
}
@@ -264,16 +263,16 @@ gvc_channel_bar_set_size_group (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- bar->priv->size_group = group;
- bar->priv->symmetric = symmetric;
+ bar->size_group = group;
+ bar->symmetric = symmetric;
- if (bar->priv->size_group != NULL) {
- gtk_size_group_add_widget (bar->priv->size_group,
- bar->priv->start_box);
+ if (bar->size_group != NULL) {
+ gtk_size_group_add_widget (bar->size_group,
+ bar->start_box);
- if (bar->priv->symmetric) {
- gtk_size_group_add_widget (bar->priv->size_group,
- bar->priv->end_box);
+ if (bar->symmetric) {
+ gtk_size_group_add_widget (bar->size_group,
+ bar->end_box);
}
}
gtk_widget_queue_draw (GTK_WIDGET (bar));
@@ -285,8 +284,8 @@ gvc_channel_bar_set_name (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- g_free (bar->priv->name);
- bar->priv->name = g_strdup (name);
+ g_free (bar->name);
+ bar->name = g_strdup (name);
update_label (bar);
g_object_notify (G_OBJECT (bar), "name");
}
@@ -297,8 +296,8 @@ gvc_channel_bar_set_icon_name (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- g_free (bar->priv->icon_name);
- bar->priv->icon_name = g_strdup (name);
+ g_free (bar->icon_name);
+ bar->icon_name = g_strdup (name);
update_image (bar);
g_object_notify (G_OBJECT (bar), "icon-name");
}
@@ -309,11 +308,11 @@ gvc_channel_bar_set_low_icon_name (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- if (name != NULL && strcmp (bar->priv->low_icon_name, name) != 0) {
- g_free (bar->priv->low_icon_name);
- bar->priv->low_icon_name = g_strdup (name);
- gtk_image_set_from_icon_name (GTK_IMAGE (bar->priv->low_image),
- bar->priv->low_icon_name,
+ if (name != NULL && strcmp (bar->low_icon_name, name) != 0) {
+ g_free (bar->low_icon_name);
+ bar->low_icon_name = g_strdup (name);
+ gtk_image_set_from_icon_name (GTK_IMAGE (bar->low_image),
+ bar->low_icon_name,
GTK_ICON_SIZE_MENU);
g_object_notify (G_OBJECT (bar), "low-icon-name");
}
@@ -325,11 +324,11 @@ gvc_channel_bar_set_high_icon_name (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- if (name != NULL && strcmp (bar->priv->high_icon_name, name) != 0) {
- g_free (bar->priv->high_icon_name);
- bar->priv->high_icon_name = g_strdup (name);
- gtk_image_set_from_icon_name (GTK_IMAGE (bar->priv->high_image),
- bar->priv->high_icon_name,
+ if (name != NULL && strcmp (bar->high_icon_name, name) != 0) {
+ g_free (bar->high_icon_name);
+ bar->high_icon_name = g_strdup (name);
+ gtk_image_set_from_icon_name (GTK_IMAGE (bar->high_image),
+ bar->high_icon_name,
GTK_ICON_SIZE_MENU);
g_object_notify (G_OBJECT (bar), "high-icon-name");
}
@@ -341,8 +340,8 @@ gvc_channel_bar_set_orientation (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- if (orientation != bar->priv->orientation) {
- bar->priv->orientation = orientation;
+ if (orientation != bar->orientation) {
+ bar->orientation = orientation;
update_layout (bar);
g_object_notify (G_OBJECT (bar), "orientation");
}
@@ -355,13 +354,13 @@ gvc_channel_bar_set_adjustment (GvcChannelBar *bar,
g_return_if_fail (GVC_CHANNEL_BAR (bar));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- if (bar->priv->adjustment != NULL) {
- g_object_unref (bar->priv->adjustment);
+ if (bar->adjustment != NULL) {
+ g_object_unref (bar->adjustment);
}
- bar->priv->adjustment = g_object_ref_sink (adjustment);
+ bar->adjustment = g_object_ref_sink (adjustment);
- if (bar->priv->scale != NULL) {
- gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale), adjustment);
+ if (bar->scale != NULL) {
+ gtk_range_set_adjustment (GTK_RANGE (bar->scale), adjustment);
}
g_object_notify (G_OBJECT (bar), "adjustment");
@@ -372,7 +371,7 @@ gvc_channel_bar_get_adjustment (GvcChannelBar *bar)
{
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), NULL);
- return bar->priv->adjustment;
+ return bar->adjustment;
}
static gboolean
@@ -380,7 +379,7 @@ on_scale_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GvcChannelBar *bar)
{
- bar->priv->click_lock = TRUE;
+ bar->click_lock = TRUE;
return FALSE;
}
@@ -393,7 +392,7 @@ on_scale_button_release_event (GtkWidget *widget,
GtkAdjustment *adj;
gdouble value;
- bar->priv->click_lock = FALSE;
+ bar->click_lock = FALSE;
adj = gtk_range_get_adjustment (GTK_RANGE (widget));
@@ -426,7 +425,7 @@ gvc_channel_bar_scroll (GvcChannelBar *bar, GdkEventScroll *event)
direction = event->direction;
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
if (direction == GDK_SCROLL_LEFT || direction == GDK_SCROLL_RIGHT)
return FALSE;
} else {
@@ -462,8 +461,8 @@ gvc_channel_bar_scroll (GvcChannelBar *bar, GdkEventScroll *event)
}
}
- adj = gtk_range_get_adjustment (GTK_RANGE (bar->priv->scale));
- if (adj == bar->priv->zero_adjustment) {
+ adj = gtk_range_get_adjustment (GTK_RANGE (bar->scale));
+ if (adj == bar->zero_adjustment) {
if (dy > 0)
gvc_channel_bar_set_is_muted (bar, FALSE);
return TRUE;
@@ -484,7 +483,7 @@ gvc_channel_bar_scroll (GvcChannelBar *bar, GdkEventScroll *event)
}
gvc_channel_bar_set_is_muted (bar, (value == 0.0));
- adj = gtk_range_get_adjustment (GTK_RANGE (bar->priv->scale));
+ adj = gtk_range_get_adjustment (GTK_RANGE (bar->scale));
gtk_adjustment_set_value (adj, value);
return TRUE;
@@ -504,15 +503,15 @@ on_zero_adjustment_value_changed (GtkAdjustment *adjustment,
{
gdouble value;
- if (bar->priv->click_lock != FALSE) {
+ if (bar->click_lock != FALSE) {
return;
}
- value = gtk_adjustment_get_value (bar->priv->zero_adjustment);
- gtk_adjustment_set_value (bar->priv->adjustment, value);
+ value = gtk_adjustment_get_value (bar->zero_adjustment);
+ gtk_adjustment_set_value (bar->adjustment, value);
- if (bar->priv->show_mute == FALSE) {
+ if (bar->show_mute == FALSE) {
/* this means the adjustment moved away from zero and
* therefore we should unmute and set the volume. */
gvc_channel_bar_set_is_muted (bar, value > 0.0);
@@ -522,33 +521,33 @@ on_zero_adjustment_value_changed (GtkAdjustment *adjustment,
static void
update_mute_switch (GvcChannelBar *bar)
{
- if (bar->priv->show_mute) {
- gtk_widget_show (bar->priv->mute_switch);
- gtk_switch_set_active (GTK_SWITCH (bar->priv->mute_switch),
- !bar->priv->is_muted);
+ if (bar->show_mute) {
+ gtk_widget_show (bar->mute_switch);
+ gtk_switch_set_active (GTK_SWITCH (bar->mute_switch),
+ !bar->is_muted);
} else {
- gtk_widget_hide (bar->priv->mute_switch);
+ gtk_widget_hide (bar->mute_switch);
}
- if (bar->priv->is_muted) {
+ if (bar->is_muted) {
/* If we aren't showing the mute button then
* move slider to the zero. But we don't want to
* change the adjustment. */
- g_signal_handlers_block_by_func (bar->priv->zero_adjustment,
+ g_signal_handlers_block_by_func (bar->zero_adjustment,
on_zero_adjustment_value_changed,
bar);
- gtk_adjustment_set_value (bar->priv->zero_adjustment, 0);
- g_signal_handlers_unblock_by_func (bar->priv->zero_adjustment,
+ gtk_adjustment_set_value (bar->zero_adjustment, 0);
+ g_signal_handlers_unblock_by_func (bar->zero_adjustment,
on_zero_adjustment_value_changed,
bar);
- gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
- bar->priv->zero_adjustment);
+ gtk_range_set_adjustment (GTK_RANGE (bar->scale),
+ bar->zero_adjustment);
} else {
/* no longer muted so restore the original adjustment
* and tell the front-end that the value changed */
- gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
- bar->priv->adjustment);
- gtk_adjustment_value_changed (bar->priv->adjustment);
+ gtk_range_set_adjustment (GTK_RANGE (bar->scale),
+ bar->adjustment);
+ gtk_adjustment_value_changed (bar->adjustment);
}
}
@@ -558,10 +557,10 @@ gvc_channel_bar_set_is_muted (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- if (is_muted != bar->priv->is_muted) {
+ if (is_muted != bar->is_muted) {
/* Update our internal state before telling the
* front-end about our changes */
- bar->priv->is_muted = is_muted;
+ bar->is_muted = is_muted;
update_mute_switch (bar);
g_object_notify (G_OBJECT (bar), "is-muted");
}
@@ -571,7 +570,7 @@ gboolean
gvc_channel_bar_get_is_muted (GvcChannelBar *bar)
{
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
- return bar->priv->is_muted;
+ return bar->is_muted;
}
void
@@ -580,8 +579,8 @@ gvc_channel_bar_set_show_mute (GvcChannelBar *bar,
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- if (show_mute != bar->priv->show_mute) {
- bar->priv->show_mute = show_mute;
+ if (show_mute != bar->show_mute) {
+ bar->show_mute = show_mute;
g_object_notify (G_OBJECT (bar), "show-mute");
update_mute_switch (bar);
}
@@ -591,7 +590,7 @@ gboolean
gvc_channel_bar_get_show_mute (GvcChannelBar *bar)
{
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
- return bar->priv->show_mute;
+ return bar->show_mute;
}
void
@@ -599,26 +598,26 @@ gvc_channel_bar_set_is_amplified (GvcChannelBar *bar, gboolean amplified)
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- bar->priv->is_amplified = amplified;
- gtk_adjustment_set_upper (bar->priv->adjustment, ADJUSTMENT_MAX);
- gtk_adjustment_set_upper (bar->priv->zero_adjustment, ADJUSTMENT_MAX);
- gtk_scale_clear_marks (GTK_SCALE (bar->priv->scale));
+ bar->is_amplified = amplified;
+ gtk_adjustment_set_upper (bar->adjustment, ADJUSTMENT_MAX);
+ gtk_adjustment_set_upper (bar->zero_adjustment, ADJUSTMENT_MAX);
+ gtk_scale_clear_marks (GTK_SCALE (bar->scale));
if (amplified) {
char *str;
- if (bar->priv->base_volume == ADJUSTMENT_MAX_NORMAL) {
+ if (bar->base_volume == ADJUSTMENT_MAX_NORMAL) {
str = g_strdup_printf ("<small>%s</small>", C_("volume", "100%"));
- gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), ADJUSTMENT_MAX_NORMAL,
+ gtk_scale_add_mark (GTK_SCALE (bar->scale), ADJUSTMENT_MAX_NORMAL,
GTK_POS_BOTTOM, str);
} else {
str = g_strdup_printf ("<small>%s</small>", C_("volume", "Unamplified"));
- gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), bar->priv->base_volume,
+ gtk_scale_add_mark (GTK_SCALE (bar->scale), bar->base_volume,
GTK_POS_BOTTOM, str);
/* Only show 100% if it's higher than the base volume */
- if (bar->priv->base_volume < ADJUSTMENT_MAX_NORMAL) {
+ if (bar->base_volume < ADJUSTMENT_MAX_NORMAL) {
str = g_strdup_printf ("<small>%s</small>", C_("volume", "100%"));
- gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), ADJUSTMENT_MAX_NORMAL,
+ gtk_scale_add_mark (GTK_SCALE (bar->scale), ADJUSTMENT_MAX_NORMAL,
GTK_POS_BOTTOM, str);
}
}
@@ -629,19 +628,19 @@ gvc_channel_bar_set_is_amplified (GvcChannelBar *bar, gboolean amplified)
* these widgets plus the scale but neither GtkScale
* nor GtkSwitch support baseline alignment yet. */
- gtk_widget_set_valign (bar->priv->mute_switch, GTK_ALIGN_START);
+ gtk_widget_set_valign (bar->mute_switch, GTK_ALIGN_START);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_misc_set_alignment (GTK_MISC (bar->priv->low_image), 0.5, 0.15);
- gtk_misc_set_alignment (GTK_MISC (bar->priv->high_image), 0.5, 0.15);
+ gtk_misc_set_alignment (GTK_MISC (bar->low_image), 0.5, 0.15);
+ gtk_misc_set_alignment (GTK_MISC (bar->high_image), 0.5, 0.15);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_widget_set_valign (bar->priv->label, GTK_ALIGN_START);
+ gtk_widget_set_valign (bar->label, GTK_ALIGN_START);
} else {
- gtk_widget_set_valign (bar->priv->mute_switch, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (bar->mute_switch, GTK_ALIGN_CENTER);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_misc_set_alignment (GTK_MISC (bar->priv->low_image), 0.5, 0.5);
- gtk_misc_set_alignment (GTK_MISC (bar->priv->high_image), 0.5, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (bar->low_image), 0.5, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (bar->high_image), 0.5, 0.5);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_widget_set_valign (bar->priv->label, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (bar->label, GTK_ALIGN_CENTER);
}
}
@@ -650,7 +649,7 @@ gvc_channel_bar_get_ellipsize (GvcChannelBar *bar)
{
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
- return gtk_label_get_ellipsize (GTK_LABEL (bar->priv->label)) != PANGO_ELLIPSIZE_NONE;
+ return gtk_label_get_ellipsize (GTK_LABEL (bar->label)) != PANGO_ELLIPSIZE_NONE;
}
void
@@ -660,9 +659,9 @@ gvc_channel_bar_set_ellipsize (GvcChannelBar *bar,
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
if (ellipsized)
- gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END);
+ gtk_label_set_ellipsize (GTK_LABEL (bar->label), PANGO_ELLIPSIZE_END);
else
- gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_NONE);
+ gtk_label_set_ellipsize (GTK_LABEL (bar->label), PANGO_ELLIPSIZE_NONE);
}
void
@@ -672,12 +671,12 @@ gvc_channel_bar_set_base_volume (GvcChannelBar *bar,
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
if (base_volume == 0) {
- bar->priv->base_volume = ADJUSTMENT_MAX_NORMAL;
+ bar->base_volume = ADJUSTMENT_MAX_NORMAL;
return;
}
/* Note that you need to call _is_amplified() afterwards to update the marks */
- bar->priv->base_volume = base_volume;
+ bar->base_volume = base_volume;
}
static void
@@ -732,35 +731,34 @@ gvc_channel_bar_get_property (GObject *object,
GParamSpec *pspec)
{
GvcChannelBar *self = GVC_CHANNEL_BAR (object);
- GvcChannelBarPrivate *priv = self->priv;
switch (prop_id) {
case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
+ g_value_set_enum (value, self->orientation);
break;
case PROP_IS_MUTED:
- g_value_set_boolean (value, priv->is_muted);
+ g_value_set_boolean (value, self->is_muted);
break;
case PROP_SHOW_MUTE:
- g_value_set_boolean (value, priv->show_mute);
+ g_value_set_boolean (value, self->show_mute);
break;
case PROP_NAME:
- g_value_set_string (value, priv->name);
+ g_value_set_string (value, self->name);
break;
case PROP_ICON_NAME:
- g_value_set_string (value, priv->icon_name);
+ g_value_set_string (value, self->icon_name);
break;
case PROP_LOW_ICON_NAME:
- g_value_set_string (value, priv->low_icon_name);
+ g_value_set_string (value, self->low_icon_name);
break;
case PROP_HIGH_ICON_NAME:
- g_value_set_string (value, priv->high_icon_name);
+ g_value_set_string (value, self->high_icon_name);
break;
case PROP_ADJUSTMENT:
g_value_set_object (value, gvc_channel_bar_get_adjustment (self));
break;
case PROP_IS_AMPLIFIED:
- g_value_set_boolean (value, priv->is_amplified);
+ g_value_set_boolean (value, self->is_amplified);
break;
case PROP_ELLIPSIZE:
g_value_set_boolean (value, gvc_channel_bar_get_ellipsize (self));
@@ -870,7 +868,6 @@ gvc_channel_bar_class_init (GvcChannelBarClass *klass)
"Whether the label is ellipsized",
FALSE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
- g_type_class_add_private (klass, sizeof (GvcChannelBarPrivate));
}
static void
@@ -888,56 +885,54 @@ gvc_channel_bar_init (GvcChannelBar *bar)
{
GtkWidget *frame;
- bar->priv = GVC_CHANNEL_BAR_GET_PRIVATE (bar);
-
- bar->priv->base_volume = ADJUSTMENT_MAX_NORMAL;
- bar->priv->low_icon_name = g_strdup ("audio-volume-low-symbolic");
- bar->priv->high_icon_name = g_strdup ("audio-volume-high-symbolic");
+ bar->base_volume = ADJUSTMENT_MAX_NORMAL;
+ bar->low_icon_name = g_strdup ("audio-volume-low-symbolic");
+ bar->high_icon_name = g_strdup ("audio-volume-high-symbolic");
- bar->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
- bar->priv->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->orientation = GTK_ORIENTATION_HORIZONTAL;
+ bar->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
0.0,
ADJUSTMENT_MAX_NORMAL,
ADJUSTMENT_MAX_NORMAL/100.0,
ADJUSTMENT_MAX_NORMAL/10.0,
0.0));
- g_object_ref_sink (bar->priv->adjustment);
+ g_object_ref_sink (bar->adjustment);
- bar->priv->zero_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->zero_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
0.0,
ADJUSTMENT_MAX_NORMAL,
ADJUSTMENT_MAX_NORMAL/100.0,
ADJUSTMENT_MAX_NORMAL/10.0,
0.0));
- g_object_ref_sink (bar->priv->zero_adjustment);
+ g_object_ref_sink (bar->zero_adjustment);
- g_signal_connect (bar->priv->zero_adjustment,
+ g_signal_connect (bar->zero_adjustment,
"value-changed",
G_CALLBACK (on_zero_adjustment_value_changed),
bar);
- bar->priv->mute_switch = gtk_switch_new ();
- gtk_widget_set_no_show_all (bar->priv->mute_switch, TRUE);
- g_signal_connect (bar->priv->mute_switch,
+ bar->mute_switch = gtk_switch_new ();
+ gtk_widget_set_no_show_all (bar->mute_switch, TRUE);
+ g_signal_connect (bar->mute_switch,
"notify::active",
G_CALLBACK (on_mute_switch_toggled),
bar);
- bar->priv->low_image = gtk_image_new_from_icon_name ("audio-volume-low-symbolic",
+ bar->low_image = gtk_image_new_from_icon_name ("audio-volume-low-symbolic",
GTK_ICON_SIZE_MENU);
- gtk_style_context_add_class (gtk_widget_get_style_context (bar->priv->low_image), "dim-label");
- gtk_widget_set_no_show_all (bar->priv->low_image, TRUE);
- bar->priv->high_image = gtk_image_new_from_icon_name ("audio-volume-high-symbolic",
+ gtk_style_context_add_class (gtk_widget_get_style_context (bar->low_image), "dim-label");
+ gtk_widget_set_no_show_all (bar->low_image, TRUE);
+ bar->high_image = gtk_image_new_from_icon_name ("audio-volume-high-symbolic",
GTK_ICON_SIZE_MENU);
- gtk_style_context_add_class (gtk_widget_get_style_context (bar->priv->high_image), "dim-label");
- gtk_widget_set_no_show_all (bar->priv->high_image, TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (bar->high_image), "dim-label");
+ gtk_widget_set_no_show_all (bar->high_image, TRUE);
- bar->priv->image = gtk_image_new ();
- gtk_widget_set_no_show_all (bar->priv->image, TRUE);
+ bar->image = gtk_image_new ();
+ gtk_widget_set_no_show_all (bar->image, TRUE);
- bar->priv->label = gtk_label_new (NULL);
- gtk_widget_set_halign (bar->priv->label, GTK_ALIGN_START);
- gtk_widget_set_no_show_all (bar->priv->label, TRUE);
+ bar->label = gtk_label_new (NULL);
+ gtk_widget_set_halign (bar->label, GTK_ALIGN_START);
+ gtk_widget_set_no_show_all (bar->label, TRUE);
/* frame */
frame = gtk_frame_new (NULL);
@@ -946,9 +941,9 @@ gvc_channel_bar_init (GvcChannelBar *bar)
gtk_widget_show_all (frame);
/* box with scale */
- bar->priv->scale_box = _scale_box_new (bar);
+ bar->scale_box = _scale_box_new (bar);
- gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
+ gtk_container_add (GTK_CONTAINER (frame), bar->scale_box);
gtk_widget_show_all (frame);
}
@@ -962,12 +957,12 @@ gvc_channel_bar_finalize (GObject *object)
channel_bar = GVC_CHANNEL_BAR (object);
- g_return_if_fail (channel_bar->priv != NULL);
+ g_return_if_fail (channel_bar != NULL);
- g_free (channel_bar->priv->name);
- g_free (channel_bar->priv->icon_name);
- g_free (channel_bar->priv->low_icon_name);
- g_free (channel_bar->priv->high_icon_name);
+ g_free (channel_bar->name);
+ g_free (channel_bar->icon_name);
+ g_free (channel_bar->low_icon_name);
+ g_free (channel_bar->high_icon_name);
G_OBJECT_CLASS (gvc_channel_bar_parent_class)->finalize (object);
}
diff --git a/panels/sound/gvc-channel-bar.h b/panels/sound/gvc-channel-bar.h
index afa5231b5..f0ded18f9 100644
--- a/panels/sound/gvc-channel-bar.h
+++ b/panels/sound/gvc-channel-bar.h
@@ -24,27 +24,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_CHANNEL_BAR (gvc_channel_bar_get_type ())
-#define GVC_CHANNEL_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_CHANNEL_BAR, GvcChannelBar))
-#define GVC_CHANNEL_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_CHANNEL_BAR, GvcChannelBarClass))
-#define GVC_IS_CHANNEL_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_CHANNEL_BAR))
-#define GVC_IS_CHANNEL_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_CHANNEL_BAR))
-#define GVC_CHANNEL_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_CHANNEL_BAR, GvcChannelBarClass))
-
-typedef struct GvcChannelBarPrivate GvcChannelBarPrivate;
-
-typedef struct
-{
- GtkBox parent;
- GvcChannelBarPrivate *priv;
-} GvcChannelBar;
-
-typedef struct
-{
- GtkBoxClass parent_class;
-} GvcChannelBarClass;
-
-GType gvc_channel_bar_get_type (void);
+#define GVC_TYPE_CHANNEL_BAR (gvc_channel_bar_get_type ())
+G_DECLARE_FINAL_TYPE (GvcChannelBar, gvc_channel_bar, GVC, CHANNEL_BAR, GtkBox)
GtkWidget * gvc_channel_bar_new (void);
diff --git a/panels/sound/gvc-combo-box.c b/panels/sound/gvc-combo-box.c
index 5f8eaedc2..ee77b0d79 100644
--- a/panels/sound/gvc-combo-box.c
+++ b/panels/sound/gvc-combo-box.c
@@ -33,10 +33,10 @@
#include "gvc-mixer-stream.h"
#include "gvc-mixer-card.h"
-#define GVC_COMBO_BOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_COMBO_BOX, GvcComboBoxPrivate))
-
-struct GvcComboBoxPrivate
+struct _GvcComboBox
{
+ GtkBox parent_instance;
+
GtkWidget *drop_box;
GtkWidget *start_box;
GtkWidget *end_box;
@@ -83,16 +83,16 @@ gvc_combo_box_set_size_group (GvcComboBox *combo_box,
{
g_return_if_fail (GVC_IS_COMBO_BOX (combo_box));
- combo_box->priv->size_group = group;
- combo_box->priv->symmetric = symmetric;
+ combo_box->size_group = group;
+ combo_box->symmetric = symmetric;
- if (combo_box->priv->size_group != NULL) {
- gtk_size_group_add_widget (combo_box->priv->size_group,
- combo_box->priv->start_box);
+ if (combo_box->size_group != NULL) {
+ gtk_size_group_add_widget (combo_box->size_group,
+ combo_box->start_box);
- if (combo_box->priv->symmetric) {
- gtk_size_group_add_widget (combo_box->priv->size_group,
- combo_box->priv->end_box);
+ if (combo_box->symmetric) {
+ gtk_size_group_add_widget (combo_box->size_group,
+ combo_box->end_box);
}
}
gtk_widget_queue_draw (GTK_WIDGET (combo_box));
@@ -108,13 +108,13 @@ gvc_combo_box_set_property (GObject *object,
switch (prop_id) {
case PROP_LABEL:
- gtk_label_set_text_with_mnemonic (GTK_LABEL (self->priv->label), g_value_get_string (value));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (self->label), g_value_get_string (value));
break;
case PROP_BUTTON_LABEL:
- gtk_button_set_label (GTK_BUTTON (self->priv->button), g_value_get_string (value));
+ gtk_button_set_label (GTK_BUTTON (self->button), g_value_get_string (value));
break;
case PROP_SHOW_BUTTON:
- gtk_widget_set_visible (self->priv->button, g_value_get_boolean (value));
+ gtk_widget_set_visible (self->button, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -133,15 +133,15 @@ gvc_combo_box_get_property (GObject *object,
switch (prop_id) {
case PROP_LABEL:
g_value_set_string (value,
- gtk_label_get_text (GTK_LABEL (self->priv->label)));
+ gtk_label_get_text (GTK_LABEL (self->label)));
break;
case PROP_BUTTON_LABEL:
g_value_set_string (value,
- gtk_button_get_label (GTK_BUTTON (self->priv->button)));
+ gtk_button_get_label (GTK_BUTTON (self->button)));
break;
case PROP_SHOW_BUTTON:
g_value_set_boolean (value,
- gtk_widget_get_visible (self->priv->button));
+ gtk_widget_get_visible (self->button));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -183,7 +183,7 @@ gvc_combo_box_class_init (GvcComboBoxClass *klass)
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GvcComboBoxClass, changed),
+ 0,
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
@@ -191,12 +191,10 @@ gvc_combo_box_class_init (GvcComboBoxClass *klass)
g_signal_new ("button-clicked",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GvcComboBoxClass, button_clicked),
+ 0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0, G_TYPE_NONE);
-
- g_type_class_add_private (klass, sizeof (GvcComboBoxPrivate));
}
void
@@ -206,19 +204,19 @@ gvc_combo_box_set_profiles (GvcComboBox *combo_box,
const GList *l;
g_return_if_fail (GVC_IS_COMBO_BOX (combo_box));
- g_return_if_fail (combo_box->priv->set_called == FALSE);
+ g_return_if_fail (combo_box->set_called == FALSE);
for (l = profiles; l != NULL; l = l->next) {
GvcMixerCardProfile *p = l->data;
- gtk_list_store_insert_with_values (GTK_LIST_STORE (combo_box->priv->model),
+ gtk_list_store_insert_with_values (GTK_LIST_STORE (combo_box->model),
NULL,
G_MAXINT,
COL_NAME, p->profile,
COL_HUMAN_NAME, p->human_profile,
-1);
}
- combo_box->priv->set_called = TRUE;
+ combo_box->set_called = TRUE;
}
void
@@ -228,19 +226,19 @@ gvc_combo_box_set_ports (GvcComboBox *combo_box,
const GList *l;
g_return_if_fail (GVC_IS_COMBO_BOX (combo_box));
- g_return_if_fail (combo_box->priv->set_called == FALSE);
+ g_return_if_fail (combo_box->set_called == FALSE);
for (l = ports; l != NULL; l = l->next) {
GvcMixerStreamPort *p = l->data;
- gtk_list_store_insert_with_values (GTK_LIST_STORE (combo_box->priv->model),
+ gtk_list_store_insert_with_values (GTK_LIST_STORE (combo_box->model),
NULL,
G_MAXINT,
COL_NAME, p->port,
COL_HUMAN_NAME, p->human_port,
-1);
}
- combo_box->priv->set_called = TRUE;
+ combo_box->set_called = TRUE;
}
void
@@ -250,18 +248,18 @@ gvc_combo_box_set_active (GvcComboBox *combo_box,
GtkTreeIter iter;
gboolean cont;
- cont = gtk_tree_model_get_iter_first (combo_box->priv->model, &iter);
+ cont = gtk_tree_model_get_iter_first (combo_box->model, &iter);
while (cont != FALSE) {
char *name;
- gtk_tree_model_get (combo_box->priv->model, &iter,
+ gtk_tree_model_get (combo_box->model, &iter,
COL_NAME, &name,
-1);
if (g_strcmp0 (name, id) == 0) {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box->priv->combobox), &iter);
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box->combobox), &iter);
return;
}
- cont = gtk_tree_model_iter_next (combo_box->priv->model, &iter);
+ cont = gtk_tree_model_iter_next (combo_box->model, &iter);
}
g_warning ("Could not find id '%s' in combo box", id);
}
@@ -278,7 +276,7 @@ on_combo_box_changed (GtkComboBox *widget,
return;
}
- gtk_tree_model_get (combo_box->priv->model, &iter,
+ gtk_tree_model_get (combo_box->model, &iter,
COL_NAME, &profile,
-1);
g_signal_emit (combo_box, signals[CHANGED], 0, profile);
@@ -301,67 +299,65 @@ gvc_combo_box_init (GvcComboBox *combo_box)
GtkWidget *ebox;
GtkCellRenderer *renderer;
- combo_box->priv = GVC_COMBO_BOX_GET_PRIVATE (combo_box);
-
- combo_box->priv->model = GTK_TREE_MODEL (gtk_list_store_new (NUM_COLS,
- G_TYPE_STRING,
- G_TYPE_STRING));
+ combo_box->model = GTK_TREE_MODEL (gtk_list_store_new (NUM_COLS,
+ G_TYPE_STRING,
+ G_TYPE_STRING));
- combo_box->priv->label = gtk_label_new (NULL);
- gtk_widget_set_halign (combo_box->priv->label, GTK_ALIGN_START);
+ combo_box->label = gtk_label_new (NULL);
+ gtk_widget_set_halign (combo_box->label, GTK_ALIGN_START);
/* frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (combo_box), frame, TRUE, TRUE, 0);
- combo_box->priv->drop_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- combo_box->priv->combobox = gtk_combo_box_new_with_model (combo_box->priv->model);
+ combo_box->drop_box = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ combo_box->combobox = gtk_combo_box_new_with_model (combo_box->model);
renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box->priv->combobox),
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box->combobox),
renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->combobox),
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->combobox),
renderer,
"text", COL_HUMAN_NAME);
/* Make sure that the combo box isn't too wide when human names are overly long,
* but that we can still read the full length of it */
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- g_object_set (G_OBJECT (combo_box->priv->combobox), "popup-fixed-width", FALSE, NULL);
+ g_object_set (G_OBJECT (combo_box->combobox), "popup-fixed-width", FALSE, NULL);
- combo_box->priv->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ combo_box->start_box = sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (sbox), combo_box->priv->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (sbox), combo_box->label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), combo_box->priv->combobox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), combo_box->combobox, TRUE, TRUE, 0);
- combo_box->priv->button = gtk_button_new_with_label ("APPLICATION BUG");
- gtk_button_set_use_underline (GTK_BUTTON (combo_box->priv->button), TRUE);
- gtk_widget_set_no_show_all (combo_box->priv->button, TRUE);
- gtk_box_pack_start (GTK_BOX (box), combo_box->priv->button, FALSE, FALSE, 0);
+ combo_box->button = gtk_button_new_with_label ("APPLICATION BUG");
+ gtk_button_set_use_underline (GTK_BUTTON (combo_box->button), TRUE);
+ gtk_widget_set_no_show_all (combo_box->button, TRUE);
+ gtk_box_pack_start (GTK_BOX (box), combo_box->button, FALSE, FALSE, 0);
- combo_box->priv->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ combo_box->end_box = ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, FALSE, 0);
- if (combo_box->priv->size_group != NULL) {
- gtk_size_group_add_widget (combo_box->priv->size_group, sbox);
+ if (combo_box->size_group != NULL) {
+ gtk_size_group_add_widget (combo_box->size_group, sbox);
- if (combo_box->priv->symmetric) {
- gtk_size_group_add_widget (combo_box->priv->size_group, ebox);
+ if (combo_box->symmetric) {
+ gtk_size_group_add_widget (combo_box->size_group, ebox);
}
}
- gtk_container_add (GTK_CONTAINER (frame), combo_box->priv->drop_box);
+ gtk_container_add (GTK_CONTAINER (frame), combo_box->drop_box);
gtk_widget_show_all (frame);
- gtk_label_set_mnemonic_widget (GTK_LABEL (combo_box->priv->label),
- combo_box->priv->combobox);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (combo_box->label),
+ combo_box->combobox);
- g_signal_connect (G_OBJECT (combo_box->priv->combobox), "changed",
+ g_signal_connect (G_OBJECT (combo_box->combobox), "changed",
G_CALLBACK (on_combo_box_changed), combo_box);
- g_signal_connect (G_OBJECT (combo_box->priv->button), "clicked",
+ g_signal_connect (G_OBJECT (combo_box->button), "clicked",
G_CALLBACK (on_combo_box_button_clicked), combo_box);
}
@@ -375,10 +371,10 @@ gvc_combo_box_finalize (GObject *object)
combo_box = GVC_COMBO_BOX (object);
- g_return_if_fail (combo_box->priv != NULL);
+ g_return_if_fail (combo_box != NULL);
- g_object_unref (combo_box->priv->model);
- combo_box->priv->model = NULL;
+ g_object_unref (combo_box->model);
+ combo_box->model = NULL;
G_OBJECT_CLASS (gvc_combo_box_parent_class)->finalize (object);
}
diff --git a/panels/sound/gvc-combo-box.h b/panels/sound/gvc-combo-box.h
index 97c3fb154..77937c2b2 100644
--- a/panels/sound/gvc-combo-box.h
+++ b/panels/sound/gvc-combo-box.h
@@ -24,29 +24,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_COMBO_BOX (gvc_combo_box_get_type ())
-#define GVC_COMBO_BOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_COMBO_BOX, GvcComboBox))
-#define GVC_COMBO_BOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_COMBO_BOX, GvcComboBoxClass))
-#define GVC_IS_COMBO_BOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_COMBO_BOX))
-#define GVC_IS_COMBO_BOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_COMBO_BOX))
-#define GVC_COMBO_BOX_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_COMBO_BOX, GvcComboBoxClass))
-
-typedef struct GvcComboBoxPrivate GvcComboBoxPrivate;
-
-typedef struct
-{
- GtkBox parent;
- GvcComboBoxPrivate *priv;
-} GvcComboBox;
-
-typedef struct
-{
- GtkBoxClass parent_class;
- void (* changed) (GvcComboBox *combobox, const char *name);
- void (* button_clicked) (GvcComboBox *combobox);
-} GvcComboBoxClass;
-
-GType gvc_combo_box_get_type (void);
+#define GVC_TYPE_COMBO_BOX (gvc_combo_box_get_type ())
+G_DECLARE_FINAL_TYPE (GvcComboBox, gvc_combo_box, GVC, COMBO_BOX, GtkBox)
GtkWidget * gvc_combo_box_new (const char *label);
diff --git a/panels/sound/gvc-level-bar.c b/panels/sound/gvc-level-bar.c
index 24627ce32..39419465f 100644
--- a/panels/sound/gvc-level-bar.c
+++ b/panels/sound/gvc-level-bar.c
@@ -32,8 +32,6 @@
#define NUM_BOXES 30
-#define GVC_LEVEL_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_LEVEL_BAR, GvcLevelBarPrivate))
-
#define MIN_HORIZONTAL_BAR_WIDTH 150
#define HORIZONTAL_BAR_HEIGHT 6
#define VERTICAL_BAR_WIDTH 6
@@ -59,8 +57,10 @@ typedef struct {
double fl_b;
} LevelBarLayout;
-struct GvcLevelBarPrivate
+struct _GvcLevelBar
{
+ GtkWidget parent_instance;
+
GtkOrientation orientation;
GtkAdjustment *peak_adjustment;
GtkAdjustment *rms_adjustment;
@@ -132,7 +132,7 @@ fraction_from_adjustment (GvcLevelBar *bar,
min = gtk_adjustment_get_lower (adjustment);
max = gtk_adjustment_get_upper (adjustment);
- switch (bar->priv->scale) {
+ switch (bar->scale) {
case GVC_LEVEL_SCALE_LINEAR:
fraction = (level - min) / (max - min);
break;
@@ -151,11 +151,11 @@ reset_max_peak (GvcLevelBar *bar)
{
gdouble min;
- min = gtk_adjustment_get_lower (bar->priv->peak_adjustment);
- bar->priv->max_peak = min;
- bar->priv->layout.max_peak_num = 0;
+ min = gtk_adjustment_get_lower (bar->peak_adjustment);
+ bar->max_peak = min;
+ bar->layout.max_peak_num = 0;
gtk_widget_queue_draw (GTK_WIDGET (bar));
- bar->priv->max_peak_id = 0;
+ bar->max_peak_id = 0;
return FALSE;
}
@@ -169,51 +169,51 @@ bar_calc_layout (GvcLevelBar *bar)
GtkStyle *style;
gtk_widget_get_allocation (GTK_WIDGET (bar), &allocation);
- bar->priv->layout.area.width = allocation.width - 2;
- bar->priv->layout.area.height = allocation.height - 2;
+ bar->layout.area.width = allocation.width - 2;
+ bar->layout.area.height = allocation.height - 2;
style = gtk_widget_get_style (GTK_WIDGET (bar));
color = style->bg [GTK_STATE_NORMAL];
- bar->priv->layout.bg_r = (float)color.red / 65535.0;
- bar->priv->layout.bg_g = (float)color.green / 65535.0;
- bar->priv->layout.bg_b = (float)color.blue / 65535.0;
+ bar->layout.bg_r = (float)color.red / 65535.0;
+ bar->layout.bg_g = (float)color.green / 65535.0;
+ bar->layout.bg_b = (float)color.blue / 65535.0;
color = style->dark [GTK_STATE_NORMAL];
- bar->priv->layout.bdr_r = (float)color.red / 65535.0;
- bar->priv->layout.bdr_g = (float)color.green / 65535.0;
- bar->priv->layout.bdr_b = (float)color.blue / 65535.0;
+ bar->layout.bdr_r = (float)color.red / 65535.0;
+ bar->layout.bdr_g = (float)color.green / 65535.0;
+ bar->layout.bdr_b = (float)color.blue / 65535.0;
color = style->bg [GTK_STATE_SELECTED];
- bar->priv->layout.fl_r = (float)color.red / 65535.0;
- bar->priv->layout.fl_g = (float)color.green / 65535.0;
- bar->priv->layout.fl_b = (float)color.blue / 65535.0;
-
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
- peak_level = bar->priv->peak_fraction * bar->priv->layout.area.height;
- max_peak_level = bar->priv->max_peak * bar->priv->layout.area.height;
-
- bar->priv->layout.delta = bar->priv->layout.area.height / NUM_BOXES;
- bar->priv->layout.area.x = 0;
- bar->priv->layout.area.y = 0;
- bar->priv->layout.box_height = bar->priv->layout.delta / 2;
- bar->priv->layout.box_width = bar->priv->layout.area.width;
- bar->priv->layout.box_radius = bar->priv->layout.box_width / 2;
+ bar->layout.fl_r = (float)color.red / 65535.0;
+ bar->layout.fl_g = (float)color.green / 65535.0;
+ bar->layout.fl_b = (float)color.blue / 65535.0;
+
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
+ peak_level = bar->peak_fraction * bar->layout.area.height;
+ max_peak_level = bar->max_peak * bar->layout.area.height;
+
+ bar->layout.delta = bar->layout.area.height / NUM_BOXES;
+ bar->layout.area.x = 0;
+ bar->layout.area.y = 0;
+ bar->layout.box_height = bar->layout.delta / 2;
+ bar->layout.box_width = bar->layout.area.width;
+ bar->layout.box_radius = bar->layout.box_width / 2;
} else {
- peak_level = bar->priv->peak_fraction * bar->priv->layout.area.width;
- max_peak_level = bar->priv->max_peak * bar->priv->layout.area.width;
-
- bar->priv->layout.delta = bar->priv->layout.area.width / NUM_BOXES;
- bar->priv->layout.area.x = 0;
- bar->priv->layout.area.y = 0;
- bar->priv->layout.box_width = bar->priv->layout.delta / 2;
- bar->priv->layout.box_height = bar->priv->layout.area.height;
- bar->priv->layout.box_radius = bar->priv->layout.box_height / 2;
+ peak_level = bar->peak_fraction * bar->layout.area.width;
+ max_peak_level = bar->max_peak * bar->layout.area.width;
+
+ bar->layout.delta = bar->layout.area.width / NUM_BOXES;
+ bar->layout.area.x = 0;
+ bar->layout.area.y = 0;
+ bar->layout.box_width = bar->layout.delta / 2;
+ bar->layout.box_height = bar->layout.area.height;
+ bar->layout.box_radius = bar->layout.box_height / 2;
}
/* This can happen if the level bar isn't realized */
- if (bar->priv->layout.delta == 0)
+ if (bar->layout.delta == 0)
return;
- bar->priv->layout.peak_num = peak_level / bar->priv->layout.delta;
- bar->priv->layout.max_peak_num = max_peak_level / bar->priv->layout.delta;
+ bar->layout.peak_num = peak_level / bar->layout.delta;
+ bar->layout.max_peak_num = max_peak_level / bar->layout.delta;
}
static void
@@ -222,22 +222,22 @@ update_peak_value (GvcLevelBar *bar)
gdouble val;
LevelBarLayout layout;
- layout = bar->priv->layout;
+ layout = bar->layout;
- val = fraction_from_adjustment (bar, bar->priv->peak_adjustment);
- bar->priv->peak_fraction = val;
+ val = fraction_from_adjustment (bar, bar->peak_adjustment);
+ bar->peak_fraction = val;
- if (val > bar->priv->max_peak) {
- if (bar->priv->max_peak_id > 0) {
- g_source_remove (bar->priv->max_peak_id);
+ if (val > bar->max_peak) {
+ if (bar->max_peak_id > 0) {
+ g_source_remove (bar->max_peak_id);
}
- bar->priv->max_peak_id = g_timeout_add_seconds (1, (GSourceFunc)reset_max_peak, bar);
- bar->priv->max_peak = val;
+ bar->max_peak_id = g_timeout_add_seconds (1, (GSourceFunc)reset_max_peak, bar);
+ bar->max_peak = val;
}
bar_calc_layout (bar);
- if (layout_changed (&bar->priv->layout, &layout)) {
+ if (layout_changed (&bar->layout, &layout)) {
gtk_widget_queue_draw (GTK_WIDGET (bar));
}
}
@@ -247,15 +247,15 @@ update_rms_value (GvcLevelBar *bar)
{
gdouble val;
- val = fraction_from_adjustment (bar, bar->priv->rms_adjustment);
- bar->priv->rms_fraction = val;
+ val = fraction_from_adjustment (bar, bar->rms_adjustment);
+ bar->rms_fraction = val;
}
GtkOrientation
gvc_level_bar_get_orientation (GvcLevelBar *bar)
{
g_return_val_if_fail (GVC_IS_LEVEL_BAR (bar), 0);
- return bar->priv->orientation;
+ return bar->orientation;
}
void
@@ -264,8 +264,8 @@ gvc_level_bar_set_orientation (GvcLevelBar *bar,
{
g_return_if_fail (GVC_IS_LEVEL_BAR (bar));
- if (orientation != bar->priv->orientation) {
- bar->priv->orientation = orientation;
+ if (orientation != bar->orientation) {
+ bar->orientation = orientation;
gtk_widget_queue_draw (GTK_WIDGET (bar));
g_object_notify (G_OBJECT (bar), "orientation");
}
@@ -292,16 +292,16 @@ gvc_level_bar_set_peak_adjustment (GvcLevelBar *bar,
g_return_if_fail (GVC_LEVEL_BAR (bar));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- if (bar->priv->peak_adjustment != NULL) {
- g_signal_handlers_disconnect_by_func (bar->priv->peak_adjustment,
+ if (bar->peak_adjustment != NULL) {
+ g_signal_handlers_disconnect_by_func (bar->peak_adjustment,
G_CALLBACK (on_peak_adjustment_value_changed),
bar);
- g_object_unref (bar->priv->peak_adjustment);
+ g_object_unref (bar->peak_adjustment);
}
- bar->priv->peak_adjustment = g_object_ref_sink (adjustment);
+ bar->peak_adjustment = g_object_ref_sink (adjustment);
- g_signal_connect (bar->priv->peak_adjustment,
+ g_signal_connect (bar->peak_adjustment,
"value-changed",
G_CALLBACK (on_peak_adjustment_value_changed),
bar);
@@ -318,17 +318,17 @@ gvc_level_bar_set_rms_adjustment (GvcLevelBar *bar,
g_return_if_fail (GVC_LEVEL_BAR (bar));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- if (bar->priv->rms_adjustment != NULL) {
- g_signal_handlers_disconnect_by_func (bar->priv->peak_adjustment,
+ if (bar->rms_adjustment != NULL) {
+ g_signal_handlers_disconnect_by_func (bar->peak_adjustment,
G_CALLBACK (on_rms_adjustment_value_changed),
bar);
- g_object_unref (bar->priv->rms_adjustment);
+ g_object_unref (bar->rms_adjustment);
}
- bar->priv->rms_adjustment = g_object_ref_sink (adjustment);
+ bar->rms_adjustment = g_object_ref_sink (adjustment);
- g_signal_connect (bar->priv->peak_adjustment,
+ g_signal_connect (bar->peak_adjustment,
"value-changed",
G_CALLBACK (on_peak_adjustment_value_changed),
bar);
@@ -343,7 +343,7 @@ gvc_level_bar_get_peak_adjustment (GvcLevelBar *bar)
{
g_return_val_if_fail (GVC_IS_LEVEL_BAR (bar), NULL);
- return bar->priv->peak_adjustment;
+ return bar->peak_adjustment;
}
GtkAdjustment *
@@ -351,7 +351,7 @@ gvc_level_bar_get_rms_adjustment (GvcLevelBar *bar)
{
g_return_val_if_fail (GVC_IS_LEVEL_BAR (bar), NULL);
- return bar->priv->rms_adjustment;
+ return bar->rms_adjustment;
}
void
@@ -360,8 +360,8 @@ gvc_level_bar_set_scale (GvcLevelBar *bar,
{
g_return_if_fail (GVC_IS_LEVEL_BAR (bar));
- if (scale != bar->priv->scale) {
- bar->priv->scale = scale;
+ if (scale != bar->scale) {
+ bar->scale = scale;
update_peak_value (bar);
update_rms_value (bar);
@@ -407,16 +407,16 @@ gvc_level_bar_get_property (GObject *object,
switch (prop_id) {
case PROP_SCALE:
- g_value_set_int (value, self->priv->scale);
+ g_value_set_int (value, self->scale);
break;
case PROP_ORIENTATION:
- g_value_set_enum (value, self->priv->orientation);
+ g_value_set_enum (value, self->orientation);
break;
case PROP_PEAK_ADJUSTMENT:
- g_value_set_object (value, self->priv->peak_adjustment);
+ g_value_set_object (value, self->peak_adjustment);
break;
case PROP_RMS_ADJUSTMENT:
- g_value_set_object (value, self->priv->rms_adjustment);
+ g_value_set_object (value, self->rms_adjustment);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -438,7 +438,7 @@ gvc_level_bar_size_request (GtkWidget *widget,
{
GvcLevelBar *bar = GVC_LEVEL_BAR (widget);
- switch (bar->priv->orientation) {
+ switch (bar->orientation) {
case GTK_ORIENTATION_VERTICAL:
requisition->width = VERTICAL_BAR_WIDTH;
requisition->height = MIN_VERTICAL_BAR_HEIGHT;
@@ -504,7 +504,7 @@ gvc_level_bar_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
gtk_widget_get_allocation (widget, allocation);
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
allocation->height = MIN (allocation->height, MIN_VERTICAL_BAR_HEIGHT);
allocation->width = MAX (allocation->width, VERTICAL_BAR_WIDTH);
} else {
@@ -584,37 +584,37 @@ gvc_level_bar_draw (GtkWidget *widget,
cairo_save (cr);
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
+ if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
int i;
int by;
for (i = 0; i < NUM_BOXES; i++) {
- by = i * bar->priv->layout.delta;
+ by = i * bar->layout.delta;
curved_rectangle (cr,
- bar->priv->layout.area.x + 0.5,
+ bar->layout.area.x + 0.5,
by + 0.5,
- bar->priv->layout.box_width - 1,
- bar->priv->layout.box_height - 1,
- bar->priv->layout.box_radius);
- if ((bar->priv->layout.max_peak_num - 1) == i) {
+ bar->layout.box_width - 1,
+ bar->layout.box_height - 1,
+ bar->layout.box_radius);
+ if ((bar->layout.max_peak_num - 1) == i) {
/* fill peak foreground */
- cairo_set_source_rgb (cr, bar->priv->layout.fl_r, bar->priv->layout.fl_g, bar->priv->layout.fl_b);
+ cairo_set_source_rgb (cr, bar->layout.fl_r, bar->layout.fl_g, bar->layout.fl_b);
cairo_fill_preserve (cr);
- } else if ((bar->priv->layout.peak_num - 1) >= i) {
+ } else if ((bar->layout.peak_num - 1) >= i) {
/* fill background */
- cairo_set_source_rgb (cr, bar->priv->layout.bg_r, bar->priv->layout.bg_g, bar->priv->layout.bg_b);
+ cairo_set_source_rgb (cr, bar->layout.bg_r, bar->layout.bg_g, bar->layout.bg_b);
cairo_fill_preserve (cr);
/* fill foreground */
- cairo_set_source_rgba (cr, bar->priv->layout.fl_r, bar->priv->layout.fl_g, bar->priv->layout.fl_b, 0.5);
+ cairo_set_source_rgba (cr, bar->layout.fl_r, bar->layout.fl_g, bar->layout.fl_b, 0.5);
cairo_fill_preserve (cr);
} else {
/* fill background */
- cairo_set_source_rgb (cr, bar->priv->layout.bg_r, bar->priv->layout.bg_g, bar->priv->layout.bg_b);
+ cairo_set_source_rgb (cr, bar->layout.bg_r, bar->layout.bg_g, bar->layout.bg_b);
cairo_fill_preserve (cr);
}
/* stroke border */
- cairo_set_source_rgb (cr, bar->priv->layout.bdr_r, bar->priv->layout.bdr_g, bar->priv->layout.bdr_b);
+ cairo_set_source_rgb (cr, bar->layout.bdr_r, bar->layout.bdr_g, bar->layout.bdr_b);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
@@ -629,33 +629,33 @@ gvc_level_bar_draw (GtkWidget *widget,
}
for (i = 0; i < NUM_BOXES; i++) {
- bx = i * bar->priv->layout.delta;
+ bx = i * bar->layout.delta;
curved_rectangle (cr,
bx + 0.5,
- bar->priv->layout.area.y + 0.5,
- bar->priv->layout.box_width - 1,
- bar->priv->layout.box_height - 1,
- bar->priv->layout.box_radius);
+ bar->layout.area.y + 0.5,
+ bar->layout.box_width - 1,
+ bar->layout.box_height - 1,
+ bar->layout.box_radius);
- if ((bar->priv->layout.max_peak_num - 1) == i) {
+ if ((bar->layout.max_peak_num - 1) == i) {
/* fill peak foreground */
- cairo_set_source_rgb (cr, bar->priv->layout.fl_r, bar->priv->layout.fl_g, bar->priv->layout.fl_b);
+ cairo_set_source_rgb (cr, bar->layout.fl_r, bar->layout.fl_g, bar->layout.fl_b);
cairo_fill_preserve (cr);
- } else if ((bar->priv->layout.peak_num - 1) >= i) {
+ } else if ((bar->layout.peak_num - 1) >= i) {
/* fill background */
- cairo_set_source_rgb (cr, bar->priv->layout.bg_r, bar->priv->layout.bg_g, bar->priv->layout.bg_b);
+ cairo_set_source_rgb (cr, bar->layout.bg_r, bar->layout.bg_g, bar->layout.bg_b);
cairo_fill_preserve (cr);
/* fill foreground */
- cairo_set_source_rgba (cr, bar->priv->layout.fl_r, bar->priv->layout.fl_g, bar->priv->layout.fl_b, 0.5);
+ cairo_set_source_rgba (cr, bar->layout.fl_r, bar->layout.fl_g, bar->layout.fl_b, 0.5);
cairo_fill_preserve (cr);
} else {
/* fill background */
- cairo_set_source_rgb (cr, bar->priv->layout.bg_r, bar->priv->layout.bg_g, bar->priv->layout.bg_b);
+ cairo_set_source_rgb (cr, bar->layout.bg_r, bar->layout.bg_g, bar->layout.bg_b);
cairo_fill_preserve (cr);
}
/* stroke border */
- cairo_set_source_rgb (cr, bar->priv->layout.bdr_r, bar->priv->layout.bdr_g, bar->priv->layout.bdr_b);
+ cairo_set_source_rgb (cr, bar->layout.bdr_r, bar->layout.bdr_g, bar->layout.bdr_b);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
@@ -713,35 +713,31 @@ gvc_level_bar_class_init (GvcLevelBarClass *klass)
G_MAXINT,
GVC_LEVEL_SCALE_LINEAR,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
-
- g_type_class_add_private (klass, sizeof (GvcLevelBarPrivate));
}
static void
gvc_level_bar_init (GvcLevelBar *bar)
{
- bar->priv = GVC_LEVEL_BAR_GET_PRIVATE (bar);
-
- bar->priv->peak_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->peak_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
0.0,
1.0,
0.05,
0.1,
0.1));
- g_object_ref_sink (bar->priv->peak_adjustment);
- g_signal_connect (bar->priv->peak_adjustment,
+ g_object_ref_sink (bar->peak_adjustment);
+ g_signal_connect (bar->peak_adjustment,
"value-changed",
G_CALLBACK (on_peak_adjustment_value_changed),
bar);
- bar->priv->rms_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ bar->rms_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
0.0,
1.0,
0.05,
0.1,
0.1));
- g_object_ref_sink (bar->priv->rms_adjustment);
- g_signal_connect (bar->priv->rms_adjustment,
+ g_object_ref_sink (bar->rms_adjustment);
+ g_signal_connect (bar->rms_adjustment,
"value-changed",
G_CALLBACK (on_rms_adjustment_value_changed),
bar);
@@ -759,12 +755,10 @@ gvc_level_bar_finalize (GObject *object)
bar = GVC_LEVEL_BAR (object);
- if (bar->priv->max_peak_id > 0) {
- g_source_remove (bar->priv->max_peak_id);
+ if (bar->max_peak_id > 0) {
+ g_source_remove (bar->max_peak_id);
}
- g_return_if_fail (bar->priv != NULL);
-
G_OBJECT_CLASS (gvc_level_bar_parent_class)->finalize (object);
}
diff --git a/panels/sound/gvc-level-bar.h b/panels/sound/gvc-level-bar.h
index ebd5dd836..758b01118 100644
--- a/panels/sound/gvc-level-bar.h
+++ b/panels/sound/gvc-level-bar.h
@@ -25,25 +25,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_LEVEL_BAR (gvc_level_bar_get_type ())
-#define GVC_LEVEL_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_LEVEL_BAR, GvcLevelBar))
-#define GVC_LEVEL_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_LEVEL_BAR, GvcLevelBarClass))
-#define GVC_IS_LEVEL_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_LEVEL_BAR))
-#define GVC_IS_LEVEL_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_LEVEL_BAR))
-#define GVC_LEVEL_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_LEVEL_BAR, GvcLevelBarClass))
-
-typedef struct GvcLevelBarPrivate GvcLevelBarPrivate;
-
-typedef struct
-{
- GtkWidget parent;
- GvcLevelBarPrivate *priv;
-} GvcLevelBar;
-
-typedef struct
-{
- GtkWidgetClass parent_class;
-} GvcLevelBarClass;
+#define GVC_TYPE_LEVEL_BAR (gvc_level_bar_get_type ())
+G_DECLARE_FINAL_TYPE (GvcLevelBar, gvc_level_bar, GVC, LEVEL_BAR, GtkBox)
typedef enum
{
@@ -52,8 +35,6 @@ typedef enum
GVC_LEVEL_SCALE_LAST
} GvcLevelScale;
-GType gvc_level_bar_get_type (void);
-
GtkWidget * gvc_level_bar_new (void);
void gvc_level_bar_set_orientation (GvcLevelBar *bar,
GtkOrientation orientation);
diff --git a/panels/sound/gvc-mixer-dialog.c b/panels/sound/gvc-mixer-dialog.c
index a358f03df..3caf253cd 100644
--- a/panels/sound/gvc-mixer-dialog.c
+++ b/panels/sound/gvc-mixer-dialog.c
@@ -46,10 +46,10 @@
#define SCALE_SIZE 128
-#define GVC_MIXER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_DIALOG, GvcMixerDialogPrivate))
-
-struct GvcMixerDialogPrivate
+struct _GvcMixerDialog
{
+ GtkBox parent_instance;
+
GvcMixerControl *mixer_control;
GHashTable *bars; /* Application and event bars only */
GtkWidget *notebook;
@@ -142,7 +142,7 @@ profile_selection_changed (GvcComboBox *combo_box,
gvc_mixer_ui_device_get_origin (output),
gvc_mixer_ui_device_get_id (output));
- if (gvc_mixer_control_change_profile_on_selected_device (dialog->priv->mixer_control, output, profile) == FALSE) {
+ if (gvc_mixer_control_change_profile_on_selected_device (dialog->mixer_control, output, profile) == FALSE) {
g_warning ("Could not change profile on device %s",
gvc_mixer_ui_device_get_description (output));
}
@@ -158,42 +158,42 @@ update_output_settings (GvcMixerDialog *dialog,
GtkAdjustment *adj;
g_debug ("Updating output settings");
- if (dialog->priv->output_balance_bar != NULL) {
- gtk_container_remove (GTK_CONTAINER (dialog->priv->output_settings_box),
- dialog->priv->output_balance_bar);
- dialog->priv->output_balance_bar = NULL;
+ if (dialog->output_balance_bar != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->output_settings_box),
+ dialog->output_balance_bar);
+ dialog->output_balance_bar = NULL;
}
- if (dialog->priv->output_fade_bar != NULL) {
- gtk_container_remove (GTK_CONTAINER (dialog->priv->output_settings_box),
- dialog->priv->output_fade_bar);
- dialog->priv->output_fade_bar = NULL;
+ if (dialog->output_fade_bar != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->output_settings_box),
+ dialog->output_fade_bar);
+ dialog->output_fade_bar = NULL;
}
- if (dialog->priv->output_lfe_bar != NULL) {
- gtk_container_remove (GTK_CONTAINER (dialog->priv->output_settings_box),
- dialog->priv->output_lfe_bar);
- dialog->priv->output_lfe_bar = NULL;
+ if (dialog->output_lfe_bar != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->output_settings_box),
+ dialog->output_lfe_bar);
+ dialog->output_lfe_bar = NULL;
}
- if (dialog->priv->output_profile_combo != NULL) {
- gtk_container_remove (GTK_CONTAINER (dialog->priv->output_settings_box),
- dialog->priv->output_profile_combo);
- dialog->priv->output_profile_combo = NULL;
+ if (dialog->output_profile_combo != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->output_settings_box),
+ dialog->output_profile_combo);
+ dialog->output_profile_combo = NULL;
}
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control,
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control,
device);
if (stream == NULL) {
g_warning ("Default sink stream not found");
return;
}
- gvc_channel_bar_set_base_volume (GVC_CHANNEL_BAR (dialog->priv->output_bar),
+ gvc_channel_bar_set_base_volume (GVC_CHANNEL_BAR (dialog->output_bar),
gvc_mixer_stream_get_base_volume (stream));
- gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->priv->output_bar),
+ gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->output_bar),
gvc_mixer_stream_get_can_decibel (stream));
/* Update the adjustment in case the previous bar wasn't decibel
* capable, and we clipped it */
- adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->priv->output_bar)));
+ adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->output_bar)));
gtk_adjustment_set_value (adj,
gvc_mixer_stream_get_volume (stream));
@@ -203,41 +203,41 @@ update_output_settings (GvcMixerDialog *dialog,
return;
}
- dialog->priv->output_balance_bar = gvc_balance_bar_new (map, BALANCE_TYPE_RL);
- if (dialog->priv->size_group != NULL) {
- gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->priv->output_balance_bar),
- dialog->priv->size_group,
+ dialog->output_balance_bar = gvc_balance_bar_new (map, BALANCE_TYPE_RL);
+ if (dialog->size_group != NULL) {
+ gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->output_balance_bar),
+ dialog->size_group,
TRUE);
}
- gtk_box_pack_start (GTK_BOX (dialog->priv->output_settings_box),
- dialog->priv->output_balance_bar,
+ gtk_box_pack_start (GTK_BOX (dialog->output_settings_box),
+ dialog->output_balance_bar,
FALSE, FALSE, 6);
- gtk_widget_show (dialog->priv->output_balance_bar);
+ gtk_widget_show (dialog->output_balance_bar);
if (gvc_channel_map_can_fade (map)) {
- dialog->priv->output_fade_bar = gvc_balance_bar_new (map, BALANCE_TYPE_FR);
- if (dialog->priv->size_group != NULL) {
- gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->priv->output_fade_bar),
- dialog->priv->size_group,
+ dialog->output_fade_bar = gvc_balance_bar_new (map, BALANCE_TYPE_FR);
+ if (dialog->size_group != NULL) {
+ gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->output_fade_bar),
+ dialog->size_group,
TRUE);
}
- gtk_box_pack_start (GTK_BOX (dialog->priv->output_settings_box),
- dialog->priv->output_fade_bar,
+ gtk_box_pack_start (GTK_BOX (dialog->output_settings_box),
+ dialog->output_fade_bar,
FALSE, FALSE, 6);
- gtk_widget_show (dialog->priv->output_fade_bar);
+ gtk_widget_show (dialog->output_fade_bar);
}
if (gvc_channel_map_has_lfe (map)) {
- dialog->priv->output_lfe_bar = gvc_balance_bar_new (map, BALANCE_TYPE_LFE);
- if (dialog->priv->size_group != NULL) {
- gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->priv->output_lfe_bar),
- dialog->priv->size_group,
+ dialog->output_lfe_bar = gvc_balance_bar_new (map, BALANCE_TYPE_LFE);
+ if (dialog->size_group != NULL) {
+ gvc_balance_bar_set_size_group (GVC_BALANCE_BAR (dialog->output_lfe_bar),
+ dialog->size_group,
TRUE);
}
- gtk_box_pack_start (GTK_BOX (dialog->priv->output_settings_box),
- dialog->priv->output_lfe_bar,
+ gtk_box_pack_start (GTK_BOX (dialog->output_settings_box),
+ dialog->output_lfe_bar,
FALSE, FALSE, 6);
- gtk_widget_show (dialog->priv->output_lfe_bar);
+ gtk_widget_show (dialog->output_lfe_bar);
}
profiles = gvc_mixer_ui_device_get_profiles (device);
@@ -246,42 +246,42 @@ update_output_settings (GvcMixerDialog *dialog,
if (TRUE /*g_list_length((GList *) profiles) >= 2 */) {
const gchar *active_profile;
- dialog->priv->output_profile_combo = gvc_combo_box_new (_("_Profile:"));
+ dialog->output_profile_combo = gvc_combo_box_new (_("_Profile:"));
- g_object_set (G_OBJECT (dialog->priv->output_profile_combo), "button-label", _("_Test Speakers"), NULL);
- g_object_set (G_OBJECT (dialog->priv->output_profile_combo),
+ g_object_set (G_OBJECT (dialog->output_profile_combo), "button-label", _("_Test Speakers"), NULL);
+ g_object_set (G_OBJECT (dialog->output_profile_combo),
"show-button", TRUE, NULL);
- g_signal_connect (G_OBJECT (dialog->priv->output_profile_combo), "button-clicked",
+ g_signal_connect (G_OBJECT (dialog->output_profile_combo), "button-clicked",
G_CALLBACK (on_test_speakers_clicked), dialog);
if (profiles)
- gvc_combo_box_set_profiles (GVC_COMBO_BOX (dialog->priv->output_profile_combo),
+ gvc_combo_box_set_profiles (GVC_COMBO_BOX (dialog->output_profile_combo),
profiles);
- gtk_box_pack_start (GTK_BOX (dialog->priv->output_settings_box),
- dialog->priv->output_profile_combo,
+ gtk_box_pack_start (GTK_BOX (dialog->output_settings_box),
+ dialog->output_profile_combo,
TRUE, FALSE, 6);
- if (dialog->priv->size_group != NULL) {
- gvc_combo_box_set_size_group (GVC_COMBO_BOX (dialog->priv->output_profile_combo),
- dialog->priv->size_group, FALSE);
+ if (dialog->size_group != NULL) {
+ gvc_combo_box_set_size_group (GVC_COMBO_BOX (dialog->output_profile_combo),
+ dialog->size_group, FALSE);
}
active_profile = gvc_mixer_ui_device_get_active_profile (device);
if (active_profile)
- gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->priv->output_profile_combo), active_profile);
+ gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->output_profile_combo), active_profile);
- g_object_set_data (G_OBJECT (dialog->priv->output_profile_combo),
+ g_object_set_data (G_OBJECT (dialog->output_profile_combo),
"uidevice",
device);
if (g_list_length((GList *) profiles))
- g_signal_connect (G_OBJECT (dialog->priv->output_profile_combo), "changed",
+ g_signal_connect (G_OBJECT (dialog->output_profile_combo), "changed",
G_CALLBACK (profile_selection_changed), dialog);
- gtk_widget_show (dialog->priv->output_profile_combo);
+ gtk_widget_show (dialog->output_profile_combo);
}
/* FIXME: We could make this into a "No settings" label instead */
- gtk_widget_set_sensitive (dialog->priv->output_balance_bar, gvc_channel_map_can_balance (map));
+ gtk_widget_set_sensitive (dialog->output_balance_bar, gvc_channel_map_can_balance (map));
}
#define DECAY_STEP .15
@@ -292,15 +292,15 @@ update_input_peak (GvcMixerDialog *dialog,
{
GtkAdjustment *adj;
- if (dialog->priv->last_input_peak >= DECAY_STEP) {
- if (v < dialog->priv->last_input_peak - DECAY_STEP) {
- v = dialog->priv->last_input_peak - DECAY_STEP;
+ if (dialog->last_input_peak >= DECAY_STEP) {
+ if (v < dialog->last_input_peak - DECAY_STEP) {
+ v = dialog->last_input_peak - DECAY_STEP;
}
}
- dialog->priv->last_input_peak = v;
+ dialog->last_input_peak = v;
- adj = gvc_level_bar_get_peak_adjustment (GVC_LEVEL_BAR (dialog->priv->input_level_bar));
+ adj = gvc_level_bar_get_peak_adjustment (GVC_LEVEL_BAR (dialog->input_level_bar));
if (v >= 0) {
gtk_adjustment_set_value (adj, v);
} else {
@@ -399,7 +399,7 @@ create_monitor_stream_for_source (GvcMixerDialog *dialog,
g_debug ("Create monitor for %u",
gvc_mixer_stream_get_index (stream));
- context = gvc_mixer_control_get_pa_context (dialog->priv->mixer_control);
+ context = gvc_mixer_control_get_pa_context (dialog->mixer_control);
if (pa_context_get_server_protocol_version (context) < 13) {
return;
@@ -438,8 +438,8 @@ create_monitor_stream_for_source (GvcMixerDialog *dialog,
pa_stream_unref (s);
} else {
g_object_set_data (G_OBJECT (stream), "has-monitor", GINT_TO_POINTER (TRUE));
- g_object_set_data (G_OBJECT (dialog->priv->input_level_bar), "pa_stream", s);
- g_object_set_data (G_OBJECT (dialog->priv->input_level_bar), "stream", stream);
+ g_object_set_data (G_OBJECT (dialog->input_level_bar), "pa_stream", s);
+ g_object_set_data (G_OBJECT (dialog->input_level_bar), "stream", stream);
}
}
@@ -451,15 +451,15 @@ stop_monitor_stream_for_source (GvcMixerDialog *dialog)
int res;
GvcMixerStream *stream;
- s = g_object_get_data (G_OBJECT (dialog->priv->input_level_bar), "pa_stream");
+ s = g_object_get_data (G_OBJECT (dialog->input_level_bar), "pa_stream");
if (s == NULL)
return;
- stream = g_object_get_data (G_OBJECT (dialog->priv->input_level_bar), "stream");
+ stream = g_object_get_data (G_OBJECT (dialog->input_level_bar), "stream");
g_assert (stream != NULL);
g_debug ("Stopping monitor for %u", pa_stream_get_index (s));
- context = gvc_mixer_control_get_pa_context (dialog->priv->mixer_control);
+ context = gvc_mixer_control_get_pa_context (dialog->mixer_control);
if (pa_context_get_server_protocol_version (context) < 13) {
return;
@@ -468,8 +468,8 @@ stop_monitor_stream_for_source (GvcMixerDialog *dialog)
res = pa_stream_disconnect (s);
if (res == 0)
g_object_set_data (G_OBJECT (stream), "has-monitor", GINT_TO_POINTER (FALSE));
- g_object_set_data (G_OBJECT (dialog->priv->input_level_bar), "pa_stream", NULL);
- g_object_set_data (G_OBJECT (dialog->priv->input_level_bar), "stream", NULL);
+ g_object_set_data (G_OBJECT (dialog->input_level_bar), "pa_stream", NULL);
+ g_object_set_data (G_OBJECT (dialog->input_level_bar), "stream", NULL);
}
static void
@@ -484,27 +484,27 @@ update_input_settings (GvcMixerDialog *dialog,
stop_monitor_stream_for_source (dialog);
- if (dialog->priv->input_profile_combo != NULL) {
- gtk_container_remove (GTK_CONTAINER (dialog->priv->input_settings_box),
- dialog->priv->input_profile_combo);
- dialog->priv->input_profile_combo = NULL;
+ if (dialog->input_profile_combo != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->input_settings_box),
+ dialog->input_profile_combo);
+ dialog->input_profile_combo = NULL;
}
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control,
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control,
device);
if (stream == NULL) {
g_debug ("Default source stream not found");
return;
}
- gvc_channel_bar_set_base_volume (GVC_CHANNEL_BAR (dialog->priv->input_bar),
+ gvc_channel_bar_set_base_volume (GVC_CHANNEL_BAR (dialog->input_bar),
gvc_mixer_stream_get_base_volume (stream));
- gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->priv->input_bar),
+ gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->input_bar),
gvc_mixer_stream_get_can_decibel (stream));
/* Update the adjustment in case the previous bar wasn't decibel
* capable, and we clipped it */
- adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->priv->input_bar)));
+ adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->input_bar)));
gtk_adjustment_set_value (adj,
gvc_mixer_stream_get_volume (stream));
@@ -512,30 +512,30 @@ update_input_settings (GvcMixerDialog *dialog,
if (g_list_length ((GList *) profiles) >= 2) {
const gchar *active_profile;
- dialog->priv->input_profile_combo = gvc_combo_box_new (_("_Profile:"));
- gvc_combo_box_set_profiles (GVC_COMBO_BOX (dialog->priv->input_profile_combo),
+ dialog->input_profile_combo = gvc_combo_box_new (_("_Profile:"));
+ gvc_combo_box_set_profiles (GVC_COMBO_BOX (dialog->input_profile_combo),
profiles);
- gtk_box_pack_start (GTK_BOX (dialog->priv->input_settings_box),
- dialog->priv->input_profile_combo,
+ gtk_box_pack_start (GTK_BOX (dialog->input_settings_box),
+ dialog->input_profile_combo,
TRUE, TRUE, 0);
- if (dialog->priv->size_group != NULL) {
- gvc_combo_box_set_size_group (GVC_COMBO_BOX (dialog->priv->input_profile_combo),
- dialog->priv->size_group, FALSE);
+ if (dialog->size_group != NULL) {
+ gvc_combo_box_set_size_group (GVC_COMBO_BOX (dialog->input_profile_combo),
+ dialog->size_group, FALSE);
}
active_profile = gvc_mixer_ui_device_get_active_profile (device);
if (active_profile)
- gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->priv->input_profile_combo), active_profile);
+ gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->input_profile_combo), active_profile);
- g_object_set_data (G_OBJECT (dialog->priv->input_profile_combo),
+ g_object_set_data (G_OBJECT (dialog->input_profile_combo),
"uidevice",
device);
- g_signal_connect (G_OBJECT (dialog->priv->input_profile_combo), "changed",
+ g_signal_connect (G_OBJECT (dialog->input_profile_combo), "changed",
G_CALLBACK (profile_selection_changed), dialog);
- gtk_widget_show (dialog->priv->input_profile_combo);
+ gtk_widget_show (dialog->input_profile_combo);
}
create_monitor_stream_for_source (dialog, stream);
@@ -550,25 +550,25 @@ gvc_mixer_dialog_set_mixer_control (GvcMixerDialog *dialog,
g_object_ref (control);
- if (dialog->priv->mixer_control != NULL) {
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ if (dialog->mixer_control != NULL) {
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
G_CALLBACK (on_control_active_input_update),
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
G_CALLBACK (on_control_active_output_update),
dialog);
- g_object_unref (dialog->priv->mixer_control);
+ g_object_unref (dialog->mixer_control);
}
- dialog->priv->mixer_control = control;
+ dialog->mixer_control = control;
/* FIXME: Why are some mixer_control signals connected here,
* and others in the dialog constructor? (And similar for disconnect) */
- g_signal_connect (dialog->priv->mixer_control,
+ g_signal_connect (dialog->mixer_control,
"active-input-update",
G_CALLBACK (on_control_active_input_update),
dialog);
- g_signal_connect (dialog->priv->mixer_control,
+ g_signal_connect (dialog->mixer_control,
"active-output-update",
G_CALLBACK (on_control_active_output_update),
dialog);
@@ -581,7 +581,7 @@ gvc_mixer_dialog_get_mixer_control (GvcMixerDialog *dialog)
{
g_return_val_if_fail (GVC_IS_MIXER_DIALOG (dialog), NULL);
- return dialog->priv->mixer_control;
+ return dialog->mixer_control;
}
static void
@@ -677,14 +677,14 @@ lookup_bar_for_stream (GvcMixerDialog *dialog,
{
GtkWidget *bar;
- bar = g_hash_table_lookup (dialog->priv->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)));
+ bar = g_hash_table_lookup (dialog->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)));
if (bar)
return bar;
- if (g_object_get_data (G_OBJECT (dialog->priv->output_bar), "gvc-mixer-dialog-stream") == stream)
- return dialog->priv->output_bar;
- if (g_object_get_data (G_OBJECT (dialog->priv->input_bar), "gvc-mixer-dialog-stream") == stream)
- return dialog->priv->input_bar;
+ if (g_object_get_data (G_OBJECT (dialog->output_bar), "gvc-mixer-dialog-stream") == stream)
+ return dialog->output_bar;
+ if (g_object_get_data (G_OBJECT (dialog->input_bar), "gvc-mixer-dialog-stream") == stream)
+ return dialog->input_bar;
return NULL;
}
@@ -744,8 +744,8 @@ on_stream_is_muted_notify (GObject *object,
gvc_channel_bar_set_is_muted (GVC_CHANNEL_BAR (bar),
is_muted);
- if (stream == gvc_mixer_control_get_default_sink (dialog->priv->mixer_control)) {
- gtk_widget_set_sensitive (dialog->priv->applications_box,
+ if (stream == gvc_mixer_control_get_default_sink (dialog->mixer_control)) {
+ gtk_widget_set_sensitive (dialog->applications_box,
!is_muted);
}
@@ -756,7 +756,7 @@ save_bar_for_stream (GvcMixerDialog *dialog,
GvcMixerStream *stream,
GtkWidget *bar)
{
- g_hash_table_insert (dialog->priv->bars,
+ g_hash_table_insert (dialog->bars,
GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)),
bar);
}
@@ -770,9 +770,9 @@ create_bar (GvcMixerDialog *dialog,
bar = gvc_channel_bar_new ();
gtk_widget_set_sensitive (bar, FALSE);
- if (add_to_size_group && dialog->priv->size_group != NULL) {
+ if (add_to_size_group && dialog->size_group != NULL) {
gvc_channel_bar_set_size_group (GVC_CHANNEL_BAR (bar),
- dialog->priv->size_group,
+ dialog->size_group,
symmetric);
}
gvc_channel_bar_set_show_mute (GVC_CHANNEL_BAR (bar),
@@ -824,7 +824,7 @@ active_input_update (GvcMixerDialog *dialog,
g_debug ("active_input_update device id = %i",
gvc_mixer_ui_device_get_id (active_input));
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->input_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->input_treeview));
if (gtk_tree_model_get_iter_first (model, &iter) == FALSE) {
g_warning ("No devices in the tree, so cannot set the active output");
@@ -848,20 +848,20 @@ active_input_update (GvcMixerDialog *dialog,
if (is_selected) {
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->input_treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->input_treeview));
gtk_tree_selection_select_iter (selection, &iter);
}
} while (gtk_tree_model_iter_next (model, &iter));
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control,
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control,
active_input);
if (stream == NULL) {
g_warning ("Couldn't find a stream from the active input");
- gtk_widget_set_sensitive (dialog->priv->input_bar, FALSE);
+ gtk_widget_set_sensitive (dialog->input_bar, FALSE);
return;
}
- bar_set_stream (dialog, dialog->priv->input_bar, stream);
+ bar_set_stream (dialog, dialog->input_bar, stream);
update_input_settings (dialog, active_input);
}
@@ -881,7 +881,7 @@ active_output_update (GvcMixerDialog *dialog,
g_debug ("active output update device id = %i",
gvc_mixer_ui_device_get_id (active_output));
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->output_treeview));
if (gtk_tree_model_get_iter_first (model, &iter) == FALSE){
g_warning ("No devices in the tree, so cannot set the active output");
@@ -911,19 +911,19 @@ active_output_update (GvcMixerDialog *dialog,
if (is_selected) {
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->output_treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->output_treeview));
gtk_tree_selection_select_iter (selection, &iter);
}
} while (gtk_tree_model_iter_next (model, &iter));
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control,
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control,
active_output);
if (stream == NULL) {
g_warning ("Couldn't find a stream from the active output");
return;
}
- bar_set_stream (dialog, dialog->priv->output_bar, stream);
+ bar_set_stream (dialog, dialog->output_bar, stream);
update_output_settings (dialog, active_output);
}
@@ -948,7 +948,7 @@ bar_set_stream (GvcMixerDialog *dialog,
g_signal_handlers_disconnect_by_func (old_stream, on_stream_is_muted_notify, dialog);
g_signal_handlers_disconnect_by_func (old_stream, on_stream_volume_notify, dialog);
- g_hash_table_remove (dialog->priv->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (old_stream)));
+ g_hash_table_remove (dialog->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (old_stream)));
}
gtk_widget_set_sensitive (bar, (stream != NULL));
@@ -998,8 +998,8 @@ add_stream (GvcMixerDialog *dialog,
if (GVC_IS_MIXER_SOURCE (stream) || GVC_IS_MIXER_SINK (stream))
return;
- else if (stream == gvc_mixer_control_get_event_sink_input (dialog->priv->mixer_control)) {
- bar = dialog->priv->effects_bar;
+ else if (stream == gvc_mixer_control_get_event_sink_input (dialog->mixer_control)) {
+ bar = dialog->effects_bar;
g_debug ("Adding effects stream");
} else {
/* Must be an application stream */
@@ -1009,9 +1009,9 @@ add_stream (GvcMixerDialog *dialog,
bar = create_app_bar (dialog, name,
gvc_mixer_stream_get_icon_name (stream));
- gtk_box_pack_start (GTK_BOX (dialog->priv->applications_box), bar, FALSE, FALSE, 12);
- dialog->priv->num_apps++;
- gtk_widget_hide (dialog->priv->no_apps_label);
+ gtk_box_pack_start (GTK_BOX (dialog->applications_box), bar, FALSE, FALSE, 12);
+ dialog->num_apps++;
+ gtk_widget_hide (dialog->no_apps_label);
}
/* We should have a bar by now. */
@@ -1029,7 +1029,7 @@ add_stream (GvcMixerDialog *dialog,
g_signal_handlers_disconnect_by_func (old_stream, on_stream_is_muted_notify, dialog);
g_signal_handlers_disconnect_by_func (old_stream, on_stream_volume_notify, dialog);
- g_hash_table_remove (dialog->priv->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (old_stream)));
+ g_hash_table_remove (dialog->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (old_stream)));
}
save_bar_for_stream (dialog, stream, bar);
bar_set_stream (dialog, bar, stream);
@@ -1051,7 +1051,7 @@ on_control_stream_added (GvcMixerControl *control,
app_id = gvc_mixer_stream_get_application_id (stream);
- if (stream == gvc_mixer_control_get_event_sink_input (dialog->priv->mixer_control) ||
+ if (stream == gvc_mixer_control_get_event_sink_input (dialog->mixer_control) ||
(GVC_IS_MIXER_SOURCE (stream) == FALSE &&
GVC_IS_MIXER_SINK (stream) == FALSE &&
gvc_mixer_stream_is_virtual (stream) == FALSE &&
@@ -1060,7 +1060,7 @@ on_control_stream_added (GvcMixerControl *control,
g_strcmp0 (app_id, "org.PulseAudio.pavucontrol") != 0)) {
GtkWidget *bar;
- bar = g_hash_table_lookup (dialog->priv->bars, GUINT_TO_POINTER (id));
+ bar = g_hash_table_lookup (dialog->bars, GUINT_TO_POINTER (id));
if (bar != NULL) {
g_debug ("GvcMixerDialog: Stream %u already added", id);
return;
@@ -1136,7 +1136,7 @@ add_input_ui_entry (GvcMixerDialog *dialog,
if (icon == NULL) {
GvcMixerStream *stream;
g_debug ("just detected a network source");
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control, input);
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control, input);
if (stream == NULL) {
g_warning ("tried to add the network source but the stream was null - fail ?!");
g_free (final_name);
@@ -1145,7 +1145,7 @@ add_input_ui_entry (GvcMixerDialog *dialog,
icon = gvc_mixer_stream_get_gicon (stream);
}
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->input_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->input_treeview));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model),
@@ -1202,7 +1202,7 @@ add_output_ui_entry (GvcMixerDialog *dialog,
GvcMixerStream *stream;
g_debug ("just detected a network sink");
- stream = gvc_mixer_control_get_stream_from_device (dialog->priv->mixer_control, output);
+ stream = gvc_mixer_control_get_stream_from_device (dialog->mixer_control, output);
if (stream == NULL) {
g_warning ("tried to add the network sink but the stream was null - fail ?!");
@@ -1212,7 +1212,7 @@ add_output_ui_entry (GvcMixerDialog *dialog,
icon = gvc_mixer_stream_get_gicon (stream);
}
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->output_treeview));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model),
@@ -1297,7 +1297,7 @@ on_control_input_removed (GvcMixerControl *control,
stream_id);
/* remove from any models */
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->input_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->input_treeview));
found = find_item_by_id (GTK_TREE_MODEL (model), id, ID_COLUMN, &iter);
if (found) {
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
@@ -1342,7 +1342,7 @@ on_control_output_removed (GvcMixerControl *control,
sink_stream_id);
/* remove from any models */
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->output_treeview));
found = find_item_by_id (GTK_TREE_MODEL (model), id, ID_COLUMN, &iter);
if (found) {
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
@@ -1356,25 +1356,25 @@ remove_stream (GvcMixerDialog *dialog,
GtkWidget *bar;
guint output_id, input_id;
- bar = g_hash_table_lookup (dialog->priv->bars, GUINT_TO_POINTER (id));
+ bar = g_hash_table_lookup (dialog->bars, GUINT_TO_POINTER (id));
if (bar != NULL) {
- g_hash_table_remove (dialog->priv->bars, GUINT_TO_POINTER (id));
+ g_hash_table_remove (dialog->bars, GUINT_TO_POINTER (id));
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (bar)),
bar);
- dialog->priv->num_apps--;
- if (dialog->priv->num_apps == 0) {
- gtk_widget_show (dialog->priv->no_apps_label);
+ dialog->num_apps--;
+ if (dialog->num_apps == 0) {
+ gtk_widget_show (dialog->no_apps_label);
}
return;
}
- output_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (dialog->priv->output_bar), "gvc-mixer-dialog-stream-id"));
- input_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (dialog->priv->input_bar), "gvc-mixer-dialog-stream-id"));
+ output_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (dialog->output_bar), "gvc-mixer-dialog-stream-id"));
+ input_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (dialog->input_bar), "gvc-mixer-dialog-stream-id"));
if (output_id == id)
- bar = dialog->priv->output_bar;
+ bar = dialog->output_bar;
else if (input_id == id)
- bar = dialog->priv->input_bar;
+ bar = dialog->input_bar;
else
return;
@@ -1420,14 +1420,14 @@ on_input_selection_changed (GtkTreeSelection *selection,
ACTIVE_COLUMN, &active,
-1);
- input = gvc_mixer_control_lookup_input_id (dialog->priv->mixer_control, id);
+ input = gvc_mixer_control_lookup_input_id (dialog->mixer_control, id);
if (input == NULL) {
g_warning ("on_input_selection_changed - Unable to find input with id: %u", id);
return;
}
- gvc_mixer_control_change_input (dialog->priv->mixer_control, input);
+ gvc_mixer_control_change_input (dialog->mixer_control, input);
}
static void
@@ -1454,14 +1454,14 @@ on_output_selection_changed (GtkTreeSelection *selection,
if (active)
return;
- output = gvc_mixer_control_lookup_output_id (dialog->priv->mixer_control, id);
+ output = gvc_mixer_control_lookup_output_id (dialog->mixer_control, id);
if (output == NULL) {
g_warning ("Unable to find output with id: %u", id);
return;
}
- gvc_mixer_control_change_output (dialog->priv->mixer_control, output);
+ gvc_mixer_control_change_output (dialog->mixer_control, output);
}
static GtkWidget *
@@ -1532,7 +1532,7 @@ on_test_speakers_clicked (GvcComboBox *widget,
GtkWidget *d, *speaker_test, *container;
char *title;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->output_treeview));
if (gtk_tree_model_get_iter_first (model, &iter) == FALSE) {
g_warning ("The tree is empty => we have no device to test speakers with return");
@@ -1559,7 +1559,7 @@ on_test_speakers_clicked (GvcComboBox *widget,
return;
}
- output = gvc_mixer_control_lookup_output_id (dialog->priv->mixer_control, (guint)active_output);
+ output = gvc_mixer_control_lookup_output_id (dialog->mixer_control, (guint)active_output);
stream_id = gvc_mixer_ui_device_get_stream_id (output);
if (stream_id == GVC_MIXER_UI_DEVICE_INVALID)
@@ -1567,7 +1567,7 @@ on_test_speakers_clicked (GvcComboBox *widget,
g_debug ("Test speakers on '%s'", gvc_mixer_ui_device_get_description (output));
- stream = gvc_mixer_control_lookup_stream_id (dialog->priv->mixer_control, stream_id);
+ stream = gvc_mixer_control_lookup_stream_id (dialog->mixer_control, stream_id);
if (stream == NULL) {
g_debug ("Stream/sink not found");
return;
@@ -1582,15 +1582,15 @@ on_test_speakers_clicked (GvcComboBox *widget,
NULL);
g_free (title);
- speaker_test = gvc_speaker_test_new (dialog->priv->mixer_control,
+ speaker_test = gvc_speaker_test_new (dialog->mixer_control,
stream);
gtk_widget_show (speaker_test);
container = gtk_dialog_get_content_area (GTK_DIALOG (d));
gtk_container_add (GTK_CONTAINER (container), speaker_test);
- dialog->priv->test_dialog = d;
+ dialog->test_dialog = d;
g_object_add_weak_pointer (G_OBJECT (d),
- (gpointer *) &dialog->priv->test_dialog);
+ (gpointer *) &dialog->test_dialog);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
}
@@ -1621,30 +1621,30 @@ gvc_mixer_dialog_constructor (GType type,
gtk_container_set_border_width (GTK_CONTAINER (self), 12);
- self->priv->output_stream_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_set_margin_top (self->priv->output_stream_box, 12);
+ self->output_stream_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_widget_set_margin_top (self->output_stream_box, 12);
gtk_box_pack_start (GTK_BOX (main_vbox),
- self->priv->output_stream_box,
+ self->output_stream_box,
FALSE, FALSE, 0);
- self->priv->output_bar = create_bar (self, TRUE, TRUE);
- gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->output_bar),
+ self->output_bar = create_bar (self, TRUE, TRUE);
+ gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->output_bar),
_("_Output volume:"));
- gtk_widget_set_sensitive (self->priv->output_bar, FALSE);
- gtk_box_pack_start (GTK_BOX (self->priv->output_stream_box),
- self->priv->output_bar, TRUE, TRUE, 12);
+ gtk_widget_set_sensitive (self->output_bar, FALSE);
+ gtk_box_pack_start (GTK_BOX (self->output_stream_box),
+ self->output_bar, TRUE, TRUE, 12);
- self->priv->notebook = gtk_notebook_new ();
+ self->notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (main_vbox),
- self->priv->notebook,
+ self->notebook,
TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (self->priv->notebook), 5);
+ gtk_container_set_border_width (GTK_CONTAINER (self->notebook), 5);
/* Output page */
- self->priv->output_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_container_set_border_width (GTK_CONTAINER (self->priv->output_box), 12);
+ self->output_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (self->output_box), 12);
label = gtk_label_new (_("Output"));
- gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
- self->priv->output_box,
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->notebook),
+ self->output_box,
label);
box = gtk_frame_new (_("C_hoose a device for sound output:"));
@@ -1652,11 +1652,11 @@ gvc_mixer_dialog_constructor (GType type,
_gtk_label_make_bold (GTK_LABEL (label));
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (self->priv->output_box), box, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (self->output_box), box, TRUE, TRUE, 0);
- self->priv->output_treeview = create_ui_device_treeview (self,
+ self->output_treeview = create_ui_device_treeview (self,
G_CALLBACK (on_output_selection_changed));
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), self->priv->output_treeview);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), self->output_treeview);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -1664,7 +1664,7 @@ gvc_mixer_dialog_constructor (GType type,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (sw), self->priv->output_treeview);
+ gtk_container_add (GTK_CONTAINER (sw), self->output_treeview);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 150);
gtk_widget_set_margin_top (sw, 6);
gtk_container_add (GTK_CONTAINER (box), sw);
@@ -1673,33 +1673,33 @@ gvc_mixer_dialog_constructor (GType type,
label = gtk_frame_get_label_widget (GTK_FRAME (box));
_gtk_label_make_bold (GTK_LABEL (label));
gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (self->priv->output_box), box, FALSE, FALSE, 12);
- self->priv->output_settings_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (box), self->priv->output_settings_box);
+ gtk_box_pack_start (GTK_BOX (self->output_box), box, FALSE, FALSE, 12);
+ self->output_settings_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_add (GTK_CONTAINER (box), self->output_settings_box);
/* Input page */
- self->priv->input_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_container_set_border_width (GTK_CONTAINER (self->priv->input_box), 12);
+ self->input_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (self->input_box), 12);
label = gtk_label_new (_("Input"));
- gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
- self->priv->input_box,
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->notebook),
+ self->input_box,
label);
- self->priv->input_bar = create_bar (self, TRUE, TRUE);
- gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->input_bar),
+ self->input_bar = create_bar (self, TRUE, TRUE);
+ gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->input_bar),
_("_Input volume:"));
- gvc_channel_bar_set_low_icon_name (GVC_CHANNEL_BAR (self->priv->input_bar),
+ gvc_channel_bar_set_low_icon_name (GVC_CHANNEL_BAR (self->input_bar),
"audio-input-microphone-low-symbolic");
- gvc_channel_bar_set_high_icon_name (GVC_CHANNEL_BAR (self->priv->input_bar),
+ gvc_channel_bar_set_high_icon_name (GVC_CHANNEL_BAR (self->input_bar),
"audio-input-microphone-high-symbolic");
- gtk_widget_set_sensitive (self->priv->input_bar, FALSE);
- gtk_widget_set_margin_top (self->priv->input_bar, 6);
- gtk_box_pack_start (GTK_BOX (self->priv->input_box),
- self->priv->input_bar,
+ gtk_widget_set_sensitive (self->input_bar, FALSE);
+ gtk_widget_set_margin_top (self->input_bar, 6);
+ gtk_box_pack_start (GTK_BOX (self->input_box),
+ self->input_bar,
FALSE, FALSE, 0);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_pack_start (GTK_BOX (self->priv->input_box),
+ gtk_box_pack_start (GTK_BOX (self->input_box),
box,
FALSE, FALSE, 6);
@@ -1712,26 +1712,26 @@ gvc_mixer_dialog_constructor (GType type,
gtk_box_pack_start (GTK_BOX (sbox),
label,
FALSE, FALSE, 0);
- if (self->priv->size_group != NULL)
- gtk_size_group_add_widget (self->priv->size_group, sbox);
+ if (self->size_group != NULL)
+ gtk_size_group_add_widget (self->size_group, sbox);
- self->priv->input_level_bar = gvc_level_bar_new ();
- gvc_level_bar_set_scale (GVC_LEVEL_BAR (self->priv->input_level_bar),
+ self->input_level_bar = gvc_level_bar_new ();
+ gvc_level_bar_set_scale (GVC_LEVEL_BAR (self->input_level_bar),
GVC_LEVEL_SCALE_LINEAR);
gtk_box_pack_start (GTK_BOX (box),
- self->priv->input_level_bar,
+ self->input_level_bar,
TRUE, TRUE, 6);
ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box),
ebox,
FALSE, FALSE, 0);
- if (self->priv->size_group != NULL)
- gtk_size_group_add_widget (self->priv->size_group, ebox);
+ if (self->size_group != NULL)
+ gtk_size_group_add_widget (self->size_group, ebox);
- self->priv->input_settings_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_pack_start (GTK_BOX (self->priv->input_box),
- self->priv->input_settings_box,
+ self->input_settings_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (self->input_box),
+ self->input_settings_box,
FALSE, FALSE, 0);
box = gtk_frame_new (_("C_hoose a device for sound input:"));
@@ -1739,11 +1739,11 @@ gvc_mixer_dialog_constructor (GType type,
_gtk_label_make_bold (GTK_LABEL (label));
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (self->priv->input_box), box, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (self->input_box), box, TRUE, TRUE, 0);
- self->priv->input_treeview = create_ui_device_treeview (self,
+ self->input_treeview = create_ui_device_treeview (self,
G_CALLBACK (on_input_selection_changed));
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), self->priv->input_treeview);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), self->input_treeview);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -1751,71 +1751,71 @@ gvc_mixer_dialog_constructor (GType type,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (sw), self->priv->input_treeview);
+ gtk_container_add (GTK_CONTAINER (sw), self->input_treeview);
gtk_widget_set_margin_top (sw, 6);
gtk_container_add (GTK_CONTAINER (box), sw);
/* Effects page */
- self->priv->sound_effects_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_container_set_border_width (GTK_CONTAINER (self->priv->sound_effects_box), 12);
+ self->sound_effects_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (self->sound_effects_box), 12);
label = gtk_label_new (_("Sound Effects"));
- gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
- self->priv->sound_effects_box,
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->notebook),
+ self->sound_effects_box,
label);
- self->priv->effects_bar = create_bar (self, TRUE, TRUE);
- gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->effects_bar),
+ self->effects_bar = create_bar (self, TRUE, TRUE);
+ gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->effects_bar),
_("_Alert volume:"));
- gtk_widget_set_sensitive (self->priv->effects_bar, FALSE);
- gtk_box_pack_start (GTK_BOX (self->priv->sound_effects_box),
- self->priv->effects_bar, FALSE, FALSE, 0);
+ gtk_widget_set_sensitive (self->effects_bar, FALSE);
+ gtk_box_pack_start (GTK_BOX (self->sound_effects_box),
+ self->effects_bar, FALSE, FALSE, 0);
- self->priv->sound_theme_chooser = gvc_sound_theme_chooser_new ();
- gtk_box_pack_start (GTK_BOX (self->priv->sound_effects_box),
- self->priv->sound_theme_chooser,
+ self->sound_theme_chooser = gvc_sound_theme_chooser_new ();
+ gtk_box_pack_start (GTK_BOX (self->sound_effects_box),
+ self->sound_theme_chooser,
TRUE, TRUE, 6);
/* Applications */
- self->priv->applications_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_container_set_border_width (GTK_CONTAINER (self->priv->applications_box), 12);
+ self->applications_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (self->applications_box), 12);
label = gtk_label_new (_("Applications"));
- gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
- self->priv->applications_box,
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->notebook),
+ self->applications_box,
label);
- self->priv->no_apps_label = gtk_label_new (_("No application is currently playing or recording audio."));
- gtk_box_pack_start (GTK_BOX (self->priv->applications_box),
- self->priv->no_apps_label,
+ self->no_apps_label = gtk_label_new (_("No application is currently playing or recording audio."));
+ gtk_box_pack_start (GTK_BOX (self->applications_box),
+ self->no_apps_label,
TRUE, TRUE, 0);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"output-added",
G_CALLBACK (on_control_output_added),
self);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"output-removed",
G_CALLBACK (on_control_output_removed),
self);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"input-added",
G_CALLBACK (on_control_input_added),
self);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"input-removed",
G_CALLBACK (on_control_input_removed),
self);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"stream-added",
G_CALLBACK (on_control_stream_added),
self);
- g_signal_connect (self->priv->mixer_control,
+ g_signal_connect (self->mixer_control,
"stream-removed",
G_CALLBACK (on_control_stream_removed),
self);
gtk_widget_show_all (main_vbox);
- streams = gvc_mixer_control_get_streams (self->priv->mixer_control);
+ streams = gvc_mixer_control_get_streams (self->mixer_control);
for (l = streams; l != NULL; l = l->next) {
stream = l->data;
add_stream (self, stream);
@@ -1830,44 +1830,44 @@ gvc_mixer_dialog_dispose (GObject *object)
{
GvcMixerDialog *dialog = GVC_MIXER_DIALOG (object);
- if (dialog->priv->mixer_control != NULL) {
+ if (dialog->mixer_control != NULL) {
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_output_added,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_output_removed,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_input_added,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_input_removed,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_active_input_update,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_active_output_update,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_stream_added,
dialog);
- g_signal_handlers_disconnect_by_func (dialog->priv->mixer_control,
+ g_signal_handlers_disconnect_by_func (dialog->mixer_control,
on_control_stream_removed,
dialog);
- g_object_unref (dialog->priv->mixer_control);
- dialog->priv->mixer_control = NULL;
+ g_object_unref (dialog->mixer_control);
+ dialog->mixer_control = NULL;
}
- if (dialog->priv->bars != NULL) {
- g_hash_table_destroy (dialog->priv->bars);
- dialog->priv->bars = NULL;
+ if (dialog->bars != NULL) {
+ g_hash_table_destroy (dialog->bars);
+ dialog->bars = NULL;
}
- if (dialog->priv->test_dialog != NULL) {
- gtk_dialog_response (GTK_DIALOG (dialog->priv->test_dialog),
+ if (dialog->test_dialog != NULL) {
+ gtk_dialog_response (GTK_DIALOG (dialog->test_dialog),
GTK_RESPONSE_OK);
}
@@ -1892,8 +1892,6 @@ gvc_mixer_dialog_class_init (GvcMixerDialogClass *klass)
"mixer control",
GVC_TYPE_MIXER_CONTROL,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
-
- g_type_class_add_private (klass, sizeof (GvcMixerDialogPrivate));
}
@@ -1902,9 +1900,8 @@ gvc_mixer_dialog_init (GvcMixerDialog *dialog)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (dialog),
GTK_ORIENTATION_VERTICAL);
- dialog->priv = GVC_MIXER_DIALOG_GET_PRIVATE (dialog);
- dialog->priv->bars = g_hash_table_new (NULL, NULL);
- dialog->priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ dialog->bars = g_hash_table_new (NULL, NULL);
+ dialog->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
}
static void
@@ -1917,7 +1914,7 @@ gvc_mixer_dialog_finalize (GObject *object)
mixer_dialog = GVC_MIXER_DIALOG (object);
- g_return_if_fail (mixer_dialog->priv != NULL);
+ g_return_if_fail (mixer_dialog != NULL);
G_OBJECT_CLASS (gvc_mixer_dialog_parent_class)->finalize (object);
}
@@ -1957,7 +1954,7 @@ gvc_mixer_dialog_set_page (GvcMixerDialog *self,
else if (g_str_equal (page, "applications"))
num = PAGE_APPLICATIONS;
- gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), num);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self->notebook), num);
return TRUE;
}
diff --git a/panels/sound/gvc-mixer-dialog.h b/panels/sound/gvc-mixer-dialog.h
index 7efdcd097..5d8b7541d 100644
--- a/panels/sound/gvc-mixer-dialog.h
+++ b/panels/sound/gvc-mixer-dialog.h
@@ -25,27 +25,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_MIXER_DIALOG (gvc_mixer_dialog_get_type ())
-#define GVC_MIXER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_DIALOG, GvcMixerDialog))
-#define GVC_MIXER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_DIALOG, GvcMixerDialogClass))
-#define GVC_IS_MIXER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_DIALOG))
-#define GVC_IS_MIXER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_DIALOG))
-#define GVC_MIXER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_DIALOG, GvcMixerDialogClass))
-
-typedef struct GvcMixerDialogPrivate GvcMixerDialogPrivate;
-
-typedef struct
-{
- GtkVBox parent;
- GvcMixerDialogPrivate *priv;
-} GvcMixerDialog;
-
-typedef struct
-{
- GtkVBoxClass parent_class;
-} GvcMixerDialogClass;
-
-GType gvc_mixer_dialog_get_type (void);
+#define GVC_TYPE_MIXER_DIALOG (gvc_mixer_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (GvcMixerDialog, gvc_mixer_dialog, GVC, MIXER_DIALOG, GtkBox)
GvcMixerDialog * gvc_mixer_dialog_new (GvcMixerControl *control);
gboolean gvc_mixer_dialog_set_page (GvcMixerDialog *dialog, const gchar* page);
diff --git a/panels/sound/gvc-sound-theme-chooser.c b/panels/sound/gvc-sound-theme-chooser.c
index 4d1ac9887..cd63dc951 100644
--- a/panels/sound/gvc-sound-theme-chooser.c
+++ b/panels/sound/gvc-sound-theme-chooser.c
@@ -37,10 +37,9 @@
#include "gvc-sound-theme-chooser.h"
#include "sound-theme-file-utils.h"
-#define GVC_SOUND_THEME_CHOOSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_SOUND_THEME_CHOOSER, GvcSoundThemeChooserPrivate))
-
-struct GvcSoundThemeChooserPrivate
+struct _GvcSoundThemeChooser
{
+ GtkBox parent_instance;
GtkWidget *treeview;
GtkWidget *selection_box;
GSettings *settings;
@@ -290,7 +289,7 @@ update_alert_model (GvcSoundThemeChooser *chooser,
GtkTreeModel *model;
GtkTreeIter iter;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (chooser->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (chooser->treeview));
g_assert (gtk_tree_model_get_iter_first (model, &iter));
do {
char *this_id;
@@ -302,7 +301,7 @@ update_alert_model (GvcSoundThemeChooser *chooser,
if (strcmp (this_id, id) == 0) {
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chooser->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chooser->treeview));
gtk_tree_selection_select_iter (selection, &iter);
}
@@ -321,13 +320,13 @@ save_theme_name (GvcSoundThemeChooser *chooser,
/* special case for no sounds */
if (strcmp (theme_name, NO_SOUNDS_THEME_NAME) == 0) {
- g_settings_set_boolean (chooser->priv->sound_settings, EVENT_SOUNDS_KEY, FALSE);
+ g_settings_set_boolean (chooser->sound_settings, EVENT_SOUNDS_KEY, FALSE);
return;
} else {
- g_settings_set_boolean (chooser->priv->sound_settings, EVENT_SOUNDS_KEY, TRUE);
+ g_settings_set_boolean (chooser->sound_settings, EVENT_SOUNDS_KEY, TRUE);
}
- g_settings_set_string (chooser->priv->sound_settings, SOUND_THEME_KEY, theme_name);
+ g_settings_set_string (chooser->sound_settings, SOUND_THEME_KEY, theme_name);
}
static gboolean
@@ -397,7 +396,7 @@ update_alert (GvcSoundThemeChooser *chooser,
gboolean add_custom;
gboolean remove_custom;
- is_custom = strcmp (chooser->priv->current_theme, CUSTOM_THEME_NAME) == 0;
+ is_custom = strcmp (chooser->current_theme, CUSTOM_THEME_NAME) == 0;
is_default = strcmp (alert_id, DEFAULT_ALERT_ID) == 0;
/* So a few possibilities:
@@ -412,8 +411,8 @@ update_alert (GvcSoundThemeChooser *chooser,
/* remove custom just in case */
remove_custom = TRUE;
} else if (! is_custom && ! is_default) {
- if (chooser->priv->current_parent)
- create_custom_theme (chooser->priv->current_parent);
+ if (chooser->current_parent)
+ create_custom_theme (chooser->current_parent);
else
create_custom_theme (DEFAULT_THEME);
save_alert_sounds (chooser, alert_id);
@@ -433,7 +432,7 @@ update_alert (GvcSoundThemeChooser *chooser,
} else if (remove_custom) {
delete_custom_theme_dir ();
if (is_custom) {
- save_theme_name (chooser, chooser->priv->current_parent);
+ save_theme_name (chooser, chooser->current_parent);
}
}
@@ -449,11 +448,11 @@ play_preview_for_id (GvcSoundThemeChooser *chooser,
/* special case: for the default item on custom themes
* play the alert for the parent theme */
if (strcmp (id, DEFAULT_ALERT_ID) == 0) {
- if (chooser->priv->current_parent != NULL) {
+ if (chooser->current_parent != NULL) {
ca_gtk_play_for_widget (GTK_WIDGET (chooser), 0,
CA_PROP_APPLICATION_NAME, _("Sound Preferences"),
CA_PROP_EVENT_ID, "bell-window-system",
- CA_PROP_CANBERRA_XDG_THEME_NAME, chooser->priv->current_parent,
+ CA_PROP_CANBERRA_XDG_THEME_NAME, chooser->current_parent,
CA_PROP_EVENT_DESCRIPTION, _("Testing event sound"),
CA_PROP_CANBERRA_CACHE_CONTROL, "never",
CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl",
@@ -498,7 +497,7 @@ on_treeview_row_activated (GtkTreeView *treeview,
GtkTreeIter iter;
char *id;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (chooser->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (chooser->treeview));
if (!gtk_tree_model_get_iter (model, &iter, path)) {
return;
}
@@ -630,30 +629,30 @@ update_theme (GvcSoundThemeChooser *chooser)
gboolean events_enabled;
char *last_theme;
- events_enabled = g_settings_get_boolean (chooser->priv->sound_settings, EVENT_SOUNDS_KEY);
+ events_enabled = g_settings_get_boolean (chooser->sound_settings, EVENT_SOUNDS_KEY);
- last_theme = chooser->priv->current_theme;
+ last_theme = chooser->current_theme;
if (events_enabled) {
- chooser->priv->current_theme = g_settings_get_string (chooser->priv->sound_settings, SOUND_THEME_KEY);
+ chooser->current_theme = g_settings_get_string (chooser->sound_settings, SOUND_THEME_KEY);
} else {
- chooser->priv->current_theme = g_strdup (NO_SOUNDS_THEME_NAME);
+ chooser->current_theme = g_strdup (NO_SOUNDS_THEME_NAME);
}
- if (g_strcmp0 (last_theme, chooser->priv->current_theme) != 0) {
- g_clear_pointer (&chooser->priv->current_parent, g_free);
- if (load_theme_name (chooser->priv->current_theme,
- &chooser->priv->current_parent) == FALSE) {
- g_free (chooser->priv->current_theme);
- chooser->priv->current_theme = g_strdup (DEFAULT_THEME);
+ if (g_strcmp0 (last_theme, chooser->current_theme) != 0) {
+ g_clear_pointer (&chooser->current_parent, g_free);
+ if (load_theme_name (chooser->current_theme,
+ &chooser->current_parent) == FALSE) {
+ g_free (chooser->current_theme);
+ chooser->current_theme = g_strdup (DEFAULT_THEME);
load_theme_name (DEFAULT_THEME,
- &chooser->priv->current_parent);
+ &chooser->current_parent);
}
}
g_free (last_theme);
- gtk_widget_set_sensitive (chooser->priv->selection_box, events_enabled);
+ gtk_widget_set_sensitive (chooser->selection_box, events_enabled);
- update_alerts_from_theme_name (chooser, chooser->priv->current_theme);
+ update_alerts_from_theme_name (chooser, chooser->current_theme);
}
static GObject *
@@ -680,8 +679,6 @@ gvc_sound_theme_chooser_class_init (GvcSoundThemeChooserClass *klass)
object_class->constructor = gvc_sound_theme_chooser_constructor;
object_class->finalize = gvc_sound_theme_chooser_finalize;
-
- g_type_class_add_private (klass, sizeof (GvcSoundThemeChooserPrivate));
}
static void
@@ -732,13 +729,12 @@ gvc_sound_theme_chooser_init (GvcSoundThemeChooser *chooser)
gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser),
GTK_ORIENTATION_VERTICAL);
- chooser->priv = GVC_SOUND_THEME_CHOOSER_GET_PRIVATE (chooser);
- chooser->priv->settings = g_settings_new (WM_SCHEMA);
- chooser->priv->sound_settings = g_settings_new (KEY_SOUNDS_SCHEMA);
+ chooser->settings = g_settings_new (WM_SCHEMA);
+ chooser->sound_settings = g_settings_new (KEY_SOUNDS_SCHEMA);
str = g_strdup_printf ("<b>%s</b>", _("C_hoose an alert sound:"));
- chooser->priv->selection_box = box = gtk_frame_new (str);
+ chooser->selection_box = box = gtk_frame_new (str);
g_free (str);
label = gtk_frame_get_label_widget (GTK_FRAME (box));
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
@@ -748,24 +744,24 @@ gvc_sound_theme_chooser_init (GvcSoundThemeChooser *chooser)
gtk_widget_set_margin_top (box, 6);
gtk_box_pack_start (GTK_BOX (chooser), box, TRUE, TRUE, 6);
- chooser->priv->treeview = create_alert_treeview (chooser);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser->priv->treeview);
+ chooser->treeview = create_alert_treeview (chooser);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser->treeview);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- setup_list_size_constraint (scrolled_window, chooser->priv->treeview);
+ setup_list_size_constraint (scrolled_window, chooser->treeview);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (scrolled_window), chooser->priv->treeview);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), chooser->treeview);
gtk_widget_set_margin_top (scrolled_window, 6);
gtk_container_add (GTK_CONTAINER (box), scrolled_window);
- g_signal_connect (G_OBJECT (chooser->priv->sound_settings), "changed",
+ g_signal_connect (G_OBJECT (chooser->sound_settings), "changed",
G_CALLBACK (on_sound_settings_changed), chooser);
- g_signal_connect (chooser->priv->settings, "changed::" AUDIO_BELL_KEY,
+ g_signal_connect (chooser->settings, "changed::" AUDIO_BELL_KEY,
G_CALLBACK (on_audible_bell_changed), chooser);
}
@@ -779,9 +775,9 @@ gvc_sound_theme_chooser_finalize (GObject *object)
sound_theme_chooser = GVC_SOUND_THEME_CHOOSER (object);
- if (sound_theme_chooser->priv != NULL) {
- g_object_unref (sound_theme_chooser->priv->settings);
- g_object_unref (sound_theme_chooser->priv->sound_settings);
+ if (sound_theme_chooser != NULL) {
+ g_object_unref (sound_theme_chooser->settings);
+ g_object_unref (sound_theme_chooser->sound_settings);
}
G_OBJECT_CLASS (gvc_sound_theme_chooser_parent_class)->finalize (object);
diff --git a/panels/sound/gvc-sound-theme-chooser.h b/panels/sound/gvc-sound-theme-chooser.h
index c3d686c5a..122a9f0e5 100644
--- a/panels/sound/gvc-sound-theme-chooser.h
+++ b/panels/sound/gvc-sound-theme-chooser.h
@@ -24,27 +24,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_SOUND_THEME_CHOOSER (gvc_sound_theme_chooser_get_type ())
-#define GVC_SOUND_THEME_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_SOUND_THEME_CHOOSER, GvcSoundThemeChooser))
-#define GVC_SOUND_THEME_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_SOUND_THEME_CHOOSER, GvcSoundThemeChooserClass))
-#define GVC_IS_SOUND_THEME_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_SOUND_THEME_CHOOSER))
-#define GVC_IS_SOUND_THEME_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_SOUND_THEME_CHOOSER))
-#define GVC_SOUND_THEME_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_SOUND_THEME_CHOOSER, GvcSoundThemeChooserClass))
-
-typedef struct GvcSoundThemeChooserPrivate GvcSoundThemeChooserPrivate;
-
-typedef struct
-{
- GtkVBox parent;
- GvcSoundThemeChooserPrivate *priv;
-} GvcSoundThemeChooser;
-
-typedef struct
-{
- GtkVBoxClass parent_class;
-} GvcSoundThemeChooserClass;
-
-GType gvc_sound_theme_chooser_get_type (void);
+#define GVC_TYPE_SOUND_THEME_CHOOSER (gvc_sound_theme_chooser_get_type ())
+G_DECLARE_FINAL_TYPE (GvcSoundThemeChooser, gvc_sound_theme_chooser, GVC, SOUND_THEME_CHOOSER, GtkBox)
GtkWidget * gvc_sound_theme_chooser_new (void);
diff --git a/panels/sound/gvc-speaker-test.c b/panels/sound/gvc-speaker-test.c
index 279a0f6cf..a84ecf28a 100644
--- a/panels/sound/gvc-speaker-test.c
+++ b/panels/sound/gvc-speaker-test.c
@@ -33,10 +33,9 @@
#include "gvc-speaker-test.h"
#include "gvc-mixer-stream.h"
-#define GVC_SPEAKER_TEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_SPEAKER_TEST, GvcSpeakerTestPrivate))
-
-struct GvcSpeakerTestPrivate
+struct _GvcSpeakerTest
{
+ GtkGrid parent_instance;
GtkWidget *channel_controls[PA_CHANNEL_POSITION_MAX];
ca_context *canberra;
GvcMixerStream *stream;
@@ -88,13 +87,13 @@ gvc_speaker_test_set_property (GObject *object,
switch (prop_id) {
case PROP_STREAM:
- self->priv->stream = g_value_dup_object (value);
- if (self->priv->control != NULL)
+ self->stream = g_value_dup_object (value);
+ if (self->control != NULL)
update_channel_map (self);
break;
case PROP_CONTROL:
- self->priv->control = g_value_dup_object (value);
- if (self->priv->stream != NULL)
+ self->control = g_value_dup_object (value);
+ if (self->stream != NULL)
update_channel_map (self);
break;
default:
@@ -113,10 +112,10 @@ gvc_speaker_test_get_property (GObject *object,
switch (prop_id) {
case PROP_STREAM:
- g_value_set_object (value, self->priv->stream);
+ g_value_set_object (value, self->stream);
break;
case PROP_CONTROL:
- g_value_set_object (value, self->priv->control);
+ g_value_set_object (value, self->control);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -147,7 +146,6 @@ gvc_speaker_test_class_init (GvcSpeakerTestClass *klass)
"The mixer controller",
GVC_TYPE_MIXER_CONTROL,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
- g_type_class_add_private (klass, sizeof (GvcSpeakerTestPrivate));
}
static const char *
@@ -365,9 +363,9 @@ create_channel_controls (GvcSpeakerTest *speaker_test)
guint i;
for (i = 0; i < G_N_ELEMENTS (position_table); i += 3) {
- speaker_test->priv->channel_controls[position_table[i]] = channel_control_new (speaker_test->priv->canberra, (pa_channel_position_t) position_table[i]);
+ speaker_test->channel_controls[position_table[i]] = channel_control_new (speaker_test->canberra, (pa_channel_position_t) position_table[i]);
gtk_grid_attach (GTK_GRID (speaker_test),
- speaker_test->priv->channel_controls[position_table[i]],
+ speaker_test->channel_controls[position_table[i]],
position_table[i+1], position_table[i+2], 1, 1);
}
}
@@ -378,19 +376,19 @@ update_channel_map (GvcSpeakerTest *speaker_test)
guint i;
const GvcChannelMap *map;
- g_return_if_fail (speaker_test->priv->control != NULL);
- g_return_if_fail (speaker_test->priv->stream != NULL);
+ g_return_if_fail (speaker_test->control != NULL);
+ g_return_if_fail (speaker_test->stream != NULL);
g_debug ("XXX update_channel_map called XXX");
- map = gvc_mixer_stream_get_channel_map (speaker_test->priv->stream);
+ map = gvc_mixer_stream_get_channel_map (speaker_test->stream);
g_return_if_fail (map != NULL);
- ca_context_change_device (speaker_test->priv->canberra,
- gvc_mixer_stream_get_name (speaker_test->priv->stream));
+ ca_context_change_device (speaker_test->canberra,
+ gvc_mixer_stream_get_name (speaker_test->stream));
for (i = 0; i < G_N_ELEMENTS (position_table); i += 3) {
- gtk_widget_set_visible (speaker_test->priv->channel_controls[position_table[i]],
+ gtk_widget_set_visible (speaker_test->channel_controls[position_table[i]],
gvc_channel_map_has_position(map, position_table[i]));
}
}
@@ -418,14 +416,12 @@ gvc_speaker_test_init (GvcSpeakerTest *speaker_test)
{
GtkWidget *face;
- speaker_test->priv = GVC_SPEAKER_TEST_GET_PRIVATE (speaker_test);
-
- ca_context_create (&speaker_test->priv->canberra);
- ca_context_set_driver (speaker_test->priv->canberra, "pulse");
- ca_context_change_props (speaker_test->priv->canberra,
+ ca_context_create (&speaker_test->canberra);
+ ca_context_set_driver (speaker_test->canberra, "pulse");
+ ca_context_change_props (speaker_test->canberra,
CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl",
NULL);
- gvc_speaker_test_set_theme (speaker_test->priv->canberra);
+ gvc_speaker_test_set_theme (speaker_test->canberra);
gtk_widget_set_direction (GTK_WIDGET (speaker_test), GTK_TEXT_DIR_LTR);
gtk_container_set_border_width (GTK_CONTAINER (speaker_test), 12);
@@ -451,16 +447,16 @@ gvc_speaker_test_finalize (GObject *object)
speaker_test = GVC_SPEAKER_TEST (object);
- g_return_if_fail (speaker_test->priv != NULL);
+ g_return_if_fail (speaker_test != NULL);
- g_object_unref (speaker_test->priv->stream);
- speaker_test->priv->stream = NULL;
+ g_object_unref (speaker_test->stream);
+ speaker_test->stream = NULL;
- g_object_unref (speaker_test->priv->control);
- speaker_test->priv->control = NULL;
+ g_object_unref (speaker_test->control);
+ speaker_test->control = NULL;
- ca_context_destroy (speaker_test->priv->canberra);
- speaker_test->priv->canberra = NULL;
+ ca_context_destroy (speaker_test->canberra);
+ speaker_test->canberra = NULL;
G_OBJECT_CLASS (gvc_speaker_test_parent_class)->finalize (object);
}
diff --git a/panels/sound/gvc-speaker-test.h b/panels/sound/gvc-speaker-test.h
index 6139b01f6..fc5dcc400 100644
--- a/panels/sound/gvc-speaker-test.h
+++ b/panels/sound/gvc-speaker-test.h
@@ -26,27 +26,8 @@
G_BEGIN_DECLS
-#define GVC_TYPE_SPEAKER_TEST (gvc_speaker_test_get_type ())
-#define GVC_SPEAKER_TEST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_SPEAKER_TEST, GvcSpeakerTest))
-#define GVC_SPEAKER_TEST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_SPEAKER_TEST, GvcSpeakerTestClass))
-#define GVC_IS_SPEAKER_TEST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_SPEAKER_TEST))
-#define GVC_IS_SPEAKER_TEST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_SPEAKER_TEST))
-#define GVC_SPEAKER_TEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_SPEAKER_TEST, GvcSpeakerTestClass))
-
-typedef struct GvcSpeakerTestPrivate GvcSpeakerTestPrivate;
-
-typedef struct
-{
- GtkNotebook parent;
- GvcSpeakerTestPrivate *priv;
-} GvcSpeakerTest;
-
-typedef struct
-{
- GtkNotebookClass parent_class;
-} GvcSpeakerTestClass;
-
-GType gvc_speaker_test_get_type (void);
+#define GVC_TYPE_SPEAKER_TEST (gvc_speaker_test_get_type ())
+G_DECLARE_FINAL_TYPE (GvcSpeakerTest, gvc_speaker_test, GVC, SPEAKER_TEST, GtkGrid)
GtkWidget * gvc_speaker_test_new (GvcMixerControl *control,
GvcMixerStream *stream);
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index f0928555e..aa5d726d2 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -33,7 +33,7 @@
#include "zoom-options.h"
-#define WID(w) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, w))
+#define WID(w) GTK_WIDGET (gtk_builder_get_object (self->builder, w))
#define DPI_FACTOR_LARGE 1.25
#define DPI_FACTOR_NORMAL 1.0
@@ -99,10 +99,10 @@
#define SCROLL_HEIGHT 490
-CC_PANEL_REGISTER (CcUaPanel, cc_ua_panel)
-
-struct _CcUaPanelPrivate
+struct _CcUaPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GSettings *wm_settings;
@@ -124,26 +124,28 @@ struct _CcUaPanelPrivate
GSList *toplevels;
};
+CC_PANEL_REGISTER (CcUaPanel, cc_ua_panel)
+
static void
cc_ua_panel_dispose (GObject *object)
{
- CcUaPanelPrivate *priv = CC_UA_PANEL (object)->priv;
+ CcUaPanel *self = CC_UA_PANEL (object);
- g_clear_object (&priv->builder);
- g_slist_free_full (priv->toplevels, (GDestroyNotify)gtk_widget_destroy);
- priv->toplevels = NULL;
+ g_clear_object (&self->builder);
+ g_slist_free_full (self->toplevels, (GDestroyNotify)gtk_widget_destroy);
+ self->toplevels = NULL;
- g_clear_object (&priv->wm_settings);
- g_clear_object (&priv->a11y_settings);
- g_clear_object (&priv->interface_settings);
- g_clear_object (&priv->kb_settings);
- g_clear_object (&priv->mouse_settings);
- g_clear_object (&priv->application_settings);
+ g_clear_object (&self->wm_settings);
+ g_clear_object (&self->a11y_settings);
+ g_clear_object (&self->interface_settings);
+ g_clear_object (&self->kb_settings);
+ g_clear_object (&self->mouse_settings);
+ g_clear_object (&self->application_settings);
- g_clear_object (&priv->zoom_options);
+ g_clear_object (&self->zoom_options);
- g_clear_pointer (&priv->sections, g_list_free);
- g_clear_pointer (&priv->sections_reverse, g_list_free);
+ g_clear_pointer (&self->sections, g_list_free);
+ g_clear_pointer (&self->sections_reverse, g_list_free);
G_OBJECT_CLASS (cc_ua_panel_parent_class)->dispose (object);
}
@@ -160,8 +162,6 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcUaPanelPrivate));
-
panel_class->get_help_uri = cc_ua_panel_get_help_uri;
object_class->dispose = cc_ua_panel_dispose;
@@ -171,11 +171,11 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
static void
zoom_options_launch (CcUaPanel *self)
{
- if (self->priv->zoom_options == NULL)
- self->priv->zoom_options = zoom_options_new ();
+ if (self->zoom_options == NULL)
+ self->zoom_options = zoom_options_new ();
- if (self->priv->zoom_options != NULL)
- zoom_options_set_parent (self->priv->zoom_options,
+ if (self->zoom_options != NULL)
+ zoom_options_set_parent (self->zoom_options,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
}
@@ -184,14 +184,13 @@ static void
cursor_size_toggled (GtkWidget *button,
CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
guint cursor_size;
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
return;
cursor_size = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (button), "cursor-size"));
- g_settings_set_int (priv->interface_settings, KEY_MOUSE_CURSOR_SIZE, cursor_size);
+ g_settings_set_int (self->interface_settings, KEY_MOUSE_CURSOR_SIZE, cursor_size);
g_debug ("Setting cursor size to %d", cursor_size);
}
@@ -200,7 +199,6 @@ cursor_size_setup (CcUaPanel *self)
{
guint cursor_sizes[] = { 24, 32, 48, 64, 96 };
guint current_cursor_size, i;
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *grid;
GtkSizeGroup *size_group;
GtkWidget *last_radio_button = NULL;
@@ -208,7 +206,7 @@ cursor_size_setup (CcUaPanel *self)
grid = WID ("cursor_size_grid");
gtk_style_context_add_class (gtk_widget_get_style_context (grid), "linked");
- current_cursor_size = g_settings_get_int (priv->interface_settings,
+ current_cursor_size = g_settings_get_int (self->interface_settings,
KEY_MOUSE_CURSOR_SIZE);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
@@ -301,23 +299,22 @@ set_contrast_mapping (const GValue *value,
{
gboolean hc;
CcUaPanel *self = user_data;
- CcUaPanelPrivate *priv = self->priv;
GVariant *ret = NULL;
hc = g_value_get_boolean (value);
if (hc)
{
ret = g_variant_new_string (HIGH_CONTRAST_THEME);
- g_settings_set_string (priv->interface_settings, KEY_ICON_THEME, HIGH_CONTRAST_THEME);
+ g_settings_set_string (self->interface_settings, KEY_ICON_THEME, HIGH_CONTRAST_THEME);
- g_settings_set_string (priv->wm_settings, KEY_WM_THEME, HIGH_CONTRAST_THEME);
+ g_settings_set_string (self->wm_settings, KEY_WM_THEME, HIGH_CONTRAST_THEME);
}
else
{
- g_settings_reset (priv->interface_settings, KEY_GTK_THEME);
- g_settings_reset (priv->interface_settings, KEY_ICON_THEME);
+ g_settings_reset (self->interface_settings, KEY_GTK_THEME);
+ g_settings_reset (self->interface_settings, KEY_ICON_THEME);
- g_settings_reset (priv->wm_settings, KEY_WM_THEME);
+ g_settings_reset (self->wm_settings, KEY_WM_THEME);
}
return ret;
@@ -385,15 +382,14 @@ add_separators (GtkListBox *list)
static gboolean
keynav_failed (GtkWidget *list, GtkDirectionType direction, CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GList *item, *sections;
gdouble value, lower, upper, page;
/* Find the list in the list of GtkListBoxes */
if (direction == GTK_DIR_DOWN)
- sections = priv->sections;
+ sections = self->sections;
else
- sections = priv->sections_reverse;
+ sections = self->sections_reverse;
item = g_list_find (sections, list);
g_assert (item);
@@ -403,19 +399,19 @@ keynav_failed (GtkWidget *list, GtkDirectionType direction, CcUaPanel *self)
return TRUE;
}
- value = gtk_adjustment_get_value (priv->focus_adjustment);
- lower = gtk_adjustment_get_lower (priv->focus_adjustment);
- upper = gtk_adjustment_get_upper (priv->focus_adjustment);
- page = gtk_adjustment_get_page_size (priv->focus_adjustment);
+ value = gtk_adjustment_get_value (self->focus_adjustment);
+ lower = gtk_adjustment_get_lower (self->focus_adjustment);
+ upper = gtk_adjustment_get_upper (self->focus_adjustment);
+ page = gtk_adjustment_get_page_size (self->focus_adjustment);
if (direction == GTK_DIR_UP && value > lower)
{
- gtk_adjustment_set_value (priv->focus_adjustment, lower);
+ gtk_adjustment_set_value (self->focus_adjustment, lower);
return TRUE;
}
else if (direction == GTK_DIR_DOWN && value < upper - page)
{
- gtk_adjustment_set_value (priv->focus_adjustment, upper - page);
+ gtk_adjustment_set_value (self->focus_adjustment, upper - page);
return TRUE;
}
@@ -425,24 +421,21 @@ keynav_failed (GtkWidget *list, GtkDirectionType direction, CcUaPanel *self)
static void
add_section (GtkWidget *list, CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
-
g_signal_connect (list, "keynav-failed", G_CALLBACK (keynav_failed), self);
- priv->sections = g_list_append (priv->sections, list);
- priv->sections_reverse = g_list_prepend (priv->sections_reverse, list);
+ self->sections = g_list_append (self->sections, list);
+ self->sections_reverse = g_list_prepend (self->sections_reverse, list);
}
static void
cc_ua_panel_init_status (CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *box;
- box = GTK_WIDGET (gtk_builder_get_object (priv->builder, "section_status"));
- priv->sections_reverse = g_list_prepend (priv->sections_reverse, box);
+ box = GTK_WIDGET (gtk_builder_get_object (self->builder, "section_status"));
+ self->sections_reverse = g_list_prepend (self->sections_reverse, box);
- g_settings_bind (priv->a11y_settings, KEY_ALWAYS_SHOW_STATUS,
+ g_settings_bind (self->a11y_settings, KEY_ALWAYS_SHOW_STATUS,
WID ("switch_status"), "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -509,7 +502,6 @@ activate_row (CcUaPanel *self, GtkListBoxRow *row)
static void
cc_ua_panel_init_seeing (CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *list;
GtkWidget *dialog;
@@ -521,7 +513,7 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
g_signal_connect_swapped (list, "row-activated",
G_CALLBACK (activate_row), self);
- g_settings_bind_with_mapping (priv->interface_settings, KEY_GTK_THEME,
+ g_settings_bind_with_mapping (self->interface_settings, KEY_GTK_THEME,
WID ("value_highcontrast"),
"active", G_SETTINGS_BIND_DEFAULT,
get_contrast_mapping,
@@ -531,26 +523,26 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
/* large text */
- g_settings_bind_with_mapping (priv->interface_settings, KEY_TEXT_SCALING_FACTOR,
+ g_settings_bind_with_mapping (self->interface_settings, KEY_TEXT_SCALING_FACTOR,
WID ("value_large_text"),
"active", G_SETTINGS_BIND_DEFAULT,
get_large_text_mapping,
set_large_text_mapping,
- priv->interface_settings,
+ self->interface_settings,
NULL);
/* cursor size */
cursor_size_setup (self);
- g_settings_bind_with_mapping (priv->interface_settings, KEY_MOUSE_CURSOR_SIZE,
+ g_settings_bind_with_mapping (self->interface_settings, KEY_MOUSE_CURSOR_SIZE,
WID ("value_cursor_size"),
"label", G_SETTINGS_BIND_GET,
cursor_size_label_mapping_get,
NULL, NULL, NULL);
dialog = WID ("cursor_size_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_cursor_size")), "dialog", dialog);
g_signal_connect (dialog, "delete-event",
@@ -558,7 +550,7 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
/* zoom */
- g_settings_bind_with_mapping (priv->application_settings, "screen-magnifier-enabled",
+ g_settings_bind_with_mapping (self->application_settings, "screen-magnifier-enabled",
WID ("value_zoom"),
"label", G_SETTINGS_BIND_GET,
on_off_label_mapping_get,
@@ -568,18 +560,18 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
/* screen reader */
- g_settings_bind_with_mapping (priv->application_settings, "screen-reader-enabled",
+ g_settings_bind_with_mapping (self->application_settings, "screen-reader-enabled",
WID ("value_screen_reader"), "label",
G_SETTINGS_BIND_GET,
on_off_label_mapping_get,
NULL, NULL, NULL);
- g_settings_bind (priv->application_settings, "screen-reader-enabled",
+ g_settings_bind (self->application_settings, "screen-reader-enabled",
WID ("screen_reader_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
dialog = WID ("screen_reader_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_screen_reader")), "dialog", dialog);
g_signal_connect (dialog, "delete-event",
@@ -587,18 +579,18 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
/* sound keys */
- g_settings_bind_with_mapping (priv->kb_settings, KEY_TOGGLEKEYS_ENABLED,
+ g_settings_bind_with_mapping (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
WID ("value_sound_keys"), "label",
G_SETTINGS_BIND_GET,
on_off_label_mapping_get,
NULL, NULL, NULL);
- g_settings_bind (priv->kb_settings, KEY_TOGGLEKEYS_ENABLED,
+ g_settings_bind (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
WID ("sound_keys_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
dialog = WID ("sound_keys_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_sound_keys")), "dialog", dialog);
g_signal_connect (dialog, "delete-event",
@@ -614,7 +606,7 @@ visual_bell_type_notify_cb (GSettings *settings,
GtkWidget *widget;
GDesktopVisualBellType type;
- type = g_settings_get_enum (self->priv->wm_settings, KEY_VISUAL_BELL_TYPE);
+ type = g_settings_get_enum (self->wm_settings, KEY_VISUAL_BELL_TYPE);
if (type == G_DESKTOP_VISUAL_BELL_FRAME_FLASH)
widget = WID ("visual_alerts_window_radio");
@@ -637,7 +629,7 @@ visual_bell_type_toggle_cb (GtkWidget *button,
type = G_DESKTOP_VISUAL_BELL_FRAME_FLASH;
else
type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
- g_settings_set_enum (panel->priv->wm_settings, KEY_VISUAL_BELL_TYPE, type);
+ g_settings_set_enum (panel->wm_settings, KEY_VISUAL_BELL_TYPE, type);
}
static void
@@ -651,7 +643,6 @@ test_flash (GtkButton *button,
static void
cc_ua_panel_init_hearing (CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *list;
GtkWidget *dialog;
@@ -667,11 +658,11 @@ cc_ua_panel_init_hearing (CcUaPanel *self)
visual_bell_type_notify_cb (NULL, NULL, self);
/* and listen */
- g_settings_bind (priv->wm_settings, KEY_VISUAL_BELL_ENABLED,
+ g_settings_bind (self->wm_settings, KEY_VISUAL_BELL_ENABLED,
WID ("visual_alerts_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
- g_settings_bind_with_mapping (priv->wm_settings, KEY_VISUAL_BELL_ENABLED,
+ g_settings_bind_with_mapping (self->wm_settings, KEY_VISUAL_BELL_ENABLED,
WID ("value_visual_alerts"),
"label", G_SETTINGS_BIND_GET,
on_off_label_mapping_get,
@@ -684,13 +675,13 @@ cc_ua_panel_init_hearing (CcUaPanel *self)
WID ("visual_alerts_screen_radio"), "sensitive",
G_BINDING_SYNC_CREATE);
- g_signal_connect (priv->wm_settings, "changed::" KEY_VISUAL_BELL_TYPE,
+ g_signal_connect (self->wm_settings, "changed::" KEY_VISUAL_BELL_TYPE,
G_CALLBACK (visual_bell_type_notify_cb), self);
g_signal_connect (WID ("visual_alerts_window_radio"),
"toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);
dialog = WID ("visual_alerts_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_visual_alerts")), "dialog", dialog);
@@ -740,7 +731,6 @@ update_accessx_label (GSettings *settings, const gchar *key, CcUaPanel *self)
static void
cc_ua_panel_init_keyboard (CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *list;
GtkWidget *w;
GtkWidget *sw;
@@ -756,16 +746,16 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
/* on-screen keyboard */
sw = WID ("screen_keyboard_switch");
- g_settings_bind (priv->application_settings, KEY_SCREEN_KEYBOARD_ENABLED,
+ g_settings_bind (self->application_settings, KEY_SCREEN_KEYBOARD_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
/* Repeat keys */
- g_signal_connect (priv->kb_desktop_settings, "changed",
+ g_signal_connect (self->kb_desktop_settings, "changed",
G_CALLBACK (on_repeat_keys_toggled), self);
dialog = WID ("repeat_keys_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_repeat_keys")), "dialog", dialog);
@@ -773,24 +763,24 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
sw = WID ("repeat_keys_switch");
- g_settings_bind (priv->kb_desktop_settings, KEY_REPEAT_KEYS,
+ g_settings_bind (self->kb_desktop_settings, KEY_REPEAT_KEYS,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
- on_repeat_keys_toggled (priv->kb_desktop_settings, NULL, self);
+ on_repeat_keys_toggled (self->kb_desktop_settings, NULL, self);
- g_settings_bind (priv->kb_desktop_settings, "delay",
+ g_settings_bind (self->kb_desktop_settings, "delay",
gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_keys_delay_scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (priv->kb_desktop_settings, "repeat-interval",
+ g_settings_bind (self->kb_desktop_settings, "repeat-interval",
gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_keys_speed_scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
/* Cursor Blinking */
- g_signal_connect (priv->interface_settings, "changed",
+ g_signal_connect (self->interface_settings, "changed",
G_CALLBACK (on_cursor_blinking_toggled), self);
dialog = WID ("cursor_blinking_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_cursor_blinking")), "dialog", dialog);
@@ -798,97 +788,97 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
sw = WID ("cursor_blinking_switch");
- g_settings_bind (priv->interface_settings, KEY_CURSOR_BLINKING,
+ g_settings_bind (self->interface_settings, KEY_CURSOR_BLINKING,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
- on_cursor_blinking_toggled (priv->interface_settings, NULL, self);
+ on_cursor_blinking_toggled (self->interface_settings, NULL, self);
- g_settings_bind (priv->interface_settings, KEY_CURSOR_BLINKING_TIME,
+ g_settings_bind (self->interface_settings, KEY_CURSOR_BLINKING_TIME,
gtk_range_get_adjustment (GTK_RANGE (WID ("cursor_blinking_scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
/* accessx */
- g_signal_connect (priv->kb_settings, "changed",
+ g_signal_connect (self->kb_settings, "changed",
G_CALLBACK (update_accessx_label), self);
- update_accessx_label (priv->kb_settings, NULL, self);
+ update_accessx_label (self->kb_settings, NULL, self);
/* enable shortcuts */
sw = WID ("typing_keyboard_toggle_switch");
- g_settings_bind (priv->kb_settings, KEY_KEYBOARD_TOGGLE,
+ g_settings_bind (self->kb_settings, KEY_KEYBOARD_TOGGLE,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
/* sticky keys */
sw = WID ("typing_stickykeys_switch");
- g_settings_bind (priv->kb_settings, KEY_STICKYKEYS_ENABLED,
+ g_settings_bind (self->kb_settings, KEY_STICKYKEYS_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("typing_stickykeys_disable_two_keys_check");
- g_settings_bind (priv->kb_settings, KEY_STICKYKEYS_TWO_KEY_OFF,
+ g_settings_bind (self->kb_settings, KEY_STICKYKEYS_TWO_KEY_OFF,
w, "active",
G_SETTINGS_BIND_NO_SENSITIVITY);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("typing_stickykeys_beep_modifier_check");
- g_settings_bind (priv->kb_settings, KEY_STICKYKEYS_MODIFIER_BEEP,
+ g_settings_bind (self->kb_settings, KEY_STICKYKEYS_MODIFIER_BEEP,
w, "active",
G_SETTINGS_BIND_NO_SENSITIVITY);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
/* slow keys */
sw = WID ("typing_slowkeys_switch");
- g_settings_bind (priv->kb_settings, KEY_SLOWKEYS_ENABLED,
+ g_settings_bind (self->kb_settings, KEY_SLOWKEYS_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("typing_slowkeys_delay_scale");
- g_settings_bind (priv->kb_settings, KEY_SLOWKEYS_DELAY,
+ g_settings_bind (self->kb_settings, KEY_SLOWKEYS_DELAY,
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
w = WID ("typing_slowkeys_delay_box");
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("typing_slowkeys_beep_pressed_check");
- g_settings_bind (priv->kb_settings, KEY_SLOWKEYS_BEEP_PRESS,
+ g_settings_bind (self->kb_settings, KEY_SLOWKEYS_BEEP_PRESS,
w, "active",
G_SETTINGS_BIND_DEFAULT);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("typing_slowkeys_beep_accepted_check");
- g_settings_bind (priv->kb_settings, KEY_SLOWKEYS_BEEP_ACCEPT,
+ g_settings_bind (self->kb_settings, KEY_SLOWKEYS_BEEP_ACCEPT,
w, "active",
G_SETTINGS_BIND_DEFAULT);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("typing_slowkeys_beep_rejected_check");
- g_settings_bind (priv->kb_settings, KEY_SLOWKEYS_BEEP_REJECT,
+ g_settings_bind (self->kb_settings, KEY_SLOWKEYS_BEEP_REJECT,
w, "active",
G_SETTINGS_BIND_DEFAULT);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
/* bounce keys */
sw = WID ("typing_bouncekeys_switch");
- g_settings_bind (priv->kb_settings, KEY_BOUNCEKEYS_ENABLED,
+ g_settings_bind (self->kb_settings, KEY_BOUNCEKEYS_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("typing_bouncekeys_delay_scale");
- g_settings_bind (priv->kb_settings, KEY_BOUNCEKEYS_DELAY,
+ g_settings_bind (self->kb_settings, KEY_BOUNCEKEYS_DELAY,
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
w = WID ("typing_bouncekeys_delay_box");
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("typing_bouncekeys_beep_rejected_check");
- g_settings_bind (priv->kb_settings, KEY_BOUNCEKEYS_BEEP_REJECT,
+ g_settings_bind (self->kb_settings, KEY_BOUNCEKEYS_BEEP_REJECT,
w, "active",
G_SETTINGS_BIND_NO_SENSITIVITY);
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
dialog = WID ("typing_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_accessx")), "dialog", dialog);
@@ -912,7 +902,6 @@ update_click_assist_label (GSettings *settings, const gchar *key, CcUaPanel *sel
static void
cc_ua_panel_init_mouse (CcUaPanel *self)
{
- CcUaPanelPrivate *priv = self->priv;
GtkWidget *list;
GtkWidget *dialog;
GtkWidget *sw;
@@ -926,22 +915,22 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
g_signal_connect_swapped (list, "row-activated",
G_CALLBACK (activate_row), self);
- g_settings_bind (priv->kb_settings, KEY_MOUSEKEYS_ENABLED,
+ g_settings_bind (self->kb_settings, KEY_MOUSEKEYS_ENABLED,
WID ("mouse_keys_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
- g_signal_connect (priv->mouse_settings, "changed",
+ g_signal_connect (self->mouse_settings, "changed",
G_CALLBACK (update_click_assist_label), self);
- update_click_assist_label (priv->mouse_settings, NULL, self);
+ update_click_assist_label (self->mouse_settings, NULL, self);
/* simulated secondary click */
sw = WID ("pointing_secondary_click_switch");
- g_settings_bind (priv->mouse_settings, KEY_SECONDARY_CLICK_ENABLED,
+ g_settings_bind (self->mouse_settings, KEY_SECONDARY_CLICK_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("pointing_secondary_click_delay_scale");
- g_settings_bind (priv->mouse_settings, KEY_SECONDARY_CLICK_TIME,
+ g_settings_bind (self->mouse_settings, KEY_SECONDARY_CLICK_TIME,
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
w = WID ("pointing_secondary_click_delay_box");
@@ -949,30 +938,30 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
/* dwell click */
sw = WID ("pointing_hover_click_switch");
- g_settings_bind (priv->mouse_settings, KEY_DWELL_CLICK_ENABLED,
+ g_settings_bind (self->mouse_settings, KEY_DWELL_CLICK_ENABLED,
sw, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("pointing_dwell_delay_scale");
- g_settings_bind (priv->mouse_settings, KEY_DWELL_TIME,
+ g_settings_bind (self->mouse_settings, KEY_DWELL_TIME,
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
w = WID ("pointing_dwell_delay_box");
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
w = WID ("pointing_dwell_threshold_scale");
- g_settings_bind (priv->mouse_settings, KEY_DWELL_THRESHOLD,
+ g_settings_bind (self->mouse_settings, KEY_DWELL_THRESHOLD,
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
w = WID ("pointing_dwell_threshold_box");
g_object_bind_property (sw, "active", w, "sensitive", G_BINDING_SYNC_CREATE);
dialog = WID ("pointing_dialog");
- priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+ self->toplevels = g_slist_prepend (self->toplevels, dialog);
g_object_set_data (G_OBJECT (WID ("row_click_assist")), "dialog", dialog);
- g_settings_bind (priv->gsd_mouse_settings, "double-click",
+ g_settings_bind (self->gsd_mouse_settings, "double-click",
gtk_range_get_adjustment (GTK_RANGE (WID ("scale_double_click_delay"))), "value",
G_SETTINGS_BIND_DEFAULT);
@@ -985,27 +974,22 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
static void
cc_ua_panel_init (CcUaPanel *self)
{
- CcUaPanelPrivate *priv;
GtkWidget *panel;
GtkWidget *content;
- priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- CC_TYPE_UA_PANEL,
- CcUaPanelPrivate);
-
g_resources_register (cc_universal_access_get_resource ());
- priv->interface_settings = g_settings_new (INTERFACE_SETTINGS);
- priv->a11y_settings = g_settings_new (A11Y_SETTINGS);
- priv->wm_settings = g_settings_new (WM_SETTINGS);
- priv->kb_settings = g_settings_new (KEYBOARD_SETTINGS);
- priv->kb_desktop_settings = g_settings_new (KEYBOARD_DESKTOP_SETTINGS);
- priv->mouse_settings = g_settings_new (MOUSE_SETTINGS);
- priv->gsd_mouse_settings = g_settings_new (GSD_MOUSE_SETTINGS);
- priv->application_settings = g_settings_new (APPLICATION_SETTINGS);
+ self->interface_settings = g_settings_new (INTERFACE_SETTINGS);
+ self->a11y_settings = g_settings_new (A11Y_SETTINGS);
+ self->wm_settings = g_settings_new (WM_SETTINGS);
+ self->kb_settings = g_settings_new (KEYBOARD_SETTINGS);
+ self->kb_desktop_settings = g_settings_new (KEYBOARD_DESKTOP_SETTINGS);
+ self->mouse_settings = g_settings_new (MOUSE_SETTINGS);
+ self->gsd_mouse_settings = g_settings_new (GSD_MOUSE_SETTINGS);
+ self->application_settings = g_settings_new (APPLICATION_SETTINGS);
- priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (priv->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/universal-access/uap.ui",
NULL);
@@ -1021,8 +1005,8 @@ cc_ua_panel_init (CcUaPanel *self)
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (panel), SCROLL_HEIGHT);
- priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (panel));
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (content), priv->focus_adjustment);
+ self->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (panel));
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (content), self->focus_adjustment);
gtk_container_add (GTK_CONTAINER (self), panel);
}
diff --git a/panels/universal-access/cc-ua-panel.h b/panels/universal-access/cc-ua-panel.h
index 463db144f..b8c467eaf 100644
--- a/panels/universal-access/cc-ua-panel.h
+++ b/panels/universal-access/cc-ua-panel.h
@@ -27,45 +27,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_UA_PANEL cc_ua_panel_get_type()
-
-#define CC_UA_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_UA_PANEL, CcUaPanel))
-
-#define CC_UA_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_UA_PANEL, CcUaPanelClass))
-
-#define CC_IS_UA_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_UA_PANEL))
-
-#define CC_IS_UA_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_UA_PANEL))
-
-#define CC_UA_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_UA_PANEL, CcUaPanelClass))
-
-typedef struct _CcUaPanel CcUaPanel;
-typedef struct _CcUaPanelClass CcUaPanelClass;
-typedef struct _CcUaPanelPrivate CcUaPanelPrivate;
-
-struct _CcUaPanel
-{
- CcPanel parent;
-
- CcUaPanelPrivate *priv;
-};
-
-struct _CcUaPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_ua_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_UA_PANEL (cc_ua_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcUaPanel, cc_ua_panel, CC, UA_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/universal-access/zoom-options.c b/panels/universal-access/zoom-options.c
index 0c052314f..d1207df76 100644
--- a/panels/universal-access/zoom-options.c
+++ b/panels/universal-access/zoom-options.c
@@ -23,28 +23,30 @@
#include <glib/gi18n.h>
#include <string.h>
-#define WID(w) (GtkWidget *) gtk_builder_get_object (priv->builder, w)
+#define WID(w) (GtkWidget *) gtk_builder_get_object (self->builder, w)
#define POSITION_MODEL_VALUE_COLUMN 2
#define FONT_SCALE 1.25
-struct _ZoomOptionsPrivate
+struct _ZoomOptions
{
+ GObject parent_instance;
+
GtkBuilder *builder;
- GSettings *settings;
- GSettings *application_settings;
-
- GtkWidget *position_combobox;
- GtkWidget *follow_mouse_radio;
- GtkWidget *screen_part_radio;
- GtkWidget *centered_radio;
- GtkWidget *push_radio;
- GtkWidget *proportional_radio;
- GtkWidget *extend_beyond_checkbox;
- GtkWidget *brightness_slider;
- GtkWidget *contrast_slider;
-
- GtkWidget *dialog;
+ GSettings *settings;
+ GSettings *application_settings;
+
+ GtkWidget *position_combobox;
+ GtkWidget *follow_mouse_radio;
+ GtkWidget *screen_part_radio;
+ GtkWidget *centered_radio;
+ GtkWidget *push_radio;
+ GtkWidget *proportional_radio;
+ GtkWidget *extend_beyond_checkbox;
+ GtkWidget *brightness_slider;
+ GtkWidget *contrast_slider;
+
+ GtkWidget *dialog;
};
G_DEFINE_TYPE (ZoomOptions, zoom_options, G_TYPE_OBJECT);
@@ -63,33 +65,33 @@ static gchar *contrast_keys[] = {
NULL
};
-static void set_enable_screen_part_ui (GtkWidget *widget, ZoomOptionsPrivate *priv);
-static void mouse_tracking_notify_cb (GSettings *settings, const gchar *key, ZoomOptionsPrivate *priv);
+static void set_enable_screen_part_ui (GtkWidget *widget, ZoomOptions *self);
+static void mouse_tracking_notify_cb (GSettings *settings, const gchar *key, ZoomOptions *self);
static void scale_label (GtkBin *toggle, PangoAttrList *attrs);
-static void xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptionsPrivate *priv);
+static void xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptions *self);
static void xhairs_length_add_marks (GtkScale *scale);
static void effects_slider_set_value (GtkRange *slider, GSettings *settings);
-static void brightness_slider_notify_cb (GSettings *settings, const gchar *key, ZoomOptionsPrivate *priv);
-static void contrast_slider_notify_cb (GSettings *settings, const gchar *key, ZoomOptionsPrivate *priv);
-static void effects_slider_changed (GtkRange *slider, ZoomOptionsPrivate *priv);
+static void brightness_slider_notify_cb (GSettings *settings, const gchar *key, ZoomOptions *self);
+static void contrast_slider_notify_cb (GSettings *settings, const gchar *key, ZoomOptions *self);
+static void effects_slider_changed (GtkRange *slider, ZoomOptions *self);
static void
-mouse_tracking_radio_toggled_cb (GtkWidget *widget, ZoomOptionsPrivate *priv)
+mouse_tracking_radio_toggled_cb (GtkWidget *widget, ZoomOptions *self)
{
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) == TRUE)
- {
- g_settings_set_string (priv->settings, "mouse-tracking",
- gtk_buildable_get_name (GTK_BUILDABLE (widget)));
- }
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) == TRUE)
+ {
+ g_settings_set_string (self->settings, "mouse-tracking",
+ gtk_buildable_get_name (GTK_BUILDABLE (widget)));
+ }
}
static void
-init_mouse_mode_radio_group (GSList *mode_group, ZoomOptionsPrivate *priv)
+init_mouse_mode_radio_group (GSList *mode_group, ZoomOptions *self)
{
gchar *mode;
gchar *name;
- mode = g_settings_get_string (priv->settings, "mouse-tracking");
+ mode = g_settings_get_string (self->settings, "mouse-tracking");
for (; mode_group != NULL; mode_group = mode_group->next)
{
name = (gchar *) gtk_buildable_get_name (GTK_BUILDABLE (mode_group->data));
@@ -99,95 +101,95 @@ init_mouse_mode_radio_group (GSList *mode_group, ZoomOptionsPrivate *priv)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_group->data), FALSE);
g_signal_connect (G_OBJECT (mode_group->data), "toggled",
- G_CALLBACK(mouse_tracking_radio_toggled_cb),
- priv);
+ G_CALLBACK(mouse_tracking_radio_toggled_cb),
+ self);
}
}
static void
-init_screen_part_section (ZoomOptionsPrivate *priv, PangoAttrList *pango_attrs)
+init_screen_part_section (ZoomOptions *self, PangoAttrList *pango_attrs)
{
gboolean lens_mode;
GSList *mouse_mode_group;
- priv->follow_mouse_radio = WID ("moveableLens");
- priv->screen_part_radio = WID ("screenPart");
- priv->centered_radio = WID ("centered");
- priv->push_radio = WID ("push");
- priv->proportional_radio = WID ("proportional");
- priv->extend_beyond_checkbox = WID ("scrollAtEdges");
+ self->follow_mouse_radio = WID ("moveableLens");
+ self->screen_part_radio = WID ("screenPart");
+ self->centered_radio = WID ("centered");
+ self->push_radio = WID ("push");
+ self->proportional_radio = WID ("proportional");
+ self->extend_beyond_checkbox = WID ("scrollAtEdges");
/* Scale the labels of the toggles */
- scale_label (GTK_BIN(priv->follow_mouse_radio), pango_attrs);
- scale_label (GTK_BIN(priv->screen_part_radio), pango_attrs);
- scale_label (GTK_BIN(priv->centered_radio), pango_attrs);
- scale_label (GTK_BIN(priv->push_radio), pango_attrs);
- scale_label (GTK_BIN(priv->proportional_radio), pango_attrs);
- scale_label (GTK_BIN(priv->extend_beyond_checkbox), pango_attrs);
-
- lens_mode = g_settings_get_boolean (priv->settings, "lens-mode");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->follow_mouse_radio), lens_mode);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->screen_part_radio), !lens_mode);
-
- mouse_mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (priv->centered_radio));
- init_mouse_mode_radio_group (mouse_mode_group, priv);
- set_enable_screen_part_ui (priv->screen_part_radio, priv);
-
- g_settings_bind (priv->settings, "lens-mode",
- priv->follow_mouse_radio, "active",
+ scale_label (GTK_BIN(self->follow_mouse_radio), pango_attrs);
+ scale_label (GTK_BIN(self->screen_part_radio), pango_attrs);
+ scale_label (GTK_BIN(self->centered_radio), pango_attrs);
+ scale_label (GTK_BIN(self->push_radio), pango_attrs);
+ scale_label (GTK_BIN(self->proportional_radio), pango_attrs);
+ scale_label (GTK_BIN(self->extend_beyond_checkbox), pango_attrs);
+
+ lens_mode = g_settings_get_boolean (self->settings, "lens-mode");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->follow_mouse_radio), lens_mode);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->screen_part_radio), !lens_mode);
+
+ mouse_mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (self->centered_radio));
+ init_mouse_mode_radio_group (mouse_mode_group, self);
+ set_enable_screen_part_ui (self->screen_part_radio, self);
+
+ g_settings_bind (self->settings, "lens-mode",
+ self->follow_mouse_radio, "active",
G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (priv->settings, "scroll-at-edges",
- priv->extend_beyond_checkbox, "active",
+ g_settings_bind (self->settings, "scroll-at-edges",
+ self->extend_beyond_checkbox, "active",
G_SETTINGS_BIND_DEFAULT);
- g_signal_connect (G_OBJECT (priv->screen_part_radio), "toggled",
- G_CALLBACK (set_enable_screen_part_ui), priv);
+ g_signal_connect (G_OBJECT (self->screen_part_radio), "toggled",
+ G_CALLBACK (set_enable_screen_part_ui), self);
- g_signal_connect (G_OBJECT (priv->settings), "changed::mouse-tracking",
- G_CALLBACK (mouse_tracking_notify_cb), priv);
+ g_signal_connect (G_OBJECT (self->settings), "changed::mouse-tracking",
+ G_CALLBACK (mouse_tracking_notify_cb), self);
}
static void
-set_enable_screen_part_ui (GtkWidget *widget, ZoomOptionsPrivate *priv)
+set_enable_screen_part_ui (GtkWidget *widget, ZoomOptions *self)
{
gboolean screen_part;
/* If the "screen part" radio is not checked, then the "follow mouse" radio
* is checked (== lens mode). Set mouse tracking back to the default.
*/
- screen_part = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->screen_part_radio));
+ screen_part = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->screen_part_radio));
if (!screen_part)
{
- g_settings_set_string (priv->settings,
+ g_settings_set_string (self->settings,
"mouse-tracking", "proportional");
}
- gtk_widget_set_sensitive (priv->centered_radio, screen_part);
- gtk_widget_set_sensitive (priv->push_radio, screen_part);
- gtk_widget_set_sensitive (priv->proportional_radio, screen_part);
- gtk_widget_set_sensitive (priv->extend_beyond_checkbox, screen_part);
+ gtk_widget_set_sensitive (self->centered_radio, screen_part);
+ gtk_widget_set_sensitive (self->push_radio, screen_part);
+ gtk_widget_set_sensitive (self->proportional_radio, screen_part);
+ gtk_widget_set_sensitive (self->extend_beyond_checkbox, screen_part);
}
static void
-mouse_tracking_notify_cb (GSettings *settings,
- const gchar *key,
- ZoomOptionsPrivate *priv)
+mouse_tracking_notify_cb (GSettings *settings,
+ const gchar *key,
+ ZoomOptions *self)
{
gchar *tracking;
tracking = g_settings_get_string (settings, key);
if (g_strcmp0 (tracking, "proportional") == 0)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->proportional_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->proportional_radio), TRUE);
}
else if (g_strcmp0 (tracking, "centered") == 0)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->centered_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->centered_radio), TRUE);
}
else
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->push_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->push_radio), TRUE);
}
}
@@ -203,7 +205,6 @@ scale_label (GtkBin *toggle, PangoAttrList *attrs)
static void
screen_position_combo_changed_cb (GtkWidget *combobox, ZoomOptions *options)
{
- ZoomOptionsPrivate *priv = options->priv;
gchar *combo_value = NULL;
GtkTreeIter iter;
@@ -215,7 +216,7 @@ screen_position_combo_changed_cb (GtkWidget *combobox, ZoomOptions *options)
if (g_strcmp0 (combo_value, ""))
{
- g_settings_set_string (priv->settings, "screen-position", combo_value);
+ g_settings_set_string (options->settings, "screen-position", combo_value);
}
g_free (combo_value);
@@ -224,9 +225,8 @@ screen_position_combo_changed_cb (GtkWidget *combobox, ZoomOptions *options)
static void
screen_position_notify_cb (GSettings *settings,
const gchar *key,
- ZoomOptions *options)
+ ZoomOptions *self)
{
- ZoomOptionsPrivate *priv = options->priv;
gchar *position;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -235,7 +235,7 @@ screen_position_notify_cb (GSettings *settings,
gchar *combo_value;
position = g_settings_get_string (settings, key);
- position = g_settings_get_string (priv->settings, key);
+ position = g_settings_get_string (self->settings, key);
combobox = GTK_COMBO_BOX (WID ("screen_position_combo_box"));
model = gtk_combo_box_get_model (combobox);
@@ -250,9 +250,9 @@ screen_position_notify_cb (GSettings *settings,
-1);
if (!g_strcmp0 (combo_value, position))
{
- g_signal_handlers_block_by_func (combobox, screen_position_combo_changed_cb, priv);
+ g_signal_handlers_block_by_func (combobox, screen_position_combo_changed_cb, self);
gtk_combo_box_set_active_iter (combobox, &iter);
- g_signal_handlers_unblock_by_func (combobox, screen_position_combo_changed_cb, priv);
+ g_signal_handlers_unblock_by_func (combobox, screen_position_combo_changed_cb, self);
g_free (combo_value);
break;
}
@@ -295,7 +295,7 @@ xhairs_opacity_notify_cb (GSettings *settings, gchar *key, GtkColorButton *butto
#define TO_HEX(x) (int) ((gdouble) x * 255.0)
static void
-xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptionsPrivate *priv)
+xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptions *self)
{
GdkRGBA rgba;
gchar *color_string;
@@ -306,10 +306,10 @@ xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptionsPrivate *priv)
TO_HEX(rgba.green),
TO_HEX(rgba.blue));
- g_settings_set_string (priv->settings, "cross-hairs-color", color_string);
+ g_settings_set_string (self->settings, "cross-hairs-color", color_string);
g_free (color_string);
- g_settings_set_double (priv->settings, "cross-hairs-opacity", rgba.alpha);
+ g_settings_set_double (self->settings, "cross-hairs-opacity", rgba.alpha);
}
static void xhairs_length_add_marks (GtkScale *scale)
@@ -339,7 +339,7 @@ static void xhairs_length_add_marks (GtkScale *scale)
static void
init_effects_slider (GtkRange *slider,
- ZoomOptionsPrivate *priv,
+ ZoomOptions *self,
gchar **keys,
GCallback notify_cb)
{
@@ -347,17 +347,17 @@ init_effects_slider (GtkRange *slider,
gchar *signal;
g_object_set_data (G_OBJECT (slider), "settings-keys", keys);
- effects_slider_set_value (slider, priv->settings);
+ effects_slider_set_value (slider, self->settings);
for (key = keys; *key; key++)
{
signal = g_strdup_printf ("changed::%s", *key);
- g_signal_connect (G_OBJECT (priv->settings), signal, notify_cb, priv);
+ g_signal_connect (G_OBJECT (self->settings), signal, notify_cb, self);
g_free (signal);
}
g_signal_connect (G_OBJECT (slider), "value-changed",
G_CALLBACK (effects_slider_changed),
- priv);
+ self);
gtk_scale_add_mark (GTK_SCALE (slider), 0, GTK_POS_BOTTOM, NULL);
}
@@ -386,29 +386,29 @@ effects_slider_set_value (GtkRange *slider, GSettings *settings)
static void
brightness_slider_notify_cb (GSettings *settings,
const gchar *key,
- ZoomOptionsPrivate *priv)
+ ZoomOptions *self)
{
- GtkRange *slider = GTK_RANGE (priv->brightness_slider);
+ GtkRange *slider = GTK_RANGE (self->brightness_slider);
- g_signal_handlers_block_by_func (slider, effects_slider_changed, priv);
+ g_signal_handlers_block_by_func (slider, effects_slider_changed, self);
effects_slider_set_value (slider, settings);
- g_signal_handlers_unblock_by_func (slider, effects_slider_changed, priv);
+ g_signal_handlers_unblock_by_func (slider, effects_slider_changed, self);
}
static void
contrast_slider_notify_cb (GSettings *settings,
const gchar *key,
- ZoomOptionsPrivate *priv)
+ ZoomOptions *self)
{
- GtkRange *slider = GTK_RANGE (priv->contrast_slider);
+ GtkRange *slider = GTK_RANGE (self->contrast_slider);
- g_signal_handlers_block_by_func (slider, effects_slider_changed, priv);
+ g_signal_handlers_block_by_func (slider, effects_slider_changed, self);
effects_slider_set_value (slider, settings);
- g_signal_handlers_unblock_by_func (slider, effects_slider_changed, priv);
+ g_signal_handlers_unblock_by_func (slider, effects_slider_changed, self);
}
static void
-effects_slider_changed (GtkRange *slider, ZoomOptionsPrivate *priv)
+effects_slider_changed (GtkRange *slider, ZoomOptions *self)
{
gchar **keys, **key;
gdouble value;
@@ -418,7 +418,7 @@ effects_slider_changed (GtkRange *slider, ZoomOptionsPrivate *priv)
for (key = keys; *key; key++)
{
- g_settings_set_double (priv->settings, *key, value);
+ g_settings_set_double (self->settings, *key, value);
}
}
@@ -427,26 +427,26 @@ zoom_options_dispose (GObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (ZOOM_IS_OPTIONS (object));
- ZoomOptionsPrivate *priv = ZOOM_OPTIONS (object)->priv;
+ ZoomOptions *self = ZOOM_OPTIONS (object);
- if (priv->builder)
+ if (self->builder)
{
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->settings)
+ if (self->settings)
{
- g_object_unref (priv->settings);
- priv->settings = NULL;
+ g_object_unref (self->settings);
+ self->settings = NULL;
}
- g_clear_object (&priv->application_settings);
+ g_clear_object (&self->application_settings);
- if (priv->dialog)
+ if (self->dialog)
{
- gtk_widget_destroy (priv->dialog);
- priv->dialog = NULL;
+ gtk_widget_destroy (self->dialog);
+ self->dialog = NULL;
}
G_OBJECT_CLASS (zoom_options_parent_class)->dispose (object);
@@ -465,23 +465,18 @@ zoom_options_class_init (ZoomOptionsClass *klass)
object_class->dispose = zoom_options_dispose;
object_class->finalize = zoom_options_finalize;
-
- g_type_class_add_private (klass, sizeof (ZoomOptionsPrivate));
}
static void
zoom_options_init (ZoomOptions *self)
{
- ZoomOptionsPrivate *priv;
GtkWidget *w;
PangoAttrList *pango_attrs;
PangoAttribute *attr;
GError *err = NULL;
- priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ZOOM_TYPE_OPTIONS, ZoomOptionsPrivate);
-
- priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (priv->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/universal-access/zoom-options.ui",
&err);
if (err)
@@ -489,100 +484,100 @@ zoom_options_init (ZoomOptions *self)
g_warning ("Could not load interface file: %s", err->message);
g_error_free (err);
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ g_object_unref (self->builder);
+ self->builder = NULL;
return;
}
- priv->settings = g_settings_new ("org.gnome.desktop.a11y.magnifier");
- priv->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
+ self->settings = g_settings_new ("org.gnome.desktop.a11y.magnifier");
+ self->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
pango_attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (FONT_SCALE);
pango_attr_list_insert (pango_attrs, attr);
/* Zoom switch */
- g_settings_bind (priv->application_settings, "screen-magnifier-enabled",
+ g_settings_bind (self->application_settings, "screen-magnifier-enabled",
WID ("seeing_zoom_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
/* Magnification factor */
w = WID ("magFactorSpinButton");
- g_settings_bind (priv->settings, "mag-factor",
+ g_settings_bind (self->settings, "mag-factor",
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
"value", G_SETTINGS_BIND_DEFAULT);
/* Screen position combo */
w = WID ("screen_position_combo_box");
- screen_position_notify_cb (priv->settings, "screen-position", self);
- g_signal_connect (G_OBJECT (priv->settings), "changed::screen-position",
+ screen_position_notify_cb (self->settings, "screen-position", self);
+ g_signal_connect (G_OBJECT (self->settings), "changed::screen-position",
G_CALLBACK (screen_position_notify_cb), self);
g_signal_connect (G_OBJECT (w), "changed",
G_CALLBACK (screen_position_combo_changed_cb), self);
/* Screen part section */
- init_screen_part_section (priv, pango_attrs);
+ init_screen_part_section (self, pango_attrs);
/* Cross hairs: show/hide ... */
w = WID ("xhairsEnabledSwitch");
- g_settings_bind (priv->settings, "show-cross-hairs", w, "active",
+ g_settings_bind (self->settings, "show-cross-hairs", w, "active",
G_SETTINGS_BIND_DEFAULT);
/* ... Cross hairs: color and opacity */
w = WID ("xHairsPicker");
- init_xhairs_color_opacity (GTK_COLOR_BUTTON (w), priv->settings);
- g_signal_connect (G_OBJECT (priv->settings), "changed::cross-hairs-color",
+ init_xhairs_color_opacity (GTK_COLOR_BUTTON (w), self->settings);
+ g_signal_connect (G_OBJECT (self->settings), "changed::cross-hairs-color",
G_CALLBACK (xhairs_color_notify_cb), w);
- g_signal_connect (G_OBJECT (priv->settings), "changed::cross-hairs-opacity",
+ g_signal_connect (G_OBJECT (self->settings), "changed::cross-hairs-opacity",
G_CALLBACK (xhairs_opacity_notify_cb), w);
g_signal_connect (G_OBJECT (w), "color-set",
G_CALLBACK (xhairs_color_opacity_changed),
- priv);
+ self);
/* ... Cross hairs: thickness ... */
w = WID ("xHairsThicknessSlider");
- g_settings_bind (priv->settings, "cross-hairs-thickness",
+ g_settings_bind (self->settings, "cross-hairs-thickness",
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
/* ... Cross hairs: clip ... */
w = WID ("xHairsClipCheckbox");
scale_label (GTK_BIN(w), pango_attrs);
- g_settings_bind (priv->settings, "cross-hairs-clip", w, "active",
+ g_settings_bind (self->settings, "cross-hairs-clip", w, "active",
G_SETTINGS_BIND_INVERT_BOOLEAN);
/* ... Cross hairs: length ... */
w = WID ("xHairsLengthSlider");
xhairs_length_add_marks (GTK_SCALE (w));
- g_settings_bind (priv->settings, "cross-hairs-length",
+ g_settings_bind (self->settings, "cross-hairs-length",
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
/* ... Color effects ... */
w = WID ("inverseEnabledSwitch");
- g_settings_bind (priv->settings, "invert-lightness", w, "active",
+ g_settings_bind (self->settings, "invert-lightness", w, "active",
G_SETTINGS_BIND_DEFAULT);
w = WID ("brightnessSlider");
- priv->brightness_slider = w;
- init_effects_slider (GTK_RANGE(w), priv, brightness_keys,
+ self->brightness_slider = w;
+ init_effects_slider (GTK_RANGE(w), self, brightness_keys,
G_CALLBACK (brightness_slider_notify_cb));
w = WID ("contrastSlider");
- priv->contrast_slider = w;
- init_effects_slider (GTK_RANGE(w), priv, contrast_keys,
+ self->contrast_slider = w;
+ init_effects_slider (GTK_RANGE(w), self, contrast_keys,
G_CALLBACK (contrast_slider_notify_cb));
w = WID ("grayscale_slider");
- g_settings_bind (priv->settings, "color-saturation",
+ g_settings_bind (self->settings, "color-saturation",
gtk_range_get_adjustment (GTK_RANGE (w)), "value",
G_SETTINGS_BIND_DEFAULT);
gtk_scale_add_mark (GTK_SCALE(w), 1.0, GTK_POS_BOTTOM, NULL);
/* ... Window itself ... */
- priv->dialog = WID ("magPrefsDialog");
+ self->dialog = WID ("magPrefsDialog");
- g_signal_connect (G_OBJECT (priv->dialog), "delete-event",
+ g_signal_connect (G_OBJECT (self->dialog), "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete),
NULL);
@@ -602,9 +597,9 @@ zoom_options_set_parent (ZoomOptions *self,
{
g_return_if_fail (ZOOM_IS_OPTIONS (self));
- gtk_window_set_transient_for (GTK_WINDOW (self->priv->dialog), parent);
- gtk_window_set_modal (GTK_WINDOW (self->priv->dialog), TRUE);
- gtk_widget_show (self->priv->dialog);
+ gtk_window_set_transient_for (GTK_WINDOW (self->dialog), parent);
+ gtk_window_set_modal (GTK_WINDOW (self->dialog), TRUE);
+ gtk_widget_show (self->dialog);
}
ZoomOptions *
diff --git a/panels/universal-access/zoom-options.h b/panels/universal-access/zoom-options.h
index 0dd54858d..683bab069 100644
--- a/panels/universal-access/zoom-options.h
+++ b/panels/universal-access/zoom-options.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-typedef struct _ZoomOptions ZoomOptions;
-typedef struct _ZoomOptionsClass ZoomOptionsClass;
-typedef struct _ZoomOptionsPrivate ZoomOptionsPrivate;
-
#define ZOOM_TYPE_OPTIONS (zoom_options_get_type ())
-
-#define ZOOM_OPTIONS(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- ZOOM_TYPE_OPTIONS, ZoomOptions))
-
-#define ZOOM_OPTIONS_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- ZOOM_TYPE_OPTIONS, ZoomOptionsClass))
-
-#define ZOOM_IS_OPTIONS(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- ZOOM_TYPE_OPTIONS))
-
-#define ZOOM_IS_OPTIONS_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- ZOOM_TYPE_OPTIONS))
-
-#define ZOOM_OPTIONS_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- ZOOM_TYPE_OPTIONS, ZoomOptionsClass))
-
-struct _ZoomOptionsClass
-{
- GObjectClass parent_class;
-};
-
-struct _ZoomOptions
-{
- GObject parent;
-
- ZoomOptionsPrivate *priv;
-};
-
-GType zoom_options_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (ZoomOptions, zoom_options, ZOOM, OPTIONS, GObject)
ZoomOptions *zoom_options_new (void);
void zoom_options_set_parent (ZoomOptions *self,
diff --git a/panels/user-accounts/cc-crop-area.c b/panels/user-accounts/cc-crop-area.c
index b0e6f2191..6cdb1f5f8 100644
--- a/panels/user-accounts/cc-crop-area.c
+++ b/panels/user-accounts/cc-crop-area.c
@@ -28,7 +28,9 @@
#include "cc-crop-area.h"
-struct _CcCropAreaPrivate {
+struct _CcCropArea {
+ GtkDrawingArea parent_instance;
+
GdkPixbuf *browse_pixbuf;
GdkPixbuf *pixbuf;
GdkPixbuf *color_shifted;
@@ -99,8 +101,8 @@ update_pixbufs (CcCropArea *area)
widget = GTK_WIDGET (area);
gtk_widget_get_allocation (widget, &allocation);
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+ width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->browse_pixbuf);
scale = allocation.height / (gdouble)height;
if (scale * width > allocation.width)
@@ -109,51 +111,51 @@ update_pixbufs (CcCropArea *area)
dest_width = width * scale;
dest_height = height * scale;
- if (area->priv->pixbuf == NULL ||
- gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
- gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height) {
- if (area->priv->pixbuf != NULL)
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- gdk_pixbuf_get_has_alpha (area->priv->browse_pixbuf),
+ if (area->pixbuf == NULL ||
+ gdk_pixbuf_get_width (area->pixbuf) != allocation.width ||
+ gdk_pixbuf_get_height (area->pixbuf) != allocation.height) {
+ if (area->pixbuf != NULL)
+ g_object_unref (area->pixbuf);
+ area->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ gdk_pixbuf_get_has_alpha (area->browse_pixbuf),
8,
dest_width, dest_height);
- gdk_pixbuf_fill (area->priv->pixbuf, 0x0);
+ gdk_pixbuf_fill (area->pixbuf, 0x0);
- gdk_pixbuf_scale (area->priv->browse_pixbuf,
- area->priv->pixbuf,
+ gdk_pixbuf_scale (area->browse_pixbuf,
+ area->pixbuf,
0, 0,
dest_width, dest_height,
0, 0,
scale, scale,
GDK_INTERP_BILINEAR);
- if (area->priv->color_shifted)
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
- shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
+ if (area->color_shifted)
+ g_object_unref (area->color_shifted);
+ area->color_shifted = gdk_pixbuf_copy (area->pixbuf);
+ shift_colors (area->color_shifted, -32, -32, -32, 0);
- if (area->priv->scale == 0.0) {
+ if (area->scale == 0.0) {
gdouble scale_to_80, scale_to_image, crop_scale;
/* Scale the crop rectangle to 80% of the area, or less to fit the image */
- scale_to_80 = MIN ((gdouble)gdk_pixbuf_get_width (area->priv->pixbuf) * 0.8 / area->priv->base_width,
- (gdouble)gdk_pixbuf_get_height (area->priv->pixbuf) * 0.8 / area->priv->base_height);
- scale_to_image = MIN ((gdouble)dest_width / area->priv->base_width,
- (gdouble)dest_height / area->priv->base_height);
+ scale_to_80 = MIN ((gdouble)gdk_pixbuf_get_width (area->pixbuf) * 0.8 / area->base_width,
+ (gdouble)gdk_pixbuf_get_height (area->pixbuf) * 0.8 / area->base_height);
+ scale_to_image = MIN ((gdouble)dest_width / area->base_width,
+ (gdouble)dest_height / area->base_height);
crop_scale = MIN (scale_to_80, scale_to_image);
- area->priv->crop.width = crop_scale * area->priv->base_width / scale;
- area->priv->crop.height = crop_scale * area->priv->base_height / scale;
- area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - area->priv->crop.width) / 2;
- area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - area->priv->crop.height) / 2;
+ area->crop.width = crop_scale * area->base_width / scale;
+ area->crop.height = crop_scale * area->base_height / scale;
+ area->crop.x = (gdk_pixbuf_get_width (area->browse_pixbuf) - area->crop.width) / 2;
+ area->crop.y = (gdk_pixbuf_get_height (area->browse_pixbuf) - area->crop.height) / 2;
}
- area->priv->scale = scale;
- area->priv->image.x = (allocation.width - dest_width) / 2;
- area->priv->image.y = (allocation.height - dest_height) / 2;
- area->priv->image.width = dest_width;
- area->priv->image.height = dest_height;
+ area->scale = scale;
+ area->image.x = (allocation.width - dest_width) / 2;
+ area->image.y = (allocation.height - dest_height) / 2;
+ area->image.width = dest_width;
+ area->image.height = dest_height;
}
}
@@ -161,10 +163,10 @@ static void
crop_to_widget (CcCropArea *area,
GdkRectangle *crop)
{
- crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
- crop->y = area->priv->image.y + area->priv->crop.y * area->priv->scale;
- crop->width = area->priv->crop.width * area->priv->scale;
- crop->height = area->priv->crop.height * area->priv->scale;
+ crop->x = area->image.x + area->crop.x * area->scale;
+ crop->y = area->image.y + area->crop.y * area->scale;
+ crop->width = area->crop.width * area->scale;
+ crop->height = area->crop.height * area->scale;
}
typedef enum {
@@ -188,30 +190,30 @@ cc_crop_area_draw (GtkWidget *widget,
gint width, height, ix, iy;
CcCropArea *uarea = CC_CROP_AREA (widget);
- if (uarea->priv->browse_pixbuf == NULL)
+ if (uarea->browse_pixbuf == NULL)
return FALSE;
update_pixbufs (uarea);
- width = gdk_pixbuf_get_width (uarea->priv->pixbuf);
- height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
+ width = gdk_pixbuf_get_width (uarea->pixbuf);
+ height = gdk_pixbuf_get_height (uarea->pixbuf);
crop_to_widget (uarea, &crop);
- ix = uarea->priv->image.x;
- iy = uarea->priv->image.y;
+ ix = uarea->image.x;
+ iy = uarea->image.y;
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->color_shifted, ix, iy);
+ gdk_cairo_set_source_pixbuf (cr, uarea->color_shifted, ix, iy);
cairo_rectangle (cr, ix, iy, width, crop.y - iy);
cairo_rectangle (cr, ix, crop.y, crop.x - ix, crop.height);
cairo_rectangle (cr, crop.x + crop.width, crop.y, width - crop.width - (crop.x - ix), crop.height);
cairo_rectangle (cr, ix, crop.y + crop.height, width, height - crop.height - (crop.y - iy));
cairo_fill (cr);
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->pixbuf, ix, iy);
+ gdk_cairo_set_source_pixbuf (cr, uarea->pixbuf, ix, iy);
cairo_rectangle (cr, crop.x, crop.y, crop.width, crop.height);
cairo_fill (cr);
- if (uarea->priv->active_region != OUTSIDE) {
+ if (uarea->active_region != OUTSIDE) {
gint x1, x2, y1, y2;
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_set_line_width (cr, 1.0);
@@ -310,7 +312,7 @@ update_cursor (CcCropArea *area,
GdkRectangle crop;
gint region;
- region = area->priv->active_region;
+ region = area->active_region;
if (region == OUTSIDE) {
crop_to_widget (area, &crop);
region = find_location (&crop, x, y);
@@ -351,12 +353,12 @@ update_cursor (CcCropArea *area,
g_assert_not_reached ();
}
- if (cursor_type != area->priv->current_cursor) {
+ if (cursor_type != area->current_cursor) {
GdkCursor *cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (area)),
cursor_type);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
g_object_unref (cursor);
- area->priv->current_cursor = cursor_type;
+ area->current_cursor = cursor_type;
}
}
@@ -390,7 +392,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
gdouble center_x, center_y;
gint min_width, min_height;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
update_cursor (area, event->x, event->y);
@@ -400,26 +402,26 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
damage.x - 1, damage.y - 1,
damage.width + 2, damage.height + 2);
- pb_width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- pb_height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+ pb_width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ pb_height = gdk_pixbuf_get_height (area->browse_pixbuf);
- x = (event->x - area->priv->image.x) / area->priv->scale;
- y = (event->y - area->priv->image.y) / area->priv->scale;
+ x = (event->x - area->image.x) / area->scale;
+ y = (event->y - area->image.y) / area->scale;
- delta_x = x - area->priv->last_press_x;
- delta_y = y - area->priv->last_press_y;
- area->priv->last_press_x = x;
- area->priv->last_press_y = y;
+ delta_x = x - area->last_press_x;
+ delta_y = y - area->last_press_y;
+ area->last_press_x = x;
+ area->last_press_y = y;
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
+ left = area->crop.x;
+ right = area->crop.x + area->crop.width - 1;
+ top = area->crop.y;
+ bottom = area->crop.y + area->crop.height - 1;
center_x = (left + right) / 2.0;
center_y = (top + bottom) / 2.0;
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case INSIDE:
width = right - left + 1;
height = bottom - top + 1;
@@ -456,101 +458,101 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
break;
case TOP_LEFT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
top = y;
left = x;
}
else if (y < eval_radial_line (center_x, center_y, left, top, x)) {
top = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
left = right - new_width;
}
else {
left = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
top = bottom - new_height;
}
break;
case TOP:
top = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
+ if (area->aspect > 0) {
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
break;
case TOP_RIGHT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
top = y;
right = x;
}
else if (y < eval_radial_line (center_x, center_y, right, top, x)) {
top = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
else {
right = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
top = bottom - new_height;
}
break;
case LEFT:
left = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
+ if (area->aspect > 0) {
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
break;
case BOTTOM_LEFT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
bottom = y;
left = x;
}
else if (y < eval_radial_line (center_x, center_y, left, bottom, x)) {
left = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
else {
bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
left = right - new_width;
}
break;
case RIGHT:
right = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
+ if (area->aspect > 0) {
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
break;
case BOTTOM_RIGHT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
bottom = y;
right = x;
}
else if (y < eval_radial_line (center_x, center_y, right, bottom, x)) {
right = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
else {
bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
break;
case BOTTOM:
bottom = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
+ if (area->aspect > 0) {
+ new_width = (bottom - top) * area->aspect;
right= left + new_width;
}
break;
@@ -559,12 +561,12 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
return FALSE;
}
- min_width = area->priv->base_width / area->priv->scale;
- min_height = area->priv->base_height / area->priv->scale;
+ min_width = area->base_width / area->scale;
+ min_height = area->base_height / area->scale;
width = right - left + 1;
height = bottom - top + 1;
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
if (left < 0)
left = 0;
if (top < 0)
@@ -577,7 +579,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
width = right - left + 1;
height = bottom - top + 1;
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case LEFT:
case TOP_LEFT:
case BOTTOM_LEFT:
@@ -594,7 +596,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
default: ;
}
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case TOP:
case TOP_LEFT:
case TOP_RIGHT:
@@ -615,17 +617,17 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
if (left < 0 || top < 0 ||
right > pb_width || bottom > pb_height ||
width < min_width || height < min_height) {
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
+ left = area->crop.x;
+ right = area->crop.x + area->crop.width - 1;
+ top = area->crop.y;
+ bottom = area->crop.y + area->crop.height - 1;
}
}
- area->priv->crop.x = left;
- area->priv->crop.y = top;
- area->priv->crop.width = right - left + 1;
- area->priv->crop.height = bottom - top + 1;
+ area->crop.x = left;
+ area->crop.y = top;
+ area->crop.width = right - left + 1;
+ area->crop.height = bottom - top + 1;
crop_to_widget (area, &damage);
gtk_widget_queue_draw_area (widget,
@@ -642,14 +644,14 @@ cc_crop_area_button_press_event (GtkWidget *widget,
CcCropArea *area = CC_CROP_AREA (widget);
GdkRectangle crop;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
crop_to_widget (area, &crop);
- area->priv->last_press_x = (event->x - area->priv->image.x) / area->priv->scale;
- area->priv->last_press_y = (event->y - area->priv->image.y) / area->priv->scale;
- area->priv->active_region = find_location (&crop, event->x, event->y);
+ area->last_press_x = (event->x - area->image.x) / area->scale;
+ area->last_press_y = (event->y - area->image.y) / area->scale;
+ area->active_region = find_location (&crop, event->x, event->y);
gtk_widget_queue_draw_area (widget,
crop.x - 1, crop.y - 1,
@@ -665,14 +667,14 @@ cc_crop_area_button_release_event (GtkWidget *widget,
CcCropArea *area = CC_CROP_AREA (widget);
GdkRectangle crop;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
crop_to_widget (area, &crop);
- area->priv->last_press_x = -1;
- area->priv->last_press_y = -1;
- area->priv->active_region = OUTSIDE;
+ area->last_press_x = -1;
+ area->last_press_y = -1;
+ area->active_region = OUTSIDE;
gtk_widget_queue_draw_area (widget,
crop.x - 1, crop.y - 1,
@@ -685,8 +687,8 @@ static void
cc_crop_area_set_size_request (CcCropArea *area)
{
gtk_widget_set_size_request (GTK_WIDGET (area),
- area->priv->base_width,
- area->priv->base_height);
+ area->base_width,
+ area->base_height);
}
static void
@@ -694,17 +696,17 @@ cc_crop_area_finalize (GObject *object)
{
CcCropArea *area = CC_CROP_AREA (object);
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
+ if (area->browse_pixbuf) {
+ g_object_unref (area->browse_pixbuf);
+ area->browse_pixbuf = NULL;
}
- if (area->priv->pixbuf) {
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = NULL;
+ if (area->pixbuf) {
+ g_object_unref (area->pixbuf);
+ area->pixbuf = NULL;
}
- if (area->priv->color_shifted) {
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = NULL;
+ if (area->color_shifted) {
+ g_object_unref (area->color_shifted);
+ area->color_shifted = NULL;
}
}
@@ -719,29 +721,24 @@ cc_crop_area_class_init (CcCropAreaClass *klass)
widget_class->button_press_event = cc_crop_area_button_press_event;
widget_class->button_release_event = cc_crop_area_button_release_event;
widget_class->motion_notify_event = cc_crop_area_motion_notify_event;
-
- g_type_class_add_private (klass, sizeof (CcCropAreaPrivate));
}
static void
cc_crop_area_init (CcCropArea *area)
{
- area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), CC_TYPE_CROP_AREA,
- CcCropAreaPrivate));
-
gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK);
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
- area->priv->active_region = OUTSIDE;
- area->priv->base_width = 48;
- area->priv->base_height = 48;
- area->priv->aspect = 1;
+ area->scale = 0.0;
+ area->image.x = 0;
+ area->image.y = 0;
+ area->image.width = 0;
+ area->image.height = 0;
+ area->active_region = OUTSIDE;
+ area->base_width = 48;
+ area->base_height = 48;
+ area->aspect = 1;
cc_crop_area_set_size_request (area);
}
@@ -757,14 +754,14 @@ cc_crop_area_get_picture (CcCropArea *area)
{
gint width, height;
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
- width = MIN (area->priv->crop.width, width - area->priv->crop.x);
- height = MIN (area->priv->crop.height, height - area->priv->crop.y);
+ width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->browse_pixbuf);
+ width = MIN (area->crop.width, width - area->crop.x);
+ height = MIN (area->crop.height, height - area->crop.y);
- return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
- area->priv->crop.x,
- area->priv->crop.y,
+ return gdk_pixbuf_new_subpixbuf (area->browse_pixbuf,
+ area->crop.x,
+ area->crop.y,
width, height);
}
@@ -775,12 +772,12 @@ cc_crop_area_set_picture (CcCropArea *area,
int width;
int height;
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
+ if (area->browse_pixbuf) {
+ g_object_unref (area->browse_pixbuf);
+ area->browse_pixbuf = NULL;
}
if (pixbuf) {
- area->priv->browse_pixbuf = g_object_ref (pixbuf);
+ area->browse_pixbuf = g_object_ref (pixbuf);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
} else {
@@ -788,16 +785,16 @@ cc_crop_area_set_picture (CcCropArea *area,
height = 0;
}
- area->priv->crop.width = 2 * area->priv->base_width;
- area->priv->crop.height = 2 * area->priv->base_height;
- area->priv->crop.x = (width - area->priv->crop.width) / 2;
- area->priv->crop.y = (height - area->priv->crop.height) / 2;
+ area->crop.width = 2 * area->base_width;
+ area->crop.height = 2 * area->base_height;
+ area->crop.x = (width - area->crop.width) / 2;
+ area->crop.y = (height - area->crop.height) / 2;
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
+ area->scale = 0.0;
+ area->image.x = 0;
+ area->image.y = 0;
+ area->image.width = 0;
+ area->image.height = 0;
gtk_widget_queue_draw (GTK_WIDGET (area));
}
@@ -807,13 +804,13 @@ cc_crop_area_set_min_size (CcCropArea *area,
gint width,
gint height)
{
- area->priv->base_width = width;
- area->priv->base_height = height;
+ area->base_width = width;
+ area->base_height = height;
cc_crop_area_set_size_request (area);
- if (area->priv->aspect > 0) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ if (area->aspect > 0) {
+ area->aspect = area->base_width / (gdouble)area->base_height;
}
}
@@ -822,10 +819,10 @@ cc_crop_area_set_constrain_aspect (CcCropArea *area,
gboolean constrain)
{
if (constrain) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ area->aspect = area->base_width / (gdouble)area->base_height;
}
else {
- area->priv->aspect = -1;
+ area->aspect = -1;
}
}
diff --git a/panels/user-accounts/cc-crop-area.h b/panels/user-accounts/cc-crop-area.h
index 38657c67f..1cc1788b7 100644
--- a/panels/user-accounts/cc-crop-area.h
+++ b/panels/user-accounts/cc-crop-area.h
@@ -26,29 +26,7 @@
G_BEGIN_DECLS
#define CC_TYPE_CROP_AREA (cc_crop_area_get_type ())
-#define CC_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_CROP_AREA, \
- CcCropArea))
-#define CC_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_CROP_AREA, \
- CcCropAreaClass))
-#define CC_IS_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_CROP_AREA))
-#define CC_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_CROP_AREA))
-#define CC_CROP_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_CROP_AREA, \
- CcCropAreaClass))
-
-typedef struct _CcCropAreaClass CcCropAreaClass;
-typedef struct _CcCropArea CcCropArea;
-typedef struct _CcCropAreaPrivate CcCropAreaPrivate;
-
-struct _CcCropAreaClass {
- GtkDrawingAreaClass parent_class;
-};
-
-struct _CcCropArea {
- GtkDrawingArea parent_instance;
- CcCropAreaPrivate *priv;
-};
-
-GType cc_crop_area_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcCropArea, cc_crop_area, CC, CROP_AREA, GtkDrawingArea)
GtkWidget *cc_crop_area_new (void);
GdkPixbuf *cc_crop_area_get_picture (CcCropArea *area);
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index 9ca2c6d9d..6c0404cd2 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -68,7 +68,8 @@ static void um_account_dialog_response (GtkDialog *dialog,
UmAccountDialogClass))
struct _UmAccountDialog {
- GtkDialog parent;
+ GtkDialog parent_instance;
+
GtkWidget *stack;
GSimpleAsyncResult *async;
GCancellable *cancellable;
@@ -118,10 +119,6 @@ struct _UmAccountDialog {
gboolean join_prompted;
};
-struct _UmAccountDialogClass {
- GtkDialogClass parent_class;
-};
-
G_DEFINE_TYPE (UmAccountDialog, um_account_dialog, GTK_TYPE_DIALOG);
static void
diff --git a/panels/user-accounts/um-account-dialog.h b/panels/user-accounts/um-account-dialog.h
index 9e8361ddc..44a356c29 100644
--- a/panels/user-accounts/um-account-dialog.h
+++ b/panels/user-accounts/um-account-dialog.h
@@ -26,14 +26,9 @@
G_BEGIN_DECLS
-#define UM_TYPE_ACCOUNT_DIALOG (um_account_dialog_get_type ())
-#define UM_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_ACCOUNT_DIALOG, UmAccountDialog))
-#define UM_IS_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_ACCOUNT_DIALOG))
+#define UM_TYPE_ACCOUNT_DIALOG (um_account_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (UmAccountDialog, um_account_dialog, UM, ACCOUNT_DIALOG, GtkDialog)
-typedef struct _UmAccountDialog UmAccountDialog;
-typedef struct _UmAccountDialogClass UmAccountDialogClass;
-
-GType um_account_dialog_get_type (void) G_GNUC_CONST;
UmAccountDialog *um_account_dialog_new (void);
void um_account_dialog_show (UmAccountDialog *self,
GtkWindow *parent,
diff --git a/panels/user-accounts/um-carousel.h b/panels/user-accounts/um-carousel.h
index 0812ca3ba..45a11caff 100644
--- a/panels/user-accounts/um-carousel.h
+++ b/panels/user-accounts/um-carousel.h
@@ -26,11 +26,9 @@
G_BEGIN_DECLS
#define UM_TYPE_CAROUSEL_ITEM (um_carousel_item_get_type ())
-
G_DECLARE_FINAL_TYPE (UmCarouselItem, um_carousel_item, UM, CAROUSEL_ITEM, GtkRadioButton)
-#define UM_TYPE_CAROUSEL (um_carousel_get_type())
-
+#define UM_TYPE_CAROUSEL (um_carousel_get_type ())
G_DECLARE_FINAL_TYPE (UmCarousel, um_carousel, UM, CAROUSEL, GtkRevealer)
GtkWidget *um_carousel_item_new (void);
diff --git a/panels/user-accounts/um-cell-renderer-user-image.c b/panels/user-accounts/um-cell-renderer-user-image.c
index bcd61606f..b97976314 100644
--- a/panels/user-accounts/um-cell-renderer-user-image.c
+++ b/panels/user-accounts/um-cell-renderer-user-image.c
@@ -23,20 +23,20 @@
#include "um-utils.h"
-struct _UmCellRendererUserImagePrivate {
+struct _UmCellRendererUserImage {
+ GtkCellRendererPixbuf parent_instance;
+
GtkWidget *parent;
ActUser *user;
};
-#define UM_CELL_RENDERER_USER_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImagePrivate))
-
enum {
PROP_0,
PROP_PARENT,
PROP_USER
};
-G_DEFINE_TYPE_WITH_CODE (UmCellRendererUserImage, um_cell_renderer_user_image, GTK_TYPE_CELL_RENDERER_PIXBUF, G_ADD_PRIVATE (UmCellRendererUserImage));
+G_DEFINE_TYPE (UmCellRendererUserImage, um_cell_renderer_user_image, GTK_TYPE_CELL_RENDERER_PIXBUF)
static void
render_user_image (UmCellRendererUserImage *cell_renderer)
@@ -44,9 +44,9 @@ render_user_image (UmCellRendererUserImage *cell_renderer)
cairo_surface_t *surface;
gint scale;
- if (cell_renderer->priv->user != NULL) {
- scale = gtk_widget_get_scale_factor (cell_renderer->priv->parent);
- surface = render_user_icon (cell_renderer->priv->user, UM_ICON_STYLE_FRAME | UM_ICON_STYLE_STATUS, 48, scale);
+ if (cell_renderer->user != NULL) {
+ scale = gtk_widget_get_scale_factor (cell_renderer->parent);
+ surface = render_user_icon (cell_renderer->user, UM_ICON_STYLE_FRAME | UM_ICON_STYLE_STATUS, 48, scale);
g_object_set (GTK_CELL_RENDERER_PIXBUF (cell_renderer), "surface", surface, NULL);
cairo_surface_destroy (surface);
} else {
@@ -74,12 +74,12 @@ um_cell_renderer_user_image_set_property (GObject *object,
switch (prop_id) {
case PROP_PARENT:
- cell_renderer->priv->parent = g_value_dup_object (value);
- g_signal_connect (cell_renderer->priv->parent, "notify::scale-factor", G_CALLBACK (on_scale_factor_changed), cell_renderer);
+ cell_renderer->parent = g_value_dup_object (value);
+ g_signal_connect (cell_renderer->parent, "notify::scale-factor", G_CALLBACK (on_scale_factor_changed), cell_renderer);
break;
case PROP_USER:
- g_clear_object (&cell_renderer->priv->user);
- cell_renderer->priv->user = g_value_dup_object (value);
+ g_clear_object (&cell_renderer->user);
+ cell_renderer->user = g_value_dup_object (value);
render_user_image (cell_renderer);
break;
default:
@@ -93,8 +93,8 @@ um_cell_renderer_user_image_finalize (GObject *object)
{
UmCellRendererUserImage *cell_renderer = UM_CELL_RENDERER_USER_IMAGE (object);
- g_clear_object (&cell_renderer->priv->parent);
- g_clear_object (&cell_renderer->priv->user);
+ g_clear_object (&cell_renderer->parent);
+ g_clear_object (&cell_renderer->user);
G_OBJECT_CLASS (um_cell_renderer_user_image_parent_class)->finalize (object);
}
@@ -127,7 +127,6 @@ um_cell_renderer_user_image_class_init (UmCellRendererUserImageClass *class)
static void
um_cell_renderer_user_image_init (UmCellRendererUserImage *cell_renderer)
{
- cell_renderer->priv = UM_CELL_RENDERER_USER_IMAGE_GET_PRIVATE (cell_renderer);
}
GtkCellRenderer *
diff --git a/panels/user-accounts/um-cell-renderer-user-image.h b/panels/user-accounts/um-cell-renderer-user-image.h
index 6176d2b5a..176312789 100644
--- a/panels/user-accounts/um-cell-renderer-user-image.h
+++ b/panels/user-accounts/um-cell-renderer-user-image.h
@@ -23,29 +23,9 @@
G_BEGIN_DECLS
-#define UM_TYPE_CELL_RENDERER_USER_IMAGE um_cell_renderer_user_image_get_type()
+#define UM_TYPE_CELL_RENDERER_USER_IMAGE (um_cell_renderer_user_image_get_type ())
+G_DECLARE_FINAL_TYPE (UmCellRendererUserImage, um_cell_renderer_user_image, UM, CELL_RENDERER_USER_IMAGE, GtkCellRendererPixbuf)
-#define UM_CELL_RENDERER_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImage))
-#define UM_CELL_RENDERER_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImageClass))
-#define UM_IS_CELL_RENDERER_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_CELL_RENDERER_USER_IMAGE))
-#define UM_IS_CELL_RENDERER_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_CELL_RENDERER_USER_IMAGE))
-#define UM_CELL_RENDERER_USER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImageClass))
-
-typedef struct _UmCellRendererUserImage UmCellRendererUserImage;
-typedef struct _UmCellRendererUserImageClass UmCellRendererUserImageClass;
-typedef struct _UmCellRendererUserImagePrivate UmCellRendererUserImagePrivate;
-
-struct _UmCellRendererUserImage {
- GtkCellRendererPixbuf parent;
-
- UmCellRendererUserImagePrivate *priv;
-};
-
-struct _UmCellRendererUserImageClass {
- GtkCellRendererPixbufClass parent_class;
-};
-
-GType um_cell_renderer_user_image_get_type (void) G_GNUC_CONST;
GtkCellRenderer *um_cell_renderer_user_image_new (GtkWidget *parent);
G_END_DECLS
diff --git a/panels/user-accounts/um-realm-manager.c b/panels/user-accounts/um-realm-manager.c
index 26391486f..1a97536d1 100644
--- a/panels/user-accounts/um-realm-manager.c
+++ b/panels/user-accounts/um-realm-manager.c
@@ -35,15 +35,12 @@
struct _UmRealmManager {
- UmRealmObjectManagerClient parent;
+ UmRealmObjectManagerClient parent_instance;
+
UmRealmProvider *provider;
guint diagnostics_sig;
};
-typedef struct {
- UmRealmProviderProxyClass parent_class;
-} UmRealmManagerClass;
-
enum {
REALM_ADDED,
NUM_SIGNALS,
diff --git a/panels/user-accounts/um-realm-manager.h b/panels/user-accounts/um-realm-manager.h
index 2bf61e6cb..2e1b07e3d 100644
--- a/panels/user-accounts/um-realm-manager.h
+++ b/panels/user-accounts/um-realm-manager.h
@@ -36,13 +36,8 @@ typedef enum {
GQuark um_realm_error_get_quark (void) G_GNUC_CONST;
-#define UM_TYPE_REALM_MANAGER (um_realm_manager_get_type ())
-#define UM_REALM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_REALM_MANAGER, UmRealmManager))
-#define UM_IS_REALM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_REALM_MANAGER))
-
-typedef struct _UmRealmManager UmRealmManager;
-
-GType um_realm_manager_get_type (void) G_GNUC_CONST;
+#define UM_TYPE_REALM_MANAGER (um_realm_manager_get_type ())
+G_DECLARE_FINAL_TYPE (UmRealmManager, um_realm_manager, UM, REALM_MANAGER, UmRealmObjectManagerClient)
void um_realm_manager_new (GCancellable *cancellable,
GAsyncReadyCallback callback,
diff --git a/panels/user-accounts/um-user-image.c b/panels/user-accounts/um-user-image.c
index 5f30bac2e..f930039cb 100644
--- a/panels/user-accounts/um-user-image.c
+++ b/panels/user-accounts/um-user-image.c
@@ -23,13 +23,13 @@
#include "um-utils.h"
-struct _UmUserImagePrivate {
+struct _UmUserImage {
+ GtkImage parent_instance;
+
ActUser *user;
};
-#define UM_USER_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UM_TYPE_USER_IMAGE, UmUserImagePrivate))
-
-G_DEFINE_TYPE_WITH_CODE (UmUserImage, um_user_image, GTK_TYPE_IMAGE, G_ADD_PRIVATE (UmUserImage));
+G_DEFINE_TYPE (UmUserImage, um_user_image, GTK_TYPE_IMAGE)
static void
render_image (UmUserImage *image)
@@ -37,12 +37,12 @@ render_image (UmUserImage *image)
cairo_surface_t *surface;
gint scale, pixel_size;
- if (image->priv->user == NULL)
+ if (image->user == NULL)
return;
pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (image));
scale = gtk_widget_get_scale_factor (GTK_WIDGET (image));
- surface = render_user_icon (image->priv->user,
+ surface = render_user_icon (image->user,
UM_ICON_STYLE_NONE,
pixel_size > 0 ? pixel_size : 48,
scale);
@@ -54,8 +54,8 @@ void
um_user_image_set_user (UmUserImage *image,
ActUser *user)
{
- g_clear_object (&image->priv->user);
- image->priv->user = g_object_ref (user);
+ g_clear_object (&image->user);
+ image->user = g_object_ref (user);
render_image (image);
}
@@ -65,7 +65,7 @@ um_user_image_finalize (GObject *object)
{
UmUserImage *image = UM_USER_IMAGE (object);
- g_clear_object (&image->priv->user);
+ g_clear_object (&image->user);
G_OBJECT_CLASS (um_user_image_parent_class)->finalize (object);
}
@@ -81,8 +81,6 @@ um_user_image_class_init (UmUserImageClass *class)
static void
um_user_image_init (UmUserImage *image)
{
- image->priv = UM_USER_IMAGE_GET_PRIVATE (image);
-
g_signal_connect_swapped (image, "notify::scale-factor", G_CALLBACK (render_image), image);
g_signal_connect_swapped (image, "notify::pixel-size", G_CALLBACK (render_image), image);
}
diff --git a/panels/user-accounts/um-user-image.h b/panels/user-accounts/um-user-image.h
index 371b4049f..e418b0538 100644
--- a/panels/user-accounts/um-user-image.h
+++ b/panels/user-accounts/um-user-image.h
@@ -24,30 +24,11 @@
G_BEGIN_DECLS
-#define UM_TYPE_USER_IMAGE um_user_image_get_type()
+#define UM_TYPE_USER_IMAGE (um_user_image_get_type ())
+G_DECLARE_FINAL_TYPE (UmUserImage, um_user_image, UM, USER_IMAGE, GtkImage)
-#define UM_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_USER_IMAGE, UmUserImage))
-#define UM_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_USER_IMAGE, UmUserImageClass))
-#define UM_IS_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_USER_IMAGE))
-#define UM_IS_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_USER_IMAGE))
-#define UM_USER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_USER_IMAGE, UmUserImageClass))
-
-typedef struct _UmUserImage UmUserImage;
-typedef struct _UmUserImageClass UmUserImageClass;
-typedef struct _UmUserImagePrivate UmUserImagePrivate;
-
-struct _UmUserImage {
- GtkImage parent;
-
- UmUserImagePrivate *priv;
-};
-
-struct _UmUserImageClass {
- GtkImageClass parent_class;
-};
-
-GType um_user_image_get_type (void) G_GNUC_CONST;
GtkWidget *um_user_image_new (void);
+
void um_user_image_set_user (UmUserImage *image, ActUser *user);
G_END_DECLS
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index c1875cb69..40702f2c1 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -58,12 +58,9 @@
#define USER_ACCOUNTS_PERMISSION "org.gnome.controlcenter.user-accounts.administration"
-CC_PANEL_REGISTER (CcUserPanel, cc_user_panel)
-
-#define UM_USER_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), UM_TYPE_USER_PANEL, CcUserPanelPrivate))
+struct _CcUserPanel {
+ CcPanel parent_instance;
-struct _CcUserPanelPrivate {
ActUserManager *um;
GCancellable *cancellable;
GtkBuilder *builder;
@@ -86,16 +83,18 @@ struct _CcUserPanelPrivate {
UmAccountDialog *account_dialog;
};
+CC_PANEL_REGISTER (CcUserPanel, cc_user_panel)
+
static GtkWidget *
-get_widget (CcUserPanelPrivate *d, const char *name)
+get_widget (CcUserPanel *self, const char *name)
{
- return (GtkWidget *)gtk_builder_get_object (d->builder, name);
+ return (GtkWidget *)gtk_builder_get_object (self->builder, name);
}
#define PAGE_LOCK "_lock"
#define PAGE_ADDUSER "_adduser"
-static void show_restart_notification (CcUserPanelPrivate *d, const gchar *locale);
+static void show_restart_notification (CcUserPanel *self, const gchar *locale);
static gint user_compare (gconstpointer i, gconstpointer u);
typedef struct {
@@ -114,13 +113,13 @@ async_delete_data_free (AsyncDeleteData *data)
}
static void
-show_error_dialog (CcUserPanelPrivate *d,
+show_error_dialog (CcUserPanel *self,
const gchar *message,
GError *error)
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
@@ -137,9 +136,9 @@ show_error_dialog (CcUserPanelPrivate *d,
}
static ActUser *
-get_selected_user (CcUserPanelPrivate *d)
+get_selected_user (CcUserPanel *self)
{
- return d->selected_user;
+ return self->selected_user;
}
static const gchar *
@@ -154,25 +153,25 @@ get_real_or_user_name (ActUser *user)
return name;
}
-static void show_user (ActUser *user, CcUserPanelPrivate *d);
+static void show_user (ActUser *user, CcUserPanel *self);
static void
-set_selected_user (UmCarousel *carousel, UmCarouselItem *item, CcUserPanelPrivate *d)
+set_selected_user (UmCarousel *carousel, UmCarouselItem *item, CcUserPanel *self)
{
uid_t uid;
- g_clear_object (&d->selected_user);
+ g_clear_object (&self->selected_user);
uid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "uid"));
- d->selected_user = act_user_manager_get_user_by_id (d->um, uid);
+ self->selected_user = act_user_manager_get_user_by_id (self->um, uid);
- if (d->selected_user != NULL) {
- show_user (d->selected_user, d);
+ if (self->selected_user != NULL) {
+ show_user (self->selected_user, self);
}
}
static GtkWidget *
-create_carousel_entry (CcUserPanelPrivate *d, ActUser *user)
+create_carousel_entry (CcUserPanel *self, ActUser *user)
{
GtkWidget *box, *widget;
gchar *label;
@@ -208,7 +207,7 @@ create_carousel_entry (CcUserPanelPrivate *d, ActUser *user)
}
static void
-user_added (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_added (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
GtkWidget *item, *widget;
gboolean show_carousel;
@@ -219,20 +218,20 @@ user_added (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
g_debug ("user added: %d %s\n", act_user_get_uid (user), get_real_or_user_name (user));
- widget = create_carousel_entry (d, user);
+ widget = create_carousel_entry (self, user);
item = um_carousel_item_new ();
gtk_container_add (GTK_CONTAINER (item), widget);
g_object_set_data (G_OBJECT (item), "uid", GINT_TO_POINTER (act_user_get_uid (user)));
- gtk_container_add (GTK_CONTAINER (d->carousel), item);
+ gtk_container_add (GTK_CONTAINER (self->carousel), item);
if (act_user_get_uid (user) != getuid ()) {
- d->other_accounts++;
+ self->other_accounts++;
}
/* Show heading for other accounts if new one have been added. */
- show_carousel = (d->other_accounts > 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->carousel), show_carousel);
+ show_carousel = (self->other_accounts > 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel), show_carousel);
}
static gint
@@ -266,7 +265,7 @@ sort_users (gconstpointer a, gconstpointer b)
}
static void
-reload_users (CcUserPanelPrivate *d, ActUser *selected_user)
+reload_users (CcUserPanel *self, ActUser *selected_user)
{
ActUser *user;
GSList *list, *l;
@@ -279,44 +278,44 @@ reload_users (CcUserPanelPrivate *d, ActUser *selected_user)
g_object_get (settings, "gtk-enable-animations", &animations, NULL);
g_object_set (settings, "gtk-enable-animations", FALSE, NULL);
- um_carousel_purge_items (d->carousel);
+ um_carousel_purge_items (self->carousel);
- d->other_accounts = 0;
+ self->other_accounts = 0;
- list = act_user_manager_list_users (d->um);
+ list = act_user_manager_list_users (self->um);
g_debug ("Got %d users\n", g_slist_length (list));
list = g_slist_sort (list, (GCompareFunc) sort_users);
for (l = list; l; l = l->next) {
user = l->data;
g_debug ("adding user %s\n", get_real_or_user_name (user));
- user_added (d->um, user, d);
+ user_added (self->um, user, self);
}
g_slist_free (list);
if (selected_user) {
- item = um_carousel_find_item (d->carousel, selected_user, user_compare);
- um_carousel_select_item (d->carousel, item);
+ item = um_carousel_find_item (self->carousel, selected_user, user_compare);
+ um_carousel_select_item (self->carousel, item);
}
g_object_set (settings, "gtk-enable-animations", animations, NULL);
}
static void
-user_removed (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_removed (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
gboolean show_carousel;
- d->other_accounts--;
- show_carousel = (d->other_accounts > 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->carousel),
+ self->other_accounts--;
+ show_carousel = (self->other_accounts > 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel),
show_carousel);
- reload_users (d, NULL);
+ reload_users (self, NULL);
/* Show the current user */
- user = act_user_manager_get_user_by_id (d->um, getuid ());
- show_user (user, d);
+ user = act_user_manager_get_user_by_id (self->um, getuid ());
+ show_user (user, self);
}
static gint
@@ -340,12 +339,12 @@ user_compare (gconstpointer i,
}
static void
-user_changed (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_changed (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
- if (act_user_get_uid (user) != act_user_get_uid (d->selected_user))
+ if (act_user_get_uid (user) != act_user_get_uid (self->selected_user))
return;
- reload_users (d, user);
+ reload_users (self, user);
}
static void
@@ -353,33 +352,33 @@ select_created_user (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- CcUserPanelPrivate *d = user_data;
+ CcUserPanel *self = user_data;
UmAccountDialog *dialog;
ActUser *user;
dialog = UM_ACCOUNT_DIALOG (object);
user = um_account_dialog_finish (dialog, result);
gtk_widget_destroy (GTK_WIDGET (dialog));
- d->account_dialog = NULL;
+ self->account_dialog = NULL;
if (user == NULL)
return;
- reload_users (d, user);
+ reload_users (self, user);
}
static void
-add_user (GtkButton *button, CcUserPanelPrivate *d)
+add_user (GtkButton *button, CcUserPanel *self)
{
- d->account_dialog = um_account_dialog_new ();
- um_account_dialog_show (d->account_dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
- d->permission, select_created_user, d);
+ self->account_dialog = um_account_dialog_new ();
+ um_account_dialog_show (self->account_dialog, GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
+ self->permission, select_created_user, self);
}
static void
delete_user_done (ActUserManager *manager,
GAsyncResult *res,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
GError *error;
@@ -387,7 +386,7 @@ delete_user_done (ActUserManager *manager,
if (!act_user_manager_delete_user_finish (manager, res, &error)) {
if (!g_error_matches (error, ACT_USER_MANAGER_ERROR,
ACT_USER_MANAGER_ERROR_PERMISSION_DENIED))
- show_error_dialog (d, _("Failed to delete user"), error);
+ show_error_dialog (self, _("Failed to delete user"), error);
g_error_free (error);
}
@@ -396,7 +395,7 @@ delete_user_done (ActUserManager *manager,
static void
delete_user_response (GtkWidget *dialog,
gint response_id,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
gboolean remove_files;
@@ -413,19 +412,19 @@ delete_user_response (GtkWidget *dialog,
remove_files = FALSE;
}
- user = get_selected_user (d);
+ user = get_selected_user (self);
/* remove autologin */
if (act_user_get_automatic_login (user)) {
act_user_set_automatic_login (user, FALSE);
}
- act_user_manager_delete_user_async (d->um,
+ act_user_manager_delete_user_async (self->um,
user,
remove_files,
NULL,
(GAsyncReadyCallback)delete_user_done,
- d);
+ self);
}
static void
@@ -434,7 +433,7 @@ enterprise_user_revoked (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
UmRealmCommon *common = UM_REALM_COMMON (source);
GError *error = NULL;
@@ -445,7 +444,7 @@ enterprise_user_revoked (GObject *source,
um_realm_common_call_change_login_policy_finish (common, result, &error);
if (error != NULL) {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
}
@@ -489,7 +488,7 @@ realm_manager_found (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
UmRealmCommon *common;
UmRealmManager *realm_manager;
const gchar *add[1];
@@ -504,7 +503,7 @@ realm_manager_found (GObject *source,
realm_manager = um_realm_manager_new_finish (result, &error);
if (error != NULL) {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
async_delete_data_free (data);
return;
@@ -541,7 +540,7 @@ enterprise_user_uncached (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
ActUserManager *manager = ACT_USER_MANAGER (source);
GError *error = NULL;
@@ -553,10 +552,10 @@ enterprise_user_uncached (GObject *source,
act_user_manager_uncache_user_finish (manager, res, &error);
if (error == NULL) {
/* Find realm manager */
- um_realm_manager_new (d->cancellable, realm_manager_found, data);
+ um_realm_manager_new (self->cancellable, realm_manager_found, data);
}
else {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
async_delete_data_free (data);
}
@@ -568,7 +567,6 @@ delete_enterprise_user_response (GtkWidget *dialog,
gpointer user_data)
{
CcUserPanel *self = UM_USER_PANEL (user_data);
- CcUserPanelPrivate *d = self->priv;
AsyncDeleteData *data;
ActUser *user;
@@ -578,17 +576,17 @@ delete_enterprise_user_response (GtkWidget *dialog,
return;
}
- user = get_selected_user (self->priv);
+ user = get_selected_user (self);
data = g_slice_new (AsyncDeleteData);
data->self = g_object_ref (self);
- data->cancellable = g_object_ref (d->cancellable);
+ data->cancellable = g_object_ref (self->cancellable);
data->login = g_strdup (act_user_get_user_name (user));
/* Uncache the user account from the accountsservice */
g_debug ("Uncaching remote user: %s", data->login);
- act_user_manager_uncache_user_async (d->um, data->login,
+ act_user_manager_uncache_user_async (self->um, data->login,
data->cancellable,
enterprise_user_uncached,
data);
@@ -597,16 +595,15 @@ delete_enterprise_user_response (GtkWidget *dialog,
static void
delete_user (GtkButton *button, CcUserPanel *self)
{
- CcUserPanelPrivate *d = self->priv;
ActUser *user;
GtkWidget *dialog;
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (user == NULL) {
return;
}
else if (act_user_get_uid (user) == getuid ()) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
@@ -615,7 +612,7 @@ delete_user (GtkButton *button, CcUserPanel *self)
G_CALLBACK (gtk_widget_destroy), NULL);
}
else if (act_user_is_logged_in_anywhere (user)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
@@ -628,7 +625,7 @@ delete_user (GtkButton *button, CcUserPanel *self)
G_CALLBACK (gtk_widget_destroy), NULL);
}
else if (act_user_is_local_account (user)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@@ -647,10 +644,10 @@ delete_user (GtkButton *button, CcUserPanel *self)
gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-users");
g_signal_connect (dialog, "response",
- G_CALLBACK (delete_user_response), d);
+ G_CALLBACK (delete_user_response), self);
}
else {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@@ -732,20 +729,20 @@ get_password_mode_text (ActUser *user)
static void
autologin_changed (GObject *object,
GParamSpec *pspec,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
gboolean active;
ActUser *user;
active = gtk_switch_get_active (GTK_SWITCH (object));
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (active != act_user_get_automatic_login (user)) {
act_user_set_automatic_login (user, active);
if (act_user_get_automatic_login (user)) {
GSList *list;
GSList *l;
- list = act_user_manager_list_users (d->um);
+ list = act_user_manager_list_users (self->um);
for (l = list; l != NULL; l = l->next) {
ActUser *u = l->data;
if (act_user_get_uid (u) != act_user_get_uid (user)) {
@@ -805,7 +802,7 @@ get_autologin_possible (ActUser *user)
static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);
static void
-show_user (ActUser *user, CcUserPanelPrivate *d)
+show_user (ActUser *user, CcUserPanel *self)
{
GtkWidget *image;
GtkWidget *label;
@@ -814,39 +811,39 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
gboolean show, enable;
ActUser *current;
- d->selected_user = user;
+ self->selected_user = user;
- image = get_widget (d, "user-icon-image");
+ image = get_widget (self, "user-icon-image");
um_user_image_set_user (UM_USER_IMAGE (image), user);
- image = get_widget (d, "user-icon-image2");
+ image = get_widget (self, "user-icon-image2");
um_user_image_set_user (UM_USER_IMAGE (image), user);
- um_photo_dialog_set_user (d->photo_dialog, user);
+ um_photo_dialog_set_user (self->photo_dialog, user);
- widget = get_widget (d, "full-name-entry");
+ widget = get_widget (self, "full-name-entry");
gtk_entry_set_text (GTK_ENTRY (widget), act_user_get_real_name (user));
gtk_widget_set_tooltip_text (widget, act_user_get_user_name (user));
- widget = get_widget (d, act_user_get_account_type (user) ? "account-type-admin" : "account-type-standard");
+ widget = get_widget (self, act_user_get_account_type (user) ? "account-type-admin" : "account-type-standard");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
/* Do not show the "Account Type" option when there's a single user account. */
- show = (d->other_accounts != 0);
- gtk_widget_set_visible (get_widget (d, "account-type-label"), show);
- gtk_widget_set_visible (get_widget (d, "account-type-box"), show);
+ show = (self->other_accounts != 0);
+ gtk_widget_set_visible (get_widget (self, "account-type-label"), show);
+ gtk_widget_set_visible (get_widget (self, "account-type-box"), show);
- widget = get_widget (d, "account-password-button-label");
+ widget = get_widget (self, "account-password-button-label");
gtk_label_set_label (GTK_LABEL (widget), get_password_mode_text (user));
enable = act_user_is_local_account (user);
gtk_widget_set_sensitive (widget, enable);
- widget = get_widget (d, "autologin-switch");
- g_signal_handlers_block_by_func (widget, autologin_changed, d);
+ widget = get_widget (self, "autologin-switch");
+ g_signal_handlers_block_by_func (widget, autologin_changed, self);
gtk_switch_set_active (GTK_SWITCH (widget), act_user_get_automatic_login (user));
- g_signal_handlers_unblock_by_func (widget, autologin_changed, d);
+ g_signal_handlers_unblock_by_func (widget, autologin_changed, self);
gtk_widget_set_sensitive (widget, get_autologin_possible (user));
- widget = get_widget (d, "account-language-button-label");
+ widget = get_widget (self, "account-language-button-label");
name = NULL;
lang = g_strdup (act_user_get_language (user));
@@ -866,35 +863,35 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
g_free (name);
/* Fingerprint: show when self, local, enabled, and possible */
- widget = get_widget (d, "account-fingerprint-button");
- label = get_widget (d, "account-fingerprint-label");
+ widget = get_widget (self, "account-fingerprint-button");
+ label = get_widget (self, "account-fingerprint-label");
show = (act_user_get_uid (user) == getuid() &&
act_user_is_local_account (user) &&
- (d->login_screen_settings &&
- g_settings_get_boolean (d->login_screen_settings, "enable-fingerprint-authentication")) &&
+ (self->login_screen_settings &&
+ g_settings_get_boolean (self->login_screen_settings, "enable-fingerprint-authentication")) &&
set_fingerprint_label (widget));
gtk_widget_set_visible (label, show);
gtk_widget_set_visible (widget, show);
/* Autologin: show when local account */
- widget = get_widget (d, "autologin-box");
- label = get_widget (d, "autologin-label");
+ widget = get_widget (self, "autologin-box");
+ label = get_widget (self, "autologin-label");
show = act_user_is_local_account (user);
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
/* Language: do not show for current user */
- widget = get_widget (d, "account-language-button");
- label = get_widget (d, "language-label");
+ widget = get_widget (self, "account-language-button");
+ label = get_widget (self, "language-label");
show = act_user_get_uid (user) != getuid();
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
/* Last login: show when administrator or current user */
- widget = get_widget (d, "last-login-button");
- label = get_widget (d, "last-login-button-label");
+ widget = get_widget (self, "last-login-button");
+ label = get_widget (self, "last-login-button-label");
- current = act_user_manager_get_user_by_id (d->um, getuid ());
+ current = act_user_manager_get_user_by_id (self->um, getuid ());
show = act_user_get_uid (user) == getuid () ||
act_user_get_account_type (current) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
if (show) {
@@ -902,25 +899,25 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
}
- label = get_widget (d, "last-login-label");
+ label = get_widget (self, "last-login-label");
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
enable = act_user_get_login_history (user) != NULL;
gtk_widget_set_sensitive (widget, enable);
- if (d->permission != NULL)
- on_permission_changed (d->permission, NULL, d);
+ if (self->permission != NULL)
+ on_permission_changed (self->permission, NULL, self);
}
static void
change_name_done (GtkWidget *entry,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
const gchar *text;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_strcmp0 (text, act_user_get_real_name (user)) != 0 &&
@@ -932,20 +929,20 @@ change_name_done (GtkWidget *entry,
static void
change_name_focus_out (GtkWidget *entry,
GdkEvent *event,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
- change_name_done (entry, d);
+ change_name_done (entry, self);
}
static void
account_type_changed (GtkToggleButton *button,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
gint account_type;
gboolean self_selected;
- user = get_selected_user (d);
+ user = get_selected_user (self);
self_selected = act_user_get_uid (user) == geteuid ();
account_type = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) ? ACT_USER_ACCOUNT_TYPE_STANDARD : ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
@@ -954,22 +951,22 @@ account_type_changed (GtkToggleButton *button,
act_user_set_account_type (user, account_type);
if (self_selected)
- show_restart_notification (d, NULL);
+ show_restart_notification (self, NULL);
}
}
static void
-dismiss_notification (CcUserPanelPrivate *d)
+dismiss_notification (CcUserPanel *self)
{
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), FALSE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), FALSE);
}
static void
-restart_now (CcUserPanelPrivate *d)
+restart_now (CcUserPanel *self)
{
GDBusConnection *bus;
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), FALSE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), FALSE);
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
g_dbus_connection_call (bus,
@@ -984,7 +981,7 @@ restart_now (CcUserPanelPrivate *d)
}
static void
-show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
+show_restart_notification (CcUserPanel *self, const gchar *locale)
{
gchar *current_locale;
@@ -993,7 +990,7 @@ show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
setlocale (LC_MESSAGES, locale);
}
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), TRUE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), TRUE);
if (locale) {
setlocale (LC_MESSAGES, current_locale);
@@ -1004,7 +1001,7 @@ show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
static void
language_response (GtkDialog *dialog,
gint response_id,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
GtkWidget *button;
ActUser *user;
@@ -1016,7 +1013,7 @@ language_response (GtkDialog *dialog,
return;
}
- user = get_selected_user (d);
+ user = get_selected_user (self);
account_language = act_user_get_language (user);
lang = cc_language_chooser_get_language (GTK_WIDGET (dialog));
@@ -1025,7 +1022,7 @@ language_response (GtkDialog *dialog,
act_user_set_language (user, lang);
}
- button = get_widget (d, "account-language-button-label");
+ button = get_widget (self, "account-language-button-label");
name = gnome_get_language_from_locale (lang, NULL);
gtk_label_set_label (GTK_LABEL (button), name);
g_free (name);
@@ -1036,81 +1033,81 @@ language_response (GtkDialog *dialog,
static void
change_language (GtkButton *button,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
const gchar *current_language;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
current_language = act_user_get_language (user);
- if (d->language_chooser) {
- cc_language_chooser_clear_filter (d->language_chooser);
- cc_language_chooser_set_language (d->language_chooser, NULL);
+ if (self->language_chooser) {
+ cc_language_chooser_clear_filter (self->language_chooser);
+ cc_language_chooser_set_language (self->language_chooser, NULL);
}
else {
- d->language_chooser = cc_language_chooser_new (gtk_widget_get_toplevel (d->main_box));
+ self->language_chooser = cc_language_chooser_new (gtk_widget_get_toplevel (self->main_box));
- g_signal_connect (d->language_chooser, "response",
- G_CALLBACK (language_response), d);
- g_signal_connect (d->language_chooser, "delete-event",
+ g_signal_connect (self->language_chooser, "response",
+ G_CALLBACK (language_response), self);
+ g_signal_connect (self->language_chooser, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- gdk_window_set_cursor (gtk_widget_get_window (gtk_widget_get_toplevel (d->main_box)), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (gtk_widget_get_toplevel (self->main_box)), NULL);
}
if (current_language && *current_language != '\0')
- cc_language_chooser_set_language (d->language_chooser, current_language);
- gtk_window_present (GTK_WINDOW (d->language_chooser));
+ cc_language_chooser_set_language (self->language_chooser, current_language);
+ gtk_window_present (GTK_WINDOW (self->language_chooser));
}
static void
-change_password (GtkButton *button, CcUserPanelPrivate *d)
+change_password (GtkButton *button, CcUserPanel *self)
{
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
- um_password_dialog_set_user (d->password_dialog, user);
- um_password_dialog_show (d->password_dialog,
- GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)));
+ um_password_dialog_set_user (self->password_dialog, user);
+ um_password_dialog_show (self->password_dialog,
+ GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)));
}
static void
-change_fingerprint (GtkButton *button, CcUserPanelPrivate *d)
+change_fingerprint (GtkButton *button, CcUserPanel *self)
{
GtkWidget *widget;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
g_assert (g_strcmp0 (g_get_user_name (), act_user_get_user_name (user)) == 0);
- widget = get_widget (d, "account-fingerprint-button");
- fingerprint_button_clicked (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)), widget, user);
+ widget = get_widget (self, "account-fingerprint-button");
+ fingerprint_button_clicked (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)), widget, user);
}
static void
-show_history (GtkButton *button, CcUserPanelPrivate *d)
+show_history (GtkButton *button, CcUserPanel *self)
{
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
- um_history_dialog_set_user (d->history_dialog, user);
- um_history_dialog_show (d->history_dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)));
+ um_history_dialog_set_user (self->history_dialog, user);
+ um_history_dialog_show (self->history_dialog, GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)));
}
static void
users_loaded (ActUserManager *manager,
GParamSpec *pspec,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
GtkWidget *dialog;
- if (act_user_manager_no_service (d->um)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ if (act_user_manager_no_service (self->um)) {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
GTK_DIALOG_MODAL,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_CLOSE,
@@ -1122,19 +1119,19 @@ users_loaded (ActUserManager *manager,
dialog);
gtk_widget_show (dialog);
- gtk_widget_set_sensitive (d->main_box, FALSE);
+ gtk_widget_set_sensitive (self->main_box, FALSE);
}
- g_signal_connect (d->um, "user-changed", G_CALLBACK (user_changed), d);
- g_signal_connect (d->um, "user-is-logged-in-changed", G_CALLBACK (user_changed), d);
- g_signal_connect (d->um, "user-added", G_CALLBACK (user_added), d);
- g_signal_connect (d->um, "user-removed", G_CALLBACK (user_removed), d);
+ g_signal_connect (self->um, "user-changed", G_CALLBACK (user_changed), self);
+ g_signal_connect (self->um, "user-is-logged-in-changed", G_CALLBACK (user_changed), self);
+ g_signal_connect (self->um, "user-added", G_CALLBACK (user_added), self);
+ g_signal_connect (self->um, "user-removed", G_CALLBACK (user_removed), self);
- reload_users (d, NULL);
+ reload_users (self, NULL);
/* Show the current user firstly. */
- user = act_user_manager_get_user_by_id (d->um, getuid ());
- show_user (user, d);
+ user = act_user_manager_get_user_by_id (self->um, getuid ());
+ show_user (user, self);
}
static void
@@ -1173,23 +1170,23 @@ on_permission_changed (GPermission *permission,
GParamSpec *pspec,
gpointer data)
{
- CcUserPanelPrivate *d = data;
+ CcUserPanel *self = data;
gboolean is_authorized;
gboolean self_selected;
ActUser *user;
GtkWidget *widget;
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (!user) {
return;
}
- is_authorized = g_permission_get_allowed (G_PERMISSION (d->permission));
+ is_authorized = g_permission_get_allowed (G_PERMISSION (self->permission));
self_selected = act_user_get_uid (user) == geteuid ();
- gtk_stack_set_visible_child_name (GTK_STACK (d->headerbar_buttons), is_authorized ? PAGE_ADDUSER : PAGE_LOCK);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->headerbar_buttons), is_authorized ? PAGE_ADDUSER : PAGE_LOCK);
- widget = get_widget (d, "add-user-toolbutton");
+ widget = get_widget (self, "add-user-toolbutton");
gtk_widget_set_sensitive (widget, is_authorized);
if (is_authorized) {
setup_tooltip_with_embedded_icon (widget, _("Create a user account"), NULL, NULL);
@@ -1209,7 +1206,7 @@ on_permission_changed (GPermission *permission,
g_object_unref (icon);
}
- widget = get_widget (d, "remove-user-toolbutton");
+ widget = get_widget (self, "remove-user-toolbutton");
gtk_widget_set_sensitive (widget, is_authorized && !self_selected
&& !would_demote_only_admin (user));
if (is_authorized) {
@@ -1232,35 +1229,35 @@ on_permission_changed (GPermission *permission,
}
if (!act_user_is_local_account (user)) {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
- remove_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")), FALSE);
+ remove_unlock_tooltip (get_widget (self, "autologin-switch"));
} else if (is_authorized && act_user_is_local_account (user)) {
if (would_demote_only_admin (user)) {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
} else {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), TRUE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), TRUE);
}
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), get_autologin_possible (user));
- remove_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")), get_autologin_possible (user));
+ remove_unlock_tooltip (get_widget (self, "autologin-switch"));
}
else {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
if (would_demote_only_admin (user)) {
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
} else {
- add_unlock_tooltip (get_widget (d, "account-type-box"));
+ add_unlock_tooltip (get_widget (self, "account-type-box"));
}
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
- add_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")), FALSE);
+ add_unlock_tooltip (get_widget (self, "autologin-switch"));
}
/* The full name entry: insensitive if remote or not authorized and not self */
- widget = get_widget (d, "full-name-entry");
+ widget = get_widget (self, "full-name-entry");
if (!act_user_is_local_account (user)) {
gtk_widget_set_sensitive (widget, FALSE);
remove_unlock_tooltip (widget);
@@ -1275,108 +1272,107 @@ on_permission_changed (GPermission *permission,
}
if (is_authorized || self_selected) {
- gtk_stack_set_visible_child (GTK_STACK (get_widget (d, "user-icon")),
- get_widget (d, "user-icon-button"));
+ gtk_stack_set_visible_child (GTK_STACK (get_widget (self, "user-icon")),
+ get_widget (self, "user-icon-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-language-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-language-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-language-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-language-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-password-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-password-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-password-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-password-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-fingerprint-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-fingerprint-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-fingerprint-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-fingerprint-button"));
- gtk_widget_set_sensitive (get_widget (d, "last-login-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "last-login-button"));
+ gtk_widget_set_sensitive (get_widget (self, "last-login-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "last-login-button"));
}
else {
- gtk_stack_set_visible_child (GTK_STACK (get_widget (d, "user-icon")),
- get_widget (d, "user-icon-image"));
+ gtk_stack_set_visible_child (GTK_STACK (get_widget (self, "user-icon")),
+ get_widget (self, "user-icon-image"));
- gtk_widget_set_sensitive (get_widget (d, "account-language-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-language-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-language-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-language-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-password-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-password-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-password-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-password-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-fingerprint-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-fingerprint-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-fingerprint-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-fingerprint-button"));
- gtk_widget_set_sensitive (get_widget (d, "last-login-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "last-login-button"));
+ gtk_widget_set_sensitive (get_widget (self, "last-login-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "last-login-button"));
}
- um_password_dialog_set_user (d->password_dialog, user);
+ um_password_dialog_set_user (self->password_dialog, user);
}
static void
setup_main_window (CcUserPanel *self)
{
- CcUserPanelPrivate *d = self->priv;
GtkWidget *button;
GIcon *icon;
GError *error = NULL;
gchar *names[3];
gboolean loaded;
- d->notification = get_widget (d, "notification");
+ self->notification = get_widget (self, "notification");
- button = get_widget (d, "restart-button");
- g_signal_connect_swapped (button, "clicked", G_CALLBACK (restart_now), d);
+ button = get_widget (self, "restart-button");
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (restart_now), self);
- button = get_widget (d, "dismiss-button");
- g_signal_connect_swapped (button, "clicked", G_CALLBACK (dismiss_notification), d);
+ button = get_widget (self, "dismiss-button");
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (dismiss_notification), self);
- d->other_accounts = 0;
+ self->other_accounts = 0;
- d->carousel = UM_CAROUSEL (get_widget (d, "carousel"));
- g_signal_connect (d->carousel, "item-activated", G_CALLBACK (set_selected_user), d);
+ self->carousel = UM_CAROUSEL (get_widget (self, "carousel"));
+ g_signal_connect (self->carousel, "item-activated", G_CALLBACK (set_selected_user), self);
- button = get_widget (d, "add-user-toolbutton");
- g_signal_connect (button, "clicked", G_CALLBACK (add_user), d);
+ button = get_widget (self, "add-user-toolbutton");
+ g_signal_connect (button, "clicked", G_CALLBACK (add_user), self);
- button = get_widget (d, "remove-user-toolbutton");
+ button = get_widget (self, "remove-user-toolbutton");
g_signal_connect (button, "clicked", G_CALLBACK (delete_user), self);
- button = get_widget (d, "user-icon-image");
+ button = get_widget (self, "user-icon-image");
add_unlock_tooltip (button);
- button = get_widget (d, "full-name-entry");
- g_signal_connect (button, "activate", G_CALLBACK (change_name_done), d);
- g_signal_connect (button, "focus-out-event", G_CALLBACK (change_name_focus_out), d);
+ button = get_widget (self, "full-name-entry");
+ g_signal_connect (button, "activate", G_CALLBACK (change_name_done), self);
+ g_signal_connect (button, "focus-out-event", G_CALLBACK (change_name_focus_out), self);
- button = get_widget (d, "account-type-standard");
- g_signal_connect (button, "toggled", G_CALLBACK (account_type_changed), d);
+ button = get_widget (self, "account-type-standard");
+ g_signal_connect (button, "toggled", G_CALLBACK (account_type_changed), self);
- button = get_widget (d, "account-password-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_password), d);
+ button = get_widget (self, "account-password-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_password), self);
- button = get_widget (d, "account-language-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_language), d);
+ button = get_widget (self, "account-language-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_language), self);
- button = get_widget (d, "autologin-switch");
- g_signal_connect (button, "notify::active", G_CALLBACK (autologin_changed), d);
+ button = get_widget (self, "autologin-switch");
+ g_signal_connect (button, "notify::active", G_CALLBACK (autologin_changed), self);
- button = get_widget (d, "account-fingerprint-button");
+ button = get_widget (self, "account-fingerprint-button");
g_signal_connect (button, "clicked",
- G_CALLBACK (change_fingerprint), d);
+ G_CALLBACK (change_fingerprint), self);
- button = get_widget (d, "last-login-button");
+ button = get_widget (self, "last-login-button");
g_signal_connect (button, "clicked",
- G_CALLBACK (show_history), d);
+ G_CALLBACK (show_history), self);
- d->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL, &error);
- if (d->permission != NULL) {
- g_signal_connect (d->permission, "notify",
- G_CALLBACK (on_permission_changed), d);
- on_permission_changed (d->permission, NULL, d);
+ self->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL, &error);
+ if (self->permission != NULL) {
+ g_signal_connect (self->permission, "notify",
+ G_CALLBACK (on_permission_changed), self);
+ on_permission_changed (self->permission, NULL, self);
} else {
g_warning ("Cannot create '%s' permission: %s", USER_ACCOUNTS_PERMISSION, error->message);
g_error_free (error);
}
- button = get_widget (d, "add-user-toolbutton");
+ button = get_widget (self, "add-user-toolbutton");
names[0] = "changes-allow-symbolic";
names[1] = "changes-allow";
names[2] = NULL;
@@ -1385,18 +1381,18 @@ setup_main_window (CcUserPanel *self)
_("To create a user account,\nclick the * icon first"),
"*",
icon);
- button = get_widget (d, "remove-user-toolbutton");
+ button = get_widget (self, "remove-user-toolbutton");
setup_tooltip_with_embedded_icon (button,
_("To delete the selected user account,\nclick the * icon first"),
"*",
icon);
g_object_unref (icon);
- g_object_get (d->um, "is-loaded", &loaded, NULL);
+ g_object_get (self->um, "is-loaded", &loaded, NULL);
if (loaded)
- users_loaded (d->um, NULL, d);
+ users_loaded (self->um, NULL, self);
else
- g_signal_connect (d->um, "notify::is-loaded", G_CALLBACK (users_loaded), d);
+ g_signal_connect (self->um, "notify::is-loaded", G_CALLBACK (users_loaded), self);
}
static GSettings *
@@ -1425,31 +1421,27 @@ settings_or_null (const gchar *schema)
static void
cc_user_panel_constructed (GObject *object)
{
- CcUserPanelPrivate *d;
CcUserPanel *self = UM_USER_PANEL (object);
GtkWidget *button;
CcShell *shell;
G_OBJECT_CLASS (cc_user_panel_parent_class)->constructed (object);
- d = self->priv;
shell = cc_panel_get_shell (CC_PANEL (self));
- cc_shell_embed_widget_in_header (shell, d->headerbar_buttons);
+ cc_shell_embed_widget_in_header (shell, self->headerbar_buttons);
- button = get_widget (d, "lock-button");
- gtk_lock_button_set_permission (GTK_LOCK_BUTTON (button), d->permission);
+ button = get_widget (self, "lock-button");
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (button), self->permission);
}
static void
cc_user_panel_init (CcUserPanel *self)
{
- CcUserPanelPrivate *d;
GError *error;
volatile GType type G_GNUC_UNUSED;
GtkWidget *button;
GtkCssProvider *provider;
- d = self->priv = UM_USER_PANEL_PRIVATE (self);
g_resources_register (um_get_resource ());
/* register types that the builder might need */
@@ -1457,12 +1449,12 @@ cc_user_panel_init (CcUserPanel *self)
type = um_cell_renderer_user_image_get_type ();
type = um_carousel_get_type ();
- d->builder = gtk_builder_new ();
- d->um = act_user_manager_get_default ();
- d->cancellable = g_cancellable_new ();
+ self->builder = gtk_builder_new ();
+ self->um = act_user_manager_get_default ();
+ self->cancellable = g_cancellable_new ();
error = NULL;
- if (!gtk_builder_add_from_resource (d->builder,
+ if (!gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/user-accounts/user-accounts-dialog.ui",
&error)) {
g_error ("%s", error->message);
@@ -1477,59 +1469,59 @@ cc_user_panel_init (CcUserPanel *self)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
- d->headerbar_buttons = get_widget (d, "headerbar-buttons");
- d->login_screen_settings = settings_or_null ("org.gnome.login-screen");
+ self->headerbar_buttons = get_widget (self, "headerbar-buttons");
+ self->login_screen_settings = settings_or_null ("org.gnome.login-screen");
- d->password_dialog = um_password_dialog_new ();
- button = get_widget (d, "user-icon-button");
- d->photo_dialog = um_photo_dialog_new (button);
- d->main_box = get_widget (d, "accounts-vbox");
- gtk_container_add (GTK_CONTAINER (self), get_widget (d, "overlay"));
- d->history_dialog = um_history_dialog_new ();
+ self->password_dialog = um_password_dialog_new ();
+ button = get_widget (self, "user-icon-button");
+ self->photo_dialog = um_photo_dialog_new (button);
+ self->main_box = get_widget (self, "accounts-vbox");
+ gtk_container_add (GTK_CONTAINER (self), get_widget (self, "overlay"));
+ self->history_dialog = um_history_dialog_new ();
setup_main_window (self);
}
static void
cc_user_panel_dispose (GObject *object)
{
- CcUserPanelPrivate *priv = UM_USER_PANEL (object)->priv;
+ CcUserPanel *self = UM_USER_PANEL (object);
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
- g_clear_object (&priv->login_screen_settings);
+ g_clear_object (&self->login_screen_settings);
- if (priv->um) {
- g_signal_handlers_disconnect_by_data (priv->um, priv);
- priv->um = NULL;
+ if (self->um) {
+ g_signal_handlers_disconnect_by_data (self->um, self);
+ self->um = NULL;
}
- if (priv->builder) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ if (self->builder) {
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->password_dialog) {
- um_password_dialog_free (priv->password_dialog);
- priv->password_dialog = NULL;
+ if (self->password_dialog) {
+ um_password_dialog_free (self->password_dialog);
+ self->password_dialog = NULL;
}
- if (priv->photo_dialog) {
- um_photo_dialog_free (priv->photo_dialog);
- priv->photo_dialog = NULL;
+ if (self->photo_dialog) {
+ um_photo_dialog_free (self->photo_dialog);
+ self->photo_dialog = NULL;
}
- if (priv->history_dialog) {
- um_history_dialog_free (priv->history_dialog);
- priv->history_dialog = NULL;
+ if (self->history_dialog) {
+ um_history_dialog_free (self->history_dialog);
+ self->history_dialog = NULL;
}
- if (priv->account_dialog) {
- gtk_dialog_response (GTK_DIALOG (priv->account_dialog), GTK_RESPONSE_DELETE_EVENT);
- priv->account_dialog = NULL;
+ if (self->account_dialog) {
+ gtk_dialog_response (GTK_DIALOG (self->account_dialog), GTK_RESPONSE_DELETE_EVENT);
+ self->account_dialog = NULL;
}
- if (priv->language_chooser) {
- gtk_widget_destroy (priv->language_chooser);
- priv->language_chooser = NULL;
+ if (self->language_chooser) {
+ gtk_widget_destroy (self->language_chooser);
+ self->language_chooser = NULL;
}
- if (priv->permission) {
- g_object_unref (priv->permission);
- priv->permission = NULL;
+ if (self->permission) {
+ g_object_unref (self->permission);
+ self->permission = NULL;
}
G_OBJECT_CLASS (cc_user_panel_parent_class)->dispose (object);
}
@@ -1550,6 +1542,4 @@ cc_user_panel_class_init (CcUserPanelClass *klass)
object_class->constructed = cc_user_panel_constructed;
panel_class->get_help_uri = cc_user_panel_get_help_uri;
-
- g_type_class_add_private (klass, sizeof (CcUserPanelPrivate));
}
diff --git a/panels/user-accounts/um-user-panel.h b/panels/user-accounts/um-user-panel.h
index 8e49650d6..a5cc79dae 100644
--- a/panels/user-accounts/um-user-panel.h
+++ b/panels/user-accounts/um-user-panel.h
@@ -25,31 +25,8 @@
G_BEGIN_DECLS
-#define UM_TYPE_USER_PANEL cc_user_panel_get_type()
-
-#define UM_USER_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_USER_PANEL, CcUserPanel))
-#define UM_USER_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_USER_PANEL, CcUserPanelClass))
-#define UM_IS_USER_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_USER_PANEL))
-#define UM_IS_USER_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_USER_PANEL))
-#define UM_USER_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_USER_PANEL, CcUserPanelClass))
-
-typedef struct _CcUserPanel CcUserPanel;
-typedef struct _CcUserPanelClass CcUserPanelClass;
-typedef struct _CcUserPanelPrivate CcUserPanelPrivate;
-
-struct _CcUserPanel
-{
- CcPanel parent;
-
- CcUserPanelPrivate *priv;
-};
-
-struct _CcUserPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_user_panel_get_type (void) G_GNUC_CONST;
+#define UM_TYPE_USER_PANEL (cc_user_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcUserPanel, cc_user_panel, UM, USER_PANEL, CcPanel)
G_END_DECLS
diff --git a/panels/wacom/calibrator/cc-clock-actor.c b/panels/wacom/calibrator/cc-clock-actor.c
index afe2d9d72..c84fb5bc4 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 5ba1a818c..f6e2b2e97 100644
--- a/panels/wacom/calibrator/cc-clock-actor.h
+++ b/panels/wacom/calibrator/cc-clock-actor.h
@@ -25,31 +25,11 @@
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))
-
-typedef struct _CcClockActor CcClockActor;
-typedef struct _CcClockActorClass CcClockActorClass;
-
-struct _CcClockActor
-{
- ClutterActor parent_instance;
-
- /*< private >*/
- gfloat angle;
-};
-
-struct _CcClockActorClass
-{
- ClutterActorClass parent_class;
-};
+#define CC_CLOCK_ACTOR_TYPE (cc_clock_actor_get_type ())
+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 34fa1e3ee..b75d877a2 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 891f48cc1..9ac7c2f58 100644
--- a/panels/wacom/calibrator/cc-target-actor.h
+++ b/panels/wacom/calibrator/cc-target-actor.h
@@ -25,35 +25,15 @@
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-drawing-area.h b/panels/wacom/cc-drawing-area.h
index a994f48c2..936716350 100644
--- a/panels/wacom/cc-drawing-area.h
+++ b/panels/wacom/cc-drawing-area.h
@@ -24,13 +24,10 @@
G_BEGIN_DECLS
-#define CC_TYPE_DRAWING_AREA cc_drawing_area_get_type()
-
+#define CC_TYPE_DRAWING_AREA (cc_drawing_area_get_type ())
G_DECLARE_FINAL_TYPE (CcDrawingArea, cc_drawing_area, CC, DRAWING_AREA, GtkEventBox)
-GType cc_drawing_area_get_type (void) G_GNUC_CONST;
-
-GtkWidget *cc_drawing_area_new (void);
+GtkWidget *cc_drawing_area_new (void);
G_END_DECLS
diff --git a/panels/wacom/cc-tablet-tool-map.h b/panels/wacom/cc-tablet-tool-map.h
index 24632021a..5e542a826 100644
--- a/panels/wacom/cc-tablet-tool-map.h
+++ b/panels/wacom/cc-tablet-tool-map.h
@@ -29,7 +29,6 @@
G_BEGIN_DECLS
#define CC_TYPE_TABLET_TOOL_MAP (cc_tablet_tool_map_get_type ())
-
G_DECLARE_FINAL_TYPE (CcTabletToolMap, cc_tablet_tool_map, CC, TABLET_TOOL_MAP, GObject)
CcTabletToolMap * cc_tablet_tool_map_new (void);
diff --git a/panels/wacom/cc-wacom-button-row.c b/panels/wacom/cc-wacom-button-row.c
index 52b1d00aa..c897d7d6c 100644
--- a/panels/wacom/cc-wacom-button-row.c
+++ b/panels/wacom/cc-wacom-button-row.c
@@ -23,8 +23,6 @@
#include "gsd-wacom-key-shortcut-button.h"
#include "cc-wacom-button-row.h"
-G_DEFINE_TYPE (CcWacomButtonRow, cc_wacom_button_row, GTK_TYPE_LIST_BOX_ROW)
-
#define ACTION_KEY "action"
#define KEYBINDING_KEY "keybinding"
@@ -36,7 +34,8 @@ enum {
ACTION_N_COLUMNS
};
-struct _CcWacomButtonRowPrivate {
+struct _CcWacomButtonRow {
+ GtkListBoxRow parent_instance;
guint button;
GSettings *settings;
GtkDirectionType direction;
@@ -44,6 +43,8 @@ struct _CcWacomButtonRowPrivate {
GsdWacomKeyShortcutButton *key_shortcut_button;
};
+G_DEFINE_TYPE (CcWacomButtonRow, cc_wacom_button_row, GTK_TYPE_LIST_BOX_ROW)
+
static GtkWidget *
create_actions_combo (void)
{
@@ -78,7 +79,6 @@ static void
cc_wacom_button_row_update_shortcut (CcWacomButtonRow *row,
GDesktopPadButtonAction action_type)
{
- CcWacomButtonRowPrivate *priv;
guint keyval;
GdkModifierType mask;
char *shortcut;
@@ -86,14 +86,13 @@ cc_wacom_button_row_update_shortcut (CcWacomButtonRow *row,
if (action_type != G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING)
return;
- priv = row->priv;
- shortcut = g_settings_get_string (row->priv->settings, KEYBINDING_KEY);
+ shortcut = g_settings_get_string (row->settings, KEYBINDING_KEY);
if (shortcut != NULL)
{
gtk_accelerator_parse (shortcut, &keyval, &mask);
- g_object_set (priv->key_shortcut_button,
+ g_object_set (row->key_shortcut_button,
"key-value", keyval,
"key-mods", mask,
NULL);
@@ -106,15 +105,12 @@ static void
cc_wacom_button_row_update_action (CcWacomButtonRow *row,
GDesktopPadButtonAction action_type)
{
- CcWacomButtonRowPrivate *priv;
GtkTreeIter iter;
gboolean iter_valid;
GDesktopPadButtonAction current_action_type, real_action_type;
GtkTreeModel *model;
- priv = row->priv;
-
- model = gtk_combo_box_get_model (priv->action_combo);
+ model = gtk_combo_box_get_model (row->action_combo);
real_action_type = action_type;
for (iter_valid = gtk_tree_model_get_iter_first (model, &iter); iter_valid;
@@ -126,7 +122,7 @@ cc_wacom_button_row_update_action (CcWacomButtonRow *row,
if (current_action_type == real_action_type)
{
- gtk_combo_box_set_active_iter (priv->action_combo, &iter);
+ gtk_combo_box_set_active_iter (row->action_combo, &iter);
break;
}
}
@@ -135,18 +131,15 @@ cc_wacom_button_row_update_action (CcWacomButtonRow *row,
static void
cc_wacom_button_row_update (CcWacomButtonRow *row)
{
- CcWacomButtonRowPrivate *priv;
GDesktopPadButtonAction current_action_type;
- priv = row->priv;
-
- current_action_type = g_settings_get_enum (priv->settings, ACTION_KEY);
+ current_action_type = g_settings_get_enum (row->settings, ACTION_KEY);
cc_wacom_button_row_update_shortcut (row, current_action_type);
cc_wacom_button_row_update_action (row, current_action_type);
- gtk_widget_set_sensitive (GTK_WIDGET (row->priv->key_shortcut_button),
+ gtk_widget_set_sensitive (GTK_WIDGET (row->key_shortcut_button),
current_action_type == G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING);
}
@@ -154,8 +147,8 @@ static void
change_button_action_type (CcWacomButtonRow *row,
GDesktopPadButtonAction type)
{
- g_settings_set_enum (row->priv->settings, ACTION_KEY, type);
- gtk_widget_set_sensitive (GTK_WIDGET (row->priv->key_shortcut_button),
+ g_settings_set_enum (row->settings, ACTION_KEY, type);
+ gtk_widget_set_sensitive (GTK_WIDGET (row->key_shortcut_button),
type == G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING);
}
@@ -169,7 +162,7 @@ on_key_shortcut_edited (GsdWacomKeyShortcutButton *shortcut_button,
change_button_action_type (row, G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING);
- g_object_get (row->priv->key_shortcut_button,
+ g_object_get (row->key_shortcut_button,
"key-value", &keyval,
"key-mods", &mask,
NULL);
@@ -178,7 +171,7 @@ on_key_shortcut_edited (GsdWacomKeyShortcutButton *shortcut_button,
custom_key = gtk_accelerator_name (keyval, mask);
- g_settings_set_string (row->priv->settings, KEYBINDING_KEY, custom_key);
+ g_settings_set_string (row->settings, KEYBINDING_KEY, custom_key);
g_free (custom_key);
}
@@ -232,31 +225,25 @@ on_key_shortcut_button_press_event (GsdWacomKeyShortcutButton *button,
static void
cc_wacom_button_row_class_init (CcWacomButtonRowClass *button_row_class)
{
- g_type_class_add_private (button_row_class, sizeof (CcWacomButtonRowPrivate));
}
static void
cc_wacom_button_row_init (CcWacomButtonRow *button_row)
{
- button_row->priv = G_TYPE_INSTANCE_GET_PRIVATE (button_row,
- CC_WACOM_TYPE_BUTTON_ROW,
- CcWacomButtonRowPrivate);
}
GtkWidget *
cc_wacom_button_row_new (guint button,
GSettings *settings)
{
- GtkWidget *row;
+ CcWacomButtonRow *row;
GtkWidget *grid, *combo, *label, *shortcut_button;
- CcWacomButtonRowPrivate *priv;
char *name = NULL;
- row = g_object_new (CC_WACOM_TYPE_BUTTON_ROW, NULL);
- priv = CC_WACOM_BUTTON_ROW (row)->priv;
+ row = CC_WACOM_BUTTON_ROW (g_object_new (CC_WACOM_TYPE_BUTTON_ROW, NULL));
- priv->button = button;
- priv->settings = g_object_ref (settings);
+ row->button = button;
+ row->settings = g_object_ref (settings);
grid = gtk_grid_new ();
gtk_widget_show (grid);
@@ -272,7 +259,7 @@ cc_wacom_button_row_new (guint button,
combo = create_actions_combo ();
gtk_grid_attach (GTK_GRID (grid), combo, 1, 0, 1, 1);
gtk_widget_show (combo);
- priv->action_combo = GTK_COMBO_BOX (combo);
+ row->action_combo = GTK_COMBO_BOX (combo);
g_signal_connect (combo, "changed",
G_CALLBACK (on_row_action_combo_box_changed), row);
@@ -280,7 +267,7 @@ cc_wacom_button_row_new (guint button,
g_object_set (shortcut_button, "mode", GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL, NULL);
gtk_grid_attach (GTK_GRID (grid), shortcut_button, 2, 0, 1, 1);
gtk_widget_show (shortcut_button);
- priv->key_shortcut_button = GSD_WACOM_KEY_SHORTCUT_BUTTON (shortcut_button);
+ row->key_shortcut_button = GSD_WACOM_KEY_SHORTCUT_BUTTON (shortcut_button);
g_signal_connect (shortcut_button, "key-shortcut-cleared",
G_CALLBACK (on_key_shortcut_cleared),
row);
@@ -297,5 +284,5 @@ cc_wacom_button_row_new (guint button,
g_free (name);
- return row;
+ return GTK_WIDGET (row);
}
diff --git a/panels/wacom/cc-wacom-button-row.h b/panels/wacom/cc-wacom-button-row.h
index ee6ecbb67..91cb17e4d 100644
--- a/panels/wacom/cc-wacom-button-row.h
+++ b/panels/wacom/cc-wacom-button-row.h
@@ -25,26 +25,8 @@
G_BEGIN_DECLS
-#define CC_WACOM_TYPE_BUTTON_ROW (cc_wacom_button_row_get_type ())
-#define CC_WACOM_BUTTON_ROW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_WACOM_TYPE_BUTTON_ROW, CcWacomButtonRow))
-#define CC_WACOM_BUTTON_ROW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_WACOM_BUTTON_ROW, CcWacomButtonRowClass))
-#define CC_WACOM_IS_BUTTON_ROW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_WACOM_TYPE_BUTTON_ROW))
-#define CC_WACOM_IS_BUTTON_ROW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_WACOM_TYPE_BUTTON_ROW))
-#define CC_WACOM_BUTTON_ROW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_WACOM_TYPE_BUTTON_ROW, CcWacomButtonRowClass))
-
-typedef struct _CcWacomButtonRow CcWacomButtonRow;
-typedef struct _CcWacomButtonRowClass CcWacomButtonRowClass;
-typedef struct _CcWacomButtonRowPrivate CcWacomButtonRowPrivate;
-
-struct _CcWacomButtonRow {
- GtkListBoxRow parent;
-
- CcWacomButtonRowPrivate *priv;
-};
-
-struct _CcWacomButtonRowClass {
- GtkListBoxRowClass parent_class;
-};
+#define CC_WACOM_TYPE_BUTTON_ROW (cc_wacom_button_row_get_type ())
+G_DECLARE_FINAL_TYPE (CcWacomButtonRow, cc_wacom_button_row, CC, WACOM_BUTTON_ROW, GtkListBoxRow)
static struct {
GDesktopPadButtonAction action_type;
@@ -56,8 +38,6 @@ static struct {
{ G_DESKTOP_PAD_BUTTON_ACTION_HELP, NC_("Wacom action-type", "Show On-Screen Help") }
};
-GType cc_wacom_button_row_get_type (void);
-
GtkWidget * cc_wacom_button_row_new (guint button,
GSettings *settings);
diff --git a/panels/wacom/cc-wacom-device.h b/panels/wacom/cc-wacom-device.h
index 856065b4c..ffc46f61b 100644
--- a/panels/wacom/cc-wacom-device.h
+++ b/panels/wacom/cc-wacom-device.h
@@ -30,7 +30,6 @@
#include <libgnome-desktop/gnome-rr.h>
#define CC_TYPE_WACOM_DEVICE (cc_wacom_device_get_type ())
-
G_DECLARE_FINAL_TYPE (CcWacomDevice, cc_wacom_device, CC, WACOM_DEVICE, GObject)
WacomDeviceDatabase *
diff --git a/panels/wacom/cc-wacom-mapping-panel.c b/panels/wacom/cc-wacom-mapping-panel.c
index 506a4e873..60664d331 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 ae9dabb73..211126761 100644
--- a/panels/wacom/cc-wacom-mapping-panel.h
+++ b/panels/wacom/cc-wacom-mapping-panel.h
@@ -26,49 +26,11 @@
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;
+#define CC_TYPE_WACOM_MAPPING_PANEL (cc_wacom_mapping_panel_get_type ())
+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 ae7a89d50..938f79f6a 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 325a5eb36..74c0a1453 100644
--- a/panels/wacom/cc-wacom-nav-button.h
+++ b/panels/wacom/cc-wacom-nav-button.h
@@ -25,45 +25,8 @@
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;
+#define CC_TYPE_WACOM_NAV_BUTTON (cc_wacom_nav_button_get_type ())
+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/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index b16d74ff8..a2f07a029 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -47,14 +47,9 @@
#include <string.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
-#define CWID(x) (GtkContainer *) gtk_builder_get_object (priv->builder, x)
-#define MWID(x) (GtkWidget *) gtk_builder_get_object (priv->mapping_builder, x)
-
-G_DEFINE_TYPE (CcWacomPage, cc_wacom_page, GTK_TYPE_BOX)
-
-#define WACOM_PAGE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_PAGE, CcWacomPagePrivate))
+#define WID(x) (GtkWidget *) gtk_builder_get_object (page->builder, x)
+#define CWID(x) (GtkContainer *) gtk_builder_get_object (page->builder, x)
+#define MWID(x) (GtkWidget *) gtk_builder_get_object (page->mapping_builder, x)
#define THRESHOLD_MISCLICK 15
#define THRESHOLD_DOUBLECLICK 7
@@ -67,8 +62,10 @@ enum {
MAPPING_N_COLUMNS
};
-struct _CcWacomPagePrivate
+struct _CcWacomPage
{
+ GtkBox parent_instance;
+
CcWacomPanel *panel;
CcWacomDevice *stylus;
CcWacomDevice *pad;
@@ -92,6 +89,8 @@ struct _CcWacomPagePrivate
GCancellable *cancellable;
};
+G_DEFINE_TYPE (CcWacomPage, cc_wacom_page, GTK_TYPE_BOX)
+
/* Button combo box storage columns */
enum {
BUTTONNUMBER_COLUMN,
@@ -179,7 +178,6 @@ finish_calibration (CalibArea *area,
gpointer user_data)
{
CcWacomPage *page = (CcWacomPage *) user_data;
- CcWacomPagePrivate *priv = page->priv;
XYinfo axis;
gdouble cal[4];
gint display_width, display_height;
@@ -193,21 +191,21 @@ finish_calibration (CalibArea *area,
calib_area_get_display_size (area, &display_width, &display_height);
- set_calibration (page->priv->stylus,
+ set_calibration (page->stylus,
display_width,
display_height,
- cal, 4, priv->wacom_settings);
+ cal, 4, page->wacom_settings);
} else {
/* Reset the old values */
GVariant *old_calibration;
old_calibration = g_object_get_data (G_OBJECT (page), "old-calibration");
- g_settings_set_value (page->priv->wacom_settings, "area", old_calibration);
+ g_settings_set_value (page->wacom_settings, "area", old_calibration);
g_object_set_data (G_OBJECT (page), "old-calibration", NULL);
}
calib_area_free (area);
- priv->area = NULL;
+ page->area = NULL;
gtk_widget_set_sensitive (WID ("button-calibrate"), TRUE);
}
@@ -220,7 +218,7 @@ cc_wacom_page_get_gdk_device (CcWacomPage *page)
GdkDisplay *display;
GList *slaves, *l;
- gsd_device = cc_wacom_device_get_device (page->priv->stylus);
+ gsd_device = cc_wacom_device_get_device (page->stylus);
g_return_val_if_fail (GSD_IS_DEVICE (gsd_device), NULL);
display = gtk_widget_get_display (GTK_WIDGET (page));
@@ -259,13 +257,9 @@ run_calibration (CcWacomPage *page,
gdouble *cal,
gint monitor)
{
- CcWacomPagePrivate *priv;
-
- g_assert (page->priv->area == NULL);
-
- priv = page->priv;
+ g_assert (page->area == NULL);
- priv->area = calib_area_new (NULL,
+ page->area = calib_area_new (NULL,
monitor,
cc_wacom_page_get_gdk_device (page),
finish_calibration,
@@ -284,7 +278,6 @@ run_calibration (CcWacomPage *page,
static void
calibrate (CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
int i;
GVariant *old_calibration, **tmp, *array;
gdouble *calibration;
@@ -296,8 +289,6 @@ calibrate (CcWacomPage *page)
GError *error = NULL;
gint x, y;
- priv = page->priv;
-
screen = gdk_screen_get_default ();
rr_screen = gnome_rr_screen_new (screen, &error);
if (error) {
@@ -306,7 +297,7 @@ calibrate (CcWacomPage *page)
return;
}
- output = cc_wacom_device_get_output (page->priv->stylus, rr_screen);
+ output = cc_wacom_device_get_output (page->stylus, rr_screen);
gnome_rr_output_get_position (output, &x, &y);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
@@ -318,7 +309,7 @@ calibrate (CcWacomPage *page)
return;
}
- old_calibration = g_settings_get_value (page->priv->wacom_settings, "area");
+ old_calibration = g_settings_get_value (page->wacom_settings, "area");
g_variant_get_fixed_array (old_calibration, &ncal, sizeof (gdouble));
if (ncal != 4) {
@@ -337,7 +328,7 @@ calibrate (CcWacomPage *page)
}
array = g_variant_new_array (G_VARIANT_TYPE_DOUBLE, tmp, ncal);
- g_settings_set_value (page->priv->wacom_settings, "area", array);
+ g_settings_set_value (page->wacom_settings, "area", array);
g_free (tmp);
run_calibration (page, old_calibration, calibration, monitor);
@@ -380,17 +371,16 @@ create_row_from_button (GtkWidget *list_box,
static void
setup_button_mapping (CcWacomPage *page)
{
- CcWacomPagePrivate *priv = page->priv;
GDesktopPadButtonAction action;
GtkWidget *list_box;
guint i, n_buttons;
GSettings *settings;
list_box = MWID ("shortcuts_list");
- n_buttons = cc_wacom_device_get_num_buttons (priv->pad);
+ n_buttons = cc_wacom_device_get_num_buttons (page->pad);
for (i = 0; i < n_buttons; i++) {
- settings = cc_wacom_device_get_button_settings (priv->pad, i);
+ settings = cc_wacom_device_get_button_settings (page->pad, i);
if (!settings)
continue;
@@ -407,12 +397,9 @@ button_mapping_dialog_closed (GtkDialog *dialog,
int response_id,
CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
-
- priv = page->priv;
gtk_widget_destroy (MWID ("button-mapping-dialog"));
- g_object_unref (priv->mapping_builder);
- priv->mapping_builder = NULL;
+ g_object_unref (page->mapping_builder);
+ page->mapping_builder = NULL;
}
static void
@@ -421,20 +408,17 @@ show_button_mapping_dialog (CcWacomPage *page)
GtkWidget *toplevel;
GError *error = NULL;
GtkWidget *dialog;
- CcWacomPagePrivate *priv;
- priv = page->priv;
-
- g_assert (priv->mapping_builder == NULL);
- priv->mapping_builder = gtk_builder_new ();
- gtk_builder_add_from_resource (priv->mapping_builder,
+ g_assert (page->mapping_builder == NULL);
+ page->mapping_builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (page->mapping_builder,
"/org/gnome/control-center/wacom/button-mapping.ui",
&error);
if (error != NULL) {
g_warning ("Error loading UI file: %s", error->message);
- g_object_unref (priv->mapping_builder);
- priv->mapping_builder = NULL;
+ g_object_unref (page->mapping_builder);
+ page->mapping_builder = NULL;
g_error_free (error);
return;
}
@@ -450,8 +434,8 @@ show_button_mapping_dialog (CcWacomPage *page)
gtk_widget_show (dialog);
- priv->button_map = dialog;
- g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &priv->button_map);
+ page->button_map = dialog;
+ g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &page->button_map);
}
static void
@@ -482,14 +466,12 @@ set_osd_visibility_cb (GObject *source_object,
static void
set_osd_visibility (CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
GDBusProxy *proxy;
GsdDevice *gsd_device;
const gchar *device_path;
- priv = page->priv;
- proxy = cc_wacom_panel_get_gsd_wacom_bus_proxy (priv->panel);
- gsd_device = cc_wacom_device_get_device (priv->pad);
+ proxy = cc_wacom_panel_get_gsd_wacom_bus_proxy (page->panel);
+ gsd_device = cc_wacom_device_get_device (page->pad);
device_path = gsd_device_get_device_file (gsd_device);
@@ -503,7 +485,7 @@ set_osd_visibility (CcWacomPage *page)
g_variant_new ("(ob)", device_path, TRUE),
G_DBUS_CALL_FLAGS_NONE,
-1,
- priv->cancellable,
+ page->cancellable,
set_osd_visibility_cb,
page);
}
@@ -520,14 +502,12 @@ display_mapping_dialog_closed (GtkDialog *dialog,
int response_id,
CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
int layout;
- priv = page->priv;
- gtk_widget_destroy (priv->dialog);
- priv->dialog = NULL;
- priv->mapping = NULL;
- layout = get_layout_type (priv->stylus);
+ gtk_widget_destroy (page->dialog);
+ page->dialog = NULL;
+ page->mapping = NULL;
+ layout = get_layout_type (page->stylus);
update_tablet_ui (page, layout);
}
@@ -535,34 +515,30 @@ static void
display_mapping_button_clicked_cb (GtkButton *button,
CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
-
- priv = page->priv;
-
- g_assert (priv->mapping == NULL);
+ g_assert (page->mapping == NULL);
- priv->dialog = gtk_dialog_new_with_buttons (_("Display Mapping"),
+ page->dialog = gtk_dialog_new_with_buttons (_("Display Mapping"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
_("_Close"),
GTK_RESPONSE_ACCEPT,
NULL);
- priv->mapping = cc_wacom_mapping_panel_new ();
- cc_wacom_mapping_panel_set_device (CC_WACOM_MAPPING_PANEL (priv->mapping),
- priv->stylus);
- gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (priv->dialog))),
- priv->mapping);
- g_signal_connect (G_OBJECT (priv->dialog), "response",
+ page->mapping = cc_wacom_mapping_panel_new ();
+ cc_wacom_mapping_panel_set_device (CC_WACOM_MAPPING_PANEL (page->mapping),
+ page->stylus);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (page->dialog))),
+ page->mapping);
+ g_signal_connect (G_OBJECT (page->dialog), "response",
G_CALLBACK (display_mapping_dialog_closed), page);
- gtk_widget_show_all (priv->dialog);
+ gtk_widget_show_all (page->dialog);
- g_object_add_weak_pointer (G_OBJECT (priv->mapping), (gpointer *) &priv->dialog);
+ g_object_add_weak_pointer (G_OBJECT (page->mapping), (gpointer *) &page->dialog);
}
static void
tabletmode_changed_cb (GtkComboBox *combo, gpointer user_data)
{
- CcWacomPagePrivate *priv = CC_WACOM_PAGE (user_data)->priv;
+ CcWacomPage *page = CC_WACOM_PAGE (user_data);
GtkListStore *liststore;
GtkTreeIter iter;
gint mode;
@@ -575,26 +551,25 @@ tabletmode_changed_cb (GtkComboBox *combo, gpointer user_data)
MODENUMBER_COLUMN, &mode,
-1);
- g_settings_set_enum (priv->wacom_settings, "mapping", mode);
+ g_settings_set_enum (page->wacom_settings, "mapping", mode);
}
static void
left_handed_toggled_cb (GtkSwitch *sw, GParamSpec *pspec, gpointer *user_data)
{
- CcWacomPagePrivate *priv = CC_WACOM_PAGE (user_data)->priv;
+ CcWacomPage *page = CC_WACOM_PAGE (user_data);
gboolean left_handed;
left_handed = gtk_switch_get_active (sw);
- g_settings_set_boolean (priv->wacom_settings, "left-handed", left_handed);
+ g_settings_set_boolean (page->wacom_settings, "left-handed", left_handed);
}
static void
set_left_handed_from_gsettings (CcWacomPage *page)
{
- CcWacomPagePrivate *priv = CC_WACOM_PAGE (page)->priv;
gboolean left_handed;
- left_handed = g_settings_get_boolean (priv->wacom_settings, "left-handed");
+ left_handed = g_settings_get_boolean (page->wacom_settings, "left-handed");
gtk_switch_set_active (GTK_SWITCH (WID ("switch-left-handed")), left_handed);
}
@@ -602,10 +577,9 @@ static void
set_mode_from_gsettings (GtkComboBox *combo,
CcWacomPage *page)
{
- CcWacomPagePrivate *priv = page->priv;
GDesktopTabletMapping mapping;
- mapping = g_settings_get_enum (priv->wacom_settings, "mapping");
+ mapping = g_settings_get_enum (page->wacom_settings, "mapping");
/* this must be kept in sync with the .ui file */
gtk_combo_box_set_active (combo, mapping);
@@ -626,7 +600,7 @@ static gboolean
display_clicked_cb (GtkButton *button,
CcWacomPage *page)
{
- cc_wacom_panel_switch_to_panel (page->priv->panel, "display");
+ cc_wacom_panel_switch_to_panel (page->panel, "display");
return TRUE;
}
@@ -634,7 +608,7 @@ static gboolean
mouse_clicked_cb (GtkButton *button,
CcWacomPage *page)
{
- cc_wacom_panel_switch_to_panel (page->priv->panel, "mouse");
+ cc_wacom_panel_switch_to_panel (page->panel, "mouse");
return TRUE;
}
@@ -669,40 +643,40 @@ cc_wacom_page_set_property (GObject *object,
static void
cc_wacom_page_dispose (GObject *object)
{
- CcWacomPagePrivate *priv = CC_WACOM_PAGE (object)->priv;
+ CcWacomPage *self = CC_WACOM_PAGE (object);
- if (priv->cancellable) {
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ if (self->cancellable) {
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
}
- if (priv->area) {
- calib_area_free (priv->area);
- priv->area = NULL;
+ if (self->area) {
+ calib_area_free (self->area);
+ self->area = NULL;
}
- if (priv->button_map) {
- gtk_widget_destroy (priv->button_map);
- priv->button_map = NULL;
+ if (self->button_map) {
+ gtk_widget_destroy (self->button_map);
+ self->button_map = NULL;
}
- if (priv->dialog) {
- gtk_widget_destroy (priv->dialog);
- priv->dialog = NULL;
+ if (self->dialog) {
+ gtk_widget_destroy (self->dialog);
+ self->dialog = NULL;
}
- if (priv->builder) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ if (self->builder) {
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->header_group) {
- g_object_unref (priv->header_group);
- priv->header_group = NULL;
+ if (self->header_group) {
+ g_object_unref (self->header_group);
+ self->header_group = NULL;
}
- priv->panel = NULL;
+ self->panel = NULL;
G_OBJECT_CLASS (cc_wacom_page_parent_class)->dispose (object);
}
@@ -712,17 +686,14 @@ cc_wacom_page_class_init (CcWacomPageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcWacomPagePrivate));
-
object_class->get_property = cc_wacom_page_get_property;
object_class->set_property = cc_wacom_page_set_property;
object_class->dispose = cc_wacom_page_dispose;
}
static void
-cc_wacom_page_init (CcWacomPage *self)
+cc_wacom_page_init (CcWacomPage *page)
{
- CcWacomPagePrivate *priv;
GError *error = NULL;
GtkComboBox *combo;
GtkWidget *box;
@@ -736,55 +707,53 @@ cc_wacom_page_init (CcWacomPage *self)
NULL
};
- priv = self->priv = WACOM_PAGE_PRIVATE (self);
-
- priv->builder = gtk_builder_new ();
+ page->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_resource (priv->builder,
+ gtk_builder_add_objects_from_resource (page->builder,
"/org/gnome/control-center/wacom/gnome-wacom-properties.ui",
objects,
&error);
if (error != NULL) {
g_warning ("Error loading UI file: %s", error->message);
- g_object_unref (priv->builder);
+ g_object_unref (page->builder);
g_error_free (error);
return;
}
box = WID ("main-grid");
- gtk_container_add (GTK_CONTAINER (self), box);
+ gtk_container_add (GTK_CONTAINER (page), box);
gtk_widget_set_vexpand (GTK_WIDGET (box), TRUE);
g_signal_connect (WID ("button-calibrate"), "clicked",
- G_CALLBACK (calibrate_button_clicked_cb), self);
+ G_CALLBACK (calibrate_button_clicked_cb), page);
g_signal_connect (WID ("map-buttons-button"), "clicked",
- G_CALLBACK (map_buttons_button_clicked_cb), self);
+ G_CALLBACK (map_buttons_button_clicked_cb), page);
combo = GTK_COMBO_BOX (WID ("combo-tabletmode"));
combobox_text_cellrenderer (combo, MODELABEL_COLUMN);
g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (tabletmode_changed_cb), self);
+ G_CALLBACK (tabletmode_changed_cb), page);
sw = GTK_SWITCH (WID ("switch-left-handed"));
g_signal_connect (G_OBJECT (sw), "notify::active",
- G_CALLBACK (left_handed_toggled_cb), self);
+ G_CALLBACK (left_handed_toggled_cb), page);
g_signal_connect (G_OBJECT (WID ("display-link")), "activate-link",
- G_CALLBACK (display_clicked_cb), self);
+ G_CALLBACK (display_clicked_cb), page);
g_signal_connect (G_OBJECT (WID ("mouse-link")), "activate-link",
- G_CALLBACK (mouse_clicked_cb), self);
+ G_CALLBACK (mouse_clicked_cb), page);
g_signal_connect (G_OBJECT (WID ("display-mapping-button")), "clicked",
- G_CALLBACK (display_mapping_button_clicked_cb), self);
+ G_CALLBACK (display_mapping_button_clicked_cb), page);
- priv->nav = cc_wacom_nav_button_new ();
- gtk_widget_set_halign (priv->nav, GTK_ALIGN_END);
- gtk_widget_set_margin_start (priv->nav, 10);
- gtk_widget_show (priv->nav);
- gtk_container_add (CWID ("navigation-placeholder"), priv->nav);
+ page->nav = cc_wacom_nav_button_new ();
+ gtk_widget_set_halign (page->nav, GTK_ALIGN_END);
+ gtk_widget_set_margin_start (page->nav, 10);
+ gtk_widget_show (page->nav);
+ gtk_container_add (CWID ("navigation-placeholder"), page->nav);
- priv->cancellable = g_cancellable_new ();
+ page->cancellable = g_cancellable_new ();
}
static void
@@ -792,25 +761,22 @@ set_icon_name (CcWacomPage *page,
const char *widget_name,
const char *icon_name)
{
- CcWacomPagePrivate *priv;
char *resource;
- priv = page->priv;
-
resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name);
gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource);
g_free (resource);
}
static void
-remove_left_handed (CcWacomPagePrivate *priv)
+remove_left_handed (CcWacomPage *page)
{
gtk_widget_destroy (WID ("label-left-handed"));
gtk_widget_destroy (WID ("switch-left-handed"));
}
static void
-remove_display_link (CcWacomPagePrivate *priv)
+remove_display_link (CcWacomPage *page)
{
gtk_widget_destroy (WID ("display-link"));
@@ -820,7 +786,7 @@ remove_display_link (CcWacomPagePrivate *priv)
}
static void
-remove_mouse_link (CcWacomPagePrivate *priv)
+remove_mouse_link (CcWacomPage *page)
{
gtk_widget_destroy (WID ("mouse-link"));
@@ -833,10 +799,8 @@ static gboolean
has_monitor (CcWacomPage *page)
{
WacomIntegrationFlags integration_flags;
- CcWacomPagePrivate *priv;
- priv = page->priv;
- integration_flags = cc_wacom_device_get_integration_flags (priv->stylus);
+ integration_flags = cc_wacom_device_get_integration_flags (page->stylus);
return ((integration_flags &
(WACOM_DEVICE_INTEGRATED_DISPLAY | WACOM_DEVICE_INTEGRATED_SYSTEM)) != 0);
@@ -847,31 +811,28 @@ update_tablet_ui (CcWacomPage *page,
int layout)
{
WacomIntegrationFlags integration_flags;
- CcWacomPagePrivate *priv;
-
- priv = page->priv;
- integration_flags = cc_wacom_device_get_integration_flags (priv->stylus);
+ integration_flags = cc_wacom_device_get_integration_flags (page->stylus);
if ((integration_flags &
(WACOM_DEVICE_INTEGRATED_DISPLAY | WACOM_DEVICE_INTEGRATED_SYSTEM)) != 0) {
/* FIXME: Check we've got a puck, or a corresponding touchpad device */
- remove_mouse_link (priv);
+ remove_mouse_link (page);
}
/* Hide the pad buttons if no pad is present */
- gtk_widget_set_visible (WID ("map-buttons-button"), priv->pad != NULL);
+ gtk_widget_set_visible (WID ("map-buttons-button"), page->pad != NULL);
switch (layout) {
case LAYOUT_NORMAL:
- remove_left_handed (priv);
- remove_display_link (priv);
+ remove_left_handed (page);
+ remove_display_link (page);
break;
case LAYOUT_REVERSIBLE:
- remove_display_link (priv);
+ remove_display_link (page);
break;
case LAYOUT_SCREEN:
- remove_left_handed (priv);
+ remove_left_handed (page);
gtk_widget_destroy (WID ("combo-tabletmode"));
gtk_widget_destroy (WID ("label-trackingmode"));
@@ -898,20 +859,18 @@ cc_wacom_page_update_tools (CcWacomPage *page,
CcWacomDevice *stylus,
CcWacomDevice *pad)
{
- CcWacomPagePrivate *priv;
int layout;
gboolean changed;
/* Type of layout */
layout = get_layout_type (stylus);
- priv = page->priv;
- changed = (priv->stylus != stylus || priv->pad != pad);
+ changed = (page->stylus != stylus || page->pad != pad);
if (!changed)
return FALSE;
- priv->stylus = stylus;
- priv->pad = pad;
+ page->stylus = stylus;
+ page->pad = pad;
update_tablet_ui (CC_WACOM_PAGE (page), layout);
@@ -924,20 +883,18 @@ cc_wacom_page_new (CcWacomPanel *panel,
CcWacomDevice *pad)
{
CcWacomPage *page;
- CcWacomPagePrivate *priv;
g_return_val_if_fail (CC_IS_WACOM_DEVICE (stylus), NULL);
g_return_val_if_fail (!pad || CC_IS_WACOM_DEVICE (pad), NULL);
page = g_object_new (CC_TYPE_WACOM_PAGE, NULL);
- priv = page->priv;
- priv->panel = panel;
+ page->panel = panel;
cc_wacom_page_update_tools (page, stylus, pad);
/* FIXME move this to construct */
- priv->wacom_settings = cc_wacom_device_get_settings (stylus);
+ page->wacom_settings = cc_wacom_device_get_settings (stylus);
set_mode_from_gsettings (GTK_COMBO_BOX (WID ("combo-tabletmode")), page);
/* Tablet name */
@@ -958,13 +915,9 @@ cc_wacom_page_set_navigation (CcWacomPage *page,
GtkNotebook *notebook,
gboolean ignore_first_page)
{
- CcWacomPagePrivate *priv;
-
g_return_if_fail (CC_IS_WACOM_PAGE (page));
- priv = page->priv;
-
- g_object_set (G_OBJECT (priv->nav),
+ g_object_set (G_OBJECT (page->nav),
"notebook", notebook,
"ignore-first", ignore_first_page,
NULL);
diff --git a/panels/wacom/cc-wacom-page.h b/panels/wacom/cc-wacom-page.h
index 65cd12bcf..50c242a3c 100644
--- a/panels/wacom/cc-wacom-page.h
+++ b/panels/wacom/cc-wacom-page.h
@@ -28,45 +28,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_WACOM_PAGE cc_wacom_page_get_type()
-
-#define CC_WACOM_PAGE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_WACOM_PAGE, CcWacomPage))
-
-#define CC_WACOM_PAGE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_WACOM_PAGE, CcWacomPageClass))
-
-#define CC_IS_WACOM_PAGE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_WACOM_PAGE))
-
-#define CC_IS_WACOM_PAGE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_WACOM_PAGE))
-
-#define CC_WACOM_PAGE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_WACOM_PAGE, CcWacomPageClass))
-
-typedef struct _CcWacomPage CcWacomPage;
-typedef struct _CcWacomPageClass CcWacomPageClass;
-typedef struct _CcWacomPagePrivate CcWacomPagePrivate;
-
-struct _CcWacomPage
-{
- GtkBox parent;
-
- CcWacomPagePrivate *priv;
-};
-
-struct _CcWacomPageClass
-{
- GtkBoxClass parent_class;
-};
-
-GType cc_wacom_page_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_WACOM_PAGE (cc_wacom_page_get_type ())
+G_DECLARE_FINAL_TYPE (CcWacomPage, cc_wacom_page, CC, WACOM_PAGE, GtkBox)
GtkWidget * cc_wacom_page_new (CcWacomPanel *panel,
CcWacomDevice *stylus,
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 77a1e261f..eea991335 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -37,15 +37,12 @@
#include <gdk/gdkwayland.h>
#endif
-#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
+#define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x)
-CC_PANEL_REGISTER (CcWacomPanel, cc_wacom_panel)
-
-#define WACOM_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_PANEL, CcWacomPanelPrivate))
-
-struct _CcWacomPanelPrivate
+struct _CcWacomPanel
{
+ CcPanel parent_instance;
+
GtkBuilder *builder;
GtkWidget *stack;
GtkWidget *switcher;
@@ -67,6 +64,8 @@ struct _CcWacomPanelPrivate
GDBusProxy *proxy;
};
+CC_PANEL_REGISTER (CcWacomPanel, cc_wacom_panel)
+
typedef struct {
const char *name;
CcWacomDevice *stylus;
@@ -86,25 +85,22 @@ enum {
static CcWacomPage *
set_device_page (CcWacomPanel *self, const gchar *device_name)
{
- CcWacomPanelPrivate *priv;
CcWacomPage *page;
gint current;
- priv = self->priv;
-
if (device_name == NULL)
return NULL;
/* Choose correct device */
- page = g_hash_table_lookup (priv->pages, device_name);
+ page = g_hash_table_lookup (self->pages, device_name);
if (page == NULL) {
g_warning ("Failed to find device '%s', supplied in the command line.", device_name);
return page;
}
- current = gtk_notebook_page_num (GTK_NOTEBOOK (priv->tablet_notebook), GTK_WIDGET (page));
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->tablet_notebook), current);
+ current = gtk_notebook_page_num (GTK_NOTEBOOK (self->tablet_notebook), GTK_WIDGET (page));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self->tablet_notebook), current);
return page;
}
@@ -212,40 +208,40 @@ cc_wacom_panel_set_property (GObject *object,
static void
cc_wacom_panel_dispose (GObject *object)
{
- CcWacomPanelPrivate *priv = CC_WACOM_PANEL (object)->priv;
+ CcWacomPanel *self = CC_WACOM_PANEL (object);
- if (priv->builder)
+ if (self->builder)
{
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->manager)
+ if (self->manager)
{
- g_signal_handler_disconnect (priv->manager, priv->device_added_id);
- g_signal_handler_disconnect (priv->manager, priv->device_removed_id);
- priv->manager = NULL;
+ g_signal_handler_disconnect (self->manager, self->device_added_id);
+ g_signal_handler_disconnect (self->manager, self->device_removed_id);
+ self->manager = NULL;
}
- if (priv->devices)
+ if (self->devices)
{
- g_hash_table_destroy (priv->devices);
- priv->devices = NULL;
+ g_hash_table_destroy (self->devices);
+ self->devices = NULL;
}
- g_clear_object (&priv->cancellable);
- g_clear_object (&priv->proxy);
+ g_clear_object (&self->cancellable);
+ g_clear_object (&self->proxy);
- if (priv->pages)
+ if (self->pages)
{
- g_hash_table_destroy (priv->pages);
- priv->pages = NULL;
+ g_hash_table_destroy (self->pages);
+ self->pages = NULL;
}
- if (priv->stylus_pages)
+ if (self->stylus_pages)
{
- g_hash_table_destroy (priv->stylus_pages);
- priv->stylus_pages = NULL;
+ g_hash_table_destroy (self->stylus_pages);
+ self->stylus_pages = NULL;
}
G_OBJECT_CLASS (cc_wacom_panel_parent_class)->dispose (object);
@@ -254,26 +250,23 @@ cc_wacom_panel_dispose (GObject *object)
static void
check_remove_stylus_pages (CcWacomPanel *self)
{
- CcWacomPanelPrivate *priv;
GHashTableIter iter;
CcWacomDevice *device;
CcWacomTool *tool;
GtkWidget *page;
GList *tools, *total = NULL;
- priv = self->priv;
-
/* First. Iterate known devices and get the tools */
- g_hash_table_iter_init (&iter, priv->devices);
+ g_hash_table_iter_init (&iter, self->devices);
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &device)) {
- tools = cc_tablet_tool_map_list_tools (priv->tablet_tool_map, device);
+ tools = cc_tablet_tool_map_list_tools (self->tablet_tool_map, device);
total = g_list_concat (total, tools);
}
/* Second. Iterate through stylus pages and remove the ones whose
* tool is no longer in the list.
*/
- g_hash_table_iter_init (&iter, priv->stylus_pages);
+ g_hash_table_iter_init (&iter, self->stylus_pages);
while (g_hash_table_iter_next (&iter, (gpointer*) &tool, (gpointer*) &page)) {
if (g_list_find (total, tool))
continue;
@@ -288,23 +281,20 @@ static gboolean
add_stylus (CcWacomPanel *self,
CcWacomTool *tool)
{
- CcWacomPanelPrivate *priv;
GtkWidget *page;
- priv = self->priv;
-
- if (g_hash_table_lookup (priv->stylus_pages, tool))
+ if (g_hash_table_lookup (self->stylus_pages, tool))
return FALSE;
page = cc_wacom_stylus_page_new (tool);
cc_wacom_stylus_page_set_navigation (CC_WACOM_STYLUS_PAGE (page),
- GTK_NOTEBOOK (priv->stylus_notebook));
+ GTK_NOTEBOOK (self->stylus_notebook));
gtk_widget_show (page);
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->stylus_notebook), page, NULL);
- g_hash_table_insert (priv->stylus_pages, tool, page);
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->stylus_notebook), page, NULL);
+ g_hash_table_insert (self->stylus_pages, tool, page);
- if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->stylus_notebook)) == 0)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->stylus_notebook), 1);
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (self->stylus_notebook)) == 0)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self->stylus_notebook), 1);
return TRUE;
}
@@ -314,7 +304,6 @@ update_current_tool (CcWacomPanel *panel,
GdkDevice *device,
GdkDeviceTool *tool)
{
- CcWacomPanelPrivate *priv = panel->priv;;
GsdDeviceManager *device_manager;
CcWacomDevice *wacom_device;
CcWacomTool *stylus;
@@ -331,13 +320,13 @@ update_current_tool (CcWacomPanel *panel,
if (!gsd_device)
return;
- wacom_device = g_hash_table_lookup (priv->devices, gsd_device);
+ wacom_device = g_hash_table_lookup (panel->devices, gsd_device);
if (!wacom_device)
return;
/* Check whether we already know this tool, nothing to do then */
serial = gdk_device_tool_get_serial (tool);
- stylus = cc_tablet_tool_map_lookup_tool (priv->tablet_tool_map,
+ stylus = cc_tablet_tool_map_lookup_tool (panel->tablet_tool_map,
wacom_device, serial);
if (!stylus) {
@@ -351,24 +340,24 @@ update_current_tool (CcWacomPanel *panel,
added = add_stylus (panel, stylus);
if (added) {
- if (priv->stylus_notebook ==
- gtk_stack_get_visible_child (GTK_STACK (priv->stack))) {
+ if (panel->stylus_notebook ==
+ gtk_stack_get_visible_child (GTK_STACK (panel->stack))) {
GtkWidget *widget;
gint page;
- widget = g_hash_table_lookup (priv->stylus_pages, stylus);
- page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->stylus_notebook), widget);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->stylus_notebook), page);
+ widget = g_hash_table_lookup (panel->stylus_pages, stylus);
+ page = gtk_notebook_page_num (GTK_NOTEBOOK (panel->stylus_notebook), widget);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->stylus_notebook), page);
} else {
- gtk_container_child_set (GTK_CONTAINER (priv->stack),
- priv->stylus_notebook,
+ gtk_container_child_set (GTK_CONTAINER (panel->stack),
+ panel->stylus_notebook,
"needs-attention", TRUE,
NULL);
}
}
}
- cc_tablet_tool_map_add_relation (priv->tablet_tool_map,
+ cc_tablet_tool_map_add_relation (panel->tablet_tool_map,
wacom_device, stylus);
}
@@ -390,7 +379,6 @@ static void
cc_wacom_panel_constructed (GObject *object)
{
CcWacomPanel *self = CC_WACOM_PANEL (object);
- CcWacomPanelPrivate *priv = self->priv;
GtkWidget *button;
CcShell *shell;
@@ -407,17 +395,17 @@ cc_wacom_panel_constructed (GObject *object)
cc_shell_embed_widget_in_header (shell, button);
- priv->test_popover = gtk_popover_new (button);
- gtk_container_set_border_width (GTK_CONTAINER (priv->test_popover), 6);
+ self->test_popover = gtk_popover_new (button);
+ gtk_container_set_border_width (GTK_CONTAINER (self->test_popover), 6);
- priv->test_draw_area = cc_drawing_area_new ();
- gtk_widget_set_size_request (priv->test_draw_area, 400, 300);
- gtk_container_add (GTK_CONTAINER (priv->test_popover),
- priv->test_draw_area);
- gtk_widget_show (priv->test_draw_area);
+ self->test_draw_area = cc_drawing_area_new ();
+ gtk_widget_set_size_request (self->test_draw_area, 400, 300);
+ gtk_container_add (GTK_CONTAINER (self->test_popover),
+ self->test_draw_area);
+ gtk_widget_show (self->test_draw_area);
g_object_bind_property (button, "active",
- priv->test_popover, "visible",
+ self->test_popover, "visible",
G_BINDING_BIDIRECTIONAL);
g_signal_connect_object (shell, "event",
@@ -433,9 +421,9 @@ cc_wacom_panel_get_help_uri (CcPanel *panel)
static GtkWidget *
cc_wacom_panel_get_title_widget (CcPanel *panel)
{
- CcWacomPanelPrivate *priv = CC_WACOM_PANEL (panel)->priv;
+ CcWacomPanel *self = CC_WACOM_PANEL (panel);
- return priv->switcher;
+ return self->switcher;
}
static void
@@ -444,8 +432,6 @@ cc_wacom_panel_class_init (CcWacomPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcWacomPanelPrivate));
-
object_class->get_property = cc_wacom_panel_get_property;
object_class->set_property = cc_wacom_panel_set_property;
object_class->dispose = cc_wacom_panel_dispose;
@@ -480,12 +466,10 @@ update_current_page (CcWacomPanel *self,
GHashTable *ht;
GList *tablets, *l;
gboolean changed;
- CcWacomPanelPrivate *priv;
GHashTableIter iter;
GsdDevice *gsd_device;
CcWacomDevice *device;
- priv = self->priv;
changed = FALSE;
ht = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
@@ -496,7 +480,7 @@ update_current_page (CcWacomPanel *self,
g_hash_table_insert (ht, (gpointer) tablet->name, tablet);
}
- g_hash_table_iter_init (&iter, priv->devices);
+ g_hash_table_iter_init (&iter, self->devices);
while (g_hash_table_iter_next (&iter, (gpointer*) &gsd_device,
(gpointer*) &device)) {
@@ -527,23 +511,23 @@ update_current_page (CcWacomPanel *self,
tablet = l->data;
if (tablet->stylus == NULL) {
- page = g_hash_table_lookup (priv->pages, tablet->name);
+ page = g_hash_table_lookup (self->pages, tablet->name);
if (page != NULL) {
- remove_page (GTK_NOTEBOOK (priv->tablet_notebook), page);
- g_hash_table_remove (priv->pages, tablet->name);
+ remove_page (GTK_NOTEBOOK (self->tablet_notebook), page);
+ g_hash_table_remove (self->pages, tablet->name);
changed = TRUE;
}
continue;
}
/* this code is called once the stylus is set up, but the pad does not exist yet */
- page = g_hash_table_lookup (priv->pages, tablet->name);
+ page = g_hash_table_lookup (self->pages, tablet->name);
if (page == NULL) {
page = cc_wacom_page_new (self, tablet->stylus, tablet->pad);
- cc_wacom_page_set_navigation (CC_WACOM_PAGE (page), GTK_NOTEBOOK (priv->tablet_notebook), TRUE);
+ cc_wacom_page_set_navigation (CC_WACOM_PAGE (page), GTK_NOTEBOOK (self->tablet_notebook), TRUE);
gtk_widget_show (page);
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->tablet_notebook), page, NULL);
- g_hash_table_insert (priv->pages, g_strdup (tablet->name), page);
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->tablet_notebook), page, NULL);
+ g_hash_table_insert (self->pages, g_strdup (tablet->name), page);
changed = TRUE;
} else {
@@ -557,9 +541,9 @@ update_current_page (CcWacomPanel *self,
if (changed == TRUE) {
int num_pages;
- num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->tablet_notebook));
+ num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->tablet_notebook));
if (num_pages > 1)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->tablet_notebook), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self->tablet_notebook), 1);
}
}
@@ -567,12 +551,10 @@ static void
add_known_device (CcWacomPanel *self,
GsdDevice *gsd_device)
{
- CcWacomPanelPrivate *priv;
CcWacomDevice *device;
GsdDeviceType device_type;
GList *tools, *l;
- priv = self->priv;
device_type = gsd_device_get_device_type (gsd_device);
if ((device_type & GSD_DEVICE_TYPE_TABLET) == 0)
@@ -587,11 +569,11 @@ add_known_device (CcWacomPanel *self,
if (!device)
return;
- g_hash_table_insert (priv->devices, gsd_device, device);
+ g_hash_table_insert (self->devices, gsd_device, device);
/* Only trigger tool lookup on pen devices */
if ((device_type & GSD_DEVICE_TYPE_TABLET) != 0) {
- tools = cc_tablet_tool_map_list_tools (priv->tablet_tool_map, device);
+ tools = cc_tablet_tool_map_list_tools (self->tablet_tool_map, device);
for (l = tools; l != NULL; l = l->next) {
add_stylus (self, l->data);
@@ -608,11 +590,11 @@ device_removed_cb (GsdDeviceManager *manager,
{
CcWacomDevice *device;
- device = g_hash_table_lookup (self->priv->devices, gsd_device);
+ device = g_hash_table_lookup (self->devices, gsd_device);
if (!device)
return;
- g_hash_table_steal (self->priv->devices, gsd_device);
+ g_hash_table_steal (self->devices, gsd_device);
update_current_page (self, device);
check_remove_stylus_pages (self);
g_object_unref (device);
@@ -659,15 +641,13 @@ got_osd_proxy_cb (GObject *source_object,
{
GError *error = NULL;
CcWacomPanel *self;
- CcWacomPanelPrivate *priv;
self = CC_WACOM_PANEL (data);
- priv = self->priv;
- priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ self->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- g_clear_object (&priv->cancellable);
+ g_clear_object (&self->cancellable);
- if (priv->proxy == NULL) {
+ if (self->proxy == NULL) {
g_printerr ("Error creating proxy: %s\n", error->message);
g_error_free (error);
return;
@@ -691,14 +671,13 @@ on_stack_visible_child_notify_cb (GObject *object,
GParamSpec *pspec,
CcWacomPanel *panel)
{
- CcWacomPanelPrivate *priv = panel->priv;
GtkWidget *child;
child = gtk_stack_get_visible_child (GTK_STACK (object));
- if (child == priv->stylus_notebook) {
- gtk_container_child_set (GTK_CONTAINER (priv->stack),
- priv->stylus_notebook,
+ if (child == panel->stylus_notebook) {
+ gtk_container_child_set (GTK_CONTAINER (panel->stack),
+ panel->stylus_notebook,
"needs-attention", FALSE,
NULL);
}
@@ -707,7 +686,6 @@ on_stack_visible_child_notify_cb (GObject *object,
static void
cc_wacom_panel_init (CcWacomPanel *self)
{
- CcWacomPanelPrivate *priv;
GtkWidget *widget;
GList *devices, *l;
GError *error = NULL;
@@ -717,30 +695,29 @@ cc_wacom_panel_init (CcWacomPanel *self)
NULL
};
- priv = self->priv = WACOM_PANEL_PRIVATE (self);
g_resources_register (cc_wacom_get_resource ());
- priv->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_resource (priv->builder,
+ gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/wacom/gnome-wacom-properties.ui",
objects,
&error);
- gtk_builder_add_objects_from_resource (priv->builder,
+ gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/wacom/wacom-stylus-page.ui",
objects,
&error);
if (error != NULL)
{
g_warning ("Error loading UI file: %s", error->message);
- g_object_unref (priv->builder);
+ g_object_unref (self->builder);
g_error_free (error);
return;
}
- priv->tablet_tool_map = cc_tablet_tool_map_new ();
+ self->tablet_tool_map = cc_tablet_tool_map_new ();
- priv->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
@@ -748,74 +725,74 @@ cc_wacom_panel_init (CcWacomPanel *self)
"org.gnome.Shell",
"/org/gnome/Shell/Wacom",
"org.gnome.Shell.Wacom.PadOsd",
- priv->cancellable,
+ self->cancellable,
got_osd_proxy_cb,
self);
/* Stack + Switcher */
- priv->stack = gtk_stack_new ();
- g_object_set (G_OBJECT (priv->stack),
+ self->stack = gtk_stack_new ();
+ g_object_set (G_OBJECT (self->stack),
"margin-top", 30,
"margin-end", 30,
"margin-start", 30,
"margin-bottom", 30,
NULL);
- g_signal_connect (priv->stack, "notify::visible-child",
+ g_signal_connect (self->stack, "notify::visible-child",
G_CALLBACK (on_stack_visible_child_notify_cb), self);
- priv->switcher = gtk_stack_switcher_new ();
- gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->switcher),
- GTK_STACK (priv->stack));
- gtk_widget_show (priv->switcher);
-
- gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->stack));
- gtk_widget_show (priv->stack);
-
- priv->tablet_notebook = gtk_notebook_new ();
- gtk_widget_show (priv->tablet_notebook);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->tablet_notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->tablet_notebook), FALSE);
- gtk_widget_set_vexpand (priv->tablet_notebook, TRUE);
-
- priv->stylus_notebook = gtk_notebook_new ();
- gtk_widget_show (priv->stylus_notebook);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->stylus_notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->stylus_notebook), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (priv->stylus_notebook), 0);
- gtk_widget_set_vexpand (priv->stylus_notebook, TRUE);
-
- gtk_stack_add_titled (GTK_STACK (priv->stack),
- priv->stylus_notebook, "stylus",
+ self->switcher = gtk_stack_switcher_new ();
+ gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (self->switcher),
+ GTK_STACK (self->stack));
+ gtk_widget_show (self->switcher);
+
+ gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->stack));
+ gtk_widget_show (self->stack);
+
+ self->tablet_notebook = gtk_notebook_new ();
+ gtk_widget_show (self->tablet_notebook);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->tablet_notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (self->tablet_notebook), FALSE);
+ gtk_widget_set_vexpand (self->tablet_notebook, TRUE);
+
+ self->stylus_notebook = gtk_notebook_new ();
+ gtk_widget_show (self->stylus_notebook);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->stylus_notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (self->stylus_notebook), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (self->stylus_notebook), 0);
+ gtk_widget_set_vexpand (self->stylus_notebook, TRUE);
+
+ gtk_stack_add_titled (GTK_STACK (self->stack),
+ self->stylus_notebook, "stylus",
_("Stylus"));
- gtk_stack_add_titled (GTK_STACK (priv->stack),
- priv->tablet_notebook, "tablet",
+ gtk_stack_add_titled (GTK_STACK (self->stack),
+ self->tablet_notebook, "tablet",
_("Tablet"));
/* No styli page */
widget = WID ("no-stylus-page");
enbiggen_label (GTK_LABEL (WID ("no-stylus-label1")));
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->stylus_notebook), widget, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->stylus_notebook), widget, NULL);
/* No tablets page */
widget = WID ("main-box");
enbiggen_label (GTK_LABEL (WID ("advice-label1")));
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->tablet_notebook), widget, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (self->tablet_notebook), widget, NULL);
g_signal_connect (G_OBJECT (WID ("linkbutton")), "activate-link",
G_CALLBACK (link_activated), self);
- priv->devices = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
- priv->pages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- priv->stylus_pages = g_hash_table_new (NULL, NULL);
+ self->devices = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
+ self->pages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ self->stylus_pages = g_hash_table_new (NULL, NULL);
- priv->manager = gsd_device_manager_get ();
- priv->device_added_id = g_signal_connect (G_OBJECT (priv->manager), "device-added",
+ self->manager = gsd_device_manager_get ();
+ self->device_added_id = g_signal_connect (G_OBJECT (self->manager), "device-added",
G_CALLBACK (device_added_cb), self);
- priv->device_removed_id = g_signal_connect (G_OBJECT (priv->manager), "device-removed",
+ self->device_removed_id = g_signal_connect (G_OBJECT (self->manager), "device-removed",
G_CALLBACK (device_removed_cb), self);
- devices = gsd_device_manager_list_devices (priv->manager,
+ devices = gsd_device_manager_list_devices (self->manager,
GSD_DEVICE_TYPE_TABLET);
for (l = devices; l ; l = l->next)
add_known_device (self, l->data);
@@ -829,5 +806,5 @@ cc_wacom_panel_get_gsd_wacom_bus_proxy (CcWacomPanel *self)
{
g_return_val_if_fail (CC_IS_WACOM_PANEL (self), NULL);
- return self->priv->proxy;
+ return self->proxy;
}
diff --git a/panels/wacom/cc-wacom-panel.h b/panels/wacom/cc-wacom-panel.h
index 430c94381..de0c74fc5 100644
--- a/panels/wacom/cc-wacom-panel.h
+++ b/panels/wacom/cc-wacom-panel.h
@@ -26,45 +26,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_WACOM_PANEL cc_wacom_panel_get_type()
-
-#define CC_WACOM_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_WACOM_PANEL, CcWacomPanel))
-
-#define CC_WACOM_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_WACOM_PANEL, CcWacomPanelClass))
-
-#define CC_IS_WACOM_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_WACOM_PANEL))
-
-#define CC_IS_WACOM_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_WACOM_PANEL))
-
-#define CC_WACOM_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_WACOM_PANEL, CcWacomPanelClass))
-
-typedef struct _CcWacomPanel CcWacomPanel;
-typedef struct _CcWacomPanelClass CcWacomPanelClass;
-typedef struct _CcWacomPanelPrivate CcWacomPanelPrivate;
-
-struct _CcWacomPanel
-{
- CcPanel parent;
-
- CcWacomPanelPrivate *priv;
-};
-
-struct _CcWacomPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_wacom_panel_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_WACOM_PANEL (cc_wacom_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcWacomPanel, cc_wacom_panel, CC, WACOM_PANEL, CcPanel)
void cc_wacom_panel_switch_to_panel (CcWacomPanel *self,
const char *panel);
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index c3829454e..6cbc1b7b2 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -29,22 +29,21 @@
#include <string.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
-#define CWID(x) (GtkContainer *) gtk_builder_get_object (priv->builder, x)
+#define WID(x) (GtkWidget *) gtk_builder_get_object (page->builder, x)
+#define CWID(x) (GtkContainer *) gtk_builder_get_object (page->builder, x)
-G_DEFINE_TYPE (CcWacomStylusPage, cc_wacom_stylus_page, GTK_TYPE_BOX)
-
-#define WACOM_STYLUS_PAGE_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WACOM_STYLUS_PAGE, CcWacomStylusPagePrivate))
-
-struct _CcWacomStylusPagePrivate
+struct _CcWacomStylusPage
{
+ GtkBox parent_instance;
+
CcWacomTool *stylus;
GtkBuilder *builder;
GtkWidget *nav;
GSettings *stylus_settings;
};
+G_DEFINE_TYPE (CcWacomStylusPage, cc_wacom_stylus_page, GTK_TYPE_BOX)
+
/* Button combo box storage columns */
enum {
BUTTONNUMBER_COLUMN,
@@ -86,13 +85,15 @@ set_pressurecurve (GtkRange *range, GSettings *settings, const gchar *key)
static void
tip_feel_value_changed_cb (GtkRange *range, gpointer user_data)
{
- set_pressurecurve (range, CC_WACOM_STYLUS_PAGE(user_data)->priv->stylus_settings, "pressure-curve");
+ CcWacomStylusPage *page = CC_WACOM_STYLUS_PAGE(user_data);
+ set_pressurecurve (range, page->stylus_settings, "pressure-curve");
}
static void
eraser_feel_value_changed_cb (GtkRange *range, gpointer user_data)
{
- set_pressurecurve (range, CC_WACOM_STYLUS_PAGE(user_data)->priv->stylus_settings, "eraser-pressure-curve");
+ CcWacomStylusPage *page = CC_WACOM_STYLUS_PAGE(user_data);
+ set_pressurecurve (range, page->stylus_settings, "eraser-pressure-curve");
}
static void
@@ -156,7 +157,7 @@ set_button_mapping_from_gsettings (GtkComboBox *combo, GSettings* settings, cons
static void
button_changed_cb (GtkComboBox *combo, gpointer user_data)
{
- CcWacomStylusPagePrivate *priv = CC_WACOM_STYLUS_PAGE(user_data)->priv;
+ CcWacomStylusPage *page = CC_WACOM_STYLUS_PAGE(user_data);
GtkTreeIter iter;
GtkListStore *liststore;
gint mapping_b2,
@@ -170,7 +171,7 @@ button_changed_cb (GtkComboBox *combo, gpointer user_data)
BUTTONNUMBER_COLUMN, &mapping_b2,
-1);
- if (cc_wacom_tool_get_num_buttons (priv->stylus) > 1) {
+ if (cc_wacom_tool_get_num_buttons (page->stylus) > 1) {
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (WID ("combo-topbutton")), &iter))
return;
@@ -181,8 +182,8 @@ button_changed_cb (GtkComboBox *combo, gpointer user_data)
mapping_b3 = 0;
}
- g_settings_set_enum (priv->stylus_settings, "button-action", mapping_b2);
- g_settings_set_enum (priv->stylus_settings, "secondary-button-action", mapping_b3);
+ g_settings_set_enum (page->stylus_settings, "button-action", mapping_b2);
+ g_settings_set_enum (page->stylus_settings, "secondary-button-action", mapping_b3);
}
static void
@@ -227,11 +228,11 @@ cc_wacom_stylus_page_set_property (GObject *object,
static void
cc_wacom_stylus_page_dispose (GObject *object)
{
- CcWacomStylusPagePrivate *priv = CC_WACOM_STYLUS_PAGE (object)->priv;
+ CcWacomStylusPage *page = CC_WACOM_STYLUS_PAGE (object);
- if (priv->builder) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ if (page->builder) {
+ g_object_unref (page->builder);
+ page->builder = NULL;
}
@@ -243,17 +244,14 @@ cc_wacom_stylus_page_class_init (CcWacomStylusPageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcWacomStylusPagePrivate));
-
object_class->get_property = cc_wacom_stylus_page_get_property;
object_class->set_property = cc_wacom_stylus_page_set_property;
object_class->dispose = cc_wacom_stylus_page_dispose;
}
static void
-cc_wacom_stylus_page_init (CcWacomStylusPage *self)
+cc_wacom_stylus_page_init (CcWacomStylusPage *page)
{
- CcWacomStylusPagePrivate *priv;
GError *error = NULL;
GtkComboBox *combo;
GtkWidget *box;
@@ -265,45 +263,43 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *self)
NULL
};
- priv = self->priv = WACOM_STYLUS_PAGE_PRIVATE (self);
-
- priv->builder = gtk_builder_new ();
+ page->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_resource (priv->builder,
+ gtk_builder_add_objects_from_resource (page->builder,
"/org/gnome/control-center/wacom/wacom-stylus-page.ui",
objects,
&error);
if (error != NULL) {
g_warning ("Error loading UI file: %s", error->message);
- g_object_unref (priv->builder);
+ g_object_unref (page->builder);
g_error_free (error);
return;
}
box = WID ("stylus-grid");
- gtk_container_add (GTK_CONTAINER (self), box);
+ gtk_container_add (GTK_CONTAINER (page), box);
gtk_widget_set_vexpand (GTK_WIDGET (box), TRUE);
g_signal_connect (WID ("scale-tip-feel"), "value-changed",
- G_CALLBACK (tip_feel_value_changed_cb), self);
+ G_CALLBACK (tip_feel_value_changed_cb), page);
g_signal_connect (WID ("scale-eraser-feel"), "value-changed",
- G_CALLBACK (eraser_feel_value_changed_cb), self);
+ G_CALLBACK (eraser_feel_value_changed_cb), page);
combo = GTK_COMBO_BOX (WID ("combo-topbutton"));
combobox_text_cellrenderer (combo, BUTTONNAME_COLUMN);
g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (button_changed_cb), self);
+ G_CALLBACK (button_changed_cb), page);
combo = GTK_COMBO_BOX (WID ("combo-bottombutton"));
combobox_text_cellrenderer (combo, BUTTONNAME_COLUMN);
g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (button_changed_cb), self);
+ G_CALLBACK (button_changed_cb), page);
- priv->nav = cc_wacom_nav_button_new ();
- gtk_widget_set_halign (priv->nav, GTK_ALIGN_END);
- gtk_widget_set_margin_start (priv->nav, 10);
- gtk_widget_show (priv->nav);
- gtk_container_add (CWID ("navigation-placeholder"), priv->nav);
+ page->nav = cc_wacom_nav_button_new ();
+ gtk_widget_set_halign (page->nav, GTK_ALIGN_END);
+ gtk_widget_set_margin_start (page->nav, 10);
+ gtk_widget_show (page->nav);
+ gtk_container_add (CWID ("navigation-placeholder"), page->nav);
}
static void
@@ -311,11 +307,8 @@ set_icon_name (CcWacomStylusPage *page,
const char *widget_name,
const char *icon_name)
{
- CcWacomStylusPagePrivate *priv;
char *resource;
- priv = page->priv;
-
resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name);
gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource);
g_free (resource);
@@ -331,7 +324,7 @@ enum {
};
static void
-remove_buttons (CcWacomStylusPagePrivate *priv)
+remove_buttons (CcWacomStylusPage *page)
{
gtk_widget_destroy (WID ("combo-topbutton"));
gtk_widget_destroy (WID ("combo-bottombutton"));
@@ -340,7 +333,7 @@ remove_buttons (CcWacomStylusPagePrivate *priv)
}
static void
-remove_button (CcWacomStylusPagePrivate *priv)
+remove_button (CcWacomStylusPage *page)
{
gtk_widget_destroy (WID ("combo-topbutton"));
gtk_widget_destroy (WID ("label-top-button"));
@@ -348,7 +341,7 @@ remove_button (CcWacomStylusPagePrivate *priv)
}
static void
-remove_eraser (CcWacomStylusPagePrivate *priv)
+remove_eraser (CcWacomStylusPage *page)
{
gtk_widget_destroy (WID ("eraser-box"));
gtk_widget_destroy (WID ("label-eraser-feel"));
@@ -358,15 +351,13 @@ static void
update_stylus_ui (CcWacomStylusPage *page,
int layout)
{
- CcWacomStylusPagePrivate *priv = page->priv;
-
switch (layout) {
case LAYOUT_NORMAL:
/* easy! */
break;
case LAYOUT_INKING:
- remove_buttons (page->priv);
- remove_eraser (page->priv);
+ remove_buttons (page);
+ remove_eraser (page);
gtk_container_child_set (CWID ("stylus-controls-grid"),
WID ("label-tip-feel"),
"top_attach", 0, NULL);
@@ -375,7 +366,7 @@ update_stylus_ui (CcWacomStylusPage *page,
"top_attach", 0, NULL);
break;
case LAYOUT_AIRBRUSH:
- remove_button (page->priv);
+ remove_button (page);
gtk_container_child_set (CWID ("stylus-controls-grid"),
WID ("label-lower-button"),
"top_attach", 1, NULL);
@@ -390,7 +381,7 @@ update_stylus_ui (CcWacomStylusPage *page,
"top_attach", 2, NULL);
break;
case LAYOUT_GENERIC_2_BUTTONS_NO_ERASER:
- remove_eraser (page->priv);
+ remove_eraser (page);
break;
case LAYOUT_OTHER:
/* We already warn about it in cc_wacom_stylus_page_new () */
@@ -402,7 +393,6 @@ GtkWidget *
cc_wacom_stylus_page_new (CcWacomTool *stylus)
{
CcWacomStylusPage *page;
- CcWacomStylusPagePrivate *priv;
guint num_buttons;
int layout;
gboolean has_eraser;
@@ -411,14 +401,13 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
page = g_object_new (CC_TYPE_WACOM_STYLUS_PAGE, NULL);
- priv = page->priv;
- priv->stylus = stylus;
+ page->stylus = stylus;
/* Icon */
set_icon_name (page, "image-stylus", cc_wacom_tool_get_icon_name (stylus));
/* Settings */
- priv->stylus_settings = cc_wacom_tool_get_settings (stylus);
+ page->stylus_settings = cc_wacom_tool_get_settings (stylus);
has_eraser = cc_wacom_tool_get_has_eraser (stylus);
/* Stylus name */
@@ -436,9 +425,9 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
else {
layout = LAYOUT_OTHER;
if (num_buttons == 0)
- remove_buttons (priv);
+ remove_buttons (page);
else if (num_buttons == 1)
- remove_button (priv);
+ remove_button (page);
/* Gray out eraser if not available */
gtk_widget_set_sensitive (WID ("eraser-box"), has_eraser);
@@ -452,16 +441,16 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
if (num_buttons == 2)
set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-topbutton")),
- priv->stylus_settings, "secondary-button-action");
+ page->stylus_settings, "secondary-button-action");
if (num_buttons >= 1)
set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-bottombutton")),
- priv->stylus_settings, "button-action");
+ page->stylus_settings, "button-action");
set_feel_from_gsettings (GTK_ADJUSTMENT (WID ("adjustment-tip-feel")),
- priv->stylus_settings, "pressure-curve");
+ page->stylus_settings, "pressure-curve");
if (has_eraser)
set_feel_from_gsettings (GTK_ADJUSTMENT (WID ("adjustment-eraser-feel")),
- priv->stylus_settings, "eraser-pressure-curve");
+ page->stylus_settings, "eraser-pressure-curve");
return GTK_WIDGET (page);
}
@@ -469,20 +458,16 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
CcWacomTool *
cc_wacom_stylus_page_get_tool (CcWacomStylusPage *page)
{
- return page->priv->stylus;
+ return page->stylus;
}
void
cc_wacom_stylus_page_set_navigation (CcWacomStylusPage *page,
GtkNotebook *notebook)
{
- CcWacomStylusPagePrivate *priv;
-
g_return_if_fail (CC_IS_WACOM_STYLUS_PAGE (page));
- priv = page->priv;
-
- g_object_set (G_OBJECT (priv->nav),
+ g_object_set (G_OBJECT (page->nav),
"notebook", notebook,
"ignore-first", TRUE,
NULL);
diff --git a/panels/wacom/cc-wacom-stylus-page.h b/panels/wacom/cc-wacom-stylus-page.h
index 19d3a07e3..05ec2910b 100644
--- a/panels/wacom/cc-wacom-stylus-page.h
+++ b/panels/wacom/cc-wacom-stylus-page.h
@@ -27,45 +27,8 @@
G_BEGIN_DECLS
-#define CC_TYPE_WACOM_STYLUS_PAGE cc_wacom_stylus_page_get_type()
-
-#define CC_WACOM_STYLUS_PAGE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_WACOM_STYLUS_PAGE, CcWacomStylusPage))
-
-#define CC_WACOM_STYLUS_PAGE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_WACOM_STYLUS_PAGE, CcWacomStylusPageClass))
-
-#define CC_IS_WACOM_STYLUS_PAGE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_WACOM_STYLUS_PAGE))
-
-#define CC_IS_WACOM_STYLUS_PAGE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_WACOM_STYLUS_PAGE))
-
-#define CC_WACOM_STYLUS_PAGE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_WACOM_STYLUS_PAGE, CcWacomStylusPageClass))
-
-typedef struct _CcWacomStylusPage CcWacomStylusPage;
-typedef struct _CcWacomStylusPageClass CcWacomStylusPageClass;
-typedef struct _CcWacomStylusPagePrivate CcWacomStylusPagePrivate;
-
-struct _CcWacomStylusPage
-{
- GtkBox parent;
-
- CcWacomStylusPagePrivate *priv;
-};
-
-struct _CcWacomStylusPageClass
-{
- GtkBoxClass parent_class;
-};
-
-GType cc_wacom_stylus_page_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_WACOM_STYLUS_PAGE (cc_wacom_stylus_page_get_type ())
+G_DECLARE_FINAL_TYPE (CcWacomStylusPage, cc_wacom_stylus_page, CC, WACOM_STYLUS_PAGE, GtkBox)
GtkWidget * cc_wacom_stylus_page_new (CcWacomTool *stylus);
diff --git a/panels/wacom/cc-wacom-tool.h b/panels/wacom/cc-wacom-tool.h
index e366c2e23..a7da46818 100644
--- a/panels/wacom/cc-wacom-tool.h
+++ b/panels/wacom/cc-wacom-tool.h
@@ -27,7 +27,6 @@
#include <glib.h>
#define CC_TYPE_WACOM_TOOL (cc_wacom_tool_get_type ())
-
G_DECLARE_FINAL_TYPE (CcWacomTool, cc_wacom_tool, CC, WACOM_TOOL, GObject)
CcWacomTool * cc_wacom_tool_new (guint64 serial,
diff --git a/panels/wacom/gsd-wacom-key-shortcut-button.c b/panels/wacom/gsd-wacom-key-shortcut-button.c
index 925c8c184..13287acb8 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 eebae0f97..444d52718 100644
--- a/panels/wacom/gsd-wacom-key-shortcut-button.h
+++ b/panels/wacom/gsd-wacom-key-shortcut-button.h
@@ -26,19 +26,11 @@
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))
-
-typedef struct _GsdWacomKeyShortcutButton GsdWacomKeyShortcutButton;
-typedef struct _GsdWacomKeyShortcutButtonClass GsdWacomKeyShortcutButtonClass;
-typedef struct _GsdWacomKeyShortcutButtonPrivate GsdWacomKeyShortcutButtonPrivate;
+#define GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON (gsd_wacom_key_shortcut_button_get_type ())
+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())
+#define GSD_WACOM_TYPE_KEY_SHORTCUT_BUTTON_MODE (gsd_wacom_key_shortcut_button_mode_type ())
typedef enum
{
@@ -46,24 +38,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__ */