aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-06 01:53:51 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-06 01:53:51 +0800
commit686b095ac4f6590ae599b2c7d7d087683d09881f (patch)
treeab24678400af3d1cac56898410b27228879954a5
parent4ccc0bb51ea56894f5c8bea291eb16ab1f019acf (diff)
downloadgsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar.gz
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar.bz2
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar.lz
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar.xz
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.tar.zst
gsoc2013-epiphany-686b095ac4f6590ae599b2c7d7d087683d09881f.zip
s/ask download/ask for download
2003-06-05 Marco Pesenti Gritti <marco@it.gnome.org> * data/epiphany.schemas.in: s/ask download/ask for download * lib/egg/egg-editable-toolbar.c: (toolbar_changed_cb), (egg_editable_toolbar_set_model): * lib/egg/egg-toolbars-model.c: (egg_toolbars_model_set_flags), (egg_toolbars_model_class_init): * lib/egg/egg-toolbars-model.h: * lib/egg/eggtoolbar.c: (egg_toolbar_internal_insert_element): Update. * src/ephy-toolbars-model.c: (ephy_toolbars_model_set_flag), (ephy_toolbars_model_unset_flag): * src/ephy-toolbars-model.h: Add a way to set/unset a flag on all toolbars. * src/ephy-window.c: (ephy_window_init), (translate_default_chrome), (update_exit_fullscreen_popup_position), (size_changed_cb), (exit_fullscreen_button_clicked_cb), (ephy_window_fullscreen), (ephy_window_unfullscreen), (ephy_window_set_chrome): Implement an exit fullscreen button. Force toolbars style to be icon only.
-rw-r--r--ChangeLog30
-rw-r--r--data/epiphany.schemas.in4
-rwxr-xr-xlib/egg/egg-editable-toolbar.c23
-rwxr-xr-xlib/egg/egg-toolbars-model.c11
-rwxr-xr-xlib/egg/egg-toolbars-model.h5
-rw-r--r--lib/egg/eggtoolbar.c2
-rwxr-xr-xsrc/ephy-toolbars-model.c40
-rw-r--r--src/ephy-window.c107
8 files changed, 216 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 01be4d0ec..1f3c84eb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,36 @@
2003-06-05 Marco Pesenti Gritti <marco@it.gnome.org>
* data/epiphany.schemas.in:
+
+ s/ask download/ask for download
+
+ * lib/egg/egg-editable-toolbar.c: (toolbar_changed_cb),
+ (egg_editable_toolbar_set_model):
+ * lib/egg/egg-toolbars-model.c: (egg_toolbars_model_set_flags),
+ (egg_toolbars_model_class_init):
+ * lib/egg/egg-toolbars-model.h:
+ * lib/egg/eggtoolbar.c: (egg_toolbar_internal_insert_element):
+
+ Update.
+
+ * src/ephy-toolbars-model.c: (ephy_toolbars_model_set_flag),
+ (ephy_toolbars_model_unset_flag):
+ * src/ephy-toolbars-model.h:
+
+ Add a way to set/unset a flag on all toolbars.
+
+ * src/ephy-window.c: (ephy_window_init),
+ (translate_default_chrome),
+ (update_exit_fullscreen_popup_position), (size_changed_cb),
+ (exit_fullscreen_button_clicked_cb), (ephy_window_fullscreen),
+ (ephy_window_unfullscreen), (ephy_window_set_chrome):
+
+ Implement an exit fullscreen button.
+ Force toolbars style to be icon only.
+
+2003-06-05 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/epiphany.schemas.in:
* embed/ephy-embed-popup.c: (embed_popup_download_link_cmd):
* embed/ephy-embed-utils.c: (ephy_embed_utils_save):
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
index f35d6f19a..3214bed96 100644
--- a/data/epiphany.schemas.in
+++ b/data/epiphany.schemas.in
@@ -77,8 +77,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Ask download destination</short>
- <long>Ask download destination.</long>
+ <short>Ask for download destination</short>
+ <long>Ask for download destination.</long>
</locale>
</schema>
<schema>
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index bf32c54ff..99726faf5 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -366,6 +366,27 @@ create_item (EggEditableToolbar *t,
}
static void
+toolbar_changed_cb (EggToolbarsModel *model,
+ int position,
+ EggEditableToolbar *t)
+{
+ GtkWidget *toolbar;
+ EggTbModelFlags flags;
+
+ flags = egg_toolbars_model_get_flags (model, position);
+ toolbar = get_toolbar_nth (t, position);
+
+ if (flags & EGG_TB_MODEL_ICONS_ONLY)
+ {
+ egg_toolbar_set_style (EGG_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+ }
+ else
+ {
+ egg_toolbar_unset_style (EGG_TOOLBAR (toolbar));
+ }
+}
+
+static void
toolbar_added_cb (EggToolbarsModel *model,
int position,
EggEditableToolbar *t)
@@ -444,6 +465,8 @@ egg_editable_toolbar_set_model (EggEditableToolbar *t,
G_CALLBACK (toolbar_added_cb), t, 0);
g_signal_connect_object (model, "toolbar_removed",
G_CALLBACK (toolbar_removed_cb), t, 0);
+ g_signal_connect_object (model, "toolbar_changed",
+ G_CALLBACK (toolbar_changed_cb), t, 0);
}
static void
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index 94a89ba27..8d8829dcf 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -31,6 +31,7 @@ enum
ITEM_ADDED,
ITEM_REMOVED,
TOOLBAR_ADDED,
+ TOOLBAR_CHANGED,
TOOLBAR_REMOVED,
LAST_SIGNAL
};
@@ -213,6 +214,9 @@ egg_toolbars_model_set_flags (EggToolbarsModel *t,
toolbar = toolbar_node->data;
toolbar->flags = flags;
+
+ g_signal_emit (G_OBJECT (t), egg_toolbars_model_signals[TOOLBAR_CHANGED],
+ 0, toolbar_position);
}
void
@@ -398,6 +402,13 @@ egg_toolbars_model_class_init (EggToolbarsModelClass *klass)
G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_removed),
NULL, NULL, g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT);
+ egg_toolbars_model_signals[TOOLBAR_CHANGED] =
+ g_signal_new ("toolbar_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
}
static void
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index 1440468fc..5d79787b9 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -39,7 +39,8 @@ typedef struct EggToolbarsModelPrivate EggToolbarsModelPrivate;
typedef enum
{
- EGG_TB_MODEL_NOT_REMOVABLE = 1
+ EGG_TB_MODEL_NOT_REMOVABLE = 1,
+ EGG_TB_MODEL_ICONS_ONLY = 2
} EggTbModelFlags;
struct EggToolbarsModel
@@ -61,6 +62,8 @@ struct EggToolbarsModelClass
int position);
void (* toolbar_added) (EggToolbarsModel *group,
int position);
+ void (* toolbar_changed) (EggToolbarsModel *group,
+ int position);
void (* toolbar_removed) (EggToolbarsModel *group,
int position);
diff --git a/lib/egg/eggtoolbar.c b/lib/egg/eggtoolbar.c
index 79344f7d9..6ae9ff4b6 100644
--- a/lib/egg/eggtoolbar.c
+++ b/lib/egg/eggtoolbar.c
@@ -2594,6 +2594,8 @@ egg_toolbar_internal_insert_element (EggToolbar *toolbar,
break;
}
+ gtk_widget_show (GTK_WIDGET (item));
+
if (type == EGG_TOOLBAR_CHILD_BUTTON ||
type == EGG_TOOLBAR_CHILD_RADIOBUTTON ||
type == EGG_TOOLBAR_CHILD_TOGGLEBUTTON)
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index 475de34f7..ca2109c90 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -355,3 +355,43 @@ ephy_toolbars_model_has_bookmark (EphyToolbarsModel *model,
return (position != -1);
}
+
+void
+ephy_toolbars_model_set_flag (EphyToolbarsModel *model,
+ EggTbModelFlags flags)
+{
+ EggToolbarsModel *t = EGG_TOOLBARS_MODEL (model);
+ int i, n_toolbars;
+
+ n_toolbars = egg_toolbars_model_n_toolbars
+ (EGG_TOOLBARS_MODEL (model));
+
+ for (i = 0; i < n_toolbars; i++)
+ {
+ EggTbModelFlags old_flags;
+
+ old_flags = egg_toolbars_model_get_flags (t, i);
+
+ egg_toolbars_model_set_flags (t, old_flags | flags, i);
+ }
+}
+
+void
+ephy_toolbars_model_unset_flag (EphyToolbarsModel *model,
+ EggTbModelFlags flags)
+{
+ EggToolbarsModel *t = EGG_TOOLBARS_MODEL (model);
+ int i, n_toolbars;
+
+ n_toolbars = egg_toolbars_model_n_toolbars
+ (EGG_TOOLBARS_MODEL (model));
+
+ for (i = 0; i < n_toolbars; i++)
+ {
+ EggTbModelFlags old_flags;
+
+ old_flags = egg_toolbars_model_get_flags (t, i);
+
+ egg_toolbars_model_set_flags (t, old_flags ^ flags, i);
+ }
+}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a828b9fc9..69af5e7aa 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -263,6 +263,7 @@ struct EphyWindowPrivate
GtkWidget *main_vbox;
GtkWidget *menu_dock;
GtkWidget *menubar;
+ GtkWidget *exit_fullscreen_popup;
Toolbar *toolbar;
GtkWidget *statusbar;
EggActionGroup *action_group;
@@ -586,6 +587,7 @@ ephy_window_init (EphyWindow *window)
window->priv->chrome_mask = 0;
window->priv->closing = FALSE;
window->priv->ppview_toolbar = NULL;
+ window->priv->exit_fullscreen_popup = NULL;
/* Setup the window and connect verbs */
setup_window (window);
@@ -714,7 +716,8 @@ translate_default_chrome (EmbedChromeMask *chrome_mask)
EMBED_CHROME_OPENASFULLSCREEN);
/* Load defaults */
- if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR))
+ if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR) &&
+ !(*chrome_mask & EMBED_CHROME_OPENASFULLSCREEN))
{
*chrome_mask |= EMBED_CHROME_STATUSBARON;
}
@@ -758,6 +761,104 @@ update_layout_toggles (EphyWindow *window)
mask & EMBED_CHROME_OPENASFULLSCREEN);
}
+static void
+update_exit_fullscreen_popup_position (EphyWindow *window)
+{
+ GdkRectangle screen_rect;
+ int popup_height;
+
+ gtk_window_get_size (GTK_WINDOW (window->priv->exit_fullscreen_popup),
+ NULL, &popup_height);
+
+ gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
+ gdk_screen_get_monitor_at_window
+ (gdk_screen_get_default (),
+ GTK_WIDGET (window)->window),
+ &screen_rect);
+
+ gtk_window_move (GTK_WINDOW (window->priv->exit_fullscreen_popup),
+ screen_rect.x, screen_rect.height - popup_height);
+}
+
+static void
+size_changed_cb (GdkScreen *screen, EphyWindow *window)
+{
+ update_exit_fullscreen_popup_position (window);
+}
+
+static void
+exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
+{
+ EmbedChromeMask mask;
+
+ mask = ephy_window_get_chrome (window);
+
+ mask ^= EMBED_CHROME_OPENASFULLSCREEN;
+ mask |= EMBED_CHROME_DEFAULT;
+
+ ephy_window_set_chrome (window, mask);
+}
+
+static void
+ephy_window_fullscreen (EphyWindow *window)
+{
+ GtkWidget *popup, *button, *icon, *label, *hbox;
+ EphyToolbarsModel *tmodel;
+
+ gtk_window_fullscreen (GTK_WINDOW (window));
+
+ tmodel = ephy_shell_get_toolbars_model (ephy_shell);
+ ephy_toolbars_model_set_flag (tmodel, EGG_TB_MODEL_ICONS_ONLY);
+
+ popup = gtk_window_new (GTK_WINDOW_POPUP);
+ window->priv->exit_fullscreen_popup = popup;
+
+ button = gtk_button_new ();
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (exit_fullscreen_button_clicked_cb),
+ window);
+ gtk_widget_show (button);
+ gtk_container_add (GTK_CONTAINER (popup), button);
+
+ hbox = gtk_hbox_new (FALSE, 2);
+ gtk_widget_show (hbox);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+
+ icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (icon);
+ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Exit Fullscreen"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ update_exit_fullscreen_popup_position (window);
+
+ gtk_widget_show (popup);
+
+ g_signal_connect (G_OBJECT (gdk_screen_get_default ()),
+ "size-changed", G_CALLBACK (size_changed_cb),
+ popup);
+}
+
+static void
+ephy_window_unfullscreen (EphyWindow *window)
+{
+ EphyToolbarsModel *tmodel;
+
+ tmodel = ephy_shell_get_toolbars_model (ephy_shell);
+ ephy_toolbars_model_unset_flag (tmodel, EGG_TB_MODEL_ICONS_ONLY);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()),
+ G_CALLBACK (size_changed_cb),
+ window);
+
+ gtk_widget_destroy (window->priv->exit_fullscreen_popup);
+ window->priv->exit_fullscreen_popup = NULL;
+
+ gtk_window_unfullscreen (GTK_WINDOW (window));
+}
+
void
ephy_window_set_chrome (EphyWindow *window,
EmbedChromeMask flags)
@@ -812,11 +913,11 @@ ephy_window_set_chrome (EphyWindow *window,
save_window_chrome (window);
if (flags & EMBED_CHROME_OPENASFULLSCREEN)
{
- gtk_window_fullscreen (GTK_WINDOW (window));
+ ephy_window_fullscreen (window);
}
else
{
- gtk_window_unfullscreen (GTK_WINDOW (window));
+ ephy_window_unfullscreen (window);
}
}