aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-04 02:07:19 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-04 02:07:19 +0800
commitc4b9c39ec588430681b25d52a1cd5f57dab716d4 (patch)
tree6b35647c1ea93b1b6b9a185dbe7a043d0a631a46 /embed
parent3c97a9bf4a384a76c51e4684b2d9a02266cf458f (diff)
downloadgsoc2013-epiphany-c4b9c39ec588430681b25d52a1cd5f57dab716d4.tar.gz
gsoc2013-epiphany-c4b9c39ec588430681b25d52a1cd5f57dab716d4.tar.zst
gsoc2013-epiphany-c4b9c39ec588430681b25d52a1cd5f57dab716d4.zip
Add types for some enums and flags.
2005-01-03 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-event.c: (ephy_embed_event_context_get_type), (ephy_embed_event_type_get_type): * embed/ephy-embed-event.h: * embed/ephy-embed.c: (ephy_embed_net_state_get_type), (ephy_embed_ppv_navigation_get_type), (ephy_embed_security_level_get_type), (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/mozilla-embed.cpp: * lib/ephy-marshal.list: * src/ephy-tab.c: (update_net_state_message), (build_progress_from_requests), (ephy_tab_net_state_cb): Add types for some enums and flags.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-event.c48
-rw-r--r--embed/ephy-embed-event.h15
-rw-r--r--embed/ephy-embed.c83
-rw-r--r--embed/ephy-embed.h15
-rw-r--r--embed/mozilla/mozilla-embed.cpp6
5 files changed, 153 insertions, 14 deletions
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
index 00f92b6c5..a0ea523ea 100644
--- a/embed/ephy-embed-event.c
+++ b/embed/ephy-embed-event.c
@@ -25,6 +25,54 @@
#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[] =
+ {
+ { EMBED_CONTEXT_NONE, "EMBED_CONTEXT_NONE", "none" },
+ { EMBED_CONTEXT_DEFAULT, "EMBED_CONTEXT_DEFAULT", "default" },
+ { EMBED_CONTEXT_LINK, "EMBED_CONTEXT_LINK", "link" },
+ { EMBED_CONTEXT_IMAGE, "EMBED_CONTEXT_IMAGE", "image" },
+ { EMBED_CONTEXT_DOCUMENT, "EMBED_CONTEXT_DOCUMENT", "document" },
+ { EMBED_CONTEXT_INPUT, "EMBED_CONTEXT_INPUT", "input" },
+ { EMBED_CONTEXT_XUL, "EMBED_CONTEXT_XUL", "xul" },
+ { EMBED_CONTEXT_EMAIL_LINK, "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 d8790fad9..f3e342baf 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -34,8 +34,11 @@ 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))
-typedef struct EphyEmbedEventIface EphyEmbedEventIface;
-typedef struct EphyEmbedEvent EphyEmbedEvent;
+#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;
typedef enum
{
@@ -57,7 +60,7 @@ typedef enum
EPHY_EMBED_EVENT_KEY
} EphyEmbedEventType;
-struct EphyEmbedEventIface
+struct _EphyEmbedEventIface
{
GTypeInterface parent_iface;
@@ -76,7 +79,11 @@ struct EphyEmbedEventIface
gpointer (* get_dom_event) (EphyEmbedEvent *event);
};
-GType ephy_embed_event_get_type (void);
+GType ephy_embed_event_get_type (void);
+
+GType ephy_embed_event_context_get_type (void);
+
+GType ephy_embed_event_type_get_type (void);
EphyEmbedEventType ephy_embed_event_get_event_type (EphyEmbedEvent *event);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 2719808e4..4c2a2c0b4 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -30,6 +30,34 @@
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[] =
+ {
+ { EMBED_STATE_UNKNOWN, "EMBED_STATE_UNKNOWN", "unknown" },
+ { EMBED_STATE_START, "EMBED_STATE_START", "start" },
+ { EMBED_STATE_REDIRECTING, "EMBED_STATE_REDIRECTING", "redirecting" },
+ { EMBED_STATE_TRANSFERRING, "EMBED_STATE_TRANSFERRING", "transferring" },
+ { EMBED_STATE_NEGOTIATING, "EMBED_STATE_NEGOTIATING", "negotiating", },
+ { EMBED_STATE_STOP, "EMBED_STATE_STOP", "stop" },
+ { EMBED_STATE_IS_REQUEST, "EMBED_STATE_IS_REQUEST", "is-request" },
+ { EMBED_STATE_IS_DOCUMENT, "EMBED_STATE_IS_DOCUMENT", "is-document" },
+ { EMBED_STATE_IS_NETWORK, "EMBED_STATE_IS_NETWORK", "is-network" },
+ { EMBED_STATE_IS_WINDOW, "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;
@@ -52,6 +80,53 @@ ephy_embed_chrome_get_type (void)
}
GType
+ephy_embed_ppv_navigation_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GEnumValue values[] =
+ {
+ { PRINTPREVIEW_GOTO_PAGENUM, "PRINTPREVIEW_GOTO_PAGENUM", "page-num" },
+ { PRINTPREVIEW_PREV_PAGE, "PRINTPREVIEW_PREV_PAGE", "prev" },
+ { PRINTPREVIEW_NEXT_PAGE, "PRINTPREVIEW_NEXT_PAGE", "next" },
+ { PRINTPREVIEW_HOME, "PRINTPREVIEW_HOME", "home" },
+ { PRINTPREVIEW_END, "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[] =
+ {
+ { STATE_IS_UNKNOWN, "STATE_IS_UNKNOWN", "unknown" },
+ { STATE_IS_INSECURE, "STATE_IS_INSECURE", "insecure" },
+ { STATE_IS_BROKEN, "STATE_IS_BROKEN", "broken" },
+ { STATE_IS_SECURE_LOW, "STATE_IS_SECURE_LOW", "low" },
+ { STATE_IS_SECURE_MED, "STATE_IS_SECURE_MED", "medium" },
+ { STATE_IS_SECURE_HIGH, "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;
@@ -210,11 +285,11 @@ ephy_embed_base_init (gpointer g_class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EphyEmbedIface, net_state),
NULL, NULL,
- ephy_marshal_VOID__STRING_INT,
+ ephy_marshal_VOID__STRING_FLAGS,
G_TYPE_NONE,
2,
G_TYPE_STRING,
- G_TYPE_INT);
+ EPHY_TYPE_EMBED_NET_STATE);
/**
* EphyEmbed::ge-dom-mouse-click:
* @embed:
@@ -262,10 +337,10 @@ ephy_embed_base_init (gpointer g_class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyEmbedIface, security_change),
NULL, NULL,
- g_cclosure_marshal_VOID__INT,
+ g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE,
1,
- G_TYPE_INT);
+ EPHY_TYPE_EMBED_SECURITY_LEVEL);
/**
* EphyEmbed::ge-zoom-change:
* @embed:
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 5da274649..7540999de 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -36,7 +36,10 @@ 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_MASK (ephy_embed_chrome_get_type ())
+#define EPHY_TYPE_EMBED_PPV_NAVIGATION (ephy_embed_ppv_navigation_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 ())
typedef struct _EphyEmbed EphyEmbed;
@@ -55,7 +58,7 @@ typedef enum
EMBED_STATE_IS_DOCUMENT = 1 << 6,
EMBED_STATE_IS_NETWORK = 1 << 7,
EMBED_STATE_IS_WINDOW = 1 << 8
-} EmbedState;
+} EmbedNetState;
typedef enum
{
@@ -84,8 +87,8 @@ typedef enum
STATE_IS_UNKNOWN,
STATE_IS_INSECURE,
STATE_IS_BROKEN,
- STATE_IS_SECURE_MED,
STATE_IS_SECURE_LOW,
+ STATE_IS_SECURE_MED,
STATE_IS_SECURE_HIGH
} EmbedSecurityLevel;
@@ -123,7 +126,7 @@ struct _EphyEmbedIface
const char *location);
void (* net_state) (EphyEmbed *embed,
const char *uri,
- EmbedState state);
+ EmbedNetState state);
gboolean (* dom_mouse_click) (EphyEmbed *embed,
EphyEmbedEvent *event);
gboolean (* dom_mouse_down) (EphyEmbed *embed,
@@ -200,8 +203,14 @@ struct _EphyEmbedIface
gboolean (* has_modified_forms) (EphyEmbed *embed);
};
+GType ephy_embed_net_state_get_type (void);
+
GType ephy_embed_chrome_get_type (void);
+GType ephy_embed_ppv_navigation_get_type (void);
+
+GType ephy_embed_security_level_get_type (void);
+
GType ephy_embed_document_type_get_type (void);
GType ephy_embed_get_type (void);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 14a62ff46..8019e7fbe 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -836,13 +836,13 @@ mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI,
gint state, guint status,
MozillaEmbed *membed)
{
- EmbedState estate = EMBED_STATE_UNKNOWN;
+ EmbedNetState estate = EMBED_STATE_UNKNOWN;
int i;
struct
{
guint state;
- EmbedState embed_state;
+ EmbedNetState embed_state;
}
conversion_map [] =
{
@@ -861,7 +861,7 @@ mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI,
{
if (state & conversion_map[i].state)
{
- estate = (EmbedState) (estate | conversion_map[i].embed_state);
+ estate = (EmbedNetState) (estate | conversion_map[i].embed_state);
}
}