From c6b5f985fe065401aad27d317684b52534f66ac2 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 30 Mar 2009 13:34:32 +0000 Subject: [PATCH] a new wallpaper config dialog. only partly done. try it anyway. it's fun. SVN revision: 39801 --- configure.ac | 3 + data/themes/default.edc | 615 +++++++++++++ src/modules/Makefile.am | 5 + src/modules/conf_wallpaper2/Makefile.am | 32 + .../e-module-conf_wallpaper2.edj | Bin 0 -> 8870 bytes .../conf_wallpaper2/e_int_config_wallpaper.c | 846 ++++++++++++++++++ .../conf_wallpaper2/e_int_config_wallpaper.h | 14 + src/modules/conf_wallpaper2/e_mod_main.c | 99 ++ src/modules/conf_wallpaper2/e_mod_main.h | 18 + src/modules/conf_wallpaper2/module.desktop.in | 30 + 10 files changed, 1662 insertions(+) create mode 100644 src/modules/conf_wallpaper2/Makefile.am create mode 100644 src/modules/conf_wallpaper2/e-module-conf_wallpaper2.edj create mode 100644 src/modules/conf_wallpaper2/e_int_config_wallpaper.c create mode 100644 src/modules/conf_wallpaper2/e_int_config_wallpaper.h create mode 100644 src/modules/conf_wallpaper2/e_mod_main.c create mode 100644 src/modules/conf_wallpaper2/e_mod_main.h create mode 100644 src/modules/conf_wallpaper2/module.desktop.in diff --git a/configure.ac b/configure.ac index 24ced84a1..0815d8273 100644 --- a/configure.ac +++ b/configure.ac @@ -371,6 +371,7 @@ AC_E_OPTIONAL_MODULE([fileman_opinfo], true) AC_E_OPTIONAL_MODULE([wizard], true) AC_E_OPTIONAL_MODULE([conf], true) AC_E_OPTIONAL_MODULE([conf_wallpaper], true) +AC_E_OPTIONAL_MODULE([conf_wallpaper2], true) AC_E_OPTIONAL_MODULE([conf_theme], true, [CHECK_MODULE_CONF_THEME]) AC_E_OPTIONAL_MODULE([conf_colors], true) AC_E_OPTIONAL_MODULE([conf_fonts], true) @@ -455,6 +456,8 @@ src/modules/conf/Makefile src/modules/conf/module.desktop src/modules/conf_wallpaper/Makefile src/modules/conf_wallpaper/module.desktop +src/modules/conf_wallpaper2/Makefile +src/modules/conf_wallpaper2/module.desktop src/modules/conf_theme/Makefile src/modules/conf_theme/module.desktop src/modules/conf_colors/Makefile diff --git a/data/themes/default.edc b/data/themes/default.edc index 4b42251b1..1738ea600 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -23948,4 +23948,619 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); // } } } + +///////////////////////////////////////////////////////////////////////////// + /*** WALLPAPER MAIN DIALOG ***/ + group { name: "e/conf/wallpaper/main/window"; + images { + image: "dia_grad.png" COMP; + image: "dia_topshad.png" COMP; + image: "dia_botshad.png" COMP; + image: "menu_sep.png" COMP; + } + parts { + part { name: "base"; + mouse_events: 0; + description { state: "default" 0.0; + color_class: "dialog_base"; + image.normal: "dia_grad.png"; + fill { + smooth: 0; + size { + relative: 0.0 1.0; + offset: 64 0; + } + } + } + } + part { name: "shadow"; + mouse_events: 0; + description { state: "default" 0.0; + rel2.relative: 1.0 0.0; + rel2.offset: -1 31; + image.normal: "dia_topshad.png"; + fill { + smooth: 0; + size { + relative: 0.0 1.0; + offset: 64 0; + } + } + } + } + part { name: "shadow2"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.relative: 0.0 1.0; + rel1.offset: 0 -4; + image.normal: "dia_botshad.png"; + fill { + smooth: 0; + size { + relative: 0.0 1.0; + offset: 64 0; + } + } + } + } + part { name: "e.swallow.preview"; + type: SWALLOW; + description { state: "default" 0.0; + } + } + part { name: "e.swallow.list"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + relative: 1.0 0.0; + offset: -3 -5; + to_y: "e.swallow.buttons"; + } + } + } + part { name: "separator"; + mouse_events: 0; + description { state: "default" 0.0; + min: 16 2; + rel1 { + relative: 0.0 1.0; + offset: 4 -1; + to_y: "e.swallow.list"; + } + rel2 { + relative: 1.0 1.0; + offset: -5 0; + to_y: "e.swallow.list"; + } + image { + normal: "menu_sep.png"; + border: 2 2 0 0; + } + fill.smooth: 0; + } + } + part { + name: "e.swallow.buttons"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.5 1.0; + fixed: 0 1; + rel1 { + relative: 0.0 1.0; + offset: 4 -5; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -5; + } + } + } + } + } + group { name: "e/conf/wallpaper/main/mini"; + images { + image: "dia_grad.png" COMP; + image: "e17_mini_button_shadow2.png" COMP; + } + parts { + part { name: "icon_box_shadow"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + rel1 { + to: "base"; + relative: 0.0 0.0; + offset: -3 -3; + } + rel2 { + to: "base"; + relative: 1.0 1.0; + offset: 4 4; + } + fill { + smooth: 0; + } + image { + normal: "e17_mini_button_shadow2.png"; + border: 6 6 6 6; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "icon_box"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + align: 0.5 0.5; + rel1 { + to: "base"; + relative: 0.0 0.0; + offset: -1 -1; + } + rel2 { + to: "base"; + relative: 1.0 1.0; + offset: 0 0; + } + color: 0 0 0 64; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "base"; + mouse_events: 0; + type: RECT; + description { state: "default" 0.0; + visible: 0; + rel1 { + to: "icon_zoom"; + relative: 0.0 0.0; + offset: 4 4; + } + rel2 { + to: "icon_zoom"; + relative: 1.0 1.0; + offset: -5 -5; + } + color: 255 255 255 255; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "icon_zoom"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; + } + description { state: "min" 0.0; + inherit: "default" 0.0; + rel1.relative: 0.5 0.5; + rel2.relative: 0.5 0.5; + } + description { state: "max" 0.0; + inherit: "default" 0.0; + rel1.relative: -0.2 -0.2; + rel2.relative: 1.2 1.2; + } + description { state: "max2" 0.0; + inherit: "default" 0.0; + rel1.relative: -0.05 -0.05; + rel2.relative: 1.05 1.05; + } + } + part { name: "e.swallow.content"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + to: "base"; + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + to: "base"; + relative: 1.0 1.0; + offset: -3 -3; + } + } + } + } + programs { + program { name: "thumb_gen"; + signal: "e,action,thumb,gen"; + source: "e"; + action: STATE_SET "visible" 0.0; + target: "icon_box_shadow"; + target: "icon_box"; + target: "base"; + target: "icon_zoom"; + target: "e.swallow.content"; + after: "thumb_gen2"; + } + program { name: "thumb_gen2"; + action: STATE_SET "min" 0.0; + target: "icon_zoom"; + after: "thumb_gen3"; + } + program { name: "thumb_gen3"; + action: STATE_SET "max" 0.0; + target: "icon_zoom"; + transition: DECELERATE 0.2; + after: "thumb_gen4"; + } + program { name: "thumb_gen4"; + action: STATE_SET "default" 0.0; + target: "icon_zoom"; + transition: SINUSOIDAL 0.1; + after: "thumb_gen5"; + } + program { name: "thumb_gen5"; + action: STATE_SET "max2" 0.0; + target: "icon_zoom"; + transition: SINUSOIDAL 0.2; + after: "thumb_gen6"; + } + program { name: "thumb_gen6"; + action: STATE_SET "default" 0.0; + target: "icon_zoom"; + transition: SINUSOIDAL 0.3; + } + program { name: "thumb_ungen"; + signal: "e,action,thumb,ungen"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "icon_box_shadow"; + target: "icon_box"; + target: "base"; + target: "icon_zoom"; + target: "e.swallow.content"; + after: "thumb_gen2"; + } + } + } + group { name: "e/conf/wallpaper/main/scrollframe"; + images { + image: "arrow_up.png" COMP; + image: "arrow_down.png" COMP; + image: "bt_sm_base1.png" COMP; + image: "bt_sm_base2.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "sb_runnerv.png" COMP; + } + parts { +// part { name: "clipper"; +// type: RECT; +// mouse_events: 0; +// description { state: "default" 0.0; +// } +// } + part { name: "e.swallow.content"; +// clip_to: "clipper"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.offset: 0 0; + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to_x: "sb_vbar"; + } + } + } + part { name: "sb_vbar"; + type: RECT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + min: 17 17; + align: 1.0 0.0; + rel1 { + relative: 1.0 0.0; + offset: -1 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + description { state: "hidden" 0.0; + visible: 0; + max: 0 99999; + rel1 { + relative: 1.0 0.0; + offset: -1 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { name: "sb_vbar_base"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + offset: 0 -1; + to: "sb_vbar_a1"; + } + rel2 { + relative: 1.0 0.0; + offset: -1 0; + to: "sb_vbar_a2"; + } + } + } + part { name: "sb_vbar_runner"; + clip_to: "sb_vbar"; + mouse_events: 0; + description { state: "default" 0.0; + max: 3 99999; + rel1.to: "sb_vbar_base"; + rel1.offset: 1 0; + rel2.to: "sb_vbar_base"; + image { + normal: "sb_runnerv.png"; + border: 0 0 4 4; + } + fill.smooth: 0; + } + } + part { name: "sb_vbar_p1"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + to: "sb_vbar_a1"; + } + rel2 { + relative: 1.0 0.0; + to: "e.dragable.vbar"; + } + } + } + part { name: "sb_vbar_p2"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + to: "e.dragable.vbar"; + } + rel2 { + relative: 1.0 0.0; + to: "sb_vbar_a2"; + } + } + } + part { name: "e.dragable.vbar"; + clip_to: "sb_vbar"; + mouse_events: 1; + scale: 1; + dragable { + x: 0 0 0; + y: 1 1 0; + confine: "sb_vbar_base"; + } + description { state: "default" 0.0; + min: 17 17; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar_base"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar_base"; + } + image { + normal: "bt_sm_base2.png"; + border: 6 6 6 6; + } + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + image.normal: "bt_sm_base1.png"; + } + } + part { name: "sb_vbar_over1"; + clip_to: "sb_vbar"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "e.dragable.vbar"; + rel2.relative: 1.0 0.5; + rel2.to: "e.dragable.vbar"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_vbar_over2"; + clip_to: "sb_vbar"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "e.dragable.vbar"; + rel2.to: "e.dragable.vbar"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + } + + part { name: "sb_vbar_a1"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { state: "default" 0.0; + min: 17 17; + align: 0.5 0.0; + aspect: 1.0 1.0; + aspect_preference: HORIZONTAL; + color: 0 0 0 0; + rel1 { to: "sb_vbar"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { to: "sb_vbar"; + relative: 1.0 0.0; + offset: -1 0; + } + } + } + part { name: "sb_vbar_a1_arrow"; + mouse_events: 0; + clip_to: "sb_vbar"; + description { state: "default" 0.0; + max: 9 9; + rel1.to: "sb_vbar_a1"; + rel2.to: "sb_vbar_a1"; + image.normal: "arrow_up.png"; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + rel1.offset: 0 -1; + rel2.offset: -1 -2; + } + } + + part { name: "sb_vbar_a2"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { state: "default" 0.0; + min: 17 17; + align: 0.5 1.0; + aspect: 1.0 1.0; + aspect_preference: HORIZONTAL; + color: 0 0 0 0; + rel1 { + to: "sb_vbar"; + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + to: "sb_vbar"; + relative: 1.0 1.0; + offset: -1 0; + } + } + } + part { name: "sb_vbar_a2_arrow"; + type: IMAGE; + mouse_events: 0; + clip_to: "sb_vbar"; + description { state: "default" 0.0; + max: 9 9; + rel1.to: "sb_vbar_a2"; + rel2.to: "sb_vbar_a2"; + image.normal: "arrow_down.png"; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + rel1.offset: 0 1; + rel2.offset: -1 0; + } + } + } + programs { + program { name: "sb_vbar_show"; + signal: "e,action,show,vbar"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "sb_vbar"; + } + program { name: "sb_vbar_hide"; + signal: "e,action,hide,vbar"; + source: "e"; + action: STATE_SET "hidden" 0.0; + target: "sb_vbar"; + } + + program { name: "sb_vbar_a1_down"; + signal: "mouse,down,1"; + source: "sb_vbar_a1"; + action: STATE_SET "clicked" 0.0; + target: "sb_vbar_a1_arrow"; + } + program { name: "sb_vbar_a1_down2"; + signal: "mouse,down,1"; + source: "sb_vbar_a1"; + action: DRAG_VAL_STEP 0.0 -1.0; + target: "e.dragable.vbar"; + } + program { name: "sb_vbar_a1_up"; + signal: "mouse,up,1"; + source: "sb_vbar_a1"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_a1_arrow"; + } + program { name: "sb_vbar_a2_down"; + signal: "mouse,down,1"; + source: "sb_vbar_a2"; + action: STATE_SET "clicked" 0.0; + target: "sb_vbar_a2_arrow"; + } + program { name: "sb_vbar_a2_down2"; + signal: "mouse,down,1"; + source: "sb_vbar_a2"; + action: DRAG_VAL_STEP 0.0 1.0; + target: "e.dragable.vbar"; + } + program { name: "sb_vbar_a2_up"; + signal: "mouse,up,1"; + source: "sb_vbar_a2"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_a2_arrow"; + } + program { name: "sb_vbar_p1_down"; + signal: "mouse,down,1"; + source: "sb_vbar_p1"; + action: DRAG_VAL_PAGE 0.0 -1.0; + target: "e.dragable.vbar"; + } + program { name: "sb_vbar_p2_down"; + signal: "mouse,down,1"; + source: "sb_vbar_p2"; + action: DRAG_VAL_PAGE 0.0 1.0; + target: "e.dragable.vbar"; + } + program { name: "sb_vbar_down"; + signal: "mouse,down,1"; + source: "e.dragable.vbar"; + action: STATE_SET "clicked" 0.0; + target: "e.dragable.vbar"; + } + program { name: "sb_vbar_up"; + signal: "mouse,up,1"; + source: "e.dragable.vbar"; + action: STATE_SET "default" 0.0; + target: "e.dragable.vbar"; + } + } + } } diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am index 251de9d8d..bcfd99023 100644 --- a/src/modules/Makefile.am +++ b/src/modules/Makefile.am @@ -66,6 +66,10 @@ if USE_MODULE_CONF_WALLPAPER SUBDIRS += conf_wallpaper endif +if USE_MODULE_CONF_WALLPAPER2 +SUBDIRS += conf_wallpaper2 +endif + if USE_MODULE_CONF_THEME SUBDIRS += conf_theme endif @@ -261,6 +265,7 @@ fileman \ wizard \ conf \ conf_wallpaper \ +conf_wallpaper2 \ conf_theme \ conf_colors \ conf_fonts \ diff --git a/src/modules/conf_wallpaper2/Makefile.am b/src/modules/conf_wallpaper2/Makefile.am new file mode 100644 index 000000000..8a28a6a1c --- /dev/null +++ b/src/modules/conf_wallpaper2/Makefile.am @@ -0,0 +1,32 @@ +MAINTAINERCLEANFILES = Makefile.in +MODULE = conf_wallpaper2 + +# data files for the module +filesdir = $(libdir)/enlightenment/modules/$(MODULE) +files_DATA = \ +e-module-$(MODULE).edj module.desktop + +EXTRA_DIST = $(files_DATA) + +# the module .so file +INCLUDES = -I. \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src/modules/$(MODULE) \ + -I$(top_srcdir)/src/bin \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/modules \ + @e_cflags@ \ + @EXCHANGE_CFLAGS@ +pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + e_int_config_wallpaper.c \ + e_int_config_wallpaper.h + +module_la_LIBADD = @e_libs@ @dlopen_libs@ @EXCHANGE_LIBS@ +module_la_LDFLAGS = -module -avoid-version +module_la_DEPENDENCIES = $(top_builddir)/config.h + +uninstall: + rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE) diff --git a/src/modules/conf_wallpaper2/e-module-conf_wallpaper2.edj b/src/modules/conf_wallpaper2/e-module-conf_wallpaper2.edj new file mode 100644 index 0000000000000000000000000000000000000000..25e2ceb460e6f1a935a59e9a29c952b80dee4835 GIT binary patch literal 8870 zcmZ{n30zEV)WF9ZLRyq;Q6W;atGv>LEH6=tO6!=WX-qXUHPbRfizP*5kR@q=RD_5(jB6^F&NBT7&kE(33Ci) z&NB=~a5)AeGzm-u#vBYr669h%bSwh45C&Xp55u1xa0!Ha5}*si0RMG5Ae~@9jK#7b zkvYIIe}SzCasdqO8Mr{s1EvlVi7ACLJ77o*#7`Gx>A>{CUJSz*Wi?b5Q&m|nTADAsLWUdD4Hx8yF*vOjqqRa}IC)fgfbBVxC0h5AZg!;Jxy9G9~K1Gym z02U6mBn$_XjQ~pp8+m_ul$8U^0(%}}BNymRz;Z!u;1Uk20M-sn28IXf2XTZUUl>ss z!6=IWwiImS8Ez=k1ttyld>FDQQvfChHZtE9WlUhe|5yvGSy&mEAnGFz`Wj%GAdy_1 zMmf}rFj6}rh>cvJL!N|>png|SwhNdIF#i33bqEs>Kh8w%Tv(T|3ovmQXJ8=p0`Dn& z4x|vDA01c_Fl0Z1&}aAqdkpphKEKt#l4s3D^70ZG@7<7RZ2|TM&*zn?G_7c@ly7 ze=tvAoH_tbN8`ac6+!Ai46%_5bU1?|CwL4bvd*)>kUi(Gq3dA!APmM;bglrHSHNDx z3C4~07qHtr1`@f}1B(JF1|tBS3-v3Kj4-~rUx2*^#{b-YFp)h+o_iFXO8~PTZ2srk z0c+vMz;(_tM2NBp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#QjRHNw1n0TuBnO86gH_dD z*SNlXkA)Yq1`&a&yS*V#4~(S{VgCg z`r@n4no2)uS^SWntee3c*xmRqv-a>c1IIj7G5<>9;b?O)>=~D5BTsBUi5*P+hFw6m zvmV-gBW+>h&|ls*&(~WRYN(bLCHYD}mhl*9y?PC|`yag@g&G4D?*`V4oo)-*pAZ>R z`_5vHfI{lzx!Wo?<;(Uj7&0+FsPXJ+gr8>V-IRw@)5Gsg4K^g0$hO!YPPy7xPTjjW zZ@9|bb1$R5$UeK`=9j{|TG5(LwdHfJy3Ci*H@FvbaKRfRD=@pn_tfXvN QfP;+6vO$d8)UvMs0U6~79smFU literal 0 HcmV?d00001 diff --git a/src/modules/conf_wallpaper2/e_int_config_wallpaper.c b/src/modules/conf_wallpaper2/e_int_config_wallpaper.c new file mode 100644 index 000000000..81cc9cb91 --- /dev/null +++ b/src/modules/conf_wallpaper2/e_int_config_wallpaper.c @@ -0,0 +1,846 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" +#include "e_mod_main.h" + +typedef struct _Info Info; +typedef struct _Smart_Data Smart_Data; +typedef struct _Item Item; + +struct _Info +{ + Evas_Object *bg, *preview, *mini, *button, *box, *sframe, *span; + char *bg_file; + int iw, ih; + Eina_List *dirs; + char *curdir; + DIR *dir; + Ecore_Idler *idler; + int specific; + int use_theme_bg; + int con_num, zone_num, desk_x, desk_y; +}; + +struct _Smart_Data +{ + Evas_Object *child_obj; + Evas_Coord x, y, w, h; + Evas_Coord cx, cy, cw, ch; + Evas_Coord sx, sy; + Eina_List *items; + Ecore_Idle_Enterer *idle_enter; + Ecore_Animator *animator; + double seltime; + double selmove; + Evas_Bool selin : 1; + Evas_Bool selout : 1; +}; + +struct _Item +{ + Evas_Object *obj; + Evas_Coord x, y, w, h; + const char *file; + Evas_Object *frame, *image; + Evas_Bool selected : 1; + Evas_Bool have_thumb : 1; + Evas_Bool do_thumb : 1; +}; + +static E_Win *win = NULL; +static Info *info = NULL; + +static void _e_smart_reconfigure(Evas_Object *obj); + +static void +_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (x > (sd->cw - sd->w)) x = sd->cw - sd->w; + if (y > (sd->ch - sd->h)) y = sd->ch - sd->h; + if (x < 0) x = 0; + if (y < 0) y = 0; + if ((sd->cx == x) && (sd->cy == y)) return; + sd->cx = x; + sd->cy = y; + _e_smart_reconfigure(obj); +} + +static void +_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (x) *x = sd->cx; + if (y) *y = sd->cy; +} + +static void +_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (x) + { + if (sd->w < sd->cw) *x = sd->cw - sd->w; + else *x = 0; + } + if (y) + { + if (sd->h < sd->ch) *y = sd->ch - sd->h; + else *y = 0; + } +} + +static void +_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (w) *w = sd->cw; + if (h) *h = sd->ch; +} + +static void _e_smart_reconfigure(Evas_Object *obj); +static void _thumb_gen(void *data, Evas_Object *obj, void *event_info); + +static int +_e_smart_reconfigure_do(void *data) +{ + Evas_Object *obj = data; + Smart_Data *sd = evas_object_smart_data_get(obj); + Eina_List *l; + Item *it; + int iw, redo = 0, changed = 0; + Evas_Coord x, y, xx, yy, ww, hh, cw, ch, mw, mh, ox, oy, dd; + + if (sd->cx > (sd->cw - sd->w)) sd->cx = sd->cw - sd->w; + if (sd->cy > (sd->ch - sd->h)) sd->cy = sd->ch - sd->h; + if (sd->cx < 0) sd->cx = 0; + if (sd->cy < 0) sd->cy = 0; + + iw = sd->w / 4; + if (iw > (120 * e_scale)) iw = 120 * e_scale; + else + { + if (iw < (60 * e_scale)) iw = sd->w / 3; + if (iw < (60 * e_scale)) iw = sd->w / 2; + if (iw < (60 * e_scale)) iw = sd->w; + } + x = 0; + y = 0; + ww = iw; + hh = (info->ih * iw) / (info->iw); + + mw = mh = 0; + EINA_LIST_FOREACH(sd->items, l, it) + { + xx = sd->x - sd->cx + x; + if (x > (sd->w - ww)) + { + x = 0; + y += hh; + xx = sd->x - sd->cx + x; + } + yy = sd->y - sd->cy + y; + it->x = x; + it->y = y; + it->w = ww; + it->h = hh; + if (it->selected) + { + sd->sx = it->x + (it->w / 2); + sd->sy = it->y + (it->h / 2); + } + if ((x + ww) > mw)mw = x + ww; + if ((y + hh) > mh) mh = y + hh; + x += ww; + } + if ((mw != sd->cw) || (mh != sd->ch)) + { + sd->cw = mw; + sd->ch = mh; + if (sd->cx > (sd->cw - sd->w)) + { + sd->cx = sd->cw - sd->w; + redo = 1; + } + if (sd->cy > (sd->ch - sd->h)) + { + sd->cy = sd->ch - sd->h; + redo = 1; + } + if (sd->cx < 0) + { + sd->cx = 0; + redo = 1; + } + if (sd->cy < 0) + { + sd->cy = 0; + redo = 1; + } + if (redo) _e_smart_reconfigure_do(obj); + changed = 1; + } + + ox = 0; + if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2; + oy = 0; + if (sd->h > sd->ch) oy = (sd->h - sd->ch) / 2; + + EINA_LIST_FOREACH(sd->items, l, it) + { + Evas_Coord dx, dy, vw, vh; + + dx = dy = 0; + if ((sd->sx >= 0) && + (sd->selmove > 0.0) + +/* && + ((it->x + it->w) > sd->cx) && + ((it->x) < (sd->cx + sd->w)) && + ((it->y + it->h) > sd->cy) && + ((it->y) < (sd->cy + sd->h)) + */ + ) + { + double a, d, di; + int sum = 0; + char *p; + + // -----0X0+++++ + dx = (it->x + (it->w / 2)) - sd->sx; + dy = (it->y + (it->h / 2)) - sd->sy; + if (dx > 0) + { + // |/ + // +-- + if (dy < 0) + a = -atan(-(double)dy / (double)dx); + // +-- + // |\ + else + a = atan((double)dy / (double)dx); + } + else if (dx == 0) + { + // | + // + + if (dy < 0) a = -M_PI / 2; + // + + // | + else a = M_PI / 2; + } + else + { + // \| + // --+ + if (dy < 0) + a = -M_PI + atan((double)dy / (double)dx); + // --+ + // /| + else + a = M_PI - atan(-(double)dy / (double)dx); + } + d = sqrt((double)(dx * dx) + (double)(dy * dy)); + dx = dy = 0; + + for (p = (char *)it->file; *p; p++) sum += (int)(*p); + sum = (sum & 0xff) - 128; + a = a + ((double)sum / 1024.0); + xx = sd->sx - sd->cx + ox; + yy = sd->sy - sd->cy + oy; + if (xx < (sd->w / 2)) dx = sd->w - xx; + else dx = xx; + if (yy < (sd->h / 2)) dy = sd->h - yy; + else dy = yy; + dd = dx - d; + if (dy > dx) dd = dy - d; + if (dd < 0) dd = 0; + dy = sin(a) * sd->selmove * (dd * 0.9); + dx = cos(a) * sd->selmove * (dd * 0.9); + } + xx = sd->x - sd->cx + it->x + ox; + yy = sd->y - sd->cy + it->y + oy; + evas_object_move(it->frame, + xx + dx, + yy + dy); + evas_object_resize(it->frame, it->w, it->h); + evas_output_viewport_get(evas_object_evas_get(obj), NULL, NULL, &vw, &vh); + if (E_INTERSECTS(xx, yy, it->w, it->h, 0, 0, vw, vh)) + { + if (!it->have_thumb) + { + if (!it->do_thumb) + { + e_thumb_icon_begin(it->image); + it->do_thumb = 1; + } + } + } + else + { + if (it->have_thumb) + { + if (it->do_thumb) + { + e_thumb_icon_end(it->image); + it->do_thumb = 0; + } + evas_object_del(it->image); + it->have_thumb = 0; + it->image = e_thumb_icon_add(evas_object_evas_get(obj)); + edje_object_part_swallow(it->frame, "e.swallow.content", it->image); + evas_object_smart_callback_add(it->image, "e_thumb_gen", _thumb_gen, it); + e_thumb_icon_file_set(it->image, it->file, "e/desktop/background"); + e_thumb_icon_size_set(it->image, info->iw, info->ih); + evas_object_show(it->image); + edje_object_signal_emit(it->frame, "e,action,thumb,ungen", "e"); + } + else + { + if (it->do_thumb) + { + e_thumb_icon_end(it->image); + it->do_thumb = 0; + } + } + } + } + + if (changed) + evas_object_smart_callback_call(obj, "changed", NULL); + sd->idle_enter = NULL; + return 0; +} + +static void +_e_smart_reconfigure(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (sd->idle_enter) return; + sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, obj); +} + +static void +_e_smart_add(Evas_Object *obj) +{ + Smart_Data *sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + sd->x = sd->y = sd->w = sd->h = 0; + sd->sx = sd->sy = -1; + evas_object_smart_data_set(obj, sd); +} + +static void +_e_smart_del(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (sd->idle_enter) + ecore_idle_enterer_del(sd->idle_enter); + if (sd->animator) + ecore_animator_del(sd->animator); + free(sd); +} + +static void +_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + sd->x = x; + sd->y = y; + _e_smart_reconfigure(obj); +} + +static void +_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + sd->w = w; + sd->h = h; + _e_smart_reconfigure(obj); + evas_object_smart_callback_call(obj, "changed", NULL); +} + +static void +_e_smart_show(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + evas_object_show(sd->child_obj); +} + +static void +_e_smart_hide(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + evas_object_hide(sd->child_obj); +} + +static void +_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + evas_object_color_set(sd->child_obj, r, g, b, a); +} + +static void +_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + evas_object_clip_set(sd->child_obj, clip); +} + +static void +_e_smart_clip_unset(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + evas_object_clip_unset(sd->child_obj); +} + +static Evas_Object * +_pan_add(Evas *evas) +{ + static Evas_Smart *smart = NULL; + static const Evas_Smart_Class sc = + { + "wp_pan", + EVAS_SMART_CLASS_VERSION, + _e_smart_add, + _e_smart_del, + _e_smart_move, + _e_smart_resize, + _e_smart_show, + _e_smart_hide, + _e_smart_color_set, + _e_smart_clip_set, + _e_smart_clip_unset, + NULL, + NULL, + NULL, + NULL + }; + smart = evas_smart_class_new(&sc); + return evas_object_smart_add(evas, smart); +} + +static int +_sel_anim(void *data) +{ + Evas_Object *obj = data; + Smart_Data *sd = evas_object_smart_data_get(obj); + double t = ecore_loop_time_get() - sd->seltime; + double len = 1.0; + double p = t / len; + double d; + if (p > 1.0) p = 1.0; + if (!sd->selin) + { + d = (p * 2) - 1.0; + if (d > 0.0) + { + d = 1.0 - d; + d = d * d * d; + d = 1.0 - d; + } + else + { + d = -1.0 - d; + d = d * d * d; + d = -1.0 - d; + } + d = (1.0 + d) / 2.0; + sd->selmove = d; + } + else + { + d = ((1.0 - p) * 2) - 1.0; + if (d > 0.0) + { + d = 1.0 - d; + d = d * d * d; + d = 1.0 - d; + } + else + { + d = -1.0 - d; + d = d * d * d; + d = -1.0 - d; + } + d = (1.0 + d) / 2.0; + sd->selmove = d; + } + _e_smart_reconfigure(obj); + if (p == 1.0) + { + if (!sd->selout) + { + sd->selin = 1; + sd->selout = 1; + sd->seltime = ecore_loop_time_get(); + return 1; + } + sd->selout = 0; + sd->selin = 0; + sd->animator = NULL; + return 0; + } + return 1; +} + +static void +_pan_sel(Evas_Object *obj, Item *it) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + edje_object_signal_emit(it->frame, "e,state,selected", "e"); + if (!it->selected) + { + Eina_List *l; + Item *it2; + + EINA_LIST_FOREACH(sd->items, l, it2) + { + if (it2->selected) it2->selected = 0; + } + // FIXME: unsel other + it->selected = 1; + if (info->bg_file) free(info->bg_file); + info->bg_file = strdup(it->file); + } + if (!sd->animator) + { + sd->seltime = ecore_loop_time_get(); + sd->animator = ecore_animator_add(_sel_anim, obj); + sd->selin = 0; + } +} + +static void +_pan_sel_up(Evas_Object *obj, Item *it) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd->animator) + { + sd->seltime = ecore_loop_time_get(); + sd->animator = ecore_animator_add(_sel_anim, obj); + sd->selin = 1; + } + else + { + if (sd->selin) return; + sd->selout = 1; + } +} + +static void +_thumb_gen(void *data, Evas_Object *obj, void *event_info) +{ + Item *it = data; + edje_object_signal_emit(it->frame, "e,action,thumb,gen", "e"); + it->have_thumb = 1; +} + +static void +_item_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + Item *it = data; +// _pan_sel(it->obj, it); +} + +static void +_item_up(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + Item *it = data; + if (ev->button == 1) + { + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) + { + edje_object_file_set(info->mini, it->file, + "e/desktop/background"); + _pan_sel(it->obj, it); + // FIXME: select image!!! + } + } +} + +static void +_pan_file_add(Evas_Object *obj, const char *file) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + Item *it = calloc(1, sizeof(Item)); + if(!it) return; + printf("+%s\n", file); + sd->items = eina_list_append(sd->items, it); + it->obj = obj; + it->file = eina_stringshare_add(file); + it->frame = edje_object_add(evas_object_evas_get(obj)); + e_theme_edje_object_set(it->frame, "base/theme/widgets", + "e/conf/wallpaper/main/mini"); + evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN, + _item_down, it); + evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP, + _item_up, it); + + evas_object_smart_member_add(it->frame, obj); + evas_object_clip_set(it->frame, evas_object_clip_get(obj)); + evas_object_show(it->frame); + it->image = e_thumb_icon_add(evas_object_evas_get(obj)); + edje_object_part_swallow(it->frame, "e.swallow.content", it->image); + evas_object_smart_callback_add(it->image, "e_thumb_gen", _thumb_gen, it); + e_thumb_icon_file_set(it->image, it->file, "e/desktop/background"); + e_thumb_icon_size_set(it->image, info->iw, info->ih); + evas_object_show(it->image); +// e_thumb_icon_begin(it->image); + _e_smart_reconfigure(obj); +} + +//////// + +static void +_resize(E_Win *wn) +{ + evas_object_resize(info->bg, win->w, win->h); +} + +static void +_delete(E_Win *wn) +{ + wp_conf_hide(); +} + +static void +_ok(void *data, void *data2) +{ + if (!info) return; + if (info->specific) + { + /* update a specific config */ + e_bg_del(info->con_num, info->zone_num, info->desk_x, info->desk_y); + e_bg_add(info->con_num, info->zone_num, info->desk_x, info->desk_y, info->bg_file); + } + else + { + /* set the default and nuke individual configs */ + while (e_config->desktop_backgrounds) + { + E_Config_Desktop_Background *cfbg; + + cfbg = e_config->desktop_backgrounds->data; + e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + } + if ((info->use_theme_bg) || (!info->bg_file)) + e_bg_default_set(NULL); + else + e_bg_default_set(info->bg_file); + +// info->all_this_desk_screen = 0; + } + e_bg_update(); + e_config_save_queue(); + wp_conf_hide(); +} + +static void _scan(void); + +static int +_idler(void *data) +{ + struct dirent *dp; + char buf[PATH_MAX], *p; + + if (!info) return 0; + if (!info->dir) + { + info->idler = NULL; + return 0; + } + dp = readdir(info->dir); + if (!dp) + { + free(info->curdir); + info->curdir = NULL; + closedir(info->dir); + info->dir = NULL; + info->idler = NULL; + _scan(); + return 0; + } + if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))) + return 1; + if (dp->d_name[0] == '.') + return 1; + snprintf(buf, sizeof(buf), "%s/%s", info->curdir, dp->d_name); + if (ecore_file_is_dir(buf)) + { + info->dirs = eina_list_append(info->dirs, strdup(buf)); + return 1; + } + _pan_file_add(info->span, buf); + + e_util_wakeup(); + return 1; +} + +static void +_scan(void) +{ + if (!info) return; + if (info->dirs) + { + if (info->curdir) free(info->curdir); + info->curdir = info->dirs->data; + info->dirs = eina_list_remove_list(info->dirs, info->dirs); + if (!info->dir) info->dir = opendir(info->curdir); + info->idler = ecore_idler_add(_idler, NULL); + } +} + +void +wp_conf_show(E_Container *con, const char *params __UNUSED__) +{ + E_Zone *zone; + E_Desk *desk; + const E_Config_Desktop_Background *cfbg; + Evas_Coord mw, mh; + + char buf[PATH_MAX]; + if (win) + { + e_win_show(win); + e_win_raise(win); + return; + } + zone = e_util_zone_current_get(con->manager); + desk = e_desk_current_get(zone); + + info = calloc(1, sizeof(Info)); + if (!info) return; + + info->con_num = con->num; + info->zone_num = zone->id; + info->desk_x = desk->x; + info->desk_y = desk->y; + + cfbg = e_bg_config_get(con->num, zone->id, desk->x, desk->y); + if (cfbg) + { + if ((cfbg->container >= 0) && (cfbg->zone >= 0)) + { + // info->specific = 1; +// if (cfbg->desk_x >= 0 && cfbg->desk_y >= 0) +// cfdata->all_this_desk_screen = E_CONFIG_WALLPAPER_DESK; +// else +// cfdata->all_this_desk_screen = E_CONFIG_WALLPAPER_SCREEN; + } + info->bg_file = strdup(cfbg->file); + } + if ((!info->bg_file) && (e_config->desktop_default_background)) + { + // default bg + info->bg_file = strdup(e_config->desktop_default_background); + } + else + { + // use theme bg +// info->use_theme_bg = 1; + } + + info->iw = 256; + info->ih = (zone->h * 256) / (zone->w); + + win = e_win_new(con); + if (!win) + { + free(info); + info = NULL; + return; + } + + snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds", e_user_homedir_get()); + info->dirs = eina_list_append(info->dirs, strdup(buf)); + snprintf(buf, sizeof(buf), "%s/data/backgrounds", e_prefix_data_get()); + info->dirs = eina_list_append(info->dirs, strdup(buf)); + + e_win_title_set(win, _("Wallpaer Settings")); + e_win_name_class_set(win, "E", "_config_wallpaper_dialog"); + e_win_border_icon_set(win, "preferences-desktop-wallpaper"); + e_win_resize_callback_set(win, _resize); + e_win_delete_callback_set(win, _delete); + + // bg + container + info->bg = edje_object_add(win->evas); + e_theme_edje_object_set(info->bg, "base/theme/widgets", + "e/conf/wallpaper/main/window"); + + // ok button + info->box = e_widget_list_add(win->evas, 1, 1); + + info->button = e_widget_button_add(win->evas, _("OK"), NULL, + _ok, NULL, NULL); + evas_object_show(info->button); + e_widget_list_object_append(info->box, info->button, 1, 0, 0.5); + + e_widget_min_size_get(info->box, &mw, &mh); + edje_extern_object_min_size_set(info->box, mw, mh); + edje_object_part_swallow(info->bg, "e.swallow.buttons", info->box); + evas_object_show(info->box); + + // preview + info->preview = e_livethumb_add(win->evas); + e_livethumb_vsize_set(info->preview, zone->w, zone->h); + edje_extern_object_aspect_set(info->preview, EDJE_ASPECT_CONTROL_NEITHER, zone->w, zone->h); + edje_object_part_swallow(info->bg, "e.swallow.preview", info->preview); + evas_object_show(info->preview); + + info->mini = edje_object_add(e_livethumb_evas_get(info->preview)); + e_livethumb_thumb_set(info->preview, info->mini); + evas_object_show(info->mini); + if (info->bg_file) + edje_object_file_set(info->mini, info->bg_file, "e/desktop/background"); + else + { + const char *f = e_theme_edje_file_get("base/theme/backgrounds", + "e/desktop/background"); + edje_object_file_set(info->mini, f, "e/desktop/background"); + } + + // scrolled thumbs + info->span = _pan_add(win->evas); + // FIXME: init span + + // the scrollframe holding the scrolled thumbs + info->sframe = e_scrollframe_add(win->evas); + e_scrollframe_custom_theme_set(info->sframe, "base/theme/widgets", + "e/conf/wallpaper/main/scrollframe"); + e_scrollframe_extern_pan_set(info->sframe, info->span, + _pan_set, _pan_get, _pan_max_get, + _pan_child_size_get); + edje_object_part_swallow(info->bg, "e.swallow.list", info->sframe); + evas_object_show(info->sframe); + evas_object_show(info->span); + + // min size calc + edje_object_size_min_calc(info->bg, &mw, &mh); + e_win_size_min_set(win, mw, mh); + if ((zone->w / 4) > mw) mw = (zone->w / 4); + if ((zone->h / 4) > mh) mh = (zone->h / 4); + e_win_resize(win, mw, mh); + e_win_centered_set(win, 1); + e_win_show(win); + + evas_object_resize(info->bg, win->w, win->h); + evas_object_show(info->bg); + + _scan(); +} + +void +wp_conf_hide(void) +{ + if (!win) return; + // del other stuff + free(info); + info = NULL; + e_object_del(E_OBJECT(win)); + win = NULL; +} diff --git a/src/modules/conf_wallpaper2/e_int_config_wallpaper.h b/src/modules/conf_wallpaper2/e_int_config_wallpaper.h new file mode 100644 index 000000000..6074a8ae8 --- /dev/null +++ b/src/modules/conf_wallpaper2/e_int_config_wallpaper.h @@ -0,0 +1,14 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifdef E_TYPEDEFS +//typedef struct _E_Config_Wallpaper E_Config_Wallpaper; +#else +#ifndef E_INT_CONFIG_WALLPAPER_H +#define E_INT_CONFIG_WALLPAPER_H + +void wp_conf_show(E_Container *con, const char *params); +void wp_conf_hide(void); + +#endif +#endif diff --git a/src/modules/conf_wallpaper2/e_mod_main.c b/src/modules/conf_wallpaper2/e_mod_main.c new file mode 100644 index 000000000..c2a3f7a28 --- /dev/null +++ b/src/modules/conf_wallpaper2/e_mod_main.c @@ -0,0 +1,99 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" +#include "e_mod_main.h" + +/***************************************************************************/ +/**/ +/* actual module specifics */ + +static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_mod_menu_add(void *data, E_Menu *m); + +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 = +{ + E_MODULE_API_VERSION, + "Settings - Wallpaper 2" +}; + +EAPI void * +e_modapi_init(E_Module *m) +{ + e_configure_registry_category_add("appearance", 10, _("Look"), NULL, "preferences-appearance"); + e_configure_registry_item_add("appearance/wallpaper2", 10, _("Wallpaper 2"), NULL, "preferences-desktop-wallpaper",wp_conf_show); + e_configure_registry_category_add("internal", -1, _("Internal"), NULL, "enlightenment/internal"); +// e_configure_registry_item_add("internal/wallpaper_desk", -1, _("Wallpaper 2"), NULL, "preferences-system-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 2"), "preferences-desktop-wallpaper", +// 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; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + E_Config_Dialog *cfd; + /* remove module-supplied menu additions */ + if (maug) + { + 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)); +// e_configure_registry_item_del("internal/wallpaper_desk"); + e_configure_registry_category_del("internal"); + e_configure_registry_item_del("appearance/wallpaper2"); + 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; +} + +EAPI int +e_modapi_save(E_Module *m) +{ + return 1; +} + +/* menu item callback(s) */ +static void +_e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi) +{ + e_configure_registry_call("appearance/wallpaper2", m->zone->container, NULL); +} + +/* menu item add hook */ +static void +_e_mod_menu_add(void *data, E_Menu *m) +{ + E_Menu_Item *mi; + + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Wallpaper 2")); + e_util_menu_item_theme_icon_set(mi, "preferences-desktop-wallpaper"); + e_menu_item_callback_set(mi, _e_mod_run_cb, NULL); +} diff --git a/src/modules/conf_wallpaper2/e_mod_main.h b/src/modules/conf_wallpaper2/e_mod_main.h new file mode 100644 index 000000000..2f3851056 --- /dev/null +++ b/src/modules/conf_wallpaper2/e_mod_main.h @@ -0,0 +1,18 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifndef E_MOD_MAIN_H +#define E_MOD_MAIN_H + +#define E_TYPEDEFS 1 +#include "e_int_config_wallpaper.h" +#undef E_TYPEDEFS +#include "e_int_config_wallpaper.h" + +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); + +#endif diff --git a/src/modules/conf_wallpaper2/module.desktop.in b/src/modules/conf_wallpaper2/module.desktop.in new file mode 100644 index 000000000..da8a2e539 --- /dev/null +++ b/src/modules/conf_wallpaper2/module.desktop.in @@ -0,0 +1,30 @@ +[Desktop Entry] +Type=Link +Name=Settings - Wallpaper 2 +Name[cs]=Nastavení - pozadí plochy +Name[de]= +Name[eo]=Agordo - Tapeto +Name[es]=Configuración - Fondo de pantalla +Name[fr]=Configuration - Fond d'écran +Name[hu]=Beállítások - Háttérkép +Name[it]=Configurazione - Sfondo +Name[ja]= +Name[pt]= +Name[pt_BR]= +Name[zh_CN]= +Name[zh_TW]= +Icon=e-module-conf_wallpaper2 +Comment=E17 Settings Applet
Used to pick a wallpaper. +Comment[cs]=E17 applet nastavení
Použit k volbě pozadí. +Comment[de]= +Comment[eo]=Aplikaĵeto de E17 agordo<title><br>Elekti tapeton. +Comment[es]=<title>Applet de configuración de E17
Para elegir un fondo de pantalla. +Comment[fr]=Appliquette de configuration pour E17
Permet de choisir un fond d'écran. +Comment[hu]=E17 beállító alkalmazás
Háttérkép beállító modul. +Comment[it]=Applet configurazione di E17
Usato per selezionare uno sfondo. +Comment[ja]= +Comment[pt]= +Comment[pt_BR]= +Comment[zh_CN]= +Comment[zh_TW]= +X-Enlightenment-ModuleType=config