[gtksourceview] Completion: small code improvements



commit 36376ecffd25005354633e0b4cec933e76a26dc8
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sat Apr 21 23:58:09 2012 +0200

    Completion: small code improvements
    
    Add "== NULL", "!= NULL", "== 0", and so on in a condition makes the
    code clearer. It is used in the other conditions in the same file.
    
    In CompletionProvider, the variable 'initialized' is not used.

 gtksourceview/gtksourcecompletioncontext.c  |    4 ++--
 gtksourceview/gtksourcecompletioninfo.h     |    2 +-
 gtksourceview/gtksourcecompletionproposal.c |    2 +-
 gtksourceview/gtksourcecompletionprovider.c |    7 -------
 4 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioncontext.c b/gtksourceview/gtksourcecompletioncontext.c
index ecd8147..167dc4f 100644
--- a/gtksourceview/gtksourcecompletioncontext.c
+++ b/gtksourceview/gtksourcecompletioncontext.c
@@ -80,7 +80,7 @@ gtk_source_completion_context_dispose (GObject *object)
 	context = GTK_SOURCE_COMPLETION_CONTEXT (object);
 	buffer = get_buffer (context);
 
-	if (context->priv->mark_set_id)
+	if (context->priv->mark_set_id != 0)
 	{
 		g_signal_handler_disconnect (buffer, context->priv->mark_set_id);
 		context->priv->mark_set_id = 0;
@@ -88,7 +88,7 @@ gtk_source_completion_context_dispose (GObject *object)
 
 	g_clear_object (&context->priv->completion);
 
-	if (context->priv->mark)
+	if (context->priv->mark != NULL)
 	{
 		gtk_text_buffer_delete_mark (buffer, context->priv->mark);
 		context->priv->mark = NULL;
diff --git a/gtksourceview/gtksourcecompletioninfo.h b/gtksourceview/gtksourcecompletioninfo.h
index f5f8a25..20c2e65 100644
--- a/gtksourceview/gtksourcecompletioninfo.h
+++ b/gtksourceview/gtksourcecompletioninfo.h
@@ -64,7 +64,7 @@ void		 gtk_source_completion_info_move_to_iter	(GtkSourceCompletionInfo *info,
 								 GtkTextView             *view,
 								 GtkTextIter             *iter);
 
-void		 gtk_source_completion_info_set_widget	(GtkSourceCompletionInfo *info,
+void		 gtk_source_completion_info_set_widget		(GtkSourceCompletionInfo *info,
 								 GtkWidget               *widget);
 
 GtkWidget	*gtk_source_completion_info_get_widget		(GtkSourceCompletionInfo *info);
diff --git a/gtksourceview/gtksourcecompletionproposal.c b/gtksourceview/gtksourcecompletionproposal.c
index 86446da..8b751db 100644
--- a/gtksourceview/gtksourcecompletionproposal.c
+++ b/gtksourceview/gtksourcecompletionproposal.c
@@ -78,7 +78,7 @@ gtk_source_completion_proposal_get_info_default (GtkSourceCompletionProposal *pr
 }
 
 static guint
-gtk_source_completion_proposal_hash_default	(GtkSourceCompletionProposal *proposal)
+gtk_source_completion_proposal_hash_default (GtkSourceCompletionProposal *proposal)
 {
 	return g_direct_hash (proposal);
 }
diff --git a/gtksourceview/gtksourcecompletionprovider.c b/gtksourceview/gtksourcecompletionprovider.c
index 15fe148..5174e35 100644
--- a/gtksourceview/gtksourcecompletionprovider.c
+++ b/gtksourceview/gtksourcecompletionprovider.c
@@ -117,8 +117,6 @@ gtk_source_completion_provider_get_priority_default (GtkSourceCompletionProvider
 static void
 gtk_source_completion_provider_default_init (GtkSourceCompletionProviderIface *iface)
 {
-	static gboolean initialized = FALSE;
-
 	iface->get_name = gtk_source_completion_provider_get_name_default;
 	iface->get_icon = gtk_source_completion_provider_get_icon_default;
 
@@ -135,11 +133,6 @@ gtk_source_completion_provider_default_init (GtkSourceCompletionProviderIface *i
 
 	iface->get_interactive_delay = gtk_source_completion_provider_get_interactive_delay_default;
 	iface->get_priority = gtk_source_completion_provider_get_priority_default;
-
-	if (!initialized)
-	{
-		initialized = TRUE;
-	}
 }
 
 /**



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