From 4862884ed885e0dc07c1da441e6f999f643b5b59 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 10 Dec 2017 23:56:46 +0100 Subject: [PATCH] Don't use GtkStock to refer to the stock icons in wxArtProvider GtkStock is deprecated since GTK+ 3.10 and stock icons should be identified directly by their names. --- src/gtk/artgtk.cpp | 182 +++++++++++++++++++++++++++++++-------------- 1 file changed, 126 insertions(+), 56 deletions(-) diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp index ba56942264..3f077d0c3d 100644 --- a/src/gtk/artgtk.cpp +++ b/src/gtk/artgtk.cpp @@ -56,73 +56,143 @@ namespace wxString wxArtIDToStock(const wxArtID& id) { #define ART(wxid, gtkid) \ - if (id == wxid) return gtkid; + if (id == wxid) return gtkid; - ART(wxART_ERROR, GTK_STOCK_DIALOG_ERROR) - ART(wxART_INFORMATION, GTK_STOCK_DIALOG_INFO) - ART(wxART_WARNING, GTK_STOCK_DIALOG_WARNING) - ART(wxART_QUESTION, GTK_STOCK_DIALOG_QUESTION) +#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0) + if ( gtk_check_version(3,10,0) == NULL ) + { + ART(wxART_ERROR, "dialog-error") + ART(wxART_INFORMATION, "dialog-information") + ART(wxART_WARNING, "dialog-warning") + ART(wxART_QUESTION, "dialog-question") - //ART(wxART_HELP_SIDE_PANEL, ) - ART(wxART_HELP_SETTINGS, GTK_STOCK_SELECT_FONT) - //ART(wxART_HELP_BOOK, ) - ART(wxART_HELP_FOLDER, GTK_STOCK_DIRECTORY) - ART(wxART_HELP_PAGE, GTK_STOCK_FILE) - ART(wxART_MISSING_IMAGE, GTK_STOCK_MISSING_IMAGE) - ART(wxART_ADD_BOOKMARK, GTK_STOCK_ADD) - ART(wxART_DEL_BOOKMARK, GTK_STOCK_REMOVE) - ART(wxART_GO_BACK, GTK_STOCK_GO_BACK) - ART(wxART_GO_FORWARD, GTK_STOCK_GO_FORWARD) - ART(wxART_GO_UP, GTK_STOCK_GO_UP) - ART(wxART_GO_DOWN, GTK_STOCK_GO_DOWN) - ART(wxART_GO_TO_PARENT, GTK_STOCK_GO_UP) - ART(wxART_GO_HOME, GTK_STOCK_HOME) - ART(wxART_GOTO_FIRST, GTK_STOCK_GOTO_FIRST) - ART(wxART_GOTO_LAST, GTK_STOCK_GOTO_LAST) - ART(wxART_FILE_OPEN, GTK_STOCK_OPEN) - ART(wxART_PRINT, GTK_STOCK_PRINT) - ART(wxART_HELP, GTK_STOCK_HELP) - ART(wxART_TIP, GTK_STOCK_DIALOG_INFO) - //ART(wxART_REPORT_VIEW, ) - //ART(wxART_LIST_VIEW, ) - //ART(wxART_NEW_DIR, ) - ART(wxART_FOLDER, GTK_STOCK_DIRECTORY) - ART(wxART_FOLDER_OPEN, GTK_STOCK_DIRECTORY) - //ART(wxART_GO_DIR_UP, ) - ART(wxART_EXECUTABLE_FILE, GTK_STOCK_EXECUTE) - ART(wxART_NORMAL_FILE, GTK_STOCK_FILE) - ART(wxART_TICK_MARK, GTK_STOCK_APPLY) - ART(wxART_CROSS_MARK, GTK_STOCK_CANCEL) + //ART(wxART_HELP_SIDE_PANEL, ) + ART(wxART_HELP_SETTINGS, "preferences-desktop-font") + ART(wxART_HELP_BOOK, "help-contents") + ART(wxART_HELP_FOLDER, "folder") + ART(wxART_HELP_PAGE, "text-x-generic") + ART(wxART_MISSING_IMAGE, "image-missing") + ART(wxART_ADD_BOOKMARK, "list-add") + ART(wxART_DEL_BOOKMARK, "list-remove") + ART(wxART_GO_BACK, "go-previous") + ART(wxART_GO_FORWARD, "go-next") + ART(wxART_GO_UP, "go-up") + ART(wxART_GO_DOWN, "go-down") + ART(wxART_GO_TO_PARENT, "go-up") + ART(wxART_GO_HOME, "go-home") + ART(wxART_GOTO_FIRST, "go-first") + ART(wxART_GOTO_LAST, "go-last") + ART(wxART_FILE_OPEN, "document-open") + ART(wxART_PRINT, "document-print") + ART(wxART_HELP, "help-browser") + ART(wxART_TIP, "dialog-information") + //ART(wxART_REPORT_VIEW, ) + //ART(wxART_LIST_VIEW, ) + ART(wxART_NEW_DIR, "folder-new") + ART(wxART_FOLDER, "folder") + ART(wxART_FOLDER_OPEN, "folder-open") + //ART(wxART_GO_DIR_UP, ) + ART(wxART_EXECUTABLE_FILE, "system-run") + ART(wxART_NORMAL_FILE, "text-x-generic") + //ART(wxART_TICK_MARK, ) + //ART(wxART_CROSS_MARK, ) - ART(wxART_FLOPPY, GTK_STOCK_FLOPPY) - ART(wxART_CDROM, GTK_STOCK_CDROM) - ART(wxART_HARDDISK, GTK_STOCK_HARDDISK) - ART(wxART_REMOVABLE, GTK_STOCK_HARDDISK) + ART(wxART_FLOPPY, "media-floppy") + ART(wxART_CDROM, "drive-optical") + ART(wxART_HARDDISK, "drive-harddisk") + ART(wxART_REMOVABLE, "drive-removable-media") - ART(wxART_FILE_SAVE, GTK_STOCK_SAVE) - ART(wxART_FILE_SAVE_AS, GTK_STOCK_SAVE_AS) + ART(wxART_FILE_SAVE, "document-save") + ART(wxART_FILE_SAVE_AS, "document-save-as") - ART(wxART_COPY, GTK_STOCK_COPY) - ART(wxART_CUT, GTK_STOCK_CUT) - ART(wxART_PASTE, GTK_STOCK_PASTE) - ART(wxART_DELETE, GTK_STOCK_DELETE) - ART(wxART_NEW, GTK_STOCK_NEW) + ART(wxART_COPY, "edit-copy") + ART(wxART_CUT, "edit-cut") + ART(wxART_PASTE, "document-open") + ART(wxART_DELETE, "edit-delete") + ART(wxART_NEW, "document-new") - ART(wxART_UNDO, GTK_STOCK_UNDO) - ART(wxART_REDO, GTK_STOCK_REDO) + ART(wxART_UNDO, "edit-undo") + ART(wxART_REDO, "edit-redo") - ART(wxART_PLUS, GTK_STOCK_ADD) - ART(wxART_MINUS, GTK_STOCK_REMOVE) + ART(wxART_PLUS, "list-add") + ART(wxART_MINUS, "list-remove") - ART(wxART_CLOSE, GTK_STOCK_CLOSE) - ART(wxART_QUIT, GTK_STOCK_QUIT) + ART(wxART_CLOSE, "window-close") + ART(wxART_QUIT, "application-exit") - ART(wxART_FIND, GTK_STOCK_FIND) - ART(wxART_FIND_AND_REPLACE, GTK_STOCK_FIND_AND_REPLACE) - ART(wxART_FULL_SCREEN, GTK_STOCK_FULLSCREEN) + ART(wxART_FIND, "edit-find") + ART(wxART_FIND_AND_REPLACE, "edit-find-replace") + ART(wxART_FULL_SCREEN, "view-fullscreen") + ART(wxART_EDIT, "accessories-text-editor") + } +#else + { + ART(wxART_ERROR, GTK_STOCK_DIALOG_ERROR) + ART(wxART_INFORMATION, GTK_STOCK_DIALOG_INFO) + ART(wxART_WARNING, GTK_STOCK_DIALOG_WARNING) + ART(wxART_QUESTION, GTK_STOCK_DIALOG_QUESTION) + + //ART(wxART_HELP_SIDE_PANEL, ) + ART(wxART_HELP_SETTINGS, GTK_STOCK_SELECT_FONT) + //ART(wxART_HELP_BOOK, ) + ART(wxART_HELP_FOLDER, GTK_STOCK_DIRECTORY) + ART(wxART_HELP_PAGE, GTK_STOCK_FILE) + ART(wxART_MISSING_IMAGE, GTK_STOCK_MISSING_IMAGE) + ART(wxART_ADD_BOOKMARK, GTK_STOCK_ADD) + ART(wxART_DEL_BOOKMARK, GTK_STOCK_REMOVE) + ART(wxART_GO_BACK, GTK_STOCK_GO_BACK) + ART(wxART_GO_FORWARD, GTK_STOCK_GO_FORWARD) + ART(wxART_GO_UP, GTK_STOCK_GO_UP) + ART(wxART_GO_DOWN, GTK_STOCK_GO_DOWN) + ART(wxART_GO_TO_PARENT, GTK_STOCK_GO_UP) + ART(wxART_GO_HOME, GTK_STOCK_HOME) + ART(wxART_GOTO_FIRST, GTK_STOCK_GOTO_FIRST) + ART(wxART_GOTO_LAST, GTK_STOCK_GOTO_LAST) + ART(wxART_FILE_OPEN, GTK_STOCK_OPEN) + ART(wxART_PRINT, GTK_STOCK_PRINT) + ART(wxART_HELP, GTK_STOCK_HELP) + ART(wxART_TIP, GTK_STOCK_DIALOG_INFO) + //ART(wxART_REPORT_VIEW, ) + //ART(wxART_LIST_VIEW, ) + //ART(wxART_NEW_DIR, ) + ART(wxART_FOLDER, GTK_STOCK_DIRECTORY) + ART(wxART_FOLDER_OPEN, GTK_STOCK_DIRECTORY) + //ART(wxART_GO_DIR_UP, ) + ART(wxART_EXECUTABLE_FILE, GTK_STOCK_EXECUTE) + ART(wxART_NORMAL_FILE, GTK_STOCK_FILE) + ART(wxART_TICK_MARK, GTK_STOCK_APPLY) + ART(wxART_CROSS_MARK, GTK_STOCK_CANCEL) + + ART(wxART_FLOPPY, GTK_STOCK_FLOPPY) + ART(wxART_CDROM, GTK_STOCK_CDROM) + ART(wxART_HARDDISK, GTK_STOCK_HARDDISK) + ART(wxART_REMOVABLE, GTK_STOCK_HARDDISK) + ART(wxART_FILE_SAVE, GTK_STOCK_SAVE) + ART(wxART_FILE_SAVE_AS, GTK_STOCK_SAVE_AS) + + ART(wxART_COPY, GTK_STOCK_COPY) + ART(wxART_CUT, GTK_STOCK_CUT) + ART(wxART_PASTE, GTK_STOCK_PASTE) + ART(wxART_DELETE, GTK_STOCK_DELETE) + ART(wxART_NEW, GTK_STOCK_NEW) + + ART(wxART_UNDO, GTK_STOCK_UNDO) + ART(wxART_REDO, GTK_STOCK_REDO) + + ART(wxART_PLUS, GTK_STOCK_ADD) + ART(wxART_MINUS, GTK_STOCK_REMOVE) + + ART(wxART_CLOSE, GTK_STOCK_CLOSE) + ART(wxART_QUIT, GTK_STOCK_QUIT) + + ART(wxART_FIND, GTK_STOCK_FIND) + ART(wxART_FIND_AND_REPLACE, GTK_STOCK_FIND_AND_REPLACE) + ART(wxART_FULL_SCREEN, GTK_STOCK_FULLSCREEN) + ART(wxART_EDIT, GTK_STOCK_EDIT) + } +#endif // GTK >= 3.10/ < 3.10 #undef ART - // allow passing GTK+ stock IDs to wxArtProvider -- if a recognized wx // ID wasn't found, pass it to GTK+ in the hope it is a GTK+ or theme // icon name: