[gnome-commander/gcmd-1-3] Fixed problem #617140 (GNOME Goal: Use accessor functions instead direct access)



commit ff6ddb776b4f06c5b38ba7c9e2b9837e7f9ac2b4
Author: André Klapper <a9016009 gmx de>
Date:   Sun May 30 22:31:21 2010 +0200

    Fixed problem #617140 (GNOME Goal: Use accessor functions instead direct access)

 src/dialogs/gnome-cmd-advrename-regex-dialog.cc  |   17 +++
 src/dialogs/gnome-cmd-edit-bookmark-dialog.cc    |   18 +++
 src/dialogs/gnome-cmd-edit-profile-dialog.cc     |   18 +++
 src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc |   16 +++
 src/dialogs/gnome-cmd-manage-profiles-dialog.cc  |   16 +++
 src/intviewer/image-render.cc                    |  158 ++++++++++++++++++----
 src/utils.h                                      |    7 +
 7 files changed, 224 insertions(+), 26 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-advrename-regex-dialog.cc b/src/dialogs/gnome-cmd-advrename-regex-dialog.cc
index 919f1d7..72a1a78 100644
--- a/src/dialogs/gnome-cmd-advrename-regex-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-regex-dialog.cc
@@ -59,15 +59,24 @@ gboolean gnome_cmd_advrename_regex_dialog_new (const gchar *title, GtkWindow *pa
                                                      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                      GTK_STOCK_OK, GTK_RESPONSE_OK,
                                                      NULL);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+#endif
 
     gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 
     // HIG defaults
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_set_spacing (GTK_BOX (content_area), 2);
+    gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
+    gtk_box_set_spacing (GTK_BOX (content_area),6);
+#else
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
     gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area),6);
+#endif
 
     GtkWidget *table, *align, *label, *entry, *check;
 
@@ -75,7 +84,11 @@ gboolean gnome_cmd_advrename_regex_dialog_new (const gchar *title, GtkWindow *pa
     gtk_container_set_border_width (GTK_CONTAINER (table), 5);
     gtk_table_set_row_spacings (GTK_TABLE (table), 6);
     gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_container_add (GTK_CONTAINER (content_area), table);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
+#endif
 
     label = gtk_label_new_with_mnemonic (_("_Search for:"));
     gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -115,7 +128,11 @@ gboolean gnome_cmd_advrename_regex_dialog_new (const gchar *title, GtkWindow *pa
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
 #endif
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_widget_show_all (content_area);
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
diff --git a/src/dialogs/gnome-cmd-edit-bookmark-dialog.cc b/src/dialogs/gnome-cmd-edit-bookmark-dialog.cc
index 63c55cf..9fbc383 100644
--- a/src/dialogs/gnome-cmd-edit-bookmark-dialog.cc
+++ b/src/dialogs/gnome-cmd-edit-bookmark-dialog.cc
@@ -74,14 +74,24 @@ gboolean gnome_cmd_edit_bookmark_dialog (GtkWindow *parent, const gchar *title,
                                                      GTK_STOCK_OK, GTK_RESPONSE_OK,
                                                      NULL);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+#endif
+
     gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 
     // HIG defaults
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_set_spacing (GTK_BOX (content_area), 2);
+    gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
+    gtk_box_set_spacing (GTK_BOX (content_area),6);
+#else
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
     gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area),6);
+#endif
 
     GtkWidget *table, *label, *entry;
 
@@ -89,7 +99,11 @@ gboolean gnome_cmd_edit_bookmark_dialog (GtkWindow *parent, const gchar *title,
     gtk_container_set_border_width (GTK_CONTAINER (table), 5);
     gtk_table_set_row_spacings (GTK_TABLE (table), 6);
     gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_container_add (GTK_CONTAINER (content_area), table);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
+#endif
 
     label = gtk_label_new_with_mnemonic (_("Bookmark _name:"));
     gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -113,7 +127,11 @@ gboolean gnome_cmd_edit_bookmark_dialog (GtkWindow *parent, const gchar *title,
     gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
     gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 1, 2);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_widget_show_all (content_area);
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
diff --git a/src/dialogs/gnome-cmd-edit-profile-dialog.cc b/src/dialogs/gnome-cmd-edit-profile-dialog.cc
index 90e87db..f07919f 100644
--- a/src/dialogs/gnome-cmd-edit-profile-dialog.cc
+++ b/src/dialogs/gnome-cmd-edit-profile-dialog.cc
@@ -72,18 +72,32 @@ gboolean gnome_cmd_edit_profile_dialog_new (GtkWindow *parent, GnomeCmdData::Adv
                                                      GTK_STOCK_OK, GTK_RESPONSE_OK,
                                                      NULL);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
+#endif
+
     gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 
     // HIG defaults
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_set_spacing (GTK_BOX (content_area), 2);
+    gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
+    gtk_box_set_spacing (GTK_BOX (content_area),6);
+#else
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
     gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area),6);
