summaryrefslogtreecommitdiff
path: root/src/terminal-window.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-09-05 01:54:51 -0700
committerStefano Karapetsas <[email protected]>2013-09-05 01:54:51 -0700
commit693f9ae54e74d7bccbcbdcf66fb146b1666c896d (patch)
treecf90f0d939c6cc7d2a385206fb5ca1caab947655 /src/terminal-window.c
parentc5735b3afe2038eb67a715ded4e1a97a02656948 (diff)
parenta3f5ac0e9cd58b5760e2a4234f6509f979e5e540 (diff)
downloadmate-terminal-693f9ae54e74d7bccbcbdcf66fb146b1666c896d.tar.bz2
mate-terminal-693f9ae54e74d7bccbcbdcf66fb146b1666c896d.tar.xz
Merge pull request #27 from stephenkgh/master
[PATCH] Add previous/next profile keyboard shortcuts, menu items
Diffstat (limited to 'src/terminal-window.c')
-rw-r--r--src/terminal-window.c69
1 files changed, 68 insertions, 1 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index dfa1b9d..69b953c 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -103,7 +103,7 @@ struct _TerminalWindowPrivate
#define SET_ENCODING_UI_PATH "/menubar/Terminal/TerminalSetEncoding/EncodingsPH"
#define SET_ENCODING_ACTION_NAME_PREFIX "TerminalSetEncoding"
-#define PROFILES_UI_PATH "/menubar/Terminal/TerminalProfiles"
+#define PROFILES_UI_PATH "/menubar/Terminal/TerminalProfiles/ProfilesPH"
#define PROFILES_POPUP_UI_PATH "/Popup/PopupTerminalProfiles/ProfilesPH"
#define SIZE_TO_UI_PATH "/menubar/Terminal/TerminalSizeToPH"
@@ -202,6 +202,8 @@ static void search_find_prev_callback (GtkAction *action,
TerminalWindow *window);
static void search_clear_highlight_callback (GtkAction *action,
TerminalWindow *window);
+static void terminal_next_or_previous_profile_cb (GtkAction *action,
+ TerminalWindow *window);
static void terminal_set_title_callback (GtkAction *action,
TerminalWindow *window);
static void terminal_add_encoding_callback (GtkAction *action,
@@ -1948,6 +1950,16 @@ terminal_window_init (TerminalWindow *window)
/* Terminal menu */
{ "TerminalProfiles", NULL, N_("Change _Profile") },
{
+ "ProfilePrevious", NULL, N_("_Previous Profile"), "<alt>Page_Up",
+ NULL,
+ G_CALLBACK (terminal_next_or_previous_profile_cb)
+ },
+ {
+ "ProfileNext", NULL, N_("_Next Profile"), "<alt>Page_Down",
+ NULL,
+ G_CALLBACK (terminal_next_or_previous_profile_cb)
+ },
+ {
"TerminalSetTitle", NULL, N_("_Set Titleā€¦"), NULL,
NULL,
G_CALLBACK (terminal_set_title_callback)
@@ -3813,6 +3825,61 @@ search_clear_highlight_callback (GtkAction *action,
}
static void
+terminal_next_or_previous_profile_cb (GtkAction *action,
+ TerminalWindow *window)
+{
+ TerminalWindowPrivate *priv = window->priv;
+ TerminalProfile *active_profile, *new_profile;
+ GList *profiles, *p;
+
+ const char *name;
+ guint backwards = 0;
+
+ name = gtk_action_get_name (action);
+ if (strcmp (name, "ProfilePrevious") == 0)
+ {
+ backwards = 1;
+ }
+
+ profiles = terminal_app_get_profile_list (terminal_app_get ());
+ if (profiles == NULL)
+ return;
+
+ if (priv->active_screen)
+ active_profile = terminal_screen_get_profile (priv->active_screen);
+ else
+ return;
+
+ for (p = profiles; p != NULL; p = p->next)
+ {
+ TerminalProfile *profile = (TerminalProfile *) p->data;
+ if (profile == active_profile)
+ {
+ if (backwards) {
+ p = p->prev;
+ if (p == NULL)
+ p = g_list_last (profiles);
+ new_profile = p->data;
+ break;
+ }
+ else
+ {
+ p = p->next;
+ if (p == NULL)
+ p = g_list_first (profiles);
+ new_profile = p->data;
+ break;
+ }
+ }
+ }
+
+ if (new_profile)
+ terminal_screen_set_profile (priv->active_screen, new_profile);
+
+ g_list_free (profiles);
+}
+
+static void
terminal_set_title_dialog_response_cb (GtkWidget *dialog,
int response,
TerminalScreen *screen)