From 2d31b5bb8da507095c3466699f8859d2d5500d57 Mon Sep 17 00:00:00 2001 From: yabause Date: Sat, 11 Jul 2009 19:44:29 +0000 Subject: [PATCH] Added some #ifdef protection for recent files feature that require gtk 2.10 when desmume only require 2.8 --- desmume/src/gtk/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 49eb4e83c..6e5ced03c 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -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 = " " " " " " +#ifdef HAVE_RECENT_FILES " " +#endif " " " " " " @@ -248,7 +254,9 @@ static const char *ui_description = static const GtkActionEntry action_entries[] = { { "FileMenu", NULL, "_File" }, { "open", "gtk-open", "_Open", "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();