[gnome-terminal] client: Reimplement opening multiple tabs in the same window
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] client: Reimplement opening multiple tabs in the same window
- Date: Thu, 3 May 2012 19:08:33 +0000 (UTC)
commit c0bdc30cf4fb764ceb71601c03bd6a9eeddc3ba0
Author: Christian Persch <chpe gnome org>
Date: Thu May 3 20:44:52 2012 +0200
client: Reimplement opening multiple tabs in the same window
src/terminal-gdbus.c | 6 ++++--
src/terminal.c | 21 ++++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/terminal-gdbus.c b/src/terminal-gdbus.c
index 15fb69e..f2b9f59 100644
--- a/src/terminal-gdbus.c
+++ b/src/terminal-gdbus.c
@@ -26,6 +26,7 @@
#include "terminal-app.h"
#include "terminal-debug.h"
#include "terminal-defines.h"
+#include "terminal-mdi-container.h"
#include "terminal-util.h"
#include "terminal-window.h"
@@ -441,8 +442,9 @@ terminal_factory_impl_create_instance (TerminalFactory *factory,
terminal_window_switch_screen (window, screen);
gtk_widget_grab_focus (GTK_WIDGET (screen));
- // FIXMEchpe make this better!
- object_path = g_strdup_printf (TERMINAL_RECEIVER_OBJECT_PATH_PREFIX "/%u", (guint)g_random_int ());
+ object_path = g_strdup_printf (TERMINAL_RECEIVER_OBJECT_PATH_PREFIX "/window/%u/terminal/%u",
+ gtk_application_window_get_id (GTK_APPLICATION_WINDOW (window)),
+ terminal_mdi_container_get_n_screens (TERMINAL_MDI_CONTAINER (terminal_window_get_mdi_container (window))));
skeleton = terminal_object_skeleton_new (object_path);
impl = terminal_receiver_impl_new (screen);
diff --git a/src/terminal.c b/src/terminal.c
index f2c78a3..c6f69e6 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -74,15 +74,18 @@ handle_options (TerminalFactory *factory,
{
InitialWindow *iw = lw->data;
GList *lt;
+ guint window_id;
g_assert (iw->tabs);
+ window_id = 0;
+
/* Now add the tabs */
for (lt = iw->tabs; lt != NULL; lt = lt->next)
{
InitialTab *it = lt->data;
GVariantBuilder builder;
- char *object_path;
+ char *object_path, *p;
TerminalReceiver *receiver;
char **argv;
int argc;
@@ -101,6 +104,10 @@ handle_options (TerminalFactory *factory,
iw->start_maximized,
iw->start_fullscreen);
+ if (window_id)
+ g_variant_builder_add (&builder, "{sv}",
+ "window-id", g_variant_new_uint32 (window_id));
+
/* Restored windows shouldn't demand attention; see bug #586308. */
if (iw->source_tag == SOURCE_SESSION)
g_variant_builder_add (&builder, "{sv}",
@@ -126,6 +133,18 @@ handle_options (TerminalFactory *factory,
continue;
}
+ p = strstr (object_path, "/window/");
+ if (p) {
+ char *end = NULL;
+ guint64 value;
+
+ errno = 0;
+ p += strlen ("/window/");
+ value = g_ascii_strtoull (p, &end, 10);
+ if (errno == 0 && end != p && *end == '/')
+ window_id = (guint) value;
+ }
+
receiver = terminal_receiver_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]