[libpeas] Use g_clear_object()/g_clear_pointer() more
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Use g_clear_object()/g_clear_pointer() more
- Date: Sat, 20 Dec 2014 17:22:26 +0000 (UTC)
commit d945591d070e657df7946f008b97f9b8d0d61544
Author: Garrett Regier <garrettregier gmail com>
Date: Sat Dec 20 09:13:50 2014 -0800
Use g_clear_object()/g_clear_pointer() more
libpeas-gtk/peas-gtk-plugin-manager-store.c | 12 ++----------
libpeas-gtk/peas-gtk-plugin-manager-view.c | 16 +++-------------
libpeas-gtk/peas-gtk-plugin-manager.c | 9 ++-------
3 files changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-store.c b/libpeas-gtk/peas-gtk-plugin-manager-store.c
index 2e2fe38..ac415d1 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-store.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-store.c
@@ -163,9 +163,7 @@ update_plugin (PeasGtkPluginManagerStore *store,
PEAS_GTK_PLUGIN_MANAGER_STORE_PLUGIN_COLUMN, info,
-1);
- if (icon_gicon != NULL)
- g_object_unref (icon_gicon);
-
+ g_clear_object (&icon_gicon);
g_free (markup);
}
@@ -283,13 +281,7 @@ peas_gtk_plugin_manager_store_dispose (GObject *object)
{
PeasGtkPluginManagerStore *store = PEAS_GTK_PLUGIN_MANAGER_STORE (object);
- if (store->priv->engine != NULL)
- {
- g_signal_handlers_disconnect_by_func (store->priv->engine,
- plugin_loaded_toggled_cb,
- store);
- g_clear_object (&store->priv->engine);
- }
+ g_clear_object (&store->priv->engine);
G_OBJECT_CLASS (peas_gtk_plugin_manager_store_parent_class)->dispose (object);
}
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 6846fe7..41ace4f 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -722,20 +722,10 @@ peas_gtk_plugin_manager_view_dispose (GObject *object)
{
PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
- if (view->priv->popup_menu != NULL)
- {
- gtk_widget_destroy (view->priv->popup_menu);
- view->priv->popup_menu = NULL;
- }
-
- if (view->priv->engine != NULL)
- {
- g_signal_handlers_disconnect_by_func (view->priv->engine,
- plugin_list_changed_cb,
- view);
- g_clear_object (&view->priv->engine);
- }
+ g_clear_pointer (&view->priv->popup_menu,
+ (GDestroyNotify) gtk_widget_destroy);
+ g_clear_object (&view->priv->engine);
g_clear_object (&view->priv->store);
G_OBJECT_CLASS (peas_gtk_plugin_manager_view_parent_class)->dispose (object);
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index be2da19..97981ac 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -511,13 +511,8 @@ peas_gtk_plugin_manager_dispose (GObject *object)
{
PeasGtkPluginManager *pm = PEAS_GTK_PLUGIN_MANAGER (object);
- if (pm->priv->engine != NULL)
- {
- g_signal_handlers_disconnect_by_func (pm->priv->engine,
- plugin_loaded_toggled_cb,
- pm);
- g_clear_object (&pm->priv->engine);
- }
+ g_clear_object (&pm->priv->engine);
+ g_clear_pointer (&pm->priv->about, (GDestroyNotify) gtk_widget_destroy);
G_OBJECT_CLASS (peas_gtk_plugin_manager_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]