[nautilus-sendto/gnome-3-0] main: Add --xid command-line option
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-sendto/gnome-3-0] main: Add --xid command-line option
- Date: Wed, 14 Mar 2012 15:31:52 +0000 (UTC)
commit 2a42b74337c3440b38a60faad0f6d622a66e09c2
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 14 14:17:28 2012 +0100
main: Add --xid command-line option
src/nautilus-sendto-command.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-sendto-command.c b/src/nautilus-sendto-command.c
index 1496411..f276c57 100644
--- a/src/nautilus-sendto-command.c
+++ b/src/nautilus-sendto-command.c
@@ -27,6 +27,10 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
#include "nautilus-sendto-plugin.h"
#define NAUTILUS_SENDTO_LAST_MEDIUM "last-medium"
@@ -53,6 +57,7 @@ gboolean has_dirs = FALSE;
GList *plugin_list = NULL;
GHashTable *hash ;
guint option = 0;
+static gint64 xid = 0;
static GSettings *settings = NULL;
@@ -77,6 +82,7 @@ struct _NS_ui {
};
static const GOptionEntry entries[] = {
+ { "xid", 'x', 0, G_OPTION_ARG_INT64, &xid, "Use XID as parent to the send dialogue", NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
{ NULL }
};
@@ -554,6 +560,19 @@ nautilus_sendto_create_ui (void)
ui->status_label = GTK_WIDGET (gtk_builder_get_object (app, "status_label"));
ui->status_image = GTK_WIDGET (gtk_builder_get_object (app, "status_image"));
+#ifdef GDK_WINDOWING_X11
+ if (xid != 0) {
+ GdkWindow *window;
+ GdkDisplayManager *manager;
+
+ gtk_widget_realize (ui->dialog);
+ manager = gdk_display_manager_get ();
+ window = gdk_x11_window_foreign_new_for_display (gdk_display_manager_get_default_display (manager), xid);
+ gdk_window_set_transient_for (gtk_widget_get_window (ui->dialog),
+ window);
+ }
+#endif
+
gtk_settings = gtk_settings_get_default ();
button_image = GTK_WIDGET (gtk_builder_get_object (app, "image1"));
g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
@@ -620,7 +639,6 @@ nautilus_sendto_create_ui (void)
}
gtk_widget_show (ui->dialog);
-
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]