midori_view_new_view_cb (GtkWidget* view,
GtkWidget* new_view,
MidoriNewView where,
+ gboolean user_initiated,
MidoriBrowser* browser)
{
midori_browser_view_copy_history (new_view, view, TRUE);
if (where != MIDORI_NEW_VIEW_BACKGROUND)
midori_browser_set_current_page (browser, n);
}
+
+ if (!user_initiated)
+ {
+ GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (browser));
+ GdkWindowState state = gdk_window_get_state (window);
+ if ((state | GDK_WINDOW_STATE_MAXIMIZED)
+ || (state | GDK_WINDOW_STATE_FULLSCREEN))
+ {
+ if (where == MIDORI_NEW_VIEW_WINDOW)
+ g_signal_emit (browser, signals[SEND_NOTIFICATION], 0,
+ _("New Window"), _("A new window has been opened"));
+ else if (!browser->show_tabs)
+ g_signal_emit (browser, signals[SEND_NOTIFICATION], 0,
+ _("New Tab"), _("A new tab has been opened"));
+ }
+ }
}
#if WEBKIT_CHECK_VERSION (1, 1, 3)
* @message: the message for the notification
*
* Emitted when a browser wants to display a notification message,
- * e.g. when a download has been completed.
+ * e.g. when a download has been completed or a new tab was opened.
*
* Since: 0.1.7
*/
GtkWidget* new_view = midori_view_new_with_title (
NULL, browser->settings, FALSE);
const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view));
- g_signal_emit_by_name (view, "new-view", new_view, where);
+ g_signal_emit_by_name (view, "new-view", new_view, where, TRUE);
midori_view_set_uri (MIDORI_VIEW (new_view), uri);
}
* @view: the object on which the signal is emitted
* @new_view: a newly created view
* @where: where to open the view
+ * @user_initiated: %TRUE if the user actively opened the new view
*
* Emitted when a new view is created. The value of
* @where determines where to open the view according
* to how it was opened and user preferences.
*
* Since: 0.1.2
+ *
+ * Since 0.3.4 a boolean argument was added.
*/
signals[NEW_VIEW] = g_signal_new (
"new-view",
0,
0,
NULL,
- midori_cclosure_marshal_VOID__OBJECT_ENUM,
- G_TYPE_NONE, 2,
+ midori_cclosure_marshal_VOID__OBJECT_ENUM_BOOLEAN,
+ G_TYPE_NONE, 3,
MIDORI_TYPE_VIEW,
- MIDORI_TYPE_NEW_VIEW);
+ MIDORI_TYPE_NEW_VIEW,
+ G_TYPE_BOOLEAN);
/**
* MidoriView::download-requested:
where = MIDORI_NEW_VIEW_WINDOW;
gtk_widget_show (new_view);
- g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
+ g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where, FALSE);
return TRUE;
}
GtkWidget* new_view = midori_view_new_with_title (
NULL, view->settings, FALSE);
const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view));
- g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
+ g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where, TRUE);
midori_view_set_uri (MIDORI_VIEW (new_view), uri);
}