Commit 69660986 authored by Garrett Regier's avatar Garrett Regier

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.
parent a30290fb
...@@ -38,30 +38,23 @@ ...@@ -38,30 +38,23 @@
G_DEFINE_INTERFACE(GeditAppActivatable, gedit_app_activatable, G_TYPE_OBJECT) G_DEFINE_INTERFACE(GeditAppActivatable, gedit_app_activatable, G_TYPE_OBJECT)
void static void
gedit_app_activatable_default_init (GeditAppActivatableInterface *iface) gedit_app_activatable_default_init (GeditAppActivatableInterface *iface)
{ {
static gboolean initialized = FALSE; /**
* GeditAppActivatable:app:
if (!initialized) *
{ * The app property contains the gedit app for this
/** * #GeditAppActivatable instance.
* GeditAppActivatable:app: */
* g_object_interface_install_property (iface,
* The app property contains the gedit app for this g_param_spec_object ("app",
* #GeditAppActivatable instance. "App",
*/ "The gedit app",
g_object_interface_install_property (iface, GEDIT_TYPE_APP,
g_param_spec_object ("app", G_PARAM_READWRITE |
"App", G_PARAM_CONSTRUCT_ONLY |
"The gedit app", G_PARAM_STATIC_STRINGS));
GEDIT_TYPE_APP,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
initialized = TRUE;
}
} }
/** /**
......
...@@ -50,33 +50,26 @@ confirm_overwrite_accumulator (GSignalInvocationHint *ihint, ...@@ -50,33 +50,26 @@ confirm_overwrite_accumulator (GSignalInvocationHint *ihint,
return continue_emission; return continue_emission;
} }
void static void
gedit_file_chooser_dialog_default_init (GeditFileChooserDialogInterface *iface) gedit_file_chooser_dialog_default_init (GeditFileChooserDialogInterface *iface)
{ {
static gboolean initialized = FALSE; g_signal_new ("response",
G_TYPE_FROM_INTERFACE (iface),
if (G_UNLIKELY (!initialized)) G_SIGNAL_RUN_LAST,
{ 0, NULL, NULL,
g_signal_new ("response", g_cclosure_marshal_VOID__INT,
G_TYPE_FROM_INTERFACE (iface), G_TYPE_NONE,
G_SIGNAL_RUN_LAST, 1,
0, NULL, NULL, G_TYPE_INT);
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, g_signal_new ("confirm-overwrite",
1, G_TYPE_FROM_INTERFACE (iface),
G_TYPE_INT); G_SIGNAL_RUN_LAST,
0,
g_signal_new ("confirm-overwrite", confirm_overwrite_accumulator, NULL,
G_TYPE_FROM_INTERFACE (iface), gedit_marshal_ENUM__VOID,
G_SIGNAL_RUN_LAST, GTK_TYPE_FILE_CHOOSER_CONFIRMATION,
0, 0);
confirm_overwrite_accumulator, NULL,
gedit_marshal_ENUM__VOID,
GTK_TYPE_FILE_CHOOSER_CONFIRMATION,
0);
initialized = TRUE;
}
} }
GeditFileChooserDialog * GeditFileChooserDialog *
......
...@@ -37,30 +37,23 @@ ...@@ -37,30 +37,23 @@
G_DEFINE_INTERFACE(GeditViewActivatable, gedit_view_activatable, G_TYPE_OBJECT) G_DEFINE_INTERFACE(GeditViewActivatable, gedit_view_activatable, G_TYPE_OBJECT)
void static void
gedit_view_activatable_default_init (GeditViewActivatableInterface *iface) gedit_view_activatable_default_init (GeditViewActivatableInterface *iface)
{ {
static gboolean initialized = FALSE; /**
* GeditViewActivatable:view:
if (!initialized) *
{ * The window property contains the gedit window for this
/** * #GeditViewActivatable instance.
* GeditViewActivatable:view: */
* g_object_interface_install_property (iface,
* The window property contains the gedit window for this g_param_spec_object ("view",
* #GeditViewActivatable instance. "view",
*/ "A gedit view",
g_object_interface_install_property (iface, GEDIT_TYPE_VIEW,
g_param_spec_object ("view", G_PARAM_READWRITE |
"view", G_PARAM_CONSTRUCT_ONLY |
"A gedit view", G_PARAM_STATIC_STRINGS));
GEDIT_TYPE_VIEW,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
initialized = TRUE;
}
} }
/** /**
......
...@@ -39,30 +39,23 @@ ...@@ -39,30 +39,23 @@
G_DEFINE_INTERFACE(GeditWindowActivatable, gedit_window_activatable, G_TYPE_OBJECT) G_DEFINE_INTERFACE(GeditWindowActivatable, gedit_window_activatable, G_TYPE_OBJECT)
void static void
gedit_window_activatable_default_init (GeditWindowActivatableInterface *iface) gedit_window_activatable_default_init (GeditWindowActivatableInterface *iface)
{ {
static gboolean initialized = FALSE; /**
* GeditWindowActivatable:window:
if (!initialized) *
{ * The window property contains the gedit window for this
/** * #GeditWindowActivatable instance.
* GeditWindowActivatable:window: */
* g_object_interface_install_property (iface,
* The window property contains the gedit window for this g_param_spec_object ("window",
* #GeditWindowActivatable instance. "Window",
*/ "The gedit window",
g_object_interface_install_property (iface, GEDIT_TYPE_WINDOW,
g_param_spec_object ("window", G_PARAM_READWRITE |
"Window", G_PARAM_CONSTRUCT_ONLY |
"The gedit window", G_PARAM_STATIC_STRINGS));
GEDIT_TYPE_WINDOW,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
initialized = TRUE;
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment