[ekiga] Made ekiga mostly GSeal-proof



commit 1eeca1d42ff289abf78a431ff32a47a31ef98dc9
Author: Julien Puydt <jpuydt gnome org>
Date:   Wed Mar 3 16:41:37 2010 +0100

    Made ekiga mostly GSeal-proof
    
    That required upping our gtk+ version dep (I checked 2.18 is current on most linux distributions, netBSD, freeBSD and win32).
    
    It is mostly a case of replacing TYPE_FOO (obj)->bar with type_get_foo (obj) or some such.
    
    Very very boring.
    
    We lack : something for GTK_WIDGET_IS_REALIZED and access to GtkStatusBar->messages ... but those are gtk+ limitations... wait and see.

 configure.ac                       |    2 +-
 lib/gui/gm-smiley-chooser-button.c |   16 +++--
 lib/gui/gmcellrendererexpander.c   |   45 +++++++++----
 lib/gui/gmconfwidgets.c            |    4 +-
 lib/gui/gmdialog.c                 |   18 +++---
 lib/gui/gmentrydialog.c            |    2 +-
 lib/gui/gmlevelmeter.c             |  127 +++++++++++++++++++-----------------
 lib/gui/gmmenuaddon.c              |   24 +++----
 lib/gui/gmpreferences.c            |    6 +-
 lib/gui/gmwindow.c                 |    2 +-
 10 files changed, 137 insertions(+), 109 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 94f944d..dac435e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,7 +175,7 @@ IT_PROG_INTLTOOL([0.35.0])
 dnl ###############################
 dnl   Mandatory GTK+ support
 dnl ###############################
-PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.12.0])
+PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.18.0])
 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.8.0 gmodule-2.0 gobject-2.0 gthread-2.0])
 AC_ARG_ENABLE([gtk-debug],
               [AC_HELP_STRING([--enable-gtk-debug],[enable GTK+ debug flags (default is disabled)])],
diff --git a/lib/gui/gm-smiley-chooser-button.c b/lib/gui/gm-smiley-chooser-button.c
index 33f7420..5356ac2 100644
--- a/lib/gui/gm-smiley-chooser-button.c
+++ b/lib/gui/gm-smiley-chooser-button.c
@@ -492,6 +492,8 @@ static void gm_smiley_chooser_button_reposition_popup (GmSmileyChooserButton* se
 {
   gint final_x = 0;
   gint final_y = 0;
+  GtkAllocation allocation;
+  GtkAllocation popup_allocation;
 
   g_return_if_fail (self != NULL);
   g_return_if_fail (GM_IS_SMILEY_CHOOSER_BUTTON (self));
@@ -502,13 +504,13 @@ static void gm_smiley_chooser_button_reposition_popup (GmSmileyChooserButton* se
   if (!self->priv->popup_window)
     return;
 
+  gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
+  gtk_widget_get_allocation (GTK_WIDGET (self->priv->popup_window), &popup_allocation);
+
   /* calculate the new position out of the button's
    * and the smiley's sizes */
-  final_x = ref_x +
-    GTK_WIDGET (self)->allocation.x;
-  final_y = ref_y +
-    GTK_WIDGET (self)->allocation.y -
-    GTK_WIDGET (self->priv->popup_window)->allocation.height;
+  final_x = ref_x + allocation.x;
+  final_y = ref_y + allocation.y - popup_allocation.height;
 
   /* move its ass */
   gtk_window_move (GTK_WINDOW (self->priv->popup_window),
@@ -559,7 +561,7 @@ gm_smiley_chooser_button_popup (GmSmileyChooserButton* self)
   priv = self->priv;
 
   /* get my position data and position the popup */
-  (void) gdk_window_get_origin (GTK_WIDGET (self)->window,
+  (void) gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (self)),
                                 &my_x, &my_y);
 
   gtk_window_move (GTK_WINDOW (priv->popup_window),
@@ -785,7 +787,7 @@ gm_smiley_chooser_button_new (void)
   /* if already possible (unlikely), initially set the toplevel reference */
   widget = gtk_widget_get_toplevel (GTK_WIDGET (self));
   if (widget &&
-      GTK_WIDGET_TOPLEVEL (widget) &&
+      gtk_widget_is_toplevel (widget) &&
       GTK_IS_WINDOW (widget))
     {
       g_object_ref_sink (G_OBJECT (widget));
diff --git a/lib/gui/gmcellrendererexpander.c b/lib/gui/gmcellrendererexpander.c
index a6606a5..f69bd9c 100644
--- a/lib/gui/gmcellrendererexpander.c
+++ b/lib/gui/gmcellrendererexpander.c
@@ -104,9 +104,11 @@ gm_cell_renderer_expander_init (GmCellRendererExpander *expander)
   priv->activatable = TRUE;
   priv->animation_node = NULL;
 
-  GTK_CELL_RENDERER (expander)->xpad = 2;
-  GTK_CELL_RENDERER (expander)->ypad = 2;
-  GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+  g_object_set (G_OBJECT (expander),
+		"xpad", 2,
+		"ypad", 2,
+		"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
+		NULL);
 }
 
 static void
@@ -255,18 +257,26 @@ gm_cell_renderer_expander_get_size (GtkCellRenderer *cell,
 {
   GmCellRendererExpander     *expander;
   GmCellRendererExpanderPriv *priv;
+  gfloat xalign, yalign;
+  guint xpad, ypad;
 
   expander = (GmCellRendererExpander*) cell;
   priv = GET_PRIV (expander);
+  g_object_get (G_OBJECT (cell),
+		"xalign", &xalign,
+		"yalign", &yalign,
+		"xpad", &xpad,
+		"ypad", &ypad,
+		NULL);
 
   if (cell_area) {
     if (x_offset) {
-      *x_offset = cell->xalign * (cell_area->width - (priv->expander_size + (2 * cell->xpad)));
+      *x_offset = xalign * (cell_area->width - (priv->expander_size + (2 * xpad)));
       *x_offset = MAX (*x_offset, 0);
     }
 
     if (y_offset) {
-      *y_offset = cell->yalign * (cell_area->height - (priv->expander_size + (2 * cell->ypad)));
+      *y_offset = yalign * (cell_area->height - (priv->expander_size + (2 * ypad)));
       *y_offset = MAX (*y_offset, 0);
     }
   } else {
@@ -278,10 +288,10 @@ gm_cell_renderer_expander_get_size (GtkCellRenderer *cell,
   }
 
   if (width)
-    *width = cell->xpad * 2 + priv->expander_size;
+    *width = xpad * 2 + priv->expander_size;
 
   if (height)
-    *height = cell->ypad * 2 + priv->expander_size;
+    *height = ypad * 2 + priv->expander_size;
 }
 
 static void
@@ -297,9 +307,16 @@ gm_cell_renderer_expander_render (GtkCellRenderer      *cell,
   GmCellRendererExpanderPriv *priv;
   GtkExpanderStyle                expander_style;
   gint                            x_offset, y_offset;
+  guint xpad, ypad;
+  GtkAllocation allocation;
 
   expander = (GmCellRendererExpander*) cell;
   priv = GET_PRIV (expander);
+  g_object_get (G_OBJECT (cell),
+		"xpad", &xpad,
+		"ypad", &ypad,
+		NULL);
+  gtk_widget_get_allocation (widget, &allocation);
 
   if (priv->animation_node) {
     GtkTreePath *path;
@@ -322,17 +339,17 @@ gm_cell_renderer_expander_render (GtkCellRenderer      *cell,
                                       &x_offset, &y_offset,
                                       NULL, NULL);
 
-  gtk_paint_expander (widget->style,
+  gtk_paint_expander (gtk_widget_get_style (widget),
                       window,
                       GTK_STATE_NORMAL,
                       expose_area,
                       widget,
                       "treeview",
-                      cell_area->x + x_offset + cell->xpad + priv->expander_size / 2,
-                      cell_area->y + y_offset + cell->ypad + priv->expander_size / 2,
+                      cell_area->x + x_offset + xpad + priv->expander_size / 2,
+                      cell_area->y + y_offset + ypad + priv->expander_size / 2,
                       expander_style);
-  gtk_paint_hline (widget->style, window, GTK_STATE_NORMAL, NULL, widget, NULL, 0,
-                   widget->allocation.width, cell_area->y + cell_area->height);
+  gtk_paint_hline (gtk_widget_get_style (widget), window, GTK_STATE_NORMAL, NULL, widget, NULL, 0,
+                   allocation.width, cell_area->y + cell_area->height);
 }
 
 static void
@@ -341,13 +358,15 @@ invalidate_node (GtkTreeView *tree_view,
 {
   GdkWindow    *bin_window;
   GdkRectangle  rect;
+  GtkAllocation allocation;
 
   bin_window = gtk_tree_view_get_bin_window (tree_view);
 
   gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
+  gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
 
   rect.x = 0;
-  rect.width = GTK_WIDGET (tree_view)->allocation.width;
+  rect.width = allocation.width;
 
   gdk_window_invalidate_rect (bin_window, &rect, TRUE);
 }
diff --git a/lib/gui/gmconfwidgets.c b/lib/gui/gmconfwidgets.c
index 1680d86..3454a78 100644
--- a/lib/gui/gmconfwidgets.c
+++ b/lib/gui/gmconfwidgets.c
@@ -209,8 +209,8 @@ adjustment_changed (GtkAdjustment *adj,
 
   key = (gchar *) data;
 
-  if (gm_conf_get_int (key) != (int) adj->value)
-    gm_conf_set_int (key, (int) adj->value);
+  if (gm_conf_get_int (key) != (int) gtk_adjustment_get_value (adj))
+    gm_conf_set_int (key, (int) gtk_adjustment_get_value (adj));
 }
 
 
diff --git a/lib/gui/gmdialog.c b/lib/gui/gmdialog.c
index 41c07eb..6a66c45 100644
--- a/lib/gui/gmdialog.c
+++ b/lib/gui/gmdialog.c
@@ -151,14 +151,15 @@ warning_dialog_destroyed_cb (GtkWidget *w,
 {
   GList *children = NULL;
   
-  children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (w)->vbox));
+  children = gtk_container_get_children (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (w))));
 
   g_return_if_fail (data != NULL);
 
   while (children) {
     
     if (GTK_IS_TOGGLE_BUTTON (children->data)) 
-      g_object_set_data (G_OBJECT (gtk_window_get_transient_for (GTK_WINDOW (w))), (const char *) data, GINT_TO_POINTER ((int) (GTK_TOGGLE_BUTTON (children->data)->active)));
+      g_object_set_data (G_OBJECT (gtk_window_get_transient_for (GTK_WINDOW (w))), (const char *) data,
+			 GINT_TO_POINTER ((int) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (children->data)))));
   
     children = g_list_next (children);
   }
@@ -271,11 +272,11 @@ gnomemeeting_progress_dialog (GtkWindow *parent,
   
   label = gtk_label_new (NULL);
   gtk_label_set_markup (GTK_LABEL (label), dialog_text);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, 
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, 
 		      FALSE, FALSE, 0);
   
   progressbar = gtk_progress_bar_new ();
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), progressbar, 
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), progressbar, 
 		      FALSE, FALSE, 0);
 
   id = g_timeout_add (100, progress_dialog_pulse_cb, progressbar);
@@ -351,10 +352,9 @@ gnomemeeting_warning_dialog_on_widget (GtkWindow *parent,
   gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
   
   gtk_window_set_title (GTK_WINDOW (dialog), "");
-  gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label),
-			dialog_text);
+  gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), dialog_text);
 
