aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-12-26 18:05:12 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-12-26 18:16:16 +0800
commite9426542a9268d052d622c6f1645707d392f55cb (patch)
tree63fe78a3ca4df60949814346803656767e15a092 /src
parent3f757018829e1b2d025c38efd3f98017f368cd86 (diff)
downloadgsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar.gz
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar.bz2
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar.lz
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar.xz
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.tar.zst
gsoc2013-empathy-e9426542a9268d052d622c6f1645707d392f55cb.zip
roster-window: add a 'Show offline button" when relevant
https://bugzilla.gnome.org/show_bug.cgi?id=670048
Diffstat (limited to 'src')
-rw-r--r--src/empathy-roster-window.c28
-rw-r--r--src/empathy-roster-window.ui26
2 files changed, 53 insertions, 1 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index 78d47f8f6..4e84b3f00 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -125,6 +125,7 @@ struct _EmpathyRosterWindowPriv {
GtkWidget *no_entry_label;
GtkWidget *button_account_settings;
GtkWidget *button_online;
+ GtkWidget *button_show_offline;
GtkWidget *spinner_loading;
GtkWidget *tooltip_widget;
@@ -393,12 +394,21 @@ button_online_clicked_cb (GtkButton *button,
g_object_unref (mgr);
}
+static void
+button_show_offline_clicked_cb (GtkButton *button,
+ EmpathyRosterWindow *self)
+{
+ g_settings_set_boolean (self->priv->gsettings_ui,
+ EMPATHY_PREFS_UI_SHOW_OFFLINE, TRUE);
+}
+
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,
+ PAGE_MESSAGE_FLAG_SHOW_OFFLINE = 1 << 4,
} PageMessageFlags;
static void
@@ -429,6 +439,8 @@ display_page_message (EmpathyRosterWindow *self,
(flags & PAGE_MESSAGE_FLAG_SPINNER) != 0);
gtk_widget_set_visible (self->priv->button_online,
(flags & PAGE_MESSAGE_FLAG_ONLINE) != 0);
+ gtk_widget_set_visible (self->priv->button_show_offline,
+ (flags & PAGE_MESSAGE_FLAG_SHOW_OFFLINE) != 0);
gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook),
PAGE_MESSAGE);
@@ -1631,7 +1643,7 @@ set_notebook_page (EmpathyRosterWindow *self)
PAGE_MESSAGE_FLAG_NONE);
else
display_page_message (self, _("No online contacts"),
- PAGE_MESSAGE_FLAG_NONE);
+ PAGE_MESSAGE_FLAG_SHOW_OFFLINE);
}
goto out;
}
@@ -2150,6 +2162,14 @@ roster_window_most_available_presence_changed_cb (TpAccountManager *manager,
}
static void
+show_offline_changed_cb (GSettings *settings,
+ const gchar *key,
+ EmpathyRosterWindow *self)
+{
+ set_notebook_page (self);
+}
+
+static void
empathy_roster_window_init (EmpathyRosterWindow *self)
{
GtkBuilder *gui;
@@ -2190,6 +2210,7 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
"roster_scrolledwindow", &sw,
"button_account_settings", &self->priv->button_account_settings,
"button_online", &self->priv->button_online,
+ "button_show_offline", &self->priv->button_show_offline,
"spinner_loading", &self->priv->spinner_loading,
NULL);
g_free (filename);
@@ -2341,6 +2362,9 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
g_settings_bind (self->priv->gsettings_ui, EMPATHY_PREFS_UI_SHOW_OFFLINE,
self->priv->view, "show-offline",
G_SETTINGS_BIND_GET);
+ tp_g_signal_connect_object (self->priv->gsettings_ui,
+ "changed::" EMPATHY_PREFS_UI_SHOW_OFFLINE,
+ G_CALLBACK (show_offline_changed_cb), self, 0);
g_settings_bind (self->priv->gsettings_ui, EMPATHY_PREFS_UI_SHOW_GROUPS,
self->priv->view, "show-groups",
G_SETTINGS_BIND_GET);
@@ -2352,6 +2376,8 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
G_CALLBACK (button_account_settings_clicked_cb), self);
g_signal_connect (self->priv->button_online, "clicked",
G_CALLBACK (button_online_clicked_cb), self);
+ g_signal_connect (self->priv->button_show_offline, "clicked",
+ G_CALLBACK (button_show_offline_clicked_cb), self);
}
GtkWidget *
diff --git a/src/empathy-roster-window.ui b/src/empathy-roster-window.ui
index 06f582672..186b87a61 100644
--- a/src/empathy-roster-window.ui
+++ b/src/empathy-roster-window.ui
@@ -191,6 +191,32 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkAlignment" id="alignment4">
+ <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_show_offline">
+ <property name="label" translatable="yes">Show _Offline Contacts</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>