hello-world/settings/menu.c

Go to the documentation of this file.
00001 /*
00002  * File Name: menu.c
00003  */
00004 
00005 /*
00006  * This file is part of hello-world-settings.
00007  *
00008  * hello-world is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * hello-world is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2009 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 //----------------------------------------------------------------------------
00028 // Include Files
00029 //----------------------------------------------------------------------------
00030 
00031 // system include files, between < >
00032 #include <stdio.h>
00033 #include <unistd.h>
00034 
00035 // ereader include files, between < >
00036 
00037 // local include files, between " "
00038 #include "log.h"
00039 #include "i18n.h"
00040 #include "ipc.h"
00041 #include "main.h"
00042 #include "menu.h"
00043 
00044 
00045 //----------------------------------------------------------------------------
00046 // Type Declarations
00047 //----------------------------------------------------------------------------
00048 
00049 
00050 //----------------------------------------------------------------------------
00051 // Constants
00052 //----------------------------------------------------------------------------
00053 
00054 // menus for application, must be unique
00055 static const char *MENU_MAIN = "helloworld_settings_menu";
00056                                             
00057 
00058 //----------------------------------------------------------------------------
00059 // Static Variables
00060 //----------------------------------------------------------------------------
00061 
00062 
00063 
00064 //============================================================================
00065 // Local Function Definitions
00066 //============================================================================
00067 
00068 
00069 
00070 //============================================================================
00071 // Functions Implementation
00072 //============================================================================
00073 
00074 // initialise popup menu
00075 void menu_init ( void ) 
00076 {
00077     static gboolean firsttime = TRUE;
00078 
00079     LOGPRINTF("entry");
00080 
00081     // execute only once
00082     if ( !firsttime )
00083     {
00084         WARNPRINTF("function called twice");
00085         return;
00086     }
00087     firsttime = FALSE;
00088 
00089     // show an empty menu
00090     ipc_menu_add_menu( MENU_MAIN, NULL, NULL, NULL );
00091     menu_show();    
00092 }
00093 
00094 
00095 // remove the proper popup menu
00096 void menu_destroy (void)
00097 {
00098     LOGPRINTF("entry");
00099 
00100     // remove the main menu
00101     ipc_remove_menu( MENU_MAIN );
00102 }
00103 
00104 
00105 // show the proper popup menu
00106 void menu_show (void)
00107 {
00108     LOGPRINTF("entry");
00109 
00110     // show the main menu
00111     ipc_menu_show_menu( MENU_MAIN );
00112 }
00113 
00114 // set menu texts
00115 void menu_set_text ( void ) 
00116 {
00117     LOGPRINTF("entry");
00118 }
00119 
00120 
00121 //----------------------------------------------------------------------------
00122 // Callbacks from popupmenu
00123 //----------------------------------------------------------------------------
00124 
00125 // user has pressed a menu button
00126 void menu_on_item_activated ( const gchar *item,
00127                               const gchar *group,
00128                               const gchar *menu,
00129                               const gchar *state )
00130 {
00131     gboolean    ok = TRUE;
00132 
00133     LOGPRINTF("entry: item [%s] group [%s]", item, group);
00134 
00135     // TODO: implement your menu handling here, if required
00136     WARNPRINTF("unexpected menu group [%s]", group);
00137     ok = FALSE;
00138 
00139     if (!ok)
00140     {
00141         ERRORPRINTF( "Unhandled menu items: menu [%s] group [%s] item [%s] state [%s]",
00142                                             menu,     group,     item,     state );
00143     }
00144 }
Generated by  doxygen 1.6.2-20100208