summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-11-22 15:02:51 -0500
committerlukefromdc <[email protected]>2016-11-22 15:02:51 -0500
commit276eb145ce96d5f75f8d3901daf6310f60ddbb81 (patch)
tree544f41e76c9a91973867065696fc2e414ca60170 /libcaja-private
parent969e4d021fe49654fe6e5ee7e88c920fec126505 (diff)
downloadcaja-276eb145ce96d5f75f8d3901daf6310f60ddbb81.tar.bz2
caja-276eb145ce96d5f75f8d3901daf6310f60ddbb81.tar.xz
move to GTK+3 (>= 3.14), drop libunique, GTK+2 code, and --with-gtk build option
*Remove GTK_VERSION_CHECK (3, 0, 0) and libunique selectors *Remove GTK2 and libunique specific code. *Leaves selector for specific GTK3 versions. *Remove #DEFINES for vbox/hbox previously required for GTK2 compatability *Keep vbox in caja-spatial-window.c, it is necessary for the desktop to work *spatial-window vbox issue at https://github.com/mate-desktop/caja/issues/591
Diffstat (limited to 'libcaja-private')
-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
21 files changed, 47 insertions, 1794 deletions
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,