xchat-gnome r2687 - trunk/src/fe-gnome



Author: chpe
Date: Mon Oct 13 21:04:27 2008
New Revision: 2687
URL: http://svn.gnome.org/viewvc/xchat-gnome?rev=2687&view=rev

Log:
Don't emit critical warnings when pressing Ctrl-U to show the userlist popup while the sidebar is toggled off (F9).

Modified:
   trunk/src/fe-gnome/userlist-gui.c

Modified: trunk/src/fe-gnome/userlist-gui.c
==============================================================================
--- trunk/src/fe-gnome/userlist-gui.c	(original)
+++ trunk/src/fe-gnome/userlist-gui.c	Mon Oct 13 21:04:27 2008
@@ -257,6 +257,7 @@
 	GdkRectangle    monitor_rect;
 	GdkScreen      *screen;
 	GtkRequisition  request;
+	GtkWidget      *anchor_widget;
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gui.userlist_toggle), TRUE);
 
@@ -265,19 +266,25 @@
 	}
 	gtk_widget_size_request (gui.userlist, &request);
 
-	gdk_window_get_origin (gui.userlist_toggle->window, &toggle_x, &toggle_y);
-	screen = gtk_widget_get_screen (gui.userlist_toggle);
+	if (GTK_WIDGET_REALIZED (gui.userlist_toggle))
+		anchor_widget = gui.userlist_toggle;
+	else
+		anchor_widget = gui.main_window;
+
+	gdk_window_get_origin (anchor_widget->window, &toggle_x, &toggle_y);
+
+	screen = gtk_widget_get_screen (anchor_widget);
 	monitor = gdk_screen_get_monitor_at_point (screen, toggle_x, toggle_y);
 	gdk_screen_get_monitor_geometry (screen, monitor, &monitor_rect);
 
-	if (gtk_widget_get_direction (gui.userlist_toggle) == GTK_TEXT_DIR_RTL) {
-		toggle_x += gui.userlist_toggle->allocation.x +
-		            gui.userlist_toggle->allocation.width - request.width;
+	if (gtk_widget_get_direction (anchor_widget) == GTK_TEXT_DIR_RTL) {
+		toggle_x += anchor_widget->allocation.x +
+		            anchor_widget->allocation.width - request.width;
 	} else {
-		toggle_x += gui.userlist_toggle->allocation.width;
+		toggle_x += anchor_widget->allocation.width;
 	}
-	toggle_y += gui.userlist_toggle->allocation.y +
-	            gui.userlist_toggle->allocation.height;
+	toggle_y += anchor_widget->allocation.y +
+	            anchor_widget->allocation.height;
 
 	/* Buffer of 20 pixels.  Would be nice to know exactly how much space
 	 * the rest of the window's UI goop used up, but oh well.



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