Enlightenment CVS committal Author : devilhorns Project : e17 Module : apps/e
Dir : e17/apps/e/src/modules/ibar Modified Files: e_mod_main.c e_mod_config.c e_mod_main.h Log Message: Re-Enable Edit Mode. Make e_modapi_config use the same configure call as menu->configuration method. Updated e_mod_config.c to use the dialog that raster designed. :) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -3 -r1.93 -r1.94 --- e_mod_main.c 17 Dec 2005 11:21:53 -0000 1.93 +++ e_mod_main.c 17 Dec 2005 20:54:52 -0000 1.94 @@ -94,32 +94,6 @@ static void _ibar_drag_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); static void _ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); -/* PROTOTYPES - same all the time */ -typedef struct _CFData CFData; - -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, CFData *cfdata); -static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata); -static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata); -static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata); -static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata); -static void _ibar_config_dialog(IBar *ib); - - -/* Actual config data we will be playing with whil the dialog is active */ -struct _CFData -{ - /*- BASIC -*/ - //int mode; - /*- ADVANCED -*/ - int follower; - double follow_speed; - int iconsize; - int autofit; - double autoscroll_speed; -}; - - /* Config Updated Function Protos */ static void _ibar_bar_cb_width_auto(void *data); static void _ibar_bar_cb_follower(void *data); @@ -192,9 +166,11 @@ e_modapi_config(E_Module *m) { IBar *ib; + E_Container *con; ib = m->data; - if (ib) _ibar_config_dialog(ib); + con = e_container_current_get(e_manager_current_get()); + if (ib) e_int_config_ibar(con, ib); return 1; } @@ -654,15 +630,6 @@ mn = e_menu_new(); ibb->menu = mn; - /* Enabled */ - /* - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, "Enabled"); - e_menu_item_check_set(mi, 1); - if (ibb->conf->enabled) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _ibar_bar_cb_menu_enabled, ibb); - */ - /* Config */ mi = e_menu_item_new(mn); e_menu_item_label_set(mi, _("Configuration")); @@ -1817,25 +1784,6 @@ } } -/* -static void -_ibar_bar_cb_menu_enabled(void *data, E_Menu *m, E_Menu_Item *mi) -{ - IBar_Bar *ibb; - unsigned char enabled; - - ibb = data; - enabled = e_menu_item_toggle_get(mi); - if ((ibb->conf->enabled) && (!enabled)) - { - _ibar_bar_disable(ibb); - } - else if ((!ibb->conf->enabled) && (enabled)) - { - _ibar_bar_enable(ibb); - } -} - static void _ibar_bar_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) { @@ -1858,266 +1806,3 @@ evas_object_resize(o, w, h); evas_object_resize(data, w, h); } -*/ - - -/* Config dialog info */ -static void -_ibar_config_dialog(IBar *ib) -{ - E_Config_Dialog *cfd; - E_Config_Dialog_View v; - E_Manager *man; - E_Container *con; - //IBar *ib; - //ib = ibb->ibar; - man = e_manager_current_get(); - //if (!man) return NULL; - con = e_container_current_get(man); - - /* methods */ - v.create_cfdata = _create_data; - v.free_cfdata = _free_data; - v.basic.apply_cfdata = _basic_apply_data; - v.basic.create_widgets = _basic_create_widgets; - v.advanced.apply_cfdata = _advanced_apply_data; - v.advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("IBar Configuration"), NULL, 0, &v, ib); - //ib->conf_diag = cfd; -} - -/**--CREATE--**/ -static void -_fill_data(IBar *ib,CFData *cfdata) -{ - cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO); - cfdata->autoscroll_speed = ib->conf->autoscroll_speed; - cfdata->follower = ib->conf->follower; - cfdata->follow_speed = ib->conf->follow_speed; - cfdata->iconsize = ib->conf->iconsize; -} - -static void * -_create_data(E_Config_Dialog *cfd) -{ - /* 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 - */ - CFData *cfdata; - IBar *ib; - ib = cfd->data; - - cfdata = E_NEW(CFData, 1); - _fill_data(ib,cfdata); - return cfdata; -} - -static void -_free_data(E_Config_Dialog *cfd, CFData *cfdata) -{ - /* Free the cfdata */ - - free(cfdata); -} - -/**--APPLY--**/ -static int -_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata) -{ - IBar *ib; - IBar_Bar *ibb; - Evas_List *l; - ib = cfd->data; - -/* Follower */ - if ((cfdata->follower) && (!ib->conf->follower)) - { - ib->conf->follower = 1; - for (l = ib->bars; l; l = l->next) - { - Evas_Object *o; - - ibb = l->data; - if (ibb->overlay_object) continue; - o = edje_object_add(ibb->evas); - ibb->overlay_object = o; - evas_object_layer_set(o, 2); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/follower"); - evas_object_show(o); - _ibar_bar_follower_reset(ibb); - } - } - else if (!(cfdata->follower) && (ib->conf->follower)) - { - ib->conf->follower = 0; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - if (!ibb->overlay_object) continue; - evas_object_del(ibb->overlay_object); - ibb->overlay_object = NULL; - } - } - -/* Auto fit */ -if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) - { - ib->conf->width = IBAR_WIDTH_AUTO; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - _ibar_bar_update_policy(ibb); - _ibar_bar_frame_resize(ibb); - } - } - else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) - { - ib->conf->width = IBAR_WIDTH_FIXED; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - _ibar_bar_update_policy(ibb); - _ibar_bar_frame_resize(ibb); - } - } - return 1; -} - -static int -_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata) -{ - IBar *ib; - IBar_Bar *ibb; - Evas_List *l; - ib = cfd->data; - -/* Follower */ - if ((cfdata->follower) && (!ib->conf->follower)) - { - ib->conf->follower = 1; - for (l = ib->bars; l; l = l->next) - { - Evas_Object *o; - - ibb = l->data; - if (ibb->overlay_object) continue; - o = edje_object_add(ibb->evas); - ibb->overlay_object = o; - evas_object_layer_set(o, 2); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/follower"); - evas_object_show(o); - } - } - else if (!(cfdata->follower) && (ib->conf->follower)) - { - ib->conf->follower = 0; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - if (!ibb->overlay_object) continue; - evas_object_del(ibb->overlay_object); - ibb->overlay_object = NULL; - } - } - - /* Auto fit */ - if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) - { - ib->conf->width = IBAR_WIDTH_AUTO; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - _ibar_bar_update_policy(ibb); - _ibar_bar_frame_resize(ibb); - } - } - else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) - { - ib->conf->width = IBAR_WIDTH_FIXED; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - _ibar_bar_update_policy(ibb); - _ibar_bar_frame_resize(ibb); - } - } - -/* Icon size */ - if (cfdata->iconsize != ib->conf->iconsize) - { - ib->conf->iconsize = cfdata->iconsize; - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - _ibar_bar_cb_iconsize_change(ibb); - } - } - - e_config_save_queue(); - return 1; -} - -/**--GUI--**/ -static Evas_Object * -_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata) -{ - /* generate the core widget layout for a basic dialog */ - Evas_Object *o, *ob; - E_Radio_Group *rg; - IBar *ib; - ib = cfd->data; - - _fill_data(ib,cfdata); - o = e_widget_list_add(evas, 0, 0); - ob = e_widget_check_add(evas, _("Follower"), &(cfdata->follower)); - e_widget_list_object_append(o, ob, 1, 1, 0.5); - ob = e_widget_check_add(evas, _("Auto fit"), &(cfdata->autofit)); - e_widget_list_object_append(o, ob, 1, 1, 0.5); - return o; -} - -static Evas_Object * -_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata) -{ - /* generate the core widget layout for an advanced dialog */ - Evas_Object *o, *ob, *of,*oo; - E_Radio_Group *rg; - IBar *ib; - ib = cfd->data; - - _fill_data(ib,cfdata); - - o = e_widget_list_add(evas, 0, 0); - - of = e_widget_framelist_add(evas, _("Follower"), 0); - ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Follow speed")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01,0, &(cfdata->follow_speed), NULL, 200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - - of = e_widget_framelist_add(evas, _("Icon size"), 0); - ob = e_widget_slider_add(evas, 1, 0, _("%3.0f px"), 8.0, 128.0, 1.0,0, NULL, &(cfdata->iconsize), 200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - - of = e_widget_framelist_add(evas, _("Width"), 0); - ob = e_widget_check_add(evas, _("Auto fit"), &(cfdata->autofit)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Autoscroll speed")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01,0, &(cfdata->autoscroll_speed), NULL, 200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - - return o; -} - =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_config.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- e_mod_config.c 17 Dec 2005 02:23:50 -0000 1.7 +++ e_mod_config.c 17 Dec 2005 20:54:52 -0000 1.8 @@ -12,15 +12,9 @@ struct _cfdata { - /* Basic Config */ - int method; - int icon_method; - + int autofit; int follower; - int width; int iconsize; - - /* Advanced Config */ double follow_speed; double autoscroll_speed; }; @@ -40,15 +34,11 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata); static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata); -IBar *ib = NULL; - void e_int_config_ibar(E_Container *con, IBar *ibar) { E_Config_Dialog *cfd; E_Config_Dialog_View v; - ib = ibar; - /* Dialog Methods */ v.create_cfdata = _create_data; v.free_cfdata = _free_data; @@ -58,28 +48,14 @@ v.advanced.create_widgets = _advanced_create_widgets; /* Create The Dialog */ - cfd = e_config_dialog_new(con, _("IBar Module"), NULL, 0, &v, ibar); + cfd = e_config_dialog_new(con, _("IBar Configuration"), NULL, 0, &v, ibar); } -static void _fill_data(CFData *cfdata) +static void _fill_data(IBar *ib, CFData *cfdata) { + cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO); cfdata->follower = ib->conf->follower; - cfdata->width = ib->conf->width; - if (cfdata->width == IBAR_WIDTH_AUTO) - { - cfdata->method = 1; - } - else - { - cfdata->method = 0; - } - - cfdata->iconsize = ib->conf->iconsize; - if (cfdata->iconsize <=24) cfdata->icon_method = ICONSIZE_SMALL; - if ((cfdata->iconsize > 24) && (cfdata->iconsize <=32)) cfdata->icon_method = ICONSIZE_MEDIUM; - if ((cfdata->iconsize > 32) && (cfdata->iconsize <=40)) cfdata->icon_method = ICONSIZE_LARGE; - if (cfdata->iconsize > 40) cfdata->icon_method = ICONSIZE_VERYLARGE; - + cfdata->iconsize = ib->conf->iconsize; cfdata->follow_speed = ib->conf->follow_speed; cfdata->autoscroll_speed = ib->conf->autoscroll_speed; } @@ -87,8 +63,11 @@ static void *_create_data(E_Config_Dialog *cfd) { CFData *cfdata; - + IBar *ib; + + ib = cfd->data; cfdata = E_NEW(CFData, 1); + _fill_data(ib, cfdata); return cfdata; } @@ -99,54 +78,44 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata) { - Evas_Object *o, *of, *ob; - E_Radio_Group *rg; - - _fill_data(cfdata); + Evas_Object *o, *ob; + IBar *ib; + + ib = cfd->data; + _fill_data(ib, cfdata); o = e_widget_list_add(evas, 0, 0); - of = e_widget_framelist_add(evas, _("General Settings"), 0); ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->method)); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Icon Size"), 0); - rg = e_widget_radio_group_new(&(cfdata->icon_method)); - ob = e_widget_radio_add(evas, _("Small"), ICONSIZE_SMALL, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Medium"), ICONSIZE_MEDIUM, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Large"), ICONSIZE_LARGE, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Very Large"), ICONSIZE_VERYLARGE, rg); - e_widget_framelist_object_append(of, ob); - - e_widget_list_object_append(o, of, 1, 1, 0.5); + e_widget_list_object_append(o, ob, 1, 1, 0.5); + ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit)); + e_widget_list_object_append(o, ob, 1, 1, 0.5); return o; } static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { + IBar *ib; + Evas_List *l; + + ib = cfd->data; e_border_button_bindings_ungrab_all(); - ib->conf->follower = cfdata->follower; - - if (cfdata->method == 0) + if ((cfdata->follower) && (!ib->conf->follower)) { - cfdata->width = IBAR_WIDTH_FIXED; + ib->conf->follower = 1; } - else + else if (!(cfdata->follower) && (ib->conf->follower)) { - cfdata->width = IBAR_WIDTH_AUTO; + ib->conf->follower = 0; + } + + if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) + { + ib->conf->width = IBAR_WIDTH_AUTO; + } + else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) + { + ib->conf->width = IBAR_WIDTH_FIXED; } - ib->conf->width = cfdata->width; - - if (cfdata->icon_method == ICONSIZE_SMALL) ib->conf->iconsize = 24; - if (cfdata->icon_method == ICONSIZE_MEDIUM) ib->conf->iconsize = 32; - if (cfdata->icon_method == ICONSIZE_LARGE) ib->conf->iconsize = 40; - if (cfdata->icon_method == ICONSIZE_VERYLARGE) ib->conf->iconsize = 48; - e_border_button_bindings_grab_all(); e_config_save_queue(); @@ -158,56 +127,75 @@ { Evas_Object *o, *of, *ob, *ot; E_Radio_Group *rg; - - _fill_data(cfdata); + IBar *ib; + + ib = cfd->data; + _fill_data(ib, cfdata); o = e_widget_list_add(evas, 0, 0); - of = e_widget_framelist_add(evas, _("General Settings"), 0); - ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->method)); + + of = e_widget_framelist_add(evas, _("Follower"), 0); + ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower)); e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Icon Settings"), 0); - ob = e_widget_label_add(evas, _("Icon Size:")); + ob = e_widget_label_add(evas, _("Follow Speed")); e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pixels"), 8, 128, 1, 0, NULL, &(cfdata->iconsize), 200); + ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->follow_speed), NULL,200); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - /* Advanced Options */ - of = e_widget_framelist_add(evas, _("Advanced Settings"), 0); - ob = e_widget_label_add(evas, _("Follow Speed:")); + of = e_widget_framelist_add(evas, _("Icon Size"), 0); + ob = e_widget_slider_add(evas, 1, 0, _("%3.0f pixels"), 8.0, 128.0, 1.0, 0, NULL, &(cfdata->iconsize), 200); e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f pixels/sec"), 0.01, 0.99, 0.01, 0, &(cfdata->follow_speed), NULL,200); + e_widget_list_object_append(o, of, 1, 1, 0.5); + + of = e_widget_framelist_add(evas, _("Width"), 0); + ob = e_widget_check_add(evas, _("Auto Fit"), &(cfdata->autofit)); e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Autoscroll Speed:")); e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f pixels/sec"), 0.01, 0.99, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200); + ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200); e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); return o; } static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { + IBar *ib; + + ib = cfd->data; e_border_button_bindings_ungrab_all(); - ib->conf->follower = cfdata->follower; - if (cfdata->method == 0) + if ((cfdata->follower) && (!ib->conf->follower)) + { + ib->conf->follower = 1; + } + else if (!(cfdata->follower) && (ib->conf->follower)) + { + ib->conf->follower = 0; + } + + if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) { - cfdata->width = IBAR_WIDTH_FIXED; + ib->conf->width = IBAR_WIDTH_AUTO; } - else + else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) { - cfdata->width = IBAR_WIDTH_AUTO; + ib->conf->width = IBAR_WIDTH_FIXED; } - ib->conf->width = cfdata->width; - ib->conf->iconsize = cfdata->iconsize; - ib->conf->follow_speed = cfdata->follow_speed; - ib->conf->autoscroll_speed = cfdata->autoscroll_speed; + + if (cfdata->iconsize != ib->conf->iconsize) + { + ib->conf->iconsize = cfdata->iconsize; + } + if (cfdata->follow_speed != ib->conf->follow_speed) + { + ib->conf->follow_speed = cfdata->follow_speed; + } + if (cfdata->autoscroll_speed != ib->conf->autoscroll_speed) + { + ib->conf->autoscroll_speed = cfdata->autoscroll_speed; + } + e_border_button_bindings_grab_all(); e_config_save_queue(); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- e_mod_main.h 14 Dec 2005 23:08:07 -0000 1.25 +++ e_mod_main.h 17 Dec 2005 20:54:52 -0000 1.26 @@ -34,8 +34,6 @@ E_App *apps; Evas_List *bars; E_Menu *config_menu; - E_Menu *config_menu_options; - E_Menu *config_menu_size; Config *conf; }; ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs