aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed-factory.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-09-13 18:24:56 +0800
committerChristian Persch <chpe@src.gnome.org>2004-09-13 18:24:56 +0800
commit2606279995f614634062e0aeb9833c482db5d083 (patch)
tree625e6ae5d03052e753c3322397b41f4174ca3926 /embed/ephy-embed-factory.c
parent79ec35d68d698710604fd4e9682188ae28ba1ae0 (diff)
downloadgsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.gz
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.bz2
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.lz
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.xz
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.zst
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.zip
Merging pre-gnome-2-10 branch to HEAD.
2004-09-13 Christian Persch <chpe@cvs.gnome.org> Merging pre-gnome-2-10 branch to HEAD. Splitting ChangeLog.
Diffstat (limited to 'embed/ephy-embed-factory.c')
-rw-r--r--embed/ephy-embed-factory.c71
1 files changed, 21 insertions, 50 deletions
diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c
index 5a81004f0..ef382c9eb 100644
--- a/embed/ephy-embed-factory.c
+++ b/embed/ephy-embed-factory.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 Marco Pesenti Gritti
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,68 +26,39 @@
#include "mozilla-embed.h"
#include "mozilla-embed-persist.h"
#include "mozilla-embed-single.h"
+#include "ephy-embed.h"
+#include "ephy-embed-persist.h"
+#include "ephy-embed-single.h"
-#include <string.h>
-
-typedef enum
-{
- EPHY_EMBED_OBJECT,
- EPHY_EMBED_PERSIST_OBJECT,
- EPHY_EMBED_SINGLE_OBJECT
-} EmbedObjectType;
-
-static EmbedObjectType
-type_from_id (const char *object_id)
+/**
+ * ephy_embed_factory_new_object:
+ * @type: a #GType specifying which object to create
+ *
+ * Create an instance of an object implementing the @type interface.
+ *
+ * Return value: the object instance
+ **/
+GObject *
+ephy_embed_factory_new_object (GType type)
{
- EmbedObjectType result = 0;
+ GObject *object = NULL;
- if (strcmp (object_id, "EphyEmbed") == 0)
+ if (type == EPHY_TYPE_EMBED)
{
- result = EPHY_EMBED_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED, NULL);
}
- else if (strcmp (object_id, "EphyEmbedPersist") == 0)
+ else if (type == EPHY_TYPE_EMBED_PERSIST)
{
- result = EPHY_EMBED_PERSIST_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL);
}
- else if (strcmp (object_id, "EphyEmbedSingle") == 0)
+ else if (type == EPHY_TYPE_EMBED_SINGLE)
{
- result = EPHY_EMBED_SINGLE_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL);
}
else
{
g_assert_not_reached ();
}
- return result;
-}
-
-/**
- * ephy_embed_factory_new_object:
- * @object_id: identifier of the object to create
- *
- * Create an instance of the object identified by @object_id.
- *
- * Return value: the object instance
- **/
-GObject *
-ephy_embed_factory_new_object (const char *object_id)
-{
- GObject *object;
-
- switch (type_from_id (object_id))
- {
- case EPHY_EMBED_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED, NULL);
- break;
- case EPHY_EMBED_PERSIST_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL);
- break;
- case EPHY_EMBED_SINGLE_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL);
- break;
- default:
- object = NULL;
- }
-
return object;
}