diff --git a/gnome/src/Makefile.am b/gnome/src/Makefile.am index 3e673bfde457f4c7e9c3e8d994d6b346abc26040..b0f6d68bdfd26903f9967675b119829990627e06 100644 --- a/gnome/src/Makefile.am +++ b/gnome/src/Makefile.am @@ -27,12 +27,13 @@ sflphone_client_gnome_SOURCES = \ codeclist.c \ reqaccount.c \ eel-gconf-extensions.c \ - shortcuts.c + shortcuts.c \ + str_utils.c noinst_HEADERS = actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \ reqaccount.h sflphone_const.h uimanager.h \ accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h \ - shortcuts.h eel-gconf-extensions.h logger.h imwindow.h unused.h + shortcuts.h eel-gconf-extensions.h logger.h imwindow.h unused.h str_utils.h sflphone_client_gnome_LDADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(X11_LIBS) \ $(GTK_LIBS) $(GLIB_LIBS) $(WEBKIT_LIBS) $(LD_LIBS) $(GCONF_LIBS) diff --git a/gnome/src/accountlist.c b/gnome/src/accountlist.c index 803e3d3d4eda3a34798b8779de022607b8b27832..2c639ce0fb962476216cb50c35811cb707ac76c5 100644 --- a/gnome/src/accountlist.c +++ b/gnome/src/accountlist.c @@ -30,6 +30,7 @@ */ #include <glib/gi18n.h> +#include "str_utils.h" #include "accountlist.h" #include "actions.h" #include "unused.h" @@ -43,7 +44,7 @@ static guint account_list_get_position(account_t *account) for (guint i = 0; i < size; i++) { account_t *tmp = account_list_get_nth(i); - if (g_strcasecmp(tmp->accountID, account->accountID) == 0) + if (utf8_case_cmp(tmp->accountID, account->accountID) == 0) return i; } @@ -266,7 +267,7 @@ gboolean current_account_has_mailbox(void) if (current) { gchar * account_mailbox = g_hash_table_lookup(current->properties, ACCOUNT_MAILBOX); - if (account_mailbox && g_strcasecmp(account_mailbox, "") != 0) + if (account_mailbox && utf8_case_cmp(account_mailbox, "") != 0) return TRUE; } diff --git a/gnome/src/actions.c b/gnome/src/actions.c index 29dca0798b8702b42d1b72b9d3568d3c8de097da..8ac4fa49d52d18fe1d2588fdafdd4bcd32866393 100644 --- a/gnome/src/actions.c +++ b/gnome/src/actions.c @@ -37,6 +37,8 @@ #else #include <gdk/gdkkeysyms.h> #endif + +#include "str_utils.h" #include <glib.h> #include <stdlib.h> #include <string.h> @@ -101,7 +103,7 @@ sflphone_notify_voice_mail(const gchar* accountID , guint count) static gboolean is_direct_call(callable_obj_t * c) { - if (g_strcasecmp(c->_accountID, "empty") == 0) { + if (utf8_case_cmp(c->_accountID, "empty") == 0) { if (!g_str_has_prefix(c->_peer_number, "sip:")) { gchar * new_number = g_strconcat("sip:", c->_peer_number, NULL); g_free(c->_peer_number); @@ -817,7 +819,7 @@ static int place_registered_call(callable_obj_t * c) } gpointer status = g_hash_table_lookup(current->properties, "Status"); - if (status && g_strcasecmp(status, "REGISTERED") == 0) { + if (status && utf8_case_cmp(status, "REGISTERED") == 0) { /* The call is made with the current account */ // free memory for previous account id and get a new one g_free(c->_accountID); diff --git a/gnome/src/callable_obj.c b/gnome/src/callable_obj.c index c16d9515edc16ac12a947d5ab88ab4453a546f37..562745a9b22681aed2d9c5b8eecbe6fe48d271af 100644 --- a/gnome/src/callable_obj.c +++ b/gnome/src/callable_obj.c @@ -29,6 +29,7 @@ */ #include "callable_obj.h" +#include "str_utils.h" #include "codeclist.h" #include "sflphone_const.h" #include <time.h> @@ -146,15 +147,15 @@ callable_obj_t *create_new_call_from_details(const gchar *call_id, GHashTable *d const gchar * const display_name = g_hash_table_lookup(details, "DISPLAY_NAME"); const gchar * const state_str = g_hash_table_lookup(details, "CALL_STATE"); - if (g_strcasecmp(state_str, "CURRENT") == 0) + if (utf8_case_cmp(state_str, "CURRENT") == 0) state = CALL_STATE_CURRENT; - else if (g_strcasecmp(state_str, "RINGING") == 0) + else if (utf8_case_cmp(state_str, "RINGING") == 0) state = CALL_STATE_RINGING; - else if (g_strcasecmp(state_str, "INCOMING") == 0) + else if (utf8_case_cmp(state_str, "INCOMING") == 0) state = CALL_STATE_INCOMING; - else if (g_strcasecmp(state_str, "HOLD") == 0) + else if (utf8_case_cmp(state_str, "HOLD") == 0) state = CALL_STATE_HOLD; - else if (g_strcasecmp(state_str, "BUSY") == 0) + else if (utf8_case_cmp(state_str, "BUSY") == 0) state = CALL_STATE_BUSY; else state = CALL_STATE_FAILURE; diff --git a/gnome/src/conference_obj.c b/gnome/src/conference_obj.c index f2bda66b51a3310be1f614408da839091b3e0221..f91617458266d8171cd8e405610f45b15bd4d85b 100644 --- a/gnome/src/conference_obj.c +++ b/gnome/src/conference_obj.c @@ -31,6 +31,7 @@ #include <time.h> #include "callable_obj.h" +#include "str_utils.h" #include "dbus.h" #include "sflphone_const.h" #include "logger.h" @@ -80,17 +81,17 @@ conference_obj_t *create_new_conference_from_details(const gchar *conf_id, GHash gchar *state_str = g_hash_table_lookup(details, "CONF_STATE"); - if (g_strcasecmp(state_str, "ACTIVE_ATTACHED") == 0) + if (utf8_case_cmp(state_str, "ACTIVE_ATTACHED") == 0) new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED; - else if (g_strcasecmp(state_str, "ACTIVE_ATTACHED_REC") == 0) + else if (utf8_case_cmp(state_str, "ACTIVE_ATTACHED_REC") == 0) new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD; - else if (g_strcasecmp(state_str, "ACTIVE_DETACHED") == 0) + else if (utf8_case_cmp(state_str, "ACTIVE_DETACHED") == 0) new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED; - else if (g_strcasecmp(state_str, "ACTIVE_DETACHED_REC") == 0) + else if (utf8_case_cmp(state_str, "ACTIVE_DETACHED_REC") == 0) new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD; - else if (g_strcasecmp(state_str, "HOLD") == 0) + else if (utf8_case_cmp(state_str, "HOLD") == 0) new_conf->_state = CONFERENCE_STATE_HOLD; - else if (g_strcasecmp(state_str, "HOLD_REC") == 0) + else if (utf8_case_cmp(state_str, "HOLD_REC") == 0) new_conf->_state = CONFERENCE_STATE_HOLD_RECORD; return new_conf; diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 7c2de3f8c46695269159866650beca02ca4de242..2a8a12aaa90cf03c0570b9e54ff25fda117fe07d 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -40,6 +40,7 @@ #include <gtk/gtk.h> #include "config.h" +#include "str_utils.h" #include "logger.h" #include "actions.h" #include "mainwindow.h" @@ -134,7 +135,7 @@ void change_protocol_cb(account_t *currentAccount UNUSED) // Only if tabs are not NULL if (security_tab && advanced_tab) { - if (g_strcasecmp(protocol, "IAX") == 0) { + if (utf8_case_cmp(protocol, "IAX") == 0) { gtk_widget_hide(security_tab); gtk_widget_hide(advanced_tab); } else { @@ -440,8 +441,8 @@ static void cell_edited_cb(GtkCellRendererText *renderer, gchar *path_desc, gcha gint column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(renderer), "column")); DEBUG("path desc in cell_edited_cb: %s\n", text); - if ((g_strcasecmp(path_desc, "0") == 0) && - g_strcasecmp(text, gtk_entry_get_text(GTK_ENTRY(entryUsername))) != 0) + if ((utf8_case_cmp(path_desc, "0") == 0) && + utf8_case_cmp(text, gtk_entry_get_text(GTK_ENTRY(entryUsername))) != 0) g_signal_handlers_disconnect_by_func(G_OBJECT(entryUsername), G_CALLBACK(update_credential_cb), NULL); GtkTreeIter iter; @@ -456,7 +457,7 @@ static void editing_started_cb(GtkCellRenderer *cell UNUSED, GtkCellEditable * e DEBUG("path desc in editing_started_cb: %s\n", path); // If we are dealing the first row - if (g_strcasecmp(path, "0") == 0) + if (utf8_case_cmp(path, "0") == 0) gtk_entry_set_text(GTK_ENTRY(editable), gtk_entry_get_text(GTK_ENTRY(entryPassword))); } @@ -464,7 +465,7 @@ static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer dat { gchar *proto = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(keyExchangeCombo)); - if (g_strcasecmp(proto, "ZRTP") == 0) + if (utf8_case_cmp(proto, "ZRTP") == 0) show_advanced_zrtp_options((GHashTable *) data); else show_advanced_sdes_options((GHashTable *) data); @@ -484,8 +485,8 @@ static void key_exchange_changed_cb(GtkWidget *widget UNUSED, gpointer data UNUS DEBUG("Key exchange changed %s", active_text); gboolean set_sensitive = FALSE; - set_sensitive |= g_strcasecmp(active_text, "SDES") == 0; - set_sensitive |= g_strcasecmp(active_text, "ZRTP") == 0; + set_sensitive |= utf8_case_cmp(active_text, "SDES") == 0; + set_sensitive |= utf8_case_cmp(active_text, "ZRTP") == 0; g_free(active_text); if (set_sensitive) @@ -863,7 +864,7 @@ static GtkWidget* create_registration_expire(account_t *a) entryResolveNameOnlyOnce = gtk_check_button_new_with_mnemonic(_("_Comply with RFC 3263")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce), - g_strcasecmp(resolve_once,"false") == 0 ? TRUE: FALSE); + utf8_case_cmp(resolve_once,"false") == 0 ? TRUE: FALSE); gtk_table_attach_defaults(GTK_TABLE(table), entryResolveNameOnlyOnce, 0, 2, 1, 2); gtk_widget_set_sensitive(entryResolveNameOnlyOnce , TRUE); @@ -952,7 +953,7 @@ GtkWidget* create_published_address(account_t *a) use_tls = g_hash_table_lookup(a->properties, TLS_ENABLE); published_sameas_local = g_hash_table_lookup(a->properties, PUBLISHED_SAMEAS_LOCAL); - if (g_strcasecmp(published_sameas_local, "true") == 0) { + if (utf8_case_cmp(published_sameas_local, "true") == 0) { published_address = dbus_get_address_from_interface_name(g_hash_table_lookup(a->properties, LOCAL_INTERFACE)); published_port = g_hash_table_lookup(a->properties, LOCAL_PORT); } else { @@ -973,9 +974,9 @@ GtkWidget* create_published_address(account_t *a) gtk_table_attach_defaults(GTK_TABLE(table), useStunCheckBox, 0, 1, 0, 1); g_signal_connect(useStunCheckBox, "toggled", G_CALLBACK(use_stun_cb), a); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useStunCheckBox), - g_strcasecmp(stun_enable, "true") == 0 ? TRUE: FALSE); + utf8_case_cmp(stun_enable, "true") == 0 ? TRUE: FALSE); gtk_widget_set_sensitive(useStunCheckBox, - g_strcasecmp(use_tls, "true") == 0 ? FALSE: TRUE); + utf8_case_cmp(use_tls, "true") == 0 ? FALSE: TRUE); stunServerLabel = gtk_label_new_with_mnemonic(_("STUN server URL")); gtk_table_attach_defaults(GTK_TABLE(table), stunServerLabel, 0, 1, 1, 2); @@ -991,7 +992,7 @@ GtkWidget* create_published_address(account_t *a) publishedAddrRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(sameAsLocalRadioButton), _("Set published address and port:")); gtk_table_attach_defaults(GTK_TABLE(table), publishedAddrRadioButton, 0, 2, 4, 5); - if (g_strcasecmp(published_sameas_local, "true") == 0) { + if (utf8_case_cmp(published_sameas_local, "true") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), FALSE); } else { @@ -1097,7 +1098,7 @@ static GtkWidget* create_audiocodecs_configuration(account_t *currentAccount) gboolean dtmf_are_rtp = TRUE; - if (g_strcasecmp(currentDtmfType, OVERRTP) != 0) + if (utf8_case_cmp(currentDtmfType, OVERRTP) != 0) dtmf_are_rtp = FALSE; overrtp = gtk_radio_button_new_with_label(NULL, _("RTP")); @@ -1204,7 +1205,7 @@ void show_account_window(account_t * currentAccount) gtk_widget_show(notebook); // We do not need the global settings for the IP2IP account - if (g_strcasecmp(currentAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(currentAccount->accountID, IP2IP) != 0) { /* General Settings */ GtkWidget *basic_tab = create_basic_tab(currentAccount); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), basic_tab, gtk_label_new(_("Basic"))); @@ -1225,7 +1226,7 @@ void show_account_window(account_t * currentAccount) currentProtocol = g_strdup("SIP"); // Do not need advanced or security one for the IP2IP account - if (g_strcasecmp(currentAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(currentAccount->accountID, IP2IP) != 0) { /* Advanced */ advanced_tab = create_advanced_tab(currentAccount); @@ -1271,7 +1272,7 @@ void show_account_window(account_t * currentAccount) } // If accept button is - if (g_strcasecmp(currentAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(currentAccount->accountID, IP2IP) != 0) { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_ALIAS), @@ -1294,7 +1295,7 @@ void show_account_window(account_t * currentAccount) } if (g_strcmp0(proto, "SIP") == 0) { - if (g_strcasecmp(currentAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(currentAccount->accountID, IP2IP) != 0) { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_RESOLVE_ONCE), @@ -1356,10 +1357,10 @@ void show_account_window(account_t * currentAccount) gchar* keyExchange = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(keyExchangeCombo)); - if (g_strcasecmp(keyExchange, "ZRTP") == 0) { + if (utf8_case_cmp(keyExchange, "ZRTP") == 0) { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP)); - } else if (g_strcasecmp(keyExchange, "SDES") == 0) { + } else if (utf8_case_cmp(keyExchange, "SDES") == 0) { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(SDES)); } else { @@ -1392,7 +1393,7 @@ void show_account_window(account_t * currentAccount) } /** @todo Verify if it's the best condition to check */ - if (g_strcasecmp(currentAccount->accountID, "new") == 0) + if (utf8_case_cmp(currentAccount->accountID, "new") == 0) dbus_add_account(currentAccount); else dbus_set_account_details(currentAccount); @@ -1401,7 +1402,7 @@ void show_account_window(account_t * currentAccount) /* Set new credentials if any */ DEBUG("Config: Setting credentials"); - if (g_strcasecmp(currentAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(currentAccount->accountID, IP2IP) != 0) { DEBUG("Config: Get new credentials"); currentAccount->credential_information = getNewCredential(); diff --git a/gnome/src/config/accountlistconfigdialog.c b/gnome/src/config/accountlistconfigdialog.c index 151f067ac7d189570edb42889faebe0ff6e1c586..32cf2009da6e504e0dcbe8d7d274478c188bef04 100644 --- a/gnome/src/config/accountlistconfigdialog.c +++ b/gnome/src/config/accountlistconfigdialog.c @@ -31,6 +31,7 @@ #include "accountlistconfigdialog.h" +#include "str_utils.h" #include "dbus/dbus.h" #include "accountconfigdialog.h" #include "actions.h" @@ -129,7 +130,7 @@ void account_list_config_dialog_fill() COLUMN_ACCOUNT_ALIAS, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name COLUMN_ACCOUNT_TYPE, g_hash_table_lookup(a->properties, ACCOUNT_TYPE), // Protocol COLUMN_ACCOUNT_STATUS, account_state_name(a->state), // Status - COLUMN_ACCOUNT_ACTIVE, (g_strcasecmp(g_hash_table_lookup(a->properties, ACCOUNT_ENABLED),"true") == 0) ? TRUE:FALSE, // Enable/Disable + COLUMN_ACCOUNT_ACTIVE, (utf8_case_cmp(g_hash_table_lookup(a->properties, ACCOUNT_ENABLED),"true") == 0) ? TRUE:FALSE, // Enable/Disable COLUMN_ACCOUNT_DATA, a, // Pointer -1); @@ -151,7 +152,7 @@ void account_list_config_dialog_fill() COLUMN_ACCOUNT_ALIAS, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name COLUMN_ACCOUNT_TYPE, g_hash_table_lookup(a->properties, ACCOUNT_TYPE), // Protocol COLUMN_ACCOUNT_STATUS, account_state_name(a->state), // Status - COLUMN_ACCOUNT_ACTIVE, (g_strcasecmp(g_hash_table_lookup(a->properties, ACCOUNT_ENABLED),"true") == 0) ? TRUE:FALSE, // Enable/Disable + COLUMN_ACCOUNT_ACTIVE, (utf8_case_cmp(g_hash_table_lookup(a->properties, ACCOUNT_ENABLED),"true") == 0) ? TRUE:FALSE, // Enable/Disable COLUMN_ACCOUNT_DATA, a, // Pointer -1); } @@ -188,7 +189,7 @@ select_account_cb(GtkTreeSelection *selection, GtkTreeModel *model) if (selectedAccount != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(editButton), TRUE); - if (g_strcasecmp(selectedAccount->accountID, IP2IP) != 0) { + if (utf8_case_cmp(selectedAccount->accountID, IP2IP) != 0) { gtk_widget_set_sensitive(GTK_WIDGET(accountMoveUpButton), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(accountMoveDownButton), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(deleteButton), TRUE); @@ -238,7 +239,7 @@ static void enable_account_cb(GtkCellRendererToggle *rend UNUSED, gchar* path, account_t* acc ; // The IP2IP profile can't be disabled - if (g_strcasecmp(path, "0") == 0) + if (utf8_case_cmp(path, "0") == 0) return; // Get pointer on object @@ -300,7 +301,7 @@ static void account_move(gboolean moveUp, gpointer data) // The first real account in the list can't move up because of the IP2IP account // It can still move down though - if (g_strcasecmp(path, "1") == 0 && moveUp) + if (utf8_case_cmp(path, "1") == 0 && moveUp) return; treePath = gtk_tree_path_new_from_string(path); @@ -395,7 +396,7 @@ void highlight_ip_profile(GtkTreeViewColumn *col UNUSED, GtkCellRenderer *rend, if (current != NULL) { // Make the first line appear differently - (g_strcasecmp(current->accountID, IP2IP) == 0) ? g_object_set(G_OBJECT(rend), "weight", PANGO_WEIGHT_THIN, + (utf8_case_cmp(current->accountID, IP2IP) == 0) ? g_object_set(G_OBJECT(rend), "weight", PANGO_WEIGHT_THIN, "style", PANGO_STYLE_ITALIC, "stretch", PANGO_STRETCH_ULTRA_EXPANDED, "scale", 0.95, @@ -421,7 +422,7 @@ void highlight_registration(GtkTreeViewColumn *col UNUSED, GtkCellRenderer *rend g_value_unset(&val); if (current != NULL) { - if (g_strcasecmp(current->accountID, IP2IP) != 0) { + if (utf8_case_cmp(current->accountID, IP2IP) != 0) { // Color the account state: green -> registered, otherwise red (current->state == ACCOUNT_STATE_REGISTERED) ? g_object_set(G_OBJECT(rend), "foreground", "Dark Green", NULL) : g_object_set(G_OBJECT(rend), "foreground", "Dark Red", NULL); diff --git a/gnome/src/config/addressbook-config.c b/gnome/src/config/addressbook-config.c index 8e9c64eb15f21c9256ca4e6be4bea2977fb4e127..fd12fc8672196ab13d9fcd1318ae7f60cf3c1e3b 100644 --- a/gnome/src/config/addressbook-config.c +++ b/gnome/src/config/addressbook-config.c @@ -29,6 +29,7 @@ */ #include "addressbook-config.h" +#include "str_utils.h" #include "dbus.h" #include "unused.h" #include "logger.h" @@ -443,13 +444,13 @@ addressbook_display(AddressBook_Config *settings, const gchar *field) { gboolean display; - if (g_strcasecmp(field, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO) == 0) + if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO) == 0) display = (settings->display_contact_photo == 1) ? TRUE : FALSE; - else if (g_strcasecmp(field, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS) == 0) + else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS) == 0) display = (settings->search_phone_business == 1) ? TRUE : FALSE; - else if (g_strcasecmp(field, ADDRESSBOOK_DISPLAY_PHONE_HOME) == 0) + else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_HOME) == 0) display = (settings->search_phone_home == 1) ? TRUE : FALSE; - else if (g_strcasecmp(field, ADDRESSBOOK_DISPLAY_PHONE_MOBILE) == 0) + else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_MOBILE) == 0) display = (settings->search_phone_mobile == 1) ? TRUE : FALSE; else display = FALSE; diff --git a/gnome/src/config/audioconf.c b/gnome/src/config/audioconf.c index 3bfbad996a4b9479bc83a2d51175d5ed662784a4..3f69218bb19dbfba1fdfea23776869d1f0052b3d 100644 --- a/gnome/src/config/audioconf.c +++ b/gnome/src/config/audioconf.c @@ -29,6 +29,7 @@ */ #include <glib/gi18n.h> +#include "str_utils.h" #include "audioconf.h" #include "utils.h" #include "logger.h" @@ -271,7 +272,7 @@ select_active_input_audio_device() void update_device_widget(gchar *pluginName) { - if (g_strcasecmp(pluginName, "default") == 0) { + if (utf8_case_cmp(pluginName, "default") == 0) { gtk_widget_set_sensitive(output, FALSE); gtk_widget_set_sensitive(input, FALSE); gtk_widget_set_sensitive(ringtone, FALSE); @@ -314,7 +315,7 @@ select_active_output_audio_plugin() do { gtk_tree_model_get(model, &iter, 0, &pluginname, -1); - if (g_strcasecmp(tmp, pluginname) == 0) { + if (utf8_case_cmp(tmp, pluginname) == 0) { // Set current iteration the active one gtk_combo_box_set_active_iter(GTK_COMBO_BOX(plugin), &iter); return; @@ -421,11 +422,11 @@ codec_active_toggled(GtkCellRendererToggle *renderer UNUSED, gchar *path, gpoint codec_t* codec; - if ((g_strcasecmp(name,"speex") == 0) && (g_strcasecmp(srate,"8 kHz") == 0)) + if ((utf8_case_cmp(name,"speex") == 0) && (utf8_case_cmp(srate,"8 kHz") == 0)) codec = codec_list_get_by_payload((gconstpointer) 110, acc->codecs); - else if ((g_strcasecmp(name,"speex") ==0) && (g_strcasecmp(srate,"16 kHz") ==0)) + else if ((utf8_case_cmp(name,"speex") ==0) && (utf8_case_cmp(srate,"16 kHz") ==0)) codec = codec_list_get_by_payload((gconstpointer) 111, acc->codecs); - else if ((g_strcasecmp(name,"speex") ==0) && (g_strcasecmp(srate,"32 kHz") ==0)) + else if ((utf8_case_cmp(name,"speex") ==0) && (utf8_case_cmp(srate,"32 kHz") ==0)) codec = codec_list_get_by_payload((gconstpointer) 112, acc->codecs); else codec = codec_list_get_by_name((gconstpointer) name, acc->codecs); diff --git a/gnome/src/config/hooks-config.c b/gnome/src/config/hooks-config.c index 8a2b419d2b4d4fbdc14a70385e2f91fdc9416f63..5a161344ac29d414e0b4fb593b12ed6600de1b29 100644 --- a/gnome/src/config/hooks-config.c +++ b/gnome/src/config/hooks-config.c @@ -29,6 +29,7 @@ */ #include <glib/gi18n.h> +#include "str_utils.h" #include "hooks-config.h" #include "dbus.h" @@ -156,7 +157,7 @@ GtkWidget* create_hooks_settings() gtk_table_attach(GTK_TABLE(table), info_bar, 0, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 10, 10); widg = gtk_check_button_new_with_mnemonic(_("Trigger on specific _SIP header")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (g_strcasecmp(_urlhook_config->sip_enabled, "true") ==0) ?TRUE:FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->sip_enabled, "true") ==0) ?TRUE:FALSE); g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(sip_enabled_cb), NULL); gtk_table_attach(GTK_TABLE(table), widg, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -165,7 +166,7 @@ GtkWidget* create_hooks_settings() gtk_table_attach(GTK_TABLE(table), field, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); widg = gtk_check_button_new_with_mnemonic(_("Trigger on _IAX2 URL")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (g_strcasecmp(_urlhook_config->iax2_enabled, "true") ==0) ?TRUE:FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->iax2_enabled, "true") ==0) ?TRUE:FALSE); g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(iax2_enabled_cb), NULL); gtk_table_attach(GTK_TABLE(table), widg, 0, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -177,14 +178,12 @@ GtkWidget* create_hooks_settings() gtk_entry_set_text(GTK_ENTRY(command), _urlhook_config->command); gtk_table_attach(GTK_TABLE(table), command, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); - - gnome_main_section_new_with_table(_("Phone number rewriting"), &frame, &table, 4, 2); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); gtk_widget_show(frame); widg = gtk_check_button_new_with_mnemonic(_("_Prefix dialed numbers with")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (g_strcasecmp(_urlhook_config->phone_number_enabled, "true") ==0) ?TRUE:FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->phone_number_enabled, "true") ==0) ?TRUE:FALSE); g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(phone_number_enabled_cb), NULL); gtk_table_attach(GTK_TABLE(table), widg, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); diff --git a/gnome/src/config/tlsadvanceddialog.c b/gnome/src/config/tlsadvanceddialog.c index 59052ea47681f2ddf8efb76469c8c3db97dea4f4..232c3a8d8938483cc8080ebb03828d792cb5f1eb 100644 --- a/gnome/src/config/tlsadvanceddialog.c +++ b/gnome/src/config/tlsadvanceddialog.c @@ -28,9 +28,10 @@ * as that of the covered work. */ -#include <tlsadvanceddialog.h> -#include <sflphone_const.h> -#include <utils.h> +#include "tlsadvanceddialog.h" +#include "str_utils.h" +#include "sflphone_const.h" +#include "utils.h" #include <dbus.h> #include <glib/gi18n.h> #include <gtk/gtk.h> @@ -237,7 +238,7 @@ void show_advanced_tls_options(GHashTable * properties) GtkWidget * tlsTimeOutSec; hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10); gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 10, 11, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - tlsTimeOutSec = gtk_spin_button_new_with_range(0, pow(2,sizeof(long)), 1); + tlsTimeOutSec = gtk_spin_button_new_with_range(0, pow(2, sizeof(long)), 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), tlsTimeOutSec); gtk_spin_button_set_value(GTK_SPIN_BUTTON(tlsTimeOutSec), g_ascii_strtod(negotiation_timeout_sec, NULL)); gtk_box_pack_start(GTK_BOX(hbox), tlsTimeOutSec, TRUE, TRUE, 0); @@ -250,19 +251,19 @@ void show_advanced_tls_options(GHashTable * properties) GtkWidget * verifyCertificateServer; verifyCertificateServer = gtk_check_button_new_with_mnemonic(_("Verify incoming certificates, as a server")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(verifyCertificateServer), - g_strcasecmp(verify_server,"true") == 0 ? TRUE: FALSE); + utf8_case_cmp(verify_server,"true") == 0); gtk_table_attach(GTK_TABLE(table), verifyCertificateServer, 0, 1, 11, 12, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); GtkWidget * verifyCertificateClient; verifyCertificateClient = gtk_check_button_new_with_mnemonic(_("Verify certificates from answer, as a client")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(verifyCertificateClient), - g_strcasecmp(verify_client,"true") == 0 ? TRUE: FALSE); + utf8_case_cmp(verify_client,"true") == 0); gtk_table_attach(GTK_TABLE(table), verifyCertificateClient, 0, 1, 12, 13, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); GtkWidget * requireCertificate; requireCertificate = gtk_check_button_new_with_mnemonic(_("Require certificate for incoming tls connections")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(requireCertificate), - g_strcasecmp(require_client_certificate,"true") == 0 ? TRUE: FALSE); + utf8_case_cmp(require_client_certificate,"true") == 0); gtk_table_attach(GTK_TABLE(table), requireCertificate, 0, 1, 13, 14, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show_all(ret); diff --git a/gnome/src/config/zrtpadvanceddialog.c b/gnome/src/config/zrtpadvanceddialog.c index fe4589b249803c8a7bedaef9ce3c79d51c6d4b3f..efb80d976356707b01d34d83fe143c9a1792b761 100644 --- a/gnome/src/config/zrtpadvanceddialog.c +++ b/gnome/src/config/zrtpadvanceddialog.c @@ -30,6 +30,7 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> +#include "str_utils.h" #include <zrtpadvanceddialog.h> #include "sflphone_const.h" #include "utils.h" @@ -42,10 +43,10 @@ void show_advanced_zrtp_options(GHashTable * properties) gboolean curDisplaySasOnce = FALSE; if (properties != NULL) { - curHelloEnabled = !g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH), "true"); - curSasConfirm = !g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS), "true"); - curZrtpNotSuppOther = !g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING), "true"); - curDisplaySasOnce = !g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE), "true"); + curHelloEnabled = !utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH), "true"); + curSasConfirm = !utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS), "true"); + curZrtpNotSuppOther = !utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING), "true"); + curDisplaySasOnce = !utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE), "true"); } GtkDialog *securityDialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("ZRTP Options"), @@ -118,7 +119,7 @@ void show_advanced_sdes_options(GHashTable * properties) gboolean rtpFallback = FALSE; if (properties != NULL) { - rtpFallback = !g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_SRTP_RTP_FALLBACK), "true"); + rtpFallback = !utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_SRTP_RTP_FALLBACK), "true"); } GtkDialog *securityDialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("SDES Options"), diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c index 4cc64dbf3875e006cacfe56a41f72ab283245150..3c00fa83bdbdff3d05b035a1ae3694718c5f9aee 100644 --- a/gnome/src/contacts/calllist.c +++ b/gnome/src/contacts/calllist.c @@ -29,6 +29,7 @@ */ #include "calllist.h" +#include "str_utils.h" #include <string.h> #include "calltab.h" #include "calltree.h" @@ -44,7 +45,7 @@ gint is_callID_callstruct(gconstpointer a, gconstpointer b) if (c == NULL || c->type != HIST_CALL) return 1; - return g_strcasecmp(c->elem.call->_callID, (const gchar *) b); + return utf8_case_cmp(c->elem.call->_callID, (const gchar *) b); } // TODO : try to do this more generically diff --git a/gnome/src/contacts/calltab.c b/gnome/src/contacts/calltab.c index fcf0d85009f6333cddaeef6884bf57bb991c2def..7ff8c1ccc55d40b487c31cfbadb6c90db0458201 100644 --- a/gnome/src/contacts/calltab.c +++ b/gnome/src/contacts/calltab.c @@ -31,6 +31,7 @@ #include "calltab.h" #include <gtk/gtk.h> #include <stdlib.h> +#include "str_utils.h" #include "calltree.h" #include "contacts/searchbar.h" #include "logger.h" @@ -97,9 +98,9 @@ calltab_create_searchbar(calltab_t* tab) { g_assert(tab); - if (g_strcasecmp(tab->_name, HISTORY) == 0) + if (utf8_case_cmp(tab->_name, HISTORY) == 0) tab->searchbar = history_searchbar_new(); - else if (g_strcasecmp(tab->_name, CONTACTS) == 0) + else if (utf8_case_cmp(tab->_name, CONTACTS) == 0) tab->searchbar = contacts_searchbar_new(); else ERROR("Current calls tab does not need a searchbar\n"); diff --git a/gnome/src/contacts/calltree.c b/gnome/src/contacts/calltree.c index ce92c7b9de6b76ee8a7c457654774f9e688b3017..d377f7031df3722e900a0b1e39fb3c88036dfed2 100644 --- a/gnome/src/contacts/calltree.c +++ b/gnome/src/contacts/calltree.c @@ -32,6 +32,7 @@ #include "calllist.h" #include "calltree.h" +#include "str_utils.h" #include <stdlib.h> #include "eel-gconf-extensions.h" @@ -290,7 +291,7 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_CONFIRMED; - if (g_strcasecmp(displaySasOnce, "true") == 0) + if (utf8_case_cmp(displaySasOnce, "true") == 0) selectedCall->_zrtp_confirmed = TRUE; dbus_confirm_sas(selectedCall); @@ -603,7 +604,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter * if (account_details != NULL) { srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED); - if (g_strcasecmp(g_hash_table_lookup(account_details->properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0) + if (utf8_case_cmp(g_hash_table_lookup(account_details->properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0) display_sas = FALSE; } else { GHashTable * properties = sflphone_get_ip2ip_properties(); @@ -611,7 +612,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter * if (properties != NULL) { srtp_enabled = g_hash_table_lookup(properties, ACCOUNT_SRTP_ENABLED); - if (g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0) + if (utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0) display_sas = FALSE; } } @@ -697,12 +698,12 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter * pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_certified.svg", NULL); break; case SRTP_STATE_UNLOCKED: - if (g_strcasecmp(srtp_enabled,"true") == 0) + if (utf8_case_cmp(srtp_enabled,"true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); break; default: WARN("Update calltree srtp state #%d- Should not happen!", c->_srtp_state); - if (g_strcasecmp(srtp_enabled, "true") == 0) + if (utf8_case_cmp(srtp_enabled, "true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); } @@ -810,7 +811,7 @@ void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) WARN("Update calltree add - Should not happen!"); } - if (srtp_enabled && g_strcasecmp(srtp_enabled, "true") == 0) + if (srtp_enabled && utf8_case_cmp(srtp_enabled, "true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/secure_off.svg", NULL); } else if (tab == contacts_tab) @@ -971,7 +972,7 @@ void calltree_add_conference_to_current_calls(conference_obj_t* conf) else srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED); - if (g_strcasecmp(srtp_enabled, "true") == 0) { + if (utf8_case_cmp(srtp_enabled, "true") == 0) { DEBUG("Calltree: SRTP enabled for participant %s", call_id); conf->_conf_srtp_enabled = TRUE; break; diff --git a/gnome/src/contacts/conferencelist.c b/gnome/src/contacts/conferencelist.c index 3d4c68f8e1f04fbc347f7653fb0e4422e39dce31..a293b268c1452b97ce8e4f550ce8465c4ddeb8a8 100644 --- a/gnome/src/contacts/conferencelist.c +++ b/gnome/src/contacts/conferencelist.c @@ -29,6 +29,7 @@ */ #include "calltab.h" +#include "str_utils.h" #include "callable_obj.h" #include "calltree.h" #include "conferencelist.h" @@ -37,7 +38,7 @@ static gint is_confID_confstruct(gconstpointer a, gconstpointer b) { conference_obj_t * c = (conference_obj_t*) a; - return g_strcasecmp(c->_confID, (const gchar*) b); + return utf8_case_cmp(c->_confID, (const gchar*) b); } void conferencelist_init(calltab_t *tab) diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 957ae5acbcc920cc506ed28bb32b2cd069cafcd8..7559cd4cf70df2e042e0406dbeddf15d36b615d9 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -31,6 +31,7 @@ */ #include "config.h" #include <glib/gi18n.h> +#include "str_utils.h" #include "logger.h" #include "calltab.h" #include "callmanager-glue.h" @@ -237,7 +238,7 @@ process_nonexisting_call_state_change(const gchar *callID, const gchar *state) GHashTable *call_details = dbus_get_call_details(callID); callable_obj_t *new_call = create_new_call_from_details(callID, call_details); - if (g_strcasecmp(g_hash_table_lookup(call_details, "CALL_TYPE"), INCOMING_STRING) == 0) + if (utf8_case_cmp(g_hash_table_lookup(call_details, "CALL_TYPE"), INCOMING_STRING) == 0) new_call->_history_state = g_strdup(INCOMING_STRING); else new_call->_history_state = g_strdup(OUTGOING_STRING); diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index e41def4b97fc6931b046416e92ad132b54266cf9..ce8d3b8140d6807af5bccca9f8029777eec3279b 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -31,6 +31,7 @@ */ #include "config.h" +#include "str_utils.h" #include "actions.h" #include "dbus.h" #include "calltree.h" @@ -47,6 +48,7 @@ #include "uimanager.h" #include "unused.h" #include "config/audioconf.h" +#include "str_utils.h" #include "eel-gconf-extensions.h" @@ -415,7 +417,7 @@ main_window_zrtp_not_supported(callable_obj_t * c) ACCOUNT_ZRTP_NOT_SUPP_WARNING); } - if (g_strcasecmp(warning_enabled, "true") == 0) { + if (utf8_case_cmp(warning_enabled, "true") == 0) { PidginMiniDialog *mini_dialog; gchar *desc = g_markup_printf_escaped( _("ZRTP is not supported by peer %s\n"), c->_peer_number); diff --git a/gnome/src/sflnotify.c b/gnome/src/sflnotify.c index 44eee7ee7ceb768dcacf8cda6244ac642b729243..773946eb06d8efb8277905de9b364bacad6cbbc4 100644 --- a/gnome/src/sflnotify.c +++ b/gnome/src/sflnotify.c @@ -31,6 +31,7 @@ #include "config.h" #include <glib.h> #include <glib/gi18n.h> +#include "str_utils.h" #include "eel-gconf-extensions.h" #include "sflnotify.h" #include "logger.h" @@ -89,7 +90,7 @@ notify_incoming_message(const gchar *callID, const gchar *msg) create_new_gnome_notification(title, (gchar *)msg, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } @@ -112,7 +113,7 @@ notify_incoming_call(callable_obj_t* c) create_new_gnome_notification(title, callerid, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } @@ -184,7 +185,7 @@ notify_secure_on(callable_obj_t* c) create_new_gnome_notification(title, callerid, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } @@ -197,7 +198,7 @@ notify_zrtp_not_supported(callable_obj_t* c) create_new_gnome_notification(title, callerid, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } @@ -210,7 +211,7 @@ notify_zrtp_negotiation_failed(callable_obj_t* c) create_new_gnome_notification(title, callerid, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } @@ -223,6 +224,6 @@ notify_secure_off(callable_obj_t* c) create_new_gnome_notification(title, callerid, NOTIFY_URGENCY_CRITICAL, - (g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); + (utf8_case_cmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER); #endif } diff --git a/gnome/src/str_utils.c b/gnome/src/str_utils.c new file mode 100644 index 0000000000000000000000000000000000000000..9e395c1efb74a5e8324059e3424b34ce51a0a456 --- /dev/null +++ b/gnome/src/str_utils.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +#include "str_utils.h" + +gint utf8_case_cmp(const gchar *a, const gchar *b) +{ + gchar *l = g_utf8_casefold(a, -1); + gchar *r = g_utf8_casefold(b, -1); + gint result = g_utf8_collate(l, r); + g_free(l); + g_free(r); + return result; +} diff --git a/gnome/src/str_utils.h b/gnome/src/str_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..b2b4bddb56655337552f51e17ce454fff7ea2245 --- /dev/null +++ b/gnome/src/str_utils.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +#ifndef STR_UTILS_H_ +#define STR_UTILS_H_ + +#include <glib.h> + +gint utf8_case_cmp(const gchar *a, const gchar *b); + +#endif /* STR_UTILS_H_ */ diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c index 0ddac4b119dfd0762e6494c15f8a386afbff0736..04ee1f5d369b77f8a771135306f4805cad15da72 100644 --- a/gnome/src/uimanager.c +++ b/gnome/src/uimanager.c @@ -29,6 +29,7 @@ */ #include "config.h" +#include "str_utils.h" #include "preferencesdialog.h" #include "logger.h" #include "dbus/dbus.h" @@ -1236,7 +1237,7 @@ add_registered_accounts_to_menu(GtkWidget *menu) account_t *acc = account_list_get_nth(i); // Display only the registered accounts - if (g_strcasecmp(account_state_name(acc->state), account_state_name( + if (utf8_case_cmp(account_state_name(acc->state), account_state_name( ACCOUNT_STATE_REGISTERED)) == 0) { gchar *alias = g_strconcat(g_hash_table_lookup(acc->properties, ACCOUNT_ALIAS), " - ", @@ -1250,7 +1251,7 @@ add_registered_accounts_to_menu(GtkWidget *menu) if (current) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items), - g_strcasecmp(acc->accountID, current->accountID) == 0); + utf8_case_cmp(acc->accountID, current->accountID) == 0); } g_signal_connect(G_OBJECT(menu_items), "activate", diff --git a/gnome/tests/Makefile.am b/gnome/tests/Makefile.am index fe5a5190ce90d15fd481aff0f6a9bc365c6fb8d1..861a254ea7e9f0c9097c1e58f42fa91ad1953b1b 100644 --- a/gnome/tests/Makefile.am +++ b/gnome/tests/Makefile.am @@ -9,7 +9,7 @@ SFLPHONE_LIBS = $(top_builddir)/src/contacts/libcontacts.la \ ########################################################### -check_global_SOURCES = check_global.c $(top_srcdir)/src/accountlist.c $(top_srcdir)/src/logger.c +check_global_SOURCES = check_global.c $(top_srcdir)/src/accountlist.c $(top_srcdir)/src/logger.c $(top_srcdir)/src/str_utils.c check_global_CFLAGS = @CHECK_CFLAGS@ @GTK_CFLAGS@ @GLIB_CFLAGS@ @DBUSGLIB_CFLAGS@ @GCONF_CFLAGS@ check_global_LDADD = $(SFLPHONE_LIBS) @CHECK_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @DBUSGLIB_LIBS@ @GCONF_LIBS@ @@ -42,7 +42,9 @@ check_dbus_SOURCES = check_dbus.c $(top_srcdir)/src/logger.c \ $(top_srcdir)/src/uimanager.c \ $(top_srcdir)/src/conference_obj.c \ $(top_srcdir)/src/shortcuts.c \ - $(top_srcdir)/src/imwindow.c + $(top_srcdir)/src/imwindow.c \ + $(top_srcdir)/src/str_utils.c + check_dbus_CFLAGS = @CHECK_CFLAGS@ @GTK_CFLAGS@ @DBUSGLIB_CFLAGS@ @GCONF_CFLAGS@ @WEBKIT_CFLAGS@ check_dbus_LDADD = $(SFLPHONE_LIBS) @CHECK_LIBS@ @GCONF_LIBS@ $(top_builddir)/src/widget/libwidget.la $(top_builddir)/src/icons/libicons.la diff --git a/gnome/tests/check_global.c b/gnome/tests/check_global.c index aa3f1bb1569f92f3a7ab1cec9b8e6c0d7219a7ca..d1e6eb37692073e024b2142459984ef361f179cc 100644 --- a/gnome/tests/check_global.c +++ b/gnome/tests/check_global.c @@ -34,6 +34,7 @@ #include "../src/accountlist.h" #include "../src/sflphone_const.h" +#include "../src/str_utils.h" account_t* create_test_account(gchar *alias) { @@ -78,7 +79,7 @@ START_TEST(test_ordered_list) account_list_init(); account_list_add(test); account_list_add(test); - fail_unless(g_strcasecmp(account_list_get_ordered_list(), list) == 0, "ERROR - BAD ACCOUNT LIST SERIALIZING"); + fail_unless(utf8_case_cmp(account_list_get_ordered_list(), list) == 0, "ERROR - BAD ACCOUNT LIST SERIALIZING"); g_free(list); } END_TEST @@ -91,7 +92,7 @@ START_TEST(test_get_by_id) account_list_init(); account_list_add(test); tmp = account_list_get_by_id(test->accountID); - fail_unless(g_strcasecmp(tmp->accountID, test->accountID) == 0, "ERROR - ACCOUNTLIST_GET_BY_ID"); + fail_unless(utf8_case_cmp(tmp->accountID, test->accountID) == 0, "ERROR - ACCOUNTLIST_GET_BY_ID"); } END_TEST @@ -109,7 +110,7 @@ START_TEST(test_get_current_account) // The current account must be the first we add if (current) { - fail_unless(g_strcasecmp(g_hash_table_lookup(current->properties, ACCOUNT_ALIAS) , + fail_unless(utf8_case_cmp(g_hash_table_lookup(current->properties, ACCOUNT_ALIAS) , g_hash_table_lookup(test->properties, ACCOUNT_ALIAS)) == 0, "ERROR - BAD CURRENT ACCOUNT"); } @@ -121,7 +122,7 @@ START_TEST(test_get_current_account) // The current account must be the first we add if (current) { - fail_unless(g_strcasecmp(g_hash_table_lookup(current->properties, ACCOUNT_ALIAS) , + fail_unless(utf8_case_cmp(g_hash_table_lookup(current->properties, ACCOUNT_ALIAS) , g_hash_table_lookup(test2->properties, ACCOUNT_ALIAS)) == 0, "ERROR - BAD CURRENT ACCOUNT"); }