* Thanks guys!
*/
-#include <config.h>
-
-#include <gtk/gtk.h>
-
-#include <libempathy/empathy-camera-monitor.h>
-#include <libempathy/empathy-gsettings.h>
-
+#include "config.h"
#include "empathy-camera-menu.h"
+#include "empathy-camera-monitor.h"
+#include "empathy-gsettings.h"
+
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
struct _EmpathyCameraMenuPrivate
{
{
EmpathyGstVideoSrc *video;
const gchar *device;
+ gchar *current_device = NULL;
if (self->priv->in_update)
return;
video = empathy_call_window_get_video_src (self->priv->window);
+ if (video != NULL)
+ current_device = empathy_video_src_dup_device (video);
device = gtk_action_get_name (action);
- empathy_video_src_change_device (video, device);
+ /* Don't change the device if it's the currently used one */
+ if (!tp_strdiff (device, current_device))
+ goto out;
+
+ empathy_call_window_change_webcam (self->priv->window, device);
+
+ out:
+ g_free (current_device);
}
static void
empathy_camera_menu_update (EmpathyCameraMenu *self)
{
GList *l;
+ GtkAction *menu;
GtkUIManager *ui_manager;
EmpathyGstVideoSrc *video;
- gchar *current_camera;
+ gboolean show_menu;
+ gchar *current_camera = NULL;
+ guint n_cameras;
ui_manager = empathy_call_window_get_ui_manager (self->priv->window);
+ menu = gtk_ui_manager_get_action (ui_manager, "/menubar1/edit/menucamera");
+ n_cameras = g_queue_get_length (self->priv->cameras);
+ show_menu = (n_cameras > 1);
+ gtk_action_set_visible (menu, show_menu);
+
video = empathy_call_window_get_video_src (self->priv->window);
- current_camera = empathy_video_src_dup_device (video);
+ if (video != NULL)
+ current_camera = empathy_video_src_dup_device (video);
empathy_camera_menu_clean (self);
self->priv->ui_id = gtk_ui_manager_new_merge_id (ui_manager);
"window", window,
NULL);
}
+
+void
+empathy_camera_menu_set_sensitive (EmpathyCameraMenu *self,
+ gboolean sensitive)
+{
+ GtkUIManager *ui_manager;
+
+ gtk_action_group_set_sensitive (self->priv->action_group, sensitive);
+ if (sensitive) /* Mark the active camera as such. */
+ empathy_camera_menu_update (self);
+
+ ui_manager = empathy_call_window_get_ui_manager (self->priv->window);
+ gtk_ui_manager_ensure_update (ui_manager);
+}