[krb5-auth-dialog] Add button to refresh credentials to main window's header bar
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Add button to refresh credentials to main window's header bar
- Date: Mon, 17 Jul 2017 06:01:42 +0000 (UTC)
commit 073c8432c6eb5849daffe841c56cdbefe29274d8
Author: Guido Günther <agx sigxcpu org>
Date: Fri Jul 7 16:19:27 2017 +0200
Add button to refresh credentials to main window's header bar
Useful if one closes the notifiation
src/ka-main-window.c | 32 ++++++++++++++++++++++++++++++++
src/resources/ui/ka-main-window.ui | 18 ++++++++++++++++--
2 files changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/src/ka-main-window.c b/src/ka-main-window.c
index 21b1dbc..1509b20 100644
--- a/src/ka-main-window.c
+++ b/src/ka-main-window.c
@@ -30,6 +30,7 @@
#include "ka-preferences.h"
static GtkListStore *tickets;
+static GtkButton *ticket_btn;
static GtkApplicationWindow *main_window;
static void
@@ -44,6 +45,26 @@ ccache_changed_cb (KaApplet* applet,
}
+static void
+enable_ticket_button_cb (gpointer* applet G_GNUC_UNUSED,
+ gchar *princ G_GNUC_UNUSED,
+ guint when G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ gboolean enable = GPOINTER_TO_UINT(user_data);
+ KA_DEBUG ("Sensitive: %u", enable);
+ gtk_widget_set_sensitive(GTK_WIDGET(ticket_btn), enable);
+}
+
+
+static void
+ticket_btn_clicked(GtkButton* btn G_GNUC_UNUSED, gpointer user_data)
+{
+ KaApplet *applet = KA_APPLET(user_data);
+ ka_grab_credentials (applet);
+}
+
+
GtkApplicationWindow *
ka_main_window_create (KaApplet *applet)
{
@@ -117,6 +138,17 @@ ka_main_window_create (KaApplet *applet)
G_CALLBACK(ccache_changed_cb),
NULL);
+ ticket_btn =
+ GTK_BUTTON (gtk_builder_get_object (builder, "get_ticket_btn"));
+ g_signal_connect(ticket_btn, "clicked", G_CALLBACK(ticket_btn_clicked), applet);
+
+ g_signal_connect (applet, "krb-tgt-acquired",
+ G_CALLBACK (enable_ticket_button_cb),
+ GUINT_TO_POINTER(FALSE));
+
+ g_signal_connect (applet, "krb-tgt-expired",
+ G_CALLBACK (enable_ticket_button_cb),
+ GUINT_TO_POINTER(TRUE));
g_object_unref (builder);
return main_window;
}
diff --git a/src/resources/ui/ka-main-window.ui b/src/resources/ui/ka-main-window.ui
index 47d1fbe..8554521 100644
--- a/src/resources/ui/ka-main-window.ui
+++ b/src/resources/ui/ka-main-window.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
<interface>
- <requires lib="gtk+" version="3.0"/>
+ <requires lib="gtk+" version="3.14"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -32,5 +32,19 @@
</child>
</object>
</child>
+ <child type="titlebar">
+ <object class="GtkHeaderBar" id="header">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">True</property>
+ <child>
+ <object class="GtkButton" id="get_ticket_btn">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Get Ticket</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]