[anjuta] Use accessor functions instead direct access. Real final patch



commit ceebe07fc728105cfa0c9f4923189d81a2105373
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Jun 2 04:47:24 2010 +0200

    Use accessor functions instead direct access. Real final patch
    
    Seems that patch of commit
    d33cab66a7981341895ca12d6fd62193cc1def39 was not correctly applied
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=597365

 libanjuta/anjuta-status.c           |    2 +-
 libanjuta/anjuta-tabber.c           |   51 ++++++++++++++++++++--------------
 plugins/debug-manager/data_view.c   |    8 +++++-
 plugins/debug-manager/registers.c   |    2 +-
 plugins/debug-manager/sparse_view.c |    8 +++++-
 plugins/gtodo/mcategory.c           |    2 +-
 src/anjuta-app.c                    |    4 +-
 7 files changed, 49 insertions(+), 28 deletions(-)
---
diff --git a/libanjuta/anjuta-status.c b/libanjuta/anjuta-status.c
index 9cd4ed6..bdcede2 100644
--- a/libanjuta/anjuta-status.c
+++ b/libanjuta/anjuta-status.c
@@ -448,7 +448,7 @@ anjuta_status_progress_add_ticks (AnjutaStatus *status, gint ticks)
 	g_return_if_fail (ticks >= 0);
 	
 	status->priv->total_ticks += ticks;
-	if (!GTK_WIDGET_REALIZED (status))
+	if (!gtk_widget_get_realized (GTK_WIDGET (status)))
 	{
 		if (status->priv->splash == NULL &&
 			status->priv->splash_file &&
diff --git a/libanjuta/anjuta-tabber.c b/libanjuta/anjuta-tabber.c
index 6ccadc2..652e6a5 100644
--- a/libanjuta/anjuta-tabber.c
+++ b/libanjuta/anjuta-tabber.c
@@ -169,9 +169,12 @@ anjuta_tabber_size_request(GtkWidget* widget, GtkRequisition* req)
 	for (child = tabber->priv->children; child != NULL; child = g_list_next (child))
 	{
 		GtkRequisition child_req;
+		GtkStyle *style;
+
 		gtk_widget_size_request (GTK_WIDGET (child->data), &child_req);
-		req->width += child_req.width + 2 * widget->style->xthickness + padding;
-		req->height = MAX(req->height, child_req.height + 2 * widget->style->ythickness);
+		style = gtk_widget_get_style (widget);
+		req->width += child_req.width + 2 * style->xthickness + padding;
+		req->height = MAX(req->height, child_req.height + 2 * style->ythickness);
 	}
 }
 
@@ -188,22 +191,22 @@ anjuta_tabber_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
 	gint child_width;
 	gint n_children = g_list_length (tabber->priv->children);
 
-	widget->allocation = *allocation;
-
+	gtk_widget_set_allocation (widget, allocation);
 
-	if (GTK_WIDGET_REALIZED (widget))
+	if (gtk_widget_get_realized (widget))
 	{
 		gdk_window_move_resize (tabber->priv->event_window,
 		                        allocation->x, allocation->y,
 		                        allocation->width, allocation->height);
-		if (GTK_WIDGET_MAPPED (widget))
+		if (gtk_widget_get_mapped (widget))
 			gdk_window_show_unraised (tabber->priv->event_window);
 	}
 
 	if (n_children > 0)
 	{
-		child_width = allocation->width / n_children - padding - 
-			(2 * widget->style->xthickness);
+		GtkStyle *style = gtk_widget_get_style (widget);
+
+		child_width = allocation->width / n_children - padding - (2 * style->xthickness);
 
 		for (child = tabber->priv->children; child != NULL; child = g_list_next (child))
 		{
@@ -213,11 +216,11 @@ anjuta_tabber_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
 
 			child_alloc.width = child_width;
 			child_alloc.height = MAX(child_req.height, allocation->height);
-			child_alloc.x = x + widget->style->xthickness;
-			child_alloc.y = y + widget->style->ythickness;
+			child_alloc.x = x + style->xthickness;
+			child_alloc.y = y + style->ythickness;
 
 			gtk_widget_size_allocate (GTK_WIDGET (child->data), &child_alloc);
-			x += child_alloc.width + 2 * widget->style->xthickness + padding;
+			x += child_alloc.width + 2 * style->xthickness + padding;
 		}
 	}
 }
