[gimp] Use various GTK+ accessors



commit e610e5420bbdd8e1ae3d9b933456e378390848c7
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 9 22:52:44 2009 +0200

    Use various GTK+ accessors

 plug-ins/map-object/map-object-preview.c |   26 +++++++++++++-------------
 plug-ins/map-object/map-object-ui.c      |   28 ++++++++++++++--------------
 2 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index 4c2fad6..7bb8017 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -322,11 +322,11 @@ draw_light_marker (gint xpos,
       else if ((backbuf.y + backbuf.h) > PREVIEW_HEIGHT)
         backbuf.h = (PREVIEW_WIDTH - backbuf.y);
 
-      backbuf.image = gdk_drawable_get_image (previewarea->window,
+      backbuf.image = gdk_drawable_get_image (gtk_widget_get_window (previewarea),
                                               backbuf.x, backbuf.y,
                                               backbuf.w, backbuf.h);
 
-      gdk_draw_arc (previewarea->window, gc,
+      gdk_draw_arc (gtk_widget_get_window (previewarea), gc,
 		    TRUE,
 		    lightx - 7, lighty - 7, 14, 14,
 		    0, 360 * 64);
@@ -355,7 +355,7 @@ clear_light_marker (void)
 
       gdk_gc_set_function (gc, GDK_COPY);
 
-      gdk_draw_image (previewarea->window, gc,
+      gdk_draw_image (gtk_widget_get_window (previewarea), gc,
 		      backbuf.image,
 		      0, 0,
 		      backbuf.x, backbuf.y,
@@ -442,22 +442,22 @@ draw_preview_image (gint docompute)
       GdkCursor  *cursor;
 
       cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
-      gdk_window_set_cursor (previewarea->window, cursor);
+      gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
       gdk_cursor_unref (cursor);
 
       compute_preview (0, 0, width - 1, height - 1, pw, ph);
 
       cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
-      gdk_window_set_cursor(previewarea->window, cursor);
+      gdk_window_set_cursor(gtk_widget_get_window (previewarea), cursor);
       gdk_cursor_unref (cursor);
 
       clear_light_marker ();
     }
 
   if (pw != PREVIEW_WIDTH || ph != PREVIEW_HEIGHT)
-    gdk_window_clear (previewarea->window);
+    gdk_window_clear (gtk_widget_get_window (previewarea));
 
-  gdk_draw_rgb_image (previewarea->window, gc,
+  gdk_draw_rgb_image (gtk_widget_get_window (previewarea), gc,
                       startx, starty, pw, ph,
                       GDK_RGB_DITHER_MAX,
                       preview_rgb_data, 3 * pw);
@@ -590,7 +590,7 @@ draw_wireframe_plane (gint startx,
 				      linetab[n].linestyle,
 				      GDK_CAP_NOT_LAST,
 				      GDK_JOIN_MITER);
-          gdk_draw_line (previewarea->window, gc,
+          gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 			 linetab[n].x1, linetab[n].y1,
 			 linetab[n].x2, linetab[n].y2);
           n++;
@@ -614,7 +614,7 @@ draw_wireframe_plane (gint startx,
 				      linetab[n].linestyle,
 				      GDK_CAP_NOT_LAST,
 				      GDK_JOIN_MITER);
-          gdk_draw_line (previewarea->window, gc,
+          gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 			 linetab[n].x1, linetab[n].y1,
 			 linetab[n].x2, linetab[n].y2);
           n++;
@@ -732,7 +732,7 @@ draw_wireframe_sphere (gint startx,
 					  linetab[n].linestyle,
 					  GDK_CAP_NOT_LAST,
 					  GDK_JOIN_MITER);
-              gdk_draw_line (previewarea->window, gc,
+              gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 			     linetab[n].x1, linetab[n].y1,
 			     linetab[n].x2, linetab[n].y2);
               n++;
@@ -773,7 +773,7 @@ draw_wireframe_sphere (gint startx,
 				      linetab[n].linestyle,
 				      GDK_CAP_NOT_LAST,
 				      GDK_JOIN_MITER);
-          gdk_draw_line (previewarea->window, gc,
+          gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 			 linetab[n].x1, linetab[n].y1,
 			 linetab[n].x2, linetab[n].y2);
           n++;
@@ -822,7 +822,7 @@ draw_line (gint        n,
 				  linetab[i].linestyle,
 				  GDK_CAP_NOT_LAST,
 				  GDK_JOIN_MITER);
-      gdk_draw_line (previewarea->window, gc,
+      gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 		     linetab[i].x1, linetab[i].y1,
 		     linetab[i].x2, linetab[i].y2);
       i++;
@@ -982,7 +982,7 @@ clear_wireframe (void)
 				  linetab[n].linestyle,
 				  GDK_CAP_NOT_LAST,
 				  GDK_JOIN_MITER);
-      gdk_draw_line (previewarea->window, gc,
+      gdk_draw_line (gtk_widget_get_window (previewarea), gc,
 		     linetab[n].x1, linetab[n].y1,
 		     linetab[n].x2, linetab[n].y2);
       n++;
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index 0066bf2..cfe8884 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -202,6 +202,9 @@ static void
 mapmenu_callback (GtkWidget *widget,
 		  gpointer   data)
 {
+  GList *children;
+  gint   n_children;
+
   gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
 
   draw_preview_image (TRUE);
@@ -230,13 +233,15 @@ mapmenu_callback (GtkWidget *widget,
       linetab[0].x1 = -1;
     }
 
+  children = gtk_container_get_children (GTK_CONTAINER (options_note_book));
+  n_children = g_list_length (children);
+  g_list_free (children);
+
   if (mapvals.maptype == MAP_BOX)
     {
       if (cylinder_page != NULL)
         {
-          gtk_notebook_remove_page
-	    (options_note_book,
-	     g_list_length (options_note_book->children) - 1);
+          gtk_notebook_remove_page (options_note_book, n_children - 1);
           cylinder_page = NULL;
         }
 
@@ -252,9 +257,7 @@ mapmenu_callback (GtkWidget *widget,
     {
       if (box_page != NULL)
         {
-          gtk_notebook_remove_page
-	    (options_note_book,
-	     g_list_length (options_note_book->children) - 1);
+          gtk_notebook_remove_page (options_note_book, n_children - 1);
           box_page = NULL;
         }
 
@@ -270,16 +273,13 @@ mapmenu_callback (GtkWidget *widget,
     {
       if (box_page != NULL)
         {
-          gtk_notebook_remove_page
-	    (options_note_book,
-	     g_list_length (options_note_book->children) - 1);
+          gtk_notebook_remove_page (options_note_book, n_children - 1);
+          n_children--;
         }
 
       if (cylinder_page != NULL)
         {
-          gtk_notebook_remove_page
-	    (options_note_book,
-	     g_list_length (options_note_book->children) - 1);
+          gtk_notebook_remove_page (options_note_book, n_children - 1);
         }
 
       box_page = NULL;
@@ -360,7 +360,7 @@ preview_events (GtkWidget *area,
 
         if (!gc)
           {
-            gc = gdk_gc_new (area->window);
+            gc = gdk_gc_new (gtk_widget_get_window (area));
             draw_preview_image (TRUE);
           }
         else
@@ -1434,7 +1434,7 @@ main_dialog (GimpDrawable *drawable)
 
     cursor = gdk_cursor_new_for_display (gtk_widget_get_display (previewarea),
                                          GDK_HAND2);
-    gdk_window_set_cursor (previewarea->window, cursor);
+    gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
     gdk_cursor_unref (cursor);
   }
 



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