[gnome-terminal/gnome-3-16] Make the ActiveTerminal field in the config file format work
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal/gnome-3-16] Make the ActiveTerminal field in the config file format work
- Date: Tue, 24 Mar 2015 08:33:14 +0000 (UTC)
commit da654cc8a926f2cf8301b9fbab349d7fa0cd88d7
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Mar 10 12:47:37 2015 +0100
Make the ActiveTerminal field in the config file format work
https://bugzilla.gnome.org/show_bug.cgi?id=745958
src/client.vapi | 1 +
src/gterminal.vala | 1 +
src/terminal-client-utils.c | 5 +++++
src/terminal-client-utils.h | 1 +
src/terminal-gdbus.c | 9 +++++----
src/terminal-nautilus.c | 1 +
src/terminal-options.c | 6 ++++++
src/terminal.c | 5 +----
8 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/src/client.vapi b/src/client.vapi
index 7eed2bf..ff8680d 100644
--- a/src/client.vapi
+++ b/src/client.vapi
@@ -25,6 +25,7 @@ namespace Terminal.Client {
string? role,
string? profile,
string? title,
+ bool active,
bool maximise_window,
bool fullscreen_window);
diff --git a/src/gterminal.vala b/src/gterminal.vala
index 39451a4..5422a18 100644
--- a/src/gterminal.vala
+++ b/src/gterminal.vala
@@ -424,6 +424,7 @@ namespace GTerminal
OpenOptions.role,
OpenOptions.profile,
null /* title */,
+ true,
OpenOptions.maximise,
OpenOptions.fullscreen);
if (OpenOptions.show_menubar_set)
diff --git a/src/terminal-client-utils.c b/src/terminal-client-utils.c
index a7feb24..7f9fb9a 100644
--- a/src/terminal-client-utils.c
+++ b/src/terminal-client-utils.c
@@ -55,6 +55,7 @@ terminal_client_append_create_instance_options (GVariantBuilder *builder,
const char *role,
const char *profile,
const char *title,
+ gboolean active,
gboolean maximise_window,
gboolean fullscreen_window)
{
@@ -80,6 +81,10 @@ terminal_client_append_create_instance_options (GVariantBuilder *builder,
"role", g_variant_new_string (role));
/* Boolean options */
+ if (active)
+ g_variant_builder_add (builder, "{sv}",
+ "active", g_variant_new_boolean (active));
+
if (maximise_window)
g_variant_builder_add (builder, "{sv}",
"maximize-window", g_variant_new_boolean (TRUE));
diff --git a/src/terminal-client-utils.h b/src/terminal-client-utils.h
index 57d711a..6489601 100644
--- a/src/terminal-client-utils.h
+++ b/src/terminal-client-utils.h
@@ -30,6 +30,7 @@ void terminal_client_append_create_instance_options (GVariantBuilder *builder,
const char *role,
const char *profile,
const char *title,
+ gboolean active,
gboolean maximise_window,
gboolean fullscreen_window);
diff --git a/src/terminal-gdbus.c b/src/terminal-gdbus.c
index 7b68a85..90597d4 100644
--- a/src/terminal-gdbus.c
+++ b/src/terminal-gdbus.c
@@ -373,7 +373,7 @@ terminal_factory_impl_create_instance (TerminalFactory *factory,
gdouble zoom = 1.0;
guint window_id;
gboolean show_menubar;
- gboolean active = TRUE;
+ gboolean active;
gboolean have_new_window, present_window, present_window_set;
GError *err = NULL;
@@ -462,8 +462,6 @@ terminal_factory_impl_create_instance (TerminalFactory *factory,
screen = terminal_screen_new (profile, NULL, NULL, NULL,
zoom_set ? zoom : 1.0);
terminal_window_add_screen (window, screen, -1);
- terminal_window_switch_screen (window, screen);
- gtk_widget_grab_focus (GTK_WIDGET (screen));
object_path = get_object_path_for_screen (window, screen);
g_assert (g_variant_is_object_path (object_path));
@@ -480,8 +478,11 @@ terminal_factory_impl_create_instance (TerminalFactory *factory,
g_signal_connect (screen, "destroy",
G_CALLBACK (screen_destroy_cb), app);
- if (active)
+ if (g_variant_lookup (options, "active", "b", &active) &&
+ active) {
terminal_window_switch_screen (window, screen);
+ gtk_widget_grab_focus (GTK_WIDGET (screen));
+ }
if (g_variant_lookup (options, "present-window", "b", &present_window))
present_window_set = TRUE;
diff --git a/src/terminal-nautilus.c b/src/terminal-nautilus.c
index 341e09e..1f6e627 100644
--- a/src/terminal-nautilus.c
+++ b/src/terminal-nautilus.c
@@ -383,6 +383,7 @@ create_terminal (ExecData *data /* transfer full */)
NULL /* role */,
NULL /* use default profile */,
NULL /* title */,
+ TRUE, /* active */
FALSE /* maximised */,
FALSE /* fullscreen */);
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 0280f11..d12b2d7 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -865,6 +865,7 @@ terminal_options_merge_config (TerminalOptions *options,
for (i = 0; groups[i]; ++i)
{
const char *window_group = groups[i];
+ char *active_terminal;
char **tab_groups;
InitialWindow *iw;
guint j;
@@ -877,6 +878,7 @@ terminal_options_merge_config (TerminalOptions *options,
initial_windows = g_list_append (initial_windows, iw);
apply_defaults (options, iw);
+ active_terminal = g_key_file_get_string (key_file, window_group,
TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB, NULL);
iw->role = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_ROLE, NULL);
iw->geometry = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY,
NULL);
iw->start_fullscreen = g_key_file_get_boolean (key_file, window_group,
TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, NULL);
@@ -898,6 +900,9 @@ terminal_options_merge_config (TerminalOptions *options,
iw->tabs = g_list_append (iw->tabs, it);
+ if (g_strcmp0 (active_terminal, tab_group) == 0)
+ it->active = TRUE;
+
/* it->width = g_key_file_get_integer (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_WIDTH,
NULL);
it->height = g_key_file_get_integer (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_HEIGHT,
NULL);*/
it->working_dir = terminal_util_key_file_get_string_unescape (key_file, tab_group,
TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY, NULL);
@@ -910,6 +915,7 @@ terminal_options_merge_config (TerminalOptions *options,
}
}
+ g_free (active_terminal);
g_strfreev (tab_groups);
if (have_error)
diff --git a/src/terminal.c b/src/terminal.c
index b6a6f5e..296d381 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -103,6 +103,7 @@ handle_options (TerminalFactory *factory,
iw->role,
it->profile ? it->profile :
options->default_profile,
NULL /* title */,
+ it->active,
iw->start_maximized,
iw->start_fullscreen);
@@ -120,10 +121,6 @@ handle_options (TerminalFactory *factory,
if (iw->force_menubar_state)
g_variant_builder_add (&builder, "{sv}",
"show-menubar", g_variant_new_boolean (iw->menubar_state));
-#if 0
- if (it->active)
- terminal_window_switch_screen (window, screen);
-#endif
if (!terminal_factory_call_create_instance_sync
(factory,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]