[balsa/gtk3] Give unique_app_new a non-NULL startup-id
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Give unique_app_new a non-NULL startup-id
- Date: Wed, 1 Jun 2011 00:40:46 +0000 (UTC)
commit e18d776b40aedcd0f46bf1a4462896148e0dcb21
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue May 31 20:39:20 2011 -0400
Give unique_app_new a non-NULL startup-id
ChangeLog | 7 +++++++
src/main.c | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 345c3f8..5a817ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-31 Peter Bloomfield
+
+ * src/main.c (mw_message_received_cb): present compose window;
+ (main): give unique_app_new_with_commands a non-NULL startup-id,
+ because when NULL it creates a fake timestamp, which results in
+ the running window being presented.
+
2011-05-28 Peter Bloomfield
* src/main.c (balsa_handle_automation_options): do not send
diff --git a/src/main.c b/src/main.c
index c36aa13..9ab52bd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,6 +24,7 @@
#endif /* HAVE_CONFIG_H */
#if HAVE_UNIQUE
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <unique/unique.h>
#endif /* HAVE_UNIQUE */
@@ -200,7 +201,6 @@ mw_message_received_cb(UniqueApp *app,
case COMMAND_COMPOSE:
gdk_threads_enter();
snd = sendmsg_window_compose();
- gdk_threads_leave();
uris = unique_message_data_get_uris(message);
text = uris[0];
@@ -217,6 +217,13 @@ mw_message_received_cb(UniqueApp *app,
}
g_strfreev(uris);
snd->quit_on_close = FALSE;
+
+ window = GTK_WINDOW(snd->window);
+ gtk_window_set_screen(window,
+ unique_message_data_get_screen(message));
+ gtk_window_present(window);
+ gdk_threads_leave();
+
break;
default:
break;
@@ -764,6 +771,8 @@ main(int argc, char *argv[])
GtkWidget *window;
gchar *default_icon;
#if HAVE_UNIQUE
+ GdkDisplay *display;
+ gchar *startup_id;
UniqueApp *app;
#endif /* HAVE_UNIQUE */
@@ -794,7 +803,11 @@ main(int argc, char *argv[])
* we requested ("org.mydomain.MyApplication", in the example) or we
* don't because there already is an application using the same name
*/
- app = unique_app_new_with_commands("org.desktop.Balsa", NULL,
+ display = gdk_display_get_default();
+ startup_id =
+ g_strdup_printf("%s%u_TIME%lu", g_get_host_name(), (guint) getpid(),
+ (gulong) gdk_x11_display_get_user_time(display));
+ app = unique_app_new_with_commands("org.desktop.Balsa", startup_id,
"check-mail", COMMAND_CHECK_MAIL,
"get-stats", COMMAND_GET_STATS,
"open-unread", COMMAND_OPEN_UNREAD,
@@ -802,6 +815,7 @@ main(int argc, char *argv[])
"open-mailbox", COMMAND_OPEN_MAILBOX,
"compose", COMMAND_COMPOSE,
NULL);
+ g_free(startup_id);
/* if there already is an instance running, this will return TRUE; there
* is no race condition because the check is already performed at
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]