return FALSE;
}
-static void
+static MidoriBrowser*
midori_browser_new_window_cb (MidoriBrowser* browser,
MidoriBrowser* new_browser,
MidoriApp* app)
{
- g_object_set (new_browser,
- "settings", app->settings,
- "bookmarks", app->bookmarks,
- "trash", app->trash,
- "search-engines", app->search_engines,
- "history", app->history,
- NULL);
+ if (new_browser)
+ g_object_set (new_browser,
+ "settings", app->settings,
+ "bookmarks", app->bookmarks,
+ "trash", app->trash,
+ "search-engines", app->search_engines,
+ "history", app->history,
+ NULL);
+ else
+ new_browser = midori_app_create_browser (app);
midori_app_add_browser (app, new_browser);
gtk_widget_show (GTK_WIDGET (new_browser));
+
+ return new_browser;
}
static gboolean
* Creates a #MidoriBrowser which inherits its settings,
* bookmarks, trash, search engines and history from @app.
*
+ * Note that creating a browser this way can be a lot
+ * faster than setting it up manually.
+ *
* Return value: a new #MidoriBrowser
*
* Since: 0.1.2
const gchar* uri,
MidoriBrowser* browser)
{
- MidoriBrowser* new_browser = g_object_new (MIDORI_TYPE_BROWSER, NULL);
- g_signal_emit (browser, signals[NEW_WINDOW], 0, new_browser);
+ MidoriBrowser* new_browser;
+ g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
midori_browser_add_uri (new_browser, uri);
}
midori_browser_view_copy_history (new_view, view, TRUE);
if (where == MIDORI_NEW_VIEW_WINDOW)
{
- MidoriBrowser* new_browser = g_object_new (MIDORI_TYPE_BROWSER, NULL);
- g_signal_emit (browser, signals[NEW_WINDOW], 0, new_browser);
+ MidoriBrowser* new_browser;
+ g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
midori_browser_add_tab (new_browser, new_view);
midori_browser_set_current_tab (new_browser, new_view);
}
/**
* MidoriBrowser::new-window:
* @browser: the object on which the signal is emitted
- * @window: a new browser window
+ * @window: a new browser window, or %NULL
*
* Emitted when a new browser window was created.
*
* Note: Before 0.1.7 the second argument was an URI string.
+ *
+ * Note: Since 0.2.1 the return value is a #MidoriBrowser
+ *
+ * Return value: a new #MidoriBrowser
*/
signals[NEW_WINDOW] = g_signal_new (
"new-window",
G_STRUCT_OFFSET (MidoriBrowserClass, new_window),
0,
NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
+ midori_cclosure_marshal_OBJECT__OBJECT,
+ MIDORI_TYPE_BROWSER, 1,
MIDORI_TYPE_BROWSER);
signals[ADD_TAB] = g_signal_new (
_action_window_new_activate (GtkAction* action,
MidoriBrowser* browser)
{
- MidoriBrowser* new_browser = g_object_new (MIDORI_TYPE_BROWSER, NULL);
- g_signal_emit (browser, signals[NEW_WINDOW], 0, new_browser);
+ MidoriBrowser* new_browser;
+ g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
midori_browser_add_uri (new_browser, "");
midori_browser_activate_action (new_browser, "Location");
}
if (uri && *uri)
{
- MidoriBrowser* new_browser = g_object_new (MIDORI_TYPE_BROWSER, NULL);
- g_signal_emit (browser, signals[NEW_WINDOW], 0, new_browser);
+ MidoriBrowser* new_browser;
+ g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
midori_browser_add_uri (new_browser, uri);
}
}