[gtksourceview] Use G_DEFINE_INTERFACE instead of homemade interfaces.



commit 30e305f910125128ee6c69086c08fc9ec6f4513e
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Jun 20 13:13:01 2010 +0200

    Use G_DEFINE_INTERFACE instead of homemade interfaces.

 gtksourceview/gtksourcecompletionproposal.c |   39 +++-----------------------
 gtksourceview/gtksourcecompletionprovider.c |   39 +++-----------------------
 gtksourceview/gtksourceundomanager.c        |   39 +++-----------------------
 3 files changed, 15 insertions(+), 102 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionproposal.c b/gtksourceview/gtksourcecompletionproposal.c
index a8a7068..2d9158b 100644
--- a/gtksourceview/gtksourcecompletionproposal.c
+++ b/gtksourceview/gtksourcecompletionproposal.c
@@ -43,6 +43,10 @@ enum
 
 static guint signals[NUM_SIGNALS] = {0,};
 
+typedef GtkSourceCompletionProposalIface GtkSourceCompletionProposalInterface;
+
+G_DEFINE_INTERFACE (GtkSourceCompletionProposal, gtk_source_completion_proposal, G_TYPE_OBJECT)
+
 static gchar *
 gtk_source_completion_proposal_get_label_default (GtkSourceCompletionProposal *proposal)
 {
@@ -87,7 +91,7 @@ gtk_source_completion_proposal_equal_default (GtkSourceCompletionProposal *propo
 }
 
 static void 
-gtk_source_completion_proposal_init (GtkSourceCompletionProposalIface *iface)
+gtk_source_completion_proposal_default_init (GtkSourceCompletionProposalIface *iface)
 {
 	static gboolean initialized = FALSE;
 	
@@ -125,39 +129,6 @@ gtk_source_completion_proposal_init (GtkSourceCompletionProposalIface *iface)
 	}
 }
 
-GType 
-gtk_source_completion_proposal_get_type ()
-{
-	static GType gtk_source_completion_proposal_type_id = 0;
-	
-	if (!gtk_source_completion_proposal_type_id)
-	{
-		static const GTypeInfo g_define_type_info =
-		{
-			sizeof (GtkSourceCompletionProposalIface),
-			(GBaseInitFunc) gtk_source_completion_proposal_init, 
-			NULL,
-			NULL,
-			NULL,
-			NULL,
-			0,
-			0,
-			NULL
-		};
-		
-		gtk_source_completion_proposal_type_id = 
-			g_type_register_static (G_TYPE_INTERFACE,
-						"GtkSourceCompletionProposal",
-						&g_define_type_info,
-						0);
-
-		g_type_interface_add_prerequisite (gtk_source_completion_proposal_type_id,
-		                                   G_TYPE_OBJECT);
-	}
-	
-	return gtk_source_completion_proposal_type_id;
-}
-
 /**
  * gtk_source_completion_proposal_get_label:
  * @proposal: a #GtkSourceCompletionProposal.
diff --git a/gtksourceview/gtksourcecompletionprovider.c b/gtksourceview/gtksourcecompletionprovider.c
index 90c37c3..c9ba1c8 100644
--- a/gtksourceview/gtksourcecompletionprovider.c
+++ b/gtksourceview/gtksourcecompletionprovider.c
@@ -32,6 +32,10 @@
 
 #include <gtksourceview/gtksourcecompletionprovider.h>
 
+typedef GtkSourceCompletionProviderIface GtkSourceCompletionProviderInterface;
+
+G_DEFINE_INTERFACE(GtkSourceCompletionProvider, gtk_source_completion_provider, G_TYPE_OBJECT)
+
 /* Default implementations */
 static gchar *
 gtk_source_completion_provider_get_name_default (GtkSourceCompletionProvider *provider)
@@ -111,7 +115,7 @@ gtk_source_completion_provider_get_priority_default (GtkSourceCompletionProvider
 }
 
 static void 
