[memprof: 71/76] Compile with GSEAL_ENABLE in preparation for GNOME 3.0



commit 39c8d519bdfa419e1ae7842fc597887dd7e8c85b
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Thu Apr 15 09:12:11 2010 +0200

    Compile with GSEAL_ENABLE in preparation for GNOME 3.0

 src/detailwin.c |   58 +++++++++++++++++++++++++++++++++++++------------------
 src/main.c      |   34 ++++++++++++++++++++-----------
 src/tree.c      |    4 +-
 3 files changed, 63 insertions(+), 33 deletions(-)
---
diff --git a/src/detailwin.c b/src/detailwin.c
index 63fe3e2..2a154f4 100644
--- a/src/detailwin.c
+++ b/src/detailwin.c
@@ -44,17 +44,26 @@
 static void
 dw_draw_memstats(ProcessWindow *pwin)
 {
+   GtkAllocation allocation;
+   GdkWindow *window;
    GtkWidget *widget;
+   GtkStyle *style;
    GdkPixmap *pixmap;
+   GtkStateType state;
    gint64 i, j, x, y, w, h, hh;
 
    widget = pwin->time_graph;
-   w = widget->allocation.width;
-   h = widget->allocation.height;
-   if (!widget->window) return;
-   pixmap = gdk_pixmap_new(widget->window, w, h, -1);
+   window = gtk_widget_get_window (widget);
+   if (!window)
+       return;
+
+   style = gtk_widget_get_style (widget);
+   gtk_widget_get_allocation(widget, &allocation);
+   w = allocation.width;
+   h = allocation.height;
+   pixmap = gdk_pixmap_new(gtk_widget_get_window (widget), w, h, -1);
    gdk_draw_rectangle(pixmap,
-		      widget->style->base_gc[GTK_STATE_NORMAL],
+		      style->base_gc[GTK_STATE_NORMAL],
 		      TRUE,
 		      0, 0, w, h);
    for (i = 0; i < MEMSTATS; i++)
@@ -67,7 +76,7 @@ dw_draw_memstats(ProcessWindow *pwin)
 	  hh = 0;
 	y = h - hh;
 	gdk_draw_rectangle(pixmap,
-			   widget->style->base_gc[GTK_STATE_SELECTED],
+			   style->base_gc[GTK_STATE_SELECTED],
 			   TRUE,
 			   x, y, 1, hh);
 	if (pwin->usage_high > 0)
@@ -76,7 +85,7 @@ dw_draw_memstats(ProcessWindow *pwin)
 	  hh = 0;
 	y = h - hh;
 	gdk_draw_rectangle(pixmap,
-			   widget->style->text_gc[GTK_STATE_NORMAL],
+			   style->text_gc[GTK_STATE_NORMAL],
 			   TRUE,
 			   x, y, 1, hh);
      }
@@ -85,7 +94,7 @@ dw_draw_memstats(ProcessWindow *pwin)
 	GdkGC *gc;
 
 	gc = gdk_gc_new(pixmap);
-	gdk_gc_copy(gc, widget->style->dark_gc[GTK_STATE_NORMAL]);
+	gdk_gc_copy(gc, style->dark_gc[GTK_STATE_NORMAL]);
 	gdk_gc_set_line_attributes(gc, 0, GDK_LINE_ON_OFF_DASH,
 				   GDK_CAP_BUTT, GDK_JOIN_MITER);
 	for (j = 0, i = 0; i < pwin->usage_high; i += (256 * 1024), j++)
@@ -93,7 +102,7 @@ dw_draw_memstats(ProcessWindow *pwin)
 	     if (j > 3) j = 0;
 	     y = h - ((i * h) / pwin->usage_high);
 	     if (j == 0)
-	       gdk_draw_line(pixmap, widget->style->dark_gc[GTK_STATE_NORMAL],
+	       gdk_draw_line(pixmap, style->dark_gc[GTK_STATE_NORMAL],
 			     0, y, w, y);
 	     else
 	       gdk_draw_line(pixmap, gc,
@@ -101,8 +110,10 @@ dw_draw_memstats(ProcessWindow *pwin)
 	  }
 	gdk_gc_unref(gc);
      }
