Mercurial > geeqie.yaz
changeset 1387:6f31fa931d3f
simplified bar interface
author | nadvornik |
---|---|
date | Fri, 06 Mar 2009 15:52:47 +0000 |
parents | 4da6d326919c |
children | 2496a345c452 |
files | src/bar.c src/bar.h src/bar_comment.c src/bar_exif.c src/bar_histogram.c src/bar_keywords.c src/layout_util.c src/rcfile.c |
diffstat | 8 files changed, 31 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar.c Fri Mar 06 15:52:47 2009 +0000 @@ -42,8 +42,7 @@ FileData *fd; GtkWidget *label_file_name; - GList *(*list_func)(gpointer); - gpointer list_data; + LayoutWindow *lw; gint width; }; @@ -187,42 +186,6 @@ } -void bar_pane_set_selection_func(GtkWidget *pane, GList *(*list_func)(gpointer data), gpointer data) -{ - PaneData *pd; - - pd = g_object_get_data(G_OBJECT(pane), "pane_data"); - if (!pd) return; - - pd->list_func = list_func; - pd->list_data = data; -} - -void bar_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data) -{ - BarData *bd; - GList *list, *work; - bd = g_object_get_data(G_OBJECT(bar), "bar_data"); - if (!bd) return; - - bd->list_func = list_func; - bd->list_data = data; - - list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); - - work = list; - while (work) - { - GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data)); - - bar_pane_set_selection_func(widget, list_func, data); - - work = work->next; - } - g_list_free(list); - return; -} - void bar_add(GtkWidget *bar, GtkWidget *pane) { GtkWidget *expander; @@ -232,12 +195,14 @@ if (!bd) return; + pd->lw = bd->lw; + pd->bar = bar; + expander = gtk_expander_new(NULL); if (pd && pd->title) { gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title); gtk_widget_show(pd->title); - pref_label_bold(pd->title, TRUE, FALSE); } gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0); @@ -250,7 +215,6 @@ gtk_widget_show(expander); - if (bd->list_func) bar_pane_set_selection_func(pane, bd->list_func, bd->list_data); if (bd->fd && pd && pd->pane_set_fd) pd->pane_set_fd(pane, bd->fd); } @@ -306,17 +270,16 @@ g_free(bd); } -GtkWidget *bar_new(GtkWidget *bounding_widget) +GtkWidget *bar_new(LayoutWindow *lw) { BarData *bd; GtkWidget *box; - GtkWidget *sizer; - GtkWidget *button; - GtkWidget *arrow; GtkWidget *scrolled; bd = g_new0(BarData, 1); + bd->lw = lw; + bd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP); g_object_set_data(G_OBJECT(bd->widget), "bar_data", bd); g_signal_connect(G_OBJECT(bd->widget), "destroy", @@ -356,9 +319,9 @@ return bd->widget; } -GtkWidget *bar_new_default(GtkWidget *bounding_widget) +GtkWidget *bar_new_default(LayoutWindow *lw) { - GtkWidget *bar = bar_new(bounding_widget); + GtkWidget *bar = bar_new(lw); bar_populate_default(bar); @@ -367,9 +330,9 @@ return bar; } -GtkWidget *bar_new_from_config(GtkWidget *bounding_widget, const gchar **attribute_names, const gchar **attribute_values) +GtkWidget *bar_new_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values) { - GtkWidget *bar = bar_new(bounding_widget); + GtkWidget *bar = bar_new(lw); gboolean enabled = TRUE; gint width = SIDEBAR_DEFAULT_WIDTH;
--- a/src/bar.h Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar.h Fri Mar 06 15:52:47 2009 +0000 @@ -17,22 +17,23 @@ typedef struct _PaneData PaneData; struct _PaneData { + /* filled in by pane */ void (*pane_set_fd)(GtkWidget *pane, FileData *fd); gint (*pane_event)(GtkWidget *pane, GdkEvent *event); void (*pane_write_config)(GtkWidget *pane, GString *outstr, gint indent); GtkWidget *title; gboolean expanded; - GList *(*list_func)(gpointer); - gpointer list_data; - + /* filled in by bar */ + GtkWidget *bar; + LayoutWindow *lw; }; -GtkWidget *bar_new(GtkWidget *bounding_widget); -GtkWidget *bar_new_default(GtkWidget *bounding_widget); -GtkWidget *bar_new_from_config(GtkWidget *bounding_widget, const gchar **attribute_names, const gchar **attribute_values); +GtkWidget *bar_new(LayoutWindow *lw); +GtkWidget *bar_new_default(LayoutWindow *lw); +GtkWidget *bar_new_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values); void bar_close(GtkWidget *bar); @@ -44,11 +45,7 @@ void bar_set_fd(GtkWidget *bar, FileData *fd); gint bar_event(GtkWidget *bar, GdkEvent *event); -void bar_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data); gint bar_get_width(GtkWidget *bar); -/* following functions are common for all panes */ -void bar_pane_set_selection_func(GtkWidget *pane, GList *(*list_func)(gpointer data), gpointer data); - #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/bar_comment.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar_comment.c Fri Mar 06 15:52:47 2009 +0000 @@ -20,6 +20,7 @@ #include "ui_menu.h" #include "ui_misc.h" #include "rcfile.h" +#include "layout.h" static void bar_pane_comment_changed(GtkTextBuffer *buffer, gpointer data); @@ -79,11 +80,9 @@ GList *work; gchar *comment = NULL; - if (!pcd->pane.list_func) return; - comment = text_widget_text_pull(pcd->comment_view); - list = pcd->pane.list_func(pcd->pane.list_data); + list = layout_selection_list(pcd->pane.lw); work = list; while (work) { @@ -223,6 +222,8 @@ pcd->pane.pane_event = bar_pane_comment_event; pcd->pane.pane_write_config = bar_pane_comment_write_config; pcd->pane.title = gtk_label_new(title); + pref_label_bold(pcd->pane.title, TRUE, FALSE); + pcd->pane.expanded = expanded; pcd->key = g_strdup(key);
--- a/src/bar_exif.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar_exif.c Fri Mar 06 15:52:47 2009 +0000 @@ -623,6 +623,7 @@ ped->pane.pane_set_fd = bar_pane_exif_set_fd; ped->pane.pane_write_config = bar_pane_exif_write_config; ped->pane.title = gtk_label_new(title); + pref_label_bold(ped->pane.title, TRUE, FALSE); ped->pane.expanded = expanded; ped->size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
--- a/src/bar_histogram.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar_histogram.c Fri Mar 06 15:52:47 2009 +0000 @@ -334,6 +334,8 @@ phd->pane.pane_set_fd = bar_pane_histogram_set_fd; phd->pane.pane_write_config = bar_pane_histogram_write_config; phd->pane.title = gtk_label_new(title); + pref_label_bold(phd->pane.title, TRUE, FALSE); + phd->pane.expanded = expanded; phd->idle_id = -1;
--- a/src/bar_keywords.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/bar_keywords.c Fri Mar 06 15:52:47 2009 +0000 @@ -26,6 +26,7 @@ #include "bar.h" #include "ui_menu.h" #include "rcfile.h" +#include "layout.h" static const gchar *keyword_favorite_defaults[] = { N_("Favorite"), @@ -561,11 +562,9 @@ GList *list = NULL; GList *work; - if (!pkd->pane.list_func) return; - keywords = keyword_list_pull(pkd->keyword_view); - list = pkd->pane.list_func(pkd->pane.list_data); + list = layout_selection_list(pkd->pane.lw); work = list; while (work) { @@ -729,6 +728,8 @@ pkd->pane.pane_event = bar_pane_keywords_event; pkd->pane.pane_write_config = bar_pane_keywords_write_config; pkd->pane.title = gtk_label_new(title); + pref_label_bold(pkd->pane.title, TRUE, FALSE); + pkd->pane.expanded = expanded; pkd->key = g_strdup(key);
--- a/src/layout_util.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/layout_util.c Fri Mar 06 15:52:47 2009 +0000 @@ -1954,20 +1954,13 @@ */ } -static GList *layout_bar_list_cb(gpointer data) -{ - LayoutWindow *lw = data; - - return layout_selection_list(lw); -} - static void layout_bar_set_default(LayoutWindow *lw) { GtkWidget *bar; if (!lw->utility_box) return; - bar = bar_new_default(lw->utility_box); + bar = bar_new_default(lw); layout_bar_set(lw, bar); } @@ -1991,7 +1984,6 @@ if (!bar) return; lw->bar = bar; - bar_set_selection_func(lw->bar, layout_bar_list_cb, lw); g_signal_connect(G_OBJECT(lw->bar), "destroy", G_CALLBACK(layout_bar_destroyed), lw);
--- a/src/rcfile.c Fri Mar 06 15:04:35 2009 +0000 +++ b/src/rcfile.c Fri Mar 06 15:52:47 2009 +0000 @@ -913,7 +913,7 @@ LayoutWindow *lw = data; if (g_ascii_strcasecmp(element_name, "bar") == 0) { - GtkWidget *bar = bar_new_from_config(lw->utility_box, attribute_names, attribute_values); + GtkWidget *bar = bar_new_from_config(lw, attribute_names, attribute_values); layout_bar_set(lw, bar); options_parse_func_push(parser_data, options_parse_bar, NULL, lw->bar); }