aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-sound-manager.c34
-rw-r--r--libempathy-gtk/empathy-sound-manager.h26
2 files changed, 60 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-sound-manager.c b/libempathy-gtk/empathy-sound-manager.c
index 459016db1..8d51f7391 100644
--- a/libempathy-gtk/empathy-sound-manager.c
+++ b/libempathy-gtk/empathy-sound-manager.c
@@ -68,6 +68,40 @@ static EmpathySoundEntry sound_entries[LAST_EMPATHY_SOUND] = {
N_("Voice call ended"), NULL },
};
+G_DEFINE_TYPE (EmpathySoundManager, empathy_sound_manager, G_TYPE_OBJECT)
+
+struct _EmpathySoundManagerPrivate
+{
+ gpointer unused;
+};
+
+static void
+empathy_sound_manager_class_init (EmpathySoundManagerClass *cls)
+{
+ g_type_class_add_private (cls, sizeof (EmpathySoundManagerPrivate));
+}
+
+static void
+empathy_sound_manager_init (EmpathySoundManager *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_SOUND_MANAGER, EmpathySoundManagerPrivate);
+}
+
+EmpathySoundManager *
+empathy_sound_manager_dup_singleton (void)
+{
+ static EmpathySoundManager *manager = NULL;
+
+ if (manager != NULL)
+ return g_object_ref (manager);
+
+ manager = g_object_new (EMPATHY_TYPE_SOUND_MANAGER, NULL);
+
+ g_object_add_weak_pointer (G_OBJECT (manager), (gpointer *) &manager);
+ return manager;
+}
+
/* An hash table containing currently repeating sounds. The format is the
* following:
* Key: An EmpathySound
diff --git a/libempathy-gtk/empathy-sound-manager.h b/libempathy-gtk/empathy-sound-manager.h
index 95160b342..ca112e2d9 100644
--- a/libempathy-gtk/empathy-sound-manager.h
+++ b/libempathy-gtk/empathy-sound-manager.h
@@ -42,6 +42,32 @@ typedef enum {
LAST_EMPATHY_SOUND,
} EmpathySound;
+#define EMPATHY_TYPE_SOUND_MANAGER (empathy_sound_manager_get_type ())
+#define EMPATHY_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_SOUND_MANAGER, EmpathySoundManager))
+#define EMPATHY_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_SOUND_MANAGER, EmpathySoundManagerClass))
+#define EMPATHY_IS_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_SOUND_MANAGER))
+#define EMPATHY_IS_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_SOUND_MANAGER))
+#define EMPATHY_SOUND_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_SOUND_MANAGER, EmpathySoundManagerClass))
+
+typedef struct _EmpathySoundManager EmpathySoundManager;
+typedef struct _EmpathySoundManagerClass EmpathySoundManagerClass;
+typedef struct _EmpathySoundManagerPrivate EmpathySoundManagerPrivate;
+
+struct _EmpathySoundManager
+{
+ GObject parent;
+ EmpathySoundManagerPrivate *priv;
+};
+
+struct _EmpathySoundManagerClass
+{
+ GObjectClass parent_class;
+};
+
+GType empathy_sound_manager_get_type (void) G_GNUC_CONST;
+
+EmpathySoundManager * empathy_sound_manager_dup_singleton (void);
+
gboolean empathy_sound_play (GtkWidget *widget, EmpathySound sound_id);
void empathy_sound_stop (EmpathySound sound_id);