aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorFelix Kaser <f.kaser@gmx.net>2009-12-02 00:04:30 +0800
committerFelix Kaser <f.kaser@gmx.net>2009-12-02 00:18:56 +0800
commit3e6fc17bc72bb426af351e0cfc33abb775ada155 (patch)
tree3fbf158581a059ba83d654d1f4b887d6aa12e245 /libempathy-gtk
parent19d28abca284a7a85a98f8bdd01aeb0ff54860e7 (diff)
downloadgsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar.gz
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar.bz2
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar.lz
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar.xz
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.tar.zst
gsoc2013-empathy-3e6fc17bc72bb426af351e0cfc33abb775ada155.zip
added destroyed flag
the destroyed flag indicates if the widgets in empathy-account-widget have already been destroyed. this is important for some async calls.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-account-widget.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 30bb55263..c28ee75a6 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -75,6 +75,12 @@ typedef struct {
* account has been created */
gboolean account_created;
+ /* if TRUE, the GTK+ destroy signal has been fired and so the widgets
+ * embedded in this account widget can't be used any more
+ * workaround because some async callbacks can be called after the
+ * widget has been destroyed */
+ gboolean destroyed;
+
TpAccountManager *account_manager;
gboolean dispose_run;
@@ -685,6 +691,7 @@ account_widget_account_enabled_cb (GObject *source_object,
}
}
+ /* unref widget - part of the workaround */
g_object_unref (widget);
g_free (message);
g_free (status);
@@ -717,7 +724,10 @@ account_widget_applied_cb (GObject *source_object,
if (priv->creating_account)
{
/* By default, when an account is created, we enable it. */
+
+ /* workaround to keep widget alive during async call */
g_object_ref (widget);
+
tp_account_set_enabled_async (account, TRUE,
account_widget_account_enabled_cb, widget);
priv->account_created = TRUE;
@@ -746,7 +756,10 @@ account_widget_applied_cb (GObject *source_object,
}
}
- account_widget_set_control_buttons_sensitivity (widget, FALSE);
+ if (!priv->destroyed)
+ account_widget_set_control_buttons_sensitivity (widget, FALSE);
+
+ /* unref the widget - part of the workaround */
g_object_unref (widget);
}
@@ -756,6 +769,7 @@ account_widget_apply_clicked_cb (GtkWidget *button,
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ /* workaround to keep widget alive during async call */
g_object_ref (self);
empathy_account_settings_apply_async (priv->settings,
account_widget_applied_cb, self);
@@ -1152,6 +1166,10 @@ static void
account_widget_destroy_cb (GtkWidget *widget,
EmpathyAccountWidget *self)
{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ /* set the destroyed flag - workaround */
+ priv->destroyed = TRUE;
+
g_object_unref (self);
}
@@ -1198,6 +1216,7 @@ account_widget_switch_flipped_cb (NbtkGtkLightSwitch *sw,
account = empathy_account_settings_get_account (priv->settings);
/* Enable the account according to the value of the "Enabled" checkbox */
+ /* workaround to keep widget alive during async call */
g_object_ref (user_data);
tp_account_set_enabled_async (account, state,
account_widget_account_enabled_cb, user_data);