diff options
Diffstat (limited to 'libcaja-private')
53 files changed, 989 insertions, 1834 deletions
diff --git a/libcaja-private/Makefile.am b/libcaja-private/Makefile.am index 6d1c343d..55cadeee 100644 --- a/libcaja-private/Makefile.am +++ b/libcaja-private/Makefile.am @@ -18,6 +18,11 @@ INCLUDES = \ $(UNIQUE_CFLAGS) \ $(NULL) +BUILT_SOURCES = \ + caja-marshal.c \ + caja-marshal.h \ + $(NULL) + dependency_static_libs = \ $(top_builddir)/cut-n-paste-code/libegg/libegg.la \ $(NULL) @@ -36,18 +41,11 @@ libcaja_private_la_LIBADD = \ $(CORE_LIBS) \ $(NULL) -marshal_sources = \ - caja-marshal.h \ - caja-marshal-guts.c \ - $(NULL) - libcaja_private_la_SOURCES = \ caja-autorun.c \ caja-autorun.h \ caja-bookmark.c \ caja-bookmark.h \ - caja-cell-renderer-pixbuf-emblem.c \ - caja-cell-renderer-pixbuf-emblem.h \ caja-cell-renderer-text-ellipsized.c \ caja-cell-renderer-text-ellipsized.h \ caja-clipboard-monitor.c \ @@ -107,8 +105,6 @@ libcaja_private_la_SOURCES = \ caja-file.h \ caja-global-preferences.c \ caja-global-preferences.h \ - caja-horizontal-splitter.c \ - caja-horizontal-splitter.h \ caja-icon-canvas-item.c \ caja-icon-canvas-item.h \ caja-icon-container.c \ @@ -121,15 +117,12 @@ libcaja_private_la_SOURCES = \ caja-icon-names.h \ caja-idle-queue.c \ caja-idle-queue.h \ - caja-iso9660.h \ caja-keep-last-vertical-box.c \ caja-keep-last-vertical-box.h \ caja-lib-self-check-functions.c \ caja-lib-self-check-functions.h \ caja-link.c \ caja-link.h \ - caja-marshal.c \ - caja-marshal.h \ caja-merged-directory.c \ caja-merged-directory.h \ caja-metadata.h \ @@ -198,14 +191,29 @@ libcaja_private_la_SOURCES = \ caja-undostack-manager.h \ $(NULL) +nodist_libcaja_private_la_SOURCES =\ + $(BUILT_SOURCES) \ + $(NULL) + $(lib_LTLIBRARIES): $(dependency_static_libs) -caja-marshal.h: caja-marshal.list $(GLIB_GENMARSHAL) - $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=caja_marshal > $@ -caja-marshal-guts.c: caja-marshal.list $(GLIB_GENMARSHAL) - $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --body --prefix=caja_marshal > $@ +caja-marshal.list: $(libcaja_private_la_SOURCES) Makefile.am + $(AM_V_GEN)( cd $(srcdir) && \ + sed -n -e 's/.*caja_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \ + $(libcaja_private_la_SOURCES) ) \ + | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > [email protected] + @if cmp -s [email protected] $@; then \ + rm [email protected]; \ + else \ + mv [email protected] $@; \ + fi + +%-marshal.h: %-marshal.list Makefile + $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h -$(libcaja_private_la_OBJECTS): $(marshal_sources) +%-marshal.c: %-marshal.list Makefile + $(AM_V_GEN)echo "#include \"caja-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c gsettingsschema_in_files = org.mate.caja.gschema.xml.in org.mate.media-handling.gschema.xml.in gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) @@ -223,9 +231,10 @@ EXTRA_DIST = \ $(NULL) CLEANFILES = \ - $(marshal_sources) \ + $(BUILT_SOURCES) \ $(schema_DATA) \ $(gsettings_SCHEMAS) \ + caja-marshal.list \ $(NULL) dist-hook: diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c index cf801b08..66534642 100644 --- a/libcaja-private/caja-autorun.c +++ b/libcaja-private/caja-autorun.c @@ -33,7 +33,6 @@ #include <gdk/gdkkeysyms.h> #include <eel/eel-glib-extensions.h> -#include <eel/eel-stock-dialogs.h> #include "caja-icon-info.h" #include "caja-global-preferences.h" @@ -274,7 +273,7 @@ dialog_response_cb (GtkDialog *dialog, } static void -dialog_destroy_cb (GtkObject *object, +dialog_destroy_cb (GtkWidget *object, CajaAutorunComboBoxData *data) { handle_dialog_closure (data); @@ -652,7 +651,8 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box, { g_object_unref (default_app_info); } - eel_g_object_list_free (app_info_list); + g_list_foreach (app_info_list, (GFunc) g_object_unref, NULL); + g_list_free(app_info_list); gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store)); g_object_unref (G_OBJECT (list_store)); @@ -747,8 +747,13 @@ is_shift_pressed (void) ret = FALSE; gdk_error_trap_push (); - status = XkbGetState (GDK_DISPLAY (), XkbUseCoreKbd, &state); + 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) { @@ -907,7 +912,7 @@ autorun_always_toggled (GtkToggleButton *togglebutton, AutorunDialogData *data) static gboolean combo_box_enter_ok (GtkWidget *togglebutton, GdkEventKey *event, GtkDialog *dialog) { - if (event->keyval == GDK_KP_Enter || event->keyval == GDK_Return) + if (event->keyval == GDK_KEY_KP_Enter || event->keyval == GDK_KEY_Return) { gtk_dialog_response (dialog, GTK_RESPONSE_OK); return TRUE; @@ -992,7 +997,6 @@ show_dialog: dialog = gtk_dialog_new (); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); hbox = gtk_hbox_new (FALSE, 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); diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c index e20efd96..48952fbb 100644 --- a/libcaja-private/caja-bookmark.c +++ b/libcaja-private/caja-bookmark.c @@ -29,10 +29,10 @@ #include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-gtk-extensions.h> #include <eel/eel-gtk-macros.h> -#include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> #include <gtk/gtk.h> #include <gio/gio.h> +#include <string.h> #include <libcaja-private/caja-file.h> #include <libcaja-private/caja-icon-names.h> @@ -143,7 +143,7 @@ caja_bookmark_compare_with (gconstpointer a, gconstpointer b) bookmark_a = CAJA_BOOKMARK (a); bookmark_b = CAJA_BOOKMARK (b); - if (eel_strcmp (bookmark_a->details->name, + if (g_strcmp0 (bookmark_a->details->name, bookmark_b->details->name) != 0) { return 1; diff --git a/libcaja-private/caja-cell-renderer-pixbuf-emblem.c b/libcaja-private/caja-cell-renderer-pixbuf-emblem.c deleted file mode 100644 index 4fec3a4a..00000000 --- a/libcaja-private/caja-cell-renderer-pixbuf-emblem.c +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- - - caja-cell-renderer-pixbuf-emblem.c: cell renderer which can render - an emblem on top of a pixbuf (for use in FMListView and FMTreeView) - - Copyright (C) 2003 Juerg Billeter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - This is based on GtkCellRendererPixbuf written by - Jonathan Blandford <[email protected]> - - Author: Juerg Billeter <[email protected]> -*/ - -#include "caja-cell-renderer-pixbuf-emblem.h" - -static void caja_cell_renderer_pixbuf_emblem_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); -static void caja_cell_renderer_pixbuf_emblem_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec); -static void caja_cell_renderer_pixbuf_emblem_init (CajaCellRendererPixbufEmblem *cellpixbuf); -static void caja_cell_renderer_pixbuf_emblem_class_init (CajaCellRendererPixbufEmblemClass *klass); -static void caja_cell_renderer_pixbuf_emblem_finalize (GObject *object); -static void caja_cell_renderer_pixbuf_emblem_create_stock_pixbuf (CajaCellRendererPixbufEmblem *cellpixbuf, - GtkWidget *widget); -static void caja_cell_renderer_pixbuf_emblem_get_size (GtkCellRenderer *cell, - GtkWidget *widget, - GdkRectangle *rectangle, - gint *x_offset, - gint *y_offset, - gint *width, - gint *height); -static void caja_cell_renderer_pixbuf_emblem_render (GtkCellRenderer *cell, - GdkWindow *window, - GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, - GtkCellRendererState flags); - -enum -{ - PROP_ZERO, - PROP_PIXBUF, - PROP_PIXBUF_EXPANDER_OPEN, - PROP_PIXBUF_EXPANDER_CLOSED, - PROP_STOCK_ID, - PROP_STOCK_SIZE, - PROP_STOCK_DETAIL, - PROP_PIXBUF_EMBLEM -}; - -#define CELLINFO_KEY "caja-cell-renderer-pixbuf-emblem-info" - -typedef struct _CajaCellRendererPixbufEmblemInfo CajaCellRendererPixbufEmblemInfo; -struct _CajaCellRendererPixbufEmblemInfo -{ - gchar *stock_id; - GtkIconSize stock_size; - gchar *stock_detail; -}; - -G_DEFINE_TYPE (CajaCellRendererPixbufEmblem, caja_cell_renderer_pixbuf_emblem, GTK_TYPE_CELL_RENDERER); - -static void -caja_cell_renderer_pixbuf_emblem_init (CajaCellRendererPixbufEmblem *cellpixbuf) -{ - CajaCellRendererPixbufEmblemInfo *cellinfo; - - cellinfo = g_new0 (CajaCellRendererPixbufEmblemInfo, 1); - cellinfo->stock_size = GTK_ICON_SIZE_MENU; - g_object_set_data (G_OBJECT (cellpixbuf), CELLINFO_KEY, cellinfo); -} - -static void -caja_cell_renderer_pixbuf_emblem_class_init (CajaCellRendererPixbufEmblemClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - - object_class->finalize = caja_cell_renderer_pixbuf_emblem_finalize; - - object_class->get_property = caja_cell_renderer_pixbuf_emblem_get_property; - object_class->set_property = caja_cell_renderer_pixbuf_emblem_set_property; - - cell_class->get_size = caja_cell_renderer_pixbuf_emblem_get_size; - cell_class->render = caja_cell_renderer_pixbuf_emblem_render; - - g_object_class_install_property (object_class, - PROP_PIXBUF, - g_param_spec_object ("pixbuf", - "Pixbuf Object", - "The pixbuf to render", - GDK_TYPE_PIXBUF, - G_PARAM_READABLE | - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, - PROP_PIXBUF_EXPANDER_OPEN, - g_param_spec_object ("pixbuf_expander_open", - "Pixbuf Expander Open", - "Pixbuf for open expander", - GDK_TYPE_PIXBUF, - G_PARAM_READABLE | - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, - PROP_PIXBUF_EXPANDER_CLOSED, - g_param_spec_object ("pixbuf_expander_closed", - "Pixbuf Expander Closed", - "Pixbuf for closed expander", - GDK_TYPE_PIXBUF, - G_PARAM_READABLE | - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, - PROP_STOCK_ID, - g_param_spec_string ("stock_id", - "Stock ID", - "The stock ID of the stock icon to render", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_STOCK_SIZE, - g_param_spec_enum ("stock_size", - "Size", - "The size of the rendered icon", - GTK_TYPE_ICON_SIZE, - GTK_ICON_SIZE_MENU, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_STOCK_DETAIL, - g_param_spec_string ("stock_detail", - "Detail", - "Render detail to pass to the theme engine", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_PIXBUF_EMBLEM, - g_param_spec_object ("pixbuf_emblem", - "Pixbuf Emblem Object", - "The emblem to overlay", - GDK_TYPE_PIXBUF, - G_PARAM_READABLE | - G_PARAM_WRITABLE)); -} - -static void -caja_cell_renderer_pixbuf_emblem_finalize (GObject *object) -{ - CajaCellRendererPixbufEmblem *cellpixbuf = CAJA_CELL_RENDERER_PIXBUF_EMBLEM (object); - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY); - - if (cellpixbuf->pixbuf && cellinfo->stock_id) - { - g_object_unref (cellpixbuf->pixbuf); - } - - if (cellinfo->stock_id) - { - g_free (cellinfo->stock_id); - } - - if (cellinfo->stock_detail) - { - g_free (cellinfo->stock_detail); - } - - g_free (cellinfo); - g_object_set_data (object, CELLINFO_KEY, NULL); - - (* G_OBJECT_CLASS (caja_cell_renderer_pixbuf_emblem_parent_class)->finalize) (object); -} - -static void -caja_cell_renderer_pixbuf_emblem_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) -{ - CajaCellRendererPixbufEmblem *cellpixbuf = CAJA_CELL_RENDERER_PIXBUF_EMBLEM (object); - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY); - - switch (param_id) - { - case PROP_PIXBUF: - g_value_set_object (value, - cellpixbuf->pixbuf ? G_OBJECT (cellpixbuf->pixbuf) : NULL); - break; - case PROP_PIXBUF_EXPANDER_OPEN: - g_value_set_object (value, - cellpixbuf->pixbuf_expander_open ? G_OBJECT (cellpixbuf->pixbuf_expander_open) : NULL); - break; - case PROP_PIXBUF_EXPANDER_CLOSED: - g_value_set_object (value, - cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL); - break; - case PROP_STOCK_ID: - g_value_set_string (value, cellinfo->stock_id); - break; - case PROP_STOCK_SIZE: - g_value_set_enum (value, cellinfo->stock_size); - break; - case PROP_STOCK_DETAIL: - g_value_set_string (value, cellinfo->stock_detail); - break; - case PROP_PIXBUF_EMBLEM: - g_value_set_object (value, - cellpixbuf->pixbuf_emblem ? G_OBJECT (cellpixbuf->pixbuf_emblem) : NULL); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -static void -caja_cell_renderer_pixbuf_emblem_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) -{ - GdkPixbuf *pixbuf; - CajaCellRendererPixbufEmblem *cellpixbuf = CAJA_CELL_RENDERER_PIXBUF_EMBLEM (object); - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY); - - switch (param_id) - { - case PROP_PIXBUF: - pixbuf = (GdkPixbuf*) g_value_get_object (value); - if (pixbuf) - { - g_object_ref (pixbuf); - } - if (cellpixbuf->pixbuf) - { - g_object_unref (cellpixbuf->pixbuf); - } - cellpixbuf->pixbuf = pixbuf; - break; - case PROP_PIXBUF_EXPANDER_OPEN: - pixbuf = (GdkPixbuf*) g_value_get_object (value); - if (pixbuf) - { - g_object_ref (pixbuf); - } - if (cellpixbuf->pixbuf_expander_open) - { - g_object_unref (cellpixbuf->pixbuf_expander_open); - } - cellpixbuf->pixbuf_expander_open = pixbuf; - break; - case PROP_PIXBUF_EXPANDER_CLOSED: - pixbuf = (GdkPixbuf*) g_value_get_object (value); - if (pixbuf) - { - g_object_ref (pixbuf); - } - if (cellpixbuf->pixbuf_expander_closed) - { - g_object_unref (cellpixbuf->pixbuf_expander_closed); - } - cellpixbuf->pixbuf_expander_closed = pixbuf; - break; - case PROP_STOCK_ID: - if (cellinfo->stock_id) - { - g_free (cellinfo->stock_id); - } - cellinfo->stock_id = g_strdup (g_value_get_string (value)); - break; - case PROP_STOCK_SIZE: - cellinfo->stock_size = g_value_get_enum (value); - break; - case PROP_STOCK_DETAIL: - if (cellinfo->stock_detail) - { - g_free (cellinfo->stock_detail); - } - cellinfo->stock_detail = g_strdup (g_value_get_string (value)); - break; - case PROP_PIXBUF_EMBLEM: - pixbuf = (GdkPixbuf *) g_value_get_object (value); - if (pixbuf) - { - g_object_ref (pixbuf); - } - if (cellpixbuf->pixbuf_emblem) - { - g_object_unref (cellpixbuf->pixbuf_emblem); - } - cellpixbuf->pixbuf_emblem = pixbuf; - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -GtkCellRenderer * -caja_cell_renderer_pixbuf_emblem_new (void) -{ - return g_object_new (CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, NULL); -} - -static void -caja_cell_renderer_pixbuf_emblem_create_stock_pixbuf (CajaCellRendererPixbufEmblem *cellpixbuf, - GtkWidget *widget) -{ - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (G_OBJECT (cellpixbuf), CELLINFO_KEY); - - if (cellpixbuf->pixbuf) - { - g_object_unref (cellpixbuf->pixbuf); - } - - cellpixbuf->pixbuf = gtk_widget_render_icon (widget, - cellinfo->stock_id, - cellinfo->stock_size, - cellinfo->stock_detail); -} - -static void -caja_cell_renderer_pixbuf_emblem_get_size (GtkCellRenderer *cell, - GtkWidget *widget, - GdkRectangle *cell_area, - gint *x_offset, - gint *y_offset, - gint *width, - gint *height) -{ - CajaCellRendererPixbufEmblem *cellpixbuf = (CajaCellRendererPixbufEmblem *) cell; - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY); - gint pixbuf_width = 0; - gint pixbuf_height = 0; - gint calc_width; - gint calc_height; - gint xpad, ypad; - - if (!cellpixbuf->pixbuf && cellinfo->stock_id) - caja_cell_renderer_pixbuf_emblem_create_stock_pixbuf (cellpixbuf, widget); - - if (cellpixbuf->pixbuf) - { - pixbuf_width = gdk_pixbuf_get_width (cellpixbuf->pixbuf); - pixbuf_height = gdk_pixbuf_get_height (cellpixbuf->pixbuf); - } - if (cellpixbuf->pixbuf_expander_open) - { - pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_open)); - pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_open)); - } - if (cellpixbuf->pixbuf_expander_closed) - { - pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_closed)); - pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_closed)); - } - - gtk_cell_renderer_get_padding (cell, &xpad, &ypad); - calc_width = xpad * 2 + pixbuf_width; - calc_height = ypad * 2 + pixbuf_height; - - if (x_offset) *x_offset = 0; - if (y_offset) *y_offset = 0; - - if (cell_area && pixbuf_width > 0 && pixbuf_height > 0) - { - gfloat xalign, yalign; - - gtk_cell_renderer_get_alignment (cell, &xalign, &yalign); - if (x_offset) - { - *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? - 1.0 - xalign : xalign) * - (cell_area->width - calc_width - 2 * xpad)); - *x_offset = MAX (*x_offset, 0) + xpad; - } - if (y_offset) - { - *y_offset = (yalign * - (cell_area->height - calc_height - 2 * ypad)); - *y_offset = MAX (*y_offset, 0) + ypad; - } - } - - if (width) - *width = calc_width; - - if (height) - *height = calc_height; -} - -static void -caja_cell_renderer_pixbuf_emblem_render (GtkCellRenderer *cell, - GdkWindow *window, - GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, - GtkCellRendererState flags) - -{ - CajaCellRendererPixbufEmblem *cellpixbuf = (CajaCellRendererPixbufEmblem *) cell; - CajaCellRendererPixbufEmblemInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY); - GdkPixbuf *pixbuf; - GdkRectangle pix_rect; - GdkRectangle pix_emblem_rect; - GdkRectangle draw_rect; - gboolean stock_pixbuf = FALSE; - gint xpad, ypad; - gboolean is_expander, is_expanded; - - pixbuf = cellpixbuf->pixbuf; - g_object_get (cell, - "is-expander", &is_expander, - "is-expanded", &is_expanded, - NULL); - if (is_expander) - { - if (is_expanded && - cellpixbuf->pixbuf_expander_open != NULL) - { - pixbuf = cellpixbuf->pixbuf_expander_open; - } - else if (!is_expanded && - cellpixbuf->pixbuf_expander_closed != NULL) - { - pixbuf = cellpixbuf->pixbuf_expander_closed; - } - } - - if (!pixbuf && !cellinfo->stock_id) - { - return; - } - else if (!pixbuf && cellinfo->stock_id) - { - stock_pixbuf = TRUE; - } - - caja_cell_renderer_pixbuf_emblem_get_size (cell, widget, cell_area, - &pix_rect.x, - &pix_rect.y, - &pix_rect.width, - &pix_rect.height); - - if (stock_pixbuf) - pixbuf = cellpixbuf->pixbuf; - - gtk_cell_renderer_get_padding (cell, &xpad, &ypad); - pix_rect.x += cell_area->x; - pix_rect.y += cell_area->y; - pix_rect.width -= xpad * 2; - pix_rect.height -= ypad * 2; - - if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) && - gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect)) - { - gdk_draw_pixbuf (window, - gtk_widget_get_style (widget)->black_gc, - pixbuf, - /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */ - draw_rect.x - pix_rect.x, - draw_rect.y - pix_rect.y, - draw_rect.x, - draw_rect.y, - draw_rect.width, - draw_rect.height, - GDK_RGB_DITHER_NORMAL, - 0, 0); - } - - if (cellpixbuf->pixbuf_emblem) - { - pix_emblem_rect.width = gdk_pixbuf_get_width (cellpixbuf->pixbuf_emblem); - pix_emblem_rect.height = gdk_pixbuf_get_height (cellpixbuf->pixbuf_emblem); - pix_emblem_rect.x = pix_rect.x; - pix_emblem_rect.y = pix_rect.y + pix_rect.height - pix_emblem_rect.height; - if (gdk_rectangle_intersect (cell_area, &pix_emblem_rect, &draw_rect) && - gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect)) - { - gdk_draw_pixbuf (window, - gtk_widget_get_style (widget)->black_gc, - cellpixbuf->pixbuf_emblem, - /* pixbuf 0, 0 is at pix_emblem_rect.x, pix_emblem_rect.y */ - draw_rect.x - pix_emblem_rect.x, - draw_rect.y - pix_emblem_rect.y, - draw_rect.x, - draw_rect.y, - draw_rect.width, - draw_rect.height, - GDK_RGB_DITHER_NORMAL, - 0, 0); - } - } -} diff --git a/libcaja-private/caja-cell-renderer-pixbuf-emblem.h b/libcaja-private/caja-cell-renderer-pixbuf-emblem.h deleted file mode 100644 index cfdf93d4..00000000 --- a/libcaja-private/caja-cell-renderer-pixbuf-emblem.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- - - caja-cell-renderer-pixbuf-emblem.h: cell renderer which can render - an emblem on top of a pixbuf (for use in FMListView and FMTreeView) - - Copyright (C) 2003 Juerg Billeter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - This is based on GtkCellRendererPixbuf written by - Jonathan Blandford <[email protected]> - - Author: Juerg Billeter <[email protected]> -*/ - -#ifndef CAJA_CELL_RENDERER_PIXBUF_EMBLEM_H -#define CAJA_CELL_RENDERER_PIXBUF_EMBLEM_H - -#include <gtk/gtk.h> - -#define CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM caja_cell_renderer_pixbuf_emblem_get_type() -#define CAJA_CELL_RENDERER_PIXBUF_EMBLEM(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, CajaCellRendererPixbufEmblem)) -#define CAJA_CELL_RENDERER_PIXBUF_EMBLEM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, CajaCellRendererPixbufEmblemClass)) -#define CAJA_IS_CELL_RENDERER_PIXBUF_EMBLEM(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) -#define CAJA_IS_CELL_RENDERER_PIXBUF_EMBLEM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) -#define CAJA_CELL_RENDERER_PIXBUF_EMBLEM_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, CajaCellRendererPixbufEmblemClass)) - -typedef struct _CajaCellRendererPixbufEmblem CajaCellRendererPixbufEmblem; -typedef struct _CajaCellRendererPixbufEmblemClass CajaCellRendererPixbufEmblemClass; - -struct _CajaCellRendererPixbufEmblem -{ - GtkCellRenderer parent; - - /*< private >*/ - GdkPixbuf *pixbuf; - GdkPixbuf *pixbuf_expander_open; - GdkPixbuf *pixbuf_expander_closed; - GdkPixbuf *pixbuf_emblem; -}; - -struct _CajaCellRendererPixbufEmblemClass -{ - GtkCellRendererClass parent_class; -}; - -GType caja_cell_renderer_pixbuf_emblem_get_type (void); -GtkCellRenderer *caja_cell_renderer_pixbuf_emblem_new (void); - -#endif /* CAJA_CELL_RENDERER_PIXBUF_EMBLEM_H */ diff --git a/libcaja-private/caja-cell-renderer-text-ellipsized.c b/libcaja-private/caja-cell-renderer-text-ellipsized.c index 4c3cd443..ad535a5d 100644 --- a/libcaja-private/caja-cell-renderer-text-ellipsized.c +++ b/libcaja-private/caja-cell-renderer-text-ellipsized.c @@ -26,55 +26,81 @@ #include "caja-cell-renderer-text-ellipsized.h" -#define ELLIPSIZE_PROP "ellipsize" - -static void caja_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell, - GtkWidget *widget, - GdkRectangle *rectangle, - gint *x_offset, - gint *y_offset, - gint *width, - gint *height); - 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) { - g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_END, NULL); + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_END, + "ellipsize-set", TRUE, + NULL); } static void -caja_cell_renderer_text_ellipsized_class_init (CajaCellRendererTextEllipsizedClass *klass) +nautilus_cell_renderer_text_ellipsized_get_preferred_width (GtkCellRenderer *cell, + GtkWidget *widget, + gint *minimum_size, + gint *natural_size) { - GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - - cell_class->get_size = caja_cell_renderer_text_ellipsized_get_size; + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_NONE, + "ellipsize-set", FALSE, + NULL); + + GTK_CELL_RENDERER_CLASS + (nautilus_cell_renderer_text_ellipsized_parent_class)->get_preferred_width (cell, widget, + minimum_size, natural_size); + + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_END, + "ellipsize-set", TRUE, + NULL); } - -GtkCellRenderer * -caja_cell_renderer_text_ellipsized_new (void) +#else /* GTK_CHECK_VERSION(3,0,0) */ +static void +caja_cell_renderer_text_ellipsized_init (CajaCellRendererTextEllipsized *cell) { - return g_object_new (CAJA_TYPE_CELL_RENDERER_TEXT_ELLIPSIZED, NULL); + 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) + GtkWidget *widget, + GdkRectangle *cell_area, + gint *x_offset, + gint *y_offset, + gint *width, + gint *height) { - g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_NONE, NULL); + 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); + 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_PROP, PANGO_ELLIPSIZE_END, NULL); + 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 * +caja_cell_renderer_text_ellipsized_new (void) +{ + return g_object_new (CAJA_TYPE_CELL_RENDERER_TEXT_ELLIPSIZED, NULL); +} diff --git a/libcaja-private/caja-clipboard.c b/libcaja-private/caja-clipboard.c index b1614509..bce5d552 100644 --- a/libcaja-private/caja-clipboard.c +++ b/libcaja-private/caja-clipboard.c @@ -33,7 +33,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <eel/eel-glib-extensions.h> #include <string.h> typedef struct _TargetCallbackData TargetCallbackData; @@ -432,7 +431,7 @@ owner_change_callback (GtkClipboard *clipboard, } static void -target_destroy_callback (GtkObject *object, +target_destroy_callback (GtkWidget *object, gpointer callback_data) { TargetCallbackData *target_data; @@ -440,7 +439,7 @@ target_destroy_callback (GtkObject *object, g_assert (callback_data != NULL); target_data = callback_data; - if (clipboard_items_are_merged_in (GTK_WIDGET(object))) + if (clipboard_items_are_merged_in (object)) { merge_out_clipboard_menu_items (G_OBJECT (object), callback_data); } @@ -662,31 +661,27 @@ caja_clipboard_clear_if_colliding_uris (GtkWidget *widget, collision = FALSE; data = gtk_clipboard_wait_for_contents (caja_clipboard_get (widget), copied_files_atom); - if (data == NULL) - { + if (data == NULL) { return; } clipboard_item_uris = caja_clipboard_get_uri_list_from_selection_data (data, NULL, copied_files_atom); - for (l = (GList *) item_uris; l; l = l->next) - { + for (l = (GList *) item_uris; l; l = l->next) { if (g_list_find_custom ((GList *) item_uris, l->data, - (GCompareFunc) g_strcmp0)) - { + (GCompareFunc) g_strcmp0)) { collision = TRUE; break; } } - if (collision) - { + if (collision) { gtk_clipboard_clear (caja_clipboard_get (widget)); } - if (clipboard_item_uris) - { - eel_g_list_free_deep (clipboard_item_uris); + if (clipboard_item_uris) { + g_list_foreach (clipboard_item_uris, (GFunc) g_free, NULL); + g_list_free(clipboard_item_uris); } } diff --git a/libcaja-private/caja-column-utilities.c b/libcaja-private/caja-column-utilities.c index 3b789221..1ba570df 100644 --- a/libcaja-private/caja-column-utilities.c +++ b/libcaja-private/caja-column-utilities.c @@ -113,6 +113,7 @@ get_builtin_columns (void) "label", _("MIME Type"), "description", _("The mime type of the file."), NULL)); +#ifdef HAVE_SELINUX columns = g_list_append (columns, g_object_new (CAJA_TYPE_COLUMN, "name", "selinux_context", @@ -120,13 +121,13 @@ get_builtin_columns (void) "label", _("SELinux Context"), "description", _("The SELinux security context of the file."), NULL)); +#endif columns = g_list_append (columns, g_object_new (CAJA_TYPE_COLUMN, "name", "where", "attribute", "where", "label", _("Location"), - /* TODO: Change after string freeze over */ - "description", _("Location"), + "description", _("The location of the file."), NULL)); return columns; diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c index f29eee40..01521d0a 100644 --- a/libcaja-private/caja-customization-data.c +++ b/libcaja-private/caja-customization-data.c @@ -31,12 +31,9 @@ #include "caja-file-utilities.h" #include <eel/eel-gdk-extensions.h> #include <eel/eel-gdk-extensions.h> -#include <eel/eel-pango-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> -#include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-extensions.h> #include <eel/eel-vfs-extensions.h> -#include <eel/eel-string.h> #include <eel/eel-xml-extensions.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <glib.h> @@ -261,7 +258,7 @@ caja_customization_data_get_next_element_for_display (CajaCustomizationData *dat label_out); } - is_reset_image = eel_strcmp(g_file_info_get_name (current_file_info), RESET_IMAGE_NAME) == 0; + is_reset_image = g_strcmp0(g_file_info_get_name (current_file_info), RESET_IMAGE_NAME) == 0; *emblem_name = g_strdup (g_file_info_get_name (current_file_info)); @@ -307,8 +304,10 @@ caja_customization_data_destroy (CajaCustomizationData *data) g_object_unref (data->pattern_frame); } - eel_g_object_list_free (data->public_file_list); - eel_g_object_list_free (data->private_file_list); + g_list_foreach(data->public_file_list, (GFunc) g_object_unref, NULL); + g_list_free(data->public_file_list); + g_list_foreach(data->private_file_list, (GFunc) g_object_unref, NULL); + g_list_free(data->private_file_list); if (data->name_map_hash != NULL) { @@ -428,7 +427,7 @@ format_name_for_display (CajaCustomizationData *data, const char* name) { char *formatted_str, *mapped_name; - if (!eel_strcmp(name, RESET_IMAGE_NAME)) + if (!g_strcmp0(name, RESET_IMAGE_NAME)) { return g_strdup (_("Reset")); } diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c index 89ff6933..1ccfed0b 100644 --- a/libcaja-private/caja-debug-log.c +++ b/libcaja-private/caja-debug-log.c @@ -27,7 +27,6 @@ #include <string.h> #include <time.h> #include <sys/time.h> -#include <eel/eel-glib-extensions.h> #include "caja-debug-log.h" #include "caja-file.h" @@ -309,7 +308,8 @@ caja_debug_log_with_file_list (gboolean is_milestone, const char *domain, GList caja_debug_logv (is_milestone, domain, uris, format, args); va_end (args); - eel_g_list_free_deep (uris); + g_list_foreach (uris, (GFunc) g_free, NULL); + g_list_free(uris); } gboolean diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c index a20d90d7..9694b1b0 100644 --- a/libcaja-private/caja-directory-async.c +++ b/libcaja-private/caja-directory-async.c @@ -34,7 +34,6 @@ #include "caja-link.h" #include "caja-marshal.h" #include <eel/eel-glib-extensions.h> -#include <eel/eel-string.h> #include <gtk/gtk.h> #include <libxml/parser.h> #include <stdio.h> @@ -1080,7 +1079,8 @@ dequeue_pending_idle_callback (gpointer callback_data) file->details->got_mime_list = TRUE; file->details->mime_list_is_up_to_date = TRUE; - eel_g_list_free_deep (file->details->mime_list); + g_list_foreach (file->details->mime_list, (GFunc) g_free, NULL); + g_list_free(file->details->mime_list); file->details->mime_list = istr_set_get_as_list (dir_load_state->load_mime_list_hash); @@ -1093,7 +1093,8 @@ dequeue_pending_idle_callback (gpointer callback_data) } drain: - eel_g_object_list_free (pending_file_info); + g_list_foreach (pending_file_info, (GFunc) g_object_unref, NULL); + g_list_free(pending_file_info); /* Get the state machine running again. */ caja_directory_async_state_changed (directory); @@ -1181,7 +1182,8 @@ file_list_cancel (CajaDirectory *directory) if (directory->details->pending_file_info != NULL) { - eel_g_object_list_free (directory->details->pending_file_info); + g_list_foreach (directory->details->pending_file_info, (GFunc) g_object_unref, NULL); + g_list_free(directory->details->pending_file_info); directory->details->pending_file_info = NULL; } @@ -2786,7 +2788,8 @@ count_more_files_callback (GObject *source_object, state); } - eel_g_object_list_free (files); + g_list_foreach (files, (GFunc) g_object_unref, NULL); + g_list_free(files); if (error) { @@ -3011,7 +3014,8 @@ deep_count_state_free (DeepCountState *state) { g_object_unref (state->deep_count_location); } - eel_g_object_list_free (state->deep_count_subdirectories); + g_list_foreach (state->deep_count_subdirectories, (GFunc) g_object_unref, NULL); + g_list_free(state->deep_count_subdirectories); g_array_free (state->seen_deep_count_inodes, TRUE); g_free (state); } @@ -3319,7 +3323,8 @@ mime_list_done (MimeListState *state, gboolean success) file = state->mime_list_file; file->details->mime_list_is_up_to_date = TRUE; - eel_g_list_free_deep (file->details->mime_list); + g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL); + g_list_free(file->details->mime_list); if (success) { file->details->mime_list_failed = TRUE; @@ -4574,7 +4579,8 @@ get_mount_at (GFile *target) g_object_unref (root); } - eel_g_object_list_free (mounts); + g_list_foreach (mounts, (GFunc) g_object_unref, NULL); + g_list_free(mounts); g_object_unref (monitor); diff --git a/libcaja-private/caja-directory-background.c b/libcaja-private/caja-directory-background.c index 05a0f8e5..a445aab7 100644 --- a/libcaja-private/caja-directory-background.c +++ b/libcaja-private/caja-directory-background.c @@ -126,8 +126,6 @@ read_color (const char *key, GdkColor *color) { gdk_color_parse ("black", color); } - - gdk_rgb_find_color (gdk_rgb_get_colormap (), color); } static void @@ -298,11 +296,12 @@ desktop_background_settings_notify_cb (GSettings *settings, gchar *key, gpointer } static void -desktop_background_destroyed_callback (EelBackground *background, void *georgeWBush) +desktop_background_weak_notify (gpointer data, + GObject *object) { g_signal_handlers_disconnect_by_func(mate_background_preferences, G_CALLBACK (desktop_background_settings_notify_cb), - background); + object); } static void @@ -311,10 +310,10 @@ caja_file_background_receive_settings_changes (EelBackground *background) g_signal_connect (mate_background_preferences, "changed", G_CALLBACK (desktop_background_settings_notify_cb), - background); + G_OBJECT (background)); - g_signal_connect (background, "destroy", - G_CALLBACK (desktop_background_destroyed_callback), NULL); + g_object_weak_ref (G_OBJECT (background), + desktop_background_weak_notify, NULL); } /* return true if the background is not in the default state */ @@ -565,9 +564,11 @@ background_reset_callback (EelBackground *background, /* handle the background destroyed signal */ static void -background_destroyed_callback (EelBackground *background, - CajaFile *file) +background_weak_notify (gpointer data, + GObject *background) { + CajaFile *file = CAJA_FILE (data); + g_signal_handlers_disconnect_by_func (file, G_CALLBACK (saved_settings_changed_callback), background); @@ -600,23 +601,26 @@ caja_connect_background_to_file_metadata (GtkWidget *widget, if (old_file != NULL) { g_assert (CAJA_IS_FILE (old_file)); - g_signal_handlers_disconnect_by_func - (background, - G_CALLBACK (background_changed_callback), old_file); - g_signal_handlers_disconnect_by_func - (background, - G_CALLBACK (background_destroyed_callback), old_file); - g_signal_handlers_disconnect_by_func - (background, - G_CALLBACK (background_reset_callback), old_file); - g_signal_handlers_disconnect_by_func - (old_file, - G_CALLBACK (saved_settings_changed_callback), background); + + g_signal_handlers_disconnect_by_func (background, + G_CALLBACK (background_changed_callback), + old_file); + + g_signal_handlers_disconnect_by_func (background, + G_CALLBACK (background_reset_callback), + old_file); + + g_object_weak_unref (G_OBJECT (background), background_weak_notify, old_file); + + g_signal_handlers_disconnect_by_func (old_file, + G_CALLBACK (saved_settings_changed_callback), + background); + caja_file_monitor_remove (old_file, background); + g_signal_handlers_disconnect_by_func (caja_preferences, caja_file_background_theme_changed, background); - } /* Attach the new directory. */ @@ -631,13 +635,15 @@ caja_connect_background_to_file_metadata (GtkWidget *widget, { g_signal_connect_object (background, "settings_changed", G_CALLBACK (background_changed_callback), file, 0); - g_signal_connect_object (background, "destroy", - G_CALLBACK (background_destroyed_callback), file, 0); + g_signal_connect_object (background, "reset", G_CALLBACK (background_reset_callback), file, 0); + g_signal_connect_object (file, "changed", G_CALLBACK (saved_settings_changed_callback), background, 0); + g_object_weak_ref (G_OBJECT (background), background_weak_notify, file); + /* arrange to receive file metadata */ caja_file_monitor_add (file, background, diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c index 6479b38a..38d73794 100644 --- a/libcaja-private/caja-directory.c +++ b/libcaja-private/caja-directory.c @@ -32,14 +32,13 @@ #include "caja-search-directory.h" #include "caja-global-preferences.h" #include "caja-lib-self-check-functions.h" -#include "caja-marshal.h" #include "caja-metadata.h" #include "caja-desktop-directory.h" #include "caja-vfs-directory.h" #include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-macros.h> -#include <eel/eel-string.h> #include <gtk/gtk.h> +#include <string.h> enum { @@ -176,7 +175,8 @@ caja_directory_finalize (GObject *object) if (directory->details->monitor_list != NULL) { g_warning ("destroying a CajaDirectory while it's being monitored"); - eel_g_list_free_deep (directory->details->monitor_list); + g_list_foreach(directory->details->monitor_list, (GFunc) g_free, NULL); + g_list_free(directory->details->monitor_list); } if (directory->details->monitor != NULL) @@ -213,7 +213,8 @@ caja_directory_finalize (GObject *object) g_assert (directory->details->directory_load_in_progress == NULL); g_assert (directory->details->count_in_progress == NULL); g_assert (directory->details->dequeue_pending_idle_id == 0); - eel_g_object_list_free (directory->details->pending_file_info); + g_list_foreach(directory->details->pending_file_info, (GFunc) g_object_unref, NULL); + g_list_free(directory->details->pending_file_info); EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); } @@ -759,7 +760,7 @@ caja_directory_find_file_by_internal_filename (CajaDirectory *directory, { CajaFile *result; - if (eel_strcmp (internal_filename, ".") == 0) + if (g_strcmp0 (internal_filename, ".") == 0) { result = caja_directory_get_existing_corresponding_file (directory); if (result != NULL) @@ -1093,7 +1094,8 @@ caja_directory_notify_files_added_by_uri (GList *uris) files = caja_file_list_from_uris (uris); caja_directory_notify_files_added (files); - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); } void @@ -1142,7 +1144,8 @@ caja_directory_notify_files_changed_by_uri (GList *uris) files = caja_file_list_from_uris (uris); caja_directory_notify_files_changed (files); - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); } void @@ -1203,7 +1206,8 @@ caja_directory_notify_files_removed_by_uri (GList *uris) files = caja_file_list_from_uris (uris); caja_directory_notify_files_changed (files); - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); } static void diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index 87617a77..feea5ca8 100644 --- a/libcaja-private/caja-dnd.c +++ b/libcaja-private/caja-dnd.c @@ -129,7 +129,8 @@ caja_drag_uri_array_from_selection_list (const GList *selection_list) uri_list = caja_drag_uri_list_from_selection_list (selection_list); uris = caja_drag_uri_array_from_list (uri_list); - eel_g_list_free_deep (uri_list); + g_list_foreach(uri_list, (GFunc) g_free, NULL); + g_list_free(uri_list); return uris; } @@ -1315,7 +1316,9 @@ slot_proxy_handle_drop (GtkWidget *widget, uri_list, target_uri, gdk_drag_context_get_selected_action (context)); - eel_g_list_free_deep (uri_list); + g_list_foreach(uri_list, (GFunc) g_free, NULL); + g_list_free(uri_list); + } else if (drag_info->info == CAJA_ICON_DND_URI_LIST) { diff --git a/libcaja-private/caja-emblem-utils.c b/libcaja-private/caja-emblem-utils.c index 3c41a016..dd70dbc3 100644 --- a/libcaja-private/caja-emblem-utils.c +++ b/libcaja-private/caja-emblem-utils.c @@ -37,7 +37,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <eel/eel-glib-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-stock-dialogs.h> @@ -120,7 +119,8 @@ is_reserved_keyword (const char *keyword) result = g_list_find_custom (available, (char *) icon_name, (GCompareFunc) g_ascii_strcasecmp) != NULL; - eel_g_list_free_deep (available); + g_list_foreach(available, (GFunc) g_free, NULL); + g_list_free(available); g_free (icon_name); return result; } diff --git a/libcaja-private/caja-entry.c b/libcaja-private/caja-entry.c index 31b590c3..fb9ac38c 100644 --- a/libcaja-private/caja-entry.c +++ b/libcaja-private/caja-entry.c @@ -35,6 +35,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> +#if !GTK_CHECK_VERSION(3, 0, 0) +#define GtkEditableInterface GtkEditableClass +#endif + struct CajaEntryDetails { gboolean user_edit; @@ -51,13 +55,13 @@ enum }; static guint signals[LAST_SIGNAL]; -static void caja_entry_editable_init (GtkEditableClass *iface); +static void caja_entry_editable_init (GtkEditableInterface *iface); G_DEFINE_TYPE_WITH_CODE (CajaEntry, caja_entry, GTK_TYPE_ENTRY, G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, caja_entry_editable_init)); -static GtkEditableClass *parent_editable_interface = NULL; +static GtkEditableInterface *parent_editable_interface = NULL; static void caja_entry_init (CajaEntry *entry) @@ -123,7 +127,7 @@ caja_entry_key_press (GtkWidget *widget, GdkEventKey *event) switch (event->keyval) { - case GDK_Tab: + case GDK_KEY_Tab: /* The location bar entry wants TAB to work kind of * like it does in the shell for command completion, * so if we get a tab and there's a selection, we @@ -373,7 +377,7 @@ caja_entry_selection_clear (GtkWidget *widget, } static void -caja_entry_editable_init (GtkEditableClass *iface) +caja_entry_editable_init (GtkEditableInterface *iface) { parent_editable_interface = g_type_interface_peek_parent (iface); @@ -391,12 +395,10 @@ static void caja_entry_class_init (CajaEntryClass *class) { GtkWidgetClass *widget_class; - GtkObjectClass *object_class; GObjectClass *gobject_class; widget_class = GTK_WIDGET_CLASS (class); gobject_class = G_OBJECT_CLASS (class); - object_class = GTK_OBJECT_CLASS (class); widget_class->button_press_event = caja_entry_button_press; widget_class->button_release_event = caja_entry_button_release; @@ -409,19 +411,17 @@ caja_entry_class_init (CajaEntryClass *class) /* Set up signals */ signals[USER_CHANGED] = g_signal_new ("user_changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CajaEntryClass, - user_changed), + G_STRUCT_OFFSET (CajaEntryClass, user_changed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[SELECTION_CHANGED] = g_signal_new ("selection_changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CajaEntryClass, - selection_changed), + G_STRUCT_OFFSET (CajaEntryClass, selection_changed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); diff --git a/libcaja-private/caja-file-changes-queue.c b/libcaja-private/caja-file-changes-queue.c index b3cd1db0..39cf123e 100644 --- a/libcaja-private/caja-file-changes-queue.c +++ b/libcaja-private/caja-file-changes-queue.c @@ -24,7 +24,6 @@ #include "caja-file-changes-queue.h" #include "caja-directory-notify.h" -#include <eel/eel-glib-extensions.h> #ifdef G_THREADS_ENABLED #define MUTEX_LOCK(a) if ((a) != NULL) g_mutex_lock (a) @@ -289,7 +288,8 @@ pairs_list_free (GList *pairs) } /* delete the list and the now empty pair structs */ - eel_g_list_free_deep (pairs); + g_list_foreach(pairs, (GFunc) g_free, NULL); + g_list_free(pairs); } static void @@ -304,7 +304,8 @@ position_set_list_free (GList *list) g_object_unref (item->location); } /* delete the list and the now empty structs */ - eel_g_list_free_deep (list); + g_list_foreach(list, (GFunc) g_free, NULL); + g_list_free(list); } /* go through changes in the change queue, send ones with the same kind @@ -386,7 +387,8 @@ caja_file_changes_consume_changes (gboolean consume_all) { deletions = g_list_reverse (deletions); caja_directory_notify_files_removed (deletions); - eel_g_object_list_free (deletions); + g_list_foreach(deletions, (GFunc) g_object_unref, NULL); + g_list_free(deletions); deletions = NULL; } if (moves != NULL) @@ -400,14 +402,16 @@ caja_file_changes_consume_changes (gboolean consume_all) { additions = g_list_reverse (additions); caja_directory_notify_files_added (additions); - eel_g_object_list_free (additions); + g_list_foreach(additions, (GFunc) g_object_unref, NULL); + g_list_free(additions); additions = NULL; } if (changes != NULL) { changes = g_list_reverse (changes); caja_directory_notify_files_changed (changes); - eel_g_object_list_free (changes); + g_list_foreach(changes, (GFunc) g_object_unref, NULL); + g_list_free(changes); changes = NULL; } if (position_set_requests != NULL) diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c index c1769960..e3419c7c 100644 --- a/libcaja-private/caja-file-conflict-dialog.c +++ b/libcaja-private/caja-file-conflict-dialog.c @@ -657,7 +657,6 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd) gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (dialog)), 14); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); - gtk_dialog_set_has_separator (dialog, FALSE); gtk_widget_show_all (dialog_area); } diff --git a/libcaja-private/caja-file-dnd.c b/libcaja-private/caja-file-dnd.c index a44d42f3..2c239643 100644 --- a/libcaja-private/caja-file-dnd.c +++ b/libcaja-private/caja-file-dnd.c @@ -30,7 +30,6 @@ #include "caja-dnd.h" #include "caja-directory.h" #include "caja-file-utilities.h" -#include <eel/eel-glib-extensions.h> #include <string.h> static gboolean @@ -182,5 +181,6 @@ caja_drag_file_receive_dropped_keyword (CajaFile *file, } caja_file_set_keywords (file, keywords); - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); } diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index f89e00cc..067f52d5 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -44,9 +44,7 @@ #include "caja-progress-info.h" -#include <eel/eel-alert-dialog.h> #include <eel/eel-glib-extensions.h> -#include <eel/eel-pango-extensions.h> #include <eel/eel-gtk-extensions.h> #include <eel/eel-stock-dialogs.h> #include <eel/eel-vfs-extensions.h> @@ -1066,12 +1064,16 @@ do_run_simple_dialog (gpointer _data) int response_id; /* Create the dialog. */ - dialog = eel_alert_dialog_new (*data->parent_window, - 0, - data->message_type, - GTK_BUTTONS_NONE, - data->primary_text, - data->secondary_text); + dialog = gtk_message_dialog_new (*data->parent_window, + 0, + data->message_type, + GTK_BUTTONS_NONE, + NULL); + + g_object_set (dialog, + "text", data->primary_text, + "secondary-text", data->secondary_text, + NULL); for (response_id = 0; data->button_titles[response_id] != NULL; @@ -1086,8 +1088,8 @@ do_run_simple_dialog (gpointer _data) } if (data->details_text) { - eel_alert_dialog_set_details_label (EEL_ALERT_DIALOG (dialog), - data->details_text); + eel_gtk_message_dialog_set_details_label (GTK_MESSAGE_DIALOG (dialog), + data->details_text); } /* Run it. */ @@ -1099,7 +1101,7 @@ do_run_simple_dialog (gpointer _data) result = gtk_dialog_run (GTK_DIALOG (dialog)); } - gtk_object_destroy (GTK_OBJECT (dialog)); + gtk_widget_destroy (dialog); data->result = result; @@ -1856,7 +1858,8 @@ delete_job_done (gpointer user_data) job = user_data; - eel_g_object_list_free (job->files); + g_list_foreach(job->files, (GFunc) g_object_unref, NULL); + g_list_free(job->files); if (job->done_callback) { debuting_uris = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL); @@ -2185,7 +2188,8 @@ has_trash_files (GMount *mount) } } - eel_g_object_list_free (dirs); + g_list_foreach(dirs, (GFunc) g_object_unref, NULL); + g_list_free(dirs); return res; } @@ -4458,7 +4462,8 @@ copy_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - eel_g_object_list_free (job->files); + g_list_foreach(job->files, (GFunc) g_object_unref, NULL); + g_list_free(job->files); if (job->destination) { g_object_unref (job->destination); } @@ -4985,7 +4990,8 @@ move_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - eel_g_object_list_free (job->files); + g_list_foreach(job->files, (GFunc) g_object_unref, NULL); + g_list_free(job->files); g_object_unref (job->destination); g_hash_table_unref (job->debuting_files); g_free (job->icon_positions); @@ -5065,7 +5071,8 @@ move_job (GIOSchedulerJob *io_job, &source_info, &transfer_info); aborted: - eel_g_list_free_deep (fallbacks); + g_list_foreach(fallbacks, (GFunc) g_free, NULL); + g_list_free(fallbacks); g_free (dest_fs_id); g_free (dest_fs_type); @@ -5319,7 +5326,8 @@ link_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - eel_g_object_list_free (job->files); + g_list_foreach(job->files, (GFunc) g_object_unref, NULL); + g_list_free(job->files); g_object_unref (job->destination); g_hash_table_unref (job->debuting_files); g_free (job->icon_positions); @@ -5771,7 +5779,8 @@ caja_file_operations_copy_move (const GList *item_uris, done_callback, done_callback_data); } - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); if (dest) { g_object_unref (dest); } @@ -6249,7 +6258,8 @@ empty_trash_job_done (gpointer user_data) job = user_data; - eel_g_object_list_free (job->trash_dirs); + g_list_foreach(job->trash_dirs, (GFunc) g_object_unref, NULL); + g_list_free(job->trash_dirs); if (job->done_callback) { job->done_callback (job->done_callback_data); diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c index 61ad5c47..bfe8321e 100644 --- a/libcaja-private/caja-file-utilities.c +++ b/libcaja-private/caja-file-utilities.c @@ -1428,7 +1428,8 @@ caja_restore_files_from_trash (GList *files, parent_window, NULL, NULL); - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); g_object_unref (original_dir_location); } diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index 31863c9c..788eec68 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -816,11 +816,14 @@ finalize (GObject *object) eel_ref_str_unref (file->details->filesystem_id); - eel_g_list_free_deep (file->details->mime_list); - - eel_g_list_free_deep (file->details->pending_extension_emblems); - eel_g_list_free_deep (file->details->extension_emblems); - eel_g_object_list_free (file->details->pending_info_providers); + g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL); + g_list_free(file->details->mime_list); + g_list_foreach(file->details->pending_extension_emblems, (GFunc) g_free, NULL); + g_list_free(file->details->pending_extension_emblems); + g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL); + g_list_free(file->details->extension_emblems); + g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL); + g_list_free(file->details->pending_info_providers); if (file->details->pending_extension_attributes) { g_hash_table_destroy (file->details->pending_extension_attributes); @@ -2994,7 +2997,8 @@ fill_emblem_cache_if_needed (CajaFile *file) /* Zero-terminate so we can tell where the list ends. */ *scanner = 0; - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); } static int @@ -6601,7 +6605,8 @@ caja_file_get_emblem_icons (CajaFile *file, icons = g_list_prepend (icons, icon); } - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); return icons; } @@ -6660,7 +6665,8 @@ sort_keyword_list_and_remove_duplicates (GList *keywords) if (strcmp ((const char *) p->data, (const char *) p->next->data) == 0) { duplicate_link = p->next; keywords = g_list_remove_link (keywords, duplicate_link); - eel_g_list_free_deep (duplicate_link); + g_list_foreach(duplicate_link, (GFunc) g_free, NULL); + g_list_free(duplicate_link); } else { p = p->next; } @@ -7554,7 +7560,8 @@ void caja_file_invalidate_extension_info_internal (CajaFile *file) { if (file->details->pending_info_providers) - eel_g_object_list_free (file->details->pending_info_providers); + g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL); + g_list_free(file->details->pending_info_providers); file->details->pending_info_providers = caja_module_get_extensions_for_type (CAJA_TYPE_INFO_PROVIDER); @@ -8376,7 +8383,8 @@ caja_file_invalidate_extension_info (CajaFile *file) void caja_file_info_providers_done (CajaFile *file) { - eel_g_list_free_deep (file->details->extension_emblems); + g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL); + g_list_free(file->details->extension_emblems); file->details->extension_emblems = file->details->pending_extension_emblems; file->details->pending_extension_emblems = NULL; diff --git a/libcaja-private/caja-horizontal-splitter.c b/libcaja-private/caja-horizontal-splitter.c deleted file mode 100644 index 0fbaa3c4..00000000 --- a/libcaja-private/caja-horizontal-splitter.c +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* caja-horizontal-splitter.c - A horizontal splitter with a semi gradient look - - Copyright (C) 1999, 2000 Eazel, Inc. - - The Mate Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Mate Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Mate Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - Authors: Ramiro Estrugo <[email protected]> -*/ - -#include <config.h> -#include "caja-horizontal-splitter.h" - -#include <eel/eel-gtk-macros.h> -#include <stdlib.h> - -struct CajaHorizontalSplitterDetails -{ - guint32 press_time; - int press_position; - int saved_size; -}; - -#define CLOSED_THRESHOLD 4 -#define NOMINAL_SIZE 148 -#define SPLITTER_CLICK_SLOP 4 -#define SPLITTER_CLICK_TIMEOUT 400 - -static void caja_horizontal_splitter_class_init (CajaHorizontalSplitterClass *horizontal_splitter_class); -static void caja_horizontal_splitter_init (CajaHorizontalSplitter *horizontal_splitter); - -EEL_CLASS_BOILERPLATE (CajaHorizontalSplitter, - caja_horizontal_splitter, - GTK_TYPE_HPANED) - -static void -caja_horizontal_splitter_init (CajaHorizontalSplitter *horizontal_splitter) -{ - horizontal_splitter->details = g_new0 (CajaHorizontalSplitterDetails, 1); -} - -static void -caja_horizontal_splitter_finalize (GObject *object) -{ - CajaHorizontalSplitter *horizontal_splitter; - - horizontal_splitter = CAJA_HORIZONTAL_SPLITTER (object); - - g_free (horizontal_splitter->details); - - EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); -} - -static void -splitter_expand (CajaHorizontalSplitter *splitter, int position) -{ - g_assert (CAJA_IS_HORIZONTAL_SPLITTER (splitter)); - - if (position >= CLOSED_THRESHOLD) - { - return; - } - - position = splitter->details->saved_size; - if (position < CLOSED_THRESHOLD) - { - position = NOMINAL_SIZE; - } - - gtk_paned_set_position (GTK_PANED (splitter), position); -} - -static void -splitter_collapse (CajaHorizontalSplitter *splitter, int position) -{ - g_assert (CAJA_IS_HORIZONTAL_SPLITTER (splitter)); - - splitter->details->saved_size = position; - gtk_paned_set_position (GTK_PANED (splitter), 0); -} - -static void -splitter_toggle (CajaHorizontalSplitter *splitter, int position) -{ - g_assert (CAJA_IS_HORIZONTAL_SPLITTER (splitter)); - - if (gtk_paned_get_position (GTK_PANED (splitter)) >= CLOSED_THRESHOLD) - { - caja_horizontal_splitter_collapse (splitter); - } - else - { - caja_horizontal_splitter_expand (splitter); - } -} - -static void -splitter_hide (CajaHorizontalSplitter *splitter) -{ - GtkPaned *parent; - - parent = GTK_PANED (splitter); - - gtk_widget_hide (gtk_paned_get_child1 (parent)); -} - -static void -splitter_show (CajaHorizontalSplitter *splitter) -{ - GtkPaned *parent; - - parent = GTK_PANED (splitter); - - gtk_widget_show (gtk_paned_get_child1 (parent)); -} - -static gboolean -splitter_is_hidden (CajaHorizontalSplitter *splitter) -{ - GtkPaned *parent; - - parent = GTK_PANED (splitter); - - return gtk_widget_get_visible (gtk_paned_get_child1 (parent)); -} - -void -caja_horizontal_splitter_expand (CajaHorizontalSplitter *splitter) -{ - splitter_expand (splitter, gtk_paned_get_position (GTK_PANED (splitter))); -} - -void -caja_horizontal_splitter_hide (CajaHorizontalSplitter *splitter) -{ - splitter_hide (splitter); -} - -void -caja_horizontal_splitter_show (CajaHorizontalSplitter *splitter) -{ - splitter_show (splitter); -} - -gboolean -caja_horizontal_splitter_is_hidden (CajaHorizontalSplitter *splitter) -{ - return splitter_is_hidden (splitter); -} - -void -caja_horizontal_splitter_collapse (CajaHorizontalSplitter *splitter) -{ - splitter_collapse (splitter, gtk_paned_get_position (GTK_PANED (splitter))); -} - -/* routine to toggle the open/closed state of the splitter */ -void -caja_horizontal_splitter_toggle_position (CajaHorizontalSplitter *splitter) -{ - splitter_toggle (splitter, gtk_paned_get_position (GTK_PANED (splitter))); -} - -/* CajaHorizontalSplitter public methods */ -GtkWidget * -caja_horizontal_splitter_new (void) -{ - return gtk_widget_new (caja_horizontal_splitter_get_type (), NULL); -} - -/* handle mouse downs by remembering the position and the time */ -static gboolean -caja_horizontal_splitter_button_press (GtkWidget *widget, GdkEventButton *event) -{ - gboolean result; - CajaHorizontalSplitter *splitter; - int position; - - splitter = CAJA_HORIZONTAL_SPLITTER (widget); - - position = gtk_paned_get_position (GTK_PANED (widget)); - - result = EEL_CALL_PARENT_WITH_RETURN_VALUE - (GTK_WIDGET_CLASS, button_press_event, (widget, event)); - - if (result) - { - splitter->details->press_time = event->time; - splitter->details->press_position = position; - } - - return result; -} - -/* handle mouse ups by seeing if it was a tap and toggling the open state accordingly */ -static gboolean -caja_horizontal_splitter_button_release (GtkWidget *widget, GdkEventButton *event) -{ - gboolean result; - CajaHorizontalSplitter *splitter; - int position, delta, delta_time; - splitter = CAJA_HORIZONTAL_SPLITTER (widget); - - position = gtk_paned_get_position (GTK_PANED (widget)); - - result = EEL_CALL_PARENT_WITH_RETURN_VALUE - (GTK_WIDGET_CLASS, button_release_event, (widget, event)); - - if (result) - { - delta = abs (position - splitter->details->press_position); - delta_time = event->time - splitter->details->press_time; - if (delta < SPLITTER_CLICK_SLOP && delta_time < SPLITTER_CLICK_TIMEOUT) - { - caja_horizontal_splitter_toggle_position (splitter); - } - } - - return result; -} - -static void -caja_horizontal_splitter_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - gint border_width; - GtkPaned *paned; - GtkAllocation child_allocation; - GtkRequisition child_requisition; - - paned = GTK_PANED (widget); - border_width = gtk_container_get_border_width (GTK_CONTAINER (paned)); - - gtk_widget_set_allocation (widget, allocation); - - if (gtk_paned_get_child2 (paned) != NULL && gtk_widget_get_visible (gtk_paned_get_child2 (paned))) - { - EEL_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate, - (widget, allocation)); - } - else if (gtk_paned_get_child1 (paned) && gtk_widget_get_visible (gtk_paned_get_child1 (paned))) - { - - if (gtk_widget_get_realized (widget)) - { - gdk_window_hide (gtk_paned_get_handle_window (paned)); - } - - gtk_widget_get_child_requisition (gtk_paned_get_child1 (paned), - &child_requisition); - - child_allocation.x = allocation->x + border_width; - child_allocation.y = allocation->y + border_width; - child_allocation.width = MIN (child_requisition.width, - allocation->width - 2 * border_width); - child_allocation.height = MIN (child_requisition.height, - allocation->height - 2 * border_width); - - gtk_widget_size_allocate (gtk_paned_get_child1 (paned), &child_allocation); - } - else if (gtk_widget_get_realized (widget)) - { - gdk_window_hide (gtk_paned_get_handle_window (paned)); - } - -} - -static void -caja_horizontal_splitter_class_init (CajaHorizontalSplitterClass *class) -{ - GtkWidgetClass *widget_class; - - widget_class = GTK_WIDGET_CLASS (class); - - G_OBJECT_CLASS (class)->finalize = caja_horizontal_splitter_finalize; - - widget_class->size_allocate = caja_horizontal_splitter_size_allocate; - widget_class->button_press_event = caja_horizontal_splitter_button_press; - widget_class->button_release_event = caja_horizontal_splitter_button_release; -} - -void -caja_horizontal_splitter_pack2 (CajaHorizontalSplitter *splitter, - GtkWidget *child2) -{ - GtkPaned *paned; - - g_return_if_fail (GTK_IS_WIDGET (child2)); - g_return_if_fail (CAJA_IS_HORIZONTAL_SPLITTER (splitter)); - - paned = GTK_PANED (splitter); - gtk_paned_pack2 (paned, child2, TRUE, FALSE); -} diff --git a/libcaja-private/caja-horizontal-splitter.h b/libcaja-private/caja-horizontal-splitter.h deleted file mode 100644 index b0fdcf4a..00000000 --- a/libcaja-private/caja-horizontal-splitter.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* caja-horizontal-splitter.h - A horizontal splitter with a semi gradient look - - Copyright (C) 1999, 2000 Eazel, Inc. - - The Mate Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Mate Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Mate Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - Authors: Ramiro Estrugo <[email protected]> -*/ - -#ifndef CAJA_HORIZONTAL_SPLITTER_H -#define CAJA_HORIZONTAL_SPLITTER_H - -#include <gtk/gtk.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define CAJA_TYPE_HORIZONTAL_SPLITTER caja_horizontal_splitter_get_type() -#define CAJA_HORIZONTAL_SPLITTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_HORIZONTAL_SPLITTER, CajaHorizontalSplitter)) -#define CAJA_HORIZONTAL_SPLITTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_HORIZONTAL_SPLITTER, CajaHorizontalSplitterClass)) -#define CAJA_IS_HORIZONTAL_SPLITTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_HORIZONTAL_SPLITTER)) -#define CAJA_IS_HORIZONTAL_SPLITTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_HORIZONTAL_SPLITTER)) -#define CAJA_HORIZONTAL_SPLITTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_HORIZONTAL_SPLITTER, CajaHorizontalSplitterClass)) - - typedef struct CajaHorizontalSplitterDetails CajaHorizontalSplitterDetails; - - typedef struct - { - GtkHPaned parent_slot; - CajaHorizontalSplitterDetails *details; - } CajaHorizontalSplitter; - - typedef struct - { - GtkHPanedClass parent_slot; - } CajaHorizontalSplitterClass; - - /* CajaHorizontalSplitter public methods */ - GType caja_horizontal_splitter_get_type (void); - GtkWidget *caja_horizontal_splitter_new (void); - - gboolean caja_horizontal_splitter_is_hidden (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_collapse (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_hide (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_show (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_expand (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_toggle_position (CajaHorizontalSplitter *splitter); - void caja_horizontal_splitter_pack2 (CajaHorizontalSplitter *splitter, - GtkWidget *child2); - -#ifdef __cplusplus -} -#endif - -#endif /* CAJA_HORIZONTAL_SPLITTER_H */ diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index db0b5280..f36f2ccf 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -35,10 +35,8 @@ #include <eel/eel-gdk-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-glib-extensions.h> -#include <eel/eel-mate-extensions.h> #include <eel/eel-graphic-effects.h> #include <eel/eel-gtk-macros.h> -#include <eel/eel-pango-extensions.h> #include <eel/eel-string.h> #include <eel/eel-accessibility.h> #include <gdk-pixbuf/gdk-pixbuf.h> @@ -216,42 +214,57 @@ G_DEFINE_TYPE_WITH_CODE (CajaIconCanvasItem, caja_icon_canvas_item, EEL_TYPE_CAN /* private */ static void draw_label_text (CajaIconCanvasItem *item, - GdkDrawable *drawable, - gboolean create_mask, - EelIRect icon_rect); +#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); static void get_icon_canvas_rectangle (CajaIconCanvasItem *item, - EelIRect *rect); -static void emblem_layout_reset (EmblemLayout *layout, - CajaIconCanvasItem *icon_item, - EelIRect icon_rect, - gboolean is_rtl); -static gboolean emblem_layout_next (EmblemLayout *layout, - GdkPixbuf **emblem_pixbuf, - EelIRect *emblem_rect, - gboolean is_rtl); -static void draw_pixbuf (GdkPixbuf *pixbuf, - GdkDrawable *drawable, - int x, - int y); -static PangoLayout *get_label_layout (PangoLayout **layout, - CajaIconCanvasItem *item, - const char *text); + EelIRect *rect); +static void emblem_layout_reset (EmblemLayout *layout, + CajaIconCanvasItem *icon_item, + EelIRect icon_rect, + gboolean is_rtl); +static gboolean emblem_layout_next (EmblemLayout *layout, + GdkPixbuf **emblem_pixbuf, + 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); static void draw_label_layout (CajaIconCanvasItem *item, - GdkDrawable *drawable, - PangoLayout *layout, - gboolean highlight, - GdkColor *label_color, - int x, - int y, - GdkGC *gc); +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else + GdkDrawable *drawable, +#endif + PangoLayout *layout, + gboolean highlight, + GdkColor *label_color, + int x, + int y); static gboolean hit_test_stretch_handle (CajaIconCanvasItem *item, - EelIRect canvas_rect, - GtkCornerType *corner); + EelIRect canvas_rect, + GtkCornerType *corner); static void draw_embedded_text (CajaIconCanvasItem *icon_item, - GdkDrawable *drawable, - int x, - int y); +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else + GdkDrawable *drawable, +#endif + int x, + int y); static void caja_icon_canvas_item_ensure_bounds_up_to_date (CajaIconCanvasItem *icon_item); @@ -313,7 +326,8 @@ caja_icon_canvas_item_finalize (GObject *object) g_object_unref (details->text_util); } - eel_gdk_pixbuf_list_free (details->emblem_pixbufs); + g_list_foreach(details->emblem_pixbufs, (GFunc) g_object_unref, NULL); + g_list_free(details->emblem_pixbufs); g_free (details->editable_text); g_free (details->additional_text); g_free (details->attach_points); @@ -405,7 +419,7 @@ caja_icon_canvas_item_set_property (GObject *object, { case PROP_EDITABLE_TEXT: - if (eel_strcmp (details->editable_text, + if (g_strcmp0 (details->editable_text, g_value_get_string (value)) == 0) { return; @@ -432,7 +446,7 @@ caja_icon_canvas_item_set_property (GObject *object, break; case PROP_ADDITIONAL_TEXT: - if (eel_strcmp (details->additional_text, + if (g_strcmp0 (details->additional_text, g_value_get_string (value)) == 0) { return; @@ -540,20 +554,28 @@ 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; - GdkGC *gc; int width, height; int item_offset_x, item_offset_y; EelIRect icon_rect; EelIRect emblem_rect; - GdkPixbuf *pixbuf; GdkPixbuf *emblem_pixbuf; EmblemLayout emblem_layout; double item_x, item_y; @@ -563,7 +585,11 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item, 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)); +#else screen = gdk_colormap_get_screen (colormap); +#endif /* Assume we're updated so canvas item data is right */ @@ -580,6 +606,19 @@ 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); + + cr = cairo_create (surface); + gdk_cairo_set_source_pixbuf (cr, item->details->pixbuf, + item_offset_x, item_offset_y); + cairo_rectangle (cr, item_offset_x, item_offset_y, + gdk_pixbuf_get_width (item->details->pixbuf), + gdk_pixbuf_get_height (item->details->pixbuf)); + cairo_fill (cr); +#else pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen), width, height, gdk_visual_get_depth (gdk_colormap_get_visual (colormap))); @@ -597,16 +636,33 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item, 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; icon_rect.x1 = item_offset_x + gdk_pixbuf_get_width (item->details->pixbuf); icon_rect.y1 = item_offset_y + gdk_pixbuf_get_height (item->details->pixbuf); - 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); + cairo_rectangle (cr, emblem_rect.x0, emblem_rect.y0, + gdk_pixbuf_get_width (emblem_pixbuf), + gdk_pixbuf_get_height (emblem_pixbuf)); + cairo_fill (cr); + } + + draw_embedded_text (item, cr, + item_offset_x, item_offset_y); + draw_label_text (item, cr, FALSE, icon_rect); + cairo_destroy (cr); + + return surface; +#else while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect, is_rtl)) { gdk_pixbuf_composite (emblem_pixbuf, pixbuf, @@ -618,34 +674,21 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item, GDK_INTERP_BILINEAR, 255); } - /* clear the pixmap */ + /* draw pixbuf to mask and pixmap */ cr = gdk_cairo_create (pixmap); - cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_paint (cr); cairo_destroy (cr); - gc = gdk_gc_new (pixmap); - gdk_draw_pixbuf (pixmap, gc, pixbuf, - 0, 0, 0, 0, - gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), - GDK_RGB_DITHER_NORMAL, - 0, 0); - g_object_unref (gc); - *mask = gdk_pixmap_new (gdk_screen_get_root_window (screen), width, height, 1); - gc = gdk_gc_new (*mask); - gdk_draw_rectangle (*mask, gc, - TRUE, - 0, 0, - width, height); - g_object_unref (gc); - - gdk_pixbuf_render_threshold_alpha (pixbuf, *mask, - 0, 0, 0, 0, - gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), - 128); + 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, GDK_DRAWABLE (pixmap), item_offset_x, item_offset_y); @@ -656,6 +699,7 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item, g_object_unref (pixbuf); return pixmap; +#endif } void @@ -718,8 +762,9 @@ caja_icon_canvas_item_set_emblems (CajaIconCanvasItem *item, } /* Take in the new list of emblems. */ - eel_gdk_pixbuf_list_ref (emblem_pixbufs); - eel_gdk_pixbuf_list_free (item->details->emblem_pixbufs); + eel_g_object_list_ref (emblem_pixbufs); + g_list_foreach(item->details->emblem_pixbufs, (GFunc) g_object_unref, NULL); + g_list_free(item->details->emblem_pixbufs); item->details->emblem_pixbufs = g_list_copy (emblem_pixbufs); caja_icon_canvas_item_invalidate_bounds_cache (item); @@ -1032,7 +1077,11 @@ make_round_rect (cairo_t *cr, static void draw_frame (CajaIconCanvasItem *item, +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else GdkDrawable *drawable, +#endif guint color, gboolean create_mask, int x, @@ -1041,12 +1090,14 @@ draw_frame (CajaIconCanvasItem *item, int height) { CajaIconContainer *container; - cairo_t *cr; container = CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas); - /* Get a cairo context */ - cr = gdk_cairo_create (drawable); +#if GTK_CHECK_VERSION(3,0,0) + cairo_save (cr); +#else + cairo_t *cr = gdk_cairo_create (drawable); +#endif /* Set the rounded rect clip region. Magic rounding value taken * from old code. @@ -1070,8 +1121,11 @@ draw_frame (CajaIconCanvasItem *item, /* Paint into drawable now that we have set up the color and opacity */ cairo_fill (cr); - /* Clean up now that drawing is complete */ +#if GTK_CHECK_VERSION(3,0,0) + cairo_restore (cr); +#else cairo_destroy (cr); +#endif } /* Keep these for a bit while we work on performance of draw_or_measure_label_text. */ @@ -1379,7 +1433,11 @@ measure_label_text (CajaIconCanvasItem *item) 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) { @@ -1389,7 +1447,6 @@ draw_label_text (CajaIconCanvasItem *item, PangoLayout *editable_layout; PangoLayout *additional_layout; GdkColor *label_color; - GdkGC *gc; gboolean have_editable, have_additional; gboolean needs_frame, needs_highlight, prelight_label, is_rtl_label_beside; EelIRect text_rect; @@ -1400,8 +1457,6 @@ draw_label_text (CajaIconCanvasItem *item, return; #endif - gc = NULL; - canvas_item = EEL_CANVAS_ITEM (item); details = item->details; @@ -1433,7 +1488,11 @@ draw_label_text (CajaIconCanvasItem *item, if (needs_highlight && !details->is_renaming) { draw_frame (item, +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else drawable, +#endif 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, @@ -1446,11 +1505,23 @@ draw_label_text (CajaIconCanvasItem *item, details->is_highlighted_as_keyboard_focus)) { /* clear the underlying icons, where the text or overlaps them. */ +#if GTK_CHECK_VERSION(3,0,0) + cairo_save (cr); + cairo_set_source_rgba (cr, 0, 0, 0, 0); + cairo_rectangle (cr, + text_rect.x0, + text_rect.y0, + text_rect.x1 - text_rect.x0, + text_rect.y1 - text_rect.y0); + cairo_fill (cr); + cairo_restore (cr); +#else 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); +#endif } if (container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE) @@ -1476,7 +1547,11 @@ draw_label_text (CajaIconCanvasItem *item, if (!(prelight_label && item->details->is_prelit)) { draw_frame (item, +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else drawable, +#endif container->details->normal_color_rgba, create_mask, text_rect.x0, @@ -1487,7 +1562,11 @@ draw_label_text (CajaIconCanvasItem *item, else { draw_frame (item, +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else drawable, +#endif container->details->prelight_color_rgba, create_mask, text_rect.x0, @@ -1497,16 +1576,21 @@ draw_label_text (CajaIconCanvasItem *item, } } - gc = caja_icon_container_get_label_color_and_gc + 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, + draw_label_layout (item, +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else + drawable, +#endif editable_layout, needs_highlight, label_color, x, - text_rect.y0 + TEXT_BACK_PADDING_Y, gc); + text_rect.y0 + TEXT_BACK_PADDING_Y); } if (have_additional) @@ -1514,22 +1598,31 @@ draw_label_text (CajaIconCanvasItem *item, additional_layout = get_label_layout (&item->details->additional_text_layout, item, item->details->additional_text); prepare_pango_layout_for_draw (item, additional_layout); - gc = caja_icon_container_get_label_color_and_gc + caja_icon_container_get_label_color (CAJA_ICON_CONTAINER (canvas_item->canvas), &label_color, FALSE, needs_highlight, FALSE); - draw_label_layout (item, drawable, + draw_label_layout (item, +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else + drawable, +#endif additional_layout, needs_highlight, label_color, x, - text_rect.y0 + details->editable_text_height + LABEL_LINE_SPACING + TEXT_BACK_PADDING_Y, gc); + 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)), +#if GTK_CHECK_VERSION(3,0,0) + cr, +#else drawable, +#endif needs_highlight ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, NULL, GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas), @@ -1611,15 +1704,18 @@ get_knob_pixbuf (void) } static void +#if GTK_CHECK_VERSION(3,0,0) +draw_stretch_handles (CajaIconCanvasItem *item, + cairo_t *cr, +#else draw_stretch_handles (CajaIconCanvasItem *item, GdkDrawable *drawable, +#endif const EelIRect *rect) { GtkWidget *widget; - GdkGC *gc; GdkPixbuf *knob_pixbuf; - GdkBitmap *stipple; int knob_width, knob_height; - GtkStyle *style; + double dash = { 2.0 }; if (!item->details->show_stretch_handles) { @@ -1627,44 +1723,45 @@ draw_stretch_handles (CajaIconCanvasItem *item, GdkDrawable *drawable, } widget = GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas); - style = gtk_widget_get_style (widget); - gc = gdk_gc_new (drawable); +#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); - stipple = eel_stipple_bitmap_for_screen ( - gdk_drawable_get_screen (GDK_DRAWABLE (drawable))); - /* first draw the box */ - gdk_gc_set_rgb_fg_color (gc, &style->white); - gdk_draw_rectangle - (drawable, gc, FALSE, - rect->x0, - rect->y0, - rect->x1 - rect->x0 - 1, - rect->y1 - rect->y0 - 1); - - gdk_gc_set_rgb_fg_color (gc, &style->black); - gdk_gc_set_stipple (gc, stipple); - gdk_gc_set_fill (gc, GDK_STIPPLED); - gdk_draw_rectangle - (drawable, gc, FALSE, - rect->x0, - rect->y0, - rect->x1 - rect->x0 - 1, - rect->y1 - rect->y0 - 1); + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_set_dash (cr, &dash, 1, 0); + cairo_set_line_width (cr, 1.0); + cairo_rectangle (cr, + rect->x0 + 0.5, + rect->y0 + 0.5, + rect->x1 - rect->x0 - 1, + rect->y1 - rect->y0 - 1); + cairo_stroke (cr); + +#if GTK_CHECK_VERSION(3,0,0) + cairo_restore (cr); /* draw the stretch handles themselves */ + draw_pixbuf (knob_pixbuf, cr, rect->x0, rect->y0); + 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); - g_object_unref (knob_pixbuf); +#endif - g_object_unref (gc); + g_object_unref (knob_pixbuf); } static void @@ -1825,16 +1922,25 @@ 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) +{ + cairo_save (cr); + gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y); + cairo_paint (cr); + cairo_restore (cr); +} +#else draw_pixbuf (GdkPixbuf *pixbuf, GdkDrawable *drawable, int x, int y) { - /* FIXME bugzilla.gnome.org 40703: - * Dither would be better if we passed dither values. - */ - gdk_draw_pixbuf (drawable, NULL, pixbuf, 0, 0, x, y, - gdk_pixbuf_get_width (pixbuf), - gdk_pixbuf_get_height (pixbuf), - GDK_RGB_DITHER_NORMAL, 0, 0); + 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 * @@ -2000,11 +2106,13 @@ 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) { - GdkGC *gc; - GdkRectangle clip_rect; PangoLayout *layout; PangoContext *context; PangoFontDescription *desc; @@ -2036,35 +2144,49 @@ draw_embedded_text (CajaIconCanvasItem *item, } } - gc = gdk_gc_new (drawable); - - clip_rect.x = x + item->details->embedded_text_rect.x; - clip_rect.y = y + item->details->embedded_text_rect.y; - clip_rect.width = item->details->embedded_text_rect.width; - clip_rect.height = item->details->embedded_text_rect.height; - - gdk_gc_set_clip_rectangle (gc, &clip_rect); +#if GTK_CHECK_VERSION(3,0,0) + cairo_save (cr); +#else + cairo_t *cr = gdk_cairo_create (drawable); +#endif - gdk_draw_layout (drawable, gc, + cairo_rectangle (cr, x + item->details->embedded_text_rect.x, y + item->details->embedded_text_rect.y, - layout); - - g_object_unref (gc); - g_object_unref (layout); + 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); + +#if GTK_CHECK_VERSION(3,0,0) + cairo_restore (cr); +#else + 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) +#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; - GdkRectangle draw_rect, pixbuf_rect; + GdkRectangle pixbuf_rect; gboolean is_rtl; icon_item = CAJA_ICON_CANVAS_ITEM (item); @@ -2085,23 +2207,29 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable, pixbuf_rect.y = icon_rect.y0; pixbuf_rect.width = gdk_pixbuf_get_width (temp_pixbuf); pixbuf_rect.height = gdk_pixbuf_get_height (temp_pixbuf); - if (gdk_rectangle_intersect (&(expose->area), &pixbuf_rect, &draw_rect)) - { - gdk_draw_pixbuf (drawable, - NULL, - temp_pixbuf, - draw_rect.x - pixbuf_rect.x, - draw_rect.y - pixbuf_rect.y, - draw_rect.x, - draw_rect.y, - draw_rect.width, - draw_rect.height, - GDK_RGB_DITHER_NORMAL, - 0,0); - } + +#if GTK_CHECK_VERSION(3,0,0) + cairo_save (cr); +#else + cairo_t *cr = gdk_cairo_create (drawable); + gdk_cairo_rectangle (cr, &expose->area); + cairo_clip (cr); +#endif + gdk_cairo_set_source_pixbuf (cr, temp_pixbuf, pixbuf_rect.x, pixbuf_rect.y); + gdk_cairo_rectangle (cr, &pixbuf_rect); + cairo_fill (cr); +#if GTK_CHECK_VERSION(3,0,0) + cairo_restore (cr); +#else + cairo_destroy (cr); +#endif g_object_unref (temp_pixbuf); +#if GTK_CHECK_VERSION(3,0,0) + draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0); +#else 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)); @@ -2109,14 +2237,23 @@ 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); +#else draw_pixbuf (emblem_pixbuf, drawable, emblem_rect.x0, emblem_rect.y0); +#endif } +#if GTK_CHECK_VERSION(3,0,0) /* Draw stretching handles (if necessary). */ - draw_stretch_handles (icon_item, drawable, &icon_rect); + draw_stretch_handles (icon_item, cr, &icon_rect); /* Draw the label text. */ + draw_label_text (icon_item, cr, FALSE, icon_rect); +#else + 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" @@ -2234,18 +2371,20 @@ get_label_layout (PangoLayout **layout_cache, static void draw_label_layout (CajaIconCanvasItem *item, +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else GdkDrawable *drawable, +#endif PangoLayout *layout, gboolean highlight, GdkColor *label_color, int x, - int y, - GdkGC *gc) + int y) { - if (drawable == NULL) - { - return; - } +#if !GTK_CHECK_VERSION(3,0,0) + g_return_if_fail (drawable != NULL); +#endif if (item->details->is_renaming) { @@ -2255,7 +2394,11 @@ draw_label_layout (CajaIconCanvasItem *item, 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, gc, +#if GTK_CHECK_VERSION(3,0,0) + eel_cairo_draw_layout_with_drop_shadow (cr, +#else + eel_gdk_draw_layout_with_drop_shadow (drawable, +#endif label_color, >k_widget_get_style (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas))->black, x, y, @@ -2263,9 +2406,20 @@ draw_label_layout (CajaIconCanvasItem *item, } else { - gdk_draw_layout (drawable, gc, - x, y, - layout); +#if GTK_CHECK_VERSION(3,0,0) + cairo_save (cr); +#else + cairo_t *cr = gdk_cairo_create (drawable); +#endif + + gdk_cairo_set_source_color (cr, label_color); + cairo_move_to (cr, x, y); + pango_cairo_show_layout (cr, layout); +#if GTK_CHECK_VERSION(3,0,0) + cairo_restore (cr); +#else + cairo_destroy (cr); +#endif } } diff --git a/libcaja-private/caja-icon-canvas-item.h b/libcaja-private/caja-icon-canvas-item.h index 27d01867..14b93b63 100644 --- a/libcaja-private/caja-icon-canvas-item.h +++ b/libcaja-private/caja-icon-canvas-item.h @@ -74,9 +74,13 @@ 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); + 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 e3457f31..6b2f18e8 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -43,7 +43,6 @@ #include <eel/eel-gtk-extensions.h> #include <eel/eel-art-extensions.h> #include <eel/eel-editable-label.h> -#include <eel/eel-marshal.h> #include <eel/eel-string.h> #include <eel/eel-canvas-rect-ellipse.h> #include <gdk/gdkkeysyms.h> @@ -53,6 +52,12 @@ #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 + #define TAB_NAVIGATION_DISABLED /* Interval for updating the rubberband selection, in milliseconds. */ @@ -301,7 +306,7 @@ static void icon_free (CajaIcon *icon) { /* Destroy this canvas item; the parent will unref it. */ - gtk_object_destroy (GTK_OBJECT (icon->item)); + eel_canvas_item_destroy (EEL_CANVAS_ITEM (icon->item)); g_free (icon); } @@ -592,8 +597,8 @@ caja_icon_container_scroll (CajaIconContainer *container, GtkAdjustment *hadj, *vadj; int old_h_value, old_v_value; - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)); /* Store the old ajustment values so we can tell if we * ended up actually scrolling. We may not have in a case @@ -755,8 +760,8 @@ reveal_icon (CajaIconContainer *container, details = container->details; gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)); if (caja_icon_container_is_auto_layout (container)) { @@ -1088,8 +1093,8 @@ canvas_set_scroll_region_include_visible_area (EelCanvas *canvas, width = (allocation.width) / canvas->pixels_per_unit; height = (allocation.height) / canvas->pixels_per_unit; - old_scroll_x = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas)))); - old_scroll_y = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas)))); + old_scroll_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas))); + old_scroll_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas))); x1 = MIN (x1, old_x1 + old_scroll_x); y1 = MIN (y1, old_y1 + old_scroll_y); @@ -1213,8 +1218,8 @@ caja_icon_container_update_scroll_region (CajaIconContainer *container) x1, y1, x2, y2); } - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)); /* Scroll by 1/4 icon each time you click. */ step_increment = caja_get_icon_size_for_zoom_level @@ -2776,14 +2781,14 @@ rubberband_timeout_callback (gpointer data) adj_changed = FALSE; gtk_widget_get_allocation (widget, &allocation); - adj_x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))); + adj_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))); if (adj_x != band_info->last_adj_x) { band_info->last_adj_x = adj_x; adj_changed = TRUE; } - adj_y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))); + adj_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))); if (adj_y != band_info->last_adj_y) { band_info->last_adj_y = adj_y; @@ -2832,8 +2837,8 @@ rubberband_timeout_callback (gpointer data) /* Remember to convert from widget to scrolled window coords */ eel_canvas_window_to_world (EEL_CANVAS (container), - x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))), - y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))), + x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))), + y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))), &world_x, &world_y); if (world_x < band_info->start_x) @@ -2954,8 +2959,8 @@ start_rubberbanding (CajaIconContainer *container, 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_layout_get_hadjustment (GTK_LAYOUT (container))); - band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))); + 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; @@ -2991,7 +2996,7 @@ stop_rubberbanding (CajaIconContainer *container, /* Destroy this canvas item; the parent will unref it. */ eel_canvas_item_ungrab (band_info->selection_rectangle, time); - gtk_object_destroy (GTK_OBJECT (band_info->selection_rectangle)); + eel_canvas_item_destroy (band_info->selection_rectangle); band_info->selection_rectangle = NULL; /* if only one item has been selected, use it as range @@ -4380,10 +4385,12 @@ select_previous_or_next_icon (CajaIconContainer *container, } #endif -/* GtkObject methods. */ - static void +#if GTK_CHECK_VERSION(3, 0, 0) +destroy (GtkWidget *object) +#else destroy (GtkObject *object) +#endif { CajaIconContainer *container; @@ -4440,8 +4447,11 @@ 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 @@ -4483,15 +4493,6 @@ finalize (GObject *object) /* GtkWidget methods. */ -static void -size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - GTK_WIDGET_CLASS (caja_icon_container_parent_class)->size_request (widget, requisition); - requisition->width = 1; - requisition->height = 1; -} - static gboolean clear_size_allocation_count (gpointer data) { @@ -4565,7 +4566,6 @@ size_allocate (GtkWidget *widget, static void realize (GtkWidget *widget) { - GdkBitmap *stipple; GtkAdjustment *vadj, *hadj; CajaIconContainer *container; @@ -4581,20 +4581,15 @@ realize (GtkWidget *widget) } /* Set up DnD. */ - caja_icon_dnd_init (container, NULL); + caja_icon_dnd_init (container); setup_label_gcs (container); - stipple = eel_stipple_bitmap_for_screen - (gdk_drawable_get_screen (GDK_DRAWABLE (gtk_widget_get_window (widget)))); - - caja_icon_dnd_set_stipple (container, stipple); - - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (widget)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget)); g_signal_connect (hadj, "value_changed", G_CALLBACK (handle_hadjustment_changed), widget); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (widget)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)); g_signal_connect (vadj, "value_changed", G_CALLBACK (handle_vadjustment_changed), widget); @@ -4603,20 +4598,10 @@ realize (GtkWidget *widget) static void unrealize (GtkWidget *widget) { - int i; CajaIconContainer *container; container = CAJA_ICON_CONTAINER (widget); - for (i = 0; i < LAST_LABEL_COLOR; i++) - { - if (container->details->label_gcs [i]) - { - g_object_unref (container->details->label_gcs [i]); - container->details->label_gcs [i] = NULL; - } - } - caja_icon_dnd_fini (container); if (container->details->typeselect_flush_timeout) @@ -4946,7 +4931,7 @@ start_stretching (CajaIconContainer *container) toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container)); if (toplevel != NULL && gtk_widget_get_realized (toplevel)) { - eel_gdk_window_focus (gtk_widget_get_window (toplevel), GDK_CURRENT_TIME); + gdk_window_focus (gtk_widget_get_window (toplevel), GDK_CURRENT_TIME); } return TRUE; @@ -5022,17 +5007,17 @@ keyboard_stretching (CajaIconContainer *container, switch (event->keyval) { - case GDK_equal: - case GDK_plus: - case GDK_KP_Add: + case GDK_KEY_equal: + case GDK_KEY_plus: + case GDK_KEY_KP_Add: icon_set_size (container, icon, size + 5, FALSE, FALSE); break; - case GDK_minus: - case GDK_KP_Subtract: + case GDK_KEY_minus: + case GDK_KEY_KP_Subtract: icon_set_size (container, icon, size - 5, FALSE, FALSE); break; - case GDK_0: - case GDK_KP_0: + case GDK_KEY_0: + case GDK_KEY_KP_0: caja_icon_container_move_icon (container, icon, icon->x, icon->y, 1.0, @@ -5258,7 +5243,7 @@ caja_icon_container_search_position_func (CajaIconContainer *container, cont_window = gtk_widget_get_window (GTK_WIDGET (container)); - screen = gdk_drawable_get_screen (cont_window); + screen = gdk_window_get_screen (cont_window); monitor_num = gdk_screen_get_monitor_at_window (screen, cont_window); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); @@ -5268,13 +5253,15 @@ caja_icon_container_search_position_func (CajaIconContainer *container, gdk_window_get_origin (cont_window, &cont_x, &cont_y); #if GTK_CHECK_VERSION(3, 0, 0) - cont_width = gdk_window_get_width(GDK_WINDOW(cont_window)); - cont_height = gdk_window_get_height(GDK_WINDOW(cont_window)); + cont_width = gdk_window_get_width (cont_window); + cont_height = gdk_window_get_height (cont_window); + + gtk_widget_get_preferred_size (search_dialog, &requisition, NULL); #else - gdk_drawable_get_size(cont_window, &cont_width, &cont_height); -#endif + gdk_drawable_get_size (cont_window, &cont_width, &cont_height); gtk_widget_size_request (search_dialog, &requisition); +#endif if (cont_x + cont_width - requisition.width > gdk_screen_get_width (screen)) { @@ -5649,14 +5636,14 @@ caja_icon_container_search_key_press_event (GtkWidget *widget, g_assert (CAJA_IS_ICON_CONTAINER (container)); /* close window and cancel the search */ - if (event->keyval == GDK_Escape || event->keyval == GDK_Tab) + if (event->keyval == GDK_KEY_Escape || event->keyval == GDK_KEY_Tab) { caja_icon_container_search_dialog_hide (widget, container); return TRUE; } /* close window and activate alternate */ - if (event->keyval == GDK_Return && event->state & GDK_SHIFT_MASK) + if (event->keyval == GDK_KEY_Return && event->state & GDK_SHIFT_MASK) { caja_icon_container_search_dialog_hide (widget, container); @@ -5666,28 +5653,28 @@ caja_icon_container_search_key_press_event (GtkWidget *widget, } /* select previous matching iter */ - if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) + if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) { caja_icon_container_search_move (widget, container, TRUE); retval = TRUE; } if (((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) - && (event->keyval == GDK_g || event->keyval == GDK_G)) + && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) { caja_icon_container_search_move (widget, container, TRUE); retval = TRUE; } /* select next matching iter */ - if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down) + if (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down) { caja_icon_container_search_move (widget, container, FALSE); retval = TRUE; } if (((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK) - && (event->keyval == GDK_g || event->keyval == GDK_G)) + && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) { caja_icon_container_search_move (widget, container, FALSE); retval = TRUE; @@ -5896,12 +5883,12 @@ key_press_event (GtkWidget *widget, { switch (event->keyval) { - case GDK_Return: - case GDK_KP_Enter: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: end_renaming_mode (container, TRUE); handled = TRUE; break; - case GDK_Escape: + case GDK_KEY_Escape: end_renaming_mode (container, FALSE); handled = TRUE; break; @@ -5913,18 +5900,18 @@ key_press_event (GtkWidget *widget, { switch (event->keyval) { - case GDK_Home: - case GDK_KP_Home: + case GDK_KEY_Home: + case GDK_KEY_KP_Home: keyboard_home (container, event); handled = TRUE; break; - case GDK_End: - case GDK_KP_End: + case GDK_KEY_End: + case GDK_KEY_KP_End: keyboard_end (container, event); handled = TRUE; break; - case GDK_Left: - case GDK_KP_Left: + case GDK_KEY_Left: + case GDK_KEY_KP_Left: /* Don't eat Alt-Left, as that is used for history browsing */ if ((event->state & GDK_MOD1_MASK) == 0) { @@ -5932,8 +5919,8 @@ key_press_event (GtkWidget *widget, handled = TRUE; } break; - case GDK_Up: - case GDK_KP_Up: + case GDK_KEY_Up: + case GDK_KEY_KP_Up: /* Don't eat Alt-Up, as that is used for alt-shift-Up */ if ((event->state & GDK_MOD1_MASK) == 0) { @@ -5941,8 +5928,8 @@ key_press_event (GtkWidget *widget, handled = TRUE; } break; - case GDK_Right: - case GDK_KP_Right: + case GDK_KEY_Right: + case GDK_KEY_KP_Right: /* Don't eat Alt-Right, as that is used for history browsing */ if ((event->state & GDK_MOD1_MASK) == 0) { @@ -5950,8 +5937,8 @@ key_press_event (GtkWidget *widget, handled = TRUE; } break; - case GDK_Down: - case GDK_KP_Down: + case GDK_KEY_Down: + case GDK_KEY_KP_Down: /* Don't eat Alt-Down, as that is used for Open */ if ((event->state & GDK_MOD1_MASK) == 0) { @@ -5959,20 +5946,20 @@ key_press_event (GtkWidget *widget, handled = TRUE; } break; - case GDK_space: + case GDK_KEY_space: keyboard_space (container, event); handled = TRUE; break; #ifndef TAB_NAVIGATION_DISABLED - case GDK_Tab: - case GDK_ISO_Left_Tab: + case GDK_KEY_Tab: + case GDK_KEY_ISO_Left_Tab: select_previous_or_next_icon (container, (event->state & GDK_SHIFT_MASK) == 0, event); handled = TRUE; break; #endif - case GDK_Return: - case GDK_KP_Enter: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: if ((event->state & GDK_SHIFT_MASK) != 0) { activate_selected_items_alternate (container, NULL); @@ -5984,22 +5971,22 @@ key_press_event (GtkWidget *widget, handled = TRUE; break; - case GDK_Escape: + case GDK_KEY_Escape: handled = undo_stretching (container); break; - case GDK_plus: - case GDK_minus: - case GDK_equal: - case GDK_KP_Add: - case GDK_KP_Subtract: - case GDK_0: - case GDK_KP_0: + case GDK_KEY_plus: + case GDK_KEY_minus: + case GDK_KEY_equal: + case GDK_KEY_KP_Add: + case GDK_KEY_KP_Subtract: + case GDK_KEY_0: + case GDK_KEY_KP_0: if (event->state & GDK_CONTROL_MASK) { handled = keyboard_stretching (container, event); } break; - case GDK_F10: + case GDK_KEY_F10: /* handle Ctrl+F10 because we want to display the * background popup even if something is selected. * The other cases are handled by popup_menu(). @@ -6010,7 +5997,7 @@ key_press_event (GtkWidget *widget, "context_click_background"); } break; - case GDK_v: + case GDK_KEY_v: /* Eat Control + v to not enable type ahead */ if ((event->state & GDK_CONTROL_MASK) != 0) { @@ -6031,9 +6018,9 @@ key_press_event (GtkWidget *widget, * start the typeahead find capabilities. * Copied from CajaIconContainer */ if (!handled && - event->keyval != GDK_slash /* don't steal slash key event, used for "go to" */ && - event->keyval != GDK_BackSpace && - event->keyval != GDK_Delete) + event->keyval != GDK_KEY_slash /* don't steal slash key event, used for "go to" */ && + event->keyval != GDK_KEY_BackSpace && + event->keyval != GDK_KEY_Delete) { GdkEvent *new_event; GdkWindow *window; @@ -6122,12 +6109,17 @@ popup_menu (GtkWidget *widget) 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 */ } +#if !GTK_CHECK_VERSION(3,0,0) static gboolean expose_event (GtkWidget *widget, GdkEventExpose *event) @@ -6139,6 +6131,7 @@ expose_event (GtkWidget *widget, return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->expose_event (widget, event); } +#endif static AtkObject * get_accessible (GtkWidget *widget) @@ -6230,7 +6223,12 @@ 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. */ @@ -6362,7 +6360,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, get_icon_uri), NULL, NULL, - eel_marshal_STRING__POINTER, + caja_marshal_STRING__POINTER, G_TYPE_STRING, 1, G_TYPE_POINTER); signals[GET_ICON_DROP_TARGET_URI] @@ -6372,7 +6370,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, get_icon_drop_target_uri), NULL, NULL, - eel_marshal_STRING__POINTER, + caja_marshal_STRING__POINTER, G_TYPE_STRING, 1, G_TYPE_POINTER); signals[MOVE_COPY_ITEMS] @@ -6455,7 +6453,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, get_container_uri), NULL, NULL, - eel_marshal_STRING__VOID, + caja_marshal_STRING__VOID, G_TYPE_STRING, 0); signals[CAN_ACCEPT_ITEM] = g_signal_new ("can_accept_item", @@ -6464,7 +6462,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, can_accept_item), NULL, NULL, - eel_marshal_INT__POINTER_STRING, + caja_marshal_INT__POINTER_STRING, G_TYPE_INT, 2, G_TYPE_POINTER, G_TYPE_STRING); @@ -6475,7 +6473,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, get_stored_icon_position), NULL, NULL, - eel_marshal_BOOLEAN__POINTER_POINTER, + caja_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER); @@ -6486,7 +6484,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, get_stored_layout_timestamp), NULL, NULL, - eel_marshal_BOOLEAN__POINTER_POINTER, + caja_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER); @@ -6497,7 +6495,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class) G_STRUCT_OFFSET (CajaIconContainerClass, store_layout_timestamp), NULL, NULL, - eel_marshal_BOOLEAN__POINTER_POINTER, + caja_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER); @@ -6581,7 +6579,6 @@ caja_icon_container_class_init (CajaIconContainerClass *class) /* GtkWidget class. */ widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = size_request; widget_class->size_allocate = size_allocate; widget_class->realize = realize; widget_class->unrealize = unrealize; @@ -6592,7 +6589,9 @@ caja_icon_container_class_init (CajaIconContainerClass *class) widget_class->popup_menu = popup_menu; widget_class->get_accessible = get_accessible; widget_class->style_set = style_set; +#if !GTK_CHECK_VERSION(3,0,0) widget_class->expose_event = expose_event; +#endif widget_class->grab_notify = grab_notify_cb; canvas_class = EEL_CANVAS_CLASS (class); @@ -6733,8 +6732,8 @@ caja_icon_container_class_init (CajaIconContainerClass *class) binding_set = gtk_binding_set_by_class (class); - gtk_binding_entry_add_signal (binding_set, GDK_f, GDK_CONTROL_MASK, "start_interactive_search", 0); - gtk_binding_entry_add_signal (binding_set, GDK_F, GDK_CONTROL_MASK, "start_interactive_search", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_f, GDK_CONTROL_MASK, "start_interactive_search", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_F, GDK_CONTROL_MASK, "start_interactive_search", 0); } static void @@ -7189,9 +7188,9 @@ caja_icon_container_get_first_visible_icon (CajaIconContainer *container) gboolean better_icon; gboolean compare_lt; - hadj_v = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))); - vadj_v = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))); - h_page_size = gtk_adjustment_get_page_size (gtk_layout_get_hadjustment (GTK_LAYOUT (container))); + hadj_v = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))); + vadj_v = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))); + h_page_size = gtk_adjustment_get_page_size (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))); if (caja_icon_container_is_layout_rtl (container)) { @@ -7280,8 +7279,8 @@ caja_icon_container_scroll_to_icon (CajaIconContainer *container, EelIRect bounds; GtkAllocation allocation; - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)); gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); /* We need to force a relayout now if there are updates queued @@ -7613,8 +7612,8 @@ caja_icon_container_update_visible_icons (CajaIconContainer *container) gboolean visible; GtkAllocation allocation; - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)); gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); min_x = gtk_adjustment_get_value (hadj); @@ -7776,7 +7775,7 @@ caja_icon_container_update_icon (CajaIconContainer *container, * happened to be typing at that moment. */ if (icon == get_icon_being_renamed (container) && - eel_strcmp (editable_text, + g_strcmp0 (editable_text, caja_icon_canvas_item_get_editable_text (icon->item)) != 0) { end_renaming_mode (container, FALSE); @@ -7796,7 +7795,8 @@ caja_icon_container_update_icon (CajaIconContainer *container, /* Let the pixbufs go. */ g_object_unref (pixbuf); - eel_gdk_pixbuf_list_free (emblem_pixbufs); + g_list_foreach(emblem_pixbufs, (GFunc) g_object_unref, NULL); + g_list_free(emblem_pixbufs); g_free (editable_text); g_free (additional_text); @@ -9331,8 +9331,8 @@ caja_icon_container_set_single_click_mode (CajaIconContainer *container, /* update the label color when the background changes */ -GdkGC * -caja_icon_container_get_label_color_and_gc (CajaIconContainer *container, +void +caja_icon_container_get_label_color (CajaIconContainer *container, GdkColor **color, gboolean is_name, gboolean is_highlight, @@ -9388,28 +9388,12 @@ caja_icon_container_get_label_color_and_gc (CajaIconContainer *container, { *color = &container->details->label_colors [idx]; } - - return container->details->label_gcs [idx]; } static void setup_gc_with_fg (CajaIconContainer *container, int idx, guint32 color) { - GdkGC *gc; - GdkColor gcolor; - - gcolor = eel_gdk_rgb_to_color (color); - container->details->label_colors [idx] = gcolor; - - gc = gdk_gc_new (gtk_layout_get_bin_window (GTK_LAYOUT (container))); - gdk_gc_set_rgb_fg_color (gc, &gcolor); - - if (container->details->label_gcs [idx]) - { - g_object_unref (container->details->label_gcs [idx]); - } - - container->details->label_gcs [idx] = gc; + container->details->label_colors [idx] = eel_gdk_rgb_to_color (color); } static void @@ -9695,7 +9679,7 @@ caja_icon_container_set_font (CajaIconContainer *container, { g_return_if_fail (CAJA_IS_ICON_CONTAINER (container)); - if (eel_strcmp (container->details->font, font) == 0) + if (g_strcmp0 (container->details->font, font) == 0) { return; } diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c index 12cc5cbf..cae6e4ee 100644 --- a/libcaja-private/caja-icon-dnd.c +++ b/libcaja-private/caja-icon-dnd.c @@ -60,6 +60,12 @@ #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 }, @@ -98,7 +104,6 @@ create_selection_shadow (CajaIconContainer *container, { EelCanvasGroup *group; EelCanvas *canvas; - GdkBitmap *stipple; int max_x, max_y; int min_x, min_y; GList *p; @@ -115,9 +120,6 @@ create_selection_shadow (CajaIconContainer *container, return NULL; } - stipple = container->details->dnd_info->stipple; - g_return_val_if_fail (stipple != NULL, NULL); - canvas = EEL_CANVAS (container); gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); @@ -164,7 +166,7 @@ create_selection_shadow (CajaIconContainer *container, "x2", (double) x2, "y2", (double) y2, "outline_color", "black", - "outline_stipple", stipple, + "outline-stippling", TRUE, "width_pixels", 1, NULL); } @@ -201,6 +203,10 @@ canvas_rect_world_to_widget (EelCanvas *canvas, EelIRect *widget_rect) { EelDRect window_rect; + GtkAdjustment *hadj, *vadj; + + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)); eel_canvas_world_to_window (canvas, world_rect->x0, world_rect->y0, @@ -208,10 +214,10 @@ canvas_rect_world_to_widget (EelCanvas *canvas, eel_canvas_world_to_window (canvas, world_rect->x1, world_rect->y1, &window_rect.x1, &window_rect.y1); - widget_rect->x0 = (int) window_rect.x0 - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))); - widget_rect->y0 = (int) window_rect.y0 - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))); - widget_rect->x1 = (int) window_rect.x1 - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))); - widget_rect->y1 = (int) window_rect.y1 - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))); + widget_rect->x0 = (int) window_rect.x0 - gtk_adjustment_get_value (hadj); + widget_rect->y0 = (int) window_rect.y0 - gtk_adjustment_get_value (vadj); + widget_rect->x1 = (int) window_rect.x1 - gtk_adjustment_get_value (hadj); + widget_rect->y1 = (int) window_rect.y1 - gtk_adjustment_get_value (vadj); } static void @@ -220,8 +226,8 @@ canvas_widget_to_world (EelCanvas *canvas, double *world_x, double *world_y) { eel_canvas_window_to_world (canvas, - widget_x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))), - widget_y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))), + widget_x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas))), + widget_y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas))), world_x, world_y); } @@ -379,7 +385,7 @@ caja_icon_container_dropped_icon_feedback (GtkWidget *widget, { /* FIXME bugzilla.gnome.org 42484: * Is a destroy really sufficient here? Who does the unref? */ - gtk_object_destroy (GTK_OBJECT (dnd_info->shadow)); + eel_canvas_item_destroy (dnd_info->shadow); } /* Build the selection list and the shadow. */ @@ -944,63 +950,6 @@ stop_auto_scroll (CajaIconContainer *container) caja_drag_autoscroll_stop (&container->details->dnd_info->drag_info); } -static gboolean -confirm_switch_to_manual_layout (CajaIconContainer *container) -{ -#if 0 - const char *message; - const char *detail; - GtkDialog *dialog; - int response; - - /* FIXME bugzilla.gnome.org 40915: Use of the word "directory" - * makes this FMIconView specific. Move these messages into - * FMIconView so CajaIconContainer can be used for things - * that are not directories? - */ - if (caja_icon_container_has_stored_icon_positions (container)) - { - if (eel_g_list_exactly_one_item (container->details->dnd_info->drag_info.selection_list)) - { - message = no_translate("Do you want to switch to manual layout and leave this item where you dropped it? " - "This will clobber the stored manual layout."); - detail = no_translate("This folder uses automatic layout."); - } - else - { - message = no_translate("Do you want to switch to manual layout and leave these items where you dropped them? " - "This will clobber the stored manual layout."); - detail = no_translate("This folder uses automatic layout."); - } - } - else - { - if (eel_g_list_exactly_one_item (container->details->dnd_info->drag_info.selection_list)) - { - message = no_translate("Do you want to switch to manual layout and leave this item where you dropped it?"); - detail = no_translate("This folder uses automatic layout."); - } - else - { - message = no_translate("Do you want to switch to manual layout and leave these items where you dropped them?"); - detail = no_translate("This folder uses automatic layout."); - - } - } - - dialog = eel_show_yes_no_dialog (message, detail, _("Switch to Manual Layout?"), - GTK_STOCK_CANCEL, - GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET(container)))); - - response = gtk_dialog_run (dialog); - gtk_object_destroy (GTK_OBJECT (dialog)); - - return response == GTK_RESPONSE_YES; -#else - return FALSE; -#endif -} - static void handle_local_move (CajaIconContainer *container, double world_x, double world_y) @@ -1015,11 +964,7 @@ handle_local_move (CajaIconContainer *container, if (container->details->auto_layout) { - if (!confirm_switch_to_manual_layout (container)) - { - return; - } - caja_icon_container_freeze_icon_positions (container); + return; } time (&now); @@ -1332,8 +1277,8 @@ caja_icon_container_receive_dropped_icons (CajaIconContainer *container, if (real_action > 0) { eel_canvas_window_to_world (EEL_CANVAS (container), - x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))), - y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))), + x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))), + y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))), &world_x, &world_y); drop_target = caja_icon_container_find_drop_target (container, @@ -1518,7 +1463,7 @@ caja_icon_container_free_drag_data (CajaIconContainer *container) if (dnd_info->shadow != NULL) { - gtk_object_destroy (GTK_OBJECT (dnd_info->shadow)); + eel_canvas_item_destroy (dnd_info->shadow); dnd_info->shadow = NULL; } @@ -1560,18 +1505,23 @@ drag_begin_callback (GtkWidget *widget, GdkDragContext *context, gpointer data) { +#if GTK_CHECK_VERSION(3,0,0) + cairo_surface_t *surface; +#else CajaIconContainer *container; GdkScreen *screen; GdkColormap *colormap; GdkPixmap *pixmap; GdkBitmap *mask; + gboolean use_mask; +#endif double x1, y1, x2, y2, winx, winy; int x_offset, y_offset; int start_x, start_y; - gboolean use_mask; container = CAJA_ICON_CONTAINER (widget); +#if !GTK_CHECK_VERSION(3,0,0) screen = gtk_widget_get_screen (widget); colormap = NULL; if (gdk_screen_is_composited (screen)) @@ -1589,16 +1539,19 @@ drag_begin_callback (GtkWidget *widget, 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_layout_get_hadjustment (GTK_LAYOUT (container))); - start_y = container->details->dnd_info->drag_info.start_y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))); + 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); - - /* we want to drag semi-transparent pixbufs, but X is too slow dealing with - stippled masks, so we had to remove the code; this comment is left as a memorial - to it, with the hope that we get it back someday as X Windows improves */ +#endif /* compute the image's offset */ eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (container->details->drag_icon->item), @@ -1608,6 +1561,11 @@ 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) { cairo_t *cr; @@ -1624,6 +1582,7 @@ drag_begin_callback (GtkWidget *widget, colormap, pixmap, (use_mask ? mask : NULL), x_offset, y_offset); +#endif } void @@ -1646,8 +1605,10 @@ caja_icon_dnd_begin_drag (CajaIconContainer *container, /* Notice that the event is in bin_window coordinates, because of the way the canvas handles events. */ - dnd_info->drag_info.start_x = start_x - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))); - dnd_info->drag_info.start_y = start_y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))); + dnd_info->drag_info.start_x = start_x - + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))); + dnd_info->drag_info.start_y = start_y - + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))); /* start the drag */ context = gtk_drag_begin (GTK_WIDGET (container), @@ -1658,34 +1619,50 @@ caja_icon_dnd_begin_drag (CajaIconContainer *container, } 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 { gint x, y, width, height; GdkWindow *window; - x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (widget))); - y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (widget))); + x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget))); + y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget))); + window = gtk_widget_get_window (widget); #if GTK_CHECK_VERSION(3, 0, 0) - width = gdk_window_get_width(GDK_WINDOW(gtk_widget_get_window(widget))); - height = gdk_window_get_height(GDK_WINDOW(gtk_widget_get_window(widget))); -#else - gdk_drawable_get_size(gtk_widget_get_window(widget), &width, &height); -#endif + width = gdk_window_get_width (window); + height = gdk_window_get_height (window); - window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + gtk_paint_shadow (gtk_widget_get_style (widget), + cr, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, + widget, "dnd", + x, y, width, height); +#else + gdk_drawable_get_size(window, &width, &height); gtk_paint_shadow (gtk_widget_get_style (widget), window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, "dnd", x, y, width, height); - gdk_draw_rectangle (window, - (gtk_widget_get_style(widget))->black_gc, - FALSE, - x, y, width - 1, height - 1); + cairo_t *cr = gdk_cairo_create (window); +#endif + + cairo_set_line_width (cr, 1.0); + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1); + cairo_stroke (cr); +#if !GTK_CHECK_VERSION(3,0,0) + cairo_destroy (cr); +#endif return FALSE; } @@ -1744,8 +1721,13 @@ 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); } @@ -1761,7 +1743,11 @@ 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; @@ -2029,25 +2015,7 @@ drag_data_received_callback (GtkWidget *widget, } void -caja_icon_dnd_set_stipple (CajaIconContainer *container, - GdkBitmap *stipple) -{ - if (stipple != NULL) - { - g_object_ref (stipple); - } - - if (container->details->dnd_info->stipple != NULL) - { - g_object_unref (container->details->dnd_info->stipple); - } - - container->details->dnd_info->stipple = stipple; -} - -void -caja_icon_dnd_init (CajaIconContainer *container, - GdkBitmap *stipple) +caja_icon_dnd_init (CajaIconContainer *container) { GtkTargetList *targets; int n_elements; @@ -2096,11 +2064,6 @@ caja_icon_dnd_init (CajaIconContainer *container, G_CALLBACK (drag_drop_callback), NULL); g_signal_connect (container, "drag_leave", G_CALLBACK (drag_leave_callback), NULL); - - if (stipple != NULL) - { - container->details->dnd_info->stipple = g_object_ref (stipple); - } } void @@ -2112,11 +2075,6 @@ caja_icon_dnd_fini (CajaIconContainer *container) { stop_auto_scroll (container); - if (container->details->dnd_info->stipple != NULL) - { - g_object_unref (container->details->dnd_info->stipple); - } - caja_drag_finalize (&container->details->dnd_info->drag_info); container->details->dnd_info = NULL; } diff --git a/libcaja-private/caja-icon-dnd.h b/libcaja-private/caja-icon-dnd.h index 1070c41f..6cf14aa0 100644 --- a/libcaja-private/caja-icon-dnd.h +++ b/libcaja-private/caja-icon-dnd.h @@ -39,19 +39,13 @@ typedef struct gboolean highlighted; - /* Stipple for drawing icon shadows during DnD. */ - GdkBitmap *stipple; - /* Shadow for the icons being dragged. */ EelCanvasItem *shadow; } CajaIconDndInfo; -void caja_icon_dnd_init (CajaIconContainer *container, - GdkBitmap *stipple); +void caja_icon_dnd_init (CajaIconContainer *container); void caja_icon_dnd_fini (CajaIconContainer *container); -void caja_icon_dnd_set_stipple (CajaIconContainer *container, - GdkBitmap *stipple); void caja_icon_dnd_begin_drag (CajaIconContainer *container, GdkDragAction actions, gint button, diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c index e504a557..5d783877 100644 --- a/libcaja-private/caja-icon-info.c +++ b/libcaja-private/caja-icon-info.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* caja-icon-info.c * Copyright (C) 2007 Red Hat, Inc., Alexander Larsson <[email protected]> * @@ -20,6 +21,7 @@ #include <config.h> #include <string.h> #include "caja-icon-info.h" +#include "caja-icon-names.h" #include "caja-default-file-icon.h" #include <gtk/gtk.h> #include <gio/gio.h> @@ -757,3 +759,49 @@ caja_icon_get_emblem_size_for_icon_size (guint size) return 0; /* no emblems for smaller sizes */ } + +gboolean +caja_icon_theme_can_render (GThemedIcon *icon) +{ + GtkIconTheme *icon_theme; + const gchar * const *names; + gint idx; + + names = g_themed_icon_get_names (icon); + + icon_theme = gtk_icon_theme_get_default (); + + for (idx = 0; names[idx] != NULL; idx++) { + if (gtk_icon_theme_has_icon (icon_theme, names[idx])) { + return TRUE; + } + } + + return FALSE; +} + +GIcon * +caja_user_special_directory_get_gicon (GUserDirectory directory) +{ + + #define ICON_CASE(x) \ + case G_USER_DIRECTORY_ ## x:\ + return g_themed_icon_new (CAJA_ICON_FOLDER_ ## x); + + switch (directory) { + + ICON_CASE (DESKTOP); + ICON_CASE (DOCUMENTS); + ICON_CASE (DOWNLOAD); + ICON_CASE (MUSIC); + ICON_CASE (PICTURES); + ICON_CASE (PUBLIC_SHARE); + ICON_CASE (TEMPLATES); + ICON_CASE (VIDEOS); + + default: + return g_themed_icon_new ("folder"); + } + + #undef ICON_CASE +} diff --git a/libcaja-private/caja-icon-info.h b/libcaja-private/caja-icon-info.h index 7c2a75d2..d4523d1a 100644 --- a/libcaja-private/caja-icon-info.h +++ b/libcaja-private/caja-icon-info.h @@ -90,6 +90,10 @@ extern "C" { gint caja_get_icon_size_for_stock_size (GtkIconSize size); guint caja_icon_get_emblem_size_for_icon_size (guint size); +gboolean caja_icon_theme_can_render (GThemedIcon *icon); +GIcon * caja_user_special_directory_get_gicon (GUserDirectory directory); + + #ifdef __cplusplus } diff --git a/libcaja-private/caja-icon-names.h b/libcaja-private/caja-icon-names.h index d0598749..20aee326 100644 --- a/libcaja-private/caja-icon-names.h +++ b/libcaja-private/caja-icon-names.h @@ -20,6 +20,15 @@ #define CAJA_ICON_EMBLEM_UNREADABLE "emblem-unreadable" #define CAJA_ICON_EMBLEM_SYMLINK "emblem-symbolic-link" +#define CAJA_ICON_FOLDER_DESKTOP "user-desktop" +#define CAJA_ICON_FOLDER_DOCUMENTS "folder-documents" +#define CAJA_ICON_FOLDER_DOWNLOAD "folder-download" +#define CAJA_ICON_FOLDER_MUSIC "folder-music" +#define CAJA_ICON_FOLDER_PICTURES "folder-pictures" +#define CAJA_ICON_FOLDER_PUBLIC_SHARE "folder-publicshare" +#define CAJA_ICON_FOLDER_TEMPLATES "folder-templates" +#define CAJA_ICON_FOLDER_VIDEOS "folder-videos" + /* Other icons */ #define CAJA_ICON_TEMPLATE "text-x-generic-template" diff --git a/libcaja-private/caja-icon-private.h b/libcaja-private/caja-icon-private.h index 8258ca15..cf7ef592 100644 --- a/libcaja-private/caja-icon-private.h +++ b/libcaja-private/caja-icon-private.h @@ -219,7 +219,6 @@ struct CajaIconContainerDetails guint32 normal_icon_color_rgba; /* colors for text labels */ - GdkGC *label_gcs [LAST_LABEL_COLOR]; GdkColor label_colors [LAST_LABEL_COLOR]; /* State used so arrow keys don't wander if icons aren't lined up. @@ -327,10 +326,10 @@ gboolean caja_icon_container_scroll (CajaIconContainer void caja_icon_container_update_scroll_region (CajaIconContainer *container); /* label color for items */ -GdkGC *caja_icon_container_get_label_color_and_gc (CajaIconContainer *container, +void caja_icon_container_get_label_color (CajaIconContainer *container, GdkColor **color, gboolean first_line, gboolean needs_highlight, - gboolean is_prelit); + gboolean is_prelit); #endif /* CAJA_ICON_CONTAINER_PRIVATE_H */ diff --git a/libcaja-private/caja-iso9660.h b/libcaja-private/caja-iso9660.h deleted file mode 100644 index d8352cc2..00000000 --- a/libcaja-private/caja-iso9660.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Header file iso9660.h - assorted structure definitions and typecasts. - * specific to iso9660 filesystem. - - Written by Eric Youngdale (1993). - - Copyright 1993 Yggdrasil Computing, Incorporated - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _ISOFS_FS_H -#define _ISOFS_FS_H - -/* - * The isofs filesystem constants/structures - */ - -#define ISODCL(from, to) (to - from + 1) - -struct iso_volume_descriptor -{ - char type[ISODCL(1,1)]; /* 711 */ - char id[ISODCL(2,6)]; - char version[ISODCL(7,7)]; - char data[ISODCL(8,2048)]; -}; - -/* volume descriptor types */ -#define ISO_VD_PRIMARY 1 -#define ISO_VD_END 255 - -#define ISO_STANDARD_ID "CD001" - -struct iso_primary_descriptor -{ - char type [ISODCL ( 1, 1)]; /* 711 */ - char id [ISODCL ( 2, 6)]; - char version [ISODCL ( 7, 7)]; /* 711 */ - char unused1 [ISODCL ( 8, 8)]; - char system_id [ISODCL ( 9, 40)]; /* achars */ - char volume_id [ISODCL ( 41, 72)]; /* dchars */ - char unused2 [ISODCL ( 73, 80)]; - char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ - char unused3 [ISODCL ( 89, 120)]; - char volume_set_size [ISODCL (121, 124)]; /* 723 */ - char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ - char logical_block_size [ISODCL (129, 132)]; /* 723 */ - char path_table_size [ISODCL (133, 140)]; /* 733 */ - char type_l_path_table [ISODCL (141, 144)]; /* 731 */ - char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ - char type_m_path_table [ISODCL (149, 152)]; /* 732 */ - char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ - char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ - char volume_set_id [ISODCL (191, 318)]; /* dchars */ - char publisher_id [ISODCL (319, 446)]; /* achars */ - char preparer_id [ISODCL (447, 574)]; /* achars */ - char application_id [ISODCL (575, 702)]; /* achars */ - char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ - char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ - char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ - char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ - char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ - char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ - char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ - char file_structure_version [ISODCL (882, 882)]; /* 711 */ - char unused4 [ISODCL (883, 883)]; - char application_data [ISODCL (884, 1395)]; - char unused5 [ISODCL (1396, 2048)]; -}; - -/* We use this to help us look up the parent inode numbers. */ - -struct iso_path_table -{ - unsigned char name_len[2]; /* 721 */ - char extent[4]; /* 731 */ - char parent[2]; /* 721 */ - char name[1]; -}; - -struct iso_directory_record -{ - unsigned char length [ISODCL (1, 1)]; /* 711 */ - char ext_attr_length [ISODCL (2, 2)]; /* 711 */ - char extent [ISODCL (3, 10)]; /* 733 */ - char size [ISODCL (11, 18)]; /* 733 */ - char date [ISODCL (19, 25)]; /* 7 by 711 */ - char flags [ISODCL (26, 26)]; - char file_unit_size [ISODCL (27, 27)]; /* 711 */ - char interleave [ISODCL (28, 28)]; /* 711 */ - char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ - unsigned char name_len [ISODCL (33, 33)]; /* 711 */ - char name [34]; /* Not really, but we need something here */ -}; -#endif - - - diff --git a/libcaja-private/caja-keep-last-vertical-box.c b/libcaja-private/caja-keep-last-vertical-box.c index 51c709ce..212fcc93 100644 --- a/libcaja-private/caja-keep-last-vertical-box.c +++ b/libcaja-private/caja-keep-last-vertical-box.c @@ -26,14 +26,13 @@ #include <config.h> #include "caja-keep-last-vertical-box.h" -#include <eel/eel-gtk-macros.h> - static void caja_keep_last_vertical_box_class_init (CajaKeepLastVerticalBoxClass *class); static void caja_keep_last_vertical_box_init (CajaKeepLastVerticalBox *box); static void caja_keep_last_vertical_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -EEL_CLASS_BOILERPLATE (CajaKeepLastVerticalBox, caja_keep_last_vertical_box, GTK_TYPE_VBOX) +G_DEFINE_TYPE (CajaKeepLastVerticalBox, caja_keep_last_vertical_box, GTK_TYPE_VBOX) +#define parent_class caja_keep_last_vertical_box_parent_class /* Standard class initialization function */ static void @@ -96,10 +95,10 @@ caja_keep_last_vertical_box_size_allocate (GtkWidget *widget, g_return_if_fail (CAJA_IS_KEEP_LAST_VERTICAL_BOX (widget)); g_return_if_fail (allocation != NULL); - EEL_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate, (widget, allocation)); + GTK_WIDGET_CLASS (caja_keep_last_vertical_box_parent_class)->size_allocate (widget, allocation); box = GTK_BOX (widget); - children = gtk_container_get_children (GTK_CONTAINER(widget)); + children = gtk_container_get_children (GTK_CONTAINER (widget)); l = g_list_last (children); if (l != NULL) diff --git a/libcaja-private/caja-marshal.c b/libcaja-private/caja-marshal.c deleted file mode 100644 index 59c9ddcc..00000000 --- a/libcaja-private/caja-marshal.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "caja-marshal.h" -#include "caja-marshal-guts.c" diff --git a/libcaja-private/caja-marshal.list b/libcaja-private/caja-marshal.list deleted file mode 100644 index 787dcc52..00000000 --- a/libcaja-private/caja-marshal.list +++ /dev/null @@ -1,23 +0,0 @@ -BOOLEAN:POINTER -BOOLEAN:VOID -INT:POINTER,BOOLEAN -INT:POINTER,INT -INT:POINTER,POINTER -OBJECT:BOXED -POINTER:VOID -STRING:VOID -VOID:DOUBLE -VOID:INT,BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN -VOID:INT,STRING -VOID:OBJECT,BOOLEAN -VOID:OBJECT,OBJECT -VOID:POINTER,ENUM -VOID:POINTER,POINTER -VOID:POINTER,POINTER -VOID:POINTER,POINTER,POINTER,ENUM,INT,INT -VOID:POINTER,STRING -VOID:POINTER,STRING,ENUM,INT,INT -VOID:STRING,STRING,ENUM,INT,INT -VOID:STRING,ENUM,INT,INT -VOID:STRING,STRING -VOID:POINTER,INT,STRING,STRING,ENUM,INT,INT diff --git a/libcaja-private/caja-merged-directory.c b/libcaja-private/caja-merged-directory.c index 0dc1b10c..a3e2a9b2 100644 --- a/libcaja-private/caja-merged-directory.c +++ b/libcaja-private/caja-merged-directory.c @@ -589,7 +589,8 @@ real_directory_notify_files_removed (CajaDirectory *real_directory) caja_directory_notify_files_removed_by_uri (files); } - eel_g_list_free_deep (files); + g_list_foreach(files, (GFunc) g_free, NULL); + g_list_free(files); } static void diff --git a/libcaja-private/caja-mime-actions.c b/libcaja-private/caja-mime-actions.c index 501263f0..4668e0ac 100644 --- a/libcaja-private/caja-mime-actions.c +++ b/libcaja-private/caja-mime-actions.c @@ -27,7 +27,6 @@ #include <eel/eel-glib-extensions.h> #include <eel/eel-stock-dialogs.h> -#include <eel/eel-alert-dialog.h> #include <eel/eel-string.h> #include <glib/gi18n.h> #include <glib/gstdio.h> @@ -231,7 +230,8 @@ static void application_launch_parameters_free (ApplicationLaunchParameters *parameters) { g_object_unref (parameters->application); - eel_g_list_free_deep (parameters->uris); + g_list_foreach(parameters->uris, (GFunc) g_free, NULL); + g_list_free(parameters->uris); g_free (parameters); } @@ -513,7 +513,8 @@ caja_mime_has_any_applications_for_file (CajaFile *file) if (apps) { result = TRUE; - eel_g_object_list_free (apps); + g_list_foreach(apps, (GFunc) g_object_unref, NULL); + g_list_free(apps); } else { @@ -734,7 +735,8 @@ trash_or_delete_files (GtkWindow *parent_window, caja_file_operations_trash_or_delete (locations, parent_window, NULL, NULL); - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); } static void @@ -794,7 +796,7 @@ report_broken_symbolic_link (GtkWindow *parent_window, CajaFile *file) */ response = gtk_dialog_run (dialog); - gtk_object_destroy (GTK_OBJECT (dialog)); + gtk_widget_destroy (GTK_WIDGET (dialog)); if (response == GTK_RESPONSE_YES) { @@ -861,7 +863,7 @@ get_executable_text_file_action (GtkWindow *parent_window, CajaFile *file) g_free (detail); response = gtk_dialog_run (dialog); - gtk_object_destroy (GTK_OBJECT (dialog)); + gtk_widget_destroy (GTK_WIDGET (dialog)); switch (response) { @@ -1224,7 +1226,7 @@ confirm_multiple_windows (GtkWindow *parent_window, g_free (detail); response = gtk_dialog_run (dialog); - gtk_object_destroy (GTK_OBJECT (dialog)); + gtk_widget_destroy (GTK_WIDGET (dialog)); return response == GTK_RESPONSE_YES; } @@ -1372,26 +1374,29 @@ show_unhandled_type_error (ActivateParametersInstall *parameters) char *mime_type = caja_file_get_mime_type (parameters->file); char *error_message = get_application_no_mime_type_handler_message (parameters->file, parameters->uri); - if (g_content_type_is_unknown (mime_type)) - { - dialog = eel_alert_dialog_new (parameters->parent_window, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - 0, - error_message, - _("The file is of an unknown type")); - } - else - { + if (g_content_type_is_unknown (mime_type)) { + dialog = gtk_message_dialog_new (parameters->parent_window, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + 0, + NULL); + g_object_set (dialog, + "text", error_message, + "secondary-text", _("The file is of an unknown type"), + NULL); + } else { char *text; text = g_strdup_printf (_("There is no application installed for %s files"), g_content_type_get_description (mime_type)); - dialog = eel_alert_dialog_new (parameters->parent_window, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - 0, - error_message, - text); + dialog = gtk_message_dialog_new (parameters->parent_window, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + 0, + NULL); + g_object_set (dialog, + "text", error_message, + "secondary-text", text, + NULL); g_free (text); } @@ -1734,12 +1739,15 @@ activate_desktop_file (ActivateParameters *parameters, ), display_name); - dialog = eel_alert_dialog_new (parameters->parent_window, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_NONE, - primary, - secondary); + dialog = gtk_message_dialog_new (parameters->parent_window, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + NULL); + g_object_set (dialog, + "text", primary, + "secondary-text", secondary, + NULL); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Launch Anyway"), RESPONSE_RUN); if (caja_file_can_set_permissions (file)) diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c index 3f458dba..dd8af544 100644 --- a/libcaja-private/caja-mime-application-chooser.c +++ b/libcaja-private/caja-mime-application-chooser.c @@ -32,8 +32,6 @@ #include "caja-signaller.h" #include "caja-file.h" #include <eel/eel-stock-dialogs.h> -#include <eel/eel-glib-extensions.h> -#include <eel/eel-string.h> #include <string.h> #include <glib/gi18n-lib.h> @@ -108,22 +106,12 @@ caja_mime_application_chooser_finalize (GObject *object) } static void -caja_mime_application_chooser_destroy (GtkObject *object) -{ - GTK_OBJECT_CLASS (caja_mime_application_chooser_parent_class)->destroy (object); -} - -static void caja_mime_application_chooser_class_init (CajaMimeApplicationChooserClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; gobject_class = G_OBJECT_CLASS (class); gobject_class->finalize = caja_mime_application_chooser_finalize; - - object_class = GTK_OBJECT_CLASS (class); - object_class->destroy = caja_mime_application_chooser_destroy; } static void @@ -575,7 +563,8 @@ refresh_model (CajaMimeApplicationChooser *chooser) g_object_unref (default_app); } - eel_g_object_list_free (applications); + g_list_foreach(applications, (GFunc) g_object_unref, NULL); + g_list_free(applications); } static void @@ -683,8 +672,7 @@ set_uri_and_type_for_multiple_files (CajaMimeApplicationChooser *chooser, char *extension_current; extension_current = get_extension_from_file (CAJA_FILE (iter->data)); - if (eel_strcmp (first_extension, extension_current)) - { + if (g_strcmp0 (first_extension, extension_current)) { same_extension = FALSE; g_free (extension_current); break; diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c index 8f236d5e..50ca03ef 100644 --- a/libcaja-private/caja-open-with-dialog.c +++ b/libcaja-private/caja-open-with-dialog.c @@ -29,7 +29,6 @@ #include "caja-open-with-dialog.h" #include "caja-signaller.h" -#include <eel/eel-glib-extensions.h> #include <eel/eel-stock-dialogs.h> #include <string.h> @@ -120,12 +119,6 @@ caja_open_with_dialog_finalize (GObject *object) G_OBJECT_CLASS (caja_open_with_dialog_parent_class)->finalize (object); } -static void -caja_open_with_dialog_destroy (GtkObject *object) -{ - GTK_OBJECT_CLASS (caja_open_with_dialog_parent_class)->destroy (object); -} - /* An application is valid if: * * 1) The file exists @@ -297,7 +290,8 @@ add_or_find_application (CajaOpenWithDialog *dialog) if (applications != NULL) { - eel_g_object_list_free (applications); + g_list_foreach(applications, (GFunc) g_object_unref, NULL); + g_list_free(applications); } } @@ -397,17 +391,13 @@ static void caja_open_with_dialog_class_init (CajaOpenWithDialogClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; gobject_class = G_OBJECT_CLASS (class); gobject_class->finalize = caja_open_with_dialog_finalize; - object_class = GTK_OBJECT_CLASS (class); - object_class->destroy = caja_open_with_dialog_destroy; - signals[APPLICATION_SELECTED] = g_signal_new ("application_selected", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CajaOpenWithDialogClass, application_selected), @@ -850,7 +840,6 @@ caja_open_with_dialog_init (CajaOpenWithDialog *dialog) dialog->details = g_new0 (CajaOpenWithDialogDetails, 1); gtk_window_set_title (GTK_WINDOW (dialog), _("Open With")); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c index a31746ec..f7b3fa42 100644 --- a/libcaja-private/caja-program-choosing.c +++ b/libcaja-private/caja-program-choosing.c @@ -31,10 +31,8 @@ #include "caja-icon-info.h" #include "caja-recent.h" #include "caja-desktop-icon-file.h" -#include <eel/eel-glib-extensions.h> #include <eel/eel-mate-extensions.h> #include <eel/eel-stock-dialogs.h> -#include <eel/eel-string.h> #include <gtk/gtk.h> #include <glib/gi18n.h> #include <gio/gio.h> @@ -98,7 +96,7 @@ application_cannot_open_location (GAppInfo *application, GTK_STOCK_CANCEL, parent_window); response = gtk_dialog_run (message_dialog); - gtk_object_destroy (GTK_OBJECT (message_dialog)); + gtk_widget_destroy (GTK_WIDGET (message_dialog)); if (response == GTK_RESPONSE_YES) { @@ -165,7 +163,8 @@ caja_launch_application (GAppInfo *application, uris = g_list_reverse (uris); caja_launch_application_by_uri (application, uris, parent_window); - eel_g_list_free_deep (uris); + g_list_foreach(uris, (GFunc) g_free, NULL); + g_list_free(uris); } void @@ -274,7 +273,8 @@ caja_launch_application_by_uri (GAppInfo *application, } } - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); } /** @@ -450,7 +450,8 @@ caja_launch_desktop_file (GdkScreen *screen, " drop them again."), parent_window); - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); g_object_unref (app_info); return; } @@ -502,7 +503,8 @@ caja_launch_desktop_file (GdkScreen *screen, g_free (message); } - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); g_object_unref (context); g_object_unref (app_info); } diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c index b547ead8..789b5de0 100644 --- a/libcaja-private/caja-progress-info.c +++ b/libcaja-private/caja-progress-info.c @@ -26,9 +26,9 @@ #include <math.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <eel/eel-string.h> #include <eel/eel-glib-extensions.h> #include "caja-progress-info.h" +#include <string.h> enum { @@ -800,7 +800,7 @@ caja_progress_info_take_status (CajaProgressInfo *info, { G_LOCK (progress_info); - if (eel_strcmp (info->status, status) != 0) + if (g_strcmp0 (info->status, status) != 0) { g_free (info->status); info->status = status; @@ -822,7 +822,7 @@ caja_progress_info_set_status (CajaProgressInfo *info, { G_LOCK (progress_info); - if (eel_strcmp (info->status, status) != 0) + if (g_strcmp0 (info->status, status) != 0) { g_free (info->status); info->status = g_strdup (status); @@ -841,7 +841,7 @@ caja_progress_info_take_details (CajaProgressInfo *info, { G_LOCK (progress_info); - if (eel_strcmp (info->details, details) != 0) + if (g_strcmp0 (info->details, details) != 0) { g_free (info->details); info->details = details; @@ -863,7 +863,7 @@ caja_progress_info_set_details (CajaProgressInfo *info, { G_LOCK (progress_info); - if (eel_strcmp (info->details, details) != 0) + if (g_strcmp0 (info->details, details) != 0) { g_free (info->details); info->details = g_strdup (details); diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c index 42804eda..9c6044af 100644 --- a/libcaja-private/caja-query.c +++ b/libcaja-private/caja-query.c @@ -118,7 +118,10 @@ caja_query_get_mime_types (CajaQuery *query) void caja_query_set_mime_types (CajaQuery *query, GList *mime_types) { - eel_g_list_free_deep (query->details->mime_types); + g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL); + g_list_free(query->details->mime_types); + g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL); + g_list_free(query->details->mime_types); query->details->mime_types = eel_g_str_list_copy (mime_types); } diff --git a/libcaja-private/caja-search-engine-beagle.c b/libcaja-private/caja-search-engine-beagle.c index 0a2c34ff..6e59b060 100644 --- a/libcaja-private/caja-search-engine-beagle.c +++ b/libcaja-private/caja-search-engine-beagle.c @@ -25,7 +25,6 @@ #include "caja-search-engine-beagle.h" #include <eel/eel-gtk-macros.h> -#include <eel/eel-glib-extensions.h> #include <gmodule.h> typedef struct _BeagleHit BeagleHit; @@ -342,7 +341,8 @@ caja_search_engine_beagle_start (CajaSearchEngine *engine) /* These must live during the lifetime of the query */ g_free (text); - eel_g_list_free_deep (mimetypes); + g_list_foreach(mimetypes, (GFunc) g_free, NULL); + g_list_free(mimetypes); } static void diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c index 5e906334..cf50497f 100644 --- a/libcaja-private/caja-search-engine-simple.c +++ b/libcaja-private/caja-search-engine-simple.c @@ -28,7 +28,6 @@ #include <glib.h> #include <eel/eel-gtk-macros.h> -#include <eel/eel-glib-extensions.h> #include <gio/gio.h> #define BATCH_SIZE 500 @@ -138,8 +137,10 @@ search_thread_data_free (SearchThreadData *data) g_hash_table_destroy (data->visited); g_object_unref (data->cancellable); g_strfreev (data->words); - eel_g_list_free_deep (data->mime_types); - eel_g_list_free_deep (data->uri_hits); + g_list_foreach(data->mime_types, (GFunc) g_free, NULL); + g_list_free(data->mime_types); + g_list_foreach(data->uri_hits, (GFunc) g_free, NULL); + g_list_free(data->uri_hits); g_free (data); } @@ -181,7 +182,8 @@ search_thread_add_hits_idle (gpointer user_data) hits->uris); } - eel_g_list_free_deep (hits->uris); + g_list_foreach(hits->uris, (GFunc) g_free, NULL); + g_list_free(hits->uris); g_free (hits); return FALSE; diff --git a/libcaja-private/caja-search-engine-tracker.c b/libcaja-private/caja-search-engine-tracker.c index ea56a924..e47af045 100644 --- a/libcaja-private/caja-search-engine-tracker.c +++ b/libcaja-private/caja-search-engine-tracker.c @@ -24,7 +24,6 @@ #include <config.h> #include "caja-search-engine-tracker.h" #include <eel/eel-gtk-macros.h> -#include <eel/eel-glib-extensions.h> #include <gmodule.h> #include <string.h> @@ -462,7 +461,8 @@ caja_search_engine_tracker_start (CajaSearchEngine *engine) tracker->details->query_pending = TRUE; g_free (search_text); - eel_g_list_free_deep (mimetypes); + g_list_foreach(mimetypes, (GFunc) g_free, NULL); + g_list_free(mimetypes); } static void diff --git a/libcaja-private/caja-thumbnails.c b/libcaja-private/caja-thumbnails.c index ef62edba..cbb5f7dc 100644 --- a/libcaja-private/caja-thumbnails.c +++ b/libcaja-private/caja-thumbnails.c @@ -277,6 +277,8 @@ thumbnail_thread_notify_file_changed (gpointer image_uri) { CajaFile *file; + gdk_threads_enter (); + 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); @@ -292,6 +294,8 @@ thumbnail_thread_notify_file_changed (gpointer image_uri) } g_free (image_uri); + gdk_threads_leave (); + return FALSE; } diff --git a/libcaja-private/caja-tree-view-drag-dest.c b/libcaja-private/caja-tree-view-drag-dest.c index 1c25c452..56e9a1cd 100644 --- a/libcaja-private/caja-tree-view-drag-dest.c +++ b/libcaja-private/caja-tree-view-drag-dest.c @@ -110,9 +110,9 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view) window = gtk_tree_view_get_bin_window (tree_view); #if GTK_CHECK_VERSION(3, 0, 0) - vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(tree_view)); + vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(tree_view)); #else - vadjustment = gtk_tree_view_get_vadjustment(tree_view); + vadjustment = gtk_tree_view_get_vadjustment (tree_view); #endif gdk_window_get_pointer (window, NULL, &y, NULL); @@ -186,35 +186,42 @@ 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_widget_is_drawable (widget)) - { - bin_window = - gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)); + /* FIXMEchpe: is bin window right here??? */ + bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)); #if GTK_CHECK_VERSION(3, 0, 0) - width = gdk_window_get_width(GDK_WINDOW(bin_window)); - height = gdk_window_get_height(GDK_WINDOW(bin_window)); + width = gdk_window_get_width(bin_window); + height = gdk_window_get_height(bin_window); #else - gdk_drawable_get_size(bin_window, &width, &height); + gdk_drawable_get_size(bin_window, &width, &height); #endif - - gtk_paint_focus (gtk_widget_get_style (widget), - bin_window, - gtk_widget_get_state (widget), - NULL, - widget, - "treeview-drop-indicator", - 0, 0, width, height); - } + gtk_paint_focus (gtk_widget_get_style (widget), +#if GTK_CHECK_VERSION(3,0,0) + cr, + gtk_widget_get_state (widget), +#else + bin_window, + gtk_widget_get_state (widget), + NULL, +#endif + widget, + "treeview-drop-indicator", + 0, 0, width, height); return FALSE; } @@ -234,8 +241,13 @@ 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)); } diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c index 465e35e1..0a19934e 100644 --- a/libcaja-private/caja-undostack-manager.c +++ b/libcaja-private/caja-undostack-manager.c @@ -33,7 +33,6 @@ #include <glib/gi18n.h> #include <locale.h> #include <gdk/gdk.h> -#include <eel/eel-glib-extensions.h> /* ***************************************************************** Private fields @@ -432,7 +431,8 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_copy (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_CREATEFILEFROMTEMPLATE: puri = get_uri_parent (action->target_uri); @@ -448,14 +448,16 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_duplicate (uris, NULL, NULL, undo_redo_done_transfer_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_RESTOREFROMTRASH: case CAJA_UNDOSTACK_MOVE: uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_move (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_RENAME: new_name = get_uri_basename (action->new_uri); @@ -489,14 +491,16 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, caja_file_operations_trash_or_delete (uris, NULL, undo_redo_done_delete_callback, action); g_list_free (uri_to_trash); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); } break; case CAJA_UNDOSTACK_CREATELINK: uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_link (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_SETPERMISSIONS: file = caja_file_get_by_uri (action->target_uri); @@ -579,7 +583,8 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, if (priv->confirm_delete) { caja_file_operations_delete (uris, NULL, undo_redo_done_delete_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); } else { /* We skip the confirmation message */ @@ -600,7 +605,8 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->destinations, action->dest_dir); caja_file_operations_trash_or_delete (uris, NULL, undo_redo_done_delete_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_MOVETOTRASH: files_to_restore = retrieve_files_to_restore (action->trashed); @@ -630,7 +636,8 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->destinations, action->dest_dir); caja_file_operations_move (uris, NULL, action->src_dir, NULL, undo_redo_done_transfer_callback, action); - eel_g_object_list_free (uris); + g_list_foreach(uris, (GFunc) g_object_unref, NULL); + g_list_free(uris); break; case CAJA_UNDOSTACK_RENAME: new_name = get_uri_basename (action->old_uri); diff --git a/libcaja-private/caja-window-info.h b/libcaja-private/caja-window-info.h index fb39c73f..7cced147 100644 --- a/libcaja-private/caja-window-info.h +++ b/libcaja-private/caja-window-info.h @@ -28,7 +28,6 @@ #include <glib-object.h> #include <libcaja-private/caja-view.h> #include <gtk/gtk.h> -#include "../src/caja-bookmark-list.h" #ifdef __cplusplus extern "C" { @@ -89,6 +88,10 @@ extern "C" { typedef struct _CajaWindowInfoIface CajaWindowInfoIface; + typedef void (* CajaWindowGoToCallback) (CajaWindow *window, + GError *error, + gpointer user_data); + struct _CajaWindowInfoIface { GTypeInterface g_iface; diff --git a/libcaja-private/caja-window-slot-info.c b/libcaja-private/caja-window-slot-info.c index f0193980..01a38a80 100644 --- a/libcaja-private/caja-window-slot-info.c +++ b/libcaja-private/caja-window-slot-info.c @@ -108,11 +108,13 @@ caja_window_slot_info_make_hosting_pane_active (CajaWindowSlotInfo *slot) } void -caja_window_slot_info_open_location (CajaWindowSlotInfo *slot, +caja_window_slot_info_open_location_full (CajaWindowSlotInfo *slot, GFile *location, - CajaWindowOpenMode mode, - CajaWindowOpenFlags flags, - GList *selection) + CajaWindowOpenMode mode, + CajaWindowOpenFlags flags, + GList *selection, + CajaWindowGoToCallback callback, + gpointer user_data) { g_assert (CAJA_IS_WINDOW_SLOT_INFO (slot)); @@ -120,7 +122,9 @@ caja_window_slot_info_open_location (CajaWindowSlotInfo *slot, location, mode, flags, - selection); + selection, + callback, + user_data); } char * diff --git a/libcaja-private/caja-window-slot-info.h b/libcaja-private/caja-window-slot-info.h index 2d8b21d2..49804820 100644 --- a/libcaja-private/caja-window-slot-info.h +++ b/libcaja-private/caja-window-slot-info.h @@ -72,18 +72,27 @@ struct _CajaWindowSlotInfoIface GFile *location, CajaWindowOpenMode mode, CajaWindowOpenFlags flags, - GList *selection); + GList *selection, + CajaWindowGoToCallback callback, + gpointer user_data); void (* make_hosting_pane_active) (CajaWindowSlotInfo *slot); }; GType caja_window_slot_info_get_type (void); CajaWindowInfo * caja_window_slot_info_get_window (CajaWindowSlotInfo *slot); -void caja_window_slot_info_open_location (CajaWindowSlotInfo *slot, +#define caja_window_slot_info_open_location(slot, location, mode, flags, selection) \ + caja_window_slot_info_open_location_full(slot, location, mode, \ + flags, selection, NULL, NULL) + +void caja_window_slot_info_open_location_full + (CajaWindowSlotInfo *slot, GFile *location, - CajaWindowOpenMode mode, - CajaWindowOpenFlags flags, - GList *selection); + CajaWindowOpenMode mode, + CajaWindowOpenFlags flags, + GList *selection, + CajaWindowGoToCallback callback, + gpointer user_data); void caja_window_slot_info_set_status (CajaWindowSlotInfo *slot, const char *status); void caja_window_slot_info_make_hosting_pane_active (CajaWindowSlotInfo *slot); |