diff options
-rw-r--r-- | data/org.gnome.Empathy.gschema.xml.in | 5 | ||||
-rw-r--r-- | src/empathy-main-window.c | 30 | ||||
-rw-r--r-- | src/empathy-main-window.ui | 8 |
3 files changed, 38 insertions, 5 deletions
diff --git a/data/org.gnome.Empathy.gschema.xml.in b/data/org.gnome.Empathy.gschema.xml.in index 27a8cb375..10001507d 100644 --- a/data/org.gnome.Empathy.gschema.xml.in +++ b/data/org.gnome.Empathy.gschema.xml.in @@ -55,6 +55,11 @@ <_summary>Show protocols</_summary> <_description>Whether to show protocols for contacts in the contact list.</_description> </key> + <key name="show-balance-in-roster" type="b"> + <default>false</default> + <_summary>Show Balance in roster</_summary> + <_description>Whether to show account balances for in the contact roster.</_description> + </key> <key name="compact-contact-list" type="b"> <default>false</default> <_summary>Compact contact list</_summary> diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 4853ef09b..68fc4e607 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -145,6 +145,7 @@ struct _EmpathyMainWindowPriv { GtkWidget *edit_context_separator; GtkActionGroup *balance_action_group; + GtkAction *view_balance_show_in_roster; GtkWidget *balance_vbox; guint size_timeout_id; @@ -1073,9 +1074,6 @@ main_window_setup_balance_create_widget (EmpathyMainWindow *window, EmpathyMainWindowPriv *priv = GET_PRIV (window); GtkWidget *hbox, *image, *label, *button; - if (action == NULL) - return NULL; - hbox = gtk_hbox_new (FALSE, 6); image = gtk_image_new (); @@ -1116,6 +1114,7 @@ main_window_setup_balance_conn_ready (GObject *conn, gpointer user_data) { EmpathyMainWindow *window = user_data; + EmpathyMainWindowPriv *priv = GET_PRIV (window); TpAccount *account = g_object_get_data (conn, "account"); GtkAction *action; GtkWidget *widget; @@ -1139,6 +1138,11 @@ main_window_setup_balance_conn_ready (GObject *conn, /* create the action */ action = main_window_setup_balance_create_action (window, account); + if (action == NULL) + return; + + gtk_action_set_visible (priv->view_balance_show_in_roster, TRUE); + /* create the display widget */ widget = main_window_setup_balance_create_widget (window, action); @@ -1196,6 +1200,7 @@ main_window_connection_changed_cb (TpAccount *account, if (priv->balance_action_group != NULL) { GtkAction *action; char *name; + GList *a; name = main_window_account_to_action_name (account); @@ -1218,6 +1223,15 @@ main_window_connection_changed_cb (TpAccount *account, } g_free (name); + + a = gtk_action_group_list_actions ( + priv->balance_action_group); + + gtk_action_set_visible ( + priv->view_balance_show_in_roster, + g_list_length (a) > 0); + + g_list_free (a); } } @@ -2187,6 +2201,7 @@ empathy_main_window_init (EmpathyMainWindow *window) "notebook", &priv->notebook, "no_entry_label", &priv->no_entry_label, "roster_scrolledwindow", &sw, + "view_balance_show_in_roster", &priv->view_balance_show_in_roster, NULL); g_free (filename); @@ -2344,8 +2359,13 @@ empathy_main_window_init (EmpathyMainWindow *window) /* Set window size. */ empathy_geometry_bind (GTK_WINDOW (window), GEOMETRY_NAME); - /* FIXME: bind balance_vbox to action */ - gtk_widget_show (priv->balance_vbox); + /* bind view_balance_show_in_roster */ + g_settings_bind (priv->gsettings_ui, "show-balance-in-roster", + priv->view_balance_show_in_roster, "active", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (priv->view_balance_show_in_roster, "active", + priv->balance_vbox, "visible", + G_BINDING_SYNC_CREATE); /* Enable event handling */ priv->call_observer = empathy_call_observer_dup_singleton (); diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui index f9f5bd9b5..56937bae2 100644 --- a/src/empathy-main-window.ui +++ b/src/empathy-main-window.ui @@ -69,6 +69,13 @@ </object> </child> <child> + <object class="GtkToggleAction" id="view_balance_show_in_roster"> + <property name="name">view_balance_show_in_roster</property> + <property name="label" translatable="yes">Show Account _Balances in Roster</property> + <property name="visible">False</property> + </object> + </child> + <child> <object class="GtkAction" id="view_show_map"> <property name="name">view_show_map</property> <property name="label" translatable="yes">Contacts on a _Map</property> @@ -256,6 +263,7 @@ <menuitem action="view_show_offline"/> <menuitem action="view_show_protocols"/> <separator/> + <menuitem action="view_balance_show_in_roster"/> <placeholder name="view_balance_placeholder"/> <separator/> <menuitem action="view_sort_by_name"/> |