[empathy] camera-monitor: move from Empathy to tp-account-widgets



commit f6d827a6b1006858de979d6627598fa17098ee62
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Mon Jul 29 16:20:24 2013 +0100

    camera-monitor: move from Empathy to tp-account-widgets
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699492

 libempathy-gtk/empathy-avatar-chooser.c            |    6 +-
 libempathy-gtk/empathy-individual-menu.c           |    6 +-
 libempathy-gtk/empathy-log-window.c                |    6 +-
 libempathy-gtk/empathy-new-call-dialog.c           |    6 +-
 libempathy/Makefile.am                             |    3 -
 libempathy/empathy-camera-monitor.h                |   69 -----------
 src/empathy-call-window.c                          |   26 ++--
 src/empathy-camera-menu.c                          |   21 ++--
 tp-account-widgets/Makefile.am                     |    2 +
 .../tpaw-camera-monitor.c                          |  122 ++++++++++----------
 tp-account-widgets/tpaw-camera-monitor.h           |   69 +++++++++++
 11 files changed, 168 insertions(+), 168 deletions(-)
---
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index 4c58a1a..e145d3f 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -24,12 +24,12 @@
 #include "empathy-avatar-chooser.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
 
 #ifdef HAVE_CHEESE
 #include <cheese-avatar-chooser.h>
 #endif /* HAVE_CHEESE */
 
-#include "empathy-camera-monitor.h"
 #include "empathy-gsettings.h"
 #include "empathy-images.h"
 #include "empathy-ui-utils.h"
