Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        entice.c entice.h ipc.c ipc.h main.c 


Log Message:
updates so an instance of entice that's piping filenames to an existing
instance of entice repositions the head of the list to the first image in
the new instance's list.


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- entice.c    1 Jan 2004 21:00:12 -0000       1.26
+++ entice.c    8 Jan 2004 05:03:54 -0000       1.27
@@ -140,6 +140,7 @@
                                         CONTAINER_FILL_POLICY_FILL_X |
                                         CONTAINER_FILL_POLICY_KEEP_ASPECT);
             e_container_direction_set(e->container, 1);
+           fprintf(stderr, "TAller than high\n");
          }
          edje_object_part_swallow(e->edje, "EnticeThumbnailArea",
                                   e->container);
@@ -178,6 +179,22 @@
    }
 }
 
+int
+entice_current_image_set(const char *file)
+{
+    if(entice && file)
+    {
+       Evas_Object *o = NULL;
+       if((o = (Evas_Object*)evas_hash_find(entice->thumb.hash, file)))
+       {
+           entice_thumb_load_ethumb(edje_object_part_swallow_get(o,
+           "EnticeThumb"));
+           return(1);
+       }
+    }
+    return(0);
+}
+
 /**
  * _entice_thumb_load - callback for loading an entice thumb
  * @_data - The E_Thumb object we're loading from, a param to the cb
@@ -199,7 +216,7 @@
       Evas_Coord w, h;
       int should_fit = 0;
       char buf[PATH_MAX];
-
+    
       if ((entice->current) && entice_image_file_get(entice->current)
           && !strcmp(e_thumb_file_get(o),
                      entice_image_file_get(entice->current)))
@@ -295,22 +312,43 @@
       {
          if ((o = e_thumb_new(ecore_evas_get(entice->ee), buf)))
          {
-            entice->thumb.list = evas_list_append(entice->thumb.list, o);
-            evas_object_resize(o, 48, 48);
 
             edje = edje_object_add(ecore_evas_get(entice->ee));
-            edje_object_file_set(edje, entice_config_theme_get(),
-                                 "EnticeThumb");
-            hookup_entice_thumb_signals(edje, o);
-            edje_object_part_swallow(edje, "EnticeThumb", o);
-            evas_object_show(edje);
-            evas_object_show(o);
-
-            entice->thumb.hash = evas_hash_add(entice->thumb.hash, buf, edje);
-
-            e_container_element_append(entice->container, edje);
-            if (evas_list_count(entice->thumb.list) == 1)
-               _entice_thumb_load(o, NULL, NULL, NULL);
+            if(edje_object_file_set(edje, entice_config_theme_get(),
+                                 "EnticeThumb"))
+           {
+               if(edje_object_part_exists(edje, "EnticeThumb"))
+               {
+                   entice->thumb.list = 
+                       evas_list_append(entice->thumb.list, o);
+                   evas_object_resize(o, 48, 48);
+                   hookup_entice_thumb_signals(edje, o);
+                   edje_object_part_swallow(edje, "EnticeThumb", o);
+                   evas_object_show(edje);
+                   evas_object_show(o);
+            
+                   entice->thumb.hash = 
+                       evas_hash_add(entice->thumb.hash, buf, edje);
+
+                   e_container_element_append(entice->container, edje);
+                   if (evas_list_count(entice->thumb.list) == 1)
+                   _entice_thumb_load(o, NULL, NULL, NULL);
+               }
+               else
+               {
+                   fprintf(stderr, "Broken Theme!!! You didn't define an"
+                   "EnticeThumb part\n");
+                   result = 1;
+               }
+           }
+           else
+           {
+               fprintf(stderr, "Broken Theme!!! You didn't define an"
+               "EnticeThumb group\n");
+               evas_object_del(edje);
+               evas_object_del(o);
+               result = 1;
+           }
          }
          else
             result = 1;
@@ -358,7 +396,7 @@
                continue;
             snprintf(buf, PATH_MAX, "%s/%s", file, dent->d_name);
             if (!entice_file_is_dir(buf))
-               entice_file_add_job_cb(buf);
+               entice_file_add_job_cb(buf, IPC_FILE_APPEND);
          }
          closedir(d);
       }
@@ -370,9 +408,10 @@
  * entice_file_add_job_cb - generate the cached thumb and send an ipc
  * message telling entice to load it
  * @data - the full or relative path to the file we want to cache
+ * @add_type - whether to display or show the image
  */
 void
-entice_file_add_job_cb(void *data)
+entice_file_add_job_cb(void *data, int add_type)
 {
    Epsilon *e = NULL;
    char buf[PATH_MAX], *file = NULL;
@@ -411,7 +450,7 @@
                }
             }
             epsilon_free(e);
