[gtksourceview/wip/chergert/gsv-gtk4: 38/84] completion: modernize GtkSourceCompletionProposal



commit 4e4c769929115bf1517ac999dcd48f474b2aa8b5
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 9 14:40:14 2020 -0800

    completion: modernize GtkSourceCompletionProposal
    
     - Use G_DELARE_
     - Fix interface names

 .../words/gtksourcecompletionwordsproposal.c       |  2 +-
 gtksourceview/gtksourcecompletionitem.c            |  2 +-
 gtksourceview/gtksourcecompletionproposal.c        | 24 ++++----
 gtksourceview/gtksourcecompletionproposal.h        | 71 ++++++++--------------
 4 files changed, 40 insertions(+), 59 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
index 52dbfe8b..9ec50b37 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
@@ -55,7 +55,7 @@ static void
 gtk_source_completion_proposal_iface_init (gpointer g_iface,
                                            gpointer iface_data)
 {
-       GtkSourceCompletionProposalIface *iface = (GtkSourceCompletionProposalIface *)g_iface;
+       GtkSourceCompletionProposalInterface *iface = (GtkSourceCompletionProposalInterface *)g_iface;
 
        /* Interface data getter implementations */
        iface->get_label = gtk_source_completion_words_proposal_get_text;
diff --git a/gtksourceview/gtksourcecompletionitem.c b/gtksourceview/gtksourcecompletionitem.c
index e81ae72c..23ec2632 100644
--- a/gtksourceview/gtksourcecompletionitem.c
+++ b/gtksourceview/gtksourcecompletionitem.c
@@ -132,7 +132,7 @@ static void
 gtk_source_completion_proposal_iface_init (gpointer g_iface,
                                            gpointer iface_data)
 {
-       GtkSourceCompletionProposalIface *iface = g_iface;
+       GtkSourceCompletionProposalInterface *iface = g_iface;
 
        /* Interface data getter implementations */
        iface->get_label = gtk_source_completion_proposal_get_label_impl;
diff --git a/gtksourceview/gtksourcecompletionproposal.c b/gtksourceview/gtksourcecompletionproposal.c
index 6bd71bfd..8813b0df 100644
--- a/gtksourceview/gtksourcecompletionproposal.c
+++ b/gtksourceview/gtksourcecompletionproposal.c
@@ -51,8 +51,6 @@ enum
 
 static guint signals[N_SIGNALS];
 
-typedef GtkSourceCompletionProposalIface GtkSourceCompletionProposalInterface;
-
 G_DEFINE_INTERFACE (GtkSourceCompletionProposal, gtk_source_completion_proposal, G_TYPE_OBJECT)
 
 static gchar *
@@ -111,7 +109,7 @@ gtk_source_completion_proposal_equal_default (GtkSourceCompletionProposal *propo
 }
 
 static void
-gtk_source_completion_proposal_default_init (GtkSourceCompletionProposalIface *iface)
+gtk_source_completion_proposal_default_init (GtkSourceCompletionProposalInterface *iface)
 {
        static gboolean initialized = FALSE;
 
@@ -139,7 +137,7 @@ gtk_source_completion_proposal_default_init (GtkSourceCompletionProposalIface *i
                        g_signal_new ("changed",
                              G_TYPE_FROM_INTERFACE (iface),
                              G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_STRUCT_OFFSET (GtkSourceCompletionProposalIface, changed),
+                             G_STRUCT_OFFSET (GtkSourceCompletionProposalInterface, changed),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE, 0);
@@ -167,7 +165,7 @@ gtk_source_completion_proposal_get_label (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_label (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_label (proposal);
 }
 
 /**
@@ -186,7 +184,7 @@ gtk_source_completion_proposal_get_markup (GtkSourceCompletionProposal *proposal
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_markup (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_markup (proposal);
 }
 
 /**
@@ -207,7 +205,7 @@ gtk_source_completion_proposal_get_text (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_text (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_text (proposal);
 }
 
 /**
@@ -223,7 +221,7 @@ gtk_source_completion_proposal_get_icon (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_icon (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_icon (proposal);
 }
 
 /**
@@ -241,7 +239,7 @@ gtk_source_completion_proposal_get_icon_name (GtkSourceCompletionProposal *propo
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_icon_name (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_icon_name (proposal);
 }
 
 /**
@@ -259,7 +257,7 @@ gtk_source_completion_proposal_get_gicon (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_gicon (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_gicon (proposal);
 }
 
 /**
@@ -279,7 +277,7 @@ gtk_source_completion_proposal_get_info (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), NULL);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_info (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->get_info (proposal);
 }
 
 /**
@@ -297,7 +295,7 @@ gtk_source_completion_proposal_hash (GtkSourceCompletionProposal *proposal)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), 0);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->hash (proposal);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->hash (proposal);
 }
 
 /**
@@ -318,7 +316,7 @@ gtk_source_completion_proposal_equal (GtkSourceCompletionProposal *proposal,
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal), FALSE);
        g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (other), FALSE);
 
-       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->equal (proposal, other);
+       return GTK_SOURCE_COMPLETION_PROPOSAL_GET_IFACE (proposal)->equal (proposal, other);
 }
 
 /**
diff --git a/gtksourceview/gtksourcecompletionproposal.h b/gtksourceview/gtksourcecompletionproposal.h
index c1bca136..cf9c640b 100644
--- a/gtksourceview/gtksourcecompletionproposal.h
+++ b/gtksourceview/gtksourcecompletionproposal.h
@@ -32,15 +32,13 @@
 
 G_BEGIN_DECLS
 
-#define GTK_SOURCE_TYPE_COMPLETION_PROPOSAL                    (gtk_source_completion_proposal_get_type ())
-#define GTK_SOURCE_COMPLETION_PROPOSAL(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GTK_SOURCE_TYPE_COMPLETION_PROPOSAL, GtkSourceCompletionProposal))
-#define GTK_SOURCE_IS_COMPLETION_PROPOSAL(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GTK_SOURCE_TYPE_COMPLETION_PROPOSAL))
-#define GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
GTK_SOURCE_TYPE_COMPLETION_PROPOSAL, GtkSourceCompletionProposalIface))
+#define GTK_SOURCE_TYPE_COMPLETION_PROPOSAL (gtk_source_completion_proposal_get_type ())
 
-typedef struct _GtkSourceCompletionProposalIface       GtkSourceCompletionProposalIface;
+GTK_SOURCE_AVAILABLE_IN_ALL
+G_DECLARE_INTERFACE (GtkSourceCompletionProposal, gtk_source_completion_proposal, GTK_SOURCE, 
COMPLETION_PROPOSAL, GObject)
 
 /**
- * GtkSourceCompletionProposalIface:
+ * GtkSourceCompletionProposalInterface:
  * @parent: The parent interface.
  * @get_label: The virtual function pointer for gtk_source_completion_proposal_get_label().
  * By default, %NULL is returned.
@@ -64,61 +62,46 @@ typedef struct _GtkSourceCompletionProposalIface    GtkSourceCompletionProposalIfac
  *
  * The virtual function table for #GtkSourceCompletionProposal.
  */
-struct _GtkSourceCompletionProposalIface
+struct _GtkSourceCompletionProposalInterface
 {
        GTypeInterface parent;
 
        /* Interface functions */
-       gchar           *(*get_label)           (GtkSourceCompletionProposal *proposal);
-       gchar           *(*get_markup)          (GtkSourceCompletionProposal *proposal);
-       gchar           *(*get_text)            (GtkSourceCompletionProposal *proposal);
-
-       GdkPixbuf       *(*get_icon)            (GtkSourceCompletionProposal *proposal);
-       const gchar     *(*get_icon_name)       (GtkSourceCompletionProposal *proposal);
-       GIcon           *(*get_gicon)           (GtkSourceCompletionProposal *proposal);
-
-       gchar           *(*get_info)            (GtkSourceCompletionProposal *proposal);
-
-       guint            (*hash)                (GtkSourceCompletionProposal *proposal);
-       gboolean         (*equal)               (GtkSourceCompletionProposal *proposal,
-                                                GtkSourceCompletionProposal *other);
+       gchar           *(*get_label)     (GtkSourceCompletionProposal *proposal);
+       gchar           *(*get_markup)    (GtkSourceCompletionProposal *proposal);
+       gchar           *(*get_text)      (GtkSourceCompletionProposal *proposal);
+       GdkPixbuf       *(*get_icon)      (GtkSourceCompletionProposal *proposal);
+       const gchar     *(*get_icon_name) (GtkSourceCompletionProposal *proposal);
+       GIcon           *(*get_gicon)     (GtkSourceCompletionProposal *proposal);
+       gchar           *(*get_info)      (GtkSourceCompletionProposal *proposal);
+       guint            (*hash)          (GtkSourceCompletionProposal *proposal);
+       gboolean         (*equal)         (GtkSourceCompletionProposal *proposal,
+                                          GtkSourceCompletionProposal *other);
 
        /* Signals */
-       void             (*changed)             (GtkSourceCompletionProposal *proposal);
+       void             (*changed)       (GtkSourceCompletionProposal *proposal);
 };
 
 GTK_SOURCE_AVAILABLE_IN_ALL
-GType                   gtk_source_completion_proposal_get_type        (void) G_GNUC_CONST;
-
+gchar       *gtk_source_completion_proposal_get_label     (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-gchar                  *gtk_source_completion_proposal_get_label       (GtkSourceCompletionProposal 
*proposal);
-
+gchar       *gtk_source_completion_proposal_get_markup    (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-gchar                  *gtk_source_completion_proposal_get_markup      (GtkSourceCompletionProposal 
*proposal);
-
+gchar       *gtk_source_completion_proposal_get_text      (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-gchar                  *gtk_source_completion_proposal_get_text        (GtkSourceCompletionProposal 
*proposal);
-
-GTK_SOURCE_AVAILABLE_IN_ALL
-GdkPixbuf              *gtk_source_completion_proposal_get_icon        (GtkSourceCompletionProposal 
*proposal);
-
+GdkPixbuf   *gtk_source_completion_proposal_get_icon      (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_3_18
-const gchar            *gtk_source_completion_proposal_get_icon_name   (GtkSourceCompletionProposal 
*proposal);
-
+const gchar *gtk_source_completion_proposal_get_icon_name (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_3_18
-GIcon                  *gtk_source_completion_proposal_get_gicon       (GtkSourceCompletionProposal 
*proposal);
-
+GIcon       *gtk_source_completion_proposal_get_gicon     (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-gchar                  *gtk_source_completion_proposal_get_info        (GtkSourceCompletionProposal 
*proposal);
-
+gchar       *gtk_source_completion_proposal_get_info      (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-void                    gtk_source_completion_proposal_changed         (GtkSourceCompletionProposal 
*proposal);
-
+void         gtk_source_completion_proposal_changed       (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-guint                   gtk_source_completion_proposal_hash            (GtkSourceCompletionProposal 
*proposal);
-
+guint        gtk_source_completion_proposal_hash          (GtkSourceCompletionProposal *proposal);
 GTK_SOURCE_AVAILABLE_IN_ALL
-gboolean                gtk_source_completion_proposal_equal           (GtkSourceCompletionProposal 
*proposal,
-                                                                        GtkSourceCompletionProposal *other);
+gboolean     gtk_source_completion_proposal_equal         (GtkSourceCompletionProposal *proposal,
+                                                           GtkSourceCompletionProposal *other);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]