Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_eap_editor.c e_eap_editor.h e_int_config_apps.c 


Log Message:


fix some buglets

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- e_eap_editor.c      3 Sep 2006 12:52:40 -0000       1.50
+++ e_eap_editor.c      3 Sep 2006 15:11:04 -0000       1.51
@@ -3,22 +3,6 @@
  */
 #include "e.h"
 
-typedef struct _E_App_Edit E_App_Edit;
-
-struct _E_App_Edit
-{
-   E_App       *eap;
-   Evas        *evas;
-
-   Evas_Object *img;
-   Evas_Object *img_widget;
-   Evas_Object *fsel;
-   E_Dialog    *fsel_dia;
-   int          img_set;
-
-   E_Config_Dialog *cfd;
-};
-
 struct _E_Config_Dialog_Data
 {
    E_App eap;
@@ -46,6 +30,7 @@
 
 /* local subsystem functions */
 
+static void           _e_eap_edit_free(E_App_Edit *editor);
 static void           _e_eap_edit_fill_data(E_Config_Dialog_Data *cdfata);
 static void          *_e_eap_edit_create_data(E_Config_Dialog *cfd);
 static void           _e_eap_edit_free_data(E_Config_Dialog *cfd, 
E_Config_Dialog_Data *data);
@@ -64,7 +49,7 @@
 
 /* externally accessible functions */
 
-EAPI void
+EAPI E_App_Edit *
 e_eap_edit_show(E_Container *con, E_App *a)
 {
    E_Config_Dialog_View *v;
@@ -72,13 +57,13 @@
 
    if (!con) return;
 
-   editor = E_NEW(E_App_Edit, 1);
-   if (!editor) return;
+   editor = E_OBJECT_ALLOC(E_App_Edit, E_EAP_EDIT_TYPE, _e_eap_edit_free);
+   if (!editor) return NULL;;
    v = E_NEW(E_Config_Dialog_View, 1);
    if (!v)
      {
        free(editor);
-       return;
+       return NULL;
      }
 
    editor->img = NULL;
@@ -97,9 +82,34 @@
                                     _("Application Editor"), 
                                     "E", "_eap_editor_dialog",
                                     NULL, 0, v, editor);
+   return editor;
 }
 
 /* local subsystem functions */
+static void
+_e_eap_edit_free(E_App_Edit *editor)
+{
+   if (!editor) return;
+   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;
+   if (editor->eap->image) evas_stringshare_del(editor->eap->image);
+   editor->eap->width = 0;
+   editor->eap->height = 0;
+   e_object_unref(E_OBJECT(editor->eap));
+//     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);
+//     if (editor->fsel_dia) e_object_del(E_OBJECT(editor->fsel_dia));
+   free(editor);
+}
 
 static void
 _e_eap_edit_fill_data(E_Config_Dialog_Data *cfdata)
@@ -127,7 +137,6 @@
    IFDUP(cfdata->editor->eap->path, cfdata->eap.path);
    IFDUP(cfdata->editor->eap->icon_class, cfdata->eap.icon_class);
    IFDUP(cfdata->editor->eap->icon_path, cfdata->eap.icon_path);
-
 }
 
 static void *
@@ -158,27 +167,19 @@
    E_FREE(data->ipath);
    E_FREE(data->image);
 
-   if (data->eap.path)
-      free((char *) data->eap.path);
-   if (data->eap.icon_class)
-      free((char *) data->eap.icon_class);
-   if (data->eap.icon_path)
-      free((char *) data->eap.icon_path);
-
-   if (data->editor->eap->tmpfile) ecore_file_unlink(data->editor->eap->image);
-   data->editor->eap->tmpfile = 0;
-   if (data->editor->eap->image) 
evas_stringshare_del(data->editor->eap->image);
-   data->editor->eap->width = 0;
-   data->editor->eap->height = 0;
+   if (data->eap.path) free((char *) data->eap.path);
+   if (data->eap.icon_class) free((char *) data->eap.icon_class);
+   if (data->eap.icon_path) free((char *) data->eap.icon_path);
+   
    if (data->editor)
      {
-       e_object_unref(E_OBJECT(data->editor->eap));
-//     if (data->editor->img) evas_object_del(data->editor->img);
-//     if (data->editor->img_widget) evas_object_del(data->editor->img_widget);
-//     if (data->editor->fsel) evas_object_del(data->editor->fsel);
-//     if (data->editor->fsel_dia) 
e_object_del(E_OBJECT(data->editor->fsel_dia));
-       free(data->editor);
+       E_Object *obj;
+       
+       obj = E_OBJECT(data->editor);
+       data->editor = NULL;
+       e_object_del(obj);
      }
