summaryrefslogtreecommitdiff
path: root/frontends/gtk/gui.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-09-15 22:20:49 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-09-21 10:53:41 +0100
commit11aa682154af6e0d4c7920bb2983df5a6ded126f (patch)
tree9a689239267870e8eec7205c8f5820dc927dbbb8 /frontends/gtk/gui.c
parent9cd9a403e6ee69c78a575872bd399c633862d5aa (diff)
downloadnetsurf-11aa682154af6e0d4c7920bb2983df5a6ded126f.tar.gz
netsurf-11aa682154af6e0d4c7920bb2983df5a6ded126f.tar.bz2
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.
Diffstat (limited to 'frontends/gtk/gui.c')
-rw-r--r--frontends/gtk/gui.c30
1 files changed, 24 insertions, 6 deletions
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 */