aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-desktop-shortcuts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indicator-desktop-shortcuts.c')
-rw-r--r--src/indicator-desktop-shortcuts.c38
1 files changed, 20 insertions, 18 deletions
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);