]> git.0d.be Git - empathy.git/commitdiff
roster-window: display a button to go online
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 4 Sep 2012 13:04:25 +0000 (15:04 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 5 Sep 2012 07:13:23 +0000 (09:13 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=683326

src/empathy-roster-window.c
src/empathy-roster-window.ui

index 465a403add59d0e5809d27421791d578266db69d..4df1ee4bc148f19af3227e7ee0295ae3302f88b1 100644 (file)
@@ -41,6 +41,7 @@
 #include <libempathy/empathy-individual-manager.h>
 #include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-status-presets.h>
+#include <libempathy/empathy-presence-manager.h>
 
 #include <libempathy-gtk/empathy-live-search.h>
 #include <libempathy-gtk/empathy-contact-blocking-dialog.h>
@@ -124,6 +125,7 @@ struct _EmpathyRosterWindowPriv {
   GtkWidget *notebook;
   GtkWidget *no_entry_label;
   GtkWidget *button_account_settings;
+  GtkWidget *button_online;
   GtkWidget *spinner_loading;
   GtkWidget *tooltip_widget;
 
@@ -379,11 +381,26 @@ button_account_settings_clicked_cb (GtkButton *button,
       NULL, FALSE, FALSE);
 }
 
+static void
+button_online_clicked_cb (GtkButton *button,
+    EmpathyRosterWindow *self)
+{
+  EmpathyPresenceManager *mgr;
+
+  mgr = empathy_presence_manager_dup_singleton ();
+
+  empathy_presence_manager_set_state (mgr,
+      TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);
+
+  g_object_unref (mgr);
+}
+
 typedef enum
 {
   PAGE_MESSAGE_FLAG_NONE = 0,
   PAGE_MESSAGE_FLAG_ACCOUNTS = 1 << 0,
   PAGE_MESSAGE_FLAG_SPINNER = 1 << 2,
+  PAGE_MESSAGE_FLAG_ONLINE = 1 << 3,
 } PageMessageFlags;
 
 static void
@@ -412,6 +429,8 @@ display_page_message (EmpathyRosterWindow *self,
       (flags & PAGE_MESSAGE_FLAG_ACCOUNTS) != 0);
   gtk_widget_set_visible (self->priv->spinner_loading,
       (flags & PAGE_MESSAGE_FLAG_SPINNER) != 0);
+  gtk_widget_set_visible (self->priv->button_online,
+      (flags & PAGE_MESSAGE_FLAG_ONLINE) != 0);
 
   gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook),
       PAGE_MESSAGE);
@@ -2180,6 +2199,7 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
       "no_entry_label", &self->priv->no_entry_label,
       "roster_scrolledwindow", &sw,
       "button_account_settings", &self->priv->button_account_settings,
+      "button_online", &self->priv->button_online,
       "spinner_loading", &self->priv->spinner_loading,
       NULL);
   g_free (filename);
@@ -2343,6 +2363,8 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
 
   g_signal_connect (self->priv->button_account_settings, "clicked",
       G_CALLBACK (button_account_settings_clicked_cb), self);
+  g_signal_connect (self->priv->button_online, "clicked",
+      G_CALLBACK (button_online_clicked_cb), self);
 }
 
 GtkWidget *
index 843f94e69ec4d9ba1203c40fc3726e7aff5f0dc4..06f5826722269118dd48ce86e5ad56c524ad05da 100644 (file)
                 <property name="position">2</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkAlignment" id="alignment3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="yalign">0</property>
+                <property name="xscale">0</property>
+                <property name="yscale">0</property>
+                <child>
+                  <object class="GtkButton" id="button_online">
+                    <property name="label" translatable="yes">Go _Online</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">6</property>
+                    <property name="margin_right">6</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="position">1</property>