Improve the window title situation
This commit is contained in:
parent
8b1a14decb
commit
a8796512d2
31
fastiv.c
31
fastiv.c
@ -107,6 +107,21 @@ show_error_dialog(GError *error)
|
|||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
switch_to_browser(void)
|
||||||
|
{
|
||||||
|
gtk_window_set_title(GTK_WINDOW(g.window), g.directory);
|
||||||
|
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
|
||||||
|
gtk_widget_grab_focus(g.browser_scroller);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
switch_to_view(const char *path)
|
||||||
|
{
|
||||||
|
gtk_window_set_title(GTK_WINDOW(g.window), path);
|
||||||
|
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_directory(const gchar *dirname)
|
load_directory(const gchar *dirname)
|
||||||
{
|
{
|
||||||
@ -150,10 +165,8 @@ load_directory(const gchar *dirname)
|
|||||||
// XXX: When something outside the filtered entries is open, the index is
|
// XXX: When something outside the filtered entries is open, the index is
|
||||||
// kept at -1, and browsing doesn't work. How to behave here?
|
// kept at -1, and browsing doesn't work. How to behave here?
|
||||||
// Should we add it to the pointer array as an exception?
|
// Should we add it to the pointer array as an exception?
|
||||||
if (dirname) {
|
if (dirname)
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
|
switch_to_browser();
|
||||||
gtk_widget_grab_focus(g.browser_scroller);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -201,8 +214,7 @@ open(const gchar *path)
|
|||||||
}
|
}
|
||||||
g_free(dirname);
|
g_free(dirname);
|
||||||
|
|
||||||
gtk_window_set_title(GTK_WINDOW(g.window), path);
|
switch_to_view(path);
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
@ -449,7 +461,7 @@ on_key_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
|
|||||||
|
|
||||||
case GDK_KEY_Tab:
|
case GDK_KEY_Tab:
|
||||||
case GDK_KEY_Return:
|
case GDK_KEY_Return:
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
|
switch_to_browser();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,7 +475,7 @@ on_button_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
switch (event->button) {
|
switch (event->button) {
|
||||||
case 8: // back
|
case 8: // back
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
|
switch_to_browser();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_BUTTON_PRIMARY:
|
case GDK_BUTTON_PRIMARY:
|
||||||
if (event->type == GDK_2BUTTON_PRESS) {
|
if (event->type == GDK_2BUTTON_PRESS) {
|
||||||
@ -483,7 +495,8 @@ on_button_press_browser(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
switch (event->button) {
|
switch (event->button) {
|
||||||
case 9: // forward
|
case 9: // forward
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
|
// FIXME: This is inconsistent, normally there is an absolute path.
|
||||||
|
switch_to_view(g.basename);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user