Mercurial > geeqie.yaz
changeset 1599:b8e2690c440a
expose the file grouping flag to the user
author | nadvornik |
---|---|
date | Sat, 09 May 2009 19:45:24 +0000 |
parents | 7de9a6897060 |
children | a9dae047e683 |
files | src/filedata.c src/filedata.h src/layout_util.c src/view_file.c src/view_file_icon.c src/view_file_list.c |
diffstat | 6 files changed, 62 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filedata.c Sat May 09 19:25:51 2009 +0000 +++ b/src/filedata.c Sat May 09 19:45:24 2009 +0000 @@ -670,6 +670,7 @@ void file_data_disable_grouping(FileData *fd, gboolean disable) { if (!fd->disable_grouping == !disable) return; + fd->disable_grouping = !!disable; if (disable) @@ -678,7 +679,6 @@ { FileData *parent = file_data_ref(fd->parent); file_data_disconnect_sidecar_file(parent, fd); - file_data_send_notification(fd, NOTIFY_GROUPING); file_data_send_notification(parent, NOTIFY_GROUPING); file_data_unref(parent); } @@ -693,18 +693,37 @@ file_data_disconnect_sidecar_file(fd, sfd); file_data_send_notification(sfd, NOTIFY_GROUPING); } - file_data_send_notification(fd, NOTIFY_GROUPING); file_data_check_sidecars((FileData *)sidecar_files->data, FALSE); /* this will group the sidecars back together */ filelist_free(sidecar_files); } + else + { + file_data_increment_version(fd); /* the functions called in the cases above increments the version too */ + } } else { + file_data_increment_version(fd); file_data_check_sidecars(fd, FALSE); - file_data_send_notification(fd, NOTIFY_GROUPING); + } + file_data_send_notification(fd, NOTIFY_GROUPING); +} + +void file_data_disable_grouping_list(GList *fd_list, gboolean disable) +{ + GList *work; + + work = fd_list; + while (work) + { + FileData *fd = work->data; + + file_data_disable_grouping(fd, disable); + work = work->next; } } + /* compare name without extension */ gint file_data_compare_name_without_ext(FileData *fd1, FileData *fd2) {
--- a/src/filedata.h Sat May 09 19:25:51 2009 +0000 +++ b/src/filedata.h Sat May 09 19:45:24 2009 +0000 @@ -43,6 +43,7 @@ void file_data_change_info_free(FileDataChangeInfo *fdci, FileData *fd); void file_data_disable_grouping(FileData *fd, gboolean disable); +void file_data_disable_grouping_list(GList *fd_list, gboolean disable); gint filelist_sort_compare_filedata(FileData *fa, FileData *fb); gint filelist_sort_compare_filedata_full(FileData *fa, FileData *fb, SortType method, gboolean ascend);
--- a/src/layout_util.c Sat May 09 19:25:51 2009 +0000 +++ b/src/layout_util.c Sat May 09 19:45:24 2009 +0000 @@ -300,6 +300,20 @@ file_util_delete(NULL, layout_selection_list(lw), layout_window(lw)); } +static void layout_menu_disable_grouping_cb(GtkAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + file_data_disable_grouping_list(layout_selection_list(lw), TRUE); +} + +static void layout_menu_enable_grouping_cb(GtkAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + file_data_disable_grouping_list(layout_selection_list(lw), FALSE); +} + static void layout_menu_close_cb(GtkAction *action, gpointer data) { LayoutWindow *lw = data; @@ -1178,6 +1192,8 @@ { "Delete", GTK_STOCK_DELETE, N_("_Delete..."), "<control>D", NULL, CB(layout_menu_delete_cb) }, { "DeleteAlt1",GTK_STOCK_DELETE, N_("_Delete..."), "Delete", NULL, CB(layout_menu_delete_cb) }, { "DeleteAlt2",GTK_STOCK_DELETE, N_("_Delete..."), "KP_Delete", NULL, CB(layout_menu_delete_cb) }, + { "EnableGrouping", NULL, N_("Enable file _grouping"), NULL, N_("Enable file grouping"), CB(layout_menu_enable_grouping_cb) }, + { "DisableGrouping", NULL, N_("Disable file groupi_ng"), NULL, N_("Disable file grouping"), CB(layout_menu_disable_grouping_cb) }, { "CopyPath", NULL, N_("_Copy path to clipboard"), NULL, NULL, CB(layout_menu_copy_path_cb) }, { "CloseWindow", GTK_STOCK_CLOSE,N_("C_lose window"), "<control>W", NULL, CB(layout_menu_close_cb) }, { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, CB(layout_menu_exit_cb) },
--- a/src/view_file.c Sat May 09 19:25:51 2009 +0000 +++ b/src/view_file.c Sat May 09 19:45:24 2009 +0000 @@ -374,6 +374,20 @@ file_util_copy_path_list_to_clipboard(vf_pop_menu_file_list(vf)); } +static void vf_pop_menu_enable_grouping_cb(GtkWidget *widget, gpointer data) +{ + ViewFile *vf = data; + + file_data_disable_grouping_list(vf_pop_menu_file_list(vf), FALSE); +} + +static void vf_pop_menu_disable_grouping_cb(GtkWidget *widget, gpointer data) +{ + ViewFile *vf = data; + + file_data_disable_grouping_list(vf_pop_menu_file_list(vf), TRUE); +} + static void vf_pop_menu_sort_cb(GtkWidget *widget, gpointer data) { ViewFile *vf; @@ -583,6 +597,11 @@ menu_item_add_sensitive(menu, _("_Copy path"), active, G_CALLBACK(vf_pop_menu_copy_path_cb), vf); + menu_item_add_sensitive(menu, _("Enable file _grouping"), active, + G_CALLBACK(vf_pop_menu_enable_grouping_cb), vf); + menu_item_add_sensitive(menu, _("Disable file groupi_ng"), active, + G_CALLBACK(vf_pop_menu_disable_grouping_cb), vf); + menu_item_add_divider(menu); submenu = submenu_add_sort(NULL, G_CALLBACK(vf_pop_menu_sort_cb), vf,
--- a/src/view_file_icon.c Sat May 09 19:25:51 2009 +0000 +++ b/src/view_file_icon.c Sat May 09 19:45:24 2009 +0000 @@ -2356,7 +2356,8 @@ } else { - name_sidecars = g_strdup_printf("%s%s", link, id->fd->name); + gchar *disabled_grouping = id->fd->disable_grouping ? _(" [NO GROUPING]") : ""; + name_sidecars = g_strdup_printf("%s%s%s", link, id->fd->name, disabled_grouping); } g_object_set(cell, "pixbuf", id->fd->thumb_pixbuf,
--- a/src/view_file_list.c Sat May 09 19:25:51 2009 +0000 +++ b/src/view_file_list.c Sat May 09 19:45:24 2009 +0000 @@ -799,7 +799,8 @@ } else { - name_sidecars = g_strdup_printf("%s%s", link, fd->name); + gchar *disabled_grouping = fd->disable_grouping ? _(" [NO GROUPING]") : ""; + name_sidecars = g_strdup_printf("%s%s%s", link, fd->name, disabled_grouping); } size = text_from_size(fd->size);