~noskcaj/ubuntu/vivid/gnome-keyring/3.15.90

« back to all changes in this revision

Viewing changes to gcr/gcr-icons.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-14 22:13:02 UTC
  • mfrom: (1.3.1)
  • mto: (80.2.8 experimental) (1.1.77)
  • mto: This revision was merged to the branch mainline in revision 148.
  • Revision ID: package-import@ubuntu.com-20120514221302-0l3gjmqpe6xopond
ImportĀ upstreamĀ versionĀ 3.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * gnome-keyring
3
 
 *
4
 
 * Copyright (C) 2010 Stefan Walter
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU Lesser General Public License as
8
 
 * published by the Free Software Foundation; either version 2.1 of
9
 
 * the License, or (at your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful, but
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Lesser General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
 
 * 02111-1307, USA.
20
 
 */
21
 
 
22
 
#include "config.h"
23
 
 
24
 
#include "gcr.h"
25
 
#include "gcr-types.h"
26
 
#include "gcr-icons.h"
27
 
#include "gcr-internal.h"
28
 
 
29
 
static gboolean registered_icons = FALSE;
30
 
static const gchar *themed_icons[] = {
31
 
        GCR_ICON_FOLDER,
32
 
        GCR_ICON_CERTIFICATE,
33
 
        NULL,
34
 
};
35
 
 
36
 
static void
37
 
add_theme_source (GtkIconSet *iconset, const gchar *icon, GtkIconSize size)
38
 
{
39
 
        GtkIconSource *source;
40
 
 
41
 
        source = gtk_icon_source_new ();
42
 
        gtk_icon_source_set_icon_name (source, icon);
43
 
        gtk_icon_source_set_direction_wildcarded (source, TRUE);
44
 
        gtk_icon_source_set_state_wildcarded (source, TRUE);
45
 
 
46
 
        if (size == -1) {
47
 
                gtk_icon_source_set_size_wildcarded (source, TRUE);
48
 
        } else {
49
 
                gtk_icon_source_set_size_wildcarded (source, FALSE);
50
 
                gtk_icon_source_set_size (source, size);
51
 
        }
52
 
 
53
 
        gtk_icon_set_add_source (iconset, source);
54
 
        gtk_icon_source_free (source);
55
 
}
56
 
 
57
 
void
58
 
_gcr_icons_register (void)
59
 
{
60
 
        GtkIconFactory *factory;
61
 
        GtkIconSet *iconset;
62
 
        const gchar **name;
63
 
 
64
 
        if (registered_icons)
65
 
                return;
66
 
 
67
 
        /* Setup the icon factory. */
68
 
        factory = gtk_icon_factory_new ();
69
 
        gtk_icon_factory_add_default (factory);
70
 
 
71
 
        for (name = themed_icons; name && *name; name++) {
72
 
                iconset = gtk_icon_set_new ();
73
 
                add_theme_source (iconset, *name, GTK_ICON_SIZE_BUTTON);
74
 
                add_theme_source (iconset, *name, GTK_ICON_SIZE_MENU);
75
 
                add_theme_source (iconset, *name, GTK_ICON_SIZE_LARGE_TOOLBAR);
76
 
                add_theme_source (iconset, *name, GTK_ICON_SIZE_SMALL_TOOLBAR);
77
 
                add_theme_source (iconset, *name, GTK_ICON_SIZE_DIALOG);
78
 
                add_theme_source (iconset, *name, -1);
79
 
                gtk_icon_factory_add (factory, *name, iconset);
80
 
                gtk_icon_set_unref (iconset);
81
 
        }
82
 
 
83
 
        g_object_unref (factory);
84
 
        registered_icons = TRUE;
85
 
}