[gedit/zbrown/deteplification-src: 455/633] HistoryEntry: cosmetic code changes




commit c2d0fa12c55517c57d359a27b8c94e8941b4d546
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jul 17 00:37:44 2020 +0200

    HistoryEntry: cosmetic code changes

 gedit/gedit-history-entry.c | 47 +++++++++++++++++++--------------------------
 gedit/gedit-history-entry.h | 21 ++++++++++----------
 2 files changed, 31 insertions(+), 37 deletions(-)
---
diff --git a/gedit/gedit-history-entry.c b/gedit/gedit-history-entry.c
index 37169c80a..1f5416ed9 100644
--- a/gedit/gedit-history-entry.c
+++ b/gedit/gedit-history-entry.c
@@ -1,5 +1,4 @@
 /*
- * gedit-history-entry.c
  * This file is part of gedit
  *
  * Copyright (C) 2006 - Paolo Borelli
@@ -19,12 +18,9 @@
  */
 
 #include "config.h"
-
 #include "gedit-history-entry.h"
-
 #include <string.h>
 #include <glib/gi18n.h>
-#include <gtk/gtk.h>
 
 #define MIN_ITEM_LEN 3
 
@@ -32,25 +28,26 @@
 
 struct _GeditHistoryEntry
 {
-       GtkComboBoxText     parent_instance;
+       GtkComboBoxText parent_instance;
 
-       gchar              *history_id;
-       guint               history_length;
+       gchar *history_id;
+       guint history_length;
 
        GtkEntryCompletion *completion;
 
-       GSettings          *settings;
+       GSettings *settings;
 };
 
-enum {
+enum
+{
        PROP_0,
        PROP_HISTORY_ID,
        PROP_HISTORY_LENGTH,
        PROP_ENABLE_COMPLETION,
-       LAST_PROP
+       N_PROPERTIES
 };
 
-static GParamSpec *properties[LAST_PROP];
+static GParamSpec *properties[N_PROPERTIES];
 
 G_DEFINE_TYPE (GeditHistoryEntry, gedit_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
 
@@ -60,25 +57,22 @@ gedit_history_entry_set_property (GObject      *object,
                                  const GValue *value,
                                  GParamSpec   *spec)
 {
-       GeditHistoryEntry *entry;
-
-       g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (object));
-
-       entry = GEDIT_HISTORY_ENTRY (object);
+       GeditHistoryEntry *entry = GEDIT_HISTORY_ENTRY (object);
 
        switch (prop_id)
        {
                case PROP_HISTORY_ID:
                        entry->history_id = g_value_dup_string (value);
                        break;
+
                case PROP_HISTORY_LENGTH:
-                       gedit_history_entry_set_history_length (entry,
-                                                               g_value_get_uint (value));
+                       gedit_history_entry_set_history_length (entry, g_value_get_uint (value));
                        break;
+
                case PROP_ENABLE_COMPLETION:
-                       gedit_history_entry_set_enable_completion (entry,
-                                                                  g_value_get_boolean (value));
+                       gedit_history_entry_set_enable_completion (entry, g_value_get_boolean (value));
                        break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
        }
@@ -90,23 +84,22 @@ gedit_history_entry_get_property (GObject    *object,
                                  GValue     *value,
                                  GParamSpec *spec)
 {
-       GeditHistoryEntry *entry;
-
-       g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (object));
-
-       entry = GEDIT_HISTORY_ENTRY (object);
+       GeditHistoryEntry *entry = GEDIT_HISTORY_ENTRY (object);
 
        switch (prop_id)
        {
                case PROP_HISTORY_ID:
                        g_value_set_string (value, entry->history_id);
                        break;
+
                case PROP_HISTORY_LENGTH:
                        g_value_set_uint (value, entry->history_length);
                        break;
+
                case PROP_ENABLE_COMPLETION:
-                       g_value_set_boolean (value, gedit_history_entry_get_enable_completion 
(GEDIT_HISTORY_ENTRY (object)));
+                       g_value_set_boolean (value, gedit_history_entry_get_enable_completion (entry));
                        break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
        }
@@ -190,7 +183,7 @@ gedit_history_entry_class_init (GeditHistoryEntryClass *klass)
                                      TRUE,
                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
-       g_object_class_install_properties (object_class, LAST_PROP, properties);
+       g_object_class_install_properties (object_class, N_PROPERTIES, properties);
 }
 
 static GtkListStore *
diff --git a/gedit/gedit-history-entry.h b/gedit/gedit-history-entry.h
index 5440be1db..b3e1b7044 100644
--- a/gedit/gedit-history-entry.h
+++ b/gedit/gedit-history-entry.h
@@ -1,5 +1,4 @@
 /*
- * gedit-history-entry.h
  * This file is part of gedit
  *
  * Copyright (C) 2006 - Paolo Borelli
@@ -27,30 +26,32 @@ G_BEGIN_DECLS
 
 #define GEDIT_TYPE_HISTORY_ENTRY (gedit_history_entry_get_type ())
 
-G_DECLARE_FINAL_TYPE (GeditHistoryEntry, gedit_history_entry, GEDIT, HISTORY_ENTRY, GtkComboBoxText)
+G_DECLARE_FINAL_TYPE (GeditHistoryEntry, gedit_history_entry,
+                     GEDIT, HISTORY_ENTRY,
+                     GtkComboBoxText)
 
-GtkWidget      *gedit_history_entry_new                        (const gchar       *history_id,
-                                                                gboolean           enable_completion);
+GtkWidget *    gedit_history_entry_new                         (const gchar *history_id,
+                                                                gboolean     enable_completion);
 
-void            gedit_history_entry_prepend_text               (GeditHistoryEntry *entry,
+void           gedit_history_entry_prepend_text                (GeditHistoryEntry *entry,
                                                                 const gchar       *text);
 
-void            gedit_history_entry_append_text                (GeditHistoryEntry *entry,
+void           gedit_history_entry_append_text                 (GeditHistoryEntry *entry,
                                                                 const gchar       *text);
 
-void            gedit_history_entry_clear                      (GeditHistoryEntry *entry);
+void           gedit_history_entry_clear                       (GeditHistoryEntry *entry);
 
-void            gedit_history_entry_set_history_length         (GeditHistoryEntry *entry,
+void           gedit_history_entry_set_history_length          (GeditHistoryEntry *entry,
                                                                 guint              max_saved);
 
-guint           gedit_history_entry_get_history_length         (GeditHistoryEntry *gentry);
+guint          gedit_history_entry_get_history_length          (GeditHistoryEntry *gentry);
 
 void           gedit_history_entry_set_enable_completion       (GeditHistoryEntry *entry,
                                                                 gboolean           enable);
 
 gboolean       gedit_history_entry_get_enable_completion       (GeditHistoryEntry *entry);
 
-GtkWidget      *gedit_history_entry_get_entry                  (GeditHistoryEntry *entry);
+GtkWidget *    gedit_history_entry_get_entry                   (GeditHistoryEntry *entry);
 
 G_END_DECLS
 


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