gnucash master: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Mon Jul 10 06:11:21 EDT 2017
Updated via https://github.com/Gnucash/gnucash/commit/eb55b5f9 (commit)
via https://github.com/Gnucash/gnucash/commit/85ce243e (commit)
from https://github.com/Gnucash/gnucash/commit/69ef9ccc (commit)
commit eb55b5f98cee554db95ea6dc1837a170641b5f4b
Author: Geert Janssens <geert at kobaltwit.be>
Date: Mon Jul 10 12:09:51 2017 +0200
Rework icon cache loading
- We actually don't care about the available icon sizes so stop checking for them.
- Even if an icon isn't found continue (with a warning). Gtk uses a fallback icon in most cases.
diff --git a/src/gnome-utils/gnc-gnome-utils.c b/src/gnome-utils/gnc-gnome-utils.c
index d4de6ba..2cad33e 100644
--- a/src/gnome-utils/gnc-gnome-utils.c
+++ b/src/gnome-utils/gnc-gnome-utils.c
@@ -655,10 +655,6 @@ gnc_gui_init(void)
#ifdef MAC_INTEGRATION
gchar *data_dir;
#endif
- int idx;
- int icon_sizes[] = { 16, 32, 48, 0 };
- GList *icons = NULL;
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
ENTER ("");
@@ -667,22 +663,7 @@ gnc_gui_init(void)
/* use custom icon */
gnc_load_app_icons();
- for (idx = 0; icon_sizes[idx] != 0; idx++)
- {
- GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (icon_theme,
- GNC_ICON_APP,
- icon_sizes[idx],
- GTK_ICON_LOOKUP_USE_BUILTIN,
- NULL);
- if (!pixbuf)
- g_warning("error loading application icon of size [%i]", icon_sizes[idx]);
- else
- icons = g_list_append(icons, pixbuf);
- }
-
- gtk_window_set_default_icon_list(icons);
- g_list_foreach(icons, (GFunc)g_object_unref, NULL);
- g_list_free(icons);
+ gtk_window_set_default_icon_name(GNC_ICON_APP);
g_set_application_name(PACKAGE_NAME);
diff --git a/src/gnome-utils/gnc-icons.c b/src/gnome-utils/gnc-icons.c
index 4810611..b9d19d5 100644
--- a/src/gnome-utils/gnc-icons.c
+++ b/src/gnome-utils/gnc-icons.c
@@ -34,72 +34,65 @@
#include "gnc-gnome-utils.h"
#include "gnc-path.h"
-typedef enum {
- APP_ICON,
- ACTION_ICON
-} IconFileType;
+static QofLogModule log_module = GNC_MOD_GUI;
-typedef struct _icon_file
+static gchar *icon_files[] =
{
- const gchar *icon_name;
- const gchar *filename;
- const IconFileType icon_type;
-} icon_file;
-
-static icon_file icon_files[] =
-{
- { GNC_ICON_APP, "gnucash-icon.png", APP_ICON},
- { GNC_ICON_ACCOUNT, "gnc-account.png", ACTION_ICON},
- { GNC_ICON_ACCOUNT_REPORT, "gnc-account-report.png", ACTION_ICON},
- { GNC_ICON_DELETE_ACCOUNT, "gnc-account-delete.png", ACTION_ICON},
- { GNC_ICON_EDIT_ACCOUNT, "gnc-account-edit.png", ACTION_ICON},
- { GNC_ICON_NEW_ACCOUNT, "gnc-account-new.png", ACTION_ICON},
- { GNC_ICON_OPEN_ACCOUNT, "gnc-account-open.png", ACTION_ICON},
- { GNC_ICON_TRANSFER, "gnc-transfer.png", ACTION_ICON},
- { GNC_ICON_SCHEDULE, "gnc-sx-new.png", ACTION_ICON},
- { GNC_ICON_SPLIT_TRANS, "gnc-split-trans.png", ACTION_ICON},
- { GNC_ICON_JUMP_TO, "gnc-jumpto.png", ACTION_ICON},
- { GNC_ICON_INVOICE, "gnc-invoice.png", ACTION_ICON},
- { GNC_ICON_INVOICE_PAY, "gnc-invoice-pay.png", ACTION_ICON},
- { GNC_ICON_INVOICE_POST, "gnc-invoice-post.png", ACTION_ICON},
- { GNC_ICON_INVOICE_UNPOST, "gnc-invoice-unpost.png", ACTION_ICON},
- { GNC_ICON_INVOICE_NEW, "gnc-invoice-new.png", ACTION_ICON},
- { GNC_ICON_INVOICE_EDIT, "gnc-invoice-edit.png", ACTION_ICON},
- { GNC_ICON_INVOICE_DUPLICATE, "gnc-invoice-duplicate.png", ACTION_ICON},
- { GNC_ICON_PDF_EXPORT, "gnc-gnome-pdf.png", ACTION_ICON},
- { GNC_ICON_PDF_EXPORT, "gnc-gnome-pdf.png", ACTION_ICON},
- { 0 },
+ GNC_ICON_APP,
+ GNC_ICON_ACCOUNT,
+ GNC_ICON_ACCOUNT_REPORT,
+ GNC_ICON_DELETE_ACCOUNT,
+ GNC_ICON_EDIT_ACCOUNT,
+ GNC_ICON_NEW_ACCOUNT,
+ GNC_ICON_OPEN_ACCOUNT,
+ GNC_ICON_TRANSFER,
+ GNC_ICON_SCHEDULE,
+ GNC_ICON_SPLIT_TRANS,
+ GNC_ICON_JUMP_TO,
+ GNC_ICON_INVOICE,
+ GNC_ICON_INVOICE_PAY,
+ GNC_ICON_INVOICE_POST,
+ GNC_ICON_INVOICE_UNPOST,
+ GNC_ICON_INVOICE_NEW,
+ GNC_ICON_INVOICE_EDIT,
+ GNC_ICON_INVOICE_DUPLICATE,
+ GNC_ICON_PDF_EXPORT,
+ NULL
};
void
gnc_load_app_icons (void)
{
GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
- icon_file *file;
+ gchar *file;
const gchar *default_path;
gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
gchar* datadir = gnc_path_get_datadir ();
+ gchar **path;
+ gint n_elements, i;
default_path = g_build_filename (pkgdatadir, "icons", NULL);
- g_free (pkgdatadir);
gtk_icon_theme_append_search_path (icon_theme, default_path);
default_path = g_build_filename (datadir, "icons", NULL);
- g_free (datadir);
gtk_icon_theme_append_search_path (icon_theme, default_path);
+ g_free (pkgdatadir);
+ g_free (datadir);
- for (file = icon_files; file->icon_name; file++)
+ gtk_icon_theme_get_search_path (icon_theme,
+ &path,
+ &n_elements);
+ PINFO ("The icon theme search path has %i elements.", n_elements);
+ if (n_elements > 0)
{
+ for (i = 0; i < n_elements; i++)
+ PINFO ("Path %i: %s", i, path[i]);
+ }
- gint *icon_sizes = gtk_icon_theme_get_icon_sizes (icon_theme, file->icon_name);
-
- if ((file->icon_type == ACTION_ICON) &&
- (icon_sizes[0] != 16) && (icon_sizes[1] != 24))
- g_warning ("Required icon size for icon name '%s' not found", file->icon_name);
- else if ((icon_sizes[0] != 16) && (icon_sizes[3] != 32) && (icon_sizes[4] != 48))
- g_warning ("Required icon size for icon name '%s' not found", file->icon_name);
- g_free (icon_sizes);
-
- // check to see if we have at least one size for the named icons loaded
- g_assert (gtk_icon_theme_has_icon (icon_theme, file->icon_name));
+ for (i = 0; icon_files[i]; i++)
+ {
+ gchar *file = icon_files[i];
+ // check if we have at least one size for the named icons loaded
+ if (!gtk_icon_theme_has_icon (icon_theme, file))
+ PWARN ("No icon named '%s' found. Some gui elements may be missing their icons", file);
}
}
commit 85ce243ef885aa639b57c60499d5e5adbe13c46b
Author: Geert Janssens <geert at kobaltwit.be>
Date: Mon Jul 10 12:07:32 2017 +0200
Add icons in the proper directory
diff --git a/src/pixmaps/CMakeLists.txt b/src/pixmaps/CMakeLists.txt
index 9a4949d..7f17b4e 100644
--- a/src/pixmaps/CMakeLists.txt
+++ b/src/pixmaps/CMakeLists.txt
@@ -6,12 +6,12 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION share/gnucash
)
INSTALL(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION share/gnucash/icons
- REGEX ".*/actions.*" EXCLUDE
+ REGEX ".*/apps.*" EXCLUDE
)
INSTALL(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION share/icons
- REGEX ".*/apps.*" EXCLUDE
+ REGEX ".*/actions.*" EXCLUDE
)
SET(gncpixmap_DATA
Summary of changes:
src/gnome-utils/gnc-gnome-utils.c | 21 +--------
src/gnome-utils/gnc-icons.c | 89 ++++++++++++++++++---------------------
src/pixmaps/CMakeLists.txt | 4 +-
3 files changed, 44 insertions(+), 70 deletions(-)
More information about the gnucash-changes
mailing list