-  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 
                      button);
   
   /* Can be called from threads */
@@ -416,8 +416,8 @@ gnomemeeting_dialog (GtkWindow *parent,
 			    GTK_BUTTONS_OK, NULL);
 
   gtk_window_set_title (GTK_WINDOW (dialog), "");
-  gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label),
-			dialog_text);
+  gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
+				 dialog_text);
   
   g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
                             G_CALLBACK (gtk_widget_destroy),
diff --git a/lib/gui/gmentrydialog.c b/lib/gui/gmentrydialog.c
index 9e5eafd..ffeddd7 100644
--- a/lib/gui/gmentrydialog.c
+++ b/lib/gui/gmentrydialog.c
@@ -121,7 +121,7 @@ gm_entry_dialog_new (const char *label,
   gtk_box_pack_start (GTK_BOX (hbox), ed->label, FALSE, FALSE, 6);
   gtk_box_pack_start (GTK_BOX (hbox), ed->field_entry, FALSE, FALSE, 6);
 
-  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (ed)->vbox), hbox);
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (ed))), hbox);
 
   gtk_dialog_add_buttons (GTK_DIALOG (ed),
 			  GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
diff --git a/lib/gui/gmlevelmeter.c b/lib/gui/gmlevelmeter.c
index 65477f1..309d8d2 100644
--- a/lib/gui/gmlevelmeter.c
+++ b/lib/gui/gmlevelmeter.c
@@ -264,6 +264,7 @@ static void
 gm_level_meter_rebuild_pixmap (GmLevelMeter *lm)
 {
   GtkWidget *widget = GTK_WIDGET (lm);
+  GtkAllocation allocation;
   GdkGC *gc = NULL;
   gint *borders = NULL;
   gint bar_length = 0;
@@ -274,25 +275,26 @@ gm_level_meter_rebuild_pixmap (GmLevelMeter *lm)
   unsigned i = 0;
 
   gc = gdk_gc_new (lm->offscreen_image);
+  gtk_widget_get_allocation (widget, &allocation);
 
   borders = (gint *) g_new (int, lm->colorEntries->len + 1);
 
-  gtk_paint_box (widget->style,
+  gtk_paint_box (gtk_widget_get_style (widget),
                  lm->offscreen_image_dark,
                  GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
                  NULL, widget, "bar",
                  0, 0,
-                 widget->allocation.width, widget->allocation.height);
+                 allocation.width, allocation.height);
 
   switch (lm->orientation) {
   case GTK_ORIENTATION_VERTICAL:
-    bar_length = widget->allocation.height - 2 * widget->style->ythickness;
-    borders[0] = widget->style->ythickness;
+    bar_length = allocation.height - 2 * gtk_widget_get_style (widget)->ythickness;
+    borders[0] = gtk_widget_get_style (widget)->ythickness;
     break;
   case GTK_ORIENTATION_HORIZONTAL:
   default:
-    bar_length = widget->allocation.width - 2 * widget->style->xthickness;
-    borders[0] = widget->style->xthickness;
+    bar_length = allocation.width - 2 * gtk_widget_get_style (widget)->xthickness;
+    borders[0] = gtk_widget_get_style (widget)->xthickness;
   }
 
   for (i = 0 ; i < lm->colorEntries->len ; i++) {
@@ -303,17 +305,17 @@ gm_level_meter_rebuild_pixmap (GmLevelMeter *lm)
 
     switch (lm->orientation) {
     case GTK_ORIENTATION_VERTICAL:
-      start_x = widget->style->xthickness;
-      width_x = widget->allocation.width - 2 * widget->style->xthickness;
+      start_x = gtk_widget_get_style (widget)->xthickness;
+      width_x = allocation.width - 2 * gtk_widget_get_style (widget)->xthickness;
       width_y = borders[i+1] - borders[i];
-      start_y = widget->allocation.height - width_y - borders[i];
+      start_y = allocation.height - width_y - borders[i];
       break;
     case GTK_ORIENTATION_HORIZONTAL:
     default:
       start_x = borders[i];
       width_x = borders[i+1] - borders[i];
-      start_y = widget->style->ythickness;
-      width_y = widget->allocation.height - 2 * widget->style->ythickness;
+      start_y = gtk_widget_get_style (widget)->ythickness;
+      width_y = allocation.height - 2 * gtk_widget_get_style (widget)->ythickness;
     }
 
     gdk_gc_set_foreground (gc, &(g_array_index (lm->colorEntries, GmLevelMeterColorEntry, i).color) );
@@ -338,6 +340,7 @@ static void
 gm_level_meter_realize (GtkWidget *widget)
 {
   GmLevelMeter *lm = NULL;
+  GtkAllocation allocation;
   GdkWindowAttr attributes;
   gint attributes_mask;
 
@@ -345,23 +348,22 @@ gm_level_meter_realize (GtkWidget *widget)
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
   lm = GM_LEVEL_METER (widget);
+  gtk_widget_get_allocation (widget, &allocation);
 
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
+  attributes.x = allocation.x;
+  attributes.y = allocation.y;
+  attributes.width = allocation.width;
+  attributes.height = allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.event_mask =
-    gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+  attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
 
   attributes_mask = GDK_WA_X | GDK_WA_Y;
-  widget->window =
-    gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+  gtk_widget_set_window (widget, gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask));
 
-  widget->style = gtk_style_attach (widget->style, widget->window);
-  gdk_window_set_user_data (widget->window, widget);
-  gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
+  gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style (widget), gtk_widget_get_window (widget)));
+  gdk_window_set_user_data (gtk_widget_get_window (widget), widget);
+  gtk_style_set_background (gtk_widget_get_style (widget), gtk_widget_get_window (widget), GTK_STATE_ACTIVE);
 
   gm_level_meter_create_pixmap (lm);
 }
