Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/c67c4aa999f44b728bc508ff24060ea605f17e1e
...commit
http://git.netsurf-browser.org/netsurf.git/commit/c67c4aa999f44b728bc508ff24060ea605f17e1e
...tree
http://git.netsurf-browser.org/netsurf.git/tree/c67c4aa999f44b728bc508ff24060ea605f17e1e
The branch, vince/gtk-tab-restyle has been updated
via c67c4aa999f44b728bc508ff24060ea605f17e1e (commit)
via dc48c0c22fb9612a464429d851b502a0d5718790 (commit)
from acbc73624be2962b58ebba50cd9d42b5ee1c10b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=c67c4aa999f44b728bc508ff24060ea605f17e1e
commit c67c4aa999f44b728bc508ff24060ea605f17e1e
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
add cookie icon and use it for show cookies toolbar button
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 9b42ef9..205c548 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -270,7 +270,14 @@ static nserror nsgtk_add_named_icons_to_theme(void)
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 8, 32);
}
gtk_icon_theme_add_builtin_icon("local-history", 32, pixbuf);
- #endif
+
+ res = nsgdk_pixbuf_new_from_resname("icons/show-cookie.png", &pixbuf);
+ if (res != NSERROR_OK) {
+ pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 24, 24);
+ }
+ gtk_icon_theme_add_builtin_icon("show-cookie", 24, pixbuf);
+
+#endif
return NSERROR_OK;
}
diff --git a/frontends/gtk/res/netsurf.gresource.xml
b/frontends/gtk/res/netsurf.gresource.xml
index b475dc5..d9aa921 100644
--- a/frontends/gtk/res/netsurf.gresource.xml
+++ b/frontends/gtk/res/netsurf.gresource.xml
@@ -57,6 +57,7 @@
<file>quirks.css</file>
<file>netsurf.png</file>
<file>default.ico</file>
+ <file>icons/show-cookie.png</file>
<file>icons/local-history.png</file>
<file>icons/arrow-l.png</file>
<file>icons/content.png</file>
diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c
index 9fd7116..f48ddb4 100644
--- a/frontends/gtk/resources.c
+++ b/frontends/gtk/resources.c
@@ -96,6 +96,7 @@ static struct nsgtk_resource_s pixbuf_resource[] = {
RES_ENTRY("netsurf.xpm"),
RES_ENTRY("menu_cursor.png"),
RES_ENTRY("icons/local-history.png"),
+ RES_ENTRY("icons/show-cookie.png"),
RES_ENTRY("throbber/throbber0.png"),
RES_ENTRY("throbber/throbber1.png"),
RES_ENTRY("throbber/throbber2.png"),
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 7a35112..344c097 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -139,7 +139,7 @@ TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, p,
, NULL)
TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, p,
gtkGlobalHistory, NULL)
TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, p, gtkAddBookMarks,
NULL)
TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, b, p,
gtkShowBookMarks, "user-bookmarks")
-TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, p, gtkShowCookies, NULL)
+TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, b, p, gtkShowCookies,
"show-cookie")
TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, p, gtkOpenLocation,
NULL)
TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y, gtkNextTab,
"media-skip-forward")
TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y, gtkPrevTab,
"media-skip-backward")
diff --git a/resources/icons/show-cookie.png b/resources/icons/show-cookie.png
new file mode 100644
index 0000000..8e44972
Binary files /dev/null and b/resources/icons/show-cookie.png differ
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=dc48c0c22fb9612a464429d851b502a0d5718790
commit dc48c0c22fb9612a464429d851b502a0d5718790
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
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.
diff --git a/frontends/gtk/compat.c b/frontends/gtk/compat.c
index a75fdaf..a8321d6 100644
--- a/frontends/gtk/compat.c
+++ b/frontends/gtk/compat.c
@@ -170,18 +170,18 @@ void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry,
/* exported interface documented in gtk/compat.h */
-void nsgtk_entry_set_icon_from_stock(GtkWidget *entry,
- GtkEntryIconPosition icon_pos,
- const gchar *id)
+void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry,
+ GtkEntryIconPosition icon_pos,
+ const gchar *id)
{
#ifdef NSGTK_USE_ICON_NAME
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
#else
#if GTK_CHECK_VERSION(2,16,0)
- gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, id);
+ gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
#else
- GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(id,
- GTK_ICON_SIZE_LARGE_TOOLBAR));
+ GtkImage *image;
+ image = GTK_IMAGE(gtk_image_new_from_stock(id,
GTK_ICON_SIZE_LARGE_TOOLBAR));
if (image != NULL) {
sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry),
diff --git a/frontends/gtk/compat.h b/frontends/gtk/compat.h
index feb0abe..8ef2ed5 100644
--- a/frontends/gtk/compat.h
+++ b/frontends/gtk/compat.h
@@ -178,16 +178,16 @@ enum {
/**
- * Sets the icon shown in the entry at the specified position from a
- * stock image.
+ * Sets the icon shown in the entry at the specified position from an
+ * icon name.
*
- * Compatability interface for original deprecated in GTK 3.10
+ * Compatability interface for original introduced in 2.16
*
* \param entry The entry widget to set the icon on.
* \param icon_pos The position of the icon.
* \param stock_id the name of the stock item.
*/
-void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition
icon_pos, const gchar *stock_id);
+void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry,
GtkEntryIconPosition icon_pos, const gchar *stock_id);
/**
* Creates a GtkImage displaying a stock icon.
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index d033a57..9b42ef9 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 */
diff --git a/frontends/gtk/gui.h b/frontends/gtk/gui.h
index 53e7324..ee82e7a 100644
--- a/frontends/gtk/gui.h
+++ b/frontends/gtk/gui.h
@@ -27,9 +27,6 @@ extern char *nsgtk_config_home;
/** favicon default pixbuf */
extern GdkPixbuf *favicon_pixbuf;
-/** arrow down pixbuf */
-extern GdkPixbuf *arrow_down_pixbuf;
-
/** resource search path vector */
extern char **respaths;
diff --git a/frontends/gtk/res/arrow_down_8x32.png
b/frontends/gtk/res/arrow_down_8x32.png
deleted file mode 100644
index 475b4ff..0000000
Binary files a/frontends/gtk/res/arrow_down_8x32.png and /dev/null differ
diff --git a/frontends/gtk/res/netsurf.gresource.xml
b/frontends/gtk/res/netsurf.gresource.xml
index c170df2..b475dc5 100644
--- a/frontends/gtk/res/netsurf.gresource.xml
+++ b/frontends/gtk/res/netsurf.gresource.xml
@@ -57,7 +57,7 @@
<file>quirks.css</file>
<file>netsurf.png</file>
<file>default.ico</file>
- <file>arrow_down_8x32.png</file>
+ <file>icons/local-history.png</file>
<file>icons/arrow-l.png</file>
<file>icons/content.png</file>
<file>icons/directory2.png</file>
diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c
index 7aea43c..9fd7116 100644
--- a/frontends/gtk/resources.c
+++ b/frontends/gtk/resources.c
@@ -95,7 +95,7 @@ static struct nsgtk_resource_s pixbuf_resource[] = {
RES_ENTRY("favicon.png"),
RES_ENTRY("netsurf.xpm"),
RES_ENTRY("menu_cursor.png"),
- RES_ENTRY("arrow_down_8x32.png"),
+ RES_ENTRY("icons/local-history.png"),
RES_ENTRY("throbber/throbber0.png"),
RES_ENTRY("throbber/throbber1.png"),
RES_ENTRY("throbber/throbber2.png"),
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 6ace032..f0b4f9b 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -53,6 +53,7 @@ struct nsgtk_menu {
GtkWidget *burger; /* right click menu */
GtkWidget *popup; /* popup menu entry */
void *mhandler; /* menu item handler */
+ const char *iconname; /* name of the icon to use */
bool sensitivity; /* menu item is sensitive */
};
@@ -463,7 +464,7 @@ nsgtk_on_##name##_activate_menu(GtkMenuItem *widget,
gpointer data) \
}
#define TOOLBAR_ITEM_y(identifier, name)
#define TOOLBAR_ITEM_n(identifier, name)
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate, label,
iconame) \
TOOLBAR_ITEM_ ## activate(identifier, name)
#include "gtk/toolbar_items.h"
#undef TOOLBAR_ITEM_y
@@ -888,15 +889,18 @@ create_scaffolding_link_menu(struct nsgtk_scaffolding *g,
GtkAccelGroup *group)
*/
static nserror nsgtk_menu_initialise(struct nsgtk_scaffolding *g)
{
-#define TOOLBAR_ITEM_p(identifier, name) \
- g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu;
-#define TOOLBAR_ITEM_y(identifier, name) \
- g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu;
-#define TOOLBAR_ITEM_n(identifier, name) \
- g->menus[identifier].mhandler = NULL;
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM_p(identifier, name, iconame)
\
+ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM_y(identifier, name, iconame) \
+ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM_n(identifier, name, iconame) \
+ g->menus[identifier].mhandler = NULL; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
g->menus[identifier].sensitivity = snstvty; \
- TOOLBAR_ITEM_ ## activate(identifier, name)
+ TOOLBAR_ITEM_ ## activate(identifier, name, iconame)
#include "gtk/toolbar_items.h"
#undef TOOLBAR_ITEM_y
#undef TOOLBAR_ITEM_n
@@ -1015,6 +1019,34 @@ static void nsgtk_menu_set_sensitivity(struct
nsgtk_scaffolding *g)
}
}
+/* set menu items to have icons */
+static void nsgtk_menu_set_icons(struct nsgtk_scaffolding *g)
+{
+ GtkWidget *img;
+ for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
+ /* ensure there is an icon name */
+ if (g->menus[i].iconname == NULL) {
+ continue;
+ }
+
+ if (g->menus[i].main != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].main), img);
+ }
+ if (g->menus[i].burger != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].burger), img);
+ }
+ if (g->menus[i].popup != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].popup), img);
+ }
+ }
+}
+
/**
* create and initialise menus
*
@@ -1069,6 +1101,7 @@ static nserror nsgtk_menus_create(struct
nsgtk_scaffolding *gs)
/* set up the menu signal handlers */
nsgtk_menu_initialise(gs);
+ nsgtk_menu_set_icons(gs);
nsgtk_menu_connect_signals(gs);
nsgtk_menu_set_sensitivity(gs);
@@ -1579,9 +1612,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct
gui_window *toplevel)
gs->prev = NULL;
scaf_list = gs;
- /* set icon images */
- nsgtk_theme_implement(gs);
-
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(gs->window));
diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c
index b9e6dad..04e90b9 100644
--- a/frontends/gtk/tabs.c
+++ b/frontends/gtk/tabs.c
@@ -286,7 +286,7 @@ nsgtk_tab_add_newtab(GtkNotebook *notebook)
tablabel = nsgtk_hbox_new(FALSE, 1);
tabcontents = nsgtk_hbox_new(FALSE, 1);
- add = nsgtk_image_new_from_stock(NSGTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+ add = gtk_image_new_from_icon_name(NSGTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
gtk_box_pack_start(GTK_BOX(tablabel), add, FALSE, FALSE, 0);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 85c32e3..f7a18e7 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -82,6 +82,27 @@
#define THROBBER_FRAME_TIME (100)
/**
+ * the minimum number of columns in the tool store
+ */
+#define NSGTK_MIN_STORE_COLUMNS 4
+
+/**
+ * the 'standard' width of a button that makes sufficient of its label visible
+ */
+#define NSGTK_BUTTON_WIDTH 120
+
+/**
+ * the 'standard' height of a button that fits as many toolbars as
+ * possible into the store
+ */
+#define NSGTK_BUTTON_HEIGHT 70
+
+/**
+ * the 'normal' width of the websearch bar
+ */
+#define NSGTK_WEBSEARCH_WIDTH 150
+
+/**
* toolbar item context
*/
struct nsgtk_toolbar_item {
@@ -137,6 +158,7 @@ struct nsgtk_toolbar {
void *get_ctx;
};
+
/**
* toolbar cusomisation context
*/
@@ -176,336 +198,9 @@ struct nsgtk_toolbar_customisation {
static bool edit_mode = false;
-/* the number of items that fit in the width of the store window */
-#define NSGTK_STORE_WIDTH 6
-
-/* the 'standard' width of a button that makes sufficient of its label
-visible */
-#define NSGTK_BUTTON_WIDTH 120
-
-/* the 'standard' height of a button that fits as many toolbars as
-possible into the store */
-#define NSGTK_BUTTON_HEIGHT 70
-
-/* the 'normal' width of the websearch bar */
-#define NSGTK_WEBSEARCH_WIDTH 150
-
-
-enum image_sets {
- IMAGE_SET_MAIN_MENU = 0,
- IMAGE_SET_RCLICK_MENU,
- IMAGE_SET_POPUP_MENU,
- IMAGE_SET_BUTTONS,
- IMAGE_SET_COUNT
-};
-
-typedef enum search_buttons {
- SEARCH_BACK_BUTTON = 0,
- SEARCH_FORWARD_BUTTON,
- SEARCH_CLOSE_BUTTON,
- SEARCH_BUTTONS_COUNT
-} nsgtk_search_buttons;
-
-struct nsgtk_theme {
- GtkImage *image[PLACEHOLDER_BUTTON];
- GtkImage *searchimage[SEARCH_BUTTONS_COUNT];
-};
-
/* forward declaration */
-int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct
nsgtk_scaffolding *g);
-static nserror toolbar_item_create(nsgtk_toolbar_button id, struct
nsgtk_toolbar_item *item_out);
-
-
-/* define data plus and data minus handlers */
-#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate) \
-static gboolean
\
-nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
- GdkDragContext *cont, \
- GtkSelectionData *selection, \
- guint info, \
- guint time, \
- gpointer data) \
-{ \
- struct nsgtk_toolbar_customisation *tbc; \
- tbc = (struct nsgtk_toolbar_customisation *)data; \
- tbc->dragitem = identifier; \
- tbc->dragfrom = true; \
- return TRUE; \
-} \
-static gboolean
\
-nsgtk_toolbar_##name##_data_minus(GtkWidget *widget, \
- GdkDragContext *cont, \
- GtkSelectionData *selection, \
- guint info, \
- guint time, \
- gpointer data) \
-{ \
- struct nsgtk_toolbar_customisation *tbc; \
- tbc = (struct nsgtk_toolbar_customisation *)data; \
- tbc->dragitem = identifier; \
- tbc->dragfrom = false; \
- return TRUE; \
-}
-
-#include "gtk/toolbar_items.h"
-
-#undef TOOLBAR_ITEM
-
-
-
-/**
- * get default image for buttons / menu items from gtk stock items.
- *
- * \param tbbutton button reference
- * \param iconsize The size of icons to select.
- * \param usedef Use the default image if not found.
- * \return default images.
- */
-static GtkImage *
-nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
- GtkIconSize iconsize,
- bool usedef)
-{
- GtkImage *image; /* The GTK image to return */
-
- switch(tbbutton) {
-
-#define BUTTON_IMAGE(p, q) \
- case p##_BUTTON: \
- image = GTK_IMAGE(nsgtk_image_new_from_stock(q, iconsize)); \
- break
-
- BUTTON_IMAGE(BACK, NSGTK_STOCK_GO_BACK);
- BUTTON_IMAGE(FORWARD, NSGTK_STOCK_GO_FORWARD);
- BUTTON_IMAGE(STOP, NSGTK_STOCK_STOP);
- BUTTON_IMAGE(RELOAD, NSGTK_STOCK_REFRESH);
- BUTTON_IMAGE(HOME, NSGTK_STOCK_HOME);
- BUTTON_IMAGE(NEWWINDOW, "gtk-new");
- BUTTON_IMAGE(NEWTAB, "gtk-new");
- BUTTON_IMAGE(OPENFILE, NSGTK_STOCK_OPEN);
- BUTTON_IMAGE(CLOSETAB, NSGTK_STOCK_CLOSE);
- BUTTON_IMAGE(CLOSEWINDOW, NSGTK_STOCK_CLOSE);
- BUTTON_IMAGE(SAVEPAGE, NSGTK_STOCK_SAVE_AS);
- BUTTON_IMAGE(PRINTPREVIEW, "gtk-print-preview");
- BUTTON_IMAGE(PRINT, "gtk-print");
- BUTTON_IMAGE(QUIT, "gtk-quit");
- BUTTON_IMAGE(CUT, "gtk-cut");
- BUTTON_IMAGE(COPY, "gtk-copy");
- BUTTON_IMAGE(PASTE, "gtk-paste");
- BUTTON_IMAGE(DELETE, "gtk-delete");
- BUTTON_IMAGE(SELECTALL, "gtk-select-all");
- BUTTON_IMAGE(FIND, NSGTK_STOCK_FIND);
- BUTTON_IMAGE(PREFERENCES, "gtk-preferences");
- BUTTON_IMAGE(ZOOMPLUS, "gtk-zoom-in");
- BUTTON_IMAGE(ZOOMMINUS, "gtk-zoom-out");
- BUTTON_IMAGE(ZOOMNORMAL, "gtk-zoom-100");
- BUTTON_IMAGE(FULLSCREEN, "gtk-fullscreen");
- BUTTON_IMAGE(VIEWSOURCE, "gtk-index");
- BUTTON_IMAGE(CONTENTS, "gtk-help");
- BUTTON_IMAGE(ABOUT, "gtk-about");
- BUTTON_IMAGE(OPENMENU, NSGTK_STOCK_OPEN_MENU);
-#undef BUTTON_IMAGE
-
- case HISTORY_BUTTON:
- image = GTK_IMAGE(gtk_image_new_from_pixbuf(arrow_down_pixbuf));
- break;
-
- default:
- image = NULL;
- break;
-
- }
-
- if (usedef && (image == NULL)) {
- image =
GTK_IMAGE(nsgtk_image_new_from_stock("gtk-missing-image", iconsize));
- }
-
- return image;
-}
-
-
-/**
- * Get default image for search buttons / menu items from gtk stock items
- *
- * \param tbbutton search button reference
- * \param iconsize The size of icons to select.
- * \param usedef Use the default image if not found.
- * \return default search image.
- */
-static GtkImage *
-nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
- GtkIconSize iconsize,
- bool usedef)
-{
- GtkImage *image;
-
- switch (tbbutton) {
-
- case (SEARCH_BACK_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_GO_BACK, iconsize));
- break;
-
- case (SEARCH_FORWARD_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_GO_FORWARD, iconsize));
- break;
-
- case (SEARCH_CLOSE_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_CLOSE, iconsize));
- break;
-
- default:
- image = NULL;
- }
-
- if (usedef && (image == NULL)) {
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- "gtk-missing-image", iconsize));
- }
-
- return image;
-}
-
-/**
- * initialise a theme structure with gtk images
- *
- * \param iconsize The size of icon to load
- * \param usedef use the default gtk icon if unset
- */
-static struct nsgtk_theme *nsgtk_theme_load(GtkIconSize iconsize, bool usedef)
-{
- struct nsgtk_theme *theme;
- int btnloop;
-
- theme = malloc(sizeof(struct nsgtk_theme));
- if (theme == NULL) {
- return NULL;
- }
-
- for (btnloop = BACK_BUTTON;
- btnloop < PLACEHOLDER_BUTTON ;
- btnloop++) {
- theme->image[btnloop] = nsgtk_theme_image_default(btnloop,
- iconsize,
- usedef);
- }
-
- for (btnloop = SEARCH_BACK_BUTTON;
- btnloop < SEARCH_BUTTONS_COUNT;
- btnloop++) {
- theme->searchimage[btnloop] =
- nsgtk_theme_searchimage_default(btnloop,
- iconsize,
- usedef);
- }
- return theme;
-}
-
-static struct nsgtk_toolbar_item *
-nsgtk_scaffolding_button(struct nsgtk_scaffolding *g, int i)
-{
- return NULL;
-}
-
-/* exported function documented in gtk/toolbar.h */
-void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
-{
- struct nsgtk_theme *theme[IMAGE_SET_COUNT];
- int i;
- struct nsgtk_toolbar_item *button;
- struct gtk_search *search;
-
- theme[IMAGE_SET_MAIN_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_RCLICK_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_POPUP_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_BUTTONS] =
nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-
- for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
- if ((i == URL_BAR_ITEM) || (i == THROBBER_ITEM) ||
- (i == WEBSEARCH_ITEM))
- continue;
-
- button = nsgtk_scaffolding_button(g, i);
- if (button == NULL)
- continue;
-
- #if 0
- /* gtk_image_menu_item_set_image accepts NULL image */
- if ((button->main != NULL) &&
- (theme[IMAGE_SET_MAIN_MENU] != NULL)) {
- nsgtk_image_menu_item_set_image(
- GTK_WIDGET(button->main),
-
GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->main));
- }
- if ((button->rclick != NULL) &&
- (theme[IMAGE_SET_RCLICK_MENU] != NULL)) {
-
nsgtk_image_menu_item_set_image(GTK_WIDGET(button->rclick),
- GTK_WIDGET(
-
theme[IMAGE_SET_RCLICK_MENU]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->rclick));
- }
- if ((button->popup != NULL) &&
- (theme[IMAGE_SET_POPUP_MENU] != NULL)) {
-
nsgtk_image_menu_item_set_image(GTK_WIDGET(button->popup),
- GTK_WIDGET(
-
theme[IMAGE_SET_POPUP_MENU]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->popup));
- }
- #endif
- if ((button->location != -1) &&
- (button->button != NULL) &&
- (theme[IMAGE_SET_BUTTONS] != NULL)) {
- gtk_tool_button_set_icon_widget(
- GTK_TOOL_BUTTON(button->button),
- GTK_WIDGET(
- theme[IMAGE_SET_BUTTONS]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->button));
- }
- }
-
- /* set search bar images */
- search = nsgtk_scaffolding_search(g);
- if ((search != NULL) && (theme[IMAGE_SET_MAIN_MENU] != NULL)) {
- /* gtk_tool_button_set_icon_widget accepts NULL image */
- if (search->buttons[SEARCH_BACK_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_BACK_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_BACK_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
-
search->buttons[SEARCH_BACK_BUTTON]));
- }
- if (search->buttons[SEARCH_FORWARD_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_FORWARD_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_FORWARD_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
- search->buttons[
-
SEARCH_FORWARD_BUTTON]));
- }
- if (search->buttons[SEARCH_CLOSE_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_CLOSE_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_CLOSE_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
-
search->buttons[SEARCH_CLOSE_BUTTON]));
- }
- }
-
- for (i = 0; i < IMAGE_SET_COUNT; i++) {
- if (theme[i] != NULL) {
- free(theme[i]);
- }
- }
-}
+static nserror toolbar_item_create(nsgtk_toolbar_button id,
+ struct nsgtk_toolbar_item *item_out);
/**
@@ -555,9 +250,11 @@ make_toolbar_item_throbber(bool sensitivity)
}
if (edit_mode) {
+ const char *msg;
+ msg = messages_get("ToolThrob");
item = gtk_tool_button_new(
GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
- "[throbber]");
+ msg);
} else {
item = gtk_tool_item_new();
@@ -576,6 +273,7 @@ make_toolbar_item_throbber(bool sensitivity)
return item;
}
+
/**
* create url bar toolbar item widget
*
@@ -588,24 +286,34 @@ make_toolbar_item_url_bar(bool sensitivity)
GtkWidget *entry;
GtkEntryCompletion *completion;
- item = gtk_tool_item_new();
entry = nsgtk_entry_new();
- completion = gtk_entry_completion_new();
- if ((entry == NULL) || (completion == NULL) || (item == NULL)) {
+ if (entry == NULL) {
return NULL;
}
- gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
-
- gtk_container_add(GTK_CONTAINER(item), entry);
- gtk_tool_item_set_expand(item, TRUE);
-
if (edit_mode) {
- gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
+
+ item = gtk_tool_button_new(NULL, "URL");
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), entry);
} else {
- gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+ completion = gtk_entry_completion_new();
+ if (completion != NULL) {
+ gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+ }
+
+ item = gtk_tool_item_new();
+ if (item == NULL) {
+ return NULL;
+ }
+
+ gtk_container_add(GTK_CONTAINER(item), entry);
+ gtk_tool_item_set_expand(item, TRUE);
+
}
+ gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
return item;
}
@@ -623,37 +331,104 @@ make_toolbar_item_websearch(bool sensitivity)
struct bitmap *bitmap;
GdkPixbuf *pixbuf = NULL;
- entry = nsgtk_entry_new();
- item = gtk_tool_item_new();
-
- if ((entry == NULL) || (item == NULL)) {
- return NULL;
- }
-
- gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
-
- gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
-
res = search_web_get_provider_bitmap(&bitmap);
if ((res == NSERROR_OK) && (bitmap != NULL)) {
pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
16, 16);
}
+ entry = nsgtk_entry_new();
+
+ if (entry == NULL) {
+ return NULL;
+ }
+
if (pixbuf != NULL) {
nsgtk_entry_set_icon_from_pixbuf(entry,
GTK_ENTRY_ICON_PRIMARY,
pixbuf);
} else {
- nsgtk_entry_set_icon_from_stock(entry,
- GTK_ENTRY_ICON_PRIMARY,
- NSGTK_STOCK_INFO);
+ nsgtk_entry_set_icon_from_icon_name(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NSGTK_STOCK_INFO);
}
- gtk_container_add(GTK_CONTAINER(item), entry);
+ if (edit_mode) {
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
+
+ item = gtk_tool_button_new(NULL, "Web Search");
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item),
+ entry);
+ } else {
+ gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+
+ item = gtk_tool_item_new();
+ if (item == NULL) {
+ return NULL;
+ }
+
+ gtk_container_add(GTK_CONTAINER(item), entry);
+ }
+ gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
+
+ return item;
+}
+
+
+/**
+ * create local history toolbar item widget
+ */
+static GtkToolItem *
+make_toolbar_item_history(bool sensitivity)
+{
+ GtkToolItem *item;
+ const char *msg = "H";
+ char *label = NULL;
if (edit_mode) {
- gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+ msg = messages_get("gtkLocalHistory");
+ }
+ label = remove_underscores(msg, false);
+ item = gtk_tool_button_new(NULL, label);
+ if (label != NULL) {
+ free(label);
+ }
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "local-history");
+
+ /* set history widget minimum width */
+ gtk_widget_set_size_request(GTK_WIDGET(item), 20, -1);
+ gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
+ return item;
+}
+
+
+/**
+ * create generic button toolbar item widget
+ */
+static GtkToolItem *
+make_toolbar_item_button(const char *labelmsg,
+ const char *iconname,
+ bool sensitivity)
+{
+ GtkToolItem *item;
+ char *label = NULL;
+
+ label = remove_underscores(messages_get(labelmsg), false);
+
+ item = gtk_tool_button_new(NULL, label);
+ if (label != NULL) {
+ free(label);
+ }
+
+ if (item != NULL) {
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), iconname);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+ if (edit_mode) {
+ nsgtk_widget_set_margins(GTK_WIDGET(item), 0, 0);
+ }
}
return item;
@@ -669,104 +444,48 @@ make_toolbar_item_websearch(bool sensitivity)
*/
static GtkToolItem *
make_toolbar_item(nsgtk_toolbar_button itemid,
- struct nsgtk_theme *theme,
bool sensitivity)
{
- GtkToolItem *w = NULL;
+ GtkToolItem *toolitem = NULL;
switch(itemid) {
+#define TOOLBAR_ITEM_y(identifier, label, iconame)
+#define TOOLBAR_ITEM_n(identifier, label, iconame)
+#define TOOLBAR_ITEM_b(identifier, label, iconame) \
+ case identifier: \
+ toolitem = make_toolbar_item_button(#label, iconame,
sensitivity);\
+ break;
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
+ TOOLBAR_ITEM_ ## clicked(identifier, label, iconame)
-/* gtk_tool_button_new accepts NULL args */
-#define MAKE_ITEM(p, q)
\
- case p##_BUTTON: { \
- char *label = NULL; \
- label = remove_underscores(messages_get(#q), false); \
- w = gtk_tool_button_new(GTK_WIDGET(theme->image[p##_BUTTON]), \
- label); \
- gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity); \
- if (label != NULL) { \
- free(label); \
- } \
- break; \
- }
-
- MAKE_ITEM(HOME, gtkHome)
- MAKE_ITEM(BACK, gtkBack)
- MAKE_ITEM(FORWARD, gtkForward)
- MAKE_ITEM(STOP, Stop)
- MAKE_ITEM(RELOAD, Reload)
- MAKE_ITEM(NEWWINDOW, gtkNewWindow)
- MAKE_ITEM(NEWTAB, gtkNewTab)
- MAKE_ITEM(OPENFILE, gtkOpenFile)
- MAKE_ITEM(CLOSETAB, gtkCloseTab)
- MAKE_ITEM(CLOSEWINDOW, gtkCloseWindow)
- MAKE_ITEM(SAVEPAGE, gtkSavePage)
- MAKE_ITEM(PRINTPREVIEW, gtkPrintPreview)
- MAKE_ITEM(PRINT, gtkPrint)
- MAKE_ITEM(QUIT, gtkQuitMenu)
- MAKE_ITEM(CUT, gtkCut)
- MAKE_ITEM(COPY, gtkCopy)
- MAKE_ITEM(PASTE, gtkPaste)
- MAKE_ITEM(DELETE, gtkDelete)
- MAKE_ITEM(SELECTALL, gtkSelectAll)
- MAKE_ITEM(PREFERENCES, gtkPreferences)
- MAKE_ITEM(ZOOMPLUS, gtkZoomPlus)
- MAKE_ITEM(ZOOMMINUS, gtkZoomMinus)
- MAKE_ITEM(ZOOMNORMAL, gtkZoomNormal)
- MAKE_ITEM(FULLSCREEN, gtkFullScreen)
- MAKE_ITEM(VIEWSOURCE, gtkViewSource)
- MAKE_ITEM(CONTENTS, gtkContents)
- MAKE_ITEM(ABOUT, gtkAbout)
- MAKE_ITEM(PDF, gtkPDF)
- MAKE_ITEM(PLAINTEXT, gtkPlainText)
- MAKE_ITEM(DRAWFILE, gtkDrawFile)
- MAKE_ITEM(POSTSCRIPT, gtkPostScript)
- MAKE_ITEM(FIND, gtkFind)
- MAKE_ITEM(DOWNLOADS, gtkDownloads)
- MAKE_ITEM(SAVEWINDOWSIZE, gtkSaveWindowSize)
- MAKE_ITEM(TOGGLEDEBUGGING, gtkToggleDebugging)
- MAKE_ITEM(SAVEBOXTREE, gtkDebugBoxTree)
- MAKE_ITEM(SAVEDOMTREE, gtkDebugDomTree)
- MAKE_ITEM(LOCALHISTORY, gtkLocalHistory)
- MAKE_ITEM(GLOBALHISTORY, gtkGlobalHistory)
- MAKE_ITEM(ADDBOOKMARKS, gtkAddBookMarks)
- MAKE_ITEM(SHOWBOOKMARKS, gtkShowBookMarks)
- MAKE_ITEM(SHOWCOOKIES, gtkShowCookies)
- MAKE_ITEM(OPENLOCATION, gtkOpenLocation)
- MAKE_ITEM(NEXTTAB, gtkNextTab)
- MAKE_ITEM(PREVTAB, gtkPrevTab)
- MAKE_ITEM(GUIDE, gtkGuide)
- MAKE_ITEM(INFO, gtkUserInformation)
- MAKE_ITEM(OPENMENU, gtkOpenMenu)
-
-#undef MAKE_ITEM
+#include "gtk/toolbar_items.h"
+
+#undef TOOLBAR_ITEM_b
+#undef TOOLBAR_ITEM_n
+#undef TOOLBAR_ITEM_y
+#undef TOOLBAR_ITEM
case HISTORY_BUTTON:
- w = gtk_tool_button_new(GTK_WIDGET(
- theme->image[HISTORY_BUTTON]), "H");
- /* set history widget minimum width */
- gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
- gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);
+ toolitem = make_toolbar_item_history(sensitivity);
break;
case URL_BAR_ITEM:
- w = make_toolbar_item_url_bar(sensitivity);
+ toolitem = make_toolbar_item_url_bar(sensitivity);
break;
case THROBBER_ITEM:
- w = make_toolbar_item_throbber(sensitivity);
+ toolitem = make_toolbar_item_throbber(sensitivity);
break;
case WEBSEARCH_ITEM:
- w = make_toolbar_item_websearch(sensitivity);
+ toolitem = make_toolbar_item_websearch(sensitivity);
break;
default:
break;
}
-
- return w;
+ return toolitem;
}
/**
@@ -957,7 +676,6 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
struct nsgtk_toolbar_customisation *tbc;
tbc = (struct nsgtk_toolbar_customisation *)data;
gint position; /* drop position in toolbar */
- struct nsgtk_theme *theme;
int location;
int itemid;
struct nsgtk_toolbar_item *dragitem; /* toolbar item being dragged */
@@ -993,18 +711,12 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
GTK_WIDGET(dragitem->button));
}
- /* add dropped item into toolbar */
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
- if (theme == NULL) {
- nsgtk_warning(messages_get("NoMemory"), 0);
- return TRUE;
- }
edit_mode = true;
- dragitem->button = make_toolbar_item(tbc->dragitem, theme, true);
+ dragitem->button = make_toolbar_item(tbc->dragitem,
+ tbc->toolbar.items[tbc->dragitem].sensitivity);
edit_mode = false;
- free(theme);
if (dragitem->button == NULL) {
nsgtk_warning("NoMemory", 0);
return TRUE;
@@ -1134,23 +846,6 @@ nsgtk_browser_window_create(struct browser_window *bw,
bool intab)
}
-/**
- * \return toolbar item id when a widget is an element of the scaffolding
- * else -1
- */
-int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
-{
- int i;
- for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
- if ((nsgtk_scaffolding_button(g, i)->location != -1)
- && (widget == GTK_WIDGET(
- nsgtk_scaffolding_button(g, i)->button))) {
- return i;
- }
- }
- return -1;
-}
/**
@@ -1228,9 +923,7 @@ apply_user_button_customisation(struct nsgtk_toolbar *tb)
* \return NSERROR_OK on success else error code.
*/
static nserror
-add_item_to_toolbar(struct nsgtk_toolbar *tb,
- struct nsgtk_theme *theme,
- int location)
+add_item_to_toolbar(struct nsgtk_toolbar *tb, int location)
{
int bidx; /* button index */
@@ -1239,7 +932,7 @@ add_item_to_toolbar(struct nsgtk_toolbar *tb,
if (tb->items[bidx].location == location) {
tb->items[bidx].button = make_toolbar_item(
- bidx, theme, tb->items[bidx].sensitivity);
+ bidx, tb->items[bidx].sensitivity);
gtk_toolbar_insert(tb->widget,
tb->items[bidx].button,
@@ -1266,14 +959,8 @@ static void container_remove_widget(GtkWidget *widget,
gpointer data)
*/
static nserror populate_gtk_toolbar_widget(struct nsgtk_toolbar *tb)
{
- struct nsgtk_theme *theme; /* internal theme context */
int lidx; /* location index */
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
- if (theme == NULL) {
- return NSERROR_NOMEM;
- }
-
/* clear the toolbar container of all widgets */
gtk_container_foreach(GTK_CONTAINER(tb->widget),
container_remove_widget,
@@ -1281,11 +968,10 @@ static nserror populate_gtk_toolbar_widget(struct
nsgtk_toolbar *tb)
/* add widgets to toolbar */
for (lidx = 0; lidx < PLACEHOLDER_BUTTON; lidx++) {
- add_item_to_toolbar(tb, theme, lidx);
+ add_item_to_toolbar(tb, lidx);
}
gtk_widget_show_all(GTK_WIDGET(tb->widget));
- free(theme);
return NSERROR_OK;
}
@@ -1490,7 +1176,6 @@ item_size_allocate_cb(GtkWidget *widget,
if (alloc->height > NSGTK_BUTTON_HEIGHT) {
alloc->height = NSGTK_BUTTON_HEIGHT;
}
- //NSLOG(netsurf, ERROR, "w:%d h:%d", alloc->width, alloc->height);
gtk_widget_set_allocation(widget, alloc);
}
@@ -1542,7 +1227,7 @@ add_toolbox_row(struct nsgtk_toolbar_customisation *tbc,
"size-allocate",
G_CALLBACK(item_size_allocate_cb),
NULL);
- gtk_toolbar_insert(rowbar, tbc->items[iidx], iidx - startitem);
+ gtk_toolbar_insert(rowbar, tbc->items[iidx], -1);
}
return NSERROR_OK;
}
@@ -1563,17 +1248,11 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
int curcol; /* current column in creation */
int iidx; /* item index */
int startidx; /* index of item at start of row */
- struct nsgtk_theme *theme;
-
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, true);
- if (theme == NULL) {
- return NSERROR_NOMEM;
- }
/* ensure there are a minimum number of items per row */
columns = width / NSGTK_BUTTON_WIDTH;
- if (columns < NSGTK_STORE_WIDTH) {
- columns = NSGTK_STORE_WIDTH;
+ if (columns < NSGTK_MIN_STORE_COLUMNS) {
+ columns = NSGTK_MIN_STORE_COLUMNS;
}
edit_mode = true;
@@ -1584,7 +1263,8 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
curcol = 0;
startidx = iidx;
}
- tbc->items[iidx] = make_toolbar_item(iidx, theme, true);
+ tbc->items[iidx] = make_toolbar_item(iidx,
+ tbc->toolbar.items[iidx].sensitivity);
if (tbc->items[iidx] != NULL) {
curcol++;
}
@@ -1594,8 +1274,6 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
}
edit_mode = false;
- free(theme);
-
return NSERROR_OK;
}
@@ -1615,10 +1293,12 @@ customisation_toolbar_update(struct
nsgtk_toolbar_customisation *tbc)
}
/* populate toolbar widget */
+ edit_mode = true;
res = populate_gtk_toolbar_widget(&tbc->toolbar);
if (res != NSERROR_OK) {
return res;
}
+ edit_mode = false;
/* ensure icon sizes and text labels on toolbar are set */
res = nsgtk_toolbar_restyle(&tbc->toolbar);
@@ -1757,7 +1437,11 @@ static gboolean cutomize_button_clicked_cb(GtkWidget
*widget, gpointer data)
if (res != NSERROR_OK) {
goto cutomize_button_clicked_cb_error;
}
- tbc->toolbar.items[iidx].sensitivity = true;
+ if ((iidx == URL_BAR_ITEM) || (iidx == WEBSEARCH_ITEM)) {
+ tbc->toolbar.items[iidx].sensitivity = false;
+ } else {
+ tbc->toolbar.items[iidx].sensitivity = true;
+ }
}
res = customisation_toolbar_update(tbc);
@@ -3240,6 +2924,42 @@ static gboolean openmenu_button_clicked_cb(GtkWidget
*widget, gpointer data)
}
+/* define data plus and data minus handlers */
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
+static gboolean
\
+nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
+ GdkDragContext *cont, \
+ GtkSelectionData *selection, \
+ guint info, \
+ guint time, \
+ gpointer data) \
+{ \
+ struct nsgtk_toolbar_customisation *tbc; \
+ tbc = (struct nsgtk_toolbar_customisation *)data; \
+ tbc->dragitem = identifier; \
+ tbc->dragfrom = true; \
+ return TRUE; \
+} \
+static gboolean
\
+nsgtk_toolbar_##name##_data_minus(GtkWidget *widget, \
+ GdkDragContext *cont, \
+ GtkSelectionData *selection, \
+ guint info, \
+ guint time, \
+ gpointer data) \
+{ \
+ struct nsgtk_toolbar_customisation *tbc; \
+ tbc = (struct nsgtk_toolbar_customisation *)data; \
+ tbc->dragitem = identifier; \
+ tbc->dragfrom = false; \
+ return TRUE; \
+}
+
+#include "gtk/toolbar_items.h"
+
+#undef TOOLBAR_ITEM
+
+
/**
* create a toolbar item
*
@@ -3252,11 +2972,13 @@ toolbar_item_create(nsgtk_toolbar_button id, struct
nsgtk_toolbar_item *item)
/* set item defaults from macro */
switch (id) {
-#define TOOLBAR_ITEM_y(name) \
+#define TOOLBAR_ITEM_b(name) \
+ item->bhandler = name##_button_clicked_cb;
+#define TOOLBAR_ITEM_y(name) \
item->bhandler = name##_button_clicked_cb;
-#define TOOLBAR_ITEM_n(name) \
+#define TOOLBAR_ITEM_n(name) \
item->bhandler = NULL;
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
case identifier: \
item->sensitivity = snstvty; \
item->dataplus = nsgtk_toolbar_##name##_data_plus; \
@@ -3617,7 +3339,6 @@ nserror nsgtk_toolbar_set_url(struct nsgtk_toolbar *tb,
nsurl *url)
}
gtk_entry_set_text(url_entry, url_text);
- //gtk_editable_set_position(GTK_EDITABLE(url_entry), -1);
if (idn_url_s != NULL) {
free(idn_url_s);
@@ -3645,9 +3366,9 @@ nsgtk_toolbar_set_websearch_image(struct nsgtk_toolbar
*tb, GdkPixbuf *pixbuf)
GTK_ENTRY_ICON_PRIMARY,
pixbuf);
} else {
- nsgtk_entry_set_icon_from_stock(entry,
- GTK_ENTRY_ICON_PRIMARY,
- NSGTK_STOCK_INFO);
+ nsgtk_entry_set_icon_from_icon_name(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NSGTK_STOCK_INFO);
}
return NSERROR_OK;
diff --git a/frontends/gtk/toolbar.h b/frontends/gtk/toolbar.h
index b699898..e895d0b 100644
--- a/frontends/gtk/toolbar.h
+++ b/frontends/gtk/toolbar.h
@@ -43,6 +43,7 @@ nserror nsgtk_toolbar_create(GtkBuilder *builder, struct
browser_window *(*get_b
*/
nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
+
/**
* Update the toolbar items being shown based on current settings
*
@@ -51,6 +52,7 @@ nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
*/
nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb);
+
/**
* Update toolbar style and size based on current settings
*
@@ -111,10 +113,6 @@ nserror nsgtk_toolbar_item_activate(struct nsgtk_toolbar
*tb, nsgtk_toolbar_butt
*/
nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool show);
-/**
- * sets up the images for scaffolding.
- */
-void nsgtk_theme_implement(struct nsgtk_scaffolding *g);
/**
* Initialise customization of toolbar entries
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 661cbef..7a35112 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -80,72 +80,75 @@ typedef enum {
/*
* Item fields are:
- * identifier enum
- * name
- * initial sensitivity
- * y/n - if there is a toolbar click signal handler
- * y/n/p - if there is a menu activate signal handler and if it calls the
- * toolbar click handler.
+ * - item identifier (enum value)
+ * - name (identifier)
+ * - initial sensitivity (true/false)
+ * - if there is a toolbar click signal handler (y/n) and it is available in
+ * the toolbar as a button (b, implies y)
+ * - if there is a menu activate signal handler (y/n) and it calls the
+ toolbar click handler directly. (p, implies y)
+ * - item label as a netsurf message (identifier)
+ * - icon image name ("string")
*/
#ifndef TOOLBAR_ITEM
-#define TOOLBAR_ITEM(a, b, c, d, e)
+#define TOOLBAR_ITEM(a, b, c, d, e, f, g)
#define TOOLBAR_ITEM_SET
#endif
-TOOLBAR_ITEM(BACK_BUTTON, back, false, y, p)
-TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n)
-TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, y, p)
-TOOLBAR_ITEM(STOP_BUTTON, stop, false, y, p)
-TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, y, p)
-TOOLBAR_ITEM(HOME_BUTTON, home, true, y, p)
-TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n)
-TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n)
-TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n)
-TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, y, p)
-TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, y, p)
-TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, y, p)
-TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, y)
-TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, p)
-TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, y, p)
-TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, p)
-TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, y, p)
-TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n)
-TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n)
-TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, p)
-TOOLBAR_ITEM(PRINT_BUTTON, print, true, y, p)
-TOOLBAR_ITEM(QUIT_BUTTON, quit, true, y, p)
-TOOLBAR_ITEM(CUT_BUTTON, cut, true, y, p)
-TOOLBAR_ITEM(COPY_BUTTON, copy, true, y, p)
-TOOLBAR_ITEM(PASTE_BUTTON, paste, true, y, p)
-TOOLBAR_ITEM(DELETE_BUTTON, delete, false, y, p)
-TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, y, p)
-TOOLBAR_ITEM(FIND_BUTTON, find, true, n, y)
-TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, y, p)
-TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, y, p)
-TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, y, p)
-TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, y, p)
-TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, y, p)
-TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, y, p)
-TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, y, p)
-TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, p)
-TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, p)
-TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, p)
-TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, p)
-TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, p)
-TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, p)
-TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, p)
-TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, y, p)
-TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, p)
-TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, p)
-TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y)
-TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y)
-TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, p)
-TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p)
-TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p)
-TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, p)
-TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n)
-TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p)
+TOOLBAR_ITEM(BACK_BUTTON, back, false, b, p, gtkBack, "go-previous")
+TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n, , "local-history")
+TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, b, p, gtkForward, "go-next")
+TOOLBAR_ITEM(STOP_BUTTON, stop, false, b, p, gtkStop, NSGTK_STOCK_STOP)
+TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, b, p, Reload, NSGTK_STOCK_REFRESH)
+TOOLBAR_ITEM(HOME_BUTTON, home, true, b, p, gtkHome, NSGTK_STOCK_HOME)
+TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n, , NULL)
+TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n, , NULL)
+TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n, , NULL)
+TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, b, p, gtkNewWindow,
"document-new")
+TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, b, p, gtkNewTab, NSGTK_STOCK_ADD)
+TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, b, p, gtkOpenFile,
"document-open")
+TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, y, , "window-close")
+TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, p, , "window-close")
+TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, b, p, gtkSavePage, "text-html")
+TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, p, , "x-office-document")
+TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, b, p, gtkPlainText,
"text-x-generic")
+TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n, , NULL)
+TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n, , NULL)
+TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, p, gtkPrintPreview,
"gtk-print-preview")
+TOOLBAR_ITEM(PRINT_BUTTON, print, true, b, p, gtkPrint, "document-print")
+TOOLBAR_ITEM(QUIT_BUTTON, quit, true, b, p, gtkQuitMenu, "application-exit")
+TOOLBAR_ITEM(CUT_BUTTON, cut, true, b, p, gtkCut, "edit-cut")
+TOOLBAR_ITEM(COPY_BUTTON, copy, true, b, p, gtkCopy, "edit-copy")
+TOOLBAR_ITEM(PASTE_BUTTON, paste, true, b, p, gtkPaste, "edit-paste")
+TOOLBAR_ITEM(DELETE_BUTTON, delete, false, b, p, gtkDelete, "edit-delete")
+TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, b, p, gtkSelectAll,
"edit-select-all")
+TOOLBAR_ITEM(FIND_BUTTON, find, true, n, y, gtkFind, "edit-find")
+TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, b, p, gtkPreferences,
"preferences-system")
+TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, b, p, gtkZoomPlus, "gtk-zoom-in")
+TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, b, p, gtkZoomMinus,
"gtk-zoom-out")
+TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, b, p, gtkZoomNormal,
"gtk-zoom-100")
+TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, b, p, gtkFullScreen,
"gtk-fullscreen")
+TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, b, p, gtkPageSource,
"gtk-index")
+TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, b, p, gtkDownloads,
NSGTK_STOCK_SAVE_AS)
+TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, p,
gtkSaveWindowSize, NULL)
+TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, p,
gtkToggleDebugging, NULL)
+TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, p, gtkDebugBoxTree,
NULL)
+TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, p, gtkDebugDomTree,
NULL)
+TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, p, , NULL)
+TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, p,
gtkGlobalHistory, NULL)
+TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, p, gtkAddBookMarks,
NULL)
+TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, b, p,
gtkShowBookMarks, "user-bookmarks")
+TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, p, gtkShowCookies, NULL)
+TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, p, gtkOpenLocation,
NULL)
+TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y, gtkNextTab,
"media-skip-forward")
+TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y, gtkPrevTab,
"media-skip-backward")
+TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, p, gtkContents, "gtk-help")
+TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p, gtkGuide, "gtk-help")
+TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p, gtkUserInformation,
"dialog-information")
+TOOLBAR_ITEM(ABOUT_BUTTON, about, true, b, p, gtkAbout, "help-about")
+TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, b, n, gtkOpenMenu,
NSGTK_STOCK_OPEN_MENU)
+TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p, , NULL)
#ifdef TOOLBAR_ITEM_SET
#undef TOOLBAR_ITEM
diff --git a/resources/FatMessages b/resources/FatMessages
index d42a4de..ee56dee 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -2906,6 +2906,8 @@ nl.gtk.gtkUnknownSize:onbekend
# gtk Menu / Button labels
#
+en.gtk.gtkOpenMenu:Open Menu
+
en.gtk.gtkFile:_File
de.gtk.gtkFile:_Datei
fr.gtk.gtkFile:_Fichier
@@ -3150,6 +3152,7 @@ fr.gtk.gtkDebugDomTree:Déboguer arbre _DOM
it.gtk.gtkDebugDomTree:Debug albero _DOM
nl.gtk.gtkDebugDomTree:_DOM-boom debuggen
+en.gtk.gtkStop:Stop
en.gtk.gtkBack:_Back
de.gtk.gtkBack:_Zurück
fr.gtk.gtkBack:_Précédent
diff --git a/resources/icons/local-history.png
b/resources/icons/local-history.png
new file mode 100644
index 0000000..475b4ff
Binary files /dev/null and b/resources/icons/local-history.png differ
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/compat.c | 12 +-
frontends/gtk/compat.h | 8 +-
frontends/gtk/gui.c | 37 +-
frontends/gtk/gui.h | 3 -
frontends/gtk/res/netsurf.gresource.xml | 3 +-
frontends/gtk/resources.c | 3 +-
frontends/gtk/scaffolding.c | 54 +-
frontends/gtk/tabs.c | 2 +-
frontends/gtk/toolbar.c | 703 ++++++--------------
frontends/gtk/toolbar.h | 6 +-
frontends/gtk/toolbar_items.h | 123 ++--
resources/FatMessages | 3 +
.../icons/local-history.png | Bin 206 -> 206 bytes
resources/icons/show-cookie.png | Bin 0 -> 303 bytes
14 files changed, 368 insertions(+), 589 deletions(-)
rename frontends/gtk/res/arrow_down_8x32.png =>
resources/icons/local-history.png (100%)
create mode 100644 resources/icons/show-cookie.png
diff --git a/frontends/gtk/compat.c b/frontends/gtk/compat.c
index a75fdaf..a8321d6 100644
--- a/frontends/gtk/compat.c
+++ b/frontends/gtk/compat.c
@@ -170,18 +170,18 @@ void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry,
/* exported interface documented in gtk/compat.h */
-void nsgtk_entry_set_icon_from_stock(GtkWidget *entry,
- GtkEntryIconPosition icon_pos,
- const gchar *id)
+void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry,
+ GtkEntryIconPosition icon_pos,
+ const gchar *id)
{
#ifdef NSGTK_USE_ICON_NAME
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
#else
#if GTK_CHECK_VERSION(2,16,0)
- gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, id);
+ gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
#else
- GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(id,
- GTK_ICON_SIZE_LARGE_TOOLBAR));
+ GtkImage *image;
+ image = GTK_IMAGE(gtk_image_new_from_stock(id,
GTK_ICON_SIZE_LARGE_TOOLBAR));
if (image != NULL) {
sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry),
diff --git a/frontends/gtk/compat.h b/frontends/gtk/compat.h
index feb0abe..8ef2ed5 100644
--- a/frontends/gtk/compat.h
+++ b/frontends/gtk/compat.h
@@ -178,16 +178,16 @@ enum {
/**
- * Sets the icon shown in the entry at the specified position from a
- * stock image.
+ * Sets the icon shown in the entry at the specified position from an
+ * icon name.
*
- * Compatability interface for original deprecated in GTK 3.10
+ * Compatability interface for original introduced in 2.16
*
* \param entry The entry widget to set the icon on.
* \param icon_pos The position of the icon.
* \param stock_id the name of the stock item.
*/
-void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition
icon_pos, const gchar *stock_id);
+void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry,
GtkEntryIconPosition icon_pos, const gchar *stock_id);
/**
* Creates a GtkImage displaying a stock icon.
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index d033a57..205c548 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,33 @@ 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);
+
+ res = nsgdk_pixbuf_new_from_resname("icons/show-cookie.png", &pixbuf);
+ if (res != NSERROR_OK) {
+ pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 24, 24);
+ }
+ gtk_icon_theme_add_builtin_icon("show-cookie", 24, pixbuf);
+
+#endif
+ return NSERROR_OK;
+}
/**
@@ -313,12 +339,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 */
diff --git a/frontends/gtk/gui.h b/frontends/gtk/gui.h
index 53e7324..ee82e7a 100644
--- a/frontends/gtk/gui.h
+++ b/frontends/gtk/gui.h
@@ -27,9 +27,6 @@ extern char *nsgtk_config_home;
/** favicon default pixbuf */
extern GdkPixbuf *favicon_pixbuf;
-/** arrow down pixbuf */
-extern GdkPixbuf *arrow_down_pixbuf;
-
/** resource search path vector */
extern char **respaths;
diff --git a/frontends/gtk/res/netsurf.gresource.xml
b/frontends/gtk/res/netsurf.gresource.xml
index c170df2..d9aa921 100644
--- a/frontends/gtk/res/netsurf.gresource.xml
+++ b/frontends/gtk/res/netsurf.gresource.xml
@@ -57,7 +57,8 @@
<file>quirks.css</file>
<file>netsurf.png</file>
<file>default.ico</file>
- <file>arrow_down_8x32.png</file>
+ <file>icons/show-cookie.png</file>
+ <file>icons/local-history.png</file>
<file>icons/arrow-l.png</file>
<file>icons/content.png</file>
<file>icons/directory2.png</file>
diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c
index 7aea43c..f48ddb4 100644
--- a/frontends/gtk/resources.c
+++ b/frontends/gtk/resources.c
@@ -95,7 +95,8 @@ static struct nsgtk_resource_s pixbuf_resource[] = {
RES_ENTRY("favicon.png"),
RES_ENTRY("netsurf.xpm"),
RES_ENTRY("menu_cursor.png"),
- RES_ENTRY("arrow_down_8x32.png"),
+ RES_ENTRY("icons/local-history.png"),
+ RES_ENTRY("icons/show-cookie.png"),
RES_ENTRY("throbber/throbber0.png"),
RES_ENTRY("throbber/throbber1.png"),
RES_ENTRY("throbber/throbber2.png"),
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 6ace032..f0b4f9b 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -53,6 +53,7 @@ struct nsgtk_menu {
GtkWidget *burger; /* right click menu */
GtkWidget *popup; /* popup menu entry */
void *mhandler; /* menu item handler */
+ const char *iconname; /* name of the icon to use */
bool sensitivity; /* menu item is sensitive */
};
@@ -463,7 +464,7 @@ nsgtk_on_##name##_activate_menu(GtkMenuItem *widget,
gpointer data) \
}
#define TOOLBAR_ITEM_y(identifier, name)
#define TOOLBAR_ITEM_n(identifier, name)
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate, label,
iconame) \
TOOLBAR_ITEM_ ## activate(identifier, name)
#include "gtk/toolbar_items.h"
#undef TOOLBAR_ITEM_y
@@ -888,15 +889,18 @@ create_scaffolding_link_menu(struct nsgtk_scaffolding *g,
GtkAccelGroup *group)
*/
static nserror nsgtk_menu_initialise(struct nsgtk_scaffolding *g)
{
-#define TOOLBAR_ITEM_p(identifier, name) \
- g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu;
-#define TOOLBAR_ITEM_y(identifier, name) \
- g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu;
-#define TOOLBAR_ITEM_n(identifier, name) \
- g->menus[identifier].mhandler = NULL;
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM_p(identifier, name, iconame)
\
+ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM_y(identifier, name, iconame) \
+ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM_n(identifier, name, iconame) \
+ g->menus[identifier].mhandler = NULL; \
+ g->menus[identifier].iconname = iconame;
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
g->menus[identifier].sensitivity = snstvty; \
- TOOLBAR_ITEM_ ## activate(identifier, name)
+ TOOLBAR_ITEM_ ## activate(identifier, name, iconame)
#include "gtk/toolbar_items.h"
#undef TOOLBAR_ITEM_y
#undef TOOLBAR_ITEM_n
@@ -1015,6 +1019,34 @@ static void nsgtk_menu_set_sensitivity(struct
nsgtk_scaffolding *g)
}
}
+/* set menu items to have icons */
+static void nsgtk_menu_set_icons(struct nsgtk_scaffolding *g)
+{
+ GtkWidget *img;
+ for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
+ /* ensure there is an icon name */
+ if (g->menus[i].iconname == NULL) {
+ continue;
+ }
+
+ if (g->menus[i].main != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].main), img);
+ }
+ if (g->menus[i].burger != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].burger), img);
+ }
+ if (g->menus[i].popup != NULL) {
+ img = gtk_image_new_from_icon_name(g->menus[i].iconname,
+ GTK_ICON_SIZE_MENU);
+
nsgtk_image_menu_item_set_image(GTK_WIDGET(g->menus[i].popup), img);
+ }
+ }
+}
+
/**
* create and initialise menus
*
@@ -1069,6 +1101,7 @@ static nserror nsgtk_menus_create(struct
nsgtk_scaffolding *gs)
/* set up the menu signal handlers */
nsgtk_menu_initialise(gs);
+ nsgtk_menu_set_icons(gs);
nsgtk_menu_connect_signals(gs);
nsgtk_menu_set_sensitivity(gs);
@@ -1579,9 +1612,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct
gui_window *toplevel)
gs->prev = NULL;
scaf_list = gs;
- /* set icon images */
- nsgtk_theme_implement(gs);
-
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(gs->window));
diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c
index b9e6dad..04e90b9 100644
--- a/frontends/gtk/tabs.c
+++ b/frontends/gtk/tabs.c
@@ -286,7 +286,7 @@ nsgtk_tab_add_newtab(GtkNotebook *notebook)
tablabel = nsgtk_hbox_new(FALSE, 1);
tabcontents = nsgtk_hbox_new(FALSE, 1);
- add = nsgtk_image_new_from_stock(NSGTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+ add = gtk_image_new_from_icon_name(NSGTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
gtk_box_pack_start(GTK_BOX(tablabel), add, FALSE, FALSE, 0);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 85c32e3..f7a18e7 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -82,6 +82,27 @@
#define THROBBER_FRAME_TIME (100)
/**
+ * the minimum number of columns in the tool store
+ */
+#define NSGTK_MIN_STORE_COLUMNS 4
+
+/**
+ * the 'standard' width of a button that makes sufficient of its label visible
+ */
+#define NSGTK_BUTTON_WIDTH 120
+
+/**
+ * the 'standard' height of a button that fits as many toolbars as
+ * possible into the store
+ */
+#define NSGTK_BUTTON_HEIGHT 70
+
+/**
+ * the 'normal' width of the websearch bar
+ */
+#define NSGTK_WEBSEARCH_WIDTH 150
+
+/**
* toolbar item context
*/
struct nsgtk_toolbar_item {
@@ -137,6 +158,7 @@ struct nsgtk_toolbar {
void *get_ctx;
};
+
/**
* toolbar cusomisation context
*/
@@ -176,336 +198,9 @@ struct nsgtk_toolbar_customisation {
static bool edit_mode = false;
-/* the number of items that fit in the width of the store window */
-#define NSGTK_STORE_WIDTH 6
-
-/* the 'standard' width of a button that makes sufficient of its label
-visible */
-#define NSGTK_BUTTON_WIDTH 120
-
-/* the 'standard' height of a button that fits as many toolbars as
-possible into the store */
-#define NSGTK_BUTTON_HEIGHT 70
-
-/* the 'normal' width of the websearch bar */
-#define NSGTK_WEBSEARCH_WIDTH 150
-
-
-enum image_sets {
- IMAGE_SET_MAIN_MENU = 0,
- IMAGE_SET_RCLICK_MENU,
- IMAGE_SET_POPUP_MENU,
- IMAGE_SET_BUTTONS,
- IMAGE_SET_COUNT
-};
-
-typedef enum search_buttons {
- SEARCH_BACK_BUTTON = 0,
- SEARCH_FORWARD_BUTTON,
- SEARCH_CLOSE_BUTTON,
- SEARCH_BUTTONS_COUNT
-} nsgtk_search_buttons;
-
-struct nsgtk_theme {
- GtkImage *image[PLACEHOLDER_BUTTON];
- GtkImage *searchimage[SEARCH_BUTTONS_COUNT];
-};
-
/* forward declaration */
-int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct
nsgtk_scaffolding *g);
-static nserror toolbar_item_create(nsgtk_toolbar_button id, struct
nsgtk_toolbar_item *item_out);
-
-
-/* define data plus and data minus handlers */
-#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate) \
-static gboolean
\
-nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
- GdkDragContext *cont, \
- GtkSelectionData *selection, \
- guint info, \
- guint time, \
- gpointer data) \
-{ \
- struct nsgtk_toolbar_customisation *tbc; \
- tbc = (struct nsgtk_toolbar_customisation *)data; \
- tbc->dragitem = identifier; \
- tbc->dragfrom = true; \
- return TRUE; \
-} \
-static gboolean
\
-nsgtk_toolbar_##name##_data_minus(GtkWidget *widget, \
- GdkDragContext *cont, \
- GtkSelectionData *selection, \
- guint info, \
- guint time, \
- gpointer data) \
-{ \
- struct nsgtk_toolbar_customisation *tbc; \
- tbc = (struct nsgtk_toolbar_customisation *)data; \
- tbc->dragitem = identifier; \
- tbc->dragfrom = false; \
- return TRUE; \
-}
-
-#include "gtk/toolbar_items.h"
-
-#undef TOOLBAR_ITEM
-
-
-
-/**
- * get default image for buttons / menu items from gtk stock items.
- *
- * \param tbbutton button reference
- * \param iconsize The size of icons to select.
- * \param usedef Use the default image if not found.
- * \return default images.
- */
-static GtkImage *
-nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
- GtkIconSize iconsize,
- bool usedef)
-{
- GtkImage *image; /* The GTK image to return */
-
- switch(tbbutton) {
-
-#define BUTTON_IMAGE(p, q) \
- case p##_BUTTON: \
- image = GTK_IMAGE(nsgtk_image_new_from_stock(q, iconsize)); \
- break
-
- BUTTON_IMAGE(BACK, NSGTK_STOCK_GO_BACK);
- BUTTON_IMAGE(FORWARD, NSGTK_STOCK_GO_FORWARD);
- BUTTON_IMAGE(STOP, NSGTK_STOCK_STOP);
- BUTTON_IMAGE(RELOAD, NSGTK_STOCK_REFRESH);
- BUTTON_IMAGE(HOME, NSGTK_STOCK_HOME);
- BUTTON_IMAGE(NEWWINDOW, "gtk-new");
- BUTTON_IMAGE(NEWTAB, "gtk-new");
- BUTTON_IMAGE(OPENFILE, NSGTK_STOCK_OPEN);
- BUTTON_IMAGE(CLOSETAB, NSGTK_STOCK_CLOSE);
- BUTTON_IMAGE(CLOSEWINDOW, NSGTK_STOCK_CLOSE);
- BUTTON_IMAGE(SAVEPAGE, NSGTK_STOCK_SAVE_AS);
- BUTTON_IMAGE(PRINTPREVIEW, "gtk-print-preview");
- BUTTON_IMAGE(PRINT, "gtk-print");
- BUTTON_IMAGE(QUIT, "gtk-quit");
- BUTTON_IMAGE(CUT, "gtk-cut");
- BUTTON_IMAGE(COPY, "gtk-copy");
- BUTTON_IMAGE(PASTE, "gtk-paste");
- BUTTON_IMAGE(DELETE, "gtk-delete");
- BUTTON_IMAGE(SELECTALL, "gtk-select-all");
- BUTTON_IMAGE(FIND, NSGTK_STOCK_FIND);
- BUTTON_IMAGE(PREFERENCES, "gtk-preferences");
- BUTTON_IMAGE(ZOOMPLUS, "gtk-zoom-in");
- BUTTON_IMAGE(ZOOMMINUS, "gtk-zoom-out");
- BUTTON_IMAGE(ZOOMNORMAL, "gtk-zoom-100");
- BUTTON_IMAGE(FULLSCREEN, "gtk-fullscreen");
- BUTTON_IMAGE(VIEWSOURCE, "gtk-index");
- BUTTON_IMAGE(CONTENTS, "gtk-help");
- BUTTON_IMAGE(ABOUT, "gtk-about");
- BUTTON_IMAGE(OPENMENU, NSGTK_STOCK_OPEN_MENU);
-#undef BUTTON_IMAGE
-
- case HISTORY_BUTTON:
- image = GTK_IMAGE(gtk_image_new_from_pixbuf(arrow_down_pixbuf));
- break;
-
- default:
- image = NULL;
- break;
-
- }
-
- if (usedef && (image == NULL)) {
- image =
GTK_IMAGE(nsgtk_image_new_from_stock("gtk-missing-image", iconsize));
- }
-
- return image;
-}
-
-
-/**
- * Get default image for search buttons / menu items from gtk stock items
- *
- * \param tbbutton search button reference
- * \param iconsize The size of icons to select.
- * \param usedef Use the default image if not found.
- * \return default search image.
- */
-static GtkImage *
-nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
- GtkIconSize iconsize,
- bool usedef)
-{
- GtkImage *image;
-
- switch (tbbutton) {
-
- case (SEARCH_BACK_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_GO_BACK, iconsize));
- break;
-
- case (SEARCH_FORWARD_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_GO_FORWARD, iconsize));
- break;
-
- case (SEARCH_CLOSE_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- NSGTK_STOCK_CLOSE, iconsize));
- break;
-
- default:
- image = NULL;
- }
-
- if (usedef && (image == NULL)) {
- image = GTK_IMAGE(nsgtk_image_new_from_stock(
- "gtk-missing-image", iconsize));
- }
-
- return image;
-}
-
-/**
- * initialise a theme structure with gtk images
- *
- * \param iconsize The size of icon to load
- * \param usedef use the default gtk icon if unset
- */
-static struct nsgtk_theme *nsgtk_theme_load(GtkIconSize iconsize, bool usedef)
-{
- struct nsgtk_theme *theme;
- int btnloop;
-
- theme = malloc(sizeof(struct nsgtk_theme));
- if (theme == NULL) {
- return NULL;
- }
-
- for (btnloop = BACK_BUTTON;
- btnloop < PLACEHOLDER_BUTTON ;
- btnloop++) {
- theme->image[btnloop] = nsgtk_theme_image_default(btnloop,
- iconsize,
- usedef);
- }
-
- for (btnloop = SEARCH_BACK_BUTTON;
- btnloop < SEARCH_BUTTONS_COUNT;
- btnloop++) {
- theme->searchimage[btnloop] =
- nsgtk_theme_searchimage_default(btnloop,
- iconsize,
- usedef);
- }
- return theme;
-}
-
-static struct nsgtk_toolbar_item *
-nsgtk_scaffolding_button(struct nsgtk_scaffolding *g, int i)
-{
- return NULL;
-}
-
-/* exported function documented in gtk/toolbar.h */
-void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
-{
- struct nsgtk_theme *theme[IMAGE_SET_COUNT];
- int i;
- struct nsgtk_toolbar_item *button;
- struct gtk_search *search;
-
- theme[IMAGE_SET_MAIN_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_RCLICK_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_POPUP_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU,
false);
- theme[IMAGE_SET_BUTTONS] =
nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-
- for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
- if ((i == URL_BAR_ITEM) || (i == THROBBER_ITEM) ||
- (i == WEBSEARCH_ITEM))
- continue;
-
- button = nsgtk_scaffolding_button(g, i);
- if (button == NULL)
- continue;
-
- #if 0
- /* gtk_image_menu_item_set_image accepts NULL image */
- if ((button->main != NULL) &&
- (theme[IMAGE_SET_MAIN_MENU] != NULL)) {
- nsgtk_image_menu_item_set_image(
- GTK_WIDGET(button->main),
-
GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->main));
- }
- if ((button->rclick != NULL) &&
- (theme[IMAGE_SET_RCLICK_MENU] != NULL)) {
-
nsgtk_image_menu_item_set_image(GTK_WIDGET(button->rclick),
- GTK_WIDGET(
-
theme[IMAGE_SET_RCLICK_MENU]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->rclick));
- }
- if ((button->popup != NULL) &&
- (theme[IMAGE_SET_POPUP_MENU] != NULL)) {
-
nsgtk_image_menu_item_set_image(GTK_WIDGET(button->popup),
- GTK_WIDGET(
-
theme[IMAGE_SET_POPUP_MENU]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->popup));
- }
- #endif
- if ((button->location != -1) &&
- (button->button != NULL) &&
- (theme[IMAGE_SET_BUTTONS] != NULL)) {
- gtk_tool_button_set_icon_widget(
- GTK_TOOL_BUTTON(button->button),
- GTK_WIDGET(
- theme[IMAGE_SET_BUTTONS]->
- image[i]));
- gtk_widget_show_all(GTK_WIDGET(button->button));
- }
- }
-
- /* set search bar images */
- search = nsgtk_scaffolding_search(g);
- if ((search != NULL) && (theme[IMAGE_SET_MAIN_MENU] != NULL)) {
- /* gtk_tool_button_set_icon_widget accepts NULL image */
- if (search->buttons[SEARCH_BACK_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_BACK_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_BACK_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
-
search->buttons[SEARCH_BACK_BUTTON]));
- }
- if (search->buttons[SEARCH_FORWARD_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_FORWARD_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_FORWARD_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
- search->buttons[
-
SEARCH_FORWARD_BUTTON]));
- }
- if (search->buttons[SEARCH_CLOSE_BUTTON] != NULL) {
- gtk_tool_button_set_icon_widget(
- search->buttons[SEARCH_CLOSE_BUTTON],
- GTK_WIDGET(theme[IMAGE_SET_MAIN_MENU]->
- searchimage[SEARCH_CLOSE_BUTTON]));
- gtk_widget_show_all(GTK_WIDGET(
-
search->buttons[SEARCH_CLOSE_BUTTON]));
- }
- }
-
- for (i = 0; i < IMAGE_SET_COUNT; i++) {
- if (theme[i] != NULL) {
- free(theme[i]);
- }
- }
-}
+static nserror toolbar_item_create(nsgtk_toolbar_button id,
+ struct nsgtk_toolbar_item *item_out);
/**
@@ -555,9 +250,11 @@ make_toolbar_item_throbber(bool sensitivity)
}
if (edit_mode) {
+ const char *msg;
+ msg = messages_get("ToolThrob");
item = gtk_tool_button_new(
GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
- "[throbber]");
+ msg);
} else {
item = gtk_tool_item_new();
@@ -576,6 +273,7 @@ make_toolbar_item_throbber(bool sensitivity)
return item;
}
+
/**
* create url bar toolbar item widget
*
@@ -588,24 +286,34 @@ make_toolbar_item_url_bar(bool sensitivity)
GtkWidget *entry;
GtkEntryCompletion *completion;
- item = gtk_tool_item_new();
entry = nsgtk_entry_new();
- completion = gtk_entry_completion_new();
- if ((entry == NULL) || (completion == NULL) || (item == NULL)) {
+ if (entry == NULL) {
return NULL;
}
- gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
-
- gtk_container_add(GTK_CONTAINER(item), entry);
- gtk_tool_item_set_expand(item, TRUE);
-
if (edit_mode) {
- gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
+
+ item = gtk_tool_button_new(NULL, "URL");
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), entry);
} else {
- gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+ completion = gtk_entry_completion_new();
+ if (completion != NULL) {
+ gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+ }
+
+ item = gtk_tool_item_new();
+ if (item == NULL) {
+ return NULL;
+ }
+
+ gtk_container_add(GTK_CONTAINER(item), entry);
+ gtk_tool_item_set_expand(item, TRUE);
+
}
+ gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
return item;
}
@@ -623,37 +331,104 @@ make_toolbar_item_websearch(bool sensitivity)
struct bitmap *bitmap;
GdkPixbuf *pixbuf = NULL;
- entry = nsgtk_entry_new();
- item = gtk_tool_item_new();
-
- if ((entry == NULL) || (item == NULL)) {
- return NULL;
- }
-
- gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
-
- gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
-
res = search_web_get_provider_bitmap(&bitmap);
if ((res == NSERROR_OK) && (bitmap != NULL)) {
pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
16, 16);
}
+ entry = nsgtk_entry_new();
+
+ if (entry == NULL) {
+ return NULL;
+ }
+
if (pixbuf != NULL) {
nsgtk_entry_set_icon_from_pixbuf(entry,
GTK_ENTRY_ICON_PRIMARY,
pixbuf);
} else {
- nsgtk_entry_set_icon_from_stock(entry,
- GTK_ENTRY_ICON_PRIMARY,
- NSGTK_STOCK_INFO);
+ nsgtk_entry_set_icon_from_icon_name(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NSGTK_STOCK_INFO);
}
- gtk_container_add(GTK_CONTAINER(item), entry);
+ if (edit_mode) {
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
+
+ item = gtk_tool_button_new(NULL, "Web Search");
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item),
+ entry);
+ } else {
+ gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+
+ item = gtk_tool_item_new();
+ if (item == NULL) {
+ return NULL;
+ }
+
+ gtk_container_add(GTK_CONTAINER(item), entry);
+ }
+ gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
+
+ return item;
+}
+
+
+/**
+ * create local history toolbar item widget
+ */
+static GtkToolItem *
+make_toolbar_item_history(bool sensitivity)
+{
+ GtkToolItem *item;
+ const char *msg = "H";
+ char *label = NULL;
if (edit_mode) {
- gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+ msg = messages_get("gtkLocalHistory");
+ }
+ label = remove_underscores(msg, false);
+ item = gtk_tool_button_new(NULL, label);
+ if (label != NULL) {
+ free(label);
+ }
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "local-history");
+
+ /* set history widget minimum width */
+ gtk_widget_set_size_request(GTK_WIDGET(item), 20, -1);
+ gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
+ return item;
+}
+
+
+/**
+ * create generic button toolbar item widget
+ */
+static GtkToolItem *
+make_toolbar_item_button(const char *labelmsg,
+ const char *iconname,
+ bool sensitivity)
+{
+ GtkToolItem *item;
+ char *label = NULL;
+
+ label = remove_underscores(messages_get(labelmsg), false);
+
+ item = gtk_tool_button_new(NULL, label);
+ if (label != NULL) {
+ free(label);
+ }
+
+ if (item != NULL) {
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), iconname);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+ if (edit_mode) {
+ nsgtk_widget_set_margins(GTK_WIDGET(item), 0, 0);
+ }
}
return item;
@@ -669,104 +444,48 @@ make_toolbar_item_websearch(bool sensitivity)
*/
static GtkToolItem *
make_toolbar_item(nsgtk_toolbar_button itemid,
- struct nsgtk_theme *theme,
bool sensitivity)
{
- GtkToolItem *w = NULL;
+ GtkToolItem *toolitem = NULL;
switch(itemid) {
+#define TOOLBAR_ITEM_y(identifier, label, iconame)
+#define TOOLBAR_ITEM_n(identifier, label, iconame)
+#define TOOLBAR_ITEM_b(identifier, label, iconame) \
+ case identifier: \
+ toolitem = make_toolbar_item_button(#label, iconame,
sensitivity);\
+ break;
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
+ TOOLBAR_ITEM_ ## clicked(identifier, label, iconame)
-/* gtk_tool_button_new accepts NULL args */
-#define MAKE_ITEM(p, q)
\
- case p##_BUTTON: { \
- char *label = NULL; \
- label = remove_underscores(messages_get(#q), false); \
- w = gtk_tool_button_new(GTK_WIDGET(theme->image[p##_BUTTON]), \
- label); \
- gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity); \
- if (label != NULL) { \
- free(label); \
- } \
- break; \
- }
-
- MAKE_ITEM(HOME, gtkHome)
- MAKE_ITEM(BACK, gtkBack)
- MAKE_ITEM(FORWARD, gtkForward)
- MAKE_ITEM(STOP, Stop)
- MAKE_ITEM(RELOAD, Reload)
- MAKE_ITEM(NEWWINDOW, gtkNewWindow)
- MAKE_ITEM(NEWTAB, gtkNewTab)
- MAKE_ITEM(OPENFILE, gtkOpenFile)
- MAKE_ITEM(CLOSETAB, gtkCloseTab)
- MAKE_ITEM(CLOSEWINDOW, gtkCloseWindow)
- MAKE_ITEM(SAVEPAGE, gtkSavePage)
- MAKE_ITEM(PRINTPREVIEW, gtkPrintPreview)
- MAKE_ITEM(PRINT, gtkPrint)
- MAKE_ITEM(QUIT, gtkQuitMenu)
- MAKE_ITEM(CUT, gtkCut)
- MAKE_ITEM(COPY, gtkCopy)
- MAKE_ITEM(PASTE, gtkPaste)
- MAKE_ITEM(DELETE, gtkDelete)
- MAKE_ITEM(SELECTALL, gtkSelectAll)
- MAKE_ITEM(PREFERENCES, gtkPreferences)
- MAKE_ITEM(ZOOMPLUS, gtkZoomPlus)
- MAKE_ITEM(ZOOMMINUS, gtkZoomMinus)
- MAKE_ITEM(ZOOMNORMAL, gtkZoomNormal)
- MAKE_ITEM(FULLSCREEN, gtkFullScreen)
- MAKE_ITEM(VIEWSOURCE, gtkViewSource)
- MAKE_ITEM(CONTENTS, gtkContents)
- MAKE_ITEM(ABOUT, gtkAbout)
- MAKE_ITEM(PDF, gtkPDF)
- MAKE_ITEM(PLAINTEXT, gtkPlainText)
- MAKE_ITEM(DRAWFILE, gtkDrawFile)
- MAKE_ITEM(POSTSCRIPT, gtkPostScript)
- MAKE_ITEM(FIND, gtkFind)
- MAKE_ITEM(DOWNLOADS, gtkDownloads)
- MAKE_ITEM(SAVEWINDOWSIZE, gtkSaveWindowSize)
- MAKE_ITEM(TOGGLEDEBUGGING, gtkToggleDebugging)
- MAKE_ITEM(SAVEBOXTREE, gtkDebugBoxTree)
- MAKE_ITEM(SAVEDOMTREE, gtkDebugDomTree)
- MAKE_ITEM(LOCALHISTORY, gtkLocalHistory)
- MAKE_ITEM(GLOBALHISTORY, gtkGlobalHistory)
- MAKE_ITEM(ADDBOOKMARKS, gtkAddBookMarks)
- MAKE_ITEM(SHOWBOOKMARKS, gtkShowBookMarks)
- MAKE_ITEM(SHOWCOOKIES, gtkShowCookies)
- MAKE_ITEM(OPENLOCATION, gtkOpenLocation)
- MAKE_ITEM(NEXTTAB, gtkNextTab)
- MAKE_ITEM(PREVTAB, gtkPrevTab)
- MAKE_ITEM(GUIDE, gtkGuide)
- MAKE_ITEM(INFO, gtkUserInformation)
- MAKE_ITEM(OPENMENU, gtkOpenMenu)
-
-#undef MAKE_ITEM
+#include "gtk/toolbar_items.h"
+
+#undef TOOLBAR_ITEM_b
+#undef TOOLBAR_ITEM_n
+#undef TOOLBAR_ITEM_y
+#undef TOOLBAR_ITEM
case HISTORY_BUTTON:
- w = gtk_tool_button_new(GTK_WIDGET(
- theme->image[HISTORY_BUTTON]), "H");
- /* set history widget minimum width */
- gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
- gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);
+ toolitem = make_toolbar_item_history(sensitivity);
break;
case URL_BAR_ITEM:
- w = make_toolbar_item_url_bar(sensitivity);
+ toolitem = make_toolbar_item_url_bar(sensitivity);
break;
case THROBBER_ITEM:
- w = make_toolbar_item_throbber(sensitivity);
+ toolitem = make_toolbar_item_throbber(sensitivity);
break;
case WEBSEARCH_ITEM:
- w = make_toolbar_item_websearch(sensitivity);
+ toolitem = make_toolbar_item_websearch(sensitivity);
break;
default:
break;
}
-
- return w;
+ return toolitem;
}
/**
@@ -957,7 +676,6 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
struct nsgtk_toolbar_customisation *tbc;
tbc = (struct nsgtk_toolbar_customisation *)data;
gint position; /* drop position in toolbar */
- struct nsgtk_theme *theme;
int location;
int itemid;
struct nsgtk_toolbar_item *dragitem; /* toolbar item being dragged */
@@ -993,18 +711,12 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
GTK_WIDGET(dragitem->button));
}
- /* add dropped item into toolbar */
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
- if (theme == NULL) {
- nsgtk_warning(messages_get("NoMemory"), 0);
- return TRUE;
- }
edit_mode = true;
- dragitem->button = make_toolbar_item(tbc->dragitem, theme, true);
+ dragitem->button = make_toolbar_item(tbc->dragitem,
+ tbc->toolbar.items[tbc->dragitem].sensitivity);
edit_mode = false;
- free(theme);
if (dragitem->button == NULL) {
nsgtk_warning("NoMemory", 0);
return TRUE;
@@ -1134,23 +846,6 @@ nsgtk_browser_window_create(struct browser_window *bw,
bool intab)
}
-/**
- * \return toolbar item id when a widget is an element of the scaffolding
- * else -1
- */
-int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
-{
- int i;
- for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
- if ((nsgtk_scaffolding_button(g, i)->location != -1)
- && (widget == GTK_WIDGET(
- nsgtk_scaffolding_button(g, i)->button))) {
- return i;
- }
- }
- return -1;
-}
/**
@@ -1228,9 +923,7 @@ apply_user_button_customisation(struct nsgtk_toolbar *tb)
* \return NSERROR_OK on success else error code.
*/
static nserror
-add_item_to_toolbar(struct nsgtk_toolbar *tb,
- struct nsgtk_theme *theme,
- int location)
+add_item_to_toolbar(struct nsgtk_toolbar *tb, int location)
{
int bidx; /* button index */
@@ -1239,7 +932,7 @@ add_item_to_toolbar(struct nsgtk_toolbar *tb,
if (tb->items[bidx].location == location) {
tb->items[bidx].button = make_toolbar_item(
- bidx, theme, tb->items[bidx].sensitivity);
+ bidx, tb->items[bidx].sensitivity);
gtk_toolbar_insert(tb->widget,
tb->items[bidx].button,
@@ -1266,14 +959,8 @@ static void container_remove_widget(GtkWidget *widget,
gpointer data)
*/
static nserror populate_gtk_toolbar_widget(struct nsgtk_toolbar *tb)
{
- struct nsgtk_theme *theme; /* internal theme context */
int lidx; /* location index */
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
- if (theme == NULL) {
- return NSERROR_NOMEM;
- }
-
/* clear the toolbar container of all widgets */
gtk_container_foreach(GTK_CONTAINER(tb->widget),
container_remove_widget,
@@ -1281,11 +968,10 @@ static nserror populate_gtk_toolbar_widget(struct
nsgtk_toolbar *tb)
/* add widgets to toolbar */
for (lidx = 0; lidx < PLACEHOLDER_BUTTON; lidx++) {
- add_item_to_toolbar(tb, theme, lidx);
+ add_item_to_toolbar(tb, lidx);
}
gtk_widget_show_all(GTK_WIDGET(tb->widget));
- free(theme);
return NSERROR_OK;
}
@@ -1490,7 +1176,6 @@ item_size_allocate_cb(GtkWidget *widget,
if (alloc->height > NSGTK_BUTTON_HEIGHT) {
alloc->height = NSGTK_BUTTON_HEIGHT;
}
- //NSLOG(netsurf, ERROR, "w:%d h:%d", alloc->width, alloc->height);
gtk_widget_set_allocation(widget, alloc);
}
@@ -1542,7 +1227,7 @@ add_toolbox_row(struct nsgtk_toolbar_customisation *tbc,
"size-allocate",
G_CALLBACK(item_size_allocate_cb),
NULL);
- gtk_toolbar_insert(rowbar, tbc->items[iidx], iidx - startitem);
+ gtk_toolbar_insert(rowbar, tbc->items[iidx], -1);
}
return NSERROR_OK;
}
@@ -1563,17 +1248,11 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
int curcol; /* current column in creation */
int iidx; /* item index */
int startidx; /* index of item at start of row */
- struct nsgtk_theme *theme;
-
- theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, true);
- if (theme == NULL) {
- return NSERROR_NOMEM;
- }
/* ensure there are a minimum number of items per row */
columns = width / NSGTK_BUTTON_WIDTH;
- if (columns < NSGTK_STORE_WIDTH) {
- columns = NSGTK_STORE_WIDTH;
+ if (columns < NSGTK_MIN_STORE_COLUMNS) {
+ columns = NSGTK_MIN_STORE_COLUMNS;
}
edit_mode = true;
@@ -1584,7 +1263,8 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
curcol = 0;
startidx = iidx;
}
- tbc->items[iidx] = make_toolbar_item(iidx, theme, true);
+ tbc->items[iidx] = make_toolbar_item(iidx,
+ tbc->toolbar.items[iidx].sensitivity);
if (tbc->items[iidx] != NULL) {
curcol++;
}
@@ -1594,8 +1274,6 @@ toolbar_customisation_create_toolbox(struct
nsgtk_toolbar_customisation *tbc,
}
edit_mode = false;
- free(theme);
-
return NSERROR_OK;
}
@@ -1615,10 +1293,12 @@ customisation_toolbar_update(struct
nsgtk_toolbar_customisation *tbc)
}
/* populate toolbar widget */
+ edit_mode = true;
res = populate_gtk_toolbar_widget(&tbc->toolbar);
if (res != NSERROR_OK) {
return res;
}
+ edit_mode = false;
/* ensure icon sizes and text labels on toolbar are set */
res = nsgtk_toolbar_restyle(&tbc->toolbar);
@@ -1757,7 +1437,11 @@ static gboolean cutomize_button_clicked_cb(GtkWidget
*widget, gpointer data)
if (res != NSERROR_OK) {
goto cutomize_button_clicked_cb_error;
}
- tbc->toolbar.items[iidx].sensitivity = true;
+ if ((iidx == URL_BAR_ITEM) || (iidx == WEBSEARCH_ITEM)) {
+ tbc->toolbar.items[iidx].sensitivity = false;
+ } else {
+ tbc->toolbar.items[iidx].sensitivity = true;
+ }
}
res = customisation_toolbar_update(tbc);
@@ -3240,6 +2924,42 @@ static gboolean openmenu_button_clicked_cb(GtkWidget
*widget, gpointer data)
}
+/* define data plus and data minus handlers */
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
+static gboolean
\
+nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
+ GdkDragContext *cont, \
+ GtkSelectionData *selection, \
+ guint info, \
+ guint time, \
+ gpointer data) \
+{ \
+ struct nsgtk_toolbar_customisation *tbc; \
+ tbc = (struct nsgtk_toolbar_customisation *)data; \
+ tbc->dragitem = identifier; \
+ tbc->dragfrom = true; \
+ return TRUE; \
+} \
+static gboolean
\
+nsgtk_toolbar_##name##_data_minus(GtkWidget *widget, \
+ GdkDragContext *cont, \
+ GtkSelectionData *selection, \
+ guint info, \
+ guint time, \
+ gpointer data) \
+{ \
+ struct nsgtk_toolbar_customisation *tbc; \
+ tbc = (struct nsgtk_toolbar_customisation *)data; \
+ tbc->dragitem = identifier; \
+ tbc->dragfrom = false; \
+ return TRUE; \
+}
+
+#include "gtk/toolbar_items.h"
+
+#undef TOOLBAR_ITEM
+
+
/**
* create a toolbar item
*
@@ -3252,11 +2972,13 @@ toolbar_item_create(nsgtk_toolbar_button id, struct
nsgtk_toolbar_item *item)
/* set item defaults from macro */
switch (id) {
-#define TOOLBAR_ITEM_y(name) \
+#define TOOLBAR_ITEM_b(name) \
+ item->bhandler = name##_button_clicked_cb;
+#define TOOLBAR_ITEM_y(name) \
item->bhandler = name##_button_clicked_cb;
-#define TOOLBAR_ITEM_n(name) \
+#define TOOLBAR_ITEM_n(name) \
item->bhandler = NULL;
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label,
iconame) \
case identifier: \
item->sensitivity = snstvty; \
item->dataplus = nsgtk_toolbar_##name##_data_plus; \
@@ -3617,7 +3339,6 @@ nserror nsgtk_toolbar_set_url(struct nsgtk_toolbar *tb,
nsurl *url)
}
gtk_entry_set_text(url_entry, url_text);
- //gtk_editable_set_position(GTK_EDITABLE(url_entry), -1);
if (idn_url_s != NULL) {
free(idn_url_s);
@@ -3645,9 +3366,9 @@ nsgtk_toolbar_set_websearch_image(struct nsgtk_toolbar
*tb, GdkPixbuf *pixbuf)
GTK_ENTRY_ICON_PRIMARY,
pixbuf);
} else {
- nsgtk_entry_set_icon_from_stock(entry,
- GTK_ENTRY_ICON_PRIMARY,
- NSGTK_STOCK_INFO);
+ nsgtk_entry_set_icon_from_icon_name(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NSGTK_STOCK_INFO);
}
return NSERROR_OK;
diff --git a/frontends/gtk/toolbar.h b/frontends/gtk/toolbar.h
index b699898..e895d0b 100644
--- a/frontends/gtk/toolbar.h
+++ b/frontends/gtk/toolbar.h
@@ -43,6 +43,7 @@ nserror nsgtk_toolbar_create(GtkBuilder *builder, struct
browser_window *(*get_b
*/
nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
+
/**
* Update the toolbar items being shown based on current settings
*
@@ -51,6 +52,7 @@ nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
*/
nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb);
+
/**
* Update toolbar style and size based on current settings
*
@@ -111,10 +113,6 @@ nserror nsgtk_toolbar_item_activate(struct nsgtk_toolbar
*tb, nsgtk_toolbar_butt
*/
nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool show);
-/**
- * sets up the images for scaffolding.
- */
-void nsgtk_theme_implement(struct nsgtk_scaffolding *g);
/**
* Initialise customization of toolbar entries
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 661cbef..344c097 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -80,72 +80,75 @@ typedef enum {
/*
* Item fields are:
- * identifier enum
- * name
- * initial sensitivity
- * y/n - if there is a toolbar click signal handler
- * y/n/p - if there is a menu activate signal handler and if it calls the
- * toolbar click handler.
+ * - item identifier (enum value)
+ * - name (identifier)
+ * - initial sensitivity (true/false)
+ * - if there is a toolbar click signal handler (y/n) and it is available in
+ * the toolbar as a button (b, implies y)
+ * - if there is a menu activate signal handler (y/n) and it calls the
+ toolbar click handler directly. (p, implies y)
+ * - item label as a netsurf message (identifier)
+ * - icon image name ("string")
*/
#ifndef TOOLBAR_ITEM
-#define TOOLBAR_ITEM(a, b, c, d, e)
+#define TOOLBAR_ITEM(a, b, c, d, e, f, g)
#define TOOLBAR_ITEM_SET
#endif
-TOOLBAR_ITEM(BACK_BUTTON, back, false, y, p)
-TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n)
-TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, y, p)
-TOOLBAR_ITEM(STOP_BUTTON, stop, false, y, p)
-TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, y, p)
-TOOLBAR_ITEM(HOME_BUTTON, home, true, y, p)
-TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n)
-TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n)
-TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n)
-TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, y, p)
-TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, y, p)
-TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, y, p)
-TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, y)
-TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, p)
-TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, y, p)
-TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, p)
-TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, y, p)
-TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n)
-TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n)
-TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, p)
-TOOLBAR_ITEM(PRINT_BUTTON, print, true, y, p)
-TOOLBAR_ITEM(QUIT_BUTTON, quit, true, y, p)
-TOOLBAR_ITEM(CUT_BUTTON, cut, true, y, p)
-TOOLBAR_ITEM(COPY_BUTTON, copy, true, y, p)
-TOOLBAR_ITEM(PASTE_BUTTON, paste, true, y, p)
-TOOLBAR_ITEM(DELETE_BUTTON, delete, false, y, p)
-TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, y, p)
-TOOLBAR_ITEM(FIND_BUTTON, find, true, n, y)
-TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, y, p)
-TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, y, p)
-TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, y, p)
-TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, y, p)
-TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, y, p)
-TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, y, p)
-TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, y, p)
-TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, p)
-TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, p)
-TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, p)
-TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, p)
-TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, p)
-TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, p)
-TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, p)
-TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, y, p)
-TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, p)
-TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, p)
-TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y)
-TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y)
-TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, p)
-TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p)
-TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p)
-TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, p)
-TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n)
-TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p)
+TOOLBAR_ITEM(BACK_BUTTON, back, false, b, p, gtkBack, "go-previous")
+TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n, , "local-history")
+TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, b, p, gtkForward, "go-next")
+TOOLBAR_ITEM(STOP_BUTTON, stop, false, b, p, gtkStop, NSGTK_STOCK_STOP)
+TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, b, p, Reload, NSGTK_STOCK_REFRESH)
+TOOLBAR_ITEM(HOME_BUTTON, home, true, b, p, gtkHome, NSGTK_STOCK_HOME)
+TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n, , NULL)
+TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n, , NULL)
+TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n, , NULL)
+TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, b, p, gtkNewWindow,
"document-new")
+TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, b, p, gtkNewTab, NSGTK_STOCK_ADD)
+TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, b, p, gtkOpenFile,
"document-open")
+TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, y, , "window-close")
+TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, p, , "window-close")
+TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, b, p, gtkSavePage, "text-html")
+TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, p, , "x-office-document")
+TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, b, p, gtkPlainText,
"text-x-generic")
+TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n, , NULL)
+TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n, , NULL)
+TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, p, gtkPrintPreview,
"gtk-print-preview")
+TOOLBAR_ITEM(PRINT_BUTTON, print, true, b, p, gtkPrint, "document-print")
+TOOLBAR_ITEM(QUIT_BUTTON, quit, true, b, p, gtkQuitMenu, "application-exit")
+TOOLBAR_ITEM(CUT_BUTTON, cut, true, b, p, gtkCut, "edit-cut")
+TOOLBAR_ITEM(COPY_BUTTON, copy, true, b, p, gtkCopy, "edit-copy")
+TOOLBAR_ITEM(PASTE_BUTTON, paste, true, b, p, gtkPaste, "edit-paste")
+TOOLBAR_ITEM(DELETE_BUTTON, delete, false, b, p, gtkDelete, "edit-delete")
+TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, b, p, gtkSelectAll,
"edit-select-all")
+TOOLBAR_ITEM(FIND_BUTTON, find, true, n, y, gtkFind, "edit-find")
+TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, b, p, gtkPreferences,
"preferences-system")
+TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, b, p, gtkZoomPlus, "gtk-zoom-in")
+TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, b, p, gtkZoomMinus,
"gtk-zoom-out")
+TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, b, p, gtkZoomNormal,
"gtk-zoom-100")
+TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, b, p, gtkFullScreen,
"gtk-fullscreen")
+TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, b, p, gtkPageSource,
"gtk-index")
+TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, b, p, gtkDownloads,
NSGTK_STOCK_SAVE_AS)
+TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, p,
gtkSaveWindowSize, NULL)
+TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, p,
gtkToggleDebugging, NULL)
+TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, p, gtkDebugBoxTree,
NULL)
+TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, p, gtkDebugDomTree,
NULL)
+TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, p, , NULL)
+TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, p,
gtkGlobalHistory, NULL)
+TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, p, gtkAddBookMarks,
NULL)
+TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, b, p,
gtkShowBookMarks, "user-bookmarks")
+TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, b, p, gtkShowCookies,
"show-cookie")
+TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, p, gtkOpenLocation,
NULL)
+TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y, gtkNextTab,
"media-skip-forward")
+TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y, gtkPrevTab,
"media-skip-backward")
+TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, p, gtkContents, "gtk-help")
+TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p, gtkGuide, "gtk-help")
+TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p, gtkUserInformation,
"dialog-information")
+TOOLBAR_ITEM(ABOUT_BUTTON, about, true, b, p, gtkAbout, "help-about")
+TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, b, n, gtkOpenMenu,
NSGTK_STOCK_OPEN_MENU)
+TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p, , NULL)
#ifdef TOOLBAR_ITEM_SET
#undef TOOLBAR_ITEM
diff --git a/resources/FatMessages b/resources/FatMessages
index d42a4de..ee56dee 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -2906,6 +2906,8 @@ nl.gtk.gtkUnknownSize:onbekend
# gtk Menu / Button labels
#
+en.gtk.gtkOpenMenu:Open Menu
+
en.gtk.gtkFile:_File
de.gtk.gtkFile:_Datei
fr.gtk.gtkFile:_Fichier
@@ -3150,6 +3152,7 @@ fr.gtk.gtkDebugDomTree:Déboguer arbre _DOM
it.gtk.gtkDebugDomTree:Debug albero _DOM
nl.gtk.gtkDebugDomTree:_DOM-boom debuggen
+en.gtk.gtkStop:Stop
en.gtk.gtkBack:_Back
de.gtk.gtkBack:_Zurück
fr.gtk.gtkBack:_Précédent
diff --git a/frontends/gtk/res/arrow_down_8x32.png
b/resources/icons/local-history.png
similarity index 100%
rename from frontends/gtk/res/arrow_down_8x32.png
rename to resources/icons/local-history.png
diff --git a/resources/icons/show-cookie.png b/resources/icons/show-cookie.png
new file mode 100644
index 0000000..8e44972
Binary files /dev/null and b/resources/icons/show-cookie.png differ
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org