[gcr/main] gcr-prompt: Use G_DECLARE_INTERFACE to define the interface
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/main] gcr-prompt: Use G_DECLARE_INTERFACE to define the interface
- Date: Thu, 9 Dec 2021 10:48:49 +0000 (UTC)
commit 5d5d69efff114d7a77fe2feea03099b991702998
Author: Corentin Noël <corentin noel collabora com>
Date: Thu Dec 9 11:47:41 2021 +0100
gcr-prompt: Use G_DECLARE_INTERFACE to define the interface
This means that GcrPromptIface becomes GcrPromptInterface and
GCR_PROMPT_GET_INTERFACE becomes GCR_PROMPT_GET_IFACE.
Signed-off-by: Corentin Noël <corentin noel collabora com>
gcr/gcr-mock-prompter.c | 4 ++--
gcr/gcr-prompt.c | 30 ++++++++++++++----------------
gcr/gcr-prompt.h | 13 +++----------
gcr/gcr-system-prompt.c | 4 ++--
gcr/gcr-system-prompter.c | 2 +-
5 files changed, 22 insertions(+), 31 deletions(-)
---
diff --git a/gcr/gcr-mock-prompter.c b/gcr/gcr-mock-prompter.c
index 1ca4589..0fb6221 100644
--- a/gcr/gcr-mock-prompter.c
+++ b/gcr/gcr-mock-prompter.c
@@ -101,7 +101,7 @@ typedef struct {
static gint prompts_a_prompting = 0;
static ThreadData *running = NULL;
-static void gcr_mock_prompt_iface (GcrPromptIface *iface);
+static void gcr_mock_prompt_iface (GcrPromptInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrMockPrompt, _gcr_mock_prompt, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GCR_TYPE_PROMPT, gcr_mock_prompt_iface);
@@ -558,7 +558,7 @@ gcr_mock_prompt_password_finish (GcrPrompt *prompt,
}
static void
-gcr_mock_prompt_iface (GcrPromptIface *iface)
+gcr_mock_prompt_iface (GcrPromptInterface *iface)
{
iface->prompt_confirm_async = gcr_mock_prompt_confirm_async;
iface->prompt_confirm_finish = gcr_mock_prompt_confirm_finish;
diff --git a/gcr/gcr-prompt.c b/gcr/gcr-prompt.c
index 3c8ed2a..56c1e0f 100644
--- a/gcr/gcr-prompt.c
+++ b/gcr/gcr-prompt.c
@@ -49,7 +49,7 @@
*/
/**
- * GcrPromptIface:
+ * GcrPromptInterface:
* @parent_iface: parent interface
* @prompt_password_async: begin a password prompt
* @prompt_password_finish: complete a password prompt
@@ -81,14 +81,12 @@ typedef struct {
GMainContext *context;
} RunClosure;
-typedef GcrPromptIface GcrPromptInterface;
-
-static void gcr_prompt_default_init (GcrPromptIface *iface);
+static void gcr_prompt_default_init (GcrPromptInterface *iface);
G_DEFINE_INTERFACE (GcrPrompt, gcr_prompt, G_TYPE_OBJECT);
static void
-gcr_prompt_default_init (GcrPromptIface *iface)
+gcr_prompt_default_init (GcrPromptInterface *iface)
{
static gsize initialized = 0;
@@ -240,7 +238,7 @@ gcr_prompt_default_init (GcrPromptIface *iface)
* You can use the [method@Prompt.close] method to emit this signal.
*/
signals[PROMPT_CLOSE] = g_signal_new ("prompt-close", GCR_TYPE_PROMPT, G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GcrPromptIface, prompt_close),
+ G_STRUCT_OFFSET (GcrPromptInterface, prompt_close),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
@@ -297,12 +295,12 @@ void
gcr_prompt_reset (GcrPrompt *prompt)
{
GParamSpec **params;
- GcrPromptIface *iface;
+ GcrPromptInterface *iface;
guint i, n_params;
g_return_if_fail (GCR_IS_PROMPT (prompt));
- iface = GCR_PROMPT_GET_INTERFACE (prompt);
+ iface = GCR_PROMPT_GET_IFACE (prompt);
params = g_object_interface_list_properties (iface, &n_params);
g_object_freeze_notify (G_OBJECT (prompt));
@@ -770,12 +768,12 @@ gcr_prompt_password_async (GcrPrompt *prompt,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GcrPromptIface *iface;
+ GcrPromptInterface *iface;
g_return_if_fail (GCR_IS_PROMPT (prompt));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
- iface = GCR_PROMPT_GET_INTERFACE (prompt);
+ iface = GCR_PROMPT_GET_IFACE (prompt);
g_return_if_fail (iface->prompt_password_async);
(iface->prompt_password_async) (prompt, cancellable, callback, user_data);
@@ -803,13 +801,13 @@ gcr_prompt_password_finish (GcrPrompt *prompt,
GAsyncResult *result,
GError **error)
{
- GcrPromptIface *iface;
+ GcrPromptInterface *iface;
g_return_val_if_fail (GCR_IS_PROMPT (prompt), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- iface = GCR_PROMPT_GET_INTERFACE (prompt);
+ iface = GCR_PROMPT_GET_IFACE (prompt);
g_return_val_if_fail (iface->prompt_password_async, NULL);
return (iface->prompt_password_finish) (prompt, result, error);
@@ -924,12 +922,12 @@ gcr_prompt_confirm_async (GcrPrompt *prompt,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GcrPromptIface *iface;
+ GcrPromptInterface *iface;
g_return_if_fail (GCR_IS_PROMPT (prompt));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
- iface = GCR_PROMPT_GET_INTERFACE (prompt);
+ iface = GCR_PROMPT_GET_IFACE (prompt);
g_return_if_fail (iface->prompt_confirm_async);
(iface->prompt_confirm_async) (prompt, cancellable, callback, user_data);
@@ -954,13 +952,13 @@ gcr_prompt_confirm_finish (GcrPrompt *prompt,
GAsyncResult *result,
GError **error)
{
- GcrPromptIface *iface;
+ GcrPromptInterface *iface;
g_return_val_if_fail (GCR_IS_PROMPT (prompt), GCR_PROMPT_REPLY_CANCEL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), GCR_PROMPT_REPLY_CANCEL);
g_return_val_if_fail (error == NULL || *error == NULL, GCR_PROMPT_REPLY_CANCEL);
- iface = GCR_PROMPT_GET_INTERFACE (prompt);
+ iface = GCR_PROMPT_GET_IFACE (prompt);
g_return_val_if_fail (iface->prompt_confirm_async, GCR_PROMPT_REPLY_CANCEL);
return (iface->prompt_confirm_finish) (prompt, result, error);
diff --git a/gcr/gcr-prompt.h b/gcr/gcr-prompt.h
index 56b9339..0a56ad1 100644
--- a/gcr/gcr-prompt.h
+++ b/gcr/gcr-prompt.h
@@ -37,15 +37,10 @@ typedef enum {
GCR_PROMPT_REPLY_CONTINUE = 1,
} GcrPromptReply;
-#define GCR_TYPE_PROMPT (gcr_prompt_get_type ())
-#define GCR_PROMPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_PROMPT, GcrPrompt))
-#define GCR_IS_PROMPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_PROMPT))
-#define GCR_PROMPT_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCR_TYPE_PROMPT,
GcrPromptIface))
+#define GCR_TYPE_PROMPT gcr_prompt_get_type ()
+G_DECLARE_INTERFACE (GcrPrompt, gcr_prompt, GCR, PROMPT, GObject)
-typedef struct _GcrPrompt GcrPrompt;
-typedef struct _GcrPromptIface GcrPromptIface;
-
-struct _GcrPromptIface {
+struct _GcrPromptInterface {
GTypeInterface parent_iface;
void (* prompt_password_async) (GcrPrompt *prompt,
@@ -69,8 +64,6 @@ struct _GcrPromptIface {
void (* prompt_close) (GcrPrompt *prompt);
};
-GType gcr_prompt_get_type (void);
-
void gcr_prompt_reset (GcrPrompt *prompt);
gchar * gcr_prompt_get_title (GcrPrompt *prompt);
diff --git a/gcr/gcr-system-prompt.c b/gcr/gcr-system-prompt.c
index ceba221..0c27abc 100644
--- a/gcr/gcr-system-prompt.c
+++ b/gcr/gcr-system-prompt.c
@@ -106,7 +106,7 @@ struct _GcrSystemPromptPrivate {
gchar *last_response;
};
-static void gcr_system_prompt_prompt_iface (GcrPromptIface *iface);
+static void gcr_system_prompt_prompt_iface (GcrPromptInterface *iface);
static void gcr_system_prompt_initable_iface (GInitableIface *iface);
@@ -1322,7 +1322,7 @@ gcr_system_prompt_real_close (GcrPrompt *prompt)
}
static void
-gcr_system_prompt_prompt_iface (GcrPromptIface *iface)
+gcr_system_prompt_prompt_iface (GcrPromptInterface *iface)
{
iface->prompt_password_async = gcr_system_prompt_password_async;
iface->prompt_password_finish = gcr_system_prompt_password_finish;
diff --git a/gcr/gcr-system-prompter.c b/gcr/gcr-system-prompter.c
index ef22e29..0f993ee 100644
--- a/gcr/gcr-system-prompter.c
+++ b/gcr/gcr-system-prompter.c
@@ -439,7 +439,7 @@ prompt_build_properties (GcrPrompt *prompt,
while (g_hash_table_iter_next (&iter, (gpointer *)&property_name, NULL)) {
/* Make sure this property is on the prompt interface */
- pspec = g_object_interface_find_property (GCR_PROMPT_GET_INTERFACE (obj),
+ pspec = g_object_interface_find_property (GCR_PROMPT_GET_IFACE (obj),
property_name);
if (pspec == NULL)
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]