+
    free(data);
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_eap_editor.h      27 Oct 2005 10:19:43 -0000      1.5
+++ e_eap_editor.h      3 Sep 2006 15:11:04 -0000       1.6
@@ -1,9 +1,33 @@
+/*
+  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+  */
 #ifdef E_TYPEDEFS
+
+typedef struct _E_App_Edit E_App_Edit;
+
 #else
 #ifndef E_EAP_EDIT_H
 #define E_EAP_EDIT_H
 
-EAPI void e_eap_edit_show(E_Container *con, E_App *a);
+#define E_EAP_EDIT_TYPE 0xE0b01019
+
+struct _E_App_Edit
+{
+   E_Object                     e_obj_inherit;
+   
+   E_App       *eap;
+   Evas        *evas;
+   
+   Evas_Object *img;
+   Evas_Object *img_widget;
+   Evas_Object *fsel;
+   E_Dialog    *fsel_dia;
+   int          img_set;
+   
+   E_Config_Dialog *cfd;
+};
+
+EAPI E_App_Edit *e_eap_edit_show(E_Container *con, E_App *a);
 
 #endif
 #endif
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_apps.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- e_int_config_apps.c 3 Sep 2006 14:27:51 -0000       1.17
+++ e_int_config_apps.c 3 Sep 2006 15:11:04 -0000       1.18
@@ -44,6 +44,7 @@
       Evas_Object *o_move_up_button;
       Evas_Object *o_move_down_button;
    } gui;
+   E_App_Edit *editor;
 };
 
 struct _E_Config_Once
@@ -135,7 +136,7 @@
 }
 
 static void
-_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
+_cb_files_dir_changed(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    
@@ -145,69 +146,85 @@
      {
        if (cfdata->gui.o_up_button)
          e_widget_disabled_set(cfdata->gui.o_up_button, 1);
-       if (cfdata->gui.o_move_up_button)
-         e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
-       if (cfdata->gui.o_move_down_button)
-         e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
      }
    else
      {
-        const char *realpath;
-        char buf[4096];
-
-        realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
-        snprintf(buf, sizeof(buf), "%s/.order", realpath);
-        if (ecore_file_exists(buf))
-          {
-             if (cfdata->gui.o_move_up_button)
-               e_widget_disabled_set(cfdata->gui.o_move_up_button, 0);
-             if (cfdata->gui.o_move_down_button)
-               e_widget_disabled_set(cfdata->gui.o_move_down_button, 0);
-          }
-       else
-          {
-             if (cfdata->gui.o_move_up_button)
-               e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
-             if (cfdata->gui.o_move_down_button)
-               e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
-          }
        if (cfdata->gui.o_up_button)
          e_widget_disabled_set(cfdata->gui.o_up_button, 0);
      }
+   if (cfdata->gui.o_move_up_button)
+     e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
+   if (cfdata->gui.o_move_down_button)
+     e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
    if (cfdata->gui.o_frame)
      e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
 }
 
 static void
-_cb_button_create(void *data1, void *data2)
+_cb_files_sel_changed(void *data, Evas_Object *obj, void *event_info)
 {
-   E_App *a;
    E_Config_Dialog_Data *cfdata;
+   const char *realpath;
+   char buf[4096];
+   
+   cfdata = data;
+   if (!cfdata->gui.o_fm) return;
+   realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
+   snprintf(buf, sizeof(buf), "%s/.order", realpath);
+   if (ecore_file_exists(buf))
+     {
+       if (cfdata->gui.o_move_up_button)
+         e_widget_disabled_set(cfdata->gui.o_move_up_button, 0);
+       if (cfdata->gui.o_move_down_button)
+         e_widget_disabled_set(cfdata->gui.o_move_down_button, 0);
+     }
+   else
+     {
+       if (cfdata->gui.o_move_up_button)
+         e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
+       if (cfdata->gui.o_move_down_button)
+         e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
+     }
+}
 
-   cfdata = data1;
-   a = e_app_empty_new(NULL);
-   e_eap_edit_show(cfdata->cfd->con, a);
+static void
+_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
+{
+   E_Config_Dialog_Data *cfdata;
+   
+   cfdata = data;
+   if (!cfdata->gui.o_fm) return;
+   if (cfdata->gui.o_move_up_button)
+     e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
+   if (cfdata->gui.o_move_down_button)
+     e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
 }
 
 static void
