From 11aa682154af6e0d4c7920bb2983df5a6ded126f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 15 Sep 2019 22:20:49 +0100 Subject: construct all toolbar items from data table This changes toolbar item constuction to use toolbar_items.h instead of explicit macros. Additionally all remenants of old stock item themeing are done away with and GTK icon names are used instead. --- frontends/gtk/gui.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'frontends/gtk/gui.c') diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c index d033a5735..9b42ef96b 100644 --- a/frontends/gtk/gui.c +++ b/frontends/gtk/gui.c @@ -81,7 +81,6 @@ char *nsgtk_config_home; /* exported global defined in gtk/gui.h */ GdkPixbuf *favicon_pixbuf; /** favicon default pixbuf */ GdkPixbuf *win_default_icon_pixbuf; /** default window icon pixbuf */ -GdkPixbuf *arrow_down_pixbuf; /** arrow down pixbuf */ GtkBuilder *warning_builder; @@ -254,6 +253,26 @@ static nserror set_defaults(struct nsoption_s *defaults) } +/** + * adds named icons into gtk theme + */ +static nserror nsgtk_add_named_icons_to_theme(void) +{ + #if GTK_CHECK_VERSION(3,14,0) + gtk_icon_theme_add_resource_path(gtk_icon_theme_get_default(), + "/org/netsurf/icons"); + #else + GdkPixbuf *pixbuf; + nserror res; + + res = nsgdk_pixbuf_new_from_resname("icons/local-history.png", &pixbuf); + if (res != NSERROR_OK) { + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 8, 32); + } + gtk_icon_theme_add_builtin_icon("local-history", 32, pixbuf); + #endif + return NSERROR_OK; +} /** @@ -313,12 +332,11 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) false, 8, 16, 16); } - /* arrow down icon */ - res = nsgdk_pixbuf_new_from_resname("arrow_down_8x32.png", - &arrow_down_pixbuf); + /* add named icons to gtk theme */ + res = nsgtk_add_named_icons_to_theme(); if (res != NSERROR_OK) { - arrow_down_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, - false, 8, 8, 32); + NSLOG(netsurf, INFO, "Unable to add named icons to GTK theme."); + return res; } /* initialise throbber */ -- cgit v1.2.3