[gnome-builder] convention: use !! to normalize boolean params and guint 1 bit flag



commit 9873d2890f3eb81f96aa787d2678a8d37d66da0e
Author: Christian Hergert <christian hergert me>
Date:   Mon Jan 19 20:55:19 2015 -0800

    convention: use !! to normalize boolean params and guint 1 bit flag
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743164

 src/commands/gb-command-result.c         |    4 ++--
 src/editor/gb-editor-document.c          |    6 +++---
 src/editor/gb-editor-view.c              |   10 +++++-----
 src/editor/gb-source-view.c              |   10 +++++-----
 src/snippets/gb-source-snippet-chunk.c   |    4 ++--
 src/snippets/gb-source-snippet-context.c |    4 ++--
 src/snippets/gb-source-snippet.c         |    2 +-
 src/tree/gb-tree-node.c                  |    4 ++--
 8 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/src/commands/gb-command-result.c b/src/commands/gb-command-result.c
index d0863ef..c849287 100644
--- a/src/commands/gb-command-result.c
+++ b/src/commands/gb-command-result.c
@@ -109,7 +109,7 @@ gb_command_result_set_is_running (GbCommandResult *result,
 
   if (result->priv->is_running != is_running)
     {
-      result->priv->is_running = is_running;
+      result->priv->is_running = !!is_running;
       g_object_notify_by_pspec (G_OBJECT (result),
                                 gParamSpecs [PROP_IS_RUNNING]);
     }
@@ -131,7 +131,7 @@ gb_command_result_set_is_error (GbCommandResult *result,
 
   if (result->priv->is_error != is_error)
     {
-      result->priv->is_error = is_error;
+      result->priv->is_error = !!is_error;
       g_object_notify_by_pspec (G_OBJECT (result),
                                 gParamSpecs [PROP_IS_ERROR]);
     }
diff --git a/src/editor/gb-editor-document.c b/src/editor/gb-editor-document.c
index e5a52cb..e0653b0 100644
--- a/src/editor/gb-editor-document.c
+++ b/src/editor/gb-editor-document.c
@@ -148,7 +148,7 @@ gb_editor_document_set_read_only (GbEditorDocument *document,
 
   if (document->priv->read_only != read_only)
     {
-      document->priv->read_only = read_only;
+      document->priv->read_only = !!read_only;
       g_object_notify (G_OBJECT (document), "read-only");
       gb_editor_document_update_title (document);
     }
@@ -172,7 +172,7 @@ gb_editor_document_set_file_changed_on_volume (GbEditorDocument *document,
 
   if (file_changed_on_volume != document->priv->file_changed_on_volume)
     {
-      document->priv->file_changed_on_volume = file_changed_on_volume;
+      document->priv->file_changed_on_volume = !!file_changed_on_volume;
       g_object_notify_by_pspec (G_OBJECT (document),
                                 gParamSpecs [PROP_FILE_CHANGED_ON_VOLUME]);
     }
@@ -280,7 +280,7 @@ gb_editor_document_set_trim_trailing_whitespace (GbEditorDocument *document,
 
   if (trim_trailing_whitespace != document->priv->trim_trailing_whitespace)
     {
-      document->priv->trim_trailing_whitespace = trim_trailing_whitespace;
+      document->priv->trim_trailing_whitespace = !!trim_trailing_whitespace;
       g_object_notify_by_pspec (G_OBJECT (document),
                                 gParamSpecs [PROP_TRIM_TRAILING_WHITESPACE]);
     }
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index 749515a..131a772 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -142,7 +142,7 @@ gb_editor_view_set_auto_indent (GbEditorView *view,
 {
   g_return_if_fail (GB_IS_EDITOR_VIEW (view));
 
-  view->priv->auto_indent = auto_indent;
+  view->priv->auto_indent = !!auto_indent;
   gb_editor_view_action_set_state (view, "auto-indent",
                                    g_variant_new_boolean (auto_indent));
   g_object_notify_by_pspec (G_OBJECT (view), gParamSpecs [PROP_AUTO_INDENT]);
@@ -164,7 +164,7 @@ gb_editor_view_set_highlight_current_line (GbEditorView *view,
 
   g_return_if_fail (GB_IS_EDITOR_VIEW (view));
 
-  view->priv->highlight_current_line = highlight_current_line;
+  view->priv->highlight_current_line = !!highlight_current_line;
   variant = g_variant_new_boolean (highlight_current_line);
   gb_editor_view_action_set_state (view, "highlight-current-line", variant);
   g_object_notify_by_pspec (G_OBJECT (view),
@@ -187,7 +187,7 @@ gb_editor_view_set_show_right_margin (GbEditorView *view,
 
   g_return_if_fail (GB_IS_EDITOR_VIEW (view));
 
-  view->priv->show_right_margin = show_right_margin;
+  view->priv->show_right_margin = !!show_right_margin;
   variant = g_variant_new_boolean (show_right_margin);
   gb_editor_view_action_set_state (view, "show-right-margin", variant);
   g_object_notify_by_pspec (G_OBJECT (view),
@@ -210,7 +210,7 @@ gb_editor_view_set_show_line_numbers (GbEditorView *view,
 
   g_return_if_fail (GB_IS_EDITOR_VIEW (view));
 
-  view->priv->show_line_numbers = show_line_numbers;
+  view->priv->show_line_numbers = !!show_line_numbers;
   variant = g_variant_new_boolean (show_line_numbers);
   gb_editor_view_action_set_state (view, "show-line-numbers", variant);
   g_object_notify_by_pspec (G_OBJECT (view),
@@ -257,7 +257,7 @@ gb_editor_view_set_use_spaces (GbEditorView *view,
 {
   g_return_if_fail (GB_IS_EDITOR_VIEW (view));
 
-  view->priv->use_spaces = use_spaces;
+  view->priv->use_spaces = !!use_spaces;
   gb_editor_view_action_set_state (view, "use-spaces",
                                    g_variant_new_boolean (use_spaces));
   g_object_notify_by_pspec (G_OBJECT (view), gParamSpecs [PROP_USE_SPACES]);
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 3a5e239..24f3e68 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -137,7 +137,7 @@ gb_source_view_set_insert_matching_brace (GbSourceView *view,
 
   if (view->priv->insert_matching_brace != insert_matching_brace)
     {
-      view->priv->insert_matching_brace = insert_matching_brace;
+      view->priv->insert_matching_brace = !!insert_matching_brace;
       g_object_notify_by_pspec (G_OBJECT (view),
                                 gParamSpecs [PROP_INSERT_MATCHING_BRACE]);
     }
@@ -159,7 +159,7 @@ gb_source_view_set_overwrite_braces (GbSourceView *view,
 
   if (view->priv->overwrite_braces != overwrite_braces)
     {
-      view->priv->overwrite_braces = overwrite_braces;
+      view->priv->overwrite_braces = !!overwrite_braces;
       g_object_notify_by_pspec (G_OBJECT (view),
                                 gParamSpecs [PROP_OVERWRITE_BRACES]);
     }
@@ -200,7 +200,7 @@ gb_source_view_set_enable_word_completion (GbSourceView *view,
             GTK_SOURCE_COMPLETION_PROVIDER (priv->words_provider),
             NULL);
 
-      priv->enable_word_completion = enable_word_completion;
+      priv->enable_word_completion = !!enable_word_completion;
       g_object_notify_by_pspec (G_OBJECT (view),
                                 gParamSpecs [PROP_ENABLE_WORD_COMPLETION]);
     }
@@ -428,7 +428,7 @@ gb_source_view_set_show_shadow (GbSourceView *view,
 {
   g_return_if_fail (GB_IS_SOURCE_VIEW (view));
 
-  view->priv->show_shadow = show_shadow;
+  view->priv->show_shadow = !!show_shadow;
   g_object_notify_by_pspec (G_OBJECT (view), gParamSpecs[PROP_SHOW_SHADOW]);
   invalidate_window (view);
 }
@@ -2142,7 +2142,7 @@ gb_source_view_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_AUTO_INDENT:
-      view->priv->auto_indent = g_value_get_boolean (value);
+      view->priv->auto_indent = !!g_value_get_boolean (value);
       gb_source_view_reload_auto_indenter (view);
       break;
 
diff --git a/src/snippets/gb-source-snippet-chunk.c b/src/snippets/gb-source-snippet-chunk.c
index 5194908..cb7ab46 100644
--- a/src/snippets/gb-source-snippet-chunk.c
+++ b/src/snippets/gb-source-snippet-chunk.c
@@ -29,7 +29,7 @@ struct _GbSourceSnippetChunkPrivate
   gint                    tab_stop;
   gchar                  *spec;
   gchar                  *text;
-  gboolean                text_set;
+  guint                   text_set : 1;
 };
 
 enum {
@@ -194,7 +194,7 @@ gb_source_snippet_chunk_set_text_set (GbSourceSnippetChunk *chunk,
                                       gboolean              text_set)
 {
   g_return_if_fail (GB_IS_SOURCE_SNIPPET_CHUNK (chunk));
-  chunk->priv->text_set = text_set;
+  chunk->priv->text_set = !!text_set;
   g_object_notify_by_pspec (G_OBJECT (chunk), gParamSpecs[PROP_TEXT_SET]);
 }
 
diff --git a/src/snippets/gb-source-snippet-context.c b/src/snippets/gb-source-snippet-context.c
index 3ec32a9..7672314 100644
--- a/src/snippets/gb-source-snippet-context.c
+++ b/src/snippets/gb-source-snippet-context.c
@@ -44,7 +44,7 @@ struct _GbSourceSnippetContextPrivate
   GHashTable *variables;
   gchar      *line_prefix;
   gint        tab_width;
-  gboolean    use_spaces;
+  guint       use_spaces : 1;
 };
 
 enum {
@@ -583,7 +583,7 @@ gb_source_snippet_context_set_use_spaces (GbSourceSnippetContext *context,
                                           gboolean                use_spaces)
 {
   g_return_if_fail (GB_IS_SOURCE_SNIPPET_CONTEXT (context));
-  context->priv->use_spaces = use_spaces;
+  context->priv->use_spaces = !!use_spaces;
 }
 
 void
diff --git a/src/snippets/gb-source-snippet.c b/src/snippets/gb-source-snippet.c
index 2f66c4f..74a0b6a 100644
--- a/src/snippets/gb-source-snippet.c
+++ b/src/snippets/gb-source-snippet.c
@@ -40,7 +40,7 @@ struct _GbSourceSnippetPrivate
   gint                    tab_stop;
   gint                    max_tab_stop;
   gint                    current_chunk;
-  gboolean                inserted;
+  guint                   inserted : 1;
 };
 
 enum {
diff --git a/src/tree/gb-tree-node.c b/src/tree/gb-tree-node.c
index 8d5816e..e604031 100644
--- a/src/tree/gb-tree-node.c
+++ b/src/tree/gb-tree-node.c
@@ -30,7 +30,7 @@ struct _GbTreeNodePrivate
   GbTreeNode    *parent;
   gchar         *text;
   GbTree        *tree;
-  gboolean       use_markup;
+  guint          use_markup : 1;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GbTreeNode, gb_tree_node, G_TYPE_INITIALLY_UNOWNED)
@@ -321,7 +321,7 @@ gb_tree_node_set_use_markup (GbTreeNode *node,
 {
   g_return_if_fail (GB_IS_TREE_NODE (node));
 
-  node->priv->use_markup = use_markup;
+  node->priv->use_markup = !!use_markup;
   g_object_notify_by_pspec (G_OBJECT (node), gParamSpecs [PROP_USE_MARKUP]);
 }
 


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