-   gdk_draw_pixmap(widget->window,
-		   widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+
+   state = gtk_widget_get_state (widget);
+   gdk_draw_pixmap(gtk_widget_get_window (widget),
+		   gtk_widget_get_style (widget)->fg_gc[state],
 		   pixmap, 0, 0, 0, 0, w, h);
    gdk_pixmap_unref(pixmap);
 }
@@ -172,7 +183,11 @@ dw_draw_memmap_foreach(gpointer key, gpointer value, gpointer data)
 static void
 dw_draw_memmap(ProcessWindow *pwin)
 {
+   GtkAllocation allocation;
+   GdkWindow *window;
    GtkWidget *widget;
+   GtkStyle *style;
+   GtkStateType state;
    GdkPixmap *pixmap, *stip;
    guint64 w, h, y, bpl, i;
    Mem mem;
@@ -187,11 +202,15 @@ dw_draw_memmap(ProcessWindow *pwin)
      return;
 
    widget = pwin->mem_map;
-   w = widget->allocation.width;
-   h = widget->allocation.height;
-   if (!widget->window) return;
-   pixmap = gdk_pixmap_new(widget->window, w, h, -1);
-   stip = gdk_pixmap_new(widget->window, 2, 2, 1);
+   window = gtk_widget_get_window (widget);
+   if (!window) return;
+
+   style = gtk_widget_get_style (widget);
+   gtk_widget_get_allocation(widget, &allocation);
+   w = allocation.width;
+   h = allocation.height;
+   pixmap = gdk_pixmap_new(window, w, h, -1);
+   stip = gdk_pixmap_new(window, 2, 2, 1);
    
    gc_none = gdk_gc_new(pixmap);
    gc_bg = gdk_gc_new(pixmap);
@@ -430,7 +449,7 @@ dw_draw_memmap(ProcessWindow *pwin)
                        
                     }
                }
