aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-12-19 03:40:08 +0800
committerChristian Persch <chpe@src.gnome.org>2004-12-19 03:40:08 +0800
commit0a389e07241775316dfb866341a1a3c9f6b8a441 (patch)
tree9d96af228f87def15b797f2f8ec5151bce6439c9 /src/ephy-window.c
parent29604a8fa8cf16a2b0e55ff6f8b9d10e57dd9be5 (diff)
downloadgsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar.gz
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar.bz2
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar.lz
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar.xz
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.tar.zst
gsoc2013-epiphany-0a389e07241775316dfb866341a1a3c9f6b8a441.zip
Disable Zoom items for images, and disable zoom, encoding and view source
2004-12-18 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed.c: (ephy_embed_chrome_get_type), (ephy_embed_document_type_get_type), (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/mozilla-embed.cpp: * src/ephy-tab.c: (ephy_tab_set_property), (ephy_tab_get_property), (ephy_tab_class_init), (ephy_tab_get_document_type), (ephy_tab_document_type_cb), (ephy_tab_init): * src/ephy-tab.h: * src/ephy-window.c: (sync_tab_document_type), (sync_tab_zoom), (ephy_window_set_active_tab): * src/toolbar.c: (toolbar_update_zoom): * src/toolbar.h: Disable Zoom items for images, and disable zoom, encoding and view source for images and xml (xul) documents. Fixes bug #132240.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3c08bf238..75ab35961 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -82,6 +82,9 @@ static void ephy_window_view_bookmarksbar_cb (GtkAction *action,
EphyWindow *window);
static void ephy_window_view_popup_windows_cb (GtkAction *action,
EphyWindow *window);
+static void sync_tab_zoom (EphyTab *tab,
+ GParamSpec *pspec,
+ EphyWindow *window);
static GtkActionEntry ephy_menu_entries [] = {
@@ -1208,6 +1211,36 @@ sync_tab_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
}
static void
+sync_tab_document_type (EphyTab *tab,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ EmbedDocumentType type;
+ gboolean can_find, enable;
+
+ /* update zoom actions */
+ sync_tab_zoom (tab, NULL, window);
+
+ type = ephy_tab_get_document_type (tab);
+ can_find = (type != EMBED_DOCUMENT_IMAGE);
+ enable = (type == EMBED_DOCUMENT_HTML);
+
+ action_group = window->priv->action_group;
+ action = gtk_action_group_get_action (action_group, "ViewEncoding");
+ g_object_set (action, "sensitive", enable, NULL);
+ action = gtk_action_group_get_action (action_group, "ViewPageSource");
+ g_object_set (action, "sensitive", enable, NULL);
+ action = gtk_action_group_get_action (action_group, "EditFind");
+ g_object_set (action, "sensitive", can_find, NULL);
+ action = gtk_action_group_get_action (action_group, "EditFindNext");
+ g_object_set (action, "sensitive", can_find, NULL);
+ action = gtk_action_group_get_action (action_group, "EditFindPrev");
+ g_object_set (action, "sensitive", can_find, NULL);
+}
+
+static void
sync_tab_icon (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
const char *address;
@@ -1507,12 +1540,15 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
GtkActionGroup *action_group;
GtkAction *action;
- gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
+ EmbedDocumentType type;
+ gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE, can_zoom;
float zoom;
if (window->priv->closing) return;
zoom = ephy_tab_get_zoom (tab);
+ type = ephy_tab_get_document_type (tab);
+ can_zoom = (type != EMBED_DOCUMENT_IMAGE);
if (zoom >= ZOOM_MAXIMAL)
{
@@ -1527,15 +1563,15 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
can_zoom_normal = TRUE;
}
- toolbar_update_zoom (window->priv->toolbar, zoom);
+ toolbar_update_zoom (window->priv->toolbar, can_zoom, zoom);
action_group = window->priv->action_group;
action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- g_object_set (action, "sensitive", can_zoom_in, NULL);
+ g_object_set (action, "sensitive", can_zoom_in && can_zoom, NULL);
action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- g_object_set (action, "sensitive", can_zoom_out, NULL);
+ g_object_set (action, "sensitive", can_zoom_out && can_zoom, NULL);
action = gtk_action_group_get_action (action_group, "ViewZoomNormal");
- g_object_set (action, "sensitive", can_zoom_normal, NULL);
+ g_object_set (action, "sensitive", can_zoom_normal && can_zoom, NULL);
}
static void
@@ -1833,6 +1869,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_address),
window);
g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab),
+ G_CALLBACK (sync_tab_document_type),
+ window);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab),
G_CALLBACK (sync_tab_icon),
window);
g_signal_handlers_disconnect_by_func (G_OBJECT (old_tab),
@@ -1877,6 +1916,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
if (new_tab)
{
sync_tab_address (new_tab, NULL, window);
+ sync_tab_document_type (new_tab, NULL, window);
sync_tab_icon (new_tab, NULL, window);
sync_tab_load_progress (new_tab, NULL, window);
sync_tab_load_status (new_tab, NULL, window);
@@ -1893,6 +1933,10 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_address),
window, 0);
g_signal_connect_object (G_OBJECT (new_tab),
+ "notify::document-type",
+ G_CALLBACK (sync_tab_document_type),
+ window, 0);
+ g_signal_connect_object (G_OBJECT (new_tab),
"notify::icon",
G_CALLBACK (sync_tab_icon),
window, 0);