[empathy] CallWindow: build the toolbar from the .ui



commit 4f8ad828afebbacef6d7d3560067976e4fc6f90a
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Wed Jul 27 09:06:01 2011 +0100

    CallWindow: build the toolbar from the .ui

 src/empathy-call-window.c  |   72 ++-----------------------------------------
 src/empathy-call-window.ui |   63 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 66 insertions(+), 69 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 8ba25a7..3bd6d74 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -125,7 +125,6 @@ struct _EmpathyCallWindowPriv
   GtkWidget *remote_user_avatar_toolbar;
   GtkWidget *remote_user_name_toolbar;
   GtkWidget *sidebar;
-  GtkWidget *volume_item;
   GtkWidget *status_label;
   GtkWidget *hangup_button;
   GtkWidget *audio_call_button;
@@ -313,70 +312,6 @@ empathy_call_window_video_call_cb (GtkToggleToolButton *button,
 }
 
 static void
-empathy_call_window_setup_toolbars (EmpathyCallWindow *self)
-{
-  EmpathyCallWindowPriv *priv = GET_PRIV (self);
-  GtkWidget *volume_button;
-  GtkToolItem *tool_item;
-
-  /* Add an empty expanded GtkToolItem to the top toolbar */
-  tool_item = gtk_tool_item_new ();
-  gtk_tool_item_set_expand (tool_item, TRUE);
-  gtk_widget_show (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
-
-  /* Set the remote name */
-  tool_item = gtk_tool_item_new ();
-  priv->remote_user_name_toolbar = gtk_label_new (NULL);
-  gtk_container_add (GTK_CONTAINER (tool_item),
-      priv->remote_user_name_toolbar);
-  gtk_widget_show_all (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
-
-  /* Add some space between the image and the name */
-  tool_item = gtk_separator_tool_item_new ();
-  gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item),
-      FALSE);
-  gtk_widget_show (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
-
-  /* Set the remote avatar */
-  tool_item = gtk_tool_item_new ();
-  priv->remote_user_avatar_toolbar = gtk_image_new ();
-  gtk_container_add (GTK_CONTAINER (tool_item),
-      priv->remote_user_avatar_toolbar);
-  gtk_widget_show_all (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
-
-  /* Set the volume button */
-  volume_button = gtk_volume_button_new ();
-  /* FIXME listen to the audiosinks signals and update the button according to
-   * that, for now starting out at 1.0 and assuming only the app changes the
-   * volume will do */
-  gtk_scale_button_set_value (GTK_SCALE_BUTTON (volume_button), 1.0);
-  g_signal_connect (G_OBJECT (volume_button), "value-changed",
-    G_CALLBACK (empathy_call_window_volume_changed_cb), self);
-
-  gtk_container_add (GTK_CONTAINER (priv->volume_item),
-      volume_button);
-  gtk_widget_show (GTK_WIDGET (volume_button));
-
-  /* Add an empty expanded GtkToolItem so the label is at the end */
-  tool_item = gtk_tool_item_new ();
-  gtk_tool_item_set_expand (tool_item, TRUE);
-  gtk_widget_show (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->bottom_toolbar), tool_item, -1);
-
-  /* Set the status label */
-  tool_item = gtk_tool_item_new ();
-  priv->status_label = gtk_label_new (NULL);
-  gtk_container_add (GTK_CONTAINER (tool_item),
-      priv->status_label);
-  gtk_widget_show_all (GTK_WIDGET (tool_item));
-  gtk_toolbar_insert (GTK_TOOLBAR (priv->bottom_toolbar), tool_item, -1);
-}
-
-static void
 dtmf_button_pressed_cb (GtkButton *button, EmpathyCallWindow *window)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (window);
@@ -1041,9 +976,11 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "call_window_vbox", &top_vbox,
     "errors_vbox", &priv->errors_vbox,
     "pane", &priv->pane,
+    "remote_user_name_toolbar", &priv->remote_user_name_toolbar,
+    "remote_user_avatar_toolbar", &priv->remote_user_avatar_toolbar,
+    "status_label", &priv->status_label,
     "audiocall", &priv->audio_call_button,
     "videocall", &priv->video_call_button,
-    "volume", &priv->volume_item,
     "microphone", &priv->mic_button,
     "camera", &priv->camera_button,
     "hangup", &priv->hangup_button,
@@ -1075,6 +1012,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "audiocall", "clicked", empathy_call_window_audio_call_cb,
     "videocall", "clicked", empathy_call_window_video_call_cb,
     "menusidebar", "toggled", empathy_call_window_sidebar_cb,
+    "volume", "value-changed", empathy_call_window_volume_changed_cb,
     "microphone", "toggled", empathy_call_window_mic_toggled_cb,
     "camera", "toggled", empathy_call_window_camera_toggled_cb,
     "dialpad", "toggled", empathy_call_window_dialpad_cb,
@@ -1152,8 +1090,6 @@ empathy_call_window_init (EmpathyCallWindow *self)
   /* The call will be started as soon the pipeline is playing */
   priv->start_call_when_playing = TRUE;
 
-  empathy_call_window_setup_toolbars (self);
-
   priv->sidebar = ev_sidebar_new ();
   g_signal_connect (G_OBJECT (priv->sidebar),
     "hide", G_CALLBACK (empathy_call_window_sidebar_hidden_cb), self);
diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui
index 205b666..bbcd972 100644
--- a/src/empathy-call-window.ui
+++ b/src/empathy-call-window.ui
@@ -96,6 +96,43 @@
             	<class name="primary-toolbar"/>
             </style>
             <child>
+              <object class="GtkToolItem" id="toolitem1">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkImage" id="remote_user_avatar_toolbar">
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparatorToolItem" id="toolbutton1">
+                <property name="draw">False</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkToolItem" id="toolitem2">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkLabel" id="remote_user_name_toolbar">
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkToolItem" id="toolbar_space1">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkToolButton" id="hangup">
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">Hang up</property>
@@ -186,8 +223,14 @@
               </packing>
             </child>
             <child>
-              <object class="GtkToolItem" id="volume">
+              <object class="GtkToolItem" id="toolitem3">
                 <property name="visible">True</property>
+                <child>
+                  <object class="GtkVolumeButton" id="volume">
+                    <property name="visible">True</property>
+                    <property name="value">1.0</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="homogeneous">True</property>
@@ -205,6 +248,24 @@
                 <property name="homogeneous">True</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkToolItem" id="toolbar_space2">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkToolItem" id="toolitem4">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkLabel" id="status_label">
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]