Fix elm_bg_file_set/get
authorhelen <helen>
Thu, 25 Nov 2010 15:16:48 +0000 (15:16 +0000)
committerhelen <helen@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 25 Nov 2010 15:16:48 +0000 (15:16 +0000)
If the file is a NULL pointer, it will delete the old imagem and set its
internal strings about file and group to NULL.
In the get function if the file argument is null does not mean that
it will not retrieve the group too.

SVN revision: 54986

src/lib/elm_bg.c

index f4ca338..43b230e 100644 (file)
@@ -165,6 +165,9 @@ elm_bg_add(Evas_Object *parent)
  * will be stretched (retaining aspect if its an image file) to completely fill
  * the bg object. This may mean some parts are not visible.
  *
+ * @note  Once the image of @p obj is set, a previously set one will be deleted,
+ * even if @p file is NULL.
+ *
  * @ingroup Bg
  */
 EAPI void
@@ -179,7 +182,14 @@ elm_bg_file_set(Evas_Object *obj, const char *file, const char *group)
        evas_object_del(wd->img);
        wd->img = NULL;
      }
-   if (!file) return;
+   if (!file)
+     {
+        eina_stringshare_del(wd->file);
+        wd->file = NULL;
+        eina_stringshare_del(wd->group);
+        wd->group = NULL;
+        return;
+     }
    eina_stringshare_replace(&wd->file, file);
    eina_stringshare_replace(&wd->group, group);
    if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
@@ -212,7 +222,6 @@ elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!file) return;
    if (file) *file = wd->file;
    if (group) *group = wd->group;
 }