summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaszlo Boros <[email protected]>2013-08-18 01:26:29 +0200
committerStefano Karapetsas <[email protected]>2013-10-17 12:28:11 +0200
commit1e9954cbc51fc67b1e34cd6dd8f0a77a360eb4c8 (patch)
tree0051295b73ee5aa6caa0210e6a3ac7af11edf674 /src
parent7a364394044201fbd23a9fc5e152f512d24fd876 (diff)
downloadeom-1e9954cbc51fc67b1e34cd6dd8f0a77a360eb4c8.tar.bz2
eom-1e9954cbc51fc67b1e34cd6dd8f0a77a360eb4c8.tar.xz
GTK3 support
Diffstat (limited to 'src')
-rw-r--r--src/eom-print-image-setup.c4
-rw-r--r--src/eom-print-preview.c6
-rw-r--r--src/eom-properties-dialog.c4
-rw-r--r--src/eom-scroll-view.c6
-rw-r--r--src/eom-sidebar.c19
-rw-r--r--src/eom-statusbar.c6
-rw-r--r--src/eom-statusbar.h2
-rw-r--r--src/eom-thumb-nav.c4
-rw-r--r--src/eom-thumb-view.c22
-rw-r--r--src/eom-window.c21
10 files changed, 93 insertions, 1 deletions
diff --git a/src/eom-print-image-setup.c b/src/eom-print-image-setup.c
index 0a33997..df63b2b 100644
--- a/src/eom-print-image-setup.c
+++ b/src/eom-print-image-setup.c
@@ -36,6 +36,10 @@
#include "eom-print-image-setup.h"
#include "eom-print-preview.h"
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #define gtk_combo_box_new_text() gtk_combo_box_text_new()
+#endif
+
/**
* SECTION:
* @Title: Printing Custom Widget
diff --git a/src/eom-print-preview.c b/src/eom-print-preview.c
index 8b6f154..0e85ae6 100644
--- a/src/eom-print-preview.c
+++ b/src/eom-print-preview.c
@@ -1053,9 +1053,15 @@ eom_print_preview_draw (EomPrintPreview *preview, cairo_t *cr)
}
if (has_focus) {
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_paint_focus (style, cr,
+ GTK_STATE_NORMAL, NULL, NULL,
+ 0, 0, allocation.width, allocation.height);
+ #else
gtk_paint_focus (style, gtk_widget_get_window (area),
GTK_STATE_NORMAL, NULL, NULL, NULL,
0, 0, allocation.width, allocation.height);
+ #endif
}
}
diff --git a/src/eom-properties-dialog.c b/src/eom-properties-dialog.c
index 6cc737e..2e8beb2 100644
--- a/src/eom-properties-dialog.c
+++ b/src/eom-properties-dialog.c
@@ -51,6 +51,10 @@
#include "eom-exif-details.h"
#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #define gtk_widget_hide_all(w) gtk_widget_hide(w)
+#endif
+
#define EOM_PROPERTIES_DIALOG_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PROPERTIES_DIALOG, EomPropertiesDialogPrivate))
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index 9a389ae..6c2bf78 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -17,6 +17,8 @@
#include "uta.h"
#include "zoom.h"
+#include <gdk/gdk.h>
+
/* Maximum size of delayed repaint rectangles */
#define PAINT_RECT_WIDTH 128
#define PAINT_RECT_HEIGHT 128
@@ -2118,9 +2120,11 @@ eom_scroll_view_set_image (EomScrollView *view, EomImage *image)
if (priv->image != NULL) {
free_image_resources (view);
+ #if !GTK_CHECK_VERSION(3, 0, 0)
if (gtk_widget_is_drawable (priv->display) && image == NULL) {
gdk_window_clear (gtk_widget_get_window (priv->display));
}
+ #endif
}
g_assert (priv->image == NULL);
g_assert (priv->pixbuf == NULL);
@@ -2630,4 +2634,4 @@ eom_scroll_view_set_zoom_multiplier (EomScrollView *view,
g_return_if_fail (EOM_IS_SCROLL_VIEW (view));
view->priv->zoom_multiplier = 1.0 + zoom_multiplier;
-}
+} \ No newline at end of file
diff --git a/src/eom-sidebar.c b/src/eom-sidebar.c
index 8d8b8b0..4ca9e89 100644
--- a/src/eom-sidebar.c
+++ b/src/eom-sidebar.c
@@ -70,7 +70,11 @@ G_DEFINE_TYPE (EomSidebar, eom_sidebar, GTK_TYPE_VBOX)
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_SIDEBAR, EomSidebarPrivate))
static void
+#if GTK_CHECK_VERSION(3, 0, 0)
+eom_sidebar_destroy (GtkWidget *object)
+#else
eom_sidebar_destroy (GtkObject *object)
+#endif
{
EomSidebar *eom_sidebar = EOM_SIDEBAR (object);
@@ -84,7 +88,11 @@ eom_sidebar_destroy (GtkObject *object)
eom_sidebar->priv->page_model = NULL;
}
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ (* GTK_WIDGET_CLASS (eom_sidebar_parent_class)->destroy) (object);
+ #else
(* GTK_OBJECT_CLASS (eom_sidebar_parent_class)->destroy) (object);
+ #endif
}
static void
@@ -179,17 +187,28 @@ eom_sidebar_get_property (GObject *object,
static void
eom_sidebar_class_init (EomSidebarClass *eom_sidebar_class)
{
+ // REFERENCE:
+ // https://git.gnome.org/browse/eog/tree/src/eog-sidebar.c?h=gnome-3-0
+
GObjectClass *g_object_class;
GtkWidgetClass *widget_class;
+ #if !GTK_CHECK_VERSION(3, 0, 0)
GtkObjectClass *gtk_object_klass;
+ #endif
g_object_class = G_OBJECT_CLASS (eom_sidebar_class);
widget_class = GTK_WIDGET_CLASS (eom_sidebar_class);
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_object_klass = GTK_OBJECT_CLASS (eom_sidebar_class);
+ #endif
g_type_class_add_private (g_object_class, sizeof (EomSidebarPrivate));
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ widget_class->destroy = eom_sidebar_destroy;
+ #else
gtk_object_klass->destroy = eom_sidebar_destroy;
+ #endif
g_object_class->get_property = eom_sidebar_get_property;
g_object_class->set_property = eom_sidebar_set_property;
diff --git a/src/eom-statusbar.c b/src/eom-statusbar.c
index f234dcd..c791701 100644
--- a/src/eom-statusbar.c
+++ b/src/eom-statusbar.c
@@ -58,10 +58,14 @@ eom_statusbar_init (EomStatusbar *statusbar)
statusbar->priv = EOM_STATUSBAR_GET_PRIVATE (statusbar);
priv = statusbar->priv;
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar), TRUE);
+ #endif
priv->img_num_statusbar = gtk_statusbar_new ();
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (priv->img_num_statusbar), FALSE);
+ #endif
gtk_widget_set_size_request (priv->img_num_statusbar, 100, 10);
gtk_widget_show (priv->img_num_statusbar);
@@ -147,6 +151,7 @@ eom_statusbar_set_progress (EomStatusbar *statusbar,
}
}
+#if !GTK_CHECK_VERSION(3, 0, 0)
void
eom_statusbar_set_has_resize_grip (EomStatusbar *statusbar, gboolean has_resize_grip)
{
@@ -155,3 +160,4 @@ eom_statusbar_set_has_resize_grip (EomStatusbar *statusbar, gboolean has_resize_
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar),
has_resize_grip);
}
+#endif \ No newline at end of file
diff --git a/src/eom-statusbar.h b/src/eom-statusbar.h
index 5258127..cf263d4 100644
--- a/src/eom-statusbar.h
+++ b/src/eom-statusbar.h
@@ -63,8 +63,10 @@ void eom_statusbar_set_image_number (EomStatusbar *statusbar,
void eom_statusbar_set_progress (EomStatusbar *statusbar,
gdouble progress);
+#if !GTK_CHECK_VERSION(3, 0, 0)
void eom_statusbar_set_has_resize_grip (EomStatusbar *statusbar,
gboolean has_resize_grip);
+#endif
G_END_DECLS
diff --git a/src/eom-thumb-nav.c b/src/eom-thumb-nav.c
index 9ae2e4c..0bde9f8 100644
--- a/src/eom-thumb-nav.c
+++ b/src/eom-thumb-nav.c
@@ -32,6 +32,10 @@
#include <gtk/gtk.h>
#include <string.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #define gtk_widget_hide_all(w) gtk_widget_hide(w)
+#endif
+
#define EOM_THUMB_NAV_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_THUMB_NAV, EomThumbNavPrivate))
diff --git a/src/eom-thumb-view.c b/src/eom-thumb-view.c
index 9c1a30e..78fbe99 100644
--- a/src/eom-thumb-view.c
+++ b/src/eom-thumb-view.c
@@ -70,6 +70,16 @@ eom_thumb_view_finalize (GObject *object)
G_OBJECT_CLASS (eom_thumb_view_parent_class)->finalize (object);
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+eom_thumb_view_dispose (GObject *object)
+{
+ EomThumbView *thumbview;
+ g_return_if_fail (EOM_IS_THUMB_VIEW (object));
+ thumbview = EOM_THUMB_VIEW (object);
+
+ G_OBJECT_CLASS (eom_thumb_view_parent_class)->dispose (object);
+}
+#else
static void
eom_thumb_view_destroy (GtkObject *object)
{
@@ -79,15 +89,23 @@ eom_thumb_view_destroy (GtkObject *object)
GTK_OBJECT_CLASS (eom_thumb_view_parent_class)->destroy (object);
}
+#endif
static void
eom_thumb_view_class_init (EomThumbViewClass *class)
{
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+
+ gobject_class->constructed = eom_thumb_view_init;
+ gobject_class->dispose = eom_thumb_view_dispose;
+ #else
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
gobject_class->finalize = eom_thumb_view_finalize;
object_class->destroy = eom_thumb_view_destroy;
+ #endif
g_type_class_add_private (class, sizeof (EomThumbViewPrivate));
}
@@ -225,7 +243,11 @@ thumbview_on_adjustment_changed_cb (EomThumbView *thumbview,
static void
thumbview_on_parent_set_cb (GtkWidget *widget,
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget *old_parent,
+ #else
GtkObject *old_parent,
+ #endif
gpointer user_data)
{
EomThumbView *thumbview = EOM_THUMB_VIEW (widget);
diff --git a/src/eom-window.c b/src/eom-window.c
index 3ba7259..dc8b638 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -75,6 +75,12 @@
#include <lcms2.h>
#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #define gtk_widget_hide_all(w) gtk_widget_hide(w)
+ #define MATE_DESKTOP_USE_UNSTABLE_API
+ #include <libmate/mate-desktop-utils.h>
+#endif
+
#define EOM_WINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_WINDOW, EomWindowPrivate))
@@ -2645,7 +2651,9 @@ eom_window_cmd_edit_toolbar (GtkAction *action, gpointer *user_data)
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ #endif
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);
@@ -2844,10 +2852,21 @@ wallpaper_info_bar_response (GtkInfoBar *bar, gint response, EomWindow *window)
GdkScreen *screen;
screen = gtk_widget_get_screen (GTK_WIDGET (window));
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ /*
+
+ commented out, since my setup does not have the latest libmate-desktop with this function to call
+
+ mate_gdk_spawn_command_line_on_screen (screen,
+ "mate-appearance-properties"
+ " --show-page=background",
+ NULL);*/
+ #else
gdk_spawn_command_line_on_screen (screen,
"mate-appearance-properties"
" --show-page=background",
NULL);
+ #endif
}
/* Close message area on every response */
@@ -5062,8 +5081,10 @@ eom_window_window_state_event (GtkWidget *widget,
show = !(event->new_window_state &
(GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN));
+ #if !GTK_CHECK_VERSION(3, 0, 0)
eom_statusbar_set_has_resize_grip (EOM_STATUSBAR (window->priv->statusbar),
show);
+ #endif
}
return FALSE;