Enlightenment CVS committal

Author  : andreas99
Project : e16
Module  : tools

Dir     : e16/tools/e16menuedit2/src


Modified Files:
        Makefile.am callbacks.c file.c file.h 


Log Message:
help handling...
help could now be started from menu, but only yelp and only locale "C"

===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- Makefile.am 4 Aug 2004 23:03:49 -0000       1.5
+++ Makefile.am 16 Aug 2004 18:37:04 -0000      1.6
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 INCLUDES = \
-       @PACKAGE_CFLAGS@
+       @PACKAGE_CFLAGS@ 
 
 bin_PROGRAMS = e16menuedit2
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/callbacks.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- callbacks.c 15 Aug 2004 15:45:24 -0000      1.11
+++ callbacks.c 16 Aug 2004 18:37:04 -0000      1.12
@@ -286,5 +286,7 @@
 void on_menu_contents_activate (GtkMenuItem *menuitem,
                                 gpointer user_data)
 {
-
+  /* only yelp execution currenty in lang C
+     other languages and html fallback comes... */
+  run_yelp (PACKAGE".xml");
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/file.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- file.c      2 Aug 2004 19:36:15 -0000       1.5
+++ file.c      16 Aug 2004 18:37:04 -0000      1.6
@@ -158,7 +158,7 @@
     tok = strtok_left (pathname_copy, "/", i);
     if (!tok)
       break;
-    left = strsplit (pathname_copy, NULL, 
+    left = strsplit (pathname_copy, NULL,
                      strlen (pathname_copy) - strlen (tok));
     err = mkdir (left, mode);
 
@@ -167,7 +167,7 @@
   while (tok != NULL);
 
   free (pathname_copy);
-          
+
   return err;
 }
 
@@ -178,7 +178,7 @@
   if (count < strlen (s))
   {
     if (right)
-       strcpy (*right, s + count);
+      strcpy (*right, s + count);
 
     s_org[count]='\0';
   }
@@ -191,7 +191,7 @@
   int i;
   char *pos = s;
   char *s_new;
-  
+
   if (number == 0)
     return s;
 
@@ -209,15 +209,15 @@
   for (i = 0; pos != NULL; i++)
   {
     pos = strstr (s_new, delim);
-    
+
     if (pos)
     {
       s_new = pos + (1 * strlen (delim));
 
-      if (i == number - 1)   
+      if (i == number - 1)
       {
         pos = '\0';
-          return s_new;       
+        return s_new;
       }
     }
   }
@@ -252,7 +252,7 @@
     if (ver2_token == NULL)
       ver2_i = 0;
     else
-    ver2_i = atoi (ver2_token);
+      ver2_i = atoi (ver2_token);
 
     if (ver1_i < ver2_i)
       return -1;
@@ -261,7 +261,7 @@
 
     ver1_token = strtok_r (NULL, ".", &ver1_ptr);
     ver2_token = strtok_r (NULL, ".", &ver2_ptr);
-  } 
+  }
 
   return 0;
 }
@@ -284,7 +284,7 @@
   argv_child[2] = package;
   argv_child[3] = NULL;
 
-  spawn = g_spawn_async_with_pipes (NULL, argv_child, NULL, 
+  spawn = g_spawn_async_with_pipes (NULL, argv_child, NULL,
                                     G_SPAWN_SEARCH_PATH, NULL,
                                     NULL, NULL,  NULL,
                                     &stdout_child, &stderr_child, NULL);
@@ -299,3 +299,66 @@
   else
     return strdup (buf);
 }
+
+char *get_fallback_locale (char *locale)
+{
+  char *locale_dup;
+  char *pos = NULL;
+
+  locale_dup = strdup (locale);
+  pos = strrchr (locale_dup, '@');
+
+  if (pos)
+  {
+    strcpy (pos, "\0");
+  }
+  else
+  {
+    pos = strrchr (locale_dup, '_');
+
+    if (pos)
+    {
+      strcpy (pos, "\0");
+    }
+    else
+    {
+      pos = locale_dup;
+      strcpy (pos, "C");
+    }
+  }
+
+  return locale_dup;
+}
+
+int run_yelp (char *help_name)
+{
+  gboolean spawn;
+  gchar *argv_child[3];
+  char *locale = malloc (30);
+  int help_exist;
+  struct stat *buf;
+
+  strcpy (argv_child[0], "yelp");
+  argv_child[2] = NULL;
+
+  locale = setlocale (LC_ALL, NULL);
+
+  argv_child[1] = g_strdup_printf ("%s/%s/%s",YELP_HELP_DIR, "C", help_name);
+
+  help_exist = stat (argv_child[1], buf);
+
+  if (!help_exist)
+  {
+    spawn = g_spawn_async (NULL, argv_child, NULL,
+                           G_SPAWN_SEARCH_PATH, NULL,
+                           NULL, NULL, NULL);
+  }
+  else
+  {
+    g_print ("help doesn't exist for locale %s\n", locale);
+  }
+
+  g_free (argv_child[1]);
+
+  return 0;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/file.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- file.h      2 Aug 2004 19:36:15 -0000       1.4
+++ file.h      16 Aug 2004 18:37:04 -0000      1.5
@@ -27,6 +27,9 @@
 #ifndef _FILE_H
 #define _FILE_H
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -37,6 +40,7 @@
 #include <glib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <locale.h>
 
 char *field (char *s, int field);
 void fword (char *s, int num, char *wd);
@@ -46,5 +50,7 @@
 char *strsplit (char *s, char **right, int count);
 int version_cmp (char *ver1, char *ver2);
 char *pkg_config_version (char *package);
+char *get_fallback_locale (char *locale);
+int run_yelp (char *help_name);
 
 #endif /* _FILE_H */




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to