aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-19 16:50:56 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-19 16:50:56 +0800
commite886e958845ad243debf35139ffa81be9aad3088 (patch)
treef34abd6e2d5a11a346d59b0584e25a0900e7e127 /src
parent3d4cc4657225dcd214857e2c6d9798d881d00623 (diff)
downloadgsoc2013-epiphany-e886e958845ad243debf35139ffa81be9aad3088.tar.gz
gsoc2013-epiphany-e886e958845ad243debf35139ffa81be9aad3088.tar.zst
gsoc2013-epiphany-e886e958845ad243debf35139ffa81be9aad3088.zip
Do not use .in for not to translate files.
2003-09-19 Marco Pesenti Gritti <marco@gnome.org> * data/ui/Makefile.am: * data/ui/epiphany-bookmark-editor-ui.xml.in: * data/ui/epiphany-fs-toolbar.xml: * data/ui/epiphany-history-window-ui.xml.in: * data/ui/epiphany-toolbar.xml.in: * data/ui/epiphany-ui.xml.in: Do not use .in for not to translate files. * lib/egg/egg-editable-toolbar.c: (create_toolbar), (toolbars_clean), (egg_editable_toolbar_construct), (egg_editable_toolbar_set_model), (egg_editable_toolbar_set_merge): * lib/egg/egg-toolbars-model.c: (parse_toolbars): Handle change of properties correctly. Add a toolbar style property in the xml. * src/bookmarks/ephy-bookmark-properties.c: (ephy_bookmark_properties_init): * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_init): * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize), (ephy_shell_get_toolbars_model): * src/ephy-shell.h: * src/ephy-window.c: (ephy_window_fullscreen), (ephy_window_unfullscreen): * src/toolbar.c: (bookmark_destroy_cb), (toolbar_ensure_action), (init_bookmarks_toolbar), (init_normal_mode), (init_fullscreen_mode), (window_state_event_cb), (toolbar_set_window), (toolbar_set_visibility): * src/toolbar.h: * src/window-commands.c: (toolbar_editor_response_cb), (window_cmd_edit_toolbar): Special, more compact, toolbar layout for fullscreen.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-shell.c43
-rw-r--r--src/ephy-shell.h3
-rw-r--r--src/ephy-window.c12
-rwxr-xr-xsrc/toolbar.c77
-rw-r--r--src/toolbar.h1
-rw-r--r--src/window-commands.c4
6 files changed, 100 insertions, 40 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 7e29fd293..2be34fdf6 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -69,6 +69,7 @@ struct EphyShellPrivate
EphyAutocompletion *autocompletion;
EphyBookmarks *bookmarks;
EphyToolbarsModel *toolbars_model;
+ EggToolbarsModel *fs_toolbars_model;
GtkWidget *bme;
GtkWidget *history_window;
GList *plugins;
@@ -204,6 +205,7 @@ ephy_shell_init (EphyShell *gs)
gs->priv->bme = NULL;
gs->priv->history_window = NULL;
gs->priv->toolbars_model = NULL;
+ gs->priv->fs_toolbars_model = NULL;
gs->priv->plugins = NULL;
ephy_shell = gs;
@@ -263,6 +265,12 @@ ephy_shell_finalize (GObject *object)
g_object_unref (G_OBJECT (gs->priv->toolbars_model));
}
+ LOG ("Unref fullscreen toolbars model")
+ if (gs->priv->fs_toolbars_model)
+ {
+ g_object_unref (G_OBJECT (gs->priv->fs_toolbars_model));
+ }
+
LOG ("Unref session")
if (gs->priv->session)
{
@@ -563,21 +571,38 @@ ephy_shell_get_bookmarks (EphyShell *gs)
}
GObject *
-ephy_shell_get_toolbars_model (EphyShell *gs)
+ephy_shell_get_toolbars_model (EphyShell *gs, gboolean fullscreen)
{
- if (gs->priv->toolbars_model == NULL)
+ if (fullscreen)
{
- EphyBookmarks *bookmarks;
-
- bookmarks = ephy_shell_get_bookmarks (gs);
+ if (gs->priv->fs_toolbars_model == NULL)
+ {
+ const char *xml;
- gs->priv->toolbars_model = ephy_toolbars_model_new (bookmarks);
+ gs->priv->fs_toolbars_model = egg_toolbars_model_new ();
+ xml = ephy_file ("epiphany-fs-toolbar.xml");
+ egg_toolbars_model_load (gs->priv->fs_toolbars_model, xml);
+ }
- g_object_set (bookmarks, "toolbars_model",
- gs->priv->toolbars_model, NULL);
+ return G_OBJECT (gs->priv->fs_toolbars_model);
}
+ else
+ {
+ if (gs->priv->toolbars_model == NULL)
+ {
+ EphyBookmarks *bookmarks;
+
+ bookmarks = ephy_shell_get_bookmarks (gs);
- return G_OBJECT (gs->priv->toolbars_model);
+ gs->priv->toolbars_model = ephy_toolbars_model_new (bookmarks);
+
+ g_object_set (bookmarks, "toolbars_model",
+ gs->priv->toolbars_model, NULL);
+ }
+
+
+ return G_OBJECT (gs->priv->toolbars_model);
+ }
}
static void
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index aad9f3808..6f0f1fd10 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -97,7 +97,8 @@ GObject *ephy_shell_get_autocompletion (EphyShell *gs);
EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *gs);
-GObject *ephy_shell_get_toolbars_model (EphyShell *gs);
+GObject *ephy_shell_get_toolbars_model (EphyShell *gs,
+ gboolean fullscreen);
void ephy_shell_show_bookmarks_editor (EphyShell *gs,
GtkWidget *parent);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index f64f310be..1c6ebf531 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -42,7 +42,6 @@
#include "ephy-encoding-menu.h"
#include "ephy-tabs-menu.h"
#include "ephy-stock-icons.h"
-#include "ephy-toolbars-model.h"
#include "session.h"
#include "ephy-favicon-cache.h"
@@ -497,14 +496,9 @@ static void
ephy_window_fullscreen (EphyWindow *window)
{
GtkWidget *popup, *button, *icon, *label, *hbox;
- EphyToolbarsModel *tmodel;
window->priv->is_fullscreen = TRUE;
- tmodel = EPHY_TOOLBARS_MODEL
- (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;
@@ -541,14 +535,8 @@ ephy_window_fullscreen (EphyWindow *window)
static void
ephy_window_unfullscreen (EphyWindow *window)
{
- EphyToolbarsModel *tmodel;
-
window->priv->is_fullscreen = FALSE;
- tmodel = EPHY_TOOLBARS_MODEL
- (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);
diff --git a/src/toolbar.c b/src/toolbar.c
index dc905c427..326a47f71 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -144,7 +144,7 @@ bookmark_destroy_cb (EphyNode *node,
long id;
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
id = ephy_node_get_id (node);
name = ephy_toolbars_model_get_action_name (model, id);
@@ -167,7 +167,7 @@ toolbar_ensure_action (Toolbar *t,
EphyNode *bmks, *topics;
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
bmks = ephy_bookmarks_get_bookmarks (bookmarks);
topics = ephy_bookmarks_get_keywords (bookmarks);
@@ -373,7 +373,7 @@ init_bookmarks_toolbar (Toolbar *t)
int i, n_toolbars;
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
n_toolbars = egg_toolbars_model_n_toolbars
(EGG_TOOLBARS_MODEL (model));
@@ -461,10 +461,61 @@ location_user_changed_cb (GtkWidget *entry, Toolbar *t)
}
static void
-toolbar_set_window (Toolbar *t, EphyWindow *window)
+init_normal_mode (Toolbar *t)
{
EphyToolbarsModel *model;
+ model = EPHY_TOOLBARS_MODEL
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
+ g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_added",
+ G_CALLBACK (update_toolbar_remove_flag),
+ NULL);
+ g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_removed",
+ G_CALLBACK (update_toolbar_remove_flag),
+ NULL);
+ g_object_set (G_OBJECT (t),
+ "ToolbarsModel", model,
+ NULL);
+ init_bookmarks_toolbar (t);
+}
+
+static void
+init_fullscreen_mode (Toolbar *t)
+{
+ EggToolbarsModel *model;
+
+ model = EGG_TOOLBARS_MODEL
+ (ephy_shell_get_toolbars_model (ephy_shell, TRUE));
+
+ g_object_set (G_OBJECT (t),
+ "ToolbarsModel", model,
+ NULL);
+}
+
+static gboolean
+window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, Toolbar *t)
+{
+ if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+ {
+ gboolean fullscreen;
+
+ fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
+ if (fullscreen)
+ {
+ init_fullscreen_mode (t);
+ }
+ else
+ {
+ init_normal_mode (t);
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+toolbar_set_window (Toolbar *t, EphyWindow *window)
+{
g_return_if_fail (t->priv->window == NULL);
t->priv->window = window;
@@ -473,24 +524,18 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
toolbar_setup_actions (t);
gtk_ui_manager_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 1);
-
g_signal_connect (t, "action_request",
G_CALLBACK (action_request_cb),
NULL);
+ g_signal_connect_object (window, "window-state-event",
+ G_CALLBACK (window_state_event_cb),
+ t, 0);
- model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
- g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_added",
- G_CALLBACK (update_toolbar_remove_flag),
- NULL);
- g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_removed",
- G_CALLBACK (update_toolbar_remove_flag),
- NULL);
g_object_set (G_OBJECT (t),
- "ToolbarsModel", model,
"MenuMerge", t->priv->ui_merge,
NULL);
- init_bookmarks_toolbar (t);
+
+ init_normal_mode (t);
g_signal_connect_object (get_location_entry (t), "user_changed",
G_CALLBACK (location_user_changed_cb),
@@ -673,7 +718,7 @@ toolbar_set_visibility (Toolbar *t,
int i, n_toolbars;
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
n_toolbars = egg_toolbars_model_n_toolbars
(EGG_TOOLBARS_MODEL (model));
diff --git a/src/toolbar.h b/src/toolbar.h
index 1ca62e439..a9d598ae8 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -71,6 +71,7 @@ void toolbar_update_navigation_actions (Toolbar *t,
gboolean back,
gboolean forward,
gboolean up);
+
void toolbar_update_zoom (Toolbar *t,
float zoom);
diff --git a/src/window-commands.c b/src/window-commands.c
index e922c3dbc..b111ef50f 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -663,7 +663,7 @@ toolbar_editor_response_cb (GtkDialog *dialog,
break;
case RESPONSE_ADD_TOOLBAR:
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
n = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model));
egg_toolbars_model_add_toolbar (EGG_TOOLBARS_MODEL (model),
n - 1, "UserCreated");
@@ -684,7 +684,7 @@ window_cmd_edit_toolbar (GtkAction *action,
GtkWidget *dialog;
model = EPHY_TOOLBARS_MODEL
- (ephy_shell_get_toolbars_model (ephy_shell));
+ (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
t = ephy_window_get_toolbar (window);
dialog = gtk_dialog_new ();