diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-04-16 20:28:37 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-04-16 20:28:37 +0800 |
commit | 3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf (patch) | |
tree | f7d2dda4c638a906703baedd4438d0aaacbcdbc9 | |
parent | 19b7e4db700dcb1ce5eec4953c99c90b0b3de7f7 (diff) | |
download | gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar.gz gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar.bz2 gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar.lz gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar.xz gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.tar.zst gsoc2013-empathy-3eed3d02ed57d6978dcfb40dcc9c42aba8d63fbf.zip |
Port EmpathyCallWindow to new API
From: Xavier Claessens <xclaesse@gmail.com>
svn path=/trunk/; revision=2855
-rw-r--r-- | src/empathy-call-window.c | 59 | ||||
-rw-r--r-- | src/empathy-call-window.ui | 153 |
2 files changed, 79 insertions, 133 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index a97eea0ae..48b6b6647 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -77,6 +77,9 @@ struct _EmpathyCallWindowPriv GtkWidget *volume_button; GtkWidget *mic_button; GtkWidget *camera_button; + GtkWidget *toolbar; + GtkWidget *hangup; + GtkWidget *pane; gdouble volume; GtkAdjustment *audio_input_adj; @@ -92,7 +95,6 @@ struct _EmpathyCallWindowPriv GstElement *funnel; GstElement *liveadder; - GladeXML *glade; guint context_id; GTimer *timer; @@ -144,10 +146,8 @@ static void empathy_call_window_setup_menubar (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - GtkWidget *hangup; - hangup = glade_xml_get_widget (priv->glade, "menuhangup"); - g_signal_connect_swapped (G_OBJECT (hangup), "activate", + g_signal_connect_swapped (priv->hangup, "activate", G_CALLBACK (empathy_call_window_hangup), self); } @@ -155,32 +155,23 @@ static void empathy_call_window_setup_toolbar (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - GtkWidget *hangup; - GtkWidget *mic; - GtkWidget *camera; - GtkWidget *toolbar; GtkToolItem *tool_item; - hangup = glade_xml_get_widget (priv->glade, "hangup"); - - g_signal_connect_swapped (G_OBJECT (hangup), "clicked", + g_signal_connect_swapped (priv->hangup, "clicked", G_CALLBACK (empathy_call_window_hangup), self); - mic = glade_xml_get_widget (priv->glade, "microphone"); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (mic), TRUE); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (priv->mic_button), + TRUE); - priv->mic_button = mic; g_signal_connect (G_OBJECT (priv->mic_button), "toggled", G_CALLBACK (empathy_call_window_mic_toggled_cb), self); - toolbar = glade_xml_get_widget (priv->glade, "toolbar"); - /* Add an empty expanded GtkToolItem so the volume button is at the end of * the 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 (toolbar), tool_item, -1); + gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, -1); priv->volume_button = gtk_volume_button_new (); /* FIXME listen to the audiosinks signals and update the button according to @@ -193,14 +184,13 @@ empathy_call_window_setup_toolbar (EmpathyCallWindow *self) tool_item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (tool_item), priv->volume_button); gtk_widget_show_all (GTK_WIDGET (tool_item)); - gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, -1); + gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, -1); - camera = glade_xml_get_widget (priv->glade, "camera"); - priv->camera_button = camera; - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (camera), FALSE); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), + FALSE); gtk_widget_set_sensitive (priv->camera_button, FALSE); - g_signal_connect (G_OBJECT (camera), "toggled", + g_signal_connect (priv->camera_button, "toggled", G_CALLBACK (empathy_call_window_camera_toggled_cb), self); } @@ -483,25 +473,28 @@ static void empathy_call_window_init (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); + GtkBuilder *gui; GtkWidget *vbox, *top_vbox; GtkWidget *hbox, *h; GtkWidget *arrow; GtkWidget *page; GstBus *bus; gchar *filename; - GtkWidget *pane; - filename = empathy_file_lookup ("empathy-call-window.glade", "src"); - - priv->glade = empathy_glade_get_file (filename, "call_window", NULL, + filename = empathy_file_lookup ("empathy-call-window.ui", "src"); + gui = empathy_builder_get_file (filename, "call_window_vbox", &top_vbox, - "pane", &pane, + "pane", &priv->pane, "statusbar", &priv->statusbar, + "microphone", &priv->mic_button, + "camera", &priv->camera_button, + "toolbar", &priv->toolbar, + "hangup", &priv->hangup, NULL); priv->lock = g_mutex_new (); - gtk_widget_reparent (top_vbox, GTK_WIDGET (self)); + gtk_container_add (GTK_CONTAINER (self), top_vbox); empathy_call_window_setup_menubar (self); empathy_call_window_setup_toolbar (self); @@ -510,7 +503,7 @@ empathy_call_window_init (EmpathyCallWindow *self) hbox = gtk_hbox_new (FALSE, 3); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_paned_pack1 (GTK_PANED(pane), hbox, TRUE, FALSE); + gtk_paned_pack1 (GTK_PANED (priv->pane), hbox, TRUE, FALSE); bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline)); @@ -559,7 +552,7 @@ empathy_call_window_init (EmpathyCallWindow *self) g_signal_connect (G_OBJECT (priv->sidebar), "hide", G_CALLBACK (empathy_call_window_sidebar_hidden_cb), self); - gtk_paned_pack2 (GTK_PANED(pane), priv->sidebar, FALSE, FALSE); + gtk_paned_pack2 (GTK_PANED (priv->pane), priv->sidebar, FALSE, FALSE); priv->dtmf_panel = empathy_call_window_create_dtmf (self); empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), _("Dialpad"), @@ -588,6 +581,8 @@ empathy_call_window_init (EmpathyCallWindow *self) empathy_call_window_status_message (self, _("Connecting...")); priv->timer = g_timer_new (); + + g_object_unref (gui); } static void empathy_call_window_dispose (GObject *object); @@ -1119,14 +1114,12 @@ empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, { EmpathyCallWindowPriv *priv = GET_PRIV (window); GtkWidget *arrow; - GtkWidget *pane; int w,h, handle_size; w = GTK_WIDGET (window)->allocation.width; h = GTK_WIDGET (window)->allocation.height; - pane = glade_xml_get_widget (priv->glade, "pane"); - gtk_widget_style_get (pane, "handle_size", &handle_size, NULL); + gtk_widget_style_get (priv->pane, "handle_size", &handle_size, NULL); if (gtk_toggle_button_get_active (toggle)) { diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 6d1bbf6e1..8ac599989 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -1,140 +1,93 @@ <?xml version="1.0"?> -<!--Generated with glade3 3.4.5 on Mon Feb 16 12:31:56 2009 --> <interface> - <object class="GtkUIManager" id="uimanager1"> + <requires lib="gtk+" version="2.16"/> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkUIManager" id="uimanager1"/> + <object class="GtkVBox" id="call_window_vbox"> + <property name="visible">True</property> + <property name="orientation">vertical</property> <child> - <object class="GtkActionGroup" id="actiongroup1"> - <child> - <object class="GtkAction" id="menuitem1"> - <property name="name">menuitem1</property> - <property name="label" translatable="yes">_Call</property> - </object> - </child> - <child> - <object class="GtkToggleAction" id="send_video"> - <property name="name">send_video</property> - <property name="label" translatable="yes">Send video</property> - </object> - </child> - <child> - <object class="GtkAction" id="menuhangup"> - <property name="stock_id">gtk-cancel</property> - <property name="name">menuhangup</property> - <property name="label" translatable="yes">Hang up</property> - </object> - </child> - <child> - <object class="GtkAction" id="menuitem3"> - <property name="name">menuitem3</property> - <property name="label" translatable="yes">_View</property> - </object> - </child> + <object class="GtkHPaned" id="pane"> + <property name="visible">True</property> + <property name="can_focus">True</property> <child> - <object class="GtkToggleAction" id="show_preview"> - <property name="name">show_preview</property> - <property name="label" translatable="yes">Video preview</property> - </object> + <placeholder/> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> - <ui> - <menubar name="menubar1"> - <menu action="menuitem1"> - <menuitem action="send_video"/> - <menuitem action="menuhangup"/> - </menu> - <menu action="menuitem3"> - <menuitem action="show_preview"/> - </menu> - </menubar> - </ui> - </object> - <object class="GtkWindow" id="call_window"> <child> - <object class="GtkVBox" id="call_window_vbox"> + <object class="GtkToolbar" id="toolbar"> <property name="visible">True</property> <child> - <object class="GtkMenuBar" constructor="uimanager1" id="menubar1"> + <object class="GtkToolButton" id="hangup"> <property name="visible">True</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Hang up</property> + <property name="stock_id">gtk-cancel</property> </object> <packing> <property name="expand">False</property> + <property name="homogeneous">True</property> </packing> </child> <child> - <object class="GtkToolbar" id="toolbar"> + <object class="GtkSeparatorToolItem" id="toolbutton1"> <property name="visible">True</property> - <child> - <object class="GtkToolButton" id="hangup"> - <property name="visible">True</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Hang up</property> - <property name="stock_id">gtk-cancel</property> - </object> - <packing> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkSeparatorToolItem" id="toolbutton1"> - <property name="visible">True</property> - </object> - <packing> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToggleToolButton" id="microphone"> - <property name="visible">True</property> - <property name="label" translatable="yes">Send Audio</property> - <property name="icon_name">gnome-stock-mic</property> - </object> - <packing> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToggleToolButton" id="camera"> - <property name="visible">True</property> - <property name="label" translatable="yes">Send video</property> - <property name="icon_name">camera-web</property> - </object> - <packing> - <property name="homogeneous">True</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> - <property name="position">1</property> + <property name="homogeneous">True</property> </packing> </child> <child> - <object class="GtkHPaned" id="pane"> + <object class="GtkToggleToolButton" id="microphone"> <property name="visible">True</property> - <property name="can_focus">True</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="label" translatable="yes">Send Audio</property> + <property name="icon_name">gnome-stock-mic</property> </object> <packing> - <property name="position">2</property> + <property name="expand">False</property> + <property name="homogeneous">True</property> </packing> </child> <child> - <object class="GtkStatusbar" id="statusbar"> + <object class="GtkToggleToolButton" id="camera"> <property name="visible">True</property> - <property name="spacing">2</property> + <property name="label" translatable="yes">Send video</property> + <property name="icon_name">camera-web</property> </object> <packing> <property name="expand">False</property> - <property name="position">3</property> + <property name="homogeneous">True</property> </packing> </child> </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkMenuBar" id="menubar1"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkStatusbar" id="statusbar"> + <property name="visible">True</property> + <property name="spacing">2</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">3</property> + </packing> </child> </object> </interface> |