[Gtranslator-devel] [patch] Hide the message table pane



Hi,

The attached patch removes the horizontal pane when the messages table
is disabled from preferences (it also fixes a failed assert from
gtk_scrolled_window_add()).

OK to commit?


-dan
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtranslator/src/ChangeLog,v
retrieving revision 1.909
diff -u -r1.909 ChangeLog
--- ChangeLog	11 Jan 2004 14:30:47 -0000	1.909
+++ ChangeLog	11 Jan 2004 21:08:16 -0000
@@ -1,5 +1,9 @@
 2004-01-11  Dan Damian  <dand gnome ro>
 
+	* gui.c (gtranslator_create_main_window): Completely hide the
+	panel when messages table is hidden from preferences (also fixes
+	a failed assert).
+
 	* languages.c (languages): Added mailing list for Romanian.
 
 2004-01-09  Dan Damian  <dand gnome ro>
Index: gui.c
===================================================================
RCS file: /cvs/gnome/gtranslator/src/gui.c,v
retrieving revision 1.223
diff -u -r1.223 gui.c
--- gui.c	2 Oct 2003 17:36:58 -0000	1.223
+++ gui.c	11 Jan 2004 21:08:16 -0000
@@ -152,32 +152,15 @@
 	 * Create all the panes we're using later on.
 	 */
 	content_pane=gtk_vpaned_new();
-	table_pane=gtk_hpaned_new();
 	
-
 	if(GtrPreferences.show_messages_table)
 	{
 		gtranslator_messages_table=gtranslator_messages_table_new();
-	}
-	else
-	{
-		/*
-		 * Foo, foo, woo, foo -- really not the right way to do this.
-		 */
-		gtranslator_messages_table=gtk_label_new("");
-	}
-
-	if(GtrPreferences.show_messages_table)
-	{
 		table_pane_position=gtranslator_config_get_int(
 			"interface/table_pane_position");
-
+		table_pane=gtk_hpaned_new();
 		gtk_paned_set_position(GTK_PANED(table_pane), table_pane_position);
 	}
-	else
-	{
-		gtk_paned_set_position(GTK_PANED(table_pane), -1);
-	}
 	
 	extra_content_view=g_new0(GtrExtraContentArea, 1);
 	
@@ -228,13 +211,19 @@
 			TRUE, FALSE);
 	gtk_paned_pack2(GTK_PANED(content_pane), vertical_box, FALSE, TRUE);
 
-	messages_table_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-	gtk_container_add(GTK_CONTAINER(messages_table_scrolled_window), gtranslator_messages_table);
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messages_table_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-	gtk_paned_pack1(GTK_PANED(table_pane), messages_table_scrolled_window, FALSE, TRUE);
-	gtk_paned_pack2(GTK_PANED(table_pane), content_pane, FALSE, TRUE);
+	if(GtrPreferences.show_messages_table)
+	{
+		messages_table_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+		gtk_container_add(GTK_CONTAINER(messages_table_scrolled_window), gtranslator_messages_table);
+		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messages_table_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+		
+		gtk_paned_pack1(GTK_PANED(table_pane), messages_table_scrolled_window, FALSE, TRUE);
+		gtk_paned_pack2(GTK_PANED(table_pane), content_pane, FALSE, TRUE);
 	
-	gnome_app_set_contents(GNOME_APP(gtranslator_application), table_pane);
+		gnome_app_set_contents(GNOME_APP(gtranslator_application), table_pane);
+	} else {
+		gnome_app_set_contents(GNOME_APP(gtranslator_application), content_pane);
+	}
 
 	original_text_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
 	gtk_box_pack_start(GTK_BOX(vertical_box), original_text_scrolled_window, TRUE, TRUE, 0);
@@ -377,15 +366,18 @@
 
 	gtranslator_file_close(NULL, NULL);
 
-	/*
-	 * Get the EPaned's position offset.
-	 */
-	table_pane_position=gtk_paned_get_position(GTK_PANED(table_pane));
+	if(GtrPreferences.show_messages_table)
+	{
+		/*
+		 * Get the EPaned's position offset.
+		 */
+		table_pane_position=gtk_paned_get_position(GTK_PANED(table_pane));
+		/*
+		 * Store the pane position in the preferences.
+		 */
+		gtranslator_config_set_int("interface/table_pane_position", table_pane_position);
+	}
 	
-	/*
-	 * Store the pane position in the preferences.
-	 */
-	gtranslator_config_set_int("interface/table_pane_position", table_pane_position);
 	gtranslator_utils_save_geometry();
 
 	/*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]