[giggle] libgiggle/giggle-remote.c: Use g_object_notify_by_pspec() instead g_object_notify()
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle] libgiggle/giggle-remote.c: Use g_object_notify_by_pspec() instead g_object_notify()
- Date: Mon, 4 Apr 2011 01:43:55 +0000 (UTC)
commit ea723597348ba471ae1bf4856eecfb63e648c363
Author: Javier Jardón <jjardon gnome org>
Date: Mon Apr 4 02:22:16 2011 +0100
libgiggle/giggle-remote.c: Use g_object_notify_by_pspec() instead g_object_notify()
libgiggle/giggle-remote.c | 72 +++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 35 deletions(-)
---
diff --git a/libgiggle/giggle-remote.c b/libgiggle/giggle-remote.c
index 1fc8dc6..c45294e 100644
--- a/libgiggle/giggle-remote.c
+++ b/libgiggle/giggle-remote.c
@@ -44,9 +44,12 @@ enum {
PROP_ICON_NAME,
PROP_MECHANISM,
PROP_NAME,
- PROP_URL
+ PROP_URL,
+ N_PROPERTIES
};
+static GParamSpec *properties[N_PROPERTIES] = { NULL, };
+
static void remote_finalize (GObject *object);
static void remote_get_property (GObject *object,
guint param_id,
@@ -70,34 +73,33 @@ giggle_remote_class_init (GiggleRemoteClass *class)
object_class->get_property = remote_get_property;
object_class->set_property = remote_set_property;
- g_object_class_install_property (object_class,
- PROP_BRANCHES,
- g_param_spec_pointer ("branches", "Branches",
- "The list of remote branches",
- G_PARAM_READABLE));
- g_object_class_install_property (object_class,
- PROP_ICON_NAME,
- g_param_spec_string ("icon-name", "Icon Name",
- "This remote's icon",
- NULL, G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_MECHANISM,
- g_param_spec_enum ("mechanism", "Mechanism",
- "This remote's mechanism",
- GIGGLE_TYPE_REMOTE_MECHANISM,
- GIGGLE_REMOTE_MECHANISM_GIT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_NAME,
- g_param_spec_string ("name", "Name",
- "This remote's name",
- NULL, G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_URL,
- g_param_spec_string ("url", "URL",
- "This remote's URL",
- NULL, G_PARAM_READWRITE));
+ properties[PROP_BRANCHES] = g_param_spec_pointer ("branches", "Branches",
+ "The list of remote branches",
+ G_PARAM_READABLE);
+
+ properties[PROP_ICON_NAME] = g_param_spec_string ("icon-name", "Icon Name",
+ "This remote's icon",
+ NULL,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MECHANISM] = g_param_spec_enum ("mechanism", "Mechanism",
+ "This remote's mechanism",
+ GIGGLE_TYPE_REMOTE_MECHANISM,
+ GIGGLE_REMOTE_MECHANISM_GIT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_NAME] = g_param_spec_string ("name", "Name",
+ "This remote's name",
+ NULL,
+ G_PARAM_READWRITE);
+
+ properties[PROP_URL] = g_param_spec_string ("url", "URL",
+ "This remote's URL",
+ NULL,
+ G_PARAM_READWRITE);
+
+ /* Install all properties */
+ g_object_class_install_properties (object_class, N_PROPERTIES, properties);
g_type_class_add_private (object_class, sizeof (GiggleRemotePriv));
}
@@ -215,7 +217,7 @@ giggle_remote_add_branch (GiggleRemote *remote,
priv = GET_PRIV (remote);
priv->branches = g_list_append (priv->branches, g_object_ref (branch));
- g_object_notify (G_OBJECT (remote), "branches");
+ g_object_notify_by_pspec (G_OBJECT (remote), properties[PROP_BRANCHES]);
}
GiggleRemote *
@@ -353,7 +355,7 @@ giggle_remote_remove_branches (GiggleRemote *self)
g_list_foreach (priv->branches, (GFunc)g_object_unref, NULL);
g_list_free (priv->branches);
priv->branches = NULL;
- g_object_notify (G_OBJECT (self), "branches");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BRANCHES]);
}
const gchar *
@@ -382,7 +384,7 @@ giggle_remote_set_icon_name (GiggleRemote *self,
g_free (priv->icon_name);
priv->icon_name = g_strdup (icon_name);
- g_object_notify (G_OBJECT (self), "icon-name");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICON_NAME]);
}
GiggleRemoteMechanism
@@ -407,7 +409,7 @@ giggle_remote_set_mechanism (GiggleRemote *self,
if (mechanism != priv->mechanism) {
priv->mechanism = mechanism;
- g_object_notify (G_OBJECT (self), "mechanism");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MECHANISM]);
}
}
@@ -437,7 +439,7 @@ giggle_remote_set_name (GiggleRemote *self,
g_free (priv->name);
priv->name = g_strdup (name);
- g_object_notify (G_OBJECT (self), "name");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_NAME]);
}
const gchar *
@@ -464,7 +466,7 @@ giggle_remote_set_url (GiggleRemote *remote,
g_free (priv->url);
priv->url = g_strdup (url);
- g_object_notify (G_OBJECT (remote), "url");
+ g_object_notify_by_pspec (G_OBJECT (remote), properties[PROP_URL]);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]