Trim trailing white spaces on empty lines.
[geeqie.git] / src / bar_sort.c
index 32599c2..15cda8c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Geeqie
  * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
@@ -67,7 +67,7 @@ struct _SortData
        SortModeType mode;
        SortActionType action;
        gchar *filter_key;
-       
+
        SortSelectionType selection;
 
        GtkWidget *folder_group;
@@ -99,7 +99,7 @@ static void bar_sort_collection_list_build(GtkWidget *bookmarks)
        history_list_free_key(SORT_KEY_COLLECTIONS);
        bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS);
 
-       dir_fd = file_data_new_simple(get_collections_dir());
+       dir_fd = file_data_new_dir(get_collections_dir());
        filelist_read(dir_fd, &list, NULL);
        file_data_unref(dir_fd);
 
@@ -205,18 +205,18 @@ static void bar_sort_undo_folder(SortData *sd, GtkWidget *button)
                        GList *list;
                        gchar *src_dir;
 
-                       list = g_list_append(NULL, file_data_new_simple(sd->undo_dest));
+                       list = g_list_append(NULL, file_data_new_group(sd->undo_dest));
                        src_dir = remove_level_from_path(sd->undo_src);
                        file_util_move_simple(list, src_dir, sd->lw->window);
                        g_free(src_dir);
                        }
                        break;
                case BAR_SORT_COPY:
-                       file_util_delete(file_data_new_simple(sd->undo_dest), NULL, button);
+                       file_util_delete(file_data_new_group(sd->undo_dest), NULL, button);
                        break;
                default:
                        /* undo external command */
-                       file_util_delete(file_data_new_simple(sd->undo_dest), NULL, button);
+                       file_util_delete(file_data_new_group(sd->undo_dest), NULL, button);
                        break;
                }
 
@@ -224,7 +224,7 @@ static void bar_sort_undo_folder(SortData *sd, GtkWidget *button)
 
        if (isfile(sd->undo_src))
                {
-               layout_image_set_fd(sd->lw, file_data_new_simple(sd->undo_src));
+               layout_image_set_fd(sd->lw, file_data_new_group(sd->undo_src));
                }
 
        bar_sort_undo_set(sd, NULL, NULL, NULL);
@@ -241,7 +241,7 @@ static void bar_sort_undo_collection(SortData *sd)
 
                source = work->data;
                work = work->next;
-               collect_manager_remove(file_data_new_simple(source), sd->undo_dest);
+               collect_manager_remove(file_data_new_group(source), sd->undo_dest);
                }
 
        bar_sort_undo_set(sd, NULL, NULL, NULL);
@@ -579,12 +579,12 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
        sd->lw = lw;
 
        sd->action = action;
-       
+
        if (sd->action == BAR_SORT_FILTER && (!filter_key || !filter_key[0]))
                {
                sd->action = BAR_SORT_COPY;
                }
-       
+
        sd->selection = selection;
        sd->undo_src = NULL;
        sd->undo_dest = NULL;
@@ -599,12 +599,12 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
        gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0);
        gtk_widget_show(label);
 
-       combo = gtk_combo_box_new_text();
+       combo = gtk_combo_box_text_new();
        gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0);
        gtk_widget_show(combo);
 
-       gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
-       gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections"));
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders"));
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Collections"));
 
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(bar_sort_mode_cb), sd);
@@ -630,9 +630,9 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
                gboolean select = FALSE;
 
                work = work->next;
-                       
+
                if (!editor_is_filter(editor->key)) continue;
-               
+
                key = g_strdup(editor->key);
                if (sd->action == BAR_SORT_FILTER && strcmp(key, filter_key) == 0)
                        {
@@ -640,7 +640,7 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
                        select = TRUE;
                        have_filter = TRUE;
                        }
-               
+
                button = pref_radiobutton_new(sd->folder_group, buttongrp,
                                              editor->name, select,
                                              G_CALLBACK(bar_sort_set_filter_cb), sd);
@@ -648,7 +648,7 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
                g_object_set_data_full(G_OBJECT(button), "filter_key", key, bar_sort_edit_button_free);
                }
        g_list_free(editors_list);
-       
+
        if (sd->action == BAR_SORT_FILTER && !have_filter) sd->action = BAR_SORT_COPY;
 
        sd->collection_group = pref_box_new(sd->vbox, FALSE, GTK_ORIENTATION_VERTICAL, 0);
@@ -683,7 +683,7 @@ static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action,
 GtkWidget *bar_sort_new_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values)
 {
        GtkWidget *bar;
-       
+
        gboolean enabled = TRUE;
        gint action = 0;
        gint mode = 0;
@@ -701,7 +701,7 @@ GtkWidget *bar_sort_new_from_config(LayoutWindow *lw, const gchar **attribute_na
                if (READ_INT_CLAMP_FULL("selection", selection, 0, BAR_SORT_SELECTION_COUNT - 1)) continue;
                if (READ_CHAR_FULL("filter_key", filter_key)) continue;
 
-               DEBUG_1("unknown attribute %s = %s", option, value);
+               log_printf("unknown attribute %s = %s\n", option, value);
                }
        bar = bar_sort_new(lw, action, mode, selection, filter_key);
 
@@ -723,15 +723,13 @@ void bar_sort_write_config(GtkWidget *bar, GString *outstr, gint indent)
        sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data");
        if (!sd) return;
 
-       WRITE_STRING("<bar_sort\n");
-       indent++;
-       write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
+       WRITE_NL(); WRITE_STRING("<bar_sort ");
+       write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
        WRITE_INT(*sd, mode);
        WRITE_INT(*sd, action);
        WRITE_INT(*sd, selection);
        WRITE_CHAR(*sd, filter_key);
-       indent--;
-       WRITE_STRING("/>\n");
+       WRITE_STRING("/>");
 }