summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--NEWS2
-rw-r--r--configure.ac96
-rw-r--r--cut-n-paste-code/libegg/eggsmclient-private.h4
-rw-r--r--cut-n-paste-code/libegg/eggsmclient-xsmp.c21
-rw-r--r--cut-n-paste-code/libegg/eggsmclient.c5
-rw-r--r--eel/eel-accessibility.c71
-rw-r--r--eel/eel-accessibility.h7
-rw-r--r--eel/eel-background-box.c17
-rw-r--r--eel/eel-background.c162
-rw-r--r--eel/eel-background.h4
-rw-r--r--eel/eel-canvas-rect-ellipse.c216
-rw-r--r--eel/eel-canvas-rect-ellipse.h5
-rw-r--r--eel/eel-canvas.c405
-rw-r--r--eel/eel-canvas.h17
-rw-r--r--eel/eel-editable-label.c447
-rw-r--r--eel/eel-editable-label.h9
-rw-r--r--eel/eel-gdk-extensions.c143
-rw-r--r--eel/eel-gdk-extensions.h25
-rw-r--r--eel/eel-gdk-pixbuf-extensions.c35
-rw-r--r--eel/eel-gdk-pixbuf-extensions.h9
-rw-r--r--eel/eel-graphic-effects.c10
-rw-r--r--eel/eel-graphic-effects.h8
-rw-r--r--eel/eel-gtk-container.c8
-rw-r--r--eel/eel-gtk-container.h5
-rw-r--r--eel/eel-gtk-extensions.c38
-rw-r--r--eel/eel-gtk-extensions.h7
-rw-r--r--eel/eel-image-table.c16
-rw-r--r--eel/eel-labeled-image.c225
-rw-r--r--eel/eel-wrap-table.c30
-rw-r--r--libcaja-extension/Makefile.am3
-rw-r--r--libcaja-extension/libcaja-extension-uninstalled.pc.in2
-rw-r--r--libcaja-extension/libcaja-extension.pc.in2
-rw-r--r--libcaja-private/Makefile.am1
-rw-r--r--libcaja-private/caja-autorun.c29
-rw-r--r--libcaja-private/caja-cell-renderer-text-ellipsized.c34
-rw-r--r--libcaja-private/caja-column-chooser.c16
-rw-r--r--libcaja-private/caja-column-chooser.h8
-rw-r--r--libcaja-private/caja-dnd.c6
-rw-r--r--libcaja-private/caja-entry.c3
-rw-r--r--libcaja-private/caja-file-conflict-dialog.c65
-rw-r--r--libcaja-private/caja-icon-canvas-item.c568
-rw-r--r--libcaja-private/caja-icon-canvas-item.h8
-rw-r--r--libcaja-private/caja-icon-container.c762
-rw-r--r--libcaja-private/caja-icon-dnd.c103
-rw-r--r--libcaja-private/caja-icon-info.c16
-rw-r--r--libcaja-private/caja-icon-private.h22
-rw-r--r--libcaja-private/caja-mime-application-chooser.c12
-rw-r--r--libcaja-private/caja-mime-application-chooser.h8
-rw-r--r--libcaja-private/caja-open-with-dialog.c27
-rw-r--r--libcaja-private/caja-program-choosing.c81
-rw-r--r--libcaja-private/caja-progress-info.c29
-rw-r--r--libcaja-private/caja-thumbnails.c8
-rw-r--r--libcaja-private/caja-tree-view-drag-dest.c35
-rw-r--r--src/Makefile.am94
-rw-r--r--src/caja-application.c753
-rw-r--r--src/caja-application.h47
-rw-r--r--src/caja-autorun-software.c5
-rw-r--r--src/caja-bookmarks-window.c3
-rw-r--r--src/caja-connect-server-dialog-main.c6
-rw-r--r--src/caja-connect-server-dialog-nonmain.c3
-rw-r--r--src/caja-connect-server-dialog.c170
-rw-r--r--src/caja-desktop-window.c6
-rw-r--r--src/caja-emblem-sidebar.c14
-rw-r--r--src/caja-emblem-sidebar.h9
-rw-r--r--src/caja-history-sidebar.c14
-rw-r--r--src/caja-image-properties-page.c13
-rw-r--r--src/caja-image-properties-page.h8
-rw-r--r--src/caja-information-panel.c82
-rw-r--r--src/caja-location-bar.c31
-rw-r--r--src/caja-location-dialog.c6
-rw-r--r--src/caja-location-entry.c15
-rw-r--r--src/caja-main.c434
-rw-r--r--src/caja-main.h41
-rw-r--r--src/caja-navigation-window-menus.c13
-rw-r--r--src/caja-navigation-window-pane.c9
-rw-r--r--src/caja-navigation-window.c54
-rw-r--r--src/caja-navigation-window.h4
-rw-r--r--src/caja-notebook.c24
-rw-r--r--src/caja-pathbar.c272
-rw-r--r--src/caja-places-sidebar.c32
-rw-r--r--src/caja-property-browser.c94
-rw-r--r--src/caja-query-editor.c25
-rw-r--r--src/caja-query-editor.h8
-rw-r--r--src/caja-search-bar.c25
-rw-r--r--src/caja-side-pane.c26
-rw-r--r--src/caja-side-pane.h8
-rw-r--r--src/caja-sidebar-title.c156
-rw-r--r--src/caja-sidebar-title.h8
-rw-r--r--src/caja-spatial-window.c50
-rw-r--r--src/caja-trash-bar.c8
-rw-r--r--src/caja-trash-bar.h10
-rw-r--r--src/caja-view-as-action.c6
-rw-r--r--src/caja-window-manage-views.c15
-rw-r--r--src/caja-window-private.h5
-rw-r--r--src/caja-window-slot.c15
-rw-r--r--src/caja-window.c112
-rw-r--r--src/caja-x-content-bar.c8
-rw-r--r--src/caja-x-content-bar.h8
-rw-r--r--src/caja-zoom-control.c95
-rw-r--r--src/caja-zoom-control.h8
-rw-r--r--src/file-manager/fm-desktop-icon-view.c16
-rw-r--r--src/file-manager/fm-directory-view.c93
-rw-r--r--src/file-manager/fm-ditem-page.c68
-rw-r--r--src/file-manager/fm-icon-container.c2
-rw-r--r--src/file-manager/fm-icon-view.c29
-rw-r--r--src/file-manager/fm-list-model.c8
-rw-r--r--src/file-manager/fm-list-view.c79
-rw-r--r--src/file-manager/fm-properties-window.c1161
-rw-r--r--src/file-manager/fm-tree-model.c8
-rw-r--r--test/test-caja-wrap-table.c5
-rw-r--r--test/test-eel-editable-label.c16
-rw-r--r--test/test-eel-labeled-image.c6
113 files changed, 272 insertions, 7968 deletions
diff --git a/Makefile.am b/Makefile.am
index 764f9c46..f00647a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,7 @@ DISTCLEANFILES = \
intltool-merge \
intltool-update
-DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb --disable-icon-update --enable-gtk-doc --with-gtk=$(GTK_API_VERSION)
+DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb --disable-icon-update --enable-gtk-doc
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
diff --git a/NEWS b/NEWS
index dd6beabe..e0ca61fe 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+Major changes in 1.17.1 are:
+
Major changes in 1.17.0 are:
* Translations update
diff --git a/configure.ac b/configure.ac
index 49e0d123..9ce4d194 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,11 +6,11 @@ m4_define(glib_minver, 2.36.0)
m4_define(gio_minver, 2.26.0)
m4_define(mate_desktop_minver, 1.15.1)
m4_define(pango_minver, 1.1.2)
-m4_define(gtk_minver, 2.24.0)
+m4_define(gtk_minver, 3.14.0)
m4_define(xml_minver, 2.4.7)
m4_define(exif_minver, 0.6.14)
m4_define(exempi_minver, 1.99.5)
-m4_define(gail_minver, 0.16)
+m4_define(gail_minver, 3.0.0)
m4_define(notify_minver, 0.7.0)
@@ -20,36 +20,7 @@ dnl Interface break is not allowed.
m4_define(caja_extension_current, 5)
m4_define(caja_extension_revision, 0)
-AC_INIT([caja], [1.17.0], [http://www.mate-desktop.org])
-
-dnl ---------------------------------------------------------------------------
-dnl GTK library version
-dnl ---------------------------------------------------------------------------
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
- [
- case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
- esac
- ],
- [with_gtk=2.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
- 2.0) GTK_API_VERSION=2.0
- GTK_REQUIRED=2.24.0
- GAIL_API_VERSION=
- LIBUNIQUE_VERSION=1.0
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- GAIL_API_VERSION=-3.0
- ;;
-esac
-AC_SUBST([GTK_API_VERSION])
-AM_CONDITIONAL([WITH_GTK3],[test "$with_gtk" = "3.0"])
+AC_INIT([caja], [1.17.1], [http://www.mate-desktop.org])
dnl ---------------------------------------------------------------------------
@@ -66,9 +37,9 @@ AC_SUBST(GLIB_REQUIRED, [glib_minver])
AC_SUBST(GIO_REQUIRED, [gio_minver])
AC_SUBST(MATE_DESKTOP_REQUIRED, [mate_desktop_minver])
AC_SUBST(PANGO_REQUIRED, [pango_minver])
-AC_SUBST(GTK_REQUIRED, [$GTK_REQUIRED])
+AC_SUBST(GTK_REQUIRED, [gtk_minver])
AC_SUBST(XML_REQUIRED, [xml_minver])
-AC_SUBST(GAIL_REQUIRED)
+AC_SUBST(GAIL_REQUIRED, [gail_minver])
dnl We need to decrement current by one in the calculation of the age because
dnl the library was started with version "1:0:0" instead of "0:0:0"
@@ -94,10 +65,10 @@ PKG_CHECK_MODULES(ALL, [
gio-unix-2.0
gio-2.0 >= gio_minver
pango >= pango_minver
- gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
+ gtk+-3.0 >= gtk_minver
libnotify
libxml-2.0 >= xml_minver
- gail$GAIL_API_VERSION >= gail_minver
+ gail-3.0 >= gail_minver
])
dnl ==========================================================================
@@ -227,51 +198,6 @@ if test "x$enable_packagekit" != "xno"; then
AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable PackageKit mimetype installer])
fi
-
-#============================================================================
-# libunique
-#============================================================================
-
-dnl Whether to use libunique
-dnl --
-
-
-AC_ARG_ENABLE(libunique,
- AC_HELP_STRING([--disable-libunique],
- [use GtkApplication instead of libunique(GTK 3 only)]))
-msg_libunique=no
-if test "x$enable_libunique" != "xno"; then
- msg_libunique=yes
- AM_CONDITIONAL([ENABLE_LIBUNIQUE], true)
- AC_DEFINE(ENABLE_LIBUNIQUE, 1, [define to enable libunique])
-else
- msg_libunique=no
- AM_CONDITIONAL([ENABLE_LIBUNIQUE], false)
- AC_DEFINE(ENABLE_LIBUNIQUE, 0, [define to disable libunique])
-fi
-
-dnl =====
-
-if test $msg_libunique = "yes";then
-
- if test "$GTK_API_VERSION" = "3.0"; then
- LIBUNIQUE_VERSION=3.0
- else
- LIBUNIQUE_VERSION=1.0
- fi
- PKG_CHECK_MODULES(UNIQUE, unique-$LIBUNIQUE_VERSION)
-
- AC_SUBST([UNIQUE_CFLAGS])
- AC_SUBST([UNIQUE_LIBS])
-
- # this deprecated stuff should be removed from unique in most distros
- # but it's still not removed upstream in unique 1.x, so leaving it alone
- # just in case.
- UNIQUE_CFLAGS="$UNIQUE_CFLAGS -DG_CONST_RETURN=const"
-
- EXTRA_CORE_MODULES="$EXTRA_CORE_MODULES unique-$LIBUNIQUE_VERSION"
-fi
-
# ==========================================================================
# Turn on the additional warnings last, so -Werror doesn't affect other tests.
@@ -354,14 +280,14 @@ fi
dnl ==========================================================================
dnl libegg
-LIBEGG_MODULES="gtk+-$GTK_API_VERSION"
+LIBEGG_MODULES="gtk+-3.0"
LIBEGG_CFLAGS="`$PKG_CONFIG --cflags $LIBEGG_MODULES`"
AC_SUBST(LIBEGG_CFLAGS)
LIBEGG_LIBS="`$PKG_CONFIG --libs $LIBEGG_MODULES`"
AC_SUBST(LIBEGG_LIBS)
dnl libcaja-extension
-LIBCAJA_EXTENSION_MODULES="glib-2.0 gtk+-$GTK_API_VERSION"
+LIBCAJA_EXTENSION_MODULES="glib-2.0 gtk+-3.0"
LIBCAJA_EXTENSION_CFLAGS="`$PKG_CONFIG --cflags $LIBCAJA_EXTENSION_MODULES`"
AC_SUBST(LIBCAJA_EXTENSION_CFLAGS)
LIBCAJA_EXTENSION_LIBS="`$PKG_CONFIG --libs $LIBCAJA_EXTENSION_MODULES`"
@@ -369,7 +295,7 @@ AC_SUBST(LIBCAJA_EXTENSION_LIBS)
dnl core caja
PKG_CHECK_MODULES(GMODULE, gmodule-2.0, [GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
-CORE_MODULES="glib-2.0 $GMODULE_ADD mate-desktop-2.0 gthread-2.0 gio-2.0 gio-unix-2.0 gail$GAIL_API_VERSION libxml-2.0 $EXTRA_CORE_MODULES gtk+-$GTK_API_VERSION x11"
+CORE_MODULES="glib-2.0 $GMODULE_ADD mate-desktop-2.0 gthread-2.0 gio-2.0 gio-unix-2.0 gail-3.0 libxml-2.0 $EXTRA_CORE_MODULES gtk+-3.0 x11"
CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES`"
AC_SUBST(CORE_CFLAGS)
CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES`"
@@ -450,8 +376,6 @@ caja-$VERSION:
source code location: ${srcdir}
compiler: ${CC}
xmp support: $msg_xmp
- Gtk+ version: ${GTK_API_VERSION}
- Using libunique: $msg_libunique
PackageKit support: $msg_packagekit
caja-extension documentation: ${enable_gtk_doc}
diff --git a/cut-n-paste-code/libegg/eggsmclient-private.h b/cut-n-paste-code/libegg/eggsmclient-private.h
index 7bc38235..3eec5324 100644
--- a/cut-n-paste-code/libegg/eggsmclient-private.h
+++ b/cut-n-paste-code/libegg/eggsmclient-private.h
@@ -22,10 +22,6 @@
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#include <gdkconfig.h>
-#endif
-
#include "eggsmclient.h"
G_BEGIN_DECLS
diff --git a/cut-n-paste-code/libegg/eggsmclient-xsmp.c b/cut-n-paste-code/libegg/eggsmclient-xsmp.c
index 263d78ac..808fffc0 100644
--- a/cut-n-paste-code/libegg/eggsmclient-xsmp.c
+++ b/cut-n-paste-code/libegg/eggsmclient-xsmp.c
@@ -37,9 +37,7 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gdk/gdkx.h>
-#endif
#define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ())
#define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
@@ -371,13 +369,7 @@ sm_client_xsmp_startup (EggSMClient *client,
xsmp->client_id = g_strdup (ret_client_id);
free (ret_client_id);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_x11_set_sm_client_id (xsmp->client_id);
-#else
- gdk_threads_enter ();
- gdk_set_sm_client_id (xsmp->client_id);
- gdk_threads_leave ();
-#endif
g_debug ("Got client ID \"%s\"", xsmp->client_id);
}
@@ -545,10 +537,6 @@ idle_do_pending_events (gpointer data)
EggSMClientXSMP *xsmp = data;
EggSMClient *client = data;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_enter ();
-#endif
-
xsmp->idle = 0;
if (xsmp->waiting_to_emit_quit)
@@ -572,9 +560,6 @@ idle_do_pending_events (gpointer data)
}
out:
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_leave ();
-#endif
return FALSE;
}
@@ -1295,13 +1280,7 @@ static gboolean
process_ice_messages (IceConn ice_conn)
{
IceProcessMessagesStatus status;
-#if GTK_CHECK_VERSION (3, 0, 0)
- status = IceProcessMessages (ice_conn, NULL, NULL);
-#else
- gdk_threads_enter ();
status = IceProcessMessages (ice_conn, NULL, NULL);
- gdk_threads_leave ();
-#endif
switch (status)
{
diff --git a/cut-n-paste-code/libegg/eggsmclient.c b/cut-n-paste-code/libegg/eggsmclient.c
index 153d98e8..7dc0f8a8 100644
--- a/cut-n-paste-code/libegg/eggsmclient.c
+++ b/cut-n-paste-code/libegg/eggsmclient.c
@@ -53,7 +53,6 @@ G_DEFINE_TYPE (EggSMClient, egg_sm_client, G_TYPE_OBJECT)
static EggSMClient *global_client;
static EggSMClientMode global_client_mode = EGG_SM_CLIENT_MODE_NORMAL;
-#if ENABLE_LIBUNIQUE == (0)
static gboolean
running_in_mate (void)
{
@@ -61,7 +60,6 @@ running_in_mate (void)
|| (g_strcmp0 (g_getenv ("XDG_SESSION_DESKTOP"), "MATE") == 0)
|| (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "MATE") == 0);
}
-#endif
static void
egg_sm_client_init (EggSMClient *client)
@@ -366,11 +364,10 @@ egg_sm_client_get (void)
/*as egg_sm_client_set_mode must be called prior to start of main loop
/*to stop caja restart but this is diffcult in GtkApplication
*/
-#if ENABLE_LIBUNIQUE == (0)
+
if (geteuid () == 0 || !running_in_mate ()){
global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
}
-#endif
}
return global_client;
diff --git a/eel/eel-accessibility.c b/eel/eel-accessibility.c
index da586ddc..b669979f 100644
--- a/eel/eel-accessibility.c
+++ b/eel/eel-accessibility.c
@@ -63,58 +63,6 @@ eel_accessibility_set_up_label_widget_relation (GtkWidget *label, GtkWidget *wid
*
* Return value: the registered type, or 0 on failure.
**/
-#if !GTK_CHECK_VERSION(3, 0, 0)
-GType
-eel_accessibility_create_derived_type (const char *type_name,
- GType existing_gobject_with_proxy,
- EelAccessibilityClassInitFn class_init)
-{
- GType type;
- GType parent_atk_type;
- GTypeInfo tinfo = { 0 };
- GTypeQuery query;
- AtkObjectFactory *factory;
-
- if ((type = g_type_from_name (type_name)))
- {
- return type;
- }
-
- factory = atk_registry_get_factory
- (atk_get_default_registry (),
- existing_gobject_with_proxy);
- if (!factory)
- {
- return G_TYPE_INVALID;
- }
-
- parent_atk_type = atk_object_factory_get_accessible_type (factory);
- if (!parent_atk_type)
- {
- return G_TYPE_INVALID;
- }
-
- /*
- * Figure out the size of the class and instance
- * we are deriving from
- */
- g_type_query (parent_atk_type, &query);
-
- if (class_init)
- {
- tinfo.class_init = (GClassInitFunc) class_init;
- }
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- /* Register the type */
- type = g_type_register_static (
- parent_atk_type, type_name, &tinfo, 0);
-
- return type;
-}
-#endif
static GQuark
get_quark_accessible (void)
@@ -208,25 +156,6 @@ eel_accessibility_destroy (gpointer data,
*
* Return value: @atk_object.
**/
-#if !GTK_CHECK_VERSION(3, 0, 0)
-AtkObject *
-eel_accessibility_set_atk_object_return (gpointer object,
- AtkObject *atk_object)
-{
- atk_object_initialize (atk_object, object);
-
- if (!ATK_IS_GOBJECT_ACCESSIBLE (atk_object))
- {
- g_object_set_qdata_full
- (object, get_quark_accessible (), atk_object,
- (GDestroyNotify)eel_accessibility_destroy);
- g_object_set_qdata
- (G_OBJECT (atk_object), get_quark_gobject (), object);
- }
-
- return atk_object;
-}
-#endif
static GailTextUtil *
get_simple_text (gpointer object)
diff --git a/eel/eel-accessibility.h b/eel/eel-accessibility.h
index a1f68d56..b9d96e4d 100644
--- a/eel/eel-accessibility.h
+++ b/eel/eel-accessibility.h
@@ -38,13 +38,6 @@ typedef void (*EelAccessibilityClassInitFn) (AtkObjectClass *klass);
AtkObject *eel_accessibility_get_atk_object (gpointer object);
AtkObject *eel_accessibility_for_object (gpointer object);
gpointer eel_accessibility_get_gobject (AtkObject *object);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-AtkObject *eel_accessibility_set_atk_object_return (gpointer object,
- AtkObject *atk_object);
-GType eel_accessibility_create_derived_type (const char *type_name,
- GType existing_gobject_with_proxy,
- EelAccessibilityClassInitFn class_init);
-#endif
void eel_accessibility_set_name (gpointer object,
const char *name);
void eel_accessibility_set_description (gpointer object,
diff --git a/eel/eel-background-box.c b/eel/eel-background-box.c
index d0b80c4e..72aabec8 100644
--- a/eel/eel-background-box.c
+++ b/eel/eel-background-box.c
@@ -31,23 +31,12 @@ G_DEFINE_TYPE (EelBackgroundBox, eel_background_box, GTK_TYPE_EVENT_BOX)
static gboolean
eel_background_box_draw (GtkWidget *widget,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr)
-#else
- GdkEventExpose *event)
-#endif
{
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_background_draw (widget, cr);
gtk_container_propagate_draw (GTK_CONTAINER (widget),
gtk_bin_get_child (GTK_BIN (widget)),
cr);
-#else
- eel_background_draw (widget, event);
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- gtk_bin_get_child (GTK_BIN (widget)),
- event);
-#endif
return TRUE;
}
@@ -60,12 +49,8 @@ static void
eel_background_box_class_init (EelBackgroundBoxClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = eel_background_box_draw;
-#else
- widget_class->expose_event = eel_background_box_draw;
-#endif
+
}
GtkWidget*
diff --git a/eel/eel-background.c b/eel/eel-background.c
index f652e98e..2734cdce 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -31,28 +31,13 @@
#include "eel-lib-self-check-functions.h"
#include <gtk/gtk.h>
#include <eel/eel-canvas.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
# include <cairo-xlib.h>
-#endif
#include <gdk/gdkx.h>
#include <gio/gio.h>
#include <math.h>
#include <stdio.h>
#include <libcaja-private/caja-global-preferences.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define cairo_surface_t GdkPixmap
-#define cairo_surface_destroy g_object_unref
-#define cairo_xlib_surface_get_display GDK_PIXMAP_XDISPLAY
-#define cairo_xlib_surface_get_drawable GDK_PIXMAP_XID
-#define cairo_set_source_surface gdk_cairo_set_source_pixmap
-#define mate_bg_create_surface mate_bg_create_pixmap
-#define mate_bg_set_surface_as_root mate_bg_set_pixmap_as_root
-#define mate_bg_get_surface_from_root mate_bg_get_pixmap_from_root
-#define mate_bg_crossfade_set_start_surface mate_bg_crossfade_set_start_pixmap
-#define mate_bg_crossfade_set_end_surface mate_bg_crossfade_set_end_pixmap
-#endif
-
G_DEFINE_TYPE (EelBackground, eel_background, G_TYPE_OBJECT);
enum
@@ -77,12 +62,7 @@ struct EelBackgroundDetails
MateBGCrossfade *fade;
int bg_entire_width;
int bg_entire_height;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA default_color;
-#else
- GdkColor default_color;
-#endif
-
gboolean use_base;
/* Is this background attached to desktop window */
@@ -167,11 +147,7 @@ eel_background_unrealize (EelBackground *self)
static void
make_color_inactive (EelBackground *self,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *color)
-#else
- GdkColor *color)
-#endif
{
double intensity, saturation;
gushort t;
@@ -206,11 +182,7 @@ gchar *
eel_bg_get_desktop_color (EelBackground *self)
{
MateBGColorType type;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA primary, secondary;
-#else
- GdkColor primary, secondary;
-#endif
char *start_color, *end_color, *color_spec;
gboolean use_gradient = TRUE;
gboolean is_horizontal = FALSE;
@@ -230,19 +202,11 @@ eel_bg_get_desktop_color (EelBackground *self)
use_gradient = FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
start_color = eel_gdk_rgb_to_color_spec (eel_gdk_rgba_to_rgb (&primary));
if (use_gradient)
{
end_color = eel_gdk_rgb_to_color_spec (eel_gdk_rgba_to_rgb (&secondary));
-#else
- start_color = eel_gdk_rgb_to_color_spec (eel_gdk_color_to_rgb (&primary));
-
- if (use_gradient)
- {
- end_color = eel_gdk_rgb_to_color_spec (eel_gdk_color_to_rgb (&secondary));
-#endif
color_spec = eel_gradient_new (start_color, end_color, is_horizontal);
g_free (end_color);
}
@@ -255,7 +219,6 @@ eel_bg_get_desktop_color (EelBackground *self)
return color_spec;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
set_image_properties (EelBackground *self)
{
@@ -298,51 +261,6 @@ set_image_properties (EelBackground *self)
}
}
}
-#else
-static void
-set_image_properties (EelBackground *self)
-{
- GdkColor c;
-
- if (self->details->is_desktop && !self->details->color)
- self->details->color = eel_bg_get_desktop_color (self);
-
- if (!self->details->color)
- {
- c = self->details->default_color;
- make_color_inactive (self, &c);
- mate_bg_set_color (self->details->bg, MATE_BG_COLOR_SOLID, &c, NULL);
- }
- else if (!eel_gradient_is_gradient (self->details->color))
- {
- eel_gdk_color_parse_with_white_default (self->details->color, &c);
- make_color_inactive (self, &c);
- mate_bg_set_color (self->details->bg, MATE_BG_COLOR_SOLID, &c, NULL);
- }
- else
- {
- GdkColor c1, c2;
- char *spec;
-
- spec = eel_gradient_get_start_color_spec (self->details->color);
- eel_gdk_color_parse_with_white_default (spec, &c1);
- make_color_inactive (self, &c1);
- g_free (spec);
-
- spec = eel_gradient_get_end_color_spec (self->details->color);
- eel_gdk_color_parse_with_white_default (spec, &c2);
- make_color_inactive (self, &c2);
- g_free (spec);
-
- if (eel_gradient_is_horizontal (self->details->color)) {
- mate_bg_set_color (self->details->bg, MATE_BG_COLOR_H_GRADIENT, &c1, &c2);
- } else {
- mate_bg_set_color (self->details->bg, MATE_BG_COLOR_V_GRADIENT, &c1, &c2);
- }
- }
-}
-#endif
-
gchar *
eel_background_get_color (EelBackground *self)
@@ -398,7 +316,6 @@ eel_background_ensure_realized (EelBackground *self)
{
int width, height;
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style;
/* Set the default color */
@@ -412,17 +329,6 @@ eel_background_ensure_realized (EelBackground *self)
gtk_style_context_get_state (style),
&self->details->default_color);
gtk_style_context_restore (style);
-#else
- GtkStyle *style;
-
- /* Set the default color */
- style = gtk_widget_get_style (self->details->widget);
- if (self->details->use_base) {
- self->details->default_color = style->base[GTK_STATE_NORMAL];
- } else {
- self->details->default_color = style->bg[GTK_STATE_NORMAL];
- }
-#endif
/* If the window size is the same as last time, don't update */
drawable_get_adjusted_size (self, &width, &height);
@@ -450,7 +356,6 @@ eel_background_ensure_realized (EelBackground *self)
void
eel_background_draw (GtkWidget *widget,
-# if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr)
{
int width, height;
@@ -479,42 +384,6 @@ eel_background_draw (GtkWidget *widget,
cairo_restore (cr);
}
-# else
- GdkEventExpose *event)
-{
- int width, height;
- GdkWindow *window = gtk_widget_get_window (widget);
- GdkColor color;
-
- if (event->window != window)
- return;
-
- EelBackground *self = eel_get_widget_background (widget);
-
- drawable_get_adjusted_size (self, &width, &height);
-
- eel_background_ensure_realized (self);
- color = self->details->default_color;
- make_color_inactive (self, &color);
-
- cairo_t *cr = gdk_cairo_create (window);
-
- if (self->details->bg_surface != NULL) {
- cairo_set_source_surface (cr, self->details->bg_surface, 0, 0);
- cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
- } else {
- gdk_cairo_set_source_color (cr, &color);
- }
-
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-}
-# endif
static void
set_root_surface (EelBackground *self,
@@ -627,11 +496,8 @@ eel_background_set_up_widget (EelBackground *self)
{
GdkWindow *window;
GtkWidget *widget = self->details->widget;
-# if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
+
gboolean in_fade = FALSE;
if (!gtk_widget_get_realized (widget))
@@ -655,30 +521,21 @@ eel_background_set_up_widget (EelBackground *self)
if (!in_fade)
{
-# if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *pattern;
pattern = cairo_pattern_create_for_surface (self->details->bg_surface);
gdk_window_set_background_pattern (window, pattern);
cairo_pattern_destroy (pattern);
-# endif
+
if (self->details->is_desktop)
{
-# if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_window_set_back_pixmap (window, self->details->bg_surface, FALSE);
-# endif
set_root_surface (self, window, gtk_widget_get_screen (widget));
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_window_set_background_rgba (window, &color);
-#else
- gdk_window_set_background (window, &color);
-#endif
-# if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_window_set_back_pixmap (window, self->details->bg_surface, FALSE);
-# endif
+
}
gdk_window_invalidate_rect (window, NULL, TRUE);
@@ -1173,21 +1030,16 @@ eel_background_set_dropped_color (EelBackground *self,
top_border = 32;
bottom_border = allocation.height - 32;
-#if GTK_CHECK_VERSION (3, 0, 0)
/* If a custom background color isn't set, get the GtkStyleContext's bg color. */
-#else
- /* If a custom background color isn't set, get the GtkStyle's bg color. */
-#endif
+
if (!self->details->color)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
+
GtkStyleContext *style = gtk_widget_get_style_context (widget);
GdkRGBA bg;
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &bg);
gradient_spec = gdk_rgba_to_string (&bg);
-#else
- gradient_spec = gdk_color_to_string (&gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL]);
-#endif
+
}
else
{
diff --git a/eel/eel-background.h b/eel/eel-background.h
index 9303835e..b16fc88b 100644
--- a/eel/eel-background.h
+++ b/eel/eel-background.h
@@ -95,11 +95,7 @@ gboolean eel_background_is_set (EelBackground
/* Helper function for widgets using EelBackground */
void eel_background_draw (GtkWidget *widget,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr);
-#else
- GdkEventExpose *event);
-#endif
/* Handles a dragged color being dropped on a widget to change the background color. */
void eel_background_set_dropped_color (EelBackground *self,
diff --git a/eel/eel-canvas-rect-ellipse.c b/eel/eel-canvas-rect-ellipse.c
index b1300679..40237cf5 100644
--- a/eel/eel-canvas-rect-ellipse.c
+++ b/eel/eel-canvas-rect-ellipse.c
@@ -53,15 +53,7 @@ enum
PROP_Y1,
PROP_X2,
PROP_Y2,
-#if !GTK_CHECK_VERSION(3,0,0)
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
-#endif
PROP_FILL_COLOR_RGBA,
-#if !GTK_CHECK_VERSION(3,0,0)
- PROP_OUTLINE_COLOR,
- PROP_OUTLINE_COLOR_GDK,
-#endif
PROP_OUTLINE_COLOR_RGBA,
PROP_OUTLINE_STIPPLING,
PROP_WIDTH_PIXELS,
@@ -170,52 +162,18 @@ eel_canvas_re_class_init (EelCanvasREClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
-#if GTK_CHECK_VERSION(3,0,0)
PROP_FILL_COLOR_RGBA,
g_param_spec_boxed ("fill-color-rgba", NULL, NULL,
GDK_TYPE_RGBA,
-#else
- PROP_FILL_COLOR,
- g_param_spec_string ("fill-color", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_FILL_COLOR_GDK,
- g_param_spec_boxed ("fill-color-gdk", NULL, NULL,
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill-color-rgba", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_OUTLINE_COLOR,
- g_param_spec_string ("outline-color", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_OUTLINE_COLOR_GDK,
- g_param_spec_boxed ("outline-color-gdk", NULL, NULL,
- GDK_TYPE_COLOR,
-#endif
+
G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
PROP_OUTLINE_COLOR_RGBA,
-#if GTK_CHECK_VERSION(3,0,0)
g_param_spec_boxed ("outline-color-rgba", NULL, NULL,
GDK_TYPE_RGBA,
G_PARAM_READWRITE));
-#else
- g_param_spec_uint ("outline-color-rgba", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-#endif
+
g_object_class_install_property
(gobject_class,
PROP_OUTLINE_STIPPLING,
@@ -317,10 +275,6 @@ eel_canvas_re_set_property (GObject *object,
{
EelCanvasItem *item;
EelCanvasRE *re;
-#if !GTK_CHECK_VERSION(3,0,0)
- GdkColor color = { 0, 0, 0, 0, };
- GdkColor *pcolor;
-#endif
g_return_if_fail (object != NULL);
g_return_if_fail (EEL_IS_CANVAS_RE (object));
@@ -354,7 +308,6 @@ eel_canvas_re_set_property (GObject *object,
eel_canvas_item_request_update (item);
break;
-#if GTK_CHECK_VERSION(3,0,0)
case PROP_FILL_COLOR_RGBA: {
GdkRGBA *color;
@@ -384,95 +337,6 @@ eel_canvas_re_set_property (GObject *object,
eel_canvas_item_request_redraw (item);
break;
}
-#else
- case PROP_FILL_COLOR:
- case PROP_FILL_COLOR_GDK:
- case PROP_FILL_COLOR_RGBA:
- switch (param_id)
- {
- case PROP_FILL_COLOR:
- if (g_value_get_string (value) &&
- gdk_color_parse (g_value_get_string (value), &color))
- eel_canvas_re_set_fill (re, TRUE);
- else
- eel_canvas_re_set_fill (re, FALSE);
-
- re->fill_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_FILL_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- eel_canvas_re_set_fill (re, pcolor != NULL);
-
- if (pcolor)
- {
- color = *pcolor;
- }
-
- re->fill_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- eel_canvas_re_set_fill (re, TRUE);
- re->fill_color = g_value_get_uint (value);
- break;
- }
-#ifdef VERBOSE
- g_print ("re fill color = %08x\n", re->fill_color);
-#endif
- eel_canvas_item_request_redraw (item);
- break;
-
- case PROP_OUTLINE_COLOR:
- case PROP_OUTLINE_COLOR_GDK:
- case PROP_OUTLINE_COLOR_RGBA:
- switch (param_id)
- {
- case PROP_OUTLINE_COLOR:
- if (g_value_get_string (value) &&
- gdk_color_parse (g_value_get_string (value), &color))
- eel_canvas_re_set_outline (re, TRUE);
- else
- eel_canvas_re_set_outline (re, FALSE);
-
- re->outline_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_OUTLINE_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- eel_canvas_re_set_outline (re, pcolor != NULL);
-
- if (pcolor)
- {
- color = *pcolor;
- }
-
- re->outline_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_OUTLINE_COLOR_RGBA:
- eel_canvas_re_set_outline (re, TRUE);
- re->outline_color = g_value_get_uint (value);
- break;
- }
-#ifdef VERBOSE
- g_print ("re outline color %x %x %x\n", color.red, color.green, color.blue);
-#endif
- eel_canvas_item_request_redraw (item);
- break;
-#endif
case PROP_OUTLINE_STIPPLING:
re->outline_stippling = g_value_get_boolean (value);
@@ -500,26 +364,6 @@ eel_canvas_re_set_property (GObject *object,
}
}
-#if !GTK_CHECK_VERSION(3,0,0)
-/* Allocates a GdkColor structure filled with the specified pixel, and puts it into the specified
- * value for returning it in the get_property method.
- */
-static void
-get_color_value (EelCanvasRE *re, gulong pixel, GValue *value)
-{
- GdkColor color;
-
- color.red = (pixel >> 16) & 0xFF;
- color.green = (pixel >> 8) & 0xFF;
- color.blue = pixel & 0xFF;
- color.red |= color.red << 8;
- color.green |= color.green << 8;
- color.blue |= color.blue << 8;
-
- g_value_set_boxed (value, &color);
-}
-#endif
-
static void
eel_canvas_re_get_property (GObject *object,
guint param_id,
@@ -551,29 +395,12 @@ eel_canvas_re_get_property (GObject *object,
g_value_set_double (value, re->y2);
break;
-#if GTK_CHECK_VERSION(3,0,0)
case PROP_FILL_COLOR_RGBA:
g_value_set_boxed (value, &re->fill_color);
break;
case PROP_OUTLINE_COLOR_RGBA:
g_value_set_boxed (value, &re->outline_color);
-#else
- case PROP_FILL_COLOR_GDK:
- get_color_value (re, re->fill_color, value);
- break;
-
- case PROP_OUTLINE_COLOR_GDK:
- get_color_value (re, re->outline_color, value);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- g_value_set_uint (value, re->fill_color);
- break;
-
- case PROP_OUTLINE_COLOR_RGBA:
- g_value_set_uint (value, re->outline_color);
-#endif
break;
case PROP_OUTLINE_STIPPLING:
@@ -660,11 +487,8 @@ static void eel_canvas_rect_init (EelCanvasRect *rect);
static void eel_canvas_rect_finalize (GObject *object);
static void eel_canvas_rect_realize (EelCanvasItem *item);
-#if GTK_CHECK_VERSION(3,0,0)
static void eel_canvas_rect_draw (EelCanvasItem *item, cairo_t *cr, cairo_region_t *region);
-#else
-static void eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose);
-#endif
+
static double eel_canvas_rect_point (EelCanvasItem *item, double x, double y, int cx, int cy,
EelCanvasItem **actual_item);
@@ -780,29 +604,15 @@ eel_canvas_rect_realize (EelCanvasItem *item)
static void
eel_canvas_set_source_color (cairo_t *cr,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *rgba)
{
gdk_cairo_set_source_rgba (cr, rgba);
-#else
- guint rgba)
-{
- cairo_set_source_rgba (cr,
- ((rgba >> 24) & 0xff) / 255.,
- ((rgba >> 16) & 0xff) / 255.,
- ((rgba >> 8) & 0xff) / 255.,
- ((rgba >> 0) & 0xff) / 255.);
-#endif
}
#define DASH_ON 0.8
#define DASH_OFF 1.7
static void
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_rect_draw (EelCanvasItem *item, cairo_t *cr, cairo_region_t *region)
-#else
-eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose)
-#endif
{
EelCanvasRE *re;
double x1, y1, x2, y2;
@@ -828,21 +638,11 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
return;
}
-#if GTK_CHECK_VERSION(3,0,0)
cairo_save (cr);
-#else
- cairo_t *cr = gdk_cairo_create (drawable);
- gdk_cairo_region (cr, expose->region);
- cairo_clip (cr);
-#endif
if (re->fill_set)
{
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_set_source_color (cr, &re->fill_color);
-#else
- eel_canvas_set_source_color (cr, re->fill_color);
-#endif
cairo_rectangle (cr,
cx1, cy1,
cx2 - cx1 + 1,
@@ -852,11 +652,8 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
if (re->outline_set)
{
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_set_source_color (cr, &re->outline_color);
-#else
- eel_canvas_set_source_color (cr, re->outline_color);
-#endif
+
if (re->width_pixels) {
cairo_set_line_width (cr, (int) re->width);
} else {
@@ -875,12 +672,7 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
cy2 - cy1);
cairo_stroke (cr);
}
-
-#if GTK_CHECK_VERSION(3,0,0)
cairo_restore (cr);
-#else
- cairo_destroy (cr);
-#endif
}
static double
diff --git a/eel/eel-canvas-rect-ellipse.h b/eel/eel-canvas-rect-ellipse.h
index 2d1dac59..e391dfb4 100644
--- a/eel/eel-canvas-rect-ellipse.h
+++ b/eel/eel-canvas-rect-ellipse.h
@@ -84,13 +84,8 @@ extern "C" {
double x1, y1, x2, y2; /* Corners of item */
double width; /* Outline width */
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA fill_color;
GdkRGBA outline_color;
-#else
- guint fill_color; /* Fill color, RGBA */
- guint outline_color; /* Outline color, RGBA */
-#endif
gboolean outline_stippling;
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 162c0b44..ddc15036 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -68,25 +68,13 @@
#include <stdio.h>
#include <gdk/gdkprivate.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3,2,0)
#include <gtk/gtk-a11y.h>
-#endif
#include <glib/gi18n-lib.h>
-#if GTK_CHECK_VERSION(3,0,0)
-# include <cairo/cairo-gobject.h>
-#endif
+#include <cairo/cairo-gobject.h>
#include "eel-canvas.h"
#include "eel-marshal.h"
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
-#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
-#define gtk_scrollable_set_hadjustment gtk_layout_set_hadjustment
-#define gtk_scrollable_set_vadjustment gtk_layout_set_vadjustment
-#define GTK_SCROLLABLE GTK_LAYOUT
-#endif
-
static void eel_canvas_request_update (EelCanvas *canvas);
static void group_add (EelCanvasGroup *group,
EelCanvasItem *item);
@@ -344,20 +332,11 @@ eel_canvas_item_dispose (GObject *object)
item->canvas->need_repick = TRUE;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
#if GTK_CHECK_VERSION(3, 20, 0)
eel_canvas_item_ungrab (item);
#else
eel_canvas_item_ungrab (item, GDK_CURRENT_TIME);
#endif
-#else
- if (item == item->canvas->grabbed_item)
- {
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
- item->canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
- }
-#endif
if (item == item->canvas->focused_item)
item->canvas->focused_item = NULL;
@@ -928,7 +907,6 @@ seat_grab_prepare_window (GdkSeat *seat,
* gdk_pointer_grab().
**/
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkGrabStatus
eel_canvas_item_grab (EelCanvasItem *item,
GdkEventMask event_mask,
@@ -982,29 +960,6 @@ eel_canvas_item_grab (EelCanvasItem *item,
cursor,
timestamp);
#endif
-#else
-int
-eel_canvas_item_grab (EelCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime)
-{
- int retval;
-
- g_return_val_if_fail (EEL_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE);
- g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)),
- GDK_GRAB_NOT_VIEWABLE);
-
- if (item->canvas->grabbed_item)
- return GDK_GRAB_ALREADY_GRABBED;
-
- if (!(item->flags & EEL_CANVAS_ITEM_MAPPED))
- return GDK_GRAB_NOT_VIEWABLE;
-
- retval = gdk_pointer_grab (gtk_layout_get_bin_window (&item->canvas->layout),
- FALSE,
- event_mask,
- NULL,
- cursor,
- etime);
-#endif
if (retval != GDK_GRAB_SUCCESS)
return retval;
@@ -1034,7 +989,6 @@ eel_canvas_item_grab (EelCanvasItem *item, guint event_mask, GdkCursor *cursor,
* mouse.
**/
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
void
#if GTK_CHECK_VERSION(3, 20, 0)
eel_canvas_item_ungrab (EelCanvasItem *item)
@@ -1073,22 +1027,6 @@ eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime)
gdk_device_ungrab (device, etime);
}
#endif
-#else
-void
-eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime)
-{
- GdkDisplay *display;
-
- g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
-
- if (item->canvas->grabbed_item != item)
- return;
-
- display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
- item->canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, etime);
-}
-#endif
/**
* eel_canvas_item_w2i:
@@ -1367,14 +1305,9 @@ static void eel_canvas_group_update (EelCanvasItem *item,
static void eel_canvas_group_unrealize (EelCanvasItem *item);
static void eel_canvas_group_map (EelCanvasItem *item);
static void eel_canvas_group_unmap (EelCanvasItem *item);
-#if GTK_CHECK_VERSION(3,0,0)
static void eel_canvas_group_draw (EelCanvasItem *item,
cairo_t *cr,
cairo_region_t *region);
-#else
-static void eel_canvas_group_draw (EelCanvasItem *item, GdkDrawable *drawable,
- GdkEventExpose *expose);
-#endif
static double eel_canvas_group_point (EelCanvasItem *item, double x, double y,
int cx, int cy,
EelCanvasItem **actual_item);
@@ -1695,14 +1628,9 @@ eel_canvas_group_unmap (EelCanvasItem *item)
/* Draw handler for canvas groups */
static void
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_group_draw (EelCanvasItem *item,
cairo_t *cr,
cairo_region_t *region)
-#else
-eel_canvas_group_draw (EelCanvasItem *item, GdkDrawable *drawable,
- GdkEventExpose *expose)
-#endif
{
EelCanvasGroup *group;
GList *list;
@@ -1724,13 +1652,8 @@ eel_canvas_group_draw (EelCanvasItem *item, GdkDrawable *drawable,
child_rect.width = child->x2 - child->x1 + 1;
child_rect.height = child->y2 - child->y1 + 1;
-#if GTK_CHECK_VERSION (3, 0, 0)
if (cairo_region_contains_rectangle (region, &child_rect) != CAIRO_REGION_OVERLAP_OUT)
EEL_CANVAS_ITEM_GET_CLASS (child)->draw (child, cr, region);
-#else
- if (gdk_region_rect_in (expose->region, &child_rect) != GDK_OVERLAP_RECTANGLE_OUT)
- (* EEL_CANVAS_ITEM_GET_CLASS (child)->draw) (child, drawable, expose);
-#endif
}
}
}
@@ -1958,11 +1881,7 @@ enum
static void eel_canvas_class_init (EelCanvasClass *klass);
static void eel_canvas_init (EelCanvas *canvas);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void eel_canvas_destroy (GtkWidget *object);
-#else
-static void eel_canvas_destroy (GtkObject *object);
-#endif
static void eel_canvas_map (GtkWidget *widget);
static void eel_canvas_unmap (GtkWidget *widget);
static void eel_canvas_realize (GtkWidget *widget);
@@ -1973,13 +1892,8 @@ static gint eel_canvas_button (GtkWidget *widget,
GdkEventButton *event);
static gint eel_canvas_motion (GtkWidget *widget,
GdkEventMotion *event);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gint eel_canvas_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gint eel_canvas_expose (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
static gint eel_canvas_key (GtkWidget *widget,
GdkEventKey *event);
static gint eel_canvas_crossing (GtkWidget *widget,
@@ -1990,14 +1904,7 @@ static gint eel_canvas_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static void eel_canvas_request_update_real (EelCanvas *canvas);
static void eel_canvas_draw_background (EelCanvas *canvas,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr);
-#else
- int x,
- int y,
- int width,
- int height);
-#endif
static GtkLayoutClass *canvas_parent_class;
@@ -2161,7 +2068,6 @@ eel_canvas_accessible_ref_child (AtkObject *obj,
return atk_object;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
G_DEFINE_TYPE (EelCanvasAccessible, eel_canvas_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
static void
@@ -2179,125 +2085,6 @@ static void
eel_canvas_accessible_init (EelCanvasAccessible *accessible)
{
}
-#else
-static void
-eel_canvas_accessible_class_init (AtkObjectClass *klass)
-{
- accessible_parent_class = g_type_class_peek_parent (klass);
-
- klass->initialize = eel_canvas_accessible_initialize;
- klass->get_n_children = eel_canvas_accessible_get_n_children;
- klass->ref_child = eel_canvas_accessible_ref_child;
-}
-
-static GType
-eel_canvas_accessible_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- AtkObjectFactory *factory;
- GType parent_atk_type;
- GTypeQuery query;
- GTypeInfo tinfo = { 0 };
-
- factory = atk_registry_get_factory (atk_get_default_registry(),
- GTK_TYPE_WIDGET);
- if (!factory)
- {
- return G_TYPE_INVALID;
- }
- parent_atk_type = atk_object_factory_get_accessible_type (factory);
- if (!parent_atk_type)
- {
- return G_TYPE_INVALID;
- }
- g_type_query (parent_atk_type, &query);
- tinfo.class_init = (GClassInitFunc) eel_canvas_accessible_class_init;
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
- type = g_type_register_static (parent_atk_type,
- "EelCanvasAccessibility",
- &tinfo, 0);
- }
- return type;
-}
-
-static AtkObject *
-eel_canvas_accessible_create (GObject *for_object)
-{
- GType type;
- AtkObject *accessible;
- EelCanvas *canvas;
-
- canvas = EEL_CANVAS (for_object);
- g_return_val_if_fail (canvas != NULL, NULL);
-
- type = eel_canvas_accessible_get_type ();
-
- if (type == G_TYPE_INVALID)
- {
- return atk_no_op_object_new (for_object);
- }
-
- accessible = g_object_new (type, NULL);
- atk_object_initialize (accessible, for_object);
- return accessible;
-}
-
-static GType
-eel_canvas_accessible_factory_get_accessible_type (void)
-{
- return eel_canvas_accessible_get_type ();
-}
-
-static AtkObject*
-eel_canvas_accessible_factory_create_accessible (GObject *obj)
-{
- AtkObject *accessible;
-
- g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
-
- accessible = eel_canvas_accessible_create (obj);
-
- return accessible;
-}
-
-static void
-eel_canvas_accessible_factory_class_init (AtkObjectFactoryClass *klass)
-{
- klass->create_accessible = eel_canvas_accessible_factory_create_accessible;
- klass->get_accessible_type = eel_canvas_accessible_factory_get_accessible_type;
-}
-
-static GType
-eel_canvas_accessible_factory_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo tinfo =
- {
- sizeof (AtkObjectFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eel_canvas_accessible_factory_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (AtkObjectFactory),
- 0, /* n_preallocs */
- NULL
- };
- type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
- "EelCanvasAccessibilityFactory",
- &tinfo, 0);
- }
-
- return type;
-}
-#endif
/* Class initialization function for EelCanvasClass */
static void
@@ -2314,11 +2101,7 @@ eel_canvas_class_init (EelCanvasClass *klass)
gobject_class->set_property = eel_canvas_set_property;
gobject_class->get_property = eel_canvas_get_property;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (klass)->destroy = eel_canvas_destroy;
-#else
widget_class->destroy = eel_canvas_destroy;
-#endif
widget_class->map = eel_canvas_map;
widget_class->unmap = eel_canvas_unmap;
widget_class->realize = eel_canvas_realize;
@@ -2327,11 +2110,7 @@ eel_canvas_class_init (EelCanvasClass *klass)
widget_class->button_press_event = eel_canvas_button;
widget_class->button_release_event = eel_canvas_button;
widget_class->motion_notify_event = eel_canvas_motion;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = eel_canvas_draw;
-#else
- widget_class->expose_event = eel_canvas_expose;
-#endif
widget_class->key_press_event = eel_canvas_key;
widget_class->key_release_event = eel_canvas_key;
widget_class->enter_notify_event = eel_canvas_crossing;
@@ -2348,23 +2127,11 @@ eel_canvas_class_init (EelCanvasClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EelCanvasClass, draw_background),
NULL, NULL,
-#if GTK_CHECK_VERSION (3, 0, 0)
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
CAIRO_GOBJECT_TYPE_CONTEXT);
-#else
- eel_marshal_VOID__INT_INT_INT_INT,
- G_TYPE_NONE, 4,
- G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_class_set_accessible_type (widget_class, eel_canvas_accessible_get_type ());
-#else
- atk_registry_set_factory_type (atk_get_default_registry (),
- EEL_TYPE_CANVAS,
- eel_canvas_accessible_factory_get_type ());
-#endif
}
/* Callback used when the root item of a canvas is destroyed. The user should
@@ -2444,12 +2211,8 @@ shutdown_transients (EelCanvas *canvas)
{
#if GTK_CHECK_VERSION(3, 20, 0)
eel_canvas_item_ungrab (canvas->grabbed_item);
-#elif GTK_CHECK_VERSION(3, 0, 0)
- eel_canvas_item_ungrab (canvas->grabbed_item, GDK_CURRENT_TIME);
#else
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (canvas));
- canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
+ eel_canvas_item_ungrab (canvas->grabbed_item, GDK_CURRENT_TIME);
#endif
}
@@ -2458,11 +2221,7 @@ shutdown_transients (EelCanvas *canvas)
/* Destroy handler for EelCanvas */
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_canvas_destroy (GtkWidget *object)
-#else
-eel_canvas_destroy (GtkObject *object)
-#endif
{
EelCanvas *canvas;
@@ -2487,13 +2246,8 @@ eel_canvas_destroy (GtkObject *object)
shutdown_transients (canvas);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (GTK_WIDGET_CLASS (canvas_parent_class)->destroy)
(* GTK_WIDGET_CLASS (canvas_parent_class)->destroy) (object);
-#else
- if (GTK_OBJECT_CLASS (canvas_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (canvas_parent_class)->destroy) (object);
-#endif
}
/**
@@ -3083,11 +2837,9 @@ eel_canvas_button (GtkWidget *widget, GdkEventButton *event)
canvas = EEL_CANVAS (widget);
-#if GTK_CHECK_VERSION(3, 0, 0)
/* Don't handle extra mouse button events */
if (event->button > 5)
return FALSE;
-#endif
/*
* dispatch normally regardless of the event's window if an item has
@@ -3235,8 +2987,6 @@ eel_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
return FALSE;
}
-
-#if GTK_CHECK_VERSION(3,0,0)
static cairo_region_t *
eel_cairo_get_clip_region (cairo_t *cr)
{
@@ -3276,19 +3026,12 @@ eel_cairo_get_clip_region (cairo_t *cr)
cairo_rectangle_list_destroy (list);
return region;
}
-#endif
/* Expose handler for the canvas */
-#if GTK_CHECK_VERSION(3,0,0)
static gboolean
eel_canvas_draw (GtkWidget *widget, cairo_t *cr)
-#else
-static gint
-eel_canvas_expose (GtkWidget *widget, GdkEventExpose *event)
-#endif
{
EelCanvas *canvas = EEL_CANVAS (widget);
-#if GTK_CHECK_VERSION(3,0,0)
GdkWindow *bin_window;
cairo_region_t *region;
@@ -3309,14 +3052,9 @@ eel_canvas_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_restore (cr);
return FALSE;
}
-#else
- if (!gtk_widget_is_drawable (widget) || (event->window != gtk_layout_get_bin_window (&canvas->layout))) return FALSE;
-#endif
-#if defined VERBOSE && GTK_CHECK_VERSION(3,0,0)
+#if defined VERBOSE
g_print ("Draw\n");
-#elif defined VERBOSE
- g_print ("Expose\n");
#endif
/* If there are any outstanding items that need updating, do them now */
if (canvas->idle_id)
@@ -3342,39 +3080,23 @@ eel_canvas_expose (GtkWidget *widget, GdkEventExpose *event)
anything that is gonna get redrawn as invalid */
g_signal_emit (G_OBJECT (canvas), canvas_signals[DRAW_BACKGROUND], 0,
-#if GTK_CHECK_VERSION(3,0,0)
cr);
-#else
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-#endif
if (canvas->root->flags & EEL_CANVAS_ITEM_MAPPED)
EEL_CANVAS_ITEM_GET_CLASS (canvas->root)->draw (canvas->root,
-#if GTK_CHECK_VERSION(3,0,0)
cr, region);
-#else
- gtk_layout_get_bin_window (&canvas->layout),
- event);
-#endif
/* Chain up to get exposes on child widgets */
-#if GTK_CHECK_VERSION(3,0,0)
cairo_restore (cr);
if (GTK_WIDGET_CLASS (canvas_parent_class)->draw)
GTK_WIDGET_CLASS (canvas_parent_class)->draw (widget, cr);
cairo_region_destroy (region);
-#else
- GTK_WIDGET_CLASS (canvas_parent_class)->expose_event (widget, event);
-#endif
return FALSE;
}
-
-#if GTK_CHECK_VERSION(3,0,0)
static void
eel_canvas_draw_background (EelCanvas *canvas,
cairo_t *cr)
@@ -3395,21 +3117,6 @@ eel_canvas_draw_background (EelCanvas *canvas,
cairo_fill (cr);
cairo_restore (cr);
}
-#else /* GTK_CHECK_VERSION(3,0,0) */
-static void
-eel_canvas_draw_background (EelCanvas *canvas,
- int x, int y, int width, int height)
-{
- cairo_t *cr = gdk_cairo_create (gtk_layout_get_bin_window (&canvas->layout));
-
- /* By default, we use the style background. */
- gdk_cairo_set_source_color (cr, &gtk_widget_get_style (GTK_WIDGET (canvas))->bg[GTK_STATE_NORMAL]);
- cairo_rectangle (cr, x, y, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-}
-#endif /* GTK_CHECK_VERSION(3,0,0) */
static void
do_update (EelCanvas *canvas)
@@ -3456,20 +3163,12 @@ idle_handler (gpointer data)
{
EelCanvas *canvas;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- GDK_THREADS_ENTER ();
-#endif
-
canvas = EEL_CANVAS (data);
do_update (canvas);
/* Reset idle id */
canvas->idle_id = 0;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GDK_THREADS_LEAVE ();
-#endif
-
return FALSE;
}
@@ -3678,18 +3377,11 @@ eel_canvas_set_pixels_per_unit (EelCanvas *canvas, double n)
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
-#if GTK_CHECK_VERSION(3,0,0)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-#else
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-#endif
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_window_set_back_pixmap (window, NULL, FALSE);
-#endif
+
gdk_window_set_user_data (window, widget);
gdk_window_show (window);
@@ -4083,11 +3775,7 @@ eel_canvas_item_accessible_is_item_in_window (EelCanvasItem *item,
int window_width, window_height;
gdk_window_get_geometry (gtk_widget_get_window (widget), NULL, NULL,
-#if GTK_CHECK_VERSION (3, 0, 0)
&window_width, &window_height);
-#else
- &window_width, &window_height, NULL);
-#endif
/*
* Check whether rectangles intersect
*/
@@ -4302,7 +3990,6 @@ eel_canvas_item_accessible_ref_state_set (AtkObject *accessible)
return state_set;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static GType eel_canvas_item_accessible_get_type (void);
typedef struct _EelCanvasItemAccessible EelCanvasItemAccessible;
@@ -4338,61 +4025,7 @@ static void
eel_canvas_item_accessible_init (EelCanvasItemAccessible *accessible)
{
}
-#else
-static void
-eel_canvas_item_accessible_class_init (AtkObjectClass *klass)
-{
- accessible_item_parent_class = g_type_class_peek_parent (klass);
-
- klass->initialize = eel_canvas_item_accessible_initialize;
- klass->ref_state_set = eel_canvas_item_accessible_ref_state_set;
-}
-static GType
-eel_canvas_item_accessible_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GInterfaceInfo atk_component_info =
- {
- (GInterfaceInitFunc) eel_canvas_item_accessible_component_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
- AtkObjectFactory *factory;
- GType parent_atk_type;
- GTypeQuery query;
- GTypeInfo tinfo = { 0 };
-
- factory = atk_registry_get_factory (atk_get_default_registry(),
- G_TYPE_INITIALLY_UNOWNED);
- if (!factory)
- {
- return G_TYPE_INVALID;
- }
- parent_atk_type = atk_object_factory_get_accessible_type (factory);
- if (!parent_atk_type)
- {
- return G_TYPE_INVALID;
- }
- g_type_query (parent_atk_type, &query);
- tinfo.class_init = (GClassInitFunc) eel_canvas_item_accessible_class_init;
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
- type = g_type_register_static (parent_atk_type,
- "EelCanvasItemAccessibility",
- &tinfo, 0);
-
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
- &atk_component_info);
-
- }
-
- return type;
-}
-#endif
static AtkObject *
eel_canvas_item_accessible_create (GObject *for_object)
{
@@ -4439,7 +4072,6 @@ eel_canvas_item_accessible_factory_class_init (AtkObjectFactoryClass *klass)
klass->get_accessible_type = eel_canvas_item_accessible_factory_get_accessible_type;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static GType eel_canvas_item_accessible_factory_get_type (void);
typedef AtkObjectFactory EelCanvasItemAccessibleFactory;
@@ -4452,35 +4084,6 @@ eel_canvas_item_accessible_factory_init (EelCanvasItemAccessibleFactory *accessi
{
}
-#else
-static GType
-eel_canvas_item_accessible_factory_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo tinfo =
- {
- sizeof (AtkObjectFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eel_canvas_item_accessible_factory_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (AtkObjectFactory),
- 0, /* n_preallocs */
- NULL
- };
- type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
- "EelCanvasItemAccessibilityFactory",
- &tinfo, 0);
- }
-
- return type;
-}
-#endif
-
/* Class initialization function for EelCanvasItemClass */
static void
eel_canvas_item_class_init (EelCanvasItemClass *klass)
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index b168aed8..d26d3daf 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -38,9 +38,7 @@
#define EEL_CANVAS_H
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
#include <gtk/gtk-a11y.h>
-#endif
#include <gdk/gdk.h>
#include <stdarg.h>
@@ -162,11 +160,7 @@ extern "C" {
* coordinates of the drawable, a temporary pixmap, where things get
* drawn. (width, height) are the dimensions of the drawable.
*/
-#if GTK_CHECK_VERSION(3,0,0)
void (* draw) (EelCanvasItem *item, cairo_t *cr, cairo_region_t *region);
-#else
- void (* draw) (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose);
-#endif
/* Calculate the distance from an item to the specified point. It also
* returns a canvas item which is the item itself in the case of the
@@ -265,7 +259,6 @@ extern "C" {
* XGrabPointer().
*/
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkGrabStatus eel_canvas_item_grab (EelCanvasItem *item,
GdkEventMask event_mask,
GdkCursor *cursor,
@@ -274,10 +267,6 @@ extern "C" {
#else
guint32 etime);
#endif
-#else
- int eel_canvas_item_grab (EelCanvasItem *item, unsigned int event_mask,
- GdkCursor *cursor, guint32 etime);
-#endif
#if GTK_CHECK_VERSION(3, 20, 0)
/* Ungrabs the seat -- the specified item must be the same that was passed to
@@ -466,11 +455,7 @@ extern "C" {
/* Draw the background for the area given.
*/
void (* draw_background) (EelCanvas *canvas,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr);
-#else
- int x, int y, int width, int height);
-#endif
/* Private Virtual methods for groping the canvas inside matecomponent */
void (* request_update) (EelCanvas *canvas);
@@ -558,7 +543,6 @@ extern "C" {
void eel_canvas_world_to_window (EelCanvas *canvas,
double worldx, double worldy, double *winx, double *winy);
-#if GTK_CHECK_VERSION(3, 0, 0)
GType eel_canvas_accessible_get_type (void);
typedef struct _EelCanvasAccessible EelCanvasAccessible;
@@ -573,7 +557,6 @@ extern "C" {
{
GtkContainerAccessibleClass parent_class;
};
-#endif
#ifdef __cplusplus
}
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index 37564275..ee1e792a 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -35,21 +35,9 @@
#include <glib/gi18n-lib.h>
#include <pango/pango.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
#include <gtk/gtk-a11y.h>
-#endif
#include <gdk/gdkkeysyms.h>
-/* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#define cairo_region_t GdkRegion
-#define cairo_region_destroy gdk_region_destroy
-#define GtkEditableInterface GtkEditableClass
-#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
/* g_memmove is removed in glib 2.40 */
#if GLIB_CHECK_VERSION (2, 39, 0)
@@ -92,36 +80,27 @@ static void eel_editable_label_get_property (GObject
GValue *value,
GParamSpec *pspec);
static void eel_editable_label_finalize (GObject *object);
-#if GTK_CHECK_VERSION(3,0,0)
+
static void eel_editable_label_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void eel_editable_label_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
-#else
-static void eel_editable_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-#endif
+
static void eel_editable_label_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void eel_editable_label_state_changed (GtkWidget *widget,
GtkStateType state);
-#if GTK_CHECK_VERSION(3,0,0)
+
static void eel_editable_label_style_updated (GtkWidget *widget);
-#else
-static void eel_editable_label_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
+
static void eel_editable_label_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir);
-#if GTK_CHECK_VERSION(3,0,0)
+
static gint eel_editable_label_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gint eel_editable_label_expose (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
+
static void eel_editable_label_realize (GtkWidget *widget);
static void eel_editable_label_unrealize (GtkWidget *widget);
static void eel_editable_label_map (GtkWidget *widget);
@@ -140,11 +119,8 @@ static gint eel_editable_label_focus_in (GtkWidget
GdkEventFocus *event);
static gint eel_editable_label_focus_out (GtkWidget *widget,
GdkEventFocus *event);
-#if GTK_CHECK_VERSION(3, 0, 0)
static GType eel_editable_label_accessible_get_type (void);
-#else
-static AtkObject *eel_editable_label_get_accessible (GtkWidget *widget);
-#endif
+
static void eel_editable_label_commit_cb (GtkIMContext *context,
const gchar *str,
EelEditableLabel *label);
@@ -217,11 +193,8 @@ static void editable_real_set_position (GtkEditable *editable,
gint position);
static gint editable_get_position (GtkEditable *editable);
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE_WITH_CODE (EelEditableLabel, eel_editable_label, GTK_TYPE_WIDGET,
-#else
-G_DEFINE_TYPE_WITH_CODE (EelEditableLabel, eel_editable_label, GTK_TYPE_MISC,
-#endif
+
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, eel_editable_label_editable_init));
static void
@@ -258,25 +231,14 @@ eel_editable_label_class_init (EelEditableLabelClass *class)
gobject_class->get_property = eel_editable_label_get_property;
gobject_class->finalize = eel_editable_label_finalize;
-#if GTK_CHECK_VERSION(3,0,0)
+
widget_class->get_preferred_width = eel_editable_label_get_preferred_width;
widget_class->get_preferred_height = eel_editable_label_get_preferred_height;
-#else
- widget_class->size_request = eel_editable_label_size_request;
-#endif
widget_class->size_allocate = eel_editable_label_size_allocate;
widget_class->state_changed = eel_editable_label_state_changed;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->style_updated = eel_editable_label_style_updated;
-#else
- widget_class->style_set = eel_editable_label_style_set;
-#endif
widget_class->direction_changed = eel_editable_label_direction_changed;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->draw = eel_editable_label_draw;
-#else
- widget_class->expose_event = eel_editable_label_expose;
-#endif
widget_class->realize = eel_editable_label_realize;
widget_class->unrealize = eel_editable_label_unrealize;
widget_class->map = eel_editable_label_map;
@@ -289,11 +251,8 @@ eel_editable_label_class_init (EelEditableLabelClass *class)
widget_class->key_release_event = eel_editable_label_key_release;
widget_class->focus_in_event = eel_editable_label_focus_in;
widget_class->focus_out_event = eel_editable_label_focus_out;
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_class_set_accessible_type (widget_class, eel_editable_label_accessible_get_type ());
-#else
- widget_class->get_accessible = eel_editable_label_get_accessible;
-#endif
+
class->move_cursor = eel_editable_label_move_cursor;
class->delete_from_cursor = eel_editable_label_delete_from_cursor;
@@ -663,10 +622,9 @@ eel_editable_label_init (EelEditableLabel *label)
label->n_bytes = 0;
gtk_widget_set_can_focus (GTK_WIDGET (label), TRUE);
-#if GTK_CHECK_VERSION(3,0,0)
+
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (label)),
GTK_STYLE_CLASS_ENTRY);
-#endif
/* This object is completely private. No external entity can gain a reference
* to it; so we create it here and destroy it in finalize().
@@ -964,12 +922,8 @@ static gint
get_label_wrap_width (EelEditableLabel *label)
{
PangoLayout *layout;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (label));
PangoFontDescription *desc;
-#else
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (label));
-#endif
LabelWrapWidth *wrap_width = g_object_get_data (G_OBJECT (style), "gtk-label-wrap-width");
if (!wrap_width)
@@ -979,37 +933,25 @@ get_label_wrap_width (EelEditableLabel *label)
wrap_width, label_wrap_width_free);
}
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_get (style, gtk_widget_get_state_flags (GTK_WIDGET (label)),
GTK_STYLE_PROPERTY_FONT, &desc,
NULL);
if (wrap_width->font_desc && pango_font_description_equal (wrap_width->font_desc, desc))
goto out;
-#else
- if (wrap_width->font_desc && pango_font_description_equal (wrap_width->font_desc, style->font_desc))
- return wrap_width->width;
-#endif
if (wrap_width->font_desc)
pango_font_description_free (wrap_width->font_desc);
-#if GTK_CHECK_VERSION(3,0,0)
wrap_width->font_desc = pango_font_description_copy (desc);
-#else
- wrap_width->font_desc = pango_font_description_copy (style->font_desc);
-#endif
layout = gtk_widget_create_pango_layout (GTK_WIDGET (label),
"This long string gives a good enough length for any line to have.");
pango_layout_get_size (layout, &wrap_width->width, NULL);
g_object_unref (layout);
-#if GTK_CHECK_VERSION(3,0,0)
out:
pango_font_description_free (desc);
-#endif
-
return wrap_width->width;
}
@@ -1177,14 +1119,9 @@ eel_editable_label_size_request (GtkWidget *widget,
gint width, height;
PangoRectangle logical_rect;
gint set_width;
-#if GTK_CHECK_VERSION(3,0,0)
gint xpad, ypad;
-#else
- gfloat xpad, ypad;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gint margin_start, margin_end, margin_top, margin_bottom;
-#endif
+
g_assert (EEL_IS_EDITABLE_LABEL (widget));
g_assert (requisition != NULL);
@@ -1209,7 +1146,6 @@ eel_editable_label_size_request (GtkWidget *widget,
eel_editable_label_ensure_layout (label, TRUE);
-#if GTK_CHECK_VERSION(3,0,0)
margin_start = gtk_widget_get_margin_start (widget);
margin_end = gtk_widget_get_margin_end (widget);
margin_top = gtk_widget_get_margin_top (widget);
@@ -1217,10 +1153,6 @@ eel_editable_label_size_request (GtkWidget *widget,
xpad = margin_start + margin_end;
ypad = margin_top + margin_bottom;
-#else
- gtk_misc_get_alignment (&label->misc,
- &xpad, &ypad);
-#endif
width = xpad * 2;
height = ypad * 2;
@@ -1238,7 +1170,6 @@ eel_editable_label_size_request (GtkWidget *widget,
requisition->height = height;
}
-#if GTK_CHECK_VERSION(3,0,0)
static void
eel_editable_label_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -1262,7 +1193,6 @@ eel_editable_label_get_preferred_height (GtkWidget *widget,
*minimum = *natural = requisition.height;
}
-#endif
static void
eel_editable_label_size_allocate (GtkWidget *widget,
@@ -1288,12 +1218,7 @@ eel_editable_label_state_changed (GtkWidget *widget,
}
static void
-#if GTK_CHECK_VERSION(3,0,0)
eel_editable_label_style_updated (GtkWidget *widget)
-#else
-eel_editable_label_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-#endif
{
EelEditableLabel *label;
@@ -1301,9 +1226,7 @@ eel_editable_label_style_set (GtkWidget *widget,
label = EEL_EDITABLE_LABEL (widget);
-#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS (eel_editable_label_parent_class)->style_updated (widget);
-#endif
/* We have to clear the layout, fonts etc. may have changed */
eel_editable_label_recompute (label);
@@ -1313,17 +1236,10 @@ eel_editable_label_style_set (GtkWidget *widget,
*/
if (gtk_widget_get_realized (widget))
{
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style;
style = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (style, gtk_widget_get_window (widget));
-#else
- GtkStyle *style;
-
- style = gtk_widget_get_style (widget);
- gdk_window_set_background (gtk_widget_get_window (widget), &style->base[gtk_widget_get_state (widget)]);
-#endif
}
}
@@ -1339,7 +1255,6 @@ eel_editable_label_direction_changed (GtkWidget *widget,
GTK_WIDGET_CLASS (eel_editable_label_parent_class)->direction_changed (widget, previous_dir);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gfloat
gtk_align_to_gfloat (GtkAlign align)
{
@@ -1355,14 +1270,12 @@ gtk_align_to_gfloat (GtkAlign align)
return 0.0;
}
}
-#endif
static void
get_layout_location (EelEditableLabel *label,
gint *xp,
gint *yp)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *widget;
gfloat xalign, yalign;
GtkRequisition req;
@@ -1394,33 +1307,6 @@ get_layout_location (EelEditableLabel *label,
y = floor (0.5 + ypad
+ ((allocation.height - req.height) * yalign)
+ 0.5);
-#else
- GtkMisc *misc;
- GtkWidget *widget;
- gfloat xalign, yalign;
- GtkRequisition req;
- gint x, y, xpad, ypad;
- GtkAllocation allocation;
-
- widget = GTK_WIDGET (label);
- misc = GTK_MISC (label);
- gtk_misc_get_alignment (misc, &xalign, &yalign);
-
- if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
- xalign = 1.0 - xalign;
-
- gtk_widget_get_preferred_size (widget, &req, NULL);
- gtk_misc_get_padding (misc, &xpad, &ypad);
-
- gtk_widget_get_allocation (widget, &allocation);
- x = floor (xpad
- + ((allocation.width - req.width) * xalign)
- + 0.5);
-
- y = floor (ypad
- + ((allocation.height - req.height) * yalign)
- + 0.5);
-#endif
if (xp)
*xp = x;
@@ -1429,11 +1315,7 @@ get_layout_location (EelEditableLabel *label,
*yp = y;
}
-#if GTK_CHECK_VERSION(3,0,0)
static gint
-#else
-static void
-#endif
eel_editable_label_get_cursor_pos (EelEditableLabel *label,
PangoRectangle *strong_pos,
PangoRectangle *weak_pos)
@@ -1450,10 +1332,8 @@ eel_editable_label_get_cursor_pos (EelEditableLabel *label,
g_utf8_offset_to_pointer (preedit_text, label->preedit_cursor) - preedit_text;
pango_layout_get_cursor_pos (label->layout, index, strong_pos, weak_pos);
-#if GTK_CHECK_VERSION(3,0,0)
return index;
-#endif
}
/* Copied from gtkutil private function */
@@ -1587,7 +1467,6 @@ eel_editable_label_get_block_cursor_location (EelEditableLabel *label,
/* These functions are copies from gtk+, as they are not exported from gtk+ */
static void
-#if GTK_CHECK_VERSION(3,0,0)
eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoffset, gint yoffset)
{
if (gtk_widget_is_drawable (GTK_WIDGET (label)))
@@ -1658,130 +1537,12 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff
}
cairo_restore (cr);
-#else
-eel_editable_label_draw_cursor (EelEditableLabel *label, gint xoffset, gint yoffset)
-{
- if (gtk_widget_is_drawable (GTK_WIDGET (label)))
- {
- GtkWidget *widget = GTK_WIDGET (label);
-
- GtkTextDirection keymap_direction;
- GtkTextDirection widget_direction;
- gboolean split_cursor;
- gboolean block;
- gboolean block_at_line_end;
- gint range[2];
- PangoRectangle strong_pos, weak_pos;
- PangoRectangle *cursor1 = NULL;
- PangoRectangle *cursor2 = NULL;
- GdkRectangle cursor_location;
- GtkTextDirection dir1 = GTK_TEXT_DIR_NONE;
- GtkTextDirection dir2 = GTK_TEXT_DIR_NONE;
-
- keymap_direction =
- (gdk_keymap_get_direction (gdk_keymap_get_default ()) == PANGO_DIRECTION_LTR) ?
- GTK_TEXT_DIR_LTR : GTK_TEXT_DIR_RTL;
-
- widget_direction = gtk_widget_get_direction (widget);
-
- if (label->overwrite_mode &&
- eel_editable_label_get_block_cursor_location (label, range,
- &strong_pos,
- &block_at_line_end))
- block = TRUE;
- else
- block = FALSE;
-
- if (!block)
- {
- eel_editable_label_get_cursor_pos (label, &strong_pos, &weak_pos);
-
- g_object_get (gtk_widget_get_settings (widget),
- "gtk-split-cursor", &split_cursor,
- NULL);
-
- dir1 = widget_direction;
-
- if (split_cursor)
- {
- cursor1 = &strong_pos;
-
- if (strong_pos.x != weak_pos.x ||
- strong_pos.y != weak_pos.y)
- {
- dir2 = (widget_direction == GTK_TEXT_DIR_LTR) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR;
- cursor2 = &weak_pos;
- }
- }
- else
- {
- if (keymap_direction == widget_direction)
- cursor1 = &strong_pos;
- else
- cursor1 = &weak_pos;
- }
-
- cursor_location.x = xoffset + PANGO_PIXELS (cursor1->x);
- cursor_location.y = yoffset + PANGO_PIXELS (cursor1->y);
- cursor_location.width = 0;
- cursor_location.height = PANGO_PIXELS (cursor1->height);
-
- gtk_draw_insertion_cursor (widget,
- gtk_widget_get_window (widget),
- NULL, &cursor_location,
- TRUE, dir1, dir2 != GTK_TEXT_DIR_NONE);
-
- if (dir2 != GTK_TEXT_DIR_NONE)
- {
- cursor_location.x = xoffset + PANGO_PIXELS (cursor2->x);
- cursor_location.y = yoffset + PANGO_PIXELS (cursor2->y);
- cursor_location.width = 0;
- cursor_location.height = PANGO_PIXELS (cursor2->height);
-
- gtk_draw_insertion_cursor (widget,
- gtk_widget_get_window (widget),
- NULL, &cursor_location,
- FALSE, dir2, TRUE);
- }
- }
- else /* Block cursor */
- {
- cairo_region_t *clip;
-
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr,
- xoffset + PANGO_PIXELS (strong_pos.x),
- yoffset + PANGO_PIXELS (strong_pos.y),
- PANGO_PIXELS (strong_pos.width),
- PANGO_PIXELS (strong_pos.height));
-
- if (!block_at_line_end)
- {
- clip = gdk_pango_layout_get_clip_region (label->layout,
- xoffset, yoffset,
- range, 1);
-
- gdk_cairo_region (cr, clip);
- cairo_clip (cr);
- gdk_cairo_set_source_color (cr,
- &gtk_widget_get_style (widget)->base[GTK_STATE_NORMAL]);
- cairo_move_to (cr, xoffset, yoffset);
- pango_cairo_show_layout (cr, label->layout);
-
- cairo_region_destroy (clip);
- }
-
- cairo_destroy (cr);
-#endif
}
}
}
static gint
-#if GTK_CHECK_VERSION(3,0,0)
eel_editable_label_draw (GtkWidget *widget,
cairo_t *cr)
{
@@ -1881,104 +1642,6 @@ eel_editable_label_draw (GtkWidget *widget,
gtk_widget_get_allocated_height (widget));
gtk_style_context_restore (style);
-#else
-eel_editable_label_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EelEditableLabel *label;
- GtkStyle *style;
- g_assert (event != NULL);
- gint x, y;
-
- g_assert (EEL_IS_EDITABLE_LABEL (widget));
-
- label = EEL_EDITABLE_LABEL (widget);
- style = gtk_widget_get_style (widget);
-
- eel_editable_label_ensure_layout (label, TRUE);
-
- if (gtk_widget_get_visible (widget) && gtk_widget_get_mapped (widget) &&
- label->text)
- {
- get_layout_location (label, &x, &y);
-
- gtk_paint_layout (style,
- gtk_widget_get_window (widget),
- gtk_widget_get_state (widget),
- TRUE,
- &event->area,
- widget,
- "label",
- x, y,
- label->layout);
-
- if (label->selection_anchor != label->selection_end)
- {
- gint range[2];
- const char *text;
- cairo_region_t *clip;
- GtkStateType state;
-
- range[0] = label->selection_anchor;
- range[1] = label->selection_end;
-
- /* Handle possible preedit string */
- if (label->preedit_length > 0 &&
- range[1] > label->selection_anchor)
- {
- text = pango_layout_get_text (label->layout) + label->selection_anchor;
- range[1] += g_utf8_offset_to_pointer (text, label->preedit_length) - text;
- }
-
- if (range[0] > range[1])
- {
- gint tmp = range[0];
- range[0] = range[1];
- range[1] = tmp;
- }
-
- clip = gdk_pango_layout_get_clip_region (label->layout,
- x, y,
- range,
- 1);
-
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
- gdk_cairo_region (cr, clip);
- cairo_clip (cr);
-
- state = GTK_STATE_SELECTED;
- if (!gtk_widget_has_focus (widget))
- state = GTK_STATE_ACTIVE;
-
- gdk_cairo_set_source_color (cr, &style->base[state]);
- cairo_paint (cr);
-
- gdk_cairo_set_source_color (cr, &style->text[state]);
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, label->layout);
-
- cairo_destroy (cr);
-
- cairo_region_destroy (clip);
- }
- else if (gtk_widget_has_focus (widget))
- eel_editable_label_draw_cursor (label, x, y);
-
- if (label->draw_outline)
- {
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
- gdk_cairo_set_source_color (cr, &style->text [gtk_widget_get_state (widget)]);
- cairo_set_line_width (cr, 1.0);
- cairo_rectangle (cr, 0.5, 0.5,
- allocation.width - 1,
- allocation.height - 1);
- cairo_stroke (cr);
-
- cairo_destroy (cr);
-#endif
}
}
@@ -1994,11 +1657,7 @@ eel_editable_label_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
GdkWindow *window;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style;
-#else
- GtkStyle *style;
-#endif
gtk_widget_set_realized (widget, TRUE);
label = EEL_EDITABLE_LABEL (widget);
@@ -2011,9 +1670,6 @@ eel_editable_label_realize (GtkWidget *widget)
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.visual = gtk_widget_get_visual (widget);
-#if !GTK_CHECK_VERSION(3,0,0)
- attributes.colormap = gtk_widget_get_colormap (widget);
-#endif
display = gtk_widget_get_display (GTK_WIDGET (label));
attributes.cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
attributes.event_mask = gtk_widget_get_events (widget) |
@@ -2027,30 +1683,17 @@ eel_editable_label_realize (GtkWidget *widget)
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
-#if GTK_CHECK_VERSION(3,0,0)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_CURSOR;
-#else
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR;
-#endif
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref (attributes.cursor);
style = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (style, gtk_widget_get_window (widget));
-#else
- gdk_cursor_unref (attributes.cursor);
-
- style = gtk_style_attach (gtk_widget_get_style (widget) , gtk_widget_get_window (widget));
- gtk_widget_set_style (widget, style);
-
- gdk_window_set_background (gtk_widget_get_window (widget), &style->base[gtk_widget_get_state (widget)]);
-#endif
gtk_im_context_set_client_window (label->im_context, gtk_widget_get_window (widget));
}
@@ -2274,14 +1917,9 @@ eel_editable_label_motion (GtkWidget *widget,
if ((event->state & GDK_BUTTON1_MASK) == 0)
return FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_device_position (gtk_widget_get_window (widget),
event->device,
&x, &y, NULL);
-#else
- gdk_window_get_pointer (gtk_widget_get_window (widget),
- &x, &y, NULL);
-#endif
get_layout_index (label, x, y, &index);
@@ -3417,12 +3055,7 @@ popup_position_func (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size (widget, &req, NULL);
-#else
- /*gtk_widget_size_request (label->popup_menu, &req);*/
- gtk_widget_get_requisition (widget, &req);
-#endif
gtk_widget_get_allocation (widget, &allocation);
*x += allocation.width / 2;
@@ -3776,7 +3409,6 @@ typedef struct
gint position;
} EelEditableLabelAccessiblePaste;
-#if GTK_CHECK_VERSION(3, 0, 0)
typedef struct _EelEditableLabelAccessible EelEditableLabelAccessible;
typedef struct _EelEditableLabelAccessibleClass EelEditableLabelAccessibleClass;
@@ -3789,7 +3421,6 @@ struct _EelEditableLabelAccessibleClass
{
GtkWidgetAccessibleClass parent_class;
};
-#endif
static gchar*
eel_editable_label_accessible_get_text (AtkText *text,
@@ -4644,7 +4275,6 @@ eel_editable_label_accessible_finalize (GObject *object)
G_OBJECT_CLASS (a11y_parent_class)->finalize (object);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static void
eel_editable_label_accessible_class_init (EelEditableLabelAccessibleClass *klass)
{
@@ -4671,57 +4301,4 @@ G_DEFINE_TYPE_WITH_CODE (EelEditableLabelAccessible,
atk_editable_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
atk_text_interface_init));
-#else
-static void
-eel_editable_label_accessible_class_init (AtkObjectClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- a11y_parent_class = g_type_class_peek_parent (klass);
-
- klass->initialize = eel_editable_label_accessible_initialize;
- klass->get_name = eel_editable_label_accessible_get_name;
- klass->ref_state_set = eel_editable_label_accessible_ref_state_set;
- gobject_class->finalize = eel_editable_label_accessible_finalize;
-}
-
-static AtkObject *
-eel_editable_label_get_accessible (GtkWidget *widget)
-{
- static GType type = 0;
- AtkObject *accessible;
- if ((accessible = eel_accessibility_get_atk_object (widget)))
- return accessible;
-
- if (!type)
- {
- const GInterfaceInfo atk_editable_text_info =
- {
- (GInterfaceInitFunc) atk_editable_text_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
- const GInterfaceInfo atk_text_info =
- {
- (GInterfaceInitFunc) atk_text_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- type = eel_accessibility_create_derived_type ("EelEditableLabelAccessible",
- G_TYPE_FROM_INSTANCE (widget),
- eel_editable_label_accessible_class_init);
-
- if (!type)
- return NULL;
-
- g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
- g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
- }
-
- accessible = g_object_new (type, NULL);
-
- return eel_accessibility_set_atk_object_return (widget, accessible);
-}
-#endif
diff --git a/eel/eel-editable-label.h b/eel/eel-editable-label.h
index 9be7f8c9..9350b060 100644
--- a/eel/eel-editable-label.h
+++ b/eel/eel-editable-label.h
@@ -53,11 +53,7 @@ extern "C" {
struct _EelEditableLabel
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget widget;
-#else
- GtkMisc misc;
-#endif
/*< private >*/
guint jtype : 2;
@@ -88,11 +84,8 @@ extern "C" {
struct _EelEditableLabelClass
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidgetClass parent_class;
-#else
- GtkMiscClass parent_class;
-#endif
+
void (* move_cursor) (EelEditableLabel *label,
GtkMovementStep step,
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 448e933a..8e86ddef 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -312,7 +312,6 @@ eel_gradient_set_bottom_color_spec (const char *gradient_spec,
return eel_gradient_set_edge_color (gradient_spec, bottom_color, FALSE, TRUE);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* eel_gdk_rgba_parse_with_white_default
* @color: Pointer to place to put resulting color.
@@ -345,40 +344,6 @@ eel_gdk_rgba_parse_with_white_default (GdkRGBA *color,
color->blue = 1.0;
}
}
-#else
-/**
- * eel_gdk_color_parse_with_white_default
- * @color_spec: A color spec, or NULL.
- * @color: Pointer to place to put resulting color.
- *
- * The same as gdk_color_parse, except sets the color to white if
- * the spec. can't be parsed, instead of returning a boolean flag.
- */
-void
-eel_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *color)
-{
- gboolean got_color;
-
- g_return_if_fail (color != NULL);
-
- got_color = FALSE;
- if (color_spec != NULL)
- {
- if (gdk_color_parse (color_spec, color))
- {
- got_color = TRUE;
- }
- }
-
- if (!got_color)
- {
- color->red = 0xFFFF;
- color->green = 0xFFFF;
- color->blue = 0xFFFF;
- }
-}
-#endif
guint32
eel_rgb16_to_rgb (gushort r, gushort g, gushort b)
@@ -392,7 +357,6 @@ eel_rgb16_to_rgb (gushort r, gushort g, gushort b)
return result;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* eel_gdk_rgba_to_rgb
* @color: A GdkRGBA style color.
@@ -430,43 +394,7 @@ eel_gdk_rgb_to_rgba (guint32 color)
return result;
}
-#else
-/**
- * eel_gdk_color_to_rgb
- * @color: A GdkColor style color.
- * Returns: An rgb value.
- *
- * Converts from a GdkColor style color to a gdk_rgb one.
- * Alpha gets set to fully opaque
- */
-guint32
-eel_gdk_color_to_rgb (const GdkColor *color)
-{
- return eel_rgb16_to_rgb (color->red, color->green, color->blue);
-}
-
-/**
- * eel_gdk_rgb_to_color
- * @color: a gdk_rgb style value.
- *
- * Converts from a gdk_rgb value style to a GdkColor one.
- * The gdk_rgb color alpha channel is ignored.
- *
- * Return value: A GdkColor structure version of the given RGB color.
- */
-GdkColor
-eel_gdk_rgb_to_color (guint32 color)
-{
- GdkColor result;
- result.red = ((color >> 16) & 0xFF) * 0x101;
- result.green = ((color >> 8) & 0xFF) * 0x101;
- result.blue = (color & 0xff) * 0x101;
- result.pixel = 0;
-
- return result;
-}
-#endif
/**
* eel_gdk_rgb_to_color_spec
@@ -483,7 +411,7 @@ eel_gdk_rgb_to_color_spec (const guint32 color)
return g_strdup_printf ("#%06X", (guint) (color & 0xFFFFFF));
}
-#if GTK_CHECK_VERSION(3,0,0)
+
/**
* eel_gdk_rgba_is_dark:
*
@@ -497,21 +425,6 @@ eel_gdk_rgba_is_dark (const GdkRGBA *color)
intensity = ((((int) (color->red) >> 8) * 77)
+ (((int) (color->green) >> 8) * 150)
+ (((int) (color->blue) >> 8) * 28)) >> 8;
-#else
-/**
- * eel_gdk_color_is_dark:
- *
- * Return true if the given color is `dark'
- */
-gboolean
-eel_gdk_color_is_dark (GdkColor *color)
-{
- int intensity;
-
- intensity = (((color->red >> 8) * 77)
- + ((color->green >> 8) * 150)
- + ((color->blue >> 8) * 28)) >> 8;
-#endif
return intensity < 128;
}
@@ -561,7 +474,6 @@ eel_gdk_parse_geometry (const char *string, int *x_return, int *y_return,
return gdk_flags;
}
-#if GTK_CHECK_VERSION(3,0,0)
void
eel_cairo_draw_layout_with_drop_shadow (cairo_t *cr,
GdkRGBA *text_color,
@@ -582,33 +494,9 @@ eel_cairo_draw_layout_with_drop_shadow (cairo_t *cr,
cairo_restore (cr);
}
-#else
-void
-eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
- GdkColor *text_color,
- GdkColor *shadow_color,
- int x,
- int y,
- PangoLayout *layout)
-{
- cairo_t *cr;
- cr = gdk_cairo_create (drawable);
-
- gdk_cairo_set_source_color (cr, shadow_color);
- cairo_move_to (cr, x+1, y+1);
- pango_cairo_show_layout (cr, layout);
-
- gdk_cairo_set_source_color (cr, text_color);
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, layout);
-
- cairo_destroy (cr);
-}
-#endif
#if ! defined (EEL_OMIT_SELF_CHECK)
-#if GTK_CHECK_VERSION(3,0,0)
static char *
eel_gdk_rgba_as_hex_string (GdkRGBA color)
{
@@ -636,33 +524,6 @@ eel_self_check_gdk_rgb_to_color (guint32 color)
return eel_gdk_rgba_as_hex_string (result);
}
-#else
-static char *
-eel_gdk_color_as_hex_string (GdkColor color)
-{
- return g_strdup_printf ("%04X%04X%04X",
- color.red, color.green, color.blue);
-}
-
-static char *
-eel_self_check_parse (const char *color_spec)
-{
- GdkColor color;
-
- eel_gdk_color_parse_with_white_default (color_spec, &color);
- return eel_gdk_color_as_hex_string (color);
-}
-
-static char *
-eel_self_check_gdk_rgb_to_color (guint32 color)
-{
- GdkColor result;
-
- result = eel_gdk_rgb_to_color (color);
-
- return eel_gdk_color_as_hex_string (result);
-}
-#endif
void
eel_self_check_gdk_extensions (void)
@@ -747,7 +608,7 @@ eel_self_check_gdk_extensions (void)
EEL_CHECK_STRING_RESULT (eel_gradient_set_bottom_color_spec ("a-c:v", "c"), "a-c");
EEL_CHECK_STRING_RESULT (eel_gradient_set_bottom_color_spec ("a:-b:h", "d"), "a:-d");
- /* eel_gdk_color_parse_with_white_default */
+ /* eel_gdk_rgba_parse_with_white_default */
EEL_CHECK_STRING_RESULT (eel_self_check_parse (""), "FFFFFFFFFFFF");
EEL_CHECK_STRING_RESULT (eel_self_check_parse ("a"), "FFFFFFFFFFFF");
EEL_CHECK_STRING_RESULT (eel_self_check_parse ("white"), "FFFFFFFFFFFF");
diff --git a/eel/eel-gdk-extensions.h b/eel/eel-gdk-extensions.h
index 0e8af740..b849af6b 100644
--- a/eel/eel-gdk-extensions.h
+++ b/eel/eel-gdk-extensions.h
@@ -102,30 +102,19 @@ char * eel_gradient_set_bottom_color_spec (const char
/* A version of parse_color that substitutes a default color instead of returning
a boolean to indicate it cannot be parsed.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
void eel_gdk_rgba_parse_with_white_default (GdkRGBA *parsed_color,
const char *color_spec);
-#else
-void eel_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *parsed_color);
-#endif
+
guint32 eel_rgb16_to_rgb (gushort r,
gushort g,
gushort b);
-#if GTK_CHECK_VERSION (3, 0, 0)
guint32 eel_gdk_rgba_to_rgb (const GdkRGBA *color);
GdkRGBA eel_gdk_rgb_to_rgba (guint32 color);
-#else
-guint32 eel_gdk_color_to_rgb (const GdkColor *color);
-GdkColor eel_gdk_rgb_to_color (guint32 color);
-#endif
+
char * eel_gdk_rgb_to_color_spec (guint32 color);
-#if GTK_CHECK_VERSION(3,0,0)
gboolean eel_gdk_rgba_is_dark (const GdkRGBA *color);
-#else
-gboolean eel_gdk_color_is_dark (GdkColor *color);
-#endif
+
/* Wrapper for XParseGeometry */
EelGdkGeometryFlags eel_gdk_parse_geometry (const char *string,
@@ -133,15 +122,11 @@ EelGdkGeometryFlags eel_gdk_parse_geometry (const char
int *y_return,
guint *width_return,
guint *height_return);
-#if GTK_CHECK_VERSION(3,0,0)
+
void eel_cairo_draw_layout_with_drop_shadow (cairo_t *cr,
GdkRGBA *text_color,
GdkRGBA *shadow_color,
-#else
-void eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
- GdkColor *text_color,
- GdkColor *shadow_color,
-#endif
+
int x,
int y,
PangoLayout *layout);
diff --git a/eel/eel-gdk-pixbuf-extensions.c b/eel/eel-gdk-pixbuf-extensions.c
index bbbffc3a..f86ad086 100644
--- a/eel/eel-gdk-pixbuf-extensions.c
+++ b/eel/eel-gdk-pixbuf-extensions.c
@@ -622,11 +622,7 @@ eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf *pixbuf_or_null)
void
eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
int source_x,
int source_y,
EelIRect destination_area)
@@ -638,16 +634,10 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
int target_height;
int source_width;
int source_height;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr;
-#endif
g_return_if_fail (eel_gdk_pixbuf_is_valid (pixbuf));
-#if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (cr != NULL);
-#else
- g_return_if_fail (drawable != NULL);
-#endif
+
g_return_if_fail (!eel_irect_is_empty (&destination_area));
dimensions = eel_gdk_pixbuf_get_dimensions (pixbuf);
@@ -683,9 +673,6 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
target.x1 = target.x0 + MIN (target_width, source_width);
target.y1 = target.y0 + MIN (target_height, source_height);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cr = gdk_cairo_create (drawable);
-#endif
gdk_cairo_set_source_pixbuf (cr, (GdkPixbuf *) pixbuf,
source.x0 - target.x0, source.y0 - target.y0);
cairo_rectangle (cr, target.x0, target.y0,
@@ -1265,11 +1252,8 @@ eel_gdk_pixbuf_render (GdkPixbuf *pixbuf,
guint saturation,
guint brightness,
guint lighten_value,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *color)
-#else
- guint color)
-#endif
+
{
GdkPixbuf *temp_pixbuf, *old_pixbuf;
@@ -1281,27 +1265,14 @@ eel_gdk_pixbuf_render (GdkPixbuf *pixbuf,
else if (render_mode == 2)
{
/* colorize icon */
-#if GTK_CHECK_VERSION(3,0,0)
temp_pixbuf = eel_create_colorized_pixbuf (pixbuf, color);
-#else
- temp_pixbuf = eel_create_colorized_pixbuf (pixbuf,
- EEL_RGBA_COLOR_GET_R (color),
- EEL_RGBA_COLOR_GET_G (color),
- EEL_RGBA_COLOR_GET_B (color));
-#endif
}
else if (render_mode == 3)
{
/* monochromely colorize icon */
old_pixbuf = eel_create_darkened_pixbuf (pixbuf, 0, 255);
-#if GTK_CHECK_VERSION(3,0,0)
temp_pixbuf = eel_create_colorized_pixbuf (old_pixbuf, color);
-#else
- temp_pixbuf = eel_create_colorized_pixbuf (old_pixbuf,
- EEL_RGBA_COLOR_GET_R (color),
- EEL_RGBA_COLOR_GET_G (color),
- EEL_RGBA_COLOR_GET_B (color));
-#endif
+
g_object_unref (old_pixbuf);
}
else
diff --git a/eel/eel-gdk-pixbuf-extensions.h b/eel/eel-gdk-pixbuf-extensions.h
index 87f79a7a..c82b6214 100644
--- a/eel/eel-gdk-pixbuf-extensions.h
+++ b/eel/eel-gdk-pixbuf-extensions.h
@@ -93,11 +93,7 @@ void eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf
/* Copy a pixbuf to an area of a GdkDrawable */
void eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
int source_x,
int source_y,
EelIRect destination_area);
@@ -151,10 +147,7 @@ GdkPixbuf * eel_gdk_pixbuf_render (GdkPixbuf *pixbuf
guint saturation,
guint brightness,
guint lighten_value,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *color);
-#else
- guint color);
-#endif
+
#endif /* EEL_GDK_PIXBUF_EXTENSIONS_H */
diff --git a/eel/eel-graphic-effects.c b/eel/eel-graphic-effects.c
index 39309de9..f25cbb6f 100644
--- a/eel/eel-graphic-effects.c
+++ b/eel/eel-graphic-effects.c
@@ -172,13 +172,7 @@ eel_create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
GdkPixbuf *
eel_create_colorized_pixbuf (GdkPixbuf *src,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *color)
-#else
- int red_value,
- int green_value,
- int blue_value)
-#endif
{
int i, j;
int width, height, has_alpha, src_row_stride, dst_row_stride;
@@ -188,9 +182,7 @@ eel_create_colorized_pixbuf (GdkPixbuf *src,
guchar *pixdest;
GdkPixbuf *dest;
-#if GTK_CHECK_VERSION(3,0,0)
gint red_value, green_value, blue_value;
-#endif
g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
@@ -199,11 +191,9 @@ eel_create_colorized_pixbuf (GdkPixbuf *src,
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
-#if GTK_CHECK_VERSION(3,0,0)
red_value = eel_round (color->red * 255);
green_value = eel_round (color->green * 255);
blue_value = eel_round (color->blue * 255);
-#endif
dest = create_new_pixbuf (src);
diff --git a/eel/eel-graphic-effects.h b/eel/eel-graphic-effects.h
index 7291629b..3a9027fe 100644
--- a/eel/eel-graphic-effects.h
+++ b/eel/eel-graphic-effects.h
@@ -27,9 +27,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3,0,0)
#include <gdk/gdk.h>
-#endif
/* return a lightened pixbuf for pre-lighting */
@@ -42,13 +40,7 @@ GdkPixbuf *eel_create_darkened_pixbuf (GdkPixbuf *source_pixbuf,
/* return a pixbuf colorized with the color specified by the parameters */
GdkPixbuf* eel_create_colorized_pixbuf (GdkPixbuf *source_pixbuf,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *color);
-#else
- int red_value,
- int green_value,
- int blue_value);
-#endif
/* stretch a image frame */
GdkPixbuf *eel_stretch_frame_image (GdkPixbuf *frame_image,
diff --git a/eel/eel-gtk-container.c b/eel/eel-gtk-container.c
index 9a1df176..0244ecc1 100644
--- a/eel/eel-gtk-container.c
+++ b/eel/eel-gtk-container.c
@@ -43,11 +43,7 @@
void
eel_gtk_container_child_expose_event (GtkContainer *container,
GtkWidget *child,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr)
-#else
- GdkEventExpose *event)
-#endif
{
g_return_if_fail (GTK_IS_CONTAINER (container));
@@ -58,11 +54,7 @@ eel_gtk_container_child_expose_event (GtkContainer *container,
g_return_if_fail (GTK_IS_WIDGET (child));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_propagate_draw (container, child, cr);
-#else
- gtk_container_propagate_expose (container, child, event);
-#endif
}
/**
diff --git a/eel/eel-gtk-container.h b/eel/eel-gtk-container.h
index c11ca3e2..ab65873b 100644
--- a/eel/eel-gtk-container.h
+++ b/eel/eel-gtk-container.h
@@ -31,11 +31,8 @@
void eel_gtk_container_child_expose_event (GtkContainer *container,
GtkWidget *child,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr);
-#else
- GdkEventExpose *event);
-#endif
+
void eel_gtk_container_child_map (GtkContainer *container,
GtkWidget *child);
void eel_gtk_container_child_unmap (GtkContainer *container,
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 4969d7aa..800fe6cd 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -353,40 +353,6 @@ eel_gtk_menu_tool_button_get_button (GtkMenuToolButton *tool_button)
return button;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-/* The standard gtk_adjustment_set_value ignores page size, which
- * disagrees with the logic used by scroll bars, for example.
- */
-void
-eel_gtk_adjustment_set_value (GtkAdjustment *adjustment,
- float value)
-{
- float upper_page_start, clamped_value;
-
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
- upper_page_start = MAX (gtk_adjustment_get_upper (adjustment) -
- gtk_adjustment_get_page_size (adjustment),
- gtk_adjustment_get_lower (adjustment));
- clamped_value = CLAMP (value, gtk_adjustment_get_lower (adjustment), upper_page_start);
- if (clamped_value != gtk_adjustment_get_value (adjustment))
- {
- gtk_adjustment_set_value (adjustment, clamped_value);
- gtk_adjustment_value_changed (adjustment);
- }
-}
-
-/* Clamp a value if the minimum or maximum has changed. */
-void
-eel_gtk_adjustment_clamp_value (GtkAdjustment *adjustment)
-{
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
- eel_gtk_adjustment_set_value (adjustment,
- gtk_adjustment_get_value (adjustment));
-}
-#endif
-
/**
* eel_gtk_label_make_bold.
*
@@ -408,11 +374,7 @@ eel_gtk_label_make_bold (GtkLabel *label)
* theme or user prefs, since the font desc only has the
* weight flag turned on.
*/
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_override_font (GTK_WIDGET (label), font_desc);
-#else
- gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
-#endif
pango_font_description_free (font_desc);
}
diff --git a/eel/eel-gtk-extensions.h b/eel/eel-gtk-extensions.h
index fd85c2db..aec680f3 100644
--- a/eel/eel-gtk-extensions.h
+++ b/eel/eel-gtk-extensions.h
@@ -63,12 +63,7 @@ GtkWidget * eel_gtk_menu_tool_button_get_button (GtkMenuTo
/* GtkLabel */
void eel_gtk_label_make_bold (GtkLabel *label);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-/* GtkAdjustment */
-void eel_gtk_adjustment_set_value (GtkAdjustment *adjustment,
- float value);
-void eel_gtk_adjustment_clamp_value (GtkAdjustment *adjustment);
-#endif
+
/* GtkTreeView */
void eel_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view,
gboolean should_activate);
diff --git a/eel/eel-image-table.c b/eel/eel-image-table.c
index be0a7d54..31cec4dd 100644
--- a/eel/eel-image-table.c
+++ b/eel/eel-image-table.c
@@ -62,11 +62,8 @@ static guint image_table_signals[LAST_SIGNAL] = { 0 };
/* Ancestor methods */
GtkWidget * find_windowed_ancestor (GtkWidget *widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
static void signal_connect_while_realized (GtkWidget *object,
-#else
-static void signal_connect_while_realized (GtkObject *object,
-#endif
const char *name,
GCallback callback,
gpointer callback_data,
@@ -132,9 +129,6 @@ eel_image_table_realize (GtkWidget *widget)
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#define windowed_ancestor GTK_OBJECT(windowed_ancestor)
-#endif
signal_connect_while_realized (windowed_ancestor,
"enter_notify_event",
@@ -431,11 +425,7 @@ while_realized_disconnecter (GObject *object,
* or &widget are destroyed.
**/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
signal_connect_while_realized (GtkWidget *object,
-#else
-signal_connect_while_realized (GtkObject *object,
-#endif
const char *name,
GCallback callback,
gpointer callback_data,
@@ -443,11 +433,7 @@ signal_connect_while_realized (GtkObject *object,
{
RealizeDisconnectInfo *info;
-#if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (GTK_IS_WIDGET (object));
-#else
- g_return_if_fail (GTK_IS_OBJECT (object));
-#endif
g_return_if_fail (name != NULL);
g_return_if_fail (name[0] != '\0');
g_return_if_fail (callback != NULL);
diff --git a/eel/eel-labeled-image.c b/eel/eel-labeled-image.c
index e357db60..d58d808e 100644
--- a/eel/eel-labeled-image.c
+++ b/eel/eel-labeled-image.c
@@ -31,9 +31,7 @@
#include "eel-gtk-extensions.h"
#include "eel-accessibility.h"
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
#include <gtk/gtk-a11y.h>
-#endif
#include <gdk/gdkkeysyms.h>
#include <atk/atkimage.h>
@@ -43,10 +41,6 @@
#define DEFAULT_X_ALIGNMENT 0.5
#define DEFAULT_Y_ALIGNMENT 0.5
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
/* Signals */
enum
{
@@ -95,11 +89,7 @@ static GType eel_labeled_image_radio_button_get_type (void);
static GType eel_labeled_image_toggle_button_get_type (void);
/* GtkWidgetClass methods */
-#if GTK_CHECK_VERSION(3, 0, 0)
static GType eel_labeled_image_accessible_get_type (void);
-#else
-static AtkObject *eel_labeled_image_get_accessible (GtkWidget *widget);
-#endif
/* Private EelLabeledImage methods */
static EelDimensions labeled_image_get_image_dimensions (const EelLabeledImage *labeled_image);
@@ -138,11 +128,7 @@ eel_labeled_image_init (EelLabeledImage *labeled_image)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_labeled_image_destroy (GtkWidget *object)
-#else
-eel_labeled_image_destroy (GtkObject *object)
-#endif
{
EelLabeledImage *labeled_image;
@@ -158,11 +144,7 @@ eel_labeled_image_destroy (GtkObject *object)
gtk_widget_destroy (labeled_image->details->label);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (eel_labeled_image_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (eel_labeled_image_parent_class)->destroy (object);
-#endif
}
/* GObjectClass methods */
@@ -330,7 +312,6 @@ eel_labeled_image_size_request (GtkWidget *widget,
2 * labeled_image->details->y_padding;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
eel_labeled_image_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
@@ -350,7 +331,6 @@ eel_labeled_image_get_preferred_height (GtkWidget *widget,
eel_labeled_image_size_request (widget, &req);
*minimum_height = *natural_height = req.height;
}
-#endif
static void
eel_labeled_image_size_allocate (GtkWidget *widget,
@@ -379,7 +359,6 @@ eel_labeled_image_size_allocate (GtkWidget *widget,
}
static int
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_labeled_image_draw (GtkWidget *widget,
cairo_t *cr)
{
@@ -445,71 +424,6 @@ eel_labeled_image_draw (GtkWidget *widget,
return FALSE;
}
-#else
-eel_labeled_image_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EelLabeledImage *labeled_image;
- EelIRect label_bounds;
- GtkStyle *style;
- GdkWindow *window;
-
- g_assert (EEL_IS_LABELED_IMAGE (widget));
- g_assert (gtk_widget_get_realized (widget));
- g_assert (event != NULL);
-
- labeled_image = EEL_LABELED_IMAGE (widget);
-
- style = gtk_widget_get_style (widget);
- window = gtk_widget_get_window (widget);
- if (gtk_widget_get_state (widget) == GTK_STATE_SELECTED ||
- gtk_widget_get_state (widget) == GTK_STATE_ACTIVE)
- {
- label_bounds = eel_labeled_image_get_label_bounds (EEL_LABELED_IMAGE (widget));
-
- gtk_paint_flat_box (style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_NONE,
- &event->area,
- widget,
- "eel-labeled-image",
- label_bounds.x0, label_bounds.y0,
- label_bounds.x1 - label_bounds.x0,
- label_bounds.y1 - label_bounds.y0);
- }
-
- if (labeled_image_show_label (labeled_image))
- {
- eel_gtk_container_child_expose_event (GTK_CONTAINER (widget),
- labeled_image->details->label,
- event);
- }
-
- if (labeled_image_show_image (labeled_image))
- {
- eel_gtk_container_child_expose_event (GTK_CONTAINER (widget),
- labeled_image->details->image,
- event);
- }
-
- if (gtk_widget_has_focus (widget))
- {
- label_bounds = eel_labeled_image_get_image_bounds (EEL_LABELED_IMAGE (widget));
- gtk_paint_focus (style,
- window,
- GTK_STATE_NORMAL,
- &event->area,
- widget,
- "eel-focusable-labeled-image",
- label_bounds.x0, label_bounds.y0,
- label_bounds.x1 - label_bounds.x0,
- label_bounds.y1 - label_bounds.y0);
- }
-
- return FALSE;
-}
-#endif
static void
eel_labeled_image_map (GtkWidget *widget)
@@ -623,29 +537,20 @@ eel_labeled_image_class_init (EelLabeledImageClass *labeled_image_class)
gobject_class->set_property = eel_labeled_image_set_property;
gobject_class->get_property = eel_labeled_image_get_property;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (labeled_image_class)->destroy = eel_labeled_image_destroy;
-#else
widget_class->destroy = eel_labeled_image_destroy;
-#endif
+
/* GtkWidgetClass */
widget_class->size_allocate = eel_labeled_image_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width = eel_labeled_image_get_preferred_width;
widget_class->get_preferred_height = eel_labeled_image_get_preferred_height;
widget_class->draw = eel_labeled_image_draw;
-#else
- widget_class->size_request = eel_labeled_image_size_request;
- widget_class->expose_event = eel_labeled_image_expose_event;
-#endif
+
widget_class->map = eel_labeled_image_map;
widget_class->unmap = eel_labeled_image_unmap;
-#if GTK_CHECK_VERSION(3, 0, 0)
+
gtk_widget_class_set_accessible_type (widget_class, eel_labeled_image_accessible_get_type ());
-#else
- widget_class->get_accessible = eel_labeled_image_get_accessible;
-#endif
+
/* GtkContainerClass */
container_class->add = eel_labeled_image_add;
@@ -1213,13 +1118,8 @@ labeled_image_update_alignments (EelLabeledImage *labeled_image)
if (labeled_image->details->fill)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
x_alignment = gtk_widget_get_halign (labeled_image->details->image);
y_alignment = gtk_widget_get_valign (labeled_image->details->image);
-#else
- gtk_misc_get_alignment (GTK_MISC (labeled_image->details->image),
- &x_alignment, &y_alignment);
-#endif
/* Only the image is shown */
if (!labeled_image_show_label (labeled_image))
@@ -1254,14 +1154,8 @@ labeled_image_update_alignments (EelLabeledImage *labeled_image)
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (labeled_image->details->image, x_alignment);
gtk_widget_set_valign (labeled_image->details->image, y_alignment);
-#else
- gtk_misc_set_alignment (GTK_MISC (labeled_image->details->image),
- x_alignment,
- y_alignment);
-#endif
}
}
}
@@ -1655,19 +1549,12 @@ eel_labeled_image_set_selected (EelLabeledImage *labeled_image,
GtkStateType state;
g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image));
-#if GTK_CHECK_VERSION (3, 0, 0)
state = selected ? GTK_STATE_FLAG_SELECTED : GTK_STATE_FLAG_NORMAL;
gtk_widget_set_state_flags (GTK_WIDGET (labeled_image), state, TRUE);
gtk_widget_set_state_flags (labeled_image->details->image, state, TRUE);
gtk_widget_set_state_flags (labeled_image->details->label, state, TRUE);
-#else
- state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
- gtk_widget_set_state (GTK_WIDGET (labeled_image), state);
- gtk_widget_set_state (labeled_image->details->image, state);
- gtk_widget_set_state (labeled_image->details->label, state);
-#endif
}
/**
@@ -1682,11 +1569,7 @@ eel_labeled_image_get_selected (EelLabeledImage *labeled_image)
{
g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
return gtk_widget_get_state_flags (GTK_WIDGET (labeled_image)) == GTK_STATE_FLAG_SELECTED;
-#else
- return gtk_widget_get_state (GTK_WIDGET (labeled_image)) == GTK_STATE_SELECTED;
-#endif
}
/**
@@ -2324,9 +2207,8 @@ eel_labeled_image_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
a11y_parent_class->initialize (accessible, widget);
-#if GTK_CHECK_VERSION(3, 0, 0)
atk_object_set_role (accessible, ATK_ROLE_IMAGE);
-#endif
+
}
static EelLabeledImage *
@@ -2388,7 +2270,6 @@ eel_labeled_image_accessible_image_interface_init (AtkImageIface *iface)
iface->get_image_size = eel_labeled_image_accessible_image_get_size;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
typedef struct _EelLabeledImageAccessible EelLabeledImageAccessible;
typedef struct _EelLabeledImageAccessibleClass EelLabeledImageAccessibleClass;
@@ -2421,106 +2302,10 @@ static void
eel_labeled_image_accessible_init (EelLabeledImageAccessible *accessible)
{
}
-#else
-static void
-eel_labeled_image_accessible_class_init (AtkObjectClass *klass)
-{
- a11y_parent_class = g_type_class_peek_parent (klass);
-
- klass->get_name = eel_labeled_image_accessible_get_name;
- klass->initialize = eel_labeled_image_accessible_initialize;
-}
-
-enum
-{
- BUTTON,
- CHECK,
- TOGGLE,
- RADIO,
- PLAIN,
- LAST_ONE
-};
-
-static AtkObject *
-eel_labeled_image_get_accessible (GtkWidget *widget)
-{
- int i;
- static GType types[LAST_ONE] = { 0 };
- const char *tname;
- AtkRole role;
- AtkObject *accessible;
-
- if ((accessible = eel_accessibility_get_atk_object (widget)))
- return accessible;
-
- if (GTK_IS_CHECK_BUTTON (widget))
- {
- i = BUTTON;
- role = ATK_ROLE_CHECK_BOX;
- tname = "EelLabeledImageCheckButtonAccessible";
-
- }
- else if (GTK_IS_TOGGLE_BUTTON (widget))
- {
- i = CHECK;
- role = ATK_ROLE_TOGGLE_BUTTON;
- tname = "EelLabeledImageToggleButtonAccessible";
-
- }
- else if (GTK_IS_RADIO_BUTTON (widget))
- {
- i = RADIO;
- role = ATK_ROLE_RADIO_BUTTON;
- tname = "EelLabeledImageRadioButtonAccessible";
-
- }
- else if (GTK_IS_BUTTON (widget))
- {
- i = TOGGLE;
- role = ATK_ROLE_PUSH_BUTTON;
- tname = "EelLabeledImagePushButtonAccessible";
-
- }
- else /* plain */
- {
- i = PLAIN;
- role = ATK_ROLE_IMAGE;
- tname = "EelLabeledImagePlainAccessible";
- }
-
- if (!types [i])
- {
- const GInterfaceInfo atk_image_info =
- {
- (GInterfaceInitFunc) eel_labeled_image_accessible_image_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- types [i] = eel_accessibility_create_derived_type
- (tname, G_TYPE_FROM_INSTANCE (widget),
- eel_labeled_image_accessible_class_init);
-
- if (!types [i])
- return NULL;
-
- g_type_add_interface_static (
- types [i], ATK_TYPE_IMAGE, &atk_image_info);
- }
-
- accessible = g_object_new (types [i], NULL);
- atk_object_set_role (accessible, role);
-
- return eel_accessibility_set_atk_object_return (widget, accessible);
-}
-#endif
static void
eel_labeled_image_button_class_init (GtkWidgetClass *klass)
{
-#if !GTK_CHECK_VERSION(3, 0, 0)
- klass->get_accessible = eel_labeled_image_get_accessible;
-#endif
}
static GType
diff --git a/eel/eel-wrap-table.c b/eel/eel-wrap-table.c
index 56c1e5e9..0d77b442 100644
--- a/eel/eel-wrap-table.c
+++ b/eel/eel-wrap-table.c
@@ -30,10 +30,6 @@
#include "eel-gtk-extensions.h"
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
/* Arguments */
enum
{
@@ -200,7 +196,6 @@ eel_wrap_table_size_request (GtkWidget *widget,
requisition->height = content_dimensions.height + gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
eel_wrap_table_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
@@ -220,7 +215,6 @@ eel_wrap_table_get_preferred_height (GtkWidget *widget,
eel_wrap_table_size_request (widget, &req);
*minimum_height = *natural_height = req.height;
}
-#endif
static void
eel_wrap_table_size_allocate (GtkWidget *widget,
@@ -239,37 +233,23 @@ eel_wrap_table_size_allocate (GtkWidget *widget,
}
static int
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_wrap_table_draw (GtkWidget *widget,
cairo_t *cr)
-#else
-eel_wrap_table_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-#endif
{
EelWrapTable *wrap_table;
GList *iterator;
g_assert (EEL_IS_WRAP_TABLE (widget));
g_assert (gtk_widget_get_realized (widget));
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_assert (event != NULL);
-#endif
wrap_table = EEL_WRAP_TABLE (widget);
for (iterator = wrap_table->details->children; iterator; iterator = iterator->next)
{
g_assert (GTK_IS_WIDGET (iterator->data));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_propagate_draw (GTK_CONTAINER (widget),
GTK_WIDGET (iterator->data),
cr);
-#else
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- GTK_WIDGET (iterator->data),
- event);
-#endif
}
return FALSE;
@@ -451,14 +431,9 @@ eel_wrap_table_class_init (EelWrapTableClass *wrap_table_class)
/* GtkWidgetClass */
widget_class->size_allocate = eel_wrap_table_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width = eel_wrap_table_get_preferred_width;
widget_class->get_preferred_height = eel_wrap_table_get_preferred_height;
widget_class->draw = eel_wrap_table_draw;
-#else
- widget_class->size_request = eel_wrap_table_size_request;
- widget_class->expose_event = eel_wrap_table_expose_event;
-#endif
widget_class->map = eel_wrap_table_map;
widget_class->unmap = eel_wrap_table_unmap;
widget_class->realize = eel_wrap_table_realize;
@@ -798,13 +773,8 @@ wrap_table_child_focus_in (GtkWidget *widget,
if (!wrap_table_child_visible_in (widget, viewport))
{
-#if GTK_CHECK_VERSION (3, 0, 0)
hadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));
-#else
- hadj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (viewport));
- vadj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (viewport));
-#endif
gtk_widget_translate_coordinates (widget, container, 0, 0, &x, &y);
diff --git a/libcaja-extension/Makefile.am b/libcaja-extension/Makefile.am
index 452528ff..03b24d82 100644
--- a/libcaja-extension/Makefile.am
+++ b/libcaja-extension/Makefile.am
@@ -11,7 +11,6 @@ AM_CPPFLAGS = \
$(WARNING_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
- $(UNIQUE_CFLAGS) \
$(NULL)
libcaja_extension_la_LDFLAGS=\
@@ -70,7 +69,7 @@ introspection_files = \
$(libcaja_extension_include_HEADERS) \
$(libcaja_extension_la_SOURCES)
Caja-2.0.gir: libcaja-extension.la Makefile
-Caja_2_0_gir_INCLUDES = Gtk-${GTK_API_VERSION} Gio-2.0 GLib-2.0
+Caja_2_0_gir_INCLUDES = Gtk-3.0 Gio-2.0 GLib-2.0
Caja_2_0_gir_CFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
diff --git a/libcaja-extension/libcaja-extension-uninstalled.pc.in b/libcaja-extension/libcaja-extension-uninstalled.pc.in
index 1b156530..9a4b6695 100644
--- a/libcaja-extension/libcaja-extension-uninstalled.pc.in
+++ b/libcaja-extension/libcaja-extension-uninstalled.pc.in
@@ -7,6 +7,6 @@ extensiondir=@libdir@/caja/extensions-2.0
Name: libcaja-extension
Description: A library to create Caja view extensions
Version: @VERSION@
-Requires: glib-2.0 gtk+-@GTK_API_VERSION@
+Requires: glib-2.0 gtk+-3.0
Libs: ${pc_top_builddir}/${pcfiledir}/libcaja-extension.la
Cflags: -I${pc_top_builddir}/${pcfiledir}/..
diff --git a/libcaja-extension/libcaja-extension.pc.in b/libcaja-extension/libcaja-extension.pc.in
index a5ccae7e..de36e0a8 100644
--- a/libcaja-extension/libcaja-extension.pc.in
+++ b/libcaja-extension/libcaja-extension.pc.in
@@ -7,6 +7,6 @@ extensiondir=@libdir@/caja/extensions-2.0
Name: libcaja-extension
Description: A library to create Caja view extensions
Version: @VERSION@
-Requires: glib-2.0 gio-2.0 gtk+-@GTK_API_VERSION@
+Requires: glib-2.0 gio-2.0 gtk+-3.0
Libs: -L${libdir} -lcaja-extension
Cflags: -I${includedir}/caja
diff --git a/libcaja-private/Makefile.am b/libcaja-private/Makefile.am
index a02d5fae..c4abbd93 100644
--- a/libcaja-private/Makefile.am
+++ b/libcaja-private/Makefile.am
@@ -15,7 +15,6 @@ AM_CPPFLAGS = \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DCAJA_DATADIR=\""$(datadir)/caja"\" \
-DCAJA_EXTENSIONDIR=\""$(libdir)/caja/extensions-2.0"\" \
- $(UNIQUE_CFLAGS) \
$(NULL)
BUILT_SOURCES = \
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index 5212813d..9a1ac819 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -43,11 +43,6 @@
#include "caja-desktop-icon-file.h"
#include "caja-file-utilities.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum
{
AUTORUN_ASK,
@@ -753,11 +748,7 @@ is_shift_pressed (void)
gdk_error_trap_push ();
status = XkbGetState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
XkbUseCoreKbd, &state);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
if (status == Success)
{
@@ -1001,7 +992,7 @@ show_dialog:
dialog = gtk_dialog_new ();
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
@@ -1012,12 +1003,8 @@ show_dialog:
g_object_unref (icon_info);
g_object_unref (icon);
image = gtk_image_new_from_pixbuf (pixbuf);
-#if GTK_CHECK_VERSION (3, 14, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0);
/* also use the icon on the dialog */
gtk_window_set_title (GTK_WINDOW (dialog), mount_name);
@@ -1025,7 +1012,7 @@ show_dialog:
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
g_object_unref (pixbuf);
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
label = gtk_label_new (NULL);
@@ -1097,11 +1084,9 @@ show_dialog:
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (label), 50);
-#endif
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
@@ -1114,11 +1099,9 @@ show_dialog:
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (label), 50);
-#endif
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
diff --git a/libcaja-private/caja-cell-renderer-text-ellipsized.c b/libcaja-private/caja-cell-renderer-text-ellipsized.c
index 414bdc9d..13d73f04 100644
--- a/libcaja-private/caja-cell-renderer-text-ellipsized.c
+++ b/libcaja-private/caja-cell-renderer-text-ellipsized.c
@@ -29,7 +29,6 @@
G_DEFINE_TYPE (CajaCellRendererTextEllipsized, caja_cell_renderer_text_ellipsized,
GTK_TYPE_CELL_RENDERER_TEXT);
-#if GTK_CHECK_VERSION(3,0,0)
static void
caja_cell_renderer_text_ellipsized_init (CajaCellRendererTextEllipsized *cell)
{
@@ -59,44 +58,13 @@ caja_cell_renderer_text_ellipsized_get_preferred_width (GtkCellRenderer *cell,
"ellipsize-set", TRUE,
NULL);
}
-#else /* GTK_CHECK_VERSION(3,0,0) */
-static void
-caja_cell_renderer_text_ellipsized_init (CajaCellRendererTextEllipsized *cell)
-{
- g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-}
-
-static void
-caja_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
-{
- g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_NONE, NULL);
-
- GTK_CELL_RENDERER_CLASS
- (caja_cell_renderer_text_ellipsized_parent_class)->get_size (cell, widget,
- cell_area,
- x_offset, y_offset,
- width, height);
-
- g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-}
-#endif /* GTK_CHECK_VERSION(3,0,0) */
static void
caja_cell_renderer_text_ellipsized_class_init (CajaCellRendererTextEllipsizedClass *klass)
{
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
-
-#if GTK_CHECK_VERSION(3,0,0)
cell_class->get_preferred_width = caja_cell_renderer_text_ellipsized_get_preferred_width;
-#else
- cell_class->get_size = caja_cell_renderer_text_ellipsized_get_size;
-#endif
+
}
GtkCellRenderer *
diff --git a/libcaja-private/caja-column-chooser.c b/libcaja-private/caja-column-chooser.c
index c5ae9779..7c4a096f 100644
--- a/libcaja-private/caja-column-chooser.c
+++ b/libcaja-private/caja-column-chooser.c
@@ -31,10 +31,6 @@
#include "caja-column-utilities.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
struct _CajaColumnChooserDetails
{
GtkTreeView *view;
@@ -69,11 +65,7 @@ enum
};
static guint signals[LAST_SIGNAL] = { 0 };
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(CajaColumnChooser, caja_column_chooser, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(CajaColumnChooser, caja_column_chooser, GTK_TYPE_HBOX);
-#endif
static void caja_column_chooser_constructed (GObject *object);
@@ -379,7 +371,7 @@ add_buttons (CajaColumnChooser *chooser)
GtkWidget *box;
GtkWidget *separator;
- box = gtk_vbox_new (FALSE, 8);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_show (box);
chooser->details->move_up_button = button_new_with_mnemonic (GTK_STOCK_GO_UP,
@@ -402,11 +394,7 @@ add_buttons (CajaColumnChooser *chooser)
gtk_box_pack_start (GTK_BOX (box), chooser->details->move_down_button,
FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- separator = gtk_hseparator_new ();
-#endif
gtk_widget_show (separator);
gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
@@ -478,9 +466,7 @@ caja_column_chooser_init (CajaColumnChooser *chooser)
g_object_set (G_OBJECT (chooser),
"homogeneous", FALSE,
"spacing", 8,
-#if GTK_CHECK_VERSION (3, 0, 0)
"orientation", GTK_ORIENTATION_HORIZONTAL,
-#endif
NULL);
add_tree_view (chooser);
diff --git a/libcaja-private/caja-column-chooser.h b/libcaja-private/caja-column-chooser.h
index 87612d44..b0596623 100644
--- a/libcaja-private/caja-column-chooser.h
+++ b/libcaja-private/caja-column-chooser.h
@@ -44,22 +44,14 @@ typedef struct _CajaColumnChooserDetails CajaColumnChooserDetails;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkHBox parent;
-#endif
CajaColumnChooserDetails *details;
} CajaColumnChooser;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_slot;
-#else
- GtkHBoxClass parent_slot;
-#endif
void (*changed) (CajaColumnChooser *chooser);
void (*use_default) (CajaColumnChooser *chooser);
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c
index 382d1764..cecb0ec1 100644
--- a/libcaja-private/caja-dnd.c
+++ b/libcaja-private/caja-dnd.c
@@ -915,7 +915,7 @@ caja_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_delta,
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *pointer;
-#elif GTK_CHECK_VERSION (3, 0, 0)
+#else
GdkDeviceManager *manager;
GdkDevice *pointer;
#endif
@@ -929,13 +929,11 @@ caja_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_delta,
pointer = gdk_seat_get_pointer (seat);
gdk_window_get_device_position (gtk_widget_get_window (widget), pointer,
&x, &y, NULL);
-#elif GTK_CHECK_VERSION (3, 0, 0)
+#else
manager = gdk_display_get_device_manager (gtk_widget_get_display (widget));
pointer = gdk_device_manager_get_client_pointer (manager);
gdk_window_get_device_position (gtk_widget_get_window (widget), pointer,
&x, &y, NULL);
-#else
- gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL);
#endif
/* Find out if we are anywhere close to the tree view edges
diff --git a/libcaja-private/caja-entry.c b/libcaja-private/caja-entry.c
index 698954f8..466b57e8 100644
--- a/libcaja-private/caja-entry.c
+++ b/libcaja-private/caja-entry.c
@@ -35,9 +35,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define GtkEditableInterface GtkEditableClass
-#endif
struct CajaEntryDetails
{
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c
index 588483be..03a9dfb6 100644
--- a/libcaja-private/caja-file-conflict-dialog.c
+++ b/libcaja-private/caja-file-conflict-dialog.c
@@ -70,11 +70,6 @@ G_DEFINE_TYPE (CajaFileConflictDialog,
(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_FILE_CONFLICT_DIALOG, \
CajaFileConflictDialogDetails))
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static void
file_icons_changed (CajaFile *file,
CajaFileConflictDialog *fcd)
@@ -115,11 +110,7 @@ file_list_ready_cb (GList *files,
GdkPixbuf *pixbuf;
GtkWidget *label;
GString *str;
-#if GTK_CHECK_VERSION(3,0,0)
PangoAttrList *attr_list;
-#else
- PangoFontDescription *desc;
-#endif
details = fcd->details;
@@ -220,7 +211,6 @@ file_list_ready_cb (GList *files,
label = gtk_label_new (primary_text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
-#if GTK_CHECK_VERSION (3, 0, 0)
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
@@ -238,30 +228,9 @@ file_list_ready_cb (GList *files,
NULL);
pango_attr_list_unref (attr_list);
-#else
- gtk_widget_set_size_request (label, 350, -1);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (details->titles_vbox),
- label, FALSE, FALSE, 0);
-
- gtk_widget_modify_font (label, NULL);
-
- desc = pango_font_description_new ();
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
- pango_font_description_set_size (desc,
- pango_font_description_get_size (gtk_widget_get_style (label)->font_desc) * PANGO_SCALE_LARGE);
- gtk_widget_modify_font (label, desc);
- pango_font_description_free (desc);
- gtk_widget_show (label);
-#endif
-
label = gtk_label_new (secondary_text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (label), 60);
-#else
- gtk_widget_set_size_request (label, 350, -1);
-#endif
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
@@ -596,11 +565,7 @@ diff_button_clicked_cb (GtkButton *w,
static void
caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *hbox, *vbox, *vbox2;
-#else
- GtkWidget *hbox, *vbox, *vbox2, *alignment;
-#endif
GtkWidget *widget, *dialog_area;
CajaFileConflictDialogDetails *details;
GtkDialog *dialog;
@@ -612,7 +577,7 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
source_is_dir = caja_file_is_directory (details->source);
/* Setup the main hbox */
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
dialog_area = gtk_dialog_get_content_area (dialog);
gtk_box_pack_start (GTK_BOX (dialog_area), hbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
@@ -621,42 +586,30 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
widget = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.0);
-#endif
/* Setup the vbox containing the dialog body */
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
/* Setup the vbox for the dialog labels */
- widget = gtk_vbox_new (FALSE, 12);
+ widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
details->titles_vbox = widget;
/* Setup the hboxes to pack file infos into */
-#if GTK_CHECK_VERSION (3, 0, 0)
- vbox2 = gtk_vbox_new (FALSE, 12);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_widget_set_halign (vbox2, GTK_ALIGN_START);
gtk_widget_set_valign (vbox2, GTK_ALIGN_START);
gtk_widget_set_margin_start (vbox2, 12);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
-#else
- alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
- g_object_set (alignment, "left-padding", 12, NULL);
- vbox2 = gtk_vbox_new (FALSE, 12);
- gtk_container_add (GTK_CONTAINER (alignment), vbox2);
- gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
-#endif
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
details->first_hbox = hbox;
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
details->second_hbox = hbox;
@@ -666,7 +619,7 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
g_signal_connect (details->expander, "activate",
G_CALLBACK (expander_activated_cb), dialog);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (details->expander), hbox);
widget = gtk_entry_new ();
@@ -683,11 +636,7 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
g_signal_connect (widget, "clicked",
G_CALLBACK (reset_button_clicked_cb), dialog);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show_all (vbox2);
-#else
- gtk_widget_show_all (alignment);
-#endif
/* Setup the diff button for text files */
details->diff_button = gtk_button_new_with_label (_("Differences..."));
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index dbe6a7ff..afca12bd 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -194,11 +194,7 @@ G_DEFINE_TYPE_WITH_CODE (CajaIconCanvasItem, caja_icon_canvas_item, EEL_TYPE_CAN
/* private */
static void draw_label_text (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
gboolean create_mask,
EelIRect icon_rect);
static void measure_label_text (CajaIconCanvasItem *item);
@@ -213,34 +209,18 @@ static gboolean emblem_layout_next (EmblemLayout
EelIRect *emblem_rect,
gboolean is_rtl);
static void draw_pixbuf (GdkPixbuf *pixbuf,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
int x,
int y);
static PangoLayout *get_label_layout (PangoLayout **layout,
CajaIconCanvasItem *item,
const char *text);
-#if !GTK_CHECK_VERSION(3,0,0)
-static void draw_label_layout (CajaIconCanvasItem *item,
- GdkDrawable *drawable,
- PangoLayout *layout,
- gboolean highlight,
- GdkColor *label_color,
- int x,
- int y);
-#endif
+
static gboolean hit_test_stretch_handle (CajaIconCanvasItem *item,
EelIRect canvas_rect,
GtkCornerType *corner);
static void draw_embedded_text (CajaIconCanvasItem *icon_item,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
int x,
int y);
@@ -512,22 +492,11 @@ caja_icon_canvas_item_get_property (GObject *object,
}
}
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t *
caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
-#else
-GdkPixmap *
-caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
- GdkBitmap **mask,
- GdkColormap *colormap)
-#endif
{
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t *surface;
-#else
- GdkPixmap *pixmap;
- GdkPixbuf *pixbuf;
-#endif
+
EelCanvas *canvas;
GdkScreen *screen;
int width, height;
@@ -539,22 +508,16 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
double item_x, item_y;
gboolean is_rtl;
cairo_t *cr;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context;
-#endif
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), NULL);
canvas = EEL_CANVAS_ITEM (item)->canvas;
-#if GTK_CHECK_VERSION(3,0,0)
screen = gtk_widget_get_screen (GTK_WIDGET (canvas));
context = gtk_widget_get_style_context (GTK_WIDGET (canvas));
gtk_style_context_save (context);
gtk_style_context_add_class (context, "caja-canvas-item");
-#else
- screen = gdk_colormap_get_screen (colormap);
-#endif
/* Assume we're updated so canvas item data is right */
@@ -571,7 +534,6 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
width = EEL_CANVAS_ITEM (item)->x2 - EEL_CANVAS_ITEM (item)->x1;
height = EEL_CANVAS_ITEM (item)->y2 - EEL_CANVAS_ITEM (item)->y1;
-#if GTK_CHECK_VERSION(3,0,0)
surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
@@ -580,25 +542,7 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
gtk_render_icon (context, cr, item->details->pixbuf,
item_offset_x, item_offset_y);
-#else
- pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen),
- width, height,
- gdk_visual_get_depth (gdk_colormap_get_visual (colormap)));
- gdk_drawable_set_colormap (pixmap, colormap);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- TRUE,
- gdk_pixbuf_get_bits_per_sample (item->details->pixbuf),
- width, height);
- gdk_pixbuf_fill (pixbuf, 0x00000000);
-
- gdk_pixbuf_composite (item->details->pixbuf, pixbuf,
- item_offset_x, item_offset_y,
- gdk_pixbuf_get_width (item->details->pixbuf),
- gdk_pixbuf_get_height (item->details->pixbuf),
- item_offset_x, item_offset_y, 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
-#endif
+
icon_rect.x0 = item_offset_x;
icon_rect.y0 = item_offset_y;
@@ -608,7 +552,7 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
is_rtl = caja_icon_container_is_layout_rtl (CAJA_ICON_CONTAINER (canvas));
emblem_layout_reset (&emblem_layout, item, icon_rect, is_rtl);
-#if GTK_CHECK_VERSION(3,0,0)
+
while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect, is_rtl))
{
gdk_cairo_set_source_pixbuf (cr, emblem_pixbuf, emblem_rect.x0, emblem_rect.y0);
@@ -626,44 +570,7 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
gtk_style_context_restore (context);
return surface;
-#else
- while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect, is_rtl))
- {
- gdk_pixbuf_composite (emblem_pixbuf, pixbuf,
- emblem_rect.x0, emblem_rect.y0,
- gdk_pixbuf_get_width (emblem_pixbuf),
- gdk_pixbuf_get_height (emblem_pixbuf),
- emblem_rect.x0, emblem_rect.y0,
- 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
- }
-
- /* draw pixbuf to mask and pixmap */
- cr = gdk_cairo_create (pixmap);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
- cairo_destroy (cr);
- *mask = gdk_pixmap_new (gdk_screen_get_root_window (screen),
- width, height,
- 1);
- cr = gdk_cairo_create (*mask);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
- cairo_destroy (cr);
-
- draw_embedded_text (item, pixmap,
- item_offset_x, item_offset_y);
-
- draw_label_text (item, pixmap, FALSE, icon_rect);
- draw_label_text (item, *mask, TRUE, icon_rect);
-
- g_object_unref (pixbuf);
-
- return pixmap;
-#endif
}
void
@@ -996,85 +903,7 @@ in_single_click_mode (void)
return click_policy_auto_value == CAJA_CLICK_POLICY_SINGLE;
}
-#if !GTK_CHECK_VERSION(3,0,0)
-/* Utility routine to create a rectangle with rounded corners.
- * This could possibly move to Eel as a general purpose routine.
- */
-static void
-make_round_rect (cairo_t *cr,
- double x,
- double y,
- double width,
- double height,
- double radius)
-{
- double cx, cy;
-
- width -= 2 * radius;
- height -= 2 * radius;
-
- cairo_move_to (cr, x + radius, y);
-
- cairo_rel_line_to (cr, width, 0.0);
-
- cairo_get_current_point (cr, &cx, &cy);
- cairo_arc (cr, cx, cy + radius, radius, 3.0 * G_PI_2, 0);
-
- cairo_rel_line_to (cr, 0.0, height);
-
- cairo_get_current_point (cr, &cx, &cy);
- cairo_arc (cr, cx - radius, cy, radius, 0, G_PI_2);
-
- cairo_rel_line_to (cr, - width, 0.0);
-
- cairo_get_current_point (cr, &cx, &cy);
- cairo_arc (cr, cx, cy - radius, radius, G_PI_2, G_PI);
-
- cairo_rel_line_to (cr, 0.0, -height);
-
- cairo_get_current_point (cr, &cx, &cy);
- cairo_arc (cr, cx + radius, cy, radius, G_PI, 3.0 * G_PI_2);
-
- cairo_close_path (cr);
-}
-
-static void
-draw_frame (CajaIconCanvasItem *item,
- GdkDrawable *drawable,
- guint color,
- gboolean create_mask,
- int x,
- int y,
- int width,
- int height)
-{
- cairo_t *cr = gdk_cairo_create (drawable);
-
- /* Set the rounded rect clip region. Magic rounding value taken
- * from old code.
- */
- make_round_rect (cr, x, y, width, height, 5);
-
- if (create_mask)
- {
- /* Dunno how to do this with cairo...
- * It used to threshold the rendering so that the
- * bitmask didn't show white where alpha < 0.5
- */
- }
-
- cairo_set_source_rgba (cr,
- EEL_RGBA_COLOR_GET_R (color) / 255.0,
- EEL_RGBA_COLOR_GET_G (color) / 255.0,
- EEL_RGBA_COLOR_GET_B (color) / 255.0,
- EEL_RGBA_COLOR_GET_A (color) / 255.0);
- /* Paint into drawable now that we have set up the color and opacity */
- cairo_fill (cr);
-
- cairo_destroy (cr);
-}
-#endif
/* Keep these for a bit while we work on performance of draw_or_measure_label_text. */
/*
#define PERFORMANCE_TEST_DRAW_DISABLE
@@ -1373,7 +1202,6 @@ measure_label_text (CajaIconCanvasItem *item)
static void
draw_label_text (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
gboolean create_mask,
EelIRect icon_rect)
@@ -1554,177 +1382,6 @@ draw_label_text (CajaIconCanvasItem *item,
g_object_unref (additional_layout);
}
}
-#else
- GdkDrawable *drawable,
- gboolean create_mask,
- EelIRect icon_rect)
-{
- EelCanvasItem *canvas_item;
- CajaIconCanvasItemDetails *details;
- CajaIconContainer *container;
- PangoLayout *editable_layout;
- PangoLayout *additional_layout;
- GdkColor *label_color;
- gboolean have_editable, have_additional;
- gboolean needs_frame, needs_highlight, prelight_label, is_rtl_label_beside;
- EelIRect text_rect;
- int x;
- int max_text_width;
-
-#ifdef PERFORMANCE_TEST_DRAW_DISABLE
- return;
-#endif
-
- details = item->details;
-
- measure_label_text (item);
- if (details->text_height == 0 ||
- details->text_width == 0)
- {
- return;
- }
-
- container = CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas);
- canvas_item = EEL_CANVAS_ITEM (item);
-
- text_rect = compute_text_rectangle (item, icon_rect, TRUE, BOUNDS_USAGE_FOR_DISPLAY);
-
- needs_highlight = details->is_highlighted_for_selection || details->is_highlighted_for_drop;
- is_rtl_label_beside = caja_icon_container_is_layout_rtl (container) &&
- container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE;
-
- editable_layout = NULL;
- additional_layout = NULL;
-
- have_editable = details->editable_text != NULL && details->editable_text[0] != '\0';
- have_additional = details->additional_text != NULL && details->additional_text[0] != '\0';
- g_assert (have_editable || have_additional);
-
- max_text_width = floor (caja_icon_canvas_item_get_max_text_width (item));
-
- if (needs_highlight && !details->is_renaming)
- {
- draw_frame (item,
- drawable,
- gtk_widget_has_focus (GTK_WIDGET (container)) ? container->details->highlight_color_rgba : container->details->active_color_rgba,
- create_mask,
- is_rtl_label_beside ? text_rect.x0 + item->details->text_dx : text_rect.x0,
- text_rect.y0,
- is_rtl_label_beside ? text_rect.x1 - text_rect.x0 - item->details->text_dx : text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- }
- else if (!needs_highlight && !details->is_renaming &&
- (details->is_prelit ||
- details->is_highlighted_as_keyboard_focus))
- {
- /* clear the underlying icons, where the text or overlaps them. */
- gdk_window_clear_area (gtk_layout_get_bin_window (&EEL_CANVAS (container)->layout),
- text_rect.x0,
- text_rect.y0,
- text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- }
-
- if (container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE)
- {
- x = text_rect.x0 + 2;
- }
- else
- {
- x = text_rect.x0 + ((text_rect.x1 - text_rect.x0) - max_text_width) / 2;
- }
-
- if (have_editable)
- {
- editable_layout = get_label_layout (&item->details->editable_text_layout, item, item->details->editable_text);
- prepare_pango_layout_for_draw (item, editable_layout);
-
- gtk_widget_style_get (GTK_WIDGET (container),
- "frame_text", &needs_frame,
- "activate_prelight_icon_label", &prelight_label,
- NULL);
- if (needs_frame && !needs_highlight && details->text_width > 0 && details->text_height > 0)
- {
- if (!(prelight_label && item->details->is_prelit))
- {
- draw_frame (item,
- drawable,
- container->details->normal_color_rgba,
- create_mask,
- text_rect.x0,
- text_rect.y0,
- text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- }
- else
- {
- draw_frame (item,
- drawable,
- container->details->prelight_color_rgba,
- create_mask,
- text_rect.x0,
- text_rect.y0,
- text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- }
- }
-
- caja_icon_container_get_label_color
- (CAJA_ICON_CONTAINER (canvas_item->canvas),
- &label_color, TRUE, needs_highlight,
- prelight_label & item->details->is_prelit);
-
- draw_label_layout (item,
- drawable,
- editable_layout, needs_highlight,
- label_color,
- x,
- text_rect.y0 + TEXT_BACK_PADDING_Y);
- }
-
- if (have_additional)
- {
- additional_layout = get_label_layout (&item->details->additional_text_layout, item, item->details->additional_text);
- prepare_pango_layout_for_draw (item, additional_layout);
-
- caja_icon_container_get_label_color
- (CAJA_ICON_CONTAINER (canvas_item->canvas),
- &label_color, FALSE, needs_highlight,
- FALSE);
-
- draw_label_layout (item,
- drawable,
- additional_layout, needs_highlight,
- label_color,
- x,
- text_rect.y0 + details->editable_text_height + LABEL_LINE_SPACING + TEXT_BACK_PADDING_Y);
- }
-
- if (!create_mask && item->details->is_highlighted_as_keyboard_focus)
- {
- gtk_paint_focus (gtk_widget_get_style (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas)),
- drawable,
- needs_highlight ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
- NULL,
- GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas),
- "icon-container",
- text_rect.x0,
- text_rect.y0,
- text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- }
-
- if (editable_layout != NULL)
- {
- g_object_unref (editable_layout);
- }
-
- if (additional_layout != NULL)
- {
- g_object_unref (additional_layout);
- }
-}
-#endif
void
caja_icon_canvas_item_set_is_visible (CajaIconCanvasItem *item,
@@ -1787,21 +1444,15 @@ get_knob_pixbuf (void)
static void
draw_stretch_handles (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
const EelIRect *rect)
{
GtkWidget *widget;
GdkPixbuf *knob_pixbuf;
int knob_width, knob_height;
double dash = { 2.0 };
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style;
GdkRGBA color;
-#endif
if (!item->details->show_stretch_handles)
{
@@ -1809,26 +1460,18 @@ draw_stretch_handles (CajaIconCanvasItem *item,
}
widget = GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas);
-#if GTK_CHECK_VERSION(3,0,0)
style = gtk_widget_get_style_context (widget);
-#endif
-#if GTK_CHECK_VERSION(3,0,0)
cairo_save (cr);
-#else
- cairo_t *cr = gdk_cairo_create (drawable);
-#endif
+
knob_pixbuf = get_knob_pixbuf ();
knob_width = gdk_pixbuf_get_width (knob_pixbuf);
knob_height = gdk_pixbuf_get_height (knob_pixbuf);
/* first draw the box */
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_get_color (style, GTK_STATE_FLAG_SELECTED, &color);
gdk_cairo_set_source_rgba (cr, &color);
-#else
- cairo_set_source_rgb (cr, 0, 0, 0);
-#endif
+
cairo_set_dash (cr, &dash, 1, 0);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
@@ -1838,7 +1481,6 @@ draw_stretch_handles (CajaIconCanvasItem *item,
rect->y1 - rect->y0 - 1);
cairo_stroke (cr);
-#if GTK_CHECK_VERSION(3,0,0)
cairo_restore (cr);
/* draw the stretch handles themselves */
@@ -1846,14 +1488,6 @@ draw_stretch_handles (CajaIconCanvasItem *item,
draw_pixbuf (knob_pixbuf, cr, rect->x0, rect->y1 - knob_height);
draw_pixbuf (knob_pixbuf, cr, rect->x1 - knob_width, rect->y0);
draw_pixbuf (knob_pixbuf, cr, rect->x1 - knob_width, rect->y1 - knob_height);
-#else
- cairo_destroy (cr);
-
- draw_pixbuf (knob_pixbuf, drawable, rect->x0, rect->y0);
- draw_pixbuf (knob_pixbuf, drawable, rect->x0, rect->y1 - knob_height);
- draw_pixbuf (knob_pixbuf, drawable, rect->x1 - knob_width, rect->y0);
- draw_pixbuf (knob_pixbuf, drawable, rect->x1 - knob_width, rect->y1 - knob_height);
-#endif
g_object_unref (knob_pixbuf);
}
@@ -2016,7 +1650,6 @@ emblem_layout_next (EmblemLayout *layout,
}
static void
-#if GTK_CHECK_VERSION(3,0,0)
draw_pixbuf (GdkPixbuf *pixbuf,
cairo_t *cr,
int x, int y)
@@ -2026,15 +1659,6 @@ draw_pixbuf (GdkPixbuf *pixbuf,
cairo_paint (cr);
cairo_restore (cr);
}
-#else
-draw_pixbuf (GdkPixbuf *pixbuf, GdkDrawable *drawable, int x, int y)
-{
- cairo_t *cr = gdk_cairo_create (drawable);
- gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
- cairo_paint (cr);
- cairo_destroy (cr);
-}
-#endif
/* shared code to highlight or dim the passed-in pixbuf */
static GdkPixbuf *
@@ -2045,12 +1669,8 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
CajaIconContainer *container;
GdkPixbuf *temp_pixbuf, *old_pixbuf, *audio_pixbuf;
int emblem_size;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style;
GdkRGBA color;
-#else
- guint render_mode, saturation, brightness, lighten;
-#endif
temp_pixbuf = icon_item->details->pixbuf;
canvas = EEL_CANVAS_ITEM(icon_item)->canvas;
@@ -2063,28 +1683,8 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
{
old_pixbuf = temp_pixbuf;
-#if GTK_CHECK_VERSION(3,0,0)
temp_pixbuf = eel_create_spotlight_pixbuf (temp_pixbuf);
g_object_unref (old_pixbuf);
-#else
- gtk_widget_style_get (GTK_WIDGET (container),
- "prelight_icon_render_mode", &render_mode,
- "prelight_icon_saturation", &saturation,
- "prelight_icon_brightness", &brightness,
- "prelight_icon_lighten", &lighten,
- NULL);
-
- if (render_mode > 0 || saturation < 255 || brightness < 255)
- {
- temp_pixbuf = eel_gdk_pixbuf_render (temp_pixbuf,
- render_mode,
- saturation,
- brightness,
- lighten,
- container->details->prelight_icon_color_rgba);
- g_object_unref (old_pixbuf);
- }
-#endif
/* FIXME bugzilla.gnome.org 42471: This hard-wired image is inappropriate to
* this level of code, which shouldn't know that the
@@ -2134,7 +1734,6 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
if (icon_item->details->is_highlighted_for_selection
|| icon_item->details->is_highlighted_for_drop)
{
-#if GTK_CHECK_VERSION(3,0,0)
style = gtk_widget_get_style_context (GTK_WIDGET (canvas));
if (gtk_widget_has_focus (GTK_WIDGET (canvas))) {
@@ -2145,50 +1744,10 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
old_pixbuf = temp_pixbuf;
temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf, &color);
-#else
- guint color;
-
- old_pixbuf = temp_pixbuf;
-
- color = gtk_widget_has_focus (GTK_WIDGET (canvas)) ? CAJA_ICON_CONTAINER (canvas)->details->highlight_color_rgba : CAJA_ICON_CONTAINER (canvas)->details->active_color_rgba;
-
- temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf,
- EEL_RGBA_COLOR_GET_R (color),
- EEL_RGBA_COLOR_GET_G (color),
- EEL_RGBA_COLOR_GET_B (color));
-#endif
g_object_unref (old_pixbuf);
}
-#if !GTK_CHECK_VERSION(3,0,0)
- if (!icon_item->details->is_active
- && !icon_item->details->is_prelit
- && !icon_item->details->is_highlighted_for_selection
- && !icon_item->details->is_highlighted_for_drop)
- {
- old_pixbuf = temp_pixbuf;
-
- gtk_widget_style_get (GTK_WIDGET (container),
- "normal_icon_render_mode", &render_mode,
- "normal_icon_saturation", &saturation,
- "normal_icon_brightness", &brightness,
- "normal_icon_lighten", &lighten,
- NULL);
- if (render_mode > 0 || saturation < 255 || brightness < 255)
- {
- /* if theme requests colorization */
- temp_pixbuf = eel_gdk_pixbuf_render (temp_pixbuf,
- render_mode,
- saturation,
- brightness,
- lighten,
- container->details->normal_icon_color_rgba);
- g_object_unref (old_pixbuf);
- }
- }
-#endif
-
return temp_pixbuf;
}
@@ -2223,20 +1782,14 @@ map_pixbuf (CajaIconCanvasItem *icon_item)
static void
draw_embedded_text (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkDrawable *drawable,
-#endif
int x, int y)
{
PangoLayout *layout;
PangoContext *context;
PangoFontDescription *desc;
-#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *widget;
GtkStyleContext *style_context;
-#endif
if (item->details->embedded_text == NULL ||
item->details->embedded_text_rect.width == 0 ||
@@ -2245,9 +1798,7 @@ draw_embedded_text (CajaIconCanvasItem *item,
return;
}
-#if GTK_CHECK_VERSION(3,0,0)
widget = GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas);
-#endif
if (item->details->embedded_text_layout != NULL)
{
@@ -2255,11 +1806,7 @@ draw_embedded_text (CajaIconCanvasItem *item,
}
else
{
-#if GTK_CHECK_VERSION(3,0,0)
context = gtk_widget_get_pango_context (widget);
-#else
- context = gtk_widget_get_pango_context (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas));
-#endif
layout = pango_layout_new (context);
pango_layout_set_text (layout, item->details->embedded_text, -1);
@@ -2273,7 +1820,6 @@ draw_embedded_text (CajaIconCanvasItem *item,
}
}
-#if GTK_CHECK_VERSION(3,0,0)
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_save (style_context);
gtk_style_context_add_class (style_context, "icon-embedded-text");
@@ -2294,54 +1840,25 @@ draw_embedded_text (CajaIconCanvasItem *item,
gtk_style_context_restore (style_context);
cairo_restore (cr);
-#else
- cairo_t *cr = gdk_cairo_create (drawable);
-
- cairo_rectangle (cr,
- x + item->details->embedded_text_rect.x,
- y + item->details->embedded_text_rect.y,
- item->details->embedded_text_rect.width,
- item->details->embedded_text_rect.height);
- cairo_clip (cr);
-
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_move_to (cr,
- x + item->details->embedded_text_rect.x,
- y + item->details->embedded_text_rect.y);
- pango_cairo_show_layout (cr, layout);
-
- cairo_destroy (cr);
-#endif
}
/* Draw the icon item for non-anti-aliased mode. */
static void
-#if GTK_CHECK_VERSION(3,0,0)
caja_icon_canvas_item_draw (EelCanvasItem *item,
cairo_t *cr,
cairo_region_t *region)
{
CajaIconContainer *container;
-#else
-caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
- GdkEventExpose *expose)
-{
-#endif
CajaIconCanvasItem *icon_item;
CajaIconCanvasItemDetails *details;
EelIRect icon_rect, emblem_rect;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf, *temp_pixbuf;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context;
container = CAJA_ICON_CONTAINER (item->canvas);
gboolean is_rtl;
-#else
- GdkRectangle pixbuf_rect;
- gboolean is_rtl;
-#endif
icon_item = CAJA_ICON_CANVAS_ITEM (item);
details = icon_item->details;
@@ -2351,14 +1868,12 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
return;
}
-#if GTK_CHECK_VERSION(3,0,0)
context = gtk_widget_get_style_context (GTK_WIDGET (container));
gtk_style_context_save (context);
gtk_style_context_add_class (context, "caja-canvas-item");
-#endif
icon_rect = icon_item->details->canvas_rect;
-#if GTK_CHECK_VERSION(3,0,0)
+
temp_pixbuf = map_pixbuf (icon_item);
gtk_render_icon (context, cr,
@@ -2367,26 +1882,6 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
g_object_unref (temp_pixbuf);
draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0);
-#else
- /* if the pre-lit or selection flag is set, make a pre-lit or darkened pixbuf and draw that instead */
- /* and colorize normal pixbuf if rc wants that */
- temp_pixbuf = map_pixbuf (icon_item);
- pixbuf_rect.x = icon_rect.x0;
- pixbuf_rect.y = icon_rect.y0;
- pixbuf_rect.width = gdk_pixbuf_get_width (temp_pixbuf);
- pixbuf_rect.height = gdk_pixbuf_get_height (temp_pixbuf);
-
- cairo_t *cr = gdk_cairo_create (drawable);
- gdk_cairo_rectangle (cr, &expose->area);
- cairo_clip (cr);
- gdk_cairo_set_source_pixbuf (cr, temp_pixbuf, pixbuf_rect.x, pixbuf_rect.y);
- gdk_cairo_rectangle (cr, &pixbuf_rect);
- cairo_fill (cr);
- cairo_destroy (cr);
- g_object_unref (temp_pixbuf);
-
- draw_embedded_text (icon_item, drawable, icon_rect.x0, icon_rect.y0);
-#endif
is_rtl = caja_icon_container_is_layout_rtl (CAJA_ICON_CONTAINER (item->canvas));
@@ -2394,7 +1889,6 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
emblem_layout_reset (&emblem_layout, icon_item, icon_rect, is_rtl);
while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect, is_rtl))
{
-#if GTK_CHECK_VERSION(3,0,0)
draw_pixbuf (emblem_pixbuf, cr, emblem_rect.x0, emblem_rect.y0);
}
@@ -2405,13 +1899,6 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
draw_label_text (icon_item, cr, FALSE, icon_rect);
gtk_style_context_restore (context);
-#else
- draw_pixbuf (emblem_pixbuf, drawable, emblem_rect.x0, emblem_rect.y0);
- }
-
- draw_stretch_handles (icon_item, drawable, &icon_rect);
- draw_label_text (icon_item, drawable, FALSE, icon_rect);
-#endif
}
#define ZERO_WIDTH_SPACE "\xE2\x80\x8B"
@@ -2527,45 +2014,8 @@ get_label_layout (PangoLayout **layout_cache,
return layout;
}
-#if !GTK_CHECK_VERSION(3,0,0)
-static void
-draw_label_layout (CajaIconCanvasItem *item,
- GdkDrawable *drawable,
- PangoLayout *layout,
- gboolean highlight,
- GdkColor *label_color,
- int x,
- int y)
-{
- g_return_if_fail (drawable != NULL);
-
- if (item->details->is_renaming)
- {
- return;
- }
-
- if (!highlight && (CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas)->details->use_drop_shadows))
- {
- /* draw a drop shadow */
- eel_gdk_draw_layout_with_drop_shadow (drawable,
- label_color,
- &gtk_widget_get_style (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas))->black,
- x, y,
- layout);
- }
- else
- {
- cairo_t *cr = gdk_cairo_create (drawable);
- gdk_cairo_set_source_color (cr, label_color);
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, layout);
- cairo_destroy (cr);
- }
-}
-#endif
/* handle events */
-
static int
caja_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
{
@@ -2591,11 +2041,7 @@ caja_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
cursor = gdk_cursor_new_for_display (gdk_display_get_default(),
GDK_HAND2);
gdk_window_set_cursor (((GdkEventAny *)event)->window, cursor);
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
/* FIXME bugzilla.gnome.org 42473:
diff --git a/libcaja-private/caja-icon-canvas-item.h b/libcaja-private/caja-icon-canvas-item.h
index 14b93b63..d6eb4ee5 100644
--- a/libcaja-private/caja-icon-canvas-item.h
+++ b/libcaja-private/caja-icon-canvas-item.h
@@ -74,13 +74,9 @@ extern "C" {
/* attributes */
void caja_icon_canvas_item_set_image (CajaIconCanvasItem *item,
GdkPixbuf *image);
-#if GTK_CHECK_VERSION(3,0,0)
+
cairo_surface_t* caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item);
-#else
- GdkPixmap * caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
- GdkBitmap **mask,
- GdkColormap *colormap);
-#endif
+
void caja_icon_canvas_item_set_emblems (CajaIconCanvasItem *item,
GList *emblem_pixbufs);
void caja_icon_canvas_item_set_show_stretch_handles (CajaIconCanvasItem *item,
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 24114381..e26a7837 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -44,9 +44,7 @@
#include <eel/eel-art-extensions.h>
#include <eel/eel-editable-label.h>
#include <eel/eel-string.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
#include <eel/eel-canvas.h>
-#endif
#include <eel/eel-canvas-rect-ellipse.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -55,20 +53,6 @@
#include <stdio.h>
#include <string.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
-#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
-#define GTK_SCROLLABLE GTK_LAYOUT
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
#define TAB_NAVIGATION_DISABLED
/* Interval for updating the rubberband selection, in milliseconds. */
@@ -127,22 +111,8 @@
#define DEFAULT_HIGHLIGHT_ALPHA 0xff
#define DEFAULT_NORMAL_ALPHA 0xff
#define DEFAULT_PRELIGHT_ALPHA 0xff
-#if GTK_CHECK_VERSION(3,0,0)
#define DEFAULT_LIGHT_INFO_COLOR "#AAAAFD"
#define DEFAULT_DARK_INFO_COLOR "#33337F"
-#else
-#define DEFAULT_LIGHT_INFO_COLOR 0xAAAAFD
-#define DEFAULT_DARK_INFO_COLOR 0x33337F
-
-#define DEFAULT_NORMAL_ICON_RENDER_MODE 0
-#define DEFAULT_PRELIGHT_ICON_RENDER_MODE 1
-#define DEFAULT_NORMAL_ICON_SATURATION 255
-#define DEFAULT_PRELIGHT_ICON_SATURATION 255
-#define DEFAULT_NORMAL_ICON_BRIGHTNESS 255
-#define DEFAULT_PRELIGHT_ICON_BRIGHTNESS 255
-#define DEFAULT_NORMAL_ICON_LIGHTEN 0
-#define DEFAULT_PRELIGHT_ICON_LIGHTEN 0
-#endif
#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20
#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20
@@ -185,7 +155,6 @@ typedef struct
static GType caja_icon_container_accessible_get_type (void);
-#if GTK_CHECK_VERSION(3, 0, 0)
typedef struct _CajaIconContainerAccessible CajaIconContainerAccessible;
typedef struct _CajaIconContainerAccessibleClass CajaIconContainerAccessibleClass;
@@ -198,14 +167,10 @@ struct _CajaIconContainerAccessibleClass
{
EelCanvasAccessibleClass parent_class;
};
-#endif
static void activate_selected_items (CajaIconContainer *container);
static void activate_selected_items_alternate (CajaIconContainer *container,
CajaIcon *icon);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static void caja_icon_container_theme_changed (gpointer user_data);
-#endif
static void compute_stretch (StretchState *start,
StretchState *current);
static CajaIcon *get_first_selected_icon (CajaIconContainer *container);
@@ -231,9 +196,6 @@ static inline void icon_get_bounding_box (CajaIcon
static gboolean is_renaming (CajaIconContainer *container);
static gboolean is_renaming_pending (CajaIconContainer *container);
static void process_pending_icon_to_rename (CajaIconContainer *container);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static void setup_label_gcs (CajaIconContainer *container);
-#endif
static void caja_icon_container_stop_monitor_top_left (CajaIconContainer *container,
CajaIconData *data,
gconstpointer client);
@@ -641,13 +603,8 @@ caja_icon_container_scroll (CajaIconContainer *container,
old_h_value = gtk_adjustment_get_value (hadj);
old_v_value = gtk_adjustment_get_value (vadj);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
-#else
- eel_gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
- eel_gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
-#endif
/* return TRUE if we did scroll */
return gtk_adjustment_get_value (hadj) != old_h_value || gtk_adjustment_get_value (vadj) != old_v_value;
@@ -801,7 +758,6 @@ reveal_icon (CajaIconContainer *container,
item_get_canvas_bounds (EEL_CANVAS_ITEM (icon->item), &bounds, TRUE);
}
if (bounds.y0 < gtk_adjustment_get_value (vadj)) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (vadj, bounds.y0);
} else if (bounds.y1 > gtk_adjustment_get_value (vadj) + allocation.height) {
gtk_adjustment_set_value (vadj, bounds.y1 - allocation.height);
@@ -814,20 +770,6 @@ reveal_icon (CajaIconContainer *container,
gtk_adjustment_set_value (hadj, bounds.x0);
} else {
gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
-#else
- eel_gtk_adjustment_set_value (vadj, bounds.y0);
- } else if (bounds.y1 > gtk_adjustment_get_value (vadj) + allocation.height) {
- eel_gtk_adjustment_set_value (vadj, bounds.y1 - allocation.height);
- }
-
- if (bounds.x0 < gtk_adjustment_get_value (hadj)) {
- eel_gtk_adjustment_set_value (hadj, bounds.x0);
- } else if (bounds.x1 > gtk_adjustment_get_value (hadj) + allocation.width) {
- if (bounds.x1 - allocation.width > bounds.x0) {
- eel_gtk_adjustment_set_value (hadj, bounds.x0);
- } else {
- eel_gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
-#endif
}
}
}
@@ -1268,13 +1210,6 @@ caja_icon_container_update_scroll_region (CajaIconContainer *container)
{
gtk_adjustment_set_step_increment (vadj, step_increment);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* Now that we have a new scroll region, clamp the
- * adjustments so we are within the valid scroll area.
- */
- eel_gtk_adjustment_clamp_value (hadj);
- eel_gtk_adjustment_clamp_value (vadj);
-#endif
}
static int
@@ -2835,14 +2770,12 @@ rubberband_timeout_callback (gpointer data)
gdk_window_get_device_position (gtk_widget_get_window (widget),
gdk_seat_get_pointer (seat),
&x, &y, NULL);
-#elif GTK_CHECK_VERSION (3, 0, 0)
+#else
gdk_window_get_device_position (gtk_widget_get_window (widget),
gdk_device_manager_get_client_pointer (
gdk_display_get_device_manager (
gtk_widget_get_display (widget))),
&x, &y, NULL);
-#else
- gtk_widget_get_pointer (widget, &x, &y);
#endif
if (x < 0)
@@ -2942,7 +2875,6 @@ rubberband_timeout_callback (gpointer data)
return TRUE;
}
-#if GTK_CHECK_VERSION(3,0,0)
/*borrowed from Nemo, makes Caja rubberbanding follow same selectors as Nemo and presumably Nautilus */
static void
start_rubberbanding (CajaIconContainer *container,
@@ -3022,94 +2954,6 @@ start_rubberbanding (CajaIconContainer *container,
#endif
}
-
-#else
-static void
-start_rubberbanding (CajaIconContainer *container,
- GdkEventButton *event)
-{
- AtkObject *accessible;
- CajaIconContainerDetails *details;
- CajaIconRubberbandInfo *band_info;
- guint fill_color, outline_color;
- GdkColor *fill_color_gdk;
- guchar fill_color_alpha;
- GList *p;
- CajaIcon *icon;
- GtkStyle *style;
-
- details = container->details;
- band_info = &details->rubberband_info;
-
- g_signal_emit (container,
- signals[BAND_SELECT_STARTED], 0);
-
- for (p = details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
- icon->was_selected_before_rubberband = icon->is_selected;
- }
-
- eel_canvas_window_to_world
- (EEL_CANVAS (container), event->x, event->y,
- &band_info->start_x, &band_info->start_y);
-
- gtk_widget_style_get (GTK_WIDGET (container),
- "selection_box_color", &fill_color_gdk,
- "selection_box_alpha", &fill_color_alpha,
- NULL);
-
- if (!fill_color_gdk)
- {
- style = gtk_widget_get_style (GTK_WIDGET (container));
- fill_color_gdk = gdk_color_copy (&style->base[GTK_STATE_SELECTED]);
- }
-
- fill_color = eel_gdk_color_to_rgb (fill_color_gdk) << 8 | fill_color_alpha;
-
- gdk_color_free (fill_color_gdk);
-
- outline_color = fill_color | 255;
-
- band_info->selection_rectangle = eel_canvas_item_new
- (eel_canvas_root
- (EEL_CANVAS (container)),
- EEL_TYPE_CANVAS_RECT,
- "x1", band_info->start_x,
- "y1", band_info->start_y,
- "x2", band_info->start_x,
- "y2", band_info->start_y,
- "fill_color_rgba", fill_color,
- "outline_color_rgba", outline_color,
- "width_pixels", 1,
- NULL);
-
- accessible = atk_gobject_accessible_for_object
- (G_OBJECT (band_info->selection_rectangle));
- atk_object_set_name (accessible, "selection");
- atk_object_set_description (accessible, _("The selection rectangle"));
-
- band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
- band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
-
- band_info->active = TRUE;
-
- if (band_info->timer_id == 0)
- {
- band_info->timer_id = g_timeout_add
- (RUBBERBAND_TIMEOUT_INTERVAL,
- rubberband_timeout_callback,
- container);
- }
-
- eel_canvas_item_grab (band_info->selection_rectangle,
- (GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_SCROLL_MASK),
- NULL, event->time);
-}
-#endif
-
static void
#if GTK_CHECK_VERSION(3, 20, 0)
stop_rubberbanding (CajaIconContainer *container)
@@ -4525,11 +4369,7 @@ select_previous_or_next_icon (CajaIconContainer *container,
#endif
static void
-#if GTK_CHECK_VERSION(3, 0, 0)
destroy (GtkWidget *object)
-#else
-destroy (GtkObject *object)
-#endif
{
CajaIconContainer *container;
@@ -4586,11 +4426,7 @@ destroy (GtkObject *object)
}
}
-#if GTK_CHECK_VERSION(3, 0, 0)
GTK_WIDGET_CLASS (caja_icon_container_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (caja_icon_container_parent_class)->destroy (object);
-#endif
}
static void
@@ -4717,11 +4553,7 @@ realize (GtkWidget *widget)
set on it is drawn by X. */
if (container->details->is_desktop)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_x11_window_get_xid (gtk_layout_get_bin_window (GTK_LAYOUT (widget)));
-#else
- gdk_x11_drawable_get_xid (gtk_layout_get_bin_window (GTK_LAYOUT (widget)));
-#endif
}
#endif
/* Set up DnD. */
@@ -4756,7 +4588,6 @@ unrealize (GtkWidget *widget)
}
static void
-#if GTK_CHECK_VERSION(3,0,0)
style_updated (GtkWidget *widget)
{
CajaIconContainer *container;
@@ -4776,32 +4607,6 @@ style_updated (GtkWidget *widget)
invalidate_labels (container);
caja_icon_container_request_update_all (container);
}
-#else
-style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- CajaIconContainer *container;
- gboolean frame_text;
-
- container = CAJA_ICON_CONTAINER (widget);
-
- gtk_widget_style_get (GTK_WIDGET (container),
- "frame_text", &frame_text,
- NULL);
-
- container->details->use_drop_shadows = container->details->drop_shadows_requested && !frame_text;
-
- caja_icon_container_theme_changed (CAJA_ICON_CONTAINER (widget));
-
- if (gtk_widget_get_realized (widget))
- {
- invalidate_label_sizes (container);
- caja_icon_container_request_update_all (container);
- }
-
- /* Don't chain up to parent, because that sets the background of the window and we're doing
- that ourself with some delay, so this would cause flickering */
-#endif
}
static gboolean
@@ -4815,9 +4620,6 @@ button_press_event (GtkWidget *widget,
container = CAJA_ICON_CONTAINER (widget);
container->details->button_down_time = event->time;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- clicked_on_icon = FALSE;
-#endif
/* Forget about the old keyboard selection now that we've started mousing. */
clear_keyboard_focus (container);
@@ -4829,15 +4631,8 @@ button_press_event (GtkWidget *widget,
return TRUE;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
/* Invoke the canvas event handler and see if an item picks up the event. */
clicked_on_icon = GTK_WIDGET_CLASS (caja_icon_container_parent_class)->button_press_event (widget, event);
-#else
- if (event->button < 6) { /* Don't let the eel canvas consume extra button events, see gnome bug 660006 */
- /* Invoke the canvas event handler and see if an item picks up the event. */
- clicked_on_icon = GTK_WIDGET_CLASS (caja_icon_container_parent_class)->button_press_event (widget, event);
- }
-#endif
/* Move focus to icon container, unless we're still renaming (to avoid exiting
* renaming mode)
@@ -5115,11 +4910,7 @@ start_stretching (CajaIconContainer *container)
GDK_CURRENT_TIME);
#endif
if (cursor)
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
/* Ensure the window itself is focused.. */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
@@ -5959,7 +5750,7 @@ caja_icon_container_ensure_interactive_directory (CajaIconContainer *container)
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (container->details->search_window), frame);
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
@@ -6302,49 +6093,12 @@ popup_menu (GtkWidget *widget)
#if !GTK_CHECK_VERSION(3, 21, 0)
static void
draw_canvas_background (EelCanvas *canvas,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr)
-#else
- int x, int y, int width, int height)
-#endif
{
/* Don't chain up to the parent to avoid clearing and redrawing */
}
#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
-static gboolean
-expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- /* g_warning ("Expose Icon Container %p '%d,%d: %d,%d'",
- widget,
- event->area.x, event->area.y,
- event->area.width, event->area.height); */
-
- return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->expose_event (widget, event);
-}
-#endif
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static AtkObject *
-get_accessible (GtkWidget *widget)
-{
- AtkObject *accessible;
-
- if ((accessible = eel_accessibility_get_atk_object (widget)))
- {
- return accessible;
- }
-
- accessible = g_object_new
- (caja_icon_container_accessible_get_type (), NULL);
-
- return eel_accessibility_set_atk_object_return (widget, accessible);
-}
-#endif
-
static void
grab_notify_cb (GtkWidget *widget,
gboolean was_grabbed)
@@ -6424,11 +6178,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
G_OBJECT_CLASS (class)->constructor = caja_icon_container_constructor;
G_OBJECT_CLASS (class)->finalize = finalize;
-#if GTK_CHECK_VERSION(3, 0, 0)
GTK_WIDGET_CLASS (class)->destroy = destroy;
-#else
- GTK_OBJECT_CLASS (class)->destroy = destroy;
-#endif
/* Signals. */
@@ -6787,26 +6537,17 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
widget_class->motion_notify_event = motion_notify_event;
widget_class->key_press_event = key_press_event;
widget_class->popup_menu = popup_menu;
-#if GTK_CHECK_VERSION(3,2,0)
- gtk_widget_class_set_accessible_type (widget_class, caja_icon_container_accessible_get_type ());
-#else
- widget_class->get_accessible = get_accessible;
-#endif
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->style_updated = style_updated;
-#else
- widget_class->style_set = style_set;
- widget_class->expose_event = expose_event;
-#endif
widget_class->grab_notify = grab_notify_cb;
+ gtk_widget_class_set_accessible_type (widget_class, caja_icon_container_accessible_get_type ());
+
canvas_class = EEL_CANVAS_CLASS (class);
#if !GTK_CHECK_VERSION(3, 21, 0)
canvas_class->draw_background = draw_canvas_background;
#endif
class->start_interactive_search = caja_icon_container_start_interactive_search;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("selection_box_rgba",
"Selection Box RGBA",
@@ -6825,130 +6566,6 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
"Color used for information text against a light background",
GDK_TYPE_RGBA,
G_PARAM_READABLE));
-#else
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boolean ("frame_text",
- "Frame Text",
- "Draw a frame around unselected text",
- FALSE,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("selection_box_color",
- "Selection Box Color",
- "Color of the selection box",
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uchar ("selection_box_alpha",
- "Selection Box Alpha",
- "Opacity of the selection box",
- 0, 0xff,
- DEFAULT_SELECTION_BOX_ALPHA,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uchar ("highlight_alpha",
- "Highlight Alpha",
- "Opacity of the highlight for selected icons",
- 0, 0xff,
- DEFAULT_HIGHLIGHT_ALPHA,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uchar ("normal_alpha",
- "Normal Alpha",
- "Opacity of the normal icons if frame_text is set",
- 0, 0xff,
- DEFAULT_NORMAL_ALPHA,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uchar ("prelight_alpha",
- "Prelight Alpha",
- "Opacity of the prelight icons if frame_text is set",
- 0, 0xff,
- DEFAULT_PRELIGHT_ALPHA,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("light_info_color",
- "Light Info Color",
- "Color used for information text against a dark background",
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("dark_info_color",
- "Dark Info Color",
- "Color used for information text against a light background",
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("normal_icon_render_mode",
- "Normal Icon Render Mode",
- "Mode of normal icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
- 0, 3,
- DEFAULT_NORMAL_ICON_RENDER_MODE,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("prelight_icon_render_mode",
- "Prelight Icon Render Mode",
- "Mode of prelight icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
- 0, 3,
- DEFAULT_PRELIGHT_ICON_RENDER_MODE,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("normal_icon_color",
- "Icon Normal Color",
- "Color used for colorizing icons in normal state (default base[NORMAL])",
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("prelight_icon_color",
- "Icon Prelight Color",
- "Color used for colorizing prelighted icons (default base[PRELIGHT])",
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("normal_icon_saturation",
- "Normal Icon Saturation",
- "Saturation of icons in normal state",
- 0, 255,
- DEFAULT_NORMAL_ICON_SATURATION,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("prelight_icon_saturation",
- "Prelight Icon Saturation",
- "Saturation of icons in prelight state",
- 0, 255,
- DEFAULT_PRELIGHT_ICON_SATURATION,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("normal_icon_brightness",
- "Normal Icon Brightness",
- "Brightness of icons in normal state",
- 0, 255,
- DEFAULT_NORMAL_ICON_BRIGHTNESS,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("prelight_icon_brightness",
- "Prelight Icon Brightness",
- "Brightness of icons in prelight state",
- 0, 255,
- DEFAULT_PRELIGHT_ICON_BRIGHTNESS,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("normal_icon_lighten",
- "Normal Icon Lighten",
- "Lighten icons in normal state",
- 0, 255,
- DEFAULT_NORMAL_ICON_LIGHTEN,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_uint ("prelight_icon_lighten",
- "Prelight Icon Lighten",
- "Lighten icons in prelight state",
- 0, 255,
- DEFAULT_PRELIGHT_ICON_LIGHTEN,
- G_PARAM_READABLE));
-#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("activate_prelight_icon_label",
"Activate Prelight Icon Label",
@@ -7114,11 +6731,6 @@ caja_icon_container_init (CajaIconContainer *container)
/* when the background changes, we must set up the label text color */
background = eel_get_widget_background (GTK_WIDGET (container));
-#if !GTK_CHECK_VERSION(3,0,0)
- g_signal_connect_object (background, "appearance_changed",
- G_CALLBACK (update_label_color), container, 0);
-#endif
-
g_signal_connect (container, "focus-in-event",
G_CALLBACK (handle_focus_in_event), NULL);
g_signal_connect (container, "focus-out-event",
@@ -7126,11 +6738,6 @@ caja_icon_container_init (CajaIconContainer *container)
eel_background_set_use_base (background, TRUE);
-#if !GTK_CHECK_VERSION(3,0,0)
- /* read in theme-dependent data */
- caja_icon_container_theme_changed (container);
-#endif
-
if (!setup_prefs)
{
g_signal_connect_swapped (caja_icon_view_preferences,
@@ -7536,21 +7143,12 @@ caja_icon_container_scroll_to_icon (CajaIconContainer *container,
if (caja_icon_container_is_layout_vertical (container)) {
if (caja_icon_container_is_layout_rtl (container)) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
} else {
gtk_adjustment_set_value (hadj, bounds.x0);
}
} else {
gtk_adjustment_set_value (vadj, bounds.y0);
-#else
- eel_gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
- } else {
- eel_gtk_adjustment_set_value (hadj, bounds.x0);
- }
- } else {
- eel_gtk_adjustment_set_value (vadj, bounds.y0);
-#endif
}
}
@@ -9366,14 +8964,10 @@ caja_icon_container_start_renaming_selected_item (CajaIconContainer *container,
eel_editable_label_set_justify (EEL_EDITABLE_LABEL (details->rename_widget), GTK_JUSTIFY_CENTER);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_margin_start (details->rename_widget, 1);
gtk_widget_set_margin_end (details->rename_widget, 1);
gtk_widget_set_margin_top (details->rename_widget, 1);
gtk_widget_set_margin_bottom (details->rename_widget, 1);
-#else
- gtk_misc_set_padding (GTK_MISC (details->rename_widget), 1, 1);
-#endif
gtk_layout_put (GTK_LAYOUT (container),
details->rename_widget, 0, 0);
}
@@ -9442,21 +9036,12 @@ caja_icon_container_start_renaming_selected_item (CajaIconContainer *container,
{
eel_filename_get_rename_region (editable_text, &start_offset, &end_offset);
}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show (details->rename_widget);
gtk_widget_grab_focus (details->rename_widget);
-#endif
eel_editable_label_select_region (EEL_EDITABLE_LABEL (details->rename_widget),
start_offset,
end_offset);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_show (details->rename_widget);
- gtk_widget_grab_focus (details->rename_widget);
-#endif
-
g_signal_emit (container,
signals[RENAMING_ICON], 0,
GTK_EDITABLE (details->rename_widget));
@@ -9571,174 +9156,6 @@ caja_icon_container_set_single_click_mode (CajaIconContainer *container,
container->details->single_click_mode = single_click_mode;
}
-#if !GTK_CHECK_VERSION(3,0,0)
-/* update the label color when the background changes */
-
-void
-caja_icon_container_get_label_color (CajaIconContainer *container,
- GdkColor **color,
- gboolean is_name,
- gboolean is_highlight,
- gboolean is_prelit)
-{
- int idx;
-
- if (is_name)
- {
- if (is_highlight)
- {
- if (gtk_widget_has_focus (GTK_WIDGET (container)))
- {
- idx = LABEL_COLOR_HIGHLIGHT;
- }
- else
- {
- idx = LABEL_COLOR_ACTIVE;
- }
- }
- else
- {
- if (is_prelit)
- {
- idx = LABEL_COLOR_PRELIGHT;
- }
- else
- {
- idx = LABEL_COLOR;
- }
- }
- }
- else
- {
- if (is_highlight)
- {
- if (gtk_widget_has_focus (GTK_WIDGET (container)))
- {
- idx = LABEL_INFO_COLOR_HIGHLIGHT;
- }
- else
- {
- idx = LABEL_INFO_COLOR_ACTIVE;
- }
- }
- else
- {
- idx = LABEL_INFO_COLOR;
- }
- }
-
- if (color)
- {
- *color = &container->details->label_colors [idx];
- }
-}
-
-static void
-setup_gc_with_fg (CajaIconContainer *container, int idx, guint32 color)
-{
- container->details->label_colors [idx] = eel_gdk_rgb_to_color (color);
-}
-
-static void
-setup_label_gcs (CajaIconContainer *container)
-{
- EelBackground *background;
- GtkWidget *widget;
- GdkColor *light_info_color, *dark_info_color;
- guint light_info_value, dark_info_value;
- gboolean frame_text;
- GtkStyle *style;
-
- if (!gtk_widget_get_realized (GTK_WIDGET (container)))
- return;
-
- widget = GTK_WIDGET (container);
-
- g_assert (CAJA_IS_ICON_CONTAINER (container));
-
- background = eel_get_widget_background (GTK_WIDGET (container));
-
- /* read the info colors from the current theme; use a reasonable default if undefined */
- gtk_widget_style_get (GTK_WIDGET (container),
- "light_info_color", &light_info_color,
- "dark_info_color", &dark_info_color,
- NULL);
- style = gtk_widget_get_style (widget);
-
- if (light_info_color)
- {
- light_info_value = eel_gdk_color_to_rgb (light_info_color);
- gdk_color_free (light_info_color);
- }
- else
- {
- light_info_value = DEFAULT_LIGHT_INFO_COLOR;
- }
-
- if (dark_info_color)
- {
- dark_info_value = eel_gdk_color_to_rgb (dark_info_color);
- gdk_color_free (dark_info_color);
- }
- else
- {
- dark_info_value = DEFAULT_DARK_INFO_COLOR;
- }
-
- setup_gc_with_fg (container, LABEL_COLOR_HIGHLIGHT, eel_gdk_color_to_rgb (&style->text[GTK_STATE_SELECTED]));
- setup_gc_with_fg (container, LABEL_COLOR_ACTIVE, eel_gdk_color_to_rgb (&style->text[GTK_STATE_ACTIVE]));
- setup_gc_with_fg (container, LABEL_COLOR_PRELIGHT, eel_gdk_color_to_rgb (&style->text[GTK_STATE_PRELIGHT]));
- setup_gc_with_fg (container,
- LABEL_INFO_COLOR_HIGHLIGHT,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_SELECTED]) ? light_info_value : dark_info_value);
- setup_gc_with_fg (container,
- LABEL_INFO_COLOR_ACTIVE,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_ACTIVE]) ? light_info_value : dark_info_value);
-
- /* If CajaIconContainer::frame_text is set, we can safely
- * use the foreground color from the theme, because it will
- * always be displayed against the gtk background */
- gtk_widget_style_get (widget,
- "frame_text", &frame_text,
- NULL);
-
- if (frame_text || !eel_background_is_set (background))
- {
- setup_gc_with_fg (container, LABEL_COLOR,
- eel_gdk_color_to_rgb (&style->text[GTK_STATE_NORMAL]));
- setup_gc_with_fg (container,
- LABEL_INFO_COLOR,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_NORMAL]) ? light_info_value : dark_info_value);
- }
- else
- {
- if (container->details->use_drop_shadows || eel_background_is_dark (background))
- {
- setup_gc_with_fg (container, LABEL_COLOR, 0xEFEFEF);
- setup_gc_with_fg (container,
- LABEL_INFO_COLOR,
- light_info_value);
- }
- else /* converse */
- {
- setup_gc_with_fg (container, LABEL_COLOR, 0x000000);
- setup_gc_with_fg (container,
- LABEL_INFO_COLOR,
- dark_info_value);
- }
- }
-}
-
-static void
-update_label_color (EelBackground *background,
- CajaIconContainer *container)
-{
- g_assert (EEL_IS_BACKGROUND (background));
-
- setup_label_gcs (container);
-}
-#endif
-
/* Return if the icon container is a fixed size */
gboolean
caja_icon_container_get_is_fixed_size (CajaIconContainer *container)
@@ -9774,14 +9191,12 @@ caja_icon_container_set_is_desktop (CajaIconContainer *container,
container->details->is_desktop = is_desktop;
-#if GTK_CHECK_VERSION (3, 0, 0)
if (is_desktop) {
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (container));
gtk_style_context_add_class (context, "caja-desktop");
}
-#endif
}
void
@@ -9806,132 +9221,19 @@ void
caja_icon_container_set_use_drop_shadows (CajaIconContainer *container,
gboolean use_drop_shadows)
{
-#if !GTK_CHECK_VERSION(3,0,0)
- gboolean frame_text;
-
- gtk_widget_style_get (GTK_WIDGET (container),
- "frame_text", &frame_text,
- NULL);
-#endif
-
if (container->details->drop_shadows_requested == use_drop_shadows)
{
return;
}
container->details->drop_shadows_requested = use_drop_shadows;
-#if GTK_CHECK_VERSION(3,0,0)
container->details->use_drop_shadows = use_drop_shadows;
-#else
- container->details->use_drop_shadows = use_drop_shadows && !frame_text;
-#endif
+
gtk_widget_queue_draw (GTK_WIDGET (container));
}
/* handle theme changes */
-#if !GTK_CHECK_VERSION(3,0,0)
-static void
-caja_icon_container_theme_changed (gpointer user_data)
-{
- CajaIconContainer *container;
- GtkStyle *style;
- GdkColor *prelight_icon_color, *normal_icon_color;
- guchar highlight_alpha, normal_alpha, prelight_alpha;
-
- container = CAJA_ICON_CONTAINER (user_data);
-
- /* load the highlight color */
- gtk_widget_style_get (GTK_WIDGET (container),
- "highlight_alpha", &highlight_alpha,
- NULL);
-
- style = gtk_widget_get_style (GTK_WIDGET (container));
-
- container->details->highlight_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_SELECTED].red >> 8,
- style->base[GTK_STATE_SELECTED].green >> 8,
- style->base[GTK_STATE_SELECTED].blue >> 8,
- highlight_alpha);
- container->details->active_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_ACTIVE].red >> 8,
- style->base[GTK_STATE_ACTIVE].green >> 8,
- style->base[GTK_STATE_ACTIVE].blue >> 8,
- highlight_alpha);
-
- /* load the prelight icon color */
- gtk_widget_style_get (GTK_WIDGET (container),
- "prelight_icon_color", &prelight_icon_color,
- NULL);
-
- if (prelight_icon_color)
- {
- container->details->prelight_icon_color_rgba =
- EEL_RGBA_COLOR_PACK (prelight_icon_color->red >> 8,
- prelight_icon_color->green >> 8,
- prelight_icon_color->blue >> 8,
- 255);
- }
- else /* if not defined by rc, set to default value */
- {
- container->details->prelight_icon_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8,
- style->base[GTK_STATE_PRELIGHT].green >> 8,
- style->base[GTK_STATE_PRELIGHT].blue >> 8,
- 255);
- }
-
-
- /* load the normal icon color */
- gtk_widget_style_get (GTK_WIDGET (container),
- "normal_icon_color", &normal_icon_color,
- NULL);
-
- if (normal_icon_color)
- {
- container->details->normal_icon_color_rgba =
- EEL_RGBA_COLOR_PACK (normal_icon_color->red >> 8,
- normal_icon_color->green >> 8,
- normal_icon_color->blue >> 8,
- 255);
- }
- else /* if not defined by rc, set to default value */
- {
- container->details->normal_icon_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8,
- style->base[GTK_STATE_NORMAL].green >> 8,
- style->base[GTK_STATE_NORMAL].blue >> 8,
- 255);
- }
-
-
- /* load the normal color */
- gtk_widget_style_get (GTK_WIDGET (container),
- "normal_alpha", &normal_alpha,
- NULL);
-
- container->details->normal_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8,
- style->base[GTK_STATE_NORMAL].green >> 8,
- style->base[GTK_STATE_NORMAL].blue >> 8,
- normal_alpha);
-
-
- /* load the prelight color */
- gtk_widget_style_get (GTK_WIDGET (container),
- "prelight_alpha", &prelight_alpha,
- NULL);
-
- container->details->prelight_color_rgba =
- EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8,
- style->base[GTK_STATE_PRELIGHT].green >> 8,
- style->base[GTK_STATE_PRELIGHT].blue >> 8,
- prelight_alpha);
-
- setup_label_gcs (container);
-}
-#endif
-
void
caja_icon_container_set_font (CajaIconContainer *container,
const char *font)
@@ -10625,7 +9927,6 @@ caja_icon_container_accessible_finalize (GObject *object)
G_OBJECT_CLASS (accessible_parent_class)->finalize (object);
}
-#if GTK_CHECK_VERSION(3,2,0)
static void
caja_icon_container_accessible_init (CajaIconContainerAccessible *accessible)
{
@@ -10656,59 +9957,6 @@ G_DEFINE_TYPE_WITH_CODE (CajaIconContainerAccessible,
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION,
caja_icon_container_accessible_selection_interface_init));
-#else
-static void
-caja_icon_container_accessible_class_init (AtkObjectClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- accessible_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = caja_icon_container_accessible_finalize;
-
- klass->get_n_children = caja_icon_container_accessible_get_n_children;
- klass->ref_child = caja_icon_container_accessible_ref_child;
- klass->initialize = caja_icon_container_accessible_initialize;
-
- accessible_private_data_quark = g_quark_from_static_string ("icon-container-accessible-private-data");
-}
-
-static GType
-caja_icon_container_accessible_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static GInterfaceInfo atk_action_info =
- {
- (GInterfaceInitFunc) caja_icon_container_accessible_action_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- static GInterfaceInfo atk_selection_info =
- {
- (GInterfaceInitFunc) caja_icon_container_accessible_selection_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- type = eel_accessibility_create_derived_type
- ("CajaIconContainerAccessible",
- EEL_TYPE_CANVAS,
- caja_icon_container_accessible_class_init);
-
- g_type_add_interface_static (type, ATK_TYPE_ACTION,
- &atk_action_info);
- g_type_add_interface_static (type, ATK_TYPE_SELECTION,
- &atk_selection_info);
- }
-
- return type;
-}
-#endif
-
#if ! defined (CAJA_OMIT_SELF_CHECK)
static char *
diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c
index a58a6a87..ad5249b5 100644
--- a/libcaja-private/caja-icon-dnd.c
+++ b/libcaja-private/caja-icon-dnd.c
@@ -60,12 +60,6 @@
#include <stdio.h>
#include <string.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
-#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
-#define GTK_SCROLLABLE GTK_LAYOUT
-#endif
-
static const GtkTargetEntry drag_types [] =
{
{ CAJA_ICON_DND_MATE_ICON_LIST_TYPE, 0, CAJA_ICON_DND_MATE_ICON_LIST },
@@ -144,9 +138,7 @@ create_selection_shadow (CajaIconContainer *container,
{
CajaDragSelectionItem *item;
int x1, y1, x2, y2;
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA black = { 0, 0, 0, 1 };
-#endif
item = p->data;
@@ -168,11 +160,7 @@ create_selection_shadow (CajaIconContainer *container,
"y1", (double) y1,
"x2", (double) x2,
"y2", (double) y2,
-#if GTK_CHECK_VERSION(3,0,0)
"outline-color-rgba", &black,
-#else
- "outline_color", "black",
-#endif
"outline-stippling", TRUE,
"width_pixels", 1,
NULL);
@@ -1507,44 +1495,20 @@ drag_begin_callback (GtkWidget *widget,
gpointer data)
{
CajaIconContainer *container;
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t *surface;
-#else
- GdkScreen *screen = gtk_widget_get_screen (widget);
- GdkColormap *colormap = NULL;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- gboolean use_mask = FALSE;
-#endif
double x1, y1, x2, y2, winx, winy;
int x_offset, y_offset;
int start_x, start_y;
container = CAJA_ICON_CONTAINER (widget);
-#if !GTK_CHECK_VERSION(3,0,0)
- if (gdk_screen_is_composited (screen))
- colormap = gdk_screen_get_rgba_colormap (screen);
-
- /* Fall back on using the same colormap as the widget */
- if (colormap == NULL)
- {
- colormap = gtk_widget_get_colormap (widget);
- use_mask = TRUE;
- }
-#endif
-
start_x = container->details->dnd_info->drag_info.start_x +
gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
start_y = container->details->dnd_info->drag_info.start_y +
gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
/* create a pixmap and mask to drag with */
-#if GTK_CHECK_VERSION(3,0,0)
surface = caja_icon_canvas_item_get_drag_surface (container->details->drag_icon->item);
-#else
- pixmap = caja_icon_canvas_item_get_image (container->details->drag_icon->item, &mask, colormap);
-#endif
/* compute the image's offset */
eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (container->details->drag_icon->item),
@@ -1554,25 +1518,9 @@ drag_begin_callback (GtkWidget *widget,
x_offset = start_x - winx;
y_offset = start_y - winy;
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_set_device_offset (surface, -x_offset, -y_offset);
gtk_drag_set_icon_surface (context, surface);
cairo_surface_destroy (surface);
-#else
- if (!use_mask && pixmap != NULL)
- {
- /* If composite works, make the icons partially transparent */
- cairo_t *cr = gdk_cairo_create (pixmap);
- cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OUT);
- cairo_set_source_rgba(cr, 1,0,0,0.35);
- cairo_paint (cr);
- cairo_destroy (cr);
- }
-
- gtk_drag_set_icon_pixmap (context, colormap,
- pixmap, (use_mask ? mask : NULL),
- x_offset, y_offset);
-#endif
}
void
@@ -1600,7 +1548,6 @@ caja_icon_dnd_begin_drag (CajaIconContainer *container,
gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
/* start the drag */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_drag_begin_with_coordinates (GTK_WIDGET (container),
dnd_info->drag_info.target_list,
actions,
@@ -1608,45 +1555,21 @@ caja_icon_dnd_begin_drag (CajaIconContainer *container,
(GdkEvent *) event,
dnd_info->drag_info.start_x,
dnd_info->drag_info.start_y);
-#else
- gtk_drag_begin (GTK_WIDGET (container),
- dnd_info->drag_info.target_list,
- actions,
- button,
- (GdkEvent *) event);
-#endif
}
static gboolean
-#if GTK_CHECK_VERSION(3,0,0)
drag_highlight_draw (GtkWidget *widget,
cairo_t *cr,
gpointer user_data)
-#else
-drag_highlight_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
-#if GTK_CHECK_VERSION(3,0,0)
gint width, height;
GdkWindow *window;
GtkStyleContext *style;
-#else
- gint x, y, width, height;
- GdkWindow *window;
-#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
- x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget)));
- y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)));
-#endif
window = gtk_widget_get_window (widget);
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
style = gtk_widget_get_style_context (widget);
gtk_style_context_save (style);
@@ -1658,27 +1581,12 @@ drag_highlight_expose (GtkWidget *widget,
0, 0, width, height);
gtk_style_context_restore (style);
-#else
- gtk_paint_shadow (gtk_widget_get_style (widget), window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, widget, "dnd",
- x, y, width, height);
-
- cairo_t *cr = gdk_cairo_create (window);
-#endif
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgb (cr, 0, 0, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
-#else
- cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1);
-#endif
- cairo_stroke (cr);
-#if !GTK_CHECK_VERSION(3,0,0)
- cairo_destroy (cr);
-#endif
+ cairo_stroke (cr);
return FALSE;
}
@@ -1736,13 +1644,8 @@ start_dnd_highlight (GtkWidget *widget)
if (!dnd_info->highlighted)
{
dnd_info->highlighted = TRUE;
-#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect_after (widget, "draw",
G_CALLBACK (drag_highlight_draw),
-#else
- g_signal_connect_after (widget, "expose_event",
- G_CALLBACK (drag_highlight_expose),
-#endif
NULL);
dnd_highlight_queue_redraw (widget);
}
@@ -1758,11 +1661,7 @@ stop_dnd_highlight (GtkWidget *widget)
if (dnd_info->highlighted)
{
g_signal_handlers_disconnect_by_func (widget,
-#if GTK_CHECK_VERSION(3,0,0)
drag_highlight_draw,
-#else
- drag_highlight_expose,
-#endif
NULL);
dnd_highlight_queue_redraw (widget);
dnd_info->highlighted = FALSE;
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c
index 38e49798..3cb90c54 100644
--- a/libcaja-private/caja-icon-info.c
+++ b/libcaja-private/caja-icon-info.c
@@ -426,11 +426,7 @@ caja_icon_info_lookup (GIcon *icon,
filename = gtk_icon_info_get_filename (gtkicon_info);
if (filename == NULL) {
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (gtkicon_info);
-#else
- gtk_icon_info_free (gtkicon_info);
-#endif
return caja_icon_info_new_for_pixbuf (NULL);
}
@@ -440,11 +436,7 @@ caja_icon_info_lookup (GIcon *icon,
icon_info = g_hash_table_lookup (themed_icon_cache, &lookup_key);
if (icon_info)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (gtkicon_info);
-#else
- gtk_icon_info_free (gtkicon_info);
-#endif
return g_object_ref (icon_info);
}
@@ -453,11 +445,7 @@ caja_icon_info_lookup (GIcon *icon,
key = themed_icon_key_new (filename, size);
g_hash_table_insert (themed_icon_cache, key, icon_info);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (gtkicon_info);
-#else
- gtk_icon_info_free (gtkicon_info);
-#endif
return g_object_ref (icon_info);
}
@@ -473,11 +461,7 @@ caja_icon_info_lookup (GIcon *icon,
if (gtk_icon_info != NULL)
{
pixbuf = gtk_icon_info_load_icon (gtk_icon_info, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (gtk_icon_info);
-#else
- gtk_icon_info_free (gtk_icon_info);
-#endif
}
else
{
diff --git a/libcaja-private/caja-icon-private.h b/libcaja-private/caja-icon-private.h
index 9364bab7..de74cba4 100644
--- a/libcaja-private/caja-icon-private.h
+++ b/libcaja-private/caja-icon-private.h
@@ -210,19 +210,6 @@ struct CajaIconContainerDetails
/* font sizes used to draw labels */
int font_size_table[CAJA_ZOOM_LEVEL_LARGEST + 1];
- /* pixbuf and color for label highlighting */
-#if !GTK_CHECK_VERSION(3,0,0)
- guint32 highlight_color_rgba;
- guint32 active_color_rgba;
- guint32 normal_color_rgba;
- guint32 prelight_color_rgba;
- guint32 prelight_icon_color_rgba;
- guint32 normal_icon_color_rgba;
-
- /* colors for text labels */
- GdkColor label_colors [LAST_LABEL_COLOR];
-#endif
-
/* State used so arrow keys don't wander if icons aren't lined up.
*/
int arrow_key_start_x;
@@ -327,13 +314,6 @@ gboolean caja_icon_container_scroll (CajaIconContainer
int delta_y);
void caja_icon_container_update_scroll_region (CajaIconContainer *container);
-#if !GTK_CHECK_VERSION(3,0,0)
-/* label color for items */
-void caja_icon_container_get_label_color (CajaIconContainer *container,
- GdkColor **color,
- gboolean first_line,
- gboolean needs_highlight,
- gboolean is_prelit);
-#endif
+
#endif /* CAJA_ICON_CONTAINER_PRIVATE_H */
diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c
index e452c229..bbb218eb 100644
--- a/libcaja-private/caja-mime-application-chooser.c
+++ b/libcaja-private/caja-mime-application-chooser.c
@@ -70,11 +70,7 @@ enum
NUM_COLUMNS
};
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaMimeApplicationChooser, caja_mime_application_chooser, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE (CajaMimeApplicationChooser, caja_mime_application_chooser, GTK_TYPE_VBOX);
-#endif
static void refresh_model (CajaMimeApplicationChooser *chooser);
static void refresh_model_soon (CajaMimeApplicationChooser *chooser);
@@ -380,9 +376,9 @@ caja_mime_application_chooser_init (CajaMimeApplicationChooser *chooser)
chooser->details = g_new0 (CajaMimeApplicationChooserDetails, 1);
chooser->details->for_multiple_files = FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL);
-#endif
+
gtk_container_set_border_width (GTK_CONTAINER (chooser), 8);
gtk_box_set_spacing (GTK_BOX (chooser), 0);
gtk_box_set_homogeneous (GTK_BOX (chooser), FALSE);
@@ -418,11 +414,7 @@ caja_mime_application_chooser_init (CajaMimeApplicationChooser *chooser)
gtk_container_add (GTK_CONTAINER (scrolled),
chooser->details->treeview);
-#if GTK_CHECK_VERSION(3, 0, 0)
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- box = gtk_hbutton_box_new ();
-#endif
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_END);
gtk_box_pack_start (GTK_BOX (chooser), box, FALSE, FALSE, 6);
diff --git a/libcaja-private/caja-mime-application-chooser.h b/libcaja-private/caja-mime-application-chooser.h
index 65d455a9..1fea609a 100644
--- a/libcaja-private/caja-mime-application-chooser.h
+++ b/libcaja-private/caja-mime-application-chooser.h
@@ -39,21 +39,13 @@ typedef struct _CajaMimeApplicationChooserDetails CajaMimeApplicationChooserDeta
struct _CajaMimeApplicationChooser
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkVBox parent;
-#endif
CajaMimeApplicationChooserDetails *details;
};
struct _CajaMimeApplicationChooserClass
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
};
GType caja_mime_application_chooser_get_type (void);
diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c
index b9967f6f..6208cb59 100644
--- a/libcaja-private/caja-open-with-dialog.c
+++ b/libcaja-private/caja-open-with-dialog.c
@@ -39,11 +39,6 @@
#define sure_string(s) ((const char *)((s)!=NULL?(s):""))
#define DESKTOP_ENTRY_GROUP "Desktop Entry"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
struct _CajaOpenWithDialogDetails
{
GAppInfo *selected_app_info;
@@ -836,9 +831,6 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog)
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *label;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkWidget *align;
-#endif
GtkWidget *scrolled_window;
GtkWidget *expander;
GtkTreeSelection *selection;
@@ -852,10 +844,10 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog)
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- vbox2 = gtk_vbox_new (FALSE, 6);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, TRUE, TRUE, 0);
dialog->details->label = gtk_label_new ("");
@@ -920,7 +912,7 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog)
gtk_widget_show (expander);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (expander), hbox);
gtk_widget_show (hbox);
@@ -964,7 +956,7 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog)
g_signal_connect (G_OBJECT (dialog->details->entry), "changed",
G_CALLBACK (entry_changed_cb), dialog);
- hbox = gtk_hbox_new (FALSE, 2);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic (_("_Open"));
@@ -974,21 +966,10 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_widget_show (align);
-#endif
-
gtk_widget_show (dialog->details->button);
gtk_widget_set_can_default (dialog->details->button, TRUE);
-
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (dialog->details->button), hbox);
-#else
- gtk_container_add (GTK_CONTAINER (align), hbox);
- gtk_container_add (GTK_CONTAINER (dialog->details->button), align);
-#endif
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
dialog->details->button, RESPONSE_OPEN);
diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c
index 6793608e..bee2bb00 100644
--- a/libcaja-private/caja-program-choosing.c
+++ b/libcaja-private/caja-program-choosing.c
@@ -205,9 +205,7 @@ caja_launch_application_by_uri (GAppInfo *application,
CajaFile *file;
gboolean result;
GError *error;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
-#endif
GdkAppLaunchContext *launch_context;
CajaIconInfo *icon;
int count, total;
@@ -231,7 +229,6 @@ caja_launch_application_by_uri (GAppInfo *application,
}
locations = g_list_reverse (locations);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (parent_window != NULL) {
display = gtk_widget_get_display (GTK_WIDGET (parent_window));
} else {
@@ -244,12 +241,6 @@ caja_launch_application_by_uri (GAppInfo *application,
gdk_app_launch_context_set_screen (launch_context,
gtk_window_get_screen (parent_window));
}
-#else
- launch_context = gdk_app_launch_context_new ();
- if (parent_window)
- gdk_app_launch_context_set_screen (launch_context,
- gtk_window_get_screen (parent_window));
-#endif
file = caja_file_get_by_uri (uris->data);
icon = caja_file_get_icon (file, 48, 0);
@@ -354,7 +345,6 @@ caja_launch_application_from_command (GdkScreen *screen,
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkAppLaunchContext *launch_context;
GdkDisplay *display;
GAppInfo *app_info = NULL;
@@ -371,38 +361,6 @@ caja_launch_application_from_command (GdkScreen *screen,
g_object_unref (launch_context);
g_object_unref (app_info);
}
-#else
- GError *error = NULL;
- gchar **argv = NULL;
- char* display;
- GPid pid;
-
- if (!g_shell_parse_argv (full_command, NULL, &argv, &error)) {
- g_error_free (error);
- g_free (full_command);
- return;
- }
-
- display = gdk_screen_make_display_name (screen);
-
- g_spawn_async (
- NULL, /* working directory */
- argv,
- NULL, /* envp */
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- set_environment,
- display,
- &pid,
- &error);
-
- if (error != NULL) {
- g_error_free (error);
- } else {
- g_child_watch_add(pid, dummy_child_watch, NULL);
- }
-
- g_free(display);
-#endif
}
g_free (full_command);
@@ -450,7 +408,6 @@ caja_launch_application_from_command_array (GdkScreen *screen,
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkAppLaunchContext *launch_context;
GdkDisplay *display;
GAppInfo *app_info = NULL;
@@ -467,38 +424,6 @@ caja_launch_application_from_command_array (GdkScreen *screen,
g_object_unref (launch_context);
g_object_unref (app_info);
}
-#else
- GError *error = NULL;
- gchar **argv = NULL;
- char* display;
- GPid pid;
-
- if (!g_shell_parse_argv (full_command, NULL, &argv, &error)) {
- g_error_free (error);
- g_free (full_command);
- return;
- }
-
- display = gdk_screen_make_display_name (screen);
-
- g_spawn_async (
- NULL, /* working directory */
- argv,
- NULL, /* envp */
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- set_environment,
- display,
- &pid,
- &error);
-
- if (error != NULL) {
- g_error_free (error);
- } else {
- g_child_watch_add(pid, dummy_child_watch, NULL);
- }
-
- g_free(display);
-#endif
}
g_free (full_command);
@@ -594,11 +519,9 @@ caja_launch_desktop_file (GdkScreen *screen,
}
error = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
+
context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (parent_window)));
-#else
- context = gdk_app_launch_context_new ();
-#endif
+
/* TODO: Ideally we should accept a timestamp here instead of using GDK_CURRENT_TIME */
gdk_app_launch_context_set_timestamp (context, GDK_CURRENT_TIME);
gdk_app_launch_context_set_screen (context,
diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c
index 44c8b6a8..4efbc41e 100644
--- a/libcaja-private/caja-progress-info.c
+++ b/libcaja-private/caja-progress-info.c
@@ -50,11 +50,6 @@ enum
#define STARTBT_DATA_IMAGE_RESUME "resumeimg"
#define STARTBT_DATA_CURIMAGE "curimage"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static guint signals[LAST_SIGNAL] = { 0 };
struct _ProgressWidgetData;
@@ -251,7 +246,7 @@ get_progress_window ()
gtk_window_set_icon_name (GTK_WINDOW (progress_window),
"system-file-manager");
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_spacing (GTK_BOX (vbox), 5);
gtk_container_add (GTK_CONTAINER (progress_window),
@@ -748,17 +743,10 @@ start_button_init (ProgressWidgetData *data)
GtkWidget *button = gtk_button_new ();
data->btstart = button;
-#if GTK_CHECK_VERSION (3, 10, 0)
pauseImage = gtk_image_new_from_icon_name (
"media-playback-pause", GTK_ICON_SIZE_BUTTON);
resumeImage = gtk_image_new_from_icon_name (
"media-playback-start", GTK_ICON_SIZE_BUTTON);
-#else
- pauseImage = gtk_image_new_from_stock (
- GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON);
- resumeImage = gtk_image_new_from_stock (
- GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
-#endif
g_object_ref (pauseImage);
g_object_ref (resumeImage);
@@ -782,11 +770,7 @@ queue_button_init (ProgressWidgetData *data)
button = gtk_button_new ();
data->btqueue = button;
-#if GTK_CHECK_VERSION (3, 10, 0)
image = gtk_image_new_from_icon_name ("undo", GTK_ICON_SIZE_BUTTON);
-#else
- image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_BUTTON);
-#endif
gtk_container_add (GTK_CONTAINER (button), image);
@@ -803,7 +787,7 @@ progress_widget_new (CajaProgressInfo *info)
data->info = g_object_ref (info);
data->state = STATE_INITIALIZED;
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_spacing (GTK_BOX (vbox), 5);
@@ -827,15 +811,10 @@ progress_widget_new (CajaProgressInfo *info)
0);
data->status = GTK_LABEL (label);
- hbox = gtk_hbox_new (FALSE,10);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
-#if GTK_CHECK_VERSION (3, 10, 0)
imgcancel = gtk_image_new_from_icon_name ("gtk-cancel",
GTK_ICON_SIZE_BUTTON);
-#else
- imgcancel = gtk_image_new_from_stock (GTK_STOCK_CANCEL,
- GTK_ICON_SIZE_BUTTON);
-#endif
btcancel = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (btcancel), imgcancel);
@@ -844,7 +823,7 @@ progress_widget_new (CajaProgressInfo *info)
progress_bar = gtk_progress_bar_new ();
data->progress_bar = GTK_PROGRESS_BAR (progress_bar);
gtk_progress_bar_set_pulse_step (data->progress_bar, 0.05);
- box = gtk_vbox_new (FALSE,0);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (box),
progress_bar,
TRUE,FALSE,
diff --git a/libcaja-private/caja-thumbnails.c b/libcaja-private/caja-thumbnails.c
index 6ef6cdb4..3f009475 100644
--- a/libcaja-private/caja-thumbnails.c
+++ b/libcaja-private/caja-thumbnails.c
@@ -272,10 +272,6 @@ thumbnail_thread_notify_file_changed (gpointer image_uri)
{
CajaFile *file;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_enter ();
-#endif
-
file = caja_file_get_by_uri ((char *) image_uri);
#ifdef DEBUG_THUMBNAILS
g_message ("(Thumbnail Thread) Notifying file changed file:%p uri: %s\n", file, (char*) image_uri);
@@ -291,10 +287,6 @@ thumbnail_thread_notify_file_changed (gpointer image_uri)
}
g_free (image_uri);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_leave ();
-#endif
-
return FALSE;
}
diff --git a/libcaja-private/caja-tree-view-drag-dest.c b/libcaja-private/caja-tree-view-drag-dest.c
index 96364f53..3cc8ef61 100644
--- a/libcaja-private/caja-tree-view-drag-dest.c
+++ b/libcaja-private/caja-tree-view-drag-dest.c
@@ -106,7 +106,7 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *pointer;
-#elif GTK_CHECK_VERSION(3, 0, 0)
+#else
GdkDeviceManager *manager;
GdkDevice *pointer;
#endif
@@ -125,17 +125,13 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
pointer = gdk_seat_get_pointer (seat);
gdk_window_get_device_position (window, pointer,
NULL, &y, NULL);
-#elif GTK_CHECK_VERSION(3, 0, 0)
+#else
vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(tree_view));
manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (tree_view)));
pointer = gdk_device_manager_get_client_pointer (manager);
gdk_window_get_device_position (window, pointer,
NULL, &y, NULL);
-#else
- vadjustment = gtk_tree_view_get_vadjustment (tree_view);
-
- gdk_window_get_pointer (window, NULL, &y, NULL);
#endif
y += gtk_adjustment_get_value (vadjustment);
@@ -207,22 +203,14 @@ remove_expand_timeout (CajaTreeViewDragDest *dest)
}
static gboolean
-#if GTK_CHECK_VERSION(3,0,0)
highlight_draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
-#else
-highlight_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
GdkWindow *bin_window;
int width;
int height;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *style;
-#endif
/* FIXMEchpe: is bin window right here??? */
bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget));
@@ -230,7 +218,6 @@ highlight_expose (GtkWidget *widget,
width = gdk_window_get_width(bin_window);
height = gdk_window_get_height(bin_window);
-#if GTK_CHECK_VERSION(3,0,0)
style = gtk_widget_get_style_context (widget);
gtk_style_context_save (style);
@@ -241,15 +228,6 @@ highlight_expose (GtkWidget *widget,
0, 0, width, height);
gtk_style_context_restore (style);
-#else
- gtk_paint_focus (gtk_widget_get_style (widget),
- bin_window,
- gtk_widget_get_state (widget),
- NULL,
- widget,
- "treeview-drop-indicator",
- 0, 0, width, height);
-#endif
return FALSE;
}
@@ -269,13 +247,8 @@ set_widget_highlight (CajaTreeViewDragDest *dest, gboolean highlight)
{
dest->details->highlight_id =
g_signal_connect_object (dest->details->tree_view,
-#if GTK_CHECK_VERSION(3,0,0)
"draw",
G_CALLBACK (highlight_draw),
-#else
- "expose_event",
- G_CALLBACK (highlight_expose),
-#endif
dest, 0);
gtk_widget_queue_draw (GTK_WIDGET (dest->details->tree_view));
}
@@ -1077,11 +1050,7 @@ set_direct_save_uri (CajaTreeViewDragDest *dest,
g_object_unref (child);
/* Change the property */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_property_change (gdk_drag_context_get_source_window (context),
-#else
- gdk_property_change (GDK_DRAWABLE (gdk_drag_context_get_source_window (context)),
-#endif
gdk_atom_intern (CAJA_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE),
gdk_atom_intern ("text/plain", FALSE), 8,
GDK_PROP_MODE_REPLACE, (const guchar *) uri,
diff --git a/src/Makefile.am b/src/Makefile.am
index ec3f575b..daeaa38b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,6 @@ AM_CPPFLAGS = \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DVERSION="\"$(VERSION)\"" \
$(DISABLE_DEPRECATED_CFLAGS) \
- $(UNIQUE_CFLAGS) \
$(NULL)
LDADD = \
@@ -66,7 +65,6 @@ BUILT_SOURCES = \
caja-src-marshal.h \
$(dbus_freedesktop_built_sources) \
$(NULL)
-if ENABLE_LIBUNIQUE
caja_SOURCES = \
caja-actions.h \
caja-application.c \
@@ -156,98 +154,6 @@ caja_SOURCES = \
caja-zoom-control.c \
caja-zoom-control.h \
$(NULL)
-else
-caja_SOURCES = \
- caja-actions.h \
- caja-application.c \
- caja-application.h \
- caja-bookmark-list.c \
- caja-bookmark-list.h \
- caja-bookmarks-window.c \
- caja-bookmarks-window.h \
- caja-connect-server-dialog.c \
- caja-connect-server-dialog.h \
- caja-connect-server-dialog-nonmain.c \
- caja-connect-server-operation.c \
- caja-connect-server-operation.h \
- caja-desktop-window.c \
- caja-desktop-window.h \
- caja-emblem-sidebar.c \
- caja-emblem-sidebar.h \
- caja-file-management-properties.c \
- caja-file-management-properties.h \
- caja-freedesktop-dbus.c \
- caja-freedesktop-dbus.h \
- caja-history-sidebar.c \
- caja-history-sidebar.h \
- caja-image-properties-page.c \
- caja-image-properties-page.h \
- caja-information-panel.c \
- caja-information-panel.h \
- caja-location-bar.c \
- caja-location-bar.h \
- caja-location-dialog.c \
- caja-location-dialog.h \
- caja-location-entry.c \
- caja-location-entry.h \
- caja-main.c \
- caja-main.h \
- caja-navigation-action.c \
- caja-navigation-action.h \
- caja-navigation-window-menus.c \
- caja-navigation-window.c \
- caja-navigation-window.h \
- caja-navigation-window-pane.c \
- caja-navigation-window-pane.h \
- caja-navigation-window-slot.c \
- caja-navigation-window-slot.h \
- caja-notebook.c \
- caja-notebook.h \
- caja-notes-viewer.c \
- caja-notes-viewer.h \
- caja-pathbar.c \
- caja-pathbar.h \
- caja-places-sidebar.c \
- caja-places-sidebar.h \
- caja-property-browser.c \
- caja-property-browser.h \
- caja-query-editor.c \
- caja-query-editor.h \
- caja-search-bar.c \
- caja-search-bar.h \
- caja-self-check-functions.c \
- caja-self-check-functions.h \
- caja-side-pane.c \
- caja-side-pane.h \
- caja-sidebar-title.c \
- caja-sidebar-title.h \
- caja-spatial-window.c \
- caja-spatial-window.h \
- caja-trash-bar.c \
- caja-trash-bar.h \
- caja-view-as-action.c \
- caja-view-as-action.h \
- caja-window-bookmarks.c \
- caja-window-bookmarks.h \
- caja-window-manage-views.c \
- caja-window-manage-views.h \
- caja-window-menus.c \
- caja-window-pane.c \
- caja-window-pane.h \
- caja-window-private.h \
- caja-window-slot.c \
- caja-window-slot.h \
- caja-window-toolbars.c \
- caja-window.c \
- caja-window.h \
- caja-x-content-bar.c \
- caja-x-content-bar.h \
- caja-zoom-action.c \
- caja-zoom-action.h \
- caja-zoom-control.c \
- caja-zoom-control.h \
- $(NULL)
-endif
nodist_caja_SOURCES = \
$(BUILT_SOURCES) \
diff --git a/src/caja-application.c b/src/caja-application.c
index 83702a9f..49958d39 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -39,9 +39,7 @@
#include "caja-information-panel.h"
#include "caja-history-sidebar.h"
#include "caja-places-sidebar.h"
-#if ENABLE_LIBUNIQUE == (FALSE)
#include "caja-self-check-functions.h"
-#endif
#include "caja-notes-viewer.h"
#include "caja-emblem-sidebar.h"
#include "caja-image-properties-page.h"
@@ -49,9 +47,6 @@
#include <string.h>
#include <unistd.h>
#include "caja-desktop-window.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-main.h"
-#endif
#include "caja-spatial-window.h"
#include "caja-navigation-window.h"
#include "caja-window-slot.h"
@@ -74,9 +69,7 @@
#include <libcaja-private/caja-debug-log.h>
#include <libcaja-private/caja-file-utilities.h>
#include <libcaja-private/caja-global-preferences.h>
-#if ENABLE_LIBUNIQUE == (FALSE)
#include <libcaja-private/caja-lib-self-check-functions.h>
-#endif
#include <libcaja-private/caja-extensions.h>
#include <libcaja-private/caja-module.h>
#include <libcaja-private/caja-desktop-link-monitor.h>
@@ -87,19 +80,10 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-bg.h>
-#if ENABLE_LIBUNIQUE == (FALSE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#else
-enum {
- COMMAND_0, /* unused: 0 is an invalid command */
- COMMAND_START_DESKTOP,
- COMMAND_STOP_DESKTOP,
- COMMAND_OPEN_BROWSER,
-};
-#endif
/* Keep window from shrinking down ridiculously small; numbers are somewhat arbitrary */
#define APPLICATION_WINDOW_MIN_WIDTH 300
#define APPLICATION_WINDOW_MIN_HEIGHT 100
@@ -109,10 +93,6 @@ enum {
/* Keeps track of all the desktop windows. */
static GList *caja_application_desktop_windows;
-#if ENABLE_LIBUNIQUE == (TRUE)
-/* Keeps track of all the caja windows. */
-static GList *caja_application_window_list;
-#endif
/* Keeps track of all the object windows */
static GList *caja_application_spatial_window_list;
@@ -123,9 +103,7 @@ static gboolean save_of_accel_map_requested = FALSE;
static CajaFreedesktopDBus *fdb_manager = NULL;
static void desktop_changed_callback (gpointer user_data);
-#if ENABLE_LIBUNIQUE == (TRUE)
-static void desktop_location_changed_callback (gpointer user_data);
-#endif
+
static void mount_removed_callback (GVolumeMonitor *monitor,
GMount *mount,
CajaApplication *application);
@@ -143,15 +121,11 @@ static void volume_removed_callback (GVolumeMonitor *mo
CajaApplication *application);
static void drive_listen_for_eject_button (GDrive *drive,
CajaApplication *application);
-#if ENABLE_LIBUNIQUE == (FALSE)
+
static void caja_application_load_session (CajaApplication *application);
static char * caja_application_get_session_data (CajaApplication *self);
void caja_application_quit (CajaApplication *self);
-#else
-static void caja_application_load_session (CajaApplication *application);
-static char * caja_application_get_session_data (void);
-#endif
-#if ENABLE_LIBUNIQUE == (FALSE)
+
G_DEFINE_TYPE (CajaApplication, caja_application, GTK_TYPE_APPLICATION);
struct _CajaApplicationPriv {
GVolumeMonitor *volume_monitor;
@@ -161,90 +135,7 @@ struct _CajaApplicationPriv {
gchar *geometry;
};
-#else
-G_DEFINE_TYPE (CajaApplication, caja_application, G_TYPE_OBJECT);
-
-static gboolean
-_unique_message_data_set_geometry_and_uris (UniqueMessageData *message_data,
- const char *geometry,
- char **uris)
-{
- GString *list;
- gint i;
- gchar *result;
- gsize length;
-
- list = g_string_new (NULL);
- if (geometry != NULL)
- {
- g_string_append (list, geometry);
- }
- g_string_append (list, "\r\n");
-
- for (i = 0; uris != NULL && uris[i]; i++)
- {
- g_string_append (list, uris[i]);
- g_string_append (list, "\r\n");
- }
-
- result = g_convert (list->str, list->len,
- "ASCII", "UTF-8",
- NULL, &length, NULL);
- g_string_free (list, TRUE);
-
- if (result)
- {
- unique_message_data_set (message_data, (guchar *) result, length);
- g_free (result);
- return TRUE;
- }
- return FALSE;
-}
-
-static gchar **
-_unique_message_data_get_geometry_and_uris (UniqueMessageData *message_data,
- char **geometry)
-{
- gchar **result = NULL;
-
- *geometry = NULL;
-
- gchar *text, *newline, *uris;
- text = unique_message_data_get_text (message_data);
- if (text)
- {
- newline = strchr (text, '\n');
- if (newline)
- {
- *geometry = g_strndup (text, newline-text);
- uris = newline+1;
- }
- else
- {
- uris = text;
- }
-
- result = g_uri_list_extract_uris (uris);
- g_free (text);
- }
-
- /* if the string is empty, make it NULL */
- if (*geometry && strlen (*geometry) == 0)
- {
- g_free (*geometry);
- *geometry = NULL;
- }
-
- return result;
-}
-
-GList *
-caja_application_get_window_list (void)
-{
- return caja_application_window_list;
-}
-#endif
GList *
@@ -253,14 +144,6 @@ caja_application_get_spatial_window_list (void)
return caja_application_spatial_window_list;
}
-#if ENABLE_LIBUNIQUE == (TRUE)
-unsigned int
-caja_application_get_n_windows (void)
-{
- return g_list_length (caja_application_window_list) +
- g_list_length (caja_application_desktop_windows);
-}
-#endif
static void
startup_volume_mount_cb (GObject *source_object,
GAsyncResult *res,
@@ -279,11 +162,9 @@ automount_all_volumes (CajaApplication *application)
if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT))
{
/* automount all mountable volumes at start-up */
-#if ENABLE_LIBUNIQUE == (FALSE)
+
volumes = g_volume_monitor_get_volumes (application->priv->volume_monitor);
-#else
- volumes = g_volume_monitor_get_volumes (application->volume_monitor);
-#endif
+
for (l = volumes; l != NULL; l = l->next)
{
volume = l->data;
@@ -315,15 +196,9 @@ smclient_save_state_cb (EggSMClient *client,
CajaApplication *application)
{
char *data;
-#if ENABLE_LIBUNIQUE == (FALSE)
data = caja_application_get_session_data (application);
- if (data != NULL)
-#else
- data = caja_application_get_session_data ();
-
- if (data)
-#endif
+ if (data != NULL)
{
g_key_file_set_string (state_file,
"Caja",
@@ -337,15 +212,9 @@ static void
smclient_quit_cb (EggSMClient *client,
CajaApplication *application)
{
-#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_quit (application);
-#else
- caja_main_event_loop_quit (TRUE);
-#endif
}
-#if ENABLE_LIBUNIQUE == (FALSE)
-
static void
caja_application_smclient_initialize (CajaApplication *self)
{
@@ -419,7 +288,6 @@ open_window (CajaApplication *application,
g_free (uri);
}
-
static void
open_windows (CajaApplication *application,
GFile **files,
@@ -532,56 +400,6 @@ caja_application_init (CajaApplication *application)
g_object_unref (action);
}
-#else
-static void
-caja_application_init (CajaApplication *application)
-{
- application->unique_app = unique_app_new_with_commands ("org.mate.Caja", NULL,
- "start_desktop", COMMAND_START_DESKTOP,
- "stop_desktop", COMMAND_STOP_DESKTOP,
- "open_browser", COMMAND_OPEN_BROWSER,
- NULL);
- application->smclient = egg_sm_client_get ();
- g_signal_connect (application->smclient, "save_state",
- G_CALLBACK (smclient_save_state_cb),
- application);
- g_signal_connect (application->smclient, "quit",
- G_CALLBACK (smclient_quit_cb),
- application);
- /* TODO: Should connect to quit_requested and block logout on active transfer? */
-
- /* register views */
- fm_icon_view_register ();
- fm_desktop_icon_view_register ();
- fm_list_view_register ();
- fm_compact_view_register ();
-#if ENABLE_EMPTY_VIEW
- fm_empty_view_register ();
-#endif /* ENABLE_EMPTY_VIEW */
-
- /* register sidebars */
- caja_places_sidebar_register ();
- caja_information_panel_register ();
- fm_tree_view_register ();
- caja_history_sidebar_register ();
- caja_notes_viewer_register (); /* also property page */
- caja_emblem_sidebar_register ();
-
- /* register property pages */
- caja_image_properties_page_register ();
-
- /* initialize search path for custom icons */
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- CAJA_DATADIR G_DIR_SEPARATOR_S "icons");
-}
-
-CajaApplication *
-caja_application_new (void)
-{
- return g_object_new (CAJA_TYPE_APPLICATION, NULL);
-}
-#endif
-
static void
caja_application_finalize (GObject *object)
{
@@ -590,7 +408,7 @@ caja_application_finalize (GObject *object)
application = CAJA_APPLICATION (object);
caja_bookmarks_exiting ();
-#if ENABLE_LIBUNIQUE == (FALSE)
+
if (application->volume_monitor)
{
g_object_unref (application->priv->volume_monitor);
@@ -599,15 +417,6 @@ caja_application_finalize (GObject *object)
g_free (application->priv->geometry);
-#else
- if (application->volume_monitor)
- {
- g_object_unref (application->volume_monitor);
- application->volume_monitor = NULL;
- }
-
- g_object_unref (application->unique_app);
-#endif
if (application->ss_watch_id > 0)
{
g_bus_unwatch_name (application->ss_watch_id);
@@ -636,9 +445,9 @@ caja_application_finalize (GObject *object)
g_object_unref (application->ss_proxy);
application->ss_proxy = NULL;
}
-#if ENABLE_LIBUNIQUE == (FALSE)
+
notify_uninit ();
-#endif
+
G_OBJECT_CLASS (caja_application_parent_class)->finalize (object);
}
@@ -705,14 +514,9 @@ check_required_directories (CajaApplication *application)
dialog = eel_show_error_dialog (error_string, detail_string, NULL);
/* We need the main event loop so the user has a chance to see the dialog. */
-#if ENABLE_LIBUNIQUE == (FALSE)
+
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (dialog));
-#elif GTK_CHECK_VERSION (3, 0, 0)
- caja_main_event_loop_register (GTK_WIDGET (dialog));
-#else
- caja_main_event_loop_register (GTK_OBJECT (dialog));
-#endif
g_string_free (directories_as_string, TRUE);
g_free (error_string);
@@ -941,393 +745,6 @@ do_initialize_screensaver (CajaApplication *application)
NULL);
}
-#if ENABLE_LIBUNIQUE == (TRUE)
-#if GTK_CHECK_VERSION (3, 0, 0)
-
-static void
-init_css (void)
-{
- GtkCssProvider *provider;
- GError *error = NULL;
-
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_path (provider,
- CAJA_DATADIR G_DIR_SEPARATOR_S "caja.css", &error);
-
- if (error != NULL) {
- g_warning ("Failed to load application css file: %s", error->message);
- g_error_free (error);
- } else {
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- }
-
- g_object_unref (provider);
-}
-#endif
-
-static void
-finish_startup (CajaApplication *application,
- gboolean no_desktop)
-{
- GList *drives;
-
- /* initialize caja modules */
- caja_module_setup ();
-
- /* attach menu-provider module callback */
- menu_provider_init_callback ();
-
- /* Initialize the desktop link monitor singleton */
- caja_desktop_link_monitor_get ();
-
- /* Initialize MATE screen saver listener to control automount
- * permission */
- do_initialize_screensaver (application);
-
- /* Watch for mounts so we can restore open windows This used
- * to be for showing new window on mount, but is not used
- * anymore */
-
- /* Watch for unmounts so we can close open windows */
- /* TODO-gio: This should be using the UNMOUNTED feature of GFileMonitor instead */
-
- application->volume_monitor = g_volume_monitor_get ();
- g_signal_connect_object (application->volume_monitor, "mount_removed",
- G_CALLBACK (mount_removed_callback), application, 0);
- g_signal_connect_object (application->volume_monitor, "mount_pre_unmount",
- G_CALLBACK (mount_removed_callback), application, 0);
- g_signal_connect_object (application->volume_monitor, "mount_added",
- G_CALLBACK (mount_added_callback), application, 0);
- g_signal_connect_object (application->volume_monitor, "volume_added",
- G_CALLBACK (volume_added_callback), application, 0);
- g_signal_connect_object (application->volume_monitor, "volume_removed",
- G_CALLBACK (volume_removed_callback), application, 0);
- g_signal_connect_object (application->volume_monitor, "drive_connected",
- G_CALLBACK (drive_connected_callback), application, 0);
-
- /* listen for eject button presses */
- drives = g_volume_monitor_get_connected_drives (application->volume_monitor);
- g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application);
- g_list_free_full (drives, g_object_unref);
-
- application->automount_idle_id =
- g_idle_add_full (G_PRIORITY_LOW,
- automount_all_volumes_idle_cb,
- application, NULL);
-}
-
-static void
-open_window (CajaApplication *application,
- const char *startup_id,
- const char *uri, GdkScreen *screen, const char *geometry,
- gboolean browser_window)
-{
- GFile *location;
- CajaWindow *window;
-
- if (uri == NULL) {
- location = g_file_new_for_path (g_get_home_dir ());
- } else {
- location = g_file_new_for_uri (uri);
- }
-
- if (browser_window ||
- g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
- window = caja_application_create_navigation_window (application,
- startup_id,
- screen);
- } else {
- window = caja_application_get_spatial_window (application,
- NULL,
- startup_id,
- location,
- screen,
- NULL);
- }
-
- caja_window_go_to (window, location);
-
- g_object_unref (location);
-
- if (geometry != NULL && !gtk_widget_get_visible (GTK_WIDGET (window)))
- {
- /* never maximize windows opened from shell if a
- * custom geometry has been requested.
- */
- gtk_window_unmaximize (GTK_WINDOW (window));
- eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window),
- geometry,
- APPLICATION_WINDOW_MIN_WIDTH,
- APPLICATION_WINDOW_MIN_HEIGHT,
- FALSE);
- }
-}
-
-static void
-open_windows (CajaApplication *application,
- const char *startup_id,
- char **uris,
- GdkScreen *screen,
- const char *geometry,
- gboolean browser_window)
-{
- guint i;
-
- if (uris == NULL || uris[0] == NULL)
- {
- /* Open a window pointing at the default location. */
- open_window (application, startup_id, NULL, screen, geometry, browser_window);
- }
- else
- {
- /* Open windows at each requested location. */
- for (i = 0; uris[i] != NULL; i++)
- {
- open_window (application, startup_id, uris[i], screen, geometry, browser_window);
- }
- }
-}
-
-void
-caja_application_open_location (CajaApplication *application,
- GFile *location,
- GFile *selection,
- const char *startup_id)
-{
- CajaWindow *window;
- GList *sel_list = NULL;
-
- window = caja_application_create_navigation_window (application, startup_id, gdk_screen_get_default ());
-
- if (selection != NULL) {
- sel_list = g_list_prepend (NULL, g_object_ref (selection));
- }
-
- caja_window_slot_open_location_full (caja_window_get_active_slot (window), location,
- 0, CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW, sel_list, NULL, NULL);
-
- if (sel_list != NULL) {
- caja_file_list_free (sel_list);
- }
-}
-
-static UniqueResponse
-message_received_cb (UniqueApp *unique_app,
- gint command,
- UniqueMessageData *message,
- guint time_,
- gpointer user_data)
-{
- CajaApplication *application;
- UniqueResponse res;
- char **uris;
- char *geometry;
- GdkScreen *screen;
-
- application = user_data;
- res = UNIQUE_RESPONSE_OK;
-
- switch (command)
- {
- case UNIQUE_CLOSE:
- res = UNIQUE_RESPONSE_OK;
- caja_main_event_loop_quit (TRUE);
-
- break;
- case UNIQUE_OPEN:
- case COMMAND_OPEN_BROWSER:
- uris = _unique_message_data_get_geometry_and_uris (message, &geometry);
- screen = unique_message_data_get_screen (message);
- open_windows (application,
- unique_message_data_get_startup_id (message),
- uris,
- screen,
- geometry,
- command == COMMAND_OPEN_BROWSER);
- g_strfreev (uris);
- g_free (geometry);
- break;
- case COMMAND_START_DESKTOP:
- caja_application_open_desktop (application);
- break;
- case COMMAND_STOP_DESKTOP:
- caja_application_close_desktop ();
- break;
- default:
- res = UNIQUE_RESPONSE_PASSTHROUGH;
- break;
- }
-
- return res;
-}
-
-gboolean
-caja_application_save_accel_map (gpointer data)
-{
- if (save_of_accel_map_requested)
- {
- char *accel_map_filename;
- accel_map_filename = caja_get_accel_map_file ();
- if (accel_map_filename)
- {
- gtk_accel_map_save (accel_map_filename);
- g_free (accel_map_filename);
- }
- save_of_accel_map_requested = FALSE;
- }
-
- return FALSE;
-}
-
-
-static void
-queue_accel_map_save_callback (GtkAccelMap *object, gchar *accel_path,
- guint accel_key, GdkModifierType accel_mods,
- gpointer user_data)
-{
- if (!save_of_accel_map_requested)
- {
- save_of_accel_map_requested = TRUE;
- g_timeout_add_seconds (CAJA_ACCEL_MAP_SAVE_DELAY,
- caja_application_save_accel_map, NULL);
- }
-}
-
-static gboolean
-desktop_changed_callback_connect (CajaApplication *application)
-{
- g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR,
- G_CALLBACK(desktop_location_changed_callback),
- G_OBJECT (application));
- return FALSE;
-}
-
-void
-caja_application_startup (CajaApplication *application,
- gboolean kill_shell,
- gboolean no_default_window,
- gboolean no_desktop,
- gboolean browser_window,
- const char *geometry,
- char **urls)
-{
- UniqueMessageData *message;
-
- /* Check the user's ~/.config/caja directories and post warnings
- * if there are problems.
- */
- if (!kill_shell && !check_required_directories (application))
- {
- return;
- }
-
- if (kill_shell)
- {
- if (unique_app_is_running (application->unique_app))
- {
- unique_app_send_message (application->unique_app,
- UNIQUE_CLOSE, NULL);
-
- }
- }
- else
- {
- char *accel_map_filename;
-
- if (!no_desktop &&
- !g_settings_get_boolean (mate_background_preferences, MATE_BG_KEY_SHOW_DESKTOP))
- {
- no_desktop = TRUE;
- }
-
- if (!no_desktop)
- {
- if (unique_app_is_running (application->unique_app))
- {
- unique_app_send_message (application->unique_app,
- COMMAND_START_DESKTOP, NULL);
- }
- else
- {
- caja_application_open_desktop (application);
- }
- }
-
- if (!unique_app_is_running (application->unique_app))
- {
- finish_startup (application, no_desktop);
- g_signal_connect (application->unique_app, "message-received", G_CALLBACK (message_received_cb), application);
- }
-
-#if GTK_CHECK_VERSION (3, 0, 0)
- /* initialize CSS theming */
- init_css ();
-#endif
-
-
- /* Start the File Manager DBus Interface */
- fdb_manager = caja_freedesktop_dbus_new (application);
-
- /* Monitor the preference to show or hide the desktop */
- g_signal_connect_swapped (mate_background_preferences,
- "changed::" MATE_BG_KEY_SHOW_DESKTOP,
- G_CALLBACK(desktop_changed_callback),
- G_OBJECT (application));
-
- /* Monitor the preference to have the desktop */
- /* point to the Unix home folder */
- g_timeout_add_seconds (30, (GSourceFunc) desktop_changed_callback_connect, application);
-
- /* Create the other windows. */
- if (urls != NULL || !no_default_window)
- {
- if (unique_app_is_running (application->unique_app))
- {
- message = unique_message_data_new ();
- _unique_message_data_set_geometry_and_uris (message, geometry, urls);
- if (browser_window)
- {
- unique_app_send_message (application->unique_app,
- COMMAND_OPEN_BROWSER, message);
- }
- else
- {
- unique_app_send_message (application->unique_app,
- UNIQUE_OPEN, message);
- }
- unique_message_data_free (message);
- }
- else
- {
- open_windows (application, NULL,
- urls,
- gdk_display_get_default_screen (gdk_display_get_default()),
- // gdk_screen_get_default (),
- geometry,
- browser_window);
- }
- }
-
- /* Load session info if availible */
- caja_application_load_session (application);
-
- /* Initialize notifications for eject operations */
- notify_init (GETTEXT_PACKAGE);
-
- /* load accelerator map, and register save callback */
- accel_map_filename = caja_get_accel_map_file ();
- if (accel_map_filename)
- {
- gtk_accel_map_load (accel_map_filename);
- g_free (accel_map_filename);
- }
- g_signal_connect (gtk_accel_map_get (), "changed", G_CALLBACK (queue_accel_map_save_callback), NULL);
- }
-}
-#endif
-
static void
selection_get_cb (GtkWidget *widget,
GtkSelectionData *selection_data,
@@ -1399,22 +816,12 @@ selection_clear_event_cb (GtkWidget *widget,
static void
caja_application_create_desktop_windows (CajaApplication *application)
{
-#if ENABLE_LIBUNIQUE == (TRUE)
- static gboolean create_in_progress = FALSE;
-#endif
GdkDisplay *display;
CajaDesktopWindow *window;
GtkWidget *selection_widget;
g_return_if_fail (caja_application_desktop_windows == NULL);
g_return_if_fail (CAJA_IS_APPLICATION (application));
-#if ENABLE_LIBUNIQUE == (TRUE)
- if (create_in_progress)
- {
- return;
- }
- create_in_progress = TRUE;
-#endif
display = gdk_display_get_default ();
selection_widget = get_desktop_manager_selection (display);
@@ -1436,14 +843,9 @@ caja_application_create_desktop_windows (CajaApplication *application)
caja_application_desktop_windows =
g_list_prepend (caja_application_desktop_windows, window);
-#if ENABLE_LIBUNIQUE == (FALSE)
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (window));
}
-#else
- }
- create_in_progress = FALSE;
-#endif
}
void
@@ -1454,11 +856,7 @@ caja_application_open_desktop (CajaApplication *application)
caja_application_create_desktop_windows (application);
}
}
-#if ENABLE_LIBUNIQUE == (FALSE)
static void
-#else
-void
-#endif
caja_application_close_desktop (void)
{
if (caja_application_desktop_windows != NULL)
@@ -1469,19 +867,11 @@ caja_application_close_desktop (void)
}
void
-#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_close_all_navigation_windows (CajaApplication *self)
{
GList *list_copy;
GList *l;
list_copy = g_list_copy (gtk_application_get_windows (GTK_APPLICATION (self)));
-#else
-caja_application_close_all_navigation_windows (void)
-{
- GList *list_copy;
- GList *l;
- list_copy = g_list_copy (caja_application_window_list);
-#endif
/* First hide all window to get the feeling of quick response */
for (l = list_copy; l != NULL; l = l->next)
{
@@ -1643,17 +1033,6 @@ caja_application_close_all_spatial_windows (void)
g_list_free (list_copy);
}
-#if ENABLE_LIBUNIQUE == (TRUE)
-static void
-#if GTK_CHECK_VERSION (3, 0, 0)
-caja_application_destroyed_window (GtkWidget *object, CajaApplication *application)
-#else
-caja_application_destroyed_window (GtkObject *object, CajaApplication *application)
-#endif
-{
- caja_application_window_list = g_list_remove (caja_application_window_list, object);
-}
-#endif
static gboolean
caja_window_delete_event_callback (GtkWidget *widget,
GdkEvent *event,
@@ -1671,9 +1050,6 @@ caja_window_delete_event_callback (GtkWidget *widget,
static CajaWindow *
create_window (CajaApplication *application,
GType window_type,
-#if ENABLE_LIBUNIQUE == (TRUE)
- const char *startup_id,
-#endif
GdkScreen *screen)
{
CajaWindow *window;
@@ -1684,23 +1060,13 @@ create_window (CajaApplication *application,
"app", application,
"screen", screen,
NULL));
-#if ENABLE_LIBUNIQUE == (TRUE)
- if (startup_id)
- {
- gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);
- }
-#endif
g_signal_connect_data (window, "delete_event",
G_CALLBACK (caja_window_delete_event_callback), NULL, NULL,
G_CONNECT_AFTER);
-#if ENABLE_LIBUNIQUE == (FALSE)
+
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (window));
-#else
- g_signal_connect_object (window, "destroy",
- G_CALLBACK (caja_application_destroyed_window), application, 0);
- caja_application_window_list = g_list_prepend (caja_application_window_list, window);
-#endif
+
/* Do not yet show the window. It will be shown later on if it can
* successfully display its initial URI. Otherwise it will be destroyed
* without ever having seen the light of day.
@@ -1742,11 +1108,8 @@ caja_application_get_spatial_window (CajaApplication *application,
if (existing != NULL) {
*existing = FALSE;
}
-#if ENABLE_LIBUNIQUE == (FALSE)
window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, screen);
-#else
- window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, startup_id, screen);
-#endif
+
if (requesting_window)
{
/* Center the window over the requesting window by default */
@@ -1787,9 +1150,6 @@ caja_application_get_spatial_window (CajaApplication *application,
CajaWindow *
caja_application_create_navigation_window (CajaApplication *application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- const char *startup_id,
-#endif
GdkScreen *screen)
{
CajaWindow *window;
@@ -1797,11 +1157,8 @@ caja_application_create_navigation_window (CajaApplication *application,
gboolean maximized;
g_return_val_if_fail (CAJA_IS_APPLICATION (application), NULL);
-#if ENABLE_LIBUNIQUE == (FALSE)
window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, screen);
-#else
- window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, startup_id, screen);
-#endif
+
maximized = g_settings_get_boolean (caja_window_state,
CAJA_WINDOW_STATE_MAXIMIZED);
if (maximized)
@@ -1833,18 +1190,7 @@ caja_application_create_navigation_window (CajaApplication *application,
return window;
}
-#if ENABLE_LIBUNIQUE == (TRUE)
-/* callback for changing the directory the desktop points to */
-static void
-desktop_location_changed_callback (gpointer user_data)
-{
- if (caja_application_desktop_windows != NULL)
- {
- g_list_foreach (caja_application_desktop_windows,
- (GFunc) caja_desktop_window_update_directory, NULL);
- }
-}
-#endif
+
/* callback for showing or hiding the desktop based on the user's preference */
static void
desktop_changed_callback (gpointer user_data)
@@ -1989,9 +1335,6 @@ autorun_show_window (GMount *mount, gpointer user_data)
/* There should probably be an easier way to do this */
if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
window = caja_application_create_navigation_window (application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gdk_screen_get_default ());
}
else
@@ -2008,7 +1351,7 @@ autorun_show_window (GMount *mount, gpointer user_data)
g_object_unref (location);
}
-#if ENABLE_LIBUNIQUE == (FALSE)
+
static void
mount_added_callback (GVolumeMonitor *monitor,
GMount *mount,
@@ -2031,27 +1374,7 @@ mount_added_callback (GVolumeMonitor *monitor,
caja_directory_unref (directory);
}
}
-#else
-static void
-mount_added_callback (GVolumeMonitor *monitor,
- GMount *mount,
- CajaApplication *application)
-{
- CajaDirectory *directory;
- GFile *root;
-
- root = g_mount_get_root (mount);
- directory = caja_directory_get_existing (root);
- g_object_unref (root);
- if (directory != NULL)
- {
- caja_directory_force_reload (directory);
- caja_directory_unref (directory);
- }
- caja_autorun (mount, autorun_show_window, application);
-}
-#endif
static CajaWindowSlot *
get_first_navigation_slot (GList *slot_list)
{
@@ -2106,11 +1429,7 @@ mount_removed_callback (GVolumeMonitor *monitor,
unclosed_slot = FALSE;
/* Check and see if any of the open windows are displaying contents from the unmounted mount */
-#if ENABLE_LIBUNIQUE == (FALSE)
window_list = gtk_application_get_windows (GTK_APPLICATION (application));
-#else
- window_list = caja_application_get_window_list ();
-#endif
root = g_mount_get_root (mount);
/* Construct a list of windows to be closed. Do not add the non-closable windows to the list. */
for (node = window_list; node != NULL; node = node->next)
@@ -2225,21 +1544,14 @@ icon_from_string (const char *string)
}
return NULL;
}
-#if ENABLE_LIBUNIQUE == (FALSE)
+
static char *
caja_application_get_session_data (CajaApplication *self)
-#else
-static char *
-caja_application_get_session_data (void)
-#endif
{
xmlDocPtr doc;
xmlNodePtr root_node, history_node;
-#if ENABLE_LIBUNIQUE == (FALSE)
GList *l, *window_list;
-#else
- GList *l;
-#endif
+
char *data;
unsigned n_processed;
xmlSaveCtxtPtr ctx;
@@ -2268,11 +1580,8 @@ caja_application_get_session_data (void)
g_free (tmp);
icon = caja_bookmark_get_icon (bookmark);
-#if ENABLE_LIBUNIQUE == (FALSE)
+
tmp = g_icon_to_string (icon);
-#else
- tmp = icon_to_string (icon);
-#endif
g_object_unref (icon);
if (tmp) {
xmlNewProp (bookmark_node, "icon", tmp);
@@ -2291,12 +1600,8 @@ caja_application_get_session_data (void)
break;
}
}
-#if ENABLE_LIBUNIQUE == (FALSE)
window_list = gtk_application_get_windows (GTK_APPLICATION (self));
for (l = window_list; l != NULL; l = l->next) {
-#else
- for (l = caja_application_window_list; l != NULL; l = l->next) {
-#endif
xmlNodePtr win_node, slot_node;
CajaWindow *window;
CajaWindowSlot *slot, *active_slot;
@@ -2392,9 +1697,7 @@ caja_application_load_session (CajaApplication *application)
xmlNodePtr root_node;
GKeyFile *state_file;
char *data;
-#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_smclient_initialize (application);
-#endif
if (!egg_sm_client_is_resumed (application->smclient))
{
return;
@@ -2458,11 +1761,7 @@ caja_application_load_session (CajaApplication *application)
icon = NULL;
if (icon_str)
{
-#if ENABLE_LIBUNIQUE == (FALSE)
icon = g_icon_new_for_string (icon_str, NULL);
-#else
- icon = icon_from_string (icon_str);
-#endif
}
location = g_file_new_for_uri (uri);
@@ -2521,11 +1820,7 @@ caja_application_load_session (CajaApplication *application)
if (g_strcmp0 (type, "navigation") == 0)
{
xmlChar *geometry;
-#if ENABLE_LIBUNIQUE == (FALSE)
window = caja_application_create_navigation_window (application, gdk_screen_get_default ());
-#else
- window = caja_application_create_navigation_window (application, NULL, gdk_screen_get_default ());
-#endif
geometry = xmlGetProp (node, "geometry");
if (geometry != NULL)
{
@@ -2647,7 +1942,6 @@ caja_application_load_session (CajaApplication *application)
}
}
-#if ENABLE_LIBUNIQUE == (FALSE)
static gboolean
do_cmdline_sanity_checks (CajaApplication *self,
gboolean perform_self_check,
@@ -3146,13 +2440,4 @@ caja_application_new (void)
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}
-#else
-static void
-caja_application_class_init (CajaApplicationClass *class)
-{
- GObjectClass *object_class;
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = caja_application_finalize;
-}
-#endif
diff --git a/src/caja-application.h b/src/caja-application.h
index 7aeaa8a4..e48b4ba1 100644
--- a/src/caja-application.h
+++ b/src/caja-application.h
@@ -31,9 +31,7 @@
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include <unique/unique.h>
-#endif
+
#include <libegg/eggsmclient.h>
#define CAJA_DESKTOP_ICON_VIEW_IID "OAFIID:Caja_File_Manager_Desktop_Icon_View"
@@ -61,21 +59,13 @@ typedef struct CajaWindow CajaWindow;
typedef struct _CajaSpatialWindow CajaSpatialWindow;
#endif
-#if ENABLE_LIBUNIQUE == (FALSE)
typedef struct _CajaApplicationPriv CajaApplicationPriv;
-#else
-typedef struct CajaShell CajaShell;
-#endif
typedef struct
{
-#if ENABLE_LIBUNIQUE == (FALSE)
GtkApplication parent;
CajaApplicationPriv *priv;
-#else
- GObject parent;
- UniqueApp* unique_app;
-#endif
+
EggSMClient* smclient;
GVolumeMonitor* volume_monitor;
unsigned int automount_idle_id;
@@ -85,8 +75,6 @@ typedef struct
GList *volume_queue;
} CajaApplication;
-
-#if ENABLE_LIBUNIQUE == (FALSE)
typedef struct
{
GtkApplicationClass parent_class;
@@ -95,25 +83,7 @@ typedef struct
GType caja_application_get_type (void);
CajaApplication *caja_application_new (void);
-#else
-typedef struct
-{
- GObjectClass parent_class;
-} CajaApplicationClass;
-GType caja_application_get_type (void);
-CajaApplication *caja_application_new (void);
-void caja_application_startup (CajaApplication *application,
- gboolean kill_shell,
- gboolean no_default_window,
- gboolean no_desktop,
- gboolean browser_window,
- const char *default_geometry,
- char **urls);
-GList * caja_application_get_window_list (void);
-GList * caja_application_get_spatial_window_list (void);
-unsigned int caja_application_get_n_windows (void);
-#endif
CajaWindow * caja_application_get_spatial_window (CajaApplication *application,
CajaWindow *requesting_window,
const char *startup_id,
@@ -122,22 +92,11 @@ CajaWindow * caja_application_get_spatial_window (CajaApplication *appli
gboolean *existing);
CajaWindow * caja_application_create_navigation_window (CajaApplication *application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- const char *startup_id,
-#endif
GdkScreen *screen);
-#if ENABLE_LIBUNIQUE == (FALSE)
void caja_application_close_all_navigation_windows (CajaApplication *self);
-#else
-void caja_application_close_all_navigation_windows (void);
-#endif
void caja_application_close_parent_windows (CajaSpatialWindow *window);
void caja_application_close_all_spatial_windows (void);
-#if ENABLE_LIBUNIQUE == (TRUE)
-void caja_application_open_desktop (CajaApplication *application);
-void caja_application_close_desktop (void);
-gboolean caja_application_save_accel_map (gpointer data);
-#endif
+
void caja_application_open_location (CajaApplication *application,
GFile *location,
GFile *selection,
diff --git a/src/caja-autorun-software.c b/src/caja-autorun-software.c
index a2d6a94b..8bd4514d 100644
--- a/src/caja-autorun-software.c
+++ b/src/caja-autorun-software.c
@@ -233,13 +233,8 @@ present_autorun_for_software_dialog (GMount *mount)
icon_info = caja_icon_info_lookup (icon, icon_size);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
image = gtk_image_new_from_pixbuf (pixbuf);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-#endif
-
gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
gtk_window_set_title (GTK_WINDOW (dialog), mount_name);
diff --git a/src/caja-bookmarks-window.c b/src/caja-bookmarks-window.c
index 1f94cc4b..10eb8e88 100644
--- a/src/caja-bookmarks-window.c
+++ b/src/caja-bookmarks-window.c
@@ -595,9 +595,6 @@ open_selected_bookmark (gpointer user_data, GdkScreen *screen)
} else { /* window that opened bookmarks window has been closed */
if (parent_is_browser_window || g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
window = caja_application_create_navigation_window (application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
screen);
}
else
diff --git a/src/caja-connect-server-dialog-main.c b/src/caja-connect-server-dialog-main.c
index 393cdc88..c2936747 100644
--- a/src/caja-connect-server-dialog-main.c
+++ b/src/caja-connect-server-dialog-main.c
@@ -82,11 +82,9 @@ caja_connect_server_dialog_display_location_async (CajaConnectServerDialog *self
error = NULL;
uri = g_file_get_uri (location);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
launch_context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (self)));
-#else
- launch_context = gdk_app_launch_context_new ();
-#endif
+
gdk_app_launch_context_set_screen (launch_context,
gtk_widget_get_screen (GTK_WIDGET (self)));
diff --git a/src/caja-connect-server-dialog-nonmain.c b/src/caja-connect-server-dialog-nonmain.c
index 72ce9a06..e57ce622 100644
--- a/src/caja-connect-server-dialog-nonmain.c
+++ b/src/caja-connect-server-dialog-nonmain.c
@@ -83,9 +83,6 @@ caja_connect_server_dialog_display_location_async (CajaConnectServerDialog *self
if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
window = caja_application_create_navigation_window (application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gtk_widget_get_screen (widget));
} else {
window = caja_application_get_spatial_window (application,
diff --git a/src/caja-connect-server-dialog.c b/src/caja-connect-server-dialog.c
index 4d4a1a3a..6df18f66 100644
--- a/src/caja-connect-server-dialog.c
+++ b/src/caja-connect-server-dialog.c
@@ -40,11 +40,6 @@
#include <libcaja-private/caja-global-preferences.h>
#include <libcaja-private/caja-icon-names.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
/* TODO:
* - name entry + pre-fill
* - NetworkManager integration
@@ -54,11 +49,7 @@ struct _CajaConnectServerDialogDetails
{
CajaApplication *application;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *primary_grid;
-#else
- GtkWidget *primary_table;
-#endif
GtkWidget *user_details;
GtkWidget *port_spinbutton;
@@ -189,7 +180,7 @@ connect_dialog_set_connecting (CajaConnectServerDialog *dialog)
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar));
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (content_area), hbox);
gtk_widget_show (hbox);
@@ -218,7 +209,7 @@ connect_dialog_gvfs_error (CajaConnectServerDialog *dialog)
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar));
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (content_area), hbox);
gtk_widget_show (hbox);
@@ -232,11 +223,7 @@ connect_dialog_gvfs_error (CajaConnectServerDialog *dialog)
gtk_widget_show (label);
gtk_widget_set_sensitive (dialog->details->connect_button, FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_sensitive (dialog->details->primary_grid, FALSE);
-#else
- gtk_widget_set_sensitive (dialog->details->primary_table, FALSE);
-#endif
gtk_widget_show (dialog->details->info_bar);
}
@@ -334,7 +321,7 @@ connect_dialog_set_info_bar_error (CajaConnectServerDialog *dialog,
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_widget_show (dialog->details->info_bar);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 6);
gtk_widget_show (hbox);
@@ -410,7 +397,7 @@ connect_dialog_request_additional_details (CajaConnectServerDialog *self,
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (self->details->info_bar));
entry = NULL;
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 6);
gtk_widget_show (hbox);
@@ -857,11 +844,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
GtkWidget *label;
GtkWidget *alignment;
GtkWidget *content_area;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *combo, *grid;
-#else
- GtkWidget *combo, *table;
-#endif
GtkWidget *vbox, *hbox, *connect_button, *checkbox;
GtkListStore *store;
GtkCellRenderer *renderer;
@@ -899,16 +882,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gtk_box_pack_start (GTK_BOX (content_area), label, FALSE, FALSE, 6);
gtk_widget_show (label);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* server settings alignment */
- alignment = gtk_alignment_new (0, 0, 0, 0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
- 0, 0, 12, 0);
- gtk_box_pack_start (GTK_BOX (content_area), alignment, TRUE, TRUE, 0);
- gtk_widget_show (alignment);
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
@@ -936,29 +909,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gtk_grid_attach_next_to (GTK_GRID (grid), hbox, label,
GTK_POS_RIGHT,
1, 1);
-#else
- table = gtk_table_new (4, 2, FALSE);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_widget_show (table);
-
- dialog->details->primary_table = table;
-
- /* first row: server entry + port spinbutton */
- label = gtk_label_new_with_mnemonic (_("_Server:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
- gtk_widget_show (label);
-
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_widget_show (hbox);
- gtk_table_attach (GTK_TABLE (table), hbox,
- 1, 2,
- 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
dialog->details->server_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->server_entry), TRUE);
@@ -995,14 +945,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
gtk_widget_show (label);
dialog->details->type_combo = combo = gtk_combo_box_new ();
@@ -1066,15 +1009,8 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gtk_widget_show (combo);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), combo, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), combo,
- 1, 2,
- 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND, 6, 3);
-#endif
g_signal_connect_swapped (combo, "changed",
G_CALLBACK (connect_dialog_setup_for_type),
dialog);
@@ -1086,26 +1022,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
dialog->details->share_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->share_entry), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->share_entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), dialog->details->share_entry,
- 1, 2,
- 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
bind_visibility (dialog, dialog->details->share_entry, label);
@@ -1116,27 +1038,13 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 3, 4,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
gtk_widget_show (label);
dialog->details->folder_entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (dialog->details->folder_entry), "/");
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->folder_entry), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->folder_entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), dialog->details->folder_entry,
- 1, 2,
- 3, 4,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
gtk_widget_show (dialog->details->folder_entry);
/* user details label */
@@ -1151,18 +1059,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#endif
gtk_box_pack_start (GTK_BOX (content_area), label, FALSE, FALSE, 6);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* user details alignment */
- alignment = gtk_alignment_new (0, 0, 0, 0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
- 0, 0, 12, 0);
- gtk_box_pack_start (GTK_BOX (content_area), alignment, TRUE, TRUE, 0);
-
- bind_visibility (dialog, alignment, label);
- dialog->details->user_details = alignment;
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 3);
@@ -1175,11 +1071,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
bind_visibility (dialog, grid, label);
dialog->details->user_details = grid;
-#else
- table = gtk_table_new (4, 2, FALSE);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_widget_show (table);
-#endif
/* first row: domain entry */
label = gtk_label_new (_("Domain Name:"));
@@ -1188,26 +1079,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
dialog->details->domain_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->domain_entry), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->domain_entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), dialog->details->domain_entry,
- 1, 2,
- 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
bind_visibility (dialog, dialog->details->domain_entry, label);
@@ -1218,26 +1095,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
dialog->details->user_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->user_entry), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->user_entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), dialog->details->user_entry,
- 1, 2,
- 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
bind_visibility (dialog, dialog->details->user_entry, label);
@@ -1248,54 +1111,33 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
dialog->details->password_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->password_entry), TRUE);
gtk_entry_set_visibility (GTK_ENTRY (dialog->details->password_entry), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->password_entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), dialog->details->password_entry,
- 1, 2,
- 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3);
-#endif
bind_visibility (dialog, dialog->details->password_entry, label);
/* fourth row: remember checkbox */
checkbox = gtk_check_button_new_with_label (_("Remember this password"));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), checkbox, dialog->details->password_entry,
GTK_POS_BOTTOM, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), checkbox,
- 1, 2,
- 3, 4,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 0);
-#endif
dialog->details->remember_checkbox = checkbox;
bind_visibility (dialog, dialog->details->password_entry, checkbox);
/* add as bookmark */
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 6);
dialog->details->bookmark_checkbox = gtk_check_button_new_with_mnemonic (_("Add _bookmark"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->details->bookmark_checkbox, TRUE, TRUE, 0);
gtk_widget_show (dialog->details->bookmark_checkbox);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new (_("Bookmark Name:"));
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c
index 1cc14348..1e453672 100644
--- a/src/caja-desktop-window.c
+++ b/src/caja-desktop-window.c
@@ -166,12 +166,10 @@ caja_desktop_window_init (CajaDesktopWindow *window)
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_DESKTOP_WINDOW,
CajaDesktopWindowDetails);
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (context, "caja-desktop-window");
-#endif
#if GTK_CHECK_VERSION(3, 21, 0)
window->details->composited = TRUE;
@@ -342,11 +340,7 @@ set_desktop_window_id (CajaDesktopWindow *window,
root_window = gdk_screen_get_root_window (
gtk_window_get_screen (GTK_WINDOW (window)));
-#if GTK_CHECK_VERSION (3, 0, 0)
window_xid = GDK_WINDOW_XID (gdkwindow);
-#else
- window_xid = GDK_WINDOW_XWINDOW (gdkwindow);
-#endif
gdk_property_change (root_window,
gdk_atom_intern ("CAJA_DESKTOP_WINDOW_ID", FALSE),
diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c
index 75e9f61f..0c5b0056 100644
--- a/src/caja-emblem-sidebar.c
+++ b/src/caja-emblem-sidebar.c
@@ -64,10 +64,6 @@ struct CajaEmblemSidebarDetails
#define STANDARD_EMBLEM_HEIGHT 52
#define EMBLEM_LABEL_SPACING 2
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
static void caja_emblem_sidebar_populate (CajaEmblemSidebar *emblem_sidebar);
static void caja_emblem_sidebar_refresh (CajaEmblemSidebar *emblem_sidebar);
static void caja_emblem_sidebar_iface_init (CajaSidebarIface *iface);
@@ -111,11 +107,7 @@ typedef struct
GObjectClass parent;
} CajaEmblemSidebarProviderClass;
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE_WITH_CODE (CajaEmblemSidebar, caja_emblem_sidebar, GTK_TYPE_BOX,
-#else
-G_DEFINE_TYPE_WITH_CODE (CajaEmblemSidebar, caja_emblem_sidebar, GTK_TYPE_VBOX,
-#endif
G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR,
caja_emblem_sidebar_iface_init));
@@ -314,7 +306,7 @@ create_rename_emblem_dialog (CajaEmblemSidebar *emblem_sidebar,
FALSE, FALSE, 8);
- hbox = gtk_hbox_new (FALSE, 8);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 8);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
@@ -588,7 +580,7 @@ create_add_emblems_dialog (CajaEmblemSidebar *emblem_sidebar,
image = gtk_image_new_from_pixbuf (emblem->pixbuf);
- hbox = gtk_hbox_new (TRUE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
entry = gtk_entry_new ();
@@ -1047,9 +1039,7 @@ caja_emblem_sidebar_init (CajaEmblemSidebar *emblem_sidebar)
"emblems_changed",
G_CALLBACK (emblems_changed_callback), emblem_sidebar, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (emblem_sidebar), GTK_ORIENTATION_VERTICAL);
-#endif
gtk_box_pack_start (GTK_BOX (emblem_sidebar), widget,
TRUE, TRUE, 0);
}
diff --git a/src/caja-emblem-sidebar.h b/src/caja-emblem-sidebar.h
index 6435ef53..3053ac7d 100644
--- a/src/caja-emblem-sidebar.h
+++ b/src/caja-emblem-sidebar.h
@@ -47,22 +47,13 @@ typedef struct CajaEmblemSidebarDetails CajaEmblemSidebarDetails;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent_slot;
-#else
- GtkVBox parent_slot;
-#endif
CajaEmblemSidebarDetails *details;
} CajaEmblemSidebar;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_slot;
-#else
- GtkVBoxClass parent_slot;
-#endif
-
} CajaEmblemSidebarClass;
GType caja_emblem_sidebar_get_type (void);
diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c
index 4ad18137..9ef695c9 100644
--- a/src/caja-history-sidebar.c
+++ b/src/caja-history-sidebar.c
@@ -74,12 +74,7 @@ enum
static void caja_history_sidebar_iface_init (CajaSidebarIface *iface);
static void sidebar_provider_iface_init (CajaSidebarProviderIface *iface);
static GType caja_history_sidebar_provider_get_type (void);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void caja_history_sidebar_style_updated (GtkWidget *widget);
-#else
-static void caja_history_sidebar_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
G_DEFINE_TYPE_WITH_CODE (CajaHistorySidebar, caja_history_sidebar, GTK_TYPE_SCROLLED_WINDOW,
G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR,
@@ -325,11 +320,7 @@ caja_history_sidebar_class_init (CajaHistorySidebarClass *class)
{
G_OBJECT_CLASS (class)->finalize = caja_history_sidebar_finalize;
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (class)->style_updated = caja_history_sidebar_style_updated;
-#else
- GTK_WIDGET_CLASS (class)->style_set = caja_history_sidebar_style_set;
-#endif
}
static const char *
@@ -382,12 +373,7 @@ caja_history_sidebar_set_parent_window (CajaHistorySidebar *sidebar,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
caja_history_sidebar_style_updated (GtkWidget *widget)
-#else
-caja_history_sidebar_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-#endif
{
CajaHistorySidebar *sidebar;
diff --git a/src/caja-image-properties-page.c b/src/caja-image-properties-page.c
index d43b3c09..12c79e38 100644
--- a/src/caja-image-properties-page.c
+++ b/src/caja-image-properties-page.c
@@ -46,10 +46,6 @@
#define LOAD_BUFFER_SIZE 8192
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
struct CajaImagePropertiesPageDetails
{
GCancellable *cancellable;
@@ -97,11 +93,7 @@ typedef struct
static GType caja_image_properties_page_provider_get_type (void);
static void property_page_provider_iface_init (CajaPropertyPageProviderIface *iface);
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_VBOX);
-#endif
G_DEFINE_TYPE_WITH_CODE (CajaImagePropertiesPageProvider, caja_image_properties_page_provider, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
@@ -658,14 +650,13 @@ caja_image_properties_page_init (CajaImagePropertiesPage *page)
CAJA_TYPE_IMAGE_PROPERTIES_PAGE,
CajaImagePropertiesPageDetails);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL);
-#endif
+
gtk_box_set_homogeneous (GTK_BOX (page), FALSE);
gtk_box_set_spacing (GTK_BOX (page), 2);
gtk_container_set_border_width (GTK_CONTAINER (page), 6);
- page->details->vbox = gtk_vbox_new (FALSE, 6);
+ page->details->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
page->details->loading_label =
append_label (page->details->vbox,_("loading..."));
gtk_box_pack_start (GTK_BOX (page),
diff --git a/src/caja-image-properties-page.h b/src/caja-image-properties-page.h
index 6e07bab8..9725ffa4 100644
--- a/src/caja-image-properties-page.h
+++ b/src/caja-image-properties-page.h
@@ -42,21 +42,13 @@ typedef struct CajaImagePropertiesPageDetails CajaImagePropertiesPageDetails;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkVBox parent;
-#endif
CajaImagePropertiesPageDetails *details;
} CajaImagePropertiesPage;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent;
-#else
- GtkVBoxClass parent;
-#endif
} CajaImagePropertiesPageClass;
GType caja_image_properties_page_get_type (void);
diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c
index d5611490..51c7e0b4 100644
--- a/src/caja-information-panel.c
+++ b/src/caja-information-panel.c
@@ -81,12 +81,7 @@ static void caja_information_panel_drag_data_received (GtkWidget
guint info,
guint time);
static void caja_information_panel_read_defaults (CajaInformationPanel *information_panel);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void caja_information_panel_style_updated (GtkWidget *widget);
-#else
-static void caja_information_panel_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
static void caja_information_panel_theme_changed (GSettings *settings,
const gchar *key,
gpointer user_data);
@@ -210,11 +205,7 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass)
widget_class->drag_data_received = caja_information_panel_drag_data_received;
widget_class->button_press_event = caja_information_panel_press_event;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->style_updated = caja_information_panel_style_updated;
-#else
- widget_class->style_set = caja_information_panel_style_set;
-#endif
/* add the "location changed" signal */
signals[LOCATION_CHANGED] = g_signal_new
@@ -234,11 +225,7 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass)
static void
make_button_box (CajaInformationPanel *information_panel)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
information_panel->details->button_box_centerer = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- information_panel->details->button_box_centerer = gtk_hbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (information_panel->details->container),
information_panel->details->button_box_centerer, TRUE, TRUE, 0);
@@ -268,11 +255,7 @@ caja_information_panel_init (CajaInformationPanel *information_panel)
gtk_widget_add_events (GTK_WIDGET (information_panel), GDK_POINTER_MOTION_MASK);
/* create the container box */
-#if GTK_CHECK_VERSION (3, 0, 0)
information_panel->details->container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- information_panel->details->container = gtk_vbox_new (FALSE, 0);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (information_panel->details->container), 0);
gtk_widget_show (information_panel->details->container);
gtk_container_add (GTK_CONTAINER (information_panel),
@@ -1045,69 +1028,8 @@ caja_information_panel_update_buttons (CajaInformationPanel *information_panel)
static void
caja_information_panel_update_appearance (CajaInformationPanel *information_panel)
{
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (information_panel)),
GTK_STYLE_CLASS_VIEW);
-#else
- EelBackground *background;
- char *background_color;
- char *background_image;
-
- g_return_if_fail (CAJA_IS_INFORMATION_PANEL (information_panel));
-
- /* Connect the background changed signal to code that writes the color. */
- background = eel_get_widget_background (GTK_WIDGET (information_panel));
- if (!information_panel->details->background_connected)
- {
- information_panel->details->background_connected = TRUE;
- g_signal_connect_object (background,"settings_changed",
- G_CALLBACK (background_settings_changed_callback), information_panel, 0);
- g_signal_connect_object (background, "reset",
- G_CALLBACK (background_reset_callback), information_panel, 0);
- }
-
- /* Set up the background color and image from the metadata. */
- background_color = caja_file_get_metadata (information_panel->details->file,
- CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR,
- NULL);
- background_image = caja_file_get_metadata (information_panel->details->file,
- CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE,
- NULL);
-
- if (background_color == NULL && background_image == NULL)
- {
- background_color = g_strdup (information_panel->details->default_background_color);
- background_image = g_strdup (information_panel->details->default_background_image);
- }
-
- /* Block so we don't write these settings out in response to our set calls below */
- g_signal_handlers_block_by_func (background,
- G_CALLBACK (background_settings_changed_callback),
- information_panel);
-
- if (value_different (information_panel->details->current_background_color, background_color) ||
- value_different (information_panel->details->current_background_image, background_image))
- {
-
- g_free (information_panel->details->current_background_color);
- information_panel->details->current_background_color = g_strdup (background_color);
- g_free (information_panel->details->current_background_image);
- information_panel->details->current_background_image = g_strdup (background_image);
-
- eel_background_set_image_uri (background, background_image);
- eel_background_set_color (background, background_color);
-
- caja_sidebar_title_select_text_color (information_panel->details->title, background);
- }
-
- g_free (background_color);
- g_free (background_image);
-
- g_signal_handlers_unblock_by_func (background,
- G_CALLBACK (background_settings_changed_callback),
- information_panel);
-#endif
}
static void
@@ -1188,11 +1110,7 @@ title_changed_callback (CajaWindowInfo *window,
/* ::style_set handler for the information_panel */
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
caja_information_panel_style_updated (GtkWidget *widget)
-#else
-caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style)
-#endif
{
CajaInformationPanel *information_panel;
diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c
index a40c3e96..17bdd989 100644
--- a/src/caja-location-bar.c
+++ b/src/caja-location-bar.c
@@ -229,11 +229,8 @@ drag_data_received_callback (GtkWidget *widget,
for (i = 1; names[i] != NULL; ++i)
{
-#if ENABLE_LIBUNIQUE == (FALSE)
new_window = caja_application_create_navigation_window (application, screen);
-#else
- new_window = caja_application_create_navigation_window (application, NULL, screen);
-#endif
+
location = g_file_new_for_uri (names[i]);
caja_window_go_to (new_window, location);
g_object_unref (location);
@@ -283,18 +280,12 @@ drag_data_get_callback (GtkWidget *widget,
we are imitating here. */
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
style_set_handler (GtkWidget *widget, GtkStyleContext *previous_style)
-#else
-style_set_handler (GtkWidget *widget, GtkStyle *previous_style)
-#endif
{
PangoLayout *layout;
int width, width2;
int xpad;
-#if GTK_CHECK_VERSION (3, 0, 0)
gint margin_start, margin_end;
-#endif
layout = gtk_label_get_layout (GTK_LABEL(widget));
@@ -307,14 +298,9 @@ style_set_handler (GtkWidget *widget, GtkStyle *previous_style)
pango_layout_get_pixel_size (layout, &width2, NULL);
width = MAX (width, width2);
-#if GTK_CHECK_VERSION (3, 0, 0)
margin_start = gtk_widget_get_margin_start (widget);
margin_end = gtk_widget_get_margin_end (widget);
xpad = margin_start + margin_end;
-#else
- gtk_misc_get_padding (GTK_MISC (widget),
- &xpad, NULL);
-#endif
width += 2 * xpad;
@@ -614,7 +600,6 @@ caja_location_bar_set_location (CajaLocationBar *bar,
void
caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
if (is_active)
{
/* reset style to default */
@@ -628,20 +613,6 @@ caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
style = gtk_widget_get_style_context (GTK_WIDGET (location_bar->details->entry));
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_ACTIVE, &color);
-#else
- if(is_active)
- {
- /* reset style to default */
- gtk_widget_modify_base (GTK_WIDGET (location_bar->details->entry), GTK_STATE_NORMAL, NULL);
- }
- else
- {
- GtkStyle *style;
- GdkColor color;
- style = gtk_widget_get_style (GTK_WIDGET (location_bar->details->entry));
- color = style->base[GTK_STATE_INSENSITIVE];
- gtk_widget_modify_base(GTK_WIDGET (location_bar->details->entry), GTK_STATE_NORMAL, &color);
-#endif
}
}
diff --git a/src/caja-location-dialog.c b/src/caja-location-dialog.c
index b6257396..486f7339 100644
--- a/src/caja-location-dialog.c
+++ b/src/caja-location-dialog.c
@@ -32,10 +32,6 @@
#include "caja-desktop-window.h"
#include <glib/gi18n.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
struct _CajaLocationDialogDetails
{
GtkWidget *entry;
@@ -164,7 +160,7 @@ caja_location_dialog_init (CajaLocationDialog *dialog)
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
- box = gtk_hbox_new (FALSE, 12);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_widget_show (box);
diff --git a/src/caja-location-entry.c b/src/caja-location-entry.c
index ad333272..4f7af4eb 100644
--- a/src/caja-location-entry.c
+++ b/src/caja-location-entry.c
@@ -285,11 +285,7 @@ finalize (GObject *object)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
destroy (GtkWidget *object)
-#else
-destroy (GtkObject *object)
-#endif
{
CajaLocationEntry *entry;
@@ -305,11 +301,7 @@ destroy (GtkObject *object)
g_free (entry->details->current_directory);
entry->details->current_directory = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object));
-#else
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-#endif
}
static void
@@ -392,11 +384,7 @@ caja_location_entry_class_init (CajaLocationEntryClass *class)
{
GTK_WIDGET_CLASS (class)->focus_in_event = caja_location_entry_focus_in;
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (class)->destroy = destroy;
-#else
- GTK_OBJECT_CLASS (class)->destroy = destroy;
-#endif
G_OBJECT_CLASS (class)->finalize = finalize;
@@ -443,13 +431,10 @@ caja_location_entry_set_secondary_action (CajaLocationEntry *entry,
static void
caja_location_entry_init (CajaLocationEntry *entry)
{
-
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
gtk_style_context_add_class (context, "caja-location-entry");
-#endif
entry->details = g_new0 (CajaLocationEntryDetails, 1);
diff --git a/src/caja-main.c b/src/caja-main.c
index 51ecbd93..549dfac0 100644
--- a/src/caja-main.c
+++ b/src/caja-main.c
@@ -28,20 +28,12 @@
/* caja-main.c: Implementation of the routines that drive program lifecycle and main window creation/destruction. */
#include <config.h>
-#include "caja-main.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-application.h"
-#include "caja-self-check-functions.h"
-#endif
#include "caja-window.h"
#include <dlfcn.h>
#include <signal.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-self-checks.h>
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include <libegg/eggsmclient.h>
-#endif
#include <libegg/eggdesktopfile.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
@@ -49,9 +41,6 @@
#include <gio/gdesktopappinfo.h>
#include <libcaja-private/caja-debug-log.h>
#include <libcaja-private/caja-global-preferences.h>
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include <libcaja-private/caja-lib-self-check-functions.h>
-#endif
#include <libcaja-private/caja-icon-names.h>
#include <libxml/parser.h>
#ifdef HAVE_LOCALE_H
@@ -68,101 +57,7 @@
#include <exempi/xmp.h>
#endif
-#if ENABLE_LIBUNIQUE == (TRUE)
-/* Keeps track of everyone who wants the main event loop kept active */
-static GSList* event_loop_registrants;
-
-static gboolean exit_with_last_window = TRUE;
-
-static gboolean is_event_loop_needed(void)
-{
- return event_loop_registrants != NULL || !exit_with_last_window;
-}
-
-static int quit_if_in_main_loop (gpointer callback_data)
-{
- guint level;
-
- g_assert (callback_data == NULL);
-
- level = gtk_main_level ();
-
- /* We can be called even outside the main loop,
- * so check that we are in a loop before calling quit.
- */
- if (level != 0)
- {
- gtk_main_quit ();
- }
- /* We need to be called again if we quit a nested loop. */
- return level > 1;
-}
-
-static void eel_gtk_main_quit_all (void)
-{
- /* Calling gtk_main_quit directly only kills the current/top event loop.
- * This idler will be run by the current event loop, killing it, and then
- * by the next event loop, ...
- */
- g_idle_add (quit_if_in_main_loop, NULL);
-}
-
-static void event_loop_unregister (GtkWidget *object)
-{
- event_loop_registrants = g_slist_remove (event_loop_registrants, object);
-
- if (!is_event_loop_needed ())
- {
- eel_gtk_main_quit_all ();
- }
-}
-
-#if GTK_CHECK_VERSION(3, 0, 0)
-void caja_main_event_loop_register (GtkWidget *object)
-#else
-void caja_main_event_loop_register (GtkObject *object)
-#endif
-{
- g_signal_connect (object, "destroy", G_CALLBACK (event_loop_unregister), NULL);
- event_loop_registrants = g_slist_prepend (event_loop_registrants, GTK_WIDGET (object));
-}
-
-gboolean caja_main_is_event_loop_mainstay (GtkWidget *object)
-{
- return g_slist_length (event_loop_registrants) == 1
- && event_loop_registrants->data == object;
-}
-
-void caja_main_event_loop_quit (gboolean explicit)
-{
- if (explicit)
- {
- /* Explicit --quit, make sure we don't restart */
-
- /* To quit all instances, reset exit_with_last_window */
- exit_with_last_window = TRUE;
-
- if (event_loop_registrants == NULL)
- {
- /* If this is reached, caja must run in "daemon" mode
- * (i.e. !exit_with_last_window) with no windows open.
- * We need to quit_all here because the below loop won't
- * trigger a quit.
- */
- eel_gtk_main_quit_all();
- }
-
- /* TODO: With the old session we needed to set restart
- style to MATE_RESTART_IF_RUNNING here, but i don't think we need
- that now since mate-session doesn't restart apps except on startup. */
- }
- while (event_loop_registrants != NULL)
- {
- gtk_widget_destroy (event_loop_registrants->data);
- }
-}
-#endif
static void dump_debug_log (void)
{
char *filename;
@@ -334,7 +229,7 @@ running_as_root (void)
{
return geteuid () == 0;
}
-#if ENABLE_LIBUNIQUE == (FALSE)
+
int
main (int argc, char *argv[])
{
@@ -397,331 +292,4 @@ main (int argc, char *argv[])
return retval;
}
-#else
-int
-main (int argc, char *argv[])
-{
- gboolean kill_shell;
- gboolean no_default_window;
- gboolean browser_window;
- gboolean no_desktop;
- gboolean version;
- gboolean autostart_mode;
- const char *autostart_id;
- gchar *geometry;
- gchar **remaining;
- gboolean perform_self_check;
- CajaApplication *application;
- GOptionContext *context;
- GFile *file = NULL;
- GFileInfo *fileinfo = NULL;
- GAppInfo *appinfo = NULL;
- char *uri = NULL;
- char **uris = NULL;
- GPtrArray *uris_array;
- GError *error;
- int i;
-
- const GOptionEntry options[] =
- {
-#ifndef CAJA_OMIT_SELF_CHECK
- {
- "check", 'c', 0, G_OPTION_ARG_NONE, &perform_self_check,
- N_("Perform a quick set of self-check tests."), NULL
- },
-#endif
- {
- "version", '\0', 0, G_OPTION_ARG_NONE, &version,
- N_("Show the version of the program."), NULL
- },
- {
- "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry,
- N_("Create the initial window with the given geometry."), N_("GEOMETRY")
- },
- {
- "no-default-window", 'n', 0, G_OPTION_ARG_NONE, &no_default_window,
- N_("Only create windows for explicitly specified URIs."), NULL
- },
- {
- "no-desktop", '\0', 0, G_OPTION_ARG_NONE, &no_desktop,
- N_("Do not manage the desktop (ignore the preference set in the preferences dialog)."), NULL
- },
- {
- "browser", '\0', 0, G_OPTION_ARG_NONE, &browser_window,
- N_("open a browser window."), NULL
- },
- {
- "quit", 'q', 0, G_OPTION_ARG_NONE, &kill_shell,
- N_("Quit Caja."), NULL
- },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, N_("[URI...]") },
-
- { NULL }
- };
-
-#if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD)
- /* Caja uses lots and lots of small and medium size allocations,
- * and then a few large ones for the desktop background. By default
- * glibc uses a dynamic treshold for how large allocations should
- * be mmaped. Unfortunately this triggers quickly for caja when
- * it does the desktop background allocations, raising the limit
- * such that a lot of temporary large allocations end up on the
- * heap and are thus not returned to the OS. To fix this we set
- * a hardcoded limit. I don't know what a good value is, but 128K
- * was the old glibc static limit, lets use that.
- */
- mallopt (M_MMAP_THRESHOLD, 128 *1024);
-#endif
-
-#if !GLIB_CHECK_VERSION (2, 42, 0)
- /* This will be done by gtk+ later, but for now, force it to MATE */
- g_desktop_app_info_set_desktop_env ("MATE");
-#endif
-
- if (g_getenv ("CAJA_DEBUG") != NULL)
- {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- /* Initialize gettext support */
- bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- autostart_mode = FALSE;
- autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
- if (autostart_id != NULL && *autostart_id != '\0')
- {
- autostart_mode = TRUE;
- }
-
- /* Get parameters. */
- remaining = NULL;
- geometry = NULL;
- version = FALSE;
- kill_shell = FALSE;
- no_default_window = FALSE;
- no_desktop = FALSE;
- perform_self_check = FALSE;
- browser_window = FALSE;
-
- g_set_prgname ("caja");
-
- if (g_file_test (DATADIR "/applications/caja.desktop", G_FILE_TEST_EXISTS))
- {
- egg_set_desktop_file (DATADIR "/applications/caja.desktop");
- }
-
- context = g_option_context_new (_("\n\nBrowse the file system with the file manager"));
- g_option_context_add_main_entries (context, options, NULL);
-
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- g_option_context_add_group (context, egg_sm_client_get_option_group ());
-
- error = NULL;
- if (!g_option_context_parse (context, &argc, &argv, &error))
- {
- g_printerr ("Could not parse arguments: %s\n", error->message);
- g_error_free (error);
- return 1;
- }
-
- g_option_context_free (context);
-
- if (version)
- {
- g_print ("MATE caja " PACKAGE_VERSION "\n");
- return 0;
- }
-
-#ifdef HAVE_EXEMPI
- xmp_init();
-#endif
-
- setup_debug_log ();
-
- /* If in autostart mode (aka started by mate-session), we need to ensure
- * caja starts with the correct options.
- */
- if (autostart_mode)
- {
- no_default_window = TRUE;
- no_desktop = FALSE;
- }
- else if (running_as_root () || !running_in_mate ())
- {
- /* do not manage desktop when running as root or on other desktops */
- no_desktop = TRUE;
-
- /* set smclient mode to "no restart" when running as root or on other desktops */
- egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NO_RESTART);
- }
-
- if (perform_self_check && remaining != NULL)
- {
- /* translators: %s is an option (e.g. --check) */
- fprintf (stderr, _("caja: %s cannot be used with URIs.\n"),
- "--check");
- return EXIT_FAILURE;
- }
- if (perform_self_check && kill_shell)
- {
- fprintf (stderr, _("caja: --check cannot be used with other options.\n"));
- return EXIT_FAILURE;
- }
- if (kill_shell && remaining != NULL)
- {
- fprintf (stderr, _("caja: %s cannot be used with URIs.\n"),
- "--quit");
- return EXIT_FAILURE;
- }
- if (geometry != NULL && remaining != NULL && remaining[0] != NULL && remaining[1] != NULL)
- {
- fprintf (stderr, _("caja: --geometry cannot be used with more than one URI.\n"));
- return EXIT_FAILURE;
- }
-
- /* Initialize the services that we use. */
- LIBXML_TEST_VERSION
-
- /* Initialize preferences. This is needed so that proper
- * defaults are available before any preference peeking
- * happens.
- */
- caja_global_preferences_init ();
-
- /* exit_with_last_window is already set to TRUE, and we need to keep that value
- * on other desktops or when running caja as root. Otherwise, we read the value
- * from the configuration.
- */
- if (running_in_mate () && !running_as_root())
- {
- exit_with_last_window = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW);
- }
-
- application = NULL;
-
- /* Do either the self-check or the real work. */
- if (perform_self_check)
- {
- #ifndef CAJA_OMIT_SELF_CHECK
- /* Run the checks (each twice) for caja and libcaja-private. */
-
- caja_run_self_checks ();
- caja_run_lib_self_checks ();
- eel_exit_if_self_checks_failed ();
-
- caja_run_self_checks ();
- caja_run_lib_self_checks ();
- eel_exit_if_self_checks_failed ();
- #endif
- }
- else
- {
- /* Convert args to URIs */
- if (remaining != NULL)
- {
- uris_array = g_ptr_array_new ();
- for (i = 0; remaining[i] != NULL; i++)
- {
- file = g_file_new_for_commandline_arg (remaining[i]);
- if (file != NULL)
- {
- uri = g_file_get_uri (file);
- if (uri)
- {
- fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
- if (fileinfo && g_file_info_get_file_type(fileinfo) == G_FILE_TYPE_DIRECTORY)
- {
- g_ptr_array_add (uris_array, uri);
- }
- else
- {
- if (fileinfo)
- g_object_unref (fileinfo);
- fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
- if (fileinfo)
- {
- appinfo = g_app_info_get_default_for_type (g_file_info_get_content_type (fileinfo), TRUE);
- if (appinfo)
- {
- if (g_strcmp0 (g_app_info_get_executable (appinfo), "caja") != 0)
- {
- g_app_info_launch_default_for_uri (uri, NULL, NULL);
- }
- else
- {
- fprintf (stderr, _("caja: set erroneously as default application for '%s' content type.\n"),
- g_file_info_get_content_type (fileinfo));
- }
- g_object_unref (appinfo);
- }
- g_free (uri);
- }
- else
- {
- g_ptr_array_add (uris_array, uri);
- }
- }
- if (fileinfo)
- g_object_unref (fileinfo);
- }
- if (file)
- g_object_unref (file);
- }
- }
- if (uris_array->len == 0)
- {
- /* Caja is being used only to open files (not directories), so closing */
- g_strfreev (remaining);
- return EXIT_SUCCESS;
- }
- g_ptr_array_add (uris_array, NULL);
- uris = (char**) g_ptr_array_free (uris_array, FALSE);
- g_strfreev (remaining);
- }
-
-
- /* Run the caja application. */
- application = caja_application_new ();
-
- if (egg_sm_client_is_resumed (application->smclient))
- {
- no_default_window = TRUE;
- }
-
- caja_application_startup
- (application,
- kill_shell, no_default_window, no_desktop,
- browser_window,
- geometry,
- uris);
- g_strfreev (uris);
-
- if (unique_app_is_running (application->unique_app) ||
- kill_shell)
- {
- exit_with_last_window = TRUE;
- }
-
- if (is_event_loop_needed ())
- {
- gtk_main ();
- }
- }
-
- caja_icon_info_clear_caches ();
-
- if (application != NULL)
- {
- g_object_unref (application);
- }
-
- eel_debug_shut_down ();
-
- caja_application_save_accel_map (NULL);
-
- return EXIT_SUCCESS;
-}
-#endif
diff --git a/src/caja-main.h b/src/caja-main.h
deleted file mode 100644
index abb9e6a7..00000000
--- a/src/caja-main.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * Caja
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000 Eazel, Inc.
- *
- * Caja is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Caja is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/* caja-main.c
- */
-
-#ifndef CAJA_MAIN_H
-#define CAJA_MAIN_H
-
-#include <gtk/gtk.h>
-
-#if GTK_CHECK_VERSION(3, 0, 0)
-void caja_main_event_loop_register (GtkWidget *object);
-#else
-void caja_main_event_loop_register (GtkObject *object);
-#endif
-gboolean caja_main_is_event_loop_mainstay (GtkWidget *object);
-void caja_main_event_loop_quit (gboolean explicit);
-
-#endif /* CAJA_MAIN_H */
-
diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c
index 2f7a1f5b..4b40494c 100644
--- a/src/caja-navigation-window-menus.c
+++ b/src/caja-navigation-window-menus.c
@@ -64,7 +64,6 @@
static void schedule_refresh_go_menu (CajaNavigationWindow *window);
-#if ENABLE_LIBUNIQUE == (FALSE)
static void
action_close_all_windows_callback (GtkAction *action,
gpointer user_data)
@@ -74,14 +73,7 @@ action_close_all_windows_callback (GtkAction *action,
app = CAJA_APPLICATION (g_application_get_default ());
caja_application_close_all_navigation_windows (app);
}
-#else
-static void
-action_close_all_windows_callback (GtkAction *action,
- gpointer user_data)
-{
- caja_application_close_all_navigation_windows ();
-}
-#endif
+
static gboolean
should_open_in_new_tab (void)
{
@@ -622,9 +614,6 @@ action_new_window_callback (GtkAction *action,
current_window = CAJA_WINDOW (user_data);
new_window = caja_application_create_navigation_window (
current_window->application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gtk_window_get_screen (GTK_WINDOW (current_window)));
caja_window_go_home (new_window);
}
diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c
index 49a80cb4..62e0f9a2 100644
--- a/src/caja-navigation-window-pane.c
+++ b/src/caja-navigation-window-pane.c
@@ -45,11 +45,6 @@ G_DEFINE_TYPE (CajaNavigationWindowPane,
CAJA_TYPE_WINDOW_PANE)
#define parent_class caja_navigation_window_pane_parent_class
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static void
real_set_active (CajaWindowPane *pane, gboolean is_active)
{
@@ -747,9 +742,9 @@ caja_navigation_window_pane_setup (CajaNavigationWindowPane *pane)
CajaEntry *entry;
GtkSizeGroup *header_size_group;
- pane->widget = gtk_vbox_new (FALSE, 0);
+ pane->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
pane->location_bar = hbox;
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (pane->widget), hbox,
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c
index f5127b8f..08a7704b 100644
--- a/src/caja-navigation-window.c
+++ b/src/caja-navigation-window.c
@@ -34,9 +34,6 @@
#include "caja-actions.h"
#include "caja-application.h"
#include "caja-bookmarks-window.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-main.h"
-#endif
#include "caja-location-bar.h"
#include "caja-query-editor.h"
#include "caja-search-bar.h"
@@ -94,10 +91,6 @@ static CajaWindowSlot *create_extra_pane (CajaNavigationWindow *window);
G_DEFINE_TYPE (CajaNavigationWindow, caja_navigation_window, CAJA_TYPE_WINDOW)
#define parent_class caja_navigation_window_parent_class
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static const struct
{
unsigned int keyval;
@@ -124,12 +117,10 @@ caja_navigation_window_init (CajaNavigationWindow *window)
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_NAVIGATION_WINDOW, CajaNavigationWindowDetails);
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (context, "caja-navigation-window");
-#endif
pane = caja_navigation_window_pane_new (win);
win->details->panes = g_list_prepend (win->details->panes, pane);
@@ -137,34 +128,20 @@ caja_navigation_window_init (CajaNavigationWindow *window)
window->details->header_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
gtk_size_group_set_ignore_hidden (window->details->header_size_group, FALSE);
-#if GTK_CHECK_VERSION(3, 0, 0)
window->details->content_paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_hexpand (window->details->content_paned, TRUE);
gtk_widget_set_vexpand (window->details->content_paned, TRUE);
gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid),
window->details->content_paned,
0, 3, 1, 1);
-#else
- window->details->content_paned = gtk_hpaned_new ();
- gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table),
- window->details->content_paned,
- /* X direction */ /* Y direction */
- 0, 1, 3, 4,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-#endif
gtk_widget_show (window->details->content_paned);
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_paned_pack2 (GTK_PANED (window->details->content_paned), vbox,
TRUE, FALSE);
gtk_widget_show (vbox);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
+
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- hpaned = gtk_hpaned_new ();
-#endif
gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
gtk_widget_show (hpaned);
window->details->split_view_hpane = hpaned;
@@ -187,22 +164,12 @@ caja_navigation_window_init (CajaNavigationWindow *window)
ui_manager = caja_window_get_ui_manager (CAJA_WINDOW (window));
toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
window->details->toolbar = toolbar;
gtk_widget_set_hexpand (toolbar, TRUE);
gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid),
toolbar,
0, 1, 1, 1);
-#else
- window->details->toolbar = toolbar;
- gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table),
- toolbar,
- /* X direction */ /* Y direction */
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-#endif
gtk_widget_show (toolbar);
caja_navigation_window_initialize_toolbars (window);
@@ -570,11 +537,7 @@ caja_navigation_window_key_press_event (GtkWidget *widget,
return GTK_WIDGET_CLASS (caja_navigation_window_parent_class)->key_press_event (widget, event);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean
-#else
-gboolean
-#endif
caja_navigation_window_button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
@@ -606,11 +569,7 @@ caja_navigation_window_button_press_event (GtkWidget *widget,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
caja_navigation_window_destroy (GtkWidget *object)
-#else
-caja_navigation_window_destroy (GtkObject *object)
-#endif
{
CajaNavigationWindow *window;
@@ -626,11 +585,7 @@ caja_navigation_window_destroy (GtkObject *object)
window->details->content_paned = NULL;
window->details->split_view_hpane = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-#endif
}
static void
@@ -1261,11 +1216,8 @@ caja_navigation_window_class_init (CajaNavigationWindowClass *class)
CAJA_WINDOW_CLASS (class)->bookmarks_placeholder = MENU_PATH_BOOKMARKS_PLACEHOLDER;
G_OBJECT_CLASS (class)->finalize = caja_navigation_window_finalize;
-#if GTK_CHECK_VERSION (3, 0, 0)
+
GTK_WIDGET_CLASS (class)->destroy = caja_navigation_window_destroy;
-#else
- GTK_OBJECT_CLASS (class)->destroy = caja_navigation_window_destroy;
-#endif
GTK_WIDGET_CLASS (class)->show = caja_navigation_window_show;
GTK_WIDGET_CLASS (class)->window_state_event = caja_navigation_window_state_event;
GTK_WIDGET_CLASS (class)->key_press_event = caja_navigation_window_key_press_event;
diff --git a/src/caja-navigation-window.h b/src/caja-navigation-window.h
index 231d140c..18c713bd 100644
--- a/src/caja-navigation-window.h
+++ b/src/caja-navigation-window.h
@@ -115,9 +115,5 @@ gboolean caja_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widge
CajaNavigationWindow *window);
gboolean caja_navigation_window_is_in_temporary_search_bar (GtkWidget *widget,
CajaNavigationWindow *window);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-gboolean caja_window_button_press_event (GtkWidget *widget,
- GdkEventButton *event);
-#endif
#endif
diff --git a/src/caja-notebook.c b/src/caja-notebook.c
index 199e7a2b..1dd5f6a9 100644
--- a/src/caja-notebook.c
+++ b/src/caja-notebook.c
@@ -40,10 +40,6 @@
#define AFTER_ALL_TABS -1
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
static void caja_notebook_init (CajaNotebook *notebook);
static void caja_notebook_class_init (CajaNotebookClass *klass);
static int caja_notebook_insert_page (GtkNotebook *notebook,
@@ -81,17 +77,6 @@ caja_notebook_class_init (CajaNotebookClass *klass)
notebook_class->insert_page = caja_notebook_insert_page;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_rc_parse_string ("style \"caja-tab-close-button-style\"\n"
- "{\n"
- "GtkWidget::focus-padding = 0\n"
- "GtkWidget::focus-line-width = 0\n"
- "xthickness = 0\n"
- "ythickness = 0\n"
- "}\n"
- "widget \"*.caja-tab-close-button\" style \"caja-tab-close-button-style\"");
-#endif
-
signals[TAB_CLOSE_REQUEST] =
g_signal_new ("tab-close-request",
G_OBJECT_CLASS_TYPE (object_class),
@@ -186,12 +171,10 @@ button_press_cb (CajaNotebook *notebook,
static void
caja_notebook_init (CajaNotebook *notebook)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (notebook));
gtk_style_context_add_class (context, "caja-notebook");
-#endif
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
@@ -307,7 +290,7 @@ build_tab_label (CajaNotebook *nb, CajaWindowSlot *slot)
/* set hbox spacing and label padding (see below) so that there's an
* equal amount of space around the label */
- hbox = gtk_hbox_new (FALSE, 4);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_show (hbox);
/* setup load feedback */
@@ -329,14 +312,11 @@ build_tab_label (CajaNotebook *nb, CajaWindowSlot *slot)
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_margin_start (label, 0);
gtk_widget_set_margin_end (label, 0);
gtk_widget_set_margin_top (label, 0);
gtk_widget_set_margin_bottom (label, 0);
-#else
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
-#endif
+
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index 91722633..8c5fec70 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -35,14 +35,6 @@
#include "caja-window-private.h"
#include "caja-window-slot.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
enum
{
PATH_CLICKED,
@@ -90,9 +82,6 @@ struct _ButtonData
GtkWidget *image;
GtkWidget *label;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkWidget *alignment;
-#endif
guint ignore_changes : 1;
guint file_is_hidden : 1;
guint fake_root : 1;
@@ -106,17 +95,14 @@ G_DEFINE_TYPE (CajaPathBar,
static void caja_path_bar_finalize (GObject *object);
static void caja_path_bar_dispose (GObject *object);
-#if GTK_CHECK_VERSION(3,0,0)
+
static void caja_path_bar_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void caja_path_bar_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
-#else
-static void caja_path_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-#endif
+
static void caja_path_bar_unmap (GtkWidget *widget);
static void caja_path_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@@ -143,12 +129,9 @@ static void caja_path_bar_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void caja_path_bar_state_changed (GtkWidget *widget,
GtkStateType previous_state);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
static void caja_path_bar_style_updated (GtkWidget *widget);
-#else
-static void caja_path_bar_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
+
static void caja_path_bar_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void caja_path_bar_check_icon_theme (CajaPathBar *path_bar);
@@ -159,7 +142,7 @@ static gboolean caja_path_bar_update_path (CajaPathBar *path_bar,
GFile *file_path,
gboolean emit_signal);
-#if GTK_CHECK_VERSION(3,0,0)
+
static GtkWidget *
get_slider_button (CajaPathBar *path_bar,
const gchar *arrow_type)
@@ -179,26 +162,6 @@ get_slider_button (CajaPathBar *path_bar,
return button;
}
-#else
-static GtkWidget *
-get_slider_button (CajaPathBar *path_bar,
- GtkArrowType arrow_type)
-{
- GtkWidget *button;
-
- gtk_widget_push_composite_child ();
-
- button = gtk_button_new ();
- gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
- gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (arrow_type, GTK_SHADOW_OUT));
- gtk_container_add (GTK_CONTAINER (path_bar), button);
- gtk_widget_show_all (button);
-
- gtk_widget_pop_composite_child ();
-
- return button;
-}
-#endif
static void
update_button_types (CajaPathBar *path_bar)
@@ -341,28 +304,22 @@ static void
caja_path_bar_init (CajaPathBar *path_bar)
{
char *p;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
gtk_style_context_add_class (context, "caja-pathbar");
-#endif
gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
path_bar->spacing = 3;
-#if GTK_CHECK_VERSION(3, 0, 0)
path_bar->up_slider_button = get_slider_button (path_bar, "pan-start-symbolic");
path_bar->down_slider_button = get_slider_button (path_bar, "pan-end-symbolic");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar->up_slider_button)),
"slider-button");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar->down_slider_button)),
"slider-button");
-#else
- path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
- path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
-#endif
+
path_bar->icon_size = CAJA_PATH_BAR_ICON_SIZE;
p = caja_get_desktop_directory ();
@@ -431,19 +388,13 @@ caja_path_bar_class_init (CajaPathBarClass *path_bar_class)
gobject_class->finalize = caja_path_bar_finalize;
gobject_class->dispose = caja_path_bar_dispose;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_height = caja_path_bar_get_preferred_height;
widget_class->get_preferred_width = caja_path_bar_get_preferred_width;
-#else
- widget_class->size_request = caja_path_bar_size_request;
-#endif
+
widget_class->unmap = caja_path_bar_unmap;
widget_class->size_allocate = caja_path_bar_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->style_updated = caja_path_bar_style_updated;
-#else
- widget_class->style_set = caja_path_bar_style_set;
-#endif
+
widget_class->screen_changed = caja_path_bar_screen_changed;
widget_class->grab_notify = caja_path_bar_grab_notify;
widget_class->state_changed = caja_path_bar_state_changed;
@@ -472,9 +423,7 @@ caja_path_bar_class_init (CajaPathBarClass *path_bar_class)
G_TYPE_NONE, 1,
G_TYPE_FILE);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_container_class_handle_border_width (container_class);
-#endif
}
@@ -548,7 +497,7 @@ caja_path_bar_dispose (GObject *object)
* Ideally, our size is determined by another widget, and we are just filling
* available space.
*/
-#if GTK_CHECK_VERSION(3,0,0)
+
static void
caja_path_bar_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -626,53 +575,6 @@ caja_path_bar_get_preferred_height (GtkWidget *widget,
}
}
-#else /* GTK_CHECK_VERSION(3,0,0) */
-
-static void
-caja_path_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- ButtonData *button_data;
- CajaPathBar *path_bar;
- GtkRequisition child_requisition;
- GList *list;
- guint border_width;
-
- path_bar = CAJA_PATH_BAR (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- for (list = path_bar->button_list; list; list = list->next)
- {
- button_data = BUTTON_DATA (list->data);
- gtk_widget_size_request (button_data->button, &child_requisition);
- requisition->width = MAX (child_requisition.width, requisition->width);
- requisition->height = MAX (child_requisition.height, requisition->height);
- }
-
- /* Add space for slider, if we have more than one path */
- /* Theoretically, the slider could be bigger than the other button. But we're */
- /* not going to worry about that now.*/
-
- path_bar->slider_width = MIN(requisition->height * 2 / 3 + 5, requisition->height);
- if (path_bar->button_list && path_bar->button_list->next != NULL)
- {
- requisition->width += (path_bar->spacing + path_bar->slider_width) * 2;
- }
-
- gtk_widget_size_request (path_bar->up_slider_button, &child_requisition);
- gtk_widget_size_request (path_bar->down_slider_button, &child_requisition);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width += border_width * 2;
- requisition->height += border_width * 2;
-
- gtk_widget_set_size_request (widget, requisition->width,
- requisition->height);
-}
-#endif /* GTK_CHECK_VERSION(3,0,0) */
-
static void
caja_path_bar_update_slider_buttons (CajaPathBar *path_bar)
{
@@ -741,12 +643,8 @@ caja_path_bar_size_allocate (GtkWidget *widget,
return;
}
direction = gtk_widget_get_direction (widget);
-#if GTK_CHECK_VERSION(3,0,0)
+
allocation_width = allocation->width;
-#else
- gint border_width = (gint) gtk_container_get_border_width (GTK_CONTAINER (path_bar));
- allocation_width = allocation->width - 2 * border_width;
-#endif
/* First, we check to see if we need the scrollbars. */
if (path_bar->fake_root)
@@ -859,45 +757,27 @@ caja_path_bar_size_allocate (GtkWidget *widget,
}
/* Now, we allocate space to the buttons */
-#if GTK_CHECK_VERSION(3,0,0)
child_allocation.y = allocation->y;
child_allocation.height = allocation->height;
-#else
- child_allocation.y = allocation->y + border_width;
- child_allocation.height = MAX (1, (gint) allocation->height - border_width * 2);
-#endif
if (direction == GTK_TEXT_DIR_RTL)
{
-#if GTK_CHECK_VERSION(3,0,0)
child_allocation.x = allocation->x + allocation->width;
-#else
- child_allocation.x = allocation->x + allocation->width - border_width;
-#endif
+
if (need_sliders || path_bar->fake_root)
{
child_allocation.x -= (path_bar->spacing + path_bar->slider_width);
-#if GTK_CHECK_VERSION(3,0,0)
up_slider_offset = allocation->width - path_bar->slider_width;
-#else
- up_slider_offset = allocation->width - border_width - path_bar->slider_width;
-#endif
+
}
}
else
{
-#if GTK_CHECK_VERSION(3,0,0)
child_allocation.x = allocation->x;
-#else
- child_allocation.x = allocation->x + border_width;
-#endif
+
if (need_sliders || path_bar->fake_root)
{
-#if GTK_CHECK_VERSION(3,0,0)
up_slider_offset = 0;
-#else
- up_slider_offset = border_width;
-#endif
child_allocation.x += (path_bar->spacing + path_bar->slider_width);
}
}
@@ -917,11 +797,7 @@ caja_path_bar_size_allocate (GtkWidget *widget,
/* Check to see if we've don't have any more space to allocate buttons */
if (need_sliders && direction == GTK_TEXT_DIR_RTL)
{
-#if GTK_CHECK_VERSION(3,0,0)
if (child_allocation.x - path_bar->spacing - path_bar->slider_width < widget_allocation.x)
-#else
- if (child_allocation.x - path_bar->spacing - path_bar->slider_width < widget_allocation.x + border_width)
-#endif
{
break;
}
@@ -930,11 +806,8 @@ caja_path_bar_size_allocate (GtkWidget *widget,
{
if (need_sliders && direction == GTK_TEXT_DIR_LTR)
{
-#if GTK_CHECK_VERSION(3,0,0)
if (child_allocation.x + child_allocation.width + path_bar->spacing + path_bar->slider_width > widget_allocation.x + allocation_width)
-#else
- if (child_allocation.x + child_allocation.width + path_bar->spacing + path_bar->slider_width > widget_allocation.x + border_width + allocation_width)
-#endif
+
{
break;
}
@@ -948,20 +821,13 @@ caja_path_bar_size_allocate (GtkWidget *widget,
{
child_allocation.x -= path_bar->spacing;
down_slider_offset = child_allocation.x - widget_allocation.x - path_bar->slider_width;
-#if GTK_CHECK_VERSION(3,0,0)
down_slider_offset = child_allocation.x - allocation->x - path_bar->slider_width;
-#else
- down_slider_offset = border_width;
-#endif
}
else
{
down_slider_offset = child_allocation.x - widget_allocation.x;
-#if GTK_CHECK_VERSION(3,0,0)
down_slider_offset += child_allocation.width + path_bar->spacing;
-#else
- down_slider_offset = allocation->width - border_width - path_bar->slider_width;
-#endif
+
child_allocation.x += child_allocation.width + path_bar->spacing;
}
}
@@ -1007,19 +873,11 @@ caja_path_bar_size_allocate (GtkWidget *widget,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
caja_path_bar_style_updated (GtkWidget *widget)
{
if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated)
{
GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated (widget);
-#else
-caja_path_bar_style_set (GtkWidget *widget, GtkStyle *previous_style)
-{
- if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set)
- {
- GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set (widget, previous_style);
-#endif
}
caja_path_bar_check_icon_theme (CAJA_PATH_BAR (widget));
@@ -1176,9 +1034,6 @@ caja_path_bar_scroll_down (CajaPathBar *path_bar)
gtk_widget_queue_resize (GTK_WIDGET (path_bar));
-#if !GTK_CHECK_VERSION(3,0,0)
- gint border_width = gtk_container_get_border_width (GTK_CONTAINER (path_bar));
-#endif
direction = gtk_widget_get_direction (GTK_WIDGET (path_bar));
/* We find the button at the 'down' end that we have to make */
@@ -1219,9 +1074,6 @@ caja_path_bar_scroll_down (CajaPathBar *path_bar)
else
{
space_available = (allocation.x + allocation.width) -
-#if !GTK_CHECK_VERSION(3,0,0)
- border_width -
-#endif
(slider_allocation.x + slider_allocation.width);
}
@@ -1270,10 +1122,6 @@ caja_path_bar_scroll_timeout (CajaPathBar *path_bar)
{
gboolean retval = FALSE;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GDK_THREADS_ENTER ();
-#endif
-
if (path_bar->timer)
{
if (gtk_widget_has_focus (path_bar->up_slider_button))
@@ -1302,10 +1150,6 @@ caja_path_bar_scroll_timeout (CajaPathBar *path_bar)
}
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GDK_THREADS_LEAVE ();
-#endif
-
return retval;
}
@@ -1604,7 +1448,6 @@ get_dir_name (ButtonData *button_data)
/* We always want to request the same size for the label, whether
* or not the contents are bold
*/
-#if GTK_CHECK_VERSION(3,0,0)
static void
set_label_padding_size (ButtonData *button_data)
{
@@ -1632,33 +1475,6 @@ set_label_padding_size (ButtonData *button_data)
g_object_unref (layout);
}
-#else /* GTK_CHECK_VERSION(3,0,0) */
-
-static void
-label_size_request_cb (GtkWidget *widget,
- GtkRequisition *requisition,
- ButtonData *button_data)
-{
- const gchar *dir_name = get_dir_name (button_data);
- PangoLayout *layout;
- gint bold_width, bold_height;
- gchar *markup;
-
- layout = gtk_widget_create_pango_layout (button_data->label, dir_name);
- pango_layout_get_pixel_size (layout, &requisition->width, &requisition->height);
-
- markup = g_markup_printf_escaped ("<b>%s</b>", dir_name);
- pango_layout_set_markup (layout, markup, -1);
- g_free (markup);
-
- pango_layout_get_pixel_size (layout, &bold_width, &bold_height);
- requisition->width = MAX (requisition->width, bold_width);
- requisition->height = MAX (requisition->height, bold_height);
-
- g_object_unref (layout);
-}
-#endif /* GTK_CHECK_VERSION(3,0,0) */
-
static void
caja_path_bar_update_button_appearance (ButtonData *button_data)
{
@@ -1674,18 +1490,15 @@ caja_path_bar_update_button_appearance (ButtonData *button_data)
markup = g_markup_printf_escaped ("<b>%s</b>", dir_name);
gtk_label_set_markup (GTK_LABEL (button_data->label), markup);
-#if GTK_CHECK_VERSION(3,0,0)
+
gtk_widget_set_margin_end (GTK_WIDGET (button_data->label), 0);
gtk_widget_set_margin_start (GTK_WIDGET (button_data->label), 0);
-#endif
g_free(markup);
}
else
{
gtk_label_set_text (GTK_LABEL (button_data->label), dir_name);
-#if GTK_CHECK_VERSION(3,0,0)
set_label_padding_size (button_data);
-#endif
}
}
@@ -1715,20 +1528,16 @@ caja_path_bar_update_button_appearance (ButtonData *button_data)
if (pixbuf != NULL)
{
gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), pixbuf);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button),
"image-button");
-#endif
gtk_widget_show (GTK_WIDGET (button_data->image));
g_object_unref (pixbuf);
}
else
{
gtk_widget_hide (GTK_WIDGET (button_data->image));
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_remove_class (gtk_widget_get_style_context (button_data->button),
"image-button");
-#endif
}
}
}
@@ -2058,17 +1867,11 @@ make_directory_button (CajaPathBar *path_bar,
{
GFile *path;
GtkWidget *child;
-#if !GTK_CHECK_VERSION(3,0,0)
- GtkWidget *label_alignment;
-#endif
ButtonData *button_data;
path = caja_file_get_location (file);
child = NULL;
-#if !GTK_CHECK_VERSION(3,0,0)
- label_alignment = NULL;
-#endif
file_is_hidden = !! file_is_hidden;
/* Is it a special button? */
@@ -2076,10 +1879,8 @@ make_directory_button (CajaPathBar *path_bar,
setup_button_type (button_data, path_bar, path);
button_data->button = gtk_toggle_button_new ();
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button),
"text-button");
-#endif
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_set_focus_on_click (button_data->button, FALSE);
#else
@@ -2102,47 +1903,20 @@ make_directory_button (CajaPathBar *path_bar,
case MOUNT_BUTTON:
case DEFAULT_LOCATION_BUTTON:
button_data->label = gtk_label_new (NULL);
-#if GTK_CHECK_VERSION(3,0,0)
- child = gtk_hbox_new (FALSE, 2);
+ child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
-#else
- label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
- child = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
-#endif
+
break;
case NORMAL_BUTTON:
default:
button_data->label = gtk_label_new (NULL);
-#if GTK_CHECK_VERSION(3,0,0)
- child = gtk_hbox_new (FALSE, 2);
+ child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
-#else
- label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
- child = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
-#endif
button_data->is_base_dir = base_dir;
}
-#if !GTK_CHECK_VERSION(3,0,0)
- /* label_alignment is created because we can't override size-request
- * on label itself and still have the contents of the label centered
- * properly in the label's requisition
- */
- if (label_alignment)
- {
- g_signal_connect (label_alignment, "size-request",
- G_CALLBACK (label_size_request_cb), button_data);
- }
-#endif
-
if (button_data->path == NULL)
{
button_data->path = g_object_ref (path);
@@ -2280,10 +2054,6 @@ caja_path_bar_update_path (CajaPathBar *path_bar,
file = caja_file_get (file_path);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
while (file != NULL)
{
parent_file = caja_file_get_parent (file);
@@ -2319,10 +2089,6 @@ caja_path_bar_update_path (CajaPathBar *path_bar,
gtk_container_add (GTK_CONTAINER (path_bar), button);
}
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
-
if (path_bar->current_path != NULL)
{
g_object_unref (path_bar->current_path);
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index b406032e..22652671 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -27,14 +27,9 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-glib-extensions.h>
-#if GTK_CHECK_VERSION(3,0,0)
#include <eel/eel-graphic-effects.h>
-#endif
#include <eel/eel-string.h>
#include <eel/eel-stock-dialogs.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#include <eel/eel-gdk-pixbuf-extensions.h>
-#endif
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -166,12 +161,8 @@ static void open_selected_bookmark (CajaPlacesSidebar
GtkTreePath *path,
CajaWindowOpenFlags flags);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void caja_places_sidebar_style_updated (GtkWidget *widget);
-#else
-static void caja_places_sidebar_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
+
static gboolean eject_or_unmount_bookmark (CajaPlacesSidebar *sidebar,
GtkTreePath *path);
static gboolean eject_or_unmount_selection (CajaPlacesSidebar *sidebar);
@@ -254,11 +245,7 @@ get_eject_icon (gboolean highlighted)
if (highlighted) {
GdkPixbuf *high;
-#if GTK_CHECK_VERSION(3,0,0)
high = eel_create_spotlight_pixbuf (eject);
-#else
- high = eel_gdk_pixbuf_render (eject, 1, 255, 255, 0, 0);
-#endif
g_object_unref (eject);
eject = high;
}
@@ -1035,11 +1022,9 @@ over_eject_button (CajaPlacesSidebar *sidebar,
eject_button_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
if (x - total_width >= 0 &&
-#if GTK_CHECK_VERSION (3, 0, 0)
/* fix unwanted unmount requests if clicking on the label */
x >= total_width - eject_button_size &&
x >= 80 &&
-#endif
x - total_width <= eject_button_size) {
return TRUE;
}
@@ -1895,9 +1880,6 @@ volume_mounted_cb (GVolume *volume,
cur = CAJA_WINDOW (sidebar->window);
new = caja_application_create_navigation_window (cur->application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gtk_window_get_screen (GTK_WINDOW (cur)));
caja_window_go_to (new, location);
}
@@ -1980,9 +1962,6 @@ open_selected_bookmark (CajaPlacesSidebar *sidebar,
cur = CAJA_WINDOW (sidebar->window);
new = caja_application_create_navigation_window (cur->application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gtk_window_get_screen (GTK_WINDOW (cur)));
caja_window_go_to (new, location);
}
@@ -3412,11 +3391,7 @@ caja_places_sidebar_class_init (CajaPlacesSidebarClass *class)
{
G_OBJECT_CLASS (class)->dispose = caja_places_sidebar_dispose;
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (class)->style_updated = caja_places_sidebar_style_updated;
-#else
- GTK_WIDGET_CLASS (class)->style_set = caja_places_sidebar_style_set;
-#endif
}
static const char *
@@ -3504,12 +3479,7 @@ caja_places_sidebar_set_parent_window (CajaPlacesSidebar *sidebar,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
caja_places_sidebar_style_updated (GtkWidget *widget)
-#else
-caja_places_sidebar_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-#endif
{
CajaPlacesSidebar *sidebar;
diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c
index 28a778e7..437e0bec 100644
--- a/src/caja-property-browser.c
+++ b/src/caja-property-browser.c
@@ -183,11 +183,6 @@ static GdkPixbuf * make_color_drag_image (CajaPropertyBro
#define ERASE_OBJECT_NAME "erase.png"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum
{
PROPERTY_TYPE
@@ -300,21 +295,19 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser)
gtk_window_set_wmclass (GTK_WINDOW (widget), "property_browser", "Caja");
gtk_window_set_type_hint (GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_DIALOG);
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (property_browser));
gtk_style_context_add_class (context, "caja-property-browser");
-#endif
/* create the main vbox. */
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (property_browser), vbox);
/* create the container box */
- property_browser->details->container = gtk_hbox_new (FALSE, 6);
+ property_browser->details->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (GTK_WIDGET (property_browser->details->container));
gtk_box_pack_start (GTK_BOX (vbox),
property_browser->details->container,
@@ -335,13 +328,13 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser)
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
/* allocate a table to hold the category selector */
- property_browser->details->category_box = gtk_vbox_new (FALSE, 6);
+ property_browser->details->category_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add(GTK_CONTAINER(viewport), property_browser->details->category_box);
gtk_container_add (GTK_CONTAINER (property_browser->details->category_container), viewport);
gtk_widget_show (GTK_WIDGET (property_browser->details->category_box));
/* make the content container vbox */
- property_browser->details->content_container = gtk_vbox_new (FALSE, 6);
+ property_browser->details->content_container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (property_browser->details->content_container);
gtk_box_pack_start (GTK_BOX (property_browser->details->container),
property_browser->details->content_container,
@@ -360,7 +353,7 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser)
gtk_widget_show(temp_frame);
gtk_container_add(GTK_CONTAINER(property_browser->details->title_box), temp_frame);
- temp_hbox = gtk_hbox_new(FALSE, 0);
+ temp_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(temp_hbox);
gtk_container_add(GTK_CONTAINER(temp_frame), temp_hbox);
@@ -385,7 +378,7 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser)
temp_box = gtk_event_box_new();
gtk_widget_show(temp_box);
- property_browser->details->bottom_box = gtk_hbox_new (FALSE, 6);
+ property_browser->details->bottom_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (property_browser->details->bottom_box);
gtk_box_pack_end (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
@@ -1103,11 +1096,7 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser)
GtkWidget *button;
GtkWidget *dialog;
GtkWidget *label;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid = gtk_grid_new ();
-#else
- GtkWidget *table = gtk_table_new(2, 2, FALSE);
-#endif
dialog = gtk_dialog_new_with_buttons (_("Create a New Emblem"),
GTK_WINDOW (property_browser), 0,
@@ -1115,41 +1104,28 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser)
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
/* install the grid in the dialog */
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_widget_show (grid);
-#else
- /* install the table in the dialog */
- 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);
- gtk_widget_show (table);
-#endif
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0);
-#else
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0);
-#endif
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);
/* make the keyword label and field */
widget = gtk_label_new_with_mnemonic(_("_Keyword:"));
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (widget, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (widget), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
#endif
gtk_widget_show(widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(GTK_GRID(grid), widget, 0, 0, 1, 1);
property_browser->details->keyword = gtk_entry_new ();
@@ -1157,15 +1133,6 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser)
gtk_entry_set_max_length (GTK_ENTRY (property_browser->details->keyword), 24);
gtk_widget_show(property_browser->details->keyword);
gtk_grid_attach(GTK_GRID(grid), property_browser->details->keyword, 1, 0, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
- property_browser->details->keyword = gtk_entry_new ();
- gtk_entry_set_activates_default (GTK_ENTRY (property_browser->details->keyword), TRUE);
- gtk_entry_set_max_length (GTK_ENTRY (property_browser->details->keyword), 24);
- gtk_widget_show(property_browser->details->keyword);
- gtk_table_attach(GTK_TABLE(table), property_browser->details->keyword, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-#endif
gtk_widget_grab_focus(property_browser->details->keyword);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget),
GTK_WIDGET (property_browser->details->keyword));
@@ -1176,20 +1143,15 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser)
/* set up a file chooser to pick the image file */
label = gtk_label_new_with_mnemonic (_("_Image:"));
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show (label);
gtk_grid_attach (GTK_GRID(grid), label, 0, 1, 1, 1);
-#else
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
- widget = gtk_hbox_new (FALSE, 0);
+ widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (widget);
button = gtk_button_new ();
@@ -1200,11 +1162,7 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
gtk_widget_show (button);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), widget, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
return dialog;
@@ -1217,11 +1175,8 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser)
{
GtkWidget *widget;
GtkWidget *dialog;
-#if GTK_CHECK_VERSION (3, 0, 0)
+
GtkWidget *grid = gtk_grid_new ();
-#else
- GtkWidget *table = gtk_table_new(2, 2, FALSE);
-#endif
dialog = gtk_dialog_new_with_buttons (_("Create a New Color:"),
GTK_WINDOW (property_browser), 0,
@@ -1229,26 +1184,17 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser)
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
/* install the grid in the dialog */
gtk_widget_show (grid);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0);
-#else
- /* install the table in the dialog */
- gtk_widget_show (table);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0);
-#endif
+
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);
/* make the name label and field */
widget = gtk_label_new_with_mnemonic(_("Color _name:"));
gtk_widget_show(widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(GTK_GRID(grid), widget, 0, 0, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-#endif
property_browser->details->color_name = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (property_browser->details->color_name), TRUE);
@@ -1256,11 +1202,7 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser)
gtk_widget_grab_focus (property_browser->details->color_name);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), property_browser->details->color_name);
gtk_widget_show(property_browser->details->color_name);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(GTK_GRID(grid), property_browser->details->color_name, 1, 0, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE(table), property_browser->details->color_name, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-#endif
gtk_widget_grab_focus(property_browser->details->color_name);
/* default image is the generic emblem */
@@ -1268,21 +1210,13 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser)
widget = gtk_label_new_with_mnemonic(_("Color _value:"));
gtk_widget_show(widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(GTK_GRID(grid), widget, 0, 1, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
property_browser->details->color_picker = gtk_color_button_new ();
gtk_widget_show (property_browser->details->color_picker);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), property_browser->details->color_picker);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(GTK_GRID(grid), property_browser->details->color_picker, 1, 1, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE(table), property_browser->details->color_picker, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
return dialog;
}
@@ -2254,9 +2188,7 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser)
/* allocate a new container, with a scrollwindow and viewport */
property_browser->details->content_frame = gtk_scrolled_window_new (NULL, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_vexpand (property_browser->details->content_frame, TRUE);
-#endif
viewport = gtk_viewport_new (NULL, NULL);
gtk_widget_show(viewport);
gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_IN);
diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c
index 38ef74bf..8319db25 100644
--- a/src/caja-query-editor.c
+++ b/src/caja-query-editor.c
@@ -34,11 +34,6 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
typedef enum
{
CAJA_QUERY_EDITOR_ROW_LOCATION,
@@ -143,11 +138,7 @@ static CajaQueryEditorRowOps row_type[] =
EEL_CLASS_BOILERPLATE (CajaQueryEditor,
caja_query_editor,
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_TYPE_BOX)
-#else
- GTK_TYPE_VBOX)
-#endif
static void
caja_query_editor_finalize (GObject *object)
@@ -967,7 +958,7 @@ caja_query_editor_add_row (CajaQueryEditor *editor,
row->editor = editor;
row->type = type;
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
row->hbox = hbox;
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0);
@@ -1030,23 +1021,19 @@ caja_query_editor_init (CajaQueryEditor *editor)
editor->details = g_new0 (CajaQueryEditorDetails, 1);
editor->details->is_visible = TRUE;
- editor->details->invisible_vbox = gtk_vbox_new (FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
+ editor->details->invisible_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL);
-#endif
gtk_box_pack_start (GTK_BOX (editor), editor->details->invisible_vbox,
FALSE, FALSE, 0);
- editor->details->visible_vbox = gtk_vbox_new (FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
+ editor->details->visible_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL);
-#endif
gtk_box_pack_start (GTK_BOX (editor), editor->details->visible_vbox,
FALSE, FALSE, 0);
/* Only show visible vbox */
gtk_widget_show (editor->details->visible_vbox);
/* Create invisible part: */
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (editor->details->invisible_vbox),
hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -1129,7 +1116,7 @@ setup_internal_entry (CajaQueryEditor *editor)
char *label_markup;
/* Create visible part: */
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0);
@@ -1159,7 +1146,7 @@ setup_external_entry (CajaQueryEditor *editor, GtkWidget *entry)
GtkWidget *hbox, *label;
/* Create visible part: */
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0);
diff --git a/src/caja-query-editor.h b/src/caja-query-editor.h
index 2a443624..9b255dc8 100644
--- a/src/caja-query-editor.h
+++ b/src/caja-query-editor.h
@@ -45,21 +45,13 @@ typedef struct CajaQueryEditorDetails CajaQueryEditorDetails;
typedef struct CajaQueryEditor
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkVBox parent;
-#endif
CajaQueryEditorDetails *details;
} CajaQueryEditor;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
void (* changed) (CajaQueryEditor *editor,
CajaQuery *query,
diff --git a/src/caja-search-bar.c b/src/caja-search-bar.c
index bbe1be02..af0531ea 100644
--- a/src/caja-search-bar.c
+++ b/src/caja-search-bar.c
@@ -29,10 +29,6 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
struct CajaSearchBarDetails
{
GtkWidget *entry;
@@ -154,42 +150,23 @@ focus_in_event_callback (GtkWidget *widget,
static void
caja_search_bar_init (CajaSearchBar *bar)
{
-#if !GTK_CHECK_VERSION(3, 0, 0)
- GtkWidget *alignment;
-#endif
GtkWidget *hbox;
GtkWidget *label;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (bar));
gtk_style_context_add_class (context, "caja-search-bar");
-#endif
bar->details = g_new0 (CajaSearchBarDetails, 1);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (bar), FALSE);
-#if GTK_CHECK_VERSION(3, 0, 0)
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_margin_start (hbox, 6);
gtk_widget_set_margin_end (hbox, 6);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (bar), hbox);
-#else
- alignment = gtk_alignment_new (0.5, 0.5,
- 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
- 0, 0, 6, 6);
- gtk_widget_show (alignment);
- gtk_container_add (GTK_CONTAINER (bar), alignment);
-
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_widget_show (hbox);
- gtk_container_add (GTK_CONTAINER (alignment), hbox);
-#endif
-
label = gtk_label_new (_("Search:"));
gtk_widget_show (label);
diff --git a/src/caja-side-pane.c b/src/caja-side-pane.c
index 8799fb0d..fc34e1ba 100644
--- a/src/caja-side-pane.c
+++ b/src/caja-side-pane.c
@@ -30,14 +30,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
typedef struct
{
char *title;
@@ -72,11 +64,7 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-#if GTK_CHECK_VERSION (3, 0, 0)
EEL_CLASS_BOILERPLATE (CajaSidePane, caja_side_pane, GTK_TYPE_BOX)
-#else
-EEL_CLASS_BOILERPLATE (CajaSidePane, caja_side_pane, GTK_TYPE_VBOX)
-#endif
static SidePanel *
panel_for_widget (CajaSidePane *side_pane, GtkWidget *widget)
@@ -320,20 +308,16 @@ caja_side_pane_init (GObject *object)
side_pane->details = G_TYPE_INSTANCE_GET_PRIVATE (object, CAJA_TYPE_SIDE_PANE, CajaSidePaneDetails);
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (object));
gtk_style_context_add_class (context, "caja-side-pane");
-#endif
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
side_pane->details->title_hbox = hbox;
gtk_widget_show (hbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (object), GTK_ORIENTATION_VERTICAL);
-#endif
gtk_box_pack_start (GTK_BOX (side_pane), hbox, FALSE, FALSE, 0);
select_button = gtk_toggle_button_new ();
@@ -349,7 +333,7 @@ caja_side_pane_init (GObject *object)
G_CALLBACK (select_button_key_press_callback),
side_pane);
- select_hbox = gtk_hbox_new (FALSE, 0);
+ select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (select_hbox);
side_pane->details->title_label = gtk_label_new ("");
@@ -360,11 +344,7 @@ caja_side_pane_init (GObject *object)
side_pane->details->title_label,
FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
-#else
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
-#endif
gtk_widget_show (arrow);
gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0);
@@ -388,7 +368,7 @@ caja_side_pane_init (GObject *object)
gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
- side_pane->details->shortcut_box = gtk_hbox_new (TRUE, 0);
+ side_pane->details->shortcut_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (side_pane->details->shortcut_box);
gtk_box_pack_end (GTK_BOX (hbox),
side_pane->details->shortcut_box,
diff --git a/src/caja-side-pane.h b/src/caja-side-pane.h
index 9ed67fe6..0a693f4c 100644
--- a/src/caja-side-pane.h
+++ b/src/caja-side-pane.h
@@ -46,21 +46,13 @@ extern "C" {
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkVBox parent;
-#endif
CajaSidePaneDetails *details;
} CajaSidePane;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_slot;
-#else
- GtkVBoxClass parent_slot;
-#endif
void (*close_requested) (CajaSidePane *side_pane);
void (*switch_page) (CajaSidePane *side_pane,
diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c
index 1f2c4295..372e7ee1 100644
--- a/src/caja-sidebar-title.c
+++ b/src/caja-sidebar-title.c
@@ -54,17 +54,8 @@
#define MIN_TITLE_FONT_SIZE 12
#define TITLE_PADDING 4
-#if GTK_CHECK_VERSION (3, 0, 0)
#define DEFAULT_LIGHT_INFO_COLOR "#FFFFFF"
#define DEFAULT_DARK_INFO_COLOR "#2A2A2A"
-#else
-#define DEFAULT_LIGHT_INFO_COLOR 0xFFFFFF
-#define DEFAULT_DARK_INFO_COLOR 0x2A2A2A
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
static void caja_sidebar_title_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@@ -74,12 +65,7 @@ static GtkWidget * sidebar_title_create_more_info_label (void);
static void update_all (CajaSidebarTitle *sidebar_title);
static void update_more_info (CajaSidebarTitle *sidebar_title);
static void update_title_font (CajaSidebarTitle *sidebar_title);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void style_updated (GtkWidget *widget);
-#else
-static void style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-#endif
static guint get_best_icon_size (CajaSidebarTitle *sidebar_title);
enum
@@ -106,35 +92,17 @@ struct CajaSidebarTitleDetails
GtkWidget *more_info_label;
GtkWidget *emblem_box;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA label_colors [LAST_LABEL_COLOR];
-#else
- GdkColor label_colors [LAST_LABEL_COLOR];
-#endif
guint best_icon_size;
gboolean determined_icon;
};
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_BOX)
-#else
-G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_VBOX)
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
style_updated (GtkWidget *widget)
{
CajaSidebarTitle *sidebar_title;
-#else
-static void
-style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- CajaSidebarTitle *sidebar_title;
- PangoFontDescription *font_desc;
- GtkStyle *style;
-#endif
g_return_if_fail (CAJA_IS_SIDEBAR_TITLE (widget));
@@ -143,20 +111,6 @@ style_set (GtkWidget *widget,
/* Update the dynamically-sized title font */
update_title_font (sidebar_title);
- /* Update the fixed-size "more info" font */
- /*Disable this in GTK3 as it does NOT work and instead blocks changing font size*/
-#if !GTK_CHECK_VERSION (3, 0, 0)
- style = gtk_widget_get_style (widget);
- font_desc = pango_font_description_copy (style->font_desc);
- if (pango_font_description_get_size (font_desc) < MORE_INFO_FONT_SIZE * PANGO_SCALE)
- {
- pango_font_description_set_size (font_desc, MORE_INFO_FONT_SIZE * PANGO_SCALE);
- }
-
- gtk_widget_modify_font (sidebar_title->details->more_info_label,
- font_desc);
- pango_font_description_free (font_desc);
-#endif
}
static void
@@ -166,9 +120,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title)
CAJA_TYPE_SIDEBAR_TITLE,
CajaSidebarTitleDetails);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (sidebar_title), GTK_ORIENTATION_VERTICAL);
-#endif
/* Create the icon */
sidebar_title->details->icon = gtk_image_new ();
@@ -185,7 +137,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title)
gtk_box_pack_start (GTK_BOX (sidebar_title), sidebar_title->details->more_info_label, 0, 0, 0);
gtk_widget_show (sidebar_title->details->more_info_label);
- sidebar_title->details->emblem_box = gtk_hbox_new (FALSE, 0);
+ sidebar_title->details->emblem_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (sidebar_title->details->emblem_box);
gtk_box_pack_start (GTK_BOX (sidebar_title), sidebar_title->details->emblem_box, 0, 0, 0);
@@ -194,11 +146,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title)
update_all (sidebar_title);
/* initialize the label colors & fonts */
-#if GTK_CHECK_VERSION (3, 0, 0)
style_updated (GTK_WIDGET (sidebar_title));
-#else
- style_set (GTK_WIDGET (sidebar_title), NULL);
-#endif
g_signal_connect_swapped (caja_preferences,
"changed::" CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
@@ -257,37 +205,20 @@ caja_sidebar_title_class_init (CajaSidebarTitleClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->size_allocate = caja_sidebar_title_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->style_updated = style_updated;
-#else
- widget_class->style_set = style_set;
-#endif
gtk_widget_class_install_style_property (widget_class,
-#if GTK_CHECK_VERSION (3, 0, 0)
g_param_spec_boxed ("light_info_rgba",
"Light Info RGBA",
"Color used for information text against a dark background",
GDK_TYPE_RGBA,
-#else
- g_param_spec_boxed ("light_info_color",
- "Light Info Color",
- "Color used for information text against a dark background",
- GDK_TYPE_COLOR,
-#endif
G_PARAM_READABLE));
+
gtk_widget_class_install_style_property (widget_class,
-#if GTK_CHECK_VERSION (3, 0, 0)
g_param_spec_boxed ("dark_info_rgba",
"Dark Info RGBA",
"Color used for information text against a light background",
GDK_TYPE_RGBA,
-#else
- g_param_spec_boxed ("dark_info_color",
- "Dark Info Color",
- "Color used for information text against a light background",
- GDK_TYPE_COLOR,
-#endif
G_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (CajaSidebarTitleDetails));
@@ -301,36 +232,23 @@ caja_sidebar_title_new (void)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
setup_gc_with_fg (CajaSidebarTitle *sidebar_title, int idx, GdkRGBA *color)
{
sidebar_title->details->label_colors[idx] = *color;
-#else
-setup_gc_with_fg (CajaSidebarTitle *sidebar_title, int idx, guint32 color)
-{
- sidebar_title->details->label_colors [idx] = eel_gdk_rgb_to_color (color);
-#endif
}
void
caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
EelBackground *background)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *light_info_color, *dark_info_color;
GtkStyleContext *style;
GdkRGBA color;
-#else
- GdkColor *light_info_color, *dark_info_color;
- guint light_info_value, dark_info_value;
- GtkStyle *style;
-#endif
g_assert (CAJA_IS_SIDEBAR_TITLE (sidebar_title));
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (sidebar_title)));
/* read the info colors from the current theme; use a reasonable default if undefined */
-#if GTK_CHECK_VERSION (3, 0, 0)
style = gtk_widget_get_style_context (GTK_WIDGET (sidebar_title));
gtk_style_context_get_style (style,
"light_info_color", &light_info_color,
@@ -365,50 +283,12 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color);
setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE,
eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color);
-#else
- gtk_widget_style_get (GTK_WIDGET (sidebar_title),
- "light_info_color", &light_info_color,
- "dark_info_color", &dark_info_color,
- NULL);
- style = gtk_widget_get_style (GTK_WIDGET (sidebar_title));
- if (light_info_color)
- {
- light_info_value = eel_gdk_color_to_rgb (light_info_color);
- gdk_color_free (light_info_color);
- }
- else
- {
- light_info_value = DEFAULT_LIGHT_INFO_COLOR;
- }
-
- if (dark_info_color)
- {
- dark_info_value = eel_gdk_color_to_rgb (dark_info_color);
- gdk_color_free (dark_info_color);
- }
- else
- {
- dark_info_value = DEFAULT_DARK_INFO_COLOR;
- }
-
- setup_gc_with_fg (sidebar_title, LABEL_COLOR_HIGHLIGHT,
- eel_gdk_color_to_rgb (&style->text[GTK_STATE_SELECTED]));
- setup_gc_with_fg (sidebar_title, LABEL_COLOR_ACTIVE,
- eel_gdk_color_to_rgb (&style->text[GTK_STATE_ACTIVE]));
- setup_gc_with_fg (sidebar_title, LABEL_COLOR_PRELIGHT,
- eel_gdk_color_to_rgb (&style->text[GTK_STATE_PRELIGHT]));
- setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_HIGHLIGHT,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_SELECTED]) ? light_info_value : dark_info_value);
- setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_ACTIVE]) ? light_info_value : dark_info_value);
-#endif
/* If EelBackground is not set in the widget, we can safely
* use the foreground color from the theme, because it will
* always be displayed against the gtk background */
if (!eel_background_is_set(background))
-#if GTK_CHECK_VERSION (3, 0, 0)
{
gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color);
setup_gc_with_fg (sidebar_title, LABEL_COLOR, &color);
@@ -437,24 +317,6 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
gdk_rgba_free (dark_info_color);
gdk_rgba_free (light_info_color);
-#else
- {
- setup_gc_with_fg (sidebar_title, LABEL_COLOR,
- eel_gdk_color_to_rgb (&style->text[GTK_STATE_NORMAL]));
- setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR,
- eel_gdk_color_is_dark (&style->base[GTK_STATE_NORMAL]) ? light_info_value : dark_info_value);
- }
- else if (eel_background_is_dark (background))
- {
- setup_gc_with_fg (sidebar_title, LABEL_COLOR, 0xEFEFEF);
- setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, light_info_value);
- }
- else /* converse */
- {
- setup_gc_with_fg (sidebar_title, LABEL_COLOR, 0x000000);
- setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, dark_info_value);
- }
-#endif
}
static char*
@@ -547,12 +409,8 @@ update_title_font (CajaSidebarTitle *sidebar_title)
{
int available_width, width;
int max_fit_font_size, max_style_font_size;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
GtkStateFlags state;
-#else
- GtkStyle *style;
-#endif
GtkAllocation allocation;
PangoFontDescription *title_font, *tmp_font;
PangoLayout *layout;
@@ -572,13 +430,9 @@ update_title_font (CajaSidebarTitle *sidebar_title)
{
return;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
context = gtk_widget_get_style_context (GTK_WIDGET (sidebar_title));
gtk_style_context_get (context, state, GTK_STYLE_PROPERTY_FONT, &title_font, NULL);
-#else
- style = gtk_widget_get_style (GTK_WIDGET (sidebar_title));
- title_font = pango_font_description_copy (style->font_desc);
-#endif
max_style_font_size = pango_font_description_get_size (title_font) * 1.8 / PANGO_SCALE;
if (max_style_font_size < MIN_TITLE_FONT_SIZE + 1)
{
@@ -607,11 +461,7 @@ update_title_font (CajaSidebarTitle *sidebar_title)
pango_font_description_set_size (title_font, max_fit_font_size * PANGO_SCALE);
pango_font_description_set_weight (title_font, PANGO_WEIGHT_BOLD);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_override_font (sidebar_title->details->title_label, title_font);
-#else
- gtk_widget_modify_font (sidebar_title->details->title_label, title_font);
-#endif
pango_font_description_free (title_font);
}
diff --git a/src/caja-sidebar-title.h b/src/caja-sidebar-title.h
index 04d93815..d6e651f9 100644
--- a/src/caja-sidebar-title.h
+++ b/src/caja-sidebar-title.h
@@ -49,21 +49,13 @@ typedef struct CajaSidebarTitleDetails CajaSidebarTitleDetails;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox box;
-#else
- GtkVBox box;
-#endif
CajaSidebarTitleDetails *details;
} CajaSidebarTitle;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
} CajaSidebarTitleClass;
GType caja_sidebar_title_get_type (void);
diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c
index ab716c3d..6d3d0112 100644
--- a/src/caja-spatial-window.c
+++ b/src/caja-spatial-window.c
@@ -37,9 +37,6 @@
#include "caja-desktop-window.h"
#include "caja-bookmarks-window.h"
#include "caja-location-dialog.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-main.h"
-#endif
#include "caja-query-editor.h"
#include "caja-search-bar.h"
#include "caja-window-manage-views.h"
@@ -63,10 +60,6 @@
#include <libcaja-private/caja-search-engine.h>
#include <libcaja-private/caja-signaller.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
#define MAX_TITLE_LENGTH 180
#define MAX_SHORTNAME_PATH 16
@@ -76,10 +69,6 @@
#define SPATIAL_ACTION_CLOSE_ALL_FOLDERS "Close All Folders"
#define MENU_PATH_SPATIAL_BOOKMARKS_PLACEHOLDER "/MenuBar/Other Menus/Places/Bookmarks Placeholder"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
struct _CajaSpatialWindowDetails
{
GtkActionGroup *spatial_action_group; /* owned by ui_manager */
@@ -990,9 +979,6 @@ static const char* icon_entries[] =
static void
caja_spatial_window_init (CajaSpatialWindow *window)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkRcStyle *rc_style;
-#endif
GtkWidget *arrow;
GtkWidget *hbox, *vbox;
GtkActionGroup *action_group;
@@ -1010,7 +996,6 @@ caja_spatial_window_init (CajaSpatialWindow *window)
win = CAJA_WINDOW (window);
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_hexpand (win->details->statusbar, TRUE);
gtk_grid_attach (GTK_GRID (win->details->grid),
win->details->statusbar,
@@ -1020,32 +1005,16 @@ caja_spatial_window_init (CajaSpatialWindow *window)
pane = caja_window_pane_new (win);
win->details->panes = g_list_prepend (win->details->panes, pane);
+ /* FIXME: changing this to gtk_box_new breaks desktop :-/
+ * see https://github.com/mate-desktop/caja/issues/591
+ */
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_set_hexpand (vbox, TRUE);
gtk_widget_set_vexpand (vbox, TRUE);
gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid),
vbox,
0, 1, 1, 3);
-#else
- gtk_table_attach (GTK_TABLE (win->details->table),
- win->details->statusbar,
- /* X direction */ /* Y direction */
- 0, 1, 5, 6,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
- gtk_widget_show (win->details->statusbar);
- pane = caja_window_pane_new (win);
- win->details->panes = g_list_prepend (win->details->panes, pane);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table),
- vbox,
- /* X direction */ /* Y direction */
- 0, 1, 1, 4,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-#endif
gtk_widget_show (vbox);
window->details->content_box = vbox;
@@ -1056,16 +1025,9 @@ caja_spatial_window_init (CajaSpatialWindow *window)
window);
gtk_button_set_relief (GTK_BUTTON (window->details->location_button),
GTK_RELIEF_NORMAL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- rc_style = gtk_widget_get_modifier_style (window->details->location_button);
- rc_style->xthickness = 0;
- rc_style->ythickness = 0;
- gtk_widget_modify_style (window->details->location_button,
- rc_style);
-#endif
gtk_widget_show (window->details->location_button);
- hbox = gtk_hbox_new (FALSE, 3);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_container_add (GTK_CONTAINER (window->details->location_button),
hbox);
gtk_widget_show (hbox);
@@ -1081,11 +1043,7 @@ caja_spatial_window_init (CajaSpatialWindow *window)
FALSE, FALSE, 0);
gtk_widget_show (window->details->location_label);
-#if GTK_CHECK_VERSION (3, 0, 0)
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
-#else
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
gtk_widget_show (arrow);
diff --git a/src/caja-trash-bar.c b/src/caja-trash-bar.c
index 25630612..53f9ebcd 100644
--- a/src/caja-trash-bar.c
+++ b/src/caja-trash-bar.c
@@ -51,11 +51,7 @@ struct CajaTrashBarPrivate
gulong selection_handler_id;
};
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaTrashBar, caja_trash_bar, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE (CajaTrashBar, caja_trash_bar, GTK_TYPE_HBOX);
-#endif
static void
restore_button_clicked_cb (GtkWidget *button,
@@ -193,9 +189,9 @@ caja_trash_bar_init (CajaTrashBar *bar)
label = gtk_label_new (_("Trash"));
gtk_widget_show (label);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_HORIZONTAL);
-#endif
+
gtk_box_pack_start (GTK_BOX (bar), label, FALSE, FALSE, 0);
bar->priv->empty_button = gtk_button_new_with_mnemonic (_("Empty _Trash"));
diff --git a/src/caja-trash-bar.h b/src/caja-trash-bar.h
index fb0d7baa..5d20175e 100644
--- a/src/caja-trash-bar.h
+++ b/src/caja-trash-bar.h
@@ -42,22 +42,14 @@ extern "C" {
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox box;
-#else
- GtkHBox box;
-#endif
-
CajaTrashBarPrivate *priv;
} CajaTrashBar;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkHBoxClass parent_class;
-#endif
+
} CajaTrashBarClass;
GType caja_trash_bar_get_type (void) G_GNUC_CONST;
diff --git a/src/caja-view-as-action.c b/src/caja-view-as-action.c
index 9325f607..d03cfa63 100644
--- a/src/caja-view-as-action.c
+++ b/src/caja-view-as-action.c
@@ -42,10 +42,6 @@ static GObjectClass *parent_class = NULL;
#define CAJA_VIEW_AS_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_VIEW_AS_ACTION, CajaViewAsActionPrivate))
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
struct CajaViewAsActionPrivate
{
CajaNavigationWindow *window;
@@ -177,7 +173,7 @@ connect_proxy (GtkAction *action,
/* Option menu for content view types; it's empty here, filled in when a uri is set.
* Pack it into vbox so it doesn't grow vertically when location bar does.
*/
- view_as_menu_vbox = gtk_vbox_new (FALSE, 4);
+ view_as_menu_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_widget_show (view_as_menu_vbox);
gtk_container_add (GTK_CONTAINER (item), view_as_menu_vbox);
diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c
index 74578525..e25a0ba0 100644
--- a/src/caja-window-manage-views.c
+++ b/src/caja-window-manage-views.c
@@ -33,9 +33,6 @@
#include "caja-location-bar.h"
#include "caja-search-bar.h"
#include "caja-pathbar.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-main.h"
-#endif
#include "caja-window-private.h"
#include "caja-window-slot.h"
#include "caja-navigation-window-slot.h"
@@ -603,9 +600,6 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot,
} else if (target_navigation) {
target_window = caja_application_create_navigation_window
(window->application,
-#if ENABLE_LIBUNIQUE == (TRUE)
- NULL,
-#endif
gtk_window_get_screen (GTK_WINDOW (window)));
} else {
target_window = caja_application_get_spatial_window
@@ -1199,9 +1193,7 @@ got_file_info_for_view_selection_callback (CajaFile *file,
GFile *location;
GMountOperation *mount_op;
MountNotMountedData *data;
-#if ENABLE_LIBUNIQUE == (FALSE)
CajaApplication *app;
-#endif
slot = callback_data;
g_assert (CAJA_IS_WINDOW_SLOT (slot));
g_assert (slot->determine_view_file == file);
@@ -1314,15 +1306,10 @@ got_file_info_for_view_selection_callback (CajaFile *file,
* happens when a new window cannot display its initial URI.
*/
/* if this is the only window, we don't want to quit, so we redirect it to home */
-#if ENABLE_LIBUNIQUE == (FALSE)
app = CAJA_APPLICATION (g_application_get_default ());
if (g_list_length (gtk_application_get_windows (GTK_APPLICATION (app))) == 1) {
-#else
- if (caja_application_get_n_windows () <= 1)
- {
- g_assert (caja_application_get_n_windows () == 1);
-#endif
+
/* the user could have typed in a home directory that doesn't exist,
in which case going home would cause an infinite loop, so we
better test for that */
diff --git a/src/caja-window-private.h b/src/caja-window-private.h
index a2361790..7afcb497 100644
--- a/src/caja-window-private.h
+++ b/src/caja-window-private.h
@@ -42,11 +42,8 @@ struct _CajaNavigationWindowPane;
/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
struct CajaWindowDetails
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
+
GtkWidget *statusbar;
GtkWidget *menubar;
diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c
index e7d53f2a..6286a5e3 100644
--- a/src/caja-window-slot.c
+++ b/src/caja-window-slot.c
@@ -33,10 +33,6 @@
#include <eel/eel-gtk-macros.h>
#include <eel/eel-string.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static void caja_window_slot_init (CajaWindowSlot *slot);
static void caja_window_slot_class_init (CajaWindowSlotClass *class);
static void caja_window_slot_dispose (GObject *object);
@@ -184,7 +180,7 @@ caja_window_slot_init (CajaWindowSlot *slot)
{
GtkWidget *content_box, *eventbox, *extras_vbox, *frame;
- content_box = gtk_vbox_new (FALSE, 0);
+ content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
slot->content_box = content_box;
gtk_widget_show (content_box);
@@ -198,13 +194,13 @@ caja_window_slot_init (CajaWindowSlot *slot)
gtk_container_add (GTK_CONTAINER (frame), eventbox);
gtk_widget_show (eventbox);
- extras_vbox = gtk_vbox_new (FALSE, 6);
+ extras_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6);
slot->extra_location_widgets = extras_vbox;
gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox);
gtk_widget_show (extras_vbox);
- slot->view_box = gtk_vbox_new (FALSE, 0);
+ slot->view_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (content_box), slot->view_box, TRUE, TRUE, 0);
gtk_widget_show (slot->view_box);
@@ -483,13 +479,8 @@ caja_window_slot_set_content_view_widget (CajaWindowSlot *slot,
if (new_view != NULL)
{
widget = caja_view_get_widget (new_view);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_box_pack_start (GTK_BOX (slot->view_box), widget,
TRUE, TRUE, 0);
-#else
- gtk_container_add (GTK_CONTAINER (slot->view_box),
- GTK_WIDGET (new_view));
-#endif
gtk_widget_show (widget);
diff --git a/src/caja-window.c b/src/caja-window.c
index 69c62429..84ae7487 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -32,9 +32,6 @@
#include "caja-application.h"
#include "caja-bookmarks-window.h"
#include "caja-information-panel.h"
-#if ENABLE_LIBUNIQUE == (TRUE)
-#include "caja-main.h"
-#endif
#include "caja-window-manage-views.h"
#include "caja-window-bookmarks.h"
#include "caja-window-slot.h"
@@ -132,15 +129,10 @@ static const struct
static void
caja_window_init (CajaWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
GtkWidget *menu;
GtkWidget *statusbar;
-#if GTK_CHECK_VERSION (3, 0, 0)
#if GTK_CHECK_VERSION (3, 20, 0)
static const gchar css_custom[] =
"#caja-extra-view-widget {"
@@ -169,7 +161,6 @@ caja_window_init (CajaWindow *window)
}
g_object_unref (provider);
-#endif
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_WINDOW, CajaWindowDetails);
window->details->panes = NULL;
@@ -177,40 +168,21 @@ caja_window_init (CajaWindow *window)
window->details->show_hidden_files_mode = CAJA_WINDOW_SHOW_HIDDEN_FILES_DEFAULT;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* Remove Top border on GtkStatusBar */
- gtk_rc_parse_string (
- "style \"statusbar-no-border\"\n"
- "{\n"
- " GtkStatusbar::shadow_type = GTK_SHADOW_NONE\n"
- "}\n"
- "widget \"*.statusbar-noborder\" style \"statusbar-no-border\"");
-#endif
-
/* Set initial window title */
gtk_window_set_title (GTK_WINDOW (window), _("Caja"));
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
window->details->grid = grid;
gtk_widget_show (grid);
gtk_container_add (GTK_CONTAINER (window), grid);
-#else
- table = gtk_table_new (1, 6, FALSE);
- window->details->table = table;
- gtk_widget_show (table);
- gtk_container_add (GTK_CONTAINER (window), table);
-#endif
statusbar = gtk_statusbar_new ();
gtk_widget_set_name (statusbar, "statusbar-noborder");
/* set margin to zero to reduce size of statusbar */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0);
gtk_widget_set_margin_bottom (GTK_WIDGET (statusbar), 0);
-#endif
window->details->statusbar = statusbar;
window->details->help_message_cid = gtk_statusbar_get_context_id
@@ -221,35 +193,13 @@ caja_window_init (CajaWindow *window)
menu = gtk_ui_manager_get_widget (window->details->ui_manager, "/MenuBar");
window->details->menubar = menu;
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_hexpand (menu, TRUE);
gtk_widget_show (menu);
gtk_grid_attach (GTK_GRID (grid), menu, 0, 0, 1, 1);
-#else
- gtk_widget_show (menu);
- gtk_table_attach (GTK_TABLE (table),
- menu,
- /* X direction */ /* Y direction */
- 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-#endif
/* Register to menu provider extension signal managing menu updates */
g_signal_connect_object (caja_signaller_get_current (), "popup_menu_changed",
G_CALLBACK (caja_window_load_extension_menus), window, G_CONNECT_SWAPPED);
-#if ENABLE_LIBUNIQUE == (TRUE)
-/* Keep the main event loop alive as long as the window exists */
-#if GTK_CHECK_VERSION(3, 0, 0)
- /* FIXME: port to GtkApplication with GTK3 */
- /*This is DONE when built with --disable-libunique */
- //gtk_quit_add_destroy (1, GTK_WIDGET (window));
- caja_main_event_loop_register (GTK_WIDGET (window));
-#else
- gtk_quit_add_destroy (1, GTK_OBJECT (window));
- caja_main_event_loop_register (GTK_OBJECT (window));
-#endif
-#endif
}
/* Unconditionally synchronize the GtkUIManager of WINDOW. */
@@ -442,11 +392,7 @@ update_cursor (CajaWindow *window)
display = gtk_widget_get_display (GTK_WIDGET (window));
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
else
{
@@ -591,9 +537,7 @@ caja_window_set_initial_window_geometry (CajaWindow *window)
{
GdkScreen *screen;
guint max_width_for_screen, max_height_for_screen;
-#if !GTK_CHECK_VERSION(3,0,0)
- guint min_width, min_height;
-#endif
+
guint default_width, default_height;
screen = gtk_window_get_screen (GTK_WINDOW (window));
@@ -601,17 +545,6 @@ caja_window_set_initial_window_geometry (CajaWindow *window)
max_width_for_screen = get_max_forced_width (screen);
max_height_for_screen = get_max_forced_height (screen);
-#if !GTK_CHECK_VERSION(3,0,0)
- EEL_CALL_METHOD (CAJA_WINDOW_CLASS, window,
- get_min_size, (window, &min_width, &min_height));
-
- gtk_widget_set_size_request (GTK_WIDGET (window),
- MIN (min_width,
- max_width_for_screen),
- MIN (min_height,
- max_height_for_screen));
-#endif
-
EEL_CALL_METHOD (CAJA_WINDOW_CLASS, window,
get_default_size, (window, &default_width, &default_height));
@@ -674,13 +607,8 @@ free_stored_viewers (CajaWindow *window)
window->details->extra_viewer = NULL;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
caja_window_destroy (GtkWidget *object)
-#else
-static void
-caja_window_destroy (GtkObject *object)
-#endif
{
CajaWindow *window;
GList *panes_copy;
@@ -695,11 +623,7 @@ caja_window_destroy (GtkObject *object)
g_assert (window->details->panes == NULL);
g_assert (window->details->active_pane == NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (caja_window_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (caja_window_parent_class)->destroy (object);
-#endif
}
static void
@@ -1064,9 +988,7 @@ caja_window_size_request (GtkWidget *widget,
g_assert (CAJA_IS_WINDOW (widget));
g_assert (requisition != NULL);
-#if !GTK_CHECK_VERSION(3,0,0)
- GTK_WIDGET_CLASS (caja_window_parent_class)->size_request (widget, requisition);
-#endif
+
screen = gtk_window_get_screen (GTK_WINDOW (widget));
/* Limit the requisition to be within 90% of the available screen
@@ -1907,20 +1829,14 @@ caja_forget_history (void)
CajaWindowSlot *slot;
CajaNavigationWindowSlot *navigation_slot;
GList *window_node, *l, *walk;
-#if ENABLE_LIBUNIQUE == (FALSE)
CajaApplication *app;
app = CAJA_APPLICATION (g_application_get_default ());
-#endif
/* Clear out each window's back & forward lists. Also, remove
* each window's current location bookmark from history list
* so it doesn't get clobbered.
*/
-#if ENABLE_LIBUNIQUE == (FALSE)
for (window_node = gtk_application_get_windows (GTK_APPLICATION (app));
-#else
- for (window_node = caja_application_get_window_list ();
-#endif
window_node != NULL;
window_node = window_node->next)
{
@@ -1963,11 +1879,7 @@ caja_forget_history (void)
free_history_list ();
/* Re-add each window's current location to history list. */
-#if ENABLE_LIBUNIQUE == (FALSE)
for (window_node = gtk_application_get_windows (GTK_APPLICATION (app));
-#else
- for (window_node = caja_application_get_window_list ();
-#endif
window_node != NULL;
window_node = window_node->next)
{
@@ -2175,16 +2087,10 @@ caja_window_class_init (CajaWindowClass *class)
G_OBJECT_CLASS (class)->set_property = caja_window_set_property;
G_OBJECT_CLASS (class)->finalize = caja_window_finalize;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (class)->destroy = caja_window_destroy;
-#else
GTK_WIDGET_CLASS (class)->destroy = caja_window_destroy;
-#endif
GTK_WIDGET_CLASS (class)->show = caja_window_show;
-#if !GTK_CHECK_VERSION (3,0,0)
- GTK_WIDGET_CLASS (class)->size_request = caja_window_size_request;
-#endif
+
GTK_WIDGET_CLASS (class)->realize = caja_window_realize;
GTK_WIDGET_CLASS (class)->key_press_event = caja_window_key_press_event;
class->get_title = real_get_title;
@@ -2256,17 +2162,7 @@ caja_window_class_init (CajaWindowClass *class)
class->reload = caja_window_reload;
class->go_up = caja_window_go_up_signal;
-#if !GTK_CHECK_VERSION (3,0,0)
- /* Allow to set the colors of the extra view widgets */
- gtk_rc_parse_string ("\n"
- " style \"caja-extra-view-widgets-style-internal\"\n"
- " {\n"
- " bg[NORMAL] = \"" EXTRA_VIEW_WIDGETS_BACKGROUND "\"\n"
- " }\n"
- "\n"
- " widget \"*.caja-extra-view-widget\" style:rc \"caja-extra-view-widgets-style-internal\" \n"
- "\n");
-#endif
+
g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (CajaWindowDetails));
}
diff --git a/src/caja-x-content-bar.c b/src/caja-x-content-bar.c
index 1fc8aabe..8c834215 100644
--- a/src/caja-x-content-bar.c
+++ b/src/caja-x-content-bar.c
@@ -50,11 +50,7 @@ enum
PROP_X_CONTENT_TYPE,
};
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_BOX)
-#else
-G_DEFINE_TYPE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_HBOX)
-#endif
void
caja_x_content_bar_set_x_content_type (CajaXContentBar *bar, const char *x_content_type)
@@ -308,9 +304,9 @@ caja_x_content_bar_init (CajaXContentBar *bar)
bar->priv->label = gtk_label_new (NULL);
gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_HORIZONTAL);
-#endif
+
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (bar->priv->label), 0.0);
#else
diff --git a/src/caja-x-content-bar.h b/src/caja-x-content-bar.h
index fc6fead6..50639e4e 100644
--- a/src/caja-x-content-bar.h
+++ b/src/caja-x-content-bar.h
@@ -43,22 +43,14 @@ extern "C" {
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox box;
-#else
- GtkHBox box;
-#endif
CajaXContentBarPrivate *priv;
} CajaXContentBar;
typedef struct
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkHBoxClass parent_class;
-#endif
} CajaXContentBarClass;
GType caja_x_content_bar_get_type (void) G_GNUC_CONST;
diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c
index 5f0549f1..e11c2a39 100644
--- a/src/caja-zoom-control.c
+++ b/src/caja-zoom-control.c
@@ -37,9 +37,7 @@
#include <eel/eel-graphic-effects.h>
#include <eel/eel-gtk-extensions.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
#include <gtk/gtk-a11y.h>
-#endif
#include <gdk/gdkkeysyms.h>
#include <libcaja-private/caja-file-utilities.h>
#include <libcaja-private/caja-global-preferences.h>
@@ -47,10 +45,6 @@
#include <stdlib.h>
#include <string.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
enum
{
ZOOM_IN,
@@ -113,11 +107,7 @@ static GType caja_zoom_control_accessible_get_type (void);
#define NUM_ACTIONS ((int)G_N_ELEMENTS (caja_zoom_control_accessible_action_names))
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (CajaZoomControl, caja_zoom_control, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE (CajaZoomControl, caja_zoom_control, GTK_TYPE_HBOX);
-#endif
static void
caja_zoom_control_finalize (GObject *object)
@@ -292,11 +282,7 @@ set_label_size (CajaZoomControl *zoom_control)
static void
label_style_set_callback (GtkWidget *label,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style,
-#else
- GtkStyle *style,
-#endif
gpointer user_data)
{
set_label_size (CAJA_ZOOM_CONTROL (user_data));
@@ -337,9 +323,9 @@ caja_zoom_control_init (CajaZoomControl *zoom_control)
g_signal_connect (G_OBJECT (zoom_control->details->zoom_out),
"clicked", G_CALLBACK (zoom_out_clicked),
zoom_control);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_orientable_set_orientation (GTK_ORIENTABLE (zoom_control), GTK_ORIENTATION_HORIZONTAL);
-#endif
+
gtk_container_add (GTK_CONTAINER (zoom_control->details->zoom_out), image);
gtk_box_pack_start (GTK_BOX (zoom_control),
zoom_control->details->zoom_out, FALSE, FALSE, 0);
@@ -532,26 +518,6 @@ create_zoom_menu (CajaZoomControl *zoom_control)
return menu;
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static AtkObject *
-caja_zoom_control_get_accessible (GtkWidget *widget)
-{
- AtkObject *accessible;
-
- accessible = eel_accessibility_get_atk_object (widget);
-
- if (accessible)
- {
- return accessible;
- }
-
- accessible = g_object_new
- (caja_zoom_control_accessible_get_type (), NULL);
-
- return eel_accessibility_set_atk_object_return (widget, accessible);
-}
-#endif
-
static void
caja_zoom_control_change_value (CajaZoomControl *zoom_control,
GtkScrollType scroll)
@@ -694,12 +660,10 @@ caja_zoom_control_class_init (CajaZoomControlClass *class)
widget_class = GTK_WIDGET_CLASS (class);
-#if GTK_CHECK_VERSION(3, 0, 0)
+
gtk_widget_class_set_accessible_type (widget_class,
caja_zoom_control_accessible_get_type ());
-#else
- widget_class->get_accessible = caja_zoom_control_get_accessible;
-#endif
+
widget_class->scroll_event = caja_zoom_control_scroll_event;
class->change_value = caja_zoom_control_change_value;
@@ -978,7 +942,6 @@ caja_zoom_control_accessible_initialize (AtkObject *accessible,
atk_object_set_role (accessible, ATK_ROLE_DIAL);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
typedef struct _CajaZoomControlAccessible CajaZoomControlAccessible;
typedef struct _CajaZoomControlAccessibleClass CajaZoomControlAccessibleClass;
@@ -1014,56 +977,6 @@ static void
caja_zoom_control_accessible_init (CajaZoomControlAccessible *accessible)
{
}
-#else
-static void
-caja_zoom_control_accessible_class_init (AtkObjectClass *klass)
-{
- accessible_parent_class = g_type_class_peek_parent (klass);
-
- klass->get_name = caja_zoom_control_accessible_get_name;
- klass->get_description = caja_zoom_control_accessible_get_description;
- klass->initialize = caja_zoom_control_accessible_initialize;
-}
-
-static GType
-caja_zoom_control_accessible_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static GInterfaceInfo atk_action_info =
- {
- (GInterfaceInitFunc)caja_zoom_control_accessible_action_interface_init,
- (GInterfaceFinalizeFunc)NULL,
- NULL
- };
-
- static GInterfaceInfo atk_value_info =
- {
- (GInterfaceInitFunc)caja_zoom_control_accessible_value_interface_init,
- (GInterfaceFinalizeFunc)NULL,
- NULL
- };
-
- type = eel_accessibility_create_derived_type
- ("CajaZoomControlAccessible",
-#if GTK_CHECK_VERSION (3, 0, 0)
- GTK_TYPE_BOX,
-#else
- GTK_TYPE_HBOX,
-#endif
- caja_zoom_control_accessible_class_init);
-
- g_type_add_interface_static (type, ATK_TYPE_ACTION,
- &atk_action_info);
- g_type_add_interface_static (type, ATK_TYPE_VALUE,
- &atk_value_info);
- }
-
- return type;
-}
-#endif
void
caja_zoom_control_set_active_appearance (CajaZoomControl *zoom_control, gboolean is_active)
diff --git a/src/caja-zoom-control.h b/src/caja-zoom-control.h
index fb72d3c8..85a07046 100644
--- a/src/caja-zoom-control.h
+++ b/src/caja-zoom-control.h
@@ -49,21 +49,13 @@ typedef struct CajaZoomControlDetails CajaZoomControlDetails;
struct CajaZoomControl
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
-#else
- GtkHBox parent;
-#endif
CajaZoomControlDetails *details;
};
struct CajaZoomControlClass
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
-#else
- GtkHBoxClass parent_class;
-#endif
void (*zoom_in) (CajaZoomControl *control);
void (*zoom_out) (CajaZoomControl *control);
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 1637532c..2a16f494 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -61,12 +61,6 @@
#include <sys/types.h>
#include <unistd.h>
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
-#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
-#define GTK_SCROLLABLE GTK_LAYOUT
-#endif
-
/* Timeout to check the desktop directory for updates */
#define RESCAN_TIMEOUT 4
@@ -354,7 +348,7 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container,
if (keyboard != NULL) {
gdk_seat_ungrab (seat);
}
-#elif GTK_CHECK_VERSION(3, 0, 0)
+#else
GdkDevice *keyboard = NULL, *pointer = NULL, *cur;
GdkDeviceManager *manager;
GList *list, *l;
@@ -392,14 +386,6 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container,
if (keyboard != NULL) {
gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
}
-#else
-
- /* During a mouse click we have the pointer and keyboard grab.
- * We will send a fake event to the root window which will cause it
- * to try to get the grab so we need to let go ourselves.
- */
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
#endif
/* Stop the event because we don't want anyone else dealing with it. */
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 28c446ec..02a22da6 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -129,10 +129,6 @@
#define MAX_MENU_LEVELS 5
#define TEMPLATE_LIMIT 30
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
enum {
ADD_FILE,
BEGIN_FILE_CHANGES,
@@ -1197,11 +1193,7 @@ select_pattern (FMDirectoryView *view)
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *example;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
GtkWidget *entry;
char *example_pattern;
@@ -1222,27 +1214,19 @@ select_pattern (FMDirectoryView *view)
label = gtk_label_new_with_mnemonic (_("_Pattern:"));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (label, GTK_ALIGN_START);
example = gtk_label_new (NULL);
gtk_widget_set_halign (example, GTK_ALIGN_START);
-#else
- example = gtk_label_new (NULL);
-#endif
example_pattern = g_strdup_printf ("<b>%s</b><i>%s</i>",
_("Examples: "),
"*.png, file\?\?.txt, pict*.\?\?\?");
gtk_label_set_markup (GTK_LABEL (example), example_pattern);
g_free (example_pattern);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (example, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (example), 0.0, 0.5);
-#endif
+
entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_hexpand (entry, TRUE);
grid = gtk_grid_new ();
@@ -1262,31 +1246,7 @@ select_pattern (FMDirectoryView *view)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
gtk_widget_show_all (grid);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid);
-#else
- table = gtk_table_new (2, 2, FALSE);
-
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1,
- 0, 1,
- GTK_FILL, GTK_FILL,
- 5, 5);
-
- gtk_table_attach (GTK_TABLE (table), entry,
- 1, 2,
- 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL,
- 5, 5);
-
- gtk_table_attach (GTK_TABLE (table), example,
- 1, 2,
- 1, 2,
- GTK_FILL, GTK_FILL,
- 5, 0);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
- gtk_widget_show_all (table);
- gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table);
-#endif
g_object_set_data (G_OBJECT (dialog), "entry", entry);
g_signal_connect (dialog, "response",
G_CALLBACK (pattern_select_response_cb),
@@ -1363,11 +1323,8 @@ action_save_search_as_callback (GtkAction *action,
{
FMDirectoryView *directory_view;
CajaSearchDirectory *search;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *dialog, *grid, *label, *entry, *chooser, *save_button;
-#else
- GtkWidget *dialog, *table, *label, *entry, *chooser, *save_button;
-#endif
+
const char *entry_text;
char *filename, *filename_utf8, *dirname, *path, *uri;
GFile *location;
@@ -1391,7 +1348,6 @@ action_save_search_as_callback (GtkAction *action,
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
g_object_set (grid,
"orientation", GTK_ORIENTATION_VERTICAL,
@@ -1401,14 +1357,6 @@ action_save_search_as_callback (GtkAction *action,
NULL);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0);
gtk_widget_show (grid);
-#else
- table = gtk_table_new (2, 2, FALSE);
- 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);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-#endif
label = gtk_label_new_with_mnemonic (_("Search _name:"));
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -1416,20 +1364,12 @@ action_save_search_as_callback (GtkAction *action,
#else
gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
-#endif
gtk_widget_show (label);
entry = gtk_entry_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_hexpand (entry, TRUE);
gtk_grid_attach_next_to (GTK_GRID (grid), entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
-#endif
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
@@ -1444,22 +1384,14 @@ action_save_search_as_callback (GtkAction *action,
#else
gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
-#else
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
-#endif
gtk_widget_show (label);
chooser = gtk_file_chooser_button_new (_("Select Folder to Save Search In"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_hexpand (chooser, TRUE);
gtk_grid_attach_next_to (GTK_GRID (grid), chooser, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), chooser, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
-#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser);
gtk_widget_show (chooser);
@@ -2183,11 +2115,7 @@ real_unmerge_menus (FMDirectoryView *view)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
fm_directory_view_destroy (GtkWidget *object)
-#else
-fm_directory_view_destroy (GtkObject *object)
-#endif
{
FMDirectoryView *view;
GList *node, *next;
@@ -2248,11 +2176,7 @@ fm_directory_view_destroy (GtkObject *object)
view->details->directory_as_file = NULL;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object));
-#else
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-#endif
}
static void
@@ -7100,7 +7024,7 @@ action_connect_to_server_link_callback (GtkAction *action,
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
- box = gtk_hbox_new (FALSE, 12);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_show (box);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
box, TRUE, TRUE, 0);
@@ -10896,10 +10820,8 @@ gboolean
fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view,
GdkEventScroll *event)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
static gdouble total_delta_y = 0;
gdouble delta_x, delta_y;
-#endif
if (event->state & GDK_CONTROL_MASK) {
switch (event->direction) {
@@ -10913,7 +10835,6 @@ fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view,
fm_directory_view_bump_zoom_level (directory_view, -1);
return TRUE;
-#if GTK_CHECK_VERSION (3, 0, 0)
case GDK_SCROLL_SMOOTH:
gdk_event_get_scroll_deltas ((const GdkEvent *) event,
&delta_x, &delta_y);
@@ -10935,7 +10856,7 @@ fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view,
/* eat event */
return TRUE;
}
-#endif
+
case GDK_SCROLL_LEFT:
case GDK_SCROLL_RIGHT:
break;
@@ -11008,11 +10929,9 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_OBJECT_CLASS (klass)->set_property = fm_directory_view_set_property;
G_OBJECT_CLASS (klass)->finalize = fm_directory_view_finalize;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (klass)->destroy = fm_directory_view_destroy;
-#else
+
widget_class->destroy = fm_directory_view_destroy;
-#endif
+
widget_class->scroll_event = fm_directory_view_scroll_event;
widget_class->parent_set = fm_directory_view_parent_set;
diff --git a/src/file-manager/fm-ditem-page.c b/src/file-manager/fm-ditem-page.c
index 13803597..08f87b20 100644
--- a/src/file-manager/fm-ditem-page.c
+++ b/src/file-manager/fm-ditem-page.c
@@ -36,10 +36,6 @@
#define MAIN_GROUP "Desktop Entry"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
typedef struct ItemEntry
{
const char *field;
@@ -320,38 +316,21 @@ entry_focus_out_cb (GtkWidget *entry,
}
static GtkWidget *
-#if GTK_CHECK_VERSION (3, 0, 0)
build_grid (GtkWidget *container,
-#else
-build_table (GtkWidget *container,
-#endif
GKeyFile *key_file,
GtkSizeGroup *label_size_group,
GList *entries)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
GtkWidget *label;
GtkWidget *entry;
GList *l;
char *val;
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
-#else
- int i;
-
- table = gtk_table_new (g_list_length (entries) + 1, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
- i = 0;
-#endif
for (l = entries; l; l = l->next)
{
@@ -370,9 +349,8 @@ build_table (GtkWidget *container,
gtk_size_group_add_widget (label_size_group, label);
entry = gtk_entry_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_hexpand (entry, TRUE);
-#endif
+
if (item_entry->localized)
{
@@ -393,18 +371,9 @@ build_table (GtkWidget *container,
gtk_entry_set_text (GTK_ENTRY (entry), item_entry->current_value);
g_free (val);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
gtk_grid_attach_next_to (GTK_GRID (grid), entry, label,
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1, i, i+1, GTK_FILL, GTK_FILL,
- 0, 0);
- gtk_table_attach (GTK_TABLE (table), entry,
- 1, 2, i, i+1, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL,
- 0, 0);
-#endif
g_signal_connect (entry, "activate",
G_CALLBACK (entry_activate_cb),
@@ -438,39 +407,21 @@ build_table (GtkWidget *container,
G_CALLBACK (fm_ditem_page_exec_drag_data_received),
entry);
}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- i++;
-#endif
}
/* append dummy row */
label = gtk_label_new ("");
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (grid), label);
gtk_size_group_add_widget (label_size_group, label);
gtk_widget_show_all (grid);
return grid;
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1, i, i+1, GTK_FILL, GTK_FILL,
- 0, 0);
- gtk_size_group_add_widget (label_size_group, label);
-
- gtk_widget_show_all (table);
- return table;
-#endif
}
static void
create_page (GKeyFile *key_file, GtkWidget *box)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
GList *entries;
GtkSizeGroup *label_size_group;
char *type;
@@ -507,16 +458,11 @@ create_page (GKeyFile *key_file, GtkWidget *box)
{
/* we only handle launchers and links */
- /* ensure that we build an empty table with a dummy row at the end */
-#if GTK_CHECK_VERSION (3, 0, 0)
+ /* ensure that we build an empty gid with a dummy row at the end */
goto build_grid;
-#else
- goto build_table;
-#endif
}
g_free (type);
-#if GTK_CHECK_VERSION (3, 0, 0)
build_grid:
label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group");
@@ -524,15 +470,7 @@ build_grid:
g_list_free (entries);
gtk_box_pack_start (GTK_BOX (box), grid, FALSE, TRUE, 0);
-#else
-build_table:
- label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group");
- table = build_table (box, key_file, label_size_group, entries);
- g_list_free (entries);
-
- gtk_box_pack_start (GTK_BOX (box), table, FALSE, TRUE, 0);
-#endif
gtk_widget_show_all (GTK_WIDGET (box));
}
@@ -588,7 +526,7 @@ fm_ditem_page_make_box (GtkSizeGroup *label_size_group,
g_assert (fm_ditem_page_should_show (files));
- box = gtk_vbox_new (FALSE, 6);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
g_object_set_data_full (G_OBJECT (box), "label-size-group",
label_size_group, (GDestroyNotify) g_object_unref);
diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c
index 08b87529..be3acee2 100644
--- a/src/file-manager/fm-icon-container.c
+++ b/src/file-manager/fm-icon-container.c
@@ -595,10 +595,8 @@ fm_icon_container_class_init (FMIconContainerClass *klass)
static void
fm_icon_container_init (FMIconContainer *icon_container)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (icon_container)),
GTK_STYLE_CLASS_VIEW);
-#endif
}
CajaIconContainer *
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index c348cbd6..a388a3fb 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -212,11 +212,7 @@ G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW,
fm_icon_view_iface_init));
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
fm_icon_view_destroy (GtkWidget *object)
-#else
-fm_icon_view_destroy (GtkObject *object)
-#endif
{
FMIconView *icon_view;
@@ -244,11 +240,7 @@ fm_icon_view_destroy (GtkObject *object)
icon_view->details->icons_not_positioned = NULL;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (fm_icon_view_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (fm_icon_view_parent_class)->destroy (object);
-#endif
}
static void
@@ -2493,7 +2485,6 @@ fm_icon_view_scroll_event (GtkWidget *widget,
gboolean ret;
icon_view = FM_ICON_VIEW (widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (icon_view->details->compact &&
(scroll_event->direction == GDK_SCROLL_UP ||
scroll_event->direction == GDK_SCROLL_DOWN ||
@@ -2517,22 +2508,7 @@ fm_icon_view_scroll_event (GtkWidget *widget,
}
if ((scroll_event_copy->direction == GDK_SCROLL_UP) || (scroll_event_copy->delta_x == -1.0))
-#else
-
- if (icon_view->details->compact &&
- (scroll_event->direction == GDK_SCROLL_UP ||
- scroll_event->direction == GDK_SCROLL_DOWN))
- {
- ret = fm_directory_view_handle_scroll_event (FM_DIRECTORY_VIEW (icon_view), scroll_event);
- if (!ret)
- {
- /* in column-wise layout, re-emit vertical mouse scroll events as horizontal ones,
- * if they don't bump zoom */
- event_copy = gdk_event_copy ((GdkEvent *) scroll_event);
- scroll_event_copy = (GdkEventScroll *) event_copy;
- if (scroll_event_copy->direction == GDK_SCROLL_UP)
-#endif
{
scroll_event_copy->direction = GDK_SCROLL_LEFT;
}
@@ -3182,11 +3158,8 @@ fm_icon_view_class_init (FMIconViewClass *klass)
G_OBJECT_CLASS (klass)->set_property = fm_icon_view_set_property;
G_OBJECT_CLASS (klass)->finalize = fm_icon_view_finalize;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (klass)->destroy = fm_icon_view_destroy;
-#else
+
GTK_WIDGET_CLASS (klass)->destroy = fm_icon_view_destroy;
-#endif
GTK_WIDGET_CLASS (klass)->screen_changed = fm_icon_view_screen_changed;
GTK_WIDGET_CLASS (klass)->scroll_event = fm_icon_view_scroll_event;
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index f33da35d..315fef70 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -29,11 +29,7 @@
#include <libegg/eggtreemultidnd.h>
#include <string.h>
-#if GTK_CHECK_VERSION(3,0,0)
#include <eel/eel-graphic-effects.h>
-#else
-#include <eel/eel-gdk-pixbuf-extensions.h>
-#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libcaja-private/caja-dnd.h>
@@ -390,11 +386,7 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
g_list_find_custom (model->details->highlight_files,
file, (GCompareFunc) caja_file_compare_location))
{
-#if GTK_CHECK_VERSION(3,0,0)
rendered_icon = eel_create_spotlight_pixbuf (icon);
-#else
- rendered_icon = eel_gdk_pixbuf_render (icon, 1, 255, 255, 0, 0);
-#endif
if (rendered_icon != NULL)
{
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 999254d0..26d3cf74 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -63,10 +63,6 @@
#include <libcaja-private/caja-clipboard.h>
#include <libcaja-private/caja-cell-renderer-text-ellipsized.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
struct FMListViewDetails
{
GtkTreeView *tree_view;
@@ -665,9 +661,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
FMListView *view;
GtkTreeView *tree_view;
GtkTreePath *path;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- GtkWidget *caja_window;
-#endif
gboolean call_parent;
GtkTreeSelection *selection;
GtkWidgetClass *tree_view_class;
@@ -683,13 +676,11 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
tree_view_class = GTK_WIDGET_GET_CLASS (tree_view);
selection = gtk_tree_view_get_selection (tree_view);
-#if GTK_CHECK_VERSION(3, 0, 0)
/* Don't handle extra mouse buttons here */
if (event->button > 5)
{
return FALSE;
}
-#endif
if (event->window != gtk_tree_view_get_bin_window (tree_view))
{
@@ -860,13 +851,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
}
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
- if (event->button > 5) {
- caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view)));
- call_parent = !caja_navigation_window_button_press_event (caja_window, event);
- }
-#endif
-
if (call_parent)
{
tree_view_class->button_press_event (widget, event);
@@ -905,22 +889,11 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
view->details->double_click_path[1] = view->details->double_click_path[0];
view->details->double_click_path[0] = NULL;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
+
/* Deselect if people click outside any row. It's OK to
let default code run; it won't reselect anything. */
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view));
tree_view_class->button_press_event (widget, event);
-#else
- if (event->button > 5) {
- caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view)));
- call_parent = !caja_navigation_window_button_press_event (caja_window, event);
- } else {
- /* Deselect if people click outside any row. It's OK to
- let default code run; it won't reselect anything. */
- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view));
- tree_view_class->button_press_event (widget, event);
- }
-#endif
if (event->button == 3)
{
@@ -1749,9 +1722,6 @@ create_and_set_up_tree_view (FMListView *view)
G_CALLBACK (subdirectory_unloaded_callback), view, 0);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view->details->tree_view), GTK_SELECTION_MULTIPLE);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_tree_view_set_rules_hint (view->details->tree_view, TRUE);
-#endif
caja_columns = caja_get_all_columns ();
@@ -1783,14 +1753,12 @@ create_and_set_up_tree_view (FMListView *view)
view->details->file_name_column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_expand (view->details->file_name_column, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
+
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET(view));
font_size = PANGO_PIXELS (pango_font_description_get_size (
gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL)));
-#else
- font_size = PANGO_PIXELS (pango_font_description_get_size (gtk_widget_get_style (GTK_WIDGET(view))->font_desc));
-#endif
+
gtk_tree_view_column_set_min_width (view->details->file_name_column, 20*font_size);
g_object_ref_sink (view->details->file_name_column);
view->details->file_name_column_num = column_num;
@@ -2551,9 +2519,6 @@ create_column_editor (FMListView *view)
GtkWidget *label;
GtkWidget *box;
GtkWidget *column_chooser;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkWidget *alignment;
-#endif
CajaFile *file;
char *str;
char *name;
@@ -2575,7 +2540,7 @@ create_column_editor (FMListView *view)
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
- box = gtk_vbox_new (FALSE, 12);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
gtk_widget_show (box);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), box);
@@ -2596,22 +2561,10 @@ create_column_editor (FMListView *view)
g_free (str);
-#if GTK_CHECK_VERSION (3, 0, 0)
column_chooser = caja_column_chooser_new (file);
gtk_widget_set_margin_start (column_chooser, 12);
gtk_widget_show (column_chooser);
gtk_box_pack_start (GTK_BOX (box), column_chooser, TRUE, TRUE, 0);
-#else
- alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
- 0, 0, 12, 0);
- gtk_widget_show (alignment);
- gtk_box_pack_start (GTK_BOX (box), alignment, TRUE, TRUE, 0);
-
- column_chooser = caja_column_chooser_new (file);
- gtk_widget_show (column_chooser);
- gtk_container_add (GTK_CONTAINER (alignment), column_chooser);
-#endif
g_signal_connect (column_chooser, "changed",
G_CALLBACK (column_chooser_changed_callback),
@@ -3005,15 +2958,8 @@ fm_list_view_click_policy_changed (FMDirectoryView *directory_view)
}
}
-#if GTK_CHECK_VERSION(3,0,0)
g_clear_object (&hand_cursor);
-#else
- if (hand_cursor != NULL)
- {
- gdk_cursor_unref (hand_cursor);
- hand_cursor = NULL;
- }
-#endif
+
}
else if (click_policy_auto_value == CAJA_CLICK_POLICY_SINGLE)
{
@@ -3311,35 +3257,20 @@ real_set_is_active (FMDirectoryView *view,
gboolean is_active)
{
GtkWidget *tree_view;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style;
GdkRGBA color;
-#else
- GtkStyle *style;
- GdkColor color;
-#endif
tree_view = GTK_WIDGET (fm_list_view_get_tree_view (FM_LIST_VIEW (view)));
if (is_active)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, NULL);
-#else
- gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, NULL);
-#endif
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
style = gtk_widget_get_style_context (tree_view);
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, &color);
-#else
- style = gtk_widget_get_style (tree_view);
- color = style->base[GTK_STATE_INSENSITIVE];
- gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, &color);
-#endif
}
EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS,
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index db5e173c..87afdc5a 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -68,7 +68,6 @@
#include <sys/mount.h>
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
#define USED_FILL_R 0.988235294
#define USED_FILL_G 0.91372549
#define USED_FILL_B 0.309803922
@@ -76,16 +75,6 @@
#define FREE_FILL_R 0.447058824
#define FREE_FILL_G 0.623529412
#define FREE_FILL_B 0.811764706
-#else
-#define USED_FILL_R (0.988235294 * 65535)
-#define USED_FILL_G (0.91372549 * 65535)
-#define USED_FILL_B (0.309803922 * 65535)
-
-#define FREE_FILL_R (0.447058824 * 65535)
-#define FREE_FILL_G (0.623529412 * 65535)
-#define FREE_FILL_B (0.811764706 * 65535)
-#endif
-
#define PREVIEW_IMAGE_WIDTH 96
@@ -100,13 +89,7 @@ struct FMPropertiesWindowDetails {
GtkNotebook *notebook;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *basic_grid;
-#else
- GtkTable *basic_table;
- GtkTable *permissions_table;
- gboolean advanced_permissions;
-#endif
GtkWidget *icon_button;
GtkWidget *icon_image;
@@ -153,40 +136,17 @@ struct FMPropertiesWindowDetails {
guint64 volume_capacity;
guint64 volume_free;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA used_color;
GdkRGBA free_color;
GdkRGBA used_stroke_color;
GdkRGBA free_stroke_color;
-#else
- GdkColor used_color;
- GdkColor free_color;
- GdkColor used_stroke_color;
- GdkColor free_stroke_color;
-#endif
};
-#if GTK_CHECK_VERSION (3, 0, 0)
typedef enum {
PERMISSIONS_CHECKBOXES_READ,
PERMISSIONS_CHECKBOXES_WRITE,
PERMISSIONS_CHECKBOXES_EXECUTE
} CheckboxType;
-#else
-enum {
- PERMISSIONS_CHECKBOXES_OWNER_ROW,
- PERMISSIONS_CHECKBOXES_GROUP_ROW,
- PERMISSIONS_CHECKBOXES_OTHERS_ROW,
- PERMISSIONS_CHECKBOXES_ROW_COUNT
-};
-
-enum {
- PERMISSIONS_CHECKBOXES_READ_COLUMN,
- PERMISSIONS_CHECKBOXES_WRITE_COLUMN,
- PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
- PERMISSIONS_CHECKBOXES_COLUMN_COUNT
-};
-#endif
enum {
TITLE_COLUMN,
@@ -263,22 +223,14 @@ static gboolean name_field_focus_out (CajaEntry *name_field,
gpointer callback_data);
static void name_field_activate (CajaEntry *name_field,
gpointer callback_data);
-#if GTK_CHECK_VERSION (3, 0, 0)
static GtkLabel *attach_ellipsizing_value_label (GtkGrid *grid,
GtkWidget *sibling,
-#else
-static GtkLabel *attach_ellipsizing_value_label (GtkTable *table,
- int row,
- int column,
-#endif
+
const char *initial_text);
static GtkWidget* create_pie_widget (FMPropertiesWindow *window);
G_DEFINE_TYPE (FMPropertiesWindow, fm_properties_window, GTK_TYPE_DIALOG);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#define parent_class fm_properties_window_parent_class
-#endif
static gboolean
is_multi_file_window (FMPropertiesWindow *window)
@@ -397,11 +349,8 @@ add_prompt_and_separator (GtkWidget *vbox, const char *prompt_text)
add_prompt (vbox, prompt_text, FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
separator_line = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- separator_line = gtk_hseparator_new ();
-#endif
+
gtk_widget_show (separator_line);
gtk_box_pack_end (GTK_BOX (vbox), separator_line, TRUE, TRUE, 2*ROW_PAD);
}
@@ -613,14 +562,9 @@ create_image_widget (FMPropertiesWindow *window,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
set_name_field (FMPropertiesWindow *window,
const gchar *original_name,
const gchar *name)
-#else
-set_name_field (FMPropertiesWindow *window, const gchar *original_name,
- const gchar *name)
-#endif
{
gboolean new_widget;
gboolean use_label;
@@ -640,36 +584,19 @@ set_name_field (FMPropertiesWindow *window, const gchar *original_name,
}
if (use_label) {
-#if GTK_CHECK_VERSION (3, 0, 0)
window->details->name_field = GTK_WIDGET
(attach_ellipsizing_value_label (window->details->basic_grid,
GTK_WIDGET (window->details->name_label),
name));
-#else
- window->details->name_field =
- GTK_WIDGET (attach_ellipsizing_value_label
- (window->details->basic_table,
- window->details->name_row,
- VALUE_COLUMN, name));
-#endif
+
} else {
window->details->name_field = caja_entry_new ();
gtk_entry_set_text (GTK_ENTRY (window->details->name_field), name);
gtk_widget_show (window->details->name_field);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (window->details->basic_grid, window->details->name_field,
GTK_WIDGET (window->details->name_label),
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (window->details->basic_table,
- window->details->name_field,
- VALUE_COLUMN,
- VALUE_COLUMN + 1,
- window->details->name_row,
- window->details->name_row + 1,
- GTK_FILL, 0,
- 0, 0);
-#endif
+
gtk_label_set_mnemonic_widget (GTK_LABEL (window->details->name_label), window->details->name_field);
g_signal_connect_object (window->details->name_field, "focus_out_event",
@@ -1421,14 +1348,8 @@ value_field_update (FMPropertiesWindow *window, GtkLabel *label)
}
static GtkLabel *
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_label (GtkGrid *grid,
GtkWidget *sibling,
-#else
-attach_label (GtkTable *table,
- int row,
- int column,
-#endif
const char *initial_text,
gboolean ellipsize_text,
gboolean selectable,
@@ -1456,7 +1377,6 @@ attach_label (GtkTable *table,
gtk_misc_set_alignment (GTK_MISC (label_field), 0, 0.5);
#endif
gtk_widget_show (label_field);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (ellipsize_text) {
gtk_widget_set_hexpand (label_field, TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (label_field), 24);
@@ -1468,66 +1388,30 @@ attach_label (GtkTable *table,
} else {
gtk_container_add (GTK_CONTAINER (grid), label_field);
}
-#else
- gtk_table_attach (table, label_field,
- column, column + 1,
- row, row + 1,
- ellipsize_text
- ? GTK_FILL | GTK_EXPAND
- : GTK_FILL,
- 0,
- 0, 0);
-#endif
return GTK_LABEL (label_field);
}
static GtkLabel *
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_value_label (GtkGrid *grid,
GtkWidget *sibling,
const char *initial_text)
{
return attach_label (grid, sibling, initial_text, FALSE, TRUE, FALSE);
}
-#else
-attach_value_label (GtkTable *table,
- int row,
- int column,
- const char *initial_text)
-{
- return attach_label (table, row, column, initial_text, FALSE, TRUE, FALSE);
-}
-#endif
static GtkLabel *
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_ellipsizing_value_label (GtkGrid *grid,
GtkWidget *sibling,
const char *initial_text)
{
return attach_label (grid, sibling, initial_text, TRUE, TRUE, FALSE);
}
-#else
-attach_ellipsizing_value_label (GtkTable *table,
- int row,
- int column,
- const char *initial_text)
-{
- return attach_label (table, row, column, initial_text, TRUE, TRUE, FALSE);
-}
-#endif
static GtkWidget*
attach_value_field_internal (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
GtkWidget *sibling,
-#else
- GtkTable *table,
- int row,
- int column,
-#endif
const char *file_attribute_name,
const char *inconsistent_string,
gboolean show_original,
@@ -1536,15 +1420,9 @@ attach_value_field_internal (FMPropertiesWindow *window,
GtkLabel *value_field;
if (ellipsize_text) {
-#if GTK_CHECK_VERSION (3, 0, 0)
value_field = attach_ellipsizing_value_label (grid, sibling, "");
} else {
value_field = attach_value_label (grid, sibling, "");
-#else
- value_field = attach_ellipsizing_value_label (table, row, column, "");
- } else {
- value_field = attach_value_label (table, row, column, "");
-#endif
}
/* Stash a copy of the file attribute name in this field for the callback's sake. */
@@ -1563,62 +1441,34 @@ attach_value_field_internal (FMPropertiesWindow *window,
static GtkWidget*
attach_value_field (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
GtkWidget *sibling,
-#else
- GtkTable *table,
- int row,
- int column,
-#endif
const char *file_attribute_name,
const char *inconsistent_string,
gboolean show_original)
{
return attach_value_field_internal (window,
-#if GTK_CHECK_VERSION (3, 0, 0)
grid, sibling,
file_attribute_name,
inconsistent_string,
show_original,
FALSE);
-#else
- table, row, column,
- file_attribute_name,
- inconsistent_string,
- show_original,
- FALSE);
-#endif
}
static GtkWidget*
attach_ellipsizing_value_field (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
GtkWidget *sibling,
-#else
- GtkTable *table,
- int row,
- int column,
-#endif
const char *file_attribute_name,
const char *inconsistent_string,
gboolean show_original)
{
return attach_value_field_internal (window,
-#if GTK_CHECK_VERSION (3, 0, 0)
grid, sibling,
file_attribute_name,
inconsistent_string,
show_original,
TRUE);
-#else
- table, row, column,
- file_attribute_name,
- inconsistent_string,
- show_original,
- TRUE);
-#endif
}
static void
@@ -1970,19 +1820,11 @@ combo_box_row_separator_func (GtkTreeModel *model,
}
static GtkComboBox *
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_combo_box (GtkGrid *grid,
GtkWidget *sibling,
-#else
-attach_combo_box (GtkTable *table,
- int row,
-#endif
gboolean two_columns)
{
GtkWidget *combo_box;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkWidget *aligner;
-#endif
if (!two_columns) {
combo_box = gtk_combo_box_text_new ();
@@ -2000,9 +1842,9 @@ attach_combo_box (GtkTable *table,
"text", 0);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_widget_set_halign (combo_box, GTK_ALIGN_START);
-#endif
+
gtk_widget_show (combo_box);
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo_box),
@@ -2010,44 +1852,20 @@ attach_combo_box (GtkTable *table,
NULL,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (grid, combo_box, sibling,
GTK_POS_RIGHT, 1, 1);
-#else
- /* Put combo box in alignment to make it left-justified
- * but minimally sized.
- */
- aligner = gtk_alignment_new (0, 0.5, 0, 0);
- gtk_widget_show (aligner);
-
- gtk_container_add (GTK_CONTAINER (aligner), combo_box);
- gtk_table_attach (table, aligner,
- VALUE_COLUMN, VALUE_COLUMN + 1,
- row, row + 1,
- GTK_FILL, 0,
- 0, 0);
-#endif
return GTK_COMBO_BOX (combo_box);
}
static GtkComboBox*
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_group_combo_box (GtkGrid *grid,
GtkWidget *sibling,
-#else
-attach_group_combo_box (GtkTable *table,
- int row,
-#endif
CajaFile *file)
{
GtkComboBox *combo_box;
-#if GTK_CHECK_VERSION (3, 0, 0)
combo_box = attach_combo_box (grid, sibling, FALSE);
-#else
- combo_box = attach_combo_box (table, row, FALSE);
-#endif
synch_groups_combo_box (combo_box, file);
@@ -2325,22 +2143,13 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file)
}
static GtkComboBox*
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_owner_combo_box (GtkGrid *grid,
GtkWidget *sibling,
-#else
-attach_owner_combo_box (GtkTable *table,
- int row,
-#endif
CajaFile *file)
{
GtkComboBox *combo_box;
-#if GTK_CHECK_VERSION (3, 0, 0)
combo_box = attach_combo_box (grid, sibling, TRUE);
-#else
- combo_box = attach_combo_box (table, row, TRUE);
-#endif
synch_user_menu (combo_box, file);
@@ -2356,24 +2165,6 @@ attach_owner_combo_box (GtkTable *table,
return combo_box;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static guint
-append_row (GtkTable *table)
-{
- guint new_row_count;
- gint nrows, ncols;
-
- g_object_get (table, "n-rows", &nrows, "n-columns", &ncols, NULL);
-
- new_row_count = nrows + 1;
-
- gtk_table_resize (table, new_row_count, ncols);
- gtk_table_set_row_spacing (table, new_row_count - 1, ROW_PAD);
-
- return new_row_count - 1;
-}
-#endif
-
static gboolean
file_has_prefix (CajaFile *file,
GList *prefix_candidates)
@@ -2559,23 +2350,14 @@ schedule_directory_contents_update (FMPropertiesWindow *window)
static GtkLabel *
attach_directory_contents_value_field (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
GtkWidget *sibling)
-#else
- GtkTable *table,
- int row)
-#endif
{
GtkLabel *value_field;
GList *l;
CajaFile *file;
-#if GTK_CHECK_VERSION (3, 0, 0)
value_field = attach_value_label (grid, sibling, "");
-#else
- value_field = attach_value_label (table, row, VALUE_COLUMN, "");
-#endif
g_assert (window->details->directory_contents_value_field == NULL);
window->details->directory_contents_value_field = value_field;
@@ -2599,43 +2381,17 @@ attach_directory_contents_value_field (FMPropertiesWindow *window,
}
static GtkLabel *
-#if GTK_CHECK_VERSION (3, 0, 0)
attach_title_field (GtkGrid *grid,
const char *title)
{
return attach_label (grid, NULL, title, FALSE, FALSE, TRUE);
}
-#else
-attach_title_field (GtkTable *table,
- int row,
- const char *title)
-{
- return attach_label (table, row, TITLE_COLUMN, title, FALSE, FALSE, TRUE);
-}
-#endif
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static guint
-append_title_field (GtkTable *table, const char *title, GtkLabel **label)
-{
- guint last_row;
- GtkLabel *title_label;
-
- last_row = append_row (table);
- title_label = attach_title_field (table, last_row, title);
- if (label) {
- *label = title_label;
- }
- return last_row;
-}
-#endif
#define INCONSISTENT_STATE_STRING \
"\xE2\x80\x92"
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
append_title_value_pair (FMPropertiesWindow *window,
GtkGrid *grid,
@@ -2689,70 +2445,6 @@ append_directory_contents_fields (FMPropertiesWindow *window,
gtk_label_set_mnemonic_widget (title_field, GTK_WIDGET(value_field));
}
-#else
-static guint
-append_title_value_pair (FMPropertiesWindow *window,
- GtkTable *table,
- const char *title,
- const char *file_attribute_name,
- const char *inconsistent_state,
- gboolean show_original)
-{
- guint last_row;
- GtkLabel *title_label;
- GtkWidget *value;
-
- last_row = append_title_field (table, title, &title_label);
- value = attach_value_field (window, table, last_row, VALUE_COLUMN,
- file_attribute_name,
- inconsistent_state,
- show_original);
- gtk_label_set_mnemonic_widget (title_label, value);
- return last_row;
-}
-
-static guint
-append_title_and_ellipsizing_value (FMPropertiesWindow *window,
- GtkTable *table,
- const char *title,
- const char *file_attribute_name,
- const char *inconsistent_state,
- gboolean show_original)
-{
- GtkLabel *title_label;
- GtkWidget *value;
- guint last_row;
-
- last_row = append_title_field (table, title, &title_label);
- value = attach_ellipsizing_value_field (window, table, last_row, VALUE_COLUMN,
- file_attribute_name,
- inconsistent_state,
- show_original);
- gtk_label_set_mnemonic_widget (title_label, value);
-
- return last_row;
-}
-
-static guint
-append_directory_contents_fields (FMPropertiesWindow *window,
- GtkTable *table)
-{
- GtkLabel *title_field, *value_field;
- guint last_row;
-
- last_row = append_row (table);
-
- title_field = attach_title_field (table, last_row, "");
- window->details->directory_contents_title_field = title_field;
- gtk_label_set_line_wrap (title_field, TRUE);
-
- value_field = attach_directory_contents_value_field
- (window, table, last_row);
-
- gtk_label_set_mnemonic_widget(title_field, GTK_WIDGET(value_field));
- return last_row;
-}
-#endif
static GtkWidget *
create_page_with_hbox (GtkNotebook *notebook,
@@ -2763,11 +2455,7 @@ create_page_with_hbox (GtkNotebook *notebook,
g_assert (GTK_IS_NOTEBOOK (notebook));
g_assert (title != NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (hbox);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_box_set_spacing (GTK_BOX (hbox), 12);
@@ -2785,12 +2473,9 @@ create_page_with_vbox (GtkNotebook *notebook,
g_assert (GTK_IS_NOTEBOOK (notebook));
g_assert (title != NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_widget_show (vbox);
+
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_notebook_append_page (notebook, vbox, gtk_label_new (title));
@@ -2798,23 +2483,12 @@ create_page_with_vbox (GtkNotebook *notebook,
}
static GtkWidget *
-#if GTK_CHECK_VERSION (3, 0, 0)
append_blank_row (GtkGrid *grid)
{
return GTK_WIDGET (attach_title_field (grid, ""));
-#else
-append_blank_row (GtkTable *table)
-{
- GtkWidget *separator;
-
- append_title_field (table, "", (GtkLabel **) &separator);
-
- return separator;
-#endif
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
append_blank_slim_row (GtkGrid *grid)
{
GtkWidget *w;
@@ -2832,16 +2506,9 @@ append_blank_slim_row (GtkGrid *grid)
pango_attr_list_unref (attr_list);
gtk_container_add (GTK_CONTAINER (grid), w);
-#else
-apply_standard_table_padding (GtkTable *table)
-{
- gtk_table_set_row_spacings (table, ROW_PAD);
- gtk_table_set_col_spacings (table, 12);
-#endif
}
static GtkWidget *
-#if GTK_CHECK_VERSION (3, 0, 0)
create_grid_with_standard_properties (void)
{
GtkWidget *grid;
@@ -2855,19 +2522,6 @@ create_grid_with_standard_properties (void)
return grid;
}
-#else
-create_attribute_value_table (GtkBox *vbox, int row_count)
-{
- GtkWidget *table;
-
- table = gtk_table_new (row_count, COLUMN_COUNT, FALSE);
- apply_standard_table_padding (GTK_TABLE (table));
- gtk_widget_show (table);
- gtk_box_pack_start (vbox, table, FALSE, FALSE, 0);
-
- return table;
-}
-#endif
static gboolean
is_merged_trash_directory (CajaFile *file)
@@ -3032,11 +2686,7 @@ should_show_volume_usage (FMPropertiesWindow *window)
static void
paint_used_legend (GtkWidget *widget,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkEventExpose *eev,
-#endif
gpointer data)
{
FMPropertiesWindow *window;
@@ -3050,46 +2700,22 @@ paint_used_legend (GtkWidget *widget,
window = FM_PROPERTIES_WINDOW (data);
-#if !GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
-
cairo_rectangle (cr,
2,
2,
width - 4,
height - 4);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &window->details->used_color);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color);
cairo_stroke (cr);
-#else
- cairo_set_source_rgb (cr,
- (double) window->details->used_color.red / 65535,
- (double) window->details->used_color.green / 65535,
- (double) window->details->used_color.blue / 65535);
- cairo_fill_preserve (cr);
-
- cairo_set_source_rgb (cr,
- (double) window->details->used_stroke_color.red / 65535,
- (double) window->details->used_stroke_color.green / 65535,
- (double) window->details->used_stroke_color.blue / 65535);
- cairo_stroke (cr);
-
- cairo_destroy (cr);
-#endif
}
static void
paint_free_legend (GtkWidget *widget,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr, gpointer data)
-#else
- GdkEventExpose *eev, gpointer data)
-#endif
{
FMPropertiesWindow *window;
gint width, height;
@@ -3100,9 +2726,6 @@ paint_free_legend (GtkWidget *widget,
width = allocation.width;
height = allocation.height;
-#if !GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
cairo_rectangle (cr,
2,
@@ -3110,36 +2733,16 @@ paint_free_legend (GtkWidget *widget,
width - 4,
height - 4);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &window->details->free_color);
cairo_fill_preserve(cr);
gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color);
cairo_stroke (cr);
-#else
- cairo_set_source_rgb (cr,
- (double) window->details->free_color.red / 65535,
- (double) window->details->free_color.green / 65535,
- (double) window->details->free_color.blue / 65535);
- cairo_fill_preserve(cr);
-
- cairo_set_source_rgb (cr,
- (double) window->details->free_stroke_color.red / 65535,
- (double) window->details->free_stroke_color.green / 65535,
- (double) window->details->free_stroke_color.blue / 65535);
- cairo_stroke (cr);
-
- cairo_destroy (cr);
-#endif
}
static void
paint_pie_chart (GtkWidget *widget,
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
-#else
- GdkEventExpose *eev,
-#endif
gpointer data)
{
@@ -3165,10 +2768,6 @@ paint_pie_chart (GtkWidget *widget,
xc = width / 2;
yc = height / 2;
-#if !GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
-
if (width < height) {
radius = width / 2 - 8;
} else {
@@ -3194,23 +2793,11 @@ paint_pie_chart (GtkWidget *widget,
cairo_line_to (cr,xc,yc);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &window->details->used_color);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color);
-#else
- cairo_set_source_rgb (cr,
- (double) window->details->used_color.red / 65535,
- (double) window->details->used_color.green / 65535,
- (double) window->details->used_color.blue / 65535);
- cairo_fill_preserve (cr);
- cairo_set_source_rgb (cr,
- (double) window->details->used_stroke_color.red / 65535,
- (double) window->details->used_stroke_color.green / 65535,
- (double) window->details->used_stroke_color.blue / 65535);
-#endif
cairo_stroke (cr);
}
@@ -3225,29 +2812,14 @@ paint_pie_chart (GtkWidget *widget,
cairo_line_to (cr,xc,yc);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_cairo_set_source_rgba (cr, &window->details->free_color);
cairo_fill_preserve(cr);
gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color);
-#else
- cairo_set_source_rgb (cr,
- (double) window->details->free_color.red / 65535,
- (double) window->details->free_color.green / 65535,
- (double) window->details->free_color.blue / 65535);
- cairo_fill_preserve(cr);
- cairo_set_source_rgb (cr,
- (double) window->details->free_stroke_color.red / 65535,
- (double) window->details->free_stroke_color.green / 65535,
- (double) window->details->free_stroke_color.blue / 65535);
-#endif
cairo_stroke (cr);
}
-
-#if !GTK_CHECK_VERSION(3,0,0)
- cairo_destroy (cr);
-#endif
}
@@ -3403,28 +2975,17 @@ hls_to_rgb (gdouble *h,
}
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
_pie_style_shade (GdkRGBA *a,
GdkRGBA *b,
-#else
-_pie_style_shade (GdkColor *a,
- GdkColor *b,
-#endif
gdouble k)
{
gdouble red;
gdouble green;
gdouble blue;
-#if GTK_CHECK_VERSION (3, 0, 0)
red = a->red;
green = a->green;
blue = a->blue;
-#else
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-#endif
rgb_to_hls (&red, &green, &blue);
@@ -3442,16 +3003,10 @@ _pie_style_shade (GdkColor *a,
hls_to_rgb (&red, &green, &blue);
-#if GTK_CHECK_VERSION (3, 0, 0)
b->red = red;
b->green = green;
b->blue = blue;
b->alpha = a->alpha;
-#else
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-#endif
}
@@ -3459,13 +3014,9 @@ static GtkWidget*
create_pie_widget (FMPropertiesWindow *window)
{
CajaFile *file;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid;
GtkStyleContext *style;
-#else
- GtkTable *table;
- GtkStyle *style;
-#endif
+
GtkWidget *pie_canvas;
GtkWidget *used_canvas;
GtkWidget *used_label;
@@ -3496,39 +3047,27 @@ create_pie_widget (FMPropertiesWindow *window)
uri = caja_file_get_activation_uri (file);
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = GTK_GRID (gtk_grid_new ());
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
style = gtk_widget_get_style_context (GTK_WIDGET (grid));
if (!gtk_style_context_lookup_color (style, "chart_rgba_1", &window->details->used_color)) {
-#else
- table = GTK_TABLE (gtk_table_new (4, 3, FALSE));
-
- style = gtk_rc_get_style (GTK_WIDGET(table));
- if (!gtk_style_lookup_color (style, "chart_color_1", &window->details->used_color)) {
-#endif
window->details->used_color.red = USED_FILL_R;
window->details->used_color.green = USED_FILL_G;
window->details->used_color.blue = USED_FILL_B;
-#if GTK_CHECK_VERSION (3, 0, 0)
window->details->used_color.alpha = 1;
-#endif
+
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
if (!gtk_style_context_lookup_color (style, "chart_rgba_2", &window->details->free_color)) {
-#else
- if (!gtk_style_lookup_color (style, "chart_color_2", &window->details->free_color)) {
-#endif
window->details->free_color.red = FREE_FILL_R;
window->details->free_color.green = FREE_FILL_G;
window->details->free_color.blue = FREE_FILL_B;
-#if GTK_CHECK_VERSION (3, 0, 0)
window->details->free_color.alpha = 1;
-#endif
+
}
_pie_style_shade (&window->details->used_color, &window->details->used_stroke_color, 0.7);
@@ -3538,19 +3077,19 @@ create_pie_widget (FMPropertiesWindow *window)
gtk_widget_set_size_request (pie_canvas, 200, 200);
used_canvas = gtk_drawing_area_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_widget_set_valign (used_canvas, GTK_ALIGN_CENTER);
gtk_widget_set_halign (used_canvas, GTK_ALIGN_CENTER);
-#endif
+
gtk_widget_set_size_request (used_canvas, 20, 20);
/* Translators: "used" refers to the capacity of the filesystem */
used_label = gtk_label_new (g_strconcat (used, " ", _("used"), NULL));
free_canvas = gtk_drawing_area_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_widget_set_valign (free_canvas, GTK_ALIGN_CENTER);
gtk_widget_set_halign (free_canvas, GTK_ALIGN_CENTER);
-#endif
+
gtk_widget_set_size_request (free_canvas, 20, 20);
/* Translators: "free" refers to the capacity of the filesystem */
free_label = gtk_label_new (g_strconcat (free, " ", _("free"), NULL));
@@ -3578,7 +3117,6 @@ create_pie_widget (FMPropertiesWindow *window)
g_free (used);
g_free (free);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add_with_properties (GTK_CONTAINER (grid), pie_canvas,
"height", 4,
NULL);
@@ -3596,40 +3134,16 @@ create_pie_widget (FMPropertiesWindow *window)
GTK_POS_BOTTOM, 2, 1);
gtk_grid_attach_next_to (grid, fstype_label, capacity_label,
GTK_POS_BOTTOM, 2, 1);
-#else
- gtk_table_attach (table, pie_canvas , 0, 1, 0, 4, GTK_FILL, GTK_SHRINK, 5, 5);
-
- gtk_table_attach (table, used_canvas, 1, 2, 0, 1, 0, 0, 5, 5);
- gtk_table_attach (table, used_label , 2, 3, 0, 1, GTK_FILL, 0, 5, 5);
- gtk_table_attach (table, free_canvas, 1, 2, 1, 2, 0, 0, 5, 5);
- gtk_table_attach (table, free_label , 2, 3, 1, 2, GTK_FILL, 0, 5, 5);
-
- gtk_table_attach (table, capacity_label , 1, 3, 2, 3, GTK_FILL, 0, 5, 5);
- gtk_table_attach (table, fstype_label , 1, 3, 3, 4, GTK_FILL, 0, 5, 5);
-#endif
-
-#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect (pie_canvas, "draw",
G_CALLBACK (paint_pie_chart), window);
g_signal_connect (used_canvas, "draw",
G_CALLBACK (paint_used_legend), window);
g_signal_connect (free_canvas, "draw",
G_CALLBACK (paint_free_legend), window);
-#else
- g_signal_connect (G_OBJECT (pie_canvas), "expose-event",
- G_CALLBACK (paint_pie_chart), window);
- g_signal_connect (G_OBJECT (used_canvas), "expose-event",
- G_CALLBACK (paint_used_legend), window);
- g_signal_connect (G_OBJECT (free_canvas), "expose-event",
- G_CALLBACK (paint_free_legend), window);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
return GTK_WIDGET (grid);
-#else
- return GTK_WIDGET (table);
-#endif
+
}
static GtkWidget*
@@ -3670,73 +3184,37 @@ create_volume_usage_widget (FMPropertiesWindow *window)
static void
create_basic_page (FMPropertiesWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid;
-#else
- GtkTable *table;
- GtkWidget *icon_aligner;
-#endif
GtkWidget *icon_pixmap_widget;
GtkWidget *volume_usage;
GtkWidget *hbox, *vbox;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- guint last_row, row;
-#endif
-
hbox = create_page_with_hbox (window->details->notebook, _("Basic"));
/* Icon pixmap */
icon_pixmap_widget = create_image_widget (
window, should_show_custom_icon_buttons (window));
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gtk_widget_set_halign (icon_pixmap_widget, GTK_ALIGN_END);
gtk_widget_set_valign (icon_pixmap_widget, GTK_ALIGN_START);
gtk_widget_show (icon_pixmap_widget);
gtk_box_pack_start (GTK_BOX (hbox), icon_pixmap_widget, FALSE, FALSE, 0);
-#else
- gtk_widget_show (icon_pixmap_widget);
-
- icon_aligner = gtk_alignment_new (1, 0, 0, 0);
- gtk_widget_show (icon_aligner);
-
- gtk_container_add (GTK_CONTAINER (icon_aligner), icon_pixmap_widget);
- gtk_box_pack_start (GTK_BOX (hbox), icon_aligner, FALSE, FALSE, 0);
-#endif
window->details->icon_chooser = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
- /* Grid */
-#else
- /* Table */
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
+
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = GTK_GRID (create_grid_with_standard_properties ());
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (grid), FALSE, FALSE, 0);
window->details->basic_grid = grid;
/* Name label. The text will be determined in update_name_field */
window->details->name_label = attach_title_field (grid, NULL);
-#else
- table = GTK_TABLE (create_attribute_value_table (GTK_BOX (vbox), 0));
- window->details->basic_table = table;
-
- /* Name label. The text will be determined in update_name_field */
- row = append_title_field (table, NULL, &window->details->name_label);
- window->details->name_row = row;
-#endif
/* Name field */
window->details->name_field = NULL;
@@ -3752,17 +3230,12 @@ create_basic_page (FMPropertiesWindow *window)
GtkSizeGroup *label_size_group;
GtkWidget *box;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- row = append_row (table);
-#endif
-
label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (label_size_group,
GTK_WIDGET (window->details->name_label));
box = fm_ditem_page_make_box (label_size_group,
window->details->target_files);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (window->details->basic_grid, box,
GTK_WIDGET (window->details->name_label),
GTK_POS_BOTTOM, 2, 1);
@@ -3837,83 +3310,6 @@ create_basic_page (FMPropertiesWindow *window)
"width", 2,
NULL);
}
-#else
- gtk_table_attach (window->details->basic_table, box,
- TITLE_COLUMN, VALUE_COLUMN + 1,
- row, row + 1,
- GTK_FILL, 0,
- 0, 0);
- }
-
- if (should_show_file_type (window)) {
- append_title_value_pair (window,
- table, _("Type:"),
- "type",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- if (should_show_link_target (window)) {
- append_title_and_ellipsizing_value (window, table,
- _("Link target:"),
- "link_target",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- if (is_multi_file_window (window) ||
- caja_file_is_directory (get_target_file (window))) {
- append_directory_contents_fields (window, table);
- } else {
- append_title_value_pair (window, table, _("Size:"),
- "size_detail",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- append_blank_row (table);
-
- if (should_show_location_info (window)) {
- append_title_and_ellipsizing_value (window, table, _("Location:"),
- "where",
- INCONSISTENT_STATE_STRING,
- TRUE);
-
- append_title_and_ellipsizing_value (window, table,
- _("Volume:"),
- "volume",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- if (should_show_accessed_date (window)) {
- append_blank_row (table);
-
- append_title_value_pair (window, table, _("Accessed:"),
- "date_accessed",
- INCONSISTENT_STATE_STRING,
- FALSE);
- append_title_value_pair (window, table, _("Modified:"),
- "date_modified",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- if (should_show_free_space (window)) {
- append_blank_row (table);
-
- append_title_value_pair (window, table, _("Free space:"),
- "free_space",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- if (should_show_volume_usage (window)) {
- last_row = append_row (table);
- volume_usage = create_volume_usage_widget (window);
- gtk_table_attach_defaults (GTK_TABLE(table), volume_usage, 0, 2, last_row, last_row+1);
- }
-#endif
}
static GHashTable *
@@ -4082,11 +3478,7 @@ start_long_operation (FMPropertiesWindow *window)
display = gtk_widget_get_display (GTK_WIDGET (window));
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
window->details->long_operation_underway ++;
}
@@ -4382,17 +3774,10 @@ set_up_permissions_checkbox (FMPropertiesWindow *window,
0);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GtkWidget *
add_permissions_checkbox_with_label (FMPropertiesWindow *window,
GtkGrid *grid,
GtkWidget *sibling,
-#else
-static void
-add_permissions_checkbox_with_label (FMPropertiesWindow *window,
- GtkTable *table,
- int row, int column,
-#endif
const char *label,
guint32 permission_to_check,
GtkLabel *label_for,
@@ -4403,20 +3788,12 @@ add_permissions_checkbox_with_label (FMPropertiesWindow *window,
check_button = gtk_check_button_new_with_mnemonic (label);
gtk_widget_show (check_button);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (sibling) {
gtk_grid_attach_next_to (grid, check_button, sibling,
GTK_POS_RIGHT, 1, 1);
} else {
gtk_container_add (GTK_CONTAINER (grid), check_button);
}
-#else
- gtk_table_attach (table, check_button,
- column, column + 1,
- row, row + 1,
- GTK_FILL, 0,
- 0, 0);
-#endif
set_up_permissions_checkbox (window,
check_button,
@@ -4428,12 +3805,10 @@ add_permissions_checkbox_with_label (FMPropertiesWindow *window,
eel_accessibility_set_up_label_widget_relation (GTK_WIDGET (label_for),
check_button);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
return check_button;
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GtkWidget *
add_permissions_checkbox (FMPropertiesWindow *window,
GtkGrid *grid,
@@ -4460,33 +3835,6 @@ add_permissions_checkbox (FMPropertiesWindow *window,
label_for,
is_folder);
}
-#else
-static void
-add_permissions_checkbox (FMPropertiesWindow *window,
- GtkTable *table,
- int row, int column,
- guint32 permission_to_check,
- GtkLabel *label_for,
- gboolean is_folder)
-{
- gchar *label;
-
- if (column == PERMISSIONS_CHECKBOXES_READ_COLUMN) {
- label = _("_Read");
- } else if (column == PERMISSIONS_CHECKBOXES_WRITE_COLUMN) {
- label = _("_Write");
- } else {
- label = _("E_xecute");
- }
-
- add_permissions_checkbox_with_label (window, table,
- row, column,
- label,
- permission_to_check,
- label_for,
- is_folder);
-}
-#endif
enum {
UNIX_PERM_SUID = S_ISUID,
@@ -4807,11 +4155,7 @@ permission_combo_update (FMPropertiesWindow *window,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
add_permissions_combo_box (FMPropertiesWindow *window, GtkGrid *grid,
-#else
-add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table,
-#endif
PermissionType type, gboolean is_folder,
gboolean short_label)
{
@@ -4820,24 +4164,13 @@ add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table,
GtkListStore *store;
GtkCellRenderer *cell;
GtkTreeIter iter;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- int row;
-#endif
if (short_label) {
-#if GTK_CHECK_VERSION (3, 0, 0)
label = attach_title_field (grid, _("Access:"));
} else if (is_folder) {
label = attach_title_field (grid, _("Folder access:"));
} else {
label = attach_title_field (grid, _("File access:"));
-#else
- row = append_title_field (table, _("Access:"), &label);
- } else if (is_folder) {
- row = append_title_field (table, _("Folder access:"), &label);
- } else {
- row = append_title_field (table, _("File access:"), &label);
-#endif
}
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
@@ -4891,41 +4224,23 @@ add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table,
gtk_label_set_mnemonic_widget (label, combo);
gtk_widget_show (combo);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach_next_to (grid, combo, GTK_WIDGET (label),
GTK_POS_RIGHT, 1, 1);
-#else
- gtk_table_attach (table, combo,
- VALUE_COLUMN, VALUE_COLUMN + 1,
- row, row + 1,
- GTK_FILL, 0,
- 0, 0);
-#endif
}
static GtkWidget *
append_special_execution_checkbox (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
GtkWidget *sibling,
-#else
- GtkTable *table,
-#endif
const char *label_text,
guint32 permission_to_check)
{
GtkWidget *check_button;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- guint last_row;
-
- last_row = append_row (table);
-#endif
check_button = gtk_check_button_new_with_mnemonic (label_text);
gtk_widget_show (check_button);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (sibling != NULL) {
gtk_grid_attach_next_to (grid, check_button, sibling,
GTK_POS_RIGHT, 1, 1);
@@ -4934,13 +4249,6 @@ append_special_execution_checkbox (FMPropertiesWindow *window,
"left-attach", 1,
NULL);
}
-#else
- gtk_table_attach (table, check_button,
- VALUE_COLUMN, VALUE_COLUMN + 1,
- last_row, last_row + 1,
- GTK_FILL, 0,
- 0, 0);
-#endif
set_up_permissions_checkbox (window,
check_button,
@@ -4953,7 +4261,6 @@ append_special_execution_checkbox (FMPropertiesWindow *window,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
append_special_execution_flags (FMPropertiesWindow *window, GtkGrid *grid)
{
GtkWidget *title;
@@ -4965,24 +4272,6 @@ append_special_execution_flags (FMPropertiesWindow *window, GtkGrid *grid)
append_special_execution_checkbox (window, grid, NULL, _("Set gro_up ID"), UNIX_PERM_SGID);
append_special_execution_checkbox (window, grid, NULL, _("_Sticky"), UNIX_PERM_STICKY);
}
-#else
-append_special_execution_flags (FMPropertiesWindow *window, GtkTable *table)
-{
- gint nrows;
-
- append_special_execution_checkbox
- (window, table, _("Set _user ID"), UNIX_PERM_SUID);
-
- g_object_get (table, "n-rows", &nrows, NULL);
- attach_title_field (table, nrows - 1, _("Special flags:"));
-
- append_special_execution_checkbox (window, table, _("Set gro_up ID"), UNIX_PERM_SGID);
- append_special_execution_checkbox (window, table, _("_Sticky"), UNIX_PERM_STICKY);
-
- g_object_get (table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (table, nrows - 1, 18);
-}
-#endif
static gboolean
all_can_get_permissions (GList *file_list)
@@ -5042,7 +4331,6 @@ get_initial_permissions (GList *file_list)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
{
gboolean has_file, has_directory;
@@ -5141,121 +4429,9 @@ create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
UNIX_PERM_USER_EXEC|UNIX_PERM_GROUP_EXEC|UNIX_PERM_OTHER_EXEC,
execute_label, FALSE);
}
-#else
-create_simple_permissions (FMPropertiesWindow *window, GtkTable *page_table)
-{
- gboolean has_file, has_directory;
- GtkLabel *group_label;
- GtkLabel *owner_label;
- GtkLabel *execute_label;
- GtkWidget *value;
- GtkComboBox *group_combo_box;
- GtkComboBox *owner_combo_box;
- guint last_row;
- gint nrows;
-
- last_row = 0;
-
- has_file = files_has_file (window);
- has_directory = files_has_directory (window);
-
- if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) {
- owner_label = attach_title_field (page_table, last_row, _("_Owner:"));
- /* Combo box in this case. */
- owner_combo_box = attach_owner_combo_box (page_table, last_row, get_target_file (window));
- gtk_label_set_mnemonic_widget (owner_label,
- GTK_WIDGET (owner_combo_box));
- } else {
- owner_label = attach_title_field (page_table, last_row, _("Owner:"));
- /* Static text in this case. */
- value = attach_value_field (window,
- page_table, last_row, VALUE_COLUMN,
- "owner",
- INCONSISTENT_STATE_STRING,
- FALSE);
- gtk_label_set_mnemonic_widget (owner_label, value);
- }
-
- if (has_directory) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_USER, TRUE, FALSE);
- }
- if (has_file || window->details->has_recursive_apply) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_USER, FALSE, !has_directory);
- }
-
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
- if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) {
- last_row = append_title_field (page_table,
- _("_Group:"),
- &group_label);
- /* Combo box in this case. */
- group_combo_box = attach_group_combo_box (page_table, last_row,
- get_target_file (window));
- gtk_label_set_mnemonic_widget (group_label,
- GTK_WIDGET (group_combo_box));
- } else {
- last_row = append_title_field (page_table,
- _("Group:"),
- &group_label);
- /* Static text in this case. */
- value = attach_value_field (window, page_table, last_row,
- VALUE_COLUMN,
- "group",
- INCONSISTENT_STATE_STRING,
- FALSE);
- gtk_label_set_mnemonic_widget (group_label, value);
- }
-
- if (has_directory) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_GROUP, TRUE,
- FALSE);
- }
- if (has_file || window->details->has_recursive_apply) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_GROUP, FALSE,
- !has_directory);
- }
-
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
- append_title_field (page_table,
- _("Others"),
- &group_label);
-
- if (has_directory) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_OTHER, TRUE,
- FALSE);
- }
- if (has_file || window->details->has_recursive_apply) {
- add_permissions_combo_box (window, page_table,
- PERMISSION_OTHER, FALSE,
- !has_directory);
- }
-
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
- last_row = append_title_field (page_table,
- _("Execute:"),
- &execute_label);
- add_permissions_checkbox_with_label (window, page_table,
- last_row, 1,
- _("Allow _executing file as program"),
- UNIX_PERM_USER_EXEC|UNIX_PERM_GROUP_EXEC|UNIX_PERM_OTHER_EXEC,
- execute_label, FALSE);
-}
-#endif
static void
create_permission_checkboxes (FMPropertiesWindow *window,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *page_grid,
gboolean is_folder)
{
@@ -5348,108 +4524,8 @@ create_permission_checkboxes (FMPropertiesWindow *window,
other_perm_label,
is_folder);
}
-#else
- GtkTable *page_table,
- gboolean is_folder)
-{
- guint checkbox_titles_row;
- GtkLabel *owner_perm_label;
- GtkLabel *group_perm_label;
- GtkLabel *other_perm_label;
- GtkTable *check_button_table;
-
- checkbox_titles_row = append_title_field (page_table, _("Owner:"), &owner_perm_label);
- append_title_field (page_table, _("Group:"), &group_perm_label);
- append_title_field (page_table, _("Others:"), &other_perm_label);
-
- check_button_table = GTK_TABLE (gtk_table_new
- (PERMISSIONS_CHECKBOXES_ROW_COUNT,
- PERMISSIONS_CHECKBOXES_COLUMN_COUNT,
- FALSE));
- apply_standard_table_padding (check_button_table);
- gtk_widget_show (GTK_WIDGET (check_button_table));
- gtk_table_attach (page_table, GTK_WIDGET (check_button_table),
- VALUE_COLUMN, VALUE_COLUMN + 1,
- checkbox_titles_row, checkbox_titles_row + PERMISSIONS_CHECKBOXES_ROW_COUNT,
- 0, 0,
- 0, 0);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OWNER_ROW,
- PERMISSIONS_CHECKBOXES_READ_COLUMN,
- UNIX_PERM_USER_READ,
- owner_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OWNER_ROW,
- PERMISSIONS_CHECKBOXES_WRITE_COLUMN,
- UNIX_PERM_USER_WRITE,
- owner_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OWNER_ROW,
- PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
- UNIX_PERM_USER_EXEC,
- owner_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_GROUP_ROW,
- PERMISSIONS_CHECKBOXES_READ_COLUMN,
- UNIX_PERM_GROUP_READ,
- group_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_GROUP_ROW,
- PERMISSIONS_CHECKBOXES_WRITE_COLUMN,
- UNIX_PERM_GROUP_WRITE,
- group_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_GROUP_ROW,
- PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
- UNIX_PERM_GROUP_EXEC,
- group_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OTHERS_ROW,
- PERMISSIONS_CHECKBOXES_READ_COLUMN,
- UNIX_PERM_OTHER_READ,
- other_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OTHERS_ROW,
- PERMISSIONS_CHECKBOXES_WRITE_COLUMN,
- UNIX_PERM_OTHER_WRITE,
- other_perm_label,
- is_folder);
-
- add_permissions_checkbox (window,
- check_button_table,
- PERMISSIONS_CHECKBOXES_OTHERS_ROW,
- PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
- UNIX_PERM_OTHER_EXEC,
- other_perm_label,
- is_folder);
-}
-#endif
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
{
GtkLabel *group_label;
@@ -5526,98 +4602,6 @@ create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
"permissions", INCONSISTENT_STATE_STRING,
FALSE);
}
-#else
-create_advanced_permissions (FMPropertiesWindow *window, GtkTable *page_table)
-{
- guint last_row;
- GtkLabel *group_label;
- GtkLabel *owner_label;
- GtkComboBox *group_combo_box;
- GtkComboBox *owner_combo_box;
- gboolean has_directory, has_file;
- gint nrows;
-
- last_row = 0;
-
- if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) {
-
- owner_label = attach_title_field (page_table, last_row, _("_Owner:"));
- /* Combo box in this case. */
- owner_combo_box = attach_owner_combo_box (page_table, last_row, get_target_file (window));
- gtk_label_set_mnemonic_widget (owner_label,
- GTK_WIDGET (owner_combo_box));
- } else {
- GtkWidget *value;
-
- owner_label = attach_title_field (page_table, last_row, _("Owner:"));
- /* Static text in this case. */
- value = attach_value_field (window,
- page_table, last_row, VALUE_COLUMN,
- "owner",
- INCONSISTENT_STATE_STRING,
- FALSE);
- gtk_label_set_mnemonic_widget (owner_label, value);
- }
-
- if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) {
- last_row = append_title_field (page_table,
- _("_Group:"),
- &group_label);
- /* Combo box in this case. */
- group_combo_box = attach_group_combo_box (page_table, last_row,
- get_target_file (window));
- gtk_label_set_mnemonic_widget (group_label,
- GTK_WIDGET (group_combo_box));
- } else {
- last_row = append_title_field (page_table,
- _("Group:"),
- NULL);
- /* Static text in this case. */
- attach_value_field (window, page_table, last_row,
- VALUE_COLUMN,
- "group",
- INCONSISTENT_STATE_STRING,
- FALSE);
- }
-
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
- has_directory = files_has_directory (window);
- has_file = files_has_file (window);
-
- if (has_directory) {
- if (has_file || window->details->has_recursive_apply) {
- append_title_field (page_table,
- _("Folder Permissions:"),
- NULL);
- }
- create_permission_checkboxes (window, page_table, TRUE);
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
- }
-
-
- if (has_file || window->details->has_recursive_apply) {
- if (has_directory) {
- append_title_field (page_table,
- _("File Permissions:"),
- NULL);
- }
- create_permission_checkboxes (window, page_table, FALSE);
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
- }
-
- append_special_execution_flags (window, page_table);
-
- append_title_value_pair
- (window, page_table, _("Text view:"),
- "permissions", INCONSISTENT_STATE_STRING,
- FALSE);
-}
-#endif
static void
set_recursive_permissions_done (gpointer callback_data)
@@ -5742,7 +4726,6 @@ static void
create_permissions_page (FMPropertiesWindow *window)
{
GtkWidget *vbox, *button, *hbox;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *page_grid;
char *file_name, *prompt_text;
GList *file_list;
@@ -5791,84 +4774,11 @@ create_permissions_page (FMPropertiesWindow *window)
FALSE);
if (window->details->has_recursive_apply) {
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (hbox);
gtk_container_add_with_properties (GTK_CONTAINER (page_grid), hbox,
"width", 2,
NULL);
-#else
- GtkTable *page_table;
- char *file_name, *prompt_text;
- GList *file_list;
- guint last_row;
- gint nrows;
-
- vbox = create_page_with_vbox (window->details->notebook,
- _("Permissions"));
-
- file_list = window->details->original_files;
-
- window->details->initial_permissions = NULL;
-
- if (all_can_get_permissions (file_list) && all_can_get_permissions (window->details->target_files)) {
- window->details->initial_permissions = get_initial_permissions (window->details->target_files);
- window->details->has_recursive_apply = files_has_changable_permissions_directory (window);
-
- if (!all_can_set_permissions (file_list)) {
- add_prompt_and_separator (
- vbox,
- _("You are not the owner, so you cannot change these permissions."));
- }
-
- page_table = GTK_TABLE (gtk_table_new (1, COLUMN_COUNT, FALSE));
- window->details->permissions_table = page_table;
-
- apply_standard_table_padding (page_table);
- gtk_widget_show (GTK_WIDGET (page_table));
- gtk_box_pack_start (GTK_BOX (vbox),
- GTK_WIDGET (page_table),
- TRUE, TRUE, 0);
-
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_ADVANCED_PERMISSIONS)) {
- window->details->advanced_permissions = TRUE;
- create_advanced_permissions (window, page_table);
- } else {
- window->details->advanced_permissions = FALSE;
- create_simple_permissions (window, page_table);
- }
-
- g_object_get (page_table, "n-rows", &nrows, NULL);
- gtk_table_set_row_spacing (page_table, nrows - 1, 18);
-
-#ifdef HAVE_SELINUX
- append_title_value_pair
- (window, page_table, _("SELinux context:"),
- "selinux_context", INCONSISTENT_STATE_STRING,
- FALSE);
-#endif
- append_title_value_pair
- (window, page_table, _("Last changed:"),
- "date_permissions", INCONSISTENT_STATE_STRING,
- FALSE);
-
- if (window->details->has_recursive_apply) {
- last_row = append_row (page_table);
-#if GTK_CHECK_VERSION (3, 0, 0)
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hbox);
- gtk_table_attach (page_table, hbox,
- 0, 2,
- last_row, last_row+1,
- GTK_FILL, 0,
- 0, 0);
-#endif
button = gtk_button_new_with_mnemonic (_("Apply Permissions to Enclosed Files"));
gtk_widget_show (button);
@@ -6253,9 +5163,6 @@ create_properties_window (StartupData *startup_data)
NULL);
/* FIXME - HIGificiation, should be done inside GTK+ */
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_ensure_style (GTK_WIDGET (window));
-#endif
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12);
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (window))), 0);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12);
@@ -6507,11 +5414,7 @@ real_response (GtkDialog *dialog,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
real_destroy (GtkWidget *object)
-#else
-real_destroy (GtkObject *object)
-#endif
{
FMPropertiesWindow *window;
GList *l;
@@ -6569,11 +5472,7 @@ real_destroy (GtkObject *object)
window->details->update_files_timeout_id = 0;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (fm_properties_window_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-#endif
}
static void
@@ -6586,13 +5485,8 @@ real_finalize (GObject *object)
g_list_free_full (window->details->mime_list, g_free);
g_free (window->details->pending_name);
-#if GTK_CHECK_VERSION (3, 0, 0)
- G_OBJECT_CLASS (fm_properties_window_parent_class)->finalize (object);
-#else
- g_free (window->details);
- G_OBJECT_CLASS (parent_class)->finalize (object);
-#endif
+ G_OBJECT_CLASS (fm_properties_window_parent_class)->finalize (object);
}
/* converts
@@ -6833,29 +5727,22 @@ fm_properties_window_class_init (FMPropertiesWindowClass *class)
GtkBindingSet *binding_set;
G_OBJECT_CLASS (class)->finalize = real_finalize;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_OBJECT_CLASS (class)->destroy = real_destroy;
-#else
+
GTK_WIDGET_CLASS (class)->destroy = real_destroy;
-#endif
+
GTK_DIALOG_CLASS (class)->response = real_response;
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
"close", 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_type_class_add_private (class, sizeof (FMPropertiesWindowDetails));
-#endif
}
static void
fm_properties_window_init (FMPropertiesWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, FM_TYPE_PROPERTIES_WINDOW,
FMPropertiesWindowDetails);
-#else
- window->details = g_new0 (FMPropertiesWindowDetails, 1);
-#endif
+
}
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 039a1ef8..cf400375 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -29,11 +29,7 @@
#include <config.h>
#include "fm-tree-model.h"
-#if GTK_CHECK_VERSION(3,0,0)
#include <eel/eel-graphic-effects.h>
-#else
-#include <eel/eel-gdk-pixbuf-extensions.h>
-#endif
#include <glib/gi18n.h>
#include <libcaja-private/caja-directory.h>
#include <libcaja-private/caja-file-attributes.h>
@@ -336,11 +332,7 @@ get_menu_icon_for_file (TreeNode *node,
if (highlight)
{
-#if GTK_CHECK_VERSION(3,0,0)
pixbuf = eel_create_spotlight_pixbuf (retval);
-#else
- pixbuf = eel_gdk_pixbuf_render (retval, 1, 255, 255, 0, 0);
-#endif
if (pixbuf != NULL)
{
diff --git a/test/test-caja-wrap-table.c b/test/test-caja-wrap-table.c
index 463870a6..184e7475 100644
--- a/test/test-caja-wrap-table.c
+++ b/test/test-caja-wrap-table.c
@@ -34,13 +34,8 @@ main (int argc, char* argv[])
GTK_POLICY_AUTOMATIC);
/* Viewport */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_add (GTK_CONTAINER (scroller),
emblems_table);
-#else
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller),
- emblems_table);
-#endif
gtk_container_add (GTK_CONTAINER (window), scroller);
diff --git a/test/test-eel-editable-label.c b/test/test-eel-editable-label.c
index f98a81ca..3120a4a9 100644
--- a/test/test-eel-editable-label.c
+++ b/test/test-eel-editable-label.c
@@ -6,11 +6,6 @@
#include <eel/eel-editable-label.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
-
static void
quit (GtkWidget *widget, gpointer data)
{
@@ -29,7 +24,7 @@ main (int argc, char* argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quit), NULL);
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -42,8 +37,8 @@ main (int argc, char* argv[])
label = eel_editable_label_new ("Left aligned label");
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
@@ -52,9 +47,8 @@ main (int argc, char* argv[])
label = eel_editable_label_new ("Right aligned label");
-#if GTK_CHECK_VERSION (3, 14, 0)
- gtk_widget_set_halign (label, GTK_ALIGN_END);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 1.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
#endif
diff --git a/test/test-eel-labeled-image.c b/test/test-eel-labeled-image.c
index d59d8def..a7e51640 100644
--- a/test/test-eel-labeled-image.c
+++ b/test/test-eel-labeled-image.c
@@ -2,10 +2,6 @@
#include <eel/eel-labeled-image.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static const char pixbuf_name[] = "/usr/share/pixmaps/mate-globe.png";
static void
@@ -30,7 +26,7 @@ labeled_image_button_window_new (const char *title,
GtkWidget *plain;
window = test_window_new (title, 20);
- vbox = gtk_vbox_new (FALSE, 10);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_add (GTK_CONTAINER (window), vbox);
if (1) button = eel_labeled_image_button_new ("GtkButton with LabeledImage", pixbuf);