@@ -380,7 +382,11 @@ gm_level_meter_create_pixmap (GmLevelMeter *lm)
   g_return_if_fail (GM_IS_LEVEL_METER (lm));
 
   if (GTK_WIDGET_REALIZED (lm)) {
+
+    GtkAllocation allocation;
+
     widget = GTK_WIDGET (lm);
+    gtk_widget_get_allocation (widget, &allocation);
 
     if (lm->offscreen_image)
       g_object_unref (lm->offscreen_image);
@@ -389,27 +395,27 @@ gm_level_meter_create_pixmap (GmLevelMeter *lm)
     if (lm->offscreen_image_dark)
       g_object_unref (lm->offscreen_image_dark);
 
-    lm->offscreen_image = gdk_pixmap_new (widget->window,
-					  widget->allocation.width,
-					  widget->allocation.height,
+    lm->offscreen_image = gdk_pixmap_new (gtk_widget_get_window (widget),
+					  allocation.width,
+					  allocation.height,
 					  -1);
-    lm->offscreen_image_hl = gdk_pixmap_new (widget->window,
-					     widget->allocation.width,
-					     widget->allocation.height,
+    lm->offscreen_image_hl = gdk_pixmap_new (gtk_widget_get_window (widget),
+					     allocation.width,
+					     allocation.height,
 					     -1);
-    lm->offscreen_image_dark = gdk_pixmap_new (widget->window,
-					       widget->allocation.width,
-					       widget->allocation.height,
+    lm->offscreen_image_dark = gdk_pixmap_new (gtk_widget_get_window (widget),
+					       allocation.width,
+					       allocation.height,
 					       -1);
-    gdk_draw_rectangle (lm->offscreen_image, widget->style->black_gc, TRUE,
+    gdk_draw_rectangle (lm->offscreen_image, gtk_widget_get_style (widget)->black_gc, TRUE,
 		        0, 0,
-			widget->allocation.width, widget->allocation.height);
-    gdk_draw_rectangle (lm->offscreen_image_hl, widget->style->black_gc, TRUE,
+			allocation.width, allocation.height);
+    gdk_draw_rectangle (lm->offscreen_image_hl, gtk_widget_get_style (widget)->black_gc, TRUE,
                         0, 0,
-                        widget->allocation.width, widget->allocation.height);
-    gdk_draw_rectangle (lm->offscreen_image_dark, widget->style->black_gc, TRUE,
+                        allocation.width, allocation.height);
+    gdk_draw_rectangle (lm->offscreen_image_dark, gtk_widget_get_style (widget)->black_gc, TRUE,
                         0, 0,
-                        widget->allocation.width, widget->allocation.height);
+                        allocation.width, allocation.height);
 
     if (lm->colorEntries == NULL)
       lm->colorEntries =
@@ -433,6 +439,7 @@ gm_level_meter_paint (GmLevelMeter *lm)
   #define PEAKSTRENGTH 3
 
   GtkWidget *widget = GTK_WIDGET (lm);
+  GtkAllocation allocation;
 
   gint inner_width = 0;
   gint inner_height = 0;
@@ -445,9 +452,11 @@ gm_level_meter_paint (GmLevelMeter *lm)
   gint hl_width = 0;
   gint hl_height = 0;
 
+  gtk_widget_get_allocation (widget, &allocation);
+
   /* widget size minus borders */
-  inner_width = widget->allocation.width - 2 * widget->style->xthickness;
-  inner_height = widget->allocation.height - 2 * widget->style->ythickness;
+  inner_width = allocation.width - 2 * gtk_widget_get_style (widget)->xthickness;
+  inner_height = allocation.height - 2 * gtk_widget_get_style (widget)->ythickness;
 
   if (lm->peak > 1.0 ) lm->peak = 1.0;
   if (lm->level < 0 ) lm->level = 0;
@@ -490,45 +499,45 @@ gm_level_meter_paint (GmLevelMeter *lm)
   }
 
   /* offset all values with x/ythickness */
-  peak_start_x += widget->style->xthickness;
-  peak_start_y += widget->style->ythickness;
-  hl_start_x = widget->style->xthickness;
-  hl_start_y += widget->style->ythickness;
+  peak_start_x += gtk_widget_get_style (widget)->xthickness;
+  peak_start_y += gtk_widget_get_style (widget)->ythickness;
+  hl_start_x = gtk_widget_get_style (widget)->xthickness;
+  hl_start_y += gtk_widget_get_style (widget)->ythickness;
 
   /* fill with dark and border */
   gdk_draw_drawable (lm->offscreen_image,
-		     widget->style->black_gc,
+		     gtk_widget_get_style (widget)->black_gc,
 		     lm->offscreen_image_dark,
 		     0, 0,
 		     0, 0,
-		     widget->allocation.width, widget->allocation.height);
+		     allocation.width, allocation.height);
   /* paint level bar */
   gdk_draw_drawable (lm->offscreen_image,
-		     widget->style->black_gc,
+		     gtk_widget_get_style (widget)->black_gc,
 		     lm->offscreen_image_hl,
 		     hl_start_x, hl_start_y, 
 		     hl_start_x, hl_start_y,
 		     hl_width, hl_height);
   /* paint peak */
   gdk_draw_drawable (lm->offscreen_image,
-		     widget->style->black_gc,
+		     gtk_widget_get_style (widget)->black_gc,
 		     lm->offscreen_image_hl,
 		     peak_start_x, peak_start_y,
 		     peak_start_x, peak_start_y,
 		     peak_width, peak_height);
 
   /* repaint */
-  if (GTK_WIDGET_DRAWABLE (widget))
-    gdk_draw_drawable (widget->window,
-		       widget->style->black_gc,
+  if (gtk_widget_is_drawable (widget))
+    gdk_draw_drawable (gtk_widget_get_window (widget),
+		       gtk_widget_get_style (widget)->black_gc,
 		       lm->offscreen_image,
 		       0, 0,
 		       0, 0,
-		       widget->allocation.width, widget->allocation.height);
+		       allocation.width, allocation.height);
 
   gtk_widget_queue_draw_area (widget,
                               0, 0,
-                              widget->allocation.width, widget->allocation.height);
+                              allocation.width, allocation.height);
 }
 
 
