gnome-terminal r3287 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r3287 - trunk/src
- Date: Tue, 27 Jan 2009 14:40:36 +0000 (UTC)
Author: chpe
Date: Tue Jan 27 14:40:36 2009
New Revision: 3287
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=3287&view=rev
Log:
Use a factory per display, like the bonobo single-instance code also did. Bug #564725.
Modified:
trunk/src/terminal-debug.c
trunk/src/terminal-debug.h
trunk/src/terminal.c
Modified: trunk/src/terminal-debug.c
==============================================================================
--- trunk/src/terminal-debug.c (original)
+++ trunk/src/terminal-debug.c Tue Jan 27 14:40:36 2009
@@ -31,6 +31,7 @@
const GDebugKey keys[] = {
{ "accels", TERMINAL_DEBUG_ACCELS },
{ "encodings", TERMINAL_DEBUG_ENCODINGS },
+ { "factory", TERMINAL_DEBUG_FACTORY },
{ "geometry", TERMINAL_DEBUG_GEOMETRY },
{ "profile", TERMINAL_DEBUG_PROFILE }
};
Modified: trunk/src/terminal-debug.h
==============================================================================
--- trunk/src/terminal-debug.h (original)
+++ trunk/src/terminal-debug.h Tue Jan 27 14:40:36 2009
@@ -28,8 +28,9 @@
typedef enum {
TERMINAL_DEBUG_ACCELS = 1 << 0,
TERMINAL_DEBUG_ENCODINGS = 1 << 1,
- TERMINAL_DEBUG_GEOMETRY = 1 << 2,
- TERMINAL_DEBUG_PROFILE = 1 << 3
+ TERMINAL_DEBUG_FACTORY = 1 << 2,
+ TERMINAL_DEBUG_GEOMETRY = 1 << 3,
+ TERMINAL_DEBUG_PROFILE = 1 << 4,
} TerminalDebugFlags;
void _terminal_debug_init(void);
Modified: trunk/src/terminal.c
==============================================================================
--- trunk/src/terminal.c (original)
+++ trunk/src/terminal.c Tue Jan 27 14:40:36 2009
@@ -21,6 +21,8 @@
#include <config.h>
+#include <locale.h>
+
#include <glib.h>
#include <glib/gstdio.h>
@@ -44,9 +46,9 @@
#include "terminal-options.h"
#include "terminal-util.h"
-#define TERMINAL_FACTORY_SERVICE_NAME "org.gnome.Terminal.Factory"
-#define TERMINAL_FACTORY_SERVICE_PATH "/org/gnome/Terminal/Factory"
-#define TERMINAL_FACTORY_INTERFACE_NAME "org.gnome.Terminal.Factory"
+#define TERMINAL_FACTORY_SERVICE_NAME_PREFIX "org.gnome.Terminal.Factory.Display"
+#define TERMINAL_FACTORY_SERVICE_PATH "/org/gnome/Terminal/Factory"
+#define TERMINAL_FACTORY_INTERFACE_NAME "org.gnome.Terminal.Factory"
#define TERMINAL_TYPE_FACTORY (terminal_factory_get_type ())
#define TERMINAL_FACTORY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_FACTORY, TerminalFactory))
@@ -207,6 +209,29 @@
g_free (uri);
}
+static char *
+get_factory_name_for_display (const char *display_name)
+{
+ GString *name;
+ const char *p;
+
+ name = g_string_sized_new (strlen (TERMINAL_FACTORY_SERVICE_NAME_PREFIX) + strlen (display_name) + 1 /* NUL */);
+ g_string_append (name, TERMINAL_FACTORY_SERVICE_NAME_PREFIX);
+
+ for (p = display_name; *p; ++p)
+ {
+ if (g_ascii_isalnum (*p))
+ g_string_append_c (name, *p);
+ else
+ g_string_append_c (name, '_');
+ }
+
+ _terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+ "Factory name is \"%s\"\n", name->str);
+
+ return g_string_free (name, FALSE);
+}
+
/* Evil hack alert: this is exported from libgconf-2 but not in a public header */
extern gboolean gconf_ping_daemon (void);
@@ -220,10 +245,13 @@
GdkDisplay *display;
TerminalOptions *options;
DBusGConnection *connection;
+ char *factory_name = NULL;
DBusGProxy *proxy;
guint32 request_name_ret;
GError *error = NULL;
+ setlocale (LC_ALL, "");
+
bindtextdomain (GETTEXT_PACKAGE, TERM_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
@@ -313,8 +341,9 @@
G_CALLBACK (name_owner_changed), factory, NULL);
#endif
+ factory_name = get_factory_name_for_display (display_name);
if (!org_freedesktop_DBus_request_name (proxy,
- TERMINAL_FACTORY_SERVICE_NAME,
+ factory_name,
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&request_name_ret,
&error))
@@ -337,6 +366,9 @@
gboolean retval;
int ret = EXIT_SUCCESS;
+ _terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+ "Forwarding arguments to existing instance\n");
+
env = g_listenv ();
envc = g_strv_length (env);
env_ptr_array = g_ptr_array_sized_new (envc);
@@ -359,7 +391,7 @@
argv_array = terminal_util_strv_to_array (argc_copy, argv_copy);
proxy = dbus_g_proxy_new_for_name (connection,
- TERMINAL_FACTORY_SERVICE_NAME,
+ factory_name,
TERMINAL_FACTORY_SERVICE_PATH,
TERMINAL_FACTORY_INTERFACE_NAME);
retval = org_gnome_Terminal_Factory_handle_arguments (proxy,
@@ -408,6 +440,7 @@
factory_disabled:
g_free (argv_copy);
+ g_free (factory_name);
/* If the gconf daemon isn't available (e.g. because there's no dbus
* session bus running), we'd crash later on. Tell the user about it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]