Notice: Trying to access array offset on value of type bool in /srv/www/vhosts/openpandora.org/domains/bugs.openpandora.org/httpdocs/scripts/details.php on line 649 FS#321 : Support overriding all category fields with .ovr

OpenPandora Main OS

  • Status Closed
  • Percent Complete
    100%
  • Task Type Feature Request
  • Category Core
  • Operating System Release 1 (Zaxxon)
  • Severity Low
  • Reported Version SuperZaxxon Final 1.54
Attached to Project: OpenPandora Main OS
Opened by Jürgen Rühle - 15.06.2013
Last edited by Jeff - 10.07.2013

FS#321 - Support overriding all category fields with .ovr

Currently only the main category and the first sub category of the main category can be overridden using a .ovr file while libpnd uses additional PXML supplied category date to construct the desktop file. This makes it difficult to work with PNDs that supply unwanted data in these additional fields.

Closed by  Jeff
10.07.2013 19:59
Reason for closing:  Implemented
Additional comments about closing:  Applied! Thanks!
Jürgen Rühle commented on 15.06.2013 21:22

Fortunately it is trivial to extend the existing override support. Please consider the following patch (there probably is a better way to supply it:-)

From 78972f82c02c6864eca677f6c4c19c8704664b9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20R=C3=BChle?= <j-r@online.de>
Date: Sat, 15 Jun 2013 19:20:15 +0200
Subject: [PATCH] Support more complete category override from .ovr files

Add overide support for subcategory 2 and the alternate category chain.

Also allow full suppression of the alternate main category using the magic
string "NoCategory". Note that the main category still cannot be supressed by
the .ovr file, because it should always use a useful main category.
---
 lib/pnd_discovery.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/lib/pnd_discovery.c b/lib/pnd_discovery.c
index 1f43540..6905687 100644
--- a/lib/pnd_discovery.c
+++ b/lib/pnd_discovery.c
@@ -428,6 +428,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 );
@@ -440,6 +441,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?
 
--
1.7.0.2

 

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing