summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Mardegan <mardy@users.sourceforge.net>2008-04-10 14:20:40 +0000
committerAlberto Mardegan <mardy@users.sourceforge.net>2008-04-10 14:20:40 +0000
commit054d7495f71cb94a3760f1459fd03bf5a0148f60 (patch)
treea851cce6cfb90c9aa2d50b0a4e1103aad040b65a
parent999717b2b7c02b998f06417882c8698cbb451c9e (diff)
Implement a DBus independent function for getting interface
properties. git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@352 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
-rw-r--r--ChangeLog6
-rw-r--r--src/mcd-dbusprop.c45
-rw-r--r--src/mcd-dbusprop.h6
3 files changed, 41 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index efc8d67a..a1674547 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-10 Alberto Mardegan <alberto.mardegan@nokia.com>
+
+ * src/mcd-dbusprop.[hc]:
+ Implement a DBus independent function for getting interface
+ properties.
+
=== telepathy-mission-control 5.0.beta2 ===
2008-04-10 Alberto Mardegan <alberto.mardegan@nokia.com>
diff --git a/src/mcd-dbusprop.c b/src/mcd-dbusprop.c
index 307f8af0..b0187036 100644
--- a/src/mcd-dbusprop.c
+++ b/src/mcd-dbusprop.c
@@ -77,25 +77,20 @@ dbusprop_set (TpSvcDBusProperties *self,
}
void
-dbusprop_get (TpSvcDBusProperties *self,
- const gchar *interface_name,
- const gchar *property_name,
- DBusGMethodInvocation *context)
+mcd_dbusprop_get_property (TpSvcDBusProperties *self,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GValue *value,
+ GError **error)
{
McdDBusProp *prop_array, *property;
- GValue value = { 0 };
- GError *error = NULL;
-
- g_debug ("%s: %s, %s", G_STRFUNC, interface_name, property_name);
/* FIXME: use some prefix */
prop_array = g_object_get_data (G_OBJECT (self), interface_name);
if (!prop_array)
{
- g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
"invalid interface: %s", interface_name);
- dbus_g_method_return_error (context, error);
- g_error_free (error);
return;
}
@@ -105,22 +100,40 @@ dbusprop_get (TpSvcDBusProperties *self,
break;
if (!property->name)
{
- g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
"invalid property: %s", property_name);
- dbus_g_method_return_error (context, error);
- g_error_free (error);
return;
}
if (!property->getprop)
{
- g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
"property %s cannot be read", property_name);
+ return;
+ }
+ property->getprop (self, property_name, value);
+}
+
+void
+dbusprop_get (TpSvcDBusProperties *self,
+ const gchar *interface_name,
+ const gchar *property_name,
+ DBusGMethodInvocation *context)
+{
+ GValue value = { 0 };
+ GError *error = NULL;
+
+ g_debug ("%s: %s, %s", G_STRFUNC, interface_name, property_name);
+
+ mcd_dbusprop_get_property (self, interface_name, property_name,
+ &value, &error);
+ if (error)
+ {
dbus_g_method_return_error (context, error);
g_error_free (error);
return;
}
- property->getprop (self, property_name, &value);
+
tp_svc_dbus_properties_return_from_get (context, &value);
g_value_unset (&value);
}
diff --git a/src/mcd-dbusprop.h b/src/mcd-dbusprop.h
index b1d462c5..ee8441c0 100644
--- a/src/mcd-dbusprop.h
+++ b/src/mcd-dbusprop.h
@@ -41,6 +41,12 @@ typedef struct _McdDBusProp
mcd_getprop getprop;
} McdDBusProp;
+void mcd_dbusprop_get_property (TpSvcDBusProperties *self,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GValue *value,
+ GError **error);
+
void dbusprop_set (TpSvcDBusProperties *self,
const gchar *interface_name,
const gchar *property_name,