ekiga r6874 - in trunk: . lib/engine/gui/gtk-frontend src/gui
- From: jschamp svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6874 - in trunk: . lib/engine/gui/gtk-frontend src/gui
- Date: Mon, 8 Sep 2008 15:47:16 +0000 (UTC)
Author: jschamp
Date: Mon Sep 8 15:47:16 2008
New Revision: 6874
URL: http://svn.gnome.org/viewvc/ekiga?rev=6874&view=rev
Log:
Introduce "unread-alert" signal in chat-window, use the signal to generate a sound event
Modified:
trunk/ChangeLog
trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
trunk/lib/engine/gui/gtk-frontend/chat-window.h
trunk/src/gui/main.cpp
Modified: trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window.cpp Mon Sep 8 15:47:16 2008
@@ -56,6 +56,7 @@
enum {
UNREAD_COUNT,
+ UNREAD_ALERT,
LAST_SIGNAL
};
@@ -256,6 +257,8 @@
txt = g_strdup_printf ("[%d] %s", unread_count, base_title);
gtk_label_set_text (GTK_LABEL (label), txt);
g_free (txt);
+
+ g_signal_emit (self, signals[UNREAD_ALERT], 0, NULL);
}
update_unread (self);
@@ -408,6 +411,15 @@
G_TYPE_NONE, 1,
G_TYPE_UINT);
+ signals[UNREAD_ALERT] =
+ g_signal_new ("unread-alert",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ChatWindowClass, unread_alert),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
/* FIXME: is it useful? */
chat_window_class = (ChatWindowClass*)g_class;
chat_window_class->unread_count = NULL;
Modified: trunk/lib/engine/gui/gtk-frontend/chat-window.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window.h (original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window.h Mon Sep 8 15:47:16 2008
@@ -62,6 +62,9 @@
/* this is the "unread-count" signal */
void (*unread_count) (ChatWindow* self,
guint unread_count);
+
+ /* this is the "unread-alert" signal */
+ void (*unread_alert) (ChatWindow* self);
};
#define CHAT_WINDOW_TYPE (chat_window_get_type ())
Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp (original)
+++ trunk/src/gui/main.cpp Mon Sep 8 15:47:16 2008
@@ -310,6 +310,13 @@
Ekiga::Presentity* presentity,
gpointer data);
+/* DESCRIPTION : This callback is called when the chat window alerts about
+ * unread messages
+ * BEHAVIOR : Plays a sound (if enabled)
+ * PRE : /
+ */
+static void on_chat_unread_alert (GtkWidget*,
+ gpointer);
/* DESCRIPTION : This callback is called when the control panel
* section key changes.
@@ -2523,6 +2530,23 @@
}
+static void
+on_chat_unread_alert (G_GNUC_UNUSED GtkWidget* widget,
+ G_GNUC_UNUSED gpointer data)
+{
+ if (!gm_conf_get_bool (SOUND_EVENTS_KEY "enable_new_message_sound"))
+ return;
+
+ Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
+ Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+
+ std::string file_name_string = gm_conf_get_string (SOUND_EVENTS_KEY "new_message_sound");
+
+ if (!file_name_string.empty ())
+ audiooutput_core->play_file(file_name_string);
+}
+
+
static void
panel_section_changed_nt (G_GNUC_UNUSED gpointer id,
GmConfEntry *entry,
@@ -3857,7 +3881,20 @@
PanelSection section = DIALPAD;
sigc::connection conn;
-
+
+ Ekiga::ServiceCore *services = NULL;
+ GtkFrontend *gtk_frontend = NULL;
+ GtkWidget *chat_window = NULL;
+
+ /* initialize the callback to play IM message sound */
+
+ services = GnomeMeeting::Process ()->GetServiceCore ();
+ gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+ chat_window = GTK_WIDGET (gtk_frontend->get_chat_window ());
+
+ g_signal_connect (chat_window, "unread-alert",
+ G_CALLBACK (on_chat_unread_alert), NULL);
+
/* The Top-level window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_object_set_data_full (G_OBJECT (window), "window_name",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]