diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-11-01 19:51:18 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-11-01 19:51:18 +0100 |
commit | dd6983fbe2a0e462de73b5b29020f6f8cff99a02 (patch) | |
tree | 7bf8fca5ccdf9db67e49cfc545f39a69ca47e0e1 /src | |
parent | document changes and release 0.13-2 (diff) | |
parent | Imported Upstream version 0.14 (diff) | |
download | krb5-auth-dialog-dd6983fbe2a0e462de73b5b29020f6f8cff99a02.tar.gz krb5-auth-dialog-dd6983fbe2a0e462de73b5b29020f6f8cff99a02.tar.bz2 krb5-auth-dialog-dd6983fbe2a0e462de73b5b29020f6f8cff99a02.zip |
Merge commit 'upstream/0.14'
Diffstat (limited to 'src')
-rw-r--r-- | src/krb5-auth-dialog.c | 9 | ||||
-rw-r--r-- | src/krb5-auth-dialog.xml | 1 | ||||
-rw-r--r-- | src/krb5-auth-pwdialog.c | 49 | ||||
-rw-r--r-- | src/krb5-auth-tickets.c | 43 | ||||
-rw-r--r-- | src/krb5-auth-tickets.h | 3 |
5 files changed, 80 insertions, 25 deletions
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c index b8f95c2..e831db2 100644 --- a/src/krb5-auth-dialog.c +++ b/src/krb5-auth-dialog.c @@ -309,6 +309,8 @@ ka_get_service_tickets (GtkListStore *tickets) ccache, &cursor, &creds)) == 0) { + gboolean renewable, proxiable, forwardable; + if (creds.times.starttime) ka_format_time(creds.times.starttime, start_time, sizeof(start_time)); @@ -325,6 +327,10 @@ ka_get_service_tickets (GtkListStore *tickets) "%s <span foreground=\"red\" style=\"italic\">(%s)</span>", end_time, _("Expired")); + forwardable = get_cred_forwardable(&creds); + renewable = get_cred_renewable(&creds); + proxiable = get_cred_proxiable(&creds); + ret = krb5_unparse_name (kcontext, creds.server, &name); if (!ret) { gtk_list_store_append(tickets, &iter); @@ -332,6 +338,9 @@ ka_get_service_tickets (GtkListStore *tickets) PRINCIPAL_COLUMN, name, START_TIME_COLUMN, start_time, END_TIME_COLUMN, end_time_markup, + FORWARDABLE_COLUMN, forwardable, + RENEWABLE_COLUMN, renewable, + PROXIABLE_COLUMN, proxiable, -1); free(name); } else diff --git a/src/krb5-auth-dialog.xml b/src/krb5-auth-dialog.xml index f1a9d11..d379265 100644 --- a/src/krb5-auth-dialog.xml +++ b/src/krb5-auth-dialog.xml @@ -155,6 +155,7 @@ <object class="GtkDialog" id="krb5_tickets_dialog"> <property name="border_width">5</property> <property name="title" translatable="yes">Service Tickets</property> + <property name="resizable">False</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> diff --git a/src/krb5-auth-pwdialog.c b/src/krb5-auth-pwdialog.c index 0bfffd7..7e050b2 100644 --- a/src/krb5-auth-pwdialog.c +++ b/src/krb5-auth-pwdialog.c @@ -60,6 +60,19 @@ ka_pwdialog_init(KaPwDialog *pwdialog) } static void +ka_pwdialog_finalize(GObject *object) +{ + KaPwDialog* pwdialog = KA_PWDIALOG (object); + GObjectClass *parent_class = G_OBJECT_CLASS (ka_pwdialog_parent_class); + + gtk_widget_destroy (pwdialog->priv->error_dialog); + pwdialog->priv->error_dialog = NULL; + + if (parent_class->finalize != NULL) + parent_class->finalize (object); +} + +static void ka_pwdialog_class_init(KaPwDialogClass *klass) { g_type_class_add_private(klass, sizeof(KaPwDialogPrivate)); @@ -128,10 +141,8 @@ ka_pwdialog_run(KaPwDialog* self) /* cleanup old error dialog, if present (e.g. user didn't acknowledge * the error but clicked the tray icon again) */ - if (self->priv->error_dialog) { - gtk_widget_destroy (self->priv->error_dialog); - self->priv->error_dialog = NULL; - } + if (self->priv->error_dialog) + gtk_widget_hide (self->priv->error_dialog); /* make sure we pop up on top */ gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE); @@ -153,20 +164,14 @@ ka_pwdialog_run(KaPwDialog* self) void ka_pwdialog_error(KaPwDialog* self, const char *msg) { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new ( - GTK_WINDOW(self->priv->dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "%s", KA_NAME); + GtkWidget *dialog = self->priv->error_dialog; + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("Couldn't acquire kerberos ticket: '%s'"), _(msg)); - self->priv->error_dialog = dialog; + gtk_widget_show (GTK_WIDGET(dialog)); gtk_dialog_run (GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); + gtk_widget_hide(dialog); } @@ -265,6 +270,20 @@ ka_pwdialog_setup (KaPwDialog* pwdialog, const gchar *krb5prompt, g_free (prompt); } + +static GtkWidget* +ka_error_dialog_new(void) +{ + GtkWidget *dialog = gtk_message_dialog_new ( + NULL, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("%s Error"), KA_NAME); + gtk_window_set_title(GTK_WINDOW(dialog), _(KA_NAME)); + gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); + return dialog; +} + + KaPwDialog* ka_pwdialog_create(GtkBuilder* xml) { @@ -276,7 +295,7 @@ ka_pwdialog_create(GtkBuilder* xml) priv->status_label = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_status_label")); priv->krb_label = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_message_label")); priv->pw_entry = GTK_WIDGET (gtk_secure_entry_new ()); - priv->error_dialog = NULL; + priv->error_dialog = ka_error_dialog_new(); entry_hbox = GTK_WIDGET (gtk_builder_get_object (xml, "entry_hbox")); gtk_container_add (GTK_CONTAINER (entry_hbox), priv->pw_entry); diff --git a/src/krb5-auth-tickets.c b/src/krb5-auth-tickets.c index e926324..7c177a9 100644 --- a/src/krb5-auth-tickets.c +++ b/src/krb5-auth-tickets.c @@ -32,38 +32,61 @@ static GtkWidget *tickets_dialog; GtkWidget* ka_tickets_dialog_create(GtkBuilder *xml) { - GtkCellRenderer *renderer; + GtkCellRenderer *text_renderer, *toggle_renderer; GtkTreeViewColumn *column; GtkTreeView *tickets_view; tickets = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING); + G_TYPE_STRING, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN); tickets_dialog = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_tickets_dialog")); tickets_view = GTK_TREE_VIEW (gtk_builder_get_object (xml, "krb5_tickets_treeview")); gtk_tree_view_set_model(GTK_TREE_VIEW(tickets_view), GTK_TREE_MODEL(tickets)); - renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes("Principal", - renderer, + text_renderer = gtk_cell_renderer_text_new(); + toggle_renderer = gtk_cell_renderer_toggle_new(); + + column = gtk_tree_view_column_new_with_attributes(_("Principal"), + text_renderer, "text", PRINCIPAL_COLUMN, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); - column = gtk_tree_view_column_new_with_attributes("Start Time", - renderer, + column = gtk_tree_view_column_new_with_attributes(_("Start Time"), + text_renderer, "text", START_TIME_COLUMN, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); - column = gtk_tree_view_column_new_with_attributes("End Time", - renderer, + column = gtk_tree_view_column_new_with_attributes(_("End Time"), + text_renderer, "markup", END_TIME_COLUMN, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); + column = gtk_tree_view_column_new_with_attributes(_("Fwd"), + toggle_renderer, + "active", + FORWARDABLE_COLUMN, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); + column = gtk_tree_view_column_new_with_attributes(_("Proxy"), + toggle_renderer, + "active", + PROXIABLE_COLUMN, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); + column = gtk_tree_view_column_new_with_attributes(_("Renew"), + toggle_renderer, + "active", + RENEWABLE_COLUMN, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column); return tickets_dialog; } @@ -71,7 +94,7 @@ void ka_tickets_dialog_run() { if (ka_get_service_tickets(tickets)) { - gtk_widget_show(tickets_dialog); + gtk_window_present(GTK_WINDOW(tickets_dialog)); gtk_dialog_run(GTK_DIALOG(tickets_dialog)); gtk_widget_hide(tickets_dialog); } else { diff --git a/src/krb5-auth-tickets.h b/src/krb5-auth-tickets.h index a5fa869..02d67b3 100644 --- a/src/krb5-auth-tickets.h +++ b/src/krb5-auth-tickets.h @@ -25,6 +25,9 @@ enum ticket_columns { PRINCIPAL_COLUMN, START_TIME_COLUMN, END_TIME_COLUMN, + FORWARDABLE_COLUMN, + RENEWABLE_COLUMN, + PROXIABLE_COLUMN, N_COLUMNS }; |