aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-presence-chooser.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-03-04 21:35:48 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-03-05 00:53:57 +0800
commitb4d06351f186346bfc65204aa4057641bbde4649 (patch)
tree84c846d4757e4565214e53591cf155653b49a621 /libempathy-gtk/empathy-presence-chooser.c
parent3550e13cd3e02e85962755851ce3ae2329ed02e3 (diff)
downloadgsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar.gz
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar.bz2
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar.lz
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar.xz
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.tar.zst
gsoc2013-empathy-b4d06351f186346bfc65204aa4057641bbde4649.zip
Cope with the favorite pixbuf not being available
Not all icon themes have the favorite icon, so don't rely on it existing (if it's not there, just don't display a bookmark icon) Fixes: #611794
Diffstat (limited to 'libempathy-gtk/empathy-presence-chooser.c')
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 7c4aae9ba..7e2e89fb6 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -345,7 +345,7 @@ presence_chooser_set_favorite_icon (EmpathyPresenceChooser *self)
GTK_ENTRY_ICON_SECONDARY,
_("Click to remove this status as a favorite"));
}
- else {
+ else if (priv->not_favorite_pixbuf != NULL) {
/* custom entries can be favorited */
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
@@ -818,6 +818,9 @@ create_not_favorite_pixbuf (void)
favorite = empathy_pixbuf_from_icon_name ("emblem-favorite",
GTK_ICON_SIZE_MENU);
+ if (favorite == NULL)
+ return NULL;
+
result = gdk_pixbuf_copy (favorite);
gdk_pixbuf_saturate_and_pixelate (favorite, result, 1.0, TRUE);
@@ -832,7 +835,8 @@ icon_theme_changed_cb (GtkIconTheme *icon_theme,
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
/* Theme has changed, recreate the not-favorite icon */
- g_object_unref (priv->not_favorite_pixbuf);
+ if (priv->not_favorite_pixbuf != NULL)
+ g_object_unref (priv->not_favorite_pixbuf);
priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
/* Update the icon */
@@ -851,7 +855,6 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
/* Create the not-favorite icon */
priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
- g_assert (priv->not_favorite_pixbuf != NULL);
empathy_signal_connect_weak (gtk_icon_theme_get_default (), "changed",
G_CALLBACK (icon_theme_changed_cb),
@@ -964,7 +967,8 @@ presence_chooser_finalize (GObject *object)
g_object_unref (priv->idle);
g_object_unref (priv->connectivity);
- g_object_unref (priv->not_favorite_pixbuf);
+ if (priv->not_favorite_pixbuf != NULL)
+ g_object_unref (priv->not_favorite_pixbuf);
G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
}