From 302f57a18243ad49b6c30f9da377d963a5e24150 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Fri, 10 Sep 2010 12:06:41 -0400 Subject: [PATCH] [#3376] remove warnings in gnome client --- sflphone-client-gnome/src/actions.c | 6 +-- sflphone-client-gnome/src/callable_obj.c | 2 - sflphone-client-gnome/src/codeclist.c | 1 - .../src/config/preferencesdialog.h | 2 + .../src/contacts/addressbook/eds.c | 3 +- sflphone-client-gnome/src/contacts/calltree.c | 2 +- sflphone-client-gnome/src/dbus/dbus.c | 24 +++++++---- sflphone-client-gnome/src/dbus/dbus.h | 7 ++++ sflphone-client-gnome/src/imwindow.c | 15 ++++--- sflphone-client-gnome/src/sflnotify.c | 1 - sflphone-client-gnome/src/uimanager.c | 14 +++++-- sflphone-client-gnome/src/widget/imwidget.c | 41 ++++++++++--------- sflphone-client-gnome/src/widget/imwidget.h | 4 +- 13 files changed, 71 insertions(+), 51 deletions(-) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index f729d667cb..a7ea725504 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -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); } diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index f3cf8e9efe..189c891ef8 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 284bc21d81..d6fcadb3c9 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 c4a2a3f0be..c681e58be3 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 0678e473ab..2046fa4cbb 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 52f0467cc3..900ddad001 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 49aed581ef..8c4c704420 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"); } @@ -267,10 +273,10 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, call = calllist_get (current_calls, call_id); if (call && call->_im_widget) - im_widget_update_state (call->_im_widget, TRUE); + im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE); } - new_participants = (gchar**) dbus_get_participant_list (changed_conf->_confID); + new_participants = (gchar **) dbus_get_participant_list (changed_conf->_confID); // update conferece participants conference_participant_list_update (new_participants, changed_conf); @@ -283,7 +289,7 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, call = calllist_get (current_calls, call_id); if (call && call->_im_widget) - im_widget_update_state (call->_im_widget, FALSE); + im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE); } // add new conference to calltree @@ -338,7 +344,7 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo // deactivate instant messaging window for this conference if (c->_im_widget) - im_widget_update_state (c->_im_widget, FALSE); + im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE); // remove all participant for this conference while (participant) { @@ -355,7 +361,7 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo // if an instant messaging was previously disabled, enabled it if (call->_im_widget) - im_widget_update_state (call->_im_widget, TRUE); + 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 99dce013df..8bdb088aef 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 a7f1038c05..154962fd68 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 76de2d3194..b90586c280 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 1a2cdca927..d1fb8288d8 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 8751088d1f..3d3dd9493d 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 3a252ba2a6..bcb1b32a64 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 -- GitLab