[glade3] Changes for GTK+ 3.0 cleanup



commit 003833ae17456b4aa67c3f416c24efad8c83e1aa
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon Aug 16 20:02:53 2010 -0400

    Changes for GTK+ 3.0 cleanup
    
     - Added convenience glade_utils_cairo_draw_[line/rectangle] to cover
       parts where the gdk drawing api is removed.
     - use gdk_pixbuf_new_from_xpm_data()/gdk_pixbuf_render_pixmap_and_mask()
       instead of the removed gdk_pixmap_new_from_xpm_d().

 gladeui/glade-base-editor.c        |    2 +-
 gladeui/glade-cell-renderer-icon.c |    2 +-
 gladeui/glade-design-layout.c      |   37 +++++++-------
 gladeui/glade-placeholder.c        |   33 ++++++++-----
 gladeui/glade-utils.c              |   95 +++++++++++++++++++++++++++---------
 gladeui/glade-utils.h              |   16 ++++++
 plugins/gtk+/fixed-bg.xpm          |    2 +-
 plugins/gtk+/glade-gtk.c           |   94 ++++++++++++++++++++++++-----------
 src/glade-window.c                 |   12 ++--
 9 files changed, 201 insertions(+), 92 deletions(-)
---
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index 3746c91..f47acb7 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -1620,7 +1620,7 @@ glade_base_editor_realize_callback (GtkWidget *widget, gpointer user_data)
 
 static void 
 glade_base_editor_switch_page (GtkNotebook     *notebook,
-			       GtkNotebookPage *page,
+			       GtkWidget       *page,
 			       guint            page_num,
 			       GladeBaseEditor *editor)
 {
diff --git a/gladeui/glade-cell-renderer-icon.c b/gladeui/glade-cell-renderer-icon.c
index 8269393..7f26acb 100644
--- a/gladeui/glade-cell-renderer-icon.c
+++ b/gladeui/glade-cell-renderer-icon.c
@@ -63,7 +63,7 @@ glade_cell_renderer_icon_init (GladeCellRendererIcon *cellicon)
   cellicon->activatable = TRUE;
   cellicon->active = FALSE;
 
-  GTK_CELL_RENDERER (cellicon)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+  g_object_set (G_OBJECT (cellicon), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
 }
 
 static void
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index ac661ae..2163bbb 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -787,43 +787,44 @@ glade_design_layout_expose_event (GtkWidget *widget, GdkEventExpose *ev)
 	window = gtk_widget_get_window (widget);
 	style = gtk_widget_get_style (widget);
 	gtk_widget_get_allocation (widget, &allocation);
-	/* draw a white widget background */
-	gdk_draw_rectangle (window,
-			    style->base_gc [gtk_widget_get_state (widget)],
-			    TRUE,
-			    allocation.x + border_width,
-			    allocation.y + border_width,
-			    allocation.width - 2 * border_width,
-			    allocation.height - 2 * border_width);
 
 	child = gtk_bin_get_child (GTK_BIN (widget));
 
+	cr = gdk_cairo_create (window);
+
+	/* draw a white widget background */
+	glade_utils_cairo_draw_rectangle (cr,
+					  &style->base [gtk_widget_get_state (widget)],
+					  TRUE,
+					  allocation.x + border_width,
+					  allocation.y + border_width,
+					  allocation.width - 2 * border_width,
+					  allocation.height - 2 * border_width);
+
 	if (child && gtk_widget_get_visible (child))
 	{
+		/* draw frame */
 		gtk_widget_get_allocation (child, &child_allocation);
 		x = child_allocation.x - OUTLINE_WIDTH / 2;
 		y = child_allocation.y - OUTLINE_WIDTH / 2;
 		w = child_allocation.width + OUTLINE_WIDTH;
 		h = child_allocation.height + OUTLINE_WIDTH;
-
-		/* draw frame */
-		cr = gdk_cairo_create (window);
 		
 		draw_frame (widget, cr, x, y, w, h);
-		
-		cairo_destroy (cr);
 
 		/* draw a filled rectangle in case child does not draw 
 		 * it's own background (a GTK_WIDGET_NO_WINDOW child). */
-		gdk_draw_rectangle (window,
-				    style->bg_gc[GTK_STATE_NORMAL],
-				    TRUE,
-				    x + OUTLINE_WIDTH / 2, y + OUTLINE_WIDTH / 2,
-				    w - OUTLINE_WIDTH, h - OUTLINE_WIDTH);
+		glade_utils_cairo_draw_rectangle (cr,
+						  &style->bg[GTK_STATE_NORMAL],
+						  TRUE,
+						  x + OUTLINE_WIDTH / 2, y + OUTLINE_WIDTH / 2,
+						  w - OUTLINE_WIDTH, h - OUTLINE_WIDTH);
 
 		GTK_WIDGET_CLASS (glade_design_layout_parent_class)->expose_event (widget, ev);
 	}	
 
+	cairo_destroy (cr);
+
 	return TRUE;
 }
 
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index 593f41c..8c41f9a 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -71,7 +71,7 @@ static gboolean  glade_placeholder_button_press        (GtkWidget      *widget,
 static gboolean  glade_placeholder_popup_menu          (GtkWidget      *widget);
 
 
-static char *placeholder_xpm[] = {
+static const char *placeholder_xpm[] = {
 	/* columns rows colors chars-per-pixel */
 	"8 8 2 1",
 	"  c #bbbbbb",
@@ -231,9 +231,9 @@ glade_placeholder_realize (GtkWidget *widget)
 
 	if (!placeholder->placeholder_pixmap)
 	{
-		placeholder->placeholder_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
-									    gtk_widget_get_colormap (GTK_WIDGET (placeholder)),
-									    NULL, NULL, placeholder_xpm);
+		GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (placeholder_xpm);
+
+		gdk_pixbuf_render_pixmap_and_mask (pixbuf, &placeholder->placeholder_pixmap, NULL, 1);
 		g_assert(G_IS_OBJECT(placeholder->placeholder_pixmap));
 	}
 
@@ -291,21 +291,28 @@ static gboolean
 glade_placeholder_expose (GtkWidget *widget, GdkEventExpose *event)
 {
 	GtkStyle *style;
-	GdkGC *light_gc;
-	GdkGC *dark_gc;
-	gint w, h;
+	GdkColor *light;
+	GdkColor *dark;
+	cairo_t  *cr;
+	gint      w, h;
 
 	g_return_val_if_fail (GLADE_IS_PLACEHOLDER (widget), FALSE);
 
 	style = gtk_widget_get_style (widget);
-	light_gc = style->light_gc[GTK_STATE_NORMAL];
-	dark_gc  = style->dark_gc[GTK_STATE_NORMAL];
+	light = &style->light[GTK_STATE_NORMAL];
+	dark  = &style->dark[GTK_STATE_NORMAL];
+
 	gdk_drawable_get_size (event->window, &w, &h);
 
-	gdk_draw_line (event->window, light_gc, 0, 0, w - 1, 0);
-	gdk_draw_line (event->window, light_gc, 0, 0, 0, h - 1);
-	gdk_draw_line (event->window, dark_gc, 0, h - 1, w - 1, h - 1);
-	gdk_draw_line (event->window, dark_gc, w - 1, 0, w - 1, h - 1);
+	cr = gdk_cairo_create (event->window);
+	cairo_set_line_width (cr, 1.0);
+
+	glade_utils_cairo_draw_line (cr, light, 0, 0, w - 1, 0);
+	glade_utils_cairo_draw_line (cr, light, 0, 0, 0, h - 1);
+	glade_utils_cairo_draw_line (cr, dark, 0, h - 1, w - 1, h - 1);
+	glade_utils_cairo_draw_line (cr, dark, w - 1, 0, w - 1, h - 1);
+
+	cairo_destroy (cr);
 
 	glade_util_draw_selection_nodes (event->window);
 
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index 9d47c52..705f404 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -683,31 +683,31 @@ glade_util_get_window_positioned_in (GtkWidget *widget)
 }
 
 static void
-glade_util_draw_nodes (GdkWindow *window, GdkGC *gc,
+glade_util_draw_nodes (cairo_t *cr, GdkColor *color,
 		       gint x, gint y,
 		       gint width, gint height)
 {
 	if (width > GLADE_UTIL_SELECTION_NODE_SIZE && height > GLADE_UTIL_SELECTION_NODE_SIZE) {
-		gdk_draw_rectangle (window, gc, TRUE,
-				    x, y,
-				    GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE);
-		gdk_draw_rectangle (window, gc, TRUE,
-				    x, y + height - GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE);
-		gdk_draw_rectangle (window, gc, TRUE,
-				    x + width - GLADE_UTIL_SELECTION_NODE_SIZE, y,
-				    GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE);
-		gdk_draw_rectangle (window, gc, TRUE,
-				    x + width - GLADE_UTIL_SELECTION_NODE_SIZE,
-				    y + height - GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE,
-				    GLADE_UTIL_SELECTION_NODE_SIZE);
+		glade_utils_cairo_draw_rectangle (cr, color, TRUE,
+						  x, y,
+						  GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE);
+		glade_utils_cairo_draw_rectangle (cr, color, TRUE,
+						  x, y + height - GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE);
+		glade_utils_cairo_draw_rectangle (cr, color, TRUE,
+						  x + width - GLADE_UTIL_SELECTION_NODE_SIZE, y,
+						  GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE);
+		glade_utils_cairo_draw_rectangle (cr, color, TRUE,
+						  x + width - GLADE_UTIL_SELECTION_NODE_SIZE,
+						  y + height - GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE,
+						  GLADE_UTIL_SELECTION_NODE_SIZE);
 	}
 
-	gdk_draw_rectangle (window, gc, FALSE, x, y, width - 1, height - 1);
+	glade_utils_cairo_draw_rectangle (cr, color, FALSE, x, y, width - 1, height - 1);
 }
 
 /* This calculates the offset of the given window within its toplevel.
@@ -793,15 +793,16 @@ glade_util_draw_selection_nodes (GdkWindow *expose_win)
 	gint expose_win_x, expose_win_y;
 	gint expose_win_w, expose_win_h;
 	GdkWindow   *expose_toplevel;
-	GdkGC *gc;
+	GdkColor *color;
 	GList *elem;
+	cairo_t *cr;
 
 	g_return_if_fail (GDK_IS_WINDOW (expose_win));
 
 	/* Find the corresponding GtkWidget */
 	gdk_window_get_user_data (expose_win, (gpointer)&expose_widget);
 
-	gc = gtk_widget_get_style (expose_widget)->black_gc;
+	color = &(gtk_widget_get_style (expose_widget)->black);
 
 	/* Calculate the offset of the expose window within its toplevel. */
 	glade_util_calculate_window_offset (expose_win,
@@ -812,6 +813,8 @@ glade_util_draw_selection_nodes (GdkWindow *expose_win)
 	gdk_drawable_get_size (expose_win,
 			       &expose_win_w, &expose_win_h);
 
+	cr = gdk_cairo_create (expose_win);
+
 	/* Step through all the selected widgets. */
 	for (elem = glade_util_selection; elem; elem = elem->next) {
 
@@ -846,11 +849,12 @@ glade_util_draw_selection_nodes (GdkWindow *expose_win)
 			   expose window bounds. */
 			if (x < expose_win_w && x + w >= 0
 			    && y < expose_win_h && y + h >= 0) {
-				glade_util_draw_nodes (expose_win, gc,
-						       x, y, w, h);
+				glade_util_draw_nodes (cr, color, x, y, w, h);
 			}
 		}
 	}
+
+	cairo_destroy (cr);
 }
 
 /**
@@ -2227,3 +2231,48 @@ glade_utils_replace_home_dir_with_tilde (const gchar *uri)
 
 	return g_strdup (uri);
 }
+
+
+void
+glade_utils_cairo_draw_line (cairo_t  *cr,
+			     GdkColor *color,
+			     gint      x1,
+			     gint      y1,
+			     gint      x2,
+			     gint      y2)
+{
+  cairo_save (cr);
+
+  gdk_cairo_set_source_color (cr, color);
+  cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+
+  cairo_move_to (cr, x1 + 0.5, y1 + 0.5);
+  cairo_line_to (cr, x2 + 0.5, y2 + 0.5);
+  cairo_stroke (cr);
+
+  cairo_restore (cr);
+}
+
+
+void
+glade_utils_cairo_draw_rectangle (cairo_t *cr,
+				  GdkColor *color,
+				  gboolean filled,
+				  gint x,
+				  gint y,
+				  gint width,
+				  gint height)
+{
+  gdk_cairo_set_source_color (cr, color);
+
+  if (filled)
+    {
+      cairo_rectangle (cr, x, y, width, height);
+      cairo_fill (cr);
+    }
+  else
+    {
+      cairo_rectangle (cr, x + 0.5, y + 0.5, width, height);
+      cairo_stroke (cr);
+    }
+}
diff --git a/gladeui/glade-utils.h b/gladeui/glade-utils.h
index 56cea79..0d1b1e5 100644
--- a/gladeui/glade-utils.h
+++ b/gladeui/glade-utils.h
@@ -157,6 +157,22 @@ gint              glade_utils_hijack_key_press (GtkWindow          *win,
 
 gchar           *glade_utils_replace_home_dir_with_tilde (const gchar *uri);
 
+void             glade_utils_cairo_draw_line (cairo_t  *cr,
+					      GdkColor *color,
+					      gint      x1,
+					      gint      y1,
+					      gint      x2,
+					      gint      y2);
+
+
+void             glade_utils_cairo_draw_rectangle (cairo_t *cr,
+						   GdkColor *color,
+						   gboolean filled,
+						   gint x,
+						   gint y,
+						   gint width,
+						   gint height);
+
 G_END_DECLS
 
 #endif /* __GLADE_UTILS_H__ */
diff --git a/plugins/gtk+/fixed-bg.xpm b/plugins/gtk+/fixed-bg.xpm
index a2fe89f..948ac4d 100644
--- a/plugins/gtk+/fixed-bg.xpm
+++ b/plugins/gtk+/fixed-bg.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char *fixed_bg_xpm[] = {
+static const char *fixed_bg_xpm[] = {
 	/* columns rows colors chars-per-pixel */
 	"8 8 2 1",
 	". c #bbbbbb",
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index acdf675..b4dcddb 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -3747,7 +3747,7 @@ glade_gtk_notebook_insert_children (GtkWidget *notebook, NotebookChildren *nchil
 
 static void
 glade_gtk_notebook_switch_page (GtkNotebook     *notebook,
-				GtkNotebookPage *page,
+				GtkWidget       *page,
 				guint            page_num,
 				gpointer         user_data)
 {
@@ -4895,10 +4895,11 @@ glade_gtk_fixed_layout_finalize(GdkPixmap *backing)
 static void
 glade_gtk_fixed_layout_realize (GtkWidget *widget)
 {
-	GdkPixmap *backing =
-		gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (widget),
-						       NULL, NULL, fixed_bg_xpm);
+	GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (fixed_bg_xpm);
+	GdkPixmap *backing;
 
+	gdk_pixbuf_render_pixmap_and_mask (pixbuf, &backing, NULL, 1);
+	
 	if (GTK_IS_LAYOUT (widget))
 		gdk_window_set_back_pixmap (gtk_layout_get_bin_window (GTK_LAYOUT (widget)),
 					    backing, FALSE);
@@ -5192,22 +5193,28 @@ glade_gtk_dialog_post_create (GladeWidgetAdaptor *adaptor,
 
 	if (GTK_IS_COLOR_SELECTION_DIALOG (object))
 	{
+		GtkWidget *child;
+
+		child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_OK);
 		ok_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_COLOR_SELECTION_DIALOG (object)->ok_button),
+			(widget, G_OBJECT (child),
 			 "ok_button", "colorsel", FALSE, reason);
 
+		child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_CANCEL);
 		cancel_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_COLOR_SELECTION_DIALOG (object)->cancel_button),
+			(widget, G_OBJECT (child),
 			 "cancel_button", "colorsel", FALSE, reason);
 
+		child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_HELP);
 		help_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_COLOR_SELECTION_DIALOG (object)->help_button),
+			(widget, G_OBJECT (child),
 			 "help_button", "colorsel", FALSE, reason);
 
+		child = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog));
 		colorsel = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_COLOR_SELECTION_DIALOG (object)->colorsel),
