summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2007-10-14 16:06:51 +0000
committerChristopher Michael <cpmichael1@comcast.net>2007-10-14 16:06:51 +0000
commitce341fa4dfc26afe9e7e414c453963fb757d2dee (patch)
treed8df98a0b21132016b1de0e9cc75773d1abd22ec /src/bin/e_bg.c
parent98d70425c2adfd33875a60ac23c5f0db57f91d58 (diff)
E_FM Context Menus :)
Big Thanks to CodeWarrior for his help !!! Add context handler for backgrounds. Can now right-click an .edj and Set as Background. SVN revision: 32068
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index ca75b7c..9b1bc78 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -9,6 +9,7 @@ static void _e_bg_event_bg_update_free(void *data, void *event);
9 9
10/* local subsystem globals */ 10/* local subsystem globals */
11EAPI int E_EVENT_BG_UPDATE = 0; 11EAPI int E_EVENT_BG_UPDATE = 0;
12static E_Fm2_Mime_Handler *bg_hdl = NULL;
12 13
13/* externally accessible functions */ 14/* externally accessible functions */
14EAPI int 15EAPI int
@@ -16,6 +17,12 @@ e_bg_init(void)
16{ 17{
17 Evas_List *l = NULL; 18 Evas_List *l = NULL;
18 19
20 /* Register mime handler */
21 bg_hdl = e_fm2_mime_handler_new(_("Set As Background"), NULL,
22 e_bg_handler_set, NULL,
23 e_bg_handler_test, NULL);
24 e_fm2_mime_handler_glob_add(bg_hdl, "*.edj");
25
19 /* Register files in use */ 26 /* Register files in use */
20 if (e_config->desktop_default_background) 27 if (e_config->desktop_default_background)
21 e_filereg_register(e_config->desktop_default_background); 28 e_filereg_register(e_config->desktop_default_background);
@@ -38,7 +45,10 @@ e_bg_shutdown(void)
38{ 45{
39 Evas_List *l = NULL; 46 Evas_List *l = NULL;
40 47
41 /* Register files in use */ 48 /* Deregister mime handler */
49 if (bg_hdl) e_fm2_mime_handler_free(bg_hdl);
50
51 /* Deregister files in use */
42 if (e_config->desktop_default_background) 52 if (e_config->desktop_default_background)
43 e_filereg_deregister(e_config->desktop_default_background); 53 e_filereg_deregister(e_config->desktop_default_background);
44 54
@@ -330,8 +340,32 @@ e_bg_update(void)
330 } 340 }
331} 341}
332 342
333/* local subsystem functions */ 343EAPI void
344e_bg_handler_set(Evas_Object *obj, const char *path, void *data)
345{
346 E_Container *con;
347 E_Zone *zone;
348 E_Desk *desk;
349
350 if (!path) return;
351 con = e_container_current_get(e_manager_current_get());
352 zone = e_zone_current_get(con);
353 desk = e_desk_current_get(zone);
354 e_bg_del(con->num, zone->num, desk->x, desk->y);
355 e_bg_add(con->num, zone->num, desk->x, desk->y, (char *)path);
356 e_bg_update();
357 e_config_save_queue();
358}
359
360EAPI int
361e_bg_handler_test(Evas_Object *obj, const char *path, void *data)
362{
363 if (!path) return 0;
364 if (edje_file_group_exists(path, "e/desktop/background")) return 1;
365 return 0;
366}
334 367
368/* local subsystem functions */
335static void 369static void
336_e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *source) 370_e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *source)
337{ 371{