aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-04-16 20:29:18 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-16 20:29:18 +0800
commit5ce1acbadc748af008d42aa4df98e6b3597b3369 (patch)
tree9e5199c4d4952a3f0f1e1a19055537b383b56af7
parent65cb048dc6b8d1c34cae75641b09cac104f7e374 (diff)
downloadgsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar.gz
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar.bz2
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar.lz
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar.xz
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.tar.zst
gsoc2013-empathy-5ce1acbadc748af008d42aa4df98e6b3597b3369.zip
Make use of GtkUIManager in EmpathyCallWindow
From: Xavier Claessens <xclaesse@gmail.com> svn path=/trunk/; revision=2867
-rw-r--r--src/empathy-call-window.c96
-rw-r--r--src/empathy-call-window.ui157
2 files changed, 161 insertions, 92 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 48b6b6647..d7d79df90 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -69,6 +69,7 @@ struct _EmpathyCallWindowPriv
gboolean connected;
+ GtkUIManager *ui_manager;
GtkWidget *video_output;
GtkWidget *video_preview;
GtkWidget *sidebar;
@@ -78,8 +79,8 @@ struct _EmpathyCallWindowPriv
GtkWidget *mic_button;
GtkWidget *camera_button;
GtkWidget *toolbar;
- GtkWidget *hangup;
GtkWidget *pane;
+ GtkAction *send_video;
gdouble volume;
GtkAdjustment *audio_input_adj;
@@ -124,13 +125,20 @@ static void empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle,
static void empathy_call_window_camera_toggled_cb (GtkToggleToolButton *toggle,
EmpathyCallWindow *window);
+static void empathy_call_window_send_video_toggled_cb (GtkToggleAction *toggle,
+ EmpathyCallWindow *window);
+
+static void empathy_call_window_show_preview_toggled_cb (GtkToggleAction *toggle,
+ EmpathyCallWindow *window);
+
static void empathy_call_window_mic_toggled_cb (
GtkToggleToolButton *toggle, EmpathyCallWindow *window);
static void empathy_call_window_sidebar_hidden_cb (EmpathySidebar *sidebar,
EmpathyCallWindow *window);
-static void empathy_call_window_hangup (EmpathyCallWindow *window);
+static void empathy_call_window_hangup_cb (gpointer object,
+ EmpathyCallWindow *window);
static void empathy_call_window_status_message (EmpathyCallWindow *window,
gchar *message);
@@ -143,29 +151,11 @@ empathy_call_window_volume_changed_cb (GtkScaleButton *button,
gdouble value, EmpathyCallWindow *window);
static void
-empathy_call_window_setup_menubar (EmpathyCallWindow *self)
-{
- EmpathyCallWindowPriv *priv = GET_PRIV (self);
-
- g_signal_connect_swapped (priv->hangup, "activate",
- G_CALLBACK (empathy_call_window_hangup), self);
-}
-
-static void
empathy_call_window_setup_toolbar (EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
GtkToolItem *tool_item;
- g_signal_connect_swapped (priv->hangup, "clicked",
- G_CALLBACK (empathy_call_window_hangup), self);
-
- gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (priv->mic_button),
- TRUE);
-
- g_signal_connect (G_OBJECT (priv->mic_button), "toggled",
- G_CALLBACK (empathy_call_window_mic_toggled_cb), self);
-
/* Add an empty expanded GtkToolItem so the volume button is at the end of
* the toolbar. */
tool_item = gtk_tool_item_new ();
@@ -185,13 +175,6 @@ empathy_call_window_setup_toolbar (EmpathyCallWindow *self)
gtk_container_add (GTK_CONTAINER (tool_item), priv->volume_button);
gtk_widget_show_all (GTK_WIDGET (tool_item));
gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, -1);
-
- 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 (priv->camera_button, "toggled",
- G_CALLBACK (empathy_call_window_camera_toggled_cb), self);
}
static void
@@ -489,14 +472,23 @@ empathy_call_window_init (EmpathyCallWindow *self)
"microphone", &priv->mic_button,
"camera", &priv->camera_button,
"toolbar", &priv->toolbar,
- "hangup", &priv->hangup,
+ "send_video", &priv->send_video,
+ "ui_manager", &priv->ui_manager,
+ NULL);
+
+ empathy_builder_connect (gui, self,
+ "menuhangup", "activate", empathy_call_window_hangup_cb,
+ "hangup", "clicked", empathy_call_window_hangup_cb,
+ "microphone", "toggled", empathy_call_window_mic_toggled_cb,
+ "camera", "toggled", empathy_call_window_camera_toggled_cb,
+ "send_video", "toggled", empathy_call_window_send_video_toggled_cb,
+ "show_preview", "toggled", empathy_call_window_show_preview_toggled_cb,
NULL);
priv->lock = g_mutex_new ();
gtk_container_add (GTK_CONTAINER (self), top_vbox);
- empathy_call_window_setup_menubar (self);
empathy_call_window_setup_toolbar (self);
priv->pipeline = gst_pipeline_new (NULL);
@@ -582,6 +574,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
priv->timer = g_timer_new ();
+ g_object_ref (priv->ui_manager);
g_object_unref (gui);
}
@@ -685,6 +678,10 @@ empathy_call_window_dispose (GObject *object)
g_source_remove (priv->timer_id);
priv->timer_id = 0;
+ if (priv->ui_manager != NULL)
+ g_object_unref (priv->ui_manager);
+ priv->ui_manager = NULL;
+
/* release any references held by the object here */
if (G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose)
G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object);
@@ -759,6 +756,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self)
empathy_call_window_status_message (self, _("Disconnected"));
gtk_widget_set_sensitive (priv->camera_button, FALSE);
+ gtk_action_set_sensitive (priv->send_video, FALSE);
}
@@ -857,7 +855,10 @@ empathy_call_window_connected (gpointer user_data)
gtk_widget_set_sensitive (priv->dtmf_panel, TRUE);
if (priv->video_input != NULL)
- gtk_widget_set_sensitive (priv->camera_button, TRUE);
+ {
+ gtk_widget_set_sensitive (priv->camera_button, TRUE);
+ gtk_action_set_sensitive (priv->send_video, TRUE);
+ }
g_object_unref (call);
@@ -1141,20 +1142,42 @@ empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle,
}
static void
+empathy_call_window_set_send_video (EmpathyCallWindow *window,
+ gboolean send)
+{
+ EmpathyCallWindowPriv *priv = GET_PRIV (window);
+ EmpathyTpCall *call;
+
+ g_object_get (priv->handler, "tp-call", &call, NULL);
+ empathy_tp_call_request_video_stream_direction (call, send);
+ g_object_unref (call);
+}
+
+static void
empathy_call_window_camera_toggled_cb (GtkToggleToolButton *toggle,
EmpathyCallWindow *window)
{
- EmpathyCallWindowPriv *priv = GET_PRIV (window);
gboolean active;
- EmpathyTpCall *call;
active = (gtk_toggle_tool_button_get_active (toggle));
+ empathy_call_window_set_send_video (window, active);
+}
- g_object_get (priv->handler, "tp-call", &call, NULL);
+static void
+empathy_call_window_send_video_toggled_cb (GtkToggleAction *toggle,
+ EmpathyCallWindow *window)
+{
+ gboolean active;
- empathy_tp_call_request_video_stream_direction (call, active);
+ active = (gtk_toggle_action_get_active (toggle));
+ empathy_call_window_set_send_video (window, active);
+}
- g_object_unref (call);
+static void
+empathy_call_window_show_preview_toggled_cb (GtkToggleAction *toggle,
+ EmpathyCallWindow *window)
+{
+ /* FIXME: Not implemented */
}
static void
@@ -1196,7 +1219,8 @@ empathy_call_window_sidebar_hidden_cb (EmpathySidebar *sidebar,
}
static void
-empathy_call_window_hangup (EmpathyCallWindow *window)
+empathy_call_window_hangup_cb (gpointer object,
+ EmpathyCallWindow *window)
{
EmpathyCallWindowPriv *priv = GET_PRIV (window);
diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui
index 8ac599989..00b8ffa88 100644
--- a/src/empathy-call-window.ui
+++ b/src/empathy-call-window.ui
@@ -1,93 +1,138 @@
<?xml version="1.0"?>
+<!--Generated with glade3 3.4.5 on Mon Feb 16 12:31:56 2009 -->
<interface>
- <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>
+ <object class="GtkUIManager" id="ui_manager">
<child>
- <object class="GtkHPaned" id="pane">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <object class="GtkActionGroup" id="actiongroup1">
<child>
- <placeholder/>
+ <object class="GtkAction" id="call">
+ <property name="name">call</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="view">
+ <property name="name">view</property>
+ <property name="label" translatable="yes">_View</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleAction" id="show_preview">
+ <property name="name">show_preview</property>
+ <property name="label" translatable="yes">Video preview</property>
+ </object>
</child>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkToolbar" id="toolbar">
+ <ui>
+ <menubar name="menubar1">
+ <menu action="call">
+ <menuitem action="send_video"/>
+ <menuitem action="menuhangup"/>
+ </menu>
+ <menu action="view">
+ <menuitem action="show_preview"/>
+ </menu>
+ </menubar>
+ </ui>
+ </object>
+ <object class="GtkVBox" id="call_window_vbox">
<property name="visible">True</property>
<child>
- <object class="GtkToolButton" id="hangup">
+ <object class="GtkMenuBar" constructor="ui_manager" id="menubar1">
<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="GtkSeparatorToolItem" id="toolbutton1">
+ <object class="GtkToolbar" id="toolbar">
<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="active">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>
+ <property name="sensitive">False</property>
+ </object>
+ <packing>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="microphone">
+ <object class="GtkHPaned" id="pane">
<property name="visible">True</property>
- <property name="label" translatable="yes">Send Audio</property>
- <property name="icon_name">gnome-stock-mic</property>
+ <property name="can_focus">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="camera">
+ <object class="GtkStatusbar" id="statusbar">
<property name="visible">True</property>
- <property name="label" translatable="yes">Send video</property>
- <property name="icon_name">camera-web</property>
+ <property name="spacing">2</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="position">3</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>