diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 6172b7e0a806919f8f2eeb3c0f099cea450e4cb1..a7ea725504aac6f43afe92eae7be4660602bce20 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -51,7 +51,7 @@ #include <sys/ioctl.h> #include <linux/if.h> - +#include <widget/imwidget.h> GHashTable * ip2ip_profile=NULL; @@ -200,7 +200,7 @@ sflphone_hung_up (callable_obj_t * c) update_actions(); /* Update the IM interface */ - im_widget_update_state (c->_im_widget, FALSE); + im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE); #if GTK_CHECK_VERSION(2,10,0) status_tray_icon_blink (FALSE); @@ -380,7 +380,7 @@ sflphone_hang_up() call_remove_all_errors (selectedCall); selectedCall->_state = CALL_STATE_DIALING; set_timestamp (&selectedCall->_time_stop); - im_widget_update_state (selectedCall->_im_widget, FALSE); + im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), FALSE); break; case CALL_STATE_FAILURE: dbus_hang_up (selectedCall); @@ -404,7 +404,7 @@ sflphone_hang_up() break; } } else if (selectedConf) { - im_widget_update_state (selectedConf->_im_widget, FALSE); + im_widget_update_state (IM_WIDGET (selectedConf->_im_widget), FALSE); dbus_hang_up_conference (selectedConf); } @@ -973,6 +973,10 @@ sflphone_detach_participant (const gchar* callID) selectedCall->_confID = NULL; } + // Instant messaging widget should have been deactivated during the conference + if (selectedCall->_im_widget) + im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), TRUE); + calltree_remove_call (current_calls, selectedCall, NULL); calltree_add_call (current_calls, selectedCall, NULL); dbus_detach_participant (selectedCall->_callID); @@ -985,6 +989,10 @@ sflphone_detach_participant (const gchar* callID) selectedCall->_confID = NULL; } + // Instant messagin widget should have been deactivated during the conference + if (selectedCall->_im_widget) + im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), TRUE); + calltree_remove_call (current_calls, selectedCall, NULL); calltree_add_call (current_calls, selectedCall, NULL); dbus_detach_participant (callID); diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index f3cf8e9efee6b219d00081b8d46bc4474cb4162d..189c891ef8fbdd8c7a3be6f030721e627f5c8d8f 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -537,8 +537,6 @@ gchar* get_peer_information (callable_obj_t *c) { - gchar *res; - if (g_strcasecmp (c->_peer_name,"") == 0) return g_strdup (c->_peer_number); else diff --git a/sflphone-client-gnome/src/codeclist.c b/sflphone-client-gnome/src/codeclist.c index 284bc21d8168c45719217169377f0558eacc7dd2..d6fcadb3c910296f2e32b715a04c9c6598afa6ee 100644 --- a/sflphone-client-gnome/src/codeclist.c +++ b/sflphone-client-gnome/src/codeclist.c @@ -105,7 +105,6 @@ void codec_capabilities_load (void) void account_create_codec_list (account_t **acc) { - gchar **order = NULL; GQueue *_codecs; _codecs = (*acc)->codecs; diff --git a/sflphone-client-gnome/src/config/preferencesdialog.h b/sflphone-client-gnome/src/config/preferencesdialog.h index c4a2a3f0be3036909f332490f96ab81afb8df3ed..c681e58be3d1fe056f1efcd969f6d6a72f075441 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.h +++ b/sflphone-client-gnome/src/config/preferencesdialog.h @@ -121,6 +121,8 @@ void save_configuration_parameters (void); void history_load_configuration (void); +void instant_messaging_load_configuration (void); + GtkTreeModel* createModel(); #endif diff --git a/sflphone-client-gnome/src/contacts/addressbook/eds.c b/sflphone-client-gnome/src/contacts/addressbook/eds.c index 0678e473abd111b78fbc133e69014206230eb6f6..2046fa4cbb918ed487b160df6a39ffb7203a23ec 100644 --- a/sflphone-client-gnome/src/contacts/addressbook/eds.c +++ b/sflphone-client-gnome/src/contacts/addressbook/eds.c @@ -548,7 +548,8 @@ fill_books_data () book_data->name = g_strdup (e_source_peek_name (source)); book_data->uid = g_strdup (e_source_peek_uid (source)); - gchar *prop = e_source_get_property (source, "default"); + const gchar *property_name = "default"; + const gchar *prop = e_source_get_property (source, property_name); if (prop) if (strcmp (prop, "true") == 0) diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 52f0467cc31a6d18e1f300907fe13a27f3b1ea0e..900ddad001ab1ac74226b1a3b12c6446e217d9f6 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -40,7 +40,7 @@ #include <history.h> #include "uimanager.h" #include "actions.h" -#include <imwindow.h> +#include "imwindow.h" GtkWidget *sw; GtkCellRenderer *rend; diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index e7616b3780bb777e7a0803b1cea8d76b24b028d9..8c4c704420c1e518181679a17296af7b0215fd3a 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -49,6 +49,8 @@ #include <widget/imwidget.h> +#include <eel-gconf-extensions.h> + #define DEFAULT_DBUS_TIMEOUT 30000 DBusGConnection * connection; @@ -144,13 +146,17 @@ incoming_message_cb (DBusGProxy *proxy UNUSED, const gchar* callID UNUSED, const /* Make the instant messaging main window pops, add messages only if the main window exist. Elsewhere the message is displayed asynchronously*/ - if (im_widget_display (& (call->_im_widget), msg, call->_callID, from)) - im_widget_add_message (call->_im_widget, from, msg, 0); + IMWidget *widget = IM_WIDGET (call->_im_widget); + + if (im_widget_display (&widget, msg, call->_callID, from)) + im_widget_add_message (IM_WIDGET (call->_im_widget), from, msg, 0); } else if (conf) { /* Make the instant messaging main window pops, add messages only if the main window exist. Elsewhere the message is displayed asynchronously*/ - if (im_widget_display (& (conf->_im_widget), msg, conf->_confID, from)) - im_widget_add_message (conf->_im_widget, from, msg, 0); + IMWidget *widget = IM_WIDGET (conf->_im_widget); + + if (im_widget_display (&widget, msg, conf->_confID, from)) + im_widget_add_message (IM_WIDGET (conf->_im_widget), from, msg, 0); } else { ERROR ("Message received, but no recipient found"); } @@ -234,9 +240,13 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, const gchar* state, void * foo UNUSED) { + gchar** part; + callable_obj_t *call; + gchar* call_id; + // sflphone_display_transfer_status("Transfer successfull"); conference_obj_t* changed_conf = conferencelist_get (confID); - gchar** participants; + gchar** old_participants, new_participants; DEBUG ("conference new state %s\n", state); @@ -255,10 +265,32 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, DEBUG ("Error: conference state not recognized"); } - participants = (gchar**) dbus_get_participant_list (changed_conf->_confID); + // reactivate instant messaging window for these calls + old_participants = (gchar**) changed_conf->participant_list; + + for (part = old_participants; *part; part++) { + call_id = (gchar*) (*part); + call = calllist_get (current_calls, call_id); + + if (call && call->_im_widget) + im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE); + } + + new_participants = (gchar **) dbus_get_participant_list (changed_conf->_confID); // update conferece participants - conference_participant_list_update (participants, changed_conf); + conference_participant_list_update (new_participants, changed_conf); + + // deactivate instant messaging window for new participants + new_participants = (gchar**) changed_conf->participant_list; + + for (part = new_participants; *part; part++) { + call_id = (gchar*) (*part); + call = calllist_get (current_calls, call_id); + + if (call && call->_im_widget) + im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE); + } // add new conference to calltree calltree_add_conference (current_calls, changed_conf); @@ -287,6 +319,11 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo for (part = participants; *part; part++) { call_id = (gchar*) (*part); call = calllist_get (current_calls, call_id); + + // if a text widget is already created, disable it, use conference widget instead + if (call->_im_widget) + im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE); + call->_confID = g_strdup (confID); } @@ -305,6 +342,11 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo GSList *participant = c->participant_list; callable_obj_t *call; + // deactivate instant messaging window for this conference + if (c->_im_widget) + im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE); + + // remove all participant for this conference while (participant) { call = calllist_get (current_calls, (const gchar *) (participant->data)); @@ -316,6 +358,10 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo g_free (call->_confID); call->_confID = NULL; } + + // if an instant messaging was previously disabled, enabled it + if (call->_im_widget) + im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE); } participant = conference_next_participant (participant); diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 99dce013df8db99d36ef8a262c3c72fded03a5c5..8bdb088aefc3bb807260867d50c91ac024e673cb 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -250,6 +250,13 @@ gchar* dbus_get_current_codec_name (const callable_obj_t * c); */ gchar** dbus_get_audio_plugin_list(); + +/** + * ConfigurationManager - Select an input audio plugin + * @param audioPlugin The string description of the plugin + */ +void dbus_set_audio_plugin (gchar* audioPlugin); + /** * ConfigurationManager - Select an input audio plugin * @param audioPlugin The string description of the plugin diff --git a/sflphone-client-gnome/src/imwindow.c b/sflphone-client-gnome/src/imwindow.c index a7f1038c0524f1d515a201e5306603a177b30453..154962fd684dd565890c9313de86e88091c3bdd6 100644 --- a/sflphone-client-gnome/src/imwindow.c +++ b/sflphone-client-gnome/src/imwindow.c @@ -43,7 +43,7 @@ GtkWidget *im_window = NULL; GtkWidget *im_notebook = NULL; -static gboolean window_configure_cb (GtkWidget *win, GdkEventConfigure *event) +static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure *event) { int pos_x, pos_y; @@ -69,7 +69,7 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED) } static void -on_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer userdata) +on_switch_page (GtkNotebook *notebook, GtkNotebookPage *page UNUSED, guint page_num, gpointer userdata UNUSED) { guint index = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); @@ -86,9 +86,6 @@ static void im_window_init() { const char *window_title = "SFLphone IM Client"; - gchar *path; - GError *error = NULL; - gboolean ret; int width, height, position_x, position_y; // Get configuration stored in gconf @@ -157,11 +154,11 @@ im_window_add (GtkWidget *widget) /* Show it all */ gtk_widget_show_all (im_window); } else - error ("Could not create the main instant messaging window"); + ERROR ("Could not create the main instant messaging window"); } static void -close_tab_cb (GtkButton *button, gpointer userdata) +close_tab_cb (GtkButton *button UNUSED, gpointer userdata) { /* We want here to close the current tab */ im_window_remove_tab (GTK_WIDGET (userdata)); @@ -187,8 +184,10 @@ im_window_add_tab (GtkWidget *widget) if (im_widget_call) tab_Label = gtk_label_new (get_peer_information (im_widget_call)); - else + else if (im_widget_conf) tab_Label = gtk_label_new ("Conferencing"); + else + tab_Label = gtk_label_new (""); GtkWidget *tab_CloseButton = gtk_button_new (); diff --git a/sflphone-client-gnome/src/sflnotify.c b/sflphone-client-gnome/src/sflnotify.c index 76de2d319460f15a9e9f950d32e51467373ec805..b90586c280f17d010a8448c7c296057b120cfce8 100644 --- a/sflphone-client-gnome/src/sflnotify.c +++ b/sflphone-client-gnome/src/sflnotify.c @@ -72,7 +72,6 @@ void notify_incoming_message (const gchar *callID, const gchar *msg) { - gchar* text; gchar* title; title = g_markup_printf_escaped (_ ("%s says:"), callID); diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index 1a2cdca92736d9c3ad307808b38d58cfe658bdcc..d1fb8288d8758fe20b85296601636c253e642718 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -576,17 +576,23 @@ call_im (void* foo UNUSED) if (calltab_get_selected_type (current_calls) == A_CALL) { + IMWidget *widget; + if (selectedCall) { - im_widget_display (& (selectedCall->_im_widget), NULL, selectedCall->_callID, NULL); + widget = IM_WIDGET (selectedCall->_im_widget); + im_widget_display (&widget, NULL, selectedCall->_callID, NULL); } else { - warn ("Sorry. Instant messaging is not allowed outside a call\n"); + WARN ("Sorry. Instant messaging is not allowed outside a call\n"); } } else { + IMWidget *widget; + if (selectedConf) { - im_widget_display (& (selectedConf->_im_widget), NULL, selectedConf->_confID, NULL); + widget = IM_WIDGET (selectedConf->_im_widget); + im_widget_display (&widget, NULL, selectedConf->_confID, NULL); } else { - warn ("Sorry. Instant messaging is not allowed outside a call\n"); + WARN ("Sorry. Instant messaging is not allowed outside a call\n"); } } } diff --git a/sflphone-client-gnome/src/widget/imwidget.c b/sflphone-client-gnome/src/widget/imwidget.c index 8751088d1f295c17744554aca555c70b143791bb..3d3dd9493dade43a53f6fa1e61a3778a4492b72a 100644 --- a/sflphone-client-gnome/src/widget/imwidget.c +++ b/sflphone-client-gnome/src/widget/imwidget.c @@ -27,6 +27,7 @@ * as that of the covered work. */ +#include <imwindow.h> #include "imwidget.h" #include <icons/icon_factory.h> #include <contacts/calltab.h> @@ -37,7 +38,7 @@ #define WEBKIT_DIR "file://" DATA_DIR "/webkit/" static void -on_frame_loading_done (GObject *gobject, GParamSpec *pspec, gpointer user_data) +on_frame_loading_done (GObject *gobject UNUSED, GParamSpec *pspec UNUSED, gpointer user_data) { IMWidget *im = IM_WIDGET (user_data); callable_obj_t *call; @@ -53,10 +54,10 @@ on_frame_loading_done (GObject *gobject, GParamSpec *pspec, gpointer user_data) conf = conferencelist_get (im->call_id); if (call) - im_widget_add_message (im, im->first_message_from, im->first_message, NULL); + im_widget_add_message (im, im->first_message_from, im->first_message, 0); if (conf) - im_widget_add_message (im, im->first_message_from, im->first_message, NULL); + im_widget_add_message (im, im->first_message_from, im->first_message, 0); g_free (im->first_message); g_free (im->first_message_from); @@ -73,14 +74,14 @@ on_frame_loading_done (GObject *gobject, GParamSpec *pspec, gpointer user_data) } gchar * -escape_single_quotes (gchar *message) +escape_single_quotes (const gchar *message) { - gchar **ptr_token, second_ptr_token; - gchar *string, second_string; + gchar **ptr_token; + gchar *string = ""; DEBUG ("message: %s", message); - if (ptr_token = g_strsplit (message, "'", NULL)) { + if ( (ptr_token = g_strsplit (message, "'", 0))) { DEBUG ("SPLITTING"); string = g_strjoinv ("\\'", ptr_token); } @@ -91,7 +92,6 @@ escape_single_quotes (gchar *message) void im_widget_add_message (IMWidget *im, const gchar *from, const gchar *message, gint level) { - gboolean loadingDone = FALSE; if (im) { @@ -116,12 +116,12 @@ im_widget_add_message (IMWidget *im, const gchar *from, const gchar *message, gi static gboolean web_view_nav_requested_cb ( - WebKitWebView *web_view, - WebKitWebFrame *frame, + WebKitWebView *web_view UNUSED, + WebKitWebFrame *frame UNUSED, WebKitNetworkRequest *request, - WebKitWebNavigationAction *navigation_action, + WebKitWebNavigationAction *navigation_action UNUSED, WebKitWebPolicyDecision *policy_decision, - gpointer user_data) + gpointer user_data UNUSED) { const gchar *uri = webkit_network_request_get_uri (request); @@ -131,7 +131,10 @@ web_view_nav_requested_cb ( } else { /* Running a system command to open the URL in the user's default browser */ gchar *cmd = g_strdup_printf ("x-www-browser %s", uri); - system (cmd); + + if (system (cmd) == -1) + ERROR ("Error executing command %s", cmd); + webkit_web_policy_decision_ignore (policy_decision); g_free (cmd); } @@ -140,7 +143,7 @@ web_view_nav_requested_cb ( } static gboolean -on_Textview_changed (GtkWidget *widget, GdkEventKey *event, gpointer user_data) +on_Textview_changed (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_data) { GtkTextIter start, end; @@ -194,7 +197,7 @@ im_widget_add_message_time () /* Get the time of the message. Format: HH:MM::SS */ strftime ( (char *) str, 100, "%R", (const struct tm *) ptr); - gchar *res = g_strdup (str); + gchar *res = g_strdup ( (gchar *) str); /* Return the new value */ return res; @@ -232,7 +235,7 @@ im_widget_send_message (gchar *id, const gchar *message) static void -im_widget_class_init (IMWidgetClass *klass) +im_widget_class_init (IMWidgetClass *klass UNUSED) { } @@ -282,7 +285,7 @@ im_widget_new() } GtkWidget * -im_widget_new_with_first_message (gchar *message) +im_widget_new_with_first_message (const gchar *message UNUSED) { return GTK_WIDGET (g_object_new (IM_WIDGET_TYPE, NULL)); // return GTK_WIDGET (g_object_new (IM_WIDGET_TYPE, "first_message", message, NULL)); @@ -319,7 +322,7 @@ im_widget_get_type (void) } gboolean -im_widget_display (IMWidget **im, gchar *message, gchar *id, gchar *from) +im_widget_display (IMWidget **im, const gchar *message, const gchar *id, const gchar *from) { /* Work with a copy of the object */ @@ -349,7 +352,7 @@ im_widget_display (IMWidget **im, gchar *message, gchar *id, gchar *from) im_widget_infobar (imwidget); /* Add it to the main instant messaging window */ - im_window_add (imwidget); + im_window_add (GTK_WIDGET (imwidget)); /* Update the first message to appears at widget creation*/ if (message) diff --git a/sflphone-client-gnome/src/widget/imwidget.h b/sflphone-client-gnome/src/widget/imwidget.h index 3a252ba2a6b7a66291cb009d534dacd32799571a..bcb1b32a644753ee06c80a5d8fbeba0df44aea24 100644 --- a/sflphone-client-gnome/src/widget/imwidget.h +++ b/sflphone-client-gnome/src/widget/imwidget.h @@ -82,7 +82,7 @@ struct _IMWidgetClass { @param The first message sender, could be different of call id for conferences @return TRUE if window is already created, FALSE elsewhere */ -gboolean im_widget_display (IMWidget**, gchar*, gchar*, gchar*); +gboolean im_widget_display (IMWidget**, const gchar*, const gchar*, const gchar*); GType im_widget_get_type (void) G_GNUC_CONST; @@ -94,7 +94,7 @@ GtkWidget *im_widget_new (); /*! @function @abstract Create a new widget with first_message */ -GtkWidget *im_widget_new_with_first_message (gchar *message); +GtkWidget *im_widget_new_with_first_message (const gchar *message); /*! @function