Enlightenment CVS committal Author : devilhorns Project : e17 Module : apps/e
Dir : e17/apps/e/src/modules/conf_wallpaper Modified Files: e_int_config_wallpaper.c e_int_config_wallpaper.h e_int_config_wallpaper_import.c e_mod_main.c Log Message: Allow setting png/jpeg as background from e_fm context menu. =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/conf_wallpaper/e_int_config_wallpaper.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_int_config_wallpaper.c 7 Oct 2007 13:33:28 -0000 1.3 +++ e_int_config_wallpaper.c 24 Oct 2007 08:37:48 -0000 1.4 @@ -146,6 +146,31 @@ cfdata->dia_gradient = NULL; } +EAPI void +e_int_config_wallpaper_handler_set(Evas_Object *obj, const char *path, void *data) +{ + const char *dev, *fpath; + + if (!path) return; + e_fm2_path_get(obj, &dev, &fpath); + if (e_config->wallpaper_import_last_dev) + evas_stringshare_del(e_config->wallpaper_import_last_dev); + e_config->wallpaper_import_last_dev = evas_stringshare_add(dev); + if (e_config->wallpaper_import_last_path) + evas_stringshare_del(e_config->wallpaper_import_last_path); + e_config->wallpaper_import_last_path = evas_stringshare_add(fpath); + e_config_save_queue(); + + e_int_config_wallpaper_import(NULL); +} + +EAPI int +e_int_config_wallpaper_handler_test(Evas_Object *obj, const char *path, void *data) +{ + if (!path) return 0; + return 1; +} + static void _cb_button_up(void *data1, void *data2) { =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/conf_wallpaper/e_int_config_wallpaper.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_config_wallpaper.h 24 Jul 2007 18:47:26 -0000 1.2 +++ e_int_config_wallpaper.h 24 Oct 2007 08:37:48 -0000 1.3 @@ -10,9 +10,12 @@ EAPI E_Config_Dialog *e_int_config_wallpaper(E_Container *con, const char *params __UNUSED__); EAPI E_Config_Dialog *e_int_config_wallpaper_desk(E_Container *con, const char *params); -EAPI void e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file); -EAPI void e_int_config_wallpaper_import_done(E_Config_Dialog *dia); -EAPI void e_int_config_wallpaper_gradient_done(E_Config_Dialog *dia); +EAPI void e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file); +EAPI void e_int_config_wallpaper_import_done(E_Config_Dialog *dia); +EAPI void e_int_config_wallpaper_gradient_done(E_Config_Dialog *dia); + +EAPI void e_int_config_wallpaper_handler_set(Evas_Object *obj, const char *path, void *data); +EAPI int e_int_config_wallpaper_handler_test(Evas_Object *obj, const char *path, void *data); #endif #endif =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/conf_wallpaper/e_int_config_wallpaper_import.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_config_wallpaper_import.c 25 Jul 2007 17:00:51 -0000 1.2 +++ e_int_config_wallpaper_import.c 24 Oct 2007 08:37:48 -0000 1.3 @@ -80,8 +80,12 @@ import = E_NEW(Import, 1); if (!import) return NULL; - - win = e_win_new(parent->con); + + if (parent) + win = e_win_new(parent->con); + else + win = e_win_new(e_container_current_get(e_manager_current_get())); + if (!win) { free(import); @@ -96,8 +100,9 @@ import->win = win; evas = e_win_evas_get(win); - - import->parent = parent; + + if (parent) + import->parent = parent; e_win_title_set(win, _("Select a Picture...")); e_win_delete_callback_set(win, _import_cb_delete); @@ -141,8 +146,7 @@ } ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL, _import_cb_sel_selected, import, - _import_cb_sel_change, import, 1 - ); + _import_cb_sel_change, import, 1); e_widget_fsel_window_object_set(ofm, E_OBJECT(win)); import->fsel_obj = ofm; e_widget_list_object_append(o, ofm, 1, 1, 0.5); @@ -230,7 +234,8 @@ E_FREE(import->fdest); import->exe = NULL; e_object_del(E_OBJECT(import->win)); - e_int_config_wallpaper_import_done(import->parent); + if (import->parent) + e_int_config_wallpaper_import_done(import->parent); E_FREE(import->cfdata->file); E_FREE(import->cfdata); if (import) free(import); @@ -475,8 +480,9 @@ _("Enlightenment was unable to import the picture<br>" "due to conversion errors.")); } - - e_int_config_wallpaper_update(import->parent, import->fdest); + + if (import->parent) + e_int_config_wallpaper_update(import->parent, import->fdest); e_int_config_wallpaper_del(import->win); return 0; @@ -554,7 +560,8 @@ } else { - e_int_config_wallpaper_update(import->parent, buf); + if (import->parent) + e_int_config_wallpaper_update(import->parent, buf); e_int_config_wallpaper_del(win); return; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/conf_wallpaper/e_mod_main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- e_mod_main.c 3 Aug 2007 15:57:27 -0000 1.6 +++ e_mod_main.c 24 Oct 2007 08:37:48 -0000 1.7 @@ -13,18 +13,8 @@ static E_Module *conf_module = NULL; static E_Int_Menu_Augmentation *maug = NULL; +static E_Fm2_Mime_Handler *import_hdl = NULL; -/**/ -/***************************************************************************/ - -/***************************************************************************/ -/**/ - -/**/ -/***************************************************************************/ - -/***************************************************************************/ -/**/ /* module setup */ EAPI E_Module_Api e_modapi = { @@ -41,6 +31,15 @@ e_configure_registry_item_add("internal/wallpaper_desk", -1, _("Wallpaper"), NULL, "enlightenment/windows", e_int_config_wallpaper_desk); maug = e_int_menus_menu_augmentation_add("config/1", _e_mod_menu_add, NULL, NULL, NULL); + import_hdl = e_fm2_mime_handler_new(_("Set As Background"), "enlightenment/background", + e_int_config_wallpaper_handler_set, NULL, + e_int_config_wallpaper_handler_test, NULL); + if (import_hdl) + { + e_fm2_mime_handler_mime_add(import_hdl, "image/png"); + e_fm2_mime_handler_mime_add(import_hdl, "image/jpeg"); + } + conf_module = m; e_module_delayed_set(m, 1); return m; @@ -56,11 +55,20 @@ e_int_menus_menu_augmentation_del("config/1", maug); maug = NULL; } - while ((cfd = e_config_dialog_get("E", "_config_wallpaper_dialog"))) e_object_del(E_OBJECT(cfd)); + while ((cfd = e_config_dialog_get("E", "_config_wallpaper_dialog"))) + e_object_del(E_OBJECT(cfd)); e_configure_registry_item_del("internal/wallpaper_desk"); e_configure_registry_category_del("internal"); e_configure_registry_item_del("appearance/wallpaper"); e_configure_registry_category_del("appearance"); + + if (import_hdl) + { + e_fm2_mime_handler_mime_del(import_hdl, "image/png"); + e_fm2_mime_handler_mime_del(import_hdl, "image/jpeg"); + e_fm2_mime_handler_free(import_hdl); + } + conf_module = NULL; return 1; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs