aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/im-accounts-service.c33
-rw-r--r--src/indicator-desktop-shortcuts.c38
2 files changed, 36 insertions, 35 deletions
diff --git a/src/im-accounts-service.c b/src/im-accounts-service.c
index b7ab15d..fa2d469 100644
--- a/src/im-accounts-service.c
+++ b/src/im-accounts-service.c
@@ -25,16 +25,11 @@
#include "im-accounts-service.h"
-typedef struct _ImAccountsServicePrivate ImAccountsServicePrivate;
-
-struct _ImAccountsServicePrivate {
+typedef struct {
ActUserManager * user_manager;
GDBusProxy * touch_settings;
GCancellable * cancel;
-};
-
-#define IM_ACCOUNTS_SERVICE_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_ACCOUNTS_SERVICE_TYPE, ImAccountsServicePrivate))
+} ImAccountsServicePrivate;
static void im_accounts_service_class_init (ImAccountsServiceClass *klass);
static void im_accounts_service_init (ImAccountsService *self);
@@ -44,15 +39,13 @@ static void user_changed (ActUserManager * manager, ActUser * user, gpointer use
static void on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data);
static void security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data);
-G_DEFINE_TYPE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
static void
im_accounts_service_class_init (ImAccountsServiceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ImAccountsServicePrivate));
-
object_class->dispose = im_accounts_service_dispose;
object_class->finalize = im_accounts_service_finalize;
}
@@ -60,7 +53,7 @@ im_accounts_service_class_init (ImAccountsServiceClass *klass)
static void
im_accounts_service_init (ImAccountsService *self)
{
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(self);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
priv->cancel = g_cancellable_new();
@@ -78,7 +71,8 @@ im_accounts_service_init (ImAccountsService *self)
static void
im_accounts_service_dispose (GObject *object)
{
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(object);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(object);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
if (priv->cancel != NULL) {
g_cancellable_cancel(priv->cancel);
@@ -104,7 +98,8 @@ user_changed (ActUserManager * manager, ActUser * user, gpointer user_data)
return;
}
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
g_debug("User Updated");
/* Clear old proxies */
@@ -135,7 +130,8 @@ security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data)
return;
}
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
/* Ensure we didn't get a proxy while we weren't looking */
g_clear_object(&priv->touch_settings);
priv->touch_settings = proxy;
@@ -146,7 +142,8 @@ security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data)
static void
on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data)
{
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
ActUser * user = NULL;
g_debug("Accounts Manager Loaded");
@@ -180,7 +177,8 @@ void
im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean draws_attention)
{
g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
if (priv->touch_settings == NULL) {
return;
@@ -206,7 +204,8 @@ im_accounts_service_get_show_on_greeter (ImAccountsService * service)
{
g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);
- ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(service);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
if (priv->touch_settings == NULL) {
return FALSE;
diff --git a/src/indicator-desktop-shortcuts.c b/src/indicator-desktop-shortcuts.c
index 7b43630..bbac612 100644
--- a/src/indicator-desktop-shortcuts.c
+++ b/src/indicator-desktop-shortcuts.c
@@ -45,14 +45,13 @@ enum _actions_t {
ACTIONS_DESKTOP_SPEC
};
-typedef struct _IndicatorDesktopShortcutsPrivate IndicatorDesktopShortcutsPrivate;
-struct _IndicatorDesktopShortcutsPrivate {
+typedef struct {
actions_t actions;
GKeyFile * keyfile;
gchar * identity;
GArray * nicks;
gchar * domain;
-};
+} IndicatorDesktopShortcutsPrivate;
enum {
PROP_0,
@@ -60,9 +59,6 @@ enum {
PROP_IDENTITY
};
-#define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsPrivate))
-
static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass);
static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self);
static void indicator_desktop_shortcuts_dispose (GObject *object);
@@ -72,7 +68,7 @@ static void get_property (GObject * object, guint prop_id, GValue * value, GPara
static void parse_keyfile (IndicatorDesktopShortcuts * ids);
static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target);
-G_DEFINE_TYPE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
/* Build up the class */
static void
@@ -80,8 +76,6 @@ indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorDesktopShortcutsPrivate));
-
object_class->dispose = indicator_desktop_shortcuts_dispose;
object_class->finalize = indicator_desktop_shortcuts_finalize;
@@ -109,7 +103,7 @@ indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass)
static void
indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
{
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(self);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
priv->keyfile = NULL;
priv->identity = NULL;
@@ -124,7 +118,8 @@ indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
static void
indicator_desktop_shortcuts_dispose (GObject *object)
{
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
if (priv->keyfile) {
g_key_file_free(priv->keyfile);
@@ -139,7 +134,8 @@ indicator_desktop_shortcuts_dispose (GObject *object)
static void
indicator_desktop_shortcuts_finalize (GObject *object)
{
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
if (priv->identity != NULL) {
g_free(priv->identity);
@@ -170,7 +166,8 @@ static void
set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
{
g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
switch(prop_id) {
case PROP_DESKTOP_FILE: {
@@ -233,7 +230,8 @@ static void
get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
{
g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
switch(prop_id) {
case PROP_IDENTITY:
@@ -253,7 +251,8 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe
static void
parse_keyfile (IndicatorDesktopShortcuts * ids)
{
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
if (priv->keyfile == NULL) {
return;
@@ -475,7 +474,8 @@ const gchar **
indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids)
{
g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
return (const gchar **)priv->nicks->data;
}
@@ -497,7 +497,8 @@ gchar *
indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick)
{
g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);
g_return_val_if_fail(priv->keyfile != NULL, NULL);
@@ -573,7 +574,8 @@ indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts *
GError * error = NULL;
g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
- IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);
g_return_val_if_fail(priv->keyfile != NULL, FALSE);