changeset 2482:9b050f7e7b6c

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.
author Colin Clark <colin.clark@cclark.uk>
date Mon, 22 May 2017 13:35:40 +0100
parents 75bbd45f9c9e
children b6ae0dd3a0c9
files doc/docbook/GuideOptionsGeneral.xml src/bar_comment.c src/bar_keywords.c src/options.h src/preferences.c
diffstat 5 files changed, 66 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideOptionsGeneral.xml	Fri May 19 19:49:47 2017 +0100
+++ b/doc/docbook/GuideOptionsGeneral.xml	Mon May 22 13:35:40 2017 +0100
@@ -203,4 +203,19 @@
       </varlistentry>
     </variablelist>
   </section>
+  <section id="InfoSidebar">
+    <title>Info Sidebar component heights</title>
+    <para>
+      The heights of the following components can be set individually:
+      <itemizedlist>
+        <listitem>Keywords</listitem>
+        <listitem>Title</listitem>
+        <listitem>Comments</listitem>
+      </itemizedlist>
+    </para>
+    <note>
+      <para>Geeqie must be restarted for changes to take effect.</para>
+    </note>
+    <variablelist />
+  </section>
 </section>
--- a/src/bar_comment.c	Fri May 19 19:49:47 2017 +0100
+++ b/src/bar_comment.c	Mon May 22 13:35:40 2017 +0100
@@ -167,6 +167,15 @@
 	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_comment ");
 	write_char_option(outstr, indent, "id", pcd->pane.id);
 	write_char_option(outstr, indent, "title", gtk_label_get_text(GTK_LABEL(pcd->pane.title)));
@@ -294,6 +303,15 @@
 		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);
--- a/src/bar_keywords.c	Fri May 19 19:49:47 2017 +0100
+++ b/src/bar_keywords.c	Mon May 22 13:35:40 2017 +0100
@@ -254,6 +254,8 @@
 	pkd = g_object_get_data(G_OBJECT(pane), "pane_data");
 	if (!pkd) return;
 
+	pkd->height = options->info_keywords.height;
+
 	WRITE_NL(); WRITE_STRING("<pane_keywords ");
 	write_char_option(outstr, indent, "id", pkd->pane.id);
 	write_char_option(outstr, indent, "title", gtk_label_get_text(GTK_LABEL(pkd->pane.title)));
@@ -1448,6 +1450,7 @@
 		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);
--- a/src/options.h	Fri May 19 19:49:47 2017 +0100
+++ b/src/options.h	Mon May 22 13:35:40 2017 +0100
@@ -53,6 +53,19 @@
 	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;
--- a/src/preferences.c	Fri May 19 19:49:47 2017 +0100
+++ b/src/preferences.c	Mon May 22 13:35:40 2017 +0100
@@ -367,6 +367,10 @@
 	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 void config_tab_general(GtkWidget *notebook)
 {
 	GtkWidget *vbox;
+	GtkWidget *hbox;
 	GtkWidget *group;
 	GtkWidget *subgroup;
 	GtkWidget *button;
@@ -1468,6 +1473,18 @@
 
 	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 */