Fix #878: Use binary units for sizes, not decimal values
[geeqie.git] / src / ui_fileops.c
index 722fdf8..a721b21 100644 (file)
@@ -178,7 +178,7 @@ gchar *path_from_utf8(const gchar *utf8)
                }
        if (!path)
                {
-               /* if invalid UTF-8, text probaby still in original form, so just copy it */
+               /* if invalid UTF-8, text probably still in original form, so just copy it */
                path = g_strdup(utf8);
                }
 
@@ -302,6 +302,24 @@ const gchar *get_trash_dir(void)
        return trash_dir;
 }
 
+const gchar *get_window_layouts_dir(void)
+{
+       static gchar *window_layouts_dir = NULL;
+
+       if (window_layouts_dir) return window_layouts_dir;
+
+       if (USE_XDG)
+               {
+               window_layouts_dir = g_build_filename(xdg_config_home_get(), GQ_APPNAME_LC, GQ_WINDOW_LAYOUTS_DIR, NULL);
+               }
+       else
+               {
+               window_layouts_dir = g_build_filename(get_rc_dir(), GQ_WINDOW_LAYOUTS_DIR, NULL);
+               }
+
+       return window_layouts_dir;
+}
+
 gboolean stat_utf8(const gchar *s, struct stat *st)
 {
        gchar *sl;
@@ -715,9 +733,14 @@ gchar *get_current_dir(void)
        return path8;
 }
 
+void list_free_wrapper(void *data, void *userdata)
+{
+       g_free(data);
+}
+
 void string_list_free(GList *list)
 {
-       g_list_foreach(list, (GFunc)g_free, NULL);
+       g_list_foreach(list, (GFunc)list_free_wrapper, NULL);
        g_list_free(list);
 }
 
@@ -864,7 +887,7 @@ void parse_out_relatives(gchar *path)
                {
                if (path[s] == G_DIR_SEPARATOR && path[s+1] == '.')
                        {
-                       /* /. occurence, let's see more */
+                       /* /. occurrence, let's see more */
                        gint p = s + 2;
 
                        if (path[p] == G_DIR_SEPARATOR || path[p] == '\0')
@@ -1042,15 +1065,14 @@ static void web_file_progress_cb(goffset current_num_bytes, goffset total_num_by
                }
 }
 
-static void timezone_cancel_button_cb(GenericDialog *gd, gpointer data)
+static void download_web_file_cancel_button_cb(GenericDialog *gd, gpointer data)
 {
        WebData* web = data;
-       GError *error = NULL;
 
        g_cancellable_cancel(web->cancellable);
 }
 
-gboolean download_web_file(const gchar *text, gpointer data)
+gboolean download_web_file(const gchar *text, gboolean minimized, gpointer data)
 {
        gchar *scheme;
        LayoutWindow *lw = data;
@@ -1087,7 +1109,7 @@ gboolean download_web_file(const gchar *text, gpointer data)
                                base = g_strdup(g_file_get_basename(web->web_file));
                                web->tmp_g_file = g_file_new_for_path(g_build_filename(tmp_dir, base, NULL));
 
-                               web->gd = generic_dialog_new(_("Download web file"), "download_web_file", NULL, TRUE, timezone_cancel_button_cb, web);
+                               web->gd = generic_dialog_new(_("Download web file"), "download_web_file", NULL, TRUE, download_web_file_cancel_button_cb, web);
 
                                message = g_strconcat(_("Downloading "), base, NULL);
                                generic_dialog_add_message(web->gd, GTK_STOCK_DIALOG_INFO, message, NULL, FALSE);
@@ -1095,6 +1117,10 @@ gboolean download_web_file(const gchar *text, gpointer data)
                                web->progress = gtk_progress_bar_new();
                                gtk_box_pack_start(GTK_BOX(web->gd->vbox), web->progress, FALSE, FALSE, 0);
                                gtk_widget_show(web->progress);
+                               if (minimized)
+                                       {
+                                       gtk_window_iconify(GTK_WINDOW(web->gd->dialog));
+                                       }
 
                                gtk_widget_show(web->gd->dialog);
                                web->cancellable = g_cancellable_new();
@@ -1113,5 +1139,6 @@ gboolean download_web_file(const gchar *text, gpointer data)
 
        g_free(scheme);
        return ret;
+
 }
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */