forked from enlightenment/enlightenment
remove offline+presentation mode - this has confused people
i've seen various people get confused as to why their screen won't blank and never heard of anyone using offline mode. i think this can retire and just disabkling blanking manually or as presentation/media tools do these days... they ask to suspend screensaver anyway. yes it also affects notifications - but that is a good question - if you want these or not? may as well simplify.
This commit is contained in:
parent
8102f2249f
commit
048a40414f
|
@ -2152,22 +2152,6 @@ ACT_FN_GO(halt_now, EINA_UNUSED)
|
|||
e_sys_action_do(E_SYS_HALT_NOW, NULL);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
ACT_FN_GO(mode_presentation_toggle, EINA_UNUSED)
|
||||
{
|
||||
e_config->mode.presentation = !e_config->mode.presentation;
|
||||
e_config_mode_changed();
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
ACT_FN_GO(mode_offline_toggle, EINA_UNUSED)
|
||||
{
|
||||
e_config->mode.offline = !e_config->mode.offline;
|
||||
e_config_mode_changed();
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
static E_Dialog *logout_dialog = NULL;
|
||||
|
||||
|
@ -3745,15 +3729,6 @@ e_actions_init(void)
|
|||
e_action_predef_name_set(N_("Enlightenment"), N_("Exit Now"),
|
||||
"exit_now", NULL, NULL, 0);
|
||||
|
||||
ACT_GO(mode_presentation_toggle);
|
||||
e_action_predef_name_set(N_("Enlightenment : Mode"),
|
||||
N_("Presentation Mode Toggle"),
|
||||
"mode_presentation_toggle", NULL, NULL, 0);
|
||||
|
||||
ACT_GO(mode_offline_toggle);
|
||||
e_action_predef_name_set(N_("Enlightenment : Mode"),
|
||||
N_("Offline Mode Toggle"),
|
||||
"mode_offline_toggle", NULL, NULL, 0);
|
||||
/* modules */
|
||||
ACT_GO(module_enable);
|
||||
e_action_predef_name_set(N_("Enlightenment : Module"),
|
||||
|
|
|
@ -102,9 +102,7 @@ _e_client_cb_config_mode(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
|
|||
|
||||
/* move fullscreen borders above everything */
|
||||
|
||||
if (e_config->mode.presentation)
|
||||
layer = E_LAYER_CLIENT_TOP;
|
||||
else if (!e_config->allow_above_fullscreen)
|
||||
if (!e_config->allow_above_fullscreen)
|
||||
layer = E_LAYER_CLIENT_FULLSCREEN;
|
||||
else
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
@ -4513,8 +4511,6 @@ e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
|
|||
ec->saved.set = 1;
|
||||
if (!e_config->allow_above_fullscreen)
|
||||
evas_object_layer_set(ec->frame, E_LAYER_CLIENT_FULLSCREEN);
|
||||
else if (e_config->mode.presentation)
|
||||
evas_object_layer_set(ec->frame, E_LAYER_CLIENT_TOP);
|
||||
|
||||
ec->fullscreen = 1;
|
||||
ec->unfullscreen_forced = 0;
|
||||
|
|
|
@ -370,8 +370,6 @@ _e_comp_nocomp_end(void)
|
|||
{
|
||||
if (!e_config->allow_above_fullscreen)
|
||||
layer = E_LAYER_CLIENT_FULLSCREEN;
|
||||
else if (e_config->mode.presentation)
|
||||
layer = E_LAYER_CLIENT_TOP;
|
||||
}
|
||||
evas_object_layer_set(e_comp->nocomp_ec->frame, layer);
|
||||
e_comp->nocomp_ec->fullscreen = fs;
|
||||
|
@ -693,7 +691,7 @@ nocomp:
|
|||
if (!ec->visible) continue;
|
||||
if (evas_object_data_get(ec->frame, "comp_skip")) continue;
|
||||
if (e_object_is_del(E_OBJECT(ec)) || (!e_client_util_desk_visible(ec, e_desk_current_get(ec->zone)))) continue;
|
||||
if (ec->override || (e_config->allow_above_fullscreen && (!e_config->mode.presentation)))
|
||||
if (ec->override || (e_config->allow_above_fullscreen))
|
||||
{
|
||||
_e_comp_nocomp_end();
|
||||
break;
|
||||
|
|
|
@ -919,9 +919,6 @@ _e_config_edd_init(Eina_Bool old)
|
|||
E_CONFIG_VAL(D, T, syscon.do_input, UCHAR);
|
||||
E_CONFIG_LIST(D, T, syscon.actions, _e_config_syscon_action_edd);
|
||||
|
||||
E_CONFIG_VAL(D, T, mode.presentation, UCHAR);
|
||||
E_CONFIG_VAL(D, T, mode.offline, UCHAR);
|
||||
|
||||
E_CONFIG_VAL(D, T, exec.expire_timeout, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, exec.show_run_dialog, UCHAR);
|
||||
E_CONFIG_VAL(D, T, exec.show_exit_dialog, UCHAR);
|
||||
|
@ -1932,9 +1929,6 @@ e_config_load(void)
|
|||
|
||||
E_CONFIG_LIMIT(e_config->ping_clients_interval, 16, 1024);
|
||||
|
||||
E_CONFIG_LIMIT(e_config->mode.presentation, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->mode.offline, 0, 1);
|
||||
|
||||
E_CONFIG_LIMIT(e_config->exec.expire_timeout, 0.1, 1000);
|
||||
E_CONFIG_LIMIT(e_config->exec.show_run_dialog, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->exec.show_exit_dialog, 0, 1);
|
||||
|
|
|
@ -345,12 +345,6 @@ struct _E_Config
|
|||
Eina_List *actions;
|
||||
} syscon;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned char presentation; // INTERNAL
|
||||
unsigned char offline; // INTERNAL
|
||||
} mode;
|
||||
|
||||
struct
|
||||
{
|
||||
double expire_timeout;
|
||||
|
|
|
@ -33,7 +33,6 @@ e_dpms_update(void)
|
|||
Eina_Bool changed = EINA_FALSE;
|
||||
|
||||
enabled = ((e_config->screensaver_enable) &&
|
||||
(!e_config->mode.presentation) &&
|
||||
(!((e_util_fullscreen_current_any()) &&
|
||||
(e_config->no_dpms_on_fullscreen))));
|
||||
if (_e_dpms_enabled != enabled)
|
||||
|
@ -87,8 +86,7 @@ e_dpms_force_update(void)
|
|||
unsigned int standby = 0, suspend = 0, off = 0;
|
||||
int enabled;
|
||||
|
||||
enabled = ((e_config->screensaver_enable) &&
|
||||
(!e_config->mode.presentation));
|
||||
enabled = (e_config->screensaver_enable);
|
||||
#ifndef HAVE_WAYLAND_ONLY
|
||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||
{
|
||||
|
|
|
@ -11,8 +11,6 @@ static Ecore_Event_Handler *_e_screensaver_handler_border_uniconify = NULL;
|
|||
static Ecore_Event_Handler *_e_screensaver_handler_border_desk_set = NULL;
|
||||
static Ecore_Event_Handler *_e_screensaver_handler_desk_show = NULL;
|
||||
static Ecore_Event_Handler *_e_screensaver_handler_powersave = NULL;
|
||||
static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
|
||||
static int _e_screensaver_ask_presentation_count = 0;
|
||||
|
||||
static int _e_screensaver_timeout = 0;
|
||||
static int _e_screensaver_blanking = 0;
|
||||
|
@ -34,11 +32,11 @@ E_API int E_EVENT_SCREENSAVER_OFF_PRE = -1;
|
|||
E_API int
|
||||
e_screensaver_timeout_get(Eina_Bool use_idle)
|
||||
{
|
||||
int timeout = 0, count = (1 + _e_screensaver_ask_presentation_count);
|
||||
int timeout = 0;
|
||||
Eina_Bool use_special_instead_of_dim = EINA_FALSE;
|
||||
|
||||
if (_screensaver_now) return 1;
|
||||
if ((e_config->screensaver_enable) && (!e_config->mode.presentation))
|
||||
if (e_config->screensaver_enable)
|
||||
{
|
||||
if ((e_desklock_state_get()) &&
|
||||
(e_config->screensaver_desklock_timeout > 0))
|
||||
|
@ -47,11 +45,10 @@ e_screensaver_timeout_get(Eina_Bool use_idle)
|
|||
use_special_instead_of_dim = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
timeout = e_config->screensaver_timeout * count;
|
||||
timeout = e_config->screensaver_timeout;
|
||||
}
|
||||
|
||||
if ((use_idle) && (!e_config->mode.presentation) &&
|
||||
(!use_special_instead_of_dim))
|
||||
if ((use_idle) && (!use_special_instead_of_dim))
|
||||
{
|
||||
if (e_config->backlight.idle_dim)
|
||||
{
|
||||
|
@ -96,7 +93,6 @@ e_screensaver_update(void)
|
|||
|
||||
timeout = e_screensaver_timeout_get(EINA_TRUE);
|
||||
if (!((e_config->screensaver_enable) &&
|
||||
(!e_config->mode.presentation) &&
|
||||
(!((e_util_fullscreen_current_any()) &&
|
||||
(e_config->no_dpms_on_fullscreen)))))
|
||||
timeout = 0;
|
||||
|
@ -137,12 +133,8 @@ e_screensaver_update(void)
|
|||
// necessary on some hardware.
|
||||
if (!e_config->screensaver_dpms_off)
|
||||
{
|
||||
int enabled;
|
||||
|
||||
enabled = ((e_config->screensaver_enable) &&
|
||||
(!e_config->mode.presentation));
|
||||
ecore_x_dpms_enabled_set(!enabled);
|
||||
ecore_x_dpms_enabled_set(enabled);
|
||||
ecore_x_dpms_enabled_set(!e_config->screensaver_enable);
|
||||
ecore_x_dpms_enabled_set(e_config->screensaver_enable);
|
||||
}
|
||||
ecore_x_screensaver_set(timeout, interval, blanking, expose);
|
||||
}
|
||||
|
@ -157,97 +149,6 @@ _e_screensaver_handler_config_mode_cb(void *data EINA_UNUSED, int type EINA_UNUS
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_del(void *data)
|
||||
{
|
||||
if (_e_screensaver_ask_presentation_dia == data)
|
||||
_e_screensaver_ask_presentation_dia = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_yes(void *data EINA_UNUSED, E_Dialog *dia)
|
||||
{
|
||||
e_config->mode.presentation = 1;
|
||||
e_config_mode_changed();
|
||||
e_config_save_queue();
|
||||
e_object_del(E_OBJECT(dia));
|
||||
_e_screensaver_ask_presentation_count = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_no(void *data EINA_UNUSED, E_Dialog *dia)
|
||||
{
|
||||
e_object_del(E_OBJECT(dia));
|
||||
_e_screensaver_ask_presentation_count = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_no_increase(void *data EINA_UNUSED, E_Dialog *dia)
|
||||
{
|
||||
_e_screensaver_ask_presentation_count++;
|
||||
e_screensaver_update();
|
||||
e_object_del(E_OBJECT(dia));
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_no_forever(void *data EINA_UNUSED, E_Dialog *dia)
|
||||
{
|
||||
e_config->screensaver_ask_presentation = 0;
|
||||
e_config_save_queue();
|
||||
e_object_del(E_OBJECT(dia));
|
||||
_e_screensaver_ask_presentation_count = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event)
|
||||
{
|
||||
Evas_Event_Key_Down *ev = event;
|
||||
E_Dialog *dia = data;
|
||||
|
||||
if (strcmp(ev->key, "Return") == 0)
|
||||
_e_screensaver_ask_presentation_yes(NULL, dia);
|
||||
else if (strcmp(ev->key, "Escape") == 0)
|
||||
_e_screensaver_ask_presentation_no(NULL, dia);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_screensaver_ask_presentation_mode(void)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
|
||||
if (_e_screensaver_ask_presentation_dia) return;
|
||||
|
||||
if (!(dia = e_dialog_new(NULL, "E", "_screensaver_ask_presentation"))) return;
|
||||
|
||||
e_dialog_title_set(dia, _("Activate Presentation Mode?"));
|
||||
e_dialog_icon_set(dia, "dialog-ask", 64);
|
||||
e_dialog_text_set(dia,
|
||||
_("You disabled the screensaver too fast.<ps/><ps/>"
|
||||
"Would you like to enable <b>presentation</b> mode and "
|
||||
"temporarily disable screen saver, lock and power saving?"));
|
||||
|
||||
e_object_del_attach_func_set(E_OBJECT(dia),
|
||||
_e_screensaver_ask_presentation_del);
|
||||
e_dialog_button_add(dia, _("Yes"), NULL,
|
||||
_e_screensaver_ask_presentation_yes, NULL);
|
||||
e_dialog_button_add(dia, _("No"), NULL,
|
||||
_e_screensaver_ask_presentation_no, NULL);
|
||||
e_dialog_button_add(dia, _("No, but increase timeout"), NULL,
|
||||
_e_screensaver_ask_presentation_no_increase, NULL);
|
||||
e_dialog_button_add(dia, _("No, and stop asking"), NULL,
|
||||
_e_screensaver_ask_presentation_no_forever, NULL);
|
||||
|
||||
e_dialog_button_focus_num(dia, 0);
|
||||
e_widget_list_homogeneous_set(dia->box_object, 0);
|
||||
elm_win_center(dia->win, 1, 1);
|
||||
e_dialog_show(dia);
|
||||
|
||||
evas_object_event_callback_add(dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
|
||||
_e_screensaver_ask_presentation_key_down, dia);
|
||||
|
||||
_e_screensaver_ask_presentation_dia = dia;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_screensaver_suspend_cb(void *data EINA_UNUSED)
|
||||
{
|
||||
|
@ -282,8 +183,6 @@ _e_screensaver_handler_powersave_cb(void *data EINA_UNUSED, int type EINA_UNUSED
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static double last_start = 0.0;
|
||||
|
||||
static Eina_Bool
|
||||
_e_screensaver_handler_screensaver_on_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
|
@ -297,8 +196,6 @@ _e_screensaver_handler_screensaver_on_cb(void *data EINA_UNUSED, int type EINA_U
|
|||
_e_screensaver_suspend_timer =
|
||||
ecore_timer_loop_add(e_config->screensaver_suspend_delay,
|
||||
_e_screensaver_suspend_cb, NULL);
|
||||
last_start = ecore_loop_time_get();
|
||||
_e_screensaver_ask_presentation_count = 0;
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
@ -313,17 +210,6 @@ _e_screensaver_handler_screensaver_off_cb(void *data EINA_UNUSED, int type EINA_
|
|||
ecore_timer_del(_e_screensaver_suspend_timer);
|
||||
_e_screensaver_suspend_timer = NULL;
|
||||
}
|
||||
if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
|
||||
{
|
||||
double current = ecore_loop_time_get();
|
||||
|
||||
if ((last_start + e_config->screensaver_ask_presentation_timeout)
|
||||
>= current)
|
||||
_e_screensaver_ask_presentation_mode();
|
||||
last_start = 0.0;
|
||||
}
|
||||
else if (_e_screensaver_ask_presentation_count)
|
||||
_e_screensaver_ask_presentation_count = 0;
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
|
|
@ -385,56 +385,6 @@ _e_mod_conf_cb(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EI
|
|||
e_configure_show(NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_mode_presentation_toggle(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
|
||||
{
|
||||
e_config->mode.presentation = !e_config->mode.presentation;
|
||||
e_menu_item_toggle_set(mi, e_config->mode.presentation);
|
||||
e_config_mode_changed();
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_mode_offline_toggle(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
|
||||
{
|
||||
e_config->mode.offline = !e_config->mode.offline;
|
||||
e_menu_item_toggle_set(mi, e_config->mode.offline);
|
||||
e_config_mode_changed();
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_submenu_modes_fill(void *data EINA_UNUSED, E_Menu *m)
|
||||
{
|
||||
E_Menu_Item *mi;
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_check_set(mi, 1);
|
||||
e_menu_item_toggle_set(mi, e_config->mode.presentation);
|
||||
e_menu_item_label_set(mi, _("Presentation"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-modes-presentation");
|
||||
e_menu_item_callback_set(mi, _e_mod_mode_presentation_toggle, NULL);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_check_set(mi, 1);
|
||||
e_menu_item_toggle_set(mi, e_config->mode.offline);
|
||||
e_menu_item_label_set(mi, _("Offline"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-modes-offline");
|
||||
e_menu_item_callback_set(mi, _e_mod_mode_offline_toggle, NULL);
|
||||
|
||||
e_menu_pre_activate_callback_set(m, NULL, NULL);
|
||||
}
|
||||
|
||||
static E_Menu *
|
||||
_e_mod_submenu_modes_get(void)
|
||||
{
|
||||
E_Menu *m;
|
||||
|
||||
if (!(m = e_menu_new())) return NULL;
|
||||
e_menu_pre_activate_callback_set(m, _e_mod_submenu_modes_fill, NULL);
|
||||
return m;
|
||||
}
|
||||
|
||||
/* menu item add hook */
|
||||
static void
|
||||
_e_mod_menu_add(void *data EINA_UNUSED, E_Menu *m)
|
||||
|
@ -445,12 +395,6 @@ _e_mod_menu_add(void *data EINA_UNUSED, E_Menu *m)
|
|||
e_menu_item_label_set(mi, _("Settings Panel"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-system");
|
||||
e_menu_item_callback_set(mi, _e_mod_conf_cb, NULL);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Modes"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-modes");
|
||||
e_menu_item_submenu_set(mi, _e_mod_submenu_modes_get());
|
||||
e_object_unref(E_OBJECT(mi->submenu));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -45,8 +45,6 @@ struct _E_Config_Dialog_Data
|
|||
E_Desklock_Background_Method bg_method;
|
||||
int bg_method_prev;
|
||||
Eina_List *bgs;
|
||||
int ask_presentation;
|
||||
double ask_presentation_timeout;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -174,10 +172,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->login_zone = e_config->desklock_login_box_zone;
|
||||
cfdata->zone = 0;
|
||||
}
|
||||
|
||||
cfdata->ask_presentation = e_config->desklock_ask_presentation;
|
||||
cfdata->ask_presentation_timeout =
|
||||
e_config->desklock_ask_presentation_timeout;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -354,18 +348,6 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
e_widget_toolbook_page_append(otb, NULL, _("Timers"), ol,
|
||||
1, 1, 1, 0, 0.0, 0.0);
|
||||
|
||||
/* Presentation */
|
||||
ol = e_widget_list_add(evas, 0, 0);
|
||||
oc = e_widget_check_add(evas, _("Suggest if deactivated before"),
|
||||
&(cfdata->ask_presentation));
|
||||
e_widget_list_object_append(ol, oc, 1, 1, 0.5);
|
||||
ow = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1.0, 300.0, 10.0, 0,
|
||||
&(cfdata->ask_presentation_timeout), NULL, 100);
|
||||
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Presentation Mode"), ol,
|
||||
1, 1, 1, 0, 0.0, 0.0);
|
||||
|
||||
/* Wallpapers */
|
||||
ol = e_widget_list_add(evas, 0, 0);
|
||||
of = e_widget_table_add(e_win_evas_win_get(evas), 1);
|
||||
|
@ -449,8 +431,6 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
|||
e_config->desklock_on_suspend = cfdata->lock_on_suspend;
|
||||
e_config->desklock_post_screensaver_time = cfdata->post_screensaver_time;
|
||||
e_config->desklock_autolock_screensaver = cfdata->screensaver_lock;
|
||||
e_config->desklock_ask_presentation = cfdata->ask_presentation;
|
||||
e_config->desklock_ask_presentation_timeout = cfdata->ask_presentation_timeout;
|
||||
if (e_config->xkb.desklock_layout != cfdata->desklock_layout)
|
||||
{
|
||||
e_config->xkb.desklock_layout = eina_stringshare_ref(cfdata->desklock_layout);
|
||||
|
@ -568,9 +548,7 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
|
|||
}
|
||||
else if (e_config->desklock_custom_desklock_cmd != cfdata->custom_lock_cmd)
|
||||
return 1;
|
||||
|
||||
return (e_config->desklock_ask_presentation != cfdata->ask_presentation) ||
|
||||
(!EINA_DBL_EQ(e_config->desklock_ask_presentation_timeout, cfdata->ask_presentation_timeout));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -10,9 +10,6 @@ Config *notification_cfg = NULL;
|
|||
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
|
||||
static unsigned int offline_id;
|
||||
static unsigned int pres_id;
|
||||
|
||||
static unsigned int
|
||||
_notification_notify(E_Notification_Notify *n)
|
||||
{
|
||||
|
@ -27,108 +24,6 @@ _notification_notify(E_Notification_Notify *n)
|
|||
return new_id;
|
||||
}
|
||||
|
||||
static void
|
||||
_notification_id_update(void *d, unsigned int id)
|
||||
{
|
||||
uintptr_t *update_id = d;
|
||||
|
||||
*update_id = id;
|
||||
}
|
||||
|
||||
static void
|
||||
_notification_show_common(const char *summary,
|
||||
const char *body,
|
||||
unsigned int *update_id)
|
||||
{
|
||||
E_Notification_Notify n;
|
||||
memset(&n, 0, sizeof(E_Notification_Notify));
|
||||
n.app_name = "enlightenment";
|
||||
n.replaces_id = *update_id;
|
||||
n.icon.icon = "enlightenment";
|
||||
n.summary = summary;
|
||||
n.body = body;
|
||||
n.urgency = E_NOTIFICATION_NOTIFY_URGENCY_CRITICAL;
|
||||
e_notification_client_send(&n, _notification_id_update, update_id);
|
||||
}
|
||||
|
||||
static void
|
||||
_notification_show_presentation(Eina_Bool enabled)
|
||||
{
|
||||
const char *summary, *body;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
summary = _("Entered Presentation Mode");
|
||||
body = _("Enlightenment has now entered <b>presentation</b> mode."
|
||||
"<ps/>During presentation mode, screen saver, lock and "
|
||||
"power saving will be disabled so you are not interrupted.");
|
||||
}
|
||||
else
|
||||
{
|
||||
summary = _("Exited Presentation Mode");
|
||||
body = _("Presentation mode has been exited."
|
||||
"<ps/>Now screen saver, lock and "
|
||||
"power saving settings will be restored.");
|
||||
}
|
||||
|
||||
_notification_show_common(summary, body, &pres_id);
|
||||
}
|
||||
|
||||
static void
|
||||
_notification_show_offline(Eina_Bool enabled)
|
||||
{
|
||||
const char *summary, *body;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
summary = _("Enter Offline Mode");
|
||||
body = _("Enlightenment is in <b>offline</b> mode.<ps/>"
|
||||
"During offline mode, modules that use network will stop "
|
||||
"polling remote services.");
|
||||
}
|
||||
else
|
||||
{
|
||||
summary = _("Exited Offline Mode");
|
||||
body = _("Now in <b>online</b> mode.<ps/>"
|
||||
"Now modules that use network will "
|
||||
"resume regular tasks.");
|
||||
}
|
||||
|
||||
_notification_show_common(summary, body, &offline_id);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_notification_cb_config_mode_changed(Config *m_cfg,
|
||||
int type EINA_UNUSED,
|
||||
void *event EINA_UNUSED)
|
||||
{
|
||||
if (m_cfg->last_config_mode.presentation != e_config->mode.presentation)
|
||||
{
|
||||
m_cfg->last_config_mode.presentation = e_config->mode.presentation;
|
||||
_notification_show_presentation(e_config->mode.presentation);
|
||||
}
|
||||
|
||||
if (m_cfg->last_config_mode.offline != e_config->mode.offline)
|
||||
{
|
||||
m_cfg->last_config_mode.offline = e_config->mode.offline;
|
||||
_notification_show_offline(e_config->mode.offline);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_notification_cb_initial_mode_timer(Config *m_cfg)
|
||||
{
|
||||
if (e_config->mode.presentation)
|
||||
_notification_show_presentation(1);
|
||||
if (e_config->mode.offline)
|
||||
_notification_show_offline(1);
|
||||
|
||||
m_cfg->initial_mode_timer = NULL;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* Module Api Functions */
|
||||
E_API E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Notification"};
|
||||
|
||||
|
@ -210,14 +105,6 @@ e_modapi_init(E_Module *m)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
notification_cfg->last_config_mode.presentation = e_config->mode.presentation;
|
||||
notification_cfg->last_config_mode.offline = e_config->mode.offline;
|
||||
notification_cfg->handler = ecore_event_handler_add
|
||||
(E_EVENT_CONFIG_MODE_CHANGED, (Ecore_Event_Handler_Cb)_notification_cb_config_mode_changed,
|
||||
notification_cfg);
|
||||
notification_cfg->initial_mode_timer = ecore_timer_loop_add
|
||||
(0.1, (Ecore_Task_Cb)_notification_cb_initial_mode_timer, notification_cfg);
|
||||
|
||||
notification_mod = m;
|
||||
|
||||
return m;
|
||||
|
@ -226,12 +113,6 @@ e_modapi_init(E_Module *m)
|
|||
E_API int
|
||||
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||
{
|
||||
if (notification_cfg->initial_mode_timer)
|
||||
ecore_timer_del(notification_cfg->initial_mode_timer);
|
||||
|
||||
if (notification_cfg->handler)
|
||||
ecore_event_handler_del(notification_cfg->handler);
|
||||
|
||||
if (notification_cfg->cfd) e_object_del(E_OBJECT(notification_cfg->cfd));
|
||||
e_configure_registry_item_del("extensions/notification");
|
||||
e_configure_registry_category_del("extensions");
|
||||
|
@ -239,11 +120,9 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
|||
notification_popup_shutdown();
|
||||
e_notification_server_unregister();
|
||||
|
||||
|
||||
_notification_cfg_free(notification_cfg);
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
notification_mod = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,17 +43,8 @@ struct _Config
|
|||
float timeout;
|
||||
Popup_Corner corner;
|
||||
|
||||
struct
|
||||
{
|
||||
Eina_Bool presentation;
|
||||
Eina_Bool offline;
|
||||
} last_config_mode;
|
||||
|
||||
Ecore_Event_Handler *handler;
|
||||
Eina_List *popups;
|
||||
unsigned int next_id;
|
||||
|
||||
Ecore_Timer *initial_mode_timer;
|
||||
};
|
||||
|
||||
struct _Popup_Data
|
||||
|
|
|
@ -110,11 +110,9 @@ notification_popup_notify(E_Notification_Notify *n,
|
|||
{
|
||||
case E_NOTIFICATION_NOTIFY_URGENCY_LOW:
|
||||
if (!notification_cfg->show_low) return;
|
||||
if (e_config->mode.presentation) return;
|
||||
break;
|
||||
case E_NOTIFICATION_NOTIFY_URGENCY_NORMAL:
|
||||
if (!notification_cfg->show_normal) return;
|
||||
if (e_config->mode.presentation) return;
|
||||
break;
|
||||
case E_NOTIFICATION_NOTIFY_URGENCY_CRITICAL:
|
||||
if (!notification_cfg->show_critical) return;
|
||||
|
|
Loading…
Reference in New Issue