aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-11-17 07:32:41 +0800
committerXan Lopez <xan@src.gnome.org>2007-11-17 07:32:41 +0800
commit0ca10a9d903db72abe211959894721ea97e33de3 (patch)
tree8372441bf0de7ef26373202d73a680613bed8492
parentb509828635066e0ce051fe77333acfb7d29d500f (diff)
downloadgsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar.gz
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar.bz2
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar.lz
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar.xz
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.tar.zst
gsoc2013-epiphany-0ca10a9d903db72abe211959894721ea97e33de3.zip
Move print-preview property to EphyEmbedContainer interface.
Also make it read-only and make the setter in EphyWindow semi-private for now (should be removed eventually, making the window be notified from the embed of the status). svn path=/trunk/; revision=7709
-rw-r--r--embed/ephy-embed-container.c4
-rw-r--r--src/ephy-window.c103
-rw-r--r--src/ephy-window.h2
-rw-r--r--src/epiphany.defs9
-rw-r--r--src/ppview-toolbar.c2
-rw-r--r--src/window-commands.c2
6 files changed, 57 insertions, 65 deletions
diff --git a/embed/ephy-embed-container.c b/embed/ephy-embed-container.c
index 64223eeda..c2a6ad9cd 100644
--- a/embed/ephy-embed-container.c
+++ b/embed/ephy-embed-container.c
@@ -47,6 +47,10 @@ ephy_embed_container_base_init (gpointer g_class)
g_param_spec_object ("active-child", NULL, NULL,
GTK_TYPE_WIDGET /* Can't use an interface type here */,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_interface_install_property (g_class,
+ g_param_spec_boolean ("is-print-preview", NULL, NULL,
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 953539d17..74d9fc123 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -989,6 +989,42 @@ ephy_window_key_press_event (GtkWidget *widget,
return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
}
+void
+_ephy_window_set_print_preview (EphyWindow *window,
+ gboolean enabled)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GtkAccelGroup *accel_group;
+
+ accel_group = gtk_ui_manager_get_accel_group (window->priv->manager);
+
+ if (priv->ppv_mode == enabled) return;
+
+ priv->ppv_mode = enabled;
+
+ sync_chromes_visibility (window);
+
+ if (enabled)
+ {
+ g_return_if_fail (priv->ppview_toolbar == NULL);
+
+ ephy_find_toolbar_request_close (priv->find_toolbar);
+
+ priv->ppview_toolbar = ppview_toolbar_new (window);
+ gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group);
+ }
+ else
+ {
+ g_return_if_fail (priv->ppview_toolbar != NULL);
+
+ g_object_unref (priv->ppview_toolbar);
+ priv->ppview_toolbar = NULL;
+ gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
+ }
+
+ g_object_notify (G_OBJECT (window), "is-print-preview");
+}
+
static gboolean
ephy_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
@@ -1014,7 +1050,7 @@ ephy_window_delete_event (GtkWidget *widget,
embed = ephy_window_get_active_child (EPHY_EMBED_CONTAINER (window));
ephy_embed_set_print_preview_mode (embed, FALSE);
- ephy_window_set_print_preview (window, FALSE);
+ _ephy_window_set_print_preview (window, FALSE);
return TRUE;
}
@@ -2953,18 +2989,21 @@ ephy_window_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_PPV_MODE:
+ /* Read only */
+ break;
case PROP_ACTIVE_CHILD:
ephy_window_set_active_child (window, g_value_get_object (value));
break;
case PROP_CHROME:
ephy_window_set_chrome (window, g_value_get_flags (value));
break;
- case PROP_PPV_MODE:
- ephy_window_set_print_preview (window, g_value_get_boolean (value));
- break;
case PROP_SINGLE_TAB_MODE:
ephy_window_set_is_popup (window, g_value_get_boolean (value));
break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -2990,6 +3029,9 @@ ephy_window_get_property (GObject *object,
case PROP_SINGLE_TAB_MODE:
g_value_set_boolean (value, window->priv->is_popup);
break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -3095,12 +3137,6 @@ ephy_window_class_init (EphyWindowClass *klass)
widget_class->window_state_event = ephy_window_state_event;
widget_class->delete_event = ephy_window_delete_event;
- g_object_class_install_property (object_class,
- PROP_PPV_MODE,
- g_param_spec_boolean ("print-preview-mode", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
g_object_class_override_property (object_class,
PROP_ACTIVE_CHILD,
"active-child");
@@ -3110,6 +3146,10 @@ ephy_window_class_init (EphyWindowClass *klass)
"is-popup");
g_object_class_override_property (object_class,
+ PROP_PPV_MODE,
+ "is-print-preview");
+
+ g_object_class_override_property (object_class,
PROP_CHROME,
"chrome");
@@ -3496,49 +3536,6 @@ ephy_window_new_with_chrome (EphyEmbedChrome chrome,
}
/**
- * ephy_window_set_print_preview:
- * @window: an #EphyWindow
- * @enabled: %TRUE to enable print preview mode
- *
- * Sets whether the window is in print preview mode.
- **/
-void
-ephy_window_set_print_preview (EphyWindow *window,
- gboolean enabled)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkAccelGroup *accel_group;
-
- accel_group = gtk_ui_manager_get_accel_group (window->priv->manager);
-
- if (priv->ppv_mode == enabled) return;
-
- priv->ppv_mode = enabled;
-
- sync_chromes_visibility (window);
-
- if (enabled)
- {
- g_return_if_fail (priv->ppview_toolbar == NULL);
-
- ephy_find_toolbar_request_close (priv->find_toolbar);
-
- priv->ppview_toolbar = ppview_toolbar_new (window);
- gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group);
- }
- else
- {
- g_return_if_fail (priv->ppview_toolbar != NULL);
-
- g_object_unref (priv->ppview_toolbar);
- priv->ppview_toolbar = NULL;
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
- }
-
- g_object_notify (G_OBJECT (window), "print-preview-mode");
-}
-
-/**
* ephy_window_get_ui_manager:
* @window: an #EphyWindow
*
diff --git a/src/ephy-window.h b/src/ephy-window.h
index e8068119d..f55f4c99d 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -60,7 +60,7 @@ EphyWindow *ephy_window_new (void);
EphyWindow *ephy_window_new_with_chrome (EphyEmbedChrome chrome,
gboolean is_popup);
-void ephy_window_set_print_preview (EphyWindow *window,
+void _ephy_window_set_print_preview (EphyWindow *window,
gboolean enabled);
GObject *ephy_window_get_ui_manager (EphyWindow *window);
diff --git a/src/epiphany.defs b/src/epiphany.defs
index 0320ac0d3..9f625fdb0 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -3478,15 +3478,6 @@
)
)
-(define-method set_print_preview
- (of-object "EphyWindow")
- (c-name "ephy_window_set_print_preview")
- (return-type "none")
- (parameters
- '("gboolean" "enabled")
- )
-)
-
(define-method get_ui_manager
(of-object "EphyWindow")
(c-name "ephy_window_get_ui_manager")
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index 357af3e89..20659acaa 100644
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -403,7 +403,7 @@ toolbar_cmd_ppv_close (GtkUIManager *merge,
(EPHY_EMBED_CONTAINER (window));
g_return_if_fail (EPHY_IS_EMBED (embed));
- ephy_window_set_print_preview (window, FALSE);
+ _ephy_window_set_print_preview (window, FALSE);
ephy_embed_set_print_preview_mode (embed, FALSE);
}
diff --git a/src/window-commands.c b/src/window-commands.c
index 8cf75a9c6..4ad935c17 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -101,7 +101,7 @@ window_cmd_file_print_preview (GtkAction *action,
g_return_if_fail (EPHY_IS_EMBED (embed));
ephy_embed_set_print_preview_mode (embed, TRUE);
- ephy_window_set_print_preview (window, TRUE);
+ _ephy_window_set_print_preview (window, TRUE);
}
void