aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-07 02:14:42 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-07 02:14:42 +0800
commit35ad841aceed89072e2cc6f589405a6feb411f74 (patch)
tree2fdf16ad0c9c630733841728c9bd0e3406bae4ba /embed
parent58a62ea3932ab6bdb599a0c519460a56622fe884 (diff)
downloadgsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.gz
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.zst
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.zip
Use glib-mkenums to generate the enum and flags get_type functions.
2005-01-06 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * embed/Makefile.am: * embed/ephy-embed-event.c: * embed/ephy-embed-event.h: * embed/ephy-embed-persist.c: * embed/ephy-embed-persist.h: * embed/ephy-embed.c: * embed/ephy-embed.h: * embed/ephy-permission-manager.c: * embed/ephy-permission-manager.h: * lib/egg/Makefile.am: * lib/egg/egg-toolbars-model.c: * lib/egg/egg-toolbars-model.h: * src/Makefile.am: * src/ephy-link.c: * src/ephy-link.h: * src/ephy-navigation-action.c: * src/ephy-shell.c: (ephy_shell_error_quark): * src/ephy-shell.h: * src/ephy-tab.c: * src/ephy-tab.h: * src/ephy-window.c: Use glib-mkenums to generate the enum and flags get_type functions.
Diffstat (limited to 'embed')
-rw-r--r--embed/Makefile.am53
-rw-r--r--embed/ephy-embed-event.c49
-rw-r--r--embed/ephy-embed-event.h3
-rw-r--r--embed/ephy-embed-persist.c23
-rw-r--r--embed/ephy-embed-persist.h2
-rw-r--r--embed/ephy-embed.c120
-rw-r--r--embed/ephy-embed.h24
-rw-r--r--embed/ephy-permission-manager.c24
-rw-r--r--embed/ephy-permission-manager.h1
9 files changed, 63 insertions, 236 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 7f81345ca..b34619866 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -3,7 +3,9 @@ SUBDIRS = mozilla
noinst_LTLIBRARIES = libephyembed.la libephyembedfactory.la
headerdir = $(prefix)/include/epiphany-@EPIPHANY_MAJOR@/epiphany
-header_DATA = $(INST_H_FILES)
+header_DATA = \
+ ephy-embed-type-builtins.h \
+ $(INST_H_FILES)
NOINST_H_FILES = \
downloader-view.h \
@@ -14,6 +16,12 @@ NOINST_H_FILES = \
find-dialog.h \
print-dialog.h
+TYPES_H_FILES = \
+ ephy-embed.h \
+ ephy-embed-event.h \
+ ephy-embed-persist.h \
+ ephy-permission-manager.h
+
INST_H_FILES = \
ephy-command-manager.h \
ephy-cookie-manager.h \
@@ -47,7 +55,8 @@ libephyembed_la_SOURCES = \
find-dialog.c \
print-dialog.c \
$(INST_H_FILES) \
- $(NOINST_H_FILES)
+ $(NOINST_H_FILES) \
+ $(BUILT_SOURCES)
libephyembed_la_CPPFLAGS = \
-I$(top_builddir)/lib \
@@ -75,3 +84,43 @@ libephyembedfactory_la_CPPFLAGS = \
libephyembedfactory_la_CFLAGS = \
$(EPIPHANY_DEPENDENCY_CFLAGS) \
$(AM_CFLAGS)
+
+
+BUILT_SOURCES = \
+ ephy-embed-type-builtins.c \
+ ephy-embed-type-builtins.h
+
+CLEAN_FILES = $(BUILT_SOURCES)
+DISTCLEAN_FILES = $(BUILT_SOURCES)
+
+ephy-embed-type-builtins.c: $(TYPES_H_FILES)
+ ( cd $(srcdir) && $(GLIB_MKENUMS) \
+ --fhead "#include \"ephy-embed-type-builtins.h\"\n\n" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --fprod "\n#include \"@filename@\"" \
+ --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n};\n\n" \
+ --vtail "GType\n@enum_name@_get_type (void)\n{\n" \
+ --vtail " static GType type = 0;\n\n" \
+ --vtail " if (G_UNLIKELY (type == 0))\n" \
+ --vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \
+ --vtail " return type;\n}\n\n" \
+ $(TYPES_H_FILES) ) > xgen-$(@F) \
+ && ( cmp -s xgen-$(@F) $(@F) || cp xgen-$(@F) $(@F) ) \
+ && rm -f xgen-$(@F)
+
+ephy-embed-type-builtins.h: $(TYPES_H_FILES)
+ ( cd $(srcdir) && $(GLIB_MKENUMS) \
+ --fhead "#ifndef EPHY_EMBED_TYPE_BUILTINS_H\n" \
+ --fhead "#define EPHY_EMBED_TYPE_BUILTINS_H 1\n\n" \
+ --fhead "#include <glib-object.h>\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif /* EPHY_EMBED_TYPE_BUILTINS_H */\n" \
+ --fprod "\n/* --- @filename@ --- */" \
+ --eprod "#define EPHY_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \
+ --eprod "GType @enum_name@_get_type (void);\n" \
+ $(TYPES_H_FILES) ) > xgen-$(@F) \
+ && ( cmp -s xgen-$(@F) $(@F) || cp xgen-$(@F) $(@F) ) \
+ && rm -f xgen-$(@F)
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
index 316962689..37e2a8a82 100644
--- a/embed/ephy-embed-event.c
+++ b/embed/ephy-embed-event.c
@@ -21,58 +21,11 @@
#include "config.h"
#include "ephy-embed-event.h"
+#include "ephy-embed-type-builtins.h"
#include <glib/ghash.h>
#include <gtk/gtktypeutils.h>
-GType
-ephy_embed_event_context_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_EMBED_CONTEXT_NONE, "EPHY_EMBED_CONTEXT_NONE", "none" },
- { EPHY_EMBED_CONTEXT_DEFAULT, "EPHY_EMBED_CONTEXT_DEFAULT", "default" },
- { EPHY_EMBED_CONTEXT_LINK, "EPHY_EMBED_CONTEXT_LINK", "link" },
- { EPHY_EMBED_CONTEXT_IMAGE, "EPHY_EMBED_CONTEXT_IMAGE", "image" },
- { EPHY_EMBED_CONTEXT_DOCUMENT, "EPHY_EMBED_CONTEXT_DOCUMENT", "document" },
- { EPHY_EMBED_CONTEXT_INPUT, "EPHY_EMBED_CONTEXT_INPUT", "input" },
- { EPHY_EMBED_CONTEXT_XUL, "EPHY_EMBED_CONTEXT_XUL", "xul" },
- { EPHY_EMBED_CONTEXT_EMAIL_LINK, "EPHY_EMBED_CONTEXT_EMAIL_LINK", "email-link" },
- { 0, NULL, NULL }
- };
-
- type = g_flags_register_static ("EphyEmbedEventContext", values);
- }
-
- return type;
-}
-
-GType
-ephy_embed_event_type_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_EMBED_EVENT_MOUSE_BUTTON1, "EPHY_EMBED_EVENT_MOUSE_BUTTON1", "mouse-button-1" },
- { EPHY_EMBED_EVENT_MOUSE_BUTTON2, "EPHY_EMBED_EVENT_MOUSE_BUTTON2", "mouse-button-2" },
- { EPHY_EMBED_EVENT_MOUSE_BUTTON3, "EPHY_EMBED_EVENT_MOUSE_BUTTON3", "mouse-button-3" },
- { EPHY_EMBED_EVENT_KEY, "EPHY_EMBED_EVENT_KEY", "key" },
- { 0, NULL, NULL }
- };
-
- type = g_enum_register_static ("EphyEmbedEventType", values);
- }
-
- return type;
-}
-
static void ephy_embed_event_base_init (gpointer g_class);
GType
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
index fde3ced29..35af428dd 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -34,9 +34,6 @@ G_BEGIN_DECLS
#define EPHY_IS_EMBED_EVENT_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_EVENT))
#define EPHY_EMBED_EVENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED_EVENT, EphyEmbedEventIface))
-#define EPHY_TYPE_EMBED_EVENT_CONTEXT (ephy_embed_event_context_get_type ())
-#define EPHY_TYPE_EMBED_EVENT_TYPE (ephy_embed_event_type_get_type ())
-
typedef struct _EphyEmbedEventIface EphyEmbedEventIface;
typedef struct _EphyEmbedEvent EphyEmbedEvent;
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c
index 025c86e52..71f3a0cdb 100644
--- a/embed/ephy-embed-persist.c
+++ b/embed/ephy-embed-persist.c
@@ -630,26 +630,3 @@ ephy_embed_persist_to_string (EphyEmbedPersist *persist)
EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
return klass->to_string (persist);
}
-
-GType
-ephy_embed_persist_flags_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_EMBED_PERSIST_COPY_PAGE, "EPHY_EMBED_PERSIST_COPY_PAGE", "copy-page" },
- { EPHY_EMBED_PERSIST_MAINDOC, "EPHY_EMBED_PERSIST_MAINDOC", "main-document" },
- { EPHY_EMBED_PERSIST_NO_VIEW, "EPHY_EMBED_PERSIST_NO_VIEW", "no-view" },
- { EPHY_EMBED_PERSIST_ASK_DESTINATION, "EPHY_EMBED_PERSIST_ASK_DESTINATION", "ask-destination" },
- { EPHY_EMBED_PERSIST_DO_CONVERSION, "EPHY_EMBED_PERSIST_DO_CONVERSION", "do-conversion" },
- { 0, NULL, NULL }
- };
-
- type = g_flags_register_static ("EphyEmbedPersistFlags", values);
- }
-
- return type;
-}
diff --git a/embed/ephy-embed-persist.h b/embed/ephy-embed-persist.h
index a2616cdb4..0f80c1200 100644
--- a/embed/ephy-embed-persist.h
+++ b/embed/ephy-embed-persist.h
@@ -38,8 +38,6 @@ G_BEGIN_DECLS
#define EPHY_IS_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_PERSIST))
#define EPHY_EMBED_PERSIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_PERSIST, EphyEmbedPersistClass))
-#define EPHY_TYPE_EMBED_PERSIST_FLAGS (ephy_embed_persist_flags_get_type ())
-
typedef struct _EphyEmbedPersistClass EphyEmbedPersistClass;
typedef struct _EphyEmbedPersist EphyEmbedPersist;
typedef struct EphyEmbedPersistPrivate EphyEmbedPersistPrivate;
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index b9789107e..376eede08 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -22,6 +22,7 @@
#include "ephy-embed.h"
+#include "ephy-embed-type-builtins.h"
#include "ephy-marshal.h"
#include "ephy-signal-accumulator.h"
#include "mozilla-embed-single.h"
@@ -30,125 +31,6 @@
static void ephy_embed_base_init (gpointer g_class);
GType
-ephy_embed_net_state_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_EMBED_STATE_UNKNOWN, "EPHY_EMBED_STATE_UNKNOWN", "unknown" },
- { EPHY_EMBED_STATE_START, "EPHY_EMBED_STATE_START", "start" },
- { EPHY_EMBED_STATE_REDIRECTING, "EPHY_EMBED_STATE_REDIRECTING", "redirecting" },
- { EPHY_EMBED_STATE_TRANSFERRING, "EPHY_EMBED_STATE_TRANSFERRING", "transferring" },
- { EPHY_EMBED_STATE_NEGOTIATING, "EPHY_EMBED_STATE_NEGOTIATING", "negotiating", },
- { EPHY_EMBED_STATE_STOP, "EPHY_EMBED_STATE_STOP", "stop" },
- { EPHY_EMBED_STATE_IS_REQUEST, "EPHY_EMBED_STATE_IS_REQUEST", "is-request" },
- { EPHY_EMBED_STATE_IS_DOCUMENT, "EPHY_EMBED_STATE_IS_DOCUMENT", "is-document" },
- { EPHY_EMBED_STATE_IS_NETWORK, "EPHY_EMBED_STATE_IS_NETWORK", "is-network" },
- { EPHY_EMBED_STATE_IS_WINDOW, "EPHY_EMBED_STATE_IS_WINDOW", "is-window" },
- { 0, NULL, NULL }
- };
-
- type = g_flags_register_static ("EphyEmbedNetState", values);
- }
-
- return type;
-}
-
-GType
-ephy_embed_chrome_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_EMBED_CHROME_MENUBAR, "EPHY_EMBED_CHROME_MENUBAR", "menubar" },
- { EPHY_EMBED_CHROME_TOOLBAR, "EPHY_EMBED_CHROME_TOOLBAR", "toolbar" },
- { EPHY_EMBED_CHROME_STATUSBAR, "EPHY_EMBED_CHROME_STATUSBAR", "statusbar" },
- { EPHY_EMBED_CHROME_BOOKMARKSBAR, "EPHY_EMBED_CHROME_BOOKMARKSBAR", "bookmarksbar" },
- { 0, NULL, NULL }
- };
-
- type = g_flags_register_static ("EphyEmbedChrome", values);
- }
-
- return type;
-}
-
-GType
-ephy_embed_ppv_navigation_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_EMBED_PRINTPREVIEW_GOTO_PAGENUM, "EPHY_EMBED_PRINTPREVIEW_GOTO_PAGENUM", "page-num" },
- { EPHY_EMBED_PRINTPREVIEW_PREV_PAGE, "EPHY_EMBED_PRINTPREVIEW_PREV_PAGE", "prev" },
- { EPHY_EMBED_PRINTPREVIEW_NEXT_PAGE, "EPHY_EMBED_PRINTPREVIEW_NEXT_PAGE", "next" },
- { EPHY_EMBED_PRINTPREVIEW_HOME, "EPHY_EMBED_PRINTPREVIEW_HOME", "home" },
- { EPHY_EMBED_PRINTPREVIEW_END, "EPHY_EMBED_PRINTPREVIEW_END", "end" },
- { 0, NULL, NULL }
- };
-
- type = g_enum_register_static ("EphyEmbedPPVNavigation", values);
- }
-
- return type;
-}
-
-GType
-ephy_embed_security_level_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_EMBED_STATE_IS_UNKNOWN, "EPHY_EMBED_STATE_IS_UNKNOWN", "unknown" },
- { EPHY_EMBED_STATE_IS_INSECURE, "EPHY_EMBED_STATE_IS_INSECURE", "insecure" },
- { EPHY_EMBED_STATE_IS_BROKEN, "EPHY_EMBED_STATE_IS_BROKEN", "broken" },
- { EPHY_EMBED_STATE_IS_SECURE_LOW, "EPHY_EMBED_STATE_IS_SECURE_LOW", "low" },
- { EPHY_EMBED_STATE_IS_SECURE_MED, "EPHY_EMBED_STATE_IS_SECURE_MED", "medium" },
- { EPHY_EMBED_STATE_IS_SECURE_HIGH, "EPHY_EMBED_STATE_IS_SECURE_HIGH", "high" },
- { 0, NULL, NULL }
- };
-
- type = g_enum_register_static ("EphyEmbedSecurityLevel", values);
- }
-
- return type;
-}
-
-GType
-ephy_embed_document_type_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_EMBED_DOCUMENT_HTML, "EPHY_EMBED_DOCUMENT_HTML", "html" },
- { EPHY_EMBED_DOCUMENT_XML, "EPHY_EMBED_DOCUMENT_XML", "xml" },
- { EPHY_EMBED_DOCUMENT_IMAGE, "EPHY_EMBED_DOCUMENT_IMAGE", "image" },
- { EPHY_EMBED_DOCUMENT_OTHER, "EPHY_EMBED_DOCUMENT_OTHER", "other" },
- { 0, NULL, NULL }
- };
-
- type = g_enum_register_static ("EphyEmbedDocumentType", values);
- }
-
- return type;
-}
-
-GType
ephy_embed_get_type (void)
{
static GType type = 0;
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index b90e4c3a1..d08174183 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -36,28 +36,22 @@ G_BEGIN_DECLS
#define EPHY_IS_EMBED_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED))
#define EPHY_EMBED_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED, EphyEmbedIface))
-#define EPHY_TYPE_EMBED_NET_STATE (ephy_embed_net_state_get_type ())
-#define EPHY_TYPE_EMBED_CHROME (ephy_embed_chrome_get_type ())
-#define EPHY_TYPE_EMBED_SECURITY_LEVEL (ephy_embed_security_level_get_type ())
-#define EPHY_TYPE_EMBED_DOCUMENT_TYPE (ephy_embed_document_type_get_type ())
-#define EPHY_TYPE_EMBED_PRINT_PREVIEW_NAV_TYPE (ephy_embed_ppv_navigation_get_type ())
-
typedef struct _EphyEmbed EphyEmbed;
typedef struct _EphyEmbedIface EphyEmbedIface;
typedef enum
{
- EPHY_EMBED_STATE_UNKNOWN = 0,
+ EPHY_EMBED_STATE_UNKNOWN = 0,
EPHY_EMBED_STATE_START = 1 << 0,
- EPHY_EMBED_STATE_REDIRECTING = 1 << 1,
+ EPHY_EMBED_STATE_REDIRECTING = 1 << 1,
EPHY_EMBED_STATE_TRANSFERRING = 1 << 2,
- EPHY_EMBED_STATE_NEGOTIATING = 1 << 3,
+ EPHY_EMBED_STATE_NEGOTIATING = 1 << 3,
EPHY_EMBED_STATE_STOP = 1 << 4,
- EPHY_EMBED_STATE_IS_REQUEST = 1 << 5,
- EPHY_EMBED_STATE_IS_DOCUMENT = 1 << 6,
- EPHY_EMBED_STATE_IS_NETWORK = 1 << 7,
- EPHY_EMBED_STATE_IS_WINDOW = 1 << 8
+ EPHY_EMBED_STATE_IS_REQUEST = 1 << 5,
+ EPHY_EMBED_STATE_IS_DOCUMENT = 1 << 6,
+ EPHY_EMBED_STATE_IS_NETWORK = 1 << 7,
+ EPHY_EMBED_STATE_IS_WINDOW = 1 << 8
} EphyEmbedNetState;
typedef enum
@@ -76,8 +70,8 @@ typedef enum
typedef enum
{
EPHY_EMBED_PRINTPREVIEW_GOTO_PAGENUM = 0,
- EPHY_EMBED_PRINTPREVIEW_PREV_PAGE = 1,
- EPHY_EMBED_PRINTPREVIEW_NEXT_PAGE = 2,
+ EPHY_EMBED_PRINTPREVIEW_PREV_PAGE = 1,
+ EPHY_EMBED_PRINTPREVIEW_NEXT_PAGE = 2,
EPHY_EMBED_PRINTPREVIEW_HOME = 3,
EPHY_EMBED_PRINTPREVIEW_END = 4
} EphyEmbedPrintPreviewNavType;
diff --git a/embed/ephy-permission-manager.c b/embed/ephy-permission-manager.c
index f5a390964..a86506b6d 100644
--- a/embed/ephy-permission-manager.c
+++ b/embed/ephy-permission-manager.c
@@ -22,32 +22,10 @@
#include "config.h"
#include "ephy-permission-manager.h"
+#include "ephy-embed-type-builtins.h"
#include "ephy-marshal.h"
#include "ephy-debug.h"
-/* EphyPermissionInfo */
-
-GType
-ephy_permission_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_PERMISSION_ALLOWED, "EPHY_PERMISSION_ALLOWED", "allowed" },
- { EPHY_PERMISSION_DENIED, "EPHY_PERMISSION_DENIED", "denied" },
- { EPHY_PERMISSION_DEFAULT, "EPHY_PERMISSION_DEFAULT", "default" },
- { 0, NULL, NULL }
- };
-
- type = g_enum_register_static ("EphyPermission", values);
- }
-
- return type;
-}
-
GType
ephy_permission_info_get_type (void)
{
diff --git a/embed/ephy-permission-manager.h b/embed/ephy-permission-manager.h
index b3d2ec1d0..22e561d89 100644
--- a/embed/ephy-permission-manager.h
+++ b/embed/ephy-permission-manager.h
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
#define EPHY_PERMISSION_MANAGER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_PERMISSION_MANAGER, EphyPermissionManagerIface))
#define EPHY_TYPE_PERMISSION_INFO (ephy_permission_info_get_type ())
-#define EPHY_TYPE_PERMISSION (ephy_permission_get_type ())
#define EPT_COOKIE "cookie"
#define EPT_IMAGE "image"