Thanks! Both of these are essentially patches from j-r; the tracker urls are..
authorskeezix <skeezix@fw.skeleton.org>
Wed, 10 Jul 2013 19:58:19 +0000 (15:58 -0400)
committerskeezix <skeezix@fw.skeleton.org>
Wed, 10 Jul 2013 19:58:19 +0000 (15:58 -0400)
http://bugs.openpandora.org/index.php?do=details&task_id=321&action=takeownership&ids=321#
http://bugs.openpandora.org/index.php?do=details&task_id=322

lib/pnd_desktop.c
lib/pnd_discovery.c

index 3977f19..4bb8130 100644 (file)
@@ -532,8 +532,10 @@ int pnd_map_dotdesktop_categories ( pnd_conf_handle c, char *target_buffer, unsi
   #define MAPCAT(field)                                            \
     if ( ( t = d -> field ) ) {                             \
       match = pnd_map_dotdesktop_category ( c, t );         \
-      strncat ( target_buffer, match ? match : t, len );    \
-      strncat ( target_buffer, ";", len );                  \
+      if ( ( !match ) || ( strcasecmp ( match, "NoCategory" ) ) ) {    \
+       strncat ( target_buffer, match ? match : t, len );  \
+       strncat ( target_buffer, ";", len );                \
+      }                                                     \
     }
 
   MAPCAT(main_category);
index 2fd1882..76f2868 100644 (file)
@@ -420,6 +420,7 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
          if ( p -> main_category ) {
            free ( p -> main_category );
          }
+         // the override file cannot suppress the main category
          p -> main_category = strdup ( v );
        }
        snprintf ( key, 100, "Application-%u.maincategorysub1", p -> subapp_number );
@@ -432,6 +433,48 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
            p -> main_category1 = strdup ( v );
          }
        }
+       snprintf ( key, 100, "Application-%u.maincategorysub2", p -> subapp_number );
+       if ( ( v = pnd_conf_get_as_char ( ovrh, key ) ) ) {
+         if ( p -> main_category2 ) {
+           free ( p -> main_category2 );
+           p -> main_category2 = NULL;
+         }
+         if ( strcasecmp ( v, "NoSubcategory" ) != 0 ) {
+           p -> main_category2 = strdup ( v );
+         }
+       }
+       // alt categories
+       snprintf ( key, 100, "Application-%u.altcategory", p -> subapp_number );
+       if ( ( v = pnd_conf_get_as_char ( ovrh, key ) ) ) {
+         if ( p -> alt_category ) {
+           free ( p -> alt_category );
+           p -> alt_category = NULL;
+         }
+         // but it makes sense to allow full suppression of the alternate category
+         if ( strcasecmp ( v, "NoCategory" ) != 0 ) {
+           p -> alt_category = strdup ( v );
+          }
+       }
+       snprintf ( key, 100, "Application-%u.altcategorysub1", p -> subapp_number );
+       if ( ( v = pnd_conf_get_as_char ( ovrh, key ) ) ) {
+         if ( p -> alt_category1 ) {
+           free ( p -> alt_category1 );
+           p -> alt_category1 = NULL;
+         }
+         if ( strcasecmp ( v, "NoSubcategory" ) != 0 ) {
+           p -> alt_category1 = strdup ( v );
+         }
+       }
+       snprintf ( key, 100, "Application-%u.altcategorysub2", p -> subapp_number );
+       if ( ( v = pnd_conf_get_as_char ( ovrh, key ) ) ) {
+         if ( p -> alt_category2 ) {
+           free ( p -> alt_category2 );
+           p -> alt_category2 = NULL;
+         }
+         if ( strcasecmp ( v, "NoSubcategory" ) != 0 ) {
+           p -> alt_category2 = strdup ( v );
+         }
+       }
 
       } // got ovr conf loaded?