diff --git a/Makefile b/Makefile
index a51b812478..317881e060 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,14 @@ DATA = AUTHORS \
images/connectivity.png \
images/info.png \
images/playlist.png \
- images/plugins.png
+ images/plugins.png \
+ images/applications-graphics.svg \
+ images/applications-internet.svg \
+ images/applications-system.svg \
+ images/audio-volume-medium.svg \
+ images/audio-x-generic.svg \
+ images/dialog-information.svg \
+ images/preferences-system.svg
include buildsys.mk
include extra.mk
diff --git a/images/applications-graphics.svg b/images/applications-graphics.svg
new file mode 100644
index 0000000000..394d0bac08
--- /dev/null
+++ b/images/applications-graphics.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/applications-internet.svg b/images/applications-internet.svg
new file mode 100644
index 0000000000..05c770910e
--- /dev/null
+++ b/images/applications-internet.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/applications-system.svg b/images/applications-system.svg
new file mode 100644
index 0000000000..e43d7cc8c9
--- /dev/null
+++ b/images/applications-system.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/audio-volume-medium.svg b/images/audio-volume-medium.svg
new file mode 100644
index 0000000000..126763f25a
--- /dev/null
+++ b/images/audio-volume-medium.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/audio-x-generic.svg b/images/audio-x-generic.svg
new file mode 100644
index 0000000000..1c21b4e468
--- /dev/null
+++ b/images/audio-x-generic.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/dialog-information.svg b/images/dialog-information.svg
new file mode 100644
index 0000000000..71df13f24b
--- /dev/null
+++ b/images/dialog-information.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/preferences-system.svg b/images/preferences-system.svg
new file mode 100644
index 0000000000..c18f12fc7e
--- /dev/null
+++ b/images/preferences-system.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/libaudgui/init.cc b/src/libaudgui/init.cc
index aa5b93cc59..8df5680dcc 100644
--- a/src/libaudgui/init.cc
+++ b/src/libaudgui/init.cc
@@ -127,6 +127,38 @@ void audgui_hide_unique_window (int id)
gtk_widget_destroy (windows[id]);
}
+static void load_fallback_icon (const char * icon, int size)
+{
+ const char * data_dir = aud_get_path (AudPath::DataDir);
+ StringBuf svg_name = str_concat ({icon, ".svg"});
+ StringBuf path = filename_build ({data_dir, "images", svg_name});
+ auto pixbuf = gdk_pixbuf_new_from_file_at_size (path, size, size, nullptr);
+
+ if (pixbuf)
+ {
+ gtk_icon_theme_add_builtin_icon (icon, size, pixbuf);
+ g_object_unref (pixbuf);
+ }
+}
+
+static void load_fallback_icons ()
+{
+ /* keep this in sync with the list in prefs-window.cc */
+ static const char * const categories[] = {
+ "applications-graphics",
+ "applications-internet",
+ "applications-system",
+ "audio-volume-medium",
+ "audio-x-generic",
+ "dialog-information",
+ "preferences-system"
+ };
+
+ int category_size = audgui_to_native_dpi (48);
+ for (const char * icon : categories)
+ load_fallback_icon (icon, category_size);
+}
+
static void playlist_set_playing_cb (void *, void *)
{
audgui_pixbuf_uncache ();
@@ -140,6 +172,7 @@ static void playlist_position_cb (void * list, void *)
EXPORT void audgui_init ()
{
+ static bool icons_loaded = false;
assert (aud_get_mainloop_type () == MainloopType::GLib);
if (init_count ++)
@@ -147,6 +180,12 @@ EXPORT void audgui_init ()
gtk_init (nullptr, nullptr);
+ if (! icons_loaded)
+ {
+ load_fallback_icons ();
+ icons_loaded = true;
+ }
+
aud_config_set_defaults ("audgui", audgui_defaults);
status_init ();
diff --git a/src/libaudgui/prefs-window.cc b/src/libaudgui/prefs-window.cc
index 1bf3a3a744..1ccaffd125 100644
--- a/src/libaudgui/prefs-window.cc
+++ b/src/libaudgui/prefs-window.cc
@@ -46,7 +46,7 @@ enum CategoryViewCols {
};
struct Category {
- const char * icon_path;
+ const char * icon;
const char * name;
};
@@ -77,14 +77,15 @@ enum {
CATEGORY_ADVANCED
};
+/* keep this in sync with the list in load_fallback_icons (init.cc) */
static const Category categories[] = {
- { "appearance.png", N_("Appearance") },
- { "audio.png", N_("Audio") },
- { "connectivity.png", N_("Network") },
- { "playlist.png", N_("Playlist")} ,
- { "info.png", N_("Song Info") },
- { "plugins.png", N_("Plugins") },
- { "advanced.png", N_("Advanced") }
+ { "applications-graphics", N_("Appearance") },
+ { "audio-volume-medium", N_("Audio") },
+ { "applications-internet", N_("Network") },
+ { "audio-x-generic", N_("Playlist")} ,
+ { "dialog-information", N_("Song Info") },
+ { "applications-system", N_("Plugins") },
+ { "preferences-system", N_("Advanced") }
};
static const PluginCategory plugin_categories[] = {
@@ -480,7 +481,8 @@ static void fill_category_list (GtkTreeView * treeview, GtkNotebook * notebook)
GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
gtk_tree_view_set_model (treeview, (GtkTreeModel *) store);
- const char * data_dir = aud_get_path (AudPath::DataDir);
+ GtkIconTheme * icon_theme = gtk_icon_theme_get_default ();
+ int icon_size = audgui_to_native_dpi (48);
for (const Category & category : categories)
{
@@ -492,8 +494,8 @@ static void fill_category_list (GtkTreeView * treeview, GtkNotebook * notebook)
gtk_list_store_set (store, & iter, CATEGORY_VIEW_COL_NAME,
gettext (category.name), -1);
- StringBuf path = filename_build ({data_dir, "images", category.icon_path});
- AudguiPixbuf img (gdk_pixbuf_new_from_file (path, nullptr));
+ AudguiPixbuf img (gtk_icon_theme_load_icon (icon_theme,
+ category.icon, icon_size, (GtkIconLookupFlags) 0, nullptr));
if (img)
gtk_list_store_set (store, & iter, CATEGORY_VIEW_COL_ICON, img.get (), -1);