desklock silliness with login box geometry fixed.

make about ands theme about use object dialog windows. save code and
centralise.
make object windows be able to accept shaped and borderless hints.



SVN revision: 36836
This commit is contained in:
Carsten Haitzler 2008-10-20 06:50:57 +00:00
parent 406fefafe4
commit 534bac9233
7 changed files with 62 additions and 289 deletions

View File

@ -4,12 +4,6 @@
#include "e.h"
/* local subsystem functions */
static void _e_about_free(E_About *about);
static void _e_about_cb_delete(E_Win *win);
static void _e_about_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_about_cb_resize(E_Win *win);
static E_About *_e_about = NULL;
/* local subsystem globals */
@ -18,65 +12,16 @@ static E_About *_e_about = NULL;
EAPI E_About *
e_about_new(E_Container *con)
{
E_Manager *man;
Evas_Object *o;
E_About *about;
if (_e_about)
{
E_Zone *z, *z2;
about = _e_about;
z = e_util_zone_current_get(e_manager_current_get());
z2 = about->win->border->zone;
e_win_show(about->win);
e_win_raise(about->win);
if (z->container == z2->container)
e_border_desk_set(about->win->border, e_desk_current_get(z));
else
{
if (!about->win->border->sticky)
e_desk_show(about->win->border->desk);
ecore_x_pointer_warp(z2->container->win,
z2->x + (z2->w / 2), z2->y + (z2->h / 2));
}
e_border_unshade(about->win->border, E_DIRECTION_DOWN);
return NULL;
}
if (!con)
{
man = e_manager_current_get();
if (!man) return NULL;
con = e_container_current_get(man);
if (!con) con = e_container_number_get(man, 0);
if (!con) return NULL;
}
about = E_OBJECT_ALLOC(E_About, E_ABOUT_TYPE, _e_about_free);
if (!about) return NULL;
about->win = e_win_new(con);
if (!about->win)
{
free(about);
return NULL;
}
e_win_delete_callback_set(about->win, _e_about_cb_delete);
e_win_resize_callback_set(about->win, _e_about_cb_resize);
about->win->data = about;
e_win_dialog_set(about->win, 1);
e_win_name_class_set(about->win, "E", "_about");
e_win_title_set(about->win, _("About Enlightenment"));
o = edje_object_add(e_win_evas_get(about->win));
about->bg_object = o;
e_theme_edje_object_set(o, "base/theme/about", "e/widgets/about/main");
evas_object_move(o, 0, 0);
evas_object_show(o);
edje_object_part_text_set(about->bg_object, "e.text.title", _("Enlightenment"));
edje_object_part_text_set(about->bg_object, "e.text.version", VERSION);
edje_object_part_text_set
(about->bg_object, "e.textblock.about",
E_Obj_Dialog *od;
od = e_obj_dialog_new(con, _("About Enlightenment"), "E", "_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme/about", "e/widgets/about/main");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
e_obj_dialog_obj_part_text_set(od, "e.text.title", _("Enlightenment"));
e_obj_dialog_obj_part_text_set(od, "e.text.version", VERSION);
e_obj_dialog_obj_part_text_set
(od, "e.textblock.about",
_(
"Copyright &copy; 1999-2008, by the Enlightenment Development Team.<br>"
"<br>"
@ -93,8 +38,7 @@ e_about_new(E_Container *con)
"yet and may have many bugs. You have been <hilight>WARNED!</hilight>"
)
);
edje_object_signal_callback_add(about->bg_object, "e,action,close", "",
_e_about_cb_close, about);
{
FILE *f;
char buf[4096], buf2[4096], *tbuf;
@ -141,73 +85,18 @@ e_about_new(E_Container *con)
fclose(f);
if (tbuf)
{
edje_object_part_text_set(about->bg_object,
"e.textblock.authors", tbuf);
e_obj_dialog_obj_part_text_set
(od, "e.textblock.authors", tbuf);
free(tbuf);
}
}
}
e_win_centered_set(about->win, 1);
_e_about = about;
return about;
return (E_About *)od;
}
EAPI void
e_about_show(E_About *about)
{
Evas_Coord w, h, mw, mh;
edje_object_size_min_get(about->bg_object, &w, &h);
edje_object_size_min_restricted_calc(about->bg_object, &mw, &mh, w, h);
if (w > mw) mw = w;
if (h > mh) mh = h;
evas_object_resize(about->bg_object, mw, mh);
e_win_resize(about->win, mw, mh);
e_win_size_min_set(about->win, mw, mh);
edje_object_size_max_get(about->bg_object, &w, &h);
if ((w > 0) && (h > 0))
{
if (w < mw) w = mw;
if (h < mh) h = mh;
e_win_size_max_set(about->win, w, h);
}
e_win_show(about->win);
}
/* local subsystem functions */
static void
_e_about_free(E_About *about)
{
_e_about = NULL;
if (about->bg_object) evas_object_del(about->bg_object);
e_object_del(E_OBJECT(about->win));
free(about);
}
static void
_e_about_cb_delete(E_Win *win)
{
E_About *about;
if (!(about = win->data)) return;
e_object_del(E_OBJECT(about));
}
static void
_e_about_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_About *about;
if (!(about = data)) return;
e_util_defer_object_del(E_OBJECT(about));
}
static void
_e_about_cb_resize(E_Win *win)
{
E_About *about;
about = win->data;
evas_object_resize(about->bg_object, about->win->w, about->win->h);
e_obj_dialog_show((E_Obj_Dialog *)about);
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "enlightenment/about");
}

