Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : apps/e_utils

Dir     : e17/apps/e_utils/src/bin/eapp_edit


Modified Files:
        eapp_edit_main.c 


Log Message:
- honour the old -c/--win-class flags to set the window class

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/eapp_edit/eapp_edit_main.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- eapp_edit_main.c    21 Aug 2005 05:51:28 -0000      1.21
+++ eapp_edit_main.c    24 Aug 2005 15:53:45 -0000      1.22
@@ -8,8 +8,8 @@
 #define TREE_COLS 2
 
 static void eapp_usage(void);
-static int eapp_ui_init(char *file, char *lang);
-static int eapp_populate(Ewl_Tree *tree, char *file, char *lang);
+static int eapp_ui_init(char *file, char *lang, char *winclass);
+static int eapp_populate(Ewl_Tree *tree, char *file, char *lang, char 
*winclass);
 static char *eapp_eet_read(Eet_File *ef, char *key, char *lang);
 static void eapp_eet_write(Eet_File *ef, char *key, char *lang, char *val, int 
size);
 static void eapp_engrave_write(char *file);
@@ -44,6 +44,7 @@
 {
     char *file = NULL;
     char *lang = NULL;
+    char *winclass = NULL;
     int ret = 1;
     int i;
 
@@ -73,6 +74,19 @@
                 goto ARGS_SHUTDOWN;
             }
         }
+        else if ((!strcmp(argv[i], "-c")) || (!strcmp(argv[i], "--win-class")))
+        {
+            if (++i < argc)
+            {
+                if (winclass) free(winclass);
+                winclass = strdup(argv[i]);
+            }
+            else
+            {
+                fprintf(stderr, "Error, missing argument for win-class.\n");
+                goto ARGS_SHUTDOWN;
+            }
+        }
         else
         {
             if (file) free(file);
@@ -93,7 +107,7 @@
         goto ARGS_SHUTDOWN;
     }
 
-    if (!eapp_ui_init(file, lang))
+    if (!eapp_ui_init(file, lang, winclass))
     {
         fprintf(stderr, "Error initializing e_utils_eapp_edit.\n");
         goto EET_SHUTDOWN;
@@ -107,6 +121,7 @@
 ARGS_SHUTDOWN:
     if (file) free(file);
     if (lang) free(lang);
+    if (winclass) free(winclass);
 EWL_SHUTDOWN:
     ewl_shutdown();
 SHUTDOWN:
@@ -132,7 +147,7 @@
 }
 
 static int
-eapp_ui_init(char *file, char *lang)
+eapp_ui_init(char *file, char *lang, char *winclass)
 {
     Ewl_Widget *win, *vbox, *hbox, *tree, *o;
     char tmp[PATH_MAX];
@@ -159,7 +174,7 @@
     ewl_theme_data_str_set(tree, "/cell/group", "cell");
     ewl_widget_show(tree);
 
-    if (!eapp_populate(EWL_TREE(tree), file, lang))
+    if (!eapp_populate(EWL_TREE(tree), file, lang, winclass))
     {
         fprintf(stderr, "Error getting eap info.\n");
         return 0;
@@ -192,7 +207,7 @@
 }
 
 static int
-eapp_populate(Ewl_Tree *tree, char *file, char *lang)
+eapp_populate(Ewl_Tree *tree, char *file, char *lang, char *winclass)
 {
     Ewl_Widget *row[TREE_COLS];
     Eet_File *ef = NULL;
@@ -240,11 +255,17 @@
         }
         else
         {
+            if (!strcmp(keys[i].key, "app/window/class"))
+            {
+                if (winclass) v = winclass;
+            }
+
             row[1] = ewl_entry_new(v);
         }
         ewl_widget_name_set(row[1], keys[i].key);
         ewl_widget_show(row[1]);
         if (v) free(v);
+        v = NULL;
 
         ewl_tree_row_add(tree, NULL, row);
     }




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to