Lots of aesthetics; for apps with searchpaths listed multiple times (like /pandora...
authorskeezix <skeezix@flotsam-vm.(none)>
Wed, 14 Jul 2010 19:30:08 +0000 (15:30 -0400)
committerskeezix <skeezix@flotsam-vm.(none)>
Wed, 14 Jul 2010 19:30:08 +0000 (15:30 -0400)
minimenu/mmcat.c
minimenu/mmenu.c
minimenu/mmenu.h
minimenu/mmui.c
testdata/conf/desktop

index 9d1b1a0..8a32fa3 100644 (file)
@@ -169,7 +169,7 @@ int cat_sort_score ( mm_appref_t *s1, mm_appref_t *s2 ) {
 
   }
 
-  return ( strcmp ( s1 -> ref -> title_en, s2 -> ref -> title_en ) );
+  return ( strcasecmp ( s1 -> ref -> title_en, s2 -> ref -> title_en ) );
 }
 
 void category_dump ( void ) {
index 7e46761..d4b1438 100644 (file)
@@ -494,6 +494,23 @@ void applications_scan ( void ) {
   // merge lists
   if ( merge_apps ) {
     if ( g_active_apps ) {
+      // the key from pnd_disco_search() is the _path_, so easy to look for duplicates
+      // this is pretty inefficient, being linked lists; perhaps should switch to hash tables when
+      // we expect thousands of apps.. or at least an index or something.
+      void *a = pnd_box_get_head ( merge_apps );
+      void *nexta = NULL;
+      while ( a ) {
+       nexta = pnd_box_get_next ( a );
+
+       // if the key for the node is also found in active apps, toss out the merging one
+       if ( pnd_box_find_by_key ( g_active_apps, pnd_box_get_key ( a ) ) ) {
+         //fprintf ( stderr, "Merging app id '%s' is duplicate; discarding it.\n", pnd_box_get_key ( a ) );
+         pnd_box_delete_node ( merge_apps, a );
+       }
+
+       a = nexta;
+      }
+
       // got menu apps, and got desktop apps, merge
       pnd_box_append ( g_active_apps, merge_apps );
     } else {
@@ -514,6 +531,28 @@ void applications_scan ( void ) {
   // merge aux apps
   if ( merge_apps ) {
     if ( g_active_apps ) {
+
+      // LAME: snipped from above; should just catenate the 3 sets of searchpaths into a
+      // master searchpath, possibly removing duplicate paths _then_, and keep all this much
+      // more efficient
+
+      // the key from pnd_disco_search() is the _path_, so easy to look for duplicates
+      // this is pretty inefficient, being linked lists; perhaps should switch to hash tables when
+      // we expect thousands of apps.. or at least an index or something.
+      void *a = pnd_box_get_head ( merge_apps );
+      void *nexta = NULL;
+      while ( a ) {
+       nexta = pnd_box_get_next ( a );
+
+       // if the key for the node is also found in active apps, toss out the merging one
+       if ( pnd_box_find_by_key ( g_active_apps, pnd_box_get_key ( a ) ) ) {
+         fprintf ( stderr, "Merging app id '%s' is duplicate; discarding it.\n", pnd_box_get_key ( a ) );
+         pnd_box_delete_node ( merge_apps, a );
+       }
+
+       a = nexta;
+      }
+
       pnd_box_append ( g_active_apps, merge_apps );
     } else {
       g_active_apps = merge_apps;
index f7de51e..1c71f6f 100644 (file)
@@ -9,7 +9,7 @@ extern char *g_skinpath;
 
 // base searchpath to locate the conf
 #define MMENU_CONF "mmenu.conf"
-#define MMENU_CONF_SEARCHPATH "/media/*/pandora/mmenu:/etc/pandora/conf:./minimenu"
+#define MMENU_CONF_SEARCHPATH "/media/*/pandora/mmenu:/media/*/pandora/appdata/mmenu:/etc/pandora/conf:./minimenu"
 
 typedef enum {
   pndn_debug = 0,
index 7a2e21d..670986e 100644 (file)
@@ -1303,13 +1303,28 @@ void ui_process_input ( unsigned char block_p ) {
        if ( isalpha ( event.key.keysym.sym ) && g_categories [ ui_category ].refcount > 0 ) {
          mm_appref_t *app = g_categories [ ui_category ].refs;
 
-         // walk the category, looking for a first-char match
-         while ( app ) {
-           if ( app -> ref -> title_en && toupper ( app -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym ) ) {
-             break;
+         //fprintf ( stderr, "sel %s next %s\n", ui_selected -> ref -> title_en, ui_selected -> next -> ref -> title_en );
+
+         // are we already matching the same char? and next item is also same char?
+         if ( app && ui_selected &&
+              ui_selected -> ref -> title_en && ui_selected -> next -> ref -> title_en &&
+              toupper ( ui_selected -> ref -> title_en [ 0 ] ) == toupper ( ui_selected -> next -> ref -> title_en [ 0 ] ) &&
+              toupper ( ui_selected -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym )
+            )
+         {
+           // just skip down one
+           app = ui_selected -> next;
+         } else {
+
+           // walk the category, looking for a first-char match
+           while ( app ) {
+             if ( app -> ref -> title_en && toupper ( app -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym ) ) {
+               break;
+             }
+             app = app -> next;
            }
-           app = app -> next;
-         }
+
+         } // same start letter, or new run?
 
          // found something, or no?
          if ( app ) {
@@ -1318,6 +1333,10 @@ void ui_process_input ( unsigned char block_p ) {
            ui_set_selected ( ui_selected );
          }
 
+
+
+
+
        } // SDLK_alphanumeric?
 
       } // SDLK_....
index 0da72c0..b60798d 100644 (file)
@@ -3,12 +3,12 @@
 # Desktop configuration
 
 [desktop]
-searchpath     /mnt/sd?/pandora/desktop:./testdata/app?        # path to depth-search for PXMLs and pnd-files
+searchpath     /media/*/pandora/desktop:./testdata/app?        # path to depth-search for PXMLs and pnd-files
 dotdesktoppath ./testdata/dotdesktop   # path for pndnotifyd to spit .desktop files into
 iconpath       ./testdata/doticons     # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)
 
 [menu]
-searchpath     /mnt/sd?/pandora/menu:./testdata/menuapps       # path to depth-search for PXMLs and pnd-files
+searchpath     /media/*/pandora/menu:./testdata/app?:./testdata/menuapps       # path to depth-search for PXMLs and pnd-files
 dotdesktoppath ./testdata/menu         # path for pndnotifyd to spit .desktop files into
 iconpath       ./testdata/menuicons    # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)