aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/ui/epiphany-ui.xml2
-rw-r--r--lib/ephy-module.c3
-rw-r--r--src/ephy-lockdown.c3
-rw-r--r--src/ephy-notebook.c35
-rw-r--r--src/ephy-window.c42
-rw-r--r--src/window-commands.c24
6 files changed, 97 insertions, 12 deletions
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 9bcf8ca9d..1f3dcaceb 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -94,7 +94,7 @@
<menuitem name="TabsMoveLeftMenu" action="TabsMoveLeft"/>
<menuitem name="TabsMoveRightMenu" action="TabsMoveRight"/>
</placeholder>
- <!-- <menuitem name="TabsDetachMenu" action="TabsDetach"/> -->
+ <menuitem name="TabsDetach" action="TabsDetach"/>
<placeholder name="TabsOpen">
<separator name="TabsSep2"/>
</placeholder>
diff --git a/lib/ephy-module.c b/lib/ephy-module.c
index 86fa9bbe6..7e6040414 100644
--- a/lib/ephy-module.c
+++ b/lib/ephy-module.c
@@ -152,6 +152,9 @@ ephy_module_load (GTypeModule *gmodule)
if (module->type == 0)
{
+ g_warning ("Failed to register the GType(s)!");
+ g_module_close (module->library);
+
return FALSE;
}
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 62f840b20..acc8c2271 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -212,6 +212,9 @@ update_window (EphyWindow *window,
action = gtk_action_group_get_action (action_group, "ViewFullscreen");
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen);
+ action = gtk_action_group_get_action (action_group, "TabsDetach");
+ ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen);
+
if (fullscreen)
{
gtk_window_fullscreen (GTK_WINDOW (window));
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 091c83ff9..e7c0a6c48 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -45,6 +45,8 @@
#define INSANE_NUMBER_OF_URLS 20
+#define EPHY_NOTEBOOK_TAB_GROUP_ID (GUINT_TO_POINTER (42))
+
#define EPHY_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NOTEBOOK, EphyNotebookPrivate))
struct _EphyNotebookPrivate
@@ -69,8 +71,9 @@ static void ephy_notebook_remove (GtkContainer *container,
static const GtkTargetEntry url_drag_types [] =
{
+ { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
{ EPHY_DND_URI_LIST_TYPE, 0, 0 },
- { EPHY_DND_URL_TYPE, 0, 1 }
+ { EPHY_DND_URL_TYPE, 0, 1 },
};
enum
@@ -349,13 +352,21 @@ ephy_notebook_switch_page_cb (GtkNotebook *notebook,
}
static void
-notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *selection_data,
- guint info, guint time, EphyEmbed *embed)
+notebook_drag_data_received_cb (GtkWidget* widget,
+ GdkDragContext *context,
+ int x,
+ int y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ EphyEmbed *embed)
{
EphyWindow *window;
GtkWidget *notebook;
+ if (selection_data->target == gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB"))
+ return;
+
g_signal_stop_emission_by_name (widget, "drag_data_received");
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) return;
@@ -442,12 +453,15 @@ static void
ephy_notebook_init (EphyNotebook *notebook)
{
EphyNotebookPrivate *priv;
+ GtkWidget *widget = GTK_WIDGET (notebook);
+ GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);
priv = notebook->priv = EPHY_NOTEBOOK_GET_PRIVATE (notebook);
- gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
+ gtk_notebook_set_scrollable (gnotebook, TRUE);
+ gtk_notebook_set_show_border (gnotebook, FALSE);
+ gtk_notebook_set_show_tabs (gnotebook, FALSE);
+ gtk_notebook_set_group (gnotebook, EPHY_NOTEBOOK_TAB_GROUP_ID);
priv->show_tabs = TRUE;
priv->dnd_enabled = TRUE;
@@ -462,12 +476,10 @@ ephy_notebook_init (EphyNotebook *notebook)
g_signal_connect (notebook, "drag-data-received",
G_CALLBACK (notebook_drag_data_received_cb),
NULL);
- gtk_drag_dest_set (GTK_WIDGET (notebook),
- GTK_DEST_DEFAULT_MOTION |
- GTK_DEST_DEFAULT_DROP,
+ gtk_drag_dest_set (widget, 0,
url_drag_types, G_N_ELEMENTS (url_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
- gtk_drag_dest_add_text_targets (GTK_WIDGET(notebook));
+ gtk_drag_dest_add_text_targets (widget);
priv->tabs_vis_notifier_id = eel_gconf_notification_add
(CONF_ALWAYS_SHOW_TABS_BAR,
@@ -699,6 +711,7 @@ ephy_notebook_insert_page (GtkNotebook *gnotebook,
position);
gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE);
+ gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE);
return position;
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 45a3ee7d5..ab4edcb14 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -254,6 +254,9 @@ static const GtkActionEntry ephy_menu_entries [] = {
{ "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down",
N_("Move current tab to right"),
G_CALLBACK (window_cmd_tabs_move_right) },
+ { "TabsDetach", NULL, N_("_Detach Tab"), NULL,
+ N_("Detach current tab"),
+ G_CALLBACK (window_cmd_tabs_detach) },
/* Help menu */
@@ -457,6 +460,8 @@ struct _EphyWindowPrivate
guint should_save_chrome : 1;
guint is_popup : 1;
+ guint present_on_insert : 1;
+
guint key_theme_is_emacs : 1;
};
@@ -2539,6 +2544,9 @@ update_tabs_menu_sensitivity (EphyWindow *window)
gtk_action_set_sensitive (action, not_first);
action = gtk_action_group_get_action (action_group, "TabsMoveRight");
gtk_action_set_sensitive (action, not_last);
+
+ action = gtk_action_group_get_action (action_group, "TabsDetach");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, n_pages <= 1);
}
static gboolean
@@ -2698,6 +2706,13 @@ notebook_popup_menu_cb (GtkNotebook *notebook,
return FALSE;
}
+static gboolean
+present_on_idle_cb (GtkWindow *window)
+{
+ gtk_window_present (window);
+ return FALSE;
+}
+
static void
notebook_page_added_cb (EphyNotebook *notebook,
EphyEmbed *embed,
@@ -2730,6 +2745,12 @@ notebook_page_added_cb (EphyNotebook *notebook,
/* Let the extensions attach themselves to the tab */
manager = EPHY_EXTENSION (ephy_shell_get_extensions_manager (ephy_shell));
ephy_extension_attach_tab (manager, window, embed);
+
+ if (priv->present_on_insert)
+ {
+ priv->present_on_insert = FALSE;
+ g_idle_add ((GSourceFunc) present_on_idle_cb, g_object_ref (window));
+ }
}
static void
@@ -2799,6 +2820,24 @@ notebook_page_close_request_cb (EphyNotebook *notebook,
}
}
+static GtkWidget *
+notebook_create_window_cb (GtkNotebook *notebook,
+ GtkWidget *page,
+ int x,
+ int y,
+ EphyWindow *window)
+{
+ EphyWindow *new_window;
+ EphyWindowPrivate *new_priv;
+
+ new_window = ephy_window_new ();
+ new_priv = new_window->priv;
+
+ new_priv->present_on_insert = TRUE;
+
+ return ephy_window_get_notebook (new_window);
+}
+
static GtkNotebook *
setup_notebook (EphyWindow *window)
{
@@ -2809,6 +2848,9 @@ setup_notebook (EphyWindow *window)
g_signal_connect_after (notebook, "switch-page",
G_CALLBACK (notebook_switch_page_cb),
window);
+ g_signal_connect (notebook, "create-window",
+ G_CALLBACK (notebook_create_window_cb),
+ window);
g_signal_connect (notebook, "popup-menu",
G_CALLBACK (notebook_popup_menu_cb), window);
diff --git a/src/window-commands.c b/src/window-commands.c
index e2f31f00f..d9e15d913 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -968,6 +968,30 @@ void window_cmd_tabs_move_right (GtkAction *action,
}
void
+window_cmd_tabs_detach (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbed *embed;
+ GtkNotebook *notebook;
+ EphyWindow *new_window;
+
+ notebook = GTK_NOTEBOOK (ephy_window_get_notebook (window));
+ if (gtk_notebook_get_n_pages (notebook) <= 1)
+ return;
+
+ embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+
+ g_object_ref_sink (embed);
+ gtk_notebook_remove_page (notebook, gtk_notebook_page_num (notebook, GTK_WIDGET (embed)));
+
+ new_window = ephy_window_new ();
+ ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (new_window), embed, 0, FALSE);
+ g_object_unref (embed);
+
+ gtk_window_present (GTK_WINDOW (new_window));
+}
+
+void
window_cmd_load_location (GtkAction *action,
EphyWindow *window)
{