summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Houston <stephen@localhost.localdomain>2017-12-04 09:58:09 -0600
committerStephen Houston <stephen@localhost.localdomain>2017-12-04 09:58:09 -0600
commit12b72d465b11d2b642bcbb54286b2be6977857c8 (patch)
treebab3ad29942ec16be2bb45015e7bd050f1ae3523
parent4b96e40bc47f439758a06ff8dc57a4e215e26b0a (diff)
Handle the case where wireless is run as an app.
-rw-r--r--src/wireless.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/wireless.c b/src/wireless.c
index c5337df..3ed18c1 100644
--- a/src/wireless.c
+++ b/src/wireless.c
@@ -40,6 +40,7 @@ typedef struct Instance
40 Evas_Object *box; 40 Evas_Object *box;
41 Evas_Object *icon[WIRELESS_SERVICE_TYPE_LAST]; 41 Evas_Object *icon[WIRELESS_SERVICE_TYPE_LAST];
42 Eina_Bool popup; 42 Eina_Bool popup;
43 Eina_Bool gadget;
43 Wireless_Connection_Type connection; 44 Wireless_Connection_Type connection;
44 45
45 struct 46 struct
@@ -1053,8 +1054,10 @@ _wireless_gadget_edit(int type)
1053 _wireless_gadget_edit_array_entry(wc->proxy_excludes, &wireless_popup.proxy_excludes); 1054 _wireless_gadget_edit_array_entry(wc->proxy_excludes, &wireless_popup.proxy_excludes);
1054 1055
1055 wireless_popup.popup = popup = elm_win_add(inst->win, "win", ELM_WIN_BASIC); 1056 wireless_popup.popup = popup = elm_win_add(inst->win, "win", ELM_WIN_BASIC);
1056 elm_win_alpha_set(popup, 1); 1057 if (inst->gadget)
1057 1058 elm_win_alpha_set(popup, 1);
1059 else
1060 elm_win_autodel_set(popup, 1);
1058 box = elm_box_add(popup); 1061 box = elm_box_add(popup);
1059 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0); 1062 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
1060 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); 1063 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -1211,7 +1214,10 @@ _wireless_gadget_mouse_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Ob
1211 wireless_popup.items = eina_hash_pointer_new(NULL); 1214 wireless_popup.items = eina_hash_pointer_new(NULL);
1212 1215
1213 ctx = elm_win_add(inst->win, "win", ELM_WIN_POPUP_MENU); 1216 ctx = elm_win_add(inst->win, "win", ELM_WIN_POPUP_MENU);
1214 elm_win_alpha_set(ctx, 1); 1217 if (inst->gadget)
1218 elm_win_alpha_set(ctx, 1);
1219 else
1220 elm_win_autodel_set(ctx, 1);
1215 evas_object_size_hint_weight_set(ctx, .2, .33); 1221 evas_object_size_hint_weight_set(ctx, .2, .33);
1216 1222
1217 tb = elm_box_add(ctx); 1223 tb = elm_box_add(ctx);
@@ -1467,8 +1473,17 @@ main(int argc, char *argv[])
1467 1473
1468 wireless_config = calloc(1, sizeof(Wireless_Config)); 1474 wireless_config = calloc(1, sizeof(Wireless_Config));
1469 inst = calloc(1, sizeof(Instance)); 1475 inst = calloc(1, sizeof(Instance));
1470 snprintf(id, sizeof(id), "%s", getenv("E_GADGET_ID")); 1476 if (getenv("E_GADGET_ID"))
1471 inst->id = atoi(id); 1477 {
1478 snprintf(id, sizeof(id), "%s", getenv("E_GADGET_ID"));
1479 inst->id = atoi(id);
1480 inst->gadget = 1;
1481 }
1482 else
1483 {
1484 inst->id = 0;
1485 inst->gadget = 0;
1486 }
1472 inst->connection = WIRELESS_CONNECTION_TYPE_CONNMAN; 1487 inst->connection = WIRELESS_CONNECTION_TYPE_CONNMAN;
1473 inst->orient = E_GADGET_SITE_ORIENT_NONE; 1488 inst->orient = E_GADGET_SITE_ORIENT_NONE;
1474 wireless_popup.type = inst->tooltip.type = -1; 1489 wireless_popup.type = inst->tooltip.type = -1;
@@ -1479,7 +1494,6 @@ main(int argc, char *argv[])
1479 _connection_init(); 1494 _connection_init();
1480 1495
1481 inst->win = elm_win_add(NULL, "wireless", ELM_WIN_BASIC); 1496 inst->win = elm_win_add(NULL, "wireless", ELM_WIN_BASIC);
1482 evas_object_size_hint_min_set(inst->win, 100, 100);
1483 evas_object_size_hint_aspect_set(inst->win, EVAS_ASPECT_CONTROL_BOTH, 1, 1); 1497 evas_object_size_hint_aspect_set(inst->win, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
1484 evas_object_smart_callback_add(inst->win, "gadget_site_anchor", _orient_change, NULL); 1498 evas_object_smart_callback_add(inst->win, "gadget_site_anchor", _orient_change, NULL);
1485 evas_object_smart_callback_add(inst->win, "gadget_site_orient", _orient_change, NULL); 1499 evas_object_smart_callback_add(inst->win, "gadget_site_orient", _orient_change, NULL);
@@ -1510,6 +1524,12 @@ main(int argc, char *argv[])
1510 else 1524 else
1511 _wireless_gadget_refresh(); 1525 _wireless_gadget_refresh();
1512 1526
1527 if (!inst->gadget)
1528 {
1529 elm_win_alpha_set(inst->win, 0);
1530 evas_object_resize(inst->win, 100, 100);
1531 }
1532
1513 elm_win_resize_object_add(inst->win, inst->box); 1533 elm_win_resize_object_add(inst->win, inst->box);
1514 evas_object_show(inst->win); 1534 evas_object_show(inst->win);
1515 ecore_main_loop_begin(); 1535 ecore_main_loop_begin();
@@ -1722,7 +1742,10 @@ wireless_authenticate(const Eina_Array *fields, Wireless_Auth_Cb cb, void *data)
1722 } 1742 }
1723 1743
1724 popup = elm_win_add(inst->win, "win", ELM_WIN_BASIC); 1744 popup = elm_win_add(inst->win, "win", ELM_WIN_BASIC);
1725 elm_win_alpha_set(popup, 1); 1745 if (inst->gadget)
1746 elm_win_alpha_set(popup, 1);
1747 else
1748 elm_win_autodel_set(popup, 1);
1726 evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, _wireless_auth_key, p); 1749 evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, _wireless_auth_key, p);
1727 evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _wireless_auth_del, p); 1750 evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _wireless_auth_del, p);
1728 p->popup = popup; 1751 p->popup = popup;
@@ -1816,8 +1839,10 @@ wireless_authenticate_external(Wireless_Network *wn, const char *url)
1816 if (!inst->icon[wn->type]) return; 1839 if (!inst->icon[wn->type]) return;
1817 1840
1818 ctx = elm_win_add(inst->win, "win", ELM_WIN_POPUP_MENU); 1841 ctx = elm_win_add(inst->win, "win", ELM_WIN_POPUP_MENU);
1819 elm_win_alpha_set(ctx, 1); 1842 if (inst->gadget)
1820 1843 elm_win_alpha_set(ctx, 1);
1844 else
1845 elm_win_autodel_set(ctx, 1);
1821 tb = elm_table_add(ctx); 1846 tb = elm_table_add(ctx);
1822 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0); 1847 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0);
1823 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); 1848 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);