[gedit/gnome-2-28] Fixed action group of FileClose action
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/gnome-2-28] Fixed action group of FileClose action
- Date: Wed, 11 Nov 2009 19:22:02 +0000 (UTC)
commit c89998f6eea01c69425edb72b0d5d5aeddc70ce9
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Wed Nov 11 18:59:23 2009 +0100
Fixed action group of FileClose action
The OS X integration patch introduced a bug in the action group
of the FileClose menu action. This has been reverted and the
sensitivity of the FileClose action on OS X is now handled
more correctly.
gedit/gedit-ui.h | 8 +-------
gedit/gedit-window.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/gedit/gedit-ui.h b/gedit/gedit-ui.h
index f007182..e1ef73c 100644
--- a/gedit/gedit-ui.h
+++ b/gedit/gedit-ui.h
@@ -58,11 +58,6 @@ static const GtkActionEntry gedit_always_sensitive_menu_entries[] =
{ "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
N_("Open a file"), G_CALLBACK (_gedit_cmd_file_open) },
-#ifdef OS_OSX
- { "FileClose", GTK_STOCK_CLOSE, NULL, "<control>W",
- N_("Close the current file"), G_CALLBACK (_gedit_cmd_file_close) },
-#endif
-
/* Edit menu */
{ "EditPreferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL,
N_("Configure the application"), G_CALLBACK (_gedit_cmd_edit_preferences) },
@@ -96,10 +91,9 @@ static const GtkActionEntry gedit_menu_entries[] =
N_("Print preview"), G_CALLBACK (_gedit_cmd_file_print_preview) },
{ "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print the current page"), G_CALLBACK (_gedit_cmd_file_print) },
-#ifndef OS_OSX
{ "FileClose", GTK_STOCK_CLOSE, NULL, "<control>W",
N_("Close the current file"), G_CALLBACK (_gedit_cmd_file_close) },
-#endif
+
/* Edit menu */
{ "EditUndo", GTK_STOCK_UNDO, NULL, "<control>Z",
N_("Undo the last action"), G_CALLBACK (_gedit_cmd_edit_undo) },
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 4a808e9..8fb0202 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -722,7 +722,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
(state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
!(lockdown & GEDIT_LOCKDOWN_PRINTING));
- action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
+ action = gtk_action_group_get_action (window->priv->action_group,
"FileClose");
gtk_action_set_sensitive (action,
@@ -3124,7 +3124,7 @@ editable_changed (GeditView *view,
}
static void
-update_sensitivity (GeditWindow *window)
+update_sensitivity_according_to_tabs (GeditWindow *window)
{
GtkAction *action;
@@ -3143,6 +3143,15 @@ update_sensitivity (GeditWindow *window)
action = gtk_action_group_get_action (window->priv->action_group,
"ViewHighlightMode");
gtk_action_set_sensitive (action, FALSE);
+
+#ifdef OS_OSX
+ /* On OS X we keep the Close action sensitive when there are
+ no tabs because when there are no active documents it
+ closes the window (OS X style) */
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "FileClose");
+ gtk_action_set_sensitive (action, TRUE);
+#endif
}
}
@@ -3160,7 +3169,7 @@ notebook_tab_added (GeditNotebook *notebook,
++window->priv->num_tabs;
- update_sensitivity (window);
+ update_sensitivity_according_to_tabs (window);
view = gedit_tab_get_view (tab);
doc = gedit_tab_get_document (tab);
@@ -3326,7 +3335,7 @@ notebook_tab_removed (GeditNotebook *notebook,
}
}
- update_sensitivity (window);
+ update_sensitivity_according_to_tabs (window);
if (window->priv->num_tabs == 0)
{
@@ -3922,7 +3931,7 @@ gedit_window_init (GeditWindow *window)
* This needs to be done after plugins activatation */
init_panels_visibility (window);
- update_sensitivity (window);
+ update_sensitivity_according_to_tabs (window);
gedit_debug_message (DEBUG_WINDOW, "END");
}
@@ -4657,4 +4666,4 @@ GtkWidget *
_gedit_window_get_menu_bar (GeditWindow *window)
{
return window->priv->menubar;
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]