Fix up formatting and remove whitespace. Still trying to figure out why this

shows a blank dialog tho :(



SVN revision: 37803
This commit is contained in:
Christopher Michael 2008-11-25 22:54:44 +00:00
parent ca31354113
commit 302bd8a48a
2 changed files with 42 additions and 59 deletions

View File

@ -4,10 +4,7 @@
#include "e.h"
#include "e_mod_main.h"
/***************************************************************************/
/**/
/* actual module specifics */
static void _e_mod_action_syscon_cb(E_Object *obj, const char *params);
static int _e_mod_syscon_defer_cb(void *data);
static void _e_mod_syscon_cb(void *data, E_Menu *m, E_Menu_Item *mi);
@ -17,17 +14,6 @@ static E_Module *conf_module = NULL;
static E_Action *act = NULL;
static E_Int_Menu_Augmentation *maug = NULL;
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/* module setup */
EAPI E_Module_Api e_modapi =
{
@ -48,7 +34,8 @@ e_modapi_init(E_Module *m)
e_action_predef_name_set(_("System"), _("System Control"), "syscon",
NULL, NULL, 0);
}
maug = e_int_menus_menu_augmentation_add("main/10", _e_mod_menu_add, NULL, NULL, NULL);
maug = e_int_menus_menu_augmentation_add("main/10", _e_mod_menu_add,
NULL, NULL, NULL);
e_module_delayed_set(m, 1);
return m;
}
@ -113,7 +100,7 @@ static int
_e_mod_syscon_defer_cb(void *data)
{
E_Zone *zone;
zone = data;
if (zone) e_syscon_show(zone, NULL);
return 0;
@ -130,7 +117,7 @@ static void
_e_mod_menu_add(void *data, E_Menu *m)
{
E_Menu_Item *mi;
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("System"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/system");

View File

@ -49,9 +49,9 @@ e_syscon_show(E_Zone *zone, const char *defact)
int x, y, w, h;
int iw, ih;
Eina_List *l;
if (popup) return 0;
input_window = ecore_x_window_input_new(zone->container->win, zone->x,
zone->y, zone->w, zone->h);
ecore_x_window_show(input_window);
@ -61,7 +61,7 @@ e_syscon_show(E_Zone *zone, const char *defact)
input_window = 0;
return 0;
}
popup = e_popup_new(zone, 0, 0, 1, 1);
if (!popup)
{
@ -72,7 +72,7 @@ e_syscon_show(E_Zone *zone, const char *defact)
}
evas_event_freeze(popup->evas);
e_popup_layer_set(popup, 500);
handlers = eina_list_append
(handlers, ecore_event_handler_add
(ECORE_X_EVENT_KEY_DOWN, _cb_key_down, NULL));
@ -94,19 +94,21 @@ e_syscon_show(E_Zone *zone, const char *defact)
e_theme_edje_object_set(o, "base/theme/syscon",
"e/widgets/syscon/main");
edje_object_part_text_set(o, "e.text.label", _("Cancel"));
edje_object_signal_callback_add(o, "e,action,close", "", _cb_signal_close, NULL);
edje_object_signal_callback_add(o, "e,action,syscon", "*", _cb_signal_syscon, NULL);
edje_object_signal_callback_add(o, "e,action,close", "",
_cb_signal_close, NULL);
edje_object_signal_callback_add(o, "e,action,syscon", "*",
_cb_signal_syscon, NULL);
// main (default):
// halt | suspend | desk_lock
// secondary (default):
// reboot | hibernate | logout
// extra (example for illume):
// home | close | kill
iw = 64 * e_scale;
ih = 64 * e_scale;
o = e_flowlayout_add(popup->evas);
o_flow_main = o;
e_flowlayout_orientation_set(o, 1);
@ -118,20 +120,20 @@ e_syscon_show(E_Zone *zone, const char *defact)
e_flowlayout_orientation_set(o, 1);
e_flowlayout_flowdirection_set(o, 1, 1);
e_flowlayout_homogenous_set(o, 1);
o = e_flowlayout_add(popup->evas);
o_flow_extra = o;
e_flowlayout_orientation_set(o, 1);
e_flowlayout_flowdirection_set(o, 1, 1);
e_flowlayout_homogenous_set(o, 1);
for (l = e_config->syscon.actions; l; l = l->next)
{
E_Config_Syscon_Action *sca;
char buf[1024];
E_Action *a;
int disabled;
sca = l->data;
if (!sca->action) continue;
a = e_action_find(sca->action);
@ -150,7 +152,8 @@ e_syscon_show(E_Zone *zone, const char *defact)
else if ((!strcmp(sca->action, "hibernate")) &&
(!e_sys_action_possible_get(E_SYS_HIBERNATE))) disabled = 1;
o = edje_object_add(popup->evas);
edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action, sca);
edje_object_signal_callback_add(o, "e,action,click", "",
_cb_signal_action, sca);
if (sca->button)
{
snprintf(buf, sizeof(buf), "e/widgets/syscon/item/%s",
@ -187,7 +190,7 @@ e_syscon_show(E_Zone *zone, const char *defact)
evas_object_show(o);
}
// FIXME: "extra" list needs to be handled
e_flowlayout_fill_set(o_flow_main, 1);
edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main);
e_flowlayout_fill_set(o_flow_secondary, 1);
@ -197,7 +200,7 @@ e_syscon_show(E_Zone *zone, const char *defact)
evas_object_resize(o_bg, zone->w, zone->h);
edje_object_calc_force(o_bg);
e_flowlayout_min_size_get(o_flow_main, &mw, &mh);
edje_extern_object_min_size_set(o_flow_main, mw, mh);
edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main);
@ -207,7 +210,7 @@ e_syscon_show(E_Zone *zone, const char *defact)
e_flowlayout_min_size_get(o_flow_extra, &mw, &mh);
edje_extern_object_min_size_set(o_flow_extra, mw, mh);
edje_object_part_swallow(o_bg, "e.swallow.extra", o_flow_extra);
edje_object_size_min_calc(o_bg, &mw, &mh);
w = mw;
if (w > zone->w) w = zone->w;
@ -224,10 +227,11 @@ e_syscon_show(E_Zone *zone, const char *defact)
if (e_config->syscon.do_input)
{
deftimer = ecore_timer_add(e_config->syscon.timeout, _cb_timeout_defaction, NULL);
deftimer = ecore_timer_add(e_config->syscon.timeout,
_cb_timeout_defaction, NULL);
if (defact) do_defact = eina_stringshare_add(defact);
}
evas_event_thaw(popup->evas);
inevas = 0;
e_popup_show(popup);
@ -264,18 +268,16 @@ static int
_cb_key_down(void *data, int type, void *event)
{
Ecore_X_Event_Key_Down *ev;
ev = event;
if (ev->event_win != input_window) return 1;
if (!strcmp(ev->keysymbol, "Escape"))
{
e_syscon_hide();
}
else if (!strcmp(ev->keysymbol, "Up"))
if (!strcmp(ev->keysymbol, "Escape"))
e_syscon_hide();
else if (!strcmp(ev->keysymbol, "Up"))
{
// FIXME: implement focus and key control... eventually
}
return 1;
}
@ -284,7 +286,7 @@ _cb_mouse_down(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Button_Down *ev;
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
ev = event;
if (ev->event_win != input_window) return 1;
if (ev->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
@ -295,9 +297,7 @@ _cb_mouse_down(void *data, int type, void *event)
e_syscon_hide();
return 1;
}
evas_event_feed_mouse_down(popup->evas,
ev->button, flags,
ev->time, NULL);
evas_event_feed_mouse_down(popup->evas, ev->button, flags, ev->time, NULL);
return 1;
}
@ -305,11 +305,10 @@ static int
_cb_mouse_up(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Button_Up *ev;
ev = event;
if (ev->event_win != input_window) return 1;
evas_event_feed_mouse_up(popup->evas,
ev->button, EVAS_BUTTON_NONE,
evas_event_feed_mouse_up(popup->evas, ev->button, EVAS_BUTTON_NONE,
ev->time, NULL);
return 1;
}
@ -318,7 +317,7 @@ static int
_cb_mouse_move(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Move *ev;
ev = event;
if (ev->event_win != input_window) return 1;
if (!inevas)
@ -326,9 +325,7 @@ _cb_mouse_move(void *data, int type, void *event)
evas_event_feed_mouse_in(popup->evas, ev->time, NULL);
inevas = 1;
}
evas_event_feed_mouse_move(popup->evas,
ev->x - popup->x,
ev->y - popup->y,
evas_event_feed_mouse_move(popup->evas, ev->x - popup->x, ev->y - popup->y,
ev->time, NULL);
return 1;
}
@ -337,11 +334,10 @@ static int
_cb_mouse_wheel(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Wheel *ev;
ev = event;
if (ev->event_win != input_window) return 1;
evas_event_feed_mouse_wheel(popup->evas,
ev->direction, ev->z,
evas_event_feed_mouse_wheel(popup->evas, ev->direction, ev->z,
ev->time, NULL);
return 1;
}
@ -356,12 +352,12 @@ static void
_do_action_name(const char *action)
{
Eina_List *l;
for (l = e_config->syscon.actions; l; l = l->next)
{
E_Config_Syscon_Action *sca;
E_Action *a;
sca = l->data;
if (!sca->action) continue;
if (!strcmp(sca->action, action))
@ -386,7 +382,7 @@ _cb_signal_action(void *data, Evas_Object *obj, const char *emission, const char
{
E_Config_Syscon_Action *sca;
E_Action *a;
e_syscon_hide();
sca = data;
if (!sca) return;