@@ -233,16 +236,20 @@ anjuta_tabber_expose_event (GtkWidget* widget, GdkEventExpose *event)
 	for (child = tabber->priv->children; child != NULL; child = g_list_next (child))
 	{
 		GtkAllocation alloc;
+		GtkStyle *style;
 		GtkStateType state = (g_list_nth (tabber->priv->children, tabber->priv->active_page) == child) ? 
 			GTK_STATE_NORMAL : GTK_STATE_ACTIVE;
 		gtk_widget_get_allocation (GTK_WIDGET (child->data), &alloc);
 
-		alloc.x -= widget->style->xthickness;
-		alloc.y -= widget->style->ythickness;
-		alloc.width += widget->style->xthickness + padding;
-		alloc.height += widget->style->ythickness;
+		style = gtk_widget_get_style (widget);
+
+		alloc.x -= style->xthickness;
+		alloc.y -= style->ythickness;
+		alloc.width += style->xthickness + padding;
+		alloc.height += style->ythickness;
 
-		gtk_paint_extension (widget->style, widget->window,
+		gtk_paint_extension (style,
+		                     gtk_widget_get_window (widget),
 		                     state, GTK_SHADOW_OUT,
 		                     NULL, widget, "tab",
 		                     alloc.x, 
@@ -277,7 +284,7 @@ anjuta_tabber_get_widget_coordinates (GtkWidget *widget,
   if (!gdk_event_get_coords (event, &tx, &ty))
     return FALSE;
 
-  while (window && window != widget->window)
+  while (window && window != gtk_widget_get_window (widget))
     {
       gint window_x, window_y;
 
@@ -332,14 +339,16 @@ anjuta_tabber_button_press_event (GtkWidget* widget, GdkEventButton* event)
 static void
 anjuta_tabber_realize (GtkWidget *widget)
 {
+	GdkWindow*    window;
 	GdkWindowAttr attributes;
 	GtkAllocation allocation;
 	AnjutaTabber* tabber = ANJUTA_TABBER (widget);
 	
 	gtk_widget_set_realized (widget, TRUE);
 
-	widget->window = gtk_widget_get_parent_window (widget);
-	g_object_ref (widget->window);
+	window = gtk_widget_get_parent_window (widget);
+	gtk_widget_set_window (widget, window);
+	g_object_ref (window);
 
 	gtk_widget_get_allocation (widget, &allocation);
 	
@@ -356,7 +365,7 @@ anjuta_tabber_realize (GtkWidget *widget)
 	                                             &attributes, GDK_WA_X | GDK_WA_Y);
 	gdk_window_set_user_data (tabber->priv->event_window, tabber);
 
-	widget->style = gtk_style_attach (widget->style, widget->window);
+	gtk_widget_style_attach (widget);
 }
 
 static void
@@ -412,7 +421,7 @@ anjuta_tabber_remove (GtkContainer* container, GtkWidget* widget)
 	g_return_if_fail (GTK_IS_WIDGET (widget));
 
 	AnjutaTabber* tabber = ANJUTA_TABBER (container);
-	gboolean visible = GTK_WIDGET_VISIBLE (widget);
+	gboolean visible = gtk_widget_get_visible (widget);
 	
 	gtk_widget_unparent (widget);
 	tabber->priv->children = g_list_remove (tabber->priv->children, widget);
diff --git a/plugins/debug-manager/data_view.c b/plugins/debug-manager/data_view.c
index d459295..6a81b10 100644
--- a/plugins/debug-manager/data_view.c
+++ b/plugins/debug-manager/data_view.c
@@ -199,22 +199,28 @@ send_focus_change (GtkWidget *widget,
 {
         GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
+#if !GTK_CHECK_VERSION (2,21,0)
         g_object_ref (widget);
 
         if (in)
                 GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
         else
                 GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
+#endif
 
         fevent->focus_change.type = GDK_FOCUS_CHANGE;
         fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
         fevent->focus_change.in = in;
-
+#if !GTK_CHECK_VERSION (2,21,0)
         gtk_widget_event (widget, fevent);
 
         g_object_notify (G_OBJECT (widget), "has-focus");
 
         g_object_unref (widget);
+#else
+	gtk_widget_send_focus_change (widget, fevent);
+#endif
+
         gdk_event_free (fevent);
 }
 
diff --git a/plugins/debug-manager/registers.c b/plugins/debug-manager/registers.c
index e2615ca..4abf915 100644
--- a/plugins/debug-manager/registers.c
+++ b/plugins/debug-manager/registers.c
@@ -206,7 +206,7 @@ on_cpu_registers_updated (const GList *registers, gpointer user_data, GError *er
 static void
 cpu_registers_update (CpuRegisters *self)
 {
-	if (GTK_WIDGET_MAPPED (self->window))
+	if (gtk_widget_get_mapped (self->window))
 	{
 		dma_queue_update_register (
 				self->debugger,
diff --git a/plugins/debug-manager/sparse_view.c b/plugins/debug-manager/sparse_view.c
index c3b0202..a71b92e 100644
--- a/plugins/debug-manager/sparse_view.c
+++ b/plugins/debug-manager/sparse_view.c
@@ -104,22 +104,28 @@ send_focus_change (GtkWidget *widget,
 {
         GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
+#if !GTK_CHECK_VERSION (2,21,0)
         g_object_ref (widget);
 
         if (in)
                 GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
         else
                 GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
+#endif
 
         fevent->focus_change.type = GDK_FOCUS_CHANGE;
         fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
         fevent->focus_change.in = in;
-
+#if !GTK_CHECK_VERSION (2,21,0)
         gtk_widget_event (widget, fevent);
 
         g_object_notify (G_OBJECT (widget), "has-focus");
 
         g_object_unref (widget);
+#else
+	gtk_widget_send_focus_change (widget, fevent);
+#endif
+
         gdk_event_free (fevent);
 }
 
diff --git a/plugins/gtodo/mcategory.c b/plugins/gtodo/mcategory.c
index e08fc8d..f12e52d 100644
--- a/plugins/gtodo/mcategory.c
+++ b/plugins/gtodo/mcategory.c
@@ -23,7 +23,7 @@ void category_manager(void)
 			NULL);
 
 	hbox = gtk_hbox_new(FALSE,12);
-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
+	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox);
 	gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
 
 	/* the list */
diff --git a/src/anjuta-app.c b/src/anjuta-app.c
index 107d040..e44bf3a 100644
--- a/src/anjuta-app.c
+++ b/src/anjuta-app.c
@@ -799,7 +799,7 @@ anjuta_app_set_geometry (AnjutaApp *app, const gchar *geometry)
 		if (sscanf (geometry, "%dx%d+%d+%d", &width, &height,
 					&posx, &posy) == 4)
 		{
-			if (GTK_WIDGET_REALIZED (app))
+			if (gtk_widget_get_realized (GTK_WIDGET (app)))
 			{
 				gtk_window_resize (GTK_WINDOW (app), width, height);
 			}
@@ -823,7 +823,7 @@ anjuta_app_set_geometry (AnjutaApp *app, const gchar *geometry)
 		height = gdk_screen_height () - 25;
 		width = (width < 790)? width : 790;
 		height = (height < 575)? width : 575;
-		if (GTK_WIDGET_REALIZED (app) == FALSE)
+		if (gtk_widget_get_realized (GTK_WIDGET (app)) == FALSE)
 		{
 			gtk_window_set_default_size (GTK_WINDOW (app), width, height);
 			gtk_window_move (GTK_WINDOW (app), posx, posy);



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