diff options
author | David Walter Seikel | 2013-01-14 04:11:14 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-14 04:11:14 +1000 |
commit | d6104c410dfa3607ab044e16faa80e8be8bda979 (patch) | |
tree | 65f94769eff53158f466b1217c9b3ac254b97394 /ClientHamr/extantz | |
parent | Just some general clean up. (diff) | |
download | SledjHamr-d6104c410dfa3607ab044e16faa80e8be8bda979.zip SledjHamr-d6104c410dfa3607ab044e16faa80e8be8bda979.tar.gz SledjHamr-d6104c410dfa3607ab044e16faa80e8be8bda979.tar.bz2 SledjHamr-d6104c410dfa3607ab044e16faa80e8be8bda979.tar.xz |
Add viewers list.
Diffstat (limited to 'ClientHamr/extantz')
-rw-r--r-- | ClientHamr/extantz/extantz.c | 101 | ||||
-rw-r--r-- | ClientHamr/extantz/extantz.h | 1 |
2 files changed, 80 insertions, 22 deletions
diff --git a/ClientHamr/extantz/extantz.c b/ClientHamr/extantz/extantz.c index f0fd4c6..a776b9d 100644 --- a/ClientHamr/extantz/extantz.c +++ b/ClientHamr/extantz/extantz.c | |||
@@ -23,8 +23,19 @@ static char *accountTest[][3] = | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | 25 | ||
26 | static char *viewerTest[][3] = | ||
27 | { | ||
28 | {"Imprudence", "1.4.0 beta 3", ""}, | ||
29 | {"Kokua", "3.4.4.25633", ""}, | ||
30 | {"meta-impy", "1.4.0 beta 1.5", ""}, | ||
31 | {"SL", "v3", ""}, | ||
32 | {NULL, NULL, NULL} | ||
33 | }; | ||
34 | |||
35 | |||
26 | static Elm_Genlist_Item_Class *grid_gic = NULL; | 36 | static Elm_Genlist_Item_Class *grid_gic = NULL; |
27 | static Elm_Genlist_Item_Class *account_gic = NULL; | 37 | static Elm_Genlist_Item_Class *account_gic = NULL; |
38 | static Elm_Genlist_Item_Class *viewer_gic = NULL; | ||
28 | 39 | ||
29 | static int x, y, w, h; | 40 | static int x, y, w, h; |
30 | 41 | ||
@@ -695,6 +706,31 @@ static Evas_Object *_account_content_get(void *data, Evas_Object *obj, const cha | |||
695 | return ic; | 706 | return ic; |
696 | } | 707 | } |
697 | 708 | ||
709 | static char *_viewer_label_get(void *data, Evas_Object *obj, const char *part) | ||
710 | { | ||
711 | ezViewer *thisViewer = data; | ||
712 | char buf[256]; | ||
713 | |||
714 | if (!strcmp(part, "elm.text")) | ||
715 | snprintf(buf, sizeof(buf), "%s", thisViewer->name); | ||
716 | else | ||
717 | snprintf(buf, sizeof(buf), "%s", thisViewer->version); | ||
718 | return strdup(buf); | ||
719 | } | ||
720 | |||
721 | static Evas_Object *_viewer_content_get(void *data, Evas_Object *obj, const char *part) | ||
722 | { | ||
723 | ezViewer *thisViewer = data; | ||
724 | Evas_Object *ic = elm_icon_add(obj); | ||
725 | |||
726 | if (!strcmp(part, "elm.swallow.icon")) | ||
727 | elm_icon_standard_set(ic, thisViewer->icon); | ||
728 | |||
729 | evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); | ||
730 | return ic; | ||
731 | } | ||
732 | |||
733 | |||
698 | static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info) | 734 | static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info) |
699 | { | 735 | { |
700 | ezGrid *thisGrid = data; | 736 | ezGrid *thisGrid = data; |
@@ -708,7 +744,7 @@ static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info) | |||
708 | 744 | ||
709 | EAPI_MAIN int elm_main(int argc, char **argv) | 745 | EAPI_MAIN int elm_main(int argc, char **argv) |
710 | { | 746 | { |
711 | Evas_Object *bg, *tb, *bt, *menu, *nf, *tab, *list; | 747 | Evas_Object *bg, *tb, *bt, *menu, *nf, *tab, *gridList, *viewerList; |
712 | Elm_Object_Item *tb_it, *menu_it, *tab_it; | 748 | Elm_Object_Item *tb_it, *menu_it, *tab_it; |
713 | EPhysics_Body *boundary; | 749 | EPhysics_Body *boundary; |
714 | EPhysics_World *world; | 750 | EPhysics_World *world; |
@@ -789,10 +825,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
789 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld->win); | 825 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld->win); |
790 | elm_toolbar_menu_parent_set(tb, gld->win); | 826 | elm_toolbar_menu_parent_set(tb, gld->win); |
791 | 827 | ||
792 | nf = elm_naviframe_add(gld->win); | 828 | // Grids stuff |
793 | evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 829 | gridList = elm_genlist_add(gld->win); |
794 | evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL); | 830 | grids = eina_hash_stringshared_new(free); |
795 | evas_object_show(nf); | ||
796 | 831 | ||
797 | grid_gic = elm_genlist_item_class_new(); | 832 | grid_gic = elm_genlist_item_class_new(); |
798 | grid_gic->item_style = "double_label"; | 833 | grid_gic->item_style = "double_label"; |
@@ -800,21 +835,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
800 | grid_gic->func.content_get = _grid_content_get; | 835 | grid_gic->func.content_get = _grid_content_get; |
801 | grid_gic->func.state_get = NULL; | 836 | grid_gic->func.state_get = NULL; |
802 | grid_gic->func.del = NULL; | 837 | grid_gic->func.del = NULL; |
803 | |||
804 | account_gic = elm_genlist_item_class_new(); | ||
805 | account_gic->item_style = "default"; | ||
806 | account_gic->func.text_get = _account_label_get; | ||
807 | account_gic->func.content_get = _account_content_get; | ||
808 | account_gic->func.state_get = NULL; | ||
809 | account_gic->func.del = NULL; | ||
810 | |||
811 | list = elm_genlist_add(gld->win); | ||
812 | tab = _content_image_new(gld->win, img1); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Accounts", _promote, tab_it); | ||
813 | tab = _content_image_new(gld->win, img2); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); | ||
814 | tab = _content_image_new(gld->win, img3); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); | ||
815 | tab = list; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); | ||
816 | |||
817 | grids = eina_hash_stringshared_new(free); | ||
818 | for (i = 0; NULL != gridTest[i][0]; i++) | 838 | for (i = 0; NULL != gridTest[i][0]; i++) |
819 | { | 839 | { |
820 | ezGrid *thisGrid = calloc(1, sizeof(ezGrid)); | 840 | ezGrid *thisGrid = calloc(1, sizeof(ezGrid)); |
@@ -827,11 +847,17 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
827 | thisGrid->loginURI = gridTest[i][1]; | 847 | thisGrid->loginURI = gridTest[i][1]; |
828 | thisGrid->splashPage = gridTest[i][2]; | 848 | thisGrid->splashPage = gridTest[i][2]; |
829 | thisGrid->icon = "folder"; | 849 | thisGrid->icon = "folder"; |
830 | thisGrid->item = elm_genlist_item_append(list, grid_gic, thisGrid, NULL, ELM_GENLIST_ITEM_TREE, _grid_sel_cb, thisGrid); | 850 | thisGrid->item = elm_genlist_item_append(gridList, grid_gic, thisGrid, NULL, ELM_GENLIST_ITEM_TREE, _grid_sel_cb, thisGrid); |
831 | eina_hash_add(grids, thisGrid->name, thisGrid); | 851 | eina_hash_add(grids, thisGrid->name, thisGrid); |
832 | } | 852 | } |
833 | } | 853 | } |
834 | 854 | ||
855 | account_gic = elm_genlist_item_class_new(); | ||
856 | account_gic->item_style = "default"; | ||
857 | account_gic->func.text_get = _account_label_get; | ||
858 | account_gic->func.content_get = _account_content_get; | ||
859 | account_gic->func.state_get = NULL; | ||
860 | account_gic->func.del = NULL; | ||
835 | for (i = 0; NULL != accountTest[i][0]; i++) | 861 | for (i = 0; NULL != accountTest[i][0]; i++) |
836 | { | 862 | { |
837 | ezAccount *thisAccount = calloc(1, sizeof(ezAccount)); | 863 | ezAccount *thisAccount = calloc(1, sizeof(ezAccount)); |
@@ -842,11 +868,42 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
842 | thisAccount->name = accountTest[i][1]; | 868 | thisAccount->name = accountTest[i][1]; |
843 | thisAccount->password = accountTest[i][2]; | 869 | thisAccount->password = accountTest[i][2]; |
844 | thisAccount->icon = "file"; | 870 | thisAccount->icon = "file"; |
845 | elm_genlist_item_append(list, account_gic, thisAccount, grid->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); | 871 | elm_genlist_item_append(gridList, account_gic, thisAccount, grid->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
846 | eina_clist_add_tail(&(grid->accounts), &(thisAccount->grid)); | 872 | eina_clist_add_tail(&(grid->accounts), &(thisAccount->grid)); |
847 | } | 873 | } |
848 | } | 874 | } |
849 | 875 | ||
876 | // Viewers stuff | ||
877 | viewerList = elm_genlist_add(gld->win); | ||
878 | viewer_gic = elm_genlist_item_class_new(); | ||
879 | viewer_gic->item_style = "double_label"; | ||
880 | viewer_gic->func.text_get = _viewer_label_get; | ||
881 | viewer_gic->func.content_get = _viewer_content_get; | ||
882 | viewer_gic->func.state_get = NULL; | ||
883 | viewer_gic->func.del = NULL; | ||
884 | for (i = 0; NULL != viewerTest[i][0]; i++) | ||
885 | { | ||
886 | ezViewer *thisViewer = calloc(1, sizeof(ezViewer)); | ||
887 | |||
888 | if (thisViewer) | ||
889 | { | ||
890 | thisViewer->name = viewerTest[i][0]; | ||
891 | thisViewer->version = viewerTest[i][1]; | ||
892 | thisViewer->path = viewerTest[i][2]; | ||
893 | thisViewer->icon = "file"; | ||
894 | thisViewer->item = elm_genlist_item_append(viewerList, viewer_gic, thisViewer, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); | ||
895 | } | ||
896 | } | ||
897 | |||
898 | // Toolbar pages | ||
899 | nf = elm_naviframe_add(gld->win); | ||
900 | evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
901 | evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
902 | evas_object_show(nf); | ||
903 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); | ||
904 | tab = _content_image_new(gld->win, img3); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); | ||
905 | tab = gridList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); | ||
906 | |||
850 | bt = elm_button_add(gld->win); | 907 | bt = elm_button_add(gld->win); |
851 | elm_object_text_set(bt, "Login"); | 908 | elm_object_text_set(bt, "Login"); |
852 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | 909 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); |
diff --git a/ClientHamr/extantz/extantz.h b/ClientHamr/extantz/extantz.h index fdcb6b5..c234e81 100644 --- a/ClientHamr/extantz/extantz.h +++ b/ClientHamr/extantz/extantz.h | |||
@@ -48,6 +48,7 @@ typedef struct | |||
48 | char *icon; | 48 | char *icon; |
49 | uint16_t tag; // The UUID of the texture used in the avatar bake hack. | 49 | uint16_t tag; // The UUID of the texture used in the avatar bake hack. |
50 | uint8_t r, g, b; // Colour used for the in world tag. | 50 | uint8_t r, g, b; // Colour used for the in world tag. |
51 | Elm_Object_Item *item; | ||
51 | } ezViewer; | 52 | } ezViewer; |
52 | 53 | ||
53 | typedef struct | 54 | typedef struct |