Added some #ifdef protection for recent files feature that

require gtk 2.10 when desmume only require 2.8
This commit is contained in:
yabause 2009-07-11 19:44:29 +00:00
parent 4ccb09d36d
commit 2d31b5bb8d
1 changed files with 14 additions and 1 deletions

View File

@ -66,6 +66,10 @@
#define EMULOOP_PRIO (G_PRIORITY_HIGH_IDLE + 20)
#if GTK_CHECK_VERSION(2,10,0)
#define HAVE_RECENT_FILES 1
#endif
#if GTK_CHECK_VERSION(2,14,0)
#define HAVE_TIMEOUT 1
#endif
@ -126,7 +130,9 @@ static const char *ui_description =
" <menubar name='MainMenu'>"
" <menu action='FileMenu'>"
" <menuitem action='open'/>"
#ifdef HAVE_RECENT_FILES
" <menu action='RecentMenu'/>"
#endif
" <separator/>"
" <menuitem action='savestateto'/>"
" <menuitem action='loadstatefrom'/>"
@ -248,7 +254,9 @@ static const char *ui_description =
static const GtkActionEntry action_entries[] = {
{ "FileMenu", NULL, "_File" },
{ "open", "gtk-open", "_Open", "<Ctrl>o", NULL, OpenNdsDialog },
#ifdef HAVE_RECENT_FILES
{ "RecentMenu", NULL, "Open _recent" },
#endif
{ "savestateto", NULL, "Save state _to ...", NULL, NULL, SaveStateDialog },
{ "loadstatefrom", NULL, "Load state _from ...", NULL, NULL, LoadStateDialog },
{ "recordmovie", NULL, "Record movie _to ...", NULL, NULL, RecordMovieDialog },
@ -905,6 +913,7 @@ static void OpenNdsDialog()
gtk_dialog_run(GTK_DIALOG(pDialog));
gtk_widget_destroy(pDialog);
} else {
#ifdef HAVE_RECENT_FILES
GtkRecentData recentData;
memset(&recentData, 0, sizeof(GtkRecentData));
recentData.mime_type = "application/x-nds-binary";
@ -916,7 +925,7 @@ static void OpenNdsDialog()
gtk_recent_manager_add_full (manager, g_filename_to_uri(sPath, NULL, NULL), &recentData);
g_free(recentData.app_exec);
#endif
gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), TRUE);
}
@ -930,12 +939,14 @@ static void OpenNdsDialog()
gtk_widget_destroy(pFileSelection);
}
#ifdef HAVE_RECENT_FILES
static void OpenRecent(GtkRecentChooser *chooser, gpointer user_data)
{
Open(g_filename_from_uri(gtk_recent_chooser_get_current_uri(chooser), NULL, NULL));
gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), TRUE);
}
#endif
static void Reset()
{
@ -1892,6 +1903,7 @@ common_gtk_main( struct configured_features *my_config)
pToolBar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar");
gtk_box_pack_start (GTK_BOX(pVBox), pToolBar, FALSE, FALSE, 0);
#ifdef HAVE_RECENT_FILES
{
GtkWidget * recentMenu = gtk_ui_manager_get_widget (ui_manager, "/MainMenu/FileMenu/RecentMenu");
GtkWidget * recentFiles = gtk_recent_chooser_menu_new();
@ -1901,6 +1913,7 @@ common_gtk_main( struct configured_features *my_config)
gtk_menu_item_set_submenu(GTK_MENU_ITEM(recentMenu), recentFiles);
g_signal_connect(G_OBJECT(recentFiles), "item-activated", G_CALLBACK(OpenRecent), NULL);
}
#endif
/* Creating the place for showing DS screens */
pDrawingArea = gtk_drawing_area_new();