Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/client


Modified Files:
        entrance_session.c entrance_session.h main.c 


Log Message:
cleaner and working again
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- entrance_session.c  10 Mar 2004 22:53:51 -0000      1.41
+++ entrance_session.c  11 Mar 2004 20:21:33 -0000      1.42
@@ -24,9 +24,6 @@
                                const char *emission, const char *source);
 static void _entrance_session_user_list_fix(Entrance_Session * e);
 
-static void entrance_session_xsession_load(Entrance_Session * e,
-                                           const char *key);
-
 /**
  * entrance_session_new: allocate a new  Entrance_Session
  * @param config - parse this config file instead of the normal system one
@@ -171,6 +168,7 @@
 {
    Evas_Object *obj = NULL;
    const char *file = NULL;
+   Entrance_X_Session *exs = NULL;
 
    if (e && eu)
    {
@@ -189,10 +187,11 @@
                if (e->session)
                   free(e->session);
                e->session = strdup(eu->session);
-               entrance_session_xsession_load(e, eu->session);
-
-               /* FIXME: Should this be optional ? */
-
+               if ((exs =
+                    evas_hash_find(e->config->sessions.hash, eu->session)))
+               {
+                  entrance_session_x_session_set(e, exs);
+               }
             }
 #if 0
             if ((pass = edje_file_data_get(file, "password")))
@@ -353,74 +352,39 @@
    execl("/bin/sh", "/bin/sh", "-c", buf, NULL);
 }
 
-/**
- * entrance_session_xsession_load : The error checking part of
- * entrance_session_xsession_set.  It only frees the current EntranceSession
- * object in the main edje if loading the newly requested one was
- * successful.
- * @param e - the entrance session you want to set the session for
- * @param key - the key in the config hash that has this session
- */
-static void
-entrance_session_xsession_load(Entrance_Session * e, const char *key)
-{
-   if (e && e->edje)
-   {
-      char buf[PATH_MAX];
-      Entrance_X_Session *exs = NULL;
-      Evas_Object *o = NULL, *old_o = NULL;
-
-      if ((exs = evas_hash_find(e->config->sessions.hash, key)))
-      {
-         snprintf(buf, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s",
-                  e->config->theme);
-         if ((o = entrance_x_session_edje_get(exs, e->edje, buf)))
-         {
-            if (e->session)
-               free(e->session);
-            e->session = strdup(key);
-
-            old_o = edje_object_part_swallow_get(e->edje, "EntranceSession");
-            if (old_o)
-            {
-               edje_object_part_unswallow(e->edje, old_o);
-               evas_object_del(old_o);
-            }
-            edje_object_part_swallow(e->edje, "EntranceSession", o);
-            edje_object_signal_emit(e->edje, "SessionDefaultChanged", "");
-         }
-      }
-   }
-}
 
 /**
  * entrance_session_xsession_set : Set the current xsesssion to the
  * specified key, emit a signal to the main edje letting it know the main
  * session has changed
  * @param e - the entrance session you want to set the session for
- * @param key - the key in the config hash that has this session
+ * @param exs - the Entrance_X_Session we want to be the new current
  */
 void
-entrance_session_xsession_set(Entrance_Session * e, const char *key)
+entrance_session_x_session_set(Entrance_Session * e, Entrance_X_Session * exs)
 {
-   char *str = NULL;
-   char buf[PATH_MAX];
-
-   if (!e || !key)
-      return;
-
-   if ((str = evas_hash_find(e->config->sessions.hash, key)))
+   if (e && e->edje && exs)
    {
-      snprintf(buf, PATH_MAX, "%s", key);
-      if (strcmp(str, e->session))
+      const char *file = NULL;
+      Evas_Object *o = NULL, *old_o = NULL;
+
+      edje_object_file_get(e->edje, &file, NULL);
+      if ((o = entrance_x_session_edje_get(exs, e->edje, file)))
       {
-         entrance_session_xsession_load(e, key);
+         if (e->session)
+            free(e->session);
+         e->session = strdup(exs->session);
+
+         old_o = edje_object_part_swallow_get(e->edje, "EntranceSession");
+         if (old_o)
+         {
+            edje_object_part_unswallow(e->edje, old_o);
+            evas_object_del(old_o);
+         }
+         edje_object_part_swallow(e->edje, "EntranceSession", o);
+         edje_object_signal_emit(e->edje, "SessionDefaultChanged", "");
+         edje_object_signal_emit(e->edje, "SessionSelected", "");
       }
-      edje_object_signal_emit(e->edje, "SessionSelected", "");
-   }
-   else
-   {
-      fprintf(stderr, "Unable to find session %s\n", key);
    }
 }
 
@@ -449,12 +413,12 @@
 void
 entrance_session_list_add(Entrance_Session * e)
 {
-   char buf[PATH_MAX];
+   Evas_Coord w, h;
    Evas_List *l = NULL;
-   Entrance_X_Session *exs = NULL;
    const char *key = NULL;
-   Evas_Coord w, h;
+   const char *file = NULL;
    Evas_Object *edje = NULL;
+   Entrance_X_Session *exs = NULL;
    Evas_Object *container = NULL;
 
    if (!e || !e->edje || !e->config)
@@ -478,15 +442,13 @@
                                      CONTAINER_FILL_POLICY_KEEP_ASPECT);
          e_container_direction_set(container, 1);
       }
-
-      snprintf(buf, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s",
-               e->config->theme);
+      edje_object_file_get(e->edje, &file, NULL);
       for (l = e->config->sessions.keys; l; l = l->next)
       {
          key = (const char *) l->data;
          if ((exs = evas_hash_find(e->config->sessions.hash, key)))
          {
-            if ((edje = entrance_x_session_edje_get(exs, e->edje, buf)))
+            if ((edje = entrance_x_session_edje_get(exs, e->edje, file)))
             {
                e_container_element_append(container, edje);
             }
@@ -553,17 +515,18 @@
  * session that's the first item in the system's session list
  * @param e - the entrance session you're working with
  */
-const char *
-entrance_session_default_xsession_get(Entrance_Session * e)
+Entrance_X_Session *
+entrance_session_x_session_default_get(Entrance_Session * e)
 {
    Evas_List *l = NULL;
-   const char *result = NULL;
+   Entrance_X_Session *result = NULL;
 
    if (e && e->config)
    {
       if ((l = e->config->sessions.keys))
       {
-         result = (const char *) l->data;
+         result =
+            evas_hash_find(e->config->sessions.hash, (const char *) l->data);
       }
    }
    return (result);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- entrance_session.h  3 Mar 2004 20:08:47 -0000       1.15
+++ entrance_session.h  11 Mar 2004 20:21:33 -0000      1.16
@@ -18,6 +18,7 @@
 #include "entrance_auth.h"
 #include "entrance_config.h"
 #include "entrance_user.h"
+#include "entrance_x_session.h"
 
 /**
  * This is the handle to all of the data we've allocated in entrance
@@ -45,12 +46,13 @@
 void entrance_session_user_set(Entrance_Session * e, Entrance_User * user);
 void entrance_session_user_session_default_set(Entrance_Session * e);
 void entrance_session_start_user_session(Entrance_Session * e);
-void entrance_session_xsession_set(Entrance_Session * e,
-                                   const char *xsession);
 void entrance_session_edje_object_set(Entrance_Session * e,
                                       Evas_Object * obj);
 void entrance_session_list_add(Entrance_Session * e);
 void entrance_session_user_list_add(Entrance_Session * e);
-const char *entrance_session_default_xsession_get(Entrance_Session * e);
+Entrance_X_Session *entrance_session_x_session_default_get(Entrance_Session *
+                                                           e);
+void entrance_session_x_session_set(Entrance_Session * e,
+                                    Entrance_X_Session * exs);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- main.c      10 Mar 2004 22:53:52 -0000      1.42
+++ main.c      11 Mar 2004 20:21:33 -0000      1.43
@@ -316,7 +316,7 @@
    {
       Entrance_X_Session *exs = (Entrance_X_Session *) data;
 
-      entrance_session_xsession_set(session, exs->name);
+      entrance_session_x_session_set(session, exs);
    }
 }
 
@@ -797,9 +797,9 @@
          in the config's session list */
       if (edje_object_part_exists(edje, "EntranceSession"))
       {
-         entrance_session_xsession_set(session,
-                                       entrance_session_default_xsession_get
-                                       (session));
+         entrance_session_x_session_set(session,
+                                        entrance_session_x_session_default_get
+                                        (session));
       }
       /* See if we have an EntranceSessionList part, tell the session to load 
          the session list if it exists. */




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to