aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-03 00:33:15 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-03 20:43:57 +0800
commit51c871d17949a1366f09eb16e74aac0cae653086 (patch)
tree8eb2ee44b6fa5991a683e9a35b2f731928cf5126 /libempathy-gtk
parent64e877879a95dda07645726acb0b4881e3280093 (diff)
downloadgsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar.gz
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar.bz2
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar.lz
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar.xz
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.tar.zst
gsoc2013-empathy-51c871d17949a1366f09eb16e74aac0cae653086.zip
empathy-account-widget: replace the 'Connect' buton by a 'Save' one when we are offline (#600427)
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-account-widget.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 293b2c711..3fc556af8 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -35,6 +35,7 @@
#endif
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-idle.h>
#include <telepathy-glib/account.h>
#include <telepathy-glib/connection-manager.h>
@@ -71,6 +72,8 @@ typedef struct {
* modify it. When we are creating an account, this member is set to TRUE */
gboolean creating_account;
+ EmpathyIdle *idle;
+
gboolean dispose_run;
} EmpathyAccountWidgetPriv;
@@ -1240,10 +1243,35 @@ do_constructed (GObject *obj)
if (!priv->simple)
{
GtkWidget *hbox = gtk_hbox_new (TRUE, 3);
+ const gchar *apply_button_id;
priv->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- priv->apply_button = gtk_button_new_from_stock (
- priv->creating_account ? GTK_STOCK_CONNECT : GTK_STOCK_APPLY);
+
+ if (priv->creating_account)
+ {
+ TpConnectionPresenceType state;
+ priv->idle = empathy_idle_dup_singleton ();
+
+ state = empathy_idle_get_state (priv->idle);
+
+ if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
+ {
+ /* We are online, display a Connect button */
+ apply_button_id = GTK_STOCK_CONNECT;
+ }
+ else
+ {
+ /* We are offline, display a Save button */
+ apply_button_id = GTK_STOCK_SAVE;
+ }
+ }
+ else
+ {
+ /* We are editing an existing account, display an Apply button */
+ apply_button_id = GTK_STOCK_APPLY;
+ }
+
+ priv->apply_button = gtk_button_new_from_stock (apply_button_id);
#ifdef HAVE_MOBLIN
if (priv->creating_account)
@@ -1386,6 +1414,12 @@ do_dispose (GObject *obj)
priv->settings = NULL;
}
+ if (priv->idle != NULL)
+ {
+ g_object_unref (priv->idle);
+ priv->idle = NULL;
+ }
+
if (G_OBJECT_CLASS (empathy_account_widget_parent_class)->dispose != NULL)
G_OBJECT_CLASS (empathy_account_widget_parent_class)->dispose (obj);
}