Hide permanently unavailable actions instead of disabling them

This commit is contained in:
Christian Dywan 2009-10-31 22:43:58 +01:00
parent e29e7f62d2
commit d550d2c520
3 changed files with 18 additions and 9 deletions

View file

@ -1424,7 +1424,7 @@ midori_load_session (gpointer data)
GtkAction* action = gtk_action_group_get_action (action_group, "LastSession"); GtkAction* action = gtk_action_group_get_action (action_group, "LastSession");
g_signal_connect (action, "activate", g_signal_connect (action, "activate",
G_CALLBACK (midori_browser_action_last_session_activate_cb), browser); G_CALLBACK (midori_browser_action_last_session_activate_cb), browser);
gtk_action_set_sensitive (action, TRUE); gtk_action_set_visible (action, TRUE);
} }
midori_app_add_browser (app, browser); midori_app_add_browser (app, browser);
gtk_widget_show (GTK_WIDGET (browser)); gtk_widget_show (GTK_WIDGET (browser));

View file

@ -199,6 +199,14 @@ _action_set_sensitive (MidoriBrowser* browser,
gtk_action_set_sensitive (_action_by_name (browser, name), sensitive); gtk_action_set_sensitive (_action_by_name (browser, name), sensitive);
} }
static void
_action_set_visible (MidoriBrowser* browser,
const gchar* name,
gboolean visible)
{
gtk_action_set_visible (_action_by_name (browser, name), visible);
}
static void static void
_action_set_active (MidoriBrowser* browser, _action_set_active (MidoriBrowser* browser,
const gchar* name, const gchar* name,
@ -5494,19 +5502,19 @@ midori_browser_init (MidoriBrowser* browser)
G_CALLBACK (midori_browser_menu_item_middle_click_event_cb), browser); G_CALLBACK (midori_browser_menu_item_middle_click_event_cb), browser);
_action_set_sensitive (browser, "PrivateBrowsing", FALSE); _action_set_visible (browser, "PrivateBrowsing", FALSE);
#if HAVE_HILDON #if HAVE_HILDON
g_object_set (_action_by_name (browser, "Menubar"), "visible", FALSE, NULL); _action_set_visible (browser, "Menubar", FALSE);
g_object_set (_action_by_name (browser, "Statusbar"), "visible", FALSE, NULL); _action_set_visible (browser, "Statusbar", FALSE);
#endif #endif
#if !WEBKIT_CHECK_VERSION (1, 1, 3) #if !WEBKIT_CHECK_VERSION (1, 1, 3)
_action_set_sensitive (browser, "Transferbar", FALSE); _action_set_visible (browser, "Transferbar", FALSE);
#endif #endif
_action_set_sensitive (browser, "EncodingCustom", FALSE); _action_set_sensitive (browser, "EncodingCustom", FALSE);
_action_set_sensitive (browser, "SelectionSourceView", FALSE); _action_set_visible (browser, "SelectionSourceView", FALSE);
_action_set_sensitive (browser, "LastSession", FALSE); _action_set_visible (browser, "LastSession", FALSE);
/* FIXME: Enable once implemented */ /* FIXME: Show once implemented */
_action_set_sensitive (browser, "AddDesktopShortcut", FALSE); _action_set_visible (browser, "AddDesktopShortcut", FALSE);
/* Create the navigationbar */ /* Create the navigationbar */
browser->navigationbar = gtk_ui_manager_get_widget ( browser->navigationbar = gtk_ui_manager_get_widget (

View file

@ -2007,6 +2007,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
menuitem = sokoke_action_create_popup_menu_item ( menuitem = sokoke_action_create_popup_menu_item (
gtk_action_group_get_action (actions, "AddDesktopShortcut")); gtk_action_group_get_action (actions, "AddDesktopShortcut"));
gtk_menu_shell_append (menu_shell, menuitem); gtk_menu_shell_append (menu_shell, menuitem);
gtk_widget_set_no_show_all (menuitem, TRUE);
#endif #endif
menuitem = sokoke_action_create_popup_menu_item ( menuitem = sokoke_action_create_popup_menu_item (