summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-autorun.c20
-rw-r--r--libcaja-private/caja-bookmark.c50
-rw-r--r--libcaja-private/caja-debug-log.c2
-rw-r--r--libcaja-private/caja-desktop-icon-file.c4
-rw-r--r--libcaja-private/caja-desktop-metadata.c2
-rw-r--r--libcaja-private/caja-directory-async.c21
-rw-r--r--libcaja-private/caja-dnd.c2
-rw-r--r--libcaja-private/caja-extensions.c2
-rw-r--r--libcaja-private/caja-file-conflict-dialog.c67
-rw-r--r--libcaja-private/caja-file-operations.c141
-rw-r--r--libcaja-private/caja-file.c100
-rw-r--r--libcaja-private/caja-icon-canvas-item.c26
-rw-r--r--libcaja-private/caja-icon-container.c203
-rw-r--r--libcaja-private/caja-icon-container.h2
-rw-r--r--libcaja-private/caja-icon-dnd.c17
-rw-r--r--libcaja-private/caja-icon-info.c160
-rw-r--r--libcaja-private/caja-mime-application-chooser.c1
-rw-r--r--libcaja-private/caja-progress-info.c4
-rw-r--r--libcaja-private/caja-progress-info.h2
-rw-r--r--libcaja-private/caja-query.c7
-rw-r--r--libcaja-private/caja-search-directory-file.c5
-rw-r--r--libcaja-private/caja-search-directory-file.h3
-rw-r--r--libcaja-private/caja-search-directory.c1
-rw-r--r--libcaja-private/caja-search-engine-simple.c1
-rw-r--r--libcaja-private/caja-search-engine.c27
-rw-r--r--libcaja-private/caja-search-engine.h3
-rw-r--r--libcaja-private/caja-sidebar-provider.c1
-rw-r--r--libcaja-private/caja-sidebar.c1
-rw-r--r--libcaja-private/caja-view.c1
-rw-r--r--libcaja-private/caja-window-info.c1
-rw-r--r--libcaja-private/caja-window-slot-info.c1
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml39
32 files changed, 576 insertions, 341 deletions
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index 2f79b16b..b78ea1c7 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -761,16 +761,22 @@ is_shift_pressed (void)
Bool status;
ret = FALSE;
-
display = gdk_display_get_default ();
- gdk_x11_display_error_trap_push (display);
- status = XkbGetState (GDK_DISPLAY_XDISPLAY (display),
- XkbUseCoreKbd, &state);
- gdk_x11_display_error_trap_pop_ignored (display);
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ gdk_x11_display_error_trap_push (display);
+ status = XkbGetState (GDK_DISPLAY_XDISPLAY (display),
+ XkbUseCoreKbd, &state);
+ gdk_x11_display_error_trap_pop_ignored (display);
- if (status == Success)
+ if (status == Success)
+ {
+ ret = state.mods & ShiftMask;
+ }
+ }
+ else
{
- ret = state.mods & ShiftMask;
+ ret=FALSE;
}
return ret;
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index 587e8cc9..cbcec80a 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/libcaja-private/caja-bookmark.c
@@ -274,11 +274,13 @@ char *
caja_bookmark_get_uri (CajaBookmark *bookmark)
{
GFile *file;
- char *uri;
+ char *uri = NULL;
- file = caja_bookmark_get_location (bookmark);
- uri = g_file_get_uri (file);
- g_object_unref (file);
+ if ((file = caja_bookmark_get_location (bookmark)) != NULL)
+ {
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+ }
return uri;
}
@@ -330,7 +332,7 @@ caja_bookmark_icon_is_different (CajaBookmark *bookmark,
return TRUE;
}
- return !g_icon_equal (bookmark->details->icon, new_icon) != 0;
+ return !g_icon_equal (bookmark->details->icon, new_icon);
}
/**
@@ -585,20 +587,6 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name,
return new_bookmark;
}
-static cairo_surface_t *
-create_image_cairo_for_bookmark (CajaBookmark *bookmark)
-{
- cairo_surface_t *surface;
-
- surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
- if (surface == NULL)
- {
- return NULL;
- }
-
- return surface;
-}
-
static GtkWidget *
bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface,
const gchar *label_name)
@@ -644,20 +632,24 @@ bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface,
GtkWidget *
caja_bookmark_menu_item_new (CajaBookmark *bookmark)
{
- cairo_surface_t *image_cairo;
-
- image_cairo = create_image_cairo_for_bookmark (bookmark);
+ GtkWidget *menu_item = NULL;
if (strlen (bookmark->details->name) > 0)
{
- GtkWidget *menu_item;
-
- menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name);
-
- return menu_item;
+ cairo_surface_t *surface;
+
+ surface =
+ caja_bookmark_get_surface (bookmark,
+ GTK_ICON_SIZE_MENU);
+ menu_item =
+ bookmark_image_menu_item_new_from_surface (surface,
+ bookmark->details->name);
+ if (surface != NULL)
+ {
+ cairo_surface_destroy (surface);
+ }
}
- else
- return NULL;
+ return menu_item;
}
gboolean
diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c
index d872f91d..a7594757 100644
--- a/libcaja-private/caja-debug-log.c
+++ b/libcaja-private/caja-debug-log.c
@@ -358,7 +358,7 @@ caja_debug_log_load_configuration (const char *filename, GError **error)
g_error_free (my_error);
else
{
- int i;
+ gsize i;
for (i = 0; i < num_strings; i++)
strings[i] = g_strstrip (strings[i]);
diff --git a/libcaja-private/caja-desktop-icon-file.c b/libcaja-private/caja-desktop-icon-file.c
index 065e4e8e..43181ddb 100644
--- a/libcaja-private/caja-desktop-icon-file.c
+++ b/libcaja-private/caja-desktop-icon-file.c
@@ -205,8 +205,8 @@ update_info_from_link (CajaDesktopIconFile *icon_file)
file->details->mount = mount;
if (mount)
{
- file->details->can_unmount = g_mount_can_unmount (mount);
- file->details->can_eject = g_mount_can_eject (mount);
+ file->details->can_unmount = (g_mount_can_unmount (mount) != FALSE);
+ file->details->can_eject = (g_mount_can_eject (mount) != FALSE);
}
file->details->file_info_is_up_to_date = TRUE;
diff --git a/libcaja-private/caja-desktop-metadata.c b/libcaja-private/caja-desktop-metadata.c
index fd3bf08e..7fad726f 100644
--- a/libcaja-private/caja-desktop-metadata.c
+++ b/libcaja-private/caja-desktop-metadata.c
@@ -240,7 +240,7 @@ caja_desktop_update_metadata_from_keyfile (CajaFile *file,
gsize length, values_length;
GKeyFile *keyfile;
GFileInfo *info;
- gint idx;
+ gsize idx;
gboolean res;
keyfile = get_keyfile ();
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
index b1fc572b..84e17d4a 100644
--- a/libcaja-private/caja-directory-async.c
+++ b/libcaja-private/caja-directory-async.c
@@ -871,7 +871,7 @@ set_file_unconfirmed (CajaFile *file, gboolean unconfirmed)
{
return;
}
- file->details->unconfirmed = unconfirmed;
+ file->details->unconfirmed = (unconfirmed != FALSE);
directory = file->details->directory;
if (unconfirmed)
@@ -2823,11 +2823,6 @@ deep_count_one (DeepCountState *state,
CajaFile *file;
gboolean is_seen_inode;
- if (should_skip_file (NULL, info))
- {
- return;
- }
-
is_seen_inode = seen_inode (state, info);
if (!is_seen_inode)
{
@@ -3521,7 +3516,7 @@ top_left_read_callback (GObject *source_object,
{
file_details->top_left_text = caja_extract_top_left_text (file_contents, state->large, file_size);
file_details->got_top_left_text = TRUE;
- file_details->got_large_top_left_text = state->large;
+ file_details->got_large_top_left_text = (state->large != FALSE);
g_free (file_contents);
}
else
@@ -3812,7 +3807,7 @@ static gboolean is_trusted_system_desktop_file (GFile *file)
return FALSE;
}
- target = g_file_info_get_symlink_target (info);
+ target = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
if (!target) {
goto done;
}
@@ -3902,9 +3897,9 @@ link_info_done (CajaDirectory *directory,
{
file->details->custom_icon = g_strdup (icon);
}
- file->details->is_launcher = is_launcher;
- file->details->is_foreign_link = is_foreign;
- file->details->is_trusted_link = is_trusted;
+ file->details->is_launcher = (is_launcher != FALSE);
+ file->details->is_foreign_link = (is_foreign != FALSE);
+ file->details->is_trusted_link = (is_trusted != FALSE);
caja_directory_async_state_changed (directory);
}
@@ -4111,7 +4106,7 @@ thumbnail_done (CajaDirectory *directory,
gboolean tried_original)
{
file->details->thumbnail_is_up_to_date = TRUE;
- file->details->thumbnail_tried_original = tried_original;
+ file->details->thumbnail_tried_original = (tried_original != FALSE);
if (file->details->thumbnail)
{
g_object_unref (file->details->thumbnail);
@@ -4667,7 +4662,7 @@ got_filesystem_info (FilesystemInfoState *state, GFileInfo *info)
file->details->filesystem_use_preview =
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW);
file->details->filesystem_readonly =
- g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
+ (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY) != FALSE);
}
caja_directory_async_state_changed (directory);
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c
index 65918b08..b2a7601c 100644
--- a/libcaja-private/caja-dnd.c
+++ b/libcaja-private/caja-dnd.c
@@ -204,7 +204,7 @@ caja_drag_build_selection_list (GtkSelectionData *data)
if (*p == '\n' || *p == '\0')
{
result = g_list_prepend (result, item);
- if (p == 0)
+ if (*p != '\n')
{
g_warning ("Invalid x-special/mate-icon-list data received: "
"missing newline character.");
diff --git a/libcaja-private/caja-extensions.c b/libcaja-private/caja-extensions.c
index 59d1f8c6..2ccc9a87 100644
--- a/libcaja-private/caja-extensions.c
+++ b/libcaja-private/caja-extensions.c
@@ -67,7 +67,7 @@ extension_new (gchar *filename, gboolean state, gboolean python, GObject *module
}
else
{
- caja_debug_log (FALSE, CAJA_DEBUG_LOG_DOMAIN_USER, "Error loading keys from file: %s\n", error->message);
+ caja_debug_log (FALSE, CAJA_DEBUG_LOG_DOMAIN_USER, "Error loading keys from file \"%s\": %s\n", extension_filename, error->message);
g_error_free (error);
}
g_free (extension_filename);
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c
index 9d86d15c..52be122f 100644
--- a/libcaja-private/caja-file-conflict-dialog.c
+++ b/libcaja-private/caja-file-conflict-dialog.c
@@ -46,8 +46,6 @@ struct _CajaFileConflictDialogPrivate
gchar *conflict_name;
CajaFileListHandle *handle;
- gulong src_handler_id;
- gulong dest_handler_id;
/* UI objects */
GtkWidget *titles_vbox;
@@ -68,27 +66,18 @@ G_DEFINE_TYPE_WITH_PRIVATE (CajaFileConflictDialog,
GTK_TYPE_DIALOG);
static void
-file_icons_changed (CajaFile *file,
- CajaFileConflictDialog *fcd)
+file_icons_changed (CajaFile *file,
+ GtkWidget *widget)
{
cairo_surface_t *surface;
- surface = caja_file_get_icon_surface (fcd->details->destination,
+ surface = caja_file_get_icon_surface (file,
CAJA_ICON_SIZE_LARGE,
FALSE,
- gtk_widget_get_scale_factor (fcd->details->dest_image),
+ gtk_widget_get_scale_factor (widget),
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
- gtk_image_set_from_surface (GTK_IMAGE (fcd->details->dest_image), surface);
- cairo_surface_destroy (surface);
-
- surface = caja_file_get_icon_surface (fcd->details->source,
- CAJA_ICON_SIZE_LARGE,
- FALSE,
- gtk_widget_get_scale_factor (fcd->details->src_image),
- CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
-
- gtk_image_set_from_surface (GTK_IMAGE (fcd->details->src_image), surface);
+ gtk_image_set_from_surface (GTK_IMAGE (widget), surface);
cairo_surface_destroy (surface);
}
@@ -370,10 +359,12 @@ file_list_ready_cb (GList *files,
caja_file_monitor_add (src, fcd, CAJA_FILE_ATTRIBUTES_FOR_ICON);
caja_file_monitor_add (dest, fcd, CAJA_FILE_ATTRIBUTES_FOR_ICON);
- details->src_handler_id = g_signal_connect (src, "changed",
- G_CALLBACK (file_icons_changed), fcd);
- details->dest_handler_id = g_signal_connect (dest, "changed",
- G_CALLBACK (file_icons_changed), fcd);
+ g_signal_connect_object (src, "changed",
+ G_CALLBACK (file_icons_changed),
+ fcd->details->src_image, 0);
+ g_signal_connect_object (dest, "changed",
+ G_CALLBACK (file_icons_changed),
+ fcd->details->dest_image, 0);
}
static void
@@ -679,33 +670,38 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd)
}
static void
-do_finalize (GObject *self)
+do_dispose (GObject *self)
{
CajaFileConflictDialogPrivate *details =
CAJA_FILE_CONFLICT_DIALOG (self)->details;
- g_free (details->conflict_name);
-
if (details->handle != NULL)
{
caja_file_list_cancel_call_when_ready (details->handle);
+ details->handle = NULL;
}
-
- if (details->src_handler_id)
+ else
{
- g_signal_handler_disconnect (details->source, details->src_handler_id);
- caja_file_monitor_remove (details->source, self);
+ if (details->source)
+ caja_file_monitor_remove (details->source, self);
+ if (details->destination)
+ caja_file_monitor_remove (details->destination, self);
}
- if (details->dest_handler_id)
- {
- g_signal_handler_disconnect (details->destination, details->dest_handler_id);
- caja_file_monitor_remove (details->destination, self);
- }
+ g_clear_pointer (&details->source, caja_file_unref);
+ g_clear_pointer (&details->destination, caja_file_unref);
+ g_clear_pointer (&details->dest_dir, caja_file_unref);
+
+ G_OBJECT_CLASS (caja_file_conflict_dialog_parent_class)->dispose (self);
+}
- caja_file_unref (details->source);
- caja_file_unref (details->destination);
- caja_file_unref (details->dest_dir);
+static void
+do_finalize (GObject *self)
+{
+ CajaFileConflictDialogPrivate *details =
+ CAJA_FILE_CONFLICT_DIALOG (self)->details;
+
+ g_free (details->conflict_name);
G_OBJECT_CLASS (caja_file_conflict_dialog_parent_class)->finalize (self);
}
@@ -713,6 +709,7 @@ do_finalize (GObject *self)
static void
caja_file_conflict_dialog_class_init (CajaFileConflictDialogClass *klass)
{
+ G_OBJECT_CLASS (klass)->dispose = do_dispose;
G_OBJECT_CLASS (klass)->finalize = do_finalize;
}
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index b0c15cdb..4b51c907 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -152,6 +152,8 @@ typedef struct {
} SetPermissionsJob;
typedef enum {
+ OP_KIND_CREATE,
+ OP_KIND_LINK,
OP_KIND_COPY,
OP_KIND_MOVE,
OP_KIND_DELETE,
@@ -188,7 +190,7 @@ typedef struct {
#define DELETE_ALL _("Delete _All")
#define REPLACE_ALL _("Replace _All")
#define MERGE_ALL _("Merge _All")
-#define COPY_FORCE _("Copy _Anyway")
+#define CONTINUE_FORCE _("Continue _Anyway")
NotifyNotification *unmount_notify;
@@ -376,7 +378,7 @@ get_link_name (const char *name, int count, int max_length)
{
const char *format;
char *result;
- int unshortened_length;
+ size_t unshortened_length;
gboolean use_count;
g_assert (name != NULL);
@@ -444,10 +446,10 @@ get_link_name (const char *name, int count, int max_length)
else
result = g_strdup_printf (format, name);
- if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) {
+ if (max_length > 0 && (unshortened_length = strlen (result)) > (size_t) max_length) {
char *new_name;
- new_name = shorten_utf8_string (name, unshortened_length - max_length);
+ new_name = shorten_utf8_string (name, ((int) unshortened_length) - max_length);
if (new_name) {
g_free (result);
@@ -456,7 +458,7 @@ get_link_name (const char *name, int count, int max_length)
else
result = g_strdup_printf (format, new_name);
- g_assert (strlen (result) <= max_length);
+ g_assert (strlen (result) <= (size_t) max_length);
g_free (new_name);
}
}
@@ -655,7 +657,7 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m
{
const char *format;
char *result;
- int unshortened_length;
+ size_t unshortened_length;
gboolean use_count;
if (count < 1) {
@@ -733,10 +735,10 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m
else
result = g_strdup_printf (format, base, suffix);
- if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) {
+ if (max_length > 0 && (unshortened_length = strlen (result)) > (size_t) max_length) {
char *new_base;
- new_base = shorten_utf8_string (base, unshortened_length - max_length);
+ new_base = shorten_utf8_string (base, ((int) unshortened_length) - max_length);
if (new_base) {
g_free (result);
@@ -745,7 +747,7 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m
else
result = g_strdup_printf (format, new_base, suffix);
- g_assert (strlen (result) <= max_length);
+ g_assert (strlen (result) <= (size_t) max_length);
g_free (new_base);
}
}
@@ -962,7 +964,11 @@ init_common (gsize job_size,
GdkScreen *screen;
screen = gtk_widget_get_screen (GTK_WIDGET (parent_window));
- common->screen_num = gdk_x11_screen_get_screen_number (screen);
+ /*common->screen_num = gdk_x11_screen_get_screen_number (screen);*
+ *https://discourse.ubuntu.com/t/porting-mate-apps-to-wayland/12670
+ *Screen number is always 0 with >GTK 3.22 so we can just use zero here
+ */
+ common->screen_num = 0;
}
return common;
@@ -1491,7 +1497,7 @@ report_delete_progress (CommonJob *job,
TransferInfo *transfer_info)
{
int files_left;
- double elapsed;
+ double elapsed, transfer_rate;
gint64 now;
char *files_left_s;
@@ -1518,15 +1524,19 @@ report_delete_progress (CommonJob *job,
f (_("Deleting files")));
elapsed = g_timer_elapsed (job->time, NULL);
- if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE) {
+ transfer_rate = 0;
+ if (elapsed > 0) {
+ transfer_rate = transfer_info->num_files / elapsed;
+ }
+
+ if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE ||
+ transfer_rate <= 0) {
caja_progress_info_set_details (job->progress, files_left_s);
} else {
char *details, *time_left_s;
int remaining_time;
- double transfer_rate;
- transfer_rate = transfer_info->num_files / elapsed;
remaining_time = files_left / transfer_rate;
/* Translators: %T will expand to a time like "2 minutes".
@@ -1778,7 +1788,7 @@ delete_file (CommonJob *job, GFile *file,
}
static void
-delete_files (CommonJob *job, GList *files, int *files_skipped)
+delete_files (CommonJob *job, GList *files, guint *files_skipped)
{
GList *l;
SourceInfo source_info;
@@ -1821,10 +1831,10 @@ delete_files (CommonJob *job, GList *files, int *files_skipped)
static void
report_trash_progress (CommonJob *job,
- int files_trashed,
- int total_files)
+ guint files_trashed,
+ guint total_files)
{
- int files_left;
+ guint files_left;
char *s;
files_left = total_files - files_trashed;
@@ -1844,13 +1854,13 @@ report_trash_progress (CommonJob *job,
}
static void
-trash_files (CommonJob *job, GList *files, int *files_skipped)
+trash_files (CommonJob *job, GList *files, guint *files_skipped)
{
GList *l;
GFile *file;
GList *to_delete;
GError *error;
- int total_files, files_trashed;
+ guint total_files, files_trashed;
char *primary, *secondary, *details;
int response;
@@ -1869,7 +1879,7 @@ trash_files (CommonJob *job, GList *files, int *files_skipped)
for (l = files;
l != NULL && !job_aborted (job);
l = l->next) {
- caja_progress_info_get_ready (job->progress);
+ caja_progress_info_get_ready (job->progress, job->time);
file = l->data;
@@ -1978,7 +1988,7 @@ delete_job (GIOSchedulerJob *io_job,
gboolean must_confirm_delete_in_trash;
gboolean must_confirm_delete;
gboolean must_confirm_trash;
- int files_skipped;
+ guint files_skipped;
GFile *file = NULL;
common = (CommonJob *)job;
@@ -2518,6 +2528,10 @@ report_count_progress (CommonJob *job,
switch (source_info->op) {
default:
+ // OP_KIND_CREATE and OP_KIND_LINK don't have a source
+ g_assert_not_reached ();
+ s = f ("");
+ break;
case OP_KIND_COPY:
s = f (ngettext("Preparing to copy %'d file (%S)",
"Preparing to copy %'d files (%S)",
@@ -2567,6 +2581,9 @@ get_scan_primary (OpKind kind)
{
switch (kind) {
default:
+ // OP_KIND_CREATE and OP_KIND_LINK don't have a source
+ g_assert_not_reached ();
+ return f ("");
case OP_KIND_COPY:
return f (_("Error while copying."));
case OP_KIND_MOVE:
@@ -2816,8 +2833,29 @@ scan_sources (GList *files,
report_count_progress (job, source_info);
}
+static char *
+get_verify_primary (OpKind kind,
+ GFile *dest)
+{
+ switch (kind) {
+ default:
+ // OP_KIND_DELETE and OP_KIND_TRASH don't have a destination
+ g_assert_not_reached ();
+ return f ("");
+ case OP_KIND_CREATE:
+ return f (_("Error while creating file/directory in \"%B\"."), dest);
+ case OP_KIND_LINK:
+ return f (_("Error while creating link in \"%B\"."), dest);
+ case OP_KIND_COPY:
+ return f (_("Error while copying to \"%B\"."), dest);
+ case OP_KIND_MOVE:
+ return f (_("Error while moving to \"%B\"."), dest);
+ }
+}
+
static void
verify_destination (CommonJob *job,
+ OpKind kind,
GFile *dest,
char **dest_fs_id,
goffset required_size)
@@ -2849,7 +2887,7 @@ verify_destination (CommonJob *job,
return;
}
- primary = f (_("Error while copying to \"%B\"."), dest);
+ primary = get_verify_primary (kind, dest);
details = NULL;
if (IS_IO_ERROR (error, PERMISSION_DENIED)) {
@@ -2891,7 +2929,7 @@ verify_destination (CommonJob *job,
g_object_unref (info);
if (file_type != G_FILE_TYPE_DIRECTORY) {
- primary = f (_("Error while copying to \"%B\"."), dest);
+ primary = get_verify_primary (kind, dest);
secondary = f (_("The destination is not a folder."));
response = run_error (job,
@@ -2923,11 +2961,11 @@ verify_destination (CommonJob *job,
free_size = g_file_info_get_attribute_uint64 (fsinfo,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
- if (free_size < required_size) {
- primary = f (_("Error while copying to \"%B\"."), dest);
+ if (free_size < (guint64) required_size) {
+ primary = get_verify_primary (kind, dest);
secondary = f(_("There is not enough space on the destination. Try to remove files to make space."));
- details = f (_("There is %S available, but %S is required."), free_size, required_size);
+ details = f (_("There is %" G_GUINT64_FORMAT " available, but %" G_GOFFSET_FORMAT " is required."), free_size, required_size);
response = run_warning (job,
primary,
@@ -2935,7 +2973,7 @@ verify_destination (CommonJob *job,
details,
FALSE,
CANCEL,
- COPY_FORCE,
+ CONTINUE_FORCE,
RETRY,
NULL);
@@ -2944,7 +2982,7 @@ verify_destination (CommonJob *job,
} else if (response == 2) {
goto retry;
} else if (response == 1) {
- /* We are forced to copy - just fall through ... */
+ /* We are forced to continue - just fall through ... */
} else {
g_assert_not_reached ();
}
@@ -2954,7 +2992,7 @@ verify_destination (CommonJob *job,
if (!job_aborted (job) &&
g_file_info_get_attribute_boolean (fsinfo,
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY)) {
- primary = f (_("Error while copying to \"%B\"."), dest);
+ primary = get_verify_primary (kind, dest);
secondary = f (_("The destination is read-only."));
response = run_error (job,
@@ -3075,8 +3113,8 @@ report_copy_progress (CopyMoveJob *copy_job,
transfer_rate = transfer_info->num_bytes / elapsed;
}
- if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE &&
- transfer_rate > 0) {
+ if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE ||
+ transfer_rate <= 0) {
char *s;
/* Translators: %S will expand to a size like "2 bytes" or "3 MB", so something like "4 kb of 4 MB" */
s = f (_("%S of %S"), transfer_info->num_bytes, total_size);
@@ -3174,7 +3212,7 @@ make_file_name_valid_for_dest_fs (char *filename,
!strcmp (dest_fs_type, "msdos") ||
!strcmp (dest_fs_type, "msdosfs")) {
gboolean ret;
- int i, old_len;
+ size_t i, old_len;
ret = str_replace (filename, FAT_FORBIDDEN_CHARACTERS, '_');
@@ -3594,7 +3632,7 @@ copy_move_directory (CopyMoveJob *copy_job,
nextinfo = g_file_enumerator_next_file (enumerator, job->cancellable, skip_error?NULL:&error);
while (!job_aborted (job) &&
(info = nextinfo) != NULL) {
- caja_progress_info_get_ready (job->progress);
+ caja_progress_info_get_ready (job->progress, job->time);
nextinfo = g_file_enumerator_next_file (enumerator, job->cancellable, skip_error?NULL:&error);
src_file = g_file_get_child (src,
@@ -4028,7 +4066,7 @@ do_run_conflict_dialog (gpointer _data)
if (response == CONFLICT_RESPONSE_RENAME) {
data->resp_data->new_name =
caja_file_conflict_dialog_get_new_name (CAJA_FILE_CONFLICT_DIALOG (dialog));
- } else if (response != GTK_RESPONSE_CANCEL ||
+ } else if (response != GTK_RESPONSE_CANCEL &&
response != GTK_RESPONSE_NONE) {
data->resp_data->apply_to_all =
caja_file_conflict_dialog_get_apply_to_all
@@ -4560,7 +4598,7 @@ copy_files (CopyMoveJob *job,
for (l = job->files;
l != NULL && !job_aborted (common);
l = l->next) {
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
src = l->data;
@@ -4664,6 +4702,7 @@ copy_job (GIOSchedulerJob *io_job,
}
verify_destination (&job->common,
+ OP_KIND_COPY,
dest,
&dest_fs_id,
source_info.num_bytes);
@@ -4876,7 +4915,7 @@ move_file_prepare (CopyMoveJob *move_job,
}
retry:
- caja_progress_info_get_ready (job->progress);
+ caja_progress_info_get_ready (job->progress, job->time);
flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE;
if (overwrite) {
@@ -5052,7 +5091,7 @@ move_files_prepare (CopyMoveJob *job,
total = left = g_list_length (job->files);
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
report_move_progress (job, total, left);
i = 0;
@@ -5116,7 +5155,7 @@ move_files (CopyMoveJob *job,
for (l = fallbacks;
l != NULL && !job_aborted (common);
l = l->next) {
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
fallback = l->data;
src = fallback->file;
@@ -5192,6 +5231,7 @@ move_job (GIOSchedulerJob *io_job,
caja_progress_info_start (job->common.progress);
verify_destination (&job->common,
+ OP_KIND_MOVE,
job->destination,
&dest_fs_id,
-1);
@@ -5221,6 +5261,7 @@ move_job (GIOSchedulerJob *io_job,
}
verify_destination (&job->common,
+ OP_KIND_MOVE,
job->destination,
NULL,
source_info.num_bytes);
@@ -5228,6 +5269,8 @@ move_job (GIOSchedulerJob *io_job,
goto aborted;
}
+ g_timer_start (job->common.time);
+
memset (&transfer_info, 0, sizeof (transfer_info));
move_files (job,
fallbacks,
@@ -5522,6 +5565,7 @@ link_job (GIOSchedulerJob *io_job,
caja_progress_info_start (job->common.progress);
verify_destination (&job->common,
+ OP_KIND_LINK,
job->destination,
NULL,
-1);
@@ -5537,7 +5581,7 @@ link_job (GIOSchedulerJob *io_job,
for (l = job->files;
l != NULL && !job_aborted (common);
l = l->next) {
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
src = l->data;
@@ -5679,7 +5723,7 @@ set_permissions_file (SetPermissionsJob *job,
caja_progress_info_pulse_progress (common->progress);
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
free_info = FALSE;
if (info == NULL) {
@@ -6005,6 +6049,7 @@ create_job (GIOSchedulerJob *io_job,
max_length = get_max_name_length (job->dest_dir);
verify_destination (common,
+ OP_KIND_CREATE,
job->dest_dir,
NULL, -1);
if (job_aborted (common)) {
@@ -6043,7 +6088,7 @@ create_job (GIOSchedulerJob *io_job,
count = 1;
retry:
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
error = NULL;
if (job->make_dir) {
@@ -6134,11 +6179,13 @@ create_job (GIOSchedulerJob *io_job,
if (count == 1) {
new_filename = g_strdup (filename);
} else if (job->make_dir) {
- filename2 = g_strdup_printf ("%s %d", filename, count);
+ size_t unshortened_length;
+ filename2 = g_strdup_printf ("%s %d", filename, count);
+ unshortened_length = strlen (filename2);
new_filename = NULL;
- if (max_length > 0 && strlen (filename2) > max_length) {
- new_filename = shorten_utf8_string (filename2, strlen (filename2) - max_length);
+ if (max_length > 0 && unshortened_length > (size_t) max_length) {
+ new_filename = shorten_utf8_string (filename2, ((int) unshortened_length) - max_length);
}
if (new_filename == NULL) {
@@ -6371,7 +6418,7 @@ delete_trash_file (CommonJob *job,
gboolean del_file,
gboolean del_children)
{
- caja_progress_info_get_ready (job->progress);
+ caja_progress_info_get_ready (job->progress, job->time);
if (job_aborted (job)) {
return;
@@ -6520,7 +6567,7 @@ mark_desktop_file_trusted (CommonJob *common,
GFileInfo *info;
retry:
- caja_progress_info_get_ready (common->progress);
+ caja_progress_info_get_ready (common->progress, common->time);
error = NULL;
if (!g_file_load_contents (file,
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index a5ed4ff9..1c7802da 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -257,7 +257,7 @@ caja_file_set_display_name (CajaFile *file,
}
}
- file->details->got_custom_display_name = custom;
+ file->details->got_custom_display_name = (custom != FALSE);
return changed;
}
@@ -2188,7 +2188,7 @@ update_info_internal (CajaFile *file,
if (file->details->is_symlink != is_symlink) {
changed = TRUE;
}
- file->details->is_symlink = is_symlink;
+ file->details->is_symlink = (is_symlink != FALSE);
is_hidden = g_file_info_get_is_hidden (info);
is_backup = g_file_info_get_is_backup (info);
@@ -2196,14 +2196,14 @@ update_info_internal (CajaFile *file,
file->details->is_backup != is_backup) {
changed = TRUE;
}
- file->details->is_hidden = is_hidden;
- file->details->is_backup = is_backup;
+ file->details->is_hidden = (is_hidden != FALSE);
+ file->details->is_backup = (is_backup != FALSE);
is_mountpoint = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT);
if (file->details->is_mountpoint != is_mountpoint) {
changed = TRUE;
}
- file->details->is_mountpoint = is_mountpoint;
+ file->details->is_mountpoint = (is_mountpoint != FALSE);
has_permissions = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE);
permissions = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE);;
@@ -2211,7 +2211,7 @@ update_info_internal (CajaFile *file,
file->details->permissions != permissions) {
changed = TRUE;
}
- file->details->has_permissions = has_permissions;
+ file->details->has_permissions = (has_permissions != FALSE);
file->details->permissions = permissions;
/* We default to TRUE for this if we can't know */
@@ -2308,21 +2308,21 @@ update_info_internal (CajaFile *file,
changed = TRUE;
}
- file->details->can_read = can_read;
- file->details->can_write = can_write;
- file->details->can_execute = can_execute;
- file->details->can_delete = can_delete;
- file->details->can_trash = can_trash;
- file->details->can_rename = can_rename;
- file->details->can_mount = can_mount;
- file->details->can_unmount = can_unmount;
- file->details->can_eject = can_eject;
- file->details->can_start = can_start;
- file->details->can_start_degraded = can_start_degraded;
- file->details->can_stop = can_stop;
+ file->details->can_read = (can_read != FALSE);
+ file->details->can_write = (can_write != FALSE);
+ file->details->can_execute = (can_execute != FALSE);
+ file->details->can_delete = (can_delete != FALSE);
+ file->details->can_trash = (can_trash != FALSE);
+ file->details->can_rename = (can_rename != FALSE);
+ file->details->can_mount = (can_mount != FALSE);
+ file->details->can_unmount = (can_unmount != FALSE);
+ file->details->can_eject = (can_eject != FALSE);
+ file->details->can_start = (can_start != FALSE);
+ file->details->can_start_degraded = (can_start_degraded != FALSE);
+ file->details->can_stop = (can_stop != FALSE);
file->details->start_stop_type = start_stop_type;
- file->details->can_poll_for_media = can_poll_for_media;
- file->details->is_media_check_automatic = is_media_check_automatic;
+ file->details->can_poll_for_media = (can_poll_for_media != FALSE);
+ file->details->is_media_check_automatic = (is_media_check_automatic != FALSE);
free_owner = FALSE;
owner = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_USER);
@@ -2396,7 +2396,7 @@ update_info_internal (CajaFile *file,
}
file->details->size_on_disk = size_on_disk;
- sort_order = g_file_info_get_sort_order (info);
+ sort_order = g_file_info_get_attribute_int32 (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER);
if (file->details->sort_order != sort_order) {
changed = TRUE;
}
@@ -2448,10 +2448,11 @@ update_info_internal (CajaFile *file,
thumbnailing_failed = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED);
if (file->details->thumbnailing_failed != thumbnailing_failed) {
changed = TRUE;
- file->details->thumbnailing_failed = thumbnailing_failed;
+ file->details->thumbnailing_failed = (thumbnailing_failed != FALSE);
}
- symlink_name = g_file_info_get_symlink_target (info);
+ symlink_name = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
+
if (eel_strcmp (file->details->symlink_name, symlink_name) != 0) {
changed = TRUE;
g_free (file->details->symlink_name);
@@ -4848,7 +4849,7 @@ caja_file_fit_date_as_string (CajaFile *file,
char *date_string;
gchar *result = NULL;
int i;
- GDateTime *date_time, *today;
+ GDateTime *date_time, *today, *end_of_today;
GTimeSpan file_date_age;
if (!caja_file_get_date (file, date_type, &file_time_raw)) {
@@ -4866,9 +4867,15 @@ caja_file_fit_date_as_string (CajaFile *file,
}
today = g_date_time_new_now_local ();
- file_date_age = g_date_time_difference (today, date_time);
+ end_of_today = g_date_time_add_full (today, 0, 0, 1,
+ -1 * g_date_time_get_hour (today),
+ -1 * g_date_time_get_minute (today),
+ -1.0 * g_date_time_get_seconds (today));
g_date_time_unref (today);
+ file_date_age = g_date_time_difference (end_of_today, date_time);
+ g_date_time_unref (end_of_today);
+
/* Format varies depending on how old the date is. This minimizes
* the length (and thus clutter & complication) of typical dates
* while providing sufficient detail for recent dates to make
@@ -4877,12 +4884,12 @@ caja_file_fit_date_as_string (CajaFile *file,
* internationalization's sake.
*/
- if (file_date_age < G_TIME_SPAN_DAY) {
- formats = TODAY_TIME_FORMATS;
- } else if (file_date_age < 2 * G_TIME_SPAN_DAY) {
+ if (file_date_age <= 0 || file_date_age > 2 * G_TIME_SPAN_DAY) {
+ formats = CURRENT_WEEK_TIME_FORMATS;
+ } else if (file_date_age > G_TIME_SPAN_DAY) {
formats = YESTERDAY_TIME_FORMATS;
} else {
- formats = CURRENT_WEEK_TIME_FORMATS;
+ formats = TODAY_TIME_FORMATS;
}
/* Find the date format that just fits the required width. Instead of measuring
@@ -5011,6 +5018,12 @@ static void
show_text_in_icons_changed_callback (gpointer callback_data)
{
show_text_in_icons = g_settings_get_enum (caja_preferences, CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS);
+
+ /* Tell the world that icons might have changed. We could invent a narrower-scope
+ * signal to mean only "thumbnails might have changed" if this ends up being slow
+ * for some reason.
+ */
+ emit_change_signals_for_all_files_in_all_directories ();
}
static void
@@ -5101,22 +5114,8 @@ caja_file_should_show_type (CajaFile *file)
gboolean
caja_file_should_get_top_left_text (CajaFile *file)
{
- static gboolean show_text_in_icons_callback_added = FALSE;
-
g_return_val_if_fail (CAJA_IS_FILE (file), FALSE);
- /* Add the callback once for the life of our process */
- if (!show_text_in_icons_callback_added) {
- g_signal_connect_swapped (caja_preferences,
- "changed::" CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS,
- G_CALLBACK (show_text_in_icons_changed_callback),
- NULL);
- show_text_in_icons_callback_added = TRUE;
-
- /* Peek for the first time */
- show_text_in_icons_changed_callback (NULL);
- }
-
if (show_text_in_icons == CAJA_SPEED_TRADEOFF_ALWAYS) {
return TRUE;
}
@@ -6254,9 +6253,9 @@ caja_file_get_size_as_string (CajaFile *file,
}
if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- return g_format_size_full (size, G_FORMAT_SIZE_IEC_UNITS);
+ return g_format_size_full ((guint64) size, G_FORMAT_SIZE_IEC_UNITS);
else
- return g_format_size (size);
+ return g_format_size ((guint64) size);
}
/**
@@ -7598,7 +7597,7 @@ caja_file_peek_top_left_text (CajaFile *file,
if (!file->details->got_top_left_text) {
if (caja_file_contains_text (file)) {
- return " ...";
+ return "Lorem ipsum sit dolor amet...";
}
return NULL;
}
@@ -7987,7 +7986,7 @@ caja_file_set_has_open_window (CajaFile *file,
has_open_window = (has_open_window != FALSE);
if (file->details->has_open_window != has_open_window) {
- file->details->has_open_window = has_open_window;
+ file->details->has_open_window = (has_open_window != FALSE);
caja_file_changed (file);
}
}
@@ -8006,7 +8005,7 @@ caja_file_set_is_thumbnailing (CajaFile *file,
{
g_return_if_fail (CAJA_IS_FILE (file));
- file->details->is_thumbnailing = is_thumbnailing;
+ file->details->is_thumbnailing = (is_thumbnailing != FALSE);
}
/**
@@ -8655,6 +8654,11 @@ caja_file_class_init (CajaFileClass *class)
"changed::" CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
G_CALLBACK (show_thumbnails_changed_callback),
NULL);
+ show_text_in_icons_changed_callback (NULL);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS,
+ G_CALLBACK (show_text_in_icons_changed_callback),
+ NULL);
icon_theme = gtk_icon_theme_get_default ();
g_signal_connect_object (icon_theme,
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 008a9048..43c340d0 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -420,7 +420,7 @@ caja_icon_canvas_item_set_property (GObject *object,
{
return;
}
- details->is_highlighted_for_selection = g_value_get_boolean (value);
+ details->is_highlighted_for_selection = (g_value_get_boolean (value) != FALSE);
caja_icon_canvas_item_invalidate_label_size (item);
atk_object_notify_state_change (accessible, ATK_STATE_SELECTED,
@@ -432,7 +432,7 @@ caja_icon_canvas_item_set_property (GObject *object,
{
return;
}
- details->is_highlighted_as_keyboard_focus = g_value_get_boolean (value);
+ details->is_highlighted_as_keyboard_focus = (g_value_get_boolean (value) != FALSE);
atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED,
details->is_highlighted_as_keyboard_focus);
break;
@@ -442,7 +442,7 @@ caja_icon_canvas_item_set_property (GObject *object,
{
return;
}
- details->is_highlighted_for_drop = g_value_get_boolean (value);
+ details->is_highlighted_for_drop = (g_value_get_boolean (value) != FALSE);
break;
case PROP_HIGHLIGHTED_FOR_CLIPBOARD:
@@ -450,7 +450,7 @@ caja_icon_canvas_item_set_property (GObject *object,
{
return;
}
- details->is_highlighted_for_clipboard = g_value_get_boolean (value);
+ details->is_highlighted_for_clipboard = (g_value_get_boolean (value) != FALSE);
break;
default:
@@ -1431,7 +1431,7 @@ caja_icon_canvas_item_set_is_visible (CajaIconCanvasItem *item,
if (item->details->is_visible == visible)
return;
- item->details->is_visible = visible;
+ item->details->is_visible = (visible != FALSE);
if (!visible)
{
@@ -1827,7 +1827,7 @@ map_surface (CajaIconCanvasItem *icon_item)
icon_item->details->rendered_is_highlighted_for_selection = icon_item->details->is_highlighted_for_selection;
icon_item->details->rendered_is_highlighted_for_drop = icon_item->details->is_highlighted_for_drop;
icon_item->details->rendered_is_highlighted_for_clipboard = icon_item->details->is_highlighted_for_clipboard;
- icon_item->details->rendered_is_focused = gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas));
+ icon_item->details->rendered_is_focused = (gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas)) != FALSE);
}
cairo_surface_reference (icon_item->details->rendered_surface);
@@ -2128,10 +2128,10 @@ caja_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
* should be separate. The "unpreview" signal
* does not have a return value.
*/
- icon_item->details->is_active = caja_icon_container_emit_preview_signal
- (CAJA_ICON_CONTAINER (item->canvas),
- CAJA_ICON_CANVAS_ITEM (item)->user_data,
- TRUE);
+ icon_item->details->is_active =
+ (caja_icon_container_emit_preview_signal (CAJA_ICON_CONTAINER (item->canvas),
+ CAJA_ICON_CANVAS_ITEM (item)->user_data,
+ TRUE) != FALSE);
}
return TRUE;
@@ -2583,7 +2583,7 @@ caja_icon_canvas_item_set_show_stretch_handles (CajaIconCanvasItem *item,
return;
}
- item->details->show_stretch_handles = show_stretch_handles;
+ item->details->show_stretch_handles = (show_stretch_handles != FALSE);
eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
}
@@ -2691,7 +2691,7 @@ caja_icon_canvas_item_set_renaming (CajaIconCanvasItem *item, gboolean state)
return;
}
- item->details->is_renaming = state;
+ item->details->is_renaming = (state != FALSE);
eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
}
@@ -2744,7 +2744,7 @@ caja_icon_canvas_item_set_entire_text (CajaIconCanvasItem *item,
gboolean entire_text)
{
if (item->details->entire_text != entire_text) {
- item->details->entire_text = entire_text;
+ item->details->entire_text = (entire_text != FALSE);
caja_icon_canvas_item_invalidate_label_size (item);
eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 77626b2d..4e01bdb2 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -296,14 +296,16 @@ icon_is_positioned (const CajaIcon *icon)
/* x, y are the top-left coordinates of the icon. */
static void
-icon_set_position (CajaIcon *icon,
- double x, double y)
+icon_set_position_full (CajaIcon *icon,
+ double x, double y,
+ gboolean force)
{
CajaIconContainer *container;
int x1, x2, y1, y2;
EelDRect icon_bounds;
+ GdkDisplay *display;
- if (icon->x == x && icon->y == y)
+ if (!force && icon->x == x && icon->y == y)
{
return;
}
@@ -314,39 +316,61 @@ icon_set_position (CajaIcon *icon,
{
end_renaming_mode (container, TRUE);
}
-
+ double pixels_per_unit;
+ int container_left, container_top, container_right, container_bottom;
+ int container_x, container_y, container_width, container_height;
+ int item_width, item_height;
+ int height_above, width_left;
+ int min_x, max_x, min_y, max_y;
if (caja_icon_container_get_is_fixed_size (container))
{
- double pixels_per_unit;
- int container_left, container_top, container_right, container_bottom;
- int container_x, container_y, container_width, container_height;
- int item_width, item_height;
- int height_above, width_left;
- int min_x, max_x, min_y, max_y;
- int scale;
-
- /* FIXME: This should be:
-
- container_x = GTK_WIDGET (container)->allocation.x;
- container_y = GTK_WIDGET (container)->allocation.y;
- container_width = GTK_WIDGET (container)->allocation.width;
- container_height = GTK_WIDGET (container)->allocation.height;
-
- But for some reason the widget allocation is sometimes not done
- at startup, and the allocation is then only 45x60. which is
- really bad.
-
- For now, we have a cheesy workaround:
- */
- scale = gtk_widget_get_scale_factor (GTK_WIDGET (container));
- container_x = 0;
- container_y = 0;
- container_width = WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_x
+ /*Use the older and well tested code in x11*/
+ display = gdk_screen_get_display (gdk_screen_get_default());
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ int scale;
+
+ /* FIXME: This should be:
+
+ container_x = GTK_WIDGET (container)->allocation.x;
+ container_width = GTK_WIDGET (container)->allocation.width;
+ container_height = GTK_WIDGET (container)->allocation.height;
+
+ But for some reason the widget allocation is sometimes not done
+ at startup, and the allocation is then only 45x60. which is
+ really bad.
+
+ For now, we have a cheesy workaround:
+ */
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (container));
+ container_x = 0;
+ container_y = 0;
+ container_width = WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_x
+ - container->details->left_margin
+ - container->details->right_margin;
+ container_height = HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_y
+ - container->details->top_margin
+ - container->details->bottom_margin;
+ }
+ else
+ {
+ GdkWindow *window;
+ GdkMonitor *monitor;
+ GdkRectangle workarea = {0};
+
+ window = gtk_widget_get_window (GTK_WIDGET(container));
+ monitor = gdk_display_get_monitor_at_window (gdk_display_get_default(), window);
+ gdk_monitor_get_workarea(monitor, &workarea);
+ container_x = 0;
+ container_y = 0;
+ container_width = workarea.width - container_x
- container->details->left_margin
- container->details->right_margin;
- container_height = HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_y
+ container_height = workarea.height - container_y
- container->details->top_margin
- container->details->bottom_margin;
+ }
+
pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
/* Clip the position of the icon within our desktop bounds */
container_left = container_x / pixels_per_unit;
@@ -392,6 +416,13 @@ icon_set_position (CajaIcon *icon,
}
static void
+icon_set_position (CajaIcon *icon,
+ double x, double y)
+{
+ icon_set_position_full (icon, x, y, FALSE);
+}
+
+static void
icon_get_size (CajaIconContainer *container,
CajaIcon *icon,
guint *size)
@@ -2387,7 +2418,8 @@ redo_layout (CajaIconContainer *container)
}
static void
-reload_icon_positions (CajaIconContainer *container)
+reload_icon_positions (CajaIconContainer *container,
+ gboolean layout_changed)
{
GList *p, *no_position_icons;
gboolean have_stored_position;
@@ -2417,7 +2449,12 @@ reload_icon_positions (CajaIconContainer *container)
&have_stored_position);
if (have_stored_position)
{
- icon_set_position (icon, position.x, position.y);
+ icon_set_position_full (icon, position.x, position.y,
+ /* if only layout changed, don't bother
+ * updating already valid info. If however
+ * e.g. zoom changed, x and y might now be
+ * overflowing and need recomputing */
+ !layout_changed);
item = EEL_CANVAS_ITEM (icon->item);
caja_icon_canvas_item_get_bounds_for_layout (icon->item,
&bounds.x0,
@@ -2435,15 +2472,20 @@ reload_icon_positions (CajaIconContainer *container)
bottom = bounds.y1;
}
}
- else
+ else if (layout_changed)
{
no_position_icons = g_list_prepend (no_position_icons, icon);
}
}
- no_position_icons = g_list_reverse (no_position_icons);
- /* Place all the other icons. */
- lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM);
+ if (layout_changed)
+ {
+ /* If layout changed, place all the other icons that don't have stored
+ * positions yet */
+ no_position_icons = g_list_reverse (no_position_icons);
+ lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM);
+ }
+
g_list_free (no_position_icons);
}
@@ -4374,7 +4416,10 @@ destroy (GtkWidget *object)
/* destroy interactive search dialog */
if (container->details->search_window)
{
- gtk_widget_destroy (container->details->search_window);
+ /*current GTK docs do not advise calling gtk_widget_destroy on child widgets
+ *gtk_widget_destroy (container->details->search_window);
+ *also note that GtkContainer destroys it's child widgets when it is destroyed
+ */
container->details->search_window = NULL;
container->details->search_entry = NULL;
if (container->details->typeselect_flush_timeout)
@@ -4564,6 +4609,19 @@ draw (GtkWidget *widget, cairo_t *cr)
{
eel_background_draw (widget, cr);
}
+ /*If this is the desktop on wayland, we must draw it from here
+ *Calling eel_background_draw() from caja_desktop_window_class_init()
+ *as we do in x11 gives a black background on wayland
+ *Wayland is always composited but never has a root window
+ *We don't have a root window to draw on
+ *the code used for x11 without compositing somehow fails too
+ *But we can get caja's toplevel window from here and draw on it
+ */
+ if ((!(GDK_IS_X11_DISPLAY (gdk_display_get_default()))) && (CAJA_ICON_CONTAINER (widget)->details->is_desktop))
+ {
+ GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
+ eel_background_draw (toplevel, cr);
+ }
return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->draw (widget,
cr);
@@ -5234,17 +5292,19 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
gint x, y;
gint cont_x, cont_y;
gint cont_width, cont_height;
- gint scale;
GdkWindow *cont_window;
GdkScreen *screen;
GtkRequisition requisition;
GdkMonitor *monitor_num;
GdkRectangle monitor;
+ GdkRectangle workarea = {0};
cont_window = gtk_widget_get_window (GTK_WIDGET (container));
- scale = gtk_widget_get_scale_factor (GTK_WIDGET (container));
screen = gdk_window_get_screen (cont_window);
+ monitor_num = gdk_display_get_monitor_at_window (gdk_display_get_default(), cont_window);
+ gdk_monitor_get_workarea(monitor_num, &workarea);
+
monitor_num = gdk_display_get_monitor_at_window (gdk_screen_get_display (screen),
cont_window);
gdk_monitor_get_geometry (monitor_num, &monitor);
@@ -5258,9 +5318,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
gtk_widget_get_preferred_size (search_dialog, &requisition, NULL);
- if (cont_x + cont_width - requisition.width > WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale)
+ if (cont_x + cont_width - requisition.width > workarea.width)
{
- x = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale - requisition.width;
+ x = workarea.width - requisition.width;
}
else if (cont_x + cont_width - requisition.width < 0)
{
@@ -5271,9 +5331,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
x = cont_x + cont_width - requisition.width;
}
- if (cont_y + cont_height > HeightOfScreen (gdk_x11_screen_get_xscreen (screen)))
+ if (cont_y + cont_height > workarea.height)
{
- y = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.height;
+ y = workarea.height - requisition.height;
}
else if (cont_y + cont_height < 0) /* isn't really possible ... */
{
@@ -5727,7 +5787,7 @@ caja_icon_container_search_init (GtkWidget *entry,
static void
caja_icon_container_ensure_interactive_directory (CajaIconContainer *container)
{
- GtkWidget *frame, *vbox;
+ GtkWidget *frame, *vbox, *toplevel;
if (container->details->search_window != NULL)
{
@@ -5735,8 +5795,14 @@ caja_icon_container_ensure_interactive_directory (CajaIconContainer *container)
}
container->details->search_window = gtk_window_new (GTK_WINDOW_POPUP);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
gtk_window_set_modal (GTK_WINDOW (container->details->search_window), TRUE);
+ gtk_window_set_decorated (GTK_WINDOW (container->details->search_window), FALSE);
+ gtk_window_set_transient_for (GTK_WINDOW (container->details->search_window),
+ GTK_WINDOW (toplevel));
+
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (container->details->search_window), TRUE);
gtk_window_set_type_hint (GTK_WINDOW (container->details->search_window),
GDK_WINDOW_TYPE_HINT_COMBO);
@@ -6018,10 +6084,8 @@ key_press_event (GtkWidget *widget,
char *old_text;
const char *new_text;
gboolean retval;
- GdkScreen *screen;
gboolean text_modified;
gulong popup_menu_id;
- gint scale;
caja_icon_container_ensure_interactive_directory (container);
@@ -6035,12 +6099,6 @@ key_press_event (GtkWidget *widget,
popup_menu_id = g_signal_connect (container->details->search_entry,
"popup_menu", G_CALLBACK (gtk_true), NULL);
- /* Move the entry off screen */
- screen = gtk_widget_get_screen (GTK_WIDGET (container));
- scale = gtk_widget_get_scale_factor (GTK_WIDGET (container));
- gtk_window_move (GTK_WINDOW (container->details->search_window),
- WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale + 1,
- HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale + 1);
gtk_widget_show (container->details->search_window);
/* Send the event to the window. If the preedit_changed signal is emitted
@@ -7615,6 +7673,8 @@ caja_icon_container_update_icon (CajaIconContainer *container,
}
eel_canvas_item_set (EEL_CANVAS_ITEM (icon->item),
+ /* "editable_text", g_strdup_printf("%d %d %d %d", attach_points[0], attach_points[1], attach_points[2], attach_points[3]), */
+ /* "editable_text", g_strdup_printf("%d %d %d %d", embedded_text_rect.x, embedded_text_rect.y, embedded_text_rect.width, embedded_text_rect.height), */
"editable_text", editable_text,
"additional_text", additional_text,
"highlighted_for_drop", icon == details->drop_target,
@@ -7668,19 +7728,6 @@ assign_icon_position (CajaIconContainer *container,
}
static void
-finish_adding_icon (CajaIconContainer *container,
- CajaIcon *icon)
-{
- caja_icon_container_update_icon (container, icon);
- eel_canvas_item_show (EEL_CANVAS_ITEM (icon->item));
-
- g_signal_connect_object (icon->item, "event",
- G_CALLBACK (item_event_callback), container, 0);
-
- g_signal_emit (container, signals[ICON_ADDED], 0, icon->data);
-}
-
-static void
finish_adding_new_icons (CajaIconContainer *container)
{
GList *p, *new_icons, *no_position_icons, *semi_position_icons;
@@ -7698,6 +7745,7 @@ finish_adding_new_icons (CajaIconContainer *container)
for (p = new_icons; p != NULL; p = p->next)
{
icon = p->data;
+ caja_icon_container_update_icon (container, icon);
if (icon->has_lazy_position)
{
assign_icon_position (container, icon);
@@ -7708,7 +7756,12 @@ finish_adding_new_icons (CajaIconContainer *container)
no_position_icons = g_list_prepend (no_position_icons, icon);
}
- finish_adding_icon (container, icon);
+ eel_canvas_item_show (EEL_CANVAS_ITEM (icon->item));
+
+ g_signal_connect_object (icon->item, "event",
+ G_CALLBACK (item_event_callback), container, 0);
+
+ g_signal_emit (container, signals[ICON_ADDED], 0, icon->data);
}
g_list_free (new_icons);
@@ -7852,7 +7905,7 @@ caja_icon_container_add (CajaIconContainer *container,
* if the previous icon position is free. If the position
* is occupied, another position near the last one will
*/
- icon->has_lazy_position = is_old_or_unknown_icon_data (container, data);
+ icon->has_lazy_position = (is_old_or_unknown_icon_data (container, data) != FALSE);
icon->scale = 1.0;
icon->item = CAJA_ICON_CANVAS_ITEM
(eel_canvas_item_new (EEL_CANVAS_GROUP (EEL_CANVAS (container)->root),
@@ -7968,6 +8021,7 @@ caja_icon_container_set_zoom_level (CajaIconContainer *container, int new_level)
CajaIconContainerDetails *details;
int pinned_level;
double pixels_per_unit;
+ guint icon_size;
details = container->details;
@@ -7990,8 +8044,8 @@ caja_icon_container_set_zoom_level (CajaIconContainer *container, int new_level)
details->zoom_level = pinned_level;
- pixels_per_unit = (double) caja_get_icon_size_for_zoom_level (pinned_level)
- / CAJA_ICON_SIZE_STANDARD;
+ icon_size = caja_get_icon_size_for_zoom_level (pinned_level);
+ pixels_per_unit = ((double) icon_size) / ((double) CAJA_ICON_SIZE_STANDARD);
eel_canvas_set_pixels_per_unit (EEL_CANVAS (container), pixels_per_unit);
invalidate_labels (container);
@@ -8020,6 +8074,11 @@ caja_icon_container_request_update_all (CajaIconContainer *container)
caja_icon_container_update_icon (container, icon);
}
+ /* on manual layout we need to reload icon positions, as that might be
+ * affected by the view size, zoom, etc. */
+ if (!container->details->auto_layout)
+ reload_icon_positions (container, FALSE);
+
redo_layout (container);
container->details->is_loading = FALSE;
}
@@ -8621,7 +8680,7 @@ caja_icon_container_set_auto_layout (CajaIconContainer *container,
if (!auto_layout)
{
- reload_icon_positions (container);
+ reload_icon_positions (container, TRUE);
caja_icon_container_freeze_icon_positions (container);
}
@@ -10153,7 +10212,7 @@ caja_icon_container_get_store_layout_timestamps (CajaIconContainer *container)
void
caja_icon_container_set_store_layout_timestamps (CajaIconContainer *container,
- gboolean store_layout_timestamps)
+ gboolean store_layout_timestamps)
{
- container->details->store_layout_timestamps = store_layout_timestamps;
+ container->details->store_layout_timestamps = (store_layout_timestamps != FALSE);
}
diff --git a/libcaja-private/caja-icon-container.h b/libcaja-private/caja-icon-container.h
index d78310d5..749c3b4e 100644
--- a/libcaja-private/caja-icon-container.h
+++ b/libcaja-private/caja-icon-container.h
@@ -45,7 +45,7 @@
#define CAJA_ICON_CONTAINER_ICON_DATA(pointer) \
((CajaIconData *) (pointer))
-typedef struct CajaIconData CajaIconData;
+typedef void CajaIconData;
typedef void (* CajaIconCallback) (CajaIconData *icon_data,
gpointer callback_data);
diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c
index dde633e3..913e085f 100644
--- a/libcaja-private/caja-icon-dnd.c
+++ b/libcaja-private/caja-icon-dnd.c
@@ -620,8 +620,6 @@ caja_icon_container_selection_items_local (CajaIconContainer *container,
/* must have at least one item */
g_assert (items);
- result = FALSE;
-
/* get the URI associated with the container */
container_uri_string = get_container_uri (container);
@@ -948,7 +946,6 @@ handle_local_move (CajaIconContainer *container,
GList *moved_icons, *p;
CajaFile *file;
char screen_string[32];
- GdkScreen *screen;
time_t now;
CajaDragSelectionItem *item = NULL;
CajaIcon *icon = NULL;
@@ -973,13 +970,15 @@ handle_local_move (CajaIconContainer *container,
{
/* probably dragged from another screen. Add it to
* this screen
+ * Update: since GTK 3.22 there is only ONE screen
+ * even with multiple monitors
*/
file = caja_file_get_by_uri (item->uri);
-
- screen = gtk_widget_get_screen (GTK_WIDGET (container));
+
g_snprintf (screen_string, sizeof (screen_string), "%d",
- gdk_x11_screen_get_screen_number (screen));
+ /*gdk_x11_screen_get_screen_number (screen)); This is ALWAYS 0 since GTK 3.22*/
+ 0);
caja_file_set_metadata (file,
CAJA_METADATA_KEY_SCREEN,
NULL, screen_string);
@@ -1908,8 +1907,10 @@ drag_data_received_callback (GtkWidget *widget,
caja_file_changes_queue_schedule_position_set (
location,
p,
- gdk_x11_screen_get_screen_number (
- gtk_widget_get_screen (widget)));
+ 0);
+ /*gdk_x11_screen_get_screen_number
+ *Always returns 0 since GTK 3.22
+ */
g_object_unref (location);
caja_file_changes_consume_changes (TRUE);
success = TRUE;
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c
index cf690a6e..36df1908 100644
--- a/libcaja-private/caja-icon-info.c
+++ b/libcaja-private/caja-icon-info.c
@@ -140,6 +140,149 @@ caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
return icon;
}
+/* Scale coordinates from the icon data prior to returning
+ * them to the user.
+ */
+static void
+caja_icon_info_scale_point (gint x,
+ gint y,
+ gint *x_out,
+ gint *y_out,
+ gint scale)
+{
+ *x_out = x * scale;
+ *y_out = y * scale;
+}
+
+/**
+ * Gets the coordinates of a rectangle within the icon
+ * that can be used for display of information such
+ * as a preview of the contents of a text file.
+ **/
+static gboolean
+caja_icon_info_set_embedded_rect (CajaIconInfo *icon,
+ GdkRectangle *rectangle)
+{
+ g_return_val_if_fail (icon != NULL, FALSE);
+
+ GdkPixbuf *pixbuf;
+ gint x0, y0;
+ gint x1, y1;
+ gint scaled_x0, scaled_y0;
+ gint scaled_x1, scaled_y1;
+ gboolean has_embedded_rect = FALSE;
+
+ pixbuf = caja_icon_info_get_pixbuf (icon);
+ if (pixbuf != NULL)
+ {
+ gint width, height;
+
+ has_embedded_rect = TRUE;
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+
+ x0 = width / 24;
+ y0 = height / 32;
+ x1 = width / 4 - x0;
+ y1 = height / 4 - y0;
+
+ if (rectangle)
+ {
+ caja_icon_info_scale_point (x0, y0,
+ &scaled_x0, &scaled_y0,
+ icon->orig_scale);
+ caja_icon_info_scale_point (x1, y1,
+ &scaled_x1, &scaled_y1,
+ icon->orig_scale);
+
+ rectangle->x = scaled_x0;
+ rectangle->y = scaled_y0;
+ rectangle->width = scaled_x1 - rectangle->x;
+ rectangle->height = scaled_y1 - rectangle->y;
+ }
+
+ g_object_unref (pixbuf);
+ }
+
+ return has_embedded_rect;
+}
+
+
+/**
+ * Fetches the set of attach points for an icon. An attach point
+ * is a location in the icon that can be used as anchor points for attaching
+ * emblems or overlays to the icon.
+ **/
+static gboolean
+caja_icon_info_set_attach_points (CajaIconInfo *icon,
+ GdkPoint **points,
+ gint *n_points)
+{
+ g_return_val_if_fail (icon != NULL, FALSE);
+
+ gint n_attach_points;
+ GdkPoint *attach_points;
+ int i;
+
+ n_attach_points = 4;
+ attach_points = g_new (GdkPoint, n_attach_points);
+
+ i = 0;
+ while (i < n_attach_points)
+ {
+ attach_points[i].x = 32;
+ attach_points[i].y = 32;
+ i++;
+ }
+
+ if (n_attach_points && points)
+ {
+ *points = g_new (GdkPoint, n_attach_points);
+ for (i = 0; i < n_attach_points; i++)
+ caja_icon_info_scale_point (attach_points[i].x,
+ attach_points[i].y,
+ &(*points)[i].x,
+ &(*points)[i].y,
+ icon->orig_scale);
+ }
+
+ if (n_points)
+ *n_points = n_attach_points;
+
+ return TRUE;
+}
+
+static char *
+caja_icon_info_set_display_name (GtkIconInfo *icon_info)
+{
+ g_return_val_if_fail (icon_info != NULL, FALSE);
+
+ GKeyFile *icon_file;
+ GError *error = NULL;
+ const char *path;
+ char *display_name;
+
+ icon_file = g_key_file_new ();
+ path = gtk_icon_info_get_filename (icon_info);
+
+ g_key_file_set_list_separator (icon_file, ',');
+ g_key_file_load_from_file (icon_file, path, 0, &error);
+ if (error)
+ {
+ g_error_free (error);
+ g_key_file_free (icon_file);
+ return FALSE;
+ }
+
+ display_name = g_key_file_get_locale_string (icon_file,
+ "Icon Data", "DisplayName",
+ NULL, NULL);
+ g_key_file_free (icon_file);
+
+ return display_name;
+}
+
static CajaIconInfo *
caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
gint scale)
@@ -152,18 +295,19 @@ caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
icon = g_object_new (CAJA_TYPE_ICON_INFO, NULL);
+ icon->orig_scale = scale;
+
icon->pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
- icon->got_embedded_rect = gtk_icon_info_get_embedded_rect (icon_info,
- &icon->embedded_rect);
+ icon->got_embedded_rect = caja_icon_info_set_embedded_rect (icon, &icon->embedded_rect);
- if (gtk_icon_info_get_attach_points (icon_info, &points, &n_points))
+ if (caja_icon_info_set_attach_points (icon, &points, &n_points))
{
icon->n_attach_points = n_points;
icon->attach_points = points;
}
- icon->display_name = g_strdup (gtk_icon_info_get_display_name (icon_info));
+ /* icon->display_name = g_strdup (caja_icon_info_set_display_name (icon_info)); */
filename = gtk_icon_info_get_filename (icon_info);
if (filename != NULL)
@@ -179,8 +323,6 @@ caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
icon->icon_name = basename;
}
- icon->orig_scale = scale;
-
return icon;
}
@@ -307,6 +449,7 @@ icon_key_new (GIcon *icon,
key = g_slice_new (IconKey);
key->icon = g_object_ref (icon);
+ key->scale = scale;
key->size = size;
return key;
@@ -682,7 +825,10 @@ caja_get_icon_size_for_zoom_level (CajaZoomLevel zoom_level)
float
caja_get_relative_icon_size_for_zoom_level (CajaZoomLevel zoom_level)
{
- return (float)caja_get_icon_size_for_zoom_level (zoom_level) / CAJA_ICON_SIZE_STANDARD;
+ guint icon_size;
+
+ icon_size = caja_get_icon_size_for_zoom_level (zoom_level);
+ return ((float) icon_size) / ((float) CAJA_ICON_SIZE_STANDARD);
}
guint
diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c
index ab9b8026..e461fb65 100644
--- a/libcaja-private/caja-mime-application-chooser.c
+++ b/libcaja-private/caja-mime-application-chooser.c
@@ -52,7 +52,6 @@ struct _CajaMimeApplicationChooserDetails
guint refresh_timeout;
GtkWidget *label;
- GtkWidget *entry;
GtkWidget *treeview;
GtkWidget *remove_button;
diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c
index 1db11351..7ded7ae4 100644
--- a/libcaja-private/caja-progress-info.c
+++ b/libcaja-private/caja-progress-info.c
@@ -707,7 +707,7 @@ widget_state_notify_paused_callback (ProgressWidgetData *data)
}
void
-caja_progress_info_get_ready (CajaProgressInfo *info)
+caja_progress_info_get_ready (CajaProgressInfo *info, GTimer *time)
{
if (info->waiting) {
G_LOCK (progress_info);
@@ -717,8 +717,10 @@ caja_progress_info_get_ready (CajaProgressInfo *info)
g_source_set_callback (source, (GSourceFunc)widget_state_notify_paused_callback, info->widget, NULL);
g_source_attach (source, NULL);
+ g_timer_stop (time);
while (info->waiting)
g_cond_wait (&info->waiting_c, &G_LOCK_NAME(progress_info));
+ g_timer_continue (time);
}
G_UNLOCK (progress_info);
}
diff --git a/libcaja-private/caja-progress-info.h b/libcaja-private/caja-progress-info.h
index c713361b..4b3e59f4 100644
--- a/libcaja-private/caja-progress-info.h
+++ b/libcaja-private/caja-progress-info.h
@@ -51,7 +51,7 @@ GType caja_progress_info_get_type (void) G_GNUC_CONST;
*/
CajaProgressInfo *caja_progress_info_new (gboolean should_start, gboolean can_pause);
-void caja_progress_info_get_ready (CajaProgressInfo *info);
+void caja_progress_info_get_ready (CajaProgressInfo *info, GTimer *time);
void caja_progress_info_disable_pause (CajaProgressInfo *info);
GList * caja_get_all_progress_info (void);
diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c
index d0902652..d87948c7 100644
--- a/libcaja-private/caja-query.c
+++ b/libcaja-private/caja-query.c
@@ -332,14 +332,9 @@ static GMarkupParser parser =
static CajaQuery *
caja_query_parse_xml (char *xml, gsize xml_len)
{
- ParserInfo info = { NULL };
+ ParserInfo info = { NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE };
GMarkupParseContext *ctx;
- if (xml_len == -1)
- {
- xml_len = strlen (xml);
- }
-
info.query = caja_query_new ();
info.in_text = FALSE;
diff --git a/libcaja-private/caja-search-directory-file.c b/libcaja-private/caja-search-directory-file.c
index 0984caf6..550d7702 100644
--- a/libcaja-private/caja-search-directory-file.c
+++ b/libcaja-private/caja-search-directory-file.c
@@ -39,11 +39,6 @@
#include "caja-file-utilities.h"
#include "caja-search-directory.h"
-struct CajaSearchDirectoryFileDetails
-{
- CajaSearchDirectory *search_directory;
-};
-
G_DEFINE_TYPE(CajaSearchDirectoryFile, caja_search_directory_file, CAJA_TYPE_FILE);
static void
diff --git a/libcaja-private/caja-search-directory-file.h b/libcaja-private/caja-search-directory-file.h
index ac6a8d0d..d0be816d 100644
--- a/libcaja-private/caja-search-directory-file.h
+++ b/libcaja-private/caja-search-directory-file.h
@@ -40,12 +40,9 @@
#define CAJA_SEARCH_DIRECTORY_FILE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_SEARCH_DIRECTORY_FILE, CajaSearchDirectoryFileClass))
-typedef struct CajaSearchDirectoryFileDetails CajaSearchDirectoryFileDetails;
-
typedef struct
{
CajaFile parent_slot;
- CajaSearchDirectoryFileDetails *details;
} CajaSearchDirectoryFile;
typedef struct
diff --git a/libcaja-private/caja-search-directory.c b/libcaja-private/caja-search-directory.c
index 4613b564..da2e133b 100644
--- a/libcaja-private/caja-search-directory.c
+++ b/libcaja-private/caja-search-directory.c
@@ -49,7 +49,6 @@ struct CajaSearchDirectoryDetails
gboolean search_finished;
GList *files;
- GHashTable *file_hash;
GList *monitor_list;
GList *callback_list;
diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c
index 207baeaa..aae74d23 100644
--- a/libcaja-private/caja-search-engine-simple.c
+++ b/libcaja-private/caja-search-engine-simple.c
@@ -42,7 +42,6 @@ typedef struct
GList *mime_types;
GList *tags;
char **words;
- GList *found_list;
GQueue *directories; /* GFiles */
diff --git a/libcaja-private/caja-search-engine.c b/libcaja-private/caja-search-engine.c
index 234575de..d8d9d9a8 100644
--- a/libcaja-private/caja-search-engine.c
+++ b/libcaja-private/caja-search-engine.c
@@ -30,11 +30,6 @@
#include "caja-search-engine-simple.h"
#include "caja-search-engine-tracker.h"
-struct CajaSearchEngineDetails
-{
- int none;
-};
-
enum
{
HITS_ADDED,
@@ -50,30 +45,9 @@ G_DEFINE_ABSTRACT_TYPE (CajaSearchEngine,
caja_search_engine,
G_TYPE_OBJECT);
-static GObjectClass *parent_class = NULL;
-
-static void
-finalize (GObject *object)
-{
- CajaSearchEngine *engine;
-
- engine = CAJA_SEARCH_ENGINE (object);
-
- g_free (engine->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
static void
caja_search_engine_class_init (CajaSearchEngineClass *class)
{
- GObjectClass *gobject_class;
-
- parent_class = g_type_class_peek_parent (class);
-
- gobject_class = G_OBJECT_CLASS (class);
- gobject_class->finalize = finalize;
-
signals[HITS_ADDED] =
g_signal_new ("hits-added",
G_TYPE_FROM_CLASS (class),
@@ -118,7 +92,6 @@ caja_search_engine_class_init (CajaSearchEngineClass *class)
static void
caja_search_engine_init (CajaSearchEngine *engine)
{
- engine->details = g_new0 (CajaSearchEngineDetails, 1);
}
CajaSearchEngine *
diff --git a/libcaja-private/caja-search-engine.h b/libcaja-private/caja-search-engine.h
index 3d811ff4..90bd6593 100644
--- a/libcaja-private/caja-search-engine.h
+++ b/libcaja-private/caja-search-engine.h
@@ -35,12 +35,9 @@
#define CAJA_IS_SEARCH_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_SEARCH_ENGINE))
#define CAJA_SEARCH_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_SEARCH_ENGINE, CajaSearchEngineClass))
-typedef struct CajaSearchEngineDetails CajaSearchEngineDetails;
-
typedef struct CajaSearchEngine
{
GObject parent;
- CajaSearchEngineDetails *details;
} CajaSearchEngine;
typedef struct
diff --git a/libcaja-private/caja-sidebar-provider.c b/libcaja-private/caja-sidebar-provider.c
index 263a0334..94f1c6c7 100644
--- a/libcaja-private/caja-sidebar-provider.c
+++ b/libcaja-private/caja-sidebar-provider.c
@@ -47,6 +47,7 @@ caja_sidebar_provider_get_type (void)
NULL,
0,
0,
+ NULL,
NULL
};
diff --git a/libcaja-private/caja-sidebar.c b/libcaja-private/caja-sidebar.c
index 60c7710e..393f5321 100644
--- a/libcaja-private/caja-sidebar.c
+++ b/libcaja-private/caja-sidebar.c
@@ -72,6 +72,7 @@ caja_sidebar_get_type (void)
NULL,
0,
0,
+ NULL,
NULL
};
diff --git a/libcaja-private/caja-view.c b/libcaja-private/caja-view.c
index 010b361b..9465217d 100644
--- a/libcaja-private/caja-view.c
+++ b/libcaja-private/caja-view.c
@@ -80,6 +80,7 @@ caja_view_get_type (void)
NULL,
0,
0,
+ NULL,
NULL
};
diff --git a/libcaja-private/caja-window-info.c b/libcaja-private/caja-window-info.c
index 9318847f..8d17c1ad 100644
--- a/libcaja-private/caja-window-info.c
+++ b/libcaja-private/caja-window-info.c
@@ -112,6 +112,7 @@ caja_window_info_get_type (void)
NULL,
0,
0,
+ NULL,
NULL
};
diff --git a/libcaja-private/caja-window-slot-info.c b/libcaja-private/caja-window-slot-info.c
index 01a38a80..b4b4d419 100644
--- a/libcaja-private/caja-window-slot-info.c
+++ b/libcaja-private/caja-window-slot-info.c
@@ -78,6 +78,7 @@ caja_window_slot_info_get_type (void)
NULL,
0,
0,
+ NULL,
NULL
};
diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml
index 399efdc7..0f3bc015 100644
--- a/libcaja-private/org.mate.caja.gschema.xml
+++ b/libcaja-private/org.mate.caja.gschema.xml
@@ -35,11 +35,12 @@
<value nick="size" value="3"/>
<value nick="type" value="4"/>
<value nick="mtime" value="5"/>
- <value nick="atime" value="6"/>
- <value nick="emblems" value="7"/>
- <value nick="trash-time" value="8"/>
- <value nick="size_on_disk" value="9"/>
- <value nick="extension" value="10"/>
+ <value nick="btime" value="6"/>
+ <value nick="atime" value="7"/>
+ <value nick="emblems" value="8"/>
+ <value nick="trash-time" value="9"/>
+ <value nick="size_on_disk" value="10"/>
+ <value nick="extension" value="11"/>
</enum>
<enum id="org.mate.caja.ZoomLevel">
@@ -186,7 +187,33 @@
</aliases>
<default>'name'</default>
<summary>Default sort order</summary>
- <description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems".</description>
+ <description>
+ The default sort-order for items in all view modes. Possible values are:
+
+ - "manually": In icon- and compact-view modes, lets the user place and organize items any way the user wants them to be organized, simply by dragging each item to where the user desires. In list-view mode, this setting is equivalent to "name" (see immediately below).
+
+ - "name": Sort items by their name; for example, a file named "a.txt" will be sorted before a file named "b.txt". This is the default.
+
+ - "directory": Sort items by their full pathname. For example, a file named "b.txt" under the directory "/home/a" will be sorted before a file named "a.txt" under the directory "/home/zzz". Since Caja usually only displays files under one directory at any particular time, this setting will usually be equivalent to the "name" option (above), except in the Caja search tool, which can traverse files under multiple subdirectories.
+
+ - "size": Sort items by their file size, or if the items are directories, by the number of items they contain.
+
+ - "type": Sort items by their human-readable type description. Such type descriptions take the form of, for instance, "plain text document" or "SVG image". The type of the file is not necessarily related to the file's "extension" (see below).
+
+ - "mtime": Sort items by their respective times of last modification.
+
+ - "btime": Sort items by the date and time on which each file was created. Note that not all files have a recorded creation time, so this setting may not always work as expected, especially on removable media that are "formatted" with legacy filesystems such as FAT.
+
+ - "atime": Sort items by the date and time on which each file was last accessed. Usually, "accessed" refers to the last time the file was read by a user or a program. Note that, for performance reasons, some filesystems do not update this timestamp every time the file is read, so this field may be inaccurate.
+
+ - "emblems": Sort items by the names of the emblems (if any) associated with each item.
+
+ - "trash-time": Sort items by the date and time on which the file was moved to the Trash. This setting is rarely useful, as it only applies to files currently in the Trash.
+
+ - "size_on_disk": Sort by the amount of actual disk space each item consumes. This figure is usually slightly larger than the conventional size of the file, since most filesystems pad files out to an even multiple of the "block size", which on many filesystems is 4096 bytes or about 4 kilobytes. A few files may use less space on the disk than the conventional file size may indicate, due to a feature of some filesystems known as "holes". This setting will not necessarily sort directories by the number of files they contain, since the amount of disk space used by a directory is not necessarily related to the number of files in a directory; other factors that can contribute to a directory's actual size include the length of the names of each file within the directory, and, interestingly, how many files the directory used to contain.
+
+ - "extension": Sort by each item's file extension (if any). The file's extension is a part of the file's name, and may not reflect the actual contents of the file, unlike the "type" setting (above).
+ </description>
</key>
<key name="default-sort-in-reverse-order" type="b">
<default>false</default>