]> sjero.net Git - linphone/commitdiff
implement incoming chat notification on Mac
authorMargaux Clerc <margaux.clerc@belledonne-communications.com>
Tue, 4 Sep 2012 14:17:47 +0000 (16:17 +0200)
committerMargaux Clerc <margaux.clerc@belledonne-communications.com>
Tue, 4 Sep 2012 14:18:31 +0000 (16:18 +0200)
gtk/chat.c
gtk/linphone.h
gtk/main.c

index 0dafbdb9c8a128a315c37e3a4a27cb992212cb0c..4138f67224e89787bb44c22b09e990491231d094 100644 (file)
@@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "linphone.h"
 
+
+#ifdef HAVE_GTK_OSX
+#include <gtkosxapplication.h>
+#endif
+
 GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){
        GtkWidget *w;
        GtkTextBuffer *b;
@@ -37,6 +42,7 @@ GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){
 }
 
 void linphone_gtk_create_chatroom(const char *with){
+       
        LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),with);
        if (!cr) return;
        linphone_gtk_init_chatroom(cr,with);
@@ -101,9 +107,15 @@ void linphone_gtk_send_text(GtkWidget *button){
 
 void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){
        GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room);
-       if (w==NULL){
+       if (w==NULL){           
                w=linphone_gtk_init_chatroom(room,linphone_address_as_string_uri_only(from));
        }
+
+       #ifdef HAVE_GTK_OSX
+       /* Notify when a new message is send */
+       linphone_gtk_status_icon_set_blinking(TRUE);
+       #endif
+       
        linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")),
                                linphone_address_as_string_uri_only(from),
                                message,FALSE);
index d4cafe28f359acad9ade88de52be65c4152f4e0b..f817969f7bfc63dfca552e0343755fba6638a332 100644 (file)
@@ -97,6 +97,8 @@ void * linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, c
 
 void linphone_gtk_show_directory_search(void);
 
+void linphone_gtk_status_icon_set_blinking(gboolean val);
+
 /*functions controlling the different views*/
 gboolean linphone_gtk_use_in_call_view();
 LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf);
index 2955b3ecc81493aa57330b608772f3e1e63137dd..2085e3d20b6c89c2ada209e217a62911caa9f048 100644 (file)
@@ -65,10 +65,11 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
 static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t enabled, const char *token);
 static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate);
 static gboolean linphone_gtk_auto_answer(LinphoneCall *call);
-static void linphone_gtk_status_icon_set_blinking(gboolean val);
+void linphone_gtk_status_icon_set_blinking(gboolean val);
 void _linphone_gtk_enable_video(gboolean val);
 
 
+
 static gboolean verbose=0;
 static gboolean auto_answer = 0;
 static gchar * addr_to_call = NULL;
@@ -1347,7 +1348,7 @@ static gboolean do_icon_blink(GtkStatusIcon *gi){
 
 #endif
 
-static void linphone_gtk_status_icon_set_blinking(gboolean val){
+void linphone_gtk_status_icon_set_blinking(gboolean val){
 #ifdef HAVE_GTK_OSX
        static gint attention_id;
        GtkOSXApplication *theMacApp=(GtkOSXApplication*)g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);