From 70fc920514af12b5c96e928a3178dfd9ddd8ed9e Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Fri, 8 Jul 2011 15:45:27 +0100 Subject: CallWindow: add a dialpad tool button Rename the dialpad menu entry to Sidebar and move it to the View menu at the same time. --- src/empathy-call-window.c | 49 ++++++++++++++++++++++++++++++++++------------ src/empathy-call-window.ui | 19 ++++++++++++++---- 2 files changed, 52 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index eee37476e..5103eb901 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -125,10 +125,11 @@ struct _EmpathyCallWindowPriv GtkWidget *redial_button; GtkWidget *mic_button; GtkWidget *camera_button; + GtkWidget *dialpad_button; GtkWidget *toolbar; GtkWidget *pane; GtkAction *redial; - GtkAction *menu_dialpad; + GtkAction *menu_sidebar; GtkAction *menu_fullscreen; /* The box that contains self and remote avatar and video @@ -231,6 +232,9 @@ static void empathy_call_window_set_send_video (EmpathyCallWindow *window, static void empathy_call_window_mic_toggled_cb ( GtkToggleToolButton *toggle, EmpathyCallWindow *window); +static void empathy_call_window_sidebar_cb (GtkToggleAction *menu, + EmpathyCallWindow *self); + static void empathy_call_window_sidebar_hidden_cb (EvSidebar *sidebar, EmpathyCallWindow *window); @@ -264,7 +268,7 @@ static void empathy_call_window_video_menu_popup (EmpathyCallWindow *window, static void empathy_call_window_redial_cb (gpointer object, EmpathyCallWindow *window); -static void empathy_call_window_dialpad_cb (GtkToggleAction *menu, +static void empathy_call_window_dialpad_cb (GtkToggleToolButton *button, EmpathyCallWindow *window); static void empathy_call_window_restart_call (EmpathyCallWindow *window); @@ -976,9 +980,10 @@ empathy_call_window_init (EmpathyCallWindow *self) "redial", &priv->redial_button, "microphone", &priv->mic_button, "camera", &priv->camera_button, + "dialpad", &priv->dialpad_button, "toolbar", &priv->toolbar, "menuredial", &priv->redial, - "menudialpad", &priv->menu_dialpad, + "menusidebar", &priv->menu_sidebar, "ui_manager", &priv->ui_manager, "menufullscreen", &priv->menu_fullscreen, "details_vbox", &priv->details_vbox, @@ -1002,9 +1007,10 @@ empathy_call_window_init (EmpathyCallWindow *self) "hangup", "clicked", empathy_call_window_hangup_cb, "menuredial", "activate", empathy_call_window_redial_cb, "redial", "clicked", empathy_call_window_redial_cb, - "menudialpad", "toggled", empathy_call_window_dialpad_cb, + "menusidebar", "toggled", empathy_call_window_sidebar_cb, "microphone", "toggled", empathy_call_window_mic_toggled_cb, "camera", "toggled", empathy_call_window_camera_toggled_cb, + "dialpad", "toggled", empathy_call_window_dialpad_cb, "menufullscreen", "activate", empathy_call_window_fullscreen_cb, "menupreviewdisable", "activate", empathy_call_window_disable_camera_cb, "menupreviewminimise", "activate", empathy_call_window_minimise_camera_cb, @@ -2824,17 +2830,28 @@ empathy_call_window_state_event_cb (GtkWidget *widget, } static void -empathy_call_window_update_dialpad_menu (EmpathyCallWindow *window, +empathy_call_window_update_sidebar_buttons (EmpathyCallWindow *window, gboolean toggled) { EmpathyCallWindowPriv *priv = GET_PRIV (window); - g_signal_handlers_block_by_func (priv->menu_dialpad, + /* Update dialpad button */ + g_signal_handlers_block_by_func (priv->dialpad_button, empathy_call_window_dialpad_cb, window); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->menu_dialpad), + gtk_toggle_tool_button_set_active ( + GTK_TOGGLE_TOOL_BUTTON (priv->dialpad_button), toggled); - g_signal_handlers_unblock_by_func (priv->menu_dialpad, + g_signal_handlers_unblock_by_func (priv->dialpad_button, empathy_call_window_dialpad_cb, window); + + /* Update sidebar menu */ + g_signal_handlers_block_by_func (priv->menu_sidebar, + empathy_call_window_sidebar_cb, window); + gtk_toggle_action_set_active ( + GTK_TOGGLE_ACTION (priv->menu_sidebar), + gtk_widget_get_visible (priv->sidebar)); + g_signal_handlers_unblock_by_func (priv->menu_sidebar, + empathy_call_window_sidebar_cb, window); } static void @@ -2874,7 +2891,7 @@ empathy_call_window_show_sidebar (EmpathyCallWindow *window, dialpad_shown = active && !tp_strdiff (page, "dialpad"); g_free (page); - empathy_call_window_update_dialpad_menu (window, dialpad_shown); + empathy_call_window_update_sidebar_buttons (window, dialpad_shown); } static void @@ -2953,7 +2970,7 @@ empathy_call_window_sidebar_changed_cb (EvSidebar *sidebar, const gchar *page, EmpathyCallWindow *window) { - empathy_call_window_update_dialpad_menu (window, + empathy_call_window_update_sidebar_buttons (window, !tp_strdiff (page, "dialpad")); } @@ -3020,13 +3037,13 @@ empathy_call_window_redial_cb (gpointer object, } static void -empathy_call_window_dialpad_cb (GtkToggleAction *menu, +empathy_call_window_dialpad_cb (GtkToggleToolButton *button, EmpathyCallWindow *window) { EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; - active = gtk_toggle_action_get_active (menu); + active = gtk_toggle_tool_button_get_active (button); if (active) ev_sidebar_set_current_page (EV_SIDEBAR (priv->sidebar), "dialpad"); @@ -3034,6 +3051,14 @@ empathy_call_window_dialpad_cb (GtkToggleAction *menu, empathy_call_window_show_sidebar (window, active); } +static void +empathy_call_window_sidebar_cb (GtkToggleAction *menu, + EmpathyCallWindow *self) +{ + empathy_call_window_show_sidebar (self, + gtk_toggle_action_get_active (menu)); +} + static void empathy_call_window_fullscreen_cb (gpointer object, EmpathyCallWindow *window) diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index fe246012d..7e41961f5 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -26,9 +26,9 @@ - - menudialpad - _Dialpad + + menusidebar + _Sidebar @@ -69,10 +69,10 @@ - + @@ -161,6 +161,17 @@ True + + + True + Show dialpad + accessories-calculator + Display the dialpad + + + True + + False -- cgit v1.2.3