[gnome-shell] st/icon: Use own methods for updating GIcon when setting icon names
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st/icon: Use own methods for updating GIcon when setting icon names
- Date: Mon, 13 Jan 2020 13:55:34 +0000 (UTC)
commit 69a5e89096074cdce6a43060f8b7654639d7d5e2
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Nov 21 19:05:04 2019 +0700
st/icon: Use own methods for updating GIcon when setting icon names
Instead of reimplementing the functions to set the GIcon inside the
`set_*_icon_name` functions, just use the already defined methods for
that.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
src/st/st-icon.c | 33 ++++-----------------------------
1 file changed, 4 insertions(+), 29 deletions(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 13f7dd54ff..8b8dbc2ff8 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -549,7 +549,6 @@ void
st_icon_set_icon_name (StIcon *icon,
const gchar *icon_name)
{
- StIconPrivate *priv = icon->priv;
GIcon *gicon = NULL;
g_return_if_fail (ST_IS_ICON (icon));
@@ -557,26 +556,12 @@ st_icon_set_icon_name (StIcon *icon,
if (icon_name)
gicon = g_themed_icon_new_with_default_fallbacks (icon_name);
- if (g_icon_equal (priv->gicon, gicon)) /* do nothing */
- {
- if (gicon)
- g_object_unref (gicon);
- return;
- }
-
- if (priv->gicon)
- g_object_unref (priv->gicon);
-
g_object_freeze_notify (G_OBJECT (icon));
- priv->gicon = gicon;
-
- g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_GICON]);
+ st_icon_set_gicon (icon, gicon);
g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_ICON_NAME]);
g_object_thaw_notify (G_OBJECT (icon));
-
- st_icon_update (icon);
}
/**
@@ -741,7 +726,6 @@ void
st_icon_set_fallback_icon_name (StIcon *icon,
const gchar *fallback_icon_name)
{
- StIconPrivate *priv = icon->priv;
GIcon *gicon = NULL;
g_return_if_fail (ST_IS_ICON (icon));
@@ -749,19 +733,10 @@ st_icon_set_fallback_icon_name (StIcon *icon,
if (fallback_icon_name != NULL)
gicon = g_themed_icon_new_with_default_fallbacks (fallback_icon_name);
- if (g_icon_equal (priv->fallback_gicon, gicon)) /* do nothing */
- {
- if (gicon)
- g_object_unref (gicon);
- return;
- }
-
- if (priv->fallback_gicon)
- g_object_unref (priv->fallback_gicon);
-
- priv->fallback_gicon = gicon;
+ g_object_freeze_notify (G_OBJECT (icon));
+ st_icon_set_fallback_gicon (icon, gicon);
g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_FALLBACK_ICON_NAME]);
- st_icon_update (icon);
+ g_object_thaw_notify (G_OBJECT (icon));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]