From: Gustavo Sverzut Barbieri Date: Thu, 4 Mar 2010 00:50:25 +0000 (+0000) Subject: window geometry got check_changed and minor cleanups. X-Git-Tag: submit/efl/20131021.015651~8092 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d08f1385a0cbc80b0bd148ab2a11226b8451d2a;p=platform%2Fupstream%2Fenlightenment.git window geometry got check_changed and minor cleanups. SVN revision: 46857 --- diff --git a/src/modules/conf_window_manipulation/e_int_config_window_geometry.c b/src/modules/conf_window_manipulation/e_int_config_window_geometry.c index 1f59e06..9863243 100644 --- a/src/modules/conf_window_manipulation/e_int_config_window_geometry.c +++ b/src/modules/conf_window_manipulation/e_int_config_window_geometry.c @@ -7,35 +7,33 @@ static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static void _cb_disable_check_list(void *data, Evas_Object *obj); /* Actual config data we will be playing with whil the dialog is active */ struct _E_Config_Dialog_Data { - /*- BASIC -*/ int use_resist; - /*- ADVANCED -*/ int desk_resist; int window_resist; int gadget_resist; - struct + struct { double timeout; - struct + struct { int dx, dy; } move; - struct + struct { int dx, dy; } resize; } border_keyboard; -}; -Eina_List *resistance_list = NULL; + Eina_List *resistance_list; +}; -/* a nice easy setup function that does the dirty work */ E_Config_Dialog * e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__) { @@ -50,6 +48,7 @@ e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__) v->free_cfdata = _free_data; v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; + v->basic.check_changed = _basic_check_changed; /* create config diaolg for NULL object/data */ cfd = e_config_dialog_new(con, _("Window Geometry"), @@ -58,10 +57,11 @@ e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__) return cfd; } -/**--CREATE--**/ -static void -_fill_data(E_Config_Dialog_Data *cfdata) +static void * +_create_data(E_Config_Dialog *cfd __UNUSED__) { + E_Config_Dialog_Data *cfdata = E_NEW(E_Config_Dialog_Data, 1); + if (!cfdata) return NULL; cfdata->use_resist = e_config->use_resist; cfdata->desk_resist = e_config->desk_resist; cfdata->window_resist = e_config->window_resist; @@ -71,37 +71,19 @@ _fill_data(E_Config_Dialog_Data *cfdata) // cfdata->border_keyboard.move.dy = e_config->border_keyboard.move.dy; cfdata->border_keyboard.resize.dx = e_config->border_keyboard.resize.dx; // cfdata->border_keyboard.resize.dy = e_config->border_keyboard.resize.dy; -} - -static void * -_create_data(E_Config_Dialog *cfd __UNUSED__) -{ - /* Create cfdata - cfdata is a temporary block of config data that this - * dialog will be dealing with while configuring. it will be applied to - * the running systems/config in the apply methods - */ - E_Config_Dialog_Data *cfdata; - - cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - resistance_list = eina_list_free(resistance_list); - - /* Free the cfdata */ + eina_list_free(cfdata->resistance_list); E_FREE(cfdata); } -/**--APPLY--**/ - static int _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - /* Actually take our cfdata settings and apply them in real life */ e_config->use_resist = cfdata->use_resist; e_config->desk_resist = cfdata->desk_resist; e_config->window_resist = cfdata->window_resist; @@ -117,11 +99,23 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) return 1; /* Apply was OK */ } -/**--GUI--**/ +static int +_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) +{ + return ((e_config->use_resist != cfdata->use_resist) || + (e_config->desk_resist != cfdata->desk_resist) || + (e_config->window_resist != cfdata->window_resist) || + (e_config->gadget_resist != cfdata->gadget_resist) || + (e_config->border_keyboard.timeout != cfdata->border_keyboard.timeout) || + (e_config->border_keyboard.move.dx != cfdata->border_keyboard.move.dx) || + (e_config->border_keyboard.move.dy != cfdata->border_keyboard.move.dx) || + (e_config->border_keyboard.resize.dx != cfdata->border_keyboard.resize.dx) || + (e_config->border_keyboard.resize.dy != cfdata->border_keyboard.resize.dx)); +} + static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata) { - /* generate the core widget layout for an advanced dialog */ Evas_Object *o, *ob, *of; Evas_Object *resistance_check; @@ -131,38 +125,38 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial resistance_check = e_widget_check_add(evas, _("Resist obstacles"), &(cfdata->use_resist)); e_widget_framelist_object_append(of, resistance_check); - ob = e_widget_label_add(evas, _("Other windows:")); - resistance_list = eina_list_append (resistance_list, ob); + ob = e_widget_label_add(evas, _("Other windows")); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 0, 64.0, 1.0, 0, NULL, &(cfdata->window_resist), 100); - resistance_list = eina_list_append (resistance_list, ob); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Edge of the screen:")); - resistance_list = eina_list_append (resistance_list, ob); + ob = e_widget_label_add(evas, _("Edge of the screen")); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 0, 64.0, 1.0, 0, NULL, &(cfdata->desk_resist), 100); - resistance_list = eina_list_append (resistance_list, ob); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Desktop gadgets:")); - resistance_list = eina_list_append (resistance_list, ob); + ob = e_widget_label_add(evas, _("Desktop gadgets")); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 0, 64.0, 1.0, 0, NULL, &(cfdata->gadget_resist), 100); - resistance_list = eina_list_append (resistance_list, ob); + cfdata->resistance_list = eina_list_append (cfdata->resistance_list, ob); e_widget_disabled_set(ob, !cfdata->use_resist); // set state from saved config e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 0, 0.5); // handler for enable/disable widget array e_widget_on_change_hook_set(resistance_check, _cb_disable_check_list, - resistance_list); + cfdata->resistance_list); of = e_widget_framelist_add(evas, _("Keyboard move and resize"), 0); ob = e_widget_label_add(evas, _("Automatically accept changes after:")); @@ -170,12 +164,12 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 9.9, 0.1, 0, &(cfdata->border_keyboard.timeout), NULL, 100); e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Move by:")); + ob = e_widget_label_add(evas, _("Move by")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 1, 255, 1, 0, NULL, &(cfdata->border_keyboard.move.dx), 100); e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Resize by:")); + ob = e_widget_label_add(evas, _("Resize by")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%2.0f pixels"), 1, 255, 1, 0, NULL, &(cfdata->border_keyboard.resize.dx), 100); @@ -185,19 +179,14 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial return o; } -/*! - * * If the check is disabled then disable the chained objects in the list. - * - * @param data A Eina_List of Evas_Object to chain widgets together with the checkbox - * @param obj A Evas_Object checkbox created with e_widget_check_add() - */ static void _cb_disable_check_list(void *data, Evas_Object *obj) { - Eina_List *list = (Eina_List*) data; - Eina_List *l; + const Eina_List *list = data; + const Eina_List *l; Evas_Object *o; + Eina_Bool disable = !e_widget_check_checked_get(obj); EINA_LIST_FOREACH(list, l, o) - e_widget_disabled_set(o, !e_widget_check_checked_get(obj)); + e_widget_disabled_set(o, disable); }