From ae96ca5e10a8df9f02ff0400cef7d5893a76c828 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Thu, 8 Jan 2009 02:33:00 +0000 Subject: [PATCH] Fix some errors thanks to llvm clang static analyzer, also begin config inwin. --- experimental/ecdb/trunk/src/ecdb.h | 1 + experimental/ecdb/trunk/src/ecdb_erase_gui.c | 6 +- experimental/ecdb/trunk/src/ecdb_gui.c | 74 +++++++++----------- experimental/ecdb/trunk/src/ecdb_gui.h | 4 +- experimental/ecdb/trunk/src/ecdb_widgets.c | 56 +++++++++++++-- experimental/ecdb/trunk/src/ecdb_widgets.h | 6 +- 6 files changed, 97 insertions(+), 50 deletions(-) diff --git a/experimental/ecdb/trunk/src/ecdb.h b/experimental/ecdb/trunk/src/ecdb.h index 6db63d9e..42a30671 100644 --- a/experimental/ecdb/trunk/src/ecdb.h +++ b/experimental/ecdb/trunk/src/ecdb.h @@ -26,6 +26,7 @@ #include #include #include +//#define PATH_MAX 4095 #include /* ECDB Global Variables */ diff --git a/experimental/ecdb/trunk/src/ecdb_erase_gui.c b/experimental/ecdb/trunk/src/ecdb_erase_gui.c index 41905598..ecf6d888 100644 --- a/experimental/ecdb/trunk/src/ecdb_erase_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_erase_gui.c @@ -7,10 +7,9 @@ static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info); static void _button_cb_return(void *data, Evas_Object *obj, void *event_info) { - Evas_Object *swallow, *gui; + Evas_Object *swallow; char *signal; - gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), "erase_page"); @@ -24,12 +23,11 @@ _button_cb_return(void *data, Evas_Object *obj, void *event_info) static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info) { - Evas_Object *swallow, *gui, *o; + Evas_Object *swallow, *o; Ecdb_Erase_Project *proj; char buf[1024]; int drive; - gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), "erase_page"); diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index 0493696c..627b8a88 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -263,40 +263,40 @@ ecdb_handle_typebuf(Evas_Object *gui) /* What to do about multi-word directories? */ dir = ecdb_strip_string(ext); - if ((dir) && (dir[0] == '/')) - { - if (ecore_file_exists(dir)) - { - ewl_filelist_directory_set(EWL_FILELIST(fl), dir); - } - } - else if (dir[0] == '~') - { - char path[PATH_MAX]; - - snprintf(path, PATH_MAX, "%s%s", getenv("HOME"), &dir[1]); - - if (ecore_file_exists(path)) - { - ewl_filelist_directory_set(EWL_FILELIST(fl), path); - } - } - else if (dir) - { - /* Try to concate it to our current directory */ - char path[PATH_MAX]; - - snprintf(path, PATH_MAX, "%s/%s", ewl_filelist_directory_get - (EWL_FILELIST(fl)), dir); - - if (ecore_file_exists(path)) - { - ewl_filelist_directory_set(EWL_FILELIST(fl), path); - } - } - if (dir) { + if (dir[0] == '/') + { + if (ecore_file_exists(dir)) + { + ewl_filelist_directory_set(EWL_FILELIST(fl), dir); + } + } + else if (dir[0] == '~') + { + char path[PATH_MAX]; + + snprintf(path, PATH_MAX, "%s%s", getenv("HOME"), &dir[1]); + + if (ecore_file_exists(path)) + { + ewl_filelist_directory_set(EWL_FILELIST(fl), path); + } + } + else + { + /* Try to concate it to our current directory */ + char path[PATH_MAX]; + + snprintf(path, PATH_MAX, "%s/%s", ewl_filelist_directory_get + (EWL_FILELIST(fl)), dir); + + if (ecore_file_exists(path)) + { + ewl_filelist_directory_set(EWL_FILELIST(fl), path); + } + } + FREE(dir); } @@ -542,7 +542,7 @@ ecdb_gui_controls_enable(const char **ids, int n) } } -Evas_Object * +void ecdb_gui_combo_header_from_drive(Evas_Object *c, const char *name, void *data, Evas_Object *obj, int sel) { @@ -553,11 +553,9 @@ ecdb_gui_combo_header_from_drive(Evas_Object *c, const char *name, void *data, drive = eina_list_nth(em->drives, sel); ecdb_label_text_set(ret, drive->product); evas_object_show(ret); - - return ret; } -Evas_Object * +void ecdb_gui_combo_header_from_speeds(Evas_Object *c, const char *name, void *data, Evas_Object *obj, int sel) { @@ -568,13 +566,11 @@ ecdb_gui_combo_header_from_speeds(Evas_Object *c, const char *name, void *data, drive = data; if (!drive) - return NULL; + return; ret = ecdb_label_add(c, name); snprintf(buf, sizeof(buf), "%d", ecdb_speed_convert(drive, sel)); ecdb_label_text_set(ret, buf); evas_object_show(ret); - - return ret; } diff --git a/experimental/ecdb/trunk/src/ecdb_gui.h b/experimental/ecdb/trunk/src/ecdb_gui.h index 590d001b..98bd1e28 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.h +++ b/experimental/ecdb/trunk/src/ecdb_gui.h @@ -10,10 +10,10 @@ void ecdb_page_hide_finished(void *data, Evas_Object *o, const char *source); void ecdb_gui_controls_disable(const char ** ids, int n); void ecdb_gui_controls_enable(const char **ids, int n); -Evas_Object *ecdb_gui_combo_header_from_drive(Evas_Object *c, const char *name, +void ecdb_gui_combo_header_from_drive(Evas_Object *c, const char *name, void *data, Evas_Object *obj, int sel); -Evas_Object *ecdb_gui_combo_header_from_speeds(Evas_Object *c, const char *name, +void ecdb_gui_combo_header_from_speeds(Evas_Object *c, const char *name, void *data, Evas_Object *obj, int sel); diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.c b/experimental/ecdb/trunk/src/ecdb_widgets.c index b668e263..6cc5c5f4 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.c +++ b/experimental/ecdb/trunk/src/ecdb_widgets.c @@ -287,6 +287,9 @@ _entry_markup_to_text(const char *mkup) char *tag_start, *tag_end, *esc_start, *esc_end, *ts; tag_start = tag_end = esc_start = esc_end = NULL; + if (!mkup) + return NULL; + p = (char *)mkup; s = p; for (;;) @@ -459,7 +462,7 @@ struct _Combo_Data const char *name; const char *header; void *data; - Evas_Object * (*create_header)(Evas_Object *, const char *name, void *data, + void (*create_header)(Evas_Object *, const char *name, void *data, Evas_Object *, int); }; @@ -566,9 +569,16 @@ _combo_clicked(void *data, Evas_Object *obj, void *event_info) cd->selected = i; + header = edje_object_part_swallow_get(data, "ecdb.header.swallow"); + if (header) + { + edje_object_part_unswallow(data, header); + evas_object_del(header); + } + if (cd->create_header) - header = cd->create_header(data, "ecdb.header.swallow", cd->data, - swallow, i); + cd->create_header(data, "ecdb.header.swallow", cd->data, swallow, i); + edje_object_signal_emit(data, "ecdb,combo,header,swallow", "ecdb"); ecdb_combo_collapse(data); } @@ -767,7 +777,7 @@ ecdb_combo_collapse(Evas_Object *c) } void -ecdb_combo_header_create_set(Evas_Object *c, Evas_Object * (*func) +ecdb_combo_header_create_set(Evas_Object *c, void (*func) (Evas_Object *c, const char *name, void *data, Evas_Object *clicked, int idx)) { @@ -825,3 +835,41 @@ ecdb_label_text_set(Evas_Object *l, const char *text) { edje_object_part_text_set(l, "ecdb.label", text); } + +/************************* Config Inwin **************************************/ +Evas_Object * +ecdb_config_inwin_add(Evas_Object *parent, const char *name) +{ + Evas_Object *iw; + + iw = ecdb_widget_add(parent, name); + edje_object_file_set(iw, em->theme_path, "ecdb/config_inwin"); + + /* + evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _combo_resize, + iw); + evas_object_event_callback_add(parent, EVAS_CALLBACK_HIDE, _combo_hide, iw); + evas_object_event_callback_add(c, EVAS_CALLBACK_DEL, _combo_del, iw); + */ + + return iw; +} + +void +ecdb_config_inwin_child_add(Evas_Object *inwin, Evas_Object *child, + int sc, int ec, int sr, int er) +{ + if (!inwin) + { + printf("ecdb_config_inwin_child_add: NULL parent!\n"); + return; + } + if (!child) + return; + + if (!edje_object_part_table_pack(inwin, "ecdb.table", child, sc, sr, ec, er)) + { + printf("ecdb_config_inwin_child_add: Couldn't append to table!\n"); + } +} + diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.h b/experimental/ecdb/trunk/src/ecdb_widgets.h index b28daf01..50eee518 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.h +++ b/experimental/ecdb/trunk/src/ecdb_widgets.h @@ -36,7 +36,7 @@ void ecdb_combo_header_set(Evas_Object *c, const char *text); void ecdb_combo_append(Evas_Object *c, Evas_Object *o); void ecdb_combo_expand(Evas_Object *c); void ecdb_combo_collapse(Evas_Object *c); -void ecdb_combo_header_create_set(Evas_Object *c, Evas_Object * +void ecdb_combo_header_create_set(Evas_Object *c, void (*func)(Evas_Object *c, const char *name, void *data, @@ -49,5 +49,9 @@ void ecdb_combo_clear(Evas_Object *c); Evas_Object *ecdb_label_add(Evas_Object *parent, const char *name); void ecdb_label_text_set(Evas_Object *l, const char *text); +Evas_Object *ecdb_config_inwin_add(Evas_Object *parent, const char *name); +void ecdb_config_inwin_child_add(Evas_Object *inwin, Evas_Object *child, + int sc, int ec, + int sr, int er); #endif