summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-12-16 17:16:36 +0000
committerTom Hacohen <tom@stosb.com>2013-12-16 17:16:36 +0000
commite6800e9c9d7cc4cc8ef92a90f48fb2c74a6eed66 (patch)
tree6e395907e96bdeee9f3c9a7ba23714141a5d39a2
parentc3166d6a5d124d71d10645e6c01f5edddcfcd458 (diff)
Return to previously selected item on reload.v0.2.0
-rw-r--r--src/bin/clouseau_client.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/bin/clouseau_client.c b/src/bin/clouseau_client.c
index 32871b8..e2a57f3 100644
--- a/src/bin/clouseau_client.c
+++ b/src/bin/clouseau_client.c
@@ -84,6 +84,7 @@ struct _Gui_Elementns
84 char *address; 84 char *address;
85 App_Data_St *sel_app; /* Currently selected app data */ 85 App_Data_St *sel_app; /* Currently selected app data */
86 Elm_Object_Item *gl_it; /* Currently selected genlist item */ 86 Elm_Object_Item *gl_it; /* Currently selected genlist item */
87 uintptr_t jump_to_ptr;
87}; 88};
88typedef struct _Gui_Elementns Gui_Elements; 89typedef struct _Gui_Elementns Gui_Elements;
89 90
@@ -102,6 +103,7 @@ static Ecore_Con_Reply *eet_svr = NULL;
102static Eina_Bool _add_callback_called = EINA_FALSE; 103static Eina_Bool _add_callback_called = EINA_FALSE;
103static void _cancel_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); 104static void _cancel_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
104static void _ofl_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); 105static void _ofl_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
106static void _jump_to_ptr(Gui_Elements *g, uintptr_t ptr);
105 107
106static void 108static void
107_titlebar_string_set(Gui_Elements *g, Eina_Bool online) 109_titlebar_string_set(Gui_Elements *g, Eina_Bool online)
@@ -264,6 +266,12 @@ _load_gui_with_list(Gui_Elements *g, Eina_List *trees)
264 glflag, NULL, NULL); 266 glflag, NULL, NULL);
265 } 267 }
266 268
269 if (g->jump_to_ptr)
270 {
271 _jump_to_ptr(g, g->jump_to_ptr);
272 g->jump_to_ptr = 0;
273 }
274
267 return EINA_TRUE; 275 return EINA_TRUE;
268} 276}
269 277
@@ -1287,8 +1295,12 @@ _gl_selected(void *data, Evas_Object *pobj EINA_UNUSED, void *event_info)
1287 Clouseau_Tree_Item *treeit = elm_object_item_data_get(event_info); 1295 Clouseau_Tree_Item *treeit = elm_object_item_data_get(event_info);
1288 const Elm_Object_Item *parent; 1296 const Elm_Object_Item *parent;
1289 const Elm_Object_Item *prt = elm_genlist_item_parent_get(event_info); 1297 const Elm_Object_Item *prt = elm_genlist_item_parent_get(event_info);
1298
1290 if (!prt) 1299 if (!prt)
1291 return; 1300 {
1301 g->gl_it = NULL;
1302 return;
1303 }
1292 1304
1293 /* Populate object information, then do highlight */ 1305 /* Populate object information, then do highlight */
1294 if (g->gl_it != event_info) 1306 if (g->gl_it != event_info)
@@ -1416,6 +1428,13 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
1416{ 1428{
1417 Gui_Elements *g = data; 1429 Gui_Elements *g = data;
1418 1430
1431 /* If there's a currently selected item, try to reopening it. */
1432 if (g->gl_it)
1433 {
1434 Clouseau_Tree_Item *treeit = elm_object_item_data_get(g->gl_it);
1435 g->jump_to_ptr = (treeit) ? (uintptr_t) treeit->ptr : 0;
1436 }
1437
1419 /* Close all app-bmp-view windows here and clear mem */ 1438 /* Close all app-bmp-view windows here and clear mem */
1420 if (g->sel_app) 1439 if (g->sel_app)
1421 { 1440 {
@@ -1796,23 +1815,29 @@ _ofl_bt_clicked(void *data,
1796} 1815}
1797 1816
1798static void 1817static void
1799_jump_to_entry_activated(void *data, 1818_jump_to_ptr(Gui_Elements *g, uintptr_t ptr)
1800 Evas_Object *obj, void *event_info EINA_UNUSED)
1801{ 1819{
1802 Gui_Elements *g = data;
1803 tree_data_st *td = (g->sel_app->td) ? g->sel_app->td : NULL; 1820 tree_data_st *td = (g->sel_app->td) ? g->sel_app->td : NULL;
1804 long long unsigned int ptr = strtoul(elm_object_text_get(obj), NULL, 16);
1805 Eina_List *found = NULL; 1821 Eina_List *found = NULL;
1806 1822
1807 if ((found = _list_tree_item_pointer_find(td->tree, (uintptr_t) ptr))) 1823 if (td && (found = _list_tree_item_pointer_find(td->tree, (uintptr_t) ptr)))
1808 { 1824 {
1809 _load_gui_with_list(g, td->tree);
1810 _tree_item_show(g->gl, found); 1825 _tree_item_show(g->gl, found);
1811 eina_list_free(found); 1826 eina_list_free(found);
1812 } 1827 }
1813} 1828}
1814 1829
1815static void 1830static void
1831_jump_to_entry_activated(void *data,
1832 Evas_Object *obj, void *event_info EINA_UNUSED)
1833{
1834 Gui_Elements *g = data;
1835 long long unsigned int ptr = strtoul(elm_object_text_get(obj), NULL, 16);
1836
1837 _jump_to_ptr(g, ptr);
1838}
1839
1840static void
1816_control_buttons_create(Gui_Elements *g, Evas_Object *win) 1841_control_buttons_create(Gui_Elements *g, Evas_Object *win)
1817{ 1842{
1818 Evas_Object *highlight_check; 1843 Evas_Object *highlight_check;