diff src/bar_histogram.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 c37f36b97173
children 8cca18bce950
line wrap: on
line diff
--- a/src/bar_histogram.c	Sun Feb 22 13:29:49 2009 +0000
+++ b/src/bar_histogram.c	Sun Feb 22 15:35:37 2009 +0000
@@ -20,6 +20,7 @@
 #include "ui_menu.h"
 #include "ui_misc.h"
 #include "histogram.h"
+#include "rcfile.h"
 
 /*
  *-------------------------------------------------------------------
@@ -76,6 +77,24 @@
 	bar_pane_histogram_update(phd);
 }
 
+static void bar_pane_histogram_write_config(GtkWidget *pane, GString *outstr, gint indent)
+{
+	PaneHistogramData *phd;
+
+	phd = g_object_get_data(G_OBJECT(pane), "pane_data");
+	if (!phd) return;
+
+	write_indent(outstr, indent);
+	g_string_append_printf(outstr, "<pane_histogram\n");
+	indent++;
+	WRITE_CHAR(*phd, pane.title);
+	WRITE_BOOL(*phd, pane.expanded);
+	indent--;
+	write_indent(outstr, indent);
+	g_string_append_printf(outstr, "/>\n");
+}
+
+
 static void bar_pane_histogram_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
 	PaneHistogramData *phd = data;
@@ -131,14 +150,16 @@
 }
 
 
-GtkWidget *bar_pane_histogram_new(const gchar *title, gint height)
+GtkWidget *bar_pane_histogram_new(const gchar *title, gint height, gint expanded)
 {
 	PaneHistogramData *phd;
 
 	phd = g_new0(PaneHistogramData, 1);
 	
 	phd->pane.pane_set_fd = bar_pane_histogram_set_fd;
+	phd->pane.pane_write_config = bar_pane_histogram_write_config;
 	phd->pane.title = g_strdup(title);
+	phd->pane.expanded = expanded;
 	
 	phd->histogram = histogram_new();
 	
@@ -169,4 +190,26 @@
 	return phd->widget;
 }
 
+GtkWidget *bar_pane_histogram_new_from_config(const gchar **attribute_names, const gchar **attribute_values)
+{
+	gchar *title = g_strdup(_("NoName"));
+	gboolean expanded = TRUE;
+	gint height = 80;
+
+	while (*attribute_names)
+		{
+		const gchar *option = *attribute_names++;
+		const gchar *value = *attribute_values++;
+
+		READ_CHAR_FULL("pane.title", title);
+		READ_BOOL_FULL("pane.expanded", expanded);
+		
+
+		DEBUG_1("unknown attribute %s = %s", option, value);
+		}
+	
+	return bar_pane_histogram_new(title, height, expanded);
+}
+
+
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */