[gedit] Fix remaining things due to gtk+ 3 deprecations.



commit 44662672574afda66bf6003e4b8078dff86c260a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Oct 1 12:40:23 2010 +0200

    Fix remaining things due to gtk+ 3 deprecations.

 gedit/gedit-app.c                                 |    3 +-
 gedit/gedit-documents-panel.c                     |    3 +-
 gedit/gedit-overlay.c                             |    6 +---
 gedit/gedit-panel.c                               |    9 -------
 gedit/gedit-rounded-frame.c                       |   24 +++++---------------
 gedit/gedit-status-combo-box.c                    |    8 +++---
 gedit/gedit-utils.c                               |   10 ++++----
 gedit/gedit-view.c                                |   18 ++++++++-------
 gedit/theatrics/gedit-theatrics-animated-widget.c |   17 +++++---------
 plugins/spell/gedit-spell-checker-dialog.c        |    2 +-
 plugins/time/gedit-time-plugin.c                  |    4 +-
 11 files changed, 39 insertions(+), 65 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index f5e4c28..21b43e1 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -877,7 +877,8 @@ is_in_viewport (GeditWindow  *window,
 	/* Check for viewport match */
 	gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
 	gdk_window_get_position (gdkwindow, &x, &y);
-	gdk_drawable_get_size (gdkwindow, &width, &height);
+	width = gdk_window_get_width (gdkwindow);
+	height = gdk_window_get_height (gdkwindow);
 	gedit_utils_get_current_viewport (screen, &vp_x, &vp_y);
 	x += vp_x;
 	y += vp_y;
diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
index b6f735d..a2759d5 100644
--- a/gedit/gedit-documents-panel.c
+++ b/gedit/gedit-documents-panel.c
@@ -758,8 +758,7 @@ menu_position (GtkMenu             *menu,
 
 	gdk_window_get_origin (gtk_widget_get_window (w), x, y);
 
-	gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), &requisition,
-	                           NULL);
+	gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
 
 	gtk_widget_get_allocation (w, &allocation);
 
diff --git a/gedit/gedit-overlay.c b/gedit/gedit-overlay.c
index 74c0c79..fe9714a 100644
--- a/gedit/gedit-overlay.c
+++ b/gedit/gedit-overlay.c
@@ -193,11 +193,10 @@ gedit_overlay_realize (GtkWidget *widget)
 	attributes.height = allocation.height;
 	attributes.wclass = GDK_INPUT_OUTPUT;
 	attributes.visual = gtk_widget_get_visual (widget);
-	attributes.colormap = gtk_widget_get_colormap (widget);
 	attributes.event_mask = gtk_widget_get_events (widget);
 	attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
 
-	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
 
 	window = gdk_window_new (gtk_widget_get_parent_window (widget),
 	                         &attributes, attributes_mask);
@@ -223,8 +222,7 @@ set_children_positions (GeditOverlay *overlay)
 		if (child->child == overlay->priv->main_widget)
 			continue;
 
-		gtk_size_request_get_size (GTK_SIZE_REQUEST (child->child), &req,
-		                           NULL);
+		gtk_widget_get_preferred_size (child->child, &req, NULL);
 
 		/* FIXME: Add all the gravities here */
 		switch (child->gravity)
diff --git a/gedit/gedit-panel.c b/gedit/gedit-panel.c
index c32dd95..6590eb1 100644
--- a/gedit/gedit-panel.c
+++ b/gedit/gedit-panel.c
@@ -268,15 +268,6 @@ set_gtk_image_from_gtk_image (GtkImage *image,
 		case GTK_IMAGE_EMPTY:
 			gtk_image_clear (image);
 			break;
-		case GTK_IMAGE_PIXMAP:
-			{
-				GdkPixmap *pm;
-				GdkBitmap *bm;
-
-				gtk_image_get_pixmap (source, &pm, &bm);
-				gtk_image_set_from_pixmap (image, pm, bm);
-			}
-			break;
 		case GTK_IMAGE_PIXBUF:
 			{
 				GdkPixbuf *pb;
diff --git a/gedit/gedit-rounded-frame.c b/gedit/gedit-rounded-frame.c
index fb971d5..fd95d70 100644
--- a/gedit/gedit-rounded-frame.c
+++ b/gedit/gedit-rounded-frame.c
@@ -58,8 +58,8 @@ gedit_rounded_frame_size_request (GtkWidget      *widget,
 		GtkRequisition child_requisition;
 
 		/* Add the child's width/height */
-		gtk_size_request_get_size (GTK_SIZE_REQUEST (frame->priv->child),
-		                           &child_requisition, NULL);
+		gtk_widget_get_preferred_size (frame->priv->child,
+		                               &child_requisition, NULL);
 
 		requisition->width = MAX (0, child_requisition.width);
 		requisition->height = child_requisition.height;
@@ -137,20 +137,17 @@ draw_frame (GeditRoundedFrame *frame,
 }
 
 static gboolean
-gedit_rounded_frame_expose_event (GtkWidget      *widget,
-                                  GdkEventExpose *event)
+gedit_rounded_frame_draw (GtkWidget      *widget,
+                          cairo_t        *cr)
 {
 	GeditRoundedFrame *frame = GEDIT_ROUNDED_FRAME (widget);
 	GdkRectangle area;
-	cairo_t *cr;
 
 	if (!gtk_widget_is_drawable (widget))
 	{
 		return FALSE;
 	}
 
-	cr = gdk_cairo_create (event->window);
-
 	area.x = frame->priv->child_allocation.x - frame->priv->frame_width;
 	area.y = frame->priv->child_allocation.y - 2 * frame->priv->frame_width - 1;
 	area.width = frame->priv->child_allocation.width + 2 * frame->priv->frame_width;
@@ -158,16 +155,7 @@ gedit_rounded_frame_expose_event (GtkWidget      *widget,
 
 	draw_frame (frame, cr, &area);
 
-	if (frame->priv->child != NULL)
-	{
-		gtk_container_propagate_expose (GTK_CONTAINER (frame),
-		                                frame->priv->child,
-		                                event);
-	}
-
-	cairo_destroy (cr);
-
-	return FALSE;
+	return GTK_WIDGET_CLASS (gedit_rounded_frame_parent_class)->draw (widget, cr);
 }
 
 static void
@@ -206,7 +194,7 @@ gedit_rounded_frame_class_init (GeditRoundedFrameClass *klass)
 
 	widget_class->size_request = gedit_rounded_frame_size_request;
 	widget_class->size_allocate = gedit_rounded_frame_size_allocate;
-	widget_class->expose_event = gedit_rounded_frame_expose_event;
+	widget_class->draw = gedit_rounded_frame_draw;
 
 	container_class->add = gedit_rounded_frame_add;
 	container_class->remove = gedit_rounded_frame_remove;
diff --git a/gedit/gedit-status-combo-box.c b/gedit/gedit-status-combo-box.c
index 25411d1..63ca6eb 100644
--- a/gedit/gedit-status-combo-box.c
+++ b/gedit/gedit-status-combo-box.c
@@ -179,8 +179,8 @@ menu_position_func (GtkMenu		*menu,
 	
 	*push_in = FALSE;
 
-	gtk_size_request_get_size (GTK_SIZE_REQUEST (gtk_widget_get_toplevel (GTK_WIDGET (menu))),
-	                           &request, NULL);
+	gtk_widget_get_preferred_size (gtk_widget_get_toplevel (GTK_WIDGET (menu)),
+	                               &request, NULL);
 	
 	/* get the origin... */
 	gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y);
@@ -205,8 +205,8 @@ show_menu (GeditStatusComboBox *combo,
 	gint max_height;
 	GtkAllocation allocation;
 
-	gtk_size_request_get_size (GTK_SIZE_REQUEST (combo->priv->menu),
-	                           &request, NULL);
+	gtk_widget_get_preferred_size (combo->priv->menu,
+	                               &request, NULL);
 
 	/* do something relative to our own height here, maybe we can do better */
 	gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 4f94057..f7fa0c1 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -101,8 +101,8 @@ gedit_utils_menu_position_under_widget (GtkMenu  *menu,
 	widget = GTK_WIDGET (user_data);
 	widget_get_origin (widget, x, y);
 
-	gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), &requisition,
-	                           NULL);
+	gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition,
+	                               NULL);
 
 	gtk_widget_get_allocation (widget, &allocation);
 
@@ -157,8 +157,8 @@ gedit_utils_menu_position_under_tree_view (GtkMenu  *menu,
 		if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL)
 		{
 			GtkRequisition requisition;
-			gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
-			                           &requisition, NULL);
+			gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+			                               &requisition, NULL);
 			*x += rect.width - requisition.width;
 		}
 	}