-gtk_source_completion_provider_base_init (GtkSourceCompletionProviderIface *iface)
+gtk_source_completion_provider_default_init (GtkSourceCompletionProviderIface *iface)
 {
 	static gboolean initialized = FALSE;
 	
@@ -138,39 +142,6 @@ gtk_source_completion_provider_base_init (GtkSourceCompletionProviderIface *ifac
 	}
 }
 
-GType 
-gtk_source_completion_provider_get_type ()
-{
-	static GType gtk_source_completion_provider_type_id = 0;
-
-	if (!gtk_source_completion_provider_type_id)
-	{
-		static const GTypeInfo g_define_type_info = 
-		{ 
-			sizeof (GtkSourceCompletionProviderIface), 
-			(GBaseInitFunc) gtk_source_completion_provider_base_init, 
-			(GBaseFinalizeFunc) NULL, 
-			(GClassInitFunc) NULL, 
-			(GClassFinalizeFunc) NULL, 
-			NULL, 
-			0, 
-			0, 
-			(GInstanceInitFunc) NULL 
-		};
-						
-		gtk_source_completion_provider_type_id = 
-				g_type_register_static (G_TYPE_INTERFACE, 
-							"GtkSourceCompletionProvider", 
-							&g_define_type_info, 
-							0);
-
-		g_type_interface_add_prerequisite (gtk_source_completion_provider_type_id,
-		                                   G_TYPE_OBJECT);
-	}
-
-	return gtk_source_completion_provider_type_id;
-}
-
 /**
  * gtk_source_completion_provider_get_name:
  * @provider: a #GtkSourceCompletionProvider.
diff --git a/gtksourceview/gtksourceundomanager.c b/gtksourceview/gtksourceundomanager.c
index 84d369c..a0ced59 100644
--- a/gtksourceview/gtksourceundomanager.c
+++ b/gtksourceview/gtksourceundomanager.c
@@ -61,6 +61,10 @@ enum
 
 static guint signals[NUM_SIGNALS] = {0,};
 
+typedef GtkSourceUndoManagerIface GtkSourceUndoManagerInterface;
+
+G_DEFINE_INTERFACE (GtkSourceUndoManager, gtk_source_undo_manager, G_TYPE_OBJECT)
+
 static gboolean
 gtk_source_undo_manager_can_undo_default (GtkSourceUndoManager *manager)
 {
@@ -94,7 +98,7 @@ gtk_source_undo_manager_end_not_undoable_action_default (GtkSourceUndoManager *m
 }
 
 static void
-gtk_source_undo_manager_init (GtkSourceUndoManagerIface *iface)
+gtk_source_undo_manager_default_init (GtkSourceUndoManagerIface *iface)
 {
 	static gboolean initialized = FALSE;
 
@@ -153,39 +157,6 @@ gtk_source_undo_manager_init (GtkSourceUndoManagerIface *iface)
 	}
 }
 
-GType
-gtk_source_undo_manager_get_type ()
-{
-	static GType gtk_source_undo_manager_type_id = 0;
-	
-	if (!gtk_source_undo_manager_type_id)
-	{
-		static const GTypeInfo g_define_type_info =
-		{
-			sizeof (GtkSourceUndoManagerIface),
-			(GBaseInitFunc) gtk_source_undo_manager_init,
-			NULL,
-			NULL,
-			NULL,
-			NULL,
-			0,
-			0,
-			NULL
-		};
-		
-		gtk_source_undo_manager_type_id =
-			g_type_register_static (G_TYPE_INTERFACE,
-						"GtkSourceUndoManager",
-						&g_define_type_info,
-						0);
-
-		g_type_interface_add_prerequisite (gtk_source_undo_manager_type_id,
-		                                   G_TYPE_OBJECT);
-	}
-	
-	return gtk_source_undo_manager_type_id;
-}
-
 /**
  * gtk_source_undo_manager_can_undo:
  * @manager: a #GtkSourceUndoManager.



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