+			(widget, G_OBJECT (child),
 			 "color_selection", "colorsel", FALSE, reason);
-
+		
 		/* Set this to 1 at load time, if there are any children then
 		 * size will adjust appropriately (otherwise the default "3" gets
 		 * set and we end up with extra placeholders).
@@ -5218,20 +5225,26 @@ glade_gtk_dialog_post_create (GladeWidgetAdaptor *adaptor,
 	}
 	else if (GTK_IS_FONT_SELECTION_DIALOG (object))
 	{
+		GtkWidget *child;
+
+		child = gtk_font_selection_dialog_get_ok_button (GTK_FONT_SELECTION_DIALOG (dialog));
 		ok_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_FONT_SELECTION_DIALOG (object)->ok_button),
+			(widget, G_OBJECT (child),
 			 "ok_button", "fontsel", FALSE, reason);
 
+		child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_APPLY);
 		apply_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_FONT_SELECTION_DIALOG (object)->apply_button),
+			(widget, G_OBJECT (child),
 			 "apply_button", "fontsel", FALSE, reason);
 		
+		child = gtk_font_selection_dialog_get_cancel_button (GTK_FONT_SELECTION_DIALOG (dialog));
 		cancel_button = glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_FONT_SELECTION_DIALOG (object)->cancel_button),
+			(widget, G_OBJECT (child),
 			 "cancel_button", "fontsel", FALSE, reason);
 
+		child = gtk_font_selection_dialog_get_font_selection (GTK_FONT_SELECTION_DIALOG (dialog));
 		fontsel =  glade_widget_adaptor_create_internal
-			(widget, G_OBJECT (GTK_FONT_SELECTION_DIALOG (object)->fontsel),
+			(widget, G_OBJECT (child),
 			 "font_selection", "fontsel", FALSE, reason);
 
 		/* Set this to 1 at load time, if there are any children then
@@ -5304,24 +5317,29 @@ glade_gtk_dialog_get_internal_child (GladeWidgetAdaptor  *adaptor,
 	if (GTK_IS_COLOR_SELECTION_DIALOG (dialog))
 	{
 		if (strcmp ("ok_button", name) == 0)
-			child = GTK_COLOR_SELECTION_DIALOG (dialog)->ok_button;
+			child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_OK);
 		else if (strcmp ("cancel_button", name) == 0)
-			child = GTK_COLOR_SELECTION_DIALOG (dialog)->cancel_button;
+			child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_CANCEL);
 		else if (strcmp ("help_button", name) == 0)
-			child = GTK_COLOR_SELECTION_DIALOG (dialog)->help_button;
+			child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_HELP);
 		else if (strcmp ("color_selection", name) == 0)
-			child = GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel;
+			child = gtk_color_selection_dialog_get_color_selection
+				(GTK_COLOR_SELECTION_DIALOG (dialog));
 	}
 	else if (GTK_IS_FONT_SELECTION_DIALOG (dialog))
 	{
+
 		if (strcmp ("ok_button", name) == 0)
-			child = GTK_FONT_SELECTION_DIALOG (dialog)->ok_button;
+			child = gtk_font_selection_dialog_get_ok_button (GTK_FONT_SELECTION_DIALOG (dialog));
 		else if (strcmp ("apply_button", name) == 0)
-			child = GTK_FONT_SELECTION_DIALOG (dialog)->apply_button;
+			child = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_APPLY);
 		else if (strcmp ("cancel_button", name) == 0)
-			child = GTK_FONT_SELECTION_DIALOG (dialog)->cancel_button;
+			child = gtk_font_selection_dialog_get_cancel_button
+				(GTK_FONT_SELECTION_DIALOG (dialog));
 		else if (strcmp ("font_selection", name) == 0)
-			child = GTK_FONT_SELECTION_DIALOG (dialog)->fontsel;
+			child = gtk_font_selection_dialog_get_font_selection
+				(GTK_FONT_SELECTION_DIALOG (dialog));
+
 	}
 	else
 	{
@@ -5348,17 +5366,35 @@ glade_gtk_dialog_get_children (GladeWidgetAdaptor  *adaptor,
 
 	if (GTK_IS_COLOR_SELECTION_DIALOG (dialog))
 	{
-		list = g_list_prepend (list, GTK_COLOR_SELECTION_DIALOG (dialog)->ok_button);
-		list = g_list_prepend (list, GTK_COLOR_SELECTION_DIALOG (dialog)->cancel_button);
-		list = g_list_prepend (list, GTK_COLOR_SELECTION_DIALOG (dialog)->help_button);
-		list = g_list_prepend (list, GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel);
+		GtkWidget *widget;
+		
+		widget = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_OK);
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_CANCEL);
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_HELP);
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog));
+		if (widget) list = g_list_prepend (list, widget);
 	}
 	else if (GTK_IS_FONT_SELECTION_DIALOG (dialog))
 	{
-		list = g_list_prepend (list, GTK_FONT_SELECTION_DIALOG (dialog)->ok_button);
-		list = g_list_prepend (list, GTK_FONT_SELECTION_DIALOG (dialog)->apply_button);
-		list = g_list_prepend (list, GTK_FONT_SELECTION_DIALOG (dialog)->cancel_button);
-		list = g_list_prepend (list, GTK_FONT_SELECTION_DIALOG (dialog)->fontsel);
+		GtkWidget *widget;
+
+		widget = gtk_font_selection_dialog_get_ok_button (GTK_FONT_SELECTION_DIALOG (dialog));
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_dialog_get_widget_for_response (dialog, GTK_RESPONSE_APPLY);
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_font_selection_dialog_get_cancel_button (GTK_FONT_SELECTION_DIALOG (dialog));
+		if (widget) list = g_list_prepend (list, widget);
+
+		widget = gtk_font_selection_dialog_get_font_selection (GTK_FONT_SELECTION_DIALOG (dialog));
+		if (widget) list = g_list_prepend (list, widget);
 	}
 	return list;
 }
diff --git a/src/glade-window.c b/src/glade-window.c
index 608ddda..f88c55e 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -1558,9 +1558,9 @@ next_project_cb (GtkAction *action, GladeWindow *window)
 
 static void
 notebook_switch_page_cb (GtkNotebook *notebook,
-			     GtkNotebookPage *page,
-			     guint page_num,
-			     GladeWindow *window)
+			 GtkWidget *page,
+			 guint page_num,
+			 GladeWindow *window)
 {
 	GladeDesignView *view;
 	GladeProject *project;
@@ -1604,9 +1604,9 @@ notebook_switch_page_cb (GtkNotebook *notebook,
 
 static void
 notebook_tab_added_cb (GtkNotebook *notebook,
-			   GladeDesignView *view,
-			   guint page_num,
-			   GladeWindow *window)
+		       GladeDesignView *view,
+		       guint page_num,
+		       GladeWindow *window)
 {
 	GladeProject *project;
 	GtkWidget    *inspector;



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