Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_config.c ewl_container.c ewl_entry.c ewl_misc.c 
        ewl_theme.c 


Log Message:
 * Patch from shorne to remove debugging printfs, load config values, and
   fallback to the default theme.
 * Pass events on textblock as EWL will do the event dispatching.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_config.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_config.c        17 Feb 2005 19:14:54 -0000      1.2
+++ ewl_config.c        22 Mar 2005 16:36:35 -0000      1.3
@@ -38,6 +38,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        ecore_config_system_init();
+       ecore_config_load();
        memset(&ewl_config, 0, sizeof(Ewl_Config));
        ewl_config_config_read();
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_container.c     11 Mar 2005 15:20:53 -0000      1.2
+++ ewl_container.c     22 Mar 2005 16:36:35 -0000      1.3
@@ -772,24 +772,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        if (c->child_show && VISIBLE(w) && REALIZED(w)) {
-               Ewl_Object *tmp;
-               printf("Parent: %dx%d\n",
-                       ewl_object_preferred_w_get(EWL_OBJECT(c)),
-                       ewl_object_preferred_h_get(EWL_OBJECT(c)));
-
-               ecore_list_goto_first(c->children);
-               while ((tmp = ecore_list_next(c->children))) {
-                       if (VISIBLE(tmp) && REALIZED(tmp))
-                               printf("\tChild: %dx%d\n",
-                                       ewl_object_preferred_w_get(tmp),
-                                       ewl_object_preferred_h_get(tmp));
-               }
-
                c->child_show(c, w);
-
-               printf("Parent: %dx%d\n",
-                       ewl_object_preferred_w_get(EWL_OBJECT(c)),
-                       ewl_object_preferred_h_get(EWL_OBJECT(c)));
        }
 
        /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_entry.c 12 Mar 2005 05:07:33 -0000      1.6
+++ ewl_entry.c 22 Mar 2005 16:36:35 -0000      1.7
@@ -839,6 +839,7 @@
        if (w->fx_clip_box)
                evas_object_clip_set(e->textobj, w->fx_clip_box);
 
+       evas_object_pass_events_set(e->textobj, 1);
        evas_object_textblock_text_insert(e->textobj, "a ");
 
        /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_misc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_misc.c  11 Mar 2005 05:22:43 -0000      1.4
+++ ewl_misc.c  22 Mar 2005 16:36:35 -0000      1.5
@@ -87,6 +87,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
+       /* check if we are already initialized */
        if (++_ewl_init_count > 1)
                DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
 
@@ -137,15 +138,15 @@
 #endif
 
        if (!use_engine) {
-               fprintf(stderr, "ERRR: Cannot open display!\n");
+               fprintf(stderr, "Cannot open display!\n");
                ewl_shutdown();
-               DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
+               DRETURN_INT(--_ewl_init_count, DLEVEL_STABLE);
        }
 
        if (!ewl_config_init()) {
-               DERROR("Could not init config data....");
+               DERROR("Could not init config data.");
                ewl_shutdown();
-               DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
+               DRETURN_INT(--_ewl_init_count, DLEVEL_STABLE);
        }
 
        if (print_theme_keys)
@@ -157,17 +158,17 @@
        }
 
        if (!ewl_ev_init()) {
-               DERROR("Could not init event data....");
+               DERROR("Could not init event data.");
                ewl_shutdown();
-               DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
+               DRETURN_INT(--_ewl_init_count, DLEVEL_STABLE);
        }
 
        ewl_callbacks_init();
 
        if (!ewl_theme_init()) {
-               DERROR("Could not init theme data....");
+               DERROR("Could not init theme data.");
                ewl_shutdown();
-               DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
+               DRETURN_INT(--_ewl_init_count, DLEVEL_STABLE);
        }
 
        ewl_embed_list = ecore_list_new();
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_theme.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_theme.c 11 Mar 2005 15:20:54 -0000      1.3
+++ ewl_theme.c 22 Mar 2005 16:36:35 -0000      1.4
@@ -12,6 +12,7 @@
 static Ecore_Hash *def_theme_data = NULL;
 
 static void ewl_theme_font_path_init(void);
