diff options
Diffstat (limited to 'src/file-manager')
-rw-r--r-- | src/file-manager/Makefile.am | 37 | ||||
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 63 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 94 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 36 | ||||
-rw-r--r-- | src/file-manager/fm-list-model.c | 158 | ||||
-rw-r--r-- | src/file-manager/fm-list-model.h | 9 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 30 | ||||
-rw-r--r-- | src/file-manager/fm-properties-window.c | 163 | ||||
-rw-r--r-- | src/file-manager/fm-tree-model.c | 132 | ||||
-rw-r--r-- | src/file-manager/fm-tree-model.h | 1 | ||||
-rw-r--r-- | src/file-manager/fm-tree-view.c | 16 |
11 files changed, 391 insertions, 348 deletions
diff --git a/src/file-manager/Makefile.am b/src/file-manager/Makefile.am index e73afbed..a08d01ad 100644 --- a/src/file-manager/Makefile.am +++ b/src/file-manager/Makefile.am @@ -12,6 +12,11 @@ INCLUDES = \ $(DISABLE_DEPRECATED_CFLAGS) \ $(NULL) +BUILT_SOURCES = \ + fm-marshal.c \ + fm-marshal.h \ + $(NULL) + libcaja_file_manager_la_SOURCES = \ fm-actions.h \ fm-desktop-icon-view.c \ @@ -40,6 +45,28 @@ libcaja_file_manager_la_SOURCES = \ caja-audio-mime-types.h \ $(NULL) +nodist_libcaja_file_manager_la_SOURCES=\ + $(BUILT_SOURCES) \ + $(NULL) + +fm-marshal.list: $(libcaja_file_manager_la_SOURCES) Makefile.am + $(AM_V_GEN)( cd $(srcdir) && \ + sed -n -e 's/.*fm_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \ + $(libcaja_file_manager_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.c: %-marshal.list Makefile + $(AM_V_GEN)echo "#include \"fm-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c + +%-marshal.h: %-marshal.list Makefile + $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h + EMPTY_VIEW_SOURCES = \ fm-empty-view.c \ fm-empty-view.h @@ -56,4 +83,12 @@ ui_DATA = \ caja-list-view-ui.xml \ $(NULL) -EXTRA_DIST = $(ui_DATA) +EXTRA_DIST = \ + $(ui_DATA) \ + fm-marshal.list + +CLEANFILES = \ + $(BUILT_SOURCES) \ + fm-marshal.list \ + $(NULL) + diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index ae9e4c02..3885ca13 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -31,13 +31,8 @@ #include <X11/Xatom.h> #include <gtk/gtk.h> -#include <dirent.h> #include <eel/eel-glib-extensions.h> -#include <eel/eel-mate-extensions.h> #include <eel/eel-gtk-extensions.h> -#include <eel/eel-gtk-macros.h> -#include <eel/eel-stock-dialogs.h> -#include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> #include <fcntl.h> #include <gdk/gdkx.h> @@ -64,6 +59,12 @@ #include <sys/types.h> #include <unistd.h> +#if !GTK_CHECK_VERSION(3, 0, 0) +#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment +#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment +#define GTK_SCROLLABLE GTK_LAYOUT +#endif + /* Timeout to check the desktop directory for updates */ #define RESCAN_TIMEOUT 4 @@ -80,8 +81,6 @@ struct FMDesktopIconViewDetails gboolean pending_rescan; }; -static void fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view); -static void fm_desktop_icon_view_class_init (FMDesktopIconViewClass *klass); static void default_zoom_level_changed (gpointer user_data); static gboolean real_supports_auto_layout (FMIconView *view); static gboolean real_supports_scaling (FMIconView *view); @@ -93,9 +92,7 @@ static gboolean real_supports_zooming (FMDirectoryVi static void fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *view); static void font_changed_callback (gpointer callback_data); -EEL_CLASS_BOILERPLATE (FMDesktopIconView, - fm_desktop_icon_view, - FM_TYPE_ICON_VIEW) +G_DEFINE_TYPE (FMDesktopIconView, fm_desktop_icon_view, FM_TYPE_ICON_VIEW) static char *desktop_directory; static time_t desktop_dir_modify_time; @@ -226,7 +223,7 @@ net_workarea_changed (FMDesktopIconView *icon_view, } else { - screen = gdk_drawable_get_screen (GDK_DRAWABLE (window)); + screen = gdk_window_get_screen (window); icon_container_set_workarea ( icon_container, screen, workareas, length_returned / sizeof (long)); @@ -263,7 +260,7 @@ desktop_icon_view_property_filter (GdkXEvent *gdk_xevent, } static void -fm_desktop_icon_view_destroy (GtkObject *object) +fm_desktop_icon_view_dispose (GObject *object) { FMDesktopIconView *icon_view; GtkUIManager *ui_manager; @@ -285,16 +282,6 @@ fm_desktop_icon_view_destroy (GtkObject *object) &icon_view->details->desktop_action_group); } - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -fm_desktop_icon_view_finalize (GObject *object) -{ - FMDesktopIconView *icon_view; - - icon_view = FM_DESKTOP_ICON_VIEW (object); - g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, default_zoom_level_changed, icon_view); @@ -309,17 +296,13 @@ fm_desktop_icon_view_finalize (GObject *object) desktop_directory_changed_callback, NULL); - g_free (icon_view->details); - - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (fm_desktop_icon_view_parent_class)->dispose (object); } static void fm_desktop_icon_view_class_init (FMDesktopIconViewClass *class) { - G_OBJECT_CLASS (class)->finalize = fm_desktop_icon_view_finalize; - - GTK_OBJECT_CLASS (class)->destroy = fm_desktop_icon_view_destroy; + G_OBJECT_CLASS (class)->dispose = fm_desktop_icon_view_dispose; FM_DIRECTORY_VIEW_CLASS (class)->merge_menus = real_merge_menus; FM_DIRECTORY_VIEW_CLASS (class)->update_menus = real_update_menus; @@ -329,6 +312,8 @@ fm_desktop_icon_view_class_init (FMDesktopIconViewClass *class) FM_ICON_VIEW_CLASS (class)->supports_scaling = real_supports_scaling; FM_ICON_VIEW_CLASS (class)->supports_keep_aligned = real_supports_keep_aligned; FM_ICON_VIEW_CLASS (class)->supports_labels_beside_icons = real_supports_labels_beside_icons; + + g_type_class_add_private (class, sizeof (FMDesktopIconViewDetails)); } static void @@ -352,7 +337,7 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, /* build an X event to represent the middle click. */ x_event.type = ButtonPress; x_event.send_event = True; - x_event.display = GDK_DISPLAY (); + x_event.display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); x_event.window = GDK_ROOT_WINDOW (); x_event.root = GDK_ROOT_WINDOW (); x_event.subwindow = 0; @@ -366,7 +351,7 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, x_event.same_screen = True; /* Send it to the root window, the window manager will handle it. */ - XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), True, + XSendEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), True, ButtonPressMask, (XEvent *) &x_event); } @@ -481,7 +466,8 @@ do_desktop_rescan (gpointer data) } static void -done_loading (GtkObject *DirectoryView, FMDesktopIconView *desktop_icon_view) +done_loading (CajaDirectory *model, + FMDesktopIconView *desktop_icon_view) { struct stat buf; @@ -547,6 +533,10 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) GtkAllocation allocation; GtkAdjustment *hadj, *vadj; + desktop_icon_view->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_icon_view, + FM_TYPE_DESKTOP_ICON_VIEW, + FMDesktopIconViewDetails); + if (desktop_directory == NULL) { g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, @@ -560,9 +550,6 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) caja_icon_container_set_use_drop_shadows (icon_container, TRUE); fm_icon_container_set_sort_desktop (FM_ICON_CONTAINER (icon_container), TRUE); - /* Set up details */ - desktop_icon_view->details = g_new0 (FMDesktopIconViewDetails, 1); - /* Do a reload on the desktop if we don't have FAM, a smarter * way to keep track of the items on the desktop. */ @@ -585,8 +572,8 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) gtk_widget_queue_resize (GTK_WIDGET (icon_container)); - hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (icon_container)); - vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (icon_container)); + hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (icon_container)); + vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (icon_container)); eel_gtk_adjustment_set_value (hadj, 0); eel_gtk_adjustment_set_value (vadj, 0); @@ -716,7 +703,7 @@ real_update_menus (FMDirectoryView *view) g_assert (FM_IS_DESKTOP_ICON_VIEW (view)); - EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, update_menus, (view)); + FM_DIRECTORY_VIEW_CLASS (fm_desktop_icon_view_parent_class)->update_menus (view); desktop_view = FM_DESKTOP_ICON_VIEW (view); @@ -782,7 +769,7 @@ real_merge_menus (FMDirectoryView *view) GtkActionGroup *action_group; const char *ui; - EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, merge_menus, (view)); + FM_DIRECTORY_VIEW_CLASS (fm_desktop_icon_view_parent_class)->merge_menus (view); desktop_view = FM_DESKTOP_ICON_VIEW (view); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 55b1e5bb..c40a40ba 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -35,6 +35,7 @@ #include "fm-actions.h" #include "fm-error-reporting.h" +#include "fm-marshal.h" #include "fm-properties-window.h" #include "libcaja-private/caja-open-with-dialog.h" @@ -46,7 +47,6 @@ #include <eel/eel-stock-dialogs.h> #include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> -#include <eel/eel-marshal.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include <glib/gi18n.h> @@ -71,7 +71,6 @@ #include <libcaja-private/caja-file-private.h> /* for caja_file_get_existing_by_uri */ #include <libcaja-private/caja-global-preferences.h> #include <libcaja-private/caja-link.h> -#include <libcaja-private/caja-marshal.h> #include <libcaja-private/caja-metadata.h> #include <libcaja-private/caja-mime-actions.h> #include <libcaja-private/caja-module.h> @@ -660,7 +659,7 @@ fm_directory_view_confirm_multiple (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; } @@ -1026,7 +1025,8 @@ delete_selected_files (FMDirectoryView *view) caja_file_operations_delete (locations, fm_directory_view_get_containing_window (view), NULL, NULL); - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); caja_file_list_free (selection); } @@ -1204,7 +1204,6 @@ select_pattern (FMDirectoryView *view) NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); @@ -1334,7 +1333,7 @@ action_save_search_as_callback (GtkAction *action, dialog = gtk_dialog_new_with_buttons (_("Save Search as"), fm_directory_view_get_containing_window (directory_view), - GTK_DIALOG_NO_SEPARATOR, + 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); save_button = gtk_dialog_add_button (GTK_DIALOG (dialog), @@ -1936,7 +1935,8 @@ fm_directory_view_set_selection_locations (CajaView *caja_view, /* If we are still loading, set the list of pending URIs instead. * done_loading() will eventually select the pending URIs and reveal them. */ - eel_g_object_list_free (view->details->pending_locations_selected); + g_list_foreach(view->details->pending_locations_selected, (GFunc) g_object_unref, NULL); + g_list_free(view->details->pending_locations_selected); view->details->pending_locations_selected = eel_g_object_list_copy (selection_locations); } @@ -2098,7 +2098,11 @@ real_unmerge_menus (FMDirectoryView *view) } static void +#if GTK_CHECK_VERSION (3, 0, 0) +fm_directory_view_destroy (GtkWidget *object) +#else fm_directory_view_destroy (GtkObject *object) +#endif { FMDirectoryView *view; GList *node, *next; @@ -2159,7 +2163,11 @@ fm_directory_view_destroy (GtkObject *object) view->details->directory_as_file = NULL; } +#if GTK_CHECK_VERSION (3, 0, 0) + EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object)); +#else EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); +#endif } static void @@ -2170,17 +2178,17 @@ fm_directory_view_finalize (GObject *object) view = FM_DIRECTORY_VIEW (object); g_signal_handlers_disconnect_by_func (caja_preferences, - schedule_update_menus_callback, view); + schedule_update_menus_callback, view); g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, - text_attribute_names_changed_callback, view); + text_attribute_names_changed_callback, view); g_signal_handlers_disconnect_by_func (caja_preferences, - image_display_policy_changed_callback, view); + image_display_policy_changed_callback, view); g_signal_handlers_disconnect_by_func (caja_preferences, - click_policy_changed_callback, view); + click_policy_changed_callback, view); g_signal_handlers_disconnect_by_func (caja_preferences, - sort_directories_first_changed_callback, view); + sort_directories_first_changed_callback, view); g_signal_handlers_disconnect_by_func (mate_lockdown_preferences, - schedule_update_menus, view); + schedule_update_menus, view); unschedule_pop_up_location_context_menu (view); if (view->details->location_popup_event != NULL) { @@ -2542,7 +2550,8 @@ done_loading (FMDirectoryView *view, fm_directory_view_reveal_selection (view); } } - eel_g_object_list_free (locations_selected); + g_list_foreach(locations_selected, (GFunc) g_object_unref, NULL); + g_list_free(locations_selected); fm_directory_view_display_selection_info (view); } @@ -2740,7 +2749,7 @@ copy_move_done_callback (GHashTable *debuting_files, gpointer data) * operate on. The ADD_FILE signal is registered as G_SIGNAL_RUN_LAST, so we * must use connect_after. */ - g_signal_connect_data (GTK_OBJECT (directory_view), + g_signal_connect_data (directory_view, "add_file", G_CALLBACK (debuting_files_add_file_callback), debuting_files_data, @@ -3784,7 +3793,8 @@ fm_directory_view_create_links_for_files (FMDirectoryView *view, GList *files, caja_file_operations_copy_move (uris, relative_item_points, dir_uri, GDK_ACTION_LINK, GTK_WIDGET (view), copy_move_done_callback, copy_move_done_data); g_free (dir_uri); - eel_g_list_free_deep (uris); + g_list_foreach(uris, (GFunc) g_free, NULL); + g_list_free(uris); } static void @@ -3816,7 +3826,8 @@ fm_directory_view_duplicate_selection (FMDirectoryView *view, GList *files, copy_move_done_data = pre_copy_move (view); caja_file_operations_copy_move (uris, relative_item_points, NULL, GDK_ACTION_COPY, GTK_WIDGET (view), copy_move_done_callback, copy_move_done_data); - eel_g_list_free_deep (uris); + g_list_foreach(uris, (GFunc) g_free, NULL); + g_list_free(uris); } /* special_link_in_selection @@ -3920,7 +3931,8 @@ trash_or_delete_files (GtkWindow *parent_window, parent_window, (CajaDeleteCallback) trash_or_delete_done_cb, view); - eel_g_object_list_free (locations); + g_list_foreach(locations, (GFunc) g_object_unref, NULL); + g_list_free(locations); } static gboolean @@ -4669,7 +4681,8 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection) index, menu_path, popup_path, submenu_visible); } - eel_g_object_list_free (applications); + g_list_foreach(applications, (GFunc) g_object_unref, NULL); + g_list_free(applications); if (default_app != NULL) { g_object_unref (default_app); } @@ -5964,7 +5977,8 @@ move_copy_selection_to_location (FMDirectoryView *view, 0, 0, view); - eel_g_list_free_deep (uris); + g_list_foreach(uris, (GFunc) g_free, NULL); + g_list_free(uris); caja_file_list_free (selection); } @@ -6104,7 +6118,10 @@ paste_clipboard_data (FMDirectoryView *view, gtk_clipboard_clear (caja_clipboard_get (GTK_WIDGET (view))); } - eel_g_list_free_deep (item_uris); + g_list_foreach(item_uris, (GFunc) g_free, NULL); + g_list_free(item_uris); + g_list_foreach(item_uris, (GFunc) g_free, NULL); + g_list_free(item_uris); } } @@ -6901,7 +6918,7 @@ action_connect_to_server_link_callback (GtkAction *action, title = g_strdup_printf (_("Connect to Server %s"), name); dialog = gtk_dialog_new_with_buttons (title, fm_directory_view_get_containing_window (view), - GTK_DIALOG_NO_SEPARATOR, + 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Connect"), GTK_RESPONSE_OK, NULL); @@ -7098,7 +7115,8 @@ action_location_delete_callback (GtkAction *action, caja_file_operations_delete (files, fm_directory_view_get_containing_window (view), NULL, NULL); - eel_g_object_list_free (files); + g_list_foreach(files, (GFunc) g_object_unref, NULL); + g_list_free(files); } static void @@ -9781,7 +9799,8 @@ fm_directory_view_stop (FMDirectoryView *view) view->details->old_added_files = NULL; file_and_directory_list_free (view->details->old_changed_files); view->details->old_changed_files = NULL; - eel_g_object_list_free (view->details->pending_locations_selected); + g_list_foreach(view->details->pending_locations_selected, (GFunc) g_object_unref, NULL); + g_list_free(view->details->pending_locations_selected); view->details->pending_locations_selected = NULL; if (view->details->model != NULL) { @@ -10559,7 +10578,8 @@ fm_directory_view_handle_uri_list_drop (FMDirectoryView *view, target_uri != NULL ? target_uri : container_uri, action, x, y, view); - eel_g_list_free_deep (real_uri_list); + g_list_foreach(real_uri_list, (GFunc) g_free, NULL); + g_list_free(real_uri_list); if (points != NULL) g_array_free (points, TRUE); @@ -10796,11 +10816,13 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) widget_class = GTK_WIDGET_CLASS (klass); scrolled_window_class = GTK_SCROLLED_WINDOW_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = fm_directory_view_finalize; G_OBJECT_CLASS (klass)->set_property = fm_directory_view_set_property; - + G_OBJECT_CLASS (klass)->finalize = fm_directory_view_finalize; +#if !GTK_CHECK_VERSION (3, 0, 0) GTK_OBJECT_CLASS (klass)->destroy = fm_directory_view_destroy; - +#else + widget_class->destroy = fm_directory_view_destroy; +#endif widget_class->scroll_event = fm_directory_view_scroll_event; widget_class->parent_set = fm_directory_view_parent_set; @@ -10815,7 +10837,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FMDirectoryViewClass, add_file), NULL, NULL, - caja_marshal_VOID__OBJECT_OBJECT, + fm_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, CAJA_TYPE_FILE, CAJA_TYPE_DIRECTORY); signals[BEGIN_FILE_CHANGES] = g_signal_new ("begin_file_changes", @@ -10871,7 +10893,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FMDirectoryViewClass, file_changed), NULL, NULL, - caja_marshal_VOID__OBJECT_OBJECT, + fm_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, CAJA_TYPE_FILE, CAJA_TYPE_DIRECTORY); signals[LOAD_ERROR] = g_signal_new ("load_error", @@ -10887,7 +10909,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FMDirectoryViewClass, remove_file), NULL, NULL, - caja_marshal_VOID__OBJECT_OBJECT, + fm_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, CAJA_TYPE_FILE, CAJA_TYPE_DIRECTORY); klass->accepts_dragged_files = real_accepts_dragged_files; @@ -10944,7 +10966,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (FMDirectoryViewClass, trash), g_signal_accumulator_true_handled, NULL, - eel_marshal_BOOLEAN__VOID, + fm_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); signals[DELETE] = g_signal_new ("delete", @@ -10952,15 +10974,15 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (FMDirectoryViewClass, delete), g_signal_accumulator_true_handled, NULL, - eel_marshal_BOOLEAN__VOID, + fm_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, GDK_Delete, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Delete, 0, "trash", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, 0, "trash", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, GDK_SHIFT_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, GDK_SHIFT_MASK, "delete", 0); klass->trash = real_trash; diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index eee45185..931df9f8 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -209,7 +209,11 @@ G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW, fm_icon_view_iface_init)); static void +#if GTK_CHECK_VERSION (3, 0, 0) +fm_icon_view_destroy (GtkWidget *object) +#else fm_icon_view_destroy (GtkObject *object) +#endif { FMIconView *icon_view; @@ -237,10 +241,13 @@ fm_icon_view_destroy (GtkObject *object) icon_view->details->icons_not_positioned = NULL; } +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_WIDGET_CLASS (fm_icon_view_parent_class)->destroy (object); +#else GTK_OBJECT_CLASS (fm_icon_view_parent_class)->destroy (object); +#endif } - static void fm_icon_view_finalize (GObject *object) { @@ -271,6 +278,7 @@ fm_icon_view_finalize (GObject *object) g_signal_handlers_disconnect_by_func (caja_compact_view_preferences, all_columns_same_width_changed_callback, icon_view); + G_OBJECT_CLASS (fm_icon_view_parent_class)->finalize (object); } @@ -2184,6 +2192,8 @@ play_file (gpointer callback_data) char **argv; GError *error; char *uri; + GFile *gfile; + char *path; icon_view = FM_ICON_VIEW (callback_data); @@ -2191,7 +2201,21 @@ play_file (gpointer callback_data) icon_view->details->audio_preview_timeout = 0; file = icon_view->details->audio_preview_file; - uri = caja_file_get_uri (file); + gfile = caja_file_get_location (file); + path = g_file_get_path (gfile); + + /* if we have a local path, use that instead of the native URI. + * this can be useful for special GVfs mounts, such as cdda:// + */ + if (path) { + uri = g_filename_to_uri (path, NULL, NULL); + } else { + uri = caja_file_get_uri (file); + } + + g_object_unref (gfile); + g_free (path); + argv = get_preview_argv (uri); g_free (uri); if (argv == NULL) @@ -2829,8 +2853,6 @@ fm_icon_view_sort_directories_first_changed (FMDirectoryView *directory_view) } } -/* GtkObject methods. */ - static gboolean icon_view_can_accept_item (CajaIconContainer *container, CajaFile *target_item, @@ -3145,9 +3167,11 @@ fm_icon_view_class_init (FMIconViewClass *klass) G_OBJECT_CLASS (klass)->set_property = fm_icon_view_set_property; G_OBJECT_CLASS (klass)->finalize = fm_icon_view_finalize; - +#if !GTK_CHECK_VERSION (3, 0, 0) GTK_OBJECT_CLASS (klass)->destroy = fm_icon_view_destroy; - +#else + GTK_WIDGET_CLASS (klass)->destroy = fm_icon_view_destroy; +#endif GTK_WIDGET_CLASS (klass)->screen_changed = fm_icon_view_screen_changed; GTK_WIDGET_CLASS (klass)->scroll_event = fm_icon_view_scroll_event; diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c index f7288fe2..f6ba0168 100644 --- a/src/file-manager/fm-list-model.c +++ b/src/file-manager/fm-list-model.c @@ -29,8 +29,6 @@ #include <libegg/eggtreemultidnd.h> #include <string.h> -#include <eel/eel-gtk-macros.h> -#include <eel/eel-glib-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> #include <gtk/gtk.h> #include <glib/gi18n.h> @@ -166,13 +164,6 @@ fm_list_model_get_column_type (GtkTreeModel *tree_model, int index) case FM_LIST_MODEL_LARGE_ICON_COLUMN: case FM_LIST_MODEL_LARGER_ICON_COLUMN: case FM_LIST_MODEL_LARGEST_ICON_COLUMN: - case FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN: - case FM_LIST_MODEL_SMALLER_EMBLEM_COLUMN: - case FM_LIST_MODEL_SMALL_EMBLEM_COLUMN: - case FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGE_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGER_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGEST_EMBLEM_COLUMN: return GDK_TYPE_PIXBUF; case FM_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN: return G_TYPE_BOOLEAN; @@ -277,10 +268,12 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column CajaFile *file; char *str; GdkPixbuf *icon, *rendered_icon; + GIcon *gicon, *emblemed_icon, *emblem_icon; + CajaIconInfo *icon_info; + GEmblem *emblem; + GList *emblem_icons, *l; int icon_size; - guint emblem_size; CajaZoomLevel zoom_level; - GList *emblem_pixbufs; CajaFile *parent_file; char *emblems_to_ignore[3]; int i; @@ -344,7 +337,52 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column } } - icon = caja_file_get_icon_pixbuf (file, icon_size, TRUE, flags); + gicon = caja_file_get_gicon (file, flags); + + /* render emblems with GEmblemedIcon */ + parent_file = caja_file_get_parent (file); + i = 0; + emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_TRASH; + if (parent_file) { + if (!caja_file_can_write (parent_file)) { + emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_CANT_WRITE; + } + caja_file_unref (parent_file); + } + emblems_to_ignore[i++] = NULL; + + emblem = NULL; + emblem_icons = caja_file_get_emblem_icons (file, + emblems_to_ignore); + + if (emblem_icons != NULL) { + emblem_icon = emblem_icons->data; + emblem = g_emblem_new (emblem_icon); + emblemed_icon = g_emblemed_icon_new (gicon, emblem); + + g_object_unref (emblem); + + for (l = emblem_icons->next; l != NULL; l = l->next) { + emblem_icon = l->data; + emblem = g_emblem_new (emblem_icon); + g_emblemed_icon_add_emblem + (G_EMBLEMED_ICON (emblemed_icon), emblem); + + g_object_unref (emblem); + } + + g_list_foreach (emblem_icons, (GFunc) g_object_unref, NULL); + g_list_free(emblem_icons); + + g_object_unref (gicon); + gicon = emblemed_icon; + } + + icon_info = caja_icon_info_lookup (gicon, icon_size); + icon = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size); + + g_object_unref (icon_info); + g_object_unref (gicon); if (model->details->highlight_files != NULL && g_list_find_custom (model->details->highlight_files, @@ -363,48 +401,6 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column g_object_unref (icon); } break; - case FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN: - case FM_LIST_MODEL_SMALLER_EMBLEM_COLUMN: - case FM_LIST_MODEL_SMALL_EMBLEM_COLUMN: - case FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGE_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGER_EMBLEM_COLUMN: - case FM_LIST_MODEL_LARGEST_EMBLEM_COLUMN: - g_value_init (value, GDK_TYPE_PIXBUF); - - if (file != NULL) - { - parent_file = caja_file_get_parent (file); - i = 0; - emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_TRASH; - if (parent_file) - { - if (!caja_file_can_write (parent_file)) - { - emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_CANT_WRITE; - } - caja_file_unref (parent_file); - } - emblems_to_ignore[i++] = NULL; - - zoom_level = fm_list_model_get_zoom_level_from_emblem_column_id (column); - icon_size = caja_get_icon_size_for_zoom_level (zoom_level); - emblem_size = caja_icon_get_emblem_size_for_icon_size (icon_size); - if (emblem_size != 0) - { - emblem_pixbufs = caja_file_get_emblem_pixbufs (file, - emblem_size, - TRUE, - emblems_to_ignore); - if (emblem_pixbufs != NULL) - { - icon = emblem_pixbufs->data; - g_value_set_object (value, icon); - } - eel_gdk_pixbuf_list_free (emblem_pixbufs); - } - } - break; case FM_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN: g_value_init (value, G_TYPE_BOOLEAN); @@ -682,7 +678,8 @@ fm_list_model_get_first_iter_for_file (FMListModel *model, res = TRUE; *iter = *(GtkTreeIter *)list->data; } - eel_g_list_free_deep (list); + g_list_foreach(list, (GFunc) g_free, NULL); + g_list_free(list); return res; } @@ -1555,54 +1552,6 @@ fm_list_model_get_column_id_from_zoom_level (CajaZoomLevel zoom_level) g_return_val_if_reached (FM_LIST_MODEL_STANDARD_ICON_COLUMN); } -CajaZoomLevel -fm_list_model_get_zoom_level_from_emblem_column_id (int column) -{ - switch (column) - { - case FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_SMALLEST; - case FM_LIST_MODEL_SMALLER_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_SMALLER; - case FM_LIST_MODEL_SMALL_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_SMALL; - case FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_STANDARD; - case FM_LIST_MODEL_LARGE_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_LARGE; - case FM_LIST_MODEL_LARGER_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_LARGER; - case FM_LIST_MODEL_LARGEST_EMBLEM_COLUMN: - return CAJA_ZOOM_LEVEL_LARGEST; - } - - g_return_val_if_reached (CAJA_ZOOM_LEVEL_STANDARD); -} - -int -fm_list_model_get_emblem_column_id_from_zoom_level (CajaZoomLevel zoom_level) -{ - switch (zoom_level) - { - case CAJA_ZOOM_LEVEL_SMALLEST: - return FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_SMALLER: - return FM_LIST_MODEL_SMALLER_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_SMALL: - return FM_LIST_MODEL_SMALL_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_STANDARD: - return FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_LARGE: - return FM_LIST_MODEL_LARGE_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_LARGER: - return FM_LIST_MODEL_LARGER_EMBLEM_COLUMN; - case CAJA_ZOOM_LEVEL_LARGEST: - return FM_LIST_MODEL_LARGEST_EMBLEM_COLUMN; - } - - g_return_val_if_reached (FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN); -} - void fm_list_model_set_drag_view (FMListModel *model, GtkTreeView *view, @@ -1857,7 +1806,8 @@ refresh_row (gpointer data, gtk_tree_path_free (path); } - eel_g_list_free_deep (iters); + g_list_foreach(iters, (GFunc) g_free, NULL); + g_list_free(iters); } void diff --git a/src/file-manager/fm-list-model.h b/src/file-manager/fm-list-model.h index a44fb28a..2d4ff88b 100644 --- a/src/file-manager/fm-list-model.h +++ b/src/file-manager/fm-list-model.h @@ -54,13 +54,6 @@ enum FM_LIST_MODEL_LARGE_ICON_COLUMN, FM_LIST_MODEL_LARGER_ICON_COLUMN, FM_LIST_MODEL_LARGEST_ICON_COLUMN, - FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN, - FM_LIST_MODEL_SMALLER_EMBLEM_COLUMN, - FM_LIST_MODEL_SMALL_EMBLEM_COLUMN, - FM_LIST_MODEL_STANDARD_EMBLEM_COLUMN, - FM_LIST_MODEL_LARGE_EMBLEM_COLUMN, - FM_LIST_MODEL_LARGER_EMBLEM_COLUMN, - FM_LIST_MODEL_LARGEST_EMBLEM_COLUMN, FM_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN, FM_LIST_MODEL_NUM_COLUMNS }; @@ -115,8 +108,6 @@ void fm_list_model_sort_files (FMListModel *model, CajaZoomLevel fm_list_model_get_zoom_level_from_column_id (int column); int fm_list_model_get_column_id_from_zoom_level (CajaZoomLevel zoom_level); -CajaZoomLevel fm_list_model_get_zoom_level_from_emblem_column_id (int column); -int fm_list_model_get_emblem_column_id_from_zoom_level (CajaZoomLevel zoom_level); CajaFile * fm_list_model_file_for_path (FMListModel *model, GtkTreePath *path); gboolean fm_list_model_load_subdirectory (FMListModel *model, GtkTreePath *path, CajaDirectory **directory); diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index e8eb16a8..f487c333 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -59,7 +59,6 @@ #include <libcaja-private/caja-tree-view-drag-dest.h> #include <libcaja-private/caja-view-factory.h> #include <libcaja-private/caja-clipboard.h> -#include <libcaja-private/caja-cell-renderer-pixbuf-emblem.h> #include <libcaja-private/caja-cell-renderer-text-ellipsized.h> struct FMListViewDetails @@ -1109,14 +1108,14 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat switch (event->keyval) { - case GDK_F10: + case GDK_KEY_F10: if (event->state & GDK_CONTROL_MASK) { fm_directory_view_pop_up_background_context_menu (view, &button_event); handled = TRUE; } break; - case GDK_Right: + case GDK_KEY_Right: gtk_tree_view_get_cursor (tree_view, &path, NULL); if (path) { @@ -1125,7 +1124,7 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat } handled = TRUE; break; - case GDK_Left: + case GDK_KEY_Left: gtk_tree_view_get_cursor (tree_view, &path, NULL); if (path) { @@ -1134,7 +1133,7 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat } handled = TRUE; break; - case GDK_space: + case GDK_KEY_space: if (event->state & GDK_CONTROL_MASK) { handled = FALSE; @@ -1155,8 +1154,8 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat } handled = TRUE; break; - 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 (FM_LIST_VIEW (view), NULL, TRUE); @@ -1167,7 +1166,7 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat } handled = TRUE; break; - case GDK_v: + case GDK_KEY_v: /* Eat Control + v to not enable type ahead */ if ((event->state & GDK_CONTROL_MASK) != 0) { @@ -1642,7 +1641,7 @@ create_and_set_up_tree_view (FMListView *view) /* Don't handle backspace key. It's used to open the parent folder. */ binding_set = gtk_binding_set_by_class (GTK_WIDGET_GET_CLASS (view->details->tree_view)); - gtk_binding_entry_remove (binding_set, GDK_BackSpace, 0); + gtk_binding_entry_remove (binding_set, GDK_KEY_BackSpace, 0); view->details->drag_dest = caja_tree_view_drag_dest_new (view->details->tree_view); @@ -1740,7 +1739,7 @@ create_and_set_up_tree_view (FMListView *view) if (!strcmp (name, "name")) { /* Create the file name column */ - cell = caja_cell_renderer_pixbuf_emblem_new (); + cell = gtk_cell_renderer_pixbuf_new (); view->details->pixbuf_cell = (GtkCellRendererPixbuf *)cell; view->details->file_name_column = gtk_tree_view_column_new (); @@ -1764,7 +1763,6 @@ create_and_set_up_tree_view (FMListView *view) gtk_tree_view_column_set_attributes (view->details->file_name_column, cell, "pixbuf", FM_LIST_MODEL_SMALLEST_ICON_COLUMN, - "pixbuf_emblem", FM_LIST_MODEL_SMALLEST_EMBLEM_COLUMN, NULL); cell = gtk_cell_renderer_text_new (); @@ -2327,7 +2325,8 @@ fm_list_view_set_selection (FMDirectoryView *view, GList *selection) gtk_tree_selection_select_iter (tree_selection, (GtkTreeIter *)l->data); } - eel_g_list_free_deep (iters); + g_list_foreach(iters, (GFunc) g_free, NULL); + g_list_free(iters); } g_signal_handlers_unblock_by_func (tree_selection, list_selection_changed_callback, view); @@ -2364,7 +2363,8 @@ fm_list_view_invert_selection (FMDirectoryView *view) gtk_tree_selection_unselect_iter (tree_selection, (GtkTreeIter *)l->data); } - eel_g_list_free_deep (iters); + g_list_foreach(iters, (GFunc) g_free, NULL); + g_list_free(iters); } g_list_free (selection); @@ -2734,7 +2734,7 @@ fm_list_view_set_zoom_level (FMListView *view, gboolean always_emit) { int icon_size; - int column, emblem_column; + int column; g_return_if_fail (FM_IS_LIST_VIEW (view)); g_return_if_fail (new_level >= CAJA_ZOOM_LEVEL_SMALLEST && @@ -2760,11 +2760,9 @@ fm_list_view_set_zoom_level (FMListView *view, /* Select correctly scaled icons. */ column = fm_list_model_get_column_id_from_zoom_level (new_level); - emblem_column = fm_list_model_get_emblem_column_id_from_zoom_level (new_level); gtk_tree_view_column_set_attributes (view->details->file_name_column, GTK_CELL_RENDERER (view->details->pixbuf_cell), "pixbuf", column, - "pixbuf_emblem", emblem_column, NULL); /* Scale text. */ diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 7ec253c0..4a7b7c54 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -37,7 +37,6 @@ #include <eel/eel-gtk-extensions.h> #include <eel/eel-labeled-image.h> #include <eel/eel-stock-dialogs.h> -#include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> #include <eel/eel-wrap-table.h> #include <gtk/gtk.h> @@ -45,7 +44,6 @@ #include <glib/gi18n.h> #include <libmateui/mate-desktop-thumbnail.h> #include <libcaja-extension/caja-property-page-provider.h> -#include <libcaja-private/caja-customization-data.h> #include <libcaja-private/caja-entry.h> #include <libcaja-private/caja-file-attributes.h> #include <libcaja-private/caja-file-operations.h> @@ -701,7 +699,7 @@ update_name_field (FMPropertiesWindow *window) set_name_field (window, original_name, current_name); if (original_name == NULL || - eel_strcmp (original_name, current_name) != 0) { + g_strcmp0 (original_name, current_name) != 0) { g_object_set_data_full (G_OBJECT (window->details->name_field), "original_name", current_name, @@ -843,7 +841,8 @@ file_has_keyword (CajaFile *file, const char *keyword) keywords = caja_file_get_keywords (file); word = g_list_find_custom (keywords, keyword, (GCompareFunc) strcmp); - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); return (word != NULL); } @@ -933,7 +932,8 @@ emblem_button_toggled (GtkToggleButton *button, keywords = g_list_prepend (keywords, g_strdup (name)); } caja_file_set_keywords (file, keywords); - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); } for (l = files_off; l != NULL; l = l->next) { @@ -946,10 +946,12 @@ emblem_button_toggled (GtkToggleButton *button, word = g_list_find_custom (keywords, name, (GCompareFunc)strcmp); if (word) { keywords = g_list_remove_link (keywords, word); - eel_g_list_free_deep (word); + g_list_foreach(word, (GFunc) g_free, NULL); + g_list_free(word); } caja_file_set_keywords (file, keywords); - eel_g_list_free_deep (keywords); + g_list_foreach(keywords, (GFunc) g_free, NULL); + g_list_free(keywords); } g_list_free (files_on); @@ -1205,7 +1207,8 @@ properties_window_update (FMPropertiesWindow *window, refresh_extension_pages (window); } - eel_g_list_free_deep (window->details->mime_list); + g_list_foreach(window->details->mime_list, (GFunc) g_free, NULL); + g_list_free(window->details->mime_list); window->details->mime_list = mime_list; } } @@ -1636,7 +1639,7 @@ changed_group_callback (GtkComboBox *combo_box, CajaFile *file) g_assert (GTK_IS_COMBO_BOX (combo_box)); g_assert (CAJA_IS_FILE (file)); - group = gtk_combo_box_get_active_text (combo_box); + group = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo_box)); cur_group = caja_file_get_group_name (file); if (group != NULL && strcmp (group, cur_group) != 0) { @@ -1791,7 +1794,7 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file) for (node = groups, group_index = 0; node != NULL; node = node->next, ++group_index) { group_name = (const char *)node->data; - gtk_combo_box_append_text (combo_box, group_name); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), group_name); } } @@ -1805,16 +1808,17 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file) if (current_group_index < 0 && current_group_name != NULL) { if (groups != NULL) { /* add separator */ - gtk_combo_box_prepend_text (combo_box, "-"); + gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (combo_box), "-"); } - gtk_combo_box_prepend_text (combo_box, current_group_name); + gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (combo_box), current_group_name); current_group_index = 0; } gtk_combo_box_set_active (combo_box, current_group_index); g_free (current_group_name); - eel_g_list_free_deep (groups); + g_list_foreach(groups, (GFunc) g_free, NULL); + g_list_free(groups); } static gboolean @@ -1850,7 +1854,7 @@ attach_combo_box (GtkTable *table, GtkWidget *aligner; if (!two_columns) { - combo_box = gtk_combo_box_new_text (); + combo_box = gtk_combo_box_text_new (); } else { GtkTreeModel *model; GtkCellRenderer *renderer; @@ -2169,7 +2173,8 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file) gtk_combo_box_set_active (combo_box, owner_index); g_free (owner_name); - eel_g_list_free_deep (users); + g_list_foreach(users, (GFunc) g_free, NULL); + g_list_free(users); } static GtkComboBox* @@ -2744,10 +2749,15 @@ should_show_volume_usage (FMPropertiesWindow *window) } static void -paint_used_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) +paint_used_legend (GtkWidget *widget, +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else + GdkEventExpose *eev, +#endif + gpointer data) { FMPropertiesWindow *window; - cairo_t *cr; gint width, height; GtkAllocation allocation; @@ -2758,7 +2768,9 @@ paint_used_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) window = FM_PROPERTIES_WINDOW (data); - cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#if !GTK_CHECK_VERSION(3,0,0) + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#endif cairo_rectangle (cr, 2, @@ -2766,20 +2778,32 @@ paint_used_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) width - 4, height - 4); - cairo_set_source_rgb (cr, (double) window->details->used_color.red / 65535, (double) window->details->used_color.green / 65535, (double) window->details->used_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->used_color.red / 65535, + (double) window->details->used_color.green / 65535, + (double) window->details->used_color.blue / 65535); cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, (double) window->details->used_stroke_color.red / 65535, (double) window->details->used_stroke_color.green / 65535, (double) window->details->used_stroke_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->used_stroke_color.red / 65535, + (double) window->details->used_stroke_color.green / 65535, + (double) window->details->used_stroke_color.blue / 65535); cairo_stroke (cr); +#if !GTK_CHECK_VERSION(3,0,0) cairo_destroy (cr); +#endif } static void -paint_free_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) +paint_free_legend (GtkWidget *widget, +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, gpointer data) +#else + GdkEventExpose *eev, gpointer data) +#endif { FMPropertiesWindow *window; - cairo_t *cr; gint width, height; GtkAllocation allocation; @@ -2788,7 +2812,9 @@ paint_free_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) width = allocation.width; height = allocation.height; - cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#if !GTK_CHECK_VERSION(3,0,0) + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#endif cairo_rectangle (cr, 2, @@ -2796,21 +2822,34 @@ paint_free_legend (GtkWidget *widget, GdkEventExpose *eev, gpointer data) width - 4, height - 4); - cairo_set_source_rgb (cr, (double) window->details->free_color.red / 65535, (double) window->details->free_color.green / 65535, (double) window->details->free_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->free_color.red / 65535, + (double) window->details->free_color.green / 65535, + (double) window->details->free_color.blue / 65535); cairo_fill_preserve(cr); - cairo_set_source_rgb (cr, (double) window->details->free_stroke_color.red / 65535, (double) window->details->free_stroke_color.green / 65535, (double) window->details->free_stroke_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->free_stroke_color.red / 65535, + (double) window->details->free_stroke_color.green / 65535, + (double) window->details->free_stroke_color.blue / 65535); cairo_stroke (cr); +#if !GTK_CHECK_VERSION(3,0,0) cairo_destroy (cr); +#endif } static void -paint_pie_chart (GtkWidget *widget, GdkEventExpose *eev, gpointer data) +paint_pie_chart (GtkWidget *widget, +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr, +#else + GdkEventExpose *eev, +#endif + gpointer data) { FMPropertiesWindow *window; - cairo_t *cr; gint width, height; double free, used; double angle1, angle2, split, xc, yc, radius; @@ -2832,7 +2871,9 @@ paint_pie_chart (GtkWidget *widget, GdkEventExpose *eev, gpointer data) xc = width / 2; yc = height / 2; - cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#if !GTK_CHECK_VERSION(3,0,0) + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); +#endif if (width < height) { radius = width / 2 - 8; @@ -2859,10 +2900,16 @@ paint_pie_chart (GtkWidget *widget, GdkEventExpose *eev, gpointer data) cairo_line_to (cr,xc,yc); } - cairo_set_source_rgb (cr, (double) window->details->used_color.red / 65535, (double) window->details->used_color.green / 65535, (double) window->details->used_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->used_color.red / 65535, + (double) window->details->used_color.green / 65535, + (double) window->details->used_color.blue / 65535); cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, (double) window->details->used_stroke_color.red / 65535, (double) window->details->used_stroke_color.green / 65535, (double) window->details->used_stroke_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->used_stroke_color.red / 65535, + (double) window->details->used_stroke_color.green / 65535, + (double) window->details->used_stroke_color.blue / 65535); cairo_stroke (cr); } @@ -2877,14 +2924,22 @@ paint_pie_chart (GtkWidget *widget, GdkEventExpose *eev, gpointer data) cairo_line_to (cr,xc,yc); } - cairo_set_source_rgb (cr, (double) window->details->free_color.red / 65535, (double) window->details->free_color.green / 65535,(double) window->details->free_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->free_color.red / 65535, + (double) window->details->free_color.green / 65535, + (double) window->details->free_color.blue / 65535); cairo_fill_preserve(cr); - cairo_set_source_rgb (cr, (double) window->details->free_stroke_color.red / 65535, (double) window->details->free_stroke_color.green / 65535, (double) window->details->free_stroke_color.blue / 65535); + cairo_set_source_rgb (cr, + (double) window->details->free_stroke_color.red / 65535, + (double) window->details->free_stroke_color.green / 65535, + (double) window->details->free_stroke_color.blue / 65535); cairo_stroke (cr); } +#if !GTK_CHECK_VERSION(3,0,0) cairo_destroy (cr); +#endif } @@ -3173,9 +3228,21 @@ create_pie_widget (FMPropertiesWindow *window) gtk_table_attach (table, capacity_label , 1, 3, 2, 3, GTK_FILL, 0, 5, 5); gtk_table_attach (table, fstype_label , 1, 3, 3, 4, GTK_FILL, 0, 5, 5); - g_signal_connect (G_OBJECT (pie_canvas), "expose-event", G_CALLBACK (paint_pie_chart), window); - g_signal_connect (G_OBJECT (used_canvas), "expose-event", G_CALLBACK (paint_used_legend), window); - g_signal_connect (G_OBJECT (free_canvas), "expose-event", G_CALLBACK (paint_free_legend), window); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect (pie_canvas, "draw", + G_CALLBACK (paint_pie_chart), window); + g_signal_connect (used_canvas, "draw", + G_CALLBACK (paint_used_legend), window); + g_signal_connect (free_canvas, "draw", + G_CALLBACK (paint_free_legend), window); +#else + g_signal_connect (G_OBJECT (pie_canvas), "expose-event", + G_CALLBACK (paint_pie_chart), window); + g_signal_connect (G_OBJECT (used_canvas), "expose-event", + G_CALLBACK (paint_used_legend), window); + g_signal_connect (G_OBJECT (free_canvas), "expose-event", + G_CALLBACK (paint_free_legend), window); +#endif return GTK_WIDGET (table); } @@ -3363,7 +3430,7 @@ get_initial_emblems (GList *files) ret = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, - (GDestroyNotify)eel_g_list_free_deep); + (GFunc) g_free); for (l = files; l != NULL; l = l->next) { CajaFile *file; @@ -3502,7 +3569,8 @@ create_emblems_page (FMPropertiesWindow *window) gtk_container_add (GTK_CONTAINER (emblems_table), button); } - eel_g_list_free_deep (icons); + g_list_foreach(icons, (GFunc) g_free, NULL); + g_list_free(icons); gtk_widget_show_all (emblems_table); } @@ -4986,7 +5054,8 @@ get_pending_key (GList *file_list) g_string_append (key, ";"); } - eel_g_list_free_deep (uris); + g_list_foreach(uris, (GFunc) g_free, NULL); + g_list_free(uris); ret = key->str; g_string_free (key, FALSE); @@ -5235,7 +5304,6 @@ create_properties_window (StartupData *startup_data) gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12); gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (window))), 0); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12); - gtk_dialog_set_has_separator (GTK_DIALOG (window), FALSE); /* Update from initial state */ properties_window_update (window, NULL); @@ -5484,7 +5552,11 @@ real_response (GtkDialog *dialog, } static void +#if GTK_CHECK_VERSION (3, 0, 0) +real_destroy (GtkWidget *object) +#else real_destroy (GtkObject *object) +#endif { FMPropertiesWindow *window; GList *l; @@ -5542,7 +5614,11 @@ real_destroy (GtkObject *object) window->details->update_files_timeout_id = 0; } +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_WIDGET_CLASS (parent_class)->destroy (object); +#else GTK_OBJECT_CLASS (parent_class)->destroy (object); +#endif } static void @@ -5552,7 +5628,8 @@ real_finalize (GObject *object) window = FM_PROPERTIES_WINDOW (object); - eel_g_list_free_deep (window->details->mime_list); + g_list_foreach(window->details->mime_list, (GFunc) g_free, NULL); + g_list_free(window->details->mime_list); g_free (window->details->pending_name); g_free (window->details); @@ -5797,11 +5874,15 @@ fm_properties_window_class_init (FMPropertiesWindowClass *class) GtkBindingSet *binding_set; G_OBJECT_CLASS (class)->finalize = real_finalize; +#if !GTK_CHECK_VERSION (3, 0, 0) GTK_OBJECT_CLASS (class)->destroy = real_destroy; +#else + GTK_WIDGET_CLASS (class)->destroy = real_destroy; +#endif GTK_DIALOG_CLASS (class)->response = real_response; binding_set = gtk_binding_set_by_class (class); - gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); } diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c index 15071b8c..3423e2d1 100644 --- a/src/file-manager/fm-tree-model.c +++ b/src/file-manager/fm-tree-model.c @@ -29,7 +29,6 @@ #include <config.h> #include "fm-tree-model.h" -#include <eel/eel-glib-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> #include <glib/gi18n.h> #include <libcaja-private/caja-directory.h> @@ -67,7 +66,6 @@ struct TreeNode GMount *mount; GdkPixbuf *closed_pixbuf; GdkPixbuf *open_pixbuf; - GdkPixbuf *emblem_pixbuf; FMTreeModelRoot *root; @@ -221,7 +219,6 @@ tree_node_destroy (FMTreeModel *model, TreeNode *node) object_unref_if_not_NULL (node->icon); object_unref_if_not_NULL (node->closed_pixbuf); object_unref_if_not_NULL (node->open_pixbuf); - object_unref_if_not_NULL (node->emblem_pixbuf); g_assert (node->done_loading_id == 0); g_assert (node->files_added_id == 0); @@ -278,17 +275,59 @@ get_menu_icon_for_file (TreeNode *node, CajaFileIconFlags flags) { CajaIconInfo *info; + GIcon *gicon, *emblem_icon, *emblemed_icon; + GEmblem *emblem; GdkPixbuf *pixbuf, *retval; gboolean highlight; int size; FMTreeModel *model; + GList *emblem_icons, *l; + char *emblems_to_ignore[3]; + int i; size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU); - info = caja_file_get_icon (file, size, flags); + gicon = caja_file_get_gicon (file, flags); + + i = 0; + emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_TRASH; + + if (node->parent && node->parent->file) { + if (!caja_file_can_write (node->parent->file)) { + emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_CANT_WRITE; + } + } + + emblems_to_ignore[i++] = NULL; + + emblem = NULL; + emblem_icons = caja_file_get_emblem_icons (node->file, + emblems_to_ignore); + + /* pick only the first emblem we can render for the tree view */ + for (l = emblem_icons; l != NULL; l = l->next) { + emblem_icon = l->data; + if (caja_icon_theme_can_render (G_THEMED_ICON (emblem_icon))) { + emblem = g_emblem_new (emblem_icon); + emblemed_icon = g_emblemed_icon_new (gicon, emblem); + + g_object_unref (gicon); + g_object_unref (emblem); + gicon = emblemed_icon; + + break; + } + } + + g_list_foreach (emblem_icons, (GFunc) g_object_unref, NULL); + g_list_free(emblem_icons); + + info = caja_icon_info_lookup (gicon, size); retval = caja_icon_info_get_pixbuf_nodefault_at_size (info, size); model = node->root->model; + g_object_unref (gicon); + highlight = (g_list_find_custom (model->details->highlighted_files, file, (GCompareFunc) caja_file_compare_location) != NULL); @@ -353,67 +392,6 @@ tree_node_update_open_pixbuf (TreeNode *node) return tree_node_update_pixbuf (node, &node->open_pixbuf, CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER); } -static GdkPixbuf * -tree_node_get_emblem_pixbuf_internal (TreeNode *node) -{ - GdkPixbuf *pixbuf; - GList *emblem_pixbufs; - char *emblems_to_ignore[3]; - int i; - - i = 0; - emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_TRASH; - - if (node->parent && node->parent->file) - { - if (!caja_file_can_write (node->parent->file)) - { - emblems_to_ignore[i++] = CAJA_FILE_EMBLEM_NAME_CANT_WRITE; - } - } - - emblems_to_ignore[i++] = NULL; - - emblem_pixbufs = caja_file_get_emblem_pixbufs (node->file, - caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), - TRUE, - emblems_to_ignore); - - - if (emblem_pixbufs != NULL) - { - pixbuf = g_object_ref (emblem_pixbufs->data); - } - else - { - pixbuf = NULL; - } - - eel_gdk_pixbuf_list_free (emblem_pixbufs); - - return pixbuf; -} - -static gboolean -tree_node_update_emblem_pixbuf (TreeNode *node) -{ - GdkPixbuf *pixbuf; - - if (node->emblem_pixbuf == NULL) - { - return FALSE; - } - pixbuf = tree_node_get_emblem_pixbuf_internal (node); - if (pixbuf == node->emblem_pixbuf) - { - g_object_unref (pixbuf); - return FALSE; - } - g_object_unref (node->emblem_pixbuf); - node->emblem_pixbuf = pixbuf; - return TRUE; -} - static gboolean tree_node_update_display_name (TreeNode *node) { @@ -459,16 +437,6 @@ tree_node_get_open_pixbuf (TreeNode *node) return node->open_pixbuf; } -static GdkPixbuf * -tree_node_get_emblem_pixbuf (TreeNode *node) -{ - if (node->emblem_pixbuf == NULL) - { - node->emblem_pixbuf = tree_node_get_emblem_pixbuf_internal (node); - } - return node->emblem_pixbuf; -} - static const char * tree_node_get_display_name (TreeNode *node) { @@ -919,7 +887,6 @@ update_node_without_reporting (FMTreeModel *model, TreeNode *node) changed |= tree_node_update_display_name (node); changed |= tree_node_update_closed_pixbuf (node); changed |= tree_node_update_open_pixbuf (node); - changed |= tree_node_update_emblem_pixbuf (node); return changed; } @@ -1244,8 +1211,6 @@ fm_tree_model_get_column_type (GtkTreeModel *model, int index) return GDK_TYPE_PIXBUF; case FM_TREE_MODEL_OPEN_PIXBUF_COLUMN: return GDK_TYPE_PIXBUF; - case FM_TREE_MODEL_EMBLEM_PIXBUF_COLUMN: - return GDK_TYPE_PIXBUF; case FM_TREE_MODEL_FONT_STYLE_COLUMN: return PANGO_TYPE_STYLE; default: @@ -1412,18 +1377,11 @@ fm_tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter, int column, GVa g_value_init (value, GDK_TYPE_PIXBUF); g_value_set_object (value, node == NULL ? NULL : tree_node_get_open_pixbuf (node)); break; - case FM_TREE_MODEL_EMBLEM_PIXBUF_COLUMN: - g_value_init (value, GDK_TYPE_PIXBUF); - g_value_set_object (value, node == NULL ? NULL : tree_node_get_emblem_pixbuf (node)); - break; case FM_TREE_MODEL_FONT_STYLE_COLUMN: g_value_init (value, PANGO_TYPE_STYLE); - if (node == NULL) - { + if (node == NULL) { g_value_set_enum (value, PANGO_STYLE_ITALIC); - } - else - { + } else { g_value_set_enum (value, PANGO_STYLE_NORMAL); } break; diff --git a/src/file-manager/fm-tree-model.h b/src/file-manager/fm-tree-model.h index bfca06e4..2e459392 100644 --- a/src/file-manager/fm-tree-model.h +++ b/src/file-manager/fm-tree-model.h @@ -49,7 +49,6 @@ enum FM_TREE_MODEL_DISPLAY_NAME_COLUMN, FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN, FM_TREE_MODEL_OPEN_PIXBUF_COLUMN, - FM_TREE_MODEL_EMBLEM_PIXBUF_COLUMN, FM_TREE_MODEL_FONT_STYLE_COLUMN, FM_TREE_MODEL_NUM_COLUMNS }; diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c index 71ec5a95..37559f53 100644 --- a/src/file-manager/fm-tree-view.c +++ b/src/file-manager/fm-tree-view.c @@ -35,10 +35,7 @@ #include "fm-tree-model.h" #include "fm-properties-window.h" #include <string.h> -#include <eel/eel-alert-dialog.h> -#include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-extensions.h> -#include <eel/eel-stock-dialogs.h> #include <gtk/gtk.h> #include <glib/gi18n.h> #include <gio/gio.h> @@ -53,7 +50,6 @@ #include <libcaja-private/caja-icon-names.h> #include <libcaja-private/caja-program-choosing.h> #include <libcaja-private/caja-tree-view-drag-dest.h> -#include <libcaja-private/caja-cell-renderer-pixbuf-emblem.h> #include <libcaja-private/caja-sidebar-provider.h> #include <libcaja-private/caja-module.h> #include <libcaja-private/caja-window-info.h> @@ -1063,7 +1059,8 @@ paste_clipboard_data (FMTreeView *view, gtk_clipboard_clear (caja_clipboard_get (GTK_WIDGET (view))); } - eel_g_list_free_deep (item_uris); + g_list_foreach(item_uris, (GFunc) g_free, NULL); + g_list_free(item_uris); } } @@ -1126,7 +1123,8 @@ fm_tree_view_trash_cb (GtkWidget *menu_item, caja_file_operations_trash_or_delete (list, fm_tree_view_get_containing_window (view), NULL, NULL); - eel_g_object_list_free (list); + g_list_foreach(list, (GFunc) g_object_unref, NULL); + g_list_free(list); } static void @@ -1144,7 +1142,8 @@ fm_tree_view_delete_cb (GtkWidget *menu_item, caja_file_get_location (view->details->popup_file)); caja_file_operations_delete (location_list, fm_tree_view_get_containing_window (view), NULL, NULL); - eel_g_object_list_free (location_list); + g_list_foreach(location_list, (GFunc) g_object_unref, NULL); + g_list_free(location_list); } static void @@ -1475,13 +1474,12 @@ create_tree (FMTreeView *view) /* Create column */ column = gtk_tree_view_column_new (); - cell = caja_cell_renderer_pixbuf_emblem_new (); + cell = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell, FALSE); gtk_tree_view_column_set_attributes (column, cell, "pixbuf", FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN, "pixbuf_expander_closed", FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN, "pixbuf_expander_open", FM_TREE_MODEL_OPEN_PIXBUF_COLUMN, - "pixbuf_emblem", FM_TREE_MODEL_EMBLEM_PIXBUF_COLUMN, NULL); cell = gtk_cell_renderer_text_new (); |