[accounts-dialog: 19/19] GTK3 build fixes



commit 5bf2bd5e544b1fb4392043129ee8ab86b0270a32
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jul 15 22:58:22 2010 -0400

    GTK3 build fixes

 src/um-crop-area.c          |   36 +++++++++++++++++++++---------------
 src/um-editable-entry.c     |    4 +++-
 src/um-fingerprint-dialog.c |    8 +++++---
 src/um-photo-dialog.c       |    4 ++--
 src/um-strength-bar.c       |   29 ++++++++++++++++-------------
 5 files changed, 47 insertions(+), 34 deletions(-)
---
diff --git a/src/um-crop-area.c b/src/um-crop-area.c
index 14ba5ee..70b637f 100644
--- a/src/um-crop-area.c
+++ b/src/um-crop-area.c
@@ -98,9 +98,11 @@ update_pixbufs (UmCropArea *area)
         guint32 pixel;
         gint dest_x, dest_y, dest_width, dest_height;
         GtkWidget *widget;
+        GtkStyle *style;
 
         widget = GTK_WIDGET (area);
         gtk_widget_get_allocation (widget, &allocation);
+        style = gtk_widget_get_style (widget);
 
         if (area->priv->pixbuf == NULL ||
             gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
@@ -112,7 +114,7 @@ update_pixbufs (UmCropArea *area)
                                                      8,
                                                      allocation.width, allocation.height);
 
-                color = &widget->style->bg[GTK_WIDGET_STATE (widget)];
+                color = &style->bg[gtk_widget_get_state (widget)];
                 pixel = ((color->red & 0xff00) << 16) |
                         ((color->green & 0xff00) << 8) |
                          (color->blue & 0xff00);
