epiphany r8278 - in trunk: data/ui lib src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: epiphany r8278 - in trunk: data/ui lib src
- Date: Thu, 12 Jun 2008 17:21:16 +0000 (UTC)
Author: chpe
Date: Thu Jun 12 17:21:16 2008
New Revision: 8278
URL: http://svn.gnome.org/viewvc/epiphany?rev=8278&view=rev
Log:
Reimplement tabs detaching and tabs DND.
Modified:
trunk/data/ui/epiphany-ui.xml
trunk/lib/ephy-module.c
trunk/src/ephy-lockdown.c
trunk/src/ephy-notebook.c
trunk/src/ephy-window.c
trunk/src/window-commands.c
Modified: trunk/data/ui/epiphany-ui.xml
==============================================================================
--- trunk/data/ui/epiphany-ui.xml (original)
+++ trunk/data/ui/epiphany-ui.xml Thu Jun 12 17:21:16 2008
@@ -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>
Modified: trunk/lib/ephy-module.c
==============================================================================
--- trunk/lib/ephy-module.c (original)
+++ trunk/lib/ephy-module.c Thu Jun 12 17:21:16 2008
@@ -152,6 +152,9 @@
if (module->type == 0)
{
+ g_warning ("Failed to register the GType(s)!");
+ g_module_close (module->library);
+
return FALSE;
}
Modified: trunk/src/ephy-lockdown.c
==============================================================================
--- trunk/src/ephy-lockdown.c (original)
+++ trunk/src/ephy-lockdown.c Thu Jun 12 17:21:16 2008
@@ -212,6 +212,9 @@
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));
Modified: trunk/src/ephy-notebook.c
==============================================================================
--- trunk/src/ephy-notebook.c (original)
+++ trunk/src/ephy-notebook.c Thu Jun 12 17:21:16 2008
@@ -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 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 @@
}
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 @@
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 @@
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 @@
position);
gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE);
+ gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE);
return position;
}
Modified: trunk/src/ephy-window.c
==============================================================================
--- trunk/src/ephy-window.c (original)
+++ trunk/src/ephy-window.c Thu Jun 12 17:21:16 2008
@@ -254,6 +254,9 @@
{ "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 @@
guint should_save_chrome : 1;
guint is_popup : 1;
+ guint present_on_insert : 1;
+
guint key_theme_is_emacs : 1;
};
@@ -2539,6 +2544,9 @@
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 @@
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 @@
/* 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 @@
}
}
+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 @@
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);
Modified: trunk/src/window-commands.c
==============================================================================
--- trunk/src/window-commands.c (original)
+++ trunk/src/window-commands.c Thu Jun 12 17:21:16 2008
@@ -968,6 +968,30 @@
}
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]