+#endif
 
     GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
     gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
+#else
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 0);
+#endif
 
     gchar *str = g_strdup_printf ("<b>%s</b>", _("_Name"));
     GtkWidget *label = gtk_label_new_with_mnemonic (str);
@@ -106,7 +120,11 @@ gboolean gnome_cmd_edit_profile_dialog_new (GtkWindow *parent, GnomeCmdData::Adv
     GnomeCmdProfileComponent *profile_component = new GnomeCmdProfileComponent(profile);
     gtk_container_add (GTK_CONTAINER (vbox), *profile_component);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_widget_show_all (content_area);
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
diff --git a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
index 51ff760..825ce6c 100644
--- a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
+++ b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
@@ -74,17 +74,29 @@ void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent)
                                                      GTK_STOCK_JUMP_TO, RESPONSE_JUMP_TO,
                                                      NULL);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
+#endif
+
     GtkWidget *vbox, *hbox, *scrolled_window, *view, *button;
 
     gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_set_spacing (GTK_BOX (content_area), 2);
+#else
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+#endif
     gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 
     vbox = gtk_vbox_new (FALSE, 12);
     gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+ #if GTK_CHECK_VERSION (2, 14, 0)
+   gtk_container_add (GTK_CONTAINER (content_area), vbox);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
+#endif
 
     hbox = gtk_hbox_new (FALSE, 12);
     gtk_container_add (GTK_CONTAINER (vbox), hbox);
@@ -133,7 +145,11 @@ void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent)
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), RESPONSE_JUMP_TO);
     gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_JUMP_TO, FALSE);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_widget_show_all (content_area);
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     g_signal_connect (dialog, "size-allocate", G_CALLBACK (size_allocate_callback), NULL);
     g_signal_connect (dialog, "response", G_CALLBACK (response_callback), view);
diff --git a/src/dialogs/gnome-cmd-manage-profiles-dialog.cc b/src/dialogs/gnome-cmd-manage-profiles-dialog.cc
index 515782e..3149a3b 100644
--- a/src/dialogs/gnome-cmd-manage-profiles-dialog.cc
+++ b/src/dialogs/gnome-cmd-manage-profiles-dialog.cc
@@ -93,17 +93,29 @@ gboolean gnome_cmd_manage_profiles_dialog_new (const gchar *title, GtkWindow *pa
                                                      GTK_STOCK_OK, GTK_RESPONSE_OK,
                                                      NULL);
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
+#endif
+
     GtkWidget *vbox, *hbox, *scrolled_window, *view, *box, *button;
 
     gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_box_set_spacing (GTK_BOX (content_area), 2);
+#else
     gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+#endif
     gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 
     vbox = gtk_vbox_new (FALSE, 12);
     gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_container_add (GTK_CONTAINER (content_area), vbox);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
+#endif
 
     hbox = gtk_hbox_new (FALSE, 12);
     gtk_container_add (GTK_CONTAINER (vbox), hbox);
@@ -157,7 +169,11 @@ gboolean gnome_cmd_manage_profiles_dialog_new (const gchar *title, GtkWindow *pa
     }
 #endif
 
+#if GTK_CHECK_VERSION (2, 14, 0)
+    gtk_widget_show_all (content_area);
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
diff --git a/src/intviewer/image-render.cc b/src/intviewer/image-render.cc
index 2440946..bb916c7 100644
--- a/src/intviewer/image-render.cc
+++ b/src/intviewer/image-render.cc
@@ -167,9 +167,14 @@ void image_render_set_h_adjustment (ImageRender *obj, GtkAdjustment *adjustment)
               (GtkSignalFunc) image_render_h_adjustment_value_changed ,
               (gpointer) obj);
 