View File

@ -3,23 +3,12 @@
*/
#ifdef E_TYPEDEFS
typedef struct _E_About E_About;
typedef struct _E_Obj_Dialog E_About;
#else
#ifndef E_ABOUT_H
#define E_ABOUT_H
#define E_ABOUT_TYPE 0xE0b0101a
struct _E_About
{
E_Object e_obj_inherit;
E_Win *win;
Evas_Object *bg_object;
void *data;
};
EAPI E_About *e_about_new (E_Container *con);
EAPI void e_about_show (E_About *about);

View File

@ -296,18 +296,27 @@ e_desklock_show(void)
"e/desklock/login_box");
edje_object_part_text_set(edp->login_box, "e.text.title",
_("Please enter your unlock password"));
edje_object_part_swallow(edp->bg_object, "e.swallow.login_box", edp->login_box);
edje_object_size_min_calc(edp->login_box, &mw, &mh);
evas_object_move(edp->login_box, (int)((zone->w - mw)/2),
(int)((zone->h - mh)/2));
if (edje_file_group_exists(edp->bg_object, "e.swallow.login_box"))
{
edje_extern_object_min_size_set(edp->login_box, mw, mh);
edje_object_part_swallow(edp->bg_object, "e.swallow.login_box", edp->login_box);
}
else
{
evas_object_resize(edp->login_box, mw, mh);
evas_object_move(edp->login_box,
((zone->w - mw) / 2),
((zone->h - mh) / 2));
}
if (total_zone_num > 1)
{
if (e_config->desklock_login_box_zone == -1)
evas_object_show(edp->login_box);
else if (e_config->desklock_login_box_zone == -2 && zone == current_zone)
else if ((e_config->desklock_login_box_zone == -2) &&
(zone == current_zone))
evas_object_show(edp->login_box);
else if (e_config->desklock_login_box_zone == zone_counter )
else if (e_config->desklock_login_box_zone == zone_counter)
evas_object_show(edp->login_box);
}
else
@ -321,7 +330,6 @@ e_desklock_show(void)
edd->elock_wnd_list = evas_list_append(edd->elock_wnd_list, edp);
}
zone_counter++;
}
}

View File

@ -75,17 +75,30 @@ e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon)
EAPI void
e_obj_dialog_show(E_Obj_Dialog *od)
{
Evas_Coord mw, mh;
Evas_Coord w, h, mw, mh;
const char *s;
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
edje_object_size_min_calc(od->bg_object, &mw, &mh);
edje_object_size_min_get(od->bg_object, &mw, &mh);
edje_object_size_min_restricted_calc(od->bg_object, &mw, &mh, mw, mh);
evas_object_resize(od->bg_object, mw, mh);
e_win_resize(od->win, mw, mh);
e_win_size_min_set(od->win, mw, mh);
e_win_size_max_set(od->win, mw, mh);
edje_object_size_max_get(od->bg_object, &w, &h);
if ((w > 0) && (h > 0))
{
if (w < mw) w = mw;
if (h < mh) h = mh;
e_win_size_max_set(od->win, w, h);
}
s = edje_object_data_get(od->bg_object, "borderless");
if (s && (!strcmp(s, "1")))
e_win_borderless_set(od->win, 1);
s = edje_object_data_get(od->bg_object, "shaped");
if (s && (!strcmp(s, "1")))
e_win_shaped_set(od->win, 1);
e_win_show(od->win);
}

View File

