Mercurial > geeqie
changeset 1635:5ad450d67878
added mark filter to menu - now it is possible to assign hotkeys
author | nadvornik |
---|---|
date | Sat, 06 Jun 2009 22:51:55 +0000 |
parents | 53b0a8e471c8 |
children | 157ef2c48fa2 |
files | src/layout.c src/layout.h src/layout_util.c src/view_file.c src/view_file.h |
diffstat | 5 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/layout.c Sat Jun 06 19:39:46 2009 +0000 +++ b/src/layout.c Sat Jun 06 22:51:55 2009 +0000 @@ -814,6 +814,14 @@ layout_status_update_info(lw, NULL); /* osd in fullscreen mode */ } +void layout_mark_filter_toggle(LayoutWindow *lw, gint mark) +{ + if (!layout_valid(&lw)) return; + + if (lw->vf) vf_mark_filter_toggle(lw->vf, mark); +} + + /* *----------------------------------------------------------------------------- * access
--- a/src/layout.h Sat Jun 06 19:39:46 2009 +0000 +++ b/src/layout.h Sat Jun 06 22:51:55 2009 +0000 @@ -70,6 +70,8 @@ void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode); void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode); +void layout_mark_filter_toggle(LayoutWindow *lw, gint mark); + void layout_refresh(LayoutWindow *lw); void layout_thumb_set(LayoutWindow *lw, gboolean enable);
--- a/src/layout_util.c Sat Jun 06 19:39:46 2009 +0000 +++ b/src/layout_util.c Sat Jun 06 22:51:55 2009 +0000 @@ -895,6 +895,16 @@ layout_mark_to_selection(lw, mark, MTS_MODE_MINUS); } +static void layout_menu_mark_filter_toggle_cb(GtkAction *action, gpointer data) +{ + LayoutWindow *lw = data; + gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); + g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); + + layout_marks_set(lw, TRUE); + layout_mark_filter_toggle(lw, mark); +} + /* *----------------------------------------------------------------------------- @@ -1618,6 +1628,7 @@ layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, _("Add mark %d"), G_CALLBACK(layout_menu_sel_mark_or_cb)); layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, _("Intersection with mark %d"), G_CALLBACK(layout_menu_sel_mark_and_cb)); layout_actions_setup_mark(lw, mark, "UnselMark%d", _("_Unselect mark %d"), NULL, _("Unselect mark %d"), G_CALLBACK(layout_menu_sel_mark_minus_cb)); + layout_actions_setup_mark(lw, mark, "FilterMark%d", _("_Filter mark %d"), NULL, _("Filter mark %d"), G_CALLBACK(layout_menu_mark_filter_toggle_cb)); g_string_append_printf(desc, " <menu action='Mark%d'>" @@ -1629,8 +1640,10 @@ " <menuitem action='AddMark%d'/>" " <menuitem action='IntMark%d'/>" " <menuitem action='UnselMark%d'/>" + " <separator/>" + " <menuitem action='FilterMark%d'/>" " </menu>", - mark, mark, mark, mark, mark, mark, mark, mark); + mark, mark, mark, mark, mark, mark, mark, mark, mark); } g_string_append(desc,
--- a/src/view_file.c Sat Jun 06 19:39:46 2009 +0000 +++ b/src/view_file.c Sat Jun 06 22:51:55 2009 +0000 @@ -711,6 +711,13 @@ return frame; } +void vf_mark_filter_toggle(ViewFile *vf, gint mark) +{ + gint n = mark - 1; + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vf->filter_check[n]), + !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[n]))); +} + ViewFile *vf_new(FileViewType type, FileData *dir_fd) { ViewFile *vf;
--- a/src/view_file.h Sat Jun 06 19:39:46 2009 +0000 +++ b/src/view_file.h Sat Jun 06 22:51:55 2009 +0000 @@ -35,6 +35,7 @@ void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend); guint vf_marks_get_filter(ViewFile *vf); +void vf_mark_filter_toggle(ViewFile *vf, gint mark); GList *vf_pop_menu_file_list(ViewFile *vf); GtkWidget *vf_pop_menu(ViewFile *vf);