aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-main-window.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-04-15 12:33:20 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-05 15:05:09 +0800
commit0892b114ee4fd20559fb0c613c7c145c8bedbc9d (patch)
tree15ebd68ac718aa971fc55c84b224f0116895502d /src/empathy-main-window.c
parent416da629fa9a0e9293b811d36547b0b189b6e13d (diff)
downloadgsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar.gz
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar.bz2
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar.lz
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar.xz
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.tar.zst
gsoc2013-empathy-0892b114ee4fd20559fb0c613c7c145c8bedbc9d.zip
Remove balance from menu when account is disconnected
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r--src/empathy-main-window.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 8d031385a..03386a01a 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -880,6 +880,7 @@ main_window_setup_balance_conn_ready (GObject *conn,
TpAccount *account = g_object_get_data (conn, "account");
GtkAction *action;
char *name, *ui;
+ guint merge_id;
GError *error = NULL;
if (!tp_proxy_prepare_finish (conn, result, &error)) {
@@ -932,9 +933,10 @@ main_window_setup_balance_conn_ready (GObject *conn,
"</ui>",
name);
- /* FIXME: do we want the merge id, can use it to unmerge the UI */
- gtk_ui_manager_add_ui_from_string (priv->ui_manager, ui, -1,
- &error);
+ merge_id = gtk_ui_manager_add_ui_from_string (priv->ui_manager,
+ ui, -1, &error);
+ g_object_set_data (G_OBJECT (action),
+ "merge-id", GUINT_TO_POINTER (merge_id));
g_free (name);
g_free (ui);
@@ -997,7 +999,33 @@ main_window_connection_changed_cb (TpAccount *account,
empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (window),
EMPATHY_SOUND_ACCOUNT_DISCONNECTED);
- /* FIXME: remove balance */
+ /* remove balance action if required */
+ if (priv->balance_action_group != NULL) {
+ GtkAction *action;
+ char *name;
+
+ name = main_window_account_to_action_name (account);
+
+ action = gtk_action_group_get_action (
+ priv->balance_action_group, name);
+
+ if (action != NULL) {
+ guint merge_id;
+
+ DEBUG ("Removing action");
+
+ merge_id = GPOINTER_TO_UINT (g_object_get_data (
+ G_OBJECT (action),
+ "merge-id"));
+
+ gtk_ui_manager_remove_ui (priv->ui_manager,
+ merge_id);
+ gtk_action_group_remove_action (
+ priv->balance_action_group, action);
+ }
+
+ g_free (name);
+ }
}
if (current == TP_CONNECTION_STATUS_CONNECTED) {