-            entice_ipc_client_request_image_load(buf);
+            entice_ipc_client_request_image_load(buf, add_type);
          }
       }
    }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- entice.h    5 Nov 2003 07:33:56 -0000       1.12
+++ entice.h    8 Jan 2004 05:03:54 -0000       1.13
@@ -18,8 +18,8 @@
 {
    struct
    {
-      Evas_Hash *hash;          /* filename -> E_Thumb Mapping */
-      Evas_List *list;          /* List of E_Thumbs */
+      Evas_Hash *hash;          /* filename -> EnticeThumb(edje) Mapping */
+      Evas_List *list;          /* List of E_Thumb */
       Evas_List *current;       /* Current Image's list item */
    } thumb;
 
@@ -40,7 +40,7 @@
 int entice_file_del(const char *file);
 int entice_file_del_from_fs(const char *file);
 int entice_current_image_set(const char *file);
-void entice_file_add_job_cb(void *data);
+void entice_file_add_job_cb(void *data, int add_type);
 
 void entice_thumbs_scroll_next_start(void);
 void entice_thumbs_scroll_prev_start(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/ipc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ipc.c       1 Jan 2004 21:00:12 -0000       1.5
+++ ipc.c       8 Jan 2004 05:03:54 -0000       1.6
@@ -1,4 +1,5 @@
 #include "entice.h"
+#include "ipc.h"
 #include <Ecore_Ipc.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -103,7 +104,19 @@
       char buf[e->size];
 
       snprintf(buf, e->size, "%s", (char *) e->data);
-      entice_file_add(buf);
+      switch(e->major)
+      {
+         case IPC_FILE_APPEND:
+           entice_file_add(buf);
+           break;
+         case IPC_FILE_DISPLAY:
+           entice_current_image_set(buf);
+           break;
+         default:
+           fprintf(stderr, "Unknown major code sent by client(%d)\n",
+           e->major);
+           break;
+      }
       /*
          printf("!! Client sent: [%i] [%i] (%i) \"%s\"\n", e->major,
          e->minor, e->size, buf);
@@ -138,7 +151,11 @@
    {
       ecore_ipc_server_del(server);
       for (i = 1; i < argc; i++)
-         entice_file_add_job_cb((void *) argv[i]);
+      {
+         entice_file_add_job_cb((void*)argv[i], IPC_FILE_APPEND);
+      }
+      if(argc > 0)
+         entice_file_add_job_cb((void*)argv[1], IPC_FILE_DISPLAY);
       return (1);
    }
    /* Otherwise we create it */
@@ -183,7 +200,7 @@
  * @file - the absolute path to file
  */
 void
-entice_ipc_client_request_image_load(const char *file)
+entice_ipc_client_request_image_load(const char *file, int major)
 {
    Ecore_Ipc_Server *server = NULL;
 
@@ -203,9 +220,9 @@
                               NULL);
       ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, ipc_server_data,
                               NULL);
-
+      
       snprintf(buf, PATH_MAX, "%s", file);
-      ecore_ipc_server_send(server, 5, 6, 0, 0, 0, buf, strlen(buf) + 1);
+      ecore_ipc_server_send(server, major, 6, 0, 0, 0, buf, strlen(buf) + 1);
       memset(buf, 0, sizeof(buf));
       ecore_ipc_server_del(server);
    }
@@ -215,5 +232,4 @@
       fprintf(stderr, "ERROR: Unable to connect to entice IPC Server\n");
    }
 #endif
-
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/ipc.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ipc.h       11 Oct 2003 22:54:12 -0000      1.1
+++ ipc.h       8 Jan 2004 05:03:54 -0000       1.2
@@ -1,6 +1,9 @@
 #ifndef ENTICE_IPC_H
 #define ENTICE_IPC_H
 
+#define IPC_FILE_APPEND 1
+#define IPC_FILE_DISPLAY 2
+
 /**
  * entice_ipc_init - entialize entice's ipc handlers
  * @argc - the number or arguments
@@ -9,6 +12,6 @@
  */
 int entice_ipc_init(int argc, const char **argv);
 void entice_ipc_shutdown(void);
-void entice_ipc_client_request_image_load(const char *file);
+void entice_ipc_client_request_image_load(const char *file, int major);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- main.c      1 Jan 2004 21:00:12 -0000       1.17
+++ main.c      8 Jan 2004 05:03:54 -0000       1.18
@@ -195,7 +195,7 @@
             {
               case 0:
                  for (i = 1; i < argc; i++)
-                    entice_file_add_job_cb((void *) argv[i]);
+                    entice_file_add_job_cb((void *) argv[i], IPC_FILE_APPEND);
                  exit(0);
                  break;
               default:




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to