[gedit] Cleanup init function for interfaces
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Cleanup init function for interfaces
- Date: Mon, 27 Apr 2015 14:17:35 +0000 (UTC)
commit 696609862e11a1c383914bab8bf2b3f02fbc7ede
Author: Garrett Regier <Garrett Regier riftio com>
Date: Mon Apr 27 10:14:10 2015 -0400
Cleanup init function for interfaces
The function should be a static function. Also, it
will only ever be called once so there is no need
for doing the check/set initialized dance.
gedit/gedit-app-activatable.c | 37 +++++++++++++-------------------
gedit/gedit-file-chooser-dialog.c | 41 +++++++++++++++---------------------
gedit/gedit-view-activatable.c | 37 +++++++++++++-------------------
gedit/gedit-window-activatable.c | 37 +++++++++++++-------------------
4 files changed, 62 insertions(+), 90 deletions(-)
---
diff --git a/gedit/gedit-app-activatable.c b/gedit/gedit-app-activatable.c
index fe93c9a..5bd00d8 100644
--- a/gedit/gedit-app-activatable.c
+++ b/gedit/gedit-app-activatable.c
@@ -38,30 +38,23 @@
G_DEFINE_INTERFACE(GeditAppActivatable, gedit_app_activatable, G_TYPE_OBJECT)
-void
+static void
gedit_app_activatable_default_init (GeditAppActivatableInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- /**
- * GeditAppActivatable:app:
- *
- * The app property contains the gedit app for this
- * #GeditAppActivatable instance.
- */
- g_object_interface_install_property (iface,
- g_param_spec_object ("app",
- "App",
- "The gedit app",
- GEDIT_TYPE_APP,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- initialized = TRUE;
- }
+ /**
+ * GeditAppActivatable:app:
+ *
+ * The app property contains the gedit app for this
+ * #GeditAppActivatable instance.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("app",
+ "App",
+ "The gedit app",
+ GEDIT_TYPE_APP,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
/**
diff --git a/gedit/gedit-file-chooser-dialog.c b/gedit/gedit-file-chooser-dialog.c
index 07d322d..365fcfd 100644
--- a/gedit/gedit-file-chooser-dialog.c
+++ b/gedit/gedit-file-chooser-dialog.c
@@ -50,33 +50,26 @@ confirm_overwrite_accumulator (GSignalInvocationHint *ihint,
return continue_emission;
}
-void
+static void
gedit_file_chooser_dialog_default_init (GeditFileChooserDialogInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (G_UNLIKELY (!initialized))
- {
- g_signal_new ("response",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE,
- 1,
- G_TYPE_INT);
-
- g_signal_new ("confirm-overwrite",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- 0,
- confirm_overwrite_accumulator, NULL,
- gedit_marshal_ENUM__VOID,
- GTK_TYPE_FILE_CHOOSER_CONFIRMATION,
- 0);
-
- initialized = TRUE;
- }
+ g_signal_new ("response",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_INT);
+
+ g_signal_new ("confirm-overwrite",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ confirm_overwrite_accumulator, NULL,
+ gedit_marshal_ENUM__VOID,
+ GTK_TYPE_FILE_CHOOSER_CONFIRMATION,
+ 0);
}
GeditFileChooserDialog *
diff --git a/gedit/gedit-view-activatable.c b/gedit/gedit-view-activatable.c
index 32a4739..57949ae 100644
--- a/gedit/gedit-view-activatable.c
+++ b/gedit/gedit-view-activatable.c
@@ -37,30 +37,23 @@
G_DEFINE_INTERFACE(GeditViewActivatable, gedit_view_activatable, G_TYPE_OBJECT)
-void
+static void
gedit_view_activatable_default_init (GeditViewActivatableInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- /**
- * GeditViewActivatable:view:
- *
- * The window property contains the gedit window for this
- * #GeditViewActivatable instance.
- */
- g_object_interface_install_property (iface,
- g_param_spec_object ("view",
- "view",
- "A gedit view",
- GEDIT_TYPE_VIEW,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- initialized = TRUE;
- }
+ /**
+ * GeditViewActivatable:view:
+ *
+ * The window property contains the gedit window for this
+ * #GeditViewActivatable instance.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("view",
+ "view",
+ "A gedit view",
+ GEDIT_TYPE_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
/**
diff --git a/gedit/gedit-window-activatable.c b/gedit/gedit-window-activatable.c
index ac58c04..81c20fe 100644
--- a/gedit/gedit-window-activatable.c
+++ b/gedit/gedit-window-activatable.c
@@ -39,30 +39,23 @@
G_DEFINE_INTERFACE(GeditWindowActivatable, gedit_window_activatable, G_TYPE_OBJECT)
-void
+static void
gedit_window_activatable_default_init (GeditWindowActivatableInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- /**
- * GeditWindowActivatable:window:
- *
- * The window property contains the gedit window for this
- * #GeditWindowActivatable instance.
- */
- g_object_interface_install_property (iface,
- g_param_spec_object ("window",
- "Window",
- "The gedit window",
- GEDIT_TYPE_WINDOW,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- initialized = TRUE;
- }
+ /**
+ * GeditWindowActivatable:window:
+ *
+ * The window property contains the gedit window for this
+ * #GeditWindowActivatable instance.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("window",
+ "Window",
+ "The gedit window",
+ GEDIT_TYPE_WINDOW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]