metric pooch!


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 17 years ago
parent e2380a8d0f
commit f261c9e1a8
  1. 2
      src/bin/Makefile.am
  2. 62
      src/bin/e_bg.c
  3. 4
      src/bin/e_bg.h
  4. 114
      src/bin/e_filereg.c
  5. 20
      src/bin/e_filereg.h
  6. 21
      src/bin/e_fm.c
  7. 1
      src/bin/e_includes.h
  8. 14
      src/bin/e_int_config_wallpaper.c
  9. 14
      src/bin/e_main.c
  10. 7
      src/bin/e_theme.c

@ -173,6 +173,7 @@ e_obj_dialog.h \
e_int_config_transitions.h \
e_fwin.h \
e_widget_aspect.h \
e_filereg.h \
e_widget_desk_preview.h \
e_int_config_borders.h
@ -324,6 +325,7 @@ e_obj_dialog.c \
e_fwin.c \
e_widget_aspect.c \
e_widget_desk_preview.c \
e_filereg.c \
e_int_config_borders.c \
$(ENLIGHTENMENTHEADERS)

@ -7,8 +7,47 @@
static void _e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *source);
/* local subsystem globals */
static int _e_bg_reg_files = 0;
/* externally accessible functions */
EAPI int
e_bg_init(void)
{
Evas_List *l;
/* Register files in use */
if (e_config->desktop_default_background)
e_filereg_register(e_config->desktop_default_background);
for (l = e_config->desktop_backgrounds; l; l = l->next)
{
E_Config_Desktop_Background *cfbg;
cfbg = l->data;
e_filereg_register(cfbg->file);
}
return 1;
}
EAPI int
e_bg_shutdown(void)
{
Evas_List *l;
/* Register files in use */
if (e_config->desktop_default_background)
e_filereg_deregister(e_config->desktop_default_background);
for (l = e_config->desktop_backgrounds; l; l = l->next)
{
E_Config_Desktop_Background *cfbg;
cfbg = l->data;
e_filereg_deregister(cfbg->file);
}
return 1;
}
EAPI const char *
e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
{
@ -165,6 +204,24 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
}
}
EAPI void
e_bg_default_set(char * file)
{
if (e_config->desktop_default_background)
{
e_filereg_deregister(e_config->desktop_default_background);
evas_stringshare_del(e_config->desktop_default_background);
}
if (file)
{
e_filereg_register(file);
e_config->desktop_default_background = evas_stringshare_add(file);
}
else
e_config->desktop_default_background = NULL;
}
EAPI void
e_bg_add(int container, int zone, int desk_x, int desk_y, char *file)
{
@ -178,6 +235,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, char *file)
cfbg->desk_y = desk_y;
cfbg->file = evas_stringshare_add(file);
e_config->desktop_backgrounds = evas_list_append(e_config->desktop_backgrounds, cfbg);
e_filereg_register(cfbg->file);
}
EAPI void
@ -194,6 +252,7 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
(cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
{
e_config->desktop_backgrounds = evas_list_remove_list(e_config->desktop_backgrounds, l);
e_filereg_deregister(cfbg->file);
if (cfbg->file) evas_stringshare_del(cfbg->file);
free(cfbg);
break;
@ -208,7 +267,7 @@ e_bg_update(void)
E_Manager *man;
E_Container *con;
E_Zone *zone;
for (l = e_manager_list(); l; l = l->next)
{
man = l->data;
@ -249,3 +308,4 @@ _e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *sou
evas_object_clip_set(zone->bg_object, zone->bg_clip_object);
evas_object_show(zone->bg_object);
}

@ -14,10 +14,14 @@ typedef enum {
#ifndef E_BG_H
#define E_BG_H
EAPI int e_bg_init(void);
EAPI int e_bg_shutdown(void);
EAPI const char *e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y);
EAPI void e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition);
EAPI void e_bg_add(int container, int zone, int desk_x, int desk_y, char *file);
EAPI void e_bg_del(int container, int zone, int desk_x, int desk_y);
EAPI void e_bg_default_set(char *file);
EAPI void e_bg_update(void);
#endif

@ -0,0 +1,114 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/*
* Implementation of a protected file registry. Any files that are
* currently being used by E in core components should be registered
* here and will be protected as best as E can. :)
*/
/* Local subsystem globals */
static Evas_List *_e_filereg = NULL;
typedef struct _Filereg_Item Filereg_Item;
struct _Filereg_Item
{
char * path;
int ref_count;
};
/* Externally accessible functions */
EAPI int
e_filereg_init(void)
{
return 1;
}
EAPI int
e_filereg_shutdown(void)
{
Evas_List * ll;
Filereg_Item * item;
/* Delete all strings in the hash */
for (ll = _e_filereg; ll; ll = ll->next)
{
item = ll->data;
E_FREE(item->path);
E_FREE(item);
}
_e_filereg = evas_list_free(_e_filereg);
}
EAPI int
e_filereg_register(const char * path)
{
Evas_List * ll;
Filereg_Item * item;
for (ll = _e_filereg; ll; ll = ll->next)
{
item = ll->data;
if (!strcmp(item->path, path))
{
/* File already registered, increment ref. count */
item->ref_count++;
return 1;
}
}
/* Doesn't exist so add to list. */
item = E_NEW(Filereg_Item, 1);
if (!item) return 0;
item->path = strdup(path);
item->ref_count = 1;
_e_filereg = evas_list_append(_e_filereg, item);
return 1;
}
EAPI void
e_filereg_deregister(const char * path)
{
Evas_List * ll;
Filereg_Item * item;
for (ll = _e_filereg; ll; ll = ll->next)
{
item = ll->data;
if (!strcmp(item->path, path))
{
item->ref_count--;
if (item->ref_count == 0)
{
_e_filereg = evas_list_remove_list(_e_filereg, ll);
E_FREE(item->path);
E_FREE(item);
}
return;
}
}
}
EAPI Evas_Bool
e_filereg_file_protected(const char * path)
{
Evas_List * ll;
Filereg_Item * item;
for (ll = _e_filereg; ll; ll = ll->next)
{
item = ll->data;
if (!strcmp(item->path, path))
return 1;
}
return 0;
}

@ -0,0 +1,20 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_FILEREG_H
#define E_FILEREG_H
EAPI int e_filereg_init(void);
EAPI int e_filereg_shutdown(void);
EAPI int e_filereg_register(const char * path);
EAPI void e_filereg_deregister(const char * path);
EAPI Evas_Bool e_filereg_file_protected(const char * path);
#endif
#endif

@ -4223,7 +4223,8 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp)
E_Manager *man;
E_Container *con;
E_Zone *zone;
int x, y, can_w, can_w2;
Evas_List *sel;
int x, y, can_w, can_w2, protected;
char buf[4096];
sd = ic->sd;
@ -4308,7 +4309,17 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp)
snprintf(buf, sizeof(buf), "%s/.order", sd->realpath);
if (ecore_file_can_write(buf)) can_w = 1;
}
if ((can_w) && (can_w2))
sel = e_fm2_selected_list_get(ic->sd->obj);
if ((!sel) || evas_list_count(sel) == 1)
{
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file);
protected = e_filereg_file_protected(buf);
}
else
protected = 0;
if ((can_w) && (can_w2) && !(protected))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
@ -4556,6 +4567,8 @@ _e_fm2_file_rename_yes_cb(char *text, void *data)
snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->sd->realpath, ic->info.file);
snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text);
}
if (e_filereg_file_protected(oldpath)) return;
if (!ecore_file_mv(oldpath, newpath))
{
man = e_manager_current_get();
@ -4665,7 +4678,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
e_object_del(E_OBJECT(dialog));
sel = e_fm2_selected_list_get(ic->sd->obj);
if (sel)
if (sel && (evas_list_count(sel) != 1))
{
for (l = sel; l; l = l->next)
{
@ -4674,6 +4687,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
if (!ici->pseudo_link)
{
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file);
if (e_filereg_file_protected(buf)) continue;
/* FIXME: recursive rm might block - need to get smart */
if (!(ecore_file_recursive_rm(buf)))
@ -4713,6 +4727,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
if (!ic->info.pseudo_link)
{
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
if (e_filereg_file_protected(buf)) return;
/* FIXME: recursive rm might block - need to get smart */
if (!(ecore_file_recursive_rm(buf)))

@ -148,6 +148,7 @@
#include "e_int_config_transitions.h"
#include "e_obj_dialog.h"
#include "e_fwin.h"
#include "e_filereg.h"
#include "e_widget_aspect.h"
#include "e_widget_desk_preview.h"
#include "e_int_config_borders.h"

@ -515,12 +515,10 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfbg = e_config->desktop_backgrounds->data;
e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y);
}
if (e_config->desktop_default_background)
evas_stringshare_del(e_config->desktop_default_background);
if ((cfdata->use_theme_bg) || (!cfdata->bg))
e_config->desktop_default_background = NULL;
e_bg_default_set(NULL);
else
e_config->desktop_default_background = evas_stringshare_add(cfdata->bg);
e_bg_default_set(cfdata->bg);
cfdata->all_this_desk_screen = 0;
@ -681,9 +679,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfbg = e_config->desktop_backgrounds->data;
e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y);
}
if (e_config->desktop_default_background)
evas_stringshare_del(e_config->desktop_default_background);
e_config->desktop_default_background = NULL;
e_bg_default_set(NULL);
}
else
{
@ -695,9 +691,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfbg = e_config->desktop_backgrounds->data;
e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y);
}
if (e_config->desktop_default_background)
evas_stringshare_del(e_config->desktop_default_background);
e_config->desktop_default_background = evas_stringshare_add(cfdata->bg);
e_bg_default_set(cfdata->bg);
}
else if (cfdata->all_this_desk_screen == 1)
{

@ -489,6 +489,13 @@ main(int argc, char **argv)
_e_main_shutdown(-1);
}
_e_main_shutdown_push(_e_main_dirs_shutdown);
/* setup file registry */
if (!e_filereg_init())
{
e_error_message_show(_("Enlightenment cannot set up its file registry system."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_filereg_shutdown);
/* init config system */
if (!e_config_init())
{
@ -553,6 +560,13 @@ main(int argc, char **argv)
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_theme_shutdown);
/* init desktop background system */
if (!e_bg_init())
{
e_error_message_show(_("Enlightenment cannot set up its desktop background system."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_bg_init);
if (!((!e_config->show_splash) || (after_restart)))
{
/* setup init status window/screen */

@ -271,6 +271,7 @@ EAPI void
e_theme_file_set(const char *category, const char *file)
{
E_Theme_Result *res;
char buf[4096];
if (group_cache)
{
@ -282,12 +283,16 @@ e_theme_file_set(const char *category, const char *file)
if (res)
{
mappings = evas_hash_del(mappings, category, res);
if (res->file) evas_stringshare_del(res->file);
if (res->file) {
e_filereg_deregister(res->file);
evas_stringshare_del(res->file);
}
if (res->cache) evas_stringshare_del(res->cache);
free(res);
}
res = calloc(1, sizeof(E_Theme_Result));
res->file = evas_stringshare_add(file);
e_filereg_register(res->file);
mappings = evas_hash_add(mappings, category, res);
}

Loading…
Cancel
Save