Fix #445: Info sidebar section heights
authorColin Clark <colin.clark@cclark.uk>
Mon, 22 May 2017 12:35:40 +0000 (13:35 +0100)
committerColin Clark <colin.clark@cclark.uk>
Mon, 22 May 2017 12:35:40 +0000 (13:35 +0100)
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
src/bar_comment.c
src/bar_keywords.c
src/options.h
src/preferences.c

index 92d4b68..e6dfd0e 100644 (file)
       </varlistentry>\r
     </variablelist>\r
   </section>\r
+  <section id="InfoSidebar">\r
+    <title>Info Sidebar component heights</title>\r
+    <para>\r
+      The heights of the following components can be set individually:\r
+      <itemizedlist>\r
+        <listitem>Keywords</listitem>\r
+        <listitem>Title</listitem>\r
+        <listitem>Comments</listitem>\r
+      </itemizedlist>\r
+    </para>\r
+    <note>\r
+      <para>Geeqie must be restarted for changes to take effect.</para>\r
+    </note>\r
+    <variablelist />\r
+  </section>\r
 </section>\r
index a8883c0..4377b60 100644 (file)
@@ -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_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 @@ 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);
index 96376d3..ffe486a 100644 (file)
@@ -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_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 @@ 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);
index 3905442..9fb78f8 100644 (file)
@@ -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;
index 36750f2..38fcc07 100644 (file)
@@ -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 */