@@ -877,7 +877,7 @@ gedit_utils_get_window_workspace (GtkWindow *gtkwindow)
 	g_return_val_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtkwindow)), 0);
 
 	window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
-	display = gdk_drawable_get_display (window);
+	display = gdk_window_get_display (window);
 
 	gdk_error_trap_push ();
 	result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index f8725a9..c4b25ad 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -101,8 +101,8 @@ static void	gedit_view_realize		(GtkWidget        *widget);
 static gboolean reset_searched_text		(GeditView        *view);
 
 
-static gint	gedit_view_expose	 	(GtkWidget        *widget,
-						 GdkEventExpose   *event);
+static gboolean	gedit_view_draw			(GtkWidget        *widget,
+						 cairo_t          *cr);
 static void 	search_highlight_updated_cb	(GeditDocument    *doc,
 						 GtkTextIter      *start,
 						 GtkTextIter      *end,
@@ -149,7 +149,7 @@ gedit_view_class_init (GeditViewClass *klass)
 
 	widget_class->destroy = gedit_view_destroy;
 	widget_class->focus_out_event = gedit_view_focus_out;
-	widget_class->expose_event = gedit_view_expose;
+	widget_class->draw = gedit_view_draw;
 
 	/*
 	 * Override the gtk_text_view_drag_motion and drag_drop
@@ -716,18 +716,20 @@ reset_searched_text (GeditView *view)
 	return TRUE;
 }
 
-static gint
-gedit_view_expose (GtkWidget      *widget,
-                   GdkEventExpose *event)
+static gboolean
+gedit_view_draw (GtkWidget *widget,
+                 cairo_t   *cr)
 {
 	GtkTextView *text_view;
 	GeditDocument *doc;
+	GdkWindow *window;
 
 	text_view = GTK_TEXT_VIEW (widget);
 
 	doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (text_view));
+	window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT);
 
-	if ((event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)) &&
+	if (gtk_cairo_should_draw_window (cr, window) &&
 	    gedit_document_get_enable_search_highlighting (doc))
 	{
 		GdkRectangle visible_rect;
@@ -746,7 +748,7 @@ gedit_view_expose (GtkWidget      *widget,
 					       &iter2);
 	}
 
-	return GTK_WIDGET_CLASS (gedit_view_parent_class)->expose_event (widget, event);
+	return GTK_WIDGET_CLASS (gedit_view_parent_class)->draw (widget, cr);
 }
 
 static GdkAtom
diff --git a/gedit/theatrics/gedit-theatrics-animated-widget.c b/gedit/theatrics/gedit-theatrics-animated-widget.c
index 5ba58a3..a03e5bc 100644
--- a/gedit/theatrics/gedit-theatrics-animated-widget.c
+++ b/gedit/theatrics/gedit-theatrics-animated-widget.c
@@ -224,7 +224,6 @@ gedit_theatrics_animated_widget_realize (GtkWidget *widget)
 	window = gdk_window_new (parent_window, &attributes, 0);
 	gdk_window_set_user_data (window, widget);
 	gtk_widget_set_window (widget, window);
-	gdk_window_set_back_pixmap (window, NULL, FALSE);
 	style = gtk_style_attach (style, window);
 	gtk_widget_set_style (widget, style);
 	gtk_style_set_background (style, window, GTK_STATE_NORMAL);
@@ -242,8 +241,8 @@ gedit_theatrics_animated_widget_size_request (GtkWidget      *widget,
 	{
 		GtkRequisition req;
 
-		gtk_size_request_get_size (GTK_SIZE_REQUEST (aw->priv->widget),
-		                           &req, NULL);
+		gtk_widget_get_preferred_size (aw->priv->widget,
+		                               &req, NULL);
 		aw->priv->widget_alloc.width = req.width;
 		aw->priv->widget_alloc.height = req.height;
 	}
@@ -311,8 +310,8 @@ gedit_theatrics_animated_widget_size_allocate (GtkWidget     *widget,
 }
 
 static gboolean
-gedit_theatrics_animated_widget_expose_event (GtkWidget      *widget,
-					      GdkEventExpose *event)
+gedit_theatrics_animated_widget_draw (GtkWidget      *widget,
+				      cairo_t        *cr)
 {
 	GeditTheatricsAnimatedWidget *aw = GEDIT_THEATRICS_ANIMATED_WIDGET (widget);
 
@@ -321,23 +320,19 @@ gedit_theatrics_animated_widget_expose_event (GtkWidget      *widget,
 		/* Do not scale if the size is 0 */
 		if (aw->priv->width > 0 && aw->priv->height > 0)
 		{
-			cairo_t *cr;
-			cr = gdk_cairo_create (event->window);
-
 			cairo_scale (cr,
 				     aw->priv->widget_alloc.width / aw->priv->width,
 				     aw->priv->widget_alloc.height / aw->priv->height);
 			cairo_set_source_surface (cr, aw->priv->surface, 0, 0);
 
 			cairo_paint (cr);
-			cairo_destroy (cr);
 		}
 
 		return TRUE;
 	}
 	else
 	{
-		return GTK_WIDGET_CLASS (gedit_theatrics_animated_widget_parent_class)->expose_event (widget, event);
+		return GTK_WIDGET_CLASS (gedit_theatrics_animated_widget_parent_class)->draw (widget, cr);
 	}
 }
 
