[gedit] history entry: use g_object_class_install_properties
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] history entry: use g_object_class_install_properties
- Date: Sun, 13 Sep 2015 19:16:14 +0000 (UTC)
commit 6dba54da2e59aa00a35c5230413693e5449d5146
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Sep 13 20:30:41 2015 +0200
history entry: use g_object_class_install_properties
gedit/gedit-history-entry.c | 70 +++++++++++++++++++++----------------------
1 files changed, 34 insertions(+), 36 deletions(-)
---
diff --git a/gedit/gedit-history-entry.c b/gedit/gedit-history-entry.c
index f578649..04f7b43 100644
--- a/gedit/gedit-history-entry.c
+++ b/gedit/gedit-history-entry.c
@@ -28,13 +28,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-enum {
- PROP_0,
- PROP_HISTORY_ID,
- PROP_HISTORY_LENGTH,
- PROP_ENABLE_COMPLETION
-};
-
#define MIN_ITEM_LEN 3
#define GEDIT_HISTORY_ENTRY_HISTORY_LENGTH_DEFAULT 10
@@ -51,6 +44,16 @@ struct _GeditHistoryEntry
GSettings *settings;
};
+enum {
+ PROP_0,
+ PROP_HISTORY_ID,
+ PROP_HISTORY_LENGTH,
+ PROP_ENABLE_COMPLETION,
+ LAST_PROP
+};
+
+static GParamSpec *properties[LAST_PROP];
+
G_DEFINE_TYPE (GeditHistoryEntry, gedit_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
static void
@@ -166,35 +169,30 @@ gedit_history_entry_class_init (GeditHistoryEntryClass *klass)
object_class->dispose = gedit_history_entry_dispose;
object_class->finalize = gedit_history_entry_finalize;
- g_object_class_install_property (object_class,
- PROP_HISTORY_ID,
- g_param_spec_string ("history-id",
- "History ID",
- "History ID",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class,
- PROP_HISTORY_LENGTH,
- g_param_spec_uint ("history-length",
- "Max History Length",
- "Max History Length",
- 0,
- G_MAXUINT,
- GEDIT_HISTORY_ENTRY_HISTORY_LENGTH_DEFAULT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class,
- PROP_ENABLE_COMPLETION,
- g_param_spec_boolean ("enable-completion",
- "Enable Completion",
- "Wether the completion is enabled",
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_HISTORY_ID] =
+ g_param_spec_string ("history-id",
+ "History ID",
+ "History ID",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_HISTORY_LENGTH] =
+ g_param_spec_uint ("history-length",
+ "Max History Length",
+ "Max History Length",
+ 0,
+ G_MAXUINT,
+ GEDIT_HISTORY_ENTRY_HISTORY_LENGTH_DEFAULT,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_ENABLE_COMPLETION] =
+ g_param_spec_boolean ("enable-completion",
+ "Enable Completion",
+ "Wether the completion is enabled",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, properties);
}
static GtkListStore *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]