aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-04-15 13:24:23 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-05 15:12:20 +0800
commitc26345ba2beb3957327810e201a9f71097910738 (patch)
treee770383d245ec6d53e27e1f483140829238c3d28
parent0892b114ee4fd20559fb0c613c7c145c8bedbc9d (diff)
downloadgsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar.gz
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar.bz2
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar.lz
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar.xz
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.tar.zst
gsoc2013-empathy-c26345ba2beb3957327810e201a9f71097910738.zip
Support Conn.I.Balance.ManageCreditURI
-rw-r--r--src/empathy-main-window.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 03386a01a..ed306509e 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -801,7 +801,16 @@ static void
main_window_balance_activate_cb (GtkAction *action,
EmpathyMainWindow *window)
{
- DEBUG ("ACTIVATE!");
+ const char *uri;
+
+ uri = g_object_get_data (G_OBJECT (action), "manage-credit-uri");
+
+ if (!tp_str_empty (uri)) {
+ DEBUG ("Top-up credit URI: %s", uri);
+ empathy_url_show (GTK_WIDGET (window), uri);
+ } else {
+ DEBUG ("unknown protocol for top-up");
+ }
}
static void
@@ -840,23 +849,30 @@ main_window_balance_update_balance (GtkAction *action,
}
static void
-main_window_setup_balance_got_balance (TpProxy *conn,
- const GValue *value,
- const GError *in_error,
- gpointer user_data,
- GObject *action)
+main_window_setup_balance_got_balance_props (TpProxy *conn,
+ GHashTable *props,
+ const GError *in_error,
+ gpointer user_data,
+ GObject *action)
{
GValueArray *balance = NULL;
+ const char *uri;
if (in_error != NULL) {
- DEBUG ("Failed to get account balance: %s",
+ DEBUG ("Failed to get account balance properties: %s",
in_error->message);
- } else if (!G_VALUE_HOLDS (value, TP_STRUCT_TYPE_CURRENCY_AMOUNT)) {
- DEBUG ("Type mismatch");
- } else {
- balance = g_value_get_boxed (value);
+ goto finally;
}
+ balance = tp_asv_get_boxed (props, "AccountBalance",
+ TP_STRUCT_TYPE_CURRENCY_AMOUNT);
+ uri = tp_asv_get_string (props, "ManageCreditURI");
+
+ g_object_set_data_full (action, "manage-credit-uri",
+ g_strdup (uri), g_free);
+ gtk_action_set_sensitive (GTK_ACTION (action), !tp_str_empty (uri));
+
+finally:
main_window_balance_update_balance (GTK_ACTION (action), balance);
}
@@ -950,10 +966,9 @@ main_window_setup_balance_conn_ready (GObject *conn,
}
/* request the current balance and monitor for any changes */
- tp_cli_dbus_properties_call_get (conn, -1,
+ tp_cli_dbus_properties_call_get_all (conn, -1,
TP_IFACE_CONNECTION_INTERFACE_BALANCE,
- "AccountBalance",
- main_window_setup_balance_got_balance,
+ main_window_setup_balance_got_balance_props,
window, NULL, G_OBJECT (action));
tp_cli_connection_interface_balance_connect_to_balance_changed (