[Elm] Since we're talking 'bout file_set()s, let's be broader.
authorglima <glima@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 22:51:40 +0000 (22:51 +0000)
committerglima <glima@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 22:51:40 +0000 (22:51 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68857 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_entry.c
src/lib/elm_entry.h
src/lib/elm_video.c
src/lib/elm_video.h

index d9890c2..8ed7220 100644 (file)
@@ -281,16 +281,16 @@ _load_plain(const char *file)
    return NULL;
 }
 
-static void
+static Eina_Bool
 _load(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    char *text;
-   if (!wd) return;
+   if (!wd) return EINA_FALSE;
    if (!wd->file)
      {
         elm_object_text_set(obj, "");
-        return;
+        return EINA_TRUE;
      }
    switch (wd->format)
      {
@@ -308,9 +308,13 @@ _load(Evas_Object *obj)
      {
         elm_object_text_set(obj, text);
         free(text);
+        return EINA_TRUE;
      }
    else
-     elm_object_text_set(obj, "");
+     {
+        elm_object_text_set(obj, "");
+        return EINA_FALSE;
+     }
 }
 
 static void
@@ -3328,12 +3332,12 @@ elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **te
    *insert = 0;
 }
 
-EAPI void
+EAPI Eina_Bool
 elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   if (!wd) return EINA_FALSE;
    if (wd->delay_write)
      {
         ecore_timer_del(wd->delay_write);
@@ -3342,7 +3346,7 @@ elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
    if (wd->autosave) _save(obj);
    eina_stringshare_replace(&wd->file, file);
    wd->format = format;
-   _load(obj);
+   return _load(obj);
 }
 
 EAPI void
index e74c36c..71175e8 100644 (file)
@@ -1025,8 +1025,9 @@ EAPI char              *elm_entry_utf8_to_markup(const char *s);
  * @param obj The entry object
  * @param file The path to the file to load and save
  * @param format The file format
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  */
-EAPI void               elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format);
+EAPI Eina_Bool          elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format);
 
 /**
  * Gets the file being edited by the entry.
index c6a94d3..9d8769a 100644 (file)
@@ -310,24 +310,28 @@ elm_video_add(Evas_Object *parent)
 #endif
 }
 
-EAPI void
+EAPI Eina_Bool
 elm_video_file_set(Evas_Object *video, const char *filename)
 {
 #ifdef HAVE_EMOTION
-   ELM_CHECK_WIDTYPE(video, widtype);
+   ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(video);
 
    if (wd->remember) emotion_object_last_position_save(wd->emotion);
    wd->stop = EINA_FALSE;
-   emotion_object_file_set(wd->emotion, filename);
+   if (!emotion_object_file_set(wd->emotion, filename)) return EINA_FALSE;
 
    if ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://")))
      emotion_object_last_position_load(wd->emotion);
 
    edje_object_signal_emit(wd->layout, "elm,video,load", "elm");
+
+   return EINA_TRUE;
 #else
    (void) video;
    (void) filename;
+
+   return EINA_FALSE;
 #endif
 }
 
index 5b29b24..5e23532 100644 (file)
@@ -75,6 +75,8 @@ EAPI Evas_Object         *elm_video_add(Evas_Object *parent);
  * WebCam (v4l2://). (You can use Emotion API to request and list 
  * the available Webcam on your system).
  *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
+ *
  * This function will explicitly define a file or URI as a source
  * for the video of the Elm_Video object.
  *
@@ -83,7 +85,7 @@ EAPI Evas_Object         *elm_video_add(Evas_Object *parent);
  *
  * @ingroup Video
  */
-EAPI void                 elm_video_file_set(Evas_Object *video, const char *filename);
+EAPI Eina_Bool            elm_video_file_set(Evas_Object *video, const char *filename);
 
 /**
  * @brief Get the underlying Emotion object.