@@ -1011,7 +1011,7 @@ avatar_chooser_clicked_cb (GtkWidget *button,
   GtkFileFilter *filter;
 #ifdef HAVE_CHEESE
   GtkWidget *picture_button;
-  EmpathyCameraMonitor *monitor;
+  TpawCameraMonitor *monitor;
 #endif
 
   if (self->priv->chooser_dialog != NULL)
@@ -1032,7 +1032,7 @@ avatar_chooser_clicked_cb (GtkWidget *button,
       _("Take a picture..."), EMPATHY_AVATAR_CHOOSER_RESPONSE_WEBCAM);
 
   /* Button is sensitive only if there is one camera connected */
-  monitor = empathy_camera_monitor_dup_singleton ();
+  monitor = tpaw_camera_monitor_dup_singleton ();
 
   g_object_set_data_full (G_OBJECT (picture_button),
       "monitor", monitor, g_object_unref);
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index 51b9548..9d3e91d 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -24,10 +24,10 @@
 #include "empathy-individual-menu.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
 
 #include "empathy-account-selector-dialog.h"
 #include "empathy-call-utils.h"
-#include "empathy-camera-monitor.h"
 #include "empathy-chatroom-manager.h"
 #include "empathy-gtk-enum-types.h"
 #include "empathy-images.h"
@@ -1411,7 +1411,7 @@ empathy_individual_video_call_menu_item_new (FolksIndividual *individual)
 {
   GtkWidget *item;
   GtkWidget *image;
-  EmpathyCameraMonitor *monitor;
+  TpawCameraMonitor *monitor;
 
   g_return_val_if_fail (FOLKS_IS_INDIVIDUAL (individual), NULL);
 
@@ -1428,7 +1428,7 @@ empathy_individual_video_call_menu_item_new (FolksIndividual *individual)
   /* Only follow available cameras if the contact can do Video calls */
   if (gtk_widget_get_sensitive (item))
     {
-      monitor = empathy_camera_monitor_dup_singleton ();
+      monitor = tpaw_camera_monitor_dup_singleton ();
       g_object_set_data_full (G_OBJECT (item),
           "monitor", monitor, g_object_unref);
       g_object_bind_property (monitor, "available", item, "sensitive",
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 9f9dfcb..9094f69 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -28,11 +28,11 @@
 #include <glib/gi18n-lib.h>
 #include <telepathy-glib/proxy-subclass.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
 
 #include "action-chain-internal.h"
 #include "empathy-account-chooser.h"
 #include "empathy-call-utils.h"
-#include "empathy-camera-monitor.h"
 #include "empathy-geometry.h"
 #include "empathy-gsettings.h"
 #include "empathy-images.h"
@@ -90,7 +90,7 @@ struct _EmpathyLogWindowPriv
   EmpathyContact *selected_contact;
   EmpathyContact *events_contact;
 
-  EmpathyCameraMonitor *camera_monitor;
+  TpawCameraMonitor *camera_monitor;
   GBinding *button_video_binding;
 
   /* Used to cancel logger calls when no longer needed */
@@ -617,7 +617,7 @@ empathy_log_window_init (EmpathyLogWindow *self)
 
   self->priv->chain = _tpl_action_chain_new_async (NULL, NULL, NULL);
 
-  self->priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
+  self->priv->camera_monitor = tpaw_camera_monitor_dup_singleton ();
 
   self->priv->log_manager = tpl_log_manager_dup_singleton ();
 
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 7dda2f9..d96d0bb 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -22,9 +22,9 @@
 #include "empathy-new-call-dialog.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
 
 #include "empathy-call-utils.h"
-#include "empathy-camera-monitor.h"
 #include "empathy-contact-chooser.h"
 #include "empathy-images.h"
 #include "empathy-ui-utils.h"
@@ -43,7 +43,7 @@ struct _EmpathyNewCallDialogPriv {
   GtkWidget *button_audio;
   GtkWidget *button_video;
 
-  EmpathyCameraMonitor *monitor;
+  TpawCameraMonitor *monitor;
 };
 
 /* Re-use the accept and ok Gtk response so we are sure they won't be used
@@ -182,7 +182,7 @@ empathy_new_call_dialog_init (EmpathyNewCallDialog *self)
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
       EMPATHY_TYPE_NEW_CALL_DIALOG, EmpathyNewCallDialogPriv);
 
-  self->priv->monitor = empathy_camera_monitor_dup_singleton ();
+  self->priv->monitor = tpaw_camera_monitor_dup_singleton ();
 
   content = gtk_dialog_get_content_area (GTK_DIALOG (self));
 
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index d6b9faa..e7dbd7f 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -13,7 +13,6 @@ AM_CPPFLAGS =                                           \
        $(GEOCODE_CFLAGS)                               \
        $(NETWORK_MANAGER_CFLAGS)                       \
        $(CONNMAN_CFLAGS)                               \
-       $(UDEV_CFLAGS)                                  \
        $(GOA_CFLAGS)                                   \
        $(UOA_CFLAGS)                                   \
        $(WARN_CFLAGS)                                  \
@@ -28,7 +27,6 @@ BUILT_SOURCES =                                       \
 libempathy_headers =                           \
        action-chain-internal.h                 \
        empathy-auth-factory.h                  \
-       empathy-camera-monitor.h                \
        empathy-chatroom-manager.h              \
        empathy-chatroom.h                      \
        empathy-client-factory.h \
@@ -58,7 +56,6 @@ libempathy_handwritten_source =                               \
        $(libempathy_headers)                           \
        action-chain.c                                  \
        empathy-auth-factory.c                          \
-       empathy-camera-monitor.c                        \
        empathy-chatroom-manager.c                      \
        empathy-chatroom.c                              \
        empathy-client-factory.c \
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index ed5de4e..cac15bc 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -26,13 +26,13 @@
 #include <farstream/fs-element-added-notifier.h>
 #include <farstream/fs-utils.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
 
 #include "empathy-about-dialog.h"
 #include "empathy-audio-sink.h"
 #include "empathy-call-utils.h"
 #include "empathy-call-window-fullscreen.h"
 #include "empathy-camera-menu.h"
-#include "empathy-camera-monitor.h"
 #include "empathy-dialpad-widget.h"
 #include "empathy-geometry.h"
 #include "empathy-gsettings.h"
@@ -122,7 +122,7 @@ struct _EmpathyCallWindowPriv
 
   EmpathyContact *contact;
 
-  EmpathyCameraMonitor *camera_monitor;
+  TpawCameraMonitor *camera_monitor;
 
   CallState call_state;
   gboolean outgoing;
@@ -562,17 +562,17 @@ empathy_call_window_swap_camera_cb (GtkAction *action,
 
   DEBUG ("Swapping the camera");
 
-  cameras = empathy_camera_monitor_get_cameras (self->priv->camera_monitor);
+  cameras = tpaw_camera_monitor_get_cameras (self->priv->camera_monitor);
   current_cam = empathy_video_src_dup_device (
       EMPATHY_GST_VIDEO_SRC (self->priv->video_input));
 
   for (l = cameras; l != NULL; l = l->next)
     {
-      EmpathyCamera *camera = l->data;
+      TpawCamera *camera = l->data;
 
       if (!tp_strdiff (camera->device, current_cam))
         {
-          EmpathyCamera *next;
+          TpawCamera *next;
 
           if (l->next != NULL)
             next = l->next->data;
@@ -593,22 +593,22 @@ empathy_call_window_swap_camera_cb (GtkAction *action,
 }
 
 static void
-empathy_call_window_camera_added_cb (EmpathyCameraMonitor *monitor,
-    EmpathyCamera *camera,
+empathy_call_window_camera_added_cb (TpawCameraMonitor *monitor,
+    TpawCamera *camera,
     EmpathyCallWindow *self)
 {
-  const GList *cameras = empathy_camera_monitor_get_cameras (monitor);
+  const GList *cameras = tpaw_camera_monitor_get_cameras (monitor);
 
   gtk_action_set_visible (self->priv->menu_swap_camera,
       g_list_length ((GList *) cameras) >= 2);
 }
 
 static void
-empathy_call_window_camera_removed_cb (EmpathyCameraMonitor *monitor,
-    EmpathyCamera *camera,
+empathy_call_window_camera_removed_cb (TpawCameraMonitor *monitor,
+    TpawCamera *camera,
     EmpathyCallWindow *self)
 {
-  const GList *cameras = empathy_camera_monitor_get_cameras (monitor);
+  const GList *cameras = tpaw_camera_monitor_get_cameras (monitor);
 
   gtk_action_set_visible (self->priv->menu_swap_camera,
       g_list_length ((GList *) cameras) >= 2);
@@ -1681,7 +1681,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
   empathy_set_css_provider (GTK_WIDGET (self));
   gtk_action_set_sensitive (priv->menu_fullscreen, FALSE);
 
-  priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
+  priv->camera_monitor = tpaw_camera_monitor_dup_singleton ();
 
   g_object_bind_property (priv->camera_monitor, "available",
       priv->camera_button, "sensitive",
@@ -3272,7 +3272,7 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
 
   can_send_video = priv->video_input != NULL &&
     empathy_contact_can_voip_video (priv->contact) &&
-    empathy_camera_monitor_get_available (priv->camera_monitor);
+    tpaw_camera_monitor_get_available (priv->camera_monitor);
 
   g_object_get (priv->handler, "call-channel", &call, NULL);
 
diff --git a/src/empathy-camera-menu.c b/src/empathy-camera-menu.c
index 8dc037b..cf18340 100644
--- a/src/empathy-camera-menu.c
+++ b/src/empathy-camera-menu.c
@@ -22,7 +22,8 @@
 #include "config.h"
 #include "empathy-camera-menu.h"
 
-#include "empathy-camera-monitor.h"
+#include <tp-account-widgets/tpaw-camera-monitor.h>
+
 #include "empathy-gsettings.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_VOIP
@@ -51,7 +52,7 @@ struct _EmpathyCameraMenuPrivate
   /* Queue of GtkRadioActions. */
   GQueue *cameras;
 
-  EmpathyCameraMonitor *camera_monitor;
+  TpawCameraMonitor *camera_monitor;
 
   GSettings *settings;
 };
@@ -200,7 +201,7 @@ empathy_camera_menu_update (EmpathyCameraMenu *self)
 
 static void
 empathy_camera_menu_add_camera (EmpathyCameraMenu *self,
-    EmpathyCamera *camera)
+    TpawCamera *camera)
 {
   GtkRadioAction *action;
   GSList *group;
@@ -219,8 +220,8 @@ empathy_camera_menu_add_camera (EmpathyCameraMenu *self,
 }
 
 static void
-empathy_camera_menu_camera_added_cb (EmpathyCameraMonitor *monitor,
-    EmpathyCamera *camera,
+empathy_camera_menu_camera_added_cb (TpawCameraMonitor *monitor,
+    TpawCamera *camera,
     EmpathyCameraMenu *self)
 {
   empathy_camera_menu_add_camera (self, camera);
@@ -228,8 +229,8 @@ empathy_camera_menu_camera_added_cb (EmpathyCameraMonitor *monitor,
 }
 
 static void
-empathy_camera_menu_camera_removed_cb (EmpathyCameraMonitor *monitor,
-    EmpathyCamera *camera,
+empathy_camera_menu_camera_removed_cb (TpawCameraMonitor *monitor,
+    TpawCamera *camera,
     EmpathyCameraMenu *self)
 {
   GList *l;
@@ -303,11 +304,11 @@ empathy_camera_menu_get_cameras (EmpathyCameraMenu *self)
 {
   const GList *cameras;
 
-  cameras = empathy_camera_monitor_get_cameras (self->priv->camera_monitor);
+  cameras = tpaw_camera_monitor_get_cameras (self->priv->camera_monitor);
 
   for (; cameras != NULL; cameras = g_list_next (cameras))
     {
-      EmpathyCamera *camera = cameras->data;
+      TpawCamera *camera = cameras->data;
 
       empathy_camera_menu_add_camera (self, camera);
     }
@@ -346,7 +347,7 @@ empathy_camera_menu_constructed (GObject *obj)
       self->priv->anchor_action);
   g_object_unref (self->priv->anchor_action);
 
-  self->priv->camera_monitor = empathy_camera_monitor_new ();
+  self->priv->camera_monitor = tpaw_camera_monitor_new ();
 
   tp_g_signal_connect_object (self->priv->camera_monitor, "added",
       G_CALLBACK (empathy_camera_menu_camera_added_cb), self, 0);
diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am
index 7bbe9f1..26e8034 100644
--- a/tp-account-widgets/Makefile.am
+++ b/tp-account-widgets/Makefile.am
@@ -28,6 +28,7 @@ libtp_account_widgets_sources =               \
        tpaw-account-widget-sip.c               \
        tpaw-builder.c                          \
        tpaw-calendar-button.c                  \
+       tpaw-camera-monitor.c                   \
        tpaw-connection-managers.c              \
        tpaw-contactinfo-utils.c                \
        tpaw-keyring.c                          \
@@ -51,6 +52,7 @@ libtp_account_widgets_headers =                       \
        tpaw-account-widget-sip.h               \
        tpaw-builder.h                          \
        tpaw-calendar-button.h                  \
+       tpaw-camera-monitor.h                   \
        tpaw-connection-managers.h              \
        tpaw-contactinfo-utils.h                \
        tpaw-keyring.h                          \
diff --git a/libempathy/empathy-camera-monitor.c b/tp-account-widgets/tpaw-camera-monitor.c
similarity index 57%
rename from libempathy/empathy-camera-monitor.c
rename to tp-account-widgets/tpaw-camera-monitor.c
index cbbd81d..fac91d0 100644
--- a/libempathy/empathy-camera-monitor.c
+++ b/tp-account-widgets/tpaw-camera-monitor.c
@@ -19,16 +19,16 @@
  */
 
 #include "config.h"
-#include "empathy-camera-monitor.h"
+#include "tpaw-camera-monitor.h"
 
 #include <tp-account-widgets/cheese-camera-device-monitor.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include "empathy-debug.h"
 
-struct _EmpathyCameraMonitorPrivate
+struct _TpawCameraMonitorPrivate
 {
-  TpawCameraDeviceMonitor *empathy_monitor;
+  TpawCameraDeviceMonitor *tpaw_monitor;
   GQueue *cameras;
   gint num_cameras;
 };
@@ -48,16 +48,16 @@ enum
 
 static guint signals[LAST_SIGNAL];
 
-G_DEFINE_TYPE (EmpathyCameraMonitor, empathy_camera_monitor, G_TYPE_OBJECT);
+G_DEFINE_TYPE (TpawCameraMonitor, tpaw_camera_monitor, G_TYPE_OBJECT);
 
-static EmpathyCameraMonitor *manager_singleton = NULL;
+static TpawCameraMonitor *manager_singleton = NULL;
 
-static EmpathyCamera *
-empathy_camera_new (const gchar *id,
+static TpawCamera *
+tpaw_camera_new (const gchar *id,
     const gchar *device,
     const gchar *name)
 {
-  EmpathyCamera *camera = g_slice_new (EmpathyCamera);
+  TpawCamera *camera = g_slice_new (TpawCamera);
 
   camera->id = g_strdup (id);
   camera->device = g_strdup (device);
@@ -66,40 +66,40 @@ empathy_camera_new (const gchar *id,
   return camera;
 }
 
-static EmpathyCamera *
-empathy_camera_copy (EmpathyCamera *camera)
+static TpawCamera *
+tpaw_camera_copy (TpawCamera *camera)
 {
-  return empathy_camera_new (camera->id, camera->device, camera->name);
+  return tpaw_camera_new (camera->id, camera->device, camera->name);
 }
 
 static void
-empathy_camera_free (EmpathyCamera *camera)
+tpaw_camera_free (TpawCamera *camera)
 {
   g_free (camera->id);
   g_free (camera->device);
   g_free (camera->name);
 
-  g_slice_free (EmpathyCamera, camera);
+  g_slice_free (TpawCamera, camera);
 }
 
-G_DEFINE_BOXED_TYPE (EmpathyCamera, empathy_camera,
-    empathy_camera_copy, empathy_camera_free)
+G_DEFINE_BOXED_TYPE (TpawCamera, tpaw_camera,
+    tpaw_camera_copy, tpaw_camera_free)
 
 static gint
-empathy_camera_find (gconstpointer a,
+tpaw_camera_find (gconstpointer a,
     gconstpointer b)
 {
-  const EmpathyCamera *camera = a;
+  const TpawCamera *camera = a;
   const gchar *id = b;
 
   return g_strcmp0 (camera->id, id);
 }
 
 static void
-empathy_camera_monitor_free_camera_foreach (gpointer data,
+tpaw_camera_monitor_free_camera_foreach (gpointer data,
     gpointer user_data)
 {
-  empathy_camera_free (data);
+  tpaw_camera_free (data);
 }
 
 static void
@@ -108,14 +108,14 @@ on_camera_added (TpawCameraDeviceMonitor *device,
     gchar *filename,
     gchar *product_name,
     gint api_version,
-    EmpathyCameraMonitor *self)
+    TpawCameraMonitor *self)
 {
-  EmpathyCamera *camera;
+  TpawCamera *camera;
 
   if (self->priv->cameras == NULL)
     return;
 
-  camera = empathy_camera_new (id, filename, product_name);
+  camera = tpaw_camera_new (id, filename, product_name);
 
   g_queue_push_tail (self->priv->cameras, camera);
 
@@ -130,15 +130,15 @@ on_camera_added (TpawCameraDeviceMonitor *device,
 static void
 on_camera_removed (TpawCameraDeviceMonitor *device,
     gchar *id,
-    EmpathyCameraMonitor *self)
+    TpawCameraMonitor *self)
 {
-  EmpathyCamera *camera;
+  TpawCamera *camera;
   GList *l;
 
   if (self->priv->cameras == NULL)
     return;
 
-  l = g_queue_find_custom (self->priv->cameras, id, empathy_camera_find);
+  l = g_queue_find_custom (self->priv->cameras, id, tpaw_camera_find);
 
   g_return_if_fail (l != NULL);
 
@@ -153,11 +153,11 @@ on_camera_removed (TpawCameraDeviceMonitor *device,
 
   g_signal_emit (self, signals[CAMERA_REMOVED], 0, camera);
 
-  empathy_camera_free (camera);
+  tpaw_camera_free (camera);
 }
 
 const GList *
-empathy_camera_monitor_get_cameras (EmpathyCameraMonitor *self)
+tpaw_camera_monitor_get_cameras (TpawCameraMonitor *self)
 {
   if (self->priv->cameras != NULL)
     return self->priv->cameras->head;
@@ -166,12 +166,12 @@ empathy_camera_monitor_get_cameras (EmpathyCameraMonitor *self)
 }
 
 static void
-empathy_camera_monitor_get_property (GObject *object,
+tpaw_camera_monitor_get_property (GObject *object,
     guint prop_id,
     GValue *value,
     GParamSpec *pspec)
 {
-  EmpathyCameraMonitor *self = (EmpathyCameraMonitor *) object;
+  TpawCameraMonitor *self = (TpawCameraMonitor *) object;
 
   switch (prop_id)
     {
@@ -185,37 +185,37 @@ empathy_camera_monitor_get_property (GObject *object,
 }
 
 static void
-empathy_camera_monitor_dispose (GObject *object)
+tpaw_camera_monitor_dispose (GObject *object)
 {
-  EmpathyCameraMonitor *self = EMPATHY_CAMERA_MONITOR (object);
+  TpawCameraMonitor *self = TPAW_CAMERA_MONITOR (object);
 
-  tp_clear_object (&self->priv->empathy_monitor);
+  tp_clear_object (&self->priv->tpaw_monitor);
 
   g_queue_foreach (self->priv->cameras,
-      empathy_camera_monitor_free_camera_foreach, NULL);
+      tpaw_camera_monitor_free_camera_foreach, NULL);
   tp_clear_pointer (&self->priv->cameras, g_queue_free);
 
-  G_OBJECT_CLASS (empathy_camera_monitor_parent_class)->dispose (object);
+  G_OBJECT_CLASS (tpaw_camera_monitor_parent_class)->dispose (object);
 }
 
 static void
-empathy_camera_monitor_constructed (GObject *object)
+tpaw_camera_monitor_constructed (GObject *object)
 {
-  EmpathyCameraMonitor *self = (EmpathyCameraMonitor *) object;
+  TpawCameraMonitor *self = (TpawCameraMonitor *) object;
 
-  G_OBJECT_CLASS (empathy_camera_monitor_parent_class)->constructed (object);
+  G_OBJECT_CLASS (tpaw_camera_monitor_parent_class)->constructed (object);
 
-  tpaw_camera_device_monitor_coldplug (self->priv->empathy_monitor);
+  tpaw_camera_device_monitor_coldplug (self->priv->tpaw_monitor);
 }
 
 static void
-empathy_camera_monitor_class_init (EmpathyCameraMonitorClass *klass)
+tpaw_camera_monitor_class_init (TpawCameraMonitorClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->dispose = empathy_camera_monitor_dispose;
-  object_class->constructed = empathy_camera_monitor_constructed;
-  object_class->get_property = empathy_camera_monitor_get_property;
+  object_class->dispose = tpaw_camera_monitor_dispose;
+  object_class->constructed = tpaw_camera_monitor_constructed;
+  object_class->get_property = tpaw_camera_monitor_get_property;
 
   g_object_class_install_property (object_class, PROP_AVAILABLE,
       g_param_spec_boolean ("available", "Available",
@@ -226,32 +226,32 @@ empathy_camera_monitor_class_init (EmpathyCameraMonitorClass *klass)
           G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
           0, NULL, NULL,
           g_cclosure_marshal_generic,
-          G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA);
+          G_TYPE_NONE, 1, TPAW_TYPE_CAMERA);
 
   signals[CAMERA_REMOVED] =
       g_signal_new ("removed", G_OBJECT_CLASS_TYPE (klass),
           G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
           0, NULL, NULL,
           g_cclosure_marshal_generic,
-          G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA);
+          G_TYPE_NONE, 1, TPAW_TYPE_CAMERA);
 
   g_type_class_add_private (object_class,
-      sizeof (EmpathyCameraMonitorPrivate));
+      sizeof (TpawCameraMonitorPrivate));
 }
 
 static void
-empathy_camera_monitor_init (EmpathyCameraMonitor *self)
+tpaw_camera_monitor_init (TpawCameraMonitor *self)
 {
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EMPATHY_TYPE_CAMERA_MONITOR, EmpathyCameraMonitorPrivate);
+      TPAW_TYPE_CAMERA_MONITOR, TpawCameraMonitorPrivate);
 
   self->priv->cameras = g_queue_new ();
 
-  self->priv->empathy_monitor = tpaw_camera_device_monitor_new ();
+  self->priv->tpaw_monitor = tpaw_camera_device_monitor_new ();
 
-  g_signal_connect (self->priv->empathy_monitor, "added",
+  g_signal_connect (self->priv->tpaw_monitor, "added",
       G_CALLBACK (on_camera_added), self);
-  g_signal_connect (self->priv->empathy_monitor, "removed",
+  g_signal_connect (self->priv->tpaw_monitor, "removed",
       G_CALLBACK (on_camera_removed), self);
 
 #ifndef HAVE_UDEV
@@ -260,8 +260,8 @@ empathy_camera_monitor_init (EmpathyCameraMonitor *self)
 #endif
 }
 
-EmpathyCameraMonitor *
-empathy_camera_monitor_dup_singleton (void)
+TpawCameraMonitor *
+tpaw_camera_monitor_dup_singleton (void)
 {
   GObject *retval;
 
@@ -271,25 +271,25 @@ empathy_camera_monitor_dup_singleton (void)
     }
   else
     {
-      retval = g_object_new (EMPATHY_TYPE_CAMERA_MONITOR, NULL);
+      retval = g_object_new (TPAW_TYPE_CAMERA_MONITOR, NULL);
 
-      manager_singleton = EMPATHY_CAMERA_MONITOR (retval);
+      manager_singleton = TPAW_CAMERA_MONITOR (retval);
       g_object_add_weak_pointer (retval, (gpointer) &manager_singleton);
     }
 
-  return EMPATHY_CAMERA_MONITOR (retval);
+  return TPAW_CAMERA_MONITOR (retval);
 }
 
-EmpathyCameraMonitor *
-empathy_camera_monitor_new (void)
+TpawCameraMonitor *
+tpaw_camera_monitor_new (void)
 {
-  return EMPATHY_CAMERA_MONITOR (
-      g_object_new (EMPATHY_TYPE_CAMERA_MONITOR, NULL));
+  return TPAW_CAMERA_MONITOR (
+      g_object_new (TPAW_TYPE_CAMERA_MONITOR, NULL));
 }
 
-gboolean empathy_camera_monitor_get_available (EmpathyCameraMonitor *self)
+gboolean tpaw_camera_monitor_get_available (TpawCameraMonitor *self)
 {
-  g_return_val_if_fail (EMPATHY_IS_CAMERA_MONITOR (self), FALSE);
+  g_return_val_if_fail (TPAW_IS_CAMERA_MONITOR (self), FALSE);
 
   return self->priv->num_cameras > 0;
 }
diff --git a/tp-account-widgets/tpaw-camera-monitor.h b/tp-account-widgets/tpaw-camera-monitor.h
new file mode 100644
index 0000000..773e19c
--- /dev/null
+++ b/tp-account-widgets/tpaw-camera-monitor.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
+ */
+
+#ifndef __TPAW_CAMERA_MONITOR_H__
+#define __TPAW_CAMERA_MONITOR_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+#define TPAW_TYPE_CAMERA_MONITOR         (tpaw_camera_monitor_get_type ())
+#define TPAW_CAMERA_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_CAMERA_MONITOR, 
TpawCameraMonitor))
+#define TPAW_CAMERA_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), TPAW_TYPE_CAMERA_MONITOR, 
TpawCameraMonitorClass))
+#define TPAW_IS_CAMERA_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_CAMERA_MONITOR))
+#define TPAW_IS_CAMERA_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_CAMERA_MONITOR))
+#define TPAW_CAMERA_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_CAMERA_MONITOR, 
TpawCameraMonitorClass))
+
+typedef struct _TpawCameraMonitor TpawCameraMonitor;
+typedef struct _TpawCameraMonitorClass TpawCameraMonitorClass;
+typedef struct _TpawCameraMonitorPrivate TpawCameraMonitorPrivate;
+
+struct _TpawCameraMonitor
+{
+  GObject parent;
+  TpawCameraMonitorPrivate *priv;
+};
+
+struct _TpawCameraMonitorClass
+{
+  GObjectClass parent_class;
+};
+
+typedef struct
+{
+  gchar *id;
+  gchar *device;
+  gchar *name;
+} TpawCamera;
+
+#define TPAW_TYPE_CAMERA (tpaw_camera_get_type ())
+GType tpaw_camera_get_type (void) G_GNUC_CONST;
+
+GType tpaw_camera_monitor_get_type (void) G_GNUC_CONST;
+
+TpawCameraMonitor *tpaw_camera_monitor_dup_singleton (void);
+TpawCameraMonitor *tpaw_camera_monitor_new (void);
+
+gboolean tpaw_camera_monitor_get_available (TpawCameraMonitor *self);
+
+const GList * tpaw_camera_monitor_get_cameras (TpawCameraMonitor *self);
+
+G_END_DECLS
+#endif /* __TPAW_CAMERA_MONITOR_H__ */


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