Use accessor functions instead direct access. (only stable GTK+ functions)
authorJavier Jardón <javierjc1982@gmail.com>
Tue, 3 Nov 2009 17:45:13 +0000 (18:45 +0100)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 3 Nov 2009 17:45:13 +0000 (18:45 +0100)
https://bugs.maemo.org/show_bug.cgi?id=4887

src/widgets/modest-attachments-view.c
src/widgets/modest-compact-mail-header-view.c
src/widgets/modest-folder-view.c
src/widgets/modest-hbox-cell-renderer.c
src/widgets/modest-header-view.c
src/widgets/modest-vbox-cell-renderer.c

index e7d5a5c..2b28cfe 100644 (file)
@@ -761,10 +761,15 @@ get_att_view_at_coords (ModestAttachmentsView *atts_view,
                gint pos_x, pos_y, w, h, int_x, int_y;
                gint widget_x, widget_y;
 
+#if GTK_CHECK_VERSION (2,14,0)
+               gdk_window_get_origin (gtk_widget_get_window (att_view), &widget_x, &widget_y);
+#else
                gdk_window_get_origin (att_view->window, &widget_x, &widget_y);
+#endif
 
                pos_x = widget_x;
                pos_y = widget_y;
+
                w = att_view->allocation.width;
                h = att_view->allocation.height;
 
index 9a6f74c..8c45e07 100644 (file)
@@ -697,7 +697,7 @@ update_style (ModestCompactMailHeaderView *self)
        g_return_if_fail (MODEST_IS_COMPACT_MAIL_HEADER_VIEW (self));
        priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (self);
 
-       if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) {
+       if (gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "SecondaryTextColor", &style_color)) {
                color.red = style_color.red;
                color.green = style_color.green;
                color.blue = style_color.blue;
index 1d654bd..7ef3c74 100644 (file)
@@ -3273,7 +3273,11 @@ on_drag_data_received (GtkWidget *widget,
        }
 
        /* Check if the get_data failed */
+#if GTK_CHECK_VERSION (2,14,0)
+       if ((selection_data == NULL) || (gtk_selection_data_get_length (selection_data) < 0))
+#else
        if (selection_data == NULL || selection_data->length < 0)
+#endif
                goto end;
 
        /* Select the destination model */
@@ -4141,7 +4145,8 @@ update_style (ModestFolderView *self)
        /* Set color */
 
        attr_list = pango_attr_list_new ();
-       if (!gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) {
+
+       if (!gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "SecondaryTextColor", &style_color)) {
                gdk_color_parse ("grey", &style_color);
        }
        attr = pango_attr_foreground_new (style_color.red, style_color.green, style_color.blue);
@@ -4165,7 +4170,7 @@ update_style (ModestFolderView *self)
                pango_attr_list_unref (attr_list);
        }
 
-       if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "ActiveTextColor", &style_active_color)) {
+       if (gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "ActiveTextColor", &style_active_color)) {
                priv->active_color = style_active_color;
        } else {
                gdk_color_parse ("000", &(priv->active_color));
index 5903f13..a01f483 100644 (file)
@@ -202,6 +202,8 @@ modest_hbox_cell_renderer_get_size     (GtkCellRenderer       *cell,
 {
        gint calc_width, calc_height;
        gint full_width, full_height;
+       guint xpad, ypad;
+       gfloat xalign, yalign;
        GList *node;
        ModestHBoxCellRendererPrivate *priv = MODEST_HBOX_CELL_RENDERER_GET_PRIVATE (cell);
 
@@ -220,18 +222,25 @@ modest_hbox_cell_renderer_get_size     (GtkCellRenderer       *cell,
                }
        }
 
-       full_width = (gint) cell->xpad * 2 + calc_width;
-       full_height = (gint) cell->ypad * 2 + calc_height;
+       g_object_get (cell,
+                     "xpad", &xpad,
+                     "ypad", &ypad,
+                     "xalign", &xalign,
+                     "yalign", &yalign,
+                     NULL);
+
+       full_width = (gint) xpad * 2 + calc_width;
+       full_height = (gint) ypad * 2 + calc_height;
 
        if (rectangle && calc_width > 0 && calc_height > 0) {
                if (x_offset) {
                        *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
-                                     (1.0 - cell->xalign) : cell->xalign) *
+                                     (1.0 - xalign) : xalign) *
                                     (rectangle->width - full_width));
                        *x_offset = MAX (*x_offset, 0);
                }
                if (y_offset) {
-                       *y_offset = ((cell->yalign) *
+                       *y_offset = ((yalign) *
                                     (rectangle->height - full_height));
                        *y_offset = MAX (*y_offset, 0);
                }
index ba10051..b7fbcbb 100644 (file)
@@ -2398,7 +2398,7 @@ update_style (ModestHeaderView *self)
        /* Set color */
 
        attr_list = pango_attr_list_new ();
-       if (!gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) {
+       if (!gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "SecondaryTextColor", &style_color)) {
                gdk_color_parse ("grey", &style_color);
        }
        priv->secondary_color = style_color;
@@ -2441,7 +2441,7 @@ update_style (ModestHeaderView *self)
                              NULL);
        }
 
-       if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "ActiveTextColor", &style_active_color)) {
+       if (gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "ActiveTextColor", &style_active_color)) {
                priv->active_color = style_active_color;
 #ifdef MODEST_TOOLKIT_HILDON2
                g_object_set_data (G_OBJECT (priv->renderer_subject), BOLD_IS_ACTIVE_COLOR, GINT_TO_POINTER (TRUE));
index e860433..e711f5c 100644 (file)
@@ -203,6 +203,8 @@ modest_vbox_cell_renderer_get_size     (GtkCellRenderer       *cell,
 {
        gint calc_width, calc_height;
        gint full_width, full_height;
+       guint xpad, ypad;
+       gfloat xalign, yalign;
        GList *node;
        ModestVBoxCellRendererPrivate *priv = MODEST_VBOX_CELL_RENDERER_GET_PRIVATE (cell);
 
@@ -221,18 +223,25 @@ modest_vbox_cell_renderer_get_size     (GtkCellRenderer       *cell,
                }
        }
 
-       full_width = (gint) cell->xpad * 2 + calc_width;
-       full_height = (gint) cell->ypad * 2 + calc_height;
+       g_object_get (cell,
+                      "xpad", &xpad,
+                      "ypad", &ypad,
+                      "xalign", &xalign,
+                      "yalign", &yalign,
+                      NULL);
+
+       full_width = (gint) xpad * 2 + calc_width;
+       full_height = (gint) ypad * 2 + calc_height;
 
        if (rectangle && calc_width > 0 && calc_height > 0) {
                if (x_offset) {
                        *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
-                                     (1.0 - cell->xalign) : cell->xalign) *
+                                     (1.0 - xalign) : xalign) *
                                     (rectangle->width - full_width));
                        *x_offset = MAX (*x_offset, 0);
                }
                if (y_offset) {
-                       *y_offset = ((cell->yalign) *
+                       *y_offset = ((yalign) *
                                     (rectangle->height - full_height));
                        *y_offset = MAX (*y_offset, 0);
                }