Enlightenment CVS committal

Author  : devilhorns
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/modules/conf_keybindings


Modified Files:
        e_int_config_keybindings.c 


Log Message:
ZGold's patch for adding 'Add Keyboard Shortcut' to border menu.

===================================================================
RCS file: 
/cvs/e/e17/apps/e/src/modules/conf_keybindings/e_int_config_keybindings.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_int_config_keybindings.c  7 Oct 2007 21:22:41 -0000       1.3
+++ e_int_config_keybindings.c  28 Oct 2007 19:06:48 -0000      1.4
@@ -52,19 +52,13 @@
      } binding;
    struct
      {
-       char *binding;
-       char *action;
-       char *params;
-
-       char *cur;
-       int cur_act;
-       int add;
+       char *binding, *action, *params, *cur;
+       int cur_act, add;
 
        E_Dialog *dia;
        Ecore_X_Window bind_win;
        Evas_List *handlers;
      } locals;
-
    struct
      {
        Evas_Object *o_add, *o_mod, *o_del, *o_del_all;
@@ -72,11 +66,12 @@
        Evas_Object *o_params;
      } gui;
 
+   char *params;
    E_Config_Dialog *cfd;
 };
 
 EAPI E_Config_Dialog *
-e_int_config_keybindings(E_Container *con, const char *params __UNUSED__)
+e_int_config_keybindings(E_Container *con, const char *params)
 {
    E_Config_Dialog *cfd;
    E_Config_Dialog_View *v;
@@ -93,13 +88,19 @@
    cfd = e_config_dialog_new(con, _("Key Binding Settings"), "E", 
                             "_config_keybindings_dialog",
                             "enlightenment/keys", 0, v, NULL);
+   if (strlen(params) > 0)
+     {
+       cfd->cfdata->params = params;
+       _add_key_binding_cb(cfd->cfdata, NULL);
+     }
+
    return cfd;
 }
 
 static void
 _fill_data(E_Config_Dialog_Data *cfdata)
 {
-   Evas_List *l;
+   Evas_List *l = NULL;
    E_Config_Binding_Key *bi, *bi2;
 
    cfdata->locals.binding = strdup("");
@@ -159,14 +160,14 @@
    if (cfdata->locals.binding) free(cfdata->locals.binding);
    if (cfdata->locals.action) free(cfdata->locals.action);
    if (cfdata->locals.params) free(cfdata->locals.params);
-
+   if (cfdata->params) free(cfdata->params);
    E_FREE(cfdata);
 }
 
 static int
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   Evas_List *l;
+   Evas_List *l = NULL;
    E_Config_Binding_Key *bi, *bi2;
 
    _auto_apply_changes(cfdata);
@@ -392,10 +393,11 @@
 
    _update_buttons(cfdata);
 }
+
 static void
 _delete_key_binding_cb(void *data, void *data2)
 {
-   Evas_List *l;
+   Evas_List *l = NULL;
    char *n;
    int sel;
    E_Config_Dialog_Data *cfdata;
@@ -621,6 +623,7 @@
    e_widget_entry_clear(cfdata->gui.o_params);
    e_widget_disabled_set(cfdata->gui.o_params, 1);
 }
+
 /**************** Updates ***********/
 static void
 _update_action_list(E_Config_Dialog_Data *cfdata)
@@ -712,6 +715,7 @@
          }
      }*/
 }
+
 static void
 _update_action_params(E_Config_Dialog_Data *cfdata)
 {
@@ -785,22 +789,17 @@
        if (!strcmp(action, actd->act_cmd))
          {
             if ((!params) || (!params[0]))
-              {
-                 KB_EXAMPLE_PARAMS;
-              }
+              KB_EXAMPLE_PARAMS;
             else
               e_widget_entry_text_set(cfdata->gui.o_params, params);
          }
        else
-         {
-            KB_EXAMPLE_PARAMS;
-         }
+         KB_EXAMPLE_PARAMS;
      }
    else
-     {
-       KB_EXAMPLE_PARAMS;
-     }
+     KB_EXAMPLE_PARAMS;
 }
+
 static void
 _update_key_binding_list(E_Config_Dialog_Data *cfdata)
 {
@@ -892,7 +891,6 @@
    
    if (i < j) return -1;
    else if (i > j) return 1; 
-   
 
    if (bi->modifiers < bi2->modifiers) return -1;
    else if (bi->modifiers > bi2->modifiers) return 1;
@@ -902,7 +900,6 @@
 
    if (i < j) return -1;
    else if (i > j) return 1;
-
    
    i = strcmp(bi->key, bi2->key);
    if (i < 0) return -1;
@@ -1091,8 +1088,23 @@
                       e_widget_ilist_unselect(cfdata->gui.o_action_list);
                       if (cfdata->locals.action) free(cfdata->locals.action);
                       cfdata->locals.action = strdup("");
-                      e_widget_entry_clear(cfdata->gui.o_params);
-                      e_widget_disabled_set(cfdata->gui.o_params, 1);
+                      if(strlen(cfdata->params) > 0)
+                         {
+                            int j,g = -1;
+                            _find_key_binding_action("exec",NULL,&g,NULL,&j);
+                            if(j >=0 )
+                               {
+                                 
e_widget_ilist_unselect(cfdata->gui.o_action_list);
+                                 
e_widget_ilist_selected_set(cfdata->gui.o_action_list, (j+g+1));
+                                 e_widget_entry_clear(cfdata->gui.o_params);
+                                 
e_widget_entry_text_set(cfdata->gui.o_params,cfdata->params);
+                              } 
+                         }
+                       else
+                        {
+                              e_widget_entry_clear(cfdata->gui.o_params);
+                              e_widget_disabled_set(cfdata->gui.o_params, 1);
+                        }
                    }
                  else
                    {
@@ -1192,6 +1204,7 @@
          bi->params = evas_stringshare_add(cfdata->locals.params);
      }
 }
+
 static void
 _find_key_binding_action(const char *action, const char *params, int *g, int 
*a, int *n)
 {
@@ -1259,6 +1272,7 @@
        if (n) *n = -1;
      }
 }
+
 static char *
 _key_binding_text_get(E_Config_Binding_Key *bi)
 {



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to