aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-15 17:14:12 -0600
committerTed Gould <ted@gould.cx>2010-02-15 17:14:12 -0600
commitae0b7bc73ee056f893c739e5dec1311f5bcd630f (patch)
treef07a9c5261f9badf00dd4b93a488406744f4420b /libindicator
parent5d7fbff4c97779922efe03268deaf669a5a4eaa8 (diff)
downloadlibayatana-indicator-ae0b7bc73ee056f893c739e5dec1311f5bcd630f.tar.gz
libayatana-indicator-ae0b7bc73ee056f893c739e5dec1311f5bcd630f.tar.bz2
libayatana-indicator-ae0b7bc73ee056f893c739e5dec1311f5bcd630f.zip
A basic property system.
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-desktop-shortcuts.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c
index 35efe4d..eceec51 100644
--- a/libindicator/indicator-desktop-shortcuts.c
+++ b/libindicator/indicator-desktop-shortcuts.c
@@ -40,6 +40,12 @@ struct _IndicatorDesktopShortcutsPrivate {
GArray * nicks;
};
+enum {
+ PROP_0,
+ PROP_DESKTOP_FILE,
+ PROP_IDENTITY
+};
+
#define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsPrivate))
@@ -47,6 +53,8 @@ static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsCla
static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self);
static void indicator_desktop_shortcuts_dispose (GObject *object);
static void indicator_desktop_shortcuts_finalize (GObject *object);
+static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
G_DEFINE_TYPE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT);
@@ -61,6 +69,23 @@ indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass)
object_class->dispose = indicator_desktop_shortcuts_dispose;
object_class->finalize = indicator_desktop_shortcuts_finalize;
+ /* Property funcs */
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+
+ g_object_class_install_property(object_class, PROP_DESKTOP_FILE,
+ g_param_spec_string(PROP_DESKTOP_FILE_S,
+ "The path of the desktop file to read",
+ "A path to a desktop file that we'll look for shortcuts in.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(object_class, PROP_IDENTITY,
+ g_param_spec_string(PROP_IDENTITY_S,
+ "The string that represents the identity that we're acting as.",
+ "Used to process ShowIn and NotShownIn fields of the desktop shortcust to get the proper list.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+
return;
}
@@ -87,7 +112,6 @@ indicator_desktop_shortcuts_dispose (GObject *object)
g_key_file_free(priv->keyfile);
priv->keyfile = NULL;
}
-
G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->dispose (object);
return;
@@ -118,6 +142,48 @@ indicator_desktop_shortcuts_finalize (GObject *object)
return;
}
+/* Sets one of the two properties we have, only at construction though */
+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);
+
+ switch(prop_id) {
+ case PROP_DESKTOP_FILE:
+ break;
+ case PROP_IDENTITY:
+ break;
+ /* *********************** */
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+
+ return;
+}
+
+/* Gets either the desktop file our the identity. */
+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);
+
+ switch(prop_id) {
+ case PROP_DESKTOP_FILE:
+ break;
+ case PROP_IDENTITY:
+ break;
+ /* *********************** */
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+
+ return;
+}
+
/* Looks through the nicks ot see if this one is in the list,
and thus valid to use. */
static gboolean