UniqueResponse response;
MidoriBrowser* browser;
gchar** uris;
+ MidoriNewPage open_external_pages_in;
+ gboolean first;
switch (command)
{
response = UNIQUE_RESPONSE_FAIL;
else
{
+ g_object_get (app->settings, "open-external-pages-in",
+ &open_external_pages_in, NULL);
+ if (open_external_pages_in == MIDORI_NEW_PAGE_WINDOW)
+ {
+ browser = g_object_new (MIDORI_TYPE_BROWSER,
+ "settings", app->settings,
+ "bookmarks", app->bookmarks,
+ "trash", app->trash,
+ "search-engines", app->search_engines,
+ "history", app->history,
+ NULL);
+ midori_app_add_browser (app, browser);
+ gtk_window_set_screen (GTK_WINDOW (app->browser),
+ unique_message_data_get_screen (message));
+ gtk_widget_show (GTK_WIDGET (browser));
+ }
+ else
+ browser = app->browser;
+ first = (open_external_pages_in == MIDORI_NEW_PAGE_CURRENT);
while (*uris)
{
- midori_browser_set_current_page (app->browser,
- midori_browser_add_uri (app->browser, *uris));
+ if (first)
+ {
+ midori_browser_set_current_uri (browser, *uris);
+ first = FALSE;
+ }
+ else
+ midori_browser_set_current_page (browser,
+ midori_browser_add_uri (browser, *uris));
uris++;
}
/* g_strfreev (uris); */
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
}
-static void
-_midori_browser_open_uri (MidoriBrowser* browser,
- const gchar* uri)
-{
- GtkWidget* view;
-
- view = midori_browser_get_current_tab (browser);
- if (view)
- midori_view_set_uri (MIDORI_VIEW (view), uri);
-}
-
static void
_toggle_tabbar_smartly (MidoriBrowser* browser)
{
{
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
gchar* folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
g_free (last_dir);
last_dir = folder;
KatzeItem* item,
MidoriBrowser* browser)
{
- _midori_browser_open_uri (browser, katze_item_get_uri (item));
+ midori_browser_set_current_uri (browser, katze_item_get_uri (item));
}
static void
KatzeItem* item,
MidoriBrowser* browser)
{
- _midori_browser_open_uri (browser, katze_item_get_uri (item));
+ midori_browser_set_current_uri (browser, katze_item_get_uri (item));
gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
}
gchar* homepage;
g_object_get (browser->settings, "homepage", &homepage, NULL);
- _midori_browser_open_uri (browser, homepage);
+ midori_browser_set_current_uri (browser, homepage);
g_free (homepage);
}
if (index > -1)
{
uri = midori_location_action_get_uri (MIDORI_LOCATION_ACTION (action));
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
}
}
midori_browser_set_current_page (browser, n);
}
else
- _midori_browser_open_uri (browser, new_uri);
+ midori_browser_set_current_uri (browser, new_uri);
g_free (new_uri);
gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
}
const gchar* uri;
uri = g_object_get_data (G_OBJECT (widget), "uri");
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
}
static void
if (new_tab)
midori_browser_add_uri (browser, search);
else
- _midori_browser_open_uri (browser, search);
+ midori_browser_set_current_uri (browser, search);
g_free (search);
g_free (location_entry_search);
gtk_tree_model_get (model, &iter, 0, &item, -1);
uri = katze_item_get_uri (item);
if (uri && *uri)
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
}
}
if (KATZE_IS_ITEM (item))
{
uri = katze_item_get_uri (item);
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
}
g_object_unref (item);
}
KatzeItem* item;
item = (KatzeItem*)g_object_get_data (G_OBJECT (widget), "KatzeItem");
- _midori_browser_open_uri (browser, katze_item_get_uri (item));
+ midori_browser_set_current_uri (browser, katze_item_get_uri (item));
gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
}
gtk_tree_model_get (model, &iter, 0, &item, -1);
uri = katze_item_get_uri (item);
if (uri && *uri)
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
}
}
gtk_tree_model_get (model, &iter, 0, &item, -1);
uri = katze_item_get_uri (item);
if (uri && *uri)
- _midori_browser_open_uri (browser, uri);
+ midori_browser_set_current_uri (browser, uri);
g_object_unref (item);
}
}
switch (prop_id)
{
case PROP_URI:
- _midori_browser_open_uri (browser, g_value_get_string (value));
+ midori_browser_set_current_uri (browser, g_value_get_string (value));
break;
case PROP_TAB:
midori_browser_set_current_tab (browser, g_value_get_object (value));
g_signal_emit (browser, signals[ACTIVATE_ACTION], 0, name);
}
+/**
+ * midori_browser_set_current_uri:
+ * @browser: a #MidoriBrowser
+ * @uri: an URI
+ *
+ * Loads the specified URI in the current view.
+ *
+ * If the current view is opaque, and cannot load
+ * new pages, it will automatically open a new tab.
+ **/
+void
+midori_browser_set_current_uri (MidoriBrowser* browser,
+ const gchar* uri)
+{
+ GtkWidget* view;
+
+ g_return_if_fail (MIDORI_IS_BROWSER (browser));
+ g_return_if_fail (uri);
+
+ view = midori_browser_get_current_tab (browser);
+ midori_view_set_uri (MIDORI_VIEW (view), uri);
+}
+
/**
* midori_browser_get_current_uri:
* @browser: a #MidoriBrowser
preferences->notebook = NULL;
- dialog_title = g_strdup_printf (_("%s Preferences"),
+ dialog_title = g_strdup_printf (_("Preferences for %s"),
g_get_application_name ());
g_object_set (preferences,
"icon-name", GTK_STOCK_PREFERENCES,
INDENTED_ADD (button, 0, 1, 3, 4);
FRAME_NEW (_("Browsing"));
TABLE_NEW (3, 2);
+ label = katze_property_label (settings, "open-external-pages-in");
+ INDENTED_ADD (label, 0, 1, 0, 1);
+ button = katze_property_proxy (settings, "open-external-pages-in", NULL);
+ FILLED_ADD (button, 1, 2, 0, 1);
/* label = katze_property_label (settings, "open-new-pages-in");
INDENTED_ADD (label, 0, 1, 0, 1);
button = katze_property_proxy (settings, "open-new-pages-in", NULL);
gboolean close_buttons_on_tabs;
MidoriNewPage open_new_pages_in;
+ MidoriNewPage open_external_pages_in;
gboolean middle_click_opens_selection;
gboolean open_tabs_in_the_background;
gboolean open_tabs_next_to_current;
PROP_CLOSE_BUTTONS_ON_TABS,
PROP_OPEN_NEW_PAGES_IN,
+ PROP_OPEN_EXTERNAL_PAGES_IN,
PROP_MIDDLE_CLICK_OPENS_SELECTION,
PROP_OPEN_TABS_IN_THE_BACKGROUND,
PROP_OPEN_TABS_NEXT_TO_CURRENT,
MIDORI_NEW_PAGE_TAB,
G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class,
+ PROP_OPEN_EXTERNAL_PAGES_IN,
+ g_param_spec_enum (
+ "open-external-pages-in",
+ _("Open external pages in"),
+ _("Where to open externally opened pages"),
+ MIDORI_TYPE_NEW_PAGE,
+ MIDORI_NEW_PAGE_TAB,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class,
PROP_MIDDLE_CLICK_OPENS_SELECTION,
g_param_spec_boolean (
case PROP_OPEN_NEW_PAGES_IN:
web_settings->open_new_pages_in = g_value_get_enum (value);
break;
+ case PROP_OPEN_EXTERNAL_PAGES_IN:
+ web_settings->open_external_pages_in = g_value_get_enum (value);
+ break;
case PROP_MIDDLE_CLICK_OPENS_SELECTION:
web_settings->middle_click_opens_selection = g_value_get_boolean (value);
break;
case PROP_OPEN_NEW_PAGES_IN:
g_value_set_enum (value, web_settings->open_new_pages_in);
break;
+ case PROP_OPEN_EXTERNAL_PAGES_IN:
+ g_value_set_enum (value, web_settings->open_external_pages_in);
+ break;
case PROP_MIDDLE_CLICK_OPENS_SELECTION:
g_value_set_boolean (value, web_settings->middle_click_opens_selection);
break;