Ok this has got some initial support with ferite, currently you can only
authorboris <boris>
Sat, 25 Aug 2001 19:51:48 +0000 (19:51 +0000)
committerboris <boris@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 25 Aug 2001 19:51:48 +0000 (19:51 +0000)
assign ferite scripts to menus see data/scripts/build_app_menu_db.sh and look
at the exit menu item as an example. you will need ferite - i suggest that
you use cvs ferite as this is what I am developing this against. This, my
friends, is the first step of many :)

SVN revision: 5280

14 files changed:
README
configure.ac
configure.in
data/config/behavior/default/apps_menu.db
data/scripts/build_app_menu_db.sh
po/ChangeLog
src/.cvsignore
src/Makefile.am
src/e_ferite.c [new file with mode: 0644]
src/e_ferite.fec [new file with mode: 0644]
src/e_ferite.h [new file with mode: 0644]
src/main.c
src/menubuild.c
src/view.c

diff --git a/README b/README
index 5e7cfd6..efd27de 100644 (file)
--- a/README
+++ b/README
@@ -62,9 +62,9 @@ worked on. Just be happy it does as much as it already does.
 
 Enlightenment RELIES on lots of libraires that have been written. Ecore,
 Ebits, Evas, Edb, Imlib2, Efsd just to mention a few. Especially Ebits,
-Ecore, Efsd and Evas change in CVS often - you will need the absolute latest 
-of these if you wish Enlightenment 0.17 code to run properly or compile. If 
-you update Enlightenment from CVS update these too to get any changes they 
+Ecore, Efsd ferite, and Evas change in CVS often - you will need the absolute 
+latest of these if you wish Enlightenment 0.17 code to run properly or compile. 
+If you update Enlightenment from CVS update these too to get any changes they 
 have in their trees.
 
 If you plan on working on the code... STOP! don't rush in and work on it -