-_cb_files_selection_changed_all(void *data, Evas_Object *obj, void *event_info)
+_cb_editor_del(E_Object *obj)
 {
    E_Config_Dialog_Data *cfdata;
-   Evas_List *selected;
+   
+   cfdata = e_object_data_get(obj);
+   cfdata->editor = NULL;
+   e_object_del_attach_func_set(obj, NULL);
+   e_object_data_set(obj, NULL);
+   e_fm2_refresh(cfdata->gui.o_fm);
+   e_fm2_refresh(cfdata->gui.o_fm_all);
+}
 
-   cfdata = data;
-   if (!cfdata->gui.o_fm_all) return;
-   selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
-   if (selected)
-      {
-         if (cfdata->gui.o_add_button)
-            e_widget_disabled_set(cfdata->gui.o_add_button, 0);
-      }
-   else
-      {
-         if (cfdata->gui.o_add_button)
-            e_widget_disabled_set(cfdata->gui.o_add_button, 1);
-      }
+static void
+_cb_button_create(void *data1, void *data2)
+{
+   E_App *a;
+   E_Config_Dialog_Data *cfdata;
+   
+   cfdata = data1;
+   a = e_app_empty_new(NULL);
+   if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
+   cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
+   e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
+   e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
 }
 
 static void
@@ -234,7 +251,30 @@
    if (ecore_file_is_dir(buf)) return;
    a = e_app_new(buf, 0);
    if (a)
-      e_eap_edit_show(cfdata->cfd->con, a);
+     {
+       if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
+       cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
+       e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
+       e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
+     }
+}
+
+static void
+_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
+{
+   E_Config_Dialog_Data *cfdata;
+   
+   cfdata = data;
+   e_widget_disabled_set(cfdata->gui.o_add_button, 0);
+}
+
+static void
+_cb_files_files_changed(void *data, Evas_Object *obj, void *event_info)
+{
+   E_Config_Dialog_Data *cfdata;
+   
+   cfdata = data;
+   e_widget_disabled_set(cfdata->gui.o_add_button, 1);
 }
 
 static void
@@ -261,7 +301,12 @@
    if (ecore_file_is_dir(buf)) return;
    a = e_app_new(buf, 0);
    if (a)
-      e_eap_edit_show(cfdata->cfd->con, a);
+     {
+       if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
+       cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
+       e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
+       e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
+     }
 }
 
 static void
@@ -426,12 +471,12 @@
    fmc_all.selection.single = 1;
    fmc_all.selection.windows_modifiers = 0;
    e_fm2_config_set(mt, &fmc_all);
-   evas_object_smart_callback_add(mt, "changed",
-                                 _cb_files_selection_changed_all, cfdata);
    evas_object_smart_callback_add(mt, "selected",
                                  _cb_files_selected, cfdata);
    evas_object_smart_callback_add(mt, "selection_change",
-                                 _cb_files_selection_changed_all, cfdata);
+                                 _cb_files_selection_change, cfdata);
+   evas_object_smart_callback_add(mt, "changed",
+                                 _cb_files_files_changed, cfdata);
    e_fm2_icon_menu_start_extend_callback_set(mt, _cb_files_add_edited, cfdata);
    snprintf(path_all, sizeof(path_all), "%s/.e/e/applications/all", homedir);
    e_fm2_path_set(cfdata->gui.o_fm_all, path_all, "/");
@@ -449,11 +494,11 @@
       mt = e_widget_button_add(evas, _(once->label), "enlightenment/e",
                           _cb_button_add, cfdata, NULL);
    else
-      mt = e_widget_button_add(evas, _("Add application ->"), 
"enlightenment/e",
+      mt = e_widget_button_add(evas, _("Add application..."), 
"enlightenment/e",
                           _cb_button_add, cfdata, NULL);
    cfdata->gui.o_add_button = mt;
    e_widget_framelist_object_append(of, mt);
-   e_widget_disabled_set(cfdata->gui.o_add_button, 1);
+   e_widget_disabled_set(mt, 1);
 
    if (!once)
       {
@@ -496,7 +541,11 @@
          fmc.selection.windows_modifiers = 0;
          e_fm2_config_set(mt, &fmc);
          evas_object_smart_callback_add(mt, "dir_changed",
-                                 _cb_files_changed, cfdata);
+                                       _cb_files_dir_changed, cfdata);
+         evas_object_smart_callback_add(mt, "selection_change",
+                                       _cb_files_sel_changed, cfdata);
+         evas_object_smart_callback_add(mt, "changed",
+                                       _cb_files_changed, cfdata);
          snprintf(path, sizeof(path), "%s/.e/e/applications", homedir);
          e_fm2_path_set(cfdata->gui.o_fm, path, "/");
 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to