Enlightenment CVS committal Author : mej Project : e_modules Module : screenshot
Dir : e_modules/screenshot 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/screenshot/e_mod_config.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_mod_config.c 30 Jan 2006 01:10:07 -0000 1.11 +++ e_mod_config.c 30 Jan 2006 03:16:42 -0000 1.12 @@ -8,107 +8,106 @@ typedef struct _Cfg_File_Data Cfg_File_Data; -struct _E_Config_Dialog_Data -{ - Screen *screen; +struct _E_Config_Dialog_Data { + Screen *screen; /* Basic */ - int method; - int use_import; - int use_scrot; - double delay_time; - char *location; - char *filename; + int method; + int use_import; + int use_scrot; + double delay_time; + char *location; + char *filename; #ifdef HAVE_IMPORT - struct - { - int use_img_border; - int use_dither; - int use_frame; - int use_window; - int use_silent; - int use_trim; - } - import; + struct { + int use_img_border; + int use_dither; + int use_frame; + int use_window; + int use_silent; + int use_trim; + } import; #endif #ifdef HAVE_SCROT - struct - { - int use_img_border; - int use_count; - int use_window; - int use_thumb; - } - scrot; + struct { + int use_img_border; + int use_count; + int use_window; + int use_thumb; + } scrot; #endif }; -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); /* Config Calls */ -void -_config_screenshot_module(E_Container *con, Screen *s) +void +_config_screenshot_module(E_Container * con, Screen * s) { - E_Config_Dialog *cfd; + E_Config_Dialog *cfd; E_Config_Dialog_View *v; v = E_NEW(E_Config_Dialog_View, 1); - + /* 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->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; /* create config diaolg */ - cfd = e_config_dialog_new(con, D_("Screenshot Configuration"), NULL, 0, v, s); + cfd = e_config_dialog_new(con, _("Screenshot Configuration"), NULL, 0, v, s); s->config_dialog = cfd; } static void -_fill_data(Screen *sc, E_Config_Dialog_Data *cfdata) +_fill_data(Screen * sc, E_Config_Dialog_Data * cfdata) { if (sc->conf->use_import == 1) { - cfdata->method = S_METHOD_IMPORT; + cfdata->method = S_METHOD_IMPORT; } else if (sc->conf->use_scrot == 1) { - cfdata->method = S_METHOD_SCROT; + cfdata->method = S_METHOD_SCROT; } cfdata->delay_time = sc->conf->delay_time; if (sc->conf->location != NULL) { - cfdata->location = strdup(sc->conf->location); + cfdata->location = strdup(sc->conf->location); } else { - cfdata->location = NULL; + cfdata->location = NULL; } if (sc->conf->filename != NULL) { - cfdata->filename = strdup(sc->conf->filename); + cfdata->filename = strdup(sc->conf->filename); } else { - cfdata->filename = NULL; + cfdata->filename = NULL; } #ifdef HAVE_IMPORT @@ -127,22 +126,22 @@ #endif } -static void * -_create_data(E_Config_Dialog *cfd) +static void * +_create_data(E_Config_Dialog * cfd) { E_Config_Dialog_Data *cfdata; - Screen *s; - + Screen *s; + s = 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) +_free_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - Screen *s; - + Screen *s; + s = cfd->data; s->config_dialog = NULL; /* Free the cfdata */ @@ -150,15 +149,16 @@ } 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, *of, *ob, *ot; - E_Radio_Group *rg; - Screen *s; - + Evas_Object *o, *of, *ob, *ot; + E_Radio_Group *rg; + Screen *s; + s = cfd->data; _fill_data(s, cfdata); - + o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); @@ -166,40 +166,43 @@ #ifdef HAVE_IMPORT # ifdef HAVE_SCROT rg = e_widget_radio_group_new(&(cfdata->method)); - ob = e_widget_radio_add(evas, D_("Use Import"), S_METHOD_IMPORT, rg); + ob = e_widget_radio_add(evas, _("Use Import"), S_METHOD_IMPORT, rg); e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0); - ob = e_widget_radio_add(evas, D_("Use Scrot"), S_METHOD_SCROT, rg); + ob = e_widget_radio_add(evas, _("Use Scrot"), S_METHOD_SCROT, rg); e_widget_table_object_append(ot, ob, 0, 1, 1, 1, 1, 0, 1, 0); # endif #else /* Dont need to add an option as we only have one to use */ #endif - ob = e_widget_label_add(evas, D_("Delay Time:")); + ob = e_widget_label_add(evas, _("Delay Time:")); e_widget_table_object_append(ot, ob, 0, 2, 1, 1, 0, 0, 1, 0); - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 0.0, 60.0, 1.0, 0, &(cfdata->delay_time), NULL, 200); + ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 0.0, 60.0, 1.0, 0, + &(cfdata->delay_time), NULL, 200); e_widget_table_object_append(ot, ob, 1, 2, 1, 1, 1, 0, 1, 0); e_widget_framelist_object_append(of, ot); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, D_("File Settings"), 0); + of = e_widget_framelist_add(evas, _("File Settings"), 0); ot = e_widget_table_add(evas, 1); - ob = e_widget_label_add(evas, D_("Save Directory:")); + ob = e_widget_label_add(evas, _("Save Directory:")); e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 0, 0, 1, 0); ob = e_widget_entry_add(evas, &cfdata->location); e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 1, 0, 1, 0); - ob = e_widget_label_add(evas, D_("Filename (minus extension):")); + ob = e_widget_label_add(evas, _("Filename (minus extension):")); e_widget_table_object_append(ot, ob, 0, 1, 1, 1, 0, 0, 1, 0); ob = e_widget_entry_add(evas, &cfdata->filename); e_widget_table_object_append(ot, ob, 1, 1, 1, 1, 1, 0, 1, 0); - ob = e_widget_label_add(evas, D_("Example: screenshot%d = screenshot1, screenshot2, etc...")); + ob = e_widget_label_add(evas, + _ + ("Example: screenshot%d = screenshot1, screenshot2, etc...")); e_widget_table_object_append(ot, ob, 0, 2, 2, 1, 0, 0, 1, 0); e_widget_framelist_object_append(of, ot); @@ -209,27 +212,27 @@ } static int -_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +_basic_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - char tmp[4096]; - int length; - Screen *sc; - + char tmp[4096]; + int length; + Screen *sc; + sc = cfd->data; - + /* Actually take our cfdata settings and apply them in real life */ e_border_button_bindings_ungrab_all(); #ifdef HAVE_IMPORT # ifdef HAVE_SCROT if (cfdata->method == S_METHOD_IMPORT) { - sc->conf->use_import = 1; - sc->conf->use_scrot = 0; + sc->conf->use_import = 1; + sc->conf->use_scrot = 0; } else { - sc->conf->use_scrot = 1; - sc->conf->use_import = 0; + sc->conf->use_scrot = 1; + sc->conf->use_import = 0; } # else sc->conf->use_import = 1; @@ -245,37 +248,39 @@ if (cfdata->location == NULL) { - sc->conf->location = strdup(e_user_homedir_get()); + sc->conf->location = strdup(e_user_homedir_get()); } else { - snprintf(tmp, sizeof(tmp), "%s", strdup(cfdata->location)); - if (tmp[(length = strlen(tmp) - 1)] == '/') tmp[length] = '\0'; - sc->conf->location = strdup(tmp); + snprintf(tmp, sizeof(tmp), "%s", strdup(cfdata->location)); + if (tmp[(length = strlen(tmp) - 1)] == '/') + tmp[length] = '\0'; + sc->conf->location = strdup(tmp); } if (cfdata->filename != NULL) { - sc->conf->filename = strdup(cfdata->filename); + sc->conf->filename = strdup(cfdata->filename); } else { - sc->conf->filename = NULL; + sc->conf->filename = NULL; } sc->conf->delay_time = cfdata->delay_time; e_config_save_queue(); e_border_button_bindings_grab_all(); - return 1; /* Apply was OK */ + return 1; /* Apply was OK */ } 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, *ot; - E_Radio_Group *rg; - Screen *s; - + Evas_Object *o, *ob, *of, *ot; + E_Radio_Group *rg; + Screen *s; + s = cfd->data; _fill_data(s, cfdata); @@ -286,9 +291,9 @@ #ifdef HAVE_IMPORT # ifdef HAVE_SCROT rg = e_widget_radio_group_new(&(cfdata->method)); - ob = e_widget_radio_add(evas, D_("Use Import"), S_METHOD_IMPORT, rg); + ob = e_widget_radio_add(evas, _("Use Import"), S_METHOD_IMPORT, rg); e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0); - ob = e_widget_radio_add(evas, D_("Use Scrot"), S_METHOD_SCROT, rg); + ob = e_widget_radio_add(evas, _("Use Scrot"), S_METHOD_SCROT, rg); e_widget_table_object_append(ot, ob, 0, 1, 1, 1, 1, 0, 1, 0); # endif @@ -296,78 +301,88 @@ /* Dont need to add an option as we only have one to use */ #endif - ob = e_widget_label_add(evas, D_("Delay Time:")); + ob = e_widget_label_add(evas, _("Delay Time:")); e_widget_table_object_append(ot, ob, 0, 2, 1, 1, 0, 0, 1, 0); - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 0.0, 60.0, 1.0, 0, &(cfdata->delay_time), NULL, 200); + ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 0.0, 60.0, 1.0, 0, + &(cfdata->delay_time), NULL, 200); e_widget_table_object_append(ot, ob, 1, 2, 1, 1, 1, 0, 1, 0); e_widget_framelist_object_append(of, ot); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, D_("File Settings"), 0); + of = e_widget_framelist_add(evas, _("File Settings"), 0); ot = e_widget_table_add(evas, 1); - ob = e_widget_label_add(evas, D_("Save Directory:")); + ob = e_widget_label_add(evas, _("Save Directory:")); e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 0, 0, 1, 0); ob = e_widget_entry_add(evas, &cfdata->location); e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 1, 0, 1, 0); - ob = e_widget_label_add(evas, D_("Filename (minus extension):")); + ob = e_widget_label_add(evas, _("Filename (minus extension):")); e_widget_table_object_append(ot, ob, 0, 1, 1, 1, 0, 0, 1, 0); ob = e_widget_entry_add(evas, &cfdata->filename); e_widget_table_object_append(ot, ob, 1, 1, 1, 1, 1, 0, 1, 0); - ob = e_widget_label_add(evas, D_("Example: screenshot%d = screenshot1, screenshot2, etc...")); + ob = e_widget_label_add(evas, + _ + ("Example: screenshot%d = screenshot1, screenshot2, etc...")); e_widget_table_object_append(ot, ob, 0, 2, 2, 1, 0, 0, 1, 0); e_widget_framelist_object_append(of, ot); e_widget_list_object_append(o, of, 1, 1, 0.5); #ifdef HAVE_IMPORT - of = e_widget_framelist_add(evas, D_("Import Options"), 0); - ob = e_widget_check_add(evas, D_("Include Image Border"), &(cfdata->import.use_img_border)); + of = e_widget_framelist_add(evas, _("Import Options"), 0); + ob = e_widget_check_add(evas, _("Include Image Border"), + &(cfdata->import.use_img_border)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Use Image Dithering"), &(cfdata->import.use_dither)); + ob = e_widget_check_add(evas, _("Use Image Dithering"), + &(cfdata->import.use_dither)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Include Window Manager Frame"), &(cfdata->import.use_frame)); + ob = e_widget_check_add(evas, _("Include Window Manager Frame"), + &(cfdata->import.use_frame)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Choose Window To Grab"), &(cfdata->import.use_window)); + ob = e_widget_check_add(evas, _("Choose Window To Grab"), + &(cfdata->import.use_window)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Silent"), &(cfdata->import.use_silent)); + ob = e_widget_check_add(evas, _("Silent"), &(cfdata->import.use_silent)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Trim Edges"), &(cfdata->import.use_trim)); + ob = e_widget_check_add(evas, _("Trim Edges"), &(cfdata->import.use_trim)); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); #endif #ifdef HAVE_SCROT - of = e_widget_framelist_add(evas, D_("Scrot Options"), 0); - ob = e_widget_check_add(evas, D_("Include Image Border"), &(cfdata->scrot.use_img_border)); + of = e_widget_framelist_add(evas, _("Scrot Options"), 0); + ob = e_widget_check_add(evas, _("Include Image Border"), + &(cfdata->scrot.use_img_border)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Generate Thumbnail"), &(cfdata->scrot.use_thumb)); + ob = e_widget_check_add(evas, _("Generate Thumbnail"), + &(cfdata->scrot.use_thumb)); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); #endif - if (!o) return NULL; + if (!o) + return NULL; return o; } static int -_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +_advanced_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { - Screen *sc; - - sc = cfd->data; + Screen *sc; + + sc = cfd->data; _basic_apply_data(cfd, cfdata); e_border_button_bindings_ungrab_all(); #ifdef HAVE_IMPORT sc->conf->import.use_img_border = cfdata->import.use_img_border; sc->conf->import.use_dither = cfdata->import.use_dither; - sc->conf->import.use_frame = cfdata->import.use_frame; + sc->conf->import.use_frame = cfdata->import.use_frame; sc->conf->import.use_window = cfdata->import.use_window; sc->conf->import.use_silent = cfdata->import.use_silent; sc->conf->import.use_trim = cfdata->import.use_trim; @@ -382,5 +397,5 @@ e_config_save_queue(); e_border_button_bindings_grab_all(); - return 1; /* Apply was OK */ + return 1; /* Apply was OK */ } =================================================================== RCS file: /cvsroot/enlightenment/e_modules/screenshot/e_mod_config.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_mod_config.h 8 Jan 2006 10:31:41 -0000 1.3 +++ e_mod_config.h 30 Jan 2006 03:16:42 -0000 1.4 @@ -3,6 +3,6 @@ #ifndef E_MOD_CONFIG_H #define E_MOD_CONFIG_H #include "e_mod_main.h" -void _config_screenshot_module(E_Container *con, Screen *s); +void _config_screenshot_module(E_Container * con, Screen * s); #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e_modules/screenshot/e_mod_main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- e_mod_main.c 30 Jan 2006 01:10:07 -0000 1.18 +++ e_mod_main.c 30 Jan 2006 03:16:42 -0000 1.19 @@ -14,41 +14,42 @@ #include "e_mod_config.h" #include "config.h" -static int screen_count; +static int screen_count; static Ecore_Event_Handler *_screen_exe_exit_handler = NULL; -static Screen *_screen_init(E_Module *m); -static void _screen_config_menu_new(Screen *e); -static void _screen_shutdown(Screen *e); -static int _screen_exe_cb_exit(void *data, int type, void *event); -static int _screen_face_init(Screen_Face *sf); -static void _screen_face_free(Screen_Face *ef); -static void _screen_face_menu_new(Screen_Face *face); -static void _screen_face_enable(Screen_Face *face); -static void _screen_face_disable(Screen_Face *face); -static void _screen_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); -static void _screen_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj,void *event_info); -static void _screen_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _screen_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi); +static Screen *_screen_init(E_Module * m); +static void _screen_config_menu_new(Screen * e); +static void _screen_shutdown(Screen * e); +static int _screen_exe_cb_exit(void *data, int type, void *event); +static int _screen_face_init(Screen_Face * sf); +static void _screen_face_free(Screen_Face * ef); +static void _screen_face_menu_new(Screen_Face * face); +static void _screen_face_enable(Screen_Face * face); +static void _screen_face_disable(Screen_Face * face); +static void _screen_face_cb_menu_edit(void *data, E_Menu * m, + E_Menu_Item * mi); +static void _screen_face_cb_mouse_down(void *data, Evas * e, + Evas_Object * obj, + void *event_info); +static void _screen_face_cb_gmc_change(void *data, + E_Gadman_Client * gmc, + E_Gadman_Change change); +static void _screen_menu_cb_configure(void *data, E_Menu * m, + E_Menu_Item * mi); -char *get_options(char **opt); -char *get_filename(Config *conf); +char *get_options(char **opt); +char *get_filename(Config * conf); /* public module routines. all modules must have these */ -EAPI E_Module_Api e_modapi = -{ +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, - "Screenshot" + "Screenshot" }; -EAPI void * -e_modapi_init(E_Module *m) +EAPI void * +e_modapi_init(E_Module * m) { - Screen *e; - - /* Set up module's message catalogue */ - bindtextdomain(PACKAGE, LOCALEDIR); - bind_textdomain_codeset(PACKAGE, "UTF-8"); + Screen *e; /* actually init screen */ e = _screen_init(m); @@ -57,81 +58,84 @@ return e; } -EAPI int -e_modapi_shutdown(E_Module *m) +EAPI int +e_modapi_shutdown(E_Module * m) { - Screen *s; + Screen *s; s = m->data; if (s) { - if (m->config_menu) - { - e_menu_deactivate(m->config_menu); - e_object_del(E_OBJECT(m->config_menu)); - m->config_menu = NULL; - } - if (s->config_dialog) - { - e_object_del(E_OBJECT(s->config_dialog)); - s->config_dialog = NULL; - } - _screen_shutdown(s); + if (m->config_menu) + { + e_menu_deactivate(m->config_menu); + e_object_del(E_OBJECT(m->config_menu)); + m->config_menu = NULL; + } + if (s->config_dialog) + { + e_object_del(E_OBJECT(s->config_dialog)); + s->config_dialog = NULL; + } + _screen_shutdown(s); } return 1; } -EAPI int -e_modapi_save(E_Module *m) +EAPI int +e_modapi_save(E_Module * m) { - Screen *e; + Screen *e; e = m->data; if (e) - e_config_domain_save("module.screenshot", e->conf_edd, e->conf); + e_config_domain_save("module.screenshot", e->conf_edd, e->conf); return 1; } -EAPI int -e_modapi_info(E_Module *m) +EAPI int +e_modapi_info(E_Module * m) { - m->icon_file = strdup(PACKAGE_DATA_DIR"/module_icon.png"); + m->icon_file = strdup(PACKAGE_DATA_DIR "/module_icon.png"); return 1; } -EAPI int -e_modapi_about(E_Module *m) +EAPI int +e_modapi_about(E_Module * m) { - e_module_dialog_show(D_("Enlightenment Screenshot Module"), - D_("This module is used to take screenshots")); + e_module_dialog_show(_("Enlightenment Screenshot Module"), + ("This module is used to take screenshots")); return 1; } EAPI int -e_modapi_config(E_Module *m) +e_modapi_config(E_Module * m) { - Screen *s; - E_Container *con; - + Screen *s; + E_Container *con; + s = m->data; - if (!s) return 0; - if (!s->face) return 0; + if (!s) + return 0; + if (!s->face) + return 0; con = e_container_current_get(e_manager_current_get()); if (s->face->con == con) - _config_screenshot_module(con, s); + _config_screenshot_module(con, s); return 1; } -static Screen * -_screen_init(E_Module *m) +static Screen * +_screen_init(E_Module * m) { - Screen *e; - E_Menu_Item *mi; - Evas_List *managers, *l, *l2; + Screen *e; + E_Menu_Item *mi; + Evas_List *managers, *l, *l2; e = E_NEW(Screen, 1); - if (!e) return NULL; + if (!e) + return NULL; e->conf_edd = E_CONFIG_DD_NEW("Screen_Config", Config); #undef T @@ -161,40 +165,40 @@ e->conf = e_config_domain_load("module.screenshot", e->conf_edd); if (!e->conf) { - e->conf = E_NEW(Config, 1); - e->conf->delay_time = 60; + e->conf = E_NEW(Config, 1); + e->conf->delay_time = 60; #ifdef HAVE_IMPORT # ifdef HAVE_SCROT - e->conf->use_import = 0; - e->conf->use_scrot = 1; + e->conf->use_import = 0; + e->conf->use_scrot = 1; # else - e->conf->use_import = 1; - e->conf->use_scrot = 0; + e->conf->use_import = 1; + e->conf->use_scrot = 0; # endif #else - e->conf->use_import = 0; + e->conf->use_import = 0; # ifdef HAVE_SCROT - e->conf->use_scrot = 1; + e->conf->use_scrot = 1; # else - e->conf->use_scrot = 0; + e->conf->use_scrot = 0; # endif #endif - e->conf->location = (char *)evas_stringshare_add(e_user_homedir_get()); - e->conf->filename = (char *)evas_stringshare_add(""); + e->conf->location = (char *)evas_stringshare_add(e_user_homedir_get()); + e->conf->filename = (char *)evas_stringshare_add(""); #ifdef HAVE_IMPORT - e->conf->import.use_img_border = 1; - e->conf->import.use_dither = 1; - e->conf->import.use_frame = 1; - e->conf->import.use_mono = 0; - e->conf->import.use_window = 0; - e->conf->import.use_silent = 1; - e->conf->import.use_trim = 1; + e->conf->import.use_img_border = 1; + e->conf->import.use_dither = 1; + e->conf->import.use_frame = 1; + e->conf->import.use_mono = 0; + e->conf->import.use_window = 0; + e->conf->import.use_silent = 1; + e->conf->import.use_trim = 1; #endif #ifdef HAVE_SCROT - e->conf->scrot.use_img_border = 1; - e->conf->scrot.use_count = 0; - e->conf->scrot.use_window = 0; - e->conf->scrot.use_thumb = 0; + e->conf->scrot.use_img_border = 1; + e->conf->scrot.use_count = 0; + e->conf->scrot.use_window = 0; + e->conf->scrot.use_thumb = 0; #endif } @@ -203,100 +207,105 @@ _screen_config_menu_new(e); /* Managers */ - managers = e_manager_list (); + managers = e_manager_list(); for (l = managers; l; l = l->next) { - E_Manager *man; + E_Manager *man; - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Screen_Face *ef; - - con = l2->data; - ef = E_NEW(Screen_Face, 1); - if (ef) - { - ef->conf_face_edd = E_CONFIG_DD_NEW("Screen_Config_Face", Config_Face); + man = l->data; + for (l2 = man->containers; l2; l2 = l2->next) + { + E_Container *con; + Screen_Face *ef; + + con = l2->data; + ef = E_NEW(Screen_Face, 1); + if (ef) + { + ef->conf_face_edd = + E_CONFIG_DD_NEW("Screen_Config_Face", Config_Face); #undef T #undef D #define T Config_Face #define D ef->conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); + E_CONFIG_VAL(D, T, enabled, UCHAR); - e->face = ef; - ef->screen = e; - ef->con = con; - ef->evas = con->bg_evas; - - ef->conf = E_NEW(Config_Face, 1); - ef->conf->enabled = 1; - - if (!_screen_face_init(ef)) return NULL; - - /* This menu must be initialized after conf */ - _screen_face_menu_new(ef); - - /* Add main menu to face menu */ - mi = e_menu_item_new(e->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_menu_item_callback_set(mi, _screen_menu_cb_configure, ef); - - mi = e_menu_item_new(e->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, ef->menu); - - /* Setup */ - if (!ef->conf->enabled) - { - _screen_face_disable(ef); - } - else - { - _screen_face_enable(ef); - } - } - } + e->face = ef; + ef->screen = e; + ef->con = con; + ef->evas = con->bg_evas; + + ef->conf = E_NEW(Config_Face, 1); + ef->conf->enabled = 1; + + if (!_screen_face_init(ef)) + return NULL; + + /* This menu must be initialized after conf */ + _screen_face_menu_new(ef); + + /* Add main menu to face menu */ + mi = e_menu_item_new(e->config_menu); + e_menu_item_label_set(mi, _("Configuration")); + e_menu_item_callback_set(mi, _screen_menu_cb_configure, ef); + + mi = e_menu_item_new(e->config_menu); + e_menu_item_label_set(mi, con->name); + e_menu_item_submenu_set(mi, ef->menu); + + /* Setup */ + if (!ef->conf->enabled) + { + _screen_face_disable(ef); + } + else + { + _screen_face_enable(ef); + } + } + } } return e; } -static void -_screen_shutdown(Screen *e) +static void +_screen_shutdown(Screen * e) { _screen_face_free(e->face); - if (e->conf->location) evas_stringshare_del(e->conf->location); - if (e->conf->filename) evas_stringshare_del(e->conf->filename); + if (e->conf->location) + evas_stringshare_del(e->conf->location); + if (e->conf->filename) + evas_stringshare_del(e->conf->filename); free(e->conf); E_CONFIG_DD_FREE(e->conf_edd); free(e); } -static void -_screen_config_menu_new(Screen *e) +static void +_screen_config_menu_new(Screen * e) { - E_Menu *mn; + E_Menu *mn; mn = e_menu_new(); e->config_menu = mn; } -static int -_screen_face_init(Screen_Face *sf) +static int +_screen_face_init(Screen_Face * sf) { - Evas_Object *o; - char buff[4096]; - + Evas_Object *o; + char buff[4096]; + evas_event_freeze(sf->evas); o = edje_object_add(sf->evas); sf->screen_object = o; - snprintf(buff, sizeof(buff), PACKAGE_DATA_DIR"/screenshot.edj"); - if (!e_theme_edje_object_set(o, "base/theme/modules/screenshot","modules/screenshot/main")) - edje_object_file_set(o, buff, "modules/screenshot/main"); + snprintf(buff, sizeof(buff), PACKAGE_DATA_DIR "/screenshot.edj"); + if (!e_theme_edje_object_set + (o, "base/theme/modules/screenshot", "modules/screenshot/main")) + edje_object_file_set(o, buff, "modules/screenshot/main"); edje_object_signal_emit(o, "passive", ""); evas_object_show(o); @@ -305,13 +314,16 @@ 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,_screen_face_cb_mouse_down, sf); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _screen_face_cb_mouse_down, sf); evas_object_show(o); sf->gmc = e_gadman_client_new(sf->con->gadman); e_gadman_client_domain_set(sf->gmc, "module.screenshot", screen_count++); - e_gadman_client_policy_set(sf->gmc,E_GADMAN_POLICY_ANYWHERE | E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VSIZE); + e_gadman_client_policy_set(sf->gmc, + E_GADMAN_POLICY_ANYWHERE | E_GADMAN_POLICY_HMOVE | + E_GADMAN_POLICY_VMOVE | E_GADMAN_POLICY_HSIZE | + E_GADMAN_POLICY_VSIZE); e_gadman_client_min_size_set(sf->gmc, 4, 4); e_gadman_client_max_size_set(sf->gmc, 128, 128); e_gadman_client_auto_size_set(sf->gmc, 40, 40); @@ -325,25 +337,30 @@ return 1; } -static void -_screen_face_free(Screen_Face *ef) +static void +_screen_face_free(Screen_Face * ef) { - if (ef->menu) e_object_del(E_OBJECT(ef->menu)); - if (ef->event_object) evas_object_del(ef->event_object); - if (ef->screen_object) evas_object_del(ef->screen_object); - if (ef->gmc) e_gadman_client_save(ef->gmc); - if (ef->gmc) e_object_del(E_OBJECT(ef->gmc)); + if (ef->menu) + e_object_del(E_OBJECT(ef->menu)); + if (ef->event_object) + evas_object_del(ef->event_object); + if (ef->screen_object) + evas_object_del(ef->screen_object); + if (ef->gmc) + e_gadman_client_save(ef->gmc); + if (ef->gmc) + e_object_del(E_OBJECT(ef->gmc)); E_FREE(ef->conf); E_FREE(ef); screen_count--; } -static void -_screen_face_menu_new(Screen_Face *face) +static void +_screen_face_menu_new(Screen_Face * face) { - E_Menu *mn; - E_Menu_Item *mi; + E_Menu *mn; + E_Menu_Item *mi; mn = e_menu_new(); face->menu = mn; @@ -358,8 +375,8 @@ e_menu_item_callback_set(mi, _screen_face_cb_menu_edit, face); } -static void -_screen_face_enable(Screen_Face *face) +static void +_screen_face_enable(Screen_Face * face) { face->conf->enabled = 1; e_config_save_queue(); @@ -367,8 +384,8 @@ evas_object_show(face->event_object); } -static void -_screen_face_disable(Screen_Face *face) +static void +_screen_face_disable(Screen_Face * face) { face->conf->enabled = 0; e_config_save_queue(); @@ -376,241 +393,262 @@ evas_object_hide(face->event_object); } -static void -_screen_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) +static void +_screen_face_cb_gmc_change(void *data, E_Gadman_Client * gmc, + E_Gadman_Change change) { - Screen_Face *ef; - Evas_Coord x, y, w, h; + Screen_Face *ef; + Evas_Coord x, y, w, h; ef = data; switch (change) { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(ef->gmc, &x, &y, &w, &h); - evas_object_move(ef->screen_object, x, y); - evas_object_move(ef->event_object, x, y); - evas_object_resize(ef->screen_object, w, h); - evas_object_resize(ef->event_object, w, h); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(ef->screen_object); - evas_object_raise(ef->event_object); - break; - case E_GADMAN_CHANGE_EDGE: - break; - case E_GADMAN_CHANGE_ZONE: - break; + case E_GADMAN_CHANGE_MOVE_RESIZE: + e_gadman_client_geometry_get(ef->gmc, &x, &y, &w, &h); + evas_object_move(ef->screen_object, x, y); + evas_object_move(ef->event_object, x, y); + evas_object_resize(ef->screen_object, w, h); + evas_object_resize(ef->event_object, w, h); + break; + case E_GADMAN_CHANGE_RAISE: + evas_object_raise(ef->screen_object); + evas_object_raise(ef->event_object); + break; + case E_GADMAN_CHANGE_EDGE: + break; + case E_GADMAN_CHANGE_ZONE: + break; } } -static void -_screen_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj,void *event_info) +static void +_screen_face_cb_mouse_down(void *data, Evas * e, Evas_Object * obj, + void *event_info) { - Ecore_Exe *x; + Ecore_Exe *x; Evas_Event_Mouse_Down *ev; Edje_Message_Int_Set *msg; - Screen_Face *ef; - char buff[1024]; - char *opts[8] = {'\0','\0','\0','\0','\0','\0','\0','\0'}; - char *opt; - char *f; + Screen_Face *ef; + char buff[1024]; + char *opts[8] = + { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' }; + char *opt; + char *f; ev = event_info; ef = data; if (ev->button == 3) { - e_menu_activate_mouse(ef->menu, e_zone_current_get(ef->con), ev->output.x, ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_all_later(ef->con); + e_menu_activate_mouse(ef->menu, e_zone_current_get(ef->con), + ev->output.x, ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + e_util_container_fake_mouse_up_all_later(ef->con); } else if (ev->button == 1) { - /* Take Shot */ - if (ef->screen->conf->use_import == 1) - { - if (ef->screen->conf->import.use_img_border == 1) - opts[0] = strdup("-border"); - if (ef->screen->conf->import.use_dither == 1) - opts[1] = strdup("-dither"); - if (ef->screen->conf->import.use_frame == 1) - opts[2] = strdup("-frame"); - if (ef->screen->conf->import.use_mono == 1) - opts[3] = strdup("-mono"); - if (ef->screen->conf->import.use_silent == 1) - opts[4] = strdup("-silent"); - if (ef->screen->conf->import.use_trim == 1) - opts[5] = strdup("-trim"); - if (ef->screen->conf->import.use_window != 1) - opts[6] = strdup("-window root"); - if (ef->screen->conf->delay_time > 0) - { - snprintf(buff, sizeof(buff), "-pause %d", ef->screen->conf->delay_time); - opts[7] = strdup(buff); - } - opt = get_options(opts); - f = get_filename(ef->screen->conf); - - snprintf(buff, sizeof(buff), "import %s %s", opt, f); - if (ef->screen->conf->delay_time > 0) - { - msg = malloc(sizeof(Edje_Message_Int_Set) + 1 * sizeof(int)); - msg->count = 1; - msg->val[0] = ef->screen->conf->delay_time - 1; - edje_object_message_send(ef->screen_object, EDJE_MESSAGE_INT_SET, 1, msg); - free(msg); - } - - _screen_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _screen_exe_cb_exit, NULL); - x = ecore_exe_run(buff, ef); - } - else if (ef->screen->conf->use_scrot == 1) - { - if (ef->screen->conf->scrot.use_img_border == 1) - opts[0] = strdup("--border"); - if (ef->screen->conf->scrot.use_thumb == 1) - opts[1] = strdup("--thumb 25"); - if (ef->screen->conf->delay_time > 0) - { - snprintf(buff, sizeof(buff), "--delay %d", ef->screen->conf->delay_time); - opts[2] = strdup(buff); - } - opt = get_options(opts); - f = get_filename(ef->screen->conf); - snprintf(buff, sizeof(buff), "scrot %s %s", opt, f); - if (ef->screen->conf->delay_time > 0) - { - msg = malloc(sizeof(Edje_Message_Int_Set) + 1 * sizeof(int)); - msg->count = 1; - msg->val[0] = ef->screen->conf->delay_time - 1; - edje_object_message_send(ef->screen_object, EDJE_MESSAGE_INT_SET, 1, msg); - free(msg); - } - - _screen_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _screen_exe_cb_exit, NULL); - x = ecore_exe_run(buff, ef); - } - else - { - e_module_dialog_show(D_("Enlightenment Screenshot Module"), - D_("Please Choose A Program To Use For Taking Screenshots.")); - return; - } + /* Take Shot */ + if (ef->screen->conf->use_import == 1) + { + if (ef->screen->conf->import.use_img_border == 1) + opts[0] = strdup("-border"); + if (ef->screen->conf->import.use_dither == 1) + opts[1] = strdup("-dither"); + if (ef->screen->conf->import.use_frame == 1) + opts[2] = strdup("-frame"); + if (ef->screen->conf->import.use_mono == 1) + opts[3] = strdup("-mono"); + if (ef->screen->conf->import.use_silent == 1) + opts[4] = strdup("-silent"); + if (ef->screen->conf->import.use_trim == 1) + opts[5] = strdup("-trim"); + if (ef->screen->conf->import.use_window != 1) + opts[6] = strdup("-window root"); + if (ef->screen->conf->delay_time > 0) + { + snprintf(buff, sizeof(buff), "-pause %d", + ef->screen->conf->delay_time); + opts[7] = strdup(buff); + } + opt = get_options(opts); + f = get_filename(ef->screen->conf); + + snprintf(buff, sizeof(buff), "import %s %s", opt, f); + if (ef->screen->conf->delay_time > 0) + { + msg = malloc(sizeof(Edje_Message_Int_Set) + 1 * sizeof(int)); + msg->count = 1; + msg->val[0] = ef->screen->conf->delay_time - 1; + edje_object_message_send(ef->screen_object, + EDJE_MESSAGE_INT_SET, 1, msg); + free(msg); + } + + _screen_exe_exit_handler = + ecore_event_handler_add(ECORE_EXE_EVENT_DEL, + _screen_exe_cb_exit, NULL); + x = ecore_exe_run(buff, ef); + } + else if (ef->screen->conf->use_scrot == 1) + { + if (ef->screen->conf->scrot.use_img_border == 1) + opts[0] = strdup("--border"); + if (ef->screen->conf->scrot.use_thumb == 1) + opts[1] = strdup("--thumb 25"); + if (ef->screen->conf->delay_time > 0) + { + snprintf(buff, sizeof(buff), "--delay %d", + ef->screen->conf->delay_time); + opts[2] = strdup(buff); + } + opt = get_options(opts); + f = get_filename(ef->screen->conf); + snprintf(buff, sizeof(buff), "scrot %s %s", opt, f); + if (ef->screen->conf->delay_time > 0) + { + msg = malloc(sizeof(Edje_Message_Int_Set) + 1 * sizeof(int)); + msg->count = 1; + msg->val[0] = ef->screen->conf->delay_time - 1; + edje_object_message_send(ef->screen_object, + EDJE_MESSAGE_INT_SET, 1, msg); + free(msg); + } + + _screen_exe_exit_handler = + ecore_event_handler_add(ECORE_EXE_EVENT_DEL, + _screen_exe_cb_exit, NULL); + x = ecore_exe_run(buff, ef); + } + else + { + e_module_dialog_show(_("Enlightenment Screenshot Module"), + _ + ("Please Choose A Program To Use For Taking Screenshots.")); + return; + } } } -static void -_screen_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) +static void +_screen_face_cb_menu_edit(void *data, E_Menu * m, E_Menu_Item * mi) { - Screen_Face *face; + Screen_Face *face; face = data; e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT); } -char * +char * get_options(char **opt) { - int i, j; - char buff[1024]; + int i, j; + char buff[1024]; j = 0; - for (i = 0; i <=7; i++) + for (i = 0; i <= 7; i++) { - if (opt[i] != '\0') - { - if (j == 0) - { - snprintf(buff, sizeof(buff), "%s", opt[i]); - j++; - } - else - { - snprintf(buff, sizeof(buff), "%s %s", strdup(buff), opt[i]); - } - } + if (opt[i] != '\0') + { + if (j == 0) + { + snprintf(buff, sizeof(buff), "%s", opt[i]); + j++; + } + else + { + snprintf(buff, sizeof(buff), "%s %s", strdup(buff), opt[i]); + } + } } return strdup(buff); } -char * -get_filename(Config *conf) +char * +get_filename(Config * conf) { - char buff[256]; - time_t t; - struct tm *loctime; - Ecore_List *fl = NULL; - int c = 0; - char *file, *x; + char buff[256]; + time_t t; + struct tm *loctime; + Ecore_List *fl = NULL; + int c = 0; + char *file, *x; /* Get Location */ if (!conf->location) { - conf->location = (char *)evas_stringshare_add(e_user_homedir_get()); - e_config_save_queue(); + conf->location = (char *)evas_stringshare_add(e_user_homedir_get()); + e_config_save_queue(); } if (!conf->filename) { - t = time(NULL); - loctime = localtime(&t); - strftime(buff, sizeof(buff), "%Y-%m-%d-%H%M%S", loctime); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); + t = time(NULL); + loctime = localtime(&t); + strftime(buff, sizeof(buff), "%Y-%m-%d-%H%M%S", loctime); + snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), + strdup(buff)); } else { - /* Parse File Name For %d */ - if (strstr(conf->filename, "%d")) - { - /* Get File Count In Location */ - if (ecore_file_is_dir(conf->location)) - { - fl = ecore_file_ls(conf->location); - ecore_list_goto_first(fl); - x = strtok(strdup(conf->filename), "%d"); - while ((file = ecore_list_next(fl)) != NULL) - { - if (strstr(file, x)) c++; - } - if (fl) ecore_list_destroy(fl); - if (c == 0) - { - c = 1; - } - else - { - c++; - } - /* Add To Filename */ - snprintf(buff, sizeof(buff), strdup(conf->filename), c); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); - } - } - else - { - snprintf(buff, sizeof(buff), strdup(conf->filename)); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); - } - } - if (buff) - { - return strdup(buff); + /* Parse File Name For %d */ + if (strstr(conf->filename, "%d")) + { + /* Get File Count In Location */ + if (ecore_file_is_dir(conf->location)) + { + fl = ecore_file_ls(conf->location); + ecore_list_goto_first(fl); + x = strtok(strdup(conf->filename), "%d"); + while ((file = ecore_list_next(fl)) != NULL) + { + if (strstr(file, x)) + c++; + } + if (fl) + ecore_list_destroy(fl); + if (c == 0) + { + c = 1; + } + else + { + c++; + } + /* Add To Filename */ + snprintf(buff, sizeof(buff), strdup(conf->filename), c); + snprintf(buff, sizeof(buff), "%s/%s.png", + strdup(conf->location), strdup(buff)); + } + } + else + { + snprintf(buff, sizeof(buff), strdup(conf->filename)); + snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), + strdup(buff)); + } } - else + if (buff) + { + return strdup(buff); + } + else { - return NULL; + return NULL; } } -static int +static int _screen_exe_cb_exit(void *data, int type, void *event) { Ecore_Exe_Event_Del *ev; - Ecore_Exe *x; - Screen_Face *ef; + Ecore_Exe *x; + Screen_Face *ef; ev = event; - if (!ev->exe) return 1; + if (!ev->exe) + return 1; x = ev->exe; - if (!x) return 1; + if (!x) + return 1; ef = ecore_exe_data_get(x); x = NULL; @@ -619,53 +657,58 @@ ecore_event_handler_del(_screen_exe_exit_handler); #ifdef WANT_OSIRIS - char buff[256], tmp[1024]; - time_t t; - struct tm *loctime; - Ecore_List *fl = NULL; - int c = 0; - char *file, *z; - Config *conf; + char buff[256], tmp[1024]; + time_t t; + struct tm *loctime; + Ecore_List *fl = NULL; + int c = 0; + char *file, *z; + Config *conf; conf = ef->screen->conf; if (!conf->filename) { - t = time(NULL); - loctime = localtime(&t); - strftime(buff, sizeof(buff), "%Y-%m-%d-%I%M%S", loctime); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); + t = time(NULL); + loctime = localtime(&t); + strftime(buff, sizeof(buff), "%Y-%m-%d-%I%M%S", loctime); + snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), + strdup(buff)); } else { - /* Parse File Name For %d */ - if (strstr(conf->filename, "%d")) - { - /* Get File Count In Location */ - if (ecore_file_is_dir(conf->location)) - { - fl = ecore_file_ls(conf->location); - ecore_list_goto_first(fl); - z = strtok(strdup(conf->filename), "%d"); - while ((file = ecore_list_next(fl)) != NULL) - { - if (strstr(file, z)) c++; - } - if (fl) ecore_list_destroy(fl); - if (c == 0) - { - c = 1; - } - /* Add To Filename */ - snprintf(buff, sizeof(buff), strdup(conf->filename), c); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); - } - } - else - { - snprintf(buff, sizeof(buff), strdup(conf->filename)); - snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), strdup(buff)); - } + /* Parse File Name For %d */ + if (strstr(conf->filename, "%d")) + { + /* Get File Count In Location */ + if (ecore_file_is_dir(conf->location)) + { + fl = ecore_file_ls(conf->location); + ecore_list_goto_first(fl); + z = strtok(strdup(conf->filename), "%d"); + while ((file = ecore_list_next(fl)) != NULL) + { + if (strstr(file, z)) + c++; + } + if (fl) + ecore_list_destroy(fl); + if (c == 0) + { + c = 1; + } + /* Add To Filename */ + snprintf(buff, sizeof(buff), strdup(conf->filename), c); + snprintf(buff, sizeof(buff), "%s/%s.png", + strdup(conf->location), strdup(buff)); + } + } + else + { + snprintf(buff, sizeof(buff), strdup(conf->filename)); + snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location), + strdup(buff)); + } } snprintf(tmp, sizeof(tmp), "sudo mv %s /var/www/html/screenshots", buff); @@ -675,12 +718,13 @@ return 0; } -static void -_screen_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi) +static void +_screen_menu_cb_configure(void *data, E_Menu * m, E_Menu_Item * mi) { - Screen_Face *sf; + Screen_Face *sf; sf = data; - if (!sf) return; + if (!sf) + return; _config_screenshot_module(sf->con, sf->screen); } =================================================================== RCS file: /cvsroot/enlightenment/e_modules/screenshot/e_mod_main.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- e_mod_main.h 30 Jan 2006 01:10:07 -0000 1.6 +++ e_mod_main.h 30 Jan 2006 03:16:42 -0000 1.7 @@ -1,79 +1,69 @@ -#define D_(str) dgettext(PACKAGE, str) - #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Screen Screen; +typedef struct _Config Config; +typedef struct _Config_Face Config_Face; +typedef struct _Screen Screen; typedef struct _Screen_Face Screen_Face; -struct _Config -{ - int delay_time; - unsigned char use_import; - unsigned char use_scrot; - char *location; - char *filename; - struct - { - unsigned char use_img_border; - unsigned char use_dither; - unsigned char use_frame; - unsigned char use_mono; - unsigned char use_window; - unsigned char use_silent; - unsigned char use_trim; - } - import; - struct - { - unsigned char use_img_border; - unsigned char use_count; - unsigned char use_window; - unsigned char use_thumb; - } - scrot; +struct _Config { + int delay_time; + unsigned char use_import; + unsigned char use_scrot; + char *location; + char *filename; + struct { + unsigned char use_img_border; + unsigned char use_dither; + unsigned char use_frame; + unsigned char use_mono; + unsigned char use_window; + unsigned char use_silent; + unsigned char use_trim; + } import; + struct { + unsigned char use_img_border; + unsigned char use_count; + unsigned char use_window; + unsigned char use_thumb; + } scrot; }; -struct _Config_Face -{ - unsigned char enabled; +struct _Config_Face { + unsigned char enabled; }; -struct _Screen -{ - E_Menu *config_menu; - Screen_Face *face; - Config *conf; +struct _Screen { + E_Menu *config_menu; + Screen_Face *face; + Config *conf; - E_Config_DD *conf_edd; - E_Config_Dialog *config_dialog; + E_Config_DD *conf_edd; + E_Config_Dialog *config_dialog; }; -struct _Screen_Face -{ - Evas *evas; - E_Container *con; - E_Menu *menu; - Screen *screen; +struct _Screen_Face { + Evas *evas; + E_Container *con; + E_Menu *menu; + Screen *screen; - Config_Face *conf; - E_Config_DD *conf_face_edd; + Config_Face *conf; + E_Config_DD *conf_face_edd; - Evas_Object *screen_object; - Evas_Object *event_object; + Evas_Object *screen_object; + Evas_Object *event_object; - E_Gadman_Client *gmc; + E_Gadman_Client *gmc; }; EAPI extern E_Module_Api e_modapi; -EAPI void *e_modapi_init (E_Module *m); -EAPI int e_modapi_shutdown (E_Module *m); -EAPI int e_modapi_save (E_Module *m); -EAPI int e_modapi_info (E_Module *m); -EAPI int e_modapi_about (E_Module *m); -EAPI int e_modapi_config (E_Module *m); +EAPI void *e_modapi_init(E_Module * m); +EAPI int e_modapi_shutdown(E_Module * m); +EAPI int e_modapi_save(E_Module * m); +EAPI int e_modapi_info(E_Module * m); +EAPI int e_modapi_about(E_Module * m); +EAPI int e_modapi_config(E_Module * m); #endif ------------------------------------------------------- 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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs