#include "midori-panel.h"
#include "midori-preferences.h"
#include "midori-plugins.h"
-#include "midori-stock.h"
#include "midori-view.h"
#include "midori-websettings.h"
} MidoriHistoryError;
-static void
-stock_items_init (void)
-{
- typedef struct
- {
- const gchar* stock_id;
- const gchar* label;
- GdkModifierType modifier;
- guint keyval;
- const gchar* fallback;
- } FatStockItem;
- GtkIconSource* icon_source;
- GtkIconSet* icon_set;
- GtkIconFactory* factory = gtk_icon_factory_new ();
- gsize i;
-
- static FatStockItem items[] =
- {
- { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT },
- { STOCK_NEWS_FEED, NULL, 0, 0, GTK_STOCK_INDEX },
- { STOCK_SCRIPT, NULL, 0, 0, GTK_STOCK_EXECUTE },
- { STOCK_STYLE, NULL, 0, 0, GTK_STOCK_SELECT_COLOR },
- { STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
-
- { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
- { STOCK_BOOKMARKS, N_("_Bookmarks"), 0, 0, GTK_STOCK_DIRECTORY },
- { STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, GTK_STOCK_ADD },
- { STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
- { STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
- { STOCK_HISTORY, N_("_History"), 0, 0, GTK_STOCK_SORT_ASCENDING },
- { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
- { STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
- { STOCK_STYLES, N_("User_styles"), 0, 0, GTK_STOCK_SELECT_COLOR },
- { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
- { STOCK_TRANSFERS, N_("_Transfers"), 0, 0, GTK_STOCK_SAVE },
- { STOCK_USER_TRASH, N_("_Closed Tabs and Windows"), 0, 0, "gtk-undo-ltr" },
- { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
- };
-
- for (i = 0; i < G_N_ELEMENTS (items); i++)
- {
- icon_set = gtk_icon_set_new ();
- icon_source = gtk_icon_source_new ();
- if (items[i].fallback)
- {
- gtk_icon_source_set_icon_name (icon_source, items[i].fallback);
- items[i].fallback = NULL;
- gtk_icon_set_add_source (icon_set, icon_source);
- }
- gtk_icon_source_set_icon_name (icon_source, items[i].stock_id);
- gtk_icon_set_add_source (icon_set, icon_source);
- gtk_icon_source_free (icon_source);
- gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
- gtk_icon_set_unref (icon_set);
- }
- gtk_stock_add ((GtkStockItem*)items, G_N_ELEMENTS (items));
- gtk_icon_factory_add_default (factory);
- g_object_unref (factory);
-}
-
static gchar*
build_config_filename (const gchar* filename)
{
/* libSoup uses threads, therefore if WebKit is built with libSoup
or Midori is using it, we need to initialize threads. */
if (!g_thread_supported ()) g_thread_init (NULL);
- stock_items_init ();
+ sokoke_register_stock_items ();
g_set_application_name (_("Midori"));
if (version)
*/
#include "sokoke.h"
+#include "midori-stock.h"
#if HAVE_CONFIG_H
#include <config.h>
return julian;
}
+
+/**
+ * sokoke_register_stock_items:
+ *
+ * Registers several custom stock items used throughout Midori.
+ **/
+void
+sokoke_register_stock_items (void)
+{
+ typedef struct
+ {
+ const gchar* stock_id;
+ const gchar* label;
+ GdkModifierType modifier;
+ guint keyval;
+ const gchar* fallback;
+ } FatStockItem;
+ GtkIconSource* icon_source;
+ GtkIconSet* icon_set;
+ GtkIconFactory* factory = gtk_icon_factory_new ();
+ gsize i;
+
+ static FatStockItem items[] =
+ {
+ { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT },
+ { STOCK_NEWS_FEED, NULL, 0, 0, GTK_STOCK_INDEX },
+ { STOCK_SCRIPT, NULL, 0, 0, GTK_STOCK_EXECUTE },
+ { STOCK_STYLE, NULL, 0, 0, GTK_STOCK_SELECT_COLOR },
+ { STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
+
+ { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
+ { STOCK_BOOKMARKS, N_("_Bookmarks"), 0, 0, GTK_STOCK_DIRECTORY },
+ { STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, GTK_STOCK_ADD },
+ { STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
+ { STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
+ { STOCK_HISTORY, N_("_History"), 0, 0, GTK_STOCK_SORT_ASCENDING },
+ { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
+ { STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
+ { STOCK_STYLES, N_("User_styles"), 0, 0, GTK_STOCK_SELECT_COLOR },
+ { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
+ { STOCK_TRANSFERS, N_("_Transfers"), 0, 0, GTK_STOCK_SAVE },
+ { STOCK_USER_TRASH, N_("_Closed Tabs and Windows"), 0, 0, "gtk-undo-ltr" },
+ { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
+ };
+
+ for (i = 0; i < G_N_ELEMENTS (items); i++)
+ {
+ icon_set = gtk_icon_set_new ();
+ icon_source = gtk_icon_source_new ();
+ if (items[i].fallback)
+ {
+ gtk_icon_source_set_icon_name (icon_source, items[i].fallback);
+ items[i].fallback = NULL;
+ gtk_icon_set_add_source (icon_set, icon_source);
+ }
+ gtk_icon_source_set_icon_name (icon_source, items[i].stock_id);
+ gtk_icon_set_add_source (icon_set, icon_source);
+ gtk_icon_source_free (icon_source);
+ gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
+ gtk_icon_set_unref (icon_set);
+ }
+ gtk_stock_add ((GtkStockItem*)items, G_N_ELEMENTS (items));
+ gtk_icon_factory_add_default (factory);
+ g_object_unref (factory);
+}