changeset 1343:eebb8d0cb677

give the panes more control over expander title
author nadvornik
date Sat, 28 Feb 2009 19:44:58 +0000
parents 06ec1279e33e
children 3f9be528787c
files src/bar.c src/bar.h src/bar_comment.c src/bar_exif.c src/bar_histogram.c src/bar_keywords.c
diffstat 6 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar.c	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar.c	Sat Feb 28 19:44:58 2009 +0000
@@ -230,7 +230,6 @@
 void bar_add(GtkWidget *bar, GtkWidget *pane)
 {
 	GtkWidget *expander;
-	GtkWidget *label;
 	BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
 	PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");
 
@@ -238,14 +237,17 @@
 	if (!bd) return;
 
 	expander = gtk_expander_new(pd ? pd->title : "");
+	if (pd && pd->title)
+		{
+		gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
+		gtk_widget_show(pd->title);
+		pref_label_bold(pd->title, TRUE, FALSE);
+		}
+		
 	gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);
 	
 	g_signal_connect(expander, "button_press_event", G_CALLBACK(bar_expander_menu_cb), bd); 
 	
-	label = gtk_expander_get_label_widget(GTK_EXPANDER(expander));
-//	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-	pref_label_bold(label, TRUE, FALSE);
-
 	gtk_container_add(GTK_CONTAINER(expander), pane);
 	
 	gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);
--- a/src/bar.h	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar.h	Sat Feb 28 19:44:58 2009 +0000
@@ -20,7 +20,7 @@
 	void (*pane_set_fd)(GtkWidget *pane, FileData *fd);
 	gint (*pane_event)(GtkWidget *pane, GdkEvent *event);
 	void (*pane_write_config)(GtkWidget *pane, GString *outstr, gint indent);
-	gchar *title;
+	GtkWidget *title;
 	gboolean expanded;
 	
 	GList *(*list_func)(gpointer);
--- a/src/bar_comment.c	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar_comment.c	Sat Feb 28 19:44:58 2009 +0000
@@ -153,7 +153,7 @@
 
 	WRITE_STRING("<pane_comment\n");
 	indent++;
-	WRITE_CHAR(*pcd, pane.title);
+	write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(pcd->pane.title)));
 	WRITE_BOOL(*pcd, pane.expanded);
 	WRITE_CHAR(*pcd, key);
 	WRITE_INT(*pcd, height); 
@@ -204,7 +204,6 @@
 	file_data_unregister_notify_func(bar_pane_comment_notify_cb, pcd);
 
 	file_data_unref(pcd->fd);
-	g_free(pcd->pane.title);
 	g_free(pcd->key);
 	
 
@@ -223,7 +222,7 @@
 	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.title = gtk_label_new(title);
 	pcd->pane.expanded = expanded;
 	
 	pcd->key = g_strdup(key);
--- a/src/bar_exif.c	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar_exif.c	Sat Feb 28 19:44:58 2009 +0000
@@ -291,7 +291,7 @@
 
 	WRITE_STRING("<pane_exif\n");
 	indent++;
-	WRITE_CHAR(*ped, pane.title);
+	write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(ped->pane.title)));
 	WRITE_BOOL(*ped, pane.expanded);
 	indent--;
 	WRITE_STRING("/>\n");
@@ -350,7 +350,7 @@
 
 	ped->pane.pane_set_fd = bar_pane_exif_set_fd;
 	ped->pane.pane_write_config = bar_pane_exif_write_config;
-	ped->pane.title = g_strdup(title);
+	ped->pane.title = gtk_label_new(title);
 	ped->pane.expanded = expanded;
 
 	ped->keys = g_new0(GtkWidget *, exif_len);
--- a/src/bar_histogram.c	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar_histogram.c	Sat Feb 28 19:44:58 2009 +0000
@@ -116,7 +116,7 @@
 
 	WRITE_STRING("<pane_histogram\n");
 	indent++;
-	WRITE_CHAR(*phd, pane.title);
+	write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(phd->pane.title)));
 	WRITE_BOOL(*phd, pane.expanded);
 	WRITE_INT(*phd->histogram, histogram_channel);
 	WRITE_INT(*phd->histogram, histogram_mode);
@@ -180,7 +180,6 @@
 	file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd);
 
 	file_data_unref(phd->fd);
-	g_free(phd->pane.title);
 	histogram_free(phd->histogram);
 	if (phd->pixbuf) g_object_unref(phd->pixbuf);
 
@@ -335,7 +334,7 @@
 	
 	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.title = gtk_label_new(title);
 	phd->pane.expanded = expanded;
 	phd->idle_id = -1;
 	
--- a/src/bar_keywords.c	Sat Feb 28 19:41:23 2009 +0000
+++ b/src/bar_keywords.c	Sat Feb 28 19:44:58 2009 +0000
@@ -484,7 +484,7 @@
 
 	WRITE_STRING("<pane_keywords\n");
 	indent++;
-	WRITE_CHAR(*pkd, pane.title);
+	write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(pkd->pane.title)));
 	WRITE_BOOL(*pkd, pane.expanded);
 	WRITE_CHAR(*pkd, key);
 	indent--;
@@ -728,7 +728,7 @@
 	pkd->pane.pane_set_fd = bar_pane_keywords_set_fd;
 	pkd->pane.pane_event = bar_pane_keywords_event;
 	pkd->pane.pane_write_config = bar_pane_keywords_write_config;
-	pkd->pane.title = g_strdup(title);
+	pkd->pane.title = gtk_label_new(title);
 	pkd->pane.expanded = expanded;
 
 	pkd->key = g_strdup(key);