/*
* gnome-keyring
*
- * Copyright (C) 2010 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
+ *
+ * Author: Stef Walter <stefw@collabora.co.uk>
*/
#include "config.h"
-#include "gcr.h"
-#include "gcr-types.h"
+#include "gcr-base.h"
#include "gcr-icons.h"
-#include "gcr-internal.h"
-
-static gboolean registered_icons = FALSE;
-static const gchar *themed_icons[] = {
- GCR_ICON_CERTIFICATE,
- GCR_ICON_KEY,
- GCR_ICON_KEY_PAIR,
- NULL,
-};
-static void
-add_theme_source (GtkIconSet *iconset, const gchar *icon, GtkIconSize size)
+GIcon *
+gcr_icon_for_token_info (GckTokenInfo *token_info)
{
- 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;
+ GIcon *icon;
- /* Setup the icon factory. */
- factory = gtk_icon_factory_new ();
- gtk_icon_factory_add_default (factory);
+ g_return_val_if_fail (token_info != NULL, NULL);
- 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);
- }
+ if (g_strcmp0 (token_info->manufacturer_id, "Gnome Keyring") == 0)
+ icon = g_themed_icon_new (GCR_ICON_HOME_DIRECTORY);
+ else
+ icon = g_themed_icon_new (GCR_ICON_SMART_CARD);
- g_object_unref (factory);
- registered_icons = TRUE;
+ return icon;
}
* gnome-keyring
*
* Copyright (C) 2010 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
#define GCR_ICON_CERTIFICATE "application-certificate"
#define GCR_ICON_KEY "gcr-key"
#define GCR_ICON_KEY_PAIR "gcr-key-pair"
+#define GCR_ICON_SMART_CARD "gcr-smart-card"
+#define GCR_ICON_HOME_DIRECTORY "user-home"
-void _gcr_icons_register (void);
+GIcon * gcr_icon_for_token_info (GckTokenInfo *token_info);
G_END_DECLS
-#endif /* __GCR_TOKEN_MANAGER_H__ */
+#endif /* __GCR_SMART_CARD_H__ */