[epiphany/overview] ephy-embed: add the overview and a overview-mode property
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/overview] ephy-embed: add the overview and a overview-mode property
- Date: Mon, 20 Aug 2012 16:13:00 +0000 (UTC)
commit 65f717e984fd37adc4833b2beedc513b44aaf8ba
Author: Claudio Saavedra <csaavedra igalia com>
Date: Mon Aug 20 13:54:32 2012 +0300
ephy-embed: add the overview and a overview-mode property
Toggling this property will toggle visibility of the overview and the
paned with the normal embed contents.
embed/ephy-embed.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
embed/ephy-embed.h | 5 ++
2 files changed, 109 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index c7d9d0d..542240f 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -79,6 +79,8 @@ struct _EphyEmbedPrivate
GtkWidget *fullscreen_message_label;
char *fullscreen_string;
+ GtkWidget *overview;
+ guint overview_mode : 1;
GSList *messages;
GSList *keys;
@@ -96,6 +98,12 @@ struct _EphyEmbedPrivate
gulong progress_update_handler_id;
};
+enum
+{
+ PROP_0,
+ PROP_OVERVIEW_MODE,
+};
+
G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
/* Portions of the following code based on GTK+.
@@ -431,6 +439,44 @@ ephy_embed_finalize (GObject *object)
}
static void
+ephy_embed_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbed *embed = EPHY_EMBED (object);
+
+ switch (prop_id)
+ {
+ case PROP_OVERVIEW_MODE:
+ ephy_embed_set_overview_mode (embed, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_embed_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbed *embed = EPHY_EMBED (object);
+
+ switch (prop_id)
+ {
+ case PROP_OVERVIEW_MODE:
+ g_value_set_boolean (value, ephy_embed_get_overview_mode (embed));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
ephy_embed_class_init (EphyEmbedClass *klass)
{
GObjectClass *object_class = (GObjectClass *)klass;
@@ -439,8 +485,18 @@ ephy_embed_class_init (EphyEmbedClass *klass)
object_class->constructed = ephy_embed_constructed;
object_class->finalize = ephy_embed_finalize;
object_class->dispose = ephy_embed_dispose;
+ object_class->set_property = ephy_embed_set_property;
+ object_class->get_property = ephy_embed_get_property;
widget_class->grab_focus = ephy_embed_grab_focus;
+ g_object_class_install_property (object_class,
+ PROP_OVERVIEW_MODE,
+ g_param_spec_boolean ("overview-mode",
+ "Overview mode",
+ "Whether the embed is showing the overview",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate));
}
@@ -919,6 +975,22 @@ ephy_embed_constructed (GObject *object)
NULL);
#endif
+ /* The overview */
+ priv->overview = ephy_overview_new ();
+ gtk_box_pack_start (GTK_BOX (embed),
+ GTK_WIDGET (priv->overview),
+ TRUE, TRUE, 0);
+ g_object_bind_property (embed, "overview-mode",
+ priv->overview, "visible",
+ G_BINDING_SYNC_CREATE
+ | G_BINDING_BIDIRECTIONAL);
+
+ g_object_bind_property (embed, "overview-mode",
+ paned, "visible",
+ G_BINDING_SYNC_CREATE
+ | G_BINDING_INVERT_BOOLEAN
+ | G_BINDING_BIDIRECTIONAL);
+
ephy_embed_prefs_add_embed (embed);
}
@@ -1028,3 +1100,35 @@ ephy_embed_get_container (EphyEmbed *embed)
return gtk_widget_get_parent (GTK_WIDGET (embed));
}
+void
+ephy_embed_set_overview_mode (EphyEmbed *embed, gboolean overview_mode)
+{
+ EphyEmbedPrivate *priv;
+
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+ priv = embed->priv;
+
+ if (priv->overview_mode == overview_mode)
+ return;
+
+ priv->overview_mode = overview_mode;
+
+ g_object_notify (G_OBJECT (embed), "overview-mode");
+}
+
+gboolean
+ephy_embed_get_overview_mode (EphyEmbed *embed)
+{
+ g_return_val_if_fail (EPHY_IS_EMBED (embed), FALSE);
+
+ return embed->priv->overview_mode;
+}
+
+EphyOverview *
+ephy_embed_get_overview (EphyEmbed *embed)
+{
+ g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
+
+ return EPHY_OVERVIEW (embed->priv->overview);
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index a4988f8..defdcbc 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -22,6 +22,7 @@
#ifndef EPHY_EMBED_H
#define EPHY_EMBED_H
+#include "ephy-overview.h"
#include "ephy-web-view.h"
#include <gtk/gtk.h>
@@ -62,6 +63,10 @@ void ephy_embed_auto_download_url (EphyEmbed *embed,
void ephy_embed_entering_fullscreen (EphyEmbed *embed);
void ephy_embed_leaving_fullscreen (EphyEmbed *embed);
GtkWidget* ephy_embed_get_container (EphyEmbed *embed);
+void ephy_embed_set_overview_mode (EphyEmbed *embed,
+ gboolean overview_mode);
+gboolean ephy_embed_get_overview_mode (EphyEmbed *embed);
+EphyOverview*ephy_embed_get_overview (EphyEmbed *embed);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]