mmenu; larger font in list view; added to config file and config menu; default folders
[pandora-libraries.git] / minimenu / freedesktop_cats.c
1
2 #include <stdio.h>
3 #include <strings.h>
4
5 #include "freedesktop_cats.h"
6
7 // folks want to limit categories to official ones, so okay.
8 // http://standards.freedesktop.org/menu-spec/latest/apa.html
9 //
10
11 freedesktop_cat_t freedesktop_complete[] = {
12
13   // HACK
14   { BADCATNAME,         NULL,           "Lazy PXML dev is lazy." },
15   { "NoParentCategory", NULL,           "To mean no parent category" },
16   { "NoSubcategory",    "NoneParent",   "To mean no subcategory" },
17   // HACK
18
19   { "AudioVideo",       NULL,           "A multimedia (audio/video) application" },
20   { "Audio",            NULL,           "An audio application" },
21   { "Video",            NULL,           "A video application" },
22   { "Development",      NULL,           "An application for development" },
23   { "Education",        NULL,           "Educational software" },
24   { "Game",             NULL,           "A game" },
25   { "Graphics",         NULL,           "Graphical application" },
26   { "Network",          NULL,           "Network application such as a web browser" },
27   { "Office",           NULL,           "An office type application" },
28   { "Settings",         NULL,           "Settings applications" },
29   { "System",           NULL,           "System application" },
30   { "Utility",          NULL,           "Small utility application" },
31
32   { "Building",         "Development",  "A tool to build applications " },
33   { "Debugger",         "Development",   "A tool to debug applications" },
34   { "IDE",              "Development",   "IDE application " },
35   { "GUIDesigner",      "Development",   "A GUI designer application " },
36   { "Profiling",        "Development",   "A profiling tool      " },
37   { "RevisionControl",  "Development",   "Applications like cvs or subversion " },
38   { "Translation",      "Development",   "A translation tool " },
39   { "Calendar",         "Office",   "Calendar application " },
40   { "ContactManagement",    "Office",   "E.g. an address book " },
41   { "Database",         "Office",       "Application to manage a database " },
42   { "Database",         "Development",  "Application to manage a database " },
43   { "Database",         "AudioVideo",   "Application to manage a database " },
44   { "Dictionary",       "Office",   "A dictionary  " },
45   { "Chart",            "Office",   "Chart application" },
46   { "Email",            "Office",   "Email application" },
47   { "Finance",          "Office",   "Application to manage your finance " },
48   { "FlowChart",        "Office",   "A flowchart application    " },
49   { "PDA",              "Office",   "Tool to manage your PDA    " },
50   { "ProjectManagement",     "Office",   "Project management application " },
51   { "Presentation",     "Office",   "Presentation software  " },
52   { "Spreadsheet",      "Office",   "A spreadsheet  " },
53   { "WordProcessor",    "Office",   "A word processor  " },
54   { "2DGraphics",       "Graphics",   "2D based graphical application " },
55   { "VectorGraphics",   "Graphics",   "Vector based graphical application " },
56   { "RasterGraphics",   "Graphics",   "Raster based graphical application " },
57   { "3DGraphics",       "Graphics",   "3D based graphical application     " },
58   { "Scanning",         "Graphics",   "Tool to scan a file/text      " },
59   { "OCR",              "Graphics",   "Optical character recognition application " },
60   { "Photography",      "Graphics",   "Camera tools, etc. " },
61   { "Publishing",       "Graphics",   "Desktop Publishing applications and Color Management tools " },
62   { "Viewer",           "Graphics",   "Tool to view e.g. a graphic or pdf file   " },
63   { "TextTools",        "Utility",   "A text tool utiliy  " },
64   { "DesktopSettings",  "Settings",   "Configuration tool for the GUI " },
65   { "HardwareSettings", "Settings",   "A tool to manage hardware components, like sound cards, video cards or printers " },
66   { "Printing",         "Settings",   "A tool to manage printers " },
67   { "PackageManager",   "Settings",   "A package manager application " },
68   { "Dialup",           "Network",   "A dial-up program " },
69   { "InstantMessaging", "Network",   "An instant messaging client " },
70   { "Chat",             "Network",   "A chat client" },
71   { "IRCClient",        "Network",   "An IRC client" },
72   { "FileTransfer",     "Network",   "Tools like FTP or P2P programs " },
73   { "HamRadio",         "Network",   "HAM radio software " },
74   { "News",             "Network",   "A news reader or a news ticker " },
75   { "P2P",              "Network",   "A P2P program " },
76   { "RemoteAccess",     "Network",   "A tool to remotely manage your PC " },
77   { "Telephony",        "Network",   "Telephony via PC   " },
78   { "TelephonyTools",   "Utility",   "Telephony tools, to dial a number, manage PBX, ... " },
79   { "VideoConference",  "Network",   "Video Conference software  " },
80   { "WebBrowser",       "Network",   "A web browser    " },
81   { "WebDevelopment",   "Network",   "A tool for web developers " },
82   { "Midi",             "AudioVideo",   "An app related to MIDI    " },
83   { "Midi",             "Audio",     "An app related to MIDI    " },
84   { "Mixer",            "AudioVideo",   "Just a mixer  " },
85   { "Mixer",            "Audio",     "Just a mixer  " },
86   { "Sequencer",        "AudioVideo",   "A sequencer  " },
87   { "Sequencer",        "Audio",     "A sequencer  " },
88   { "Tuner",            "AudioVideo",   "A tuner  " },
89   { "Tuner",            "Audio",        "A tuner  " },
90   { "TV",               "AudioVideo",   "A TV application" },
91   { "TV",               "Video",   "A TV application" },
92   { "AudioVideoEditing",    "Audio",   "Application to edit audio/video files " },
93   { "AudioVideoEditing",    "Video",   "Application to edit audio/video files " },
94   { "AudioVideoEditing",    "AudioVideo",   "Application to edit audio/video files " },
95   { "Player",           "Audio",   "Application to play audio/video files " },
96   { "Player",           "AudioVideo",   "Application to play audio/video files " },
97   { "Player",           "Video",   "Application to play audio/video files " },
98   { "Recorder",         "Audio",   "Application to record audio/video files " },
99   { "Recorder",         "AudioVideo",   "Application to record audio/video files " },
100   { "DiscBurning",      "AudioVideo",   "Application to burn a disc     " },
101   { "ActionGame",       "Game",   "An action game " },
102   { "AdventureGame",    "Game",   "Adventure style game" },
103   { "ArcadeGame",       "Game",   "Arcade style game" },
104   { "BoardGame",        "Game",   "A board game" },
105   { "BlocksGame",       "Game",   "Falling blocks game" },
106   { "CardGame",         "Game",   "A card game  " },
107   { "KidsGame",         "Game",   "A game for kids" },
108   { "LogicGame",        "Game",   "Logic games like puzzles, etc " },
109   { "RolePlaying",      "Game",   "A role playing game     " },
110   { "Simulation",       "Game",   "A simulation game     " },
111   { "SportsGame",       "Game",   "A sports game     " },
112   { "StrategyGame",     "Game",   "A strategy game     " },
113   { "Art",              "Education",   "Software to teach arts    " },
114   { "Construction",     "Education",   NULL },
115   { "Music",            "Audio",  "Musical software" },
116   { "Languages",        "Education",   "Software to learn foreign languages " },
117   { "Science",          "Education",   "Scientific software     " },
118   { "ArtificialIntelligence",     "Education",   "Artificial Intelligence software " },
119   { "Astronomy",        "Education",   "Astronomy software   " },
120   { "Biology",          "Education",   "Biology software   " },
121   { "Chemistry",        "Education",   "Chemistry software   " },
122   { "ComputerScience",  "Education",   "ComputerSience software " },
123   { "DataVisualization", "Education",   "Data visualization software " },
124   { "Economy",          "Education",   "Economy software   " },
125   { "Electricity",      "Education",   "Electricity software" },
126   { "Geography",        "Education",   "Geography software" },
127   { "Geology",          "Education",   "Geology software" },
128   { "Geoscience",       "Education",   "Geoscience software" },
129   { "History",          "Education",   "History software" },
130   { "ImageProcessing",  "Education",   "Image Processing software " },
131   { "Literature",       "Education",   "Literature software     " },
132   { "Math",             "Education",   "Math software     " },
133   { "NumericalAnalysis",   "Education",   "Numerical analysis software " },
134   { "MedicalSoftware",     "Education",   "Medical software   " },
135   { "Physics",          "Education",   "Physics software   " },
136   { "Robotics",         "Education",   "Robotics software  " },
137   { "Sports",           "Education",   "Sports software    " },
138   { "ParallelComputing",   "Education",   "Parallel computing software " },
139   { "Amusement",        NULL, "A simple amusement " },
140   { "Archiving",        "Utility",   "A tool to archive/backup data " },
141   { "Compression",      "Utility",   "A tool to manage compressed data/archives " },
142   { "Electronics",      NULL, "Electronics software, e.g. a circuit designer" },
143   { "Emulator",         "Game",   "Emulator of another platform, such as a DOS emulator " },
144   { "Engineering",      NULL, "Engineering software, e.g. CAD programs " },
145   { "FileTools",        "Utility",   "A file tool utility " },
146   { "FileTools",        "System",   "A file tool utility " },
147   { "FileManager",      "System",   "A file manager " },
148   { "TerminalEmulator", "System",   "A terminal emulator application " },
149   { "Filesystem",       "System",   "A file system tool  " },
150   { "Monitor",          "System",   "Monitor application/applet that monitors some resource or activity " },
151   { "Security",         "System",   "A security tool      " },
152   { "Accessibility",    "System",   "Accessibility      " },
153   { "Calculator",       "Utility",   "A calculator      " },
154   { "Clock",            "Utility",   "A clock application/applet " },
155   { "TextEditor",       "Utility",   "A text editor      " },
156   { "Documentation",    NULL, "Help or documentation      " },
157   { "Core",             NULL, "Important application, core to the desktop such as a file manager or a help browser " },
158   { "KDE",              "QT",   "Application based on KDE libraries " },
159   { "GNOME",           "GTK",   "Application based on GNOME libraries " },
160   { "GTK",              NULL, "Application based on GTK+ libraries" },
161   { "Qt",               NULL, "Application based on Qt libraries" },
162   { "Motif",            NULL, "Application based on Motif libraries" },
163   { "Java",             NULL, "Application based on Java GUI libraries, such as AWT or Swing" },
164   { "ConsoleOnly",      NULL, "Application that only works inside a terminal (text-based or command line application)" },
165   { NULL,               NULL, NULL }
166 };
167
168 // return the found category, if ..
169 //   name matches catname AND
170 //   parent is NULL, or
171 //     parent is value and matches cats parent.
172 // ex:
173 //   If you're looking for Game/NULL, you'll find it.
174 //   If you're looking for Game/Emulator, you'll find it.
175 //   If you're looking for Emulator/NULL you WILL NOT find it.
176 freedesktop_cat_t *freedesktop_category_query ( char *name, char *parentcatname ) {
177   freedesktop_cat_t *p = freedesktop_complete;
178
179   // if we're supplied "NoSubcategory" virtual name, then we set it to NULL for the search
180 #if 0
181   if ( parentcatname && strcasecmp ( name, freedesktop_complete [ 2 ].cat ) == 0 ) {
182     name = parentcatname;
183     parentcatname = NULL;
184   }
185 #endif
186
187   // search for the cat/parent combination
188   while ( p -> cat ) {
189
190     if ( strcasecmp ( p -> cat, name ) == 0 ) {
191
192       if ( parentcatname == NULL && p -> parent_cat == NULL ) {
193         return ( p );
194       } else if ( parentcatname && p -> parent_cat && strcasecmp ( p -> parent_cat, parentcatname ) == 0 ) {
195         return ( p );
196       }
197
198     }
199
200     p++;
201   }
202
203   return ( NULL );
204 }
205
206 unsigned int freedesktop_count ( void ) {
207   unsigned int i = 0;
208
209   while ( freedesktop_complete [ i ].cat ) {
210     i++;
211   }
212
213   return ( i );
214 }
215
216 #if 0
217 int main ( void ) {
218
219   printf ( "check Applet (should be 1) -> %d\n", freedesktop_category_query ( "Applet" ) );
220   printf ( "check Education (should be 1) -> %d\n", freedesktop_category_query ( "Education" ) );
221   printf ( "check Mofo (should be 0) -> %d\n", freedesktop_category_query ( "Mofo" ) );
222
223   return ( 0 );
224 }
225 #endif