diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-04-10 19:51:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-04-10 19:51:48 +0800 |
commit | b53d58efcee1ef734894b4b7d27afe9535f9e922 (patch) | |
tree | 393a69c45eb59225b92d27751ba1ad3a717650db /lib | |
parent | 7542888f38a33adf2053ba28881efd5c884eb7c5 (diff) | |
download | gsoc2013-epiphany-b53d58efcee1ef734894b4b7d27afe9535f9e922.tar.gz gsoc2013-epiphany-b53d58efcee1ef734894b4b7d27afe9535f9e922.tar.zst gsoc2013-epiphany-b53d58efcee1ef734894b4b7d27afe9535f9e922.zip |
Remove unused function ephy_node_db_get_by_name(), and clean up a bit.
2005-04-10 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-node-db.c: (ephy_node_db_get_property),
(ephy_node_db_set_property), (ephy_node_db_finalize),
(ephy_node_db_write_to_xml_safe), (ephy_node_db_class_init),
(ephy_node_db_get_type):
Remove unused function ephy_node_db_get_by_name(), and
clean up a bit.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-node-db.c | 170 | ||||
-rw-r--r-- | lib/ephy-node-db.h | 2 |
2 files changed, 62 insertions, 110 deletions
diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c index c98f7b4f7..613251ef5 100644 --- a/lib/ephy-node-db.c +++ b/lib/ephy-node-db.c @@ -32,10 +32,6 @@ #include <unistd.h> #include <sys/stat.h> -static void ephy_node_db_class_init (EphyNodeDbClass *klass); -static void ephy_node_db_init (EphyNodeDb *node); -static void ephy_node_db_finalize (GObject *object); - /* FIXME I want to find a better way to deal with "root" nodes */ #define RESERVED_IDS 30 @@ -58,60 +54,15 @@ struct _EphyNodeDbPrivate GPtrArray *id_to_node; }; -static GHashTable *ephy_node_databases = NULL; - static GObjectClass *parent_class = NULL; -GType -ephy_node_db_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - static const GTypeInfo our_info = - { - sizeof (EphyNodeDbClass), - NULL, - NULL, - (GClassInitFunc) ephy_node_db_class_init, - NULL, - NULL, - sizeof (EphyNodeDb), - 0, - (GInstanceInitFunc) ephy_node_db_init - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "EphyNodeDb", - &our_info, 0); - } - - return type; -} - -static void -ephy_node_db_set_name (EphyNodeDb *db, const char *name) -{ - db->priv->name = g_strdup (name); - - if (ephy_node_databases == NULL) - { - ephy_node_databases = g_hash_table_new (g_str_hash, g_str_equal); - } - - g_hash_table_insert (ephy_node_databases, db->priv->name, db); -} - static void ephy_node_db_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - EphyNodeDb *db; - - db = EPHY_NODE_DB (object); + EphyNodeDb *db = EPHY_NODE_DB (object); switch (prop_id) { @@ -130,14 +81,12 @@ ephy_node_db_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - EphyNodeDb *db; - - db = EPHY_NODE_DB (object); + EphyNodeDb *db = EPHY_NODE_DB (object); switch (prop_id) { case PROP_NAME: - ephy_node_db_set_name (db, g_value_get_string (value)); + db->priv->name = g_value_dup_string (value); break; case PROP_IMMUTABLE: ephy_node_db_set_immutable (db, g_value_get_boolean (value)); @@ -146,36 +95,6 @@ ephy_node_db_set_property (GObject *object, } static void -ephy_node_db_class_init (EphyNodeDbClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = ephy_node_db_finalize; - object_class->set_property = ephy_node_db_set_property; - object_class->get_property = ephy_node_db_get_property; - - g_object_class_install_property (object_class, - PROP_NAME, - g_param_spec_string ("name", - "Name", - "Name", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_IMMUTABLE, - g_param_spec_boolean ("immutable", - "Immutable", - "Immutable", - FALSE, - G_PARAM_READWRITE)); - - g_type_class_add_private (object_class, sizeof (EphyNodeDbPrivate)); -} - -static void ephy_node_db_init (EphyNodeDb *db) { db->priv = EPHY_NODE_DB_GET_PRIVATE (db); @@ -192,12 +111,6 @@ ephy_node_db_finalize (GObject *object) { EphyNodeDb *db = EPHY_NODE_DB (object); - g_hash_table_remove (ephy_node_databases, db->priv->name); - if (g_hash_table_size (ephy_node_databases) == 0) - { - g_hash_table_destroy (ephy_node_databases); - } - g_ptr_array_free (db->priv->id_to_node, TRUE); g_free (db->priv->name); @@ -206,24 +119,6 @@ ephy_node_db_finalize (GObject *object) } /** - * ephy_node_db_get_by_name: - * @name: the name of the desired #EphyNodeDb - * - * Returns the #EphyNodeDb named @name, or %NULL if no such database exists. - * - * Return value: an #EphyNodeDb - **/ -EphyNodeDb * -ephy_node_db_get_by_name (const char *name) -{ - EphyNodeDb *ret; - - ret = g_hash_table_lookup (ephy_node_databases, name); - - return ret; -} - -/** * ephy_node_db_new: * @name: the name of the new #EphyNodeDb * @@ -614,3 +509,62 @@ failed: return ret; } + +static void +ephy_node_db_class_init (EphyNodeDbClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = ephy_node_db_finalize; + object_class->set_property = ephy_node_db_set_property; + object_class->get_property = ephy_node_db_get_property; + + g_object_class_install_property (object_class, + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_IMMUTABLE, + g_param_spec_boolean ("immutable", + "Immutable", + "Immutable", + FALSE, + G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyNodeDbPrivate)); +} + +GType +ephy_node_db_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo our_info = + { + sizeof (EphyNodeDbClass), + NULL, + NULL, + (GClassInitFunc) ephy_node_db_class_init, + NULL, + NULL, + sizeof (EphyNodeDb), + 0, + (GInstanceInitFunc) ephy_node_db_init + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "EphyNodeDb", + &our_info, 0); + } + + return type; +} diff --git a/lib/ephy-node-db.h b/lib/ephy-node-db.h index 84c3d9b8c..f07557766 100644 --- a/lib/ephy-node-db.h +++ b/lib/ephy-node-db.h @@ -55,8 +55,6 @@ typedef struct GType ephy_node_db_get_type (void); -EphyNodeDb *ephy_node_db_get_by_name (const char *name); - EphyNodeDb *ephy_node_db_new (const char *name); gboolean ephy_node_db_load_from_file (EphyNodeDb *db, |