aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-31 01:59:01 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-31 03:43:51 +0100
commit2ac918b7abb148038a3c8312b3e789d6d2ad3701 (patch)
tree1b8b3824bef0e945fa80fa7181010c245763f14e
parent5f8dc88fa715563c3abb8ed0d8ae5d2736f7a1a9 (diff)
downloadfiv-2ac918b7abb148038a3c8312b3e789d6d2ad3701.tar.gz
fiv-2ac918b7abb148038a3c8312b3e789d6d2ad3701.tar.xz
fiv-2ac918b7abb148038a3c8312b3e789d6d2ad3701.zip
A bunch of additional fixes
-rw-r--r--fastiv.c35
-rw-r--r--fiv-browser.c9
2 files changed, 27 insertions, 17 deletions
diff --git a/fastiv.c b/fastiv.c
index 5aa183f..1d57cca 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -263,11 +263,11 @@ struct {
gchar **supported_globs;
gboolean filtering;
- gchar *uri; ///< Current image URI
+ gchar *uri; ///< Current image URI, if any
gchar *directory; ///< URI of the currently browsed directory
GList *directory_back; ///< History paths going backwards
GList *directory_forward; ///< History paths going forwards
- GPtrArray *files; ///< "directory" contents
+ GPtrArray *files; ///< "directory" contents as URIs
gint files_index; ///< Where "uri" is within "files"
GtkWidget *window;
@@ -337,9 +337,11 @@ switch_to_browser(void)
}
static void
-switch_to_view(const char *uri)
+switch_to_view(void)
{
- set_window_title(uri);
+ g_return_if_fail(g.uri != NULL);
+
+ set_window_title(g.uri);
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_box);
gtk_widget_grab_focus(g.view);
}
@@ -467,8 +469,12 @@ load_directory(const gchar *uri)
// XXX: When something outside the filtered entries is open, the index is
// kept at -1, and browsing doesn't work. How to behave here?
// Should we add it to the pointer array as an exception?
- if (uri)
+ if (uri) {
switch_to_browser();
+
+ // TODO(p): Rather place it in history.
+ g_clear_pointer(&g.uri, g_free);
+ }
}
static void
@@ -513,7 +519,7 @@ open(const gchar *uri)
update_files_index();
g_free(parent);
- switch_to_view(uri);
+ switch_to_view();
}
static GtkWidget *
@@ -550,7 +556,8 @@ on_open(void)
// Apparently, just keeping the dialog around doesn't mean
// that it will remember its last location.
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g.directory);
+ (void) gtk_file_chooser_set_current_folder_uri(
+ GTK_FILE_CHOOSER(dialog), g.directory);
// The default is local-only, single item.
switch (gtk_dialog_run(GTK_DIALOG(dialog))) {
@@ -780,8 +787,8 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
case GDK_KEY_Right:
if (g.directory_forward)
load_directory(g.directory_forward->data);
- else
- switch_to_view(g.uri);
+ else if (g.uri)
+ switch_to_view();
return TRUE;
case GDK_KEY_Up:
if (gtk_stack_get_visible_child(GTK_STACK(g.stack)) != g.view_box) {
@@ -895,12 +902,10 @@ on_button_press_browser_paned(
load_directory(g.directory_back->data);
return TRUE;
case 9: // forward
- // FIXME: It may be inappropriate to go to the picture,
- // which may be left over from a different directory.
if (g.directory_forward)
load_directory(g.directory_forward->data);
- else
- switch_to_view(g.uri);
+ else if (g.uri)
+ switch_to_view();
return TRUE;
default:
return FALSE;
@@ -951,14 +956,18 @@ on_view_actions_changed(void)
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_PLAY_PAUSE], can_animate);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_SEEK_FORWARD], can_animate);
+ // Note that none of the following should be visible with no image.
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_PLUS], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_SCALE], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_MINUS], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_ONE], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_FIT], has_image);
+ gtk_widget_set_sensitive(g.toolbar[TOOLBAR_COLOR], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_SMOOTH], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_CHECKERBOARD], has_image);
+ gtk_widget_set_sensitive(g.toolbar[TOOLBAR_ENHANCE], has_image);
+
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_SAVE], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_PRINT], has_image);
gtk_widget_set_sensitive(g.toolbar[TOOLBAR_INFO], has_image);
diff --git a/fiv-browser.c b/fiv-browser.c
index d426454..b0ec19e 100644
--- a/fiv-browser.c
+++ b/fiv-browser.c
@@ -469,13 +469,14 @@ on_thumbnailer_ready(GObject *object, GAsyncResult *res, gpointer user_data)
g_error_free(error);
return;
}
-
- g_warning("%s", error->message);
+ if (!g_subprocess_get_if_exited(subprocess) ||
+ g_subprocess_get_exit_status(subprocess) != EXIT_FAILURE)
+ g_warning("%s", error->message);
g_error_free(error);
}
- gboolean succeeded = g_subprocess_get_if_exited(self->thumbnailer) &&
- g_subprocess_get_exit_status(self->thumbnailer) == EXIT_SUCCESS;
+ gboolean succeeded = g_subprocess_get_if_exited(subprocess) &&
+ g_subprocess_get_exit_status(subprocess) == EXIT_SUCCESS;
g_clear_object(&self->thumbnailer);
if (!self->thumbnail_queue) {
g_warning("finished thumbnailing an unknown image");