diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-10-26 20:09:38 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-11-25 01:29:44 +0800 |
commit | b15f926089b6b718004467c8bb2ddf6f6cd3a9ac (patch) | |
tree | e7a6c022d509e527eb9a69d8f4c36707f0033f1f | |
parent | 591c58b68cb39c62d22d76f394c30481b0821018 (diff) | |
download | gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar.gz gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar.bz2 gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar.lz gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar.xz gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.tar.zst gsoc2013-empathy-b15f926089b6b718004467c8bb2ddf6f6cd3a9ac.zip |
Remove dead code from EmpathySmileyManager
-rw-r--r-- | libempathy-gtk/empathy-smiley-manager.c | 101 | ||||
-rw-r--r-- | libempathy-gtk/empathy-smiley-manager.h | 4 |
2 files changed, 10 insertions, 95 deletions
diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c index 0e78ee687..846b2b72b 100644 --- a/libempathy-gtk/empathy-smiley-manager.c +++ b/libempathy-gtk/empathy-smiley-manager.c @@ -81,32 +81,22 @@ smiley_manager_tree_free (SmileyManagerTree *tree) g_slice_free (SmileyManagerTree, tree); } -/* Note: This function takes the ownership of str */ static EmpathySmiley * -smiley_new (GdkPixbuf *pixbuf, gchar *str, const gchar *path) +smiley_new (GdkPixbuf *pixbuf, const gchar *str) { EmpathySmiley *smiley; smiley = g_slice_new0 (EmpathySmiley); - if (pixbuf) { - smiley->pixbuf = g_object_ref (pixbuf); - } - smiley->str = str; - smiley->path = path; + smiley->pixbuf = g_object_ref (pixbuf); + smiley->str = g_strdup (str); return smiley; } -void -empathy_smiley_free (EmpathySmiley *smiley) +static void +smiley_free (EmpathySmiley *smiley) { - if (!smiley) { - return; - } - - if (smiley->pixbuf) { - g_object_unref (smiley->pixbuf); - } + g_object_unref (smiley->pixbuf); g_free (smiley->str); g_slice_free (EmpathySmiley, smiley); } @@ -115,16 +105,9 @@ static void smiley_manager_finalize (GObject *object) { EmpathySmileyManagerPriv *priv = GET_PRIV (object); - GSList *l; smiley_manager_tree_free (priv->tree); - for (l = priv->smileys; l; l = l->next) { - EmpathySmiley *smiley = l->data; - - /* The smiley got the ownership of the path */ - g_free ((gchar *) smiley->path); - empathy_smiley_free (smiley); - } + g_slist_foreach (priv->smileys, (GFunc) smiley_free, NULL); g_slist_free (priv->smileys); } @@ -247,7 +230,7 @@ smiley_manager_add_valist (EmpathySmileyManager *manager, /* We give the ownership of path to the smiley */ g_object_set_data_full (G_OBJECT (pixbuf), "smiley_str", g_strdup (first_str), g_free); - smiley = smiley_new (pixbuf, g_strdup (first_str), path); + smiley = smiley_new (pixbuf, first_str); priv->smileys = g_slist_prepend (priv->smileys, smiley); } @@ -305,72 +288,6 @@ empathy_smiley_manager_load (EmpathySmileyManager *manager) empathy_smiley_manager_add (manager, "face-worried", ":-S", ":S", ":-s", ":s", NULL); } -GSList * -empathy_smiley_manager_parse (EmpathySmileyManager *manager, - const gchar *text) -{ - EmpathySmileyManagerPriv *priv = GET_PRIV (manager); - EmpathySmiley *smiley; - SmileyManagerTree *cur_tree = priv->tree; - const gchar *t; - const gchar *cur_str = text; - GSList *smileys = NULL; - - g_return_val_if_fail (EMPATHY_IS_SMILEY_MANAGER (manager), NULL); - g_return_val_if_fail (text != NULL, NULL); - - for (t = text; *t; t = g_utf8_next_char (t)) { - SmileyManagerTree *child; - gunichar c; - - c = g_utf8_get_char (t); - child = smiley_manager_tree_find_child (cur_tree, c); - - if (cur_tree == priv->tree) { - if (child) { - if (t > cur_str) { - smiley = smiley_new (NULL, - g_strndup (cur_str, t - cur_str), - NULL); - smileys = g_slist_prepend (smileys, smiley); - } - cur_str = t; - cur_tree = child; - } - - continue; - } - - if (child) { - cur_tree = child; - continue; - } - - smiley = smiley_new (cur_tree->pixbuf, - g_strndup (cur_str, t - cur_str), - cur_tree->path); - smileys = g_slist_prepend (smileys, smiley); - if (cur_tree->pixbuf) { - cur_str = t; - cur_tree = smiley_manager_tree_find_child (priv->tree, c); - - if (!cur_tree) { - cur_tree = priv->tree; - } - } else { - cur_str = t; - cur_tree = priv->tree; - } - } - - smiley = smiley_new (cur_tree->pixbuf, - g_strndup (cur_str, t - cur_str), - cur_tree->path); - smileys = g_slist_prepend (smileys, smiley); - - return g_slist_reverse (smileys); -} - static EmpathySmileyHit * smiley_hit_new (SmileyManagerTree *tree, guint start, @@ -390,6 +307,8 @@ smiley_hit_new (SmileyManagerTree *tree, void empathy_smiley_hit_free (EmpathySmileyHit *hit) { + g_return_if_fail (hit != NULL); + g_slice_free (EmpathySmileyHit, hit); } diff --git a/libempathy-gtk/empathy-smiley-manager.h b/libempathy-gtk/empathy-smiley-manager.h index 9530fe85b..99511e8be 100644 --- a/libempathy-gtk/empathy-smiley-manager.h +++ b/libempathy-gtk/empathy-smiley-manager.h @@ -50,7 +50,6 @@ struct _EmpathySmileyManagerClass { typedef struct { GdkPixbuf *pixbuf; gchar *str; - const gchar *path; } EmpathySmiley; typedef struct { @@ -72,15 +71,12 @@ void empathy_smiley_manager_add (EmpathySmileyManag const gchar *first_str, ...); GSList * empathy_smiley_manager_get_all (EmpathySmileyManager *manager); -GSList * empathy_smiley_manager_parse (EmpathySmileyManager *manager, - const gchar *text); GSList * empathy_smiley_manager_parse_len (EmpathySmileyManager *manager, const gchar *text, gssize len); GtkWidget * empathy_smiley_menu_new (EmpathySmileyManager *manager, EmpathySmileyMenuFunc func, gpointer user_data); -void empathy_smiley_free (EmpathySmiley *smiley); void empathy_smiley_hit_free (EmpathySmileyHit *hit); G_END_DECLS |