2012-12-17 01:19:13 -08:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
#include "e_int_config_randr.h"
|
2013-02-19 02:55:20 -08:00
|
|
|
#include "e_smart_randr.h"
|
2012-12-17 01:19:13 -08:00
|
|
|
|
|
|
|
/* local structures */
|
|
|
|
struct _E_Config_Dialog_Data
|
|
|
|
{
|
|
|
|
Evas_Object *o_randr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* local function prototypes */
|
2012-12-17 01:20:07 -08:00
|
|
|
static void *_create_data(E_Config_Dialog *cfd EINA_UNUSED);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata);
|
2013-02-19 02:55:20 -08:00
|
|
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata);
|
2012-12-18 07:27:59 -08:00
|
|
|
static int _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata);
|
2012-12-17 01:19:13 -08:00
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
E_Config_Dialog *
|
2012-12-17 01:20:07 -08:00
|
|
|
e_int_config_randr(E_Container *con, const char *params EINA_UNUSED)
|
2012-12-17 01:19:13 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
|
|
|
|
|
|
|
/* check for existing dialog */
|
|
|
|
if (e_config_dialog_find("E", "screen/screen_setup"))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* try to allocate dialog view */
|
|
|
|
if (!(v = E_NEW(E_Config_Dialog_View, 1)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* set dialog view functions & properties */
|
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
|
|
|
v->basic.create_widgets = _basic_create;
|
|
|
|
v->basic.apply_cfdata = _basic_apply;
|
|
|
|
v->override_auto_apply = EINA_TRUE;
|
|
|
|
|
|
|
|
/* create new dialog */
|
|
|
|
cfd = e_config_dialog_new(con, _("Screen Setup"),
|
|
|
|
"E", "screen/screen_setup",
|
|
|
|
"preferences-system-screen-resolution",
|
|
|
|
0, v, NULL);
|
2012-12-17 19:25:45 -08:00
|
|
|
e_dialog_resizable_set(cfd->dia, 1);
|
2012-12-17 01:19:13 -08:00
|
|
|
|
|
|
|
return cfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
static void *
|
2012-12-17 01:20:07 -08:00
|
|
|
_create_data(E_Config_Dialog *cfd EINA_UNUSED)
|
2012-12-17 01:19:13 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
/* try to allocate the config data structure */
|
|
|
|
if (!(cfdata = E_NEW(E_Config_Dialog_Data, 1)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-17 01:20:07 -08:00
|
|
|
_free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2012-12-17 01:19:13 -08:00
|
|
|
{
|
|
|
|
/* if we have the randr smart widget, delete it */
|
|
|
|
if (cfdata->o_randr)
|
2012-12-17 01:20:38 -08:00
|
|
|
{
|
|
|
|
/* delete the randr object */
|
|
|
|
evas_object_del(cfdata->o_randr);
|
|
|
|
}
|
2012-12-17 01:19:13 -08:00
|
|
|
|
|
|
|
/* free the config data structure */
|
|
|
|
E_FREE(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2013-02-19 02:55:20 -08:00
|
|
|
_basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2012-12-17 01:19:13 -08:00
|
|
|
{
|
2013-02-19 02:55:20 -08:00
|
|
|
Evas_Object *o;
|
|
|
|
|
2012-12-17 01:19:13 -08:00
|
|
|
/* create the base list widget */
|
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
|
|
|
|
|
|
|
/* try to create randr smart widget */
|
2013-02-19 02:55:09 -08:00
|
|
|
if ((cfdata->o_randr = e_smart_randr_add(evas)))
|
|
|
|
{
|
|
|
|
/* append randr widget to list object */
|
|
|
|
e_widget_list_object_append(o, cfdata->o_randr, 1, 1, 0.5);
|
|
|
|
}
|
|
|
|
|
2012-12-17 01:19:13 -08:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-12-18 07:27:59 -08:00
|
|
|
_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2012-12-17 01:19:13 -08:00
|
|
|
{
|
2012-12-17 01:20:38 -08:00
|
|
|
/* return success */
|
2012-12-17 01:19:13 -08:00
|
|
|
return 1;
|
|
|
|
}
|