-    obj->priv->old_h_adj_value = adjustment->value;
+    obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    obj->priv->old_h_adj_lower = gtk_adjustment_get_lower (adjustment);
+    obj->priv->old_h_adj_upper = gtk_adjustment_get_upper (adjustment);
+#else
     obj->priv->old_h_adj_lower = adjustment->lower;
     obj->priv->old_h_adj_upper = adjustment->upper;
+#endif
 
     image_render_h_adjustment_update (obj);
 }
@@ -196,9 +201,14 @@ void image_render_set_v_adjustment (ImageRender *obj, GtkAdjustment *adjustment)
               (GtkSignalFunc) image_render_v_adjustment_value_changed ,
               (gpointer) obj);
 
-    obj->priv->old_v_adj_value = adjustment->value;
+    obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
+#if GTK_CHECK_VERSION (2, 14, 0)
+    obj->priv->old_v_adj_lower = gtk_adjustment_get_lower (adjustment);
+    obj->priv->old_v_adj_upper = gtk_adjustment_get_upper (adjustment);
+#else
     obj->priv->old_v_adj_lower = adjustment->lower;
     obj->priv->old_v_adj_upper = adjustment->upper;
+#endif
 
     image_render_v_adjustment_update (obj);
 }
@@ -348,6 +358,9 @@ static void image_render_realize (GtkWidget *widget)
     ImageRender *obj = IMAGE_RENDER (widget);
 
     GdkWindowAttr attributes;
+#if GTK_CHECK_VERSION (2,14,0)
+    GdkWindow *window = gtk_widget_get_window (widget);
+#endif
 
     attributes.x = widget->allocation.x;
     attributes.y = widget->allocation.y;
@@ -365,11 +378,15 @@ static void image_render_realize (GtkWidget *widget)
     gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
     widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
 
+#if GTK_CHECK_VERSION (2,14,0)
+    widget->style = gtk_style_attach (widget->style, window);
+    gdk_window_set_user_data (window, widget);
+    gtk_style_set_background (widget->style, window, GTK_STATE_ACTIVE);
+#else
     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);
+#endif
 
     // image_render_prepare_disp_pixbuf (obj);
     if (!obj->priv->scaled_pixbuf_loaded)
@@ -383,7 +400,11 @@ static void image_render_redraw (ImageRender *w)
         return;
 
     image_render_notify_status_changed (w);
+#if GTK_CHECK_VERSION (2,14,0)
+    gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (w)), NULL, FALSE);
+#else
     gdk_window_invalidate_rect (GTK_WIDGET (w)->window, NULL, FALSE);
+#endif
 }
 
 
@@ -404,8 +425,11 @@ static void image_render_size_allocate (GtkWidget *widget, GtkAllocation *alloca
 
     if (GTK_WIDGET_REALIZED (widget))
     {
+#if GTK_CHECK_VERSION (2,14,0)
+        gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height);
+#else
         gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
-
+#endif
         image_render_prepare_disp_pixbuf (IMAGE_RENDER (widget));
     }
 }
@@ -422,7 +446,11 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
 
     ImageRender *w = IMAGE_RENDER (widget);
 
+#if GTK_CHECK_VERSION (2,14,0)
+    gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, widget->allocation.width, widget->allocation.height);
+#else
     gdk_window_clear_area (widget->window, 0, 0, widget->allocation.width, widget->allocation.height);
+#endif
 
     if (!w->priv->disp_pixbuf)
         return FALSE;
@@ -436,7 +464,11 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
         xc = widget->allocation.width / 2 - gdk_pixbuf_get_width (w->priv->disp_pixbuf)/2;
         yc = widget->allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
 
