Skip to content

Commit

Permalink
Regression: Toggle menu visibility on F10 if menu is hidden (Issue #498)
Browse files Browse the repository at this point in the history
Otherwise pressing F10 will make UI unresponsive when menu bar is hidden

Fixes #498
  • Loading branch information
Alexander Schwinn committed Feb 5, 2021
1 parent f9aedf4 commit 6588ac1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions thunar/thunar-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ static void thunar_window_action_toolbar_changed (ThunarWindow
static void thunar_window_action_shortcuts_changed (ThunarWindow *window);
static void thunar_window_action_tree_changed (ThunarWindow *window);
static void thunar_window_action_statusbar_changed (ThunarWindow *window);
static void thunar_window_action_menubar_update (ThunarWindow *window);
static void thunar_window_action_menubar_changed (ThunarWindow *window);
static void thunar_window_action_detailed_view (ThunarWindow *window);
static void thunar_window_action_icon_view (ThunarWindow *window);
Expand Down Expand Up @@ -716,6 +717,9 @@ thunar_window_init (ThunarWindow *window)
gtk_menu_shell_append (GTK_MENU_SHELL (window->menubar), item);
gtk_widget_show (item);

/* Required if F10 is pushed while the menu is hidden */
g_signal_connect_swapped (G_OBJECT (window->menubar), "deactivate", G_CALLBACK (thunar_window_action_menubar_update), window);

/* place the spinner into the menu item */
window->spinner = gtk_spinner_new ();
gtk_container_add (GTK_CONTAINER (item), window->spinner);
Expand Down Expand Up @@ -2695,6 +2699,20 @@ thunar_window_action_statusbar_changed (ThunarWindow *window)



static void
thunar_window_action_menubar_update (ThunarWindow *window)
{
gboolean last_menubar_visible;

_thunar_return_if_fail (THUNAR_IS_WINDOW (window));

g_object_get (window->preferences, "last-menubar-visible", &last_menubar_visible, NULL);

gtk_widget_set_visible (window->menubar, last_menubar_visible);
}



static void
thunar_window_action_menubar_changed (ThunarWindow *window)
{
Expand Down Expand Up @@ -3397,6 +3415,9 @@ thunar_window_action_open_file_menu (ThunarWindow *window)

_thunar_return_if_fail (THUNAR_IS_WINDOW (window));

/* In case the menubar is hidden, we make it visible (e.g. when F10 is pressed) */
gtk_widget_set_visible (window->menubar, TRUE);

children = gtk_container_get_children (GTK_CONTAINER (window->menubar));
g_signal_emit_by_name (children->data, "button-press-event", NULL, &ret);
g_list_free (children);
Expand Down

0 comments on commit 6588ac1

Please sign in to comment.