[gnome-keyring/ui-widgets: 3/7] [gcr] Display proper certificate icon.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/ui-widgets: 3/7] [gcr] Display proper certificate icon.
- Date: Fri, 27 Aug 2010 03:24:45 +0000 (UTC)
commit b193540c3b1f3651c3d76015093c63fe48d3b32e
Author: Stef Walter <stef memberwebs com>
Date: Sun Jun 20 17:20:19 2010 +0000
[gcr] Display proper certificate icon.
gcr/Makefile.am | 1 +
gcr/gcr-certificate-widget.c | 15 ++-----
gcr/gcr-display-view.c | 2 -
gcr/gcr-icons.c | 85 ++++++++++++++++++++++++++++++++++++++++++
gcr/gcr-icons.h | 36 ++++++++++++++++++
5 files changed, 127 insertions(+), 12 deletions(-)
---
diff --git a/gcr/Makefile.am b/gcr/Makefile.am
index 3f8842c..bba15bb 100644
--- a/gcr/Makefile.am
+++ b/gcr/Makefile.am
@@ -48,6 +48,7 @@ libgcr_la_SOURCES = \
gcr-certificate-basics-widget.c gcr-certificate-basics-widget.h \
gcr-certificate-details-widget.c gcr-certificate-details-widget.h \
gcr-display-view.c gcr-display-view.h \
+ gcr-icons.c gcr-icons.h \
gcr-import-dialog.c gcr-import-dialog.h \
gcr-importer.c gcr-importer.h \
gcr-internal.h \
diff --git a/gcr/gcr-certificate-widget.c b/gcr/gcr-certificate-widget.c
index 5d81b5b..7b81d7f 100644
--- a/gcr/gcr-certificate-widget.c
+++ b/gcr/gcr-certificate-widget.c
@@ -22,6 +22,7 @@
#include "gcr-certificate.h"
#include "gcr-certificate-widget.h"
#include "gcr-display-view.h"
+#include "gcr-icons.h"
#include "egg/egg-asn1.h"
#include "egg/egg-oid.h"
@@ -170,16 +171,8 @@ refresh_display (GcrCertificateWidget *self)
/* TODO: Calculate name properly */
_gcr_display_view_append_title (self->pv->view, "Certificate Name");
-#if 0
- _gcr_display_view_append_table ()
-
- Issued To:
- Issued By:
- Expires:
-#endif
-
display = egg_asn1_read_dn_part (asn, "tbsCertificate.subject.rdnSequence", "CN");
- _gcr_display_view_append_content (self->pv->view, _("Identifies"), display);
+ _gcr_display_view_append_content (self->pv->view, _("Identity"), display);
g_free (display);
display = egg_asn1_read_dn_part (asn, "tbsCertificate.issuer.rdnSequence", "CN");
@@ -310,7 +303,7 @@ gcr_certificate_widget_constructor (GType type, guint n_props, GObjectConstructP
self = GCR_CERTIFICATE_WIDGET (obj);
self->pv->view = _gcr_display_view_new ();
- _gcr_display_view_set_stock_image (self->pv->view, GTK_STOCK_DIALOG_AUTHENTICATION);
+ _gcr_display_view_set_stock_image (self->pv->view, GCR_ICON_CERTIFICATE);
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -399,6 +392,8 @@ gcr_certificate_widget_class_init (GcrCertificateWidgetClass *klass)
g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
g_param_spec_object("certificate", "Certificate", "Certificate to display.",
GCR_TYPE_CERTIFICATE, G_PARAM_READWRITE));
+
+ _gcr_icons_register ();
}
/* -----------------------------------------------------------------------------
diff --git a/gcr/gcr-display-view.c b/gcr/gcr-display-view.c
index 86b3f4d..a66456c 100644
--- a/gcr/gcr-display-view.c
+++ b/gcr/gcr-display-view.c
@@ -127,7 +127,6 @@ static void
on_expander_realize (GtkWidget *widget, gpointer user_data)
{
GdkCursor *cursor = gdk_cursor_new (GDK_ARROW);
- g_printerr ("realize cursor\n");
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
gdk_cursor_unref (cursor);
}
@@ -230,7 +229,6 @@ _gcr_display_view_realize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (_gcr_display_view_parent_class)->realize)
GTK_WIDGET_CLASS (_gcr_display_view_parent_class)->realize (widget);
- g_printerr ("setting color\n");
style = gtk_widget_get_style (widget);
gtk_widget_modify_bg (self->pv->details_widget, GTK_STATE_NORMAL, &style->base[GTK_STATE_NORMAL]);
}
diff --git a/gcr/gcr-icons.c b/gcr/gcr-icons.c
new file mode 100644
index 0000000..9b6c38f
--- /dev/null
+++ b/gcr/gcr-icons.c
@@ -0,0 +1,85 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2010 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "gcr.h"
+#include "gcr-types.h"
+#include "gcr-icons.h"
+#include "gcr-internal.h"
+
+static gboolean registered_icons = FALSE;
+static const gchar *themed_icons[] = {
+ GCR_ICON_FOLDER,
+ GCR_ICON_CERTIFICATE,
+ NULL,
+};
+
+static void
+add_theme_source (GtkIconSet *iconset, const gchar *icon, GtkIconSize size)
+{
+ GtkIconSource *source;
+
+ source = gtk_icon_source_new ();
+ gtk_icon_source_set_icon_name (source, icon);
+ gtk_icon_source_set_direction_wildcarded (source, TRUE);
+ gtk_icon_source_set_state_wildcarded (source, TRUE);
+
+ if (size == -1) {
+ gtk_icon_source_set_size_wildcarded (source, TRUE);
+ } else {
+ gtk_icon_source_set_size_wildcarded (source, FALSE);
+ gtk_icon_source_set_size (source, size);
+ }
+
+ gtk_icon_set_add_source (iconset, source);
+ gtk_icon_source_free (source);
+}
+
+void
+_gcr_icons_register (void)
+{
+ GtkIconFactory *factory;
+ GtkIconSet *iconset;
+ const gchar **name;
+
+ if (registered_icons)
+ return;
+
+ /* Setup the icon factory. */
+ factory = gtk_icon_factory_new ();
+ gtk_icon_factory_add_default (factory);
+
+ for (name = themed_icons; name && *name; name++) {
+ iconset = gtk_icon_set_new ();
+ add_theme_source (iconset, *name, GTK_ICON_SIZE_BUTTON);
+ add_theme_source (iconset, *name, GTK_ICON_SIZE_MENU);
+ add_theme_source (iconset, *name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ add_theme_source (iconset, *name, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ add_theme_source (iconset, *name, GTK_ICON_SIZE_DIALOG);
+ add_theme_source (iconset, *name, -1);
+ gtk_icon_factory_add (factory, *name, iconset);
+ gtk_icon_set_unref (iconset);
+ }
+
+ g_object_unref (factory);
+ registered_icons = TRUE;
+}
diff --git a/gcr/gcr-icons.h b/gcr/gcr-icons.h
new file mode 100644
index 0000000..7465438
--- /dev/null
+++ b/gcr/gcr-icons.h
@@ -0,0 +1,36 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2010 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef __GCR_ICONS_H__
+#define __GCR_ICONS_H__
+
+#include "gcr-internal.h"
+
+G_BEGIN_DECLS
+
+#define GCR_ICON_FOLDER "folder"
+#define GCR_ICON_CERTIFICATE "application-certificate"
+
+void _gcr_icons_register (void);
+
+G_END_DECLS
+
+#endif /* __GCR_TOKEN_MANAGER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]