Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/xviewer-image.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,13 @@ xviewer_image_get_file_info (XviewerImage *img,
if (mime_type)
*mime_type = NULL;

g_set_error (error,
XVIEWER_IMAGE_ERROR,
XVIEWER_IMAGE_ERROR_VFS,
"Error in getting image file info");
if (error && *error == NULL)
{
g_set_error (error,
XVIEWER_IMAGE_ERROR,
XVIEWER_IMAGE_ERROR_VFS,
"Error in getting image file info");
}
} else {
if (bytes)
*bytes = g_file_info_get_size (file_info);
Expand Down
79 changes: 16 additions & 63 deletions src/xviewer-list-store.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,84 +375,37 @@ file_monitor_changed_cb (GFileMonitor *monitor,
GFileMonitorEvent event,
XviewerListStore *store)
{
const char *mimetype;
GFileInfo *file_info;
GtkTreeIter iter;
XviewerImage *image;
if (event == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
{
const char *mimetype;
GFileInfo *file_info;
GtkTreeIter iter;
XviewerImage *image;

switch (event) {
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
break;
return;
}
mimetype = g_file_info_get_content_type (file_info);

if (is_file_in_list_store_file (store, file, &iter)) {
if (xviewer_image_is_supported_mime_type (mimetype)) {
if (xviewer_image_is_supported_mime_type (mimetype)) {
gboolean found = is_file_in_list_store_file (store, file, &iter);
if (found) {
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
XVIEWER_LIST_STORE_XVIEWER_IMAGE, &image,
-1);
XVIEWER_LIST_STORE_XVIEWER_IMAGE, &image,
-1);
xviewer_image_file_changed (image);
g_object_unref (image);
xviewer_list_store_thumbnail_refresh (store, &iter);
} else {
xviewer_list_store_remove (store, &iter);
}
} else {
if (xviewer_image_is_supported_mime_type (mimetype)) {
xviewer_list_store_append_image_from_file (store, file);
found = is_file_in_list_store_file (store, file, &iter);
}

if (found)
xviewer_list_store_thumbnail_refresh (store, &iter);
}
g_object_unref (file_info);
break;
case G_FILE_MONITOR_EVENT_DELETED:
if (is_file_in_list_store_file (store, file, &iter)) {
XviewerImage *image;

gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
XVIEWER_LIST_STORE_XVIEWER_IMAGE, &image,
-1);

xviewer_list_store_remove (store, &iter);
}
break;
case G_FILE_MONITOR_EVENT_CREATED:
if (!is_file_in_list_store_file (store, file, NULL)) {
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
break;
}
mimetype = g_file_info_get_content_type (file_info);

if (xviewer_image_is_supported_mime_type (mimetype)) {
xviewer_list_store_append_image_from_file (store, file);
}
g_object_unref (file_info);
}
break;
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
break;
}
mimetype = g_file_info_get_content_type (file_info);
if (is_file_in_list_store_file (store, file, &iter) &&
xviewer_image_is_supported_mime_type (mimetype)) {
xviewer_list_store_thumbnail_refresh (store, &iter);
}
g_object_unref (file_info);
break;
case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
case G_FILE_MONITOR_EVENT_UNMOUNTED:
case G_FILE_MONITOR_EVENT_MOVED:
break;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/xviewer-thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,14 @@ xviewer_thumb_data_new (GFile *file, GError **error)
data->can_read = g_file_info_get_attribute_boolean (file_info,
G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
}
g_object_unref (file_info);
}
else {
xviewer_thumb_data_free (data);
data = NULL;
g_clear_error (&ioerror);
}

g_object_unref (file_info);

return data;
}

Expand Down
4 changes: 2 additions & 2 deletions src/xviewer-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ update_status_bar (XviewerWindow *window)

g_free (size_string);
}

update_image_pos (window);
}

update_image_pos (window);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken images were not updating the position counter in the status bar


gtk_statusbar_pop (GTK_STATUSBAR (priv->statusbar),
priv->image_info_message_cid);

Expand Down