From: <enl...@li...> - 2006-01-30 03:16:52
|
Enlightenment CVS committal Author : mej Project : e_modules Module : mount Dir : e_modules/mount Modified Files: e_mod_config.c e_mod_config.h e_mod_main.c e_mod_main.h Log Message: Sun Jan 29 22:16:32 2006 Michael Jennings (mej) Attempt #2 to get rid of tabs. ---------------------------------------------------------------------- =================================================================== RCS file: /cvsroot/enlightenment/e_modules/mount/e_mod_config.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- e_mod_config.c 30 Jan 2006 01:13:17 -0000 1.8 +++ e_mod_config.c 30 Jan 2006 03:16:41 -0000 1.9 @@ -5,154 +5,164 @@ typedef struct _Cfg_File_Data Cfg_File_Data; -struct _E_Config_Dialog_Data -{ - int iconsize; - int orientation; - int show_labels; +struct _E_Config_Dialog_Data { + int iconsize; + int orientation; + int show_labels; }; -struct _Cfg_File_Data -{ - E_Config_Dialog *cfd; - char *file; +struct _Cfg_File_Data { + E_Config_Dialog *cfd; + char *file; }; /* Protos */ -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(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 int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); -static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static void *_create_data(E_Config_Dialog * cfd); +static void _free_data(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 int _basic_apply_data(E_Config_Dialog * cfd, + E_Config_Dialog_Data * cfdata); +static Evas_Object *_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas, + E_Config_Dialog_Data * cfdata); +static int _advanced_apply_data(E_Config_Dialog * cfd, + E_Config_Dialog_Data * cfdata); -void -_config_mount_module(E_Container *con, Mount *m) +void +_config_mount_module(E_Container * con, Mount * m) { - E_Config_Dialog *cfd; + E_Config_Dialog *cfd; E_Config_Dialog_View *v; - + v = E_NEW(E_Config_Dialog_View, 1); - + 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, D_("Mount Configuration"), NULL, 0, v, m); + + cfd = e_config_dialog_new(con, _("Mount Configuration"), NULL, 0, v, m); m->config_dialog = cfd; } -static void -_fill_data(Mount *m, E_Config_Dialog_Data *cfdata) +static void +_fill_data(Mount * m, E_Config_Dialog_Data * cfdata) { cfdata->iconsize = m->conf->icon_size; cfdata->orientation = m->conf->orientation; cfdata->show_labels = m->conf->show_labels; } -static void * -_create_data(E_Config_Dialog *cfd) +static void * +_create_data(E_Config_Dialog * cfd) { E_Config_Dialog_Data *cfdata; - Mount *m; - + Mount *m; + m = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); return cfdata; } -static void -_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +static void +_free_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - Mount *m; - + Mount *m; + m = cfd->data; m->config_dialog = NULL; free(cfdata); } static Evas_Object * -_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) +_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas, + E_Config_Dialog_Data * cfdata) { - Evas_Object *o, *ob, *of; - E_Radio_Group *rg; - Mount *m; - + Evas_Object *o, *ob, *of; + E_Radio_Group *rg; + Mount *m; + m = cfd->data; _fill_data(m, cfdata); - + o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); - ob = e_widget_check_add(evas, D_("Show Labels"), &(cfdata->show_labels)); + ob = e_widget_check_add(evas, _("Show Labels"), &(cfdata->show_labels)); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, D_("Layout Settings"), 0); + of = e_widget_framelist_add(evas, _("Layout Settings"), 0); rg = e_widget_radio_group_new(&(cfdata->orientation)); - ob = e_widget_radio_add(evas, D_("Use Vertical Layout"), MOUNT_ORIENT_VERT, rg); + ob = e_widget_radio_add(evas, _("Use Vertical Layout"), MOUNT_ORIENT_VERT, + rg); e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, D_("Use Horizontal Layout"), MOUNT_ORIENT_HORIZ, rg); + ob = e_widget_radio_add(evas, _("Use Horizontal Layout"), MOUNT_ORIENT_HORIZ, + rg); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - + return o; } -static int -_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +static int +_basic_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - Mount *m; - + Mount *m; + m = cfd->data; e_border_button_bindings_ungrab_all(); m->conf->show_labels = cfdata->show_labels; m->conf->orientation = cfdata->orientation; e_config_save_queue(); e_border_button_bindings_grab_all(); - + _mount_cb_config_updated(m); return 1; } static Evas_Object * -_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) +_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas, + E_Config_Dialog_Data * cfdata) { - Evas_Object *o, *ob, *of; - E_Radio_Group *rg; - Mount *m; - + Evas_Object *o, *ob, *of; + E_Radio_Group *rg; + Mount *m; + m = cfd->data; _fill_data(m, cfdata); - + o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); - ob = e_widget_check_add(evas, D_("Show Labels"), &(cfdata->show_labels)); + ob = e_widget_check_add(evas, _("Show Labels"), &(cfdata->show_labels)); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, D_("Layout Settings"), 0); + of = e_widget_framelist_add(evas, _("Layout Settings"), 0); rg = e_widget_radio_group_new(&(cfdata->orientation)); - ob = e_widget_radio_add(evas, D_("Use Vertical Layout"), MOUNT_ORIENT_VERT, rg); + ob = e_widget_radio_add(evas, _("Use Vertical Layout"), MOUNT_ORIENT_VERT, + rg); e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, D_("Use Horizontal Layout"), MOUNT_ORIENT_HORIZ, rg); + ob = e_widget_radio_add(evas, _("Use Horizontal Layout"), MOUNT_ORIENT_HORIZ, + rg); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, D_("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); + + 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); - e_widget_list_object_append(o, of, 1, 1, 0.5); + e_widget_list_object_append(o, of, 1, 1, 0.5); return o; } -static int -_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +static int +_advanced_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - Mount *m; - + Mount *m; + m = cfd->data; e_border_button_bindings_ungrab_all(); m->conf->show_labels = cfdata->show_labels; @@ -160,7 +170,7 @@ m->conf->icon_size = cfdata->iconsize; e_config_save_queue(); e_border_button_bindings_grab_all(); - + _mount_cb_config_updated(m); return 1; } =================================================================== RCS file: /cvsroot/enlightenment/e_modules/mount/e_mod_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_config.h 8 Jan 2006 10:30:27 -0000 1.2 +++ e_mod_config.h 30 Jan 2006 03:16:41 -0000 1.3 @@ -3,6 +3,6 @@ #ifndef E_MOD_CONFIG_H #define E_MOD_CONFIG_h #include "e_mod_main.h" -void _config_mount_module(E_Container *con, Mount *m); +void _config_mount_module(E_Container * con, Mount * m); #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e_modules/mount/e_mod_main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_mod_main.c 30 Jan 2006 01:13:17 -0000 1.14 +++ e_mod_main.c 30 Jan 2006 03:16:41 -0000 1.15 @@ -7,58 +7,64 @@ #include "e_mod_config.h" #include "config.h" -static int bar_count; +static int bar_count; static Ecore_Event_Handler *_mount_exe_exit_handler = NULL; /* Private Module Routines Prototypes */ -static void _parse_fstab(Mount *mnt); -static int _parse_file(char *file, Mount_Point *mntpoint); -static void _setup_mountpoints(Mount *mnt); -static int _is_mounted(Mount_Point *mntpoint); - -static Mount *_mount_new(E_Module *m); -static int _mount_box_init(Mount_Box *mntbox); -static Mount_Icon *_mount_icon_new(Mount_Box *mntbox, Mount_Point *point); -static void _mount_mountpoint(Mount_Icon *mnticon); -static void _unmount_mountpoint(Mount_Icon *mnticon); -static void _eject_mountpoint(Mount_Icon *mnticon); -static void _mount_free(Mount *mnt); -static void _mount_box_free(Mount_Box *mntbox); -static void _mount_box_icon_free(Mount_Icon *mnticon); -static void _mount_config_menu_new(Mount *mnt); -static void _mount_box_menu_new(Mount_Box *mntbox); -static void _mount_box_disable(Mount_Box *mntbox); -static void _mount_box_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi); -static void _mount_box_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi); - -static void _mount_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _mount_box_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _mount_box_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); -static void _mount_icon_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _mount_icon_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); -static void _mount_box_iconsize_change(Mount_Box *mntbox); -static void _mount_box_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _change_orient_horiz(Mount *mnt); -static void _change_orient_vert(Mount *mnt); -static void _set_state(Mount_Icon *ic); -static void _mount_icon_cb_edje_mouse_down(void *data, Evas_Object *o, const char *emission, const char *source); -static int _mount_exe_cb_exit(void *data, int type, void *event); +static void _parse_fstab(Mount * mnt); +static int _parse_file(char *file, Mount_Point * mntpoint); +static void _setup_mountpoints(Mount * mnt); +static int _is_mounted(Mount_Point * mntpoint); + +static Mount *_mount_new(E_Module * m); +static int _mount_box_init(Mount_Box * mntbox); +static Mount_Icon *_mount_icon_new(Mount_Box * mntbox, Mount_Point * point); +static void _mount_mountpoint(Mount_Icon * mnticon); +static void _unmount_mountpoint(Mount_Icon * mnticon); +static void _eject_mountpoint(Mount_Icon * mnticon); +static void _mount_free(Mount * mnt); +static void _mount_box_free(Mount_Box * mntbox); +static void _mount_box_icon_free(Mount_Icon * mnticon); +static void _mount_config_menu_new(Mount * mnt); +static void _mount_box_menu_new(Mount_Box * mntbox); +static void _mount_box_disable(Mount_Box * mntbox); +static void _mount_box_cb_menu_edit(void *data, E_Menu * mn, + E_Menu_Item * mi); +static void _mount_box_cb_menu_configure(void *data, E_Menu * mn, + E_Menu_Item * mi); + +static void _mount_box_cb_gmc_change(void *data, E_Gadman_Client * gmc, + E_Gadman_Change change); +static void _mount_box_cb_intercept_move(void *data, Evas_Object * o, + Evas_Coord x, Evas_Coord y); +static void _mount_box_cb_intercept_resize(void *data, Evas_Object * o, + Evas_Coord w, Evas_Coord h); +static void _mount_icon_cb_intercept_move(void *data, Evas_Object * o, + Evas_Coord x, Evas_Coord y); +static void _mount_icon_cb_intercept_resize(void *data, Evas_Object * o, + Evas_Coord w, Evas_Coord h); +static void _mount_box_iconsize_change(Mount_Box * mntbox); +static void _mount_box_cb_mouse_down(void *data, Evas * e, + Evas_Object * obj, + void *event_info); +static void _change_orient_horiz(Mount * mnt); +static void _change_orient_vert(Mount * mnt); +static void _set_state(Mount_Icon * ic); +static void _mount_icon_cb_edje_mouse_down(void *data, Evas_Object * o, + const char *emission, + const char *source); +static int _mount_exe_cb_exit(void *data, int type, void *event); /* Begin Required Module Routines */ -EAPI E_Module_Api e_modapi = -{ +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, - "Mount" + "Mount" }; -EAPI void * -e_modapi_init(E_Module *m) +EAPI void * +e_modapi_init(E_Module * m) { - Mount *mnt; - - /* Set up module's message catalogue */ - bindtextdomain(PACKAGE, LOCALEDIR); - bind_textdomain_codeset(PACKAGE, "UTF-8"); + Mount *mnt; mnt = _mount_new(m); m->config_menu = mnt->config_menu; @@ -66,202 +72,207 @@ } EAPI int -e_modapi_shutdown(E_Module *m) +e_modapi_shutdown(E_Module * m) { - Mount *mnt; + Mount *mnt; mnt = m->data; if (mnt) { - if (m->config_menu) - { - e_menu_deactivate(m->config_menu); - e_object_del(E_OBJECT(m->config_menu)); - m->config_menu = NULL; - } - if (mnt->config_dialog) - { - e_object_del(E_OBJECT(mnt->config_dialog)); - mnt->config_dialog = NULL; - } - _mount_free(mnt); + if (m->config_menu) + { + e_menu_deactivate(m->config_menu); + e_object_del(E_OBJECT(m->config_menu)); + m->config_menu = NULL; + } + if (mnt->config_dialog) + { + e_object_del(E_OBJECT(mnt->config_dialog)); + mnt->config_dialog = NULL; + } + _mount_free(mnt); } return 1; } EAPI int -e_modapi_save(E_Module *m) +e_modapi_save(E_Module * m) { - Mount *mnt; + Mount *mnt; mnt = m->data; if (mnt) - e_config_domain_save("module.mount", mnt->conf_edd, mnt->conf); + e_config_domain_save("module.mount", mnt->conf_edd, mnt->conf); return 1; } EAPI int -e_modapi_info(E_Module *m) +e_modapi_info(E_Module * m) { m->icon_file = strdup(PACKAGE_DATA_DIR "/module_icon.png"); return 1; } EAPI int -e_modapi_about(E_Module *m) +e_modapi_about(E_Module * m) { - e_module_dialog_show(D_("Enlightenment Mount Module"), - D_("This is a mount module to mount/unmount devices.")); + e_module_dialog_show(_("Enlightenment Mount Module"), + _("This is a mount module to mount/unmount devices.")); return 1; } EAPI int -e_modapi_config(E_Module *m) +e_modapi_config(E_Module * m) { - Mount *mnt; + Mount *mnt; mnt = m->data; - if (mnt) _config_mount_module(mnt->con, mnt); + if (mnt) + _config_mount_module(mnt->con, mnt); return 1; } /* End Required Module Routines */ /* Begin Private Module Routines */ static void -_setup_mountpoints(Mount *mnt) +_setup_mountpoints(Mount * mnt) { - /* Parse fstab for user mountable devices*/ + /* Parse fstab for user mountable devices */ _parse_fstab(mnt); } static void -_parse_fstab(Mount *mnt) +_parse_fstab(Mount * mnt) { - FILE *f; - char s[1024]; - char *token = NULL; - char *info[4]; - int i, user_mnt; - char *p; - Mount_Point *point; + FILE *f; + char s[1024]; + char *token = NULL; + char *info[4]; + int i, user_mnt; + char *p; + Mount_Point *point; if ((f = fopen(FSTAB, "r")) == NULL) { - e_module_dialog_show(D_("Mount Module"), D_("Cannot Parse fstab")); - return; + e_module_dialog_show(_("Mount Module"), _("Cannot Parse fstab")); + return; } *s = 0; for (; fgets(s, sizeof(s), f);) { - /* skip comments and blank lines */ - if (!(*s) || (*s == '\n') || (*s == '#')) continue; - for (i = 0; i < 4; i++) - { - info[i] = NULL; - } - - /* parse tokens we need */ - i = 0; - token = strtok(s, " \t"); - if (token) info[i++] = strdup(token); - while ((token = strtok(NULL, " \t")) && (i < 4)) - info[i++] = strdup(token); - - /* see if device is mountable by user */ - user_mnt = 0; - p = info[3]; - while ((p = strstr(p, "user"))) - { - if (p != strstr(info[3], "user_xattr")) - { - user_mnt = 1; - break; - } - p++; - } - - if (user_mnt) - { - point = E_NEW(Mount_Point, 1); - if (!point) return; - point->device = strdup(info[0]); - point->path = strdup(info[1]); - if ((strstr(point->path, "cdrw")) || - (strstr(point->path, "cdrecorder"))) - { - point->part = strdup("cdrw"); - point->eject_mode = AUTO_EJECT; - } - else if (strstr(point->path, "hd")) - { - point->part = strdup("harddisk"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "cdrom")) - { - point->part = strdup("cdrom"); - point->eject_mode = AUTO_EJECT; - } - else if (strstr(point->path, "zip")) - { - point->part = strdup("zip"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "dvd")) - { - point->part = strdup("dvd"); - point->eject_mode = AUTO_EJECT; - } - else if (strstr(point->path, "floppy")) - { - point->part = strdup("floppy"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "usb")) - { - point->part = strdup("usb"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "stick")) - { - point->part = strdup("usb"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "psp")) - { - point->part = strdup("psp"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "ipod")) - { - point->part = strdup("ipod"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "camera")) - { - point->part = strdup("camera"); - point->eject_mode = MANUAL_EJECT; - } - else if (strstr(point->path, "smb")) - { - point->part = strdup("network"); - point->eject_mode = MANUAL_EJECT; - } - else - { - point->part = strdup("harddisk"); - point->eject_mode = MANUAL_EJECT; - } - point->mounted = _is_mounted(point); - mnt->mntpoints = evas_list_append(mnt->mntpoints, point); - } + /* skip comments and blank lines */ + if (!(*s) || (*s == '\n') || (*s == '#')) + continue; + for (i = 0; i < 4; i++) + { + info[i] = NULL; + } + + /* parse tokens we need */ + i = 0; + token = strtok(s, " \t"); + if (token) + info[i++] = strdup(token); + while ((token = strtok(NULL, " \t")) && (i < 4)) + info[i++] = strdup(token); + + /* see if device is mountable by user */ + user_mnt = 0; + p = info[3]; + while ((p = strstr(p, "user"))) + { + if (p != strstr(info[3], "user_xattr")) + { + user_mnt = 1; + break; + } + p++; + } + + if (user_mnt) + { + point = E_NEW(Mount_Point, 1); + if (!point) + return; + point->device = strdup(info[0]); + point->path = strdup(info[1]); + if ((strstr(point->path, "cdrw")) || + (strstr(point->path, "cdrecorder"))) + { + point->part = strdup("cdrw"); + point->eject_mode = AUTO_EJECT; + } + else if (strstr(point->path, "hd")) + { + point->part = strdup("harddisk"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "cdrom")) + { + point->part = strdup("cdrom"); + point->eject_mode = AUTO_EJECT; + } + else if (strstr(point->path, "zip")) + { + point->part = strdup("zip"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "dvd")) + { + point->part = strdup("dvd"); + point->eject_mode = AUTO_EJECT; + } + else if (strstr(point->path, "floppy")) + { + point->part = strdup("floppy"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "usb")) + { + point->part = strdup("usb"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "stick")) + { + point->part = strdup("usb"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "psp")) + { + point->part = strdup("psp"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "ipod")) + { + point->part = strdup("ipod"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "camera")) + { + point->part = strdup("camera"); + point->eject_mode = MANUAL_EJECT; + } + else if (strstr(point->path, "smb")) + { + point->part = strdup("network"); + point->eject_mode = MANUAL_EJECT; + } + else + { + point->part = strdup("harddisk"); + point->eject_mode = MANUAL_EJECT; + } + point->mounted = _is_mounted(point); + mnt->mntpoints = evas_list_append(mnt->mntpoints, point); + } } for (i = 0; i < 4; i++) { - if (info[i]) free(info[i]); + if (info[i]) + free(info[i]); } fclose(f); @@ -269,31 +280,36 @@ } static int -_parse_file(char *fl, Mount_Point *mntpoint) +_parse_file(char *fl, Mount_Point * mntpoint) { - FILE *f; - char s[1024]; - char *token = NULL; - char *device = NULL; - char *path = NULL; - int mounted; + FILE *f; + char s[1024]; + char *token = NULL; + char *device = NULL; + char *path = NULL; + int mounted; mounted = 0; - if ((f = fopen(fl, "r")) == NULL) return -1; + if ((f = fopen(fl, "r")) == NULL) + return -1; *s = 0; for (; fgets(s, sizeof(s), f);) { - /* skip comments */ - if (!(*s) || (*s == '\n') || (*s == '#')) continue; - token = strtok(s, " \t"); - if (token) device = strdup(token); - token = NULL; - token = strtok(NULL, " \t"); - if (token) path = strdup(token); - if (path) - { - if (!strcmp(mntpoint->path, path)) mounted = 1; - } + /* skip comments */ + if (!(*s) || (*s == '\n') || (*s == '#')) + continue; + token = strtok(s, " \t"); + if (token) + device = strdup(token); + token = NULL; + token = strtok(NULL, " \t"); + if (token) + path = strdup(token); + if (path) + { + if (!strcmp(mntpoint->path, path)) + mounted = 1; + } } fclose(f); free(device); @@ -302,40 +318,47 @@ } static int -_is_mounted(Mount_Point *mntpoint) +_is_mounted(Mount_Point * mntpoint) { - int mounted; + int mounted; /* Check proc mounts */ mounted = _parse_file(PROCMOUNTS, mntpoint); if (mounted <= 0) { - /* Check mtab */ - mounted = _parse_file(MTAB, mntpoint); - if (mounted <= 0) mounted = 0; + /* Check mtab */ + mounted = _parse_file(MTAB, mntpoint); + if (mounted <= 0) + mounted = 0; } return mounted; } static void -_mount_free(Mount *mnt) +_mount_free(Mount * mnt) { _mount_box_free(mnt->box); - if (mnt->config_menu_options) e_object_del(E_OBJECT(mnt->config_menu_options)); - if (mnt->config_menu_size) e_object_del(E_OBJECT(mnt->config_menu_size)); - if (mnt->config_menu) e_object_del(E_OBJECT(mnt->config_menu)); + if (mnt->config_menu_options) + e_object_del(E_OBJECT(mnt->config_menu_options)); + if (mnt->config_menu_size) + e_object_del(E_OBJECT(mnt->config_menu_size)); + if (mnt->config_menu) + e_object_del(E_OBJECT(mnt->config_menu)); while (mnt->mntpoints) { - Mount_Point *point; + Mount_Point *point; - point = mnt->mntpoints->data; - if (point->device) free(point->device); - if (point->path) free(point->path); - if (point->part) free(point->part); + point = mnt->mntpoints->data; + if (point->device) + free(point->device); + if (point->path) + free(point->path); + if (point->part) + free(point->part); - mnt->mntpoints = evas_list_remove_list(mnt->mntpoints, mnt->mntpoints); + mnt->mntpoints = evas_list_remove_list(mnt->mntpoints, mnt->mntpoints); } free(mnt->conf); @@ -345,20 +368,27 @@ } static void -_mount_box_free(Mount_Box *mntbox) +_mount_box_free(Mount_Box * mntbox) { - if (mntbox->con) e_object_unref(E_OBJECT(mntbox->con)); - if (mntbox->menu) e_object_del(E_OBJECT(mntbox->menu)); + if (mntbox->con) + e_object_unref(E_OBJECT(mntbox->con)); + if (mntbox->menu) + e_object_del(E_OBJECT(mntbox->menu)); while (mntbox->icons) - _mount_box_icon_free(mntbox->icons->data); + _mount_box_icon_free(mntbox->icons->data); - if (mntbox->bar_object) evas_object_del(mntbox->bar_object); - if (mntbox->box_object) evas_object_del(mntbox->box_object); - if (mntbox->event_object) evas_object_del(mntbox->event_object); - - if (mntbox->gmc) e_gadman_client_save(mntbox->gmc); - if (mntbox->gmc) e_object_del(E_OBJECT(mntbox->gmc)); + if (mntbox->bar_object) + evas_object_del(mntbox->bar_object); + if (mntbox->box_object) + evas_object_del(mntbox->box_object); + if (mntbox->event_object) + evas_object_del(mntbox->event_object); + + if (mntbox->gmc) + e_gadman_client_save(mntbox->gmc); + if (mntbox->gmc) + e_object_del(E_OBJECT(mntbox->gmc)); free(mntbox->conf); E_CONFIG_DD_FREE(mntbox->conf_box_edd); @@ -368,29 +398,35 @@ } static void -_mount_box_icon_free(Mount_Icon *mnticon) +_mount_box_icon_free(Mount_Icon * mnticon) { mnticon->mntbox->icons = evas_list_remove(mnticon->mntbox->icons, mnticon); - edje_object_signal_callback_del(mnticon->icon_object, "mouse,down,1", "icon", _mount_icon_cb_edje_mouse_down); - if (mnticon->bg_object) evas_object_del(mnticon->bg_object); - if (mnticon->icon_object) evas_object_del(mnticon->icon_object); - if (mnticon->overlay_object) evas_object_del(mnticon->overlay_object); - if (mnticon->txt_object) evas_object_del(mnticon->txt_object); + edje_object_signal_callback_del(mnticon->icon_object, "mouse,down,1", "icon", + _mount_icon_cb_edje_mouse_down); + if (mnticon->bg_object) + evas_object_del(mnticon->bg_object); + if (mnticon->icon_object) + evas_object_del(mnticon->icon_object); + if (mnticon->overlay_object) + evas_object_del(mnticon->overlay_object); + if (mnticon->txt_object) + evas_object_del(mnticon->txt_object); free(mnticon); } -static Mount * -_mount_new(E_Module *m) +static Mount * +_mount_new(E_Module * m) { - Mount *mnt; - Evas_List *managers, *l, *l2; + Mount *mnt; + Evas_List *managers, *l, *l2; bar_count = 0; /* Create New Mount Module Structure */ mnt = E_NEW(Mount, 1); - if (!mnt) return NULL; + if (!mnt) + return NULL; /* Setup Initial Module Config */ mnt->conf_edd = E_CONFIG_DD_NEW("Mount_Config", Config); @@ -407,16 +443,17 @@ mnt->conf = e_config_domain_load("module.mount", mnt->conf_edd); if (!mnt->conf) { - /* Create New Config */ - mnt->conf = E_NEW(Config, 1); - mnt->conf->icon_size = 24; - mnt->conf->orientation = MOUNT_ORIENT_HORIZ; - mnt->conf->show_labels = 1; + /* Create New Config */ + mnt->conf = E_NEW(Config, 1); + mnt->conf->icon_size = 24; + mnt->conf->orientation = MOUNT_ORIENT_HORIZ; + mnt->conf->show_labels = 1; } /* Set Config Limits */ E_CONFIG_LIMIT(mnt->conf->icon_size, 8, 128); - E_CONFIG_LIMIT(mnt->conf->orientation, MOUNT_ORIENT_VERT, MOUNT_ORIENT_HORIZ); + E_CONFIG_LIMIT(mnt->conf->orientation, MOUNT_ORIENT_VERT, + MOUNT_ORIENT_HORIZ); //E_CONFIG_LIMIT(mnt->conf->show_labels, 0, 1); /* Create New Config Menu */ @@ -429,71 +466,77 @@ for (l = managers; l; l = l->next) { - E_Manager *man; - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Mount_Box *mntbox; - E_Menu_Item *mi; - - con = l2->data; - mntbox = E_NEW(Mount_Box, 1); - if (mntbox) - { - mntbox->conf_box_edd = E_CONFIG_DD_NEW("Mount_Config_Box", Config_Box); + E_Manager *man; + + man = l->data; + for (l2 = man->containers; l2; l2 = l2->next) + { + E_Container *con; + Mount_Box *mntbox; + E_Menu_Item *mi; + + con = l2->data; + mntbox = E_NEW(Mount_Box, 1); + if (mntbox) + { + mntbox->conf_box_edd = + E_CONFIG_DD_NEW("Mount_Config_Box", Config_Box); #undef T #undef D #define T Config_Box #define D mntbox->conf_box_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); + E_CONFIG_VAL(D, T, enabled, UCHAR); - mntbox->con = con; - mntbox->evas = con->bg_evas; - mntbox->conf = E_NEW(Config_Box, 1); - mntbox->conf->enabled = 1; - mnt->box = mntbox; - mntbox->mnt = mnt; - - if (!_mount_box_init(mntbox)) return NULL; - _mount_box_menu_new(mntbox); - - mi = e_menu_item_new(mnt->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_menu_item_callback_set(mi, _mount_box_cb_menu_configure, mntbox); - - mi = e_menu_item_new(mnt->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, mntbox->menu); - - if (!mntbox->conf->enabled) _mount_box_disable(mntbox); - } - } + mntbox->con = con; + mntbox->evas = con->bg_evas; + mntbox->conf = E_NEW(Config_Box, 1); + mntbox->conf->enabled = 1; + mnt->box = mntbox; + mntbox->mnt = mnt; + + if (!_mount_box_init(mntbox)) + return NULL; + _mount_box_menu_new(mntbox); + + mi = e_menu_item_new(mnt->config_menu); + e_menu_item_label_set(mi, _("Configuration")); + e_menu_item_callback_set(mi, _mount_box_cb_menu_configure, + mntbox); + + mi = e_menu_item_new(mnt->config_menu); + e_menu_item_label_set(mi, con->name); + e_menu_item_submenu_set(mi, mntbox->menu); + + if (!mntbox->conf->enabled) + _mount_box_disable(mntbox); + } + } } return mnt; } static void -_mount_config_menu_new(Mount *mnt) +_mount_config_menu_new(Mount * mnt) { - E_Menu *mn; + E_Menu *mn; mn = e_menu_new(); mnt->config_menu = mn; } static int -_mount_box_init(Mount_Box *mntbox) +_mount_box_init(Mount_Box * mntbox) { - Evas_Object *o; - Evas_List *l; - E_Gadman_Policy policy; - Evas_Coord x, y, w, h; - char buffer[1024]; + Evas_Object *o; + Evas_List *l; + E_Gadman_Policy policy; + Evas_Coord x, y, w, h; + char buffer[1024]; - if (!mntbox) return 0; + if (!mntbox) + return 0; - snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR"/mount.edj"); + snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR "/mount.edj"); e_object_ref(E_OBJECT(mntbox->con)); @@ -503,8 +546,9 @@ o = edje_object_add(mntbox->evas); mntbox->bar_object = o; - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/main")) - edje_object_file_set(o, buffer, "modules/mount/main"); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/main")) + edje_object_file_set(o, buffer, "modules/mount/main"); evas_object_show(o); o = evas_object_rectangle_add(mntbox->evas); @@ -512,29 +556,32 @@ evas_object_layer_set(o, 2); evas_object_repeat_events_set(o, 1); evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mount_box_cb_mouse_down, mntbox); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _mount_box_cb_mouse_down, mntbox); evas_object_show(o); o = e_box_add(mntbox->evas); mntbox->box_object = o; - evas_object_intercept_move_callback_add(o, _mount_box_cb_intercept_move, mntbox); - evas_object_intercept_resize_callback_add(o, _mount_box_cb_intercept_resize, mntbox); + evas_object_intercept_move_callback_add(o, _mount_box_cb_intercept_move, + mntbox); + evas_object_intercept_resize_callback_add(o, _mount_box_cb_intercept_resize, + mntbox); e_box_freeze(o); edje_object_part_swallow(mntbox->bar_object, "items", o); evas_object_show(o); if (mntbox->mnt->mntpoints) { - for (l = mntbox->mnt->mntpoints; l; l = l->next) - { - /* Create New Icon */ - Mount_Icon *mnticon; - Mount_Point *point; - - point = l->data; - mnticon = _mount_icon_new(mntbox, point); - _set_state(mnticon); - } + for (l = mntbox->mnt->mntpoints; l; l = l->next) + { + /* Create New Icon */ + Mount_Icon *mnticon; + Mount_Point *point; + + point = l->data; + mnticon = _mount_icon_new(mntbox, point); + _set_state(mnticon); + } } mntbox->align_req = 0.5; @@ -548,9 +595,11 @@ edje_object_part_geometry_get(mntbox->bar_object, "items", &x, &y, &w, &h); o = edje_object_add(mntbox->evas); - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); edje_object_calc_force(o); edje_object_part_geometry_get(o, "item", &x, &y, &w, &h); mntbox->icon_inset.l = x; @@ -559,7 +608,8 @@ mntbox->icon_inset.b = mntbox->mnt->conf->icon_size - (y + h); evas_object_del(o); - policy = E_GADMAN_POLICY_ANYWHERE | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE; + policy = + E_GADMAN_POLICY_ANYWHERE | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE; mntbox->gmc = e_gadman_client_new(mntbox->con->gadman); e_gadman_client_domain_set(mntbox->gmc, "module.mount", bar_count++); e_gadman_client_policy_set(mntbox->gmc, policy); @@ -567,7 +617,8 @@ e_gadman_client_max_size_set(mntbox->gmc, 3200, 3200); e_gadman_client_align_set(mntbox->gmc, 0.5, 0.5); e_gadman_client_resize(mntbox->gmc, 400, 40); - e_gadman_client_change_func_set(mntbox->gmc, _mount_box_cb_gmc_change, mntbox); + e_gadman_client_change_func_set(mntbox->gmc, _mount_box_cb_gmc_change, + mntbox); e_gadman_client_load(mntbox->gmc); evas_event_thaw(mntbox->evas); @@ -575,21 +626,21 @@ _mount_box_iconsize_change(mntbox); if (mntbox->mnt->conf->orientation == MOUNT_ORIENT_HORIZ) { - _change_orient_horiz(mntbox->mnt); + _change_orient_horiz(mntbox->mnt); } else { - _change_orient_vert(mntbox->mnt); + _change_orient_vert(mntbox->mnt); } return 1; } static void -_mount_box_menu_new(Mount_Box *mntbox) +_mount_box_menu_new(Mount_Box * mntbox) { - E_Menu *mn; - E_Menu_Item *mi; + E_Menu *mn; + E_Menu_Item *mi; mn = e_menu_new(); mntbox->menu = mn; @@ -604,97 +655,112 @@ } static void -_mount_box_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) +_mount_box_cb_menu_configure(void *data, E_Menu * m, E_Menu_Item * mi) { - Mount_Box *mntbox; - Mount *mnt; + Mount_Box *mntbox; + Mount *mnt; mntbox = data; - if (!mntbox) return; + if (!mntbox) + return; mnt = mntbox->mnt; _config_mount_module(mnt->con, mnt); } static void -_mount_box_disable(Mount_Box *mntbox) +_mount_box_disable(Mount_Box * mntbox) { mntbox->conf->enabled = 0; - if (mntbox->bar_object) evas_object_hide(mntbox->bar_object); - if (mntbox->box_object) evas_object_hide(mntbox->box_object); - if (mntbox->event_object) evas_object_hide(mntbox->event_object); + if (mntbox->bar_object) + evas_object_hide(mntbox->bar_object); + if (mntbox->box_object) + evas_object_hide(mntbox->box_object); + if (mntbox->event_object) + evas_object_hide(mntbox->event_object); e_config_save_queue(); } static void -_mount_box_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi) +_mount_box_cb_menu_edit(void *data, E_Menu * mn, E_Menu_Item * mi) { - Mount_Box *mntbox; + Mount_Box *mntbox; mntbox = data; e_gadman_mode_set(mntbox->gmc->gadman, E_GADMAN_MODE_EDIT); } static void -_mount_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) +_mount_box_cb_gmc_change(void *data, E_Gadman_Client * gmc, + E_Gadman_Change change) { - Mount_Box *mntbox; + Mount_Box *mntbox; mntbox = data; switch (change) { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(mntbox->gmc, &mntbox->x, &mntbox->y, &mntbox->w, &mntbox->h); - edje_extern_object_min_size_set(mntbox->box_object, 0, 0); - edje_object_part_swallow(mntbox->bar_object, "items", mntbox->box_object); - - evas_object_move(mntbox->bar_object, mntbox->x, mntbox->y); - evas_object_move(mntbox->event_object, mntbox->x, mntbox->y); - evas_object_move(mntbox->box_object, mntbox->x, mntbox->y); - - evas_object_resize(mntbox->bar_object, mntbox->w, mntbox->h); - evas_object_resize(mntbox->event_object, mntbox->w, mntbox->h); - evas_object_resize(mntbox->box_object, mntbox->w, mntbox->h); - break; - case E_GADMAN_CHANGE_EDGE: - break; - case E_GADMAN_CHANGE_ZONE: - break; - case E_GADMAN_CHANGE_RAISE: - break; + case E_GADMAN_CHANGE_MOVE_RESIZE: + e_gadman_client_geometry_get(mntbox->gmc, &mntbox->x, &mntbox->y, + &mntbox->w, &mntbox->h); + edje_extern_object_min_size_set(mntbox->box_object, 0, 0); + edje_object_part_swallow(mntbox->bar_object, "items", + mntbox->box_object); + + evas_object_move(mntbox->bar_object, mntbox->x, mntbox->y); + evas_object_move(mntbox->event_object, mntbox->x, mntbox->y); + evas_object_move(mntbox->box_object, mntbox->x, mntbox->y); + + evas_object_resize(mntbox->bar_object, mntbox->w, mntbox->h); + evas_object_resize(mntbox->event_object, mntbox->w, mntbox->h); + evas_object_resize(mntbox->box_object, mntbox->w, mntbox->h); + break; + case E_GADMAN_CHANGE_EDGE: + break; + case E_GADMAN_CHANGE_ZONE: + break; + case E_GADMAN_CHANGE_RAISE: + break; } } -static Mount_Icon * -_mount_icon_new(Mount_Box *mntbox, Mount_Point *point) -{ - Mount_Icon *mnticon; - Evas_Object *o; - Evas_Coord w, h, x, y; - char buffer[1024]; +static Mount_Icon * +_mount_icon_new(Mount_Box * mntbox, Mount_Point * point) +{ + Mount_Icon *mnticon; + Evas_Object *o; + Evas_Coord w, h, x, y; + char buffer[1024]; mnticon = E_NEW(Mount_Icon, 1); - if (!mnticon) return NULL; + if (!mnticon) + return NULL; - snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR"/mount.edj"); + snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR "/mount.edj"); mnticon->mntbox = mntbox; mnticon->mntpoint = point; mntbox->icons = evas_list_append(mntbox->icons, mnticon); - o = edje_object_add(mntbox->evas); + o = edje_object_add(mntbox->evas); mnticon->bg_object = o; - evas_object_intercept_move_callback_add(o, _mount_icon_cb_intercept_move, mnticon); - evas_object_intercept_resize_callback_add(o, _mount_icon_cb_intercept_resize, mnticon); - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); + evas_object_intercept_move_callback_add(o, _mount_icon_cb_intercept_move, + mnticon); + evas_object_intercept_resize_callback_add(o, _mount_icon_cb_intercept_resize, + mnticon); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); evas_object_show(o); o = edje_object_add(mntbox->evas); mnticon->icon_object = o; - edje_extern_object_min_size_set(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); - edje_object_signal_callback_add(o, "mouse,down,1", "icon", _mount_icon_cb_edje_mouse_down, mnticon); + edje_extern_object_min_size_set(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); + edje_object_signal_callback_add(o, "mouse,down,1", "icon", + _mount_icon_cb_edje_mouse_down, mnticon); edje_object_part_swallow(mnticon->bg_object, "item", o); evas_object_show(o); @@ -707,34 +773,38 @@ o = edje_object_add(mntbox->evas); mnticon->txt_object = o; - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); evas_object_show(o); - - char *strip = strrchr(point->path, '/'); - if (!strip) + + char *strip = strrchr(point->path, '/'); + + if (!strip) { - strip = point->path; + strip = point->path; } - else + else { - strip++; + strip++; } - edje_object_part_text_set (o, "label", strip); + edje_object_part_text_set(o, "label", strip); if (mntbox->mnt->conf->show_labels) { - edje_object_signal_emit(o, "show_label", ""); + edje_object_signal_emit(o, "show_label", ""); } else { - edje_object_signal_emit(o, "hide_label", ""); + edje_object_signal_emit(o, "hide_label", ""); } edje_object_message_signal_process(o); o = edje_object_add(mntbox->evas); - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); edje_object_calc_force(o); edje_object_part_geometry_get(o, "item", &x, &y, &w, &h); mntbox->icon_inset.l = x; @@ -743,8 +813,10 @@ mntbox->icon_inset.b = mntbox->mnt->conf->icon_size - (y + h); evas_object_del(o); - w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + mntbox->icon_inset.r; - h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + mntbox->icon_inset.b; + w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + + mntbox->icon_inset.r; + h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + + mntbox->icon_inset.b; e_box_pack_end(mntbox->box_object, mnticon->bg_object); e_box_pack_options_set(mnticon->bg_object, 1, 1, 0, 0, 0.5, 0.5, w, h, w, h); @@ -753,127 +825,152 @@ } static void -_mount_box_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) +_mount_box_cb_intercept_move(void *data, Evas_Object * o, Evas_Coord x, + Evas_Coord y) { - Mount_Box *mntbox; + Mount_Box *mntbox; mntbox = data; evas_object_move(o, x, y); - if (mntbox->bar_object) evas_object_move(mntbox->bar_object, x, y); - if (mntbox->event_object) evas_object_move(mntbox->event_object, x, y); - if (mntbox->box_object) evas_object_move(mntbox->box_object, x, y); + if (mntbox->bar_object) + evas_object_move(mntbox->bar_object, x, y); + if (mntbox->event_object) + evas_object_move(mntbox->event_object, x, y); + if (mntbox->box_object) + evas_object_move(mntbox->box_object, x, y); } static void -_mount_box_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) +_mount_box_cb_intercept_resize(void *data, Evas_Object * o, Evas_Coord w, + Evas_Coord h) { - Mount_Box *mntbox; + Mount_Box *mntbox; mntbox = data; evas_object_resize(o, w, h); - if (mntbox->bar_object) evas_object_resize(mntbox->bar_object, w, h); - if (mntbox->event_object) evas_object_resize(mntbox->event_object, w, h); - if (mntbox->box_object) evas_object_resize(mntbox->box_object, w, h); + if (mntbox->bar_object) + evas_object_resize(mntbox->bar_object, w, h); + if (mntbox->event_object) + evas_object_resize(mntbox->event_object, w, h); + if (mntbox->box_object) + evas_object_resize(mntbox->box_object, w, h); } static void -_mount_icon_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) +_mount_icon_cb_intercept_move(void *data, Evas_Object * o, Evas_Coord x, + Evas_Coord y) { - Mount_Icon *mnticon; + Mount_Icon *mnticon; mnticon = data; evas_object_move(o, x, y); - if (mnticon->bg_object) evas_object_move(mnticon->bg_object, x, y); - if (mnticon->icon_object) evas_object_move(mnticon->icon_object, x, y); - if (mnticon->overlay_object) evas_object_move(mnticon->overlay_object, x, y); - if (mnticon->txt_object) evas_object_move(mnticon->txt_object, x, y); + if (mnticon->bg_object) + evas_object_move(mnticon->bg_object, x, y); + if (mnticon->icon_object) + evas_object_move(mnticon->icon_object, x, y); + if (mnticon->overlay_object) + evas_object_move(mnticon->overlay_object, x, y); + if (mnticon->txt_object) + evas_object_move(mnticon->txt_object, x, y); } static void -_mount_icon_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) +_mount_icon_cb_intercept_resize(void *data, Evas_Object * o, Evas_Coord w, + Evas_Coord h) { - Mount_Icon *mnticon; + Mount_Icon *mnticon; mnticon = data; evas_object_resize(o, w, h); - if (mnticon->bg_object) evas_object_resize(mnticon->bg_object, w, h); - if (mnticon->overlay_object) evas_object_resize(mnticon->overlay_object, w, h); - if (mnticon->icon_object) evas_object_resize(mnticon->icon_object, w, h); - if (mnticon->txt_object) evas_object_resize(mnticon->txt_object, w, h); + if (mnticon->bg_object) + evas_object_resize(mnticon->bg_object, w, h); + if (mnticon->overlay_object) + evas_object_resize(mnticon->overlay_object, w, h); + if (mnticon->icon_object) + evas_object_resize(mnticon->icon_object, w, h); + if (mnticon->txt_object) + evas_object_resize(mnticon->txt_object, w, h); } static void -_mount_box_iconsize_change(Mount_Box *mntbox) -{ - Evas_List *l; - Evas_Coord w, h, x, y; - char buffer[1024]; +_mount_box_iconsize_change(Mount_Box * mntbox) +{ + Evas_List *l; + Evas_Coord w, h, x, y; + char buffer[1024]; if ((mntbox->x == -1) || (mntbox->y == -1) || (mntbox->w == -1) || (mntbox->h == -1)) - return; + return; - snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR"/mount.edj"); + snprintf(buffer, sizeof(buffer), PACKAGE_DATA_DIR "/mount.edj"); evas_event_freeze(mntbox->evas); e_box_freeze(mntbox->box_object); for (l = mntbox->icons; l; l = l->next) { - Mount_Icon *ic; - Evas_Object *o; + Mount_Icon *ic; + Evas_Object *o; - ic = l->data; + ic = l->data; - o = ic->icon_object; - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); - edje_object_part_swallow(ic->bg_object, "item", o); - - o = ic->overlay_object; - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); - - o = edje_object_add(mntbox->evas); - if (!e_theme_edje_object_set(o, "base/theme/modules/mount", "modules/mount/icon")) - edje_object_file_set(o, buffer, "modules/mount/icon"); - evas_object_resize(o, mntbox->mnt->conf->icon_size, mntbox->mnt->conf->icon_size); - edje_object_calc_force(o); - edje_object_part_geometry_get(o, "item", &x, &y, &w, &h); - mntbox->icon_inset.l = x; - mntbox->icon_inset.r = mntbox->mnt->conf->icon_size - (x + w); - mntbox->icon_inset.t = y; - mntbox->icon_inset.b = mntbox->mnt->conf->icon_size - (y + h); - evas_object_del(o); - - w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + mntbox->icon_inset.r; - h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + mntbox->icon_inset.b; - - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.0, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); + o = ic->icon_object; + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); + edje_object_part_swallow(ic->bg_object, "item", o); + + o = ic->overlay_object; + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); + + o = edje_object_add(mntbox->evas); + if (!e_theme_edje_object_set + (o, "base/theme/modules/mount", "modules/mount/icon")) + edje_object_file_set(o, buffer, "modules/mount/icon"); + evas_object_resize(o, mntbox->mnt->conf->icon_size, + mntbox->mnt->conf->icon_size); + edje_object_calc_force(o); + edje_object_part_geometry_get(o, "item", &x, &y, &w, &h); + mntbox->icon_inset.l = x; + mntbox->icon_inset.r = mntbox->mnt->conf->icon_size - (x + w); + mntbox->icon_inset.t = y; + mntbox->icon_inset.b = mntbox->mnt->conf->icon_size - (y + h); + evas_object_del(o); + + w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + + mntbox->icon_inset.r; + h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + + mntbox->icon_inset.b; + + e_box_pack_options_set(ic->bg_object, 1, 1, /* fill */ + 0, 0, /* expand */ + 0.0, 0.5, /* align */ + w, h, /* min */ + w, h /* max */ + ); } e_box_thaw(mntbox->box_object); evas_event_thaw(mntbox->evas); if (mntbox->mnt->conf->orientation == MOUNT_ORIENT_VERT) { - e_gadman_client_resize(mntbox->gmc, w, (h * (evas_list_count(mntbox->icons)))); + e_gadman_client_resize(mntbox->gmc, w, + (h * (evas_list_count(mntbox->icons)))); } else { - e_gadman_client_resize(mntbox->gmc, (w * (evas_list_count(mntbox->icons))), h); + e_gadman_client_resize(mntbox->gmc, + (w * (evas_list_count(mntbox->icons))), h); } } static void -_change_orient_horiz(Mount *mnt) +_change_orient_horiz(Mount * mnt) { - Evas_List *l2; - Evas_Object *o; - Evas_Coord w, h; - Mount_Box *mntbox; + Evas_List *l2; + Evas_Object *o; + Evas_Coord w, h; + Mount_Box *mntbox; mntbox = mnt->box; evas_event_freeze(mntbox->evas); @@ -884,47 +981,49 @@ e_box_freeze(mntbox->box_object); - w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + mntbox->icon_inset.r; - h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + mntbox->icon_inset.b; + w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + + mntbox->icon_inset.r; + h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + + mntbox->icon_inset.b; for (l2 = mntbox->icons; l2; l2 = l2->next) { - Mount_Icon *ic; + Mount_Icon *ic; - ic = l2->data; - o = ic->bg_object; - edje_object_signal_emit(o, "set_orientation", "horiz"); - edje_object_message_signal_process(o); - - o = ic->icon_object; - edje_object_signal_emit(o, "set_orientation", "horiz"); - edje_object_message_signal_process(o); - - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); + ic = l2->data; + o = ic->bg_object; + edje_object_signal_emit(o, "set_orientation", "horiz"); + edje_object_message_signal_process(o); + + o = ic->icon_object; + edje_object_signal_emit(o, "set_orientation", "horiz"); + edje_object_message_signal_process(o); + + e_box_pack_options_set(ic->bg_object, 1, 1, /* fill */ + 0, 0, /* expand */ + 0.5, 0.5, /* align */ + w, h, /* min */ + w, h /* max */ + ); } e_box_align_set(mntbox->box_object, 0.5, 0.5); e_box_orientation_set(mntbox->box_object, 1); e_box_thaw(mntbox->box_object); evas_event_thaw(mntbox->evas); - e_gadman_client_resize(mntbox->gmc, (w * (evas_list_count(mntbox->icons))), h); + e_gadman_client_resize(mntbox->gmc, (w * (evas_list_count(mntbox->icons))), + h); _mount_box_iconsize_change(mntbox); } static void -_change_orient_vert(Mount *mnt) +_change_orient_vert(Mount * mnt) { - Evas_List *l2; - Evas_Object *o; - Evas_Coord w, h; - Mount_Box *mntbox; + Evas_List *l2; + Evas_Object *o; + Evas_Coord w, h; + Mount_Box *mntbox; mntbox = mnt->box; evas_event_freeze(mntbox->evas); @@ -935,145 +1034,159 @@ e_box_freeze(mntbox->box_object); - w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + mntbox->icon_inset.r; - h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + mntbox->icon_inset.b; + w = mntbox->mnt->conf->icon_size + mntbox->icon_inset.l + + mntbox->icon_inset.r; + h = mntbox->mnt->conf->icon_size + mntbox->icon_inset.t + + mntbox->icon_inset.b; for (l2 = mntbox->icons; l2; l2 = l2->next) { - Mount_Icon *ic; + Mount_Icon *ic; - ic = l2->data; - o = ic->bg_object; - edje_object_signal_emit(o, "set_orientation", "vert"); - edje_object_message_signal_process(o); - - o = ic->icon_object; - edje_object_signal_emit(o, "set_orientation", "vert"); - edje_object_message_signal_process(o); - - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); + ic = l2->data; + o = ic->bg_object; + edje_object_signal_emit(o, "set_orientation", "vert"); + edje_object_message_signal_process(o); + + o = ic->icon_object; + edje_object_signal_emit(o, "set_orientation", "vert"); + edje_object_message_signal_process(o); + + e_box_pack_options_set(ic->bg_object, 1, 1, /* fill */ + 0, 0, /* expand */ + 0.5, 0.5, /* align */ + w, h, /* min */ + w, h /* max */ + ); } e_box_align_set(mntbox->box_object, 0.5, 0.5); e_box_orientation_set(mntbox->box_object, 0); e_box_thaw(mntbox->box_object); evas_event_thaw(mntbox->evas); - e_gadman_client_resize(mntbox->gmc, w, (h * (evas_list_count(mntbox->icons)))); + e_gadman_client_resize(mntbox->gmc, w, + (h * (evas_list_count(mntbox->icons)))); _mount_box_iconsize_change(mntbox); } static void -_mount_mountpoint(Mount_Icon *mnticon) +_mount_mountpoint(Mount_Icon * mnticon) { - char buf[1024]; - Ecore_Exe *x; + char buf[1024]; + Ecore_Exe *x; fprintf(stderr, "Trying To Mount %s\n", mnticon->mntpoint->path); - snprintf(buf, sizeof(buf), MOUNT" %s", mnticon->mntpoint->p... [truncated message content] |