Mercurial > geeqie
diff src/bar_comment.c @ 1309:55ea4962887a
config file format changed to XML
save and restore all layout windows
save and restore sidebar configuration
author | nadvornik |
---|---|
date | Sun, 22 Feb 2009 15:35:37 +0000 |
parents | 8c59e6e50bd8 |
children | 8cca18bce950 |
line wrap: on
line diff
--- a/src/bar_comment.c Sun Feb 22 13:29:49 2009 +0000 +++ b/src/bar_comment.c Sun Feb 22 15:35:37 2009 +0000 @@ -19,6 +19,7 @@ #include "filedata.h" #include "ui_menu.h" #include "ui_misc.h" +#include "rcfile.h" static void bar_pane_comment_changed(GtkTextBuffer *buffer, gpointer data); @@ -38,6 +39,7 @@ GtkWidget *comment_view; FileData *fd; gchar *key; + gint height; }; @@ -130,7 +132,7 @@ bar_pane_comment_update(pcd); } -gint bar_pane_comment_event(GtkWidget *bar, GdkEvent *event) +static gint bar_pane_comment_event(GtkWidget *bar, GdkEvent *event) { PaneCommentData *pcd; @@ -142,6 +144,25 @@ return FALSE; } +static void bar_pane_comment_write_config(GtkWidget *pane, GString *outstr, gint indent) +{ + PaneCommentData *pcd; + + pcd = g_object_get_data(G_OBJECT(pane), "pane_data"); + if (!pcd) return; + + write_indent(outstr, indent); + g_string_append_printf(outstr, "<pane_comment\n"); + indent++; + WRITE_CHAR(*pcd, pane.title); + WRITE_BOOL(*pcd, pane.expanded); + WRITE_CHAR(*pcd, key); + WRITE_INT(*pcd, height); + indent--; + write_indent(outstr, indent); + g_string_append_printf(outstr, "/>\n"); +} + static void bar_pane_comment_notify_cb(FileData *fd, NotifyType type, gpointer data) { PaneCommentData *pcd = data; @@ -193,7 +214,7 @@ } -GtkWidget *bar_pane_comment_new(const gchar *title, const gchar *key, gint height) +GtkWidget *bar_pane_comment_new(const gchar *title, const gchar *key, gboolean expanded, gint height) { PaneCommentData *pcd; GtkWidget *scrolled; @@ -203,9 +224,12 @@ pcd->pane.pane_set_fd = bar_pane_comment_set_fd; pcd->pane.pane_event = bar_pane_comment_event; + pcd->pane.pane_write_config = bar_pane_comment_write_config; pcd->pane.title = g_strdup(title); + pcd->pane.expanded = expanded; pcd->key = g_strdup(key); + pcd->height = height; scrolled = gtk_scrolled_window_new(NULL, NULL); @@ -237,4 +261,28 @@ return pcd->widget; } +GtkWidget *bar_pane_comment_new_from_config(const gchar **attribute_names, const gchar **attribute_values) +{ + gchar *title = g_strdup(_("NoName")); + gchar *key = g_strdup(COMMENT_KEY); + gboolean expanded = TRUE; + gint height = 50; + + while (*attribute_names) + { + const gchar *option = *attribute_names++; + const gchar *value = *attribute_values++; + + READ_CHAR_FULL("pane.title", title); + READ_CHAR_FULL("key", key); + READ_BOOL_FULL("pane.expanded", expanded); + READ_INT_FULL("height", height); + + + DEBUG_1("unknown attribute %s = %s", option, value); + } + + return bar_pane_comment_new(title, key, expanded, height); +} + /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */