Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_misc.c ewl_theme.c ewl_theme.h ewl_tree.c 


Log Message:
Allow for specifying the theme on the command line (--ewl-theme <theme>)
Fix for expanding and collapsing the tree nodes with multiple rows.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- ewl_misc.c  24 Jun 2004 02:17:08 -0000      1.72
+++ ewl_misc.c  28 Jun 2004 16:08:06 -0000      1.73
@@ -304,16 +304,23 @@
 static void ewl_init_parse_options(int *argc, char **argv)
 {
        int i;
+       int matched = 0;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        i = 0;
        while (i < *argc) {
-               int matched = 0;
                if (!strcmp(argv[i], "--ewl-segv")) {
                        debug_segv = 1;
                        matched++;
                }
+               if (!strcmp(argv[i], "--ewl-theme")) {
+                       if (i + 1 < argc) {
+                               ewl_theme_name_set(argv[i + 1]);
+                               matched++;
+                       }
+                       matched++;
+               }
                else if (!strcmp(argv[i], "--ewl-software-x11")) {
                        use_engine = EWL_ENGINE_SOFTWARE_X11;
                        matched++;
@@ -327,8 +334,12 @@
                        matched++;
                }
 
-               if (matched)
-                       ewl_init_remove_option(argc, argv, i);
+               if (matched > 0) {
+                       while (matched) {
+                               ewl_init_remove_option(argc, argv, i);
+                               matched--;
+                       }
+               }
                else
                        i++;
        }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- ewl_theme.c 2 Jun 2004 18:55:28 -0000       1.62
+++ ewl_theme.c 28 Jun 2004 16:08:06 -0000      1.63
@@ -4,6 +4,7 @@
 #include "ewl-config.h"
 #endif
 
+static char     *theme_name = NULL;
 static char     *theme_path = NULL;
 
 static E_DB_File *theme_db = NULL;
@@ -25,7 +26,6 @@
 int ewl_theme_init(void)
 {
        struct stat     st;
-       char           *theme_name;
        char            theme_db_path[PATH_MAX];
        char           *home;
 
@@ -41,9 +41,11 @@
        /*
         * Retrieve the current theme from the users config.
         */
-       theme_name = ewl_config_get_str("system", "/theme/name");
-       if (!theme_name)
-               theme_name = strdup("default");
+       if (!theme_name) {
+               theme_name = ewl_config_get_str("system", "/theme/name");
+               if (!theme_name)
+                       theme_name = strdup("default");
+       }
 
        if (!theme_name)
                DRETURN_INT(FALSE, DLEVEL_STABLE);
@@ -237,13 +239,38 @@
 }
 
 /**
+ * @brief Set the name of the theme to use.
+ * @param name: the name of the theme to use.
+ * @return Returns no value.
+ */
+void ewl_theme_name_set(char *name)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       IF_FREE(theme_name);
+       theme_name = strdup(name);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @brief Return the name of the current theme
+ * @return Returns a copy of the current theme name on success, NULL on failure
+ */
+char           *ewl_theme_name_get()
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DRETURN_PTR((theme_name ? strdup(theme_name) : NULL), DLEVEL_STABLE);
+}
+
+/**
  * @brief Return the path of the current theme
  * @return Returns a copy of the current theme path on success, NULL on failure
  */
-char           *ewl_theme_path()
+char           *ewl_theme_path_get()
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DRETURN_PTR(strdup(theme_path), DLEVEL_STABLE);
+       DRETURN_PTR((theme_path ? strdup(theme_path) : NULL), DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_theme.h 24 Mar 2004 04:11:09 -0000      1.23
+++ ewl_theme.h 28 Jun 2004 16:08:06 -0000      1.24
@@ -33,7 +33,9 @@
 void            ewl_theme_shutdown(void);
 int             ewl_theme_init_widget(Ewl_Widget * w);
 void            ewl_theme_shutdown_widget(Ewl_Widget * w);
-char           *ewl_theme_path(void);
+void            ewl_theme_name_set(char *name);
+char           *ewl_theme_name_get(void);
+char           *ewl_theme_path_get(void);
 E_DB_File      *ewl_theme_get_db();
 Ecore_List       *ewl_theme_font_path_get(void);
 void            ewl_theme_font_path_add(char *path);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tree.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- ewl_tree.c  24 Jun 2004 02:17:08 -0000      1.42
+++ ewl_tree.c  28 Jun 2004 16:08:06 -0000      1.43
@@ -512,6 +512,7 @@
 void ewl_tree_node_collapse(Ewl_Tree_Node *node)
 {
        Ewl_Widget *w;
+       Ecore_List *tmp;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("node", node);
@@ -522,12 +523,20 @@
        if (!EWL_CONTAINER(node)->children)
                DRETURN(DLEVEL_STABLE);
 
+       tmp = ecore_list_new();
+
        ecore_list_goto_first(EWL_CONTAINER(node)->children);
        while ((w = ecore_list_next(EWL_CONTAINER(node)->children))) {
                if (w != node->row && w != node->handle)
-                       ewl_widget_hide(w);
+                       ecore_list_append(tmp, w);
+       }
+
+       while ((w = ecore_list_remove_first(tmp))) {
+               ewl_widget_hide(w);
        }
 
+       ecore_list_destroy(tmp);
+
        node->expanded = EWL_TREE_NODE_COLLAPSED;
 
        ewl_widget_set_state(EWL_WIDGET(node), "collapsed");
@@ -543,6 +552,7 @@
 void ewl_tree_node_expand(Ewl_Tree_Node *node)
 {
        Ewl_Widget *w;
+       Ecore_List *tmp;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("node", node);
@@ -555,12 +565,20 @@
        if (!EWL_CONTAINER(node)->children)
                DRETURN(DLEVEL_STABLE);
 
+       tmp = ecore_list_new();
+
        ecore_list_goto_first(EWL_CONTAINER(node)->children);
        while ((w = ecore_list_next(EWL_CONTAINER(node)->children))) {
                if (w != node->row && w != node->handle)
-                       ewl_widget_show(w);
+                       ecore_list_append(tmp, w);
+       }
+
+       while ((w = ecore_list_remove_first(tmp))) {
+               ewl_widget_show(w);
        }
 
+       ecore_list_destroy(tmp);
+
        ewl_widget_set_state(EWL_WIDGET(node), "expanded");
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to