Re: [Freeciv-Dev] (PR#40705) [Patch] Option for split lower notebook

2009-03-05 Thread Brendon Oram

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40705 

I keep getting segfaults when I double click on the [Messages X] title
tab to separate it, with dual/split chat and messages enabled.

The separate window pops up then whole thing dies.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6e559b0 (LWP 15070)]
0xb7caf3e0 in gtk_notebook_button_release (widget=0xad58ae0, event=0xc2c8f40)
at /build/buildd/gtk+2.0-2.14.4/gtk/gtknotebook.c:2825
2825/build/buildd/gtk+2.0-2.14.4/gtk/gtknotebook.c: No such file
or directory.
in /build/buildd/gtk+2.0-2.14.4/gtk/gtknotebook.c


2009/2/18 Madeline Book madeline.b...@gmail.com:

 URL: http://bugs.freeciv.org/Ticket/Display.html?id=40705 

 [book - Wed Feb 04 07:00:22 2009]:

 Patch implements an option to have the lower notebook split into
 two notebooks so that the chat tab and the message tab are both
 visible at the same time. If enabled the message tab is hard-
 coded to appear in the right notebook.

 Updated to recent S2_1 and trunk.


 ---
 シンクロ率が低下しています。

 ___
 Freeciv-dev mailing list
 Freeciv-dev@gna.org
 https://mail.gna.org/listinfo/freeciv-dev





___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40705) [Patch] Option for split lower notebook

2009-02-03 Thread Madeline Book

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40705 

Patch implements an option to have the lower notebook split into
two notebooks so that the chat tab and the message tab are both
visible at the same time. If enabled the message tab is hard-
coded to appear in the right notebook.

The next step would be to implement the ability to move tabs
between the two notebooks and to save the layout over program
restart.


---
うわっ!分裂される。
 client/gui-gtk-2.0/gui_main.c   |   43 --
 client/gui-gtk-2.0/gui_main.h   |2 +
 client/gui-gtk-2.0/messagewin.c |9 ++-
 3 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/client/gui-gtk-2.0/gui_main.c b/client/gui-gtk-2.0/gui_main.c
index 6448d26..eeccb0a 100644
--- a/client/gui-gtk-2.0/gui_main.c
+++ b/client/gui-gtk-2.0/gui_main.c
@@ -97,13 +97,15 @@ int overview_canvas_store_height = 2 * 50;
 
 bool enable_tabs = TRUE;
 bool better_fog = TRUE;
+bool split_bottom_notebook = FALSE;
 
 GtkWidget *toplevel;
 GdkWindow *root_window;
 GtkWidget *toplevel_tabs;
 GtkWidget *top_vbox;
-GtkWidget *top_notebook, *bottom_notebook;
+GtkWidget *top_notebook, *bottom_notebook, *right_notebook;
 GtkWidget *map_widget;
+static GtkWidget *bottom_hpaned;
 
 int city_names_font_size = 0, city_productions_font_size = 0;
 PangoFontDescription *main_font;
@@ -164,6 +166,8 @@ char font_comment_label[512] = Sans Italic 9;
 char font_city_names[512] = Sans Bold 10;
 char font_city_productions[512] = Serif 10;
 
+static void split_bottom_notebook_callback(struct client_option *op);
+
 client_option gui_options[] = {
   /* This option is the same as the one in gui-gtk */
   GEN_BOOL_OPTION(map_scrollbars, N_(Show Map Scrollbars),
@@ -198,6 +202,12 @@ client_option gui_options[] = {
 			for drawing fog-of-war.  It is not any slower but 
 			will consume about twice as much memory.),
 		 COC_GRAPHICS, mapview_redraw_callback),
+  GEN_BOOL_OPTION_CB(split_bottom_notebook,
+ N_(Split bottom notebook area),
+ N_(Enabling this option will split the bottom 
+notebook into a left and right notebook so that 
+two tabs may be viewed at once.),
+ COC_INTERFACE, split_bottom_notebook_callback),
   GEN_FONT_OPTION(font_city_label,
   		  city_label,
 		  N_(City Label),
@@ -990,7 +1000,7 @@ void enable_menus(bool enable)
 static void setup_widgets(void)
 {
   GtkWidget *box, *ebox, *hbox, *sbox, *align, *label;
-  GtkWidget *frame, *table, *table2, *paned, *sw, *text;
+  GtkWidget *frame, *table, *table2, *paned, *hpaned, *sw, *text;
   int i;
   char buf[256];
   struct sprite *sprite;
@@ -1317,10 +1327,22 @@ static void setup_widgets(void)
   gtk_paned_pack2(GTK_PANED(paned), sbox, TRUE, TRUE);
   avbox = detached_widget_fill(sbox);
 
+  hpaned = gtk_hpaned_new();
+  gtk_box_pack_start(GTK_BOX(avbox), hpaned, TRUE, TRUE, 0);
+  bottom_hpaned = hpaned;
+
   bottom_notebook = gtk_notebook_new();
   gtk_notebook_set_tab_pos(GTK_NOTEBOOK(bottom_notebook), GTK_POS_TOP);
   gtk_notebook_set_scrollable(GTK_NOTEBOOK(bottom_notebook), TRUE);
-  gtk_box_pack_start(GTK_BOX(avbox), bottom_notebook, TRUE, TRUE, 0);
+  gtk_paned_pack1(GTK_PANED(hpaned), bottom_notebook, TRUE, TRUE);
+
+  right_notebook = gtk_notebook_new();
+  g_object_ref(right_notebook);
+  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(right_notebook), GTK_POS_TOP);
+  gtk_notebook_set_scrollable(GTK_NOTEBOOK(right_notebook), TRUE);
+  if (split_bottom_notebook) {
+gtk_paned_pack2(GTK_PANED(hpaned), right_notebook, TRUE, TRUE);
+  }
 
   vbox = gtk_vbox_new(FALSE, 0);
 
@@ -2110,3 +2132,18 @@ void add_idle_callback(void (callback)(void *), void *data)
   cb-data = data;
   gtk_idle_add(idle_callback_wrapper, cb);
 }
+
+/
+  Option callback for the 'split_bottom_notebook' option.
+/
+static void split_bottom_notebook_callback(struct client_option *op)
+{
+  popdown_meswin_dialog();
+  if (*op-p_bool_value) {
+gtk_paned_pack2(GTK_PANED(bottom_hpaned), right_notebook, TRUE, TRUE);
+gtk_widget_show_all(right_notebook);
+  } else {
+gtk_container_remove(GTK_CONTAINER(bottom_hpaned), right_notebook);
+  }
+  popup_meswin_dialog(FALSE);
+}
diff --git a/client/gui-gtk-2.0/gui_main.h b/client/gui-gtk-2.0/gui_main.h
index f5ed3fa..fda9ddd 100644
--- a/client/gui-gtk-2.0/gui_main.h
+++ b/client/gui-gtk-2.0/gui_main.h
@@ -26,6 +26,7 @@ extern PangoFontDescription *city_productions_font;
 
 extern bool enable_tabs;
 extern bool better_fog;
+extern bool split_bottom_notebook;
 
 extern GdkGC *  civ_gc;
 extern GdkGC *  mask_fg_gc;
@@ -72,6 +73,7 @@ extern GtkWidget *	toplevel_tabs;
 extern GtkWidget *	top_notebook;
 extern GtkWidget *