aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-notebook.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-04-18 03:39:00 +0800
committerChristian Persch <chpe@src.gnome.org>2005-04-18 03:39:00 +0800
commitffdcb7ffd0191129ccee3d377cae306c81b10594 (patch)
tree239f51f3a48167e9278a8b810a2f2054d9694723 /src/ephy-notebook.c
parent7b8fb927ca8c223ba51294bf52ab865b067bd774 (diff)
downloadgsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar.gz
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar.bz2
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar.lz
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar.xz
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.tar.zst
gsoc2013-epiphany-ffdcb7ffd0191129ccee3d377cae306c81b10594.zip
Rework popup windows. Introduce "is-popup" property on EphyWindow to
2005-04-17 Christian Persch <chpe@cvs.gnome.org> * src/ephy-automation.c: (impl_ephy_automation_loadUrlWithStartupId): * src/ephy-notebook.c: (ephy_notebook_set_dnd_enabled), (ephy_notebook_get_property), (ephy_notebook_set_property), (ephy_notebook_class_init), (move_tab_to_another_notebook), (button_press_cb), (ephy_notebook_init): * src/ephy-notebook.h: * src/ephy-session.c: (ephy_session_get_active_window): * src/ephy-shell.c: (ephy_shell_new_window_cb), (ephy_shell_new_tab_full), (ephy_shell_new_tab): * src/ephy-shell.h: * src/ephy-tab.c: (ephy_tab_class_init), (popups_manager_new_window_info), (ephy_tab_dispose), (ephy_tab_finalize), (let_me_resize_hack), (ephy_tab_set_size), (ephy_tab_init): * src/ephy-tab.h: * src/ephy-window.c: (get_chromes_visibility), (sync_chromes_visibility), (update_chromes_actions), (update_actions_sensitivity), (sync_tab_visibility), (show_embed_popup), (let_me_resize_hack), (tab_size_to_cb), (ephy_window_set_active_tab), (ephy_window_set_chrome), (ephy_window_set_is_popup), (ephy_window_dispose), (ephy_window_set_property), (ephy_window_get_property), (ephy_window_class_init), (ephy_window_init), (ephy_window_constructor), (ephy_window_new_with_chrome), (ephy_window_set_print_preview), (ephy_window_add_tab), (ephy_window_show), (ephy_window_view_popup_windows_cb), (ephy_window_get_is_popup): * src/ephy-window.h: Rework popup windows. Introduce "is-popup" property on EphyWindow to indicate a window who will only have one tab, and can be resized by javascript calls. Fixes bug #136288 and #155395.
Diffstat (limited to 'src/ephy-notebook.c')
-rw-r--r--src/ephy-notebook.c100
1 files changed, 93 insertions, 7 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 02bf907f6..8ba8c29ba 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -67,9 +67,12 @@ struct _EphyNotebookPrivate
GtkTooltips *title_tips;
guint tabs_vis_notifier_id;
gulong motion_notify_handler_id;
- gint x_start, y_start;
- gboolean drag_in_progress;
- gboolean show_tabs;
+ int x_start;
+ int y_start;
+
+ guint drag_in_progress : 1;
+ guint show_tabs : 1;
+ guint dnd_enabled : 1;
};
static void ephy_notebook_init (EphyNotebook *notebook);
@@ -92,6 +95,13 @@ static guint n_url_drag_types = G_N_ELEMENTS (url_drag_types);
enum
{
+ PROP_0,
+ PROP_DND_ENABLED,
+ PROP_SHOW_TABS
+};
+
+enum
+{
TAB_ADDED,
TAB_REMOVED,
TABS_REORDERED,
@@ -142,6 +152,57 @@ ephy_notebook_get_type (void)
return type;
}
+void
+ephy_notebook_set_dnd_enabled (EphyNotebook *notebook,
+ gboolean enabled)
+{
+ EphyNotebookPrivate *priv = notebook->priv;
+
+ priv->dnd_enabled = enabled;
+ /* FIXME abort any DNDs in progress */
+
+ g_object_notify (G_OBJECT (notebook), "dnd-enabled");
+}
+
+static void
+ephy_notebook_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNotebook *notebook = EPHY_NOTEBOOK (object);
+ EphyNotebookPrivate *priv = notebook->priv;
+
+ switch (prop_id)
+ {
+ case PROP_DND_ENABLED:
+ g_value_set_boolean (value, priv->dnd_enabled);
+ break;
+ case PROP_SHOW_TABS:
+ g_value_set_boolean (value, priv->show_tabs);
+ break;
+ }
+}
+
+static void
+ephy_notebook_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNotebook *notebook = EPHY_NOTEBOOK (object);
+
+ switch (prop_id)
+ {
+ case PROP_DND_ENABLED:
+ ephy_notebook_set_dnd_enabled (notebook, g_value_get_boolean (value));
+ break;
+ case PROP_SHOW_TABS:
+ ephy_notebook_set_show_tabs (notebook, g_value_get_boolean (value));
+ break;
+ }
+}
+
static void
ephy_notebook_class_init (EphyNotebookClass *klass)
{
@@ -150,6 +211,8 @@ ephy_notebook_class_init (EphyNotebookClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = ephy_notebook_finalize;
+ object_class->get_property = ephy_notebook_get_property;
+ object_class->set_property = ephy_notebook_set_property;
signals[TAB_ADDED] =
g_signal_new ("tab_added",
@@ -201,7 +264,23 @@ ephy_notebook_class_init (EphyNotebookClass *klass)
1,
EPHY_TYPE_TAB);
- g_type_class_add_private (object_class, sizeof(EphyNotebookPrivate));
+ g_object_class_install_property (object_class,
+ PROP_DND_ENABLED,
+ g_param_spec_boolean ("dnd-enabled",
+ "DND enabled",
+ "Whether the notebook allows tab reordering by DND",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_SHOW_TABS,
+ g_param_spec_boolean ("show-tabs",
+ "Show tabs",
+ "Whether the notebook shows the tabs bar",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (object_class, sizeof (EphyNotebookPrivate));
}
static EphyNotebook *
@@ -476,6 +555,9 @@ move_tab_to_another_notebook (EphyNotebook *src,
g_assert (EPHY_IS_NOTEBOOK (dest));
g_assert (dest != src);
+ /* Check if the dest notebook can accept the drag */
+ if (!dest->priv->dnd_enabled) return;
+
cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src));
tab = EPHY_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page));
@@ -543,10 +625,13 @@ button_press_cb (EphyNotebook *notebook,
GdkEventButton *event,
gpointer data)
{
- gint tab_clicked = find_tab_num_at_pos (notebook,
- event->x_root,
- event->y_root);
+ int tab_clicked;
+
+ if (!notebook->priv->dnd_enabled) return FALSE;
+
+ tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root);
+ /* FIXME: how could there be a drag in progress!? */
if (notebook->priv->drag_in_progress)
{
return TRUE;
@@ -705,6 +790,7 @@ ephy_notebook_init (EphyNotebook *notebook)
gtk_object_sink (GTK_OBJECT (notebook->priv->title_tips));
notebook->priv->show_tabs = TRUE;
+ notebook->priv->dnd_enabled = TRUE;
g_signal_connect (notebook, "button-press-event",
(GCallback)button_press_cb, NULL);