[gnome-flashback] polkit: use x11 server time when displaying authentication dialog
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] polkit: use x11 server time when displaying authentication dialog
- Date: Sun, 6 Sep 2015 20:59:20 +0000 (UTC)
commit ca7f2fd1f0d769c4a619aae64d35885601345a69
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Sep 6 23:43:18 2015 +0300
polkit: use x11 server time when displaying authentication dialog
Based on patch from Jeffrey Knockel <jeff250 gmail com>.
https://bugzilla.gnome.org/show_bug.cgi?id=676076
.../libpolkit/flashback-authenticator.c | 9 ++-----
.../libpolkit/flashback-polkit-dialog.c | 21 ++++++++++++++++++++
.../libpolkit/flashback-polkit-dialog.h | 2 +
3 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/gnome-flashback/libpolkit/flashback-authenticator.c
b/gnome-flashback/libpolkit/flashback-authenticator.c
index f40bafb..8763a05 100644
--- a/gnome-flashback/libpolkit/flashback-authenticator.c
+++ b/gnome-flashback/libpolkit/flashback-authenticator.c
@@ -102,8 +102,7 @@ session_request (PolkitAgentSession *session,
modified_request = g_strdup (request);
}
- gtk_widget_show_all (authenticator->dialog);
- gtk_window_present (GTK_WINDOW (dialog));
+ flashback_polkit_dialog_present (dialog);
password = flashback_polkit_dialog_run_until_response_for_prompt (dialog,
modified_request,
@@ -140,8 +139,7 @@ session_show_info (PolkitAgentSession *session,
flashback_polkit_dialog_set_info_message (dialog, s);
g_free (s);
- gtk_widget_show_all (authenticator->dialog);
- gtk_window_present (GTK_WINDOW (dialog));
+ flashback_polkit_dialog_present (dialog);
}
static void
@@ -187,8 +185,7 @@ do_initiate (gpointer user_data)
authenticator = FLASHBACK_AUTHENTICATOR (user_data);
dialog = FLASHBACK_POLKIT_DIALOG (authenticator->dialog);
- gtk_widget_show_all (authenticator->dialog);
- gtk_window_present (GTK_WINDOW (dialog));
+ flashback_polkit_dialog_present (dialog);
if (!flashback_polkit_dialog_run_until_user_is_selected (dialog))
{
diff --git a/gnome-flashback/libpolkit/flashback-polkit-dialog.c
b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
index 24a2911..34fde6a 100644
--- a/gnome-flashback/libpolkit/flashback-polkit-dialog.c
+++ b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <errno.h>
+#include <gdk/gdkx.h>
#include <glib/gi18n-lib.h>
#include <pwd.h>
@@ -1114,3 +1115,23 @@ flashback_polkit_dialog_set_info_message (FlashbackPolkitDialog *dialog,
{
gtk_label_set_markup (GTK_LABEL (dialog->info_label), info_markup);
}
+
+void
+flashback_polkit_dialog_present (FlashbackPolkitDialog *dialog)
+{
+ GtkWidget *widget;
+ GdkWindow *window;
+ guint32 server_time;
+
+ widget = GTK_WIDGET (dialog);
+
+ gtk_widget_show_all (widget);
+
+ window = gtk_widget_get_window (widget);
+
+ server_time = GDK_CURRENT_TIME;
+ if (window != NULL)
+ server_time = gdk_x11_get_server_time (window);
+
+ gtk_window_present_with_time (GTK_WINDOW (dialog), server_time);
+}
diff --git a/gnome-flashback/libpolkit/flashback-polkit-dialog.h
b/gnome-flashback/libpolkit/flashback-polkit-dialog.h
index 1a4c87b..14022cb 100644
--- a/gnome-flashback/libpolkit/flashback-polkit-dialog.h
+++ b/gnome-flashback/libpolkit/flashback-polkit-dialog.h
@@ -54,6 +54,8 @@ void flashback_polkit_dialog_indicate_error (FlashbackPolki
void flashback_polkit_dialog_set_info_message (FlashbackPolkitDialog *dialog,
const gchar *info_markup);
+void flashback_polkit_dialog_present (FlashbackPolkitDialog *dialog);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]