summaryrefslogtreecommitdiff
path: root/client/gtk.c
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2009-10-03 21:47:59 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2010-01-02 22:30:12 +0100
commit205717fab38b52f72f16c7c73ec959e7cd900d62 (patch)
treec752e406ade789a2db22b47f8beaa351f0701a76 /client/gtk.c
parent9d77e5b29487cf27eb9f6571e62f0be34ffa0649 (diff)
downloadfribid-205717fab38b52f72f16c7c73ec959e7cd900d62.tar.gz
fribid-205717fab38b52f72f16c7c73ec959e7cd900d62.tar.bz2
fribid-205717fab38b52f72f16c7c73ec959e7cd900d62.zip
Made the window modal instead of "stay on top"
Diffstat (limited to 'client/gtk.c')
-rw-r--r--client/gtk.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/client/gtk.c b/client/gtk.c
index 94a4287..b4e82e6 100644
--- a/client/gtk.c
+++ b/client/gtk.c
@@ -137,7 +137,7 @@ static bool addSignatureFile(GtkListStore *signatures, const char *filename,
}
void platform_startSign(const char *url, const char *hostname, const char *ip,
- const char *subjectFilter) {
+ const char *subjectFilter, int parentWindowId) {
currentSubjectFilter = (subjectFilter != NULL ?
strdup(subjectFilter) : NULL);
@@ -194,8 +194,28 @@ void platform_startSign(const char *url, const char *hostname, const char *ip,
passwordEntry = GTK_ENTRY(gtk_builder_get_object(builder, "password_entry"));
signDialog = GTK_DIALOG(gtk_builder_get_object(builder, "dialog_sign"));
- //gtk_window_set_transient_for(GTK_WINDOW(signDialog), ???);
- gtk_window_set_keep_above(GTK_WINDOW(signDialog), TRUE);
+
+ bool transientOk = false;
+ if (parentWindowId != -1) {
+ GdkWindow *parent = gdk_window_foreign_new((GdkNativeWindow)parentWindowId);
+ if (parent != NULL) {
+ gtk_widget_realize(GTK_WIDGET(signDialog));
+ // Only available in GTK 2.14+
+ //GdkWindow *ourWindow = gtk_widget_get_window(GTK_WINDOW(signDialog));
+ GdkWindow *ourWindow = GTK_WIDGET(signDialog)->window;
+ if (ourWindow != NULL) {
+ gdk_window_set_transient_for(ourWindow, parent);
+ gdk_window_set_modal_hint(ourWindow, TRUE);
+ transientOk = true;
+ //g_object_unref(G_OBJECT(ourWindow));
+ }
+ g_object_unref(G_OBJECT(parent));
+ }
+ }
+
+ if (!transientOk) {
+ gtk_window_set_keep_above(GTK_WINDOW(signDialog), TRUE);
+ }
platform_setMessage(NULL);
validateDialog(NULL, NULL);