Main Page | Directories | File List | File Members

libhildonmenu.h

00001 /*
00002  * This file is part of maemo-af-desktop
00003  *
00004  * Copyright (C) 2005, 2006 Nokia Corporation.
00005  *
00006  * Contact: Karoliina Salminen <karoliina.t.salminen@nokia.com>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * version 2.1 as published by the Free Software Foundation.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00020  * 02110-1301 USA
00021  *
00022  */
00023 
00024 #ifndef __LIBMENU_H__
00025 #define __LIBMENU_H__
00026 
00027 #include <libxml/xmlreader.h>
00028 #include <gtk/gtk.h>
00029 #include <libintl.h>
00030 
00031 G_BEGIN_DECLS
00032 
00033 /* [Desktop Entry] */
00034 #define DESKTOP_ENTRY_TYPE_FIELD        "Type"
00035 #define DESKTOP_ENTRY_ICON_FIELD        "Icon"
00036 #define DESKTOP_ENTRY_NAME_FIELD        "Name"
00037 #define DESKTOP_ENTRY_COMMENT_FIELD     "Comment"
00038 #define DESKTOP_ENTRY_EXEC_FIELD        "Exec"
00039 #define DESKTOP_ENTRY_SERVICE_FIELD     "X-Osso-Service"
00040 #define DESKTOP_ENTRY_TEXT_DOMAIN_FIELD "X-Text-Domain"
00041 
00042 #define SEPARATOR_STRING   "SEPARATOR"
00043 #define EXTRAS_MENU_STRING "tana_fi_extras"
00044 
00045 /* Default directory for .desktop files */
00046 #define DEFAULT_APPS_DIR "/usr/share/applications/"
00047 #define ICON_FAVOURITES  "qgn_list_gene_favor"
00048 #define ICON_FOLDER      "qgn_list_filesys_common_fldr"
00049 /*#define ICON_FOLDER      "qgn_list_gene_fldr_cls"*/
00050 #define ICON_DEFAULT_APP "qgn_list_gene_default_app"
00051 #define ICON_SIZE        26
00052 /* Apparently 64 is what we get for the "scalable" size. Should really be -1.*/
00053 #define ICON_THUMB_SIZE  64
00054 
00055 #define EMBLEM_EXPANDER_OPEN   "qgn_list_gene_fldr_exp"
00056 #define EMBLEM_EXPANDER_CLOSED "qgn_list_gene_fldr_clp"
00057 
00058 /* This string is only displayed in the task navigator applet */
00059 #define FAVOURITES_LOGICAL_STRING "tncpa_li_of_favourites"
00060 #define FAVOURITES_NAME  dgettext("osso-applet-tasknavigator", FAVOURITES_LOGICAL_STRING)
00061 
00062 /* Default systemwide menu */
00063 #define SYSTEMWIDE_MENU_FILE "/etc/xdg/menus/applications.menu"
00064 
00065 /* User specific menu. $HOME is prepended to this! */
00066 #define USER_MENU_FILE ".osso/menus/applications.menu"
00067 
00068 
00069 /* TreeModel items */
00070 enum {
00071     TREE_MODEL_NAME = 0,
00072     TREE_MODEL_ICON,
00073     TREE_MODEL_THUMB_ICON,
00074     TREE_MODEL_EMBLEM_EXPANDER_OPEN,
00075     TREE_MODEL_EMBLEM_EXPANDER_CLOSED,
00076     TREE_MODEL_EXEC,
00077     TREE_MODEL_SERVICE,
00078     TREE_MODEL_DESKTOP_ID,
00079     TREE_MODEL_COMMENT,
00080     TREE_MODEL_TEXT_DOMAIN,
00081     TREE_MODEL_COLUMNS
00082 };
00083 
00084 /* Menu types */
00085 enum {
00086     USER_MENU = 0,        /* User specific menu */
00087     SYSTEMWIDE_MENU,      /* The (default) systemwide menu */
00088     MENU_TYPES            /* Number of menu types */
00089 };
00090 
00091 
00092 
00093 /* Function for getting an icon */
00094 GdkPixbuf *get_icon(const char *icon_name, int icon_size);
00095 
00096 /* Function to load an icon with a fallback if exact size is not present */
00097 GdkPixbuf *get_icon_with_fallback(const char *icon_name,
00098                                   int icon_size,
00099                                   GdkPixbuf *fallback);
00100 
00101 
00102 /* Function for getting the menu contents */
00103 GtkTreeModel *get_menu_contents(void);
00104 
00105 /* Function for finding the first and last folders on root level
00106  * i.e. under Favourites.
00107  *
00108  * model        - The tree model which to search for the folders
00109  * first_folder - GtkTreePath to be set to point to the first folder
00110  * last_folder  - GtkTreePath to be set to point to the last folder
00111  */
00112 void find_first_and_last_root_level_folders( GtkTreeModel *model,
00113         GtkTreePath **first_folder, GtkTreePath **last_folder );
00114 
00115 /* Function for setting the separators to correct positions 
00116  *
00117  * model - The tree model of the menu in which we want to set the separators.
00118  *
00119  * Returns TRUE on success, FALSE on failure.
00120  */
00121 gboolean set_separators( GtkTreeModel *model );
00122 
00123 /* Function for setting the menu contents, i.e. writing it to the file */
00124 gboolean set_menu_contents( GtkTreeModel *model );
00125 
00126 G_END_DECLS
00127 
00128 #endif

Generated on Thu Dec 21 11:26:52 2006 for maemo-af-desktop-documentation by  doxygen 1.4.2