-             gtk_draw_string(widget->style,
+             gtk_draw_string(style,
                              pixmap,
                              GTK_STATE_NORMAL,
                              0 + 5, reg->y + reg->h - 5,
@@ -448,8 +467,9 @@ dw_draw_memmap(ProcessWindow *pwin)
      }
    g_list_free(mem.regs);
 
-   gdk_draw_pixmap(widget->window,
-		   widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+   state = gtk_widget_get_state (widget);
+   gdk_draw_pixmap(window,
+		   style->fg_gc[state],
 		   pixmap, 0, 0, 0, 0, w, h);
    
    gdk_gc_unref(gc_none);
diff --git a/src/main.c b/src/main.c
index 77c2bc2..43a4924 100644
--- a/src/main.c
+++ b/src/main.c
@@ -125,17 +125,20 @@ static void
 draw_bar (GtkWidget *widget, int red, int green, int blue,
 	  int size)
 {
-	GdkGC *gc = gdk_gc_new (widget->window);
+	GtkAllocation allocation;
+	GdkWindow *window = gtk_widget_get_window (widget);
+	GdkGC *gc = gdk_gc_new (window);
  	GdkColor color;
 
 	color.red = red;
 	color.green = green;
 	color.blue = blue;
 
+	gtk_widget_get_allocation (widget, &allocation);
 	gdk_gc_set_rgb_fg_color (gc, &color);
 
-	gdk_draw_rectangle (widget->window, gc, TRUE,
-			    0, 0, size, widget->allocation.height);
+	gdk_draw_rectangle (window, gc, TRUE,
+			    0, 0, size, allocation.height);
 
 	color.red = 0;
 	color.green = 0;
@@ -143,8 +146,8 @@ draw_bar (GtkWidget *widget, int red, int green, int blue,
 	
 	gdk_gc_set_rgb_fg_color (gc, &color);
 
-	gdk_draw_rectangle (widget->window, gc, FALSE,
-			    0, 0, size - 1, widget->allocation.height - 1);
+	gdk_draw_rectangle (window, gc, FALSE,
+			    0, 0, size - 1, allocation.height - 1);
 	
 	g_object_unref (gc);
 }
@@ -153,6 +156,7 @@ static gboolean
 on_usage_area_expose (GtkWidget *widget, GdkEvent *event,
 		      gpointer data)
 {
+	GtkAllocation allocation;
 	ProcessWindow *pwin = data;
 	int width;
 	int bytes_used;
@@ -160,7 +164,8 @@ on_usage_area_expose (GtkWidget *widget, GdkEvent *event,
 	int high_size;
 	int current_size;
 
-	width = widget->allocation.width;
+	gtk_widget_get_allocation (widget, &allocation);
+	width = allocation.width;
 
 	/* background */
 	draw_bar (widget, 0xffff, 0xffff, 0xffff, width);
@@ -836,10 +841,11 @@ pwin_from_widget (GtkWidget *widget)
 	GtkWidget *app;
 
 	if (GTK_IS_MENU_ITEM (widget)) {
-		GtkWidget *menu_shell = widget->parent;
+		GtkWidget *menu_shell = gtk_widget_get_parent (widget);
 
 		while (menu_shell && !GTK_IS_MENU_BAR (menu_shell)) {
-			menu_shell = gtk_menu_get_attach_widget (GTK_MENU (menu_shell))->parent;
+			menu_shell = gtk_menu_get_attach_widget (GTK_MENU (menu_shell));
+			menu_shell = gtk_widget_get_parent (menu_shell);
 		}
 		g_assert (menu_shell != NULL);
 
@@ -1454,7 +1460,7 @@ set_default_size (GtkWindow *window)
 	GtkWidget *widget = GTK_WIDGET (window);
 	
 	screen = gtk_widget_get_screen (widget);
-	monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+	monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
 	
 	gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 	
@@ -1590,7 +1596,7 @@ process_window_get_process (ProcessWindow *pwin)
 gboolean
 process_window_visible (ProcessWindow *pwin)
 {
-	return GTK_WIDGET_VISIBLE (pwin->main_window);
+	return gtk_widget_get_visible (pwin->main_window);
 }
 
 void
@@ -1599,7 +1605,7 @@ process_window_show (ProcessWindow *pwin)
 	if (!process_window_visible (pwin))
 		gtk_widget_show (pwin->main_window);
 	else
-		gdk_window_show (pwin->main_window->window);
+		gdk_window_show (gtk_widget_get_window (pwin->main_window));
 }
 
 void
@@ -1616,7 +1622,7 @@ check_quit (void)
 	
 	tmplist = toplevels = gtk_window_list_toplevels ();
 	while (tmplist) {
-		if (GTK_WIDGET_VISIBLE (toplevels->data))
+		if (gtk_widget_get_visible (toplevels->data))
 			return;
 		tmplist = tmplist->next;
 	}
@@ -1787,9 +1793,13 @@ main(int argc, char **argv)
 {
        ProcessWindow *initial_window;
        
+
+        printf("befor argc: %d\n", argc);
        gtk_init (&argc, &argv);
        
        parse_options (&argc, &argv);
+        printf("after argc: %d\n", argc);
+
 	
        /* Set up a handler for SIGCHLD to avoid zombie children
 	*/
diff --git a/src/tree.c b/src/tree.c
index d7b72bf..6772ffc 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -54,7 +54,7 @@ make_menu_item (const char *label, GCallback cb)
 static ProcessWindow *
 get_process_window (GtkWidget *menu_item)
 {
-	return g_object_get_data (G_OBJECT (menu_item->parent), "process-window");
+	return g_object_get_data (G_OBJECT (gtk_widget_get_parent (menu_item)), "process-window");
 }
 
 static void
@@ -194,7 +194,7 @@ tree_window_show (void)
 	ensure_tree_window ();
 	
 	gtk_widget_show (tree_window);
-	gdk_window_show (tree_window->window); /* Raise */
+	gdk_window_show (gtk_widget_get_window (tree_window)); /* Raise */
 }
 
 static ProcessWindow *



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