GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-icons.c
1/*
2 * gnc-icons.c -- Functions to add icons for GnuCash to use
3 * Copyright (C) 2003 Jan Arne Petersen
4 * Author: Jan Arne Petersen <jpetersen@uni-bonn.de>
5 */
6/********************************************************************\
7 * This program is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU General Public License as *
9 * published by the Free Software Foundation; either version 2 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License*
18 * along with this program; if not, contact: *
19 * *
20 * Free Software Foundation Voice: +1-617-542-5942 *
21 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
22 * Boston, MA 02110-1301, USA gnu@gnu.org *
23 * *
24\********************************************************************/
25
26
27#include <config.h>
28
29#include <gtk/gtk.h>
30#include <glib/gi18n.h>
31
32#include "gnc-icons.h"
33#include "gnc-filepath-utils.h"
34#include "gnc-gnome-utils.h"
35#include "gnc-path.h"
36#include <gnc-engine.h> // For define GNC_MOD_GUI
37
38static QofLogModule log_module = GNC_MOD_GUI;
39
40static gchar *icon_files[] =
41{
42 GNC_ICON_APP,
43 GNC_ICON_ACCOUNT,
44 GNC_ICON_ACCOUNT_REPORT,
45 GNC_ICON_DELETE_ACCOUNT,
46 GNC_ICON_EDIT_ACCOUNT,
47 GNC_ICON_NEW_ACCOUNT,
48 GNC_ICON_OPEN_ACCOUNT,
49 GNC_ICON_TRANSFER,
50 GNC_ICON_SCHEDULE,
51 GNC_ICON_SPLIT_TRANS,
52 GNC_ICON_JUMP_TO,
53 GNC_ICON_INVOICE,
54 GNC_ICON_INVOICE_PAY,
55 GNC_ICON_INVOICE_POST,
56 GNC_ICON_INVOICE_UNPOST,
57 GNC_ICON_INVOICE_NEW,
58 GNC_ICON_INVOICE_EDIT,
59 GNC_ICON_INVOICE_DUPLICATE,
60 GNC_ICON_PDF_EXPORT,
61 NULL
62};
63
64void
65gnc_load_app_icons (void)
66{
67 GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
68 gchar *default_path;
69 gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
70 gchar* datadir = gnc_path_get_datadir ();
71 gchar **path;
72 gint n_elements, i;
73
74 default_path = g_build_filename (pkgdatadir, "icons", NULL);
75 gtk_icon_theme_append_search_path (icon_theme, default_path);
76 g_free (default_path);
77 default_path = g_build_filename (datadir, "icons", NULL);
78 gtk_icon_theme_append_search_path (icon_theme, default_path);
79 g_free (default_path);
80 g_free (pkgdatadir);
81 g_free (datadir);
82
83 gtk_icon_theme_get_search_path (icon_theme,
84 &path,
85 &n_elements);
86 PINFO ("The icon theme search path has %i elements.", n_elements);
87 if (n_elements > 0)
88 {
89 for (i = 0; i < n_elements; i++)
90 PINFO ("Path %i: %s", i, path[i]);
91 }
92
93 g_strfreev (path);
94
95 for (i = 0; icon_files[i]; i++)
96 {
97 gchar *file = icon_files[i];
98 // check if we have at least one size for the named icons loaded
99 if (!gtk_icon_theme_has_icon (icon_theme, file))
100 PWARN ("No icon named '%s' found. Some gui elements may be missing their icons", file);
101 }
102}
All type declarations for the whole Gnucash engine.
File path resolution utility functions.
Gnome specific utility functions.
#define PINFO(format, args...)
Print an informational note.
Definition qoflog.h:256
#define PWARN(format, args...)
Log a warning.
Definition qoflog.h:250