]> git.0d.be Git - empathy.git/commitdiff
CallWindow: add a dialpad tool button
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Fri, 8 Jul 2011 14:45:27 +0000 (15:45 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 12 Jul 2011 08:46:23 +0000 (09:46 +0100)
Rename the dialpad menu entry to Sidebar and move it to
the View menu at the same time.

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

index eee37476e5d8787b6981c238152f00afbaf42207..5103eb901577d775bda32aa347a1e95b110a39f6 100644 (file)
@@ -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)
index fe246012d824fdcb215c488add7ee7109b488c1d..7e41961f597109cf8269cacf915f78018bdc592b 100644 (file)
@@ -26,9 +26,9 @@
           </object>
         </child>
         <child>
-          <object class="GtkToggleAction" id="menudialpad">
-            <property name="name">menudialpad</property>
-            <property name="label" translatable="yes">_Dialpad</property>
+          <object class="GtkToggleAction" id="menusidebar">
+            <property name="name">menusidebar</property>
+            <property name="label" translatable="yes">_Sidebar</property>
           </object>
         </child>
         <child>
         <menu action="call">
           <menuitem action="menuhangup"/>
           <menuitem action="menuredial"/>
-          <menuitem action="menudialpad"/>
         </menu>
         <menu action="view">
           <menuitem action="menufullscreen"/>
+          <menuitem action="menusidebar"/>
         </menu>
       </menubar>
       <popup name="video-popup">
                 <property name="homogeneous">True</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkToggleToolButton" id="dialpad">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Show dialpad</property>
+                <property name="icon_name">accessories-calculator</property>
+                <property name="tooltip_text" translatable="yes">Display the dialpad</property>
+              </object>
+              <packing>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>