@@ -557,8 +566,8 @@ gm_level_meter_size_request (GtkWidget *widget,
     requisition->width = 100;
     requisition->height = 4;
   }
-  requisition->width += 2 * widget->style->xthickness;
-  requisition->height += 2 * widget->style->ythickness;
+  requisition->width += 2 * gtk_widget_get_style (widget)->xthickness;
+  requisition->height += 2 * gtk_widget_get_style (widget)->ythickness;
 }
 
 
@@ -569,10 +578,10 @@ gm_level_meter_size_allocate (GtkWidget *widget,
   g_return_if_fail (GM_IS_LEVEL_METER (widget));
   g_return_if_fail (allocation != NULL);
 
-  widget->allocation = *allocation;
+  gtk_widget_set_allocation (widget, allocation);
   if (GTK_WIDGET_REALIZED (widget)) {
 
-    gdk_window_move_resize (widget->window,
+    gdk_window_move_resize (gtk_widget_get_window (widget),
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
 
@@ -596,9 +605,9 @@ gm_level_meter_expose (GtkWidget *widget,
     return FALSE;
 
   /* repaint */
-  if (GTK_WIDGET_DRAWABLE (widget))
-    gdk_draw_drawable (widget->window,
-		       widget->style->black_gc,
+  if (gtk_widget_is_drawable (widget))
+    gdk_draw_drawable (gtk_widget_get_window (widget),
+		       gtk_widget_get_style (widget)->black_gc,
 		       GM_LEVEL_METER (widget)->offscreen_image,
 		       event->area.x, event->area.y,
 		       event->area.x, event->area.y,
diff --git a/lib/gui/gmmenuaddon.c b/lib/gui/gmmenuaddon.c
index 19945fc..89fa3e0 100644
--- a/lib/gui/gmmenuaddon.c
+++ b/lib/gui/gmmenuaddon.c
@@ -180,7 +180,7 @@ radio_menu_changed_cb (GtkWidget *widget,
 
   /* Only do something when a new CHECK_MENU_ITEM becomes active,
      not when it becomes inactive */
-  if (GTK_CHECK_MENU_ITEM (widget)->active) {
+  if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
 
     while (group) {
 
@@ -203,7 +203,7 @@ toggle_menu_changed_cb (GtkWidget *widget,
   g_return_if_fail (data != NULL);
   
   gm_conf_set_bool ((gchar *) data, 
-		    GTK_CHECK_MENU_ITEM (widget)->active);
+		    gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)));
 }
 
 
@@ -222,7 +222,7 @@ menu_toggle_changed_nt (G_GNUC_UNUSED gpointer id,
     e = GTK_WIDGET (data);
 
     /* We set the new value for the widget */
-    GTK_CHECK_MENU_ITEM (e)->active = gm_conf_entry_get_bool (entry);
+    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (e), gm_conf_entry_get_bool (entry));
 
     gtk_widget_queue_draw (GTK_WIDGET (e));
   }
@@ -295,8 +295,7 @@ gtk_build_menu (GtkWidget *menubar,
 	
 	menu [i].widget = 
 	  gtk_check_menu_item_new_with_mnemonic (menu_name);
-	GTK_CHECK_MENU_ITEM (menu [i].widget)->active =
-	  menu [i].enabled;
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget), menu [i].enabled);
 	gtk_widget_queue_draw (menu [i].widget);
       }
       else if (menu [i].type == MENU_RADIO_ENTRY) {
@@ -308,8 +307,7 @@ gtk_build_menu (GtkWidget *menubar,
 	  gtk_radio_menu_item_new_with_mnemonic (group, 
 						 menu_name);
 
-	GTK_CHECK_MENU_ITEM (menu [i].widget)->active =
-	  menu [i].enabled;
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget), menu [i].enabled);
 	gtk_widget_queue_draw (menu [i].widget);
 
 	group = 
@@ -537,7 +535,7 @@ void
 gtk_toggle_menu_enable (GtkWidget *e, 
 			gboolean show)
 {
-  GTK_CHECK_MENU_ITEM (e)->active = show;
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (e), show);
 
   gtk_widget_queue_draw (GTK_WIDGET (e));
 }
@@ -565,11 +563,10 @@ gtk_radio_menu_select_with_id (GtkWidget *menu,
 						  last pos is 0 */
   while (group) {
 
-    if (GTK_WIDGET_SENSITIVE (GTK_CHECK_MENU_ITEM (group->data)))
-      GTK_CHECK_MENU_ITEM (group->data)->active = 
-        (i == group_last_pos - active);
+    if (gtk_widget_is_sensitive (GTK_WIDGET (group->data)))
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), (i == group_last_pos - active));
     else
-      GTK_CHECK_MENU_ITEM (group->data)->active = FALSE; 
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), FALSE);
       
     gtk_widget_queue_draw (GTK_WIDGET (group->data));
       
@@ -595,8 +592,7 @@ gtk_radio_menu_select_with_widget (GtkWidget *widget,
 						  last pos is 0 */
   while (group) {
 
-    GTK_CHECK_MENU_ITEM (group->data)->active = 
-      (i == group_last_pos - active);
+    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), (i == group_last_pos - active));
     gtk_widget_queue_draw (GTK_WIDGET (group->data));
       
     group = g_slist_next (group);
diff --git a/lib/gui/gmpreferences.c b/lib/gui/gmpreferences.c
index d1e5f0d..d974a0a 100644
--- a/lib/gui/gmpreferences.c
+++ b/lib/gui/gmpreferences.c
@@ -395,8 +395,10 @@ gnome_prefs_spin_new (GtkWidget *table,
 
   if (box) {
    
+    guint ncols;
+    g_object_get (G_OBJECT (table), "n-columns", &ncols, NULL);
     gtk_table_attach (GTK_TABLE (table), hbox, 
-		      0, GTK_TABLE (table)->ncols, row, row+1,
+		      0, ncols, row, row+1,
 		      (GtkAttachOptions) (GTK_FILL),
 		      (GtkAttachOptions) (GTK_FILL),
 		      0, 0);
@@ -991,7 +993,7 @@ gnome_prefs_window_new (const gchar *logo_name)
 
 
   /* The sections */
-  dialog_vbox = GTK_DIALOG (window)->vbox;
+  dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (window));
   
   hbox = gtk_hbox_new (FALSE, 6);
   gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
diff --git a/lib/gui/gmwindow.c b/lib/gui/gmwindow.c
index 98c8145..169c332 100644
--- a/lib/gui/gmwindow.c
+++ b/lib/gui/gmwindow.c
@@ -533,7 +533,7 @@ gm_window_set_always_on_top (GdkWindow *window,
 gboolean
 gm_window_is_visible (GtkWidget* w)
 {
-  return (GTK_WIDGET_VISIBLE (w) && !(gdk_window_get_state (GDK_WINDOW (w->window)) & GDK_WINDOW_STATE_ICONIFIED));
+  return (gtk_widget_get_visible (w) && !(gdk_window_get_state (gtk_widget_get_window (w)) & GDK_WINDOW_STATE_ICONIFIED));
 }
 
 



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