2005-12-16 18:14:19 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
2010-03-01 11:28:21 -08:00
|
|
|
/* local structures */
|
2006-01-14 08:05:35 -08:00
|
|
|
struct _E_Config_Dialog_Data
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
int show_favs, show_apps;
|
|
|
|
int show_name, show_generic, show_comment;
|
|
|
|
double scroll_speed, fast_mouse_move_threshhold;
|
|
|
|
double click_drag_timeout;
|
|
|
|
int autoscroll_margin, autoscroll_cursor_margin;
|
2005-12-16 18:14:19 -08:00
|
|
|
};
|
|
|
|
|
2010-03-01 11:28:21 -08:00
|
|
|
/* local function prototypes */
|
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
|
|
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-08 05:45:38 -08:00
|
|
|
static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-01 11:28:21 -08:00
|
|
|
static Evas_Object *_adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-08 05:45:38 -08:00
|
|
|
static int _adv_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-01 11:28:21 -08:00
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
2007-07-24 11:47:26 -07:00
|
|
|
e_int_config_menus(E_Container *con, const char *params __UNUSED__)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2006-01-22 06:17:43 -08:00
|
|
|
E_Config_Dialog_View *v;
|
2010-03-01 11:28:21 -08:00
|
|
|
|
2009-12-04 14:37:18 -08:00
|
|
|
if (e_config_dialog_find("E", "menus/menu_settings")) return NULL;
|
2010-03-01 11:28:21 -08:00
|
|
|
|
2006-01-22 06:17:43 -08:00
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
2007-12-17 17:42:56 -08:00
|
|
|
v->basic.create_widgets = _basic_create;
|
2010-03-01 11:28:21 -08:00
|
|
|
v->basic.apply_cfdata = _basic_apply;
|
2010-03-08 05:45:38 -08:00
|
|
|
v->basic.check_changed = _basic_check_changed;
|
2010-03-01 11:28:21 -08:00
|
|
|
v->advanced.create_widgets = _adv_create;
|
|
|
|
v->advanced.apply_cfdata = _adv_apply;
|
2010-03-08 05:45:38 -08:00
|
|
|
v->advanced.check_changed = _adv_check_changed;
|
2005-12-16 18:14:19 -08:00
|
|
|
|
2010-03-01 11:28:21 -08:00
|
|
|
cfd = e_config_dialog_new(con, _("Menu Settings"), "E", "menus/menu_settings",
|
|
|
|
"preferences-menus", 0, v, NULL);
|
|
|
|
return cfd;
|
2005-12-16 18:14:19 -08:00
|
|
|
}
|
|
|
|
|
2010-03-01 11:28:21 -08:00
|
|
|
/* local functions */
|
2005-12-16 18:14:19 -08:00
|
|
|
static void *
|
2010-03-02 11:05:45 -08:00
|
|
|
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2006-01-14 08:05:35 -08:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2010-03-01 11:28:21 -08:00
|
|
|
|
2006-01-14 08:05:35 -08:00
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
2005-12-16 18:14:19 -08:00
|
|
|
_fill_data(cfdata);
|
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
static void
|
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata __UNUSED__)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
cfdata->show_favs = e_config->menu_favorites_show;
|
|
|
|
cfdata->show_apps = e_config->menu_apps_show;
|
|
|
|
cfdata->show_name = e_config->menu_eap_name_show;
|
|
|
|
cfdata->show_generic = e_config->menu_eap_generic_show;
|
|
|
|
cfdata->show_comment = e_config->menu_eap_comment_show;
|
|
|
|
cfdata->scroll_speed = e_config->menus_scroll_speed;
|
|
|
|
cfdata->fast_mouse_move_threshhold =
|
|
|
|
e_config->menus_fast_mouse_move_threshhold;
|
|
|
|
cfdata->click_drag_timeout = e_config->menus_click_drag_timeout;
|
|
|
|
cfdata->autoscroll_margin = e_config->menu_autoscroll_margin;
|
|
|
|
cfdata->autoscroll_cursor_margin = e_config->menu_autoscroll_cursor_margin;
|
2005-12-16 18:14:19 -08:00
|
|
|
}
|
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
static void
|
|
|
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
E_FREE(cfdata);
|
2005-12-16 18:14:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2010-03-02 11:05:45 -08:00
|
|
|
_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
Evas_Object *o, *of, *ow;
|
2007-12-17 17:42:56 -08:00
|
|
|
|
2005-12-16 18:14:19 -08:00
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
2010-03-01 11:28:21 -08:00
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
of = e_widget_framelist_add(evas, _("Main Menu"), 0);
|
|
|
|
ow = e_widget_check_add(evas, _("Favorites"), &(cfdata->show_favs));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_framelist_object_append(of, ow);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Applications"), &(cfdata->show_apps));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_framelist_object_append(of, ow);
|
|
|
|
e_widget_list_object_append(o, of, 1, 0, 0.5);
|
2007-12-17 17:42:56 -08:00
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
of = e_widget_framelist_add(evas, _("Display"), 0);
|
|
|
|
ow = e_widget_check_add(evas, _("Name"), &(cfdata->show_name));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_framelist_object_append(of, ow);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Generic"), &(cfdata->show_generic));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_framelist_object_append(of, ow);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Comments"), &(cfdata->show_comment));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_framelist_object_append(of, ow);
|
|
|
|
e_widget_list_object_append(o, of, 1, 0, 0.5);
|
|
|
|
|
2005-12-16 18:14:19 -08:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
static int
|
|
|
|
_basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
e_config->menu_favorites_show = cfdata->show_favs;
|
|
|
|
e_config->menu_apps_show = cfdata->show_apps;
|
|
|
|
e_config->menu_eap_name_show = cfdata->show_name;
|
|
|
|
e_config->menu_eap_generic_show = cfdata->show_generic;
|
|
|
|
e_config->menu_eap_comment_show = cfdata->show_comment;
|
2005-12-16 18:14:19 -08:00
|
|
|
e_config_save_queue();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-03-08 05:45:38 -08:00
|
|
|
static int
|
|
|
|
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
return ((e_config->menu_favorites_show != cfdata->show_favs) ||
|
|
|
|
(e_config->menu_apps_show != cfdata->show_apps) ||
|
|
|
|
(e_config->menu_eap_name_show != cfdata->show_name) ||
|
|
|
|
(e_config->menu_eap_generic_show != cfdata->show_generic) ||
|
|
|
|
(e_config->menu_eap_comment_show != cfdata->show_comment));
|
|
|
|
}
|
|
|
|
|
2005-12-16 18:14:19 -08:00
|
|
|
static Evas_Object *
|
2010-03-02 11:05:45 -08:00
|
|
|
_adv_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2005-12-16 18:14:19 -08:00
|
|
|
{
|
2010-03-01 11:28:21 -08:00
|
|
|
Evas_Object *otb, *ol, *ow;
|
|
|
|
|
|
|
|
otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale));
|
|
|
|
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Favorites"), &(cfdata->show_favs));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Applications"), &(cfdata->show_apps));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Main Menu"), ol, 0, 0, 0, 0,
|
|
|
|
0.5, 0.0);
|
|
|
|
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Name"), &(cfdata->show_name));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Generic"), &(cfdata->show_generic));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_check_add(evas, _("Comments"), &(cfdata->show_comment));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
2010-03-02 11:05:45 -08:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Display"), ol, 0, 0, 0, 0,
|
2010-03-01 11:28:21 -08:00
|
|
|
0.5, 0.0);
|
|
|
|
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_label_add(evas, _("Margin"));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 0, 50, 1, 0, NULL,
|
2010-03-02 11:05:45 -08:00
|
|
|
&(cfdata->autoscroll_margin), 100);
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
2010-03-02 11:05:45 -08:00
|
|
|
ow = e_widget_label_add(evas, _("Cursor Margin"));
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 0, 50, 1, 0, NULL,
|
2010-03-02 11:05:45 -08:00
|
|
|
&(cfdata->autoscroll_cursor_margin), 100);
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Autoscroll"), ol, 0, 0, 0, 0,
|
|
|
|
0.5, 0.0);
|
|
|
|
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
|
|
|
ow = e_widget_label_add(evas, _("Menu Scroll Speed"));
|
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_slider_add(evas, 1, 0, _("%5.0f pixels/sec"), 0, 20000, 100,
|
2010-03-02 11:05:45 -08:00
|
|
|
0, &(cfdata->scroll_speed), NULL, 100);
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_label_add(evas, _("Fast Mouse Move Threshhold"));
|
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_slider_add(evas, 1, 0, _("%4.0f pixels/sec"), 0, 2000, 10,
|
2010-03-02 11:05:45 -08:00
|
|
|
0, &(cfdata->fast_mouse_move_threshhold), NULL, 100);
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_label_add(evas, _("Click Drag Timeout"));
|
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
ow = e_widget_slider_add(evas, 1, 0, _("%2.2f sec"), 0, 10, 0.25,
|
2010-03-02 11:05:45 -08:00
|
|
|
0, &(cfdata->click_drag_timeout), NULL, 100);
|
2010-03-01 11:28:21 -08:00
|
|
|
e_widget_list_object_append(ol, ow, 1, 0, 0.5);
|
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Miscellaneous"), ol, 0, 0, 0, 0,
|
|
|
|
0.5, 0.0);
|
|
|
|
|
|
|
|
e_widget_toolbook_page_show(otb, 0);
|
|
|
|
return otb;
|
|
|
|
}
|
2007-05-12 15:40:03 -07:00
|
|
|
|
2010-03-02 11:05:45 -08:00
|
|
|
static int
|
|
|
|
_adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2010-03-01 11:28:21 -08:00
|
|
|
{
|
|
|
|
e_config->menu_favorites_show = cfdata->show_favs;
|
|
|
|
e_config->menu_apps_show = cfdata->show_apps;
|
|
|
|
e_config->menu_eap_name_show = cfdata->show_name;
|
|
|
|
e_config->menu_eap_generic_show = cfdata->show_generic;
|
|
|
|
e_config->menu_eap_comment_show = cfdata->show_comment;
|
|
|
|
|
|
|
|
if (cfdata->scroll_speed == 0) e_config->menus_scroll_speed = 1.0;
|
|
|
|
else e_config->menus_scroll_speed = cfdata->scroll_speed;
|
|
|
|
|
|
|
|
if (cfdata->fast_mouse_move_threshhold == 0)
|
|
|
|
e_config->menus_fast_mouse_move_threshhold = 1.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e_config->menus_fast_mouse_move_threshhold =
|
|
|
|
cfdata->fast_mouse_move_threshhold;
|
|
|
|
}
|
|
|
|
e_config->menus_click_drag_timeout = cfdata->click_drag_timeout;
|
|
|
|
e_config->menu_autoscroll_margin = cfdata->autoscroll_margin;
|
|
|
|
e_config->menu_autoscroll_cursor_margin = cfdata->autoscroll_cursor_margin;
|
|
|
|
e_config_save_queue();
|
|
|
|
return 1;
|
2005-12-16 18:14:19 -08:00
|
|
|
}
|
2010-03-08 05:45:38 -08:00
|
|
|
|
|
|
|
static int
|
|
|
|
_adv_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
double scroll_speed, move_threshold;
|
|
|
|
|
|
|
|
if (cfdata->scroll_speed == 0)
|
|
|
|
scroll_speed = 1.0;
|
|
|
|
else
|
|
|
|
scroll_speed = cfdata->scroll_speed;
|
|
|
|
|
|
|
|
if (cfdata->fast_mouse_move_threshhold == 0)
|
|
|
|
move_threshold = 1.0;
|
|
|
|
else
|
|
|
|
move_threshold = cfdata->fast_mouse_move_threshhold;
|
|
|
|
|
|
|
|
return ((e_config->menu_favorites_show != cfdata->show_favs) ||
|
|
|
|
(e_config->menu_apps_show != cfdata->show_apps) ||
|
|
|
|
(e_config->menu_eap_name_show != cfdata->show_name) ||
|
|
|
|
(e_config->menu_eap_generic_show != cfdata->show_generic) ||
|
|
|
|
(e_config->menu_eap_comment_show != cfdata->show_comment) ||
|
|
|
|
(e_config->menus_click_drag_timeout != cfdata->click_drag_timeout) ||
|
|
|
|
(e_config->menu_autoscroll_margin != cfdata->autoscroll_margin) ||
|
|
|
|
(e_config->menu_autoscroll_cursor_margin != cfdata->autoscroll_cursor_margin) ||
|
|
|
|
(e_config->menus_scroll_speed != scroll_speed) ||
|
|
|
|
(e_config->menus_fast_mouse_move_threshhold != move_threshold));
|
|
|
|
}
|