index 1a39535..d615e7a 100644 (file)
@@ -155,6 +155,22 @@ AC_PATH_GENERIC(efsd,, [
 efsd_libs=`efsd-config --libs`
 efsd_cflags=`efsd-config --cflags`
 
+dnl Check for ferite.
+AC_ARG_WITH(ferite,
+        [  --with-ferite=DIR          use ferite in <DIR>],
+        [CFLAGS="$CFLAGS -I$withval/include"
+         LIBS="-L$withval/lib $LIBS"])
+
+AC_PATH_GENERIC(ferite,, [
+    AC_SUBST(ferite_libs)
+    AC_SUBST(ferite_cflags)],
+    AC_MSG_ERROR(Cannot find ferite: Is ferite-config in path?))
+ferite_libs=`ferite-config --libs`
+ferite_cflags=`ferite-config --cflags`
+
+AC_PATH_PROG(FEBUILDER, builder,,)
+AC_SUBST(FEBUILDER)
+
 AC_SUBST(CP_OPTIONS)
 
 AC_CONFIG_FILES([
index bfbd5a3..21af8bb 100644 (file)
@@ -154,6 +154,22 @@ AC_PATH_GENERIC(efsd,, [
 efsd_libs=`efsd-config --libs`
 efsd_cflags=`efsd-config --cflags`
 
+dnl Check for ferite.
+AC_ARG_WITH(ferite,
+        [  --with-ferite=DIR          use ferite in <DIR>],
+        [CFLAGS="$CFLAGS -I$withval/include"
+         LIBS="-L$withval/lib $LIBS"])
+
+AC_PATH_GENERIC(ferite,, [
+    AC_SUBST(ferite_libs)
+    AC_SUBST(ferite_cflags)],
+    AC_MSG_ERROR(Cannot find ferite: Is ferite-config in path?))
+ferite_libs=`ferite-config --libs`
+ferite_cflags=`ferite-config --cflags`
+
+AC_PATH_PROG(FEBUILDER, builder,,)
+AC_SUBST(FEBUILDER)
+
 AC_SUBST(CP_OPTIONS)
 
 AC_OUTPUT([
index fbb346e..92c1080 100644 (file)
Binary files a/data/config/behavior/default/apps_menu.db and b/data/config/behavior/default/apps_menu.db differ
index 189a2db..b7d493f 100755 (executable)
@@ -65,9 +65,13 @@ entry ()
     
   else if [ $1 = "separator" ]; then
     edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/separator" int 1
+       
+       
+  else if [ $1 = "script" ]; then
+    edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/text"      str "$2"
+       edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/script"    str "$3"
     
-    
-  fi; fi; fi; fi
+  fi; fi; fi; fi; fi
   ENTRYNUM=$[ $ENTRYNUM + 1 ];
 }
 
@@ -95,6 +99,7 @@ entry both 'XMag' '/usr/share/pixmaps/gnome-applets.png' 'xmag'
 entry separator
 entry text 'Network' 'sub' 1
 entry text 'System' 'sub' 2
+entry script 'Exit' 'e.shutdown();'
 end_menu
 
 menu 1
@@ -107,4 +112,5 @@ entry text 'Shut Down' 'sudo -S /sbin/shutdown -h now'
 entry text 'Reboot' 'sudo -S /sbin/shutdown -r now'
 end_menu
 
+
 finish
index 0bc3b79..f13efe4 100644 (file)
@@ -1,3 +1,19 @@
+2001-08-25  gettextize  <bug-gnu-utils@gnu.org>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.39.
+
+2001-08-25  gettextize  <bug-gnu-utils@gnu.org>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.39.
+
+2001-08-25  gettextize  <bug-gnu-utils@gnu.org>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.39.
+
+2001-08-25  gettextize  <bug-gnu-utils@gnu.org>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.39.
+
 2001-08-23  gettextize  <bug-gnu-utils@gnu.org>
 
        * Makefile.in.in: Upgrade to gettext-0.10.39.
index aee5d8a..ed69a9f 100644 (file)
@@ -6,4 +6,5 @@ Makefile.in
 Makefile
 enlightenment
 .libs
-.deps
\ No newline at end of file
+.deps
+e_ferite_gen_*
index 3b8d533..e6fd853 100644 (file)
@@ -1,8 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
+CLEANFILES = e_ferite_gen_*
+
 INCLUDES = \
        -I$(top_srcdir)/intl \
-       @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@
+       @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ferite_cflags@
 
 bin_PROGRAMS = enlightenment
 
@@ -14,6 +16,10 @@ enlightenment_SOURCES = \
        desktops.h desktops.c \
        entry.h entry.c \
        exec.h exec.c \
+       e_ferite.h e_ferite.c \
+       e_ferite_gen_header.h e_ferite_gen_core.c \
+       e_ferite_gen_e.c \
+       e_ferite_gen_Window.c \
        fs.h fs.c \
        icccm.h icccm.c \
        icons.c \
@@ -31,5 +37,11 @@ enlightenment_SOURCES = \
        view.h view.c \
        e.h
 
-enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc -ldl $(INTLLIBS)
+enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ferite_libs@ -lm -lc -ldl $(INTLLIBS)
 
+e_ferite_gen_core.c: e_ferite.fec
+       rm -f e_ferite_gen_* ; \
+       @FEBUILDER@ -m e_ferite_gen e_ferite.fec ; \
+       mv e_ferite_gen_core.c e_ferite_gen_core.c.old ; \
+       cat e_ferite_gen_core.c.old |  sed -e "s/module_init/e_ferite_register/g" > e_ferite_gen_core.c ; \
+       rm e_ferite_gen_core.c.old
diff --git a/src/e_ferite.c b/src/e_ferite.c
new file mode 100644 (file)
index 0000000..4adc949
--- /dev/null
@@ -0,0 +1,41 @@
+#include "e_ferite.h"
+#include "e_ferite_gen_header.h"
+
+void e_ferite_init(void)
+{
+   printf( "Initialising ferite....\n" );
+   ferite_init( 0, NULL );
+}
+
+void e_ferite_deinit(void)
+{
+   printf( "Deinitialising ferite....\n" );
+   ferite_deinit();
+}
+
+int e_ferite_script_error( FeriteScript *script, char *errmsg, int val )
+{
+   fprintf( stderr, "e17: ferite error: %s\n", errmsg );
+   return 1;
+}
+
+int e_ferite_script_warning( FeriteScript *script, char *warnmsg )
+{
+   fprintf( stderr, "e17: ferite warning: %s\n", warnmsg );
+   return 1;
+}
+
+void e_ferite_run( char *txt )
+{
+   FeriteScript *script = NULL;
+   
+   printf( "Compiling script `%s'\n", txt );
+   script = __ferite_compile_string( txt );
+   e_ferite_register( script, script->mainns );
+   script->error_cb = e_ferite_script_error;
+   script->warning_cb = e_ferite_script_warning;
+   printf( "Executing script.\n" );
+   ferite_script_execute( script );
+   printf( "Cleaning up.\n" );
+   ferite_script_delete( script );
+}
diff --git a/src/e_ferite.fec b/src/e_ferite.fec
new file mode 100644 (file)
index 0000000..2ca1c82
--- /dev/null
@@ -0,0 +1,54 @@
+%{
+   
+   #include "Ecore.h"
+   
+%}
+
+class Window {
+   
+   function getName();
+   function getTitle();
+   function getClass();
+   function getX();
+   function getY();
+   function getWidth();
+   function getHeight();
+   
+   function move( number x, number y );
+   function resize( number width, number height );
+
+   function show();
+   function hide();
+   function isVisible();
+   
+   function shade();
+   function unshade();
+   function isShaded();
+   
+   function iconify();
+   function uniconify();
+   function isIconic();
+
+   function isMapped();
+   function isTransient();
+   function isShaped();
+   
+   function delete();
+   function kill();
+   
+}
+
+namespace e {
+   
+   function flipToDesktop( number desk );
+   function getDesktopCount();
+   
+   function getWidth();
+   function getHeight();
+
+   // shutdown enlightenment
+   function shutdown()
+   %{
+         e_event_loop_quit();  
+   %}
+}
diff --git a/src/e_ferite.h b/src/e_ferite.h
new file mode 100644 (file)
index 0000000..2810af5
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef E_FERITE_H
+#define E_FERITE_H
+
+#include <ferite.h>
+
+void e_ferite_init(void);
+void e_ferite_deinit(void);
+void e_ferite_run( char *script );
+void e_ferite_register( FeriteScript *script, FeriteNamespace *ns );
+int  e_ferite_script_error( FeriteScript *script, char *errmsg, int val );
+int  e_ferite_script_warning( FeriteScript *script, char *warnmsg );
+
+#endif /* E_FERITE_H */
index e4965a9..38adb7b 100644 (file)
@@ -9,6 +9,7 @@
 #include "ipc.h"
 #include "menu.h"
 #include "view.h"
+#include "e_ferite.h"
 #include <X11/Xproto.h>
 
 #ifdef E_PROF
@@ -122,11 +123,14 @@ main(int argc, char **argv)
    e_view_init();
    e_entry_init();
    e_keys_init();
+   e_ferite_init();
    
    setup();
    
    e_event_loop();
 
+   e_ferite_deinit();
+   
    return 0;
    UN(argc);
    UN(argv);
index d094724..5062a90 100644 (file)
@@ -2,6 +2,7 @@
 #include "menubuild.h"
 #include "exec.h"
 #include "util.h"
+#include "e_ferite.h"
 
 Evas_List build_menus = NULL;
 
@@ -28,6 +29,18 @@ e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data)
    UN(mi);
 }
 
+static void 
+e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
+{
+   char *script;
+   
+   script = data;
+   e_ferite_run(script);
+   return;
+   UN(m);
+   UN(mi);
+}
+
 static void
 e_build_menu_unbuild(E_Build_Menu *bm)
 {
@@ -126,7 +139,7 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
    for (i2 = 0; i2 < num2; i2++)
      {
        E_Menu_Item *menuitem;
-       char        *text, *icon, *exe;
+       char        *text, *icon, *exe, *script;
        int          ok, sub, sep;
        
        sprintf(buf, "/menu/%i/%i/text", num, i2);
@@ -135,6 +148,8 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
        icon = e_db_str_get(db, buf);
        sprintf(buf, "/menu/%i/%i/command", num, i2);
        exe = e_db_str_get(db, buf);
+       sprintf(buf, "/menu/%i/%i/script", num, i2);
+       script = e_db_str_get(db, buf);
        sprintf(buf, "/menu/%i/%i/submenu", num, i2);
        ok = e_db_int_get(db, buf, &sub);
        sep = 0;
@@ -161,6 +176,11 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
             e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe);
             bm->commands = evas_list_prepend(bm->commands, exe);
          }
+               if( script )
+               {
+                  e_menu_item_set_callback(menuitem, e_build_menu_cb_script, script);
+                  bm->commands = evas_list_prepend(bm->commands, script);                 
+               }
        e_menu_add_item(menu, menuitem);
      }
    bm->menus = evas_list_prepend(bm->menus, menu);
index d2d36d9..82dc23d 100644 (file)
@@ -273,7 +273,7 @@ e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
        e_view_selection_update(v);
      }
    if( _b == 2 && ev->double_click )
-        exit(0);
+        e_event_loop_quit();
    
    UN(_e);
    UN(_o);