[epiphany/wip/modern_gobject: 1/14] EphyEmbedFormAuth: Use G_DECLARE_FINAL_TYPE
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/modern_gobject: 1/14] EphyEmbedFormAuth: Use G_DECLARE_FINAL_TYPE
- Date: Tue, 15 Sep 2015 00:09:54 +0000 (UTC)
commit 14239de28e197c0e131ae22e537bb5b9b04cef5a
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Thu Sep 10 18:47:25 2015 -0500
EphyEmbedFormAuth: Use G_DECLARE_FINAL_TYPE
embed/web-extension/ephy-embed-form-auth.c | 38 ++++++++++++++--------------
embed/web-extension/ephy-embed-form-auth.h | 21 +--------------
2 files changed, 21 insertions(+), 38 deletions(-)
---
diff --git a/embed/web-extension/ephy-embed-form-auth.c b/embed/web-extension/ephy-embed-form-auth.c
index 1cd232a..a4fef1e 100644
--- a/embed/web-extension/ephy-embed-form-auth.c
+++ b/embed/web-extension/ephy-embed-form-auth.c
@@ -21,8 +21,10 @@
#include <config.h>
#include "ephy-embed-form-auth.h"
-struct _EphyEmbedFormAuthPrivate
+struct _EphyEmbedFormAuth
{
+ GObject parent_instance;
+
guint64 page_id;
SoupURI *uri;
WebKitDOMNode *username_node;
@@ -35,12 +37,12 @@ G_DEFINE_TYPE (EphyEmbedFormAuth, ephy_embed_form_auth, G_TYPE_OBJECT)
static void
ephy_embed_form_auth_finalize (GObject *object)
{
- EphyEmbedFormAuthPrivate *priv = EPHY_EMBED_FORM_AUTH (object)->priv;
+ EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (object);
- if (priv->uri)
- soup_uri_free (priv->uri);
- g_clear_object (&priv->username_node);
- g_clear_object (&priv->password_node);
+ if (form_auth->uri)
+ soup_uri_free (form_auth->uri);
+ g_clear_object (&form_auth->username_node);
+ g_clear_object (&form_auth->password_node);
G_OBJECT_CLASS (ephy_embed_form_auth_parent_class)->finalize (object);
}
@@ -48,7 +50,6 @@ ephy_embed_form_auth_finalize (GObject *object)
static void
ephy_embed_form_auth_init (EphyEmbedFormAuth *form_auth)
{
- form_auth->priv = G_TYPE_INSTANCE_GET_PRIVATE (form_auth, EPHY_TYPE_EMBED_FORM_AUTH,
EphyEmbedFormAuthPrivate);
}
static void
@@ -57,7 +58,6 @@ ephy_embed_form_auth_class_init (EphyEmbedFormAuthClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ephy_embed_form_auth_finalize;
- g_type_class_add_private (object_class, sizeof (EphyEmbedFormAuthPrivate));
}
EphyEmbedFormAuth *
@@ -72,11 +72,11 @@ ephy_embed_form_auth_new (WebKitWebPage *web_page,
form_auth = EPHY_EMBED_FORM_AUTH (g_object_new (EPHY_TYPE_EMBED_FORM_AUTH, NULL));
- form_auth->priv->page_id = webkit_web_page_get_id (web_page);
- form_auth->priv->uri = soup_uri_new (webkit_web_page_get_uri (web_page));
- form_auth->priv->username_node = username_node;
- form_auth->priv->password_node = password_node;
- form_auth->priv->username = g_strdup (username);
+ form_auth->page_id = webkit_web_page_get_id (web_page);
+ form_auth->uri = soup_uri_new (webkit_web_page_get_uri (web_page));
+ form_auth->username_node = username_node;
+ form_auth->password_node = password_node;
+ form_auth->username = g_strdup (username);
return form_auth;
}
@@ -84,35 +84,35 @@ ephy_embed_form_auth_new (WebKitWebPage *web_page,
WebKitDOMNode *
ephy_embed_form_auth_get_username_node (EphyEmbedFormAuth *form_auth)
{
- return form_auth->priv->username_node;
+ return form_auth->username_node;
}
WebKitDOMNode *
ephy_embed_form_auth_get_password_node (EphyEmbedFormAuth *form_auth)
{
- return form_auth->priv->password_node;
+ return form_auth->password_node;
}
SoupURI *
ephy_embed_form_auth_get_uri (EphyEmbedFormAuth *form_auth)
{
- return form_auth->priv->uri;
+ return form_auth->uri;
}
guint64
ephy_embed_form_auth_get_page_id (EphyEmbedFormAuth *form_auth)
{
- return form_auth->priv->page_id;
+ return form_auth->page_id;
}
const char*
ephy_embed_form_auth_get_username (EphyEmbedFormAuth *form_auth)
{
- return form_auth->priv->username;
+ return form_auth->username;
}
WebKitDOMDocument *
ephy_embed_form_auth_get_owner_document (EphyEmbedFormAuth *form_auth)
{
- return webkit_dom_node_get_owner_document (form_auth->priv->password_node);
+ return webkit_dom_node_get_owner_document (form_auth->password_node);
}
diff --git a/embed/web-extension/ephy-embed-form-auth.h b/embed/web-extension/ephy-embed-form-auth.h
index 9e31248..022fadf 100644
--- a/embed/web-extension/ephy-embed-form-auth.h
+++ b/embed/web-extension/ephy-embed-form-auth.h
@@ -27,27 +27,10 @@
G_BEGIN_DECLS
-#define EPHY_TYPE_EMBED_FORM_AUTH (ephy_embed_form_auth_get_type ())
-#define EPHY_EMBED_FORM_AUTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_EMBED_FORM_AUTH,
EphyEmbedFormAuth))
-#define EPHY_IS_EMBED_FORM_AUTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_EMBED_FORM_AUTH))
+#define EPHY_TYPE_EMBED_FORM_AUTH (ephy_embed_form_auth_get_type ())
-typedef struct _EphyEmbedFormAuthClass EphyEmbedFormAuthClass;
-typedef struct _EphyEmbedFormAuth EphyEmbedFormAuth;
-typedef struct _EphyEmbedFormAuthPrivate EphyEmbedFormAuthPrivate;
+G_DECLARE_FINAL_TYPE (EphyEmbedFormAuth, ephy_embed_form_auth, EPHY, EMBED_FORM_AUTH, GObject)
-struct _EphyEmbedFormAuth
-{
- GObject parent;
-
- EphyEmbedFormAuthPrivate *priv;
-};
-
-struct _EphyEmbedFormAuthClass
-{
- GObjectClass parent_class;
-};
-
-GType ephy_embed_form_auth_get_type (void);
EphyEmbedFormAuth *ephy_embed_form_auth_new (WebKitWebPage *web_page,
WebKitDOMNode *username_node,
WebKitDOMNode *password_node,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]