+static char * ewl_theme_path_find(const char * name);
 
 /**
  * @return Returns TRUE on success, FALSE on failure.
@@ -23,10 +24,6 @@
  */
 int ewl_theme_init(void)
 {
-       struct stat     st;
-       char            theme_db_path[PATH_MAX];
-       char           *home;
-       
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        /*
@@ -40,13 +37,45 @@
         * Retrieve the current theme from the users config.
         */
        if (!theme_name) {
-               theme_name = ewl_config_str_get("/ewl/theme/name");
-               if (!theme_name)
-                       theme_name = strdup("default");
+               if(ewl_config.theme.name) {
+                       theme_name = strdup(ewl_config.theme.name);
+                       theme_path = ewl_theme_path_find(theme_name);
+               }
+       }               
+
+       /*
+        * Fall back to the default theme.
+        */     
+       if(!theme_path) {
+               theme_name = strdup("default");
+               theme_path = ewl_theme_path_find(theme_name);
        }
 
-       if (!theme_name)
+       /*
+        * If we can't find a theme, no point in continuing further.
+        */
+       if (!theme_path) {
+               DERROR("No usable theme found, exiting EWL");
                DRETURN_INT(FALSE, DLEVEL_STABLE);
+       }
+
+       ewl_theme_font_path_init();
+
+       IF_FREE(theme_name);
+
+       DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+/*
+ * Private function for finding the theme path given a theme name, If no theme
+ * of name is found we will return null.
+ */
+static char * ewl_theme_path_find(const char * name) 
+{              
+       struct stat     st;
+       char           *theme_found_path = NULL;
+       char            theme_tmp_path[PATH_MAX];
+       char           *home;
 
        /*
         * Get the users home directory. This environment variable should
@@ -57,67 +86,57 @@
                DERROR("Environment variable HOME not defined\n"
                       "Try export HOME=/home/user in a bash like environemnt 
or\n"
                       "setenv HOME=/home/user in a csh like environment.\n");
-               DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
 
        /*
         * Build a path to the theme if it is the users home dir and use it if
         * available. 
         */
-       snprintf(theme_db_path, PATH_MAX, "%s/.e/ewl/themes/%s.eet",
-                       home, theme_name);
-       if (((stat(theme_db_path, &st)) == 0) && S_ISREG(st.st_mode)) {
-               theme_path = strdup(theme_db_path);
+       if (home) {
+               snprintf(theme_tmp_path, PATH_MAX, "%s/.e/ewl/themes/%s.eet",
+                       home, name);
+               if (((stat(theme_tmp_path, &st)) == 0) && S_ISREG(st.st_mode)) {
+                       theme_found_path = strdup(theme_tmp_path);
+               }
        }
 
        /*
         * No user theme, so we try the system-wide theme.
         */
-       if (!theme_path) {
-               snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
-                               "/themes/%s.eet", theme_name);
-               if (((stat(theme_db_path, &st)) == 0) &&
+       if (!theme_found_path) {
+               snprintf(theme_tmp_path, PATH_MAX, PACKAGE_DATA_DIR
+                               "/themes/%s.eet", name);
+               if (((stat(theme_tmp_path, &st)) == 0) &&
                                S_ISREG(st.st_mode)) {
-                       theme_path = strdup(theme_db_path);
+                       theme_found_path = strdup(theme_tmp_path);
                }
        }
 
        /*
         * see if they gave a full path to the theme
         */
-       if (!theme_path) {
-               if (theme_name[0] != '/') {
+       if (!theme_found_path) {
+               if (name[0] != '/') {
                        char   *cwd;
 
                        cwd = getenv("PWD");
                        if (cwd != NULL) 
-                               snprintf(theme_db_path, PATH_MAX, "%s/%s", cwd, 
theme_name);
+                               snprintf(theme_tmp_path, PATH_MAX, "%s/%s", 
cwd, name);
                        else
-                               snprintf(theme_db_path, PATH_MAX, "%s", 
theme_name);
+                               snprintf(theme_tmp_path, PATH_MAX, "%s", name);
 
                } else {
-                       snprintf(theme_db_path, PATH_MAX, "%s", theme_name);
+                       snprintf(theme_tmp_path, PATH_MAX, "%s", name);
                }
 
-               if (((stat(theme_db_path, &st)) == 0) &&
+               if (((stat(theme_tmp_path, &st)) == 0) &&
                                S_ISREG(st.st_mode)) {
-                       theme_path = strdup(theme_db_path);
+                       theme_found_path = strdup(theme_tmp_path);
                }
        }
 
-       /*
-        * If we can't find a theme, no point in continuing further.
-        */
-       if (!theme_path) {
-               DERROR("No usable theme found, exiting EWL");
-               DRETURN_INT(FALSE, DLEVEL_STABLE);
-       }
-
-       ewl_theme_font_path_init();
-
-       IF_FREE(theme_name);
+       return theme_found_path;
 
-       DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**




-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to