-        gdk_draw_pixbuf(widget->window,
+#if GTK_CHECK_VERSION (2,14,0)
+        gdk_draw_pixbuf (gtk_widget_get_window (widget),
+#else
+        gdk_draw_pixbuf (widget->window,
+#endif
                 NULL,
                 w->priv->disp_pixbuf,
                 0, 0, // source X, Y
@@ -458,7 +490,7 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
         }
         else
         {
-            src_x = (int)w->priv->h_adjustment->value;
+            src_x = (int) gtk_adjustment_get_value (w->priv->h_adjustment);
             dst_x = 0;
             width = MIN(widget->allocation.width, gdk_pixbuf_get_width (w->priv->disp_pixbuf));
             if (src_x + width > gdk_pixbuf_get_width (w->priv->disp_pixbuf))
@@ -466,7 +498,7 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
         }
 
 
-        if ((int)w->priv->h_adjustment->value > gdk_pixbuf_get_height (w->priv->disp_pixbuf))
+        if ((int) gtk_adjustment_get_value (w->priv->h_adjustment) > gdk_pixbuf_get_height (w->priv->disp_pixbuf))
         {
             src_y = 0;
             dst_y = widget->allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
@@ -474,7 +506,7 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
         }
         else
         {
-            src_y = (int)w->priv->v_adjustment->value;
+            src_y = (int) gtk_adjustment_get_value (w->priv->v_adjustment);
             dst_y = 0;
             height = MIN(widget->allocation.height, gdk_pixbuf_get_height (w->priv->disp_pixbuf));
 
@@ -494,7 +526,11 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
                 (int)w->priv->h_adjustment->value,
                 (int)w->priv->v_adjustment->value);
 #endif
+#if GTK_CHECK_VERSION (2,14,0)
+        gdk_draw_pixbuf(gtk_widget_get_window (widget),
+#else
         gdk_draw_pixbuf(widget->window,
+#endif
                         NULL,
                         w->priv->disp_pixbuf,
                         src_x, src_y,
@@ -565,9 +601,15 @@ static gboolean image_render_motion_notify (GtkWidget *widget, GdkEventMotion *e
         gint x = event->x;
         gint y = event->y;
 
+#if GTK_CHECK_VERSION (2,14,0)
+        GdkWindow *window = gtk_widget_get_window (widget);
+
+        if (event->is_hint || (event->window != window))
+            gdk_window_get_pointer (window, &x, &y, &mods);
+#else
         if (event->is_hint || (event->window != widget->window))
             gdk_window_get_pointer (widget->window, &x, &y, &mods);
-
+#endif
         // TODO: respond to motion event
     }
 
@@ -580,17 +622,25 @@ static void image_render_h_adjustment_update (ImageRender *obj)
     g_return_if_fail (obj != NULL);
     g_return_if_fail (IS_IMAGE_RENDER(obj));
 
-    gfloat new_value = obj->priv->h_adjustment->value;
+    gfloat new_value = gtk_adjustment_get_value (obj->priv->h_adjustment);
 
+#if GTK_CHECK_VERSION (2,14,0)
+    if (new_value < gtk_adjustment_get_lower (obj->priv->h_adjustment))
+        new_value = gtk_adjustment_get_lower (obj->priv->h_adjustment);
+
+    if (new_value > gtk_adjustment_get_upper (obj->priv->h_adjustment))
+        new_value = gtk_adjustment_get_upper (obj->priv->h_adjustment);
+#else
     if (new_value < obj->priv->h_adjustment->lower)
         new_value = obj->priv->h_adjustment->lower;
 
     if (new_value > obj->priv->h_adjustment->upper)
         new_value = obj->priv->h_adjustment->upper;
+#endif
 
-    if (new_value != obj->priv->h_adjustment->value)
+    if (new_value != gtk_adjustment_get_value (obj->priv->h_adjustment))
     {
-        obj->priv->h_adjustment->value = new_value;
+        gtk_adjustment_set_value (obj->priv->h_adjustment, new_value);
         gtk_signal_emit_by_name (GTK_OBJECT (obj->priv->h_adjustment), "value-changed");
     }
 
@@ -608,6 +658,18 @@ static void image_render_h_adjustment_changed (GtkAdjustment *adjustment, gpoint
 
     ImageRender *obj = IMAGE_RENDER (data);
 
+#if GTK_CHECK_VERSION (2,14,0)
+    if ((obj->priv->old_h_adj_value != gtk_adjustment_get_value (adjustment)) ||
+        (obj->priv->old_h_adj_lower != gtk_adjustment_get_lower (adjustment)) ||
+        (obj->priv->old_h_adj_upper != gtk_adjustment_get_upper (adjustment)))
+    {
+        image_render_h_adjustment_update (obj);
+
+        obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
+        obj->priv->old_h_adj_lower = gtk_adjustment_get_lower (adjustment);
+        obj->priv->old_h_adj_upper = gtk_adjustment_get_upper (adjustment);
+    }
+#else
     if ((obj->priv->old_h_adj_value != adjustment->value) ||
         (obj->priv->old_h_adj_lower != adjustment->lower) ||
         (obj->priv->old_h_adj_upper != adjustment->upper))
@@ -618,6 +680,7 @@ static void image_render_h_adjustment_changed (GtkAdjustment *adjustment, gpoint
         obj->priv->old_h_adj_lower = adjustment->lower;
         obj->priv->old_h_adj_upper = adjustment->upper;
     }
+#endif
 }
 
 
@@ -628,10 +691,10 @@ static void image_render_h_adjustment_value_changed (GtkAdjustment *adjustment,
 
     ImageRender *obj = IMAGE_RENDER (data);
 
-    if (obj->priv->old_h_adj_value != adjustment->value)
+    if (obj->priv->old_h_adj_value != gtk_adjustment_get_value (adjustment))
     {
         image_render_h_adjustment_update (obj);
-        obj->priv->old_h_adj_value = adjustment->value;
+        obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
     }
 }
 
@@ -641,17 +704,25 @@ static void image_render_v_adjustment_update (ImageRender *obj)
     g_return_if_fail (obj != NULL);
     g_return_if_fail (IS_IMAGE_RENDER(obj));
 
-    gfloat new_value = obj->priv->v_adjustment->value;
+    gfloat new_value = gtk_adjustment_get_value (obj->priv->v_adjustment);
+
+#if GTK_CHECK_VERSION (2,14,0)
+    if (new_value < gtk_adjustment_get_lower (obj->priv->v_adjustment))
+        new_value = gtk_adjustment_get_lower (obj->priv->v_adjustment);
 
+    if (new_value > gtk_adjustment_get_upper (obj->priv->v_adjustment))
+        new_value = gtk_adjustment_get_upper (obj->priv->v_adjustment);
+#else
     if (new_value < obj->priv->v_adjustment->lower)
         new_value = obj->priv->v_adjustment->lower;
 
     if (new_value > obj->priv->v_adjustment->upper)
         new_value = obj->priv->v_adjustment->upper;
+#endif
 
-    if (new_value != obj->priv->v_adjustment->value)
+    if (new_value != gtk_adjustment_get_value (obj->priv->v_adjustment))
     {
-        obj->priv->v_adjustment->value = new_value;
+        gtk_adjustment_set_value (obj->priv->v_adjustment, new_value);
         gtk_signal_emit_by_name (GTK_OBJECT (obj->priv->v_adjustment), "value-changed");
     }
 
@@ -669,6 +740,18 @@ static void image_render_v_adjustment_changed (GtkAdjustment *adjustment, gpoint
 
     ImageRender *obj = IMAGE_RENDER (data);
 
+#if GTK_CHECK_VERSION (2,14,0)
+    if ((obj->priv->old_v_adj_value != gtk_adjustment_get_value (adjustment)) ||
+        (obj->priv->old_v_adj_lower != gtk_adjustment_get_lower (adjustment)) ||
+        (obj->priv->old_v_adj_upper != gtk_adjustment_get_upper (adjustment)))
+    {
+        image_render_v_adjustment_update (obj);
+
+        obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
+        obj->priv->old_v_adj_lower = gtk_adjustment_get_lower (adjustment);
+        obj->priv->old_v_adj_upper = gtk_adjustment_get_upper (adjustment);
+    }
+#else
     if ((obj->priv->old_v_adj_value != adjustment->value) ||
         (obj->priv->old_v_adj_lower != adjustment->lower) ||
         (obj->priv->old_v_adj_upper != adjustment->upper))
@@ -679,6 +762,7 @@ static void image_render_v_adjustment_changed (GtkAdjustment *adjustment, gpoint
         obj->priv->old_v_adj_lower = adjustment->lower;
         obj->priv->old_v_adj_upper = adjustment->upper;
     }
+#endif
 }
 
 
@@ -689,10 +773,10 @@ static void image_render_v_adjustment_value_changed (GtkAdjustment *adjustment,
 
     ImageRender *obj = IMAGE_RENDER (data);
 
-    if (obj->priv->old_v_adj_value != adjustment->value)
+    if (obj->priv->old_v_adj_value != gtk_adjustment_get_value (adjustment))
     {
         image_render_v_adjustment_update (obj);
-        obj->priv->old_v_adj_value = adjustment->value;
+        obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
     }
 }
 
@@ -900,34 +984,56 @@ static void image_render_update_adjustments (ImageRender *obj)
     {
         if (obj->priv->h_adjustment)
         {
+#if GTK_CHECK_VERSION (2,14,0)
+            gtk_adjustment_set_lower (obj->priv->h_adjustment, 0);
+            gtk_adjustment_set_upper (obj->priv->h_adjustment, 0);
+#else
             obj->priv->h_adjustment->lower = 0;
             obj->priv->h_adjustment->upper = 0;
-            obj->priv->h_adjustment->value = 0;
-            gtk_adjustment_changed(obj->priv->h_adjustment);
+#endif
+            gtk_adjustment_set_value (obj->priv->h_adjustment, 0);
+            gtk_adjustment_changed (obj->priv->h_adjustment);
         }
         if (obj->priv->v_adjustment)
         {
+#if GTK_CHECK_VERSION (2,14,0)
+            gtk_adjustment_set_lower (obj->priv->v_adjustment, 0);
+            gtk_adjustment_set_upper (obj->priv->v_adjustment, 0);
+#else
             obj->priv->v_adjustment->lower = 0;
             obj->priv->v_adjustment->upper = 0;
-            obj->priv->v_adjustment->value = 0;
-            gtk_adjustment_changed(obj->priv->v_adjustment);
+#endif
+            gtk_adjustment_set_value (obj->priv->v_adjustment, 0);
+            gtk_adjustment_changed (obj->priv->v_adjustment);
         }
     }
     else
     {
         if (obj->priv->h_adjustment)
         {
+#if GTK_CHECK_VERSION (2,14,0)
+            gtk_adjustment_set_lower (obj->priv->h_adjustment, 0);
+            gtk_adjustment_set_upper (obj->priv->h_adjustment, gdk_pixbuf_get_width (obj->priv->disp_pixbuf));
+            gtk_adjustment_set_page_size (obj->priv->h_adjustment, GTK_WIDGET (obj)->allocation.width);
+#else
             obj->priv->h_adjustment->lower = 0;
             obj->priv->h_adjustment->upper = gdk_pixbuf_get_width (obj->priv->disp_pixbuf);
             obj->priv->h_adjustment->page_size = GTK_WIDGET (obj)->allocation.width;
-            gtk_adjustment_changed(obj->priv->h_adjustment);
+#endif
+            gtk_adjustment_changed (obj->priv->h_adjustment);
         }
         if (obj->priv->v_adjustment)
         {
+#if GTK_CHECK_VERSION (2,14,0)
+            gtk_adjustment_set_lower (obj->priv->v_adjustment, 0);
+            gtk_adjustment_set_upper (obj->priv->v_adjustment, gdk_pixbuf_get_height (obj->priv->disp_pixbuf));
+            gtk_adjustment_set_page_size (obj->priv->v_adjustment, GTK_WIDGET (obj)->allocation.height);
+#else
             obj->priv->v_adjustment->lower = 0;
             obj->priv->v_adjustment->upper = gdk_pixbuf_get_height (obj->priv->disp_pixbuf);
             obj->priv->v_adjustment->page_size = GTK_WIDGET (obj)->allocation.height;
-            gtk_adjustment_changed(obj->priv->v_adjustment);
+#endif
+            gtk_adjustment_changed (obj->priv->v_adjustment);
         }
     }
 }
diff --git a/src/utils.h b/src/utils.h
index cf93970..81db985 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -183,8 +183,15 @@ void set_cursor_busy_for_widget (GtkWidget *widget);
 
 inline void set_cursor_default_for_widget (GtkWidget *widget)
 {
+#if GTK_CHECK_VERSION (2, 14, 0)
+    GdkWindow *window = gtk_widget_get_window (widget);
+
+    if (window)
+        gdk_window_set_cursor (window, NULL);
+#else
     if (widget->window)
         gdk_window_set_cursor (widget->window, NULL);
+#endif
 }
 
 void set_cursor_busy ();



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