Track selected search engine per window

This commit is contained in:
Christian Dywan 2011-05-15 21:40:39 +02:00
parent a1855abf67
commit e66ea168c2

View file

@ -101,6 +101,7 @@ struct _MidoriBrowser
gboolean show_statusbar; gboolean show_statusbar;
guint maximum_history_age; guint maximum_history_age;
gchar* location_entry_search; gchar* location_entry_search;
guint last_web_search;
gchar* news_aggregator; gchar* news_aggregator;
}; };
@ -3797,13 +3798,11 @@ _action_search_submit (GtkAction* action,
gboolean new_tab, gboolean new_tab,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
guint last_web_search;
KatzeItem* item; KatzeItem* item;
const gchar* url; const gchar* url;
gchar* search; gchar* search;
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL); item = katze_array_get_nth_item (browser->search_engines, browser->last_web_search);
item = katze_array_get_nth_item (browser->search_engines, last_web_search);
if (item) if (item)
url = katze_item_get_uri (item); url = katze_item_get_uri (item);
else /* The location entry search is our fallback */ else /* The location entry search is our fallback */
@ -3862,6 +3861,7 @@ _action_search_notify_current_item (GtkAction* action,
idx = 0; idx = 0;
g_object_set (browser->settings, "last-web-search", idx, NULL); g_object_set (browser->settings, "last-web-search", idx, NULL);
browser->last_web_search = idx;
} }
static void static void
@ -6352,7 +6352,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
gboolean show_panel; gboolean show_panel;
MidoriToolbarStyle toolbar_style; MidoriToolbarStyle toolbar_style;
gchar* toolbar_items; gchar* toolbar_items;
gint last_web_search;
gboolean close_buttons_on_tabs; gboolean close_buttons_on_tabs;
KatzeItem* item; KatzeItem* item;
@ -6377,7 +6376,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
"show-statusbar", &browser->show_statusbar, "show-statusbar", &browser->show_statusbar,
"toolbar-style", &toolbar_style, "toolbar-style", &toolbar_style,
"toolbar-items", &toolbar_items, "toolbar-items", &toolbar_items,
"last-web-search", &last_web_search,
"location-entry-search", &browser->location_entry_search, "location-entry-search", &browser->location_entry_search,
"close-buttons-on-tabs", &close_buttons_on_tabs, "close-buttons-on-tabs", &close_buttons_on_tabs,
"maximum-history-age", &browser->maximum_history_age, "maximum-history-age", &browser->maximum_history_age,
@ -6425,7 +6423,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
if (browser->search_engines) if (browser->search_engines)
{ {
item = katze_array_get_nth_item (browser->search_engines, item = katze_array_get_nth_item (browser->search_engines,
last_web_search); browser->last_web_search);
if (item) if (item)
midori_search_action_set_current_item (MIDORI_SEARCH_ACTION ( midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
_action_by_name (browser, "Search")), item); _action_by_name (browser, "Search")), item);
@ -6713,7 +6711,6 @@ midori_browser_set_property (GObject* object,
GParamSpec* pspec) GParamSpec* pspec)
{ {
MidoriBrowser* browser = MIDORI_BROWSER (object); MidoriBrowser* browser = MIDORI_BROWSER (object);
guint last_web_search;
KatzeItem* item; KatzeItem* item;
switch (prop_id) switch (prop_id)
@ -6772,8 +6769,8 @@ midori_browser_set_property (GObject* object,
if (browser->search_engines) if (browser->search_engines)
{ {
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL); g_object_get (browser->settings, "last-web-search", &browser->last_web_search, NULL);
item = katze_array_get_nth_item (browser->search_engines, last_web_search); item = katze_array_get_nth_item (browser->search_engines, browser->last_web_search);
midori_search_action_set_current_item (MIDORI_SEARCH_ACTION ( midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
_action_by_name (browser, "Search")), item); _action_by_name (browser, "Search")), item);