Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_eap_editor.c e_eap_editor.h 


Log Message:

reenable creation of .desktop when dropping a border icon on to ibar

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- e_eap_editor.c      13 Apr 2007 00:49:24 -0000      1.77
+++ e_eap_editor.c      13 Apr 2007 01:36:05 -0000      1.78
@@ -48,77 +48,85 @@
 
 /* externally accessible functions */
 
-EAPI E_Desktop_Edit *
-e_desktop_border_edit(E_Container *con, E_Border *bd)
+EAPI Efreet_Desktop *
+e_desktop_border_create(E_Border *bd)
 {
-   E_Desktop_Edit *editor;
+   Efreet_Desktop *desktop = NULL;
+   const char *desktop_dir, *icon_dir;
    const char *bname, *bclass;
    char path[PATH_MAX];
 
-   if (!con) return NULL;
-   editor = E_OBJECT_ALLOC(E_Desktop_Edit, E_DESKTOP_EDIT_TYPE, 
_e_desktop_edit_free);
-   if (!editor) return NULL;
-   if (bd->desktop)
-     editor->desktop = bd->desktop;
-
    bname = bd->client.icccm.name;
    if ((bname) && (bname[0] == 0)) bname = NULL;
    bclass = bd->client.icccm.class;
    if ((bclass) && (bclass[0] == 0)) bclass = NULL;
 
-   /* the border does not yet have a desktop entry. add one and pre-populate
-      it with values from the border */
-   if (!editor->desktop)
-     {
-       const char *desktop_dir, *icon_dir;
+   desktop_dir = e_user_desktop_dir_get();
 
-       desktop_dir = e_user_desktop_dir_get();
+   if (!desktop_dir || !e_util_dir_check(desktop_dir)) return NULL;
 
-       if (!desktop_dir || !e_util_dir_check(desktop_dir)) return;
+   icon_dir = e_user_icon_dir_get();
+   if (!icon_dir || !e_util_dir_check(icon_dir)) return NULL;
 
-       icon_dir = e_user_icon_dir_get();
-       if (!icon_dir || !e_util_dir_check(icon_dir)) return;
+   if (bname) 
+     {
+       snprintf(path, sizeof(path), "%s/%s.desktop", desktop_dir, bname);
+       desktop = efreet_desktop_empty_new(path);
+     }
+   else
+     desktop = efreet_desktop_empty_new(NULL);
+
+   if (!desktop)
+     {
+       //XXX out of memory?
+       return NULL;
+     }
+   if (bclass) desktop->name = strdup(bclass);
+   if (bclass) desktop->startup_wm_class = strdup(bclass);
+   if (bd->client.icccm.command.argc > 0)
+     // FIXME this should concat the entire argv array together
+     desktop->exec = strdup(bd->client.icccm.command.argv[0]);
+   else if (bname)
+     desktop->exec = strdup(bname); 
+
+   if (bd->client.netwm.startup_id > 0)
+     desktop->startup_notify = 1;
+   if (bd->client.netwm.icons)
+     {
+       /* FIXME
+        * - Find the icon with the best size
+        * - Should use mkstemp
+        */
+       const char *tmp;
 
-       if (bname) 
+       snprintf(path, sizeof(path), "%s/%s-%.6f.png", icon_dir, bname, 
ecore_time_get());
+       if (e_util_icon_save(&(bd->client.netwm.icons[0]), path))
          {
-            snprintf(path, sizeof(path), "%s/%s.desktop", desktop_dir, bname);
-            editor->desktop = efreet_desktop_empty_new(path);
+            desktop->icon = strdup(path);
          }
        else
-         editor->desktop = efreet_desktop_empty_new(NULL);
+         fprintf(stderr, "Could not save file from ARGB: %s\n", path);
+     }
+   return desktop;
+}
+EAPI E_Desktop_Edit *
+e_desktop_border_edit(E_Container *con, E_Border *bd)
+{
+   E_Desktop_Edit *editor;
 
-       if (!editor->desktop)
-         {
-            //XXX out of memory?
-            return;
-         }
-         if (bclass) editor->desktop->name = strdup(bclass);
-         if (bclass) editor->desktop->startup_wm_class = strdup(bclass);
-         if (bd->client.icccm.command.argc > 0)
-           // FIXME this should concat the entire argv array together
-           editor->desktop->exec = strdup(bd->client.icccm.command.argv[0]);
-         else if (bname)
-           editor->desktop->exec = strdup(bname); 
-
-         if (bd->client.netwm.startup_id > 0)
-           editor->desktop->startup_notify = 1;
-         if (bd->client.netwm.icons)
-           {
-              /* FIXME
-               * - Find the icon with the best size
-               * - Should use mkstemp
-               */
-              const char *tmp;
-
-              snprintf(path, sizeof(path), "%s/%s-%.6f.png", icon_dir, bname, 
ecore_time_get());
-              if (e_util_icon_save(&(bd->client.netwm.icons[0]), path))
-                {
-                   editor->tmp_image_path = strdup(path);
-                   editor->desktop->icon = strdup(path);
-                }
-              else
-                fprintf(stderr, "Could not save file from ARGB: %s\n", path);
-           }
+   if (!con) return NULL;
+   editor = E_OBJECT_ALLOC(E_Desktop_Edit, E_DESKTOP_EDIT_TYPE, 
_e_desktop_edit_free);
+   if (!editor) return NULL;
+   if (bd->desktop)
+     editor->desktop = bd->desktop;
+
+   /* the border does not yet have a desktop entry. add one and pre-populate
+      it with values from the border */
+   if (!editor->desktop)
+     {
+       editor->desktop = e_desktop_border_create(bd);
+       if (editor->desktop && editor->desktop->icon)
+         editor->tmp_image_path = strdup(editor->desktop->icon);
      }
 
 #if 0
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_eap_editor.h      13 Apr 2007 00:49:24 -0000      1.9
+++ e_eap_editor.h      13 Apr 2007 01:36:05 -0000      1.10
@@ -32,6 +32,7 @@
    E_Config_Dialog *cfd;
 };
 
+EAPI Efreet_Desktop *e_desktop_border_create(E_Border *bd);
 EAPI E_Desktop_Edit *e_desktop_border_edit(E_Container *con, E_Border *bd);
 EAPI E_Desktop_Edit *e_desktop_edit(E_Container *con, Efreet_Desktop *desktop);
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to