-#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
+#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
+#define LIST_ITEM_MAX 20
+
static Elm_Genlist_Item_Class itc;
static void _bstatus(void *data, Evas_Object *obj, void *event_info);
static void _tstatus(void *data, Evas_Object *obj, void *event_info);
-static char *_label_get(void *data, Evas_Object *obj, const char *source);
-static Evas_Object *_icon_get(void *data, Evas_Object *obj, const char *source);
+static char *_text_get(void *data, Evas_Object *obj, const char *source);
+static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *source);
static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *source);
static void _item_del(void *data, Evas_Object *obj);
static void _fill_list(Evas_Object *obj);
static Eina_Bool _dir_has_subs(const char *path);
+static Eina_List *dirs = NULL;
+
static void
_tstatus(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
- Elm_Toolbar_Item *sel;
+ Elm_Object_Item *tb_it;
const char *status;
if (elm_panel_hidden_get((Evas_Object*)data))
else
status = "shown";
printf("The top panel is currently %s\n", status);
- sel = elm_toolbar_selected_item_get(obj);
- elm_toolbar_item_selected_set(sel, EINA_FALSE);
+ tb_it = elm_toolbar_selected_item_get(obj);
+ elm_toolbar_item_selected_set(tb_it, EINA_FALSE);
}
static void
_bstatus(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
- Elm_Toolbar_Item *sel;
+ Elm_Object_Item *tb_it;
const char *status;
if (elm_panel_hidden_get((Evas_Object*)data))
else
status = "shown";
printf("The bottom panel is currently %s\n", status);
- sel = elm_toolbar_selected_item_get(obj);
- elm_toolbar_item_selected_set(sel, EINA_FALSE);
+ tb_it = elm_toolbar_selected_item_get(obj);
+ elm_toolbar_item_selected_set(tb_it, EINA_FALSE);
}
static char *
-_label_get(void *data, Evas_Object *obj __UNUSED__, const char *source __UNUSED__)
+_text_get(void *data, Evas_Object *obj __UNUSED__, const char *source __UNUSED__)
{
return strdup(ecore_file_file_get(data));
}
static Evas_Object *
-_icon_get(void *data, Evas_Object *obj, const char *source)
+_content_get(void *data, Evas_Object *obj, const char *source)
{
if (!strcmp(source, "elm.swallow.icon"))
{
{
DIR *d;
struct dirent *de;
- Eina_List *dirs = NULL, *l;
+ Eina_List *l;
char *real;
+ unsigned int x = 0;
- if (!(d = opendir(getenv("HOME")))) return;
- while ((de = readdir(d)))
+ if (!dirs)
{
- char buff[PATH_MAX];
-
- if (de->d_name[0] == '.') continue;
- snprintf(buff, sizeof(buff), "%s/%s", getenv("HOME"), de->d_name);
- if (!ecore_file_is_dir(buff)) continue;
- real = ecore_file_realpath(buff);
- dirs = eina_list_append(dirs, real);
+ if (!(d = opendir(getenv("HOME")))) return;
+ while ((de = readdir(d)) && (x < LIST_ITEM_MAX))
+ {
+ char buff[PATH_MAX];
+
+ if (de->d_name[0] == '.') continue;
+ snprintf(buff, sizeof(buff), "%s/%s", getenv("HOME"), de->d_name);
+ if (!ecore_file_is_dir(buff)) continue;
+ x++;
+ real = ecore_file_realpath(buff);
+ dirs = eina_list_sorted_insert(dirs, EINA_COMPARE_CB(strcoll), real);
+ }
+ closedir(d);
}
- closedir(d);
-
- dirs = eina_list_sort(dirs, eina_list_count(dirs), EINA_COMPARE_CB(strcoll));
-
EINA_LIST_FOREACH(dirs, l, real)
{
Eina_Bool result = EINA_FALSE;
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
else
elm_genlist_item_append(obj, &itc, eina_stringshare_add(real),
- NULL, ELM_GENLIST_ITEM_SUBITEMS,
+ NULL, ELM_GENLIST_ITEM_TREE,
NULL, NULL);
- free(real);
}
- eina_list_free(dirs);
}
static Eina_Bool
void
test_panel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- Evas_Object *win, *bg, *panel, *bx, *vbx, *toolbar;
+ Evas_Object *win, *panel, *bx, *vbx, *toolbar;
Evas_Object *list;
- win = elm_win_add(NULL, "panel", ELM_WIN_BASIC);
- elm_win_title_set(win, "Panel");
- elm_win_autodel_set(win, 1);
-
- bg = elm_bg_add(win);
- elm_win_resize_object_add(win, bg);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(bg);
+ win = elm_win_util_standard_add("panel", "Panel");
+ elm_win_autodel_set(win, EINA_TRUE);
vbx = elm_box_add(win);
elm_win_resize_object_add(win, vbx);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bx);
- panel = elm_panel_add(win);
+ panel = elm_panel_add(vbx);
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP);
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
- toolbar = elm_toolbar_add(win);
- elm_toolbar_homogenous_set(toolbar, 0);
- elm_toolbar_mode_shrink_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
+ toolbar = elm_toolbar_add(panel);
+ elm_toolbar_homogeneous_set(toolbar, 0);
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(toolbar);
elm_toolbar_item_append(toolbar, "home", "Hello", _tstatus, panel);
- elm_panel_content_set(panel, toolbar);
+ elm_object_content_set(panel, toolbar);
elm_box_pack_end(vbx, panel);
evas_object_show(panel);
- panel = elm_panel_add(win);
+ panel = elm_panel_add(bx);
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(panel, 0, EVAS_HINT_FILL);
itc.item_style = "default";
- itc.func.label_get = _label_get;
- itc.func.icon_get = _icon_get;
+ itc.func.text_get = _text_get;
+ itc.func.content_get = _content_get;
itc.func.state_get = _state_get;
itc.func.del = _item_del;
- list = elm_genlist_add(win);
+ list = elm_genlist_add(panel);
evas_object_size_hint_min_set(list, 100, -1);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(list);
- elm_panel_content_set(panel, list);
+ elm_object_content_set(panel, list);
elm_box_pack_end(bx, panel);
evas_object_show(panel);
_fill_list(list);
- panel = elm_panel_add(win);
+ panel = elm_panel_add(bx);
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT);
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(panel, 1, EVAS_HINT_FILL);
elm_panel_hidden_set(panel, EINA_TRUE);
- list = elm_genlist_add(win);
+ list = elm_genlist_add(panel);
evas_object_size_hint_min_set(list, 100, -1);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(list);
- elm_panel_content_set(panel, list);
+ elm_object_content_set(panel, list);
elm_box_pack_end(bx, panel);
evas_object_show(panel);
_fill_list(list);
+ {
+ char *dir;
+ EINA_LIST_FREE(dirs, dir)
+ free(dir);
+ }
elm_box_pack_end(vbx, bx);
- panel = elm_panel_add(win);
+ panel = elm_panel_add(vbx);
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_BOTTOM);
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_panel_hidden_set(panel, EINA_TRUE);
- toolbar = elm_toolbar_add(win);
- elm_toolbar_homogenous_set(toolbar, 0);
- elm_toolbar_mode_shrink_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
+ toolbar = elm_toolbar_add(panel);
+ elm_toolbar_homogeneous_set(toolbar, 0);
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(toolbar);
elm_toolbar_item_append(toolbar, "home", "Hello", _bstatus, panel);
- elm_panel_content_set(panel, toolbar);
+ elm_object_content_set(panel, toolbar);
elm_box_pack_end(vbx, panel);
evas_object_show(panel);