forked from enlightenment/enlightenment
Allow setting png/jpeg as background from e_fm context menu.
SVN revision: 32151
This commit is contained in:
parent
ad36f2ea04
commit
1230661800
|
@ -146,6 +146,31 @@ e_int_config_wallpaper_gradient_done(E_Config_Dialog *dia)
|
||||||
cfdata->dia_gradient = NULL;
|
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
|
static void
|
||||||
_cb_button_up(void *data1, void *data2)
|
_cb_button_up(void *data1, void *data2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,9 +10,12 @@ typedef struct _E_Config_Wallpaper E_Config_Wallpaper;
|
||||||
EAPI E_Config_Dialog *e_int_config_wallpaper(E_Container *con, const char *params __UNUSED__);
|
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 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_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_import_done(E_Config_Dialog *dia);
|
||||||
EAPI void e_int_config_wallpaper_gradient_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
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -80,8 +80,12 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
||||||
|
|
||||||
import = E_NEW(Import, 1);
|
import = E_NEW(Import, 1);
|
||||||
if (!import) return NULL;
|
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)
|
if (!win)
|
||||||
{
|
{
|
||||||
free(import);
|
free(import);
|
||||||
|
@ -96,8 +100,9 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
||||||
import->win = win;
|
import->win = win;
|
||||||
|
|
||||||
evas = e_win_evas_get(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_title_set(win, _("Select a Picture..."));
|
||||||
e_win_delete_callback_set(win, _import_cb_delete);
|
e_win_delete_callback_set(win, _import_cb_delete);
|
||||||
|
@ -141,8 +146,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
||||||
}
|
}
|
||||||
ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL,
|
ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL,
|
||||||
_import_cb_sel_selected, import,
|
_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));
|
e_widget_fsel_window_object_set(ofm, E_OBJECT(win));
|
||||||
import->fsel_obj = ofm;
|
import->fsel_obj = ofm;
|
||||||
e_widget_list_object_append(o, ofm, 1, 1, 0.5);
|
e_widget_list_object_append(o, ofm, 1, 1, 0.5);
|
||||||
|
@ -230,7 +234,8 @@ e_int_config_wallpaper_del(E_Win *win)
|
||||||
E_FREE(import->fdest);
|
E_FREE(import->fdest);
|
||||||
import->exe = NULL;
|
import->exe = NULL;
|
||||||
e_object_del(E_OBJECT(import->win));
|
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->file);
|
||||||
E_FREE(import->cfdata);
|
E_FREE(import->cfdata);
|
||||||
if (import) free(import);
|
if (import) free(import);
|
||||||
|
@ -475,8 +480,9 @@ _import_cb_edje_cc_exit(void *data, int type, void *event)
|
||||||
_("Enlightenment was unable to import the picture<br>"
|
_("Enlightenment was unable to import the picture<br>"
|
||||||
"due to conversion errors."));
|
"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);
|
e_int_config_wallpaper_del(import->win);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -554,7 +560,8 @@ _import_cb_ok(void *data, void *data2)
|
||||||
}
|
}
|
||||||
else
|
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);
|
e_int_config_wallpaper_del(win);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,18 +13,8 @@ static void _e_mod_menu_add(void *data, E_Menu *m);
|
||||||
|
|
||||||
static E_Module *conf_module = NULL;
|
static E_Module *conf_module = NULL;
|
||||||
static E_Int_Menu_Augmentation *maug = NULL;
|
static E_Int_Menu_Augmentation *maug = NULL;
|
||||||
|
static E_Fm2_Mime_Handler *import_hdl = NULL;
|
||||||
|
|
||||||
/**/
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/**/
|
|
||||||
|
|
||||||
/**/
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/**/
|
|
||||||
/* module setup */
|
/* module setup */
|
||||||
EAPI E_Module_Api e_modapi =
|
EAPI E_Module_Api e_modapi =
|
||||||
{
|
{
|
||||||
|
@ -41,6 +31,15 @@ e_modapi_init(E_Module *m)
|
||||||
e_configure_registry_item_add("internal/wallpaper_desk", -1, _("Wallpaper"), NULL, "enlightenment/windows", e_int_config_wallpaper_desk);
|
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);
|
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;
|
conf_module = m;
|
||||||
e_module_delayed_set(m, 1);
|
e_module_delayed_set(m, 1);
|
||||||
return m;
|
return m;
|
||||||
|
@ -56,11 +55,20 @@ e_modapi_shutdown(E_Module *m)
|
||||||
e_int_menus_menu_augmentation_del("config/1", maug);
|
e_int_menus_menu_augmentation_del("config/1", maug);
|
||||||
maug = NULL;
|
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_item_del("internal/wallpaper_desk");
|
||||||
e_configure_registry_category_del("internal");
|
e_configure_registry_category_del("internal");
|
||||||
e_configure_registry_item_del("appearance/wallpaper");
|
e_configure_registry_item_del("appearance/wallpaper");
|
||||||
e_configure_registry_category_del("appearance");
|
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;
|
conf_module = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue