Enlightenment CVS committal
Author : onefang
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_apps.c e_eap_editor.c
Log Message:
*Put in some more refs/unrefs for E_Apps, maybe need more, maybe I went
overboard.
*Fix up E_App saving.
*More object checking.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -3 -r1.191 -r1.192
--- e_apps.c 17 Sep 2006 02:05:19 -0000 1.191
+++ e_apps.c 18 Sep 2006 20:52:59 -0000 1.192
@@ -390,6 +390,7 @@
{
a2->parent = a;
a->subapps = evas_list_append(a->subapps, a2);
+ e_object_ref(E_OBJECT(a2));
}
}
else
@@ -413,6 +414,7 @@
{
a3->parent = a;
a->subapps = evas_list_append(a->subapps, a3);
+ e_object_ref(E_OBJECT(a3));
a2->references =
evas_list_append(a2->references, a3);
#if ! NO_APP_LIST
_e_apps_list = evas_list_prepend(_e_apps_list,
a3);
@@ -654,6 +656,7 @@
before->parent->subapps =
evas_list_prepend_relative(before->parent->subapps,
add, before);
+ e_object_ref(E_OBJECT(add));
add->parent = before->parent;
/* Check if this app is in the trash */
@@ -680,6 +683,7 @@
if ((!add) || (!parent)) return;
parent->subapps = evas_list_append(parent->subapps, add);
+ e_object_ref(E_OBJECT(add));
add->parent = parent;
/* Check if this app is in the trash */
@@ -793,6 +797,8 @@
char buf[PATH_MAX];
if (!a) return;
+ E_OBJECT_CHECK(a);
+ E_OBJECT_TYPE_CHECK(a, E_APP_TYPE);
if (!a->parent) return;
a->parent->subapps = evas_list_remove(a->parent->subapps, a);
@@ -881,6 +887,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
for (ll = a->instances; ll; ll = ll->next)
{
E_App_Instance *ai;
@@ -916,6 +924,8 @@
for (l = _e_apps_list; l; l = l->next)
{
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
ok = 0;
if ((a->win_name) || (a->win_class) || (a->win_title) || (a->win_role))
{
@@ -986,6 +996,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->path)
{
char *p;
@@ -1020,6 +1032,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->path)
{
if (!strcmp(a->path, path))
@@ -1046,6 +1060,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->name)
{
if (!strcasecmp(a->name, name))
@@ -1071,6 +1087,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->generic)
{
if (!strcasecmp(a->generic, generic))
@@ -1096,6 +1114,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->exe)
{
if (!strcmp(a->exe, exe))
@@ -1123,6 +1143,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->name)
{
if (e_util_glob_case_match(a->name, name))
@@ -1144,6 +1166,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->generic)
{
if (e_util_glob_case_match(a->generic, generic))
@@ -1165,6 +1189,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->exe)
{
if (e_util_glob_match(a->exe, exe))
@@ -1186,6 +1212,8 @@
E_App *a;
a = l->data;
+ E_OBJECT_CHECK_RETURN(a, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
if (a->comment)
{
if (e_util_glob_case_match(a->comment, comment))
@@ -1331,12 +1359,15 @@
const char *lang, *ext = NULL;
int new_eap = 0;
+ E_OBJECT_CHECK(a);
+ E_OBJECT_TYPE_CHECK(a, E_APP_TYPE);
/* Check if it's a new one that has not been saved yet. */
if (a->path)
ext = ecore_file_get_file(a->path);
if ( (!a->path) || ((strncmp(ext, "_new_app_", 9) == 0) &&
(!ecore_file_exists(a->path))) )
{
snprintf(buf, sizeof(buf), "%s/%s.desktop", _e_apps_all->path,
a->name);
+ if (a->path) evas_stringshare_del(a->path);
a->path = evas_stringshare_add(buf);
}
if (!a->path) return;
@@ -1345,6 +1376,7 @@
{
/* Force it to be in all. */
snprintf(buf, sizeof(buf), "%s/%s", _e_apps_all->path,
ecore_file_get_file(a->path));
+ if (a->path) evas_stringshare_del(a->path);
a->path = evas_stringshare_add(buf);
}
if (!a->path) return;
@@ -1498,31 +1530,47 @@
eet_close(ef);
}
- if (a->parent)
- {
- Evas_List *l;
-
- snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", a->parent->path);
- ecore_file_unlink(buf);
- _e_app_change(a->parent, E_APP_CHANGE);
- _e_app_change(a, E_APP_CHANGE);
- for (l = a->references; l; l = l->next)
- {
- E_App *a2;
-
- a2 = l->data;
- if (_e_app_copy(a2, a)) _e_app_change(a2, E_APP_CHANGE);
- }
- _e_app_subdir_rescan(a->parent);
- }
if (new_eap)
{
/* Careful, if this is being created from the border icon, this E_App
is already part of the border. */
a->parent = _e_apps_all;
_e_apps_all->subapps = evas_list_append(_e_apps_all->subapps, a);
+ e_object_ref(E_OBJECT(a));
/* FIXME: Don't know if we need to copy and reference this since it is
in the repository. */
_e_app_change(a, E_APP_ADD);
}
+ else
+ {
+ Evas_List *l;
+
+ for (l = a->references; l; l = l->next)
+ {
+ E_App *a2;
+
+ a2 = l->data;
+ if (_e_app_copy(a2, a)) _e_app_change(a2, E_APP_CHANGE);
+ }
+ if (a->orig)
+ {
+ E_App *a2;
+
+ a2 = a->orig;
+ if (_e_app_copy(a2, a)) _e_app_change(a2, E_APP_CHANGE);
+ }
+ _e_app_change(a, E_APP_CHANGE);
+ if (a->parent)
+ {
+ snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", a->parent->path);
+ ecore_file_unlink(buf);
+ _e_app_change(a->parent, E_APP_CHANGE);
+ /* I don't think we need to rescan.
+ * A) we should be changing all the relevant stuff here.
+ * B) monitoring will catch other changes.
+ * C) it's a waste of time.
+ _e_app_subdir_rescan(a->parent);
+ */
+ }
+ }
}
EAPI void
@@ -1884,7 +1932,9 @@
if (a->references)
printf("BUG: A eapp copy shouldn't have any references!\n");
if (a->parent)
- a->parent->subapps = evas_list_remove(a->parent->subapps, a);
+ {
+ a->parent->subapps = evas_list_remove(a->parent->subapps, a);
+ }
a->orig->references = evas_list_remove(a->orig->references, a);
#if ! NO_APP_LIST
_e_apps_list = evas_list_remove(_e_apps_list, a);
@@ -1959,6 +2009,8 @@
E_App *a2;
a2 = l->data;
+ E_OBJECT_CHECK_RETURN(a2, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(a2, E_APP_TYPE, NULL);
if ((a2->deleted) || ((a2->orig) && (a2->orig->deleted))) continue;
if (!strcmp(ecore_file_get_file(a2->path), ecore_file_get_file(file)))
return a2;
}
@@ -2191,6 +2243,7 @@
if (a2)
{
subapps = evas_list_append(subapps, a2);
+ e_object_ref(E_OBJECT(a2));
}
else
{
@@ -2207,6 +2260,7 @@
changes = evas_list_append(changes, ch);
subapps = evas_list_append(subapps, a2);
+ e_object_ref(E_OBJECT(a2));
}
else
{
@@ -2236,6 +2290,7 @@
changes = evas_list_append(changes, ch);
subapps = evas_list_append(subapps, a3);
+ e_object_ref(E_OBJECT(a3));
a2->references =
evas_list_append(a2->references, a3);
#if ! NO_APP_LIST
_e_apps_list =
evas_list_prepend(_e_apps_list, a3);
@@ -2268,12 +2323,10 @@
ch = E_NEW(E_App_Change_Info, 1);
ch->app = a2;
ch->change = E_APP_DEL;
- /* We don't need to ref this,
- * it has an extra ref
- e_object_ref(E_OBJECT(ch->app));
- */
+ e_object_ref(E_OBJECT(ch->app));
changes = evas_list_append(changes, ch);
}
+ e_object_unref(E_OBJECT(a2));
}
/* FIXME: We only need to tell about order changes if there are! */
evas_list_free(app->subapps);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- e_eap_editor.c 16 Sep 2006 20:59:40 -0000 1.56
+++ e_eap_editor.c 18 Sep 2006 20:52:59 -0000 1.57
@@ -95,20 +95,26 @@
_e_eap_edit_free(E_App_Edit *editor)
{
if (!editor) return;
+ E_OBJECT_CHECK(editor);
+ E_OBJECT_TYPE_CHECK(editor, E_EAP_EDIT_TYPE);
if (editor->cfd)
{
E_Object *obj;
-
+
obj = E_OBJECT(editor->cfd);
editor->cfd = NULL;
e_object_del(obj);
}
- if (editor->eap->tmpfile) ecore_file_unlink(editor->eap->image);
- editor->eap->tmpfile = 0;
- IFDEL(editor->eap->image);
- editor->eap->width = 0;
- editor->eap->height = 0;
- e_object_unref(E_OBJECT(editor->eap));
+ if (editor->eap)
+ {
+ if (editor->eap->tmpfile) ecore_file_unlink(editor->eap->image);
+ editor->eap->tmpfile = 0;
+ IFDEL(editor->eap->image);
+ editor->eap->width = 0;
+ editor->eap->height = 0;
+ e_object_unref(E_OBJECT(editor->eap));
+ editor->eap = NULL;
+ }
// if (editor->img) evas_object_del(editor->img);
// if (editor->img_widget) evas_object_del(editor->img_widget);
// if (editor->fsel) evas_object_del(editor->fsel);
@@ -233,7 +239,7 @@
else eap->height = 128;
if ((eap->name) && (eap->exe))
- e_app_fields_save(eap);
+ e_app_fields_save(eap);
return 1;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs