more sanitizing of translatable strings
[claws.git] / src / main.c
index 6d0a1c010ab9177883509666cc16f4a40f42c0e1..9368487f8945af91fb574cc801d80f841565a134 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -629,7 +629,7 @@ static void sc_session_manager_connect(MainWindow *mainwin)
                                256, error_string_ret);
 
                if (error_string_ret[0] || mainwin->smc_conn == NULL)
-                       g_warning ("While connecting to session manager:\n%s.",
+                       g_warning ("While connecting to session manager: %s.",
                                error_string_ret);
                else {
                        SmPropValue *vals;
@@ -934,14 +934,14 @@ static void install_dbus_status_handler(void)
                        "com.google.code.Awn");
        dbus_item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, dbus_status_update_item_hook, NULL);
        if (dbus_item_hook_id == -1) {
-               g_warning(_("Failed to register folder item update hook"));
+               g_warning("Failed to register folder item update hook");
                uninstall_dbus_status_handler();
                return;
        }
 
        dbus_folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, dbus_status_update_folder_hook, NULL);
        if (dbus_folder_hook_id == -1) {
-               g_warning(_("Failed to register folder update hook"));
+               g_warning("Failed to register folder update hook");
                uninstall_dbus_status_handler();
                return;
        }
@@ -1133,13 +1133,16 @@ int main(int argc, char *argv[])
                 * and migration succeeded, and FALSE otherwise.
                 */
                if (is_dir_exist(OLD_GTK2_RC_DIR)) {
-                       r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR, _("Sylpheed-Claws 2.6.0 (or older)"));
+                       r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR,
+                                              g_strconcat("Sylpheed-Claws 2.6.0 ", _("(or older)"), NULL));
                        asked_for_migration = TRUE;
                } else if (is_dir_exist(OLDER_GTK2_RC_DIR)) {
-                       r = migrate_old_config(OLDER_GTK2_RC_DIR, RC_DIR, _("Sylpheed-Claws 1.9.15 (or older)"));
+                       r = migrate_old_config(OLDER_GTK2_RC_DIR, RC_DIR,
+                                              g_strconcat("Sylpheed-Claws 1.9.15 ",_("(or older)"), NULL));
                        asked_for_migration = TRUE;
                } else if (is_dir_exist(OLD_GTK1_RC_DIR)) {
-                       r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR, _("Sylpheed-Claws 1.0.5 (or older)"));
+                       r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR,
+                                              g_strconcat("Sylpheed-Claws 1.0.5 ",_("(or older)"), NULL));
                        asked_for_migration = TRUE;
                } else if (is_dir_exist(SYLPHEED_RC_DIR)) {
                        r = migrate_old_config(SYLPHEED_RC_DIR, RC_DIR, "Sylpheed");
@@ -1754,11 +1757,7 @@ static GString * parse_cmd_compose_from_file(const gchar *fn)
                        g_string_append_c(headers, '&');
                        g_string_append(headers, tmp);
                        g_string_append_c(headers, '=');
-#if GLIB_CHECK_VERSION(2,16,0)
                        g_string_append_uri_escaped(headers, v, NULL, TRUE);
-#else
-                       G_STRING_APPEND_ENCODED_URI(headers, v);
-#endif 
                }
                g_free(tmp);
        }
@@ -1768,11 +1767,7 @@ static GString * parse_cmd_compose_from_file(const gchar *fn)
        g_free(to);
        g_string_append(body, "?body=");
        while (fgets(fb, sizeof(fb), fp)) {
-#if GLIB_CHECK_VERSION(2,16,0)
                g_string_append_uri_escaped(body, fb, NULL, TRUE);
-#else
-               G_STRING_APPEND_ENCODED_URI(body, fb);
-#endif
        }
        if (!isstdin)
                fclose(fp);
@@ -2148,7 +2143,7 @@ gchar *claws_get_socket_name(void)
        gchar md5sum[33];
 
        if (filename == NULL) {
-               struct stat st;
+               GStatBuf st;
                gint stat_ok;
 
                socket_dir = g_strdup_printf("%s%cclaws-mail-%d",
@@ -2158,10 +2153,10 @@ gchar *claws_get_socket_name(void)
 #else
                                           0);
 #endif
-               stat_ok = stat(socket_dir, &st);
+               stat_ok = g_stat(socket_dir, &st);
                if (stat_ok < 0 && errno != ENOENT) {
                        g_print("Error stat'ing socket_dir %s: %s\n",
-                               socket_dir, strerror(errno));
+                               socket_dir, g_strerror(errno));
                } else if (stat_ok == 0 && S_ISSOCK(st.st_mode)) {
                        /* old versions used a sock in $TMPDIR/claws-mail-$UID */
                        debug_print("Using legacy socket %s\n", socket_dir);
@@ -2171,7 +2166,7 @@ gchar *claws_get_socket_name(void)
 
                if (!is_dir_exist(socket_dir) && make_dir(socket_dir) < 0) {
                        g_print("Error creating socket_dir %s: %s\n",
-                               socket_dir, strerror(errno));
+                               socket_dir, g_strerror(errno));
                }
 
                md5_hex_digest(md5sum, get_rc_dir());
@@ -2229,13 +2224,13 @@ static gint prohibit_duplicate_launch(void)
                lock_fd = g_open(socket_lock, O_RDWR|O_CREAT, 0);
                if (lock_fd < 0) {
                        debug_print("Couldn't open %s: %s (%d)\n", socket_lock,
-                               strerror(errno), errno);
+                               g_strerror(errno), errno);
                        g_free(socket_lock);
                        return -1;
                }
                if (flock(lock_fd, LOCK_EX) < 0) {
                        debug_print("Couldn't lock %s: %s (%d)\n", socket_lock,
-                               strerror(errno), errno);
+                               g_strerror(errno), errno);
                        close(lock_fd);
                        g_free(socket_lock);
                        return -1;
@@ -2452,7 +2447,7 @@ static GPtrArray *get_folder_item_list(gint sock)
                if (item) {
                        g_ptr_array_add(folders, item);
                } else {
-                       g_warning("no such folder: %s\n", buf);
+                       g_warning("no such folder: %s", buf);
                }
        }
 
@@ -2798,7 +2793,7 @@ static void install_memory_sighandler()
        mem_notify_fd = g_open("/dev/mem_notify", O_RDONLY|O_NONBLOCK, 0);
        if (mem_notify_fd == -1) {
                debug_print("/dev/mem_notify not available (%s)\n", 
-                       strerror(errno));
+                       g_strerror(errno));
                return;
        }
        
@@ -2838,10 +2833,9 @@ static void networkmanager_state_change_cb(DBusGProxy *proxy, gchar *dev,
                return;
 
        if (mainWin) {
-               GError *error;
+               GError *error = NULL;
                gboolean online;
 
-               error = NULL;           
                online = networkmanager_is_online(&error);
                if(!error) {
                        if(online && went_offline_nm) {