Fix #445: Info sidebar section heights
[geeqie.git] / src / bar_keywords.c
index f58f348..ffe486a 100644 (file)
@@ -1,13 +1,22 @@
 /*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
  * Author: John Ellis
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <glib/gprintf.h>
@@ -113,6 +122,7 @@ struct _PaneKeywordsData
        guint idle_id; /* event source id */
        FileData *fd;
        gchar *key;
+       gint height;
 };
 
 typedef struct _ConfDialogData ConfDialogData;
@@ -244,11 +254,14 @@ 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)));
        WRITE_BOOL(pkd->pane, expanded);
        WRITE_CHAR(*pkd, key);
+       WRITE_INT(*pkd, height);
        WRITE_STRING("/>");
 }
 
@@ -870,14 +883,14 @@ static void bar_pane_keywords_edit_dialog(PaneKeywordsData *pkd, gboolean edit_e
        pkd->click_tpath = NULL;
        cdd->edit_existing = edit_existing;
 
-       cdd->gd = gd = generic_dialog_new(name ? _("Edit keyword") : _("Add keywords"), "keyword_edit",
+       cdd->gd = gd = generic_dialog_new(name ? _("Edit keyword") : _("New keyword"), "keyword_edit",
                                pkd->widget, TRUE,
                                bar_pane_keywords_edit_cancel_cb, cdd);
        g_signal_connect(G_OBJECT(gd->dialog), "destroy",
                         G_CALLBACK(bar_pane_keywords_edit_destroy_cb), cdd);
 
 
-       generic_dialog_add_message(gd, NULL, name ? _("Configure keyword") : _("Add keyword"), NULL);
+       generic_dialog_add_message(gd, NULL, name ? _("Configure keyword") : _("New keyword"), NULL);
 
        generic_dialog_add_button(gd, GTK_STOCK_OK, NULL,
                                  bar_pane_keywords_edit_ok_cb, TRUE);
@@ -1138,7 +1151,7 @@ static void bar_pane_keywords_menu_popup(GtkWidget *widget, PaneKeywordsData *pk
 
        menu = popup_menu_short_lived();
 
-       menu_item_add_stock(menu, _("Add keyword"), GTK_STOCK_EDIT, G_CALLBACK(bar_pane_keywords_add_dialog_cb), pkd);
+       menu_item_add_stock(menu, _("New keyword"), GTK_STOCK_EDIT, G_CALLBACK(bar_pane_keywords_add_dialog_cb), pkd);
 
        menu_item_add_divider(menu);
 
@@ -1263,7 +1276,7 @@ static void bar_pane_keywords_destroy(GtkWidget *widget, gpointer data)
 }
 
 
-static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, const gchar *key, gboolean expanded)
+static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, const gchar *key, gboolean expanded, gint height)
 {
        PaneKeywordsData *pkd;
        GtkWidget *hbox;
@@ -1285,6 +1298,7 @@ static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, con
 
        pkd->pane.expanded = expanded;
 
+       pkd->height = height;
        pkd->key = g_strdup(key);
 
        pkd->expand_checked = TRUE;
@@ -1295,6 +1309,7 @@ static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, con
        g_object_set_data(G_OBJECT(pkd->widget), "pane_data", pkd);
        g_signal_connect(G_OBJECT(pkd->widget), "destroy",
                         G_CALLBACK(bar_pane_keywords_destroy), pkd);
+       gtk_widget_set_size_request(pkd->widget, -1, height);
        gtk_widget_show(hbox);
 
        scrolled = gtk_scrolled_window_new(NULL, NULL);
@@ -1417,6 +1432,7 @@ GtkWidget *bar_pane_keywords_new_from_config(const gchar **attribute_names, cons
        gchar *title = NULL;
        gchar *key = g_strdup(COMMENT_KEY);
        gboolean expanded = TRUE;
+       gint height = 200;
        GtkWidget *ret;
 
        while (*attribute_names)
@@ -1428,13 +1444,15 @@ GtkWidget *bar_pane_keywords_new_from_config(const gchar **attribute_names, cons
                if (READ_CHAR_FULL("title", title)) continue;
                if (READ_CHAR_FULL("key", key)) continue;
                if (READ_BOOL_FULL("expanded", expanded)) continue;
+               if (READ_INT_FULL("height", height)) continue;
 
 
                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);
+       ret = bar_pane_keywords_new(id, title, key, expanded, height);
        g_free(id);
        g_free(title);
        g_free(key);