aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-05-10 19:06:35 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2012-06-05 02:44:31 +0800
commitad00117319033a3fe51d739cabc482e7217cd248 (patch)
treefd9b5f52b3737e84d2c530c8db75699765cbf3e8
parente4a612165350d8d1868b75745f8ffb273f38e8e0 (diff)
downloadgsoc2013-epiphany-ad00117319033a3fe51d739cabc482e7217cd248.tar.gz
gsoc2013-epiphany-ad00117319033a3fe51d739cabc482e7217cd248.tar.zst
gsoc2013-epiphany-ad00117319033a3fe51d739cabc482e7217cd248.zip
ephy-location-entry: make parameters actual properties
So that they are bindable. https://bugzilla.gnome.org/show_bug.cgi?id=675804
-rw-r--r--lib/widgets/ephy-location-entry.c112
1 files changed, 112 insertions, 0 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index ad36fe125..7a1cc5581 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -102,6 +102,15 @@ static void extracell_data_func (GtkCellLayout *cell_layout,
GtkTreeIter *iter,
gpointer data);
+enum
+{
+ PROP_0,
+ PROP_LOCATION,
+ PROP_FAVICON,
+ PROP_LOCK_STOCK,
+ PROP_SHOW_LOCK
+};
+
enum signalsEnum
{
USER_CHANGED,
@@ -115,6 +124,55 @@ static gint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (EphyLocationEntry, ephy_location_entry, GTK_TYPE_ENTRY)
static void
+ephy_location_entry_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (object);
+
+ switch (prop_id)
+ {
+ case PROP_LOCATION:
+ ephy_location_entry_set_location (entry,
+ g_value_get_string (value));
+ break;
+ case PROP_FAVICON:
+ ephy_location_entry_set_favicon (entry,
+ g_value_get_object (value));
+ break;
+ case PROP_LOCK_STOCK:
+ ephy_location_entry_set_lock_stock (entry,
+ g_value_get_string (value));
+ break;
+ case PROP_SHOW_LOCK:
+ ephy_location_entry_set_show_lock (entry,
+ g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id,pspec);
+ }
+}
+
+static void
+ephy_location_entry_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (object);
+
+ switch (prop_id)
+ {
+ case PROP_LOCATION:
+ g_value_set_string (value, ephy_location_entry_get_location (entry));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id,pspec);
+ }
+}
+
+static void
ephy_location_entry_finalize (GObject *object)
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (object);
@@ -140,8 +198,62 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->get_property = ephy_location_entry_get_property;
+ object_class->set_property = ephy_location_entry_set_property;
object_class->finalize = ephy_location_entry_finalize;
+ /**
+ * EphyLocationEntry:location:
+ *
+ * The current location.
+ */
+ g_object_class_install_property (object_class,
+ PROP_LOCATION,
+ g_param_spec_string ("location",
+ "Location",
+ "The current location",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+ /**
+ * EphyLocationEntry:favicon:
+ *
+ * The icon corresponding to the current location.
+ */
+ g_object_class_install_property (object_class,
+ PROP_FAVICON,
+ g_param_spec_object ("favicon",
+ "Favicon",
+ "The icon corresponding to the current location",
+ GDK_TYPE_PIXBUF,
+ G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+ /**
+ * EphyLocationEntry:lock-stock-id:
+ *
+ * Stock id of the security icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_LOCK_STOCK,
+ g_param_spec_string ("lock-stock-id",
+ "Lock Stock ID",
+ "Stock id of the security icon",
+ NULL,
+ G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+ /**
+ * EphyLocationEntry:show-lock:
+ *
+ * If we should show the security icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_SHOW_LOCK,
+ g_param_spec_boolean ("show-lock",
+ "Show Lock",
+ "If we should show the security icon",
+ FALSE,
+ G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
/**
* EphyLocationEntry::user-changed:
* @entry: the object on which the signal is emitted