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

[PATCH] Missing tab scrolling buttons [Bug 783681]



Attached patch (against latest CVS) fixes the missing scrolling buttons when 
creating new tabs (and indirectly fixes the superfluous scrolling buttons 
when there's plenty of spare space). It does this by making 
tab_group_resize() private to tabs.c and connecting it to the group's 
"size_allocate" signal.

P.S. tab_group_resize() should now be trigger-able externally by calling 
gtk_widget_queue_resize(group), if the need arises, but is no longer 
necessary in the case of the tab_group_resize call in mg_changui_new.
Index: maingui.c
===================================================================
RCS file: /cvsroot/xchat/xchat2/src/fe-gtk/maingui.c,v
retrieving revision 1.82
diff -u -r1.82 maingui.c
--- maingui.c	5 Aug 2003 07:36:58 -0000	1.82
+++ maingui.c	18 Aug 2003 13:55:05 -0000
@@ -2513,7 +2513,6 @@
 
 /*	while (g_main_pending ())
 		g_main_iteration (TRUE);*/
-	tab_group_resize (mg_gui->tabs_box);
 	/*g_idle_add ((GSourceFunc)tab_group_resize, mg_gui->tabs_box);*/
 }
 
Index: tabs.h
===================================================================
RCS file: /cvsroot/xchat/xchat2/src/fe-gtk/tabs.h,v
retrieving revision 1.11
diff -u -r1.11 tabs.h
--- tabs.h	28 Apr 2003 10:12:41 -0000	1.11
+++ tabs.h	18 Aug 2003 13:55:06 -0000
@@ -5,7 +5,6 @@
 GtkWidget *tab_group_add (GtkWidget *group, char *name, void *family, void *userdata, void *click_cb, void *delink_cb, int trunc_len, int dnd);
 GtkOrientation tab_group_get_orientation (GtkWidget *group);
 GtkWidget *tab_group_set_orientation (GtkWidget *group, gboolean vertical);
-int tab_group_resize (GtkWidget *group);
 GtkWidget *tab_group_get_focused (GtkWidget *group);
 
 void tab_focus (GtkWidget *tab);
Index: tabs.c
===================================================================
RCS file: /cvsroot/xchat/xchat2/src/fe-gtk/tabs.c,v
retrieving revision 1.22
diff -u -r1.22 tabs.c
--- tabs.c	30 May 2003 16:51:52 -0000	1.22
+++ tabs.c	18 Aug 2003 13:55:07 -0000
@@ -178,8 +178,8 @@
 	gtk_adjustment_set_value (adj, new_value);
 }
 
-int
-tab_group_resize (GtkWidget *group)
+static void
+tab_group_resize (GtkWidget *group, GtkAllocation *allocation, gpointer user_data)
 {
 	GtkAdjustment *adj;
 	GtkWidget *inner;
@@ -208,8 +208,6 @@
 		gtk_widget_show (g_object_get_data (G_OBJECT (group), "b1"));
 		gtk_widget_show (g_object_get_data (G_OBJECT (group), "b2"));
 	}
-
-	return 0;
 }
 
 /* called when a tab is clicked (button down) */
@@ -255,6 +253,8 @@
 	} else
 		group = gtk_hbox_new (0, 0);
 	g_object_set_data (G_OBJECT (group), "c", callback);
+	g_signal_connect (G_OBJECT (group), "size_allocate",
+							G_CALLBACK (tab_group_resize), NULL);
 	gtk_container_set_border_width (GTK_CONTAINER (group), 2);
 	gtk_widget_show (group);
 
@@ -408,8 +408,6 @@
 
 	/*while (g_main_pending ())
 		g_main_iteration (TRUE);*/
-
-	tab_group_resize (group);
 
 	if (relative)
 	{