@@ -190,6 +192,8 @@ um_crop_area_expose (GtkWidget      *widget,
         GdkRectangle crop;
         gint width, height;
         UmCropArea *uarea = UM_CROP_AREA (widget);
+        GtkStyle *style;
+        GdkWindow *window;
 
         if (uarea->priv->browse_pixbuf == NULL)
                 return FALSE;
@@ -205,8 +209,10 @@ um_crop_area_expose (GtkWidget      *widget,
         area.width = width;
         area.height = crop.y;
         gdk_rectangle_intersect (&area, &event->area, &area);
-        gdk_draw_pixbuf (widget->window,
-                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+        style = gtk_widget_get_style (widget);
+        window = gtk_widget_get_window (widget);
+        gdk_draw_pixbuf (window,
+                         style->fg_gc[gtk_widget_get_state (widget)],
                          uarea->priv->color_shifted,
                          area.x, area.y,
                          area.x, area.y,
@@ -218,8 +224,8 @@ um_crop_area_expose (GtkWidget      *widget,
         area.width = crop.x;
         area.height = crop.height;
         gdk_rectangle_intersect (&area, &event->area, &area);
-        gdk_draw_pixbuf (widget->window,
-                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+        gdk_draw_pixbuf (window,
+                         style->fg_gc[gtk_widget_get_state (widget)],
                          uarea->priv->color_shifted,
                          area.x, area.y,
                          area.x, area.y,
@@ -231,8 +237,8 @@ um_crop_area_expose (GtkWidget      *widget,
         area.width = crop.width;
         area.height = crop.height;
         gdk_rectangle_intersect (&area, &event->area, &area);
-        gdk_draw_pixbuf (widget->window,
-                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+        gdk_draw_pixbuf (window,
+                         style->fg_gc[gtk_widget_get_state (widget)],
                          uarea->priv->pixbuf,
                          area.x, area.y,
                          area.x, area.y,
@@ -244,8 +250,8 @@ um_crop_area_expose (GtkWidget      *widget,
         area.width = width - area.x;
         area.height = crop.height;
         gdk_rectangle_intersect (&area, &event->area, &area);
-        gdk_draw_pixbuf (widget->window,
-                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+        gdk_draw_pixbuf (window,
+                         style->fg_gc[gtk_widget_get_state (widget)],
                          uarea->priv->color_shifted,
                          area.x, area.y,
                          area.x, area.y,
@@ -257,21 +263,21 @@ um_crop_area_expose (GtkWidget      *widget,
         area.width = width;
         area.height = height - area.y;
         gdk_rectangle_intersect (&area, &event->area, &area);
-        gdk_draw_pixbuf (widget->window,
-                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+        gdk_draw_pixbuf (window,
+                         style->fg_gc[gtk_widget_get_state (widget)],
                          uarea->priv->color_shifted,
                          area.x, area.y,
                          area.x, area.y,
                          area.width, area.height,
                          GDK_RGB_DITHER_NONE, 0, 0);
 
-        cr = gdk_cairo_create (widget->window);
+        cr = gdk_cairo_create (window);
         gdk_cairo_rectangle (cr, &event->area);
         cairo_clip (cr);
 
         if (uarea->priv->active_region != OUTSIDE) {
                 gint x1, x2, y1, y2;
-                gdk_cairo_set_source_color (cr, &widget->style->white);
+                gdk_cairo_set_source_color (cr, &style->white);
                 cairo_set_line_width (cr, 1.0);
                 x1 = crop.x + crop.width / 3.0;
                 x2 = crop.x + 2 * crop.width / 3.0;
@@ -292,7 +298,7 @@ um_crop_area_expose (GtkWidget      *widget,
                 cairo_stroke (cr);
         }
 
-        gdk_cairo_set_source_color (cr, &widget->style->black);
+        gdk_cairo_set_source_color (cr, &style->black);
         cairo_set_line_width (cr, 1.0);
         cairo_rectangle (cr,
                          crop.x + 0.5,
@@ -301,7 +307,7 @@ um_crop_area_expose (GtkWidget      *widget,
                          crop.height - 1.0);
         cairo_stroke (cr);
 
-        gdk_cairo_set_source_color (cr, &widget->style->white);
+        gdk_cairo_set_source_color (cr, &style->white);
         cairo_set_line_width (cr, 2.0);
         cairo_rectangle (cr,
                          crop.x + 2.0,
diff --git a/src/um-editable-entry.c b/src/um-editable-entry.c
index 5b9b0e5..914b5b5 100644
--- a/src/um-editable-entry.c
+++ b/src/um-editable-entry.c
@@ -121,6 +121,7 @@ update_entry_font (GtkWidget        *widget,
 {
         UmEditableEntryPrivate *priv = e->priv;
         PangoFontDescription *desc;
+        GtkStyle *style;
         gint size;
 
         if (!priv->weight_set && !priv->scale_set)
@@ -130,7 +131,8 @@ update_entry_font (GtkWidget        *widget,
 
         gtk_widget_modify_font (widget, NULL);
 
-        desc = pango_font_description_copy (widget->style->font_desc);
+        style = gtk_widget_get_style (widget);
+        desc = pango_font_description_copy (style->font_desc);
         if (priv->weight_set)
                 pango_font_description_set_weight (desc, priv->weight);
         if (priv->scale_set) {
diff --git a/src/um-fingerprint-dialog.c b/src/um-fingerprint-dialog.c
index af90214..ea06a09 100644
--- a/src/um-fingerprint-dialog.c
+++ b/src/um-fingerprint-dialog.c
@@ -224,7 +224,7 @@ delete_fingerprints_question (GtkWindow *parent,
 
         button = gtk_button_new_with_mnemonic (_("_Delete Fingerprints"));
         gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
-        GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+        gtk_widget_set_can_default (button, TRUE);
         gtk_widget_show (button);
         gtk_dialog_add_action_widget (GTK_DIALOG (question), button, GTK_RESPONSE_OK);
 
@@ -529,6 +529,7 @@ enroll_fingerprints (GtkWindow *parent,
         GError *error = NULL;
         GdkPixbuf *pixbuf;
         gchar *title;
+        GtkStyle *style;
 
         device = NULL;
 
@@ -587,8 +588,9 @@ enroll_fingerprints (GtkWindow *parent,
         gtk_window_set_position (GTK_WINDOW (ass), GTK_WIN_POS_CENTER_ON_PARENT);
 
         gtk_widget_realize (ass);
-        gtk_widget_modify_fg (ass, GTK_STATE_SELECTED, &ass->style->fg[GTK_STATE_NORMAL]);
-        gtk_widget_modify_bg (ass, GTK_STATE_SELECTED, &ass->style->bg[GTK_STATE_NORMAL]);
+        style = gtk_widget_get_style (ass);
+        gtk_widget_modify_fg (ass, GTK_STATE_SELECTED, &style->fg[GTK_STATE_NORMAL]);
+        gtk_widget_modify_bg (ass, GTK_STATE_SELECTED, &style->bg[GTK_STATE_NORMAL]);
 
         g_signal_connect (G_OBJECT (ass), "cancel",
                           G_CALLBACK (assistant_cancelled), data);
diff --git a/src/um-photo-dialog.c b/src/um-photo-dialog.c
index b2e1677..a98788f 100644
--- a/src/um-photo-dialog.c
+++ b/src/um-photo-dialog.c
@@ -458,7 +458,7 @@ out:
 static void
 popup_icon_menu (GtkToggleButton *button, UmPhotoDialog *um)
 {
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) && !GTK_WIDGET_VISIBLE (um->photo_popup)) {
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) && !gtk_widget_get_visible (um->photo_popup)) {
                 gtk_menu_popup (GTK_MENU (um->photo_popup),
                                 NULL, NULL,
                                 (GtkMenuPositionFunc) popup_menu_below_button, um->popup_button,
@@ -474,7 +474,7 @@ on_popup_button_button_pressed (GtkToggleButton *button,
                                 UmPhotoDialog  *um)
 {
         if (event->button == 1) {
-                if (!GTK_WIDGET_VISIBLE (um->photo_popup)) {
+                if (!gtk_widget_get_visible (um->photo_popup)) {
                         popup_icon_menu (button, um);
                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
                 } else {
diff --git a/src/um-strength-bar.c b/src/um-strength-bar.c
index 88b8c37..d2cb294 100644
--- a/src/um-strength-bar.c
+++ b/src/um-strength-bar.c
@@ -168,25 +168,29 @@ um_strength_bar_expose (GtkWidget      *widget,
 {
         UmStrengthBar *bar = UM_STRENGTH_BAR (widget);
         gdouble r, g, b;
+        GdkWindow *window;
+        GtkAllocation allocation;
 
-        if (GTK_WIDGET_DRAWABLE (widget)) {
+        if (gtk_widget_is_drawable (widget)) {
                 cairo_t *cr;
 
-                cr = gdk_cairo_create (widget->window);
+                window = gtk_widget_get_window (widget);
+                gtk_widget_get_allocation (widget, &allocation);
+                cr = gdk_cairo_create (window);
                 cairo_set_line_width (cr, 1);
 
                 cairo_rectangle (cr,
-                                 widget->allocation.x,
-                                 widget->allocation.y,
-                                 bar->priv->strength * widget->allocation.width,
-                                 widget->allocation.height);
+                                 allocation.x,
+                                 allocation.y,
+                                 bar->priv->strength * allocation.width,
+                                 allocation.height);
                 cairo_clip (cr);
 
                 curved_rectangle (cr,
-                                 widget->allocation.x + 0.5,
-                                 widget->allocation.y + 0.5,
-                                 widget->allocation.width - 1,
-                                 widget->allocation.height - 1,
+                                 allocation.x + 0.5,
+                                 allocation.y + 0.5,
+                                 allocation.width - 1,
+                                 allocation.height - 1,
                                  4);
                 get_color (bar->priv->strength, &r, &g ,&b);
                 cairo_set_source_rgb (cr, r, g, b);
@@ -230,9 +234,8 @@ um_strength_bar_class_init (UmStrengthBarClass *class)
 static void
 um_strength_bar_init (UmStrengthBar *bar)
 {
-        GTK_WIDGET_SET_FLAGS (bar, GTK_NO_WINDOW);
-        GTK_WIDGET (bar)->requisition.width = 120;
-        GTK_WIDGET (bar)->requisition.height = 8;
+        gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE);
+        gtk_widget_set_size_request (GTK_WIDGET (bar), 120, 8);
 
         bar->priv = GET_PRIVATE (bar);
         bar->priv->strength = 0.0;



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