Compare commits
2 Commits
1221325b3e
...
dfa1fed18b
Author | SHA1 | Date | |
---|---|---|---|
dfa1fed18b | |||
58d11ebbff |
8
fastiv.c
8
fastiv.c
@ -594,6 +594,14 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
|
|||||||
else
|
else
|
||||||
switch_to_view(g.path);
|
switch_to_view(g.path);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
case GDK_KEY_Up:
|
||||||
|
if (gtk_stack_get_visible_child(GTK_STACK(g.stack)) != g.view_box) {
|
||||||
|
// This isn't exact, trailing slashes should be ignored.
|
||||||
|
gchar *parent = g_path_get_dirname(g.directory);
|
||||||
|
load_directory(parent);
|
||||||
|
g_free(parent);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -45,6 +45,7 @@ struct _FivBrowser {
|
|||||||
int item_height; ///< Thumbnail height in pixels
|
int item_height; ///< Thumbnail height in pixels
|
||||||
int item_spacing; ///< Space between items in pixels
|
int item_spacing; ///< Space between items in pixels
|
||||||
|
|
||||||
|
char *path; ///< Current path
|
||||||
GArray *entries; ///< [Entry]
|
GArray *entries; ///< [Entry]
|
||||||
GArray *layouted_rows; ///< [Row]
|
GArray *layouted_rows; ///< [Row]
|
||||||
int selected;
|
int selected;
|
||||||
@ -626,6 +627,7 @@ static void
|
|||||||
fiv_browser_finalize(GObject *gobject)
|
fiv_browser_finalize(GObject *gobject)
|
||||||
{
|
{
|
||||||
FivBrowser *self = FIV_BROWSER(gobject);
|
FivBrowser *self = FIV_BROWSER(gobject);
|
||||||
|
g_free(self->path);
|
||||||
g_array_free(self->entries, TRUE);
|
g_array_free(self->entries, TRUE);
|
||||||
g_array_free(self->layouted_rows, TRUE);
|
g_array_free(self->layouted_rows, TRUE);
|
||||||
cairo_surface_destroy(self->glow);
|
cairo_surface_destroy(self->glow);
|
||||||
@ -804,6 +806,12 @@ fiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
|||||||
gtk_widget_grab_focus(widget);
|
gtk_widget_grab_focus(widget);
|
||||||
|
|
||||||
const Entry *entry = entry_at(self, event->x, event->y);
|
const Entry *entry = entry_at(self, event->x, event->y);
|
||||||
|
if (!entry && event->button == GDK_BUTTON_SECONDARY) {
|
||||||
|
gchar *uri = g_filename_to_uri(self->path, NULL, NULL);
|
||||||
|
show_context_menu(widget, uri);
|
||||||
|
g_free(uri);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -1038,8 +1046,9 @@ fiv_browser_load(
|
|||||||
{
|
{
|
||||||
g_array_set_size(self->entries, 0);
|
g_array_set_size(self->entries, 0);
|
||||||
g_array_set_size(self->layouted_rows, 0);
|
g_array_set_size(self->layouted_rows, 0);
|
||||||
|
g_clear_pointer(&self->path, g_free);
|
||||||
|
|
||||||
GFile *file = g_file_new_for_path(path);
|
GFile *file = g_file_new_for_path((self->path = g_strdup(path)));
|
||||||
GFileEnumerator *enumerator = g_file_enumerate_children(file,
|
GFileEnumerator *enumerator = g_file_enumerate_children(file,
|
||||||
G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
|
G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
|
||||||
G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user