diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-12-26 18:15:03 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-12-26 18:16:16 +0800 |
commit | 3c5a3f177c017e68503c8cff90552e5d1ab20a7c (patch) | |
tree | 2435652b0765bb81ba83bf4450c0a3d6fdaf7d2d | |
parent | e9426542a9268d052d622c6f1645707d392f55cb (diff) | |
download | gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar.gz gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar.bz2 gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar.lz gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar.xz gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.tar.zst gsoc2013-empathy-3c5a3f177c017e68503c8cff90552e5d1ab20a7c.zip |
roster-window: add 'Add Contact...' button when relevant
https://bugzilla.gnome.org/show_bug.cgi?id=670048
-rw-r--r-- | src/empathy-roster-window.c | 16 | ||||
-rw-r--r-- | src/empathy-roster-window.ui | 26 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c index 4e84b3f00..b87741b35 100644 --- a/src/empathy-roster-window.c +++ b/src/empathy-roster-window.c @@ -126,6 +126,7 @@ struct _EmpathyRosterWindowPriv { GtkWidget *button_account_settings; GtkWidget *button_online; GtkWidget *button_show_offline; + GtkWidget *button_add_contact; GtkWidget *spinner_loading; GtkWidget *tooltip_widget; @@ -402,6 +403,13 @@ button_show_offline_clicked_cb (GtkButton *button, EMPATHY_PREFS_UI_SHOW_OFFLINE, TRUE); } +static void +button_add_contact_clicked_cb (GtkButton *button, + EmpathyRosterWindow *self) +{ + empathy_new_individual_dialog_show (GTK_WINDOW (self)); +} + typedef enum { PAGE_MESSAGE_FLAG_NONE = 0, @@ -409,6 +417,7 @@ typedef enum PAGE_MESSAGE_FLAG_SPINNER = 1 << 2, PAGE_MESSAGE_FLAG_ONLINE = 1 << 3, PAGE_MESSAGE_FLAG_SHOW_OFFLINE = 1 << 4, + PAGE_MESSAGE_FLAG_ADD_CONTACT = 1 << 5, } PageMessageFlags; static void @@ -441,6 +450,8 @@ display_page_message (EmpathyRosterWindow *self, (flags & PAGE_MESSAGE_FLAG_ONLINE) != 0); gtk_widget_set_visible (self->priv->button_show_offline, (flags & PAGE_MESSAGE_FLAG_SHOW_OFFLINE) != 0); + gtk_widget_set_visible (self->priv->button_add_contact, + (flags & PAGE_MESSAGE_FLAG_ADD_CONTACT) != 0); gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), PAGE_MESSAGE); @@ -1640,7 +1651,7 @@ set_notebook_page (EmpathyRosterWindow *self) if (g_settings_get_boolean (self->priv->gsettings_ui, EMPATHY_PREFS_UI_SHOW_OFFLINE)) display_page_message (self, _("You haven't added any contact yet"), - PAGE_MESSAGE_FLAG_NONE); + PAGE_MESSAGE_FLAG_ADD_CONTACT); else display_page_message (self, _("No online contacts"), PAGE_MESSAGE_FLAG_SHOW_OFFLINE); @@ -2211,6 +2222,7 @@ empathy_roster_window_init (EmpathyRosterWindow *self) "button_account_settings", &self->priv->button_account_settings, "button_online", &self->priv->button_online, "button_show_offline", &self->priv->button_show_offline, + "button_add_contact", &self->priv->button_add_contact, "spinner_loading", &self->priv->spinner_loading, NULL); g_free (filename); @@ -2378,6 +2390,8 @@ empathy_roster_window_init (EmpathyRosterWindow *self) G_CALLBACK (button_online_clicked_cb), self); g_signal_connect (self->priv->button_show_offline, "clicked", G_CALLBACK (button_show_offline_clicked_cb), self); + g_signal_connect (self->priv->button_add_contact, "clicked", + G_CALLBACK (button_add_contact_clicked_cb), self); } GtkWidget * diff --git a/src/empathy-roster-window.ui b/src/empathy-roster-window.ui index 186b87a61..25156d5fc 100644 --- a/src/empathy-roster-window.ui +++ b/src/empathy-roster-window.ui @@ -217,6 +217,32 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkAlignment" id="alignment5"> + <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_add_contact"> + <property name="label" translatable="yes">_Add Contact...</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> |