[Elm] Since we're talking 'bout file_set()s, let's be broader.

SVN revision: 68857
This commit is contained in:
Gustavo Lima Chaves 2012-03-06 22:51:40 +00:00
parent 02aa57d92e
commit 969e0b4c51
4 changed files with 24 additions and 13 deletions

View 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

View 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.

View 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
}

View 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.