Quick change so back to single .desktop/info, no assoc .desktops, and no alternative...
[pandora-libraries.git] / lib / pnd_desktop.c
index fb875ff..3977f19 100644 (file)
@@ -16,7 +16,7 @@
 
 unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t *p ) {
   char filename [ FILENAME_MAX ];
-  char buffer [ 1024 ];
+  char buffer [ 4096 ];
   FILE *f;
 
   // specification
@@ -122,23 +122,6 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
     fprintf ( f, "X-Pandora-Info-Name=%s\n", p -> info_name );
   }
 
-  if ( p -> associationitem1_name || p -> associationitem2_name || p -> associationitem3_name ) {
-    fprintf ( f, "MimeType=" );
-    if ( p -> associationitem1_name ) {
-      fprintf ( f, "%s;", p -> associationitem1_filetype );
-      pnd_log ( PND_LOG_DEFAULT, "App %s is handling mimetype %s [1]\n", p -> title_en, p -> associationitem1_filetype );
-    }
-    if ( p -> associationitem2_name ) {
-      fprintf ( f, "%s;", p -> associationitem2_filetype );
-      pnd_log ( PND_LOG_DEFAULT, "App %s is handling mimetype %s [2]\n", p -> title_en, p -> associationitem2_filetype );
-    }
-    if ( p -> associationitem3_name ) {
-      fprintf ( f, "%s;", p -> associationitem3_filetype );
-      pnd_log ( PND_LOG_DEFAULT, "App %s is handling mimetype %s [3]\n", p -> title_en, p -> associationitem3_filetype );
-    }
-    fprintf ( f, "\n" );
-  }
-
 #if 0 // we let pnd_run.sh command line handle this instead of in .desktop
   if ( p -> startdir ) {
     snprintf ( buffer, 1020, "Path=%s\n", p -> startdir );
@@ -148,6 +131,11 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
   }
 #endif
 
+  // association requests
+  if ( p -> associationitem1_filetype ) {
+    fprintf ( f, "MimeType=%s\n", p -> associationitem1_filetype );
+  }
+
   if ( p -> exec ) {
     char *nohup;
 
@@ -174,7 +162,7 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
       strncat ( buffer, p -> startdir, 1020 );
     }
 
-    // args
+    // args (regular args, for pnd_run.sh to handle)
     if ( p -> execargs ) {
       char argbuf [ 1024 ];
       snprintf ( argbuf, 1000, " -a \"%s\"", p -> execargs );
@@ -192,6 +180,13 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
       strncat ( buffer, " -x ", 1020 );
     }
 
+    // args (dashdash -- args, that the shell can screw with before pnd_run.sh gets them)
+    if ( p -> exec_dashdash_args ) {
+      char argbuf [ 4096 ];
+      snprintf ( argbuf, 4096, " -- %s", p -> exec_dashdash_args );
+      strncat ( buffer, argbuf, 4096 );
+    }
+
     // newline
     strncat ( buffer, "\n", 1020 );