aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-04-20 09:02:57 +0800
committerJonny Lamb <jonny.lamb@collabora.co.uk>2009-04-24 08:52:48 +0800
commita1a6d017403f00f39d34611d0890edb8cebf9389 (patch)
tree393d44f75fddcb84a9580ad409c7a1226e7bcc72
parent431c9bd2c21cf9d47996f1d9e68519acbbc70652 (diff)
downloadgsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar.gz
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar.bz2
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar.lz
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar.xz
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.tar.zst
gsoc2013-empathy-a1a6d017403f00f39d34611d0890edb8cebf9389.zip
Set Enabled dbus property to the correct value depending on whether the signal is connected and whether the pause button is pressed.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--src/empathy-debug-dialog.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/empathy-debug-dialog.c b/src/empathy-debug-dialog.c
index 5b6b509be..ec9c9ddb8 100644
--- a/src/empathy-debug-dialog.c
+++ b/src/empathy-debug-dialog.c
@@ -151,6 +151,21 @@ debug_dialog_new_debug_message_cb (TpProxy *proxy,
}
static void
+debug_dialog_set_enabled (EmpathyDebugDialog *debug_dialog,
+ gboolean enabled)
+{
+ EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
+ GValue *val;
+
+ val = tp_g_value_slice_new_boolean (enabled);
+
+ tp_cli_dbus_properties_call_set (priv->proxy, -1, EMP_IFACE_DEBUG,
+ "Enabled", val, NULL, NULL, NULL, NULL);
+
+ tp_g_value_slice_free (val);
+}
+
+static void
debug_dialog_get_messages_cb (TpProxy *proxy,
const GPtrArray *messages,
const GError *error,
@@ -182,6 +197,9 @@ debug_dialog_get_messages_cb (TpProxy *proxy,
priv->signal_connection = emp_cli_debug_connect_to_new_debug_message (
proxy, debug_dialog_new_debug_message_cb, debug_dialog,
NULL, NULL, NULL);
+
+ /* Set Enabled as appropriate */
+ debug_dialog_set_enabled (debug_dialog, !priv->paused);
}
static void
@@ -222,8 +240,8 @@ debug_dialog_account_chooser_changed_cb (GtkComboBox *account_chooser,
return;
}
- if (priv->proxy)
- g_object_unref (priv->proxy);
+ /* Disable debug signalling */
+ debug_dialog_set_enabled (debug_dialog, FALSE);
/* Disconnect from previous NewDebugMessage signal */
if (priv->signal_connection)
@@ -232,6 +250,9 @@ debug_dialog_account_chooser_changed_cb (GtkComboBox *account_chooser,
priv->signal_connection = NULL;
}
+ if (priv->proxy)
+ g_object_unref (priv->proxy);
+
priv->proxy = TP_PROXY (g_object_ref (connection));
emp_cli_debug_call_get_messages (priv->proxy, -1,
@@ -247,16 +268,10 @@ debug_dialog_pause_toggled_cb (GtkToggleToolButton *pause,
EmpathyDebugDialog *debug_dialog)
{
EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
- GValue *val;
priv->paused = gtk_toggle_tool_button_get_active (pause);
- val = tp_g_value_slice_new_boolean (!priv->paused);
-
- tp_cli_dbus_properties_call_set (priv->proxy, -1, EMP_IFACE_DEBUG,
- "Enabled", val, NULL, NULL, NULL, NULL);
-
- tp_g_value_slice_free (val);
+ debug_dialog_set_enabled (debug_dialog, !priv->paused);
}
static GObject *
@@ -481,6 +496,8 @@ debug_dialog_dispose (GObject *object)
if (priv->store)
g_object_unref (priv->store);
+ debug_dialog_set_enabled (EMPATHY_DEBUG_DIALOG (object), FALSE);
+
if (priv->proxy)
g_object_unref (priv->proxy);