aboutsummaryrefslogtreecommitdiffstats
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-03-19 02:49:54 +0800
commit55cb2cf01c448a9e4239945a76adde482fded2cf (patch)
tree080e30121f61266bafc567b6316c4aa23153aa54
parent019dfb03af25ec93a7cc897900cde7f2dda0ae55 (diff)
downloadgsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar.gz
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar.bz2
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar.lz
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar.xz
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.tar.zst
gsoc2013-empathy-55cb2cf01c448a9e4239945a76adde482fded2cf.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.
-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",