gnome-terminal r2745 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r2745 - trunk/src
- Date: Thu, 29 May 2008 19:50:18 +0000 (UTC)
Author: chpe
Date: Thu May 29 19:50:18 2008
New Revision: 2745
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2745&view=rev
Log:
Only update the active profile in the profiles menu instead of rebuilding the whole menu when switching tabs.
Also there's no need to update the encodings and new-terminal submenus on active tab change.
Modified:
trunk/src/terminal-window.c
Modified: trunk/src/terminal-window.c
==============================================================================
--- trunk/src/terminal-window.c (original)
+++ trunk/src/terminal-window.c Thu May 29 19:50:18 2008
@@ -343,7 +343,7 @@
actions = gtk_action_group_list_actions (action_group);
for (l = actions; l != NULL; l = l->next)
{
- GObject *action= G_OBJECT (l->data);
+ GObject *action = G_OBJECT (l->data);
TerminalProfile *profile;
profile = g_object_get_data (action, PROFILE_DATA_KEY);
@@ -356,6 +356,38 @@
}
static void
+terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window)
+{
+ TerminalWindowPrivate *priv = window->priv;
+ TerminalProfile *new_active_profile;
+ GList *actions, *l;
+
+ if (!priv->profiles_action_group)
+ return;
+
+ if (!priv->active_term)
+ return;
+
+ new_active_profile = terminal_screen_get_profile (priv->active_term);
+
+ actions = gtk_action_group_list_actions (priv->profiles_action_group);
+ for (l = actions; l != NULL; l = l->next)
+ {
+ GObject *action = G_OBJECT (l->data);
+ TerminalProfile *profile;
+
+ profile = g_object_get_data (action, PROFILE_DATA_KEY);
+ if (profile != new_active_profile)
+ continue;
+
+ g_signal_handlers_block_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+ g_signal_handlers_unblock_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window);
+ }
+ g_list_free (actions);
+}
+
+static void
terminal_window_update_set_profile_menu (TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
@@ -365,6 +397,7 @@
GList *profiles, *p;
GSList *group;
guint n;
+ gboolean single_profile;
/* Remove the old UI */
if (priv->profiles_ui_id != 0)
@@ -381,18 +414,18 @@
priv->profiles_action_group = NULL;
}
- if (priv->active_term == NULL)
- return;
-
profiles = terminal_app_get_profile_list (terminal_app_get ());
action = gtk_action_group_get_action (priv->action_group, "TerminalProfiles");
- gtk_action_set_sensitive (action, profiles && profiles->next != NULL /* list length >= 2 */);
-
+ single_profile = !profiles || profiles->next == NULL; /* list length <= 1 */
+ gtk_action_set_sensitive (action, !single_profile);
if (profiles == NULL)
return;
- active_profile = terminal_screen_get_profile (priv->active_term);
+ if (priv->active_term)
+ active_profile = terminal_screen_get_profile (priv->active_term);
+ else
+ active_profile = NULL;
action_group = priv->profiles_action_group = gtk_action_group_new ("Profiles");
gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1);
@@ -1379,6 +1412,10 @@
terminal_window_set_menubar_visible (window, TRUE);
priv->use_default_menubar_visibility = TRUE;
+ terminal_window_update_set_profile_menu (window);
+ terminal_window_update_new_terminal_menus (window);
+ terminal_window_update_encoding_menu (window);
+
/* We have to explicitly call this, since screen-changed is NOT
* emitted for the toplevel the first time!
*/
@@ -1564,7 +1601,7 @@
TerminalProfile *old_profile,
TerminalWindow *window)
{
- terminal_window_update_set_profile_menu (window);
+ terminal_window_update_set_profile_menu_active_profile (window);
terminal_window_update_new_terminal_menus (window);
}
@@ -1933,10 +1970,8 @@
g_fprintf (stderr,"setting size after flipping notebook pages\n");
#endif
terminal_window_set_size (window, screen, TRUE);
-
- terminal_window_update_set_profile_menu (window); /* FIXMEchpe no need to do this, just update the current profile action's active state! */
- terminal_window_update_new_terminal_menus (window);
- terminal_window_update_encoding_menu (window);
+
+ terminal_window_update_set_profile_menu_active_profile (window);
terminal_window_update_copy_sensitivity (window);
terminal_window_update_zoom_sensitivity (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]