1. fm rename in-place patch. ok for now - probably should fix it up later
authorCarsten Haitzler <raster@rasterman.com>
Tue, 5 May 2009 14:27:28 +0000 (14:27 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Tue, 5 May 2009 14:27:28 +0000 (14:27 +0000)
2. config module fix

SVN revision: 40508

data/themes/default.edc
src/bin/e_fm.c
src/modules/conf/e_conf.c

index aabf49c..a56c49f 100644 (file)
@@ -13435,6 +13435,13 @@ collections { /* begin the collection of edje groups that are in this file */
               image.normal:  "icon_efm_dnd_move.png";
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
@@ -13848,6 +13855,13 @@ collections { /* begin the collection of edje groups that are in this file */
               image.normal:  "icon_efm_dnd_move.png";
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
@@ -15090,6 +15104,13 @@ collections { /* begin the collection of edje groups that are in this file */
               color: 0 0 0 0;
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
@@ -15555,6 +15576,13 @@ collections { /* begin the collection of edje groups that are in this file */
               color: 0 0 0 0;
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
@@ -16022,6 +16050,13 @@ collections { /* begin the collection of edje groups that are in this file */
               color: 0 0 0 0;
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
@@ -16488,6 +16523,13 @@ collections { /* begin the collection of edje groups that are in this file */
               color: 0 0 0 0;
            }
         }
+        part { name: "e.swallow.entry";
+           type: SWALLOW;
+           description { state: "default" 0.0;
+              rel1.to: "e.text.label";
+              rel2.to: "e.text.label";
+           }
+        }
       }
       programs {
         program { name: "go_active";
index eaa39f9..f149473 100644 (file)
@@ -127,6 +127,8 @@ struct _E_Fm2_Smart_Data
       int ox, oy;
       int x, y, w, h;
    } selrect;
+
+   E_Fm2_Icon         *iop_icon;
 };
 
 struct _E_Fm2_Region
@@ -147,6 +149,7 @@ struct _E_Fm2_Icon
    int               saved_rel;
    E_Menu           *menu;
    E_Entry_Dialog   *entry_dialog;
+   Evas_Object      *entry_widget;
    E_Config_Dialog  *prop_dialog;
    E_Dialog         *dialog;
 
@@ -324,6 +327,12 @@ static void _e_fm2_file_rename_yes_cb(char *text, void *data);
 static void _e_fm2_file_rename_no_cb(void *data);
 static void _e_fm2_file_properties(void *data, E_Menu *m, E_Menu_Item *mi);
 static void _e_fm2_file_properties_delete_cb(void *obj);
+static void _e_fm2_file_do_rename(const char *text, E_Fm2_Icon *ic);
+
+static Evas_Object* _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic);
+static void         _e_fm2_icon_entry_widget_del(E_Fm2_Icon *ic);
+static void         _e_fm2_icon_entry_widget_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void         _e_fm2_icon_entry_widget_accept(E_Fm2_Icon *ic);
 
 static void _e_fm_retry_abort_dialog(int pid, const char *str);
 static void _e_fm_retry_abort_delete_cb(void *obj);
@@ -4453,6 +4462,8 @@ _e_fm2_icon_free(E_Fm2_Icon *ic)
        e_object_del(E_OBJECT(ic->entry_dialog));
        ic->entry_dialog = NULL;
      }
+   if (ic->entry_widget)
+     _e_fm2_icon_entry_widget_del(ic);
    if (ic->prop_dialog)
      {
        e_object_del(E_OBJECT(ic->prop_dialog));
@@ -4669,6 +4680,9 @@ _e_fm2_icon_select(E_Fm2_Icon *ic)
      {
        const char *selectraise;
 
+        if(ic->sd->iop_icon)
+           _e_fm2_icon_entry_widget_accept(ic->sd->iop_icon);
+
        edje_object_signal_emit(ic->obj, "e,state,selected", "e");
        edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e");
        evas_object_stack_below(ic->obj, ic->sd->drop);
@@ -4688,6 +4702,9 @@ _e_fm2_icon_deselect(E_Fm2_Icon *ic)
      {
        const char *stacking, *selectraise;
 
+       if(ic->entry_widget)
+          _e_fm2_icon_entry_widget_accept(ic);
+
        edje_object_signal_emit(ic->obj, "e,state,unselected", "e");
        edje_object_signal_emit(ic->obj_icon, "e,state,unselected", "e");
         stacking = edje_object_data_get(ic->obj, "stacking");
@@ -6297,6 +6314,10 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
 
    ic = data;
    ev = event_info;
+
+   if (ic->entry_widget)
+      return;
+
    if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK))
      {
        /* if its a directory && open dirs in-place is set then change the dir
@@ -6340,6 +6361,9 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
    ic = data;
    ev = event_info;
 
+   if (ic->entry_widget)
+      return;
+
    if ((ev->button == 1) && (!ic->drag.dnd))
      {
        if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
@@ -6449,6 +6473,10 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
 
    ic = data;
    ev = event_info;
+
+   if (ic->entry_widget)
+      return;
+
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
    if ((ic->drag.start) && (ic->sd->eobj))
      {
@@ -6656,6 +6684,9 @@ _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
    sd = data;
    ev = event_info;
 
+   if(sd->iop_icon)
+      return;
+
    if (evas_key_modifier_is_set(ev->modifiers, "Control"))
      {
        if (!strcmp(ev->key, "x"))
@@ -8370,27 +8401,81 @@ static void
 _e_fm2_file_rename(void *data, E_Menu *m, E_Menu_Item *mi)
 {
    E_Fm2_Icon *ic;
-   E_Manager *man;
-   E_Container *con;
    char text[PATH_MAX + 256];
 
    ic = data;
-   if (ic->entry_dialog) return;
+   if (ic->entry_dialog || ic->entry_widget) return;
 
-   man = e_manager_current_get();
-   if (!man) return;
-   con = e_container_current_get(man);
-   if (!con) return;
+   if (!_e_fm2_icon_entry_widget_add(ic))
+     {
+        snprintf(text, PATH_MAX + 256,
+                    _("Rename %s to:"),
+                    ic->info.file);
+        ic->entry_dialog = e_entry_dialog_show(_("Rename File"), "edit-rename",
+                                  text, ic->info.file, NULL, NULL,
+                                              _e_fm2_file_rename_yes_cb,
+                                              _e_fm2_file_rename_no_cb, ic);
+        E_OBJECT(ic->entry_dialog)->data = ic;
+        e_object_del_attach_func_set(E_OBJECT(ic->entry_dialog), _e_fm2_file_rename_delete_cb);
+     }
+}
+
+static Evas_Object*
+_e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic)
+{
+   Evas_Object *eo;
+
+   if (ic->sd->iop_icon)
+      _e_fm2_icon_entry_widget_accept(ic->sd->iop_icon);
+
+   if (!edje_object_part_exists(ic->obj, "e.swallow.entry"))
+      return NULL;
+
+   ic->entry_widget = e_widget_entry_add(evas_object_evas_get(ic->obj),
+                                         NULL, NULL, NULL, NULL);
+   evas_object_event_callback_add(ic->entry_widget, EVAS_CALLBACK_KEY_DOWN,
+                                  _e_fm2_icon_entry_widget_cb_key_down, ic);
+   edje_object_part_swallow(ic->obj, "e.swallow.entry", ic->entry_widget);
+   evas_object_show(ic->entry_widget);
+   e_widget_entry_text_set(ic->entry_widget, ic->info.file);
+   e_widget_focus_set(ic->entry_widget, 0);
+   eo = e_widget_entry_editable_object_get(ic->entry_widget);
+   e_editable_cursor_move_to_start(eo);
+   e_editable_selection_move_to_end(eo);
+   ic->sd->iop_icon = ic;
+
+   return ic->entry_widget;
+}
+
+static void
+_e_fm2_icon_entry_widget_del(E_Fm2_Icon *ic)
+{
+   ic->sd->iop_icon = NULL;
+   evas_object_focus_set(ic->sd->obj, 1);
+   evas_object_del(ic->entry_widget);
+   ic->entry_widget = NULL;
+}
+
+static void
+_e_fm2_icon_entry_widget_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Key_Down *ev;
+   E_Fm2_Icon *ic;
 
-   snprintf(text, PATH_MAX + 256,
-           _("Rename %s to:"),
-           ic->info.file);
-   ic->entry_dialog = e_entry_dialog_show(_("Rename File"), "edit-rename",
-                                         text, ic->info.file, NULL, NULL,
-                                         _e_fm2_file_rename_yes_cb,
-                                         _e_fm2_file_rename_no_cb, ic);
-   E_OBJECT(ic->entry_dialog)->data = ic;
-   e_object_del_attach_func_set(E_OBJECT(ic->entry_dialog), _e_fm2_file_rename_delete_cb);
+   ev = event_info;
+   ic = data;
+
+   if (!strcmp(ev->key, "Escape"))
+      _e_fm2_icon_entry_widget_del(ic);
+   else if (!strcmp(ev->key, "Return"))
+      _e_fm2_icon_entry_widget_accept(ic);
+}
+
+static void
+_e_fm2_icon_entry_widget_accept(E_Fm2_Icon *ic)
+{
+   _e_fm2_file_do_rename(e_widget_entry_text_get(ic->entry_widget), ic);
+   _e_fm2_icon_entry_widget_del(ic);
 }
 
 static void
@@ -8406,27 +8491,11 @@ static void
 _e_fm2_file_rename_yes_cb(char *text, void *data)
 {
    E_Fm2_Icon *ic;
-   char oldpath[PATH_MAX];
-   char newpath[PATH_MAX];
-   char *args = NULL;
-   size_t size = 0;
-   size_t length = 0;
 
    ic = data;
    ic->entry_dialog = NULL;
-   if ((text) && (strcmp(text, ic->info.file)))
-     {
-       _e_fm2_icon_realpath(ic, oldpath, sizeof(oldpath));
-       snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text);
-       if (e_filereg_file_protected(oldpath)) return;
-
-       args = _e_fm_string_append_quoted(args, &size, &length, oldpath);
-       args = _e_fm_string_append_char(args, &size, &length, ' ');
-       args = _e_fm_string_append_quoted(args, &size, &length, newpath);
 
-       _e_fm_client_file_move(args, ic->sd->obj);
-       free(args);
-     }
+   _e_fm2_file_do_rename(text, ic);
 }
 
 static void
@@ -8438,6 +8507,30 @@ _e_fm2_file_rename_no_cb(void *data)
    ic->entry_dialog = NULL;
 }
 
+static void
+_e_fm2_file_do_rename(const char *text, E_Fm2_Icon *ic)
+{
+   char oldpath[PATH_MAX];
+   char newpath[PATH_MAX];
+   char *args = NULL;
+   size_t size = 0;
+   size_t length = 0;
+
+   if ((text) && (strcmp(text, ic->info.file)))
+     {
+        _e_fm2_icon_realpath(ic, oldpath, sizeof(oldpath));
+        snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text);
+        if (e_filereg_file_protected(oldpath)) return;
+
+        args = _e_fm_string_append_quoted(args, &size, &length, oldpath);
+        args = _e_fm_string_append_char(args, &size, &length, ' ');
+        args = _e_fm_string_append_quoted(args, &size, &length, newpath);
+
+        _e_fm_client_file_move(args, ic->sd->obj);
+        free(args);
+     }
+}
+
 static void _e_fm_retry_abort_dialog(int pid, const char *str)
 {
    E_Manager *man;
@@ -8662,7 +8755,7 @@ _e_fm2_file_properties(void *data, E_Menu *m, E_Menu_Item *mi)
    E_Container *con;
 
    ic = data;
-   if (ic->entry_dialog) return;
+   if (ic->entry_dialog || ic->entry_widget) return;
 
    man = e_manager_current_get();
    if (!man) return;
index ddb1f7d..84367ce 100644 (file)
@@ -514,8 +514,8 @@ _e_configure_module_update_cb(void *data, int type, void *event)
 
    if (!(eco = data)) return 1;
    if (!eco->cat_list) return 1;
-   sel = e_widget_ilist_selected_get(eco->cat_list);
+//   sel = e_widget_ilist_selected_get(eco->cat_list);
    _e_configure_fill_cat_list(eco);
-   e_widget_ilist_selected_set(eco->cat_list, sel);
+//   e_widget_ilist_selected_set(eco->cat_list, sel);
    return 1;
 }