@@ -381,7 +376,7 @@ gedit_theatrics_animated_widget_class_init (GeditTheatricsAnimatedWidgetClass *k
 	widget_class->realize = gedit_theatrics_animated_widget_realize;
 	widget_class->size_request = gedit_theatrics_animated_widget_size_request;
 	widget_class->size_allocate = gedit_theatrics_animated_widget_size_allocate;
-	widget_class->expose_event = gedit_theatrics_animated_widget_expose_event;
+	widget_class->draw = gedit_theatrics_animated_widget_draw;
 
 	container_class->add = gedit_theatrics_animated_widget_add;
 	container_class->remove = gedit_theatrics_animated_widget_remove;
diff --git a/plugins/spell/gedit-spell-checker-dialog.c b/plugins/spell/gedit-spell-checker-dialog.c
index 7eaed42..30bca62 100644
--- a/plugins/spell/gedit-spell-checker-dialog.c
+++ b/plugins/spell/gedit-spell-checker-dialog.c
@@ -128,7 +128,7 @@ gedit_spell_checker_dialog_dispose (GObject *object)
 		dlg->misspelled_word = NULL;
 	}
 
-	G_OBJECT_CLASS (gedit_spell_checker_dialog_parent_class)->dipose (object);
+	G_OBJECT_CLASS (gedit_spell_checker_dialog_parent_class)->dispose (object);
 }
 
 static void
diff --git a/plugins/time/gedit-time-plugin.c b/plugins/time/gedit-time-plugin.c
index cdc4000..fa914c1 100644
--- a/plugins/time/gedit-time-plugin.c
+++ b/plugins/time/gedit-time-plugin.c
@@ -425,11 +425,11 @@ static void
 configure_widget_destroyed (GtkWidget *widget,
 			    gpointer   data)
 {
-	TimeConfigureWidget *widget = (TimeConfigureWidget *)data;
+	TimeConfigureWidget *conf_widget = (TimeConfigureWidget *)data;
 
 	gedit_debug (DEBUG_PLUGINS);
 
-	g_object_unref (widget->settings);
+	g_object_unref (conf_widget->settings);
 	g_slice_free (TimeConfigureWidget, data);
 
 	gedit_debug_message (DEBUG_PLUGINS, "END");



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