[gtranslator] Changed dispose functions to g_object_clear
- From: Daniel Mustieles GarcÃa <dmustieles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Changed dispose functions to g_object_clear
- Date: Sat, 21 Apr 2012 09:40:58 +0000 (UTC)
commit ce316dd15c939cad9da55fc430f184f70cd92f68
Author: Daniel Mustieles <daniel mustieles gmail com>
Date: Sat Apr 21 11:05:48 2012 +0200
Changed dispose functions to g_object_clear
.../gtr-alternate-language-panel.c | 6 +--
.../gtr-alternate-language-plugin.c | 20 +-------
plugins/codeview/gtr-codeview-plugin.c | 13 +-----
plugins/dictionary/gtr-dict-panel.c | 6 +--
plugins/dictionary/gtr-dictionary-plugin.c | 6 +--
plugins/fullscreen/gtr-fullscreen-plugin.c | 13 +-----
plugins/insert-params/gtr-insert-params-plugin.c | 13 +-----
plugins/open-tran/gtr-open-tran-panel.c | 7 +---
plugins/open-tran/gtr-open-tran-plugin.c | 13 +-----
.../gtr-translation-memory-dialog.c | 6 +--
.../gtr-translation-memory-tab-activatable.c | 6 +--
.../translation-memory/gtr-translation-memory-ui.c | 6 +--
.../gtr-translation-memory-window-activatable.c | 27 ++---------
src/gtr-application.c | 27 ++---------
src/gtr-header-dialog.c | 6 +--
src/gtr-header.c | 20 +-------
src/gtr-history-entry.c | 6 +--
src/gtr-plugins-engine.c | 6 +--
src/gtr-po.c | 6 +--
src/gtr-preferences-dialog.c | 20 +-------
src/gtr-settings.c | 20 +-------
src/gtr-tab.c | 48 +++-----------------
src/gtr-view.c | 13 +-----
src/gtr-window.c | 26 ++---------
24 files changed, 52 insertions(+), 288 deletions(-)
---
diff --git a/plugins/alternate-language/gtr-alternate-language-panel.c b/plugins/alternate-language/gtr-alternate-language-panel.c
index 4a51854..08499fe 100644
--- a/plugins/alternate-language/gtr-alternate-language-panel.c
+++ b/plugins/alternate-language/gtr-alternate-language-panel.c
@@ -395,11 +395,7 @@ gtr_alternate_lang_panel_dispose (GObject *object)
panel->priv->showed_message_id = 0;
}
- if (panel->priv->po != NULL)
- {
- g_object_unref (panel->priv->po);
- panel->priv->po = NULL;
- }
+ g_clear_object (&panel->priv->po);
G_OBJECT_CLASS (gtr_alternate_lang_panel_parent_class)->dispose (object);
}
diff --git a/plugins/alternate-language/gtr-alternate-language-plugin.c b/plugins/alternate-language/gtr-alternate-language-plugin.c
index 3449b16..3b195df 100644
--- a/plugins/alternate-language/gtr-alternate-language-plugin.c
+++ b/plugins/alternate-language/gtr-alternate-language-plugin.c
@@ -96,23 +96,9 @@ gtr_alternate_lang_plugin_dispose (GObject *object)
{
GtrAlternateLangPluginPrivate *priv = GTR_ALTERNATE_LANG_PLUGIN (object)->priv;
- if (priv->window != NULL)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
-
- if (priv->tab != NULL)
- {
- g_object_unref (priv->tab);
- priv->tab = NULL;
- }
-
- if (priv->action_group != NULL)
- {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
+ g_clear_object (&priv->window);
+ g_clear_object (&priv->tab);
+ g_clear_object (&priv->action_group);
G_OBJECT_CLASS (gtr_alternate_lang_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/codeview/gtr-codeview-plugin.c b/plugins/codeview/gtr-codeview-plugin.c
index 456dcd3..bba4de7 100644
--- a/plugins/codeview/gtr-codeview-plugin.c
+++ b/plugins/codeview/gtr-codeview-plugin.c
@@ -423,17 +423,8 @@ gtr_code_view_plugin_dispose (GObject *object)
{
GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_PLUGIN (object)->priv;
- if (priv->settings != NULL)
- {
- g_object_unref (priv->settings);
- priv->settings = NULL;
- }
-
- if (priv->window != NULL)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->window);
G_OBJECT_CLASS (gtr_code_view_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/dictionary/gtr-dict-panel.c b/plugins/dictionary/gtr-dict-panel.c
index c983eca..a399d8d 100644
--- a/plugins/dictionary/gtr-dict-panel.c
+++ b/plugins/dictionary/gtr-dict-panel.c
@@ -625,11 +625,7 @@ gtr_dict_panel_dispose (GObject * object)
{
GtrDictPanel *panel = GTR_DICT_PANEL (object);
- if (panel->priv->settings != NULL)
- {
- g_object_unref (panel->priv->settings);
- panel->priv->settings = NULL;
- }
+ g_clear_object (&panel->priv->settings);
G_OBJECT_CLASS (gtr_dict_panel_parent_class)->dispose (object);
}
diff --git a/plugins/dictionary/gtr-dictionary-plugin.c b/plugins/dictionary/gtr-dictionary-plugin.c
index 8c9833c..f540a31 100644
--- a/plugins/dictionary/gtr-dictionary-plugin.c
+++ b/plugins/dictionary/gtr-dictionary-plugin.c
@@ -119,11 +119,7 @@ gtr_dict_plugin_dispose (GObject * object)
{
GtrDictPluginPrivate *priv = GTR_DICT_PLUGIN (object)->priv;
- if (priv->tab != NULL)
- {
- g_object_unref (priv->tab);
- priv->tab = NULL;
- }
+ g_clear_object (&priv->tab);
G_OBJECT_CLASS (gtr_dict_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/fullscreen/gtr-fullscreen-plugin.c b/plugins/fullscreen/gtr-fullscreen-plugin.c
index df5f49c..0a9fb8c 100644
--- a/plugins/fullscreen/gtr-fullscreen-plugin.c
+++ b/plugins/fullscreen/gtr-fullscreen-plugin.c
@@ -82,17 +82,8 @@ gtr_fullscreen_plugin_dispose (GObject *object)
{
GtrFullscreenPluginPrivate *priv = GTR_FULLSCREEN_PLUGIN (object)->priv;
- if (priv->window != NULL)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
-
- if (priv->action_group != NULL)
- {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
+ g_clear_object (&priv->window);
+ g_clear_object (&priv->action_group);
G_OBJECT_CLASS (gtr_fullscreen_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/insert-params/gtr-insert-params-plugin.c b/plugins/insert-params/gtr-insert-params-plugin.c
index 4d5b63a..d11756c 100644
--- a/plugins/insert-params/gtr-insert-params-plugin.c
+++ b/plugins/insert-params/gtr-insert-params-plugin.c
@@ -176,17 +176,8 @@ gtr_insert_params_plugin_dispose (GObject *object)
{
GtrInsertParamsPluginPrivate *priv = GTR_INSERT_PARAMS_PLUGIN (object)->priv;
- if (priv->window != NULL)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
-
- if (priv->action_group != NULL)
- {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
+ g_clear_object (&priv->window);
+ g_clear_object (&priv->action_group);
G_OBJECT_CLASS (gtr_insert_params_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/open-tran/gtr-open-tran-panel.c b/plugins/open-tran/gtr-open-tran-panel.c
index 182479b..5a1d120 100644
--- a/plugins/open-tran/gtr-open-tran-panel.c
+++ b/plugins/open-tran/gtr-open-tran-panel.c
@@ -535,12 +535,7 @@ gtr_open_tran_panel_dispose (GObject * object)
{
GtrOpenTranPanel *panel = GTR_OPEN_TRAN_PANEL (object);
-
- if (panel->priv->settings != NULL)
- {
- g_object_unref (panel->priv->settings);
- panel->priv->settings = NULL;
- }
+ g_clear_object (&panel->priv->settings);
G_OBJECT_CLASS (gtr_open_tran_panel_parent_class)->dispose (object);
}
diff --git a/plugins/open-tran/gtr-open-tran-plugin.c b/plugins/open-tran/gtr-open-tran-plugin.c
index eb32fad..a4a5a10 100644
--- a/plugins/open-tran/gtr-open-tran-plugin.c
+++ b/plugins/open-tran/gtr-open-tran-plugin.c
@@ -99,17 +99,8 @@ gtr_open_tran_plugin_dispose (GObject * object)
xmlNanoHTTPCleanup ();
- if (priv->settings)
- {
- g_object_unref (priv->settings);
- priv->settings = NULL;
- }
-
- if (priv->tab != NULL)
- {
- g_object_unref (priv->tab);
- priv->tab = NULL;
- }
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->tab);
G_OBJECT_CLASS (gtr_open_tran_plugin_parent_class)->dispose (object);
}
diff --git a/plugins/translation-memory/gtr-translation-memory-dialog.c b/plugins/translation-memory/gtr-translation-memory-dialog.c
index fac7418..59c1d65 100644
--- a/plugins/translation-memory/gtr-translation-memory-dialog.c
+++ b/plugins/translation-memory/gtr-translation-memory-dialog.c
@@ -52,11 +52,7 @@ gtr_translation_memory_dialog_dispose (GObject *object)
{
GtrTranslationMemoryDialogPrivate *priv = GTR_TRANSLATION_MEMORY_DIALOG (object)->priv;
- if (priv->tm_settings != NULL)
- {
- g_object_unref (priv->tm_settings);
- priv->tm_settings = NULL;
- }
+ g_clear_object (&priv->tm_settings);
G_OBJECT_CLASS (gtr_translation_memory_dialog_parent_class)->dispose (object);
}
diff --git a/plugins/translation-memory/gtr-translation-memory-tab-activatable.c b/plugins/translation-memory/gtr-translation-memory-tab-activatable.c
index 7747d8a..edddc50 100644
--- a/plugins/translation-memory/gtr-translation-memory-tab-activatable.c
+++ b/plugins/translation-memory/gtr-translation-memory-tab-activatable.c
@@ -64,11 +64,7 @@ gtr_translation_memory_tab_activatable_dispose (GObject *object)
{
GtrTranslationMemoryTabActivatablePrivate *priv = GTR_TRANSLATION_MEMORY_TAB_ACTIVATABLE (object)->priv;
- if (priv->tab != NULL)
- {
- g_object_unref (priv->tab);
- priv->tab = NULL;
- }
+ g_clear_object (&priv->tab);
G_OBJECT_CLASS (gtr_translation_memory_tab_activatable_parent_class)->dispose (object);
}
diff --git a/plugins/translation-memory/gtr-translation-memory-ui.c b/plugins/translation-memory/gtr-translation-memory-ui.c
index 8866771..3c8d618 100644
--- a/plugins/translation-memory/gtr-translation-memory-ui.c
+++ b/plugins/translation-memory/gtr-translation-memory-ui.c
@@ -510,11 +510,7 @@ gtr_translation_memory_ui_dispose (GObject * object)
DEBUG_PRINT ("Dispose translation memory ui");
- if (tm_ui->priv->msg)
- {
- g_object_unref (tm_ui->priv->msg);
- tm_ui->priv->msg = NULL;
- }
+ g_clear_object (&tm_ui->priv->msg);
G_OBJECT_CLASS (gtr_translation_memory_ui_parent_class)->dispose (object);
}
diff --git a/plugins/translation-memory/gtr-translation-memory-window-activatable.c b/plugins/translation-memory/gtr-translation-memory-window-activatable.c
index ea0da3e..05c4d98 100644
--- a/plugins/translation-memory/gtr-translation-memory-window-activatable.c
+++ b/plugins/translation-memory/gtr-translation-memory-window-activatable.c
@@ -130,29 +130,10 @@ gtr_translation_memory_window_activatable_dispose (GObject *object)
{
GtrTranslationMemoryWindowActivatablePrivate *priv = GTR_TRANSLATION_MEMORY_WINDOW_ACTIVATABLE (object)->priv;
- if (priv->window != NULL)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
-
- if (priv->action_group != NULL)
- {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
-
- if (priv->translation_memory != NULL)
- {
- g_object_unref (priv->translation_memory);
- priv->translation_memory = NULL;
- }
-
- if (priv->tm_settings != NULL)
- {
- g_object_unref (priv->tm_settings);
- priv->tm_settings = NULL;
- }
+ g_clear_object (&priv->window);
+ g_clear_object (&priv->action_group);
+ g_clear_object (&priv->translation_memory);
+ g_clear_object (&priv->tm_settings);
G_OBJECT_CLASS (gtr_translation_memory_window_activatable_parent_class)->dispose (object);
}
diff --git a/src/gtr-application.c b/src/gtr-application.c
index 4b540ae..67ee033 100644
--- a/src/gtr-application.c
+++ b/src/gtr-application.c
@@ -232,29 +232,10 @@ gtr_application_dispose (GObject * object)
DEBUG_PRINT ("Disposing app");
- if (priv->settings != NULL)
- {
- g_object_unref (priv->settings);
- priv->settings = NULL;
- }
-
- if (priv->window_settings != NULL)
- {
- g_object_unref (priv->window_settings);
- priv->window_settings = NULL;
- }
-
- if (priv->icon_factory != NULL)
- {
- g_object_unref (priv->icon_factory);
- priv->icon_factory = NULL;
- }
-
- if (priv->toolbars_model)
- {
- g_object_unref (priv->toolbars_model);
- priv->toolbars_model = NULL;
- }
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->window_settings);
+ g_clear_object (&priv->icon_factory);
+ g_clear_object (&priv->toolbars_model);
G_OBJECT_CLASS (gtr_application_parent_class)->dispose (object);
}
diff --git a/src/gtr-header-dialog.c b/src/gtr-header-dialog.c
index 1511f05..a412e42 100644
--- a/src/gtr-header-dialog.c
+++ b/src/gtr-header-dialog.c
@@ -74,11 +74,7 @@ gtr_header_dialog_dispose (GObject * object)
{
GtrHeaderDialog *dlg = GTR_HEADER_DIALOG (object);
- if (dlg->priv->settings != NULL)
- {
- g_object_unref (dlg->priv->settings);
- dlg->priv->settings = NULL;
- }
+ g_clear_object (&dlg->priv->settings);
G_OBJECT_CLASS (gtr_header_dialog_parent_class)->dispose (object);
}
diff --git a/src/gtr-header.c b/src/gtr-header.c
index 16f9d85..7561b53 100644
--- a/src/gtr-header.c
+++ b/src/gtr-header.c
@@ -163,23 +163,9 @@ gtr_header_dispose (GObject * object)
{
GtrHeader *header = GTR_HEADER (object);
- if (header->priv->settings != NULL)
- {
- g_object_unref (header->priv->settings);
- header->priv->settings = NULL;
- }
-
- if (header->priv->prof_manager != NULL)
- {
- g_object_unref (header->priv->prof_manager);
- header->priv->prof_manager = NULL;
- }
-
- if (header->priv->profile != NULL)
- {
- g_object_unref (header->priv->profile);
- header->priv->profile = NULL;
- }
+ g_clear_object (&header->priv->settings);
+ g_clear_object (&header->priv->prof_manager);
+ g_clear_object (&header->priv->profile);
G_OBJECT_CLASS (gtr_header_parent_class)->dispose (object);
}
diff --git a/src/gtr-history-entry.c b/src/gtr-history-entry.c
index a1b0972..ee1e2db 100644
--- a/src/gtr-history-entry.c
+++ b/src/gtr-history-entry.c
@@ -132,11 +132,7 @@ gtr_history_entry_dispose (GObject * object)
gtr_history_entry_set_enable_completion (GTR_HISTORY_ENTRY (object), FALSE);
- if (priv->settings != NULL)
- {
- g_object_unref (G_OBJECT (priv->settings));
- priv->settings = NULL;
- }
+ g_clear_object (&priv->settings);
G_OBJECT_CLASS (gtr_history_entry_parent_class)->dispose (object);
}
diff --git a/src/gtr-plugins-engine.c b/src/gtr-plugins-engine.c
index 96de3ac..903ea73 100644
--- a/src/gtr-plugins-engine.c
+++ b/src/gtr-plugins-engine.c
@@ -117,11 +117,7 @@ gtr_plugins_engine_dispose (GObject * object)
{
GtrPluginsEngine *engine = GTR_PLUGINS_ENGINE (object);
- if (engine->priv->plugin_settings != NULL)
- {
- g_object_unref (engine->priv->plugin_settings);
- engine->priv->plugin_settings = NULL;
- }
+ g_clear_object (&engine->priv->plugin_settings);
G_OBJECT_CLASS (gtr_plugins_engine_parent_class)->dispose (object);
}
diff --git a/src/gtr-po.c b/src/gtr-po.c
index abb6d01..1d995e8 100644
--- a/src/gtr-po.c
+++ b/src/gtr-po.c
@@ -204,11 +204,7 @@ gtr_po_dispose (GObject * object)
{
GtrPo *po = GTR_PO (object);
- if (po->priv->location != NULL)
- {
- g_object_unref (po->priv->location);
- po->priv->location = NULL;
- }
+ g_clear_object (&po->priv->location);
G_OBJECT_CLASS (gtr_po_parent_class)->dispose (object);
}
diff --git a/src/gtr-preferences-dialog.c b/src/gtr-preferences-dialog.c
index 4fc6a8c..22ad165 100644
--- a/src/gtr-preferences-dialog.c
+++ b/src/gtr-preferences-dialog.c
@@ -703,23 +703,9 @@ gtr_preferences_dialog_dispose (GObject * object)
{
GtrPreferencesDialog *dlg = GTR_PREFERENCES_DIALOG (object);
- if (dlg->priv->ui_settings != NULL)
- {
- g_object_unref (dlg->priv->ui_settings);
- dlg->priv->ui_settings = NULL;
- }
-
- if (dlg->priv->editor_settings != NULL)
- {
- g_object_unref (dlg->priv->editor_settings);
- dlg->priv->editor_settings = NULL;
- }
-
- if (dlg->priv->files_settings != NULL)
- {
- g_object_unref (dlg->priv->files_settings);
- dlg->priv->files_settings = NULL;
- }
+ g_clear_object (&dlg->priv->ui_settings);
+ g_clear_object (&dlg->priv->editor_settings);
+ g_clear_object (&dlg->priv->files_settings);
G_OBJECT_CLASS (gtr_preferences_dialog_parent_class)->dispose (object);
}
diff --git a/src/gtr-settings.c b/src/gtr-settings.c
index fe2bb80..9a7bf73 100644
--- a/src/gtr-settings.c
+++ b/src/gtr-settings.c
@@ -63,23 +63,9 @@ gtr_settings_dispose (GObject * object)
{
GtrSettings *gs = GTR_SETTINGS (object);
- if (gs->priv->interface != NULL)
- {
- g_object_unref (gs->priv->interface);
- gs->priv->interface = NULL;
- }
-
- if (gs->priv->editor != NULL)
- {
- g_object_unref (gs->priv->editor);
- gs->priv->editor = NULL;
- }
-
- if (gs->priv->ui != NULL)
- {
- g_object_unref (gs->priv->ui);
- gs->priv->ui = NULL;
- }
+ g_clear_object (&gs->priv->interface);
+ g_clear_object (&gs->priv->editor);
+ g_clear_object (&gs->priv->ui);
G_OBJECT_CLASS (gtr_settings_parent_class)->dispose (object);
}
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index e24465b..2de880e 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -902,47 +902,13 @@ gtr_tab_dispose (GObject * object)
priv->dispose_has_run = TRUE;
}
- if (priv->extensions != NULL)
- {
- g_object_unref (priv->extensions);
- priv->extensions = NULL;
- }
-
- if (priv->po != NULL)
- {
- g_object_unref (priv->po);
- priv->po = NULL;
- }
-
- if (priv->ui_settings)
- {
- g_object_unref (priv->ui_settings);
- priv->ui_settings = NULL;
- }
-
- if (priv->files_settings != NULL)
- {
- g_object_unref (priv->files_settings);
- priv->files_settings = NULL;
- }
-
- if (priv->editor_settings != NULL)
- {
- g_object_unref (priv->editor_settings);
- priv->editor_settings = NULL;
- }
-
- if (priv->state_settings != NULL)
- {
- g_object_unref (priv->state_settings);
- priv->state_settings = NULL;
- }
-
- if (priv->layout_manager)
- {
- g_object_unref (priv->layout_manager);
- priv->layout_manager = NULL;
- }
+ g_clear_object (&priv->extensions);
+ g_clear_object (&priv->po);
+ g_clear_object (&priv->ui_settings);
+ g_clear_object (&priv->files_settings);
+ g_clear_object (&priv->editor_settings);
+ g_clear_object (&priv->state_settings);
+ g_clear_object (&priv->layout_manager);
G_OBJECT_CLASS (gtr_tab_parent_class)->dispose (object);
}
diff --git a/src/gtr-view.c b/src/gtr-view.c
index ce5b406..59f18e8 100644
--- a/src/gtr-view.c
+++ b/src/gtr-view.c
@@ -171,17 +171,8 @@ gtr_view_dispose (GObject * object)
DEBUG_PRINT ("Dispose view");
- if (view->priv->editor_settings)
- {
- g_object_unref (view->priv->editor_settings);
- view->priv->editor_settings = NULL;
- }
-
- if (view->priv->ui_settings)
- {
- g_object_unref (view->priv->ui_settings);
- view->priv->ui_settings = NULL;
- }
+ g_clear_object (&view->priv->editor_settings);
+ g_clear_object (&view->priv->ui_settings);
G_OBJECT_CLASS (gtr_view_parent_class)->dispose (object);
}
diff --git a/src/gtr-window.c b/src/gtr-window.c
index c1a4067..7accd00 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -1615,28 +1615,10 @@ gtr_window_dispose (GObject * object)
priv->dispose_has_run = TRUE;
}
- if (priv->state_settings)
- {
- g_object_unref (priv->state_settings);
- priv->state_settings = NULL;
- }
-
- if (priv->ui_manager)
- {
- g_object_unref (priv->ui_manager);
- priv->ui_manager = NULL;
- }
- if (priv->action_group)
- {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
-
- if (priv->prof_manager != NULL)
- {
- g_object_unref (priv->prof_manager);
- priv->prof_manager = NULL;
- }
+ g_clear_object (&priv->state_settings);
+ g_clear_object (&priv->ui_manager);
+ g_clear_object (&priv->action_group);
+ g_clear_object (&priv->prof_manager);
/* Now that there have broken some reference loops,
* force collection again.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]