@ -4,12 +4,6 @@
#include "e.h"
/* local subsystem functions */
static void _e_theme_about_free(E_Theme_About *about);
static void _e_theme_about_cb_delete(E_Win *win);
static void _e_theme_about_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_theme_about_cb_resize(E_Win *win);
static E_Theme_About *_e_theme_about = NULL;
/* local subsystem globals */
@ -18,126 +12,19 @@ static E_Theme_About *_e_theme_about = NULL;
EAPI E_Theme_About *
e_theme_about_new(E_Container *con)
{
E_Theme_About *about;
E_Manager *man;
Evas_Object *o;
E_Obj_Dialog *od;
if (_e_theme_about)
{
E_Zone *z, *z2;
about = _e_theme_about;
z = e_util_zone_current_get(e_manager_current_get());
z2 = about->win->border->zone;
e_win_show(about->win);
e_win_raise(about->win);
if (z->container == z2->container)
e_border_desk_set(about->win->border, e_desk_current_get(z));
else
{
if (!about->win->border->sticky)
e_desk_show(about->win->border->desk);
ecore_x_pointer_warp(z2->container->win,
z2->x + (z2->w / 2), z2->y + (z2->h / 2));
}
e_border_unshade(about->win->border, E_DIRECTION_DOWN);
return NULL;
}
od = e_obj_dialog_new(con, _("About Theme"), "E", "_theme_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme", "e/theme/about");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
if (!con)
{
man = e_manager_current_get();
if (!man) return NULL;
con = e_container_current_get(man);
if (!con) con = e_container_number_get(man, 0);
if (!con) return NULL;
}
about = E_OBJECT_ALLOC(E_Theme_About, E_THEME_ABOUT_TYPE, _e_theme_about_free);
if (!about) return NULL;
about->win = e_win_new(con);
if (!about->win)
{
free(about);
return NULL;
}
e_win_delete_callback_set(about->win, _e_theme_about_cb_delete);
e_win_resize_callback_set(about->win, _e_theme_about_cb_resize);
about->win->data = about;
e_win_dialog_set(about->win, 1);
e_win_name_class_set(about->win, "E", "_theme_about");
e_win_title_set(about->win, _("About This Theme"));
o = edje_object_add(e_win_evas_get(about->win));
about->bg_object = o;
e_theme_edje_object_set(o, "base/theme", "e/theme/about");
evas_object_move(o, 0, 0);
evas_object_show(o);
edje_object_signal_callback_add(about->bg_object, "e,action,close", "",
_e_theme_about_cb_close, about);
e_win_centered_set(about->win, 1);
_e_theme_about = about;
return about;
return (E_Theme_About *)od;
}
EAPI void
e_theme_about_show(E_Theme_About *about)
{
Evas_Coord w, h, mw, mh, mcw, mch;
edje_object_size_min_get(about->bg_object, &mw, &mh);
edje_object_size_min_restricted_calc(about->bg_object, &mw, &mh, mw, mh);
evas_object_resize(about->bg_object, mw, mh);
e_win_resize(about->win, mw, mh);
e_win_size_min_set(about->win, mw, mh);
edje_object_size_max_get(about->bg_object, &w, &h);
if ((w > 0) && (h > 0))
{
if (w < mw) w = mw;
if (h < mh) h = mh;
e_win_size_max_set(about->win, w, h);
}
e_win_show(about->win);
e_win_border_icon_set(about->win, "enlightenment/themes");
}
/* local subsystem functions */
static void
_e_theme_about_free(E_Theme_About *about)
{
_e_theme_about = NULL;
if (about->bg_object) evas_object_del(about->bg_object);
e_object_del(E_OBJECT(about->win));
free(about);
}
static void
_e_theme_about_cb_delete(E_Win *win)
{
E_Theme_About *about;
about = win->data;
if (!about) return;
e_object_del(E_OBJECT(about));
}
static void
_e_theme_about_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_Theme_About *about;
about = data;
if (!about) return;
e_util_defer_object_del(E_OBJECT(about));
}
static void
_e_theme_about_cb_resize(E_Win *win)
{
E_Theme_About *about;
about = win->data;
evas_object_resize(about->bg_object, about->win->w, about->win->h);
e_obj_dialog_show((E_Obj_Dialog *)about);
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "enlightenment/themes");
}

View File

@ -3,23 +3,12 @@
*/
#ifdef E_TYPEDEFS
typedef struct _E_Theme_About E_Theme_About;
typedef struct _E_Obj_Dialog E_Theme_About;
#else
#ifndef E_THEME_ABOUT_H
#define E_THEME_ABOUT_H
#define E_THEME_ABOUT_TYPE 0xE0b01015
struct _E_Theme_About
{
E_Object e_obj_inherit;
E_Win *win;
Evas_Object *bg_object;
void *data;
};
EAPI E_Theme_About *e_theme_about_new (E_Container *con);
EAPI void e_theme_about_show (E_Theme_About *about);

View File

@ -348,14 +348,12 @@ _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_filereg_register(e_config->desklock_background);
}
e_config->desklock_login_box_zone = -1;
if (cfdata->zone_count > 1)
if (cfdata->login_zone < 0)
{
if (cfdata->login_zone >= 0)
e_config->desklock_login_box_zone = cfdata->zone;
else
e_config->desklock_login_box_zone = cfdata->login_zone;
e_config->desklock_login_box_zone = cfdata->login_zone;
}
else
e_config->desklock_login_box_zone = cfdata->zone;
e_config->desklock_use_custom_desklock = cfdata->custom_lock;
if (cfdata->custom_lock_cmd)