aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent58a62ea3932ab6bdb599a0c519460a56622fe884 (diff)
downloadgsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.gz
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.bz2
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.lz
gsoc2013-epiphany-35ad841aceed89072e2cc6f589405a6feb411f74.tar.xz
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 'src')
-rw-r--r--src/Makefile.am47
-rw-r--r--src/ephy-link.c22
-rw-r--r--src/ephy-link.h2
-rw-r--r--src/ephy-navigation-action.c1
-rw-r--r--src/ephy-shell.c93
-rw-r--r--src/ephy-shell.h14
-rw-r--r--src/ephy-tab.c40
-rw-r--r--src/ephy-tab.h3
-rw-r--r--src/ephy-window.c2
9 files changed, 57 insertions, 167 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index eb0b110cf..eb40d34ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,9 @@ $(CORBA_SOURCE): $(idls) $(ORBIT_IDL)
$(ORBIT_IDL) $(idl_flags) $(idls)
headerdir = $(prefix)/include/epiphany-@EPIPHANY_MAJOR@/epiphany
-header_DATA = $(INST_H_FILES)
+header_DATA = \
+ ephy-type-builtins.h \
+ $(INST_H_FILES)
NOINST_H_FILES = \
ephy-automation.h \
@@ -55,7 +57,7 @@ INST_H_FILES = \
ephy-window.h
libephymain_la_SOURCES = \
- $(CORBA_SOURCE) \
+ $(BUILT_SOURCES) \
ephy-automation.c \
ephy-completion-model.c \
ephy-completion-model.h \
@@ -91,6 +93,7 @@ libephymain_la_SOURCES = \
libephymain_la_CPPFLAGS = \
-I$(top_builddir)/lib \
+ -I$(top_builddir)/embed \
-I$(top_srcdir)/embed \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/egg \
@@ -141,7 +144,45 @@ epiphany_LDADD = \
$(EPIPHANY_DEPENDENCY_LIBS) \
$(INTLLIBS)
-BUILT_SOURCES = $(CORBA_SOURCE)
+BUILT_SOURCES = \
+ $(CORBA_SOURCE) \
+ $(TYPES_SOURCE)
+
+TYPES_SOURCE = \
+ ephy-type-builtins.c \
+ ephy-type-builtins.h
+
+ephy-type-builtins.c: $(INST_H_FILES) $(NOINST_H_FILES)
+ ( cd $(srcdir) && $(GLIB_MKENUMS) \
+ --fhead "#include \"ephy-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" \
+ $(INST_H_FILES) $(NOINST_H_FILES) ) > xgen-$(@F) \
+ && ( cmp -s xgen-$(@F) $(@F) || cp xgen-$(@F) $(@F) ) \
+ && rm -f xgen-$(@F)
+
+ephy-type-builtins.h: $(INST_H_FILES) $(NOINST_H_FILES)
+ ( cd $(srcdir) && $(GLIB_MKENUMS) \
+ --fhead "#ifndef EPHY_TYPE_BUILTINS_H\n" \
+ --fhead "#define EPHY_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_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" \
+ $(INST_H_FILES) $(NOINST_H_FILES) ) > xgen-$(@F) \
+ && ( cmp -s xgen-$(@F) $(@F) || cp xgen-$(@F) $(@F) ) \
+ && rm -f xgen-$(@F)
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(BUILT_SOURCES)
diff --git a/src/ephy-link.c b/src/ephy-link.c
index 6adb758bc..4b1ec7288 100644
--- a/src/ephy-link.c
+++ b/src/ephy-link.c
@@ -22,31 +22,11 @@
#include "ephy-link.h"
+#include "ephy-type-builtins.h"
#include "ephy-marshal.h"
#include "ephy-signal-accumulator.h"
#include "ephy-debug.h"
-GType
-ephy_link_flags_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_LINK_NEW_WINDOW, "EPHY_LINK_NEW_WINDOW", "new-window" },
- { EPHY_LINK_NEW_TAB, "EPHY_LINK_NEW_TAB", "new-tab" },
- { EPHY_LINK_JUMP_TO, "EPHY_LINK_JUMP_TO", "jump-to" },
- { 0, NULL, NULL }
- };
-
- type = g_flags_register_static ("EphyLinkFlags", values);
- }
-
- return type;
-}
-
enum
{
OPEN_LINK,
diff --git a/src/ephy-link.h b/src/ephy-link.h
index 12fad7d6c..a1e80cf03 100644
--- a/src/ephy-link.h
+++ b/src/ephy-link.h
@@ -34,8 +34,6 @@ G_BEGIN_DECLS
#define EPHY_IS_LINK_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_LINK))
#define EPHY_LINK_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_LINK, EphyLinkIface))
-#define EPHY_TYPE_LINK_FLAGS (ephy_link_flags_get_type ())
-
typedef struct _EphyLink EphyLink;
typedef struct _EphyLinkIface EphyLinkIface;
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c
index 61300aa93..bd094f0ed 100644
--- a/src/ephy-navigation-action.c
+++ b/src/ephy-navigation-action.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "ephy-navigation-action.h"
+#include "ephy-type-builtins.h"
#include "ephy-window.h"
#include "ephy-favicon-cache.h"
#include "ephy-history.h"
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index cd64585c1..1e9fb000b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "ephy-shell.h"
+#include "ephy-type-builtins.h"
#include "ephy-embed-shell.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
@@ -57,7 +58,7 @@
#define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate))
-struct EphyShellPrivate
+struct _EphyShellPrivate
{
BonoboGenericFactory *automation_factory;
EphySession *session;
@@ -94,96 +95,6 @@ ephy_shell_error_quark (void)
return q;
}
-
-GType
-ephy_shell_error_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_SHELL_ERROR_MISSING_SERVER,
- "EPHY_SHELL_ERROR_MISSING_SERVER", "missing-server" },
- { EPHY_SHELL_ERROR_OBJECT_REG_FAILED,
- "EPHY_SHELL_ERROR_OBJECT_REG_FAILED", "object-reg-failed" },
- { EPHY_SHELL_ERROR_FACTORY_REG_FAILED,
- "EPHY_SHELL_ERROR_FACTORY_REG_FAILED", "factory-reg-failed" },
- { 0, NULL, NULL }
- };
- type = g_enum_register_static ("EphyShellError", values);
- }
- return type;
-}
-
-GType
-ephy_shell_startup_flags_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_SHELL_STARTUP_TABS, "EPHY_SHELL_STARTUP_TABS",
- "tabs" },
- { EPHY_SHELL_STARTUP_EXISTING_WINDOW, "EPHY_SHELL_STARTUP_EXISTING_WINDOW",
- "existing-window" },
- { EPHY_SHELL_STARTUP_FULLSCREEN, "EPHY_SHELL_STARTUP_FULLSCREEN",
- "fullscreen" },
- { EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR, "EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR",
- "bookmarks-editor" },
- { EPHY_SHELL_STARTUP_SESSION, "EPHY_SHELL_STARTUP_SESSION",
- "session" },
- { EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS, "EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS",
- "import-bookmarks" },
- { EPHY_SHELL_STARTUP_ADD_BOOKMARK, "EPHY_SHELL_STARTUP_ADD_BOOKMARK",
- "add-bookmark" },
- { 0, NULL, NULL }
- };
- type = g_flags_register_static ("EphyShellStartupFlags", values);
- }
- return type;
-}
-
-
-GType
-ephy_new_tab_flags_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_NEW_TAB_HOME_PAGE, "EPHY_NEW_TAB_HOME_PAGE",
- "home-page" },
- { EPHY_NEW_TAB_NEW_PAGE, "EPHY_NEW_TAB_NEW_PAGE",
- "new-page" },
- { EPHY_NEW_TAB_OPEN_PAGE, "EPHY_NEW_TAB_OPEN_PAGE",
- "open-page" },
- { EPHY_NEW_TAB_FULLSCREEN_MODE, "EPHY_NEW_TAB_FULLSCREEN_MODE",
- "fullscreen-mode" },
- { EPHY_NEW_TAB_APPEND_LAST, "EPHY_NEW_TAB_APPEND_LAST",
- "append-last" },
- { EPHY_NEW_TAB_APPEND_AFTER, "EPHY_NEW_TAB_APPEND_AFTER",
- "append-after" },
- { EPHY_NEW_TAB_JUMP, "EPHY_NEW_TAB_JUMP",
- "jump" },
- { EPHY_NEW_TAB_IN_NEW_WINDOW, "EPHY_NEW_TAB_IN_NEW_WINDOW",
- "new-window" },
- { EPHY_NEW_TAB_IN_EXISTING_WINDOW, "EPHY_NEW_TAB_IN_EXISTING_WINDOW",
- "existing-window" },
- { 0, NULL, NULL }
- };
- type = g_flags_register_static ("EphyNewTabFlags", values);
- }
- return type;
-}
-
-
-
GType
ephy_shell_get_type (void)
{
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index b12b30af8..d807cd139 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -38,14 +38,10 @@ G_BEGIN_DECLS
#define EPHY_IS_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SHELL))
#define EPHY_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SHELL))
#define EPHY_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SHELL, EphyShellClass))
-#define EPHY_TYPE_SHELL_ERROR (ephy_shell_error_get_type())
-#define EPHY_TYPE_SHELL_STARTUP_FLAGS (ephy_shell_startup_flags_get_type())
-#define EPHY_TYPE_NEW_TAB_FLAGS (ephy_new_tab_flags_get_type())
-
-typedef struct EphyShell EphyShell;
-typedef struct EphyShellClass EphyShellClass;
-typedef struct EphyShellPrivate EphyShellPrivate;
+typedef struct _EphyShell EphyShell;
+typedef struct _EphyShellClass EphyShellClass;
+typedef struct _EphyShellPrivate EphyShellPrivate;
extern EphyShell *ephy_shell;
@@ -87,7 +83,7 @@ typedef enum
EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 11
} EphyNewTabFlags;
-struct EphyShell
+struct _EphyShell
{
EphyEmbedShell parent;
@@ -95,7 +91,7 @@ struct EphyShell
EphyShellPrivate *priv;
};
-struct EphyShellClass
+struct _EphyShellClass
{
EphyEmbedShellClass parent_class;
};
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 63b28eda6..a76f2b051 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -24,6 +24,8 @@
#include "config.h"
#include "ephy-tab.h"
+#include "ephy-type-builtins.h"
+#include "ephy-embed-type-builtins.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-embed-factory.h"
@@ -142,44 +144,6 @@ static guint popup_blocker_n_hidden (EphyTab *tab);
static gboolean ephy_tab_get_popups_allowed (EphyTab *tab);
static void ephy_tab_set_popups_allowed (EphyTab *tab,
gboolean allowed);
-GType
-ephy_tab_address_expire_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GEnumValue values[] =
- {
- { EPHY_TAB_ADDRESS_EXPIRE_NOW, "EPHY_TAB_ADDRESS_EXPIRE_NOW", "expire-now" },
- { EPHY_TAB_ADDRESS_EXPIRE_NEXT, "EPHY_TAB_ADDRESS_EXPIRE_NEXT", "expire-next" },
- { EPHY_TAB_ADDRESS_EXPIRE_CURRENT, "EPHY_TAB_ADDRESS_EXPIRE_CURRENT", "expire-current" },
- { 0, NULL, NULL }
- };
- type = g_enum_register_static ("EphyTabAddressExpire", values);
- }
- return type;
-}
-
-GType
-ephy_tab_navigation_flags_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GFlagsValue values[] =
- {
- { EPHY_TAB_NAV_UP, "EPHY_TAB_NAV_UP", "up" },
- { EPHY_TAB_NAV_BACK, "EPHY_TAB_NAV_BACK", "back" },
- { EPHY_TAB_NAV_FORWARD, "EPHY_TAB_NAV_FORWARD", "forward" },
- { 0, NULL, NULL }
- };
- type = g_flags_register_static ("EphyTabNavigationFlags", values);
- }
- return type;
-}
-
/* Class functions */
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index f140d398a..474030400 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -35,9 +35,6 @@ G_BEGIN_DECLS
#define EPHY_IS_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TAB))
#define EPHY_TAB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TAB, EphyTabClass))
-#define EPHY_TYPE_TAB_NAVIGATION_FLAGS (ephy_tab_navigation_flags_get_type())
-#define EPHY_TYPE_TAB_ADDRESS_EXPIRE (ephy_tab_address_expire_get_type())
-
typedef struct _EphyTabClass EphyTabClass;
typedef struct _EphyTab EphyTab;
typedef struct _EphyTabPrivate EphyTabPrivate;
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4ae0c4a84..70b508986 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -23,6 +23,8 @@
#include "config.h"
#include "ephy-window.h"
+#include "ephy-type-builtins.h"
+#include "ephy-embed-type-builtins.h"
#include "ephy-command-manager.h"
#include "ephy-bookmarks-menu.h"
#include "ephy-favorites-menu.h"