forked from enlightenment/enlightenment
PAM support for Desklock is added. Now system-wide authentication is available and one
can use its user password instead of setting just desklock password. However, the possibility to set a personilized password is still available. If somebody think that it is not neccesarily to have it now, please write :) Moreover, the desklock dialog is updated. Now, the advanced tab includes all the settings that are on the basic tab. SVN revision: 21631
This commit is contained in:
parent
fc925ae5d8
commit
df2ea4c01e
|
@ -37,6 +37,12 @@ fi
|
|||
|
||||
AC_SUBST(fnmatch_libs)
|
||||
|
||||
have_pam=no
|
||||
AC_CHECK_HEADERS(security/pam_appl.h, [
|
||||
LIBS="$LIBS -lpam"
|
||||
have_pam=yes
|
||||
AC_DEFINE(HAVE_PAM, 1, [PAM Authentication Support])])
|
||||
|
||||
# Setting have_valgrind to "no" seems pointless, but we just need to
|
||||
# put something in as the 4th parameter, so configure doesn't abort
|
||||
# when valgrind.pc isn't found.
|
||||
|
|
|
@ -460,6 +460,9 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, font_hinting, INT);
|
||||
E_CONFIG_VAL(D, T, desklock_personal_passwd, STR);
|
||||
E_CONFIG_VAL(D, T, desklock_background, STR);
|
||||
#ifdef HAVE_PAM
|
||||
E_CONFIG_VAL(D, T, desklock_auth_method, INT);
|
||||
#endif
|
||||
E_CONFIG_VAL(D, T, desklock_login_box_zone, INT);
|
||||
E_CONFIG_VAL(D, T, desklock_autolock, INT);
|
||||
E_CONFIG_VAL(D, T, desklock_use_timeout, INT);
|
||||
|
@ -631,6 +634,9 @@ e_config_init(void)
|
|||
|
||||
e_config->desklock_personal_passwd = NULL;
|
||||
e_config->desklock_background = NULL;
|
||||
#ifdef HAVE_PAM
|
||||
e_config->desklock_auth_method = 0;
|
||||
#endif
|
||||
e_config->desklock_login_box_zone = -1;
|
||||
e_config->desklock_autolock = 0;
|
||||
e_config->desklock_use_timeout = 0;
|
||||
|
|
|
@ -48,10 +48,10 @@ typedef Eet_Data_Descriptor E_Config_DD;
|
|||
* defaults for e to work.
|
||||
*/
|
||||
#define E_CONFIG_FILE_EPOCH 0x0000
|
||||
/* incriment this whenever a new set of configvalues are added but the users
|
||||
/* increment this whenever a new set of configvalues are added but the users
|
||||
* config doesn't need top be wiped - simply new values need to be put in
|
||||
*/
|
||||
#define E_CONFIG_FILE_GENERATION 0x008d
|
||||
#define E_CONFIG_FILE_GENERATION 0x008e
|
||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
|
@ -217,6 +217,9 @@ struct _E_Config
|
|||
|
||||
char *desklock_personal_passwd; // GUI
|
||||
char *desklock_background; // GUI
|
||||
#ifdef HAVE_PAM
|
||||
int desklock_auth_method; // GUI
|
||||
#endif
|
||||
int desklock_login_box_zone; // GUI
|
||||
int desklock_autolock; // GUI
|
||||
int desklock_use_timeout; // GUI
|
||||
|
|
|
@ -1,8 +1,37 @@
|
|||
#include "e.h"
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <pwd.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define ELOCK_POPUP_LAYER 10000
|
||||
#define PASSWD_LEN 256
|
||||
|
||||
/**************************** Pam support *******************************/
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
struct _Desklock_Auth
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct pam_conv conv;
|
||||
pam_handle_t *handle;
|
||||
} pam;
|
||||
|
||||
char user[PATH_MAX];
|
||||
char passwd[PATH_MAX];
|
||||
};
|
||||
|
||||
static int _desklock_auth(const char *passwd);
|
||||
static int _desklock_pam_init(struct _Desklock_Auth *da);
|
||||
static int _desklock_auth_pam_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response **resp, void *appdata_ptr);
|
||||
static char *_desklock_auth_get_current_user();
|
||||
static char *_desklock_auth_get_current_host();
|
||||
#endif
|
||||
|
||||
/**************************** private data ******************************/
|
||||
typedef struct _E_Desklock_Data E_Desklock_Data;
|
||||
typedef struct _E_Desklock_Popup_Data E_Desklock_Popup_Data;
|
||||
|
@ -40,6 +69,8 @@ static void _e_desklock_backspace();
|
|||
static void _e_desklock_delete();
|
||||
static int _e_desklock_zone_num_get();
|
||||
|
||||
static int _e_desklock_check_auth();
|
||||
|
||||
EAPI int
|
||||
e_desklock_show(void)
|
||||
{
|
||||
|
@ -52,19 +83,26 @@ e_desklock_show(void)
|
|||
|
||||
if (edd) return 0;
|
||||
|
||||
if (!e_config->desklock_personal_passwd)
|
||||
#ifdef HAVE_PAM
|
||||
if (e_config->desklock_auth_method == 1 )
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
if (zone)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
cfd = e_int_config_desklock(zone->container);
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
if (!e_config->desklock_personal_passwd)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
if (zone)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
cfd = e_int_config_desklock(zone->container);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#ifdef HAVE_PAM
|
||||
}
|
||||
#endif
|
||||
|
||||
edd = E_NEW(E_Desklock_Data, 1);
|
||||
if (!edd) return 0;
|
||||
|
@ -305,13 +343,11 @@ _e_desklock_cb_key_down(void *data, int type, void *event)
|
|||
else if (!strcmp(ev->keysymbol, "KP_Enter"))
|
||||
{
|
||||
// here we have to go to auth
|
||||
if ((e_config->desklock_personal_passwd) &&
|
||||
(!strcmp(edd->passwd == NULL ? "" : edd->passwd,
|
||||
e_config->desklock_personal_passwd == NULL ? "" :
|
||||
e_config->desklock_personal_passwd)))
|
||||
if (_e_desklock_check_auth())
|
||||
{
|
||||
e_desklock_hide();
|
||||
return 1;
|
||||
memset(edd->passwd, 0, sizeof(char) * PASSWD_LEN);
|
||||
e_desklock_hide();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
; // report about invalid password
|
||||
|
@ -322,13 +358,11 @@ _e_desklock_cb_key_down(void *data, int type, void *event)
|
|||
else if (!strcmp(ev->keysymbol, "Return"))
|
||||
{
|
||||
// here we have to go to auth
|
||||
if ((e_config->desklock_personal_passwd) &&
|
||||
(!strcmp(edd->passwd == NULL ? "" : edd->passwd,
|
||||
e_config->desklock_personal_passwd == NULL ? "" :
|
||||
e_config->desklock_personal_passwd)))
|
||||
if (_e_desklock_check_auth())
|
||||
{
|
||||
e_desklock_hide();
|
||||
return 1;
|
||||
memset(edd->passwd, 0, sizeof(char) * PASSWD_LEN);
|
||||
e_desklock_hide();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
; // report about invalid password
|
||||
|
@ -493,3 +527,129 @@ _e_desklock_zone_num_get()
|
|||
return num;
|
||||
}
|
||||
|
||||
static int _e_desklock_check_auth()
|
||||
{
|
||||
if (!edd) return 0;
|
||||
#ifdef HAVE_PAM
|
||||
if (e_config->desklock_auth_method == 0)
|
||||
{
|
||||
return _desklock_auth(edd->passwd);
|
||||
}
|
||||
else if (e_config->desklock_auth_method == 1)
|
||||
{
|
||||
#endif // HAVE_PAM
|
||||
if ((e_config->desklock_personal_passwd) &&
|
||||
(!strcmp(edd->passwd == NULL ? "" : edd->passwd,
|
||||
e_config->desklock_personal_passwd == NULL ? "" :
|
||||
e_config->desklock_personal_passwd)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#ifdef HAVE_PAM
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
static int _desklock_auth(const char *passwd)
|
||||
{
|
||||
int pamerr;
|
||||
struct _Desklock_Auth da;
|
||||
|
||||
strncpy(da.user, _desklock_auth_get_current_user(), PATH_MAX);
|
||||
strncpy(da.passwd, passwd, PATH_MAX);
|
||||
da.pam.handle = NULL;
|
||||
da.pam.conv.conv = NULL;
|
||||
da.pam.conv.appdata_ptr = NULL;
|
||||
|
||||
if (!_desklock_pam_init(&da))
|
||||
return 0;
|
||||
|
||||
pamerr = pam_authenticate(da.pam.handle, 0);
|
||||
|
||||
pam_end(da.pam.handle, pamerr);
|
||||
memset(da.passwd, 0 , sizeof(da.passwd));
|
||||
|
||||
return pamerr == PAM_SUCCESS ? 1 : 0;
|
||||
}
|
||||
|
||||
static char *_desklock_auth_get_current_user()
|
||||
{
|
||||
char *user;
|
||||
struct passwd *pwent = NULL;
|
||||
|
||||
pwent = getpwuid(getuid());
|
||||
user = strdup(pwent->pw_name);
|
||||
return user;
|
||||
}
|
||||
|
||||
static int _desklock_pam_init(struct _Desklock_Auth *da)
|
||||
{
|
||||
int pamerr;
|
||||
|
||||
if (!da) return 0;
|
||||
|
||||
da->pam.conv.conv = _desklock_auth_pam_conv;
|
||||
da->pam.conv.appdata_ptr = da;
|
||||
da->pam.handle = NULL;
|
||||
|
||||
if ((pamerr = pam_start("system-auth", da->user, &(da->pam.conv),
|
||||
&(da->pam.handle))) != PAM_SUCCESS)
|
||||
return 0;
|
||||
|
||||
if ((pamerr = pam_set_item(da->pam.handle, PAM_USER,
|
||||
_desklock_auth_get_current_user())) != PAM_SUCCESS)
|
||||
return 0;
|
||||
|
||||
if ((pamerr = pam_set_item(da->pam.handle, PAM_RHOST,
|
||||
_desklock_auth_get_current_host())) != PAM_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _desklock_auth_pam_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response **resp, void *appdata_ptr)
|
||||
{
|
||||
int replies = 0;
|
||||
struct _Desklock_Auth *da = (struct _Desklock_Auth *)appdata_ptr;
|
||||
struct pam_response *reply = NULL;
|
||||
|
||||
reply = (struct pam_response *)malloc(sizeof(struct pam_response) *num_msg);
|
||||
|
||||
if (!reply)
|
||||
return PAM_CONV_ERR;
|
||||
|
||||
for (replies = 0; replies < num_msg; replies++)
|
||||
{
|
||||
switch (msg[replies]->msg_style)
|
||||
{
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
reply[replies].resp_retcode = PAM_SUCCESS;
|
||||
reply[replies].resp = (char *)strdup(da->user);
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
reply[replies].resp_retcode = PAM_SUCCESS;
|
||||
reply[replies].resp = (char *)strdup(da->passwd);
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
case PAM_TEXT_INFO:
|
||||
reply[replies].resp_retcode = PAM_SUCCESS;
|
||||
reply[replies].resp = NULL;
|
||||
break;
|
||||
default:
|
||||
free(reply);
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
}
|
||||
*resp = reply;
|
||||
return PAM_SUCCESS;
|
||||
}
|
||||
|
||||
static char *_desklock_auth_get_current_host()
|
||||
{
|
||||
return strdup("localhost");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,13 @@ static void _e_desklock_cb_lb_show_on_current_screen(void *data, Evas_Object *ob
|
|||
static void _e_desklock_cb_lb_show_on_specific_screen(void *data, Evas_Object *obj,
|
||||
const char *emission, const char *source);
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
static void _e_desklock_cb_syswide_auth_method(void *data, Evas_Object *obj,
|
||||
const char *emission, const char *source);
|
||||
static void _e_desklock_cb_personilized_auth_method(void *data, Evas_Object *obj,
|
||||
const char *emission, const char *source);
|
||||
#endif
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
|
@ -63,10 +70,16 @@ struct _E_Config_Dialog_Data
|
|||
char *cur_bg; // local variable;
|
||||
Evas *evas; // local variable
|
||||
Evas_Object *preview_image; // local variable
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
int auth_method;
|
||||
#endif
|
||||
|
||||
struct {
|
||||
Evas_Object *passwd_field;
|
||||
Evas_Object *passwd_field;
|
||||
Evas_Object *bg_list;
|
||||
|
||||
Evas_Object *show_passwd_check;
|
||||
|
||||
struct {
|
||||
Evas_Object *show_all_screens;
|
||||
|
@ -174,6 +187,10 @@ _fill_desklock_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->cur_bg = strdup(DEF_DESKLOCK_BACKGROUND);
|
||||
else
|
||||
cfdata->cur_bg = strdup(e_config->desklock_background);
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
cfdata->auth_method = e_config->desklock_auth_method;
|
||||
#endif
|
||||
|
||||
//vertical_lb_align = e_config->desklock_login
|
||||
}
|
||||
|
@ -215,6 +232,9 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
e_config->desklock_autolock = cfdata->autolock;
|
||||
e_config->desklock_use_timeout = cfdata->use_timeout;
|
||||
e_config->desklock_timeout = cfdata->timeout;
|
||||
#ifdef HAVE_PAM
|
||||
e_config->desklock_auth_method = cfdata->auth_method;
|
||||
#endif
|
||||
if (e_config->desklock_use_timeout)
|
||||
{
|
||||
ecore_x_screensaver_timeout_set(e_config->desklock_timeout);
|
||||
|
@ -228,20 +248,56 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
E_Widget_Check_Data *wd;
|
||||
E_Widget_Radio_Data *rwd;
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
E_Radio_Group *rg_auth;
|
||||
Evas_Object *oc;
|
||||
#endif
|
||||
|
||||
//_fill_desklock_data(cfdata);
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
of = e_widget_framelist_add(evas, _("Authentication Method"), 0);
|
||||
{
|
||||
rg_auth = e_widget_radio_group_new((int*)(&cfdata->auth_method));
|
||||
oc = e_widget_radio_add(evas, _("System wide authentication"), 0, rg_auth);
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
|
||||
rwd = e_widget_data_get(oc);
|
||||
edje_object_signal_callback_add(rwd->o_radio, "toggle_on", "",
|
||||
_e_desklock_cb_syswide_auth_method, cfdata);
|
||||
|
||||
oc = e_widget_radio_add(evas, _("Personilized password"), 1, rg_auth);
|
||||
e_widget_framelist_object_append(of,oc);
|
||||
|
||||
rwd = e_widget_data_get(oc);
|
||||
edje_object_signal_callback_add(rwd->o_radio, "toggle_on", "",
|
||||
_e_desklock_cb_personilized_auth_method, cfdata);
|
||||
}
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
#endif
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Personalized Password:"), 0);
|
||||
|
||||
cfdata->gui.passwd_field = ob = e_widget_entry_add(evas, &(cfdata->desklock_passwd));
|
||||
#ifdef HAVE_PAM
|
||||
if (cfdata->auth_method == 0)
|
||||
e_widget_disabled_set(ob, 1);
|
||||
#endif
|
||||
_e_desklock_passwd_cb_change(cfdata, ob);
|
||||
e_widget_entry_on_change_callback_set(ob, _e_desklock_passwd_cb_change, cfdata);
|
||||
e_widget_min_size_set(ob, 200, 25);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Show Password"), &(cfdata->show_password));
|
||||
cfdata->gui.show_passwd_check = ob;
|
||||
#ifdef HAVE_PAM
|
||||
if (cfdata->auth_method == 0)
|
||||
e_widget_disabled_set(ob, 1);
|
||||
#endif
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
wd = (E_Widget_Check_Data*)e_widget_data_get(ob);
|
||||
|
@ -283,6 +339,13 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
{
|
||||
if (!cfdata) return 0;
|
||||
|
||||
if (cfdata->desklock_passwd_cp)
|
||||
{
|
||||
if (e_config->desklock_personal_passwd)
|
||||
evas_stringshare_del(e_config->desklock_personal_passwd);
|
||||
}
|
||||
e_config->desklock_personal_passwd = (char *)evas_stringshare_add(cfdata->desklock_passwd_cp);
|
||||
|
||||
if (cfdata->cur_bg)
|
||||
{
|
||||
if (e_config->desklock_background)
|
||||
|
@ -303,6 +366,14 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
e_config->desklock_autolock = cfdata->autolock;
|
||||
e_config->desklock_use_timeout = cfdata->use_timeout;
|
||||
e_config->desklock_timeout = cfdata->timeout;
|
||||
#ifdef HAVE_PAM
|
||||
e_config->desklock_auth_method = cfdata->auth_method;
|
||||
#endif
|
||||
|
||||
if (e_config->desklock_use_timeout)
|
||||
{
|
||||
ecore_x_screensaver_timeout_set(e_config->desklock_timeout);
|
||||
}
|
||||
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
|
@ -314,12 +385,15 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
|
|||
Evas_Object *o, *of, *of1, *ob;
|
||||
E_Widget_Radio_Data *wd;
|
||||
|
||||
/* FIXME: this dialog is broken. advanced options should ALSO INCLUDE basic options */
|
||||
E_Radio_Group *rg, *rg_bkg;
|
||||
Evas_Object *ot;
|
||||
Evas_Object *ot, *ol;
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
E_Radio_Group *rg_auth;
|
||||
Evas_Object *oc;
|
||||
E_Widget_Check_Data *cwd;
|
||||
#endif
|
||||
|
||||
//_fill_desklock_data(cfdata);
|
||||
|
||||
cfdata->evas = evas;
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
|
@ -327,7 +401,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
|
|||
Evas_Object *ot1;
|
||||
/* start: bkg list */
|
||||
cfdata->gui.bg_list = e_widget_ilist_add(evas, BG_LIST_ICON_SIZE_W,
|
||||
BG_LIST_ICON_SIZE_H, &(cfdata->cur_bg));
|
||||
BG_LIST_ICON_SIZE_H, &(cfdata->cur_bg));
|
||||
{
|
||||
e_widget_ilist_selector_set(cfdata->gui.bg_list, 1);
|
||||
e_widget_min_size_set(cfdata->gui.bg_list, 180, 200);
|
||||
|
@ -355,41 +429,120 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
|
|||
|
||||
if (1 || _e_desklock_zone_num_get() > 1)
|
||||
{
|
||||
of = e_widget_framelist_add(evas, _("Login Box Settings"), 0);
|
||||
{
|
||||
rg = e_widget_radio_group_new((int *)(&(cfdata->login_box_zone)));
|
||||
of = e_widget_framelist_add(evas, _("Login Box Settings"), 0);
|
||||
{
|
||||
rg = e_widget_radio_group_new((int *)(&(cfdata->login_box_zone)));
|
||||
|
||||
ob = e_widget_radio_add(evas, _("Show On All Screen Zones"), LOGINBOX_SHOW_ALL_SCREENS,
|
||||
rg);
|
||||
cfdata->gui.loginbox_obj.show_all_screens = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Show On All Screen Zones"), LOGINBOX_SHOW_ALL_SCREENS,
|
||||
rg);
|
||||
cfdata->gui.loginbox_obj.show_all_screens = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_radio_add(evas, _("Show On Current Screen Zone"),
|
||||
LOGINBOX_SHOW_CURRENT_SCREENS, rg);
|
||||
cfdata->gui.loginbox_obj.show_current_screen = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Show On Current Screen Zone"),
|
||||
LOGINBOX_SHOW_CURRENT_SCREENS, rg);
|
||||
cfdata->gui.loginbox_obj.show_current_screen = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_radio_add(evas, _("Show On Screen Zone :"), LOGINBOX_SHOW_SPECIFIC_SCREEN,
|
||||
rg);
|
||||
cfdata->gui.loginbox_obj.show_specific_screen = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Show On Screen Zone :"), LOGINBOX_SHOW_SPECIFIC_SCREEN,
|
||||
rg);
|
||||
cfdata->gui.loginbox_obj.show_specific_screen = ob;
|
||||
if (cfdata->zone_count == 1) e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 0.0, (double)(cfdata->zone_count - 1),
|
||||
1.0, 0, NULL, &(cfdata->specific_lb_zone), 100);
|
||||
cfdata->gui.loginbox_obj.screen_slider = ob;
|
||||
if (cfdata->zone_count == 1 ||
|
||||
cfdata->login_box_zone == LOGINBOX_SHOW_ALL_SCREENS)
|
||||
{
|
||||
e_widget_disabled_set(ob, 1);
|
||||
}
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
}
|
||||
e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 0.0, (double)(cfdata->zone_count - 1),
|
||||
1.0, 0, NULL, &(cfdata->specific_lb_zone), 100);
|
||||
cfdata->gui.loginbox_obj.screen_slider = ob;
|
||||
if (cfdata->zone_count == 1 || cfdata->login_box_zone == LOGINBOX_SHOW_ALL_SCREENS)
|
||||
e_widget_disabled_set(ob, 1);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
}
|
||||
e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
}
|
||||
/* end: login box options */
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
of = e_widget_framelist_add(evas, _("Authentication Method"), 0);
|
||||
{
|
||||
rg_auth = e_widget_radio_group_new((int*)(&cfdata->auth_method));
|
||||
oc = e_widget_radio_add(evas, _("System wide authentication"), 0, rg_auth);
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
|
||||
wd = e_widget_data_get(oc);
|
||||
edje_object_signal_callback_add(wd->o_radio, "toggle_on", "",
|
||||
_e_desklock_cb_syswide_auth_method, cfdata);
|
||||
|
||||
oc = e_widget_radio_add(evas, _("Personilized password"), 1, rg_auth);
|
||||
e_widget_framelist_object_append(of,oc);
|
||||
|
||||
wd = e_widget_data_get(oc);
|
||||
edje_object_signal_callback_add(wd->o_radio, "toggle_on", "",
|
||||
_e_desklock_cb_personilized_auth_method, cfdata);
|
||||
}
|
||||
e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||
#endif
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Personalized Password:"), 0);
|
||||
{
|
||||
cfdata->gui.passwd_field = ob = e_widget_entry_add(evas, &(cfdata->desklock_passwd));
|
||||
#ifdef HAVE_PAM
|
||||
if (cfdata->auth_method == 0)
|
||||
e_widget_disabled_set(ob, 1);
|
||||
#endif
|
||||
|
||||
_e_desklock_passwd_cb_change(cfdata, ob);
|
||||
e_widget_entry_on_change_callback_set(ob, _e_desklock_passwd_cb_change, cfdata);
|
||||
e_widget_min_size_set(ob, 200, 25);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Show Password"), &(cfdata->show_password));
|
||||
cfdata->gui.show_passwd_check = ob;
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
if (cfdata->auth_method == 0)
|
||||
e_widget_disabled_set(ob, 1);
|
||||
#endif
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
cwd = (E_Widget_Check_Data*)e_widget_data_get(ob);
|
||||
edje_object_signal_callback_add(cwd->o_check,"toggle_on", "",
|
||||
_e_desklock_cb_show_passwd, cfdata);
|
||||
edje_object_signal_callback_add(cwd->o_check,"toggle_off", "",
|
||||
_e_desklock_cb_show_passwd, cfdata);
|
||||
}
|
||||
#ifdef HAVE_PAM
|
||||
e_widget_table_object_append(ot, of, 0, 3, 1, 1, 1, 1, 1, 1);
|
||||
#else
|
||||
e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||
#endif
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Automatic Locking"), 0);
|
||||
{
|
||||
e_widget_disabled_set(of, !ecore_x_screensaver_event_available_get());
|
||||
|
||||
ob = e_widget_check_add(evas, _("Lock when the Screensaver starts"), &(cfdata->autolock));
|
||||
e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Set the screensaver timeout"), &(cfdata->use_timeout));
|
||||
e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Time until screensaver starts"));
|
||||
e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
|
||||
1.0, 600.0,
|
||||
1.0, 0, &(cfdata->timeout), NULL,
|
||||
200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
}
|
||||
#ifdef HAVE_PAM
|
||||
e_widget_table_object_append(ot, of, 1, 2, 1, 2 ,1 ,1 ,1 ,1);
|
||||
#else
|
||||
e_widget_table_object_append(ot, of, 1, 2, 1, 1 ,1 ,1 ,1 ,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* register callbacks for the radios in login box options
|
||||
|
@ -723,6 +876,33 @@ _e_desklock_cb_lb_show_on_specific_screen(void *data, Evas_Object *obj, const ch
|
|||
e_slider_value_set(wd->o_slider, cfdata->specific_lb_zone_backup);
|
||||
cfdata->specific_lb_zone = cfdata->specific_lb_zone_backup;
|
||||
|
||||
//e_widget_disabled_set(wd->o_widget, 1);
|
||||
e_widget_disabled_set(wd->o_widget, 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
static void
|
||||
_e_desklock_cb_syswide_auth_method(void *data, Evas_Object *obj, const char *emission,
|
||||
const char *source)
|
||||
{
|
||||
E_Widget_Entry_Data *ewd;
|
||||
E_Widget_Check_Data *cwd;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
if (!(cfdata = data)) return;
|
||||
|
||||
e_widget_disabled_set(cfdata->gui.passwd_field, 1);
|
||||
e_widget_disabled_set(cfdata->gui.show_passwd_check, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_desklock_cb_personilized_auth_method(void *data, Evas_Object *obj, const char *emission,
|
||||
const char *source)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
if (!(cfdata = data)) return;
|
||||
|
||||
e_widget_disabled_set(cfdata->gui.passwd_field, 0);
|
||||
e_widget_disabled_set(cfdata->gui.show_passwd_check, 0);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue