From 2ed5e0e3bd63a51decd876ea9f2143a0dc977846 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Mon, 22 May 2017 13:35:40 +0100 Subject: [PATCH] Fix #445: Info sidebar section heights https://github.com/BestImageViewer/geeqie/issues/445 Options in preferences/general to set heights of: Title Comment Keywords Restart of Geeqie required for changes to take effect. --- doc/docbook/GuideOptionsGeneral.xml | 15 +++++++++++++++ src/bar_comment.c | 18 ++++++++++++++++++ src/bar_keywords.c | 3 +++ src/options.h | 13 +++++++++++++ src/preferences.c | 17 +++++++++++++++++ 5 files changed, 66 insertions(+) diff --git a/doc/docbook/GuideOptionsGeneral.xml b/doc/docbook/GuideOptionsGeneral.xml index 92d4b686..e6dfd0ef 100644 --- a/doc/docbook/GuideOptionsGeneral.xml +++ b/doc/docbook/GuideOptionsGeneral.xml @@ -203,4 +203,19 @@ +
+ Info Sidebar component heights + + The heights of the following components can be set individually: + + Keywords + Title + Comments + + + + Geeqie must be restarted for changes to take effect. + + +
diff --git a/src/bar_comment.c b/src/bar_comment.c index a8883c0a..4377b603 100644 --- a/src/bar_comment.c +++ b/src/bar_comment.c @@ -167,6 +167,15 @@ static void bar_pane_comment_write_config(GtkWidget *pane, GString *outstr, gint pcd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pcd) return; + if (!g_strcmp0(pcd->pane.id, "title")) + { + pcd->height = options->info_title.height; + } + if (!g_strcmp0(pcd->pane.id, "comment")) + { + pcd->height = options->info_comment.height; + } + WRITE_NL(); WRITE_STRING("pane.id); write_char_option(outstr, indent, "title", gtk_label_get_text(GTK_LABEL(pcd->pane.title))); @@ -294,6 +303,15 @@ GtkWidget *bar_pane_comment_new_from_config(const gchar **attribute_names, const log_printf("unknown attribute %s = %s\n", option, value); } + if (!g_strcmp0(id, "title")) + { + options->info_title.height = height; + } + if (!g_strcmp0(id, "comment")) + { + options->info_comment.height = height; + } + bar_pane_translate_title(PANE_COMMENT, id, &title); ret = bar_pane_comment_new(id, title, key, expanded, height); g_free(title); diff --git a/src/bar_keywords.c b/src/bar_keywords.c index 96376d30..ffe486a8 100644 --- a/src/bar_keywords.c +++ b/src/bar_keywords.c @@ -254,6 +254,8 @@ static void bar_pane_keywords_write_config(GtkWidget *pane, GString *outstr, gin pkd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pkd) return; + pkd->height = options->info_keywords.height; + WRITE_NL(); WRITE_STRING("pane.id); write_char_option(outstr, indent, "title", gtk_label_get_text(GTK_LABEL(pkd->pane.title))); @@ -1448,6 +1450,7 @@ GtkWidget *bar_pane_keywords_new_from_config(const gchar **attribute_names, cons log_printf("unknown attribute %s = %s\n", option, value); } + options->info_keywords.height = height; bar_pane_translate_title(PANE_KEYWORDS, id, &title); ret = bar_pane_keywords_new(id, title, key, expanded, height); g_free(id); diff --git a/src/options.h b/src/options.h index 39054423..9fb78f83 100644 --- a/src/options.h +++ b/src/options.h @@ -53,6 +53,19 @@ struct _ConfOptions gboolean use_saved_window_positions_for_new_windows; gboolean tools_restore_state; + /* info sidebar component heights */ + struct { + gint height; + } info_comment; + + struct { + gint height; + } info_keywords; + + struct { + gint height; + } info_title; + /* file ops */ struct { gboolean enable_in_place_rename; diff --git a/src/preferences.c b/src/preferences.c index 36750f2e..38fcc07f 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -367,6 +367,10 @@ static void config_window_apply(void) options->stereo.fixed_x2 = c_options->stereo.fixed_x2; options->stereo.fixed_y2 = c_options->stereo.fixed_y2; + options->info_keywords.height = c_options->info_keywords.height; + options->info_title.height = c_options->info_title.height; + options->info_comment.height = c_options->info_comment.height; + #ifdef DEBUG set_debug_level(debug_c); #endif @@ -1414,6 +1418,7 @@ static GtkWidget *scrolled_notebook_page(GtkWidget *notebook, const gchar *title static void config_tab_general(GtkWidget *notebook) { GtkWidget *vbox; + GtkWidget *hbox; GtkWidget *group; GtkWidget *subgroup; GtkWidget *button; @@ -1468,6 +1473,18 @@ static void config_tab_general(GtkWidget *notebook) pref_checkbox_new_int(group, _("Refresh on file change"), options->update_on_time_change, &c_options->update_on_time_change); + + group = pref_group_new(vbox, FALSE, _("Info sidebar"), GTK_ORIENTATION_VERTICAL); + hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); + pref_spin_new_int(hbox, _("Keywords height:"), NULL, + 1, 9999, 1, + options->info_keywords.height, &c_options->info_keywords.height); + pref_spin_new_int(hbox, _("Title height:"), NULL, + 1, 9999, 1, + options->info_title.height, &c_options->info_title.height); + pref_spin_new_int(hbox, _("Comment height:"), NULL, + 1, 9999, 1, + options->info_comment.height, &c_options->info_comment.height); } /* image tab */ -- 2.20.1