diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-22 04:27:35 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-22 04:27:35 +0800 |
commit | e2eae63203dae33b0b72ed369d879be2c9179a26 (patch) | |
tree | 2320f4cc06be6e9644a55b03c6fc5191cf727314 /src | |
parent | e9f5eff3e812dab2c9f8aaddf13c7540f309a5ee (diff) | |
download | gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar.gz gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar.bz2 gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar.lz gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar.xz gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.tar.zst gsoc2013-epiphany-e2eae63203dae33b0b72ed369d879be2c9179a26.zip |
Fix chromes
2003-01-21 Marco Pesenti Gritti <marco@it.gnome.org>
* data/ui/epiphany-ui.xml.in:
* lib/egg/egg-menu-merge.c: (do_updates):
* src/ephy-spinner-action.c: (create_tool_item):
* src/ephy-window.c: (add_widget), (ephy_window_init),
(ephy_window_finalize), (update_layout_toggles),
(ephy_window_set_chrome):
* src/toolbar.c: (toolbar_set_window), (toolbar_new):
* src/toolbar.h:
* src/window-commands.c: (window_cmd_view_toolbar),
(window_cmd_view_statusbar), (window_cmd_view_fullscreen):
* src/window-commands.h:
Fix chromes
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-spinner-action.c | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 55 | ||||
-rwxr-xr-x | src/toolbar.c | 12 | ||||
-rw-r--r-- | src/toolbar.h | 3 | ||||
-rw-r--r-- | src/window-commands.c | 47 | ||||
-rw-r--r-- | src/window-commands.h | 3 |
6 files changed, 100 insertions, 22 deletions
diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c index 84d0e3cee..3e990f49b 100644 --- a/src/ephy-spinner-action.c +++ b/src/ephy-spinner-action.c @@ -95,7 +95,7 @@ create_tool_item (EggAction *action) gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (item), button); spinner = ephy_spinner_new (); - ephy_spinner_set_small_mode (spinner, TRUE); + ephy_spinner_set_small_mode (EPHY_SPINNER (spinner), TRUE); gtk_container_add (GTK_CONTAINER (button), spinner); egg_tool_item_set_pack_end (EGG_TOOL_ITEM (item), TRUE); egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (item), FALSE); diff --git a/src/ephy-window.c b/src/ephy-window.c index 76509dd95..bf88d72e9 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -37,6 +37,7 @@ #include "statusbar.h" #include "toolbar.h" #include "popup-commands.h" +#include "egg-toggle-action.h" #include <string.h> #include <libgnome/gnome-i18n.h> @@ -139,10 +140,13 @@ static EggActionGroupEntry ephy_menu_entries [] = { { "ViewReload", N_("_Reload"), GTK_STOCK_REFRESH, "<control>R", N_("Display the latest content of the current page"), G_CALLBACK (window_cmd_view_reload), NULL }, + { "ViewToolbar", N_("_Toolbar"), NULL, "<shift><control>T", + N_("Show or hide toolbar"), + G_CALLBACK (window_cmd_view_toolbar), NULL, TOGGLE_ACTION }, { "ViewStatusbar", N_("St_atusbar"), NULL, NULL, N_("Show or hide statusbar"), G_CALLBACK (window_cmd_view_statusbar), NULL, TOGGLE_ACTION }, - { "ViewFullscreen", N_("_Fullscreen"), NULL, NULL, + { "ViewFullscreen", N_("_Fullscreen"), NULL, "F11", N_("Browse at full screen"), G_CALLBACK (window_cmd_view_fullscreen), NULL, TOGGLE_ACTION}, { "ViewZoomIn", N_("Zoom _In"), GTK_STOCK_ZOOM_IN, "<control>plus", @@ -260,6 +264,7 @@ struct EphyWindowPrivate GtkWidget *main_vbox; GtkWidget *menubar; Toolbar *toolbar; + GList *toolbars; GtkWidget *statusbar; EggActionGroup *action_group; EggActionGroup *popups_action_group; @@ -272,7 +277,6 @@ struct EphyWindowPrivate EphyDialog *history_dialog; EphyDialog *history_sidebar; EmbedChromeMask chrome_mask; - gboolean ignore_layout_toggles; gboolean has_default_size; gboolean closing; }; @@ -419,10 +423,14 @@ add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window) { window->priv->menubar = widget; } + else + { + window->priv->toolbars = g_list_append + (window->priv->toolbars, widget); + } gtk_box_pack_start (GTK_BOX (window->priv->main_vbox), widget, FALSE, FALSE, 0); - gtk_widget_show (widget); } static void @@ -523,10 +531,10 @@ ephy_window_init (EphyWindow *window) window->priv = g_new0 (EphyWindowPrivate, 1); window->priv->active_tab = NULL; window->priv->chrome_mask = 0; - window->priv->ignore_layout_toggles = FALSE; window->priv->closing = FALSE; window->priv->has_default_size = FALSE; window->priv->ppview_toolbar = NULL; + window->priv->toolbars = NULL; cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); g_signal_connect_object (G_OBJECT (cache), @@ -628,6 +636,11 @@ ephy_window_finalize (GObject *object) g_object_unref (window->priv->ppview_toolbar); } + if (window->priv->toolbars) + { + g_list_free (window->priv->toolbars); + } + g_free (window->priv); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -740,6 +753,26 @@ translate_default_chrome (EmbedChromeMask *chrome_mask) } } +static void +update_layout_toggles (EphyWindow *window) +{ + EggActionGroup *action_group = EGG_ACTION_GROUP (window->priv->action_group); + EmbedChromeMask mask = window->priv->chrome_mask; + EggAction *action; + + action = egg_action_group_get_action (action_group, "ViewToolbar"); + egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), + mask & EMBED_CHROME_TOOLBARON); + + action = egg_action_group_get_action (action_group, "ViewStatusbar"); + egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), + mask & EMBED_CHROME_STATUSBARON); + + action = egg_action_group_get_action (action_group, "ViewFullscreen"); + egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), + mask & EMBED_CHROME_OPENASFULLSCREEN); +} + void ephy_window_set_chrome (EphyWindow *window, EmbedChromeMask flags) @@ -758,8 +791,16 @@ ephy_window_set_chrome (EphyWindow *window, gtk_widget_hide (window->priv->menubar); } - toolbar_set_visibility (window->priv->toolbar, - flags & EMBED_CHROME_TOOLBARON); + if (flags & EMBED_CHROME_TOOLBARON) + { + g_list_foreach (window->priv->toolbars, + (GFunc)gtk_widget_show, NULL); + } + else + { + g_list_foreach (window->priv->toolbars, + (GFunc)gtk_widget_hide, NULL); + } if (flags & EMBED_CHROME_STATUSBARON) { @@ -796,6 +837,8 @@ ephy_window_set_chrome (EphyWindow *window, window->priv->chrome_mask = flags; + update_layout_toggles (window); + save_window_chrome (window); } diff --git a/src/toolbar.c b/src/toolbar.c index 51cf64b5f..e81163f86 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -156,11 +156,6 @@ toolbar_setup_widgets (Toolbar *t) } static void -add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window) -{ -} - -static void go_location_cb (EggAction *action, char *location, EphyWindow *window) { EphyEmbed *embed; @@ -243,8 +238,6 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) t->priv->window = window; t->priv->ui_merge = EGG_MENU_MERGE (window->ui_merge); - g_signal_connect (t->priv->ui_merge, "add_widget", - G_CALLBACK (add_widget), t); toolbar_setup_actions (t); egg_menu_merge_insert_action_group (t->priv->ui_merge, @@ -298,11 +291,6 @@ toolbar_new (EphyWindow *window) } void -toolbar_set_visibility (Toolbar *t, gboolean visibility) -{ -} - -void toolbar_activate_location (Toolbar *t) { EggAction *action; diff --git a/src/toolbar.h b/src/toolbar.h index 63ebff824..15cfa855a 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -50,9 +50,6 @@ GType toolbar_get_type (void); Toolbar *toolbar_new (EphyWindow *window); -void toolbar_set_visibility (Toolbar *t, - gboolean visibility); - void toolbar_spinner_start (Toolbar *t); void toolbar_spinner_stop (Toolbar *t); diff --git a/src/window-commands.c b/src/window-commands.c index ece083b35..a8957a0ed 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -28,6 +28,7 @@ #include "pdm-dialog.h" #include "ephy-bookmarks-editor.h" #include "ephy-new-bookmark.h" +#include "egg-toggle-action.h" #include <string.h> #include <libgnomevfs/gnome-vfs-uri.h> @@ -494,15 +495,61 @@ window_cmd_edit_find_prev (EggAction *action, } void +window_cmd_view_toolbar (EggAction *action, + EphyWindow *window) +{ + EmbedChromeMask mask; + gboolean active; + gboolean current_state; + + mask = ephy_window_get_chrome (window); + active = EGG_TOGGLE_ACTION (action)->active; + current_state = (mask & EMBED_CHROME_TOOLBARON) > 0; + + if (active != current_state) + { + mask ^= EMBED_CHROME_TOOLBARON; + ephy_window_set_chrome (window, mask); + } +} + +void window_cmd_view_statusbar (EggAction *action, EphyWindow *window) { + EmbedChromeMask mask; + gboolean active; + gboolean current_state; + + mask = ephy_window_get_chrome (window); + active = EGG_TOGGLE_ACTION (action)->active; + current_state = (mask & EMBED_CHROME_STATUSBARON) > 0; + + if (active != current_state) + { + mask ^= EMBED_CHROME_STATUSBARON; + ephy_window_set_chrome (window, mask); + } } void window_cmd_view_fullscreen (EggAction *action, EphyWindow *window) { + EmbedChromeMask mask; + gboolean active; + gboolean current_state; + + mask = ephy_window_get_chrome (window); + active = EGG_TOGGLE_ACTION (action)->active; + current_state = (mask & EMBED_CHROME_OPENASFULLSCREEN) > 0; + + if (active != current_state) + { + mask ^= EMBED_CHROME_OPENASFULLSCREEN; + mask |= EMBED_CHROME_DEFAULT; + ephy_window_set_chrome (window, mask); + } } void diff --git a/src/window-commands.h b/src/window-commands.h index bf733897c..c6c5a333f 100644 --- a/src/window-commands.h +++ b/src/window-commands.h @@ -104,6 +104,9 @@ void window_cmd_edit_find_prev (EggAction *action, void window_cmd_view_statusbar (EggAction *action, EphyWindow *window); +void window_cmd_view_toolbar (EggAction *action, + EphyWindow *window); + void window_cmd_view_fullscreen (EggAction *action, EphyWindow *window); |