aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-03-08 08:39:21 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-08 18:41:27 +0800
commit3c150e71f7944978b038f9c412d7a458fd0f51e6 (patch)
tree2bb7054160082ea62fda956b5cae874468d631af /libempathy-gtk
parent29e955cef16efd532e288659b2af6a9409b996bf (diff)
downloadgsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar.gz
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar.bz2
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar.lz
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar.xz
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.tar.zst
gsoc2013-empathy-3c150e71f7944978b038f9c412d7a458fd0f51e6.zip
Don't assume account != NULL
Fixes problem when creating a new Skype account widget. This patch also ports to the bind_connection_status_property() now present in tp-glib.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-account-widget.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 296c56489..1baa53005 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1758,37 +1758,6 @@ account_widget_build_skype_setup_combo (EmpathyAccountWidget *self,
G_CALLBACK (account_widget_skype_combo_changed_cb), self);
}
-static gboolean
-_connection_status_binding_function (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- g_return_val_if_fail (G_VALUE_HOLDS_UINT (source_value), FALSE);
- g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (target_value), FALSE);
-
- g_value_set_boolean (target_value,
- g_value_get_uint (source_value) == TP_CONNECTION_STATUS_CONNECTED);
-
- return TRUE;
-}
-
-static GBinding *
-account_widget_bind_connection_status (EmpathyAccountSettings *settings,
- gpointer widget,
- const char *property)
-{
- /* FIXME: support for this in tp-glib is
- * https://bugs.freedesktop.org/show_bug.cgi?id=34813 */
- return g_object_bind_property_full (
- empathy_account_settings_get_account (settings),
- "connection-status",
- widget, property,
- G_BINDING_SYNC_CREATE,
- _connection_status_binding_function,
- NULL, NULL, NULL);
-}
-
static void
account_widget_skype_privacy_settings (GtkWidget *button,
EmpathyAccountWidget *self)
@@ -1816,8 +1785,9 @@ account_widget_skype_privacy_settings (GtkWidget *button,
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
/* make the settings insensitive when the account is disconnected */
- account_widget_bind_connection_status (priv->settings,
- table, "sensitive");
+ tp_account_bind_connection_status_to_property (
+ empathy_account_settings_get_account (priv->settings),
+ table, "sensitive", FALSE);
/* set up an informative info bar */
infobar = gtk_info_bar_new ();
@@ -1901,6 +1871,8 @@ account_widget_build_skype (EmpathyAccountWidget *self,
else
{
GtkWidget *edit_privacy_settings_button;
+ TpAccount *account =
+ empathy_account_settings_get_account (priv->settings);
self->ui_details->gui = empathy_builder_get_file (filename,
"table_common_skype_settings", &priv->table_common_settings,
@@ -1913,8 +1885,11 @@ account_widget_build_skype (EmpathyAccountWidget *self,
account_widget_skype_privacy_settings,
NULL);
- account_widget_bind_connection_status (priv->settings,
- edit_privacy_settings_button, "sensitive");
+ if (account != NULL)
+ tp_account_bind_connection_status_to_property (account,
+ edit_privacy_settings_button, "sensitive", FALSE);
+ else
+ gtk_widget_set_sensitive (edit_privacy_settings_button, FALSE);
empathy_account_widget_handle_params (self,
"entry_id", "account",