diff --git a/.travis.yml b/.travis.yml index 9929ab74e2..3ab8a3a67b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,14 @@ dist: trusty compiler: - gcc env: - - GTK2=no BINRELOC=no - - GTK2=yes BINRELOC=no - - GTK2=no BINRELOC=yes - - GTK2=yes BINRELOC=yes - - GTK2=no MINGW=yes - - GTK2=yes MINGW=yes + - BINRELOC=no + - BINRELOC=yes + - MINGW=yes before_install: - sudo apt-get update -qq install: - sudo apt-get install -y intltool libtool - - test -n "$MINGW" || sudo apt-get install -y libgtk2.0-dev libgtk-3-dev + - test -n "$MINGW" || sudo apt-get install -y libgtk-3-dev - test -z "$MINGW" || sudo apt-get install -y mingw-w64-tools g++-mingw-w64-i686 gcc-mingw-w64-i686 binutils-mingw-w64-i686 # fix broken pkg-config-crosswrapper, see https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242 - test -z "$MINGW" || sudo sed -e 's/PKG_CONFIG_PATH=/&$PKG_CONFIG_PATH:/' -i /usr/bin/i686-w64-mingw32-pkg-config @@ -29,11 +26,11 @@ script: - NOCONFIGURE=1 ./autogen.sh - > if [ -n "$MINGW" ]; then - arg=-3; [ "$GTK2" = yes ] && arg=-2; + arg=-3; unset CC CXX; sh ./scripts/cross-build-mingw.sh $arg; else - CONFIGURE_FLAGS="--enable-gtk2=$GTK2 --enable-binreloc=$BINRELOC"; + CONFIGURE_FLAGS="--enable-binreloc=$BINRELOC"; mkdir _build && cd _build && { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; } && diff --git a/HACKING b/HACKING index 4801b2b490..436e844220 100644 --- a/HACKING +++ b/HACKING @@ -167,11 +167,11 @@ unmanageable diffs. GTK versions & API documentation -------------------------------- -Geany requires GTK >= 2.24 or GTK 3 (with the --enable-gtk3 configure option) -and GLib >= 2.32. API symbols from newer GTK/GLib versions should be -avoided or made optional to keep the source code building on older systems. +Geany requires GTK >= 3.0 and GLib >= 2.32. API symbols from newer GTK/GLib +versions should be avoided or made optional to keep the source code building +on older systems. -It is recommended to use the 2.24 API documentation of the GTK +It is recommended to use the 3.0 API documentation of the GTK libs (including GLib, GDK and Pango) has the advantages that you don't get confused by any newer API additions and you don't have to take care about whether you can use them or not. @@ -196,8 +196,8 @@ Coding them down into smaller static functions where possible. This makes code much easier to read and maintain. * Use GLib types and functions - gint not int, g_free() not free(). -* Your code should build against GLib 2.32 and GTK 2.24. At least for the - moment, we want to keep the minimum requirement for GTK at 2.24 (of +* Your code should build against GLib 2.32 and GTK 3.0. At least for the + moment, we want to keep the minimum requirement for GTK at 3.0 (of course, you can use the GTK_CHECK_VERSION macro to protect code using later versions). * Variables should be declared (and initialized) as close as practical @@ -791,9 +791,6 @@ Building Plugins The geany-plugins autotools script automatically detects the installed system Geany and builds the plugins against that. -Plugins will build with either GTK2 or GTK3, whichever the detected -Geany was built with. - To use plugins with a development version of Geany built with a different prefix, the plugins will need to be compiled against that version if the ABI has changed. diff --git a/README b/README index 611cc6e5db..ef5eb6a113 100644 --- a/README +++ b/README @@ -49,10 +49,10 @@ Installation from sources Requirements ++++++++++++ -For compiling Geany yourself, you will need the GTK2 (>= 2.24) or -GTK3 libraries and header files. You will also need its dependency libraries -and header files, such as Pango, Glib and ATK. All these files are -available at https://www.gtk.org. +For compiling Geany yourself, you will need the GTK3 (>= 3.0) libraries and +header files. You will also need its dependency libraries and header files, +such as Pango, Glib and ATK. All these files are available at +https://www.gtk.org. Furthermore you need, of course, a C compiler and the Make tool; a C++ compiler is also needed for the required Scintilla library included. The diff --git a/configure.ac b/configure.ac index 22a0a92e6a..b61213668b 100644 --- a/configure.ac +++ b/configure.ac @@ -71,23 +71,11 @@ AC_CHECK_DECLS([_NSGetEnviron],,,[[#include ]]) GEANY_CHECK_REVISION([dnl force debug mode for a VCS working copy CFLAGS="-g -DGEANY_DEBUG $CFLAGS"]) -# GTK version check -AC_ARG_ENABLE([gtk2], - [AS_HELP_STRING([--enable-gtk2], - [compile against deprecated GTK2 [default=no]])], - [enable_gtk2=$enableval], - [enable_gtk2=no]) - -gtk2_package=gtk+-2.0 -gtk2_min_version=2.24 gtk3_package=gtk+-3.0 gtk3_min_version=3.0 -AS_IF([test "x$enable_gtk2" = "xyes"], - [gtk_package=$gtk2_package - gtk_min_version=$gtk2_min_version], - [gtk_package=$gtk3_package - gtk_min_version=$gtk3_min_version]) +gtk_package=$gtk3_package +gtk_min_version=$gtk3_min_version AM_CONDITIONAL([GTK3], [test "x$gtk_package" = "x$gtk3_package"]) @@ -97,8 +85,7 @@ gtk_modules_private="gio-2.0 >= 2.32 gmodule-no-export-2.0" PKG_CHECK_MODULES([GTK], [$gtk_modules $gtk_modules_private]) AC_SUBST([DEPENDENCIES], [$gtk_modules]) AS_VAR_APPEND([GTK_CFLAGS], [" -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"]) -dnl Disable all GTK deprecations on 3.x so long as we want to keep 2.x support and only require 3.0. -dnl No need on 2.x as we target the latest version. +dnl Disable all GTK deprecations on 3.x so long as we only require 3.0. AM_COND_IF([GTK3], [AS_VAR_APPEND([GTK_CFLAGS], [" -DGDK_DISABLE_DEPRECATION_WARNINGS"])]) AC_SUBST([GTK_CFLAGS]) AC_SUBST([GTK_LIBS]) diff --git a/data/Makefile.am b/data/Makefile.am index b8501b8d02..279029a07b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -126,12 +126,7 @@ nobase_dist_pkgdata_DATA = \ nobase_pkgdata_DATA = \ $(filetypes_nodist) -if GTK3 nobase_dist_pkgdata_DATA += \ geany-3.0.css \ geany-3.20.css \ geany.css -else -nobase_dist_pkgdata_DATA += geany.gtkrc -endif - diff --git a/data/geany.gtkrc b/data/geany.gtkrc deleted file mode 100644 index ce3b46d149..0000000000 --- a/data/geany.gtkrc +++ /dev/null @@ -1,72 +0,0 @@ -# custom GTK2 style for Geany - -# make close button on the editor's tabs smaller -style "geany-close-tab-button-style" { - GtkWidget::focus-padding = 0 - GtkWidget::focus-line-width = 0 - xthickness = 0 - ythickness = 0 -} -widget "*.geany-close-tab-button" style "geany-close-tab-button-style" - -# use monospaced font in search entries for easier reading of regexp (#1907117) -style "geany-monospace" { - font_name = "Monospace" -} -widget "GeanyDialogSearch.*.GtkEntry" style "geany-monospace" -widget "GeanyDialogSearch.*.geany-search-entry-no-match" style "geany-monospace" - -# set red background for GtkEntries showing unmatched searches -style "geany-search-entry-no-match-style" { - base[NORMAL] = "#ffff66666666" - text[NORMAL] = "#ffffffffffff" - base[SELECTED] = "#777711111111" - text[SELECTED] = "#ffffffffffff" - # try and remove the entry background image on pixmap engine so that our - # background color is visible, and we don't end up with white text on white - # background (workaround for Adwaita 3.20). - engine "pixmap" { - image { - function = FLAT_BOX - detail = "entry_bg" - } - } -} -widget "*.geany-search-entry-no-match" style "geany-search-entry-no-match-style" - -# document status colors -style "geany-document-status-changed-style" { - fg[NORMAL] = "#ffff00000000" - fg[ACTIVE] = "#ffff00000000" -} -style "geany-document-status-disk-changed-style" { - fg[NORMAL] = "#ffff7fff0000" - fg[ACTIVE] = "#ffff7fff0000" -} -style "geany-document-status-readonly-style" { - fg[NORMAL] = "#00007fff0000" - fg[ACTIVE] = "#00007fff0000" -} -widget "*.geany-document-status-changed" style "geany-document-status-changed-style" -widget "*.geany-document-status-disk-changed" style "geany-document-status-disk-changed-style" -widget "*.geany-document-status-readonly" style "geany-document-status-readonly-style" - -# compiler message colors -style "geany-compiler-error-style" { - fg[NORMAL] = "#ffff00000000" - fg[ACTIVE] = "#ffff00000000" -} -style "geany-compiler-context-style" { - fg[NORMAL] = "#7f7f00000000" - fg[ACTIVE] = "#7f7f00000000" -} -style "geany-compiler-message-style" { - fg[NORMAL] = "#00000000D000" - fg[ACTIVE] = "#00000000D000" -} -widget "*.geany-compiler-error" style "geany-compiler-error-style" -widget "*.geany-compiler-context" style "geany-compiler-context-style" -widget "*.geany-compiler-message" style "geany-compiler-message-style" - -# red "Terminal" label when terminal dirty -widget "*.geany-terminal-dirty" style "geany-document-status-changed-style" diff --git a/doc/plugins.dox b/doc/plugins.dox index 7ccbcdfcd3..4344b0929c 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -159,7 +159,7 @@ following. First you need to have Geany installed. Then install the development files for GTK and its dependencies. The easiest way to do this is to use your distribution's package management system, e.g. on Debian and Ubuntu systems you can use -@code apt-get install libgtk2.0-dev intltool @endcode +@code apt-get install libgtk-3-dev intltool @endcode This will install all necessary files to be able to compile plugins for Geany. On other distributions, the package names and commands to use may differ. diff --git a/m4/geany-mac-integration.m4 b/m4/geany-mac-integration.m4 index 28eaa3c488..2850682819 100644 --- a/m4/geany-mac-integration.m4 +++ b/m4/geany-mac-integration.m4 @@ -12,8 +12,6 @@ AC_DEFUN([GEANY_CHECK_MAC_INTEGRATION], AM_CONDITIONAL(ENABLE_MAC_INTEGRATION, [test "x$geany_enable_mac_integration" = "xyes"]) AM_COND_IF(ENABLE_MAC_INTEGRATION, [ - AS_IF([test "x$enable_gtk2" = xyes], - [PKG_CHECK_MODULES(MAC_INTEGRATION, gtk-mac-integration-gtk2)], - [PKG_CHECK_MODULES(MAC_INTEGRATION, gtk-mac-integration-gtk3)]) + PKG_CHECK_MODULES(MAC_INTEGRATION, gtk-mac-integration-gtk3) ]) ]) diff --git a/plugins/classbuilder.c b/plugins/classbuilder.c index 2cec2abe4c..6db036b12e 100644 --- a/plugins/classbuilder.c +++ b/plugins/classbuilder.c @@ -494,7 +494,7 @@ static void show_dialog_create_class(gint type) cc_dlg->base_header_entry = cc_table_attach_option_entry(table, _("Base source:"), row++); else { - hdr_hbox = gtk_hbox_new(FALSE, 6); + hdr_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); label = cc_table_attach_option_label(table, _("Base header:"), row); diff --git a/plugins/demoplugin.c b/plugins/demoplugin.c index 6fccd759f2..171a5113c3 100644 --- a/plugins/demoplugin.c +++ b/plugins/demoplugin.c @@ -182,7 +182,7 @@ static GtkWidget *demo_configure(GeanyPlugin *plugin, GtkDialog *dialog, gpointe GtkWidget *label, *entry, *vbox; /* example configuration dialog */ - vbox = gtk_vbox_new(FALSE, 6); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); /* add a label and a text entry to the dialog */ label = gtk_label_new(_("Welcome text to show:")); diff --git a/plugins/export.c b/plugins/export.c index 845288c363..c9d1f13d87 100644 --- a/plugins/export.c +++ b/plugins/export.c @@ -178,7 +178,7 @@ static void create_file_save_as_dialog(const gchar *extension, ExportFunc func, gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); /* file chooser extra widget */ - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox); { GtkWidget *check_line_numbers; diff --git a/plugins/filebrowser.c b/plugins/filebrowser.c index 925548dcb1..02546da046 100644 --- a/plugins/filebrowser.c +++ b/plugins/filebrowser.c @@ -758,20 +758,20 @@ static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer dat return TRUE; } - if (event->keyval == GDK_space) + if (event->keyval == GDK_KEY_space) { on_open_clicked(NULL, GINT_TO_POINTER(TRUE)); return TRUE; } - if (( (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) && (event->state & GDK_MOD1_MASK)) || /* FIXME: Alt-Up doesn't seem to work! */ - (event->keyval == GDK_BackSpace) ) + if (( (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) && (event->state & GDK_MOD1_MASK)) || /* FIXME: Alt-Up doesn't seem to work! */ + (event->keyval == GDK_KEY_BackSpace) ) { on_go_up(); return TRUE; } - if ((event->keyval == GDK_F10 && event->state & GDK_SHIFT_MASK) || event->keyval == GDK_Menu) + if ((event->keyval == GDK_KEY_F10 && event->state & GDK_SHIFT_MASK) || event->keyval == GDK_KEY_Menu) { GdkEventButton button_event; @@ -942,7 +942,7 @@ static GtkWidget *make_filterbar(void) { GtkWidget *label, *filterbar; - filterbar = gtk_hbox_new(FALSE, 1); + filterbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); label = gtk_label_new(_("Filter:")); @@ -1133,7 +1133,7 @@ void plugin_init(GeanyData *data) filter = NULL; - file_view_vbox = gtk_vbox_new(FALSE, 0); + file_view_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); toolbar = make_toolbar(); gtk_box_pack_start(GTK_BOX(file_view_vbox), toolbar, FALSE, FALSE, 0); @@ -1261,8 +1261,8 @@ GtkWidget *plugin_configure(GtkDialog *dialog) GtkWidget *label, *entry, *checkbox_of, *checkbox_hf, *checkbox_fp, *checkbox_pb, *vbox; GtkWidget *box, *align; - vbox = gtk_vbox_new(FALSE, 6); - box = gtk_vbox_new(FALSE, 3); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3); label = gtk_label_new(_("External open command:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -1287,7 +1287,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) pref_widgets.show_hidden_checkbox = checkbox_hf; g_signal_connect(checkbox_hf, "toggled", on_toggle_hidden, NULL); - box = gtk_vbox_new(FALSE, 3); + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3); checkbox_of = gtk_check_button_new_with_label(_("Hide file extensions:")); gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_of), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_of), hide_object_files); diff --git a/plugins/saveactions.c b/plugins/saveactions.c index 93539ae432..8d132f98dd 100644 --- a/plugins/saveactions.c +++ b/plugins/saveactions.c @@ -589,7 +589,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) GtkWidget *vbox, *label, *notebook_vbox, *checkbox_enable; GtkWidget *notebook, *inner_vbox; - vbox = gtk_vbox_new(FALSE, 6); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); notebook = gtk_notebook_new(); gtk_widget_set_can_focus(notebook, FALSE); @@ -602,8 +602,8 @@ GtkWidget *plugin_configure(GtkDialog *dialog) { GtkWidget *spin, *hbox, *checkbox, *checkbox_enable_as_lf, *radio1, *radio2; - notebook_vbox = gtk_vbox_new(FALSE, 2); - inner_vbox = gtk_vbox_new(FALSE, 5); + notebook_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); + inner_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_set_border_width(GTK_CONTAINER(inner_vbox), 5); gtk_box_pack_start(GTK_BOX(notebook_vbox), inner_vbox, TRUE, TRUE, 5); gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), @@ -633,7 +633,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) label = gtk_label_new(_("seconds")); - hbox = gtk_hbox_new(FALSE, 5); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_pack_start(GTK_BOX(hbox), spin, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -670,8 +670,8 @@ GtkWidget *plugin_configure(GtkDialog *dialog) guint i; const GSList *node; - notebook_vbox = gtk_vbox_new(FALSE, 2); - inner_vbox = gtk_vbox_new(FALSE, 5); + notebook_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); + inner_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_set_border_width(GTK_CONTAINER(inner_vbox), 5); gtk_box_pack_start(GTK_BOX(notebook_vbox), inner_vbox, TRUE, TRUE, 5); gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), @@ -711,8 +711,8 @@ GtkWidget *plugin_configure(GtkDialog *dialog) { GtkWidget *hbox, *entry_dir, *entry_time, *button, *image, *spin_dir_levels; - notebook_vbox = gtk_vbox_new(FALSE, 2); - inner_vbox = gtk_vbox_new(FALSE, 5); + notebook_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); + inner_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_set_border_width(GTK_CONTAINER(inner_vbox), 5); gtk_box_pack_start(GTK_BOX(notebook_vbox), inner_vbox, TRUE, TRUE, 5); gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), @@ -742,7 +742,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON); gtk_container_add(GTK_CONTAINER(button), image); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), entry_dir, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -759,7 +759,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) gtk_entry_set_text(GTK_ENTRY(entry_time), backupcopy_time_fmt); gtk_box_pack_start(GTK_BOX(inner_vbox), entry_time, FALSE, FALSE, 0); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); label = gtk_label_new_with_mnemonic( _("Directory _levels to include in the backup destination:")); diff --git a/plugins/splitwindow.c b/plugins/splitwindow.c index 199e9773e2..a00846a79e 100644 --- a/plugins/splitwindow.c +++ b/plugins/splitwindow.c @@ -256,7 +256,6 @@ static void on_doc_show_menu(GtkMenuToolButton *button, GtkMenu *menu) } -#if GTK_CHECK_VERSION(3, 0, 0) /* Blocks the ::show-menu signal if the menu's parent toggle button was inactive in the previous run. * This is a hack to workaround https://bugzilla.gnome.org/show_bug.cgi?id=769287 * and should NOT be used for any other version than 3.15.9 to 3.21.4, although the code tries and @@ -281,7 +280,6 @@ static void show_menu_gtk316_fix(GtkMenuToolButton *button, gpointer data) block_next = TRUE; } } -#endif static GtkWidget *create_toolbar(void) @@ -302,11 +300,9 @@ static GtkWidget *create_toolbar(void) item = gtk_menu_new(); gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(tool_item), item); -#if GTK_CHECK_VERSION (3, 0, 0) /* hack for https://bugzilla.gnome.org/show_bug.cgi?id=769287 */ if (! gtk_check_version(3, 15, 9) && gtk_check_version(3, 21, 4+1)) g_signal_connect(tool_item, "show-menu", G_CALLBACK(show_menu_gtk316_fix), NULL); -#endif g_signal_connect(tool_item, "show-menu", G_CALLBACK(on_doc_show_menu), item); tool_item = gtk_tool_item_new(); @@ -343,13 +339,13 @@ static void split_view(gboolean horizontal) g_object_ref(notebook); gtk_container_remove(GTK_CONTAINER(parent), notebook); - pane = horizontal ? gtk_hpaned_new() : gtk_vpaned_new(); + pane = gtk_paned_new(horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); gtk_container_add(GTK_CONTAINER(parent), pane); gtk_container_add(GTK_CONTAINER(pane), notebook); g_object_unref(notebook); - box = gtk_vbox_new(FALSE, 0); + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); toolbar = create_toolbar(); gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0); edit_window.vbox = box; diff --git a/scripts/cross-build-mingw.sh b/scripts/cross-build-mingw.sh index 02ddcb4d26..a55643bdad 100755 --- a/scripts/cross-build-mingw.sh +++ b/scripts/cross-build-mingw.sh @@ -15,7 +15,6 @@ # You may change those HOST=i686-w64-mingw32 -GTK2_BUNDLE_ZIP="https://download.geany.org/contrib/gtk/gtk+-bundle_2.24.10-20120208_win32.zip" GTK3_BUNDLE_ZIP="https://download.geany.org/contrib/gtk/gtk+-bundle_3.8.2-20131001_win32.zip" BUILDDIR=_build-cross-mingw GTK3=yes @@ -25,13 +24,11 @@ MAKEFLAGS="${MAKEFLAGS:--j2}" while getopts '32b:h' o; do case "$o" in 3) GTK3=yes;; - 2) GTK3=no;; b) BUILDDIR="$OPTARG";; h) cat < #define HEADER "Geany %s" #define INFO "%s" @@ -179,7 +179,7 @@ static GtkWidget *create_dialog(void) /* create header */ header_eventbox = gtk_event_box_new(); gtk_widget_show(header_eventbox); - header_hbox = gtk_hbox_new(FALSE, 12); + header_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width(GTK_CONTAINER(header_hbox), 4); gtk_widget_show(header_hbox); gtk_container_add(GTK_CONTAINER(header_eventbox), header_hbox); @@ -205,7 +205,7 @@ static GtkWidget *create_dialog(void) gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), notebook, TRUE, TRUE, 0); /* create "Info" tab */ - info_box = gtk_vbox_new(FALSE, 0); + info_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(info_box), 6); gtk_widget_show(info_box); @@ -258,7 +258,7 @@ static GtkWidget *create_dialog(void) gtk_widget_show(runtime_label); gtk_box_pack_start(GTK_BOX(info_box), runtime_label, FALSE, FALSE, 0); - box = gtk_hbutton_box_new(); + box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); url_button = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(url_button), GTK_RELIEF_NONE); g_signal_connect(url_button, "clicked", G_CALLBACK(homepage_clicked), (gpointer)GEANY_HOMEPAGE); diff --git a/src/build.c b/src/build.c index 4c9f4ebb24..86283d3050 100644 --- a/src/build.c +++ b/src/build.c @@ -50,13 +50,12 @@ #include "vte.h" #include "win32.h" -#include "gtkcompat.h" - #include #include #include #include #include +#include #include @@ -1733,11 +1732,7 @@ typedef struct RowWidgets gboolean used_dst; } RowWidgets; -#if GTK_CHECK_VERSION(3,0,0) typedef GdkRGBA InsensitiveColor; -#else -typedef GdkColor InsensitiveColor; -#endif static InsensitiveColor insensitive_color; static void set_row_color(RowWidgets *r, InsensitiveColor *color) @@ -1749,11 +1744,7 @@ static void set_row_color(RowWidgets *r, InsensitiveColor *color) if (i == GEANY_BC_LABEL) continue; -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(r->entries[i], GTK_STATE_FLAG_NORMAL, color); -#else - gtk_widget_modify_text(r->entries[i], GTK_STATE_NORMAL, color); -#endif } } @@ -1866,23 +1857,19 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gui enum GeanyBuildCmdEntries i; guint column = 0; gchar *text; + GtkStyleContext *ctx; g_return_val_if_fail(doc == NULL || doc->is_valid, NULL); text = g_strdup_printf("%d.", cmd + 1); label = gtk_label_new(text); g_free(text); -#if GTK_CHECK_VERSION(3,0,0) -{ - GtkStyleContext *ctx = gtk_widget_get_style_context(label); + ctx = gtk_widget_get_style_context(label); gtk_style_context_save(ctx); gtk_style_context_get_color(ctx, GTK_STATE_FLAG_INSENSITIVE, &insensitive_color); gtk_style_context_restore(ctx); -} -#else - insensitive_color = gtk_widget_get_style(label)->text[GTK_STATE_INSENSITIVE]; -#endif + gtk_table_attach(table, label, column, column + 1, row, row + 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding); roww = g_new0(RowWidgets, 1); @@ -1979,7 +1966,7 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildT gtk_table_attach(table, label, col, col + 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding); } - sep = gtk_hseparator_new(); + sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_table_attach(table, sep, 0, DC_N_COL, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, sep_padding); if (ft != NULL && ft->id != GEANY_FILETYPES_NONE) @@ -2018,7 +2005,7 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildT gtk_widget_set_sensitive(fields->fileregex, sensitivity); gtk_widget_set_sensitive(clear, sensitivity); ++row; - sep = gtk_hseparator_new(); + sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_table_attach(table, sep, 0, DC_N_COL, row, row + 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, sep_padding); ++row; @@ -2059,7 +2046,7 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildT gtk_table_attach(table, label, 0, DC_N_COL, row, row + 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding); ++row; - sep = gtk_hseparator_new(); + sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_table_attach(table, sep, 0, DC_N_COL, row, row + 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, sep_padding); ++row; @@ -2069,7 +2056,7 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildT entry_x_padding, entry_y_padding); for (++row, cmd = 0; cmd < build_groups_count[GEANY_GBG_EXEC]; ++row, ++cmdindex, ++cmd) fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GEANY_GBG_EXEC, cmd, TRUE); - sep = gtk_hseparator_new(); + sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_table_attach(table, sep, 0, DC_N_COL, row, row + 1, GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, sep_padding); ++row; diff --git a/src/callbacks.c b/src/callbacks.c index 75d087098c..93900b0d05 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -63,11 +63,10 @@ #include "utils.h" #include "vte.h" -#include "gtkcompat.h" - #include #include #include +#include #include #include #include @@ -1640,7 +1639,7 @@ gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpoint guint state = keybindings_get_modifiers(event->state); /* make pressing escape in the sidebar and toolbar focus the editor */ - if (event->keyval == GDK_Escape && state == 0) + if (event->keyval == GDK_KEY_Escape && state == 0) { keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR); return TRUE; diff --git a/src/dialogs.c b/src/dialogs.c index 7c083512d1..5fe792e7ad 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -40,8 +40,7 @@ #include "ui_utils.h" #include "win32.h" -#include "gtkcompat.h" - +#include #include #include @@ -305,7 +304,7 @@ static GtkWidget *add_file_open_extra_widget(GtkWidget *dialog) GtkWidget *encoding_ebox, *encoding_label, *encoding_combo; expander = gtk_expander_new_with_mnemonic(_("_More Options")); - vbox = gtk_vbox_new(FALSE, 6); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); gtk_container_add(GTK_CONTAINER(expander), vbox); table = gtk_table_new(2, 4, FALSE); diff --git a/src/document.c b/src/document.c index 643b31e2d1..bbaa12089b 100644 --- a/src/document.c +++ b/src/document.c @@ -54,8 +54,6 @@ #include "vte.h" #include "win32.h" -#include "gtkcompat.h" - #ifdef HAVE_SYS_TIME_H # include #endif @@ -78,6 +76,7 @@ /*#define USE_GIO_FILEMON 1*/ #include +#include #include @@ -3285,7 +3284,6 @@ const GdkColor *document_get_status_color(GeanyDocument *doc) return NULL; if (! document_status_styles[status].loaded) { -#if GTK_CHECK_VERSION(3, 0, 0) GdkRGBA color; GtkWidgetPath *path = gtk_widget_path_new(); GtkStyleContext *ctx = gtk_style_context_new(); @@ -3303,16 +3301,6 @@ const GdkColor *document_get_status_color(GeanyDocument *doc) document_status_styles[status].loaded = TRUE; gtk_widget_path_unref(path); g_object_unref(ctx); -#else - GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(doc->editor->sci)); - gchar *path = g_strconcat("GeanyMainWindow.GtkHBox.GtkNotebook.", - document_status_styles[status].name, NULL); - GtkStyle *style = gtk_rc_get_style_by_paths(settings, path, NULL, GTK_TYPE_LABEL); - - document_status_styles[status].color = style->fg[GTK_STATE_NORMAL]; - document_status_styles[status].loaded = TRUE; - g_free(path); -#endif } return &document_status_styles[status].color; } @@ -3482,7 +3470,7 @@ static GtkWidget* document_show_message(GeanyDocument *doc, GtkMessageType msgty g_signal_connect(info_widget, "response", G_CALLBACK(response_cb), doc); - hbox = gtk_hbox_new(FALSE, 12); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 0); switch (msgtype) @@ -3509,7 +3497,7 @@ static GtkWidget* document_show_message(GeanyDocument *doc, GtkMessageType msgty if (extra_text) { - GtkWidget *vbox = gtk_vbox_new(FALSE, 6); + GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); GtkWidget *extra_label = geany_wrap_label_new(extra_text); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); @@ -3568,15 +3556,15 @@ static gboolean on_sci_key(GtkWidget *widget, GdkEventKey *event, gpointer data) switch (event->keyval) { - case GDK_Tab: - case GDK_ISO_Left_Tab: + case GDK_KEY_Tab: + case GDK_KEY_ISO_Left_Tab: { GtkWidget *action_area = gtk_info_bar_get_action_area(bar); - GtkDirectionType dir = event->keyval == GDK_Tab ? GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD; + GtkDirectionType dir = event->keyval == GDK_KEY_Tab ? GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD; gtk_widget_child_focus(action_area, dir); return TRUE; } - case GDK_Escape: + case GDK_KEY_Escape: { gtk_info_bar_response(bar, GTK_RESPONSE_CANCEL); return TRUE; diff --git a/src/documentprivate.h b/src/documentprivate.h index aa758c309c..51334eb801 100644 --- a/src/documentprivate.h +++ b/src/documentprivate.h @@ -22,7 +22,7 @@ #ifndef GEANY_DOCUMENT_PRIVATE_H #define GEANY_DOCUMENT_PRIVATE_H 1 -#include "gtkcompat.h" +#include G_BEGIN_DECLS diff --git a/src/editor.c b/src/editor.c index e2473c4c6c..3043eb0d55 100644 --- a/src/editor.c +++ b/src/editor.c @@ -57,11 +57,10 @@ #include "SciLexer.h" -#include "gtkcompat.h" - #include #include +#include #include @@ -2659,7 +2658,7 @@ gboolean editor_complete_snippet(GeanyEditor *editor, gint pos) return FALSE; /* return if we are editing an existing line (chars on right of cursor) */ if (keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR, - GEANY_KEYS_EDITOR_COMPLETESNIPPET)->key == GDK_space && + GEANY_KEYS_EDITOR_COMPLETESNIPPET)->key == GDK_KEY_space && ! editor_prefs.complete_snippets_whilst_editing && ! at_eol(sci, pos)) return FALSE; @@ -4796,8 +4795,7 @@ static gboolean on_editor_focus_in(GtkWidget *widget, GdkEventFocus *event, gpoi } -static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event, - gpointer user_data) +static gboolean on_editor_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data) { GeanyEditor *editor = user_data; @@ -4808,14 +4806,6 @@ static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event, } -#if GTK_CHECK_VERSION(3, 0, 0) -static gboolean on_editor_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data) -{ - return on_editor_expose_event(widget, NULL, user_data); -} -#endif - - static void setup_sci_keys(ScintillaObject *sci) { /* disable some Scintilla keybindings to be able to redefine them cleanly */ @@ -4961,11 +4951,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor) g_signal_connect(sci, "scroll-event", G_CALLBACK(on_editor_scroll_event), editor); g_signal_connect(sci, "motion-notify-event", G_CALLBACK(on_motion_event), NULL); g_signal_connect(sci, "focus-in-event", G_CALLBACK(on_editor_focus_in), editor); -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(sci, "draw", G_CALLBACK(on_editor_draw), editor); -#else - g_signal_connect(sci, "expose-event", G_CALLBACK(on_editor_expose_event), editor); -#endif } return sci; } diff --git a/src/filetypesprivate.h b/src/filetypesprivate.h index 107a6392ce..3bff969c96 100644 --- a/src/filetypesprivate.h +++ b/src/filetypesprivate.h @@ -24,7 +24,7 @@ #include "build.h" -#include "gtkcompat.h" +#include G_BEGIN_DECLS diff --git a/src/gb.c b/src/gb.c index 8e172a3801..b0a4a42218 100644 --- a/src/gb.c +++ b/src/gb.c @@ -24,7 +24,7 @@ #include "utils.h" -#include "gtkcompat.h" +#include #define AREA_SIZE 300 @@ -78,22 +78,14 @@ static GType geany_pong_get_type(void) G_GNUC_CONST; G_DEFINE_TYPE(GeanyPong, geany_pong, GTK_TYPE_DIALOG) -#if GTK_CHECK_VERSION(3, 0, 0) static void geany_pong_set_cairo_source_color(cairo_t *cr, GdkRGBA *c, gdouble a) { cairo_set_source_rgba(cr, c->red, c->green, c->blue, MIN(c->alpha, a)); } -#else -static void geany_pong_set_cairo_source_color(cairo_t *cr, GdkColor *c, gdouble a) -{ - cairo_set_source_rgba(cr, c->red/65535.0, c->green/65535.0, c->blue/65535.0, a); -} -#endif static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *self) { -#if GTK_CHECK_VERSION(3, 0, 0) /* we use the window style context because the area one has a transparent * background and we want something to paint for the overlay */ GtkStyleContext *ctx = gtk_widget_get_style_context(GTK_WIDGET(self)); @@ -102,11 +94,6 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se gtk_style_context_get_color(ctx, state, &fg); gtk_style_context_get_background_color(ctx, state, &bg); -#else - GtkStyle *style = gtk_widget_get_style(area); - GdkColor fg = style->fg[GTK_STATE_NORMAL]; - GdkColor bg = style->bg[GTK_STATE_NORMAL]; -#endif self->area_width = gtk_widget_get_allocated_width(area); self->area_height = gtk_widget_get_allocated_height(area); @@ -131,6 +118,7 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se /* if not running, add an info */ if (! self->source_id || self->handle_width < 1) { + PangoFontDescription *font = NULL; PangoLayout *layout; gint pw, ph; gdouble scale; @@ -141,17 +129,12 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se geany_pong_set_cairo_source_color(cr, &fg, 1.0); layout = pango_cairo_create_layout(cr); -#if GTK_CHECK_VERSION(3, 0, 0) - PangoFontDescription *font = NULL; gtk_style_context_get(ctx, state, GTK_STYLE_PROPERTY_FONT, &font, NULL); if (font) { pango_layout_set_font_description(layout, font); pango_font_description_free(font); } -#else - pango_layout_set_font_description(layout, style->font_desc); -#endif if (! self->handle_width) pango_layout_set_markup(layout, "You won!\nOK, go back to work now.", -1); else @@ -171,20 +154,6 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se } -#if ! GTK_CHECK_VERSION(3, 0, 0) -static gboolean geany_pong_area_expose(GtkWidget *area, GdkEventExpose *event, GeanyPong *self) -{ - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(area)); - gboolean ret; - - ret = geany_pong_area_draw(area, cr, self); - cairo_destroy(cr); - - return ret; -} -#endif - - static void geany_pong_reset_ball(GeanyPong *self) { self->ball_speed = 5; @@ -349,11 +318,11 @@ static void geany_pong_init(GeanyPong *self) gtk_window_set_skip_pager_hint(GTK_WINDOW(self), TRUE); gtk_window_set_resizable(GTK_WINDOW(self), FALSE); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), vbox, TRUE, TRUE, 0); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Score:"); @@ -365,11 +334,7 @@ static void geany_pong_init(GeanyPong *self) self->area = gtk_drawing_area_new(); gtk_widget_add_events(self->area, GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK); -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(self->area, "draw", G_CALLBACK(geany_pong_area_draw), self); -#else - g_signal_connect(self->area, "expose-event", G_CALLBACK(geany_pong_area_expose), self); -#endif g_signal_connect(self->area, "button-press-event", G_CALLBACK(geany_pong_area_button_press), self); g_signal_connect(self->area, "motion-notify-event", G_CALLBACK(geany_pong_area_motion_notify), self); gtk_widget_set_size_request(self->area, AREA_SIZE, AREA_SIZE); diff --git a/src/geanywraplabel.c b/src/geanywraplabel.c index cbfd02e416..c3996c96b3 100644 --- a/src/geanywraplabel.c +++ b/src/geanywraplabel.c @@ -48,7 +48,6 @@ struct _GeanyWrapLabel }; -#if GTK_CHECK_VERSION(3, 0, 0) static gboolean geany_wrap_label_draw(GtkWidget *widget, cairo_t *cr); static void geany_wrap_label_get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width); @@ -59,10 +58,6 @@ static void geany_wrap_label_get_preferred_width_for_height (GtkWidget *widget, static void geany_wrap_label_get_preferred_height_for_width (GtkWidget *widget, gint width, gint *minimal_height, gint *natural_height); static GtkSizeRequestMode geany_wrap_label_get_request_mode(GtkWidget *widget); -#else -static gboolean geany_wrap_label_expose (GtkWidget *widget, GdkEventExpose *event); -static void geany_wrap_label_size_request (GtkWidget *widget, GtkRequisition *req); -#endif static void geany_wrap_label_size_allocate (GtkWidget *widget, GtkAllocation *alloc); static void geany_wrap_label_set_wrap_width (GtkWidget *widget, gint width); static void geany_wrap_label_label_notify (GObject *object, GParamSpec *pspec, gpointer data); @@ -75,17 +70,12 @@ static void geany_wrap_label_class_init(GeanyWrapLabelClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); widget_class->size_allocate = geany_wrap_label_size_allocate; -#if GTK_CHECK_VERSION(3, 0, 0) widget_class->draw = geany_wrap_label_draw; widget_class->get_preferred_width = geany_wrap_label_get_preferred_width; widget_class->get_preferred_width_for_height = geany_wrap_label_get_preferred_width_for_height; widget_class->get_preferred_height = geany_wrap_label_get_preferred_height; widget_class->get_preferred_height_for_width = geany_wrap_label_get_preferred_height_for_width; widget_class->get_request_mode = geany_wrap_label_get_request_mode; -#else - widget_class->size_request = geany_wrap_label_size_request; - widget_class->expose_event = geany_wrap_label_expose; -#endif g_type_class_add_private(klass, sizeof (GeanyWrapLabelPrivate)); } @@ -140,7 +130,6 @@ static void geany_wrap_label_label_notify(GObject *object, GParamSpec *pspec, gp } -#if GTK_CHECK_VERSION(3, 0, 0) /* makes sure the layout is setup for rendering and chains to parent renderer */ static gboolean geany_wrap_label_draw(GtkWidget *widget, cairo_t *cr) { @@ -199,48 +188,22 @@ static GtkSizeRequestMode geany_wrap_label_get_request_mode(GtkWidget *widget) return GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT; } -#else /* GTK3 */ - -/* makes sure the layout is setup for rendering and chains to parent renderer */ -static gboolean geany_wrap_label_expose(GtkWidget *widget, GdkEventExpose *event) -{ - GeanyWrapLabel *self = GEANY_WRAP_LABEL(widget); - PangoLayout *layout = gtk_label_get_layout(GTK_LABEL(widget)); - - pango_layout_set_width(layout, self->priv->wrap_width * PANGO_SCALE); - pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); - - return (* GTK_WIDGET_CLASS(geany_wrap_label_parent_class)->expose_event)(widget, event); -} - - -/* Forces the height to be the size necessary for the Pango layout, while allowing the - * width to be flexible. */ -static void geany_wrap_label_size_request(GtkWidget *widget, GtkRequisition *req) -{ - req->width = 0; - req->height = GEANY_WRAP_LABEL(widget)->priv->wrap_height; -} -#endif /* GTK3 */ - /* Sets the wrap width to the width allocated to us. */ static void geany_wrap_label_size_allocate(GtkWidget *widget, GtkAllocation *alloc) { + GtkWidget *parent; + (* GTK_WIDGET_CLASS(geany_wrap_label_parent_class)->size_allocate)(widget, alloc); geany_wrap_label_set_wrap_width(widget, alloc->width); -#if GTK_CHECK_VERSION(3, 0, 0) -{ /* ask the parent to recompute our size, because it seems GTK3 size * caching is too aggressive */ - GtkWidget *parent = gtk_widget_get_parent(widget); + parent = gtk_widget_get_parent(widget); if (GTK_IS_CONTAINER(parent)) gtk_container_check_resize(GTK_CONTAINER(parent)); } -#endif -} GtkWidget *geany_wrap_label_new(const gchar *text) diff --git a/src/gtkcompat.h b/src/gtkcompat.h index f669e1f80d..4cf801b786 100644 --- a/src/gtkcompat.h +++ b/src/gtkcompat.h @@ -24,78 +24,36 @@ #define GTK_COMPAT_H 1 #include -#if GTK_CHECK_VERSION(3, 0, 0) -# include -#endif +#include G_BEGIN_DECLS -/* GtkComboBoxText */ -/* This is actually available in GTK 2.24, but we expose GtkComboBoxText in the - * API so we don't want the type to change for no good reason (although this - * should probably be harmless since it's only a derivated type). However, since - * a plugin needs to be rebuilt and tuned to work with GTK3 we don't mind that - * a type changes between the GTK2 and GTK3 version */ -#if ! GTK_CHECK_VERSION(3, 0, 0) -/* undef those not to get warnings about redefinitions under GTK 2.24 */ -# undef GTK_COMBO_BOX_TEXT -# undef GTK_COMBO_BOX_TEXT_CLASS -# undef GTK_COMBO_BOX_TEXT_GET_CLASS -# undef GTK_IS_COMBO_BOX_TEXT -# undef GTK_IS_COMBO_BOX_TEXT_CLASS -# undef GTK_TYPE_COMBO_BOX_TEXT - -# define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX -# define GTK_COMBO_BOX_TEXT_CLASS GTK_COMBO_BOX_CLASS -# define GTK_COMBO_BOX_TEXT_GET_CLASS GTK_COMBO_BOX_GET_CLASS -# define GTK_IS_COMBO_BOX_TEXT GTK_IS_COMBO_BOX -# define GTK_IS_COMBO_BOX_TEXT_CLASS GTK_IS_COMBO_BOX_CLASS -# define GTK_TYPE_COMBO_BOX_TEXT GTK_TYPE_COMBO_BOX -# define GtkComboBoxText GtkComboBox -# define gtk_combo_box_text_new gtk_combo_box_new_text -# define gtk_combo_box_text_new_with_entry gtk_combo_box_entry_new_text -# define gtk_combo_box_text_append_text gtk_combo_box_append_text -# define gtk_combo_box_text_insert_text gtk_combo_box_insert_text -# define gtk_combo_box_text_prepend_text gtk_combo_box_prepend_text -# define gtk_combo_box_text_remove gtk_combo_box_remove_text -# define gtk_combo_box_text_get_active_text gtk_combo_box_get_active_text -#endif - -/* GtkWidget */ -#if ! GTK_CHECK_VERSION(3, 0, 0) -# define gtk_widget_get_allocated_height(widget) (((GtkWidget *) (widget))->allocation.height) -# define gtk_widget_get_allocated_width(widget) (((GtkWidget *) (widget))->allocation.width) -#endif - - /* Mappings below only prevent some deprecation warnings on GTK3 for things * that didn't exist on GTK2. That's not future-proof. */ -#if GTK_CHECK_VERSION(3, 0, 0) /* Gtk[VH]Box */ -# define compat_gtk_box_new(orientation, homogeneous, spacing) \ - ((GtkWidget *)g_object_new(GTK_TYPE_BOX, \ - "orientation", (orientation), \ - "homogeneous", (homogeneous), \ - "spacing", (spacing), \ - NULL)) -# define gtk_vbox_new(homogeneous, spacing) \ - compat_gtk_box_new(GTK_ORIENTATION_VERTICAL, (homogeneous), (spacing)) -# define gtk_hbox_new(homogeneous, spacing) \ - compat_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, (homogeneous), (spacing)) +#define compat_gtk_box_new(orientation, homogeneous, spacing) \ + ((GtkWidget *)g_object_new(GTK_TYPE_BOX, \ + "orientation", (orientation), \ + "homogeneous", (homogeneous), \ + "spacing", (spacing), \ + NULL)) +#define gtk_vbox_new(homogeneous, spacing) \ + compat_gtk_box_new(GTK_ORIENTATION_VERTICAL, (homogeneous), (spacing)) +#define gtk_hbox_new(homogeneous, spacing) \ + compat_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, (homogeneous), (spacing)) /* Gtk[VH]ButtonBox */ -# define gtk_vbutton_box_new() gtk_button_box_new(GTK_ORIENTATION_VERTICAL) -# define gtk_hbutton_box_new() gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL) +#define gtk_vbutton_box_new() gtk_button_box_new(GTK_ORIENTATION_VERTICAL) +#define gtk_hbutton_box_new() gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL) /* Gtk[VH]Separator */ -# define gtk_vseparator_new() gtk_separator_new(GTK_ORIENTATION_VERTICAL) -# define gtk_hseparator_new() gtk_separator_new(GTK_ORIENTATION_HORIZONTAL) +#define gtk_vseparator_new() gtk_separator_new(GTK_ORIENTATION_VERTICAL) +#define gtk_hseparator_new() gtk_separator_new(GTK_ORIENTATION_HORIZONTAL) /* Gtk[VH]Paned */ -# define gtk_vpaned_new() gtk_paned_new(GTK_ORIENTATION_VERTICAL) -# define gtk_hpaned_new() gtk_paned_new(GTK_ORIENTATION_HORIZONTAL) +#define gtk_vpaned_new() gtk_paned_new(GTK_ORIENTATION_VERTICAL) +#define gtk_hpaned_new() gtk_paned_new(GTK_ORIENTATION_HORIZONTAL) /* Gtk[VH]Scrollbar */ -# define gtk_vscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, (adj)) -# define gtk_hscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, (adj)) -#endif +#define gtk_vscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, (adj)) +#define gtk_hscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, (adj)) G_END_DECLS diff --git a/src/keybindings.c b/src/keybindings.c index 2696ba064b..5126bb93a8 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -54,8 +54,7 @@ #include "utils.h" #include "vte.h" -#include "gtkcompat.h" - +#include #include #include @@ -161,7 +160,7 @@ GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id) * @param key_id Keybinding index for the group. * @param callback @nullable Function to call when activated, or @c NULL to use the group callback. * Usually it's better to use the group callback instead - see plugin_set_key_group(). - * @param key Default key, e.g. @c GDK_j (must be lower case), but usually 0 for unset. + * @param key Default key, e.g. @c GDK_KEY_j (must be lower case), but usually 0 for unset. * @param mod Default modifier, e.g. @c GDK_CONTROL_MASK, but usually 0 for unset. * @param kf_name Key name used for this item in the keybindings configuration file, i.e. @c "menu_new". * @param label Label used in the preferences dialog keybindings tab. May contain @@ -214,7 +213,7 @@ GeanyKeyBinding *keybindings_set_item(GeanyKeyGroup *group, gsize key_id, * * @param group Group. * @param key_id Keybinding index for the group. - * @param key Default key, e.g. @c GDK_j (must be lower case), but usually 0 for unset. + * @param key Default key, e.g. @c GDK_KEY_j (must be lower case), but usually 0 for unset. * @param mod Default modifier, e.g. @c GDK_CONTROL_MASK, but usually 0 for unset. * @param kf_name Key name used for this item in the keybindings configuration file, i.e. @c "menu_new". * @param label Label used in the preferences dialog keybindings tab. May contain @@ -332,34 +331,34 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_FILE); add_kb(group, GEANY_KEYS_FILE_NEW, NULL, - GDK_n, GEANY_PRIMARY_MOD_MASK, "menu_new", _("New"), "menu_new1"); + GDK_KEY_n, GEANY_PRIMARY_MOD_MASK, "menu_new", _("New"), "menu_new1"); add_kb(group, GEANY_KEYS_FILE_OPEN, NULL, - GDK_o, GEANY_PRIMARY_MOD_MASK, "menu_open", _("Open"), "menu_open1"); + GDK_KEY_o, GEANY_PRIMARY_MOD_MASK, "menu_open", _("Open"), "menu_open1"); add_kb(group, GEANY_KEYS_FILE_OPENSELECTED, NULL, - GDK_o, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "menu_open_selected", + GDK_KEY_o, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "menu_open_selected", _("Open selected file"), "menu_open_selected_file1"); add_kb(group, GEANY_KEYS_FILE_SAVE, NULL, - GDK_s, GEANY_PRIMARY_MOD_MASK, "menu_save", _("Save"), "menu_save1"); + GDK_KEY_s, GEANY_PRIMARY_MOD_MASK, "menu_save", _("Save"), "menu_save1"); add_kb(group, GEANY_KEYS_FILE_SAVEAS, NULL, 0, 0, "menu_saveas", _("Save as"), "menu_save_as1"); add_kb(group, GEANY_KEYS_FILE_SAVEALL, NULL, - GDK_s, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "menu_saveall", _("Save all"), + GDK_KEY_s, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "menu_saveall", _("Save all"), "menu_save_all1"); add_kb(group, GEANY_KEYS_FILE_PROPERTIES, NULL, 0, 0, "file_properties", _("Properties"), "properties1"); add_kb(group, GEANY_KEYS_FILE_PRINT, NULL, - GDK_p, GEANY_PRIMARY_MOD_MASK, "menu_print", _("Print"), "print1"); + GDK_KEY_p, GEANY_PRIMARY_MOD_MASK, "menu_print", _("Print"), "print1"); add_kb(group, GEANY_KEYS_FILE_CLOSE, NULL, - GDK_w, GEANY_PRIMARY_MOD_MASK, "menu_close", _("Close"), "menu_close1"); + GDK_KEY_w, GEANY_PRIMARY_MOD_MASK, "menu_close", _("Close"), "menu_close1"); add_kb(group, GEANY_KEYS_FILE_CLOSEALL, NULL, - GDK_w, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "menu_closeall", _("Close all"), + GDK_KEY_w, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "menu_closeall", _("Close all"), "menu_close_all1"); add_kb(group, GEANY_KEYS_FILE_RELOAD, NULL, - GDK_r, GEANY_PRIMARY_MOD_MASK, "menu_reloadfile", _("Reload file"), "menu_reload1"); + GDK_KEY_r, GEANY_PRIMARY_MOD_MASK, "menu_reloadfile", _("Reload file"), "menu_reload1"); add_kb(group, GEANY_KEYS_FILE_OPENLASTTAB, NULL, 0, 0, "file_openlasttab", _("Re-open last closed tab"), NULL); add_kb(group, GEANY_KEYS_FILE_QUIT, NULL, - GDK_q, GEANY_PRIMARY_MOD_MASK, "menu_quit", _("Quit"), "menu_quit1"); + GDK_KEY_q, GEANY_PRIMARY_MOD_MASK, "menu_quit", _("Quit"), "menu_quit1"); group = keybindings_get_core_group(GEANY_KEY_GROUP_PROJECT); @@ -376,32 +375,32 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_EDITOR); add_kb(group, GEANY_KEYS_EDITOR_UNDO, NULL, - GDK_z, GEANY_PRIMARY_MOD_MASK, "menu_undo", _("Undo"), "menu_undo2"); + GDK_KEY_z, GEANY_PRIMARY_MOD_MASK, "menu_undo", _("Undo"), "menu_undo2"); add_kb(group, GEANY_KEYS_EDITOR_REDO, NULL, - GDK_y, GEANY_PRIMARY_MOD_MASK, "menu_redo", _("Redo"), "menu_redo2"); + GDK_KEY_y, GEANY_PRIMARY_MOD_MASK, "menu_redo", _("Redo"), "menu_redo2"); add_kb(group, GEANY_KEYS_EDITOR_DUPLICATELINE, NULL, - GDK_d, GEANY_PRIMARY_MOD_MASK, "edit_duplicateline", _("D_uplicate Line or Selection"), + GDK_KEY_d, GEANY_PRIMARY_MOD_MASK, "edit_duplicateline", _("D_uplicate Line or Selection"), "duplicate_line_or_selection1"); add_kb(group, GEANY_KEYS_EDITOR_DELETELINE, NULL, - GDK_k, GEANY_PRIMARY_MOD_MASK, "edit_deleteline", _("_Delete Current Line(s)"), + GDK_KEY_k, GEANY_PRIMARY_MOD_MASK, "edit_deleteline", _("_Delete Current Line(s)"), "delete_current_lines1"); add_kb(group, GEANY_KEYS_EDITOR_DELETELINETOEND, NULL, - GDK_Delete, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_deletelinetoend", + GDK_KEY_Delete, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_deletelinetoend", _("Delete to line end"), NULL); add_kb(group, GEANY_KEYS_EDITOR_DELETELINETOBEGINNING, NULL, - GDK_BackSpace, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_deletelinetobegin", + GDK_KEY_BackSpace, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_deletelinetobegin", _("Delete to beginning of line"), NULL); /* Note: transpose may fit better in format group, but that would break the API */ add_kb(group, GEANY_KEYS_EDITOR_TRANSPOSELINE, NULL, 0, 0, "edit_transposeline", _("_Transpose Current Line"), NULL); add_kb(group, GEANY_KEYS_EDITOR_SCROLLTOLINE, NULL, - GDK_l, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_scrolltoline", _("Scroll to current line"), NULL); + GDK_KEY_l, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "edit_scrolltoline", _("Scroll to current line"), NULL); add_kb(group, GEANY_KEYS_EDITOR_SCROLLLINEUP, NULL, - GDK_Up, GDK_MOD1_MASK, "edit_scrolllineup", _("Scroll up the view by one line"), NULL); + GDK_KEY_Up, GDK_MOD1_MASK, "edit_scrolllineup", _("Scroll up the view by one line"), NULL); add_kb(group, GEANY_KEYS_EDITOR_SCROLLLINEDOWN, NULL, - GDK_Down, GDK_MOD1_MASK, "edit_scrolllinedown", _("Scroll down the view by one line"), NULL); + GDK_KEY_Down, GDK_MOD1_MASK, "edit_scrolllinedown", _("Scroll down the view by one line"), NULL); add_kb(group, GEANY_KEYS_EDITOR_COMPLETESNIPPET, NULL, - GDK_Tab, 0, "edit_completesnippet", _("Complete snippet"), NULL); + GDK_KEY_Tab, 0, "edit_completesnippet", _("Complete snippet"), NULL); add_kb(group, GEANY_KEYS_EDITOR_SNIPPETNEXTCURSOR, NULL, 0, 0, "move_snippetnextcursor", _("Move cursor in snippet"), NULL); add_kb(group, GEANY_KEYS_EDITOR_SUPPRESSSNIPPETCOMPLETION, NULL, @@ -409,44 +408,44 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_EDITOR_CONTEXTACTION, NULL, 0, 0, "popup_contextaction", _("Context Action"), NULL); add_kb(group, GEANY_KEYS_EDITOR_AUTOCOMPLETE, NULL, - GDK_space, GEANY_PRIMARY_MOD_MASK, "edit_autocomplete", _("Complete word"), NULL); + GDK_KEY_space, GEANY_PRIMARY_MOD_MASK, "edit_autocomplete", _("Complete word"), NULL); add_kb(group, GEANY_KEYS_EDITOR_CALLTIP, NULL, - GDK_space, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"), NULL); + GDK_KEY_space, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"), NULL); add_kb(group, GEANY_KEYS_EDITOR_WORDPARTCOMPLETION, NULL, - GDK_Tab, 0, "edit_wordpartcompletion", _("Word part completion"), NULL); + GDK_KEY_Tab, 0, "edit_wordpartcompletion", _("Word part completion"), NULL); add_kb(group, GEANY_KEYS_EDITOR_MOVELINEUP, NULL, - GDK_Page_Up, GDK_MOD1_MASK, "edit_movelineup", + GDK_KEY_Page_Up, GDK_MOD1_MASK, "edit_movelineup", _("Move line(s) up"), "move_lines_up1"); add_kb(group, GEANY_KEYS_EDITOR_MOVELINEDOWN, NULL, - GDK_Page_Down, GDK_MOD1_MASK, "edit_movelinedown", + GDK_KEY_Page_Down, GDK_MOD1_MASK, "edit_movelinedown", _("Move line(s) down"), "move_lines_down1"); group = keybindings_get_core_group(GEANY_KEY_GROUP_CLIPBOARD); add_kb(group, GEANY_KEYS_CLIPBOARD_CUT, NULL, - GDK_x, GEANY_PRIMARY_MOD_MASK, "menu_cut", _("Cut"), "menu_cut1"); + GDK_KEY_x, GEANY_PRIMARY_MOD_MASK, "menu_cut", _("Cut"), "menu_cut1"); add_kb(group, GEANY_KEYS_CLIPBOARD_COPY, NULL, - GDK_c, GEANY_PRIMARY_MOD_MASK, "menu_copy", _("Copy"), "menu_copy1"); + GDK_KEY_c, GEANY_PRIMARY_MOD_MASK, "menu_copy", _("Copy"), "menu_copy1"); add_kb(group, GEANY_KEYS_CLIPBOARD_PASTE, NULL, - GDK_v, GEANY_PRIMARY_MOD_MASK, "menu_paste", _("Paste"), "menu_paste1"); + GDK_KEY_v, GEANY_PRIMARY_MOD_MASK, "menu_paste", _("Paste"), "menu_paste1"); add_kb(group, GEANY_KEYS_CLIPBOARD_COPYLINE, NULL, - GDK_c, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_copyline", _("_Copy Current Line(s)"), + GDK_KEY_c, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_copyline", _("_Copy Current Line(s)"), "copy_current_lines1"); add_kb(group, GEANY_KEYS_CLIPBOARD_CUTLINE, NULL, - GDK_x, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_cutline", _("Cu_t Current Line(s)"), + GDK_KEY_x, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_cutline", _("Cu_t Current Line(s)"), "cut_current_lines1"); group = keybindings_get_core_group(GEANY_KEY_GROUP_SELECT); add_kb(group, GEANY_KEYS_SELECT_ALL, NULL, - GDK_a, GEANY_PRIMARY_MOD_MASK, "menu_selectall", _("Select All"), "menu_select_all1"); + GDK_KEY_a, GEANY_PRIMARY_MOD_MASK, "menu_selectall", _("Select All"), "menu_select_all1"); add_kb(group, GEANY_KEYS_SELECT_WORD, NULL, - GDK_w, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectword", _("Select current word"), NULL); + GDK_KEY_w, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectword", _("Select current word"), NULL); add_kb(group, GEANY_KEYS_SELECT_LINE, NULL, - GDK_l, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectline", _("S_elect Current Line(s)"), + GDK_KEY_l, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectline", _("S_elect Current Line(s)"), "select_current_lines1"); add_kb(group, GEANY_KEYS_SELECT_PARAGRAPH, NULL, - GDK_p, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectparagraph", _("Se_lect Current Paragraph"), + GDK_KEY_p, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectparagraph", _("Se_lect Current Paragraph"), "select_current_paragraph1"); add_kb(group, GEANY_KEYS_SELECT_WORDPARTLEFT, NULL, 0, 0, "edit_selectwordpartleft", _("Select to previous word part"), NULL); @@ -456,20 +455,20 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_FORMAT); add_kb(group, GEANY_KEYS_FORMAT_TOGGLECASE, NULL, - GDK_u, GEANY_PRIMARY_MOD_MASK | GDK_MOD1_MASK, "edit_togglecase", + GDK_KEY_u, GEANY_PRIMARY_MOD_MASK | GDK_MOD1_MASK, "edit_togglecase", _("T_oggle Case of Selection"), "menu_toggle_case2"); add_kb(group, GEANY_KEYS_FORMAT_COMMENTLINETOGGLE, NULL, - GDK_e, GEANY_PRIMARY_MOD_MASK, "edit_commentlinetoggle", _("Toggle line commentation"), + GDK_KEY_e, GEANY_PRIMARY_MOD_MASK, "edit_commentlinetoggle", _("Toggle line commentation"), "menu_toggle_line_commentation1"); add_kb(group, GEANY_KEYS_FORMAT_COMMENTLINE, NULL, 0, 0, "edit_commentline", _("Comment line(s)"), "menu_comment_line1"); add_kb(group, GEANY_KEYS_FORMAT_UNCOMMENTLINE, NULL, 0, 0, "edit_uncommentline", _("Uncomment line(s)"), "menu_uncomment_line1"); add_kb(group, GEANY_KEYS_FORMAT_INCREASEINDENT, NULL, - GDK_i, GEANY_PRIMARY_MOD_MASK, "edit_increaseindent", _("Increase indent"), + GDK_KEY_i, GEANY_PRIMARY_MOD_MASK, "edit_increaseindent", _("Increase indent"), "menu_increase_indent1"); add_kb(group, GEANY_KEYS_FORMAT_DECREASEINDENT, NULL, - GDK_u, GEANY_PRIMARY_MOD_MASK, "edit_decreaseindent", _("Decrease indent"), + GDK_KEY_u, GEANY_PRIMARY_MOD_MASK, "edit_decreaseindent", _("Decrease indent"), "menu_decrease_indent1"); add_kb(group, GEANY_KEYS_FORMAT_INCREASEINDENTBYSPACE, NULL, 0, 0, "edit_increaseindentbyspace", _("Increase indent by one space"), NULL); @@ -478,11 +477,11 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_FORMAT_AUTOINDENT, NULL, 0, 0, "edit_autoindent", _("S_mart Line Indent"), "smart_line_indent1"); add_kb(group, GEANY_KEYS_FORMAT_SENDTOCMD1, NULL, - GDK_1, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd1", _("Send to Custom Command 1"), NULL); + GDK_KEY_1, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd1", _("Send to Custom Command 1"), NULL); add_kb(group, GEANY_KEYS_FORMAT_SENDTOCMD2, NULL, - GDK_2, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd2", _("Send to Custom Command 2"), NULL); + GDK_KEY_2, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd2", _("Send to Custom Command 2"), NULL); add_kb(group, GEANY_KEYS_FORMAT_SENDTOCMD3, NULL, - GDK_3, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd3", _("Send to Custom Command 3"), NULL); + GDK_KEY_3, GEANY_PRIMARY_MOD_MASK, "edit_sendtocmd3", _("Send to Custom Command 3"), NULL); add_kb(group, GEANY_KEYS_FORMAT_SENDTOCMD4, NULL, 0, 0, "edit_sendtocmd4", _("Send to Custom Command 4"), NULL); add_kb(group, GEANY_KEYS_FORMAT_SENDTOCMD5, NULL, @@ -499,7 +498,7 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_FORMAT_SENDTOVTE, NULL, 0, 0, "edit_sendtovte", _("_Send Selection to Terminal"), "send_selection_to_vte1"); add_kb(group, GEANY_KEYS_FORMAT_REFLOWPARAGRAPH, NULL, - GDK_j, GEANY_PRIMARY_MOD_MASK, "format_reflowparagraph", _("_Reflow Lines/Block"), + GDK_KEY_j, GEANY_PRIMARY_MOD_MASK, "format_reflowparagraph", _("_Reflow Lines/Block"), "reflow_lines_block1"); keybindings_set_item(group, GEANY_KEYS_FORMAT_JOINLINES, NULL, 0, 0, "edit_joinlines", _("Join lines"), NULL); @@ -507,7 +506,7 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_INSERT); add_kb(group, GEANY_KEYS_INSERT_DATE, NULL, - GDK_d, GDK_SHIFT_MASK | GDK_MOD1_MASK, "menu_insert_date", _("Insert date"), + GDK_KEY_d, GDK_SHIFT_MASK | GDK_MOD1_MASK, "menu_insert_date", _("Insert date"), "insert_date_custom1"); add_kb(group, GEANY_KEYS_INSERT_ALTWHITESPACE, NULL, 0, 0, "edit_insertwhitespace", _("Insert Alternative _White Space"), @@ -520,7 +519,7 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_SETTINGS); add_kb(group, GEANY_KEYS_SETTINGS_PREFERENCES, cb_func_menu_preferences, - GDK_p, GEANY_PRIMARY_MOD_MASK | GDK_MOD1_MASK, "menu_preferences", _("Preferences"), + GDK_KEY_p, GEANY_PRIMARY_MOD_MASK | GDK_MOD1_MASK, "menu_preferences", _("Preferences"), "preferences1"); add_kb(group, GEANY_KEYS_SETTINGS_PLUGINPREFERENCES, cb_func_menu_preferences, 0, 0, "menu_pluginpreferences", _("P_lugin Preferences"), "plugin_preferences1"); @@ -528,19 +527,19 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_SEARCH); add_kb(group, GEANY_KEYS_SEARCH_FIND, NULL, - GDK_f, GEANY_PRIMARY_MOD_MASK, "menu_find", _("Find"), "find1"); + GDK_KEY_f, GEANY_PRIMARY_MOD_MASK, "menu_find", _("Find"), "find1"); add_kb(group, GEANY_KEYS_SEARCH_FINDNEXT, NULL, - GDK_g, GEANY_PRIMARY_MOD_MASK, "menu_findnext", _("Find Next"), "find_next1"); + GDK_KEY_g, GEANY_PRIMARY_MOD_MASK, "menu_findnext", _("Find Next"), "find_next1"); add_kb(group, GEANY_KEYS_SEARCH_FINDPREVIOUS, NULL, - GDK_g, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "menu_findprevious", _("Find Previous"), + GDK_KEY_g, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "menu_findprevious", _("Find Previous"), "find_previous1"); add_kb(group, GEANY_KEYS_SEARCH_FINDNEXTSEL, NULL, 0, 0, "menu_findnextsel", _("Find Next _Selection"), "find_nextsel1"); add_kb(group, GEANY_KEYS_SEARCH_FINDPREVSEL, NULL, 0, 0, "menu_findprevsel", _("Find Pre_vious Selection"), "find_prevsel1"); add_kb(group, GEANY_KEYS_SEARCH_REPLACE, NULL, - GDK_h, GEANY_PRIMARY_MOD_MASK, "menu_replace", _("Replace"), "replace1"); - add_kb(group, GEANY_KEYS_SEARCH_FINDINFILES, NULL, GDK_f, + GDK_KEY_h, GEANY_PRIMARY_MOD_MASK, "menu_replace", _("Replace"), "replace1"); + add_kb(group, GEANY_KEYS_SEARCH_FINDINFILES, NULL, GDK_KEY_f, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "menu_findinfiles", _("Find in Files"), "find_in_files1"); add_kb(group, GEANY_KEYS_SEARCH_NEXTMESSAGE, NULL, @@ -548,52 +547,52 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_SEARCH_PREVIOUSMESSAGE, NULL, 0, 0, "menu_previousmessage", _("Previous Message"), "previous_message1"); add_kb(group, GEANY_KEYS_SEARCH_FINDUSAGE, NULL, - GDK_e, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_findusage", + GDK_KEY_e, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_findusage", _("Find Usage"), "find_usage1"); add_kb(group, GEANY_KEYS_SEARCH_FINDDOCUMENTUSAGE, NULL, - GDK_d, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_finddocumentusage", + GDK_KEY_d, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_finddocumentusage", _("Find Document Usage"), "find_document_usage1"); add_kb(group, GEANY_KEYS_SEARCH_MARKALL, NULL, - GDK_m, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "find_markall", _("_Mark All"), "mark_all1"); + GDK_KEY_m, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "find_markall", _("_Mark All"), "mark_all1"); group = keybindings_get_core_group(GEANY_KEY_GROUP_GOTO); add_kb(group, GEANY_KEYS_GOTO_BACK, NULL, - GDK_Left, GDK_MOD1_MASK, "nav_back", _("Navigate back a location"), NULL); + GDK_KEY_Left, GDK_MOD1_MASK, "nav_back", _("Navigate back a location"), NULL); add_kb(group, GEANY_KEYS_GOTO_FORWARD, NULL, - GDK_Right, GDK_MOD1_MASK, "nav_forward", _("Navigate forward a location"), NULL); + GDK_KEY_Right, GDK_MOD1_MASK, "nav_forward", _("Navigate forward a location"), NULL); add_kb(group, GEANY_KEYS_GOTO_LINE, NULL, - GDK_l, GEANY_PRIMARY_MOD_MASK, "menu_gotoline", _("Go to Line"), "go_to_line1"); + GDK_KEY_l, GEANY_PRIMARY_MOD_MASK, "menu_gotoline", _("Go to Line"), "go_to_line1"); add_kb(group, GEANY_KEYS_GOTO_MATCHINGBRACE, NULL, - GDK_b, GEANY_PRIMARY_MOD_MASK, "edit_gotomatchingbrace", + GDK_KEY_b, GEANY_PRIMARY_MOD_MASK, "edit_gotomatchingbrace", _("Go to matching brace"), NULL); add_kb(group, GEANY_KEYS_GOTO_TOGGLEMARKER, NULL, - GDK_m, GEANY_PRIMARY_MOD_MASK, "edit_togglemarker", + GDK_KEY_m, GEANY_PRIMARY_MOD_MASK, "edit_togglemarker", _("Toggle marker"), NULL); add_kb(group, GEANY_KEYS_GOTO_NEXTMARKER, NULL, - GDK_period, GEANY_PRIMARY_MOD_MASK, "edit_gotonextmarker", + GDK_KEY_period, GEANY_PRIMARY_MOD_MASK, "edit_gotonextmarker", _("Go to Ne_xt Marker"), "go_to_next_marker1"); add_kb(group, GEANY_KEYS_GOTO_PREVIOUSMARKER, NULL, - GDK_comma, GEANY_PRIMARY_MOD_MASK, "edit_gotopreviousmarker", + GDK_KEY_comma, GEANY_PRIMARY_MOD_MASK, "edit_gotopreviousmarker", _("Go to Pre_vious Marker"), "go_to_previous_marker1"); add_kb(group, GEANY_KEYS_GOTO_TAGDEFINITION, NULL, - GDK_t, GEANY_PRIMARY_MOD_MASK, "popup_gototagdefinition", + GDK_KEY_t, GEANY_PRIMARY_MOD_MASK, "popup_gototagdefinition", _("Go to Symbol Definition"), "goto_tag_definition1"); add_kb(group, GEANY_KEYS_GOTO_TAGDECLARATION, NULL, - GDK_t, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_gototagdeclaration", + GDK_KEY_t, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "popup_gototagdeclaration", _("Go to Symbol Declaration"), "goto_tag_declaration1"); add_kb(group, GEANY_KEYS_GOTO_LINESTART, NULL, - GDK_Home, 0, "edit_gotolinestart", _("Go to Start of Line"), NULL); + GDK_KEY_Home, 0, "edit_gotolinestart", _("Go to Start of Line"), NULL); add_kb(group, GEANY_KEYS_GOTO_LINEEND, NULL, - GDK_End, 0, "edit_gotolineend", _("Go to End of Line"), NULL); + GDK_KEY_End, 0, "edit_gotolineend", _("Go to End of Line"), NULL); add_kb(group, GEANY_KEYS_GOTO_LINESTARTVISUAL, NULL, - GDK_Home, GDK_MOD1_MASK, "edit_gotolinestartvisual", _("Go to Start of Display Line"), NULL); + GDK_KEY_Home, GDK_MOD1_MASK, "edit_gotolinestartvisual", _("Go to Start of Display Line"), NULL); add_kb(group, GEANY_KEYS_GOTO_LINEENDVISUAL, NULL, - GDK_End, GDK_MOD1_MASK, "edit_gotolineendvisual", _("Go to End of Display Line"), NULL); + GDK_KEY_End, GDK_MOD1_MASK, "edit_gotolineendvisual", _("Go to End of Display Line"), NULL); add_kb(group, GEANY_KEYS_GOTO_PREVWORDPART, NULL, - GDK_slash, GEANY_PRIMARY_MOD_MASK, "edit_prevwordstart", _("Go to Previous Word Part"), NULL); + GDK_KEY_slash, GEANY_PRIMARY_MOD_MASK, "edit_prevwordstart", _("Go to Previous Word Part"), NULL); add_kb(group, GEANY_KEYS_GOTO_NEXTWORDPART, NULL, - GDK_backslash, GEANY_PRIMARY_MOD_MASK, "edit_nextwordstart", _("Go to Next Word Part"), NULL); + GDK_KEY_backslash, GEANY_PRIMARY_MOD_MASK, "edit_nextwordstart", _("Go to Next Word Part"), NULL); group = keybindings_get_core_group(GEANY_KEY_GROUP_VIEW); @@ -601,25 +600,25 @@ static void init_default_kb(void) 0, 0, "menu_toggleall", _("Toggle All Additional Widgets"), "menu_toggle_all_additional_widgets1"); add_kb(group, GEANY_KEYS_VIEW_FULLSCREEN, cb_func_menu_fullscreen, - GDK_F11, 0, "menu_fullscreen", _("Fullscreen"), "menu_fullscreen1"); + GDK_KEY_F11, 0, "menu_fullscreen", _("Fullscreen"), "menu_fullscreen1"); add_kb(group, GEANY_KEYS_VIEW_MESSAGEWINDOW, cb_func_menu_messagewindow, 0, 0, "menu_messagewindow", _("Toggle Messages Window"), "menu_show_messages_window1"); add_kb(group, GEANY_KEYS_VIEW_SIDEBAR, NULL, 0, 0, "toggle_sidebar", _("Toggle Sidebar"), "menu_show_sidebar1"); add_kb(group, GEANY_KEYS_VIEW_ZOOMIN, NULL, - GDK_plus, GEANY_PRIMARY_MOD_MASK, "menu_zoomin", _("Zoom In"), "menu_zoom_in1"); + GDK_KEY_plus, GEANY_PRIMARY_MOD_MASK, "menu_zoomin", _("Zoom In"), "menu_zoom_in1"); add_kb(group, GEANY_KEYS_VIEW_ZOOMOUT, NULL, - GDK_minus, GEANY_PRIMARY_MOD_MASK, "menu_zoomout", _("Zoom Out"), "menu_zoom_out1"); + GDK_KEY_minus, GEANY_PRIMARY_MOD_MASK, "menu_zoomout", _("Zoom Out"), "menu_zoom_out1"); add_kb(group, GEANY_KEYS_VIEW_ZOOMRESET, NULL, - GDK_0, GEANY_PRIMARY_MOD_MASK, "normal_size", _("Zoom Reset"), "normal_size1"); + GDK_KEY_0, GEANY_PRIMARY_MOD_MASK, "normal_size", _("Zoom Reset"), "normal_size1"); group = keybindings_get_core_group(GEANY_KEY_GROUP_FOCUS); add_kb(group, GEANY_KEYS_FOCUS_EDITOR, NULL, - GDK_F2, 0, "switch_editor", _("Switch to Editor"), NULL); + GDK_KEY_F2, 0, "switch_editor", _("Switch to Editor"), NULL); add_kb(group, GEANY_KEYS_FOCUS_SEARCHBAR, NULL, - GDK_F7, 0, "switch_search_bar", _("Switch to Search Bar"), NULL); + GDK_KEY_F7, 0, "switch_search_bar", _("Switch to Search Bar"), NULL); add_kb(group, GEANY_KEYS_FOCUS_MESSAGE_WINDOW, NULL, 0, 0, "switch_message_window", _("Switch to Message Window"), NULL); add_kb(group, GEANY_KEYS_FOCUS_COMPILER, NULL, @@ -627,9 +626,9 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_FOCUS_MESSAGES, NULL, 0, 0, "switch_messages", _("Switch to Messages"), NULL); add_kb(group, GEANY_KEYS_FOCUS_SCRIBBLE, NULL, - GDK_F6, 0, "switch_scribble", _("Switch to Scribble"), NULL); + GDK_KEY_F6, 0, "switch_scribble", _("Switch to Scribble"), NULL); add_kb(group, GEANY_KEYS_FOCUS_VTE, NULL, - GDK_F4, 0, "switch_vte", _("Switch to VTE"), NULL); + GDK_KEY_F4, 0, "switch_vte", _("Switch to VTE"), NULL); add_kb(group, GEANY_KEYS_FOCUS_SIDEBAR, NULL, 0, 0, "switch_sidebar", _("Switch to Sidebar"), NULL); add_kb(group, GEANY_KEYS_FOCUS_SIDEBAR_SYMBOL_LIST, NULL, @@ -640,16 +639,16 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_NOTEBOOK); add_kb(group, GEANY_KEYS_NOTEBOOK_SWITCHTABLEFT, cb_func_switch_tableft, - GDK_Page_Up, GEANY_PRIMARY_MOD_MASK, "switch_tableft", _("Switch to left document"), NULL); + GDK_KEY_Page_Up, GEANY_PRIMARY_MOD_MASK, "switch_tableft", _("Switch to left document"), NULL); add_kb(group, GEANY_KEYS_NOTEBOOK_SWITCHTABRIGHT, cb_func_switch_tabright, - GDK_Page_Down, GEANY_PRIMARY_MOD_MASK, "switch_tabright", _("Switch to right document"), NULL); + GDK_KEY_Page_Down, GEANY_PRIMARY_MOD_MASK, "switch_tabright", _("Switch to right document"), NULL); add_kb(group, GEANY_KEYS_NOTEBOOK_SWITCHTABLASTUSED, cb_func_switch_tablastused, - GDK_Tab, GEANY_PRIMARY_MOD_MASK, "switch_tablastused", _("Switch to last used document"), NULL); + GDK_KEY_Tab, GEANY_PRIMARY_MOD_MASK, "switch_tablastused", _("Switch to last used document"), NULL); add_kb(group, GEANY_KEYS_NOTEBOOK_MOVETABLEFT, cb_func_move_tab, - GDK_Page_Up, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "move_tableft", + GDK_KEY_Page_Up, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "move_tableft", _("Move document left"), NULL); add_kb(group, GEANY_KEYS_NOTEBOOK_MOVETABRIGHT, cb_func_move_tab, - GDK_Page_Down, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "move_tabright", + GDK_KEY_Page_Down, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "move_tabright", _("Move document right"), NULL); add_kb(group, GEANY_KEYS_NOTEBOOK_MOVETABFIRST, cb_func_move_tab, 0, 0, "move_tabfirst", _("Move document first"), NULL); @@ -677,7 +676,7 @@ static void init_default_kb(void) add_kb(group, GEANY_KEYS_DOCUMENT_UNFOLDALL, NULL, 0, 0, "menu_unfoldall", _("Unfold all"), "menu_unfold_all1"); add_kb(group, GEANY_KEYS_DOCUMENT_RELOADTAGLIST, NULL, - GDK_r, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "reloadtaglist", _("Reload symbol list"), NULL); + GDK_KEY_r, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "reloadtaglist", _("Reload symbol list"), NULL); add_kb(group, GEANY_KEYS_DOCUMENT_REMOVE_MARKERS, NULL, 0, 0, "remove_markers", _("Remove Markers"), "remove_markers1"); add_kb(group, GEANY_KEYS_DOCUMENT_REMOVE_ERROR_INDICATORS, NULL, @@ -688,22 +687,22 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_BUILD); add_kb(group, GEANY_KEYS_BUILD_COMPILE, NULL, - GDK_F8, 0, "build_compile", _("Compile"), NULL); + GDK_KEY_F8, 0, "build_compile", _("Compile"), NULL); add_kb(group, GEANY_KEYS_BUILD_LINK, NULL, - GDK_F9, 0, "build_link", _("Build"), NULL); + GDK_KEY_F9, 0, "build_link", _("Build"), NULL); add_kb(group, GEANY_KEYS_BUILD_MAKE, NULL, - GDK_F9, GDK_SHIFT_MASK, "build_make", _("Make all"), NULL); + GDK_KEY_F9, GDK_SHIFT_MASK, "build_make", _("Make all"), NULL); add_kb(group, GEANY_KEYS_BUILD_MAKEOWNTARGET, NULL, - GDK_F9, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "build_makeowntarget", + GDK_KEY_F9, GDK_SHIFT_MASK | GEANY_PRIMARY_MOD_MASK, "build_makeowntarget", _("Make custom target"), NULL); add_kb(group, GEANY_KEYS_BUILD_MAKEOBJECT, NULL, - GDK_F8, GDK_SHIFT_MASK, "build_makeobject", _("Make object"), NULL); + GDK_KEY_F8, GDK_SHIFT_MASK, "build_makeobject", _("Make object"), NULL); add_kb(group, GEANY_KEYS_BUILD_NEXTERROR, NULL, 0, 0, "build_nexterror", _("Next error"), NULL); add_kb(group, GEANY_KEYS_BUILD_PREVIOUSERROR, NULL, 0, 0, "build_previouserror", _("Previous error"), NULL); add_kb(group, GEANY_KEYS_BUILD_RUN, NULL, - GDK_F5, 0, "build_run", _("Run"), NULL); + GDK_KEY_F5, 0, "build_run", _("Run"), NULL); add_kb(group, GEANY_KEYS_BUILD_OPTIONS, NULL, 0, 0, "build_options", _("Build options"), NULL); @@ -715,7 +714,7 @@ static void init_default_kb(void) group = keybindings_get_core_group(GEANY_KEY_GROUP_HELP); add_kb(group, GEANY_KEYS_HELP_HELP, cb_func_menu_help, - GDK_F1, 0, "menu_help", _("Help"), "help1"); + GDK_KEY_F1, 0, "menu_help", _("Help"), "help1"); } @@ -1090,13 +1089,13 @@ void keybindings_show_shortcuts(void) static gboolean check_fixed_kb(guint keyval, guint state) { /* check alt-0 to alt-9 for setting current notebook page */ - if (state == GDK_MOD1_MASK && keyval >= GDK_0 && keyval <= GDK_9) + if (state == GDK_MOD1_MASK && keyval >= GDK_KEY_0 && keyval <= GDK_KEY_9) { - gint page = keyval - GDK_0 - 1; + gint page = keyval - GDK_KEY_0 - 1; gint npages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); /* alt-0 is for the rightmost tab */ - if (keyval == GDK_0) + if (keyval == GDK_KEY_0) page = npages - 1; /* invert the order if tabs are added on the other side */ if (swap_alt_tab_order && ! file_prefs.tab_order_ltr) @@ -1106,14 +1105,14 @@ static gboolean check_fixed_kb(guint keyval, guint state) return TRUE; } /* note: these are now overridden by default with move tab bindings */ - if (keyval == GDK_Page_Up || keyval == GDK_Page_Down) + if (keyval == GDK_KEY_Page_Up || keyval == GDK_KEY_Page_Down) { /* switch to first or last document */ if (state == (GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK)) { - if (keyval == GDK_Page_Up) + if (keyval == GDK_KEY_Page_Up) gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), 0); - if (keyval == GDK_Page_Down) + if (keyval == GDK_KEY_Page_Down) gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), -1); return TRUE; } @@ -1173,7 +1172,7 @@ static gboolean check_menu_key(GeanyDocument *doc, guint keyval, guint state, gu { g_return_val_if_fail(doc == NULL || doc->is_valid, FALSE); - if ((keyval == GDK_Menu && state == 0) || (keyval == GDK_F10 && state == GDK_SHIFT_MASK)) + if ((keyval == GDK_KEY_Menu && state == 0) || (keyval == GDK_KEY_F10 && state == GDK_SHIFT_MASK)) { GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); if (doc != NULL) @@ -1185,7 +1184,7 @@ static gboolean check_menu_key(GeanyDocument *doc, guint keyval, guint state, gu } if (focusw == GTK_WIDGET(doc->editor->sci)) { - if (keyval == GDK_Menu) + if (keyval == GDK_KEY_Menu) { /* show editor popup menu */ trigger_button_event(focusw, event_time); return TRUE; @@ -1233,14 +1232,14 @@ static gboolean check_vte(GdkModifierType state, guint keyval) if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != vc->vte) return FALSE; /* let VTE copy/paste override any user keybinding */ - if (state == (GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK) && (keyval == GDK_c || keyval == GDK_v)) + if (state == (GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK) && (keyval == GDK_KEY_c || keyval == GDK_KEY_v)) return TRUE; if (! vc->enable_bash_keys) return FALSE; /* prevent menubar flickering: */ - if (state == GDK_SHIFT_MASK && (keyval >= GDK_a && keyval <= GDK_z)) + if (state == GDK_SHIFT_MASK && (keyval >= GDK_KEY_a && keyval <= GDK_KEY_z)) return FALSE; - if (state == 0 && (keyval < GDK_F1 || keyval > GDK_F35)) /* e.g. backspace */ + if (state == 0 && (keyval < GDK_KEY_F1 || keyval > GDK_KEY_F35)) /* e.g. backspace */ return FALSE; /* make focus commands override any bash commands */ @@ -1271,26 +1270,26 @@ static guint key_kp_translate(guint key_in) { switch (key_in) { - case GDK_KP_Down: - return GDK_Down; - case GDK_KP_Up: - return GDK_Up; - case GDK_KP_Left: - return GDK_Left; - case GDK_KP_Right: - return GDK_Right; - case GDK_KP_Home: - return GDK_Home; - case GDK_KP_End: - return GDK_End; - case GDK_KP_Page_Up: - return GDK_Page_Up; - case GDK_KP_Page_Down: - return GDK_Page_Down; - case GDK_KP_Delete: - return GDK_Delete; - case GDK_KP_Insert: - return GDK_Insert; + case GDK_KEY_KP_Down: + return GDK_KEY_Down; + case GDK_KEY_KP_Up: + return GDK_KEY_Up; + case GDK_KEY_KP_Left: + return GDK_KEY_Left; + case GDK_KEY_KP_Right: + return GDK_KEY_Right; + case GDK_KEY_KP_Home: + return GDK_KEY_Home; + case GDK_KEY_KP_End: + return GDK_KEY_End; + case GDK_KEY_KP_Page_Up: + return GDK_KEY_Page_Up; + case GDK_KEY_KP_Page_Down: + return GDK_KEY_Page_Down; + case GDK_KEY_KP_Delete: + return GDK_KEY_Delete; + case GDK_KEY_KP_Insert: + return GDK_KEY_Insert; default: return key_in; } @@ -1307,12 +1306,12 @@ gboolean keybindings_check_event(GdkEventKey *ev, GeanyKeyBinding *kb) keyval = ev->keyval; state = keybindings_get_modifiers(ev->state); - /* hack to get around that CTRL+Shift+r results in GDK_R not GDK_r */ + /* hack to get around that CTRL+Shift+r results in GDK_KEY_R not GDK_KEY_r */ if ((ev->state & GDK_SHIFT_MASK) || (ev->state & GDK_LOCK_MASK)) - if (keyval >= GDK_A && keyval <= GDK_Z) - keyval += GDK_a - GDK_A; + if (keyval >= GDK_KEY_A && keyval <= GDK_KEY_Z) + keyval += GDK_KEY_a - GDK_KEY_A; - if (keyval >= GDK_KP_Space && keyval < GDK_KP_Equal) + if (keyval >= GDK_KEY_KP_Space && keyval < GDK_KEY_KP_Equal) keyval = key_kp_translate(keyval); return (keyval == kb->key && state == kb->mods); @@ -1366,12 +1365,12 @@ static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *ev, gpointer keyval = ev->keyval; state = keybindings_get_modifiers(ev->state); - /* hack to get around that CTRL+Shift+r results in GDK_R not GDK_r */ + /* hack to get around that CTRL+Shift+r results in GDK_KEY_R not GDK_KEY_r */ if ((ev->state & GDK_SHIFT_MASK) || (ev->state & GDK_LOCK_MASK)) - if (keyval >= GDK_A && keyval <= GDK_Z) - keyval += GDK_a - GDK_A; + if (keyval >= GDK_KEY_A && keyval <= GDK_KEY_Z) + keyval += GDK_KEY_a - GDK_KEY_A; - if (keyval >= GDK_KP_Space && keyval < GDK_KP_Equal) + if (keyval >= GDK_KEY_KP_Space && keyval < GDK_KEY_KP_Equal) keyval = key_kp_translate(keyval); /*geany_debug("%d (%d) %d (%d)", keyval, ev->keyval, state, ev->state);*/ @@ -2162,10 +2161,10 @@ static gboolean cb_func_editor_action(guint key_id) switch (kb->key) { - case GDK_space: + case GDK_KEY_space: sci_add_text(doc->editor->sci, " "); break; - case GDK_Tab: + case GDK_KEY_Tab: sci_send_command(doc->editor->sci, SCI_TAB); break; default: diff --git a/src/keybindings.h b/src/keybindings.h index 221c8864fc..6f9ecae6d7 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -73,7 +73,7 @@ typedef gboolean (*GeanyKeyBindingFunc)(GeanyKeyBinding *key, guint key_id, gpoi * Use keybindings_set_item() to set. */ struct GeanyKeyBinding { - guint key; /**< Key value in lower-case, such as @c GDK_a or 0 */ + guint key; /**< Key value in lower-case, such as @c GDK_KEY_a or 0 */ GdkModifierType mods; /**< Modifier keys, such as @c GDK_CONTROL_MASK or 0 */ gchar *name; /**< Key name for the configuration file, such as @c "menu_new" */ /** Label used in the preferences dialog keybindings tab. diff --git a/src/libmain.c b/src/libmain.c index d7c8d22733..7693555ab8 100644 --- a/src/libmain.c +++ b/src/libmain.c @@ -63,8 +63,6 @@ #include "win32.h" #include "osx.h" -#include "gtkcompat.h" - #include #include #include @@ -73,6 +71,7 @@ #include #include +#include #include #ifdef G_OS_UNIX @@ -1015,52 +1014,6 @@ static const gchar *get_locale(void) } -#if ! GTK_CHECK_VERSION(3, 0, 0) -/* This prepends our own gtkrc file to the list of RC files to be loaded by GTK at startup. - * This function *has* to be called before gtk_init(). - * - * We have a custom RC file defining various styles we need, and we want the user to be - * able to override them (e.g. if they want -- or need -- other colors). Fair enough, one - * would simply call gtk_rc_parse() with the appropriate filename. However, the styling - * rules applies in the order they are loaded, then if we load our styles after GTK has - * loaded the user's ones we'd override them. - * - * There are 2 solutions to fix this: - * 1) set our styles' priority to something with lower than "user" (actually "theme" - * priority because rules precedence are first calculated depending on the priority - * no matter of how precise the rules is, so we need to override the theme). - * 2) prepend our custom style to GTK's list while keeping priority to user (which is the - * default), so it gets loaded before real user's ones and so gets overridden by them. - * - * One would normally go for 1 because it's ways simpler and requires less code: you just - * have to add the priorities to your styles, which is a matter of adding a few ":theme" in - * the RC file. However, KDE being a bitch it doesn't set the gtk-theme-name but rather - * directly includes the style to use in a user gtkrc file, which makes the theme have - * "user" priority, hence overriding our styles. So, we cannot set priorities in the RC - * file if we want to support running under KDE, which pretty much leave us with no choice - * but to go with solution 2, which unfortunately requires writing ugly code since GTK - * don't have a gtk_rc_prepend_default_file() function. Thank you very much KDE. - * - * Though, as a side benefit it also makes the code work with people using gtk-chtheme, - * which also found it funny to include the theme in the user RC file. */ -static void setup_gtk2_styles(void) -{ - gchar **gtk_files = gtk_rc_get_default_files(); - gchar **new_files = g_malloc(sizeof *new_files * (g_strv_length(gtk_files) + 2)); - guint i = 0; - - new_files[i++] = g_build_filename(app->datadir, "geany.gtkrc", NULL); - for (; *gtk_files; gtk_files++) - new_files[i++] = g_strdup(*gtk_files); - new_files[i] = NULL; - - gtk_rc_set_default_files(new_files); - - g_strfreev(new_files); -} -#endif - - GEANY_EXPORT_SYMBOL gint main_lib(gint argc, gchar **argv) { @@ -1088,9 +1041,6 @@ gint main_lib(gint argc, gchar **argv) memset(&ui_widgets, 0, sizeof(UIWidgets)); setup_paths(); -#if ! GTK_CHECK_VERSION(3, 0, 0) - setup_gtk2_styles(); -#endif #ifdef ENABLE_NLS main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE); #endif diff --git a/src/log.c b/src/log.c index f6326457a2..578ec5ff92 100644 --- a/src/log.c +++ b/src/log.c @@ -33,7 +33,7 @@ #include "utils.h" #include "ui_utils.h" -#include "gtkcompat.h" +#include #ifdef HAVE_LOCALE_H # include diff --git a/src/msgwindow.c b/src/msgwindow.c index f1577760a8..a82fd41ffc 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -120,7 +120,6 @@ void msgwin_set_messages_dir(const gchar *messages_dir) static void load_color(const gchar *color_name, GdkColor *color) { -#if GTK_CHECK_VERSION(3, 0, 0) GdkRGBA rgba_color; GtkWidgetPath *path = gtk_widget_path_new(); GtkStyleContext *ctx = gtk_style_context_new(); @@ -137,15 +136,6 @@ static void load_color(const gchar *color_name, GdkColor *color) gtk_widget_path_unref(path); g_object_unref(ctx); -#else - gchar *path = g_strconcat("*.", color_name, NULL); - - GtkSettings *settings = gtk_settings_get_default(); - GtkStyle *style = gtk_rc_get_style_by_paths(settings, path, NULL, GTK_TYPE_WIDGET); - *color = style->fg[GTK_STATE_NORMAL]; - - g_free(path); -#endif } @@ -184,7 +174,7 @@ static gboolean on_msgwin_key_press_event(GtkWidget *widget, GdkEventKey *event, { gboolean enter_or_return = ui_is_keyval_enter_or_return(event->keyval); - if (enter_or_return || event->keyval == GDK_space) + if (enter_or_return || event->keyval == GDK_KEY_space) { switch (GPOINTER_TO_INT(data)) { diff --git a/src/navqueue.c b/src/navqueue.c index 21baf1eb7c..a4ada6932d 100644 --- a/src/navqueue.c +++ b/src/navqueue.c @@ -34,7 +34,7 @@ #include "toolbar.h" #include "utils.h" -#include "gtkcompat.h" +#include /* for the navigation history queue */ diff --git a/src/notebook.c b/src/notebook.c index a6f9d54372..f4e3724dfc 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -37,8 +37,7 @@ #include "ui_utils.h" #include "utils.h" -#include "gtkcompat.h" - +#include #include @@ -148,18 +147,18 @@ static gboolean is_modifier_key(guint keyval) { switch (keyval) { - case GDK_Shift_L: - case GDK_Shift_R: - case GDK_Control_L: - case GDK_Control_R: - case GDK_Meta_L: - case GDK_Meta_R: - case GDK_Alt_L: - case GDK_Alt_R: - case GDK_Super_L: - case GDK_Super_R: - case GDK_Hyper_L: - case GDK_Hyper_R: + case GDK_KEY_Shift_L: + case GDK_KEY_Shift_R: + case GDK_KEY_Control_L: + case GDK_KEY_Control_R: + case GDK_KEY_Meta_L: + case GDK_KEY_Meta_R: + case GDK_KEY_Alt_L: + case GDK_KEY_Alt_R: + case GDK_KEY_Super_L: + case GDK_KEY_Super_R: + case GDK_KEY_Hyper_L: + case GDK_KEY_Hyper_R: return TRUE; default: return FALSE; @@ -199,7 +198,7 @@ static GtkWidget *create_switch_dialog(void) gtk_window_set_decorated(GTK_WINDOW(dialog), FALSE); gtk_window_set_default_size(GTK_WINDOW(dialog), 200, -1); - vbox = gtk_vbox_new(FALSE, 6); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); gtk_container_add(GTK_CONTAINER(dialog), vbox); @@ -679,7 +678,7 @@ gint notebook_new_tab(GeanyDocument *this) g_return_val_if_fail(this != NULL, -1); /* page is packed into a vbox so we can stack infobars above it */ - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); page = GTK_WIDGET(this->editor->sci); gtk_box_pack_start(GTK_BOX(vbox), page, TRUE, TRUE, 0); @@ -694,7 +693,7 @@ gint notebook_new_tab(GeanyDocument *this) g_signal_connect_after(ebox, "button-release-event", G_CALLBACK(focus_sci), NULL); - hbox = gtk_hbox_new(FALSE, 2); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start(GTK_BOX(hbox), this->priv->tab_label, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(ebox), hbox); diff --git a/src/plugindata.h b/src/plugindata.h index 8fb0e35140..e0616dcb4f 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -60,13 +60,9 @@ G_BEGIN_DECLS */ #define GEANY_API_VERSION 239 -/* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins - * with GTK3-linked Geany leads to crash */ -#if GTK_CHECK_VERSION(3, 0, 0) -# define GEANY_ABI_SHIFT 8 -#else -# define GEANY_ABI_SHIFT 0 -#endif +/* hack to have a different ABI when built with different GTK major versions + * because loading plugins linked to a different one leads to crashes */ +#define GEANY_ABI_SHIFT 8 /** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. * Changing this forces all plugins to be recompiled before Geany can load them. */ diff --git a/src/pluginprivate.h b/src/pluginprivate.h index 4e9a204df4..26bcc9e7e8 100644 --- a/src/pluginprivate.h +++ b/src/pluginprivate.h @@ -26,8 +26,6 @@ #include "ui_utils.h" /* GeanyAutoSeparator */ #include "keybindings.h" /* GeanyKeyGroup */ -#include "gtkcompat.h" - G_BEGIN_DECLS diff --git a/src/plugins.c b/src/plugins.c index 52c847f082..cfc4efdf05 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -54,8 +54,7 @@ #include "utils.h" #include "win32.h" -#include "gtkcompat.h" - +#include #include @@ -1997,7 +1996,7 @@ static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data) pm_widgets.popup_help_menu_item = menu_item; /* put it together */ - vbox2 = gtk_vbox_new(FALSE, 6); + vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), filter_entry, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), swin, TRUE, TRUE, 0); diff --git a/src/pluginutils.c b/src/pluginutils.c index 1ce455365f..85d28dc844 100644 --- a/src/pluginutils.c +++ b/src/pluginutils.c @@ -395,7 +395,7 @@ static GtkWidget *create_pref_page(Plugin *p, GtkWidget *dialog) gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6); gtk_container_add(GTK_CONTAINER(align), page); - page = gtk_vbox_new(FALSE, 0); + page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(page), align, TRUE, TRUE, 0); } } diff --git a/src/prefs.c b/src/prefs.c index 5d1b5fc970..a5d4761217 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -57,10 +57,9 @@ #include "vte.h" #include "osx.h" -#include "gtkcompat.h" - #include #include +#include #include @@ -1420,7 +1419,7 @@ static gboolean kb_grab_key_dialog_key_press_cb(GtkWidget *dialog, GdkEventKey * state = keybindings_get_modifiers(event->state); - if (event->keyval == GDK_Escape) + if (event->keyval == GDK_KEY_Escape) return FALSE; /* close the dialog, don't allow escape when detecting keybindings. */ str = gtk_accelerator_name(event->keyval, state); diff --git a/src/printing.c b/src/printing.c index e974c6a856..6529e6825c 100644 --- a/src/printing.c +++ b/src/printing.c @@ -231,7 +231,7 @@ static GtkWidget *create_custom_widget(GtkPrintOperation *operation, gpointer us gtk_print_operation_set_custom_tab_label(operation, _("Document Setup")); - page = gtk_vbox_new(FALSE, 0); + page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(page), 5); w->check_print_linenumbers = gtk_check_button_new_with_mnemonic(_("Print line numbers")); @@ -259,7 +259,7 @@ static GtkWidget *create_custom_widget(GtkPrintOperation *operation, gpointer us gtk_container_add(GTK_CONTAINER(frame33), alignment36); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment36), 0, 0, 12, 0); - vbox30 = gtk_vbox_new(FALSE, 1); + vbox30 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); gtk_container_add(GTK_CONTAINER(alignment36), vbox30); w->check_print_basename = gtk_check_button_new_with_mnemonic(_("Use the basename of the printed file")); @@ -267,7 +267,7 @@ static GtkWidget *create_custom_widget(GtkPrintOperation *operation, gpointer us gtk_widget_set_tooltip_text(w->check_print_basename, _("Print only the basename(without the path) of the printed file")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_basename), printing_prefs.page_header_basename); - hbox10 = gtk_hbox_new(FALSE, 5); + hbox10 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_pack_start(GTK_BOX(vbox30), hbox10, TRUE, TRUE, 0); label203 = gtk_label_new(_("Date format:")); diff --git a/src/project.c b/src/project.c index 53cab8130a..0754b7d63d 100644 --- a/src/project.c +++ b/src/project.c @@ -195,7 +195,7 @@ void project_new(void) g_signal_connect(button, "clicked", G_CALLBACK(on_file_save_button_clicked), &e); image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON); gtk_container_add(GTK_CONTAINER(button), image); - bbox = gtk_hbox_new(FALSE, 6); + bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(bbox), e.file_name, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); diff --git a/src/search.c b/src/search.c index 82682ae330..7ec608d859 100644 --- a/src/search.c +++ b/src/search.c @@ -44,12 +44,11 @@ #include "ui_utils.h" #include "utils.h" -#include "gtkcompat.h" - #include #include #include +#include #include enum @@ -332,7 +331,7 @@ static GtkWidget *add_find_checkboxes(GtkDialog *dialog) "of the input and can be captured as normal characters by the pattern.")); /* Search features */ - fbox = gtk_vbox_new(FALSE, 0); + fbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(fbox), check_regexp, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(fbox), check_multiline, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(fbox), checkbox7, FALSE, FALSE, 0); @@ -362,12 +361,13 @@ static GtkWidget *add_find_checkboxes(GtkDialog *dialog) G_CALLBACK(on_widget_toggled_set_insensitive), checkbox5); /* Matching options */ - mbox = gtk_vbox_new(FALSE, 0); + mbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(mbox), checkbox1, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(mbox), checkbox2, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(mbox), checkbox5, FALSE, FALSE, 0); - hbox = gtk_hbox_new(TRUE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE); gtk_container_add(GTK_CONTAINER(hbox), fbox); gtk_container_add(GTK_CONTAINER(hbox), mbox); return hbox; @@ -497,7 +497,7 @@ static void create_find_dialog(void) g_signal_connect(find_dlg.dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); - sbox = gtk_hbox_new(FALSE, 6); + sbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(sbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(sbox), entry, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), sbox, TRUE, FALSE, 0); @@ -511,7 +511,7 @@ static void create_find_dialog(void) g_signal_connect_after(exp, "activate", G_CALLBACK(on_expander_activated), &find_dlg.all_expanded); - bbox = gtk_hbutton_box_new(); + bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); button = gtk_button_new_with_mnemonic(_("_Mark")); gtk_widget_set_tooltip_text(button, @@ -600,7 +600,7 @@ static void send_replace_dialog_response(GtkButton *button, gpointer user_data) static gboolean on_widget_key_pressed_set_focus(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { - if (event->keyval == GDK_Tab) + if (event->keyval == GDK_KEY_Tab) { gtk_widget_grab_focus(GTK_WIDGET(user_data)); return TRUE; @@ -669,11 +669,11 @@ static void create_replace_dialog(void) g_signal_connect(replace_dlg.dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); - fbox = gtk_hbox_new(FALSE, 6); + fbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(fbox), label_find, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(fbox), replace_dlg.find_combobox, TRUE, TRUE, 0); - rbox = gtk_hbox_new(FALSE, 6); + rbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(rbox), label_replace, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(rbox), replace_dlg.replace_combobox, TRUE, TRUE, 0); @@ -693,7 +693,7 @@ static void create_replace_dialog(void) g_signal_connect_after(exp, "activate", G_CALLBACK(on_expander_activated), &replace_dlg.all_expanded); - bbox = gtk_hbutton_box_new(); + bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); button = gtk_button_new_with_mnemonic(_("In Sessi_on")); gtk_container_add(GTK_CONTAINER(bbox), button); @@ -886,7 +886,7 @@ static void create_fif_dialog(void) gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); fif_dlg.search_combo = combo; - sbox = gtk_hbox_new(FALSE, 6); + sbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(sbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(sbox), combo, TRUE, TRUE, 0); @@ -914,7 +914,7 @@ static void create_fif_dialog(void) /* update the entry when selection is changed */ g_signal_connect(combo_files_mode, "changed", G_CALLBACK(update_file_patterns), fcombo); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), label3, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), combo_files_mode, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), fcombo, TRUE, TRUE, 0); @@ -945,7 +945,7 @@ static void create_fif_dialog(void) gtk_label_set_mnemonic_widget(GTK_LABEL(label2), e_combo); fif_dlg.encoding_combo = e_combo; - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label2, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), e_combo, TRUE, TRUE, 0); @@ -983,17 +983,17 @@ static void create_fif_dialog(void) gtk_widget_set_tooltip_text(checkbox2, _("Invert the sense of matching, to select non-matching lines")); - lbox = gtk_vbox_new(FALSE, 0); + lbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(lbox), check_regexp); gtk_container_add(GTK_CONTAINER(lbox), checkbox2); gtk_container_add(GTK_CONTAINER(lbox), check_recursive); - rbox = gtk_vbox_new(FALSE, 0); + rbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(rbox), checkbox1); gtk_container_add(GTK_CONTAINER(rbox), check_wholeword); gtk_container_add(GTK_CONTAINER(rbox), gtk_label_new(NULL)); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add(GTK_CONTAINER(hbox), lbox); gtk_container_add(GTK_CONTAINER(hbox), rbox); gtk_container_add(GTK_CONTAINER(vbox), hbox); @@ -1013,7 +1013,7 @@ static void create_fif_dialog(void) g_signal_connect(check_extra, "toggled", G_CALLBACK(on_widget_toggled_set_sensitive), entry_extra); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), check_extra, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), entry_extra, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(vbox), hbox); diff --git a/src/sidebar.c b/src/sidebar.c index 6032fb77cb..8f9ce231fc 100644 --- a/src/sidebar.c +++ b/src/sidebar.c @@ -600,24 +600,14 @@ void sidebar_add_common_menu_items(GtkMenu *menu) item = gtk_check_menu_item_new_with_mnemonic(_("Show S_ymbol List")); gtk_container_add(GTK_CONTAINER(menu), item); -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(item, "draw", G_CALLBACK(on_sidebar_display_symbol_list_show), NULL); -#else - g_signal_connect(item, "expose-event", - G_CALLBACK(on_sidebar_display_symbol_list_show), NULL); -#endif gtk_widget_show(item); g_signal_connect(item, "activate", G_CALLBACK(on_list_symbol_activate), NULL); item = gtk_check_menu_item_new_with_mnemonic(_("Show _Document List")); gtk_container_add(GTK_CONTAINER(menu), item); -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(item, "draw", G_CALLBACK(on_sidebar_display_open_files_show), NULL); -#else - g_signal_connect(item, "expose-event", - G_CALLBACK(on_sidebar_display_open_files_show), NULL); -#endif gtk_widget_show(item); g_signal_connect(item, "activate", G_CALLBACK(on_list_document_activate), NULL); @@ -889,7 +879,7 @@ static gboolean openfiles_go_to_selection(GtkTreeSelection *selection, guint key /* switch to the doc and grab the focus */ document_show_tab(doc); - if (keyval != GDK_space) + if (keyval != GDK_KEY_space) change_focus_to_editor(doc, tv.tree_openfiles); } return FALSE; @@ -920,7 +910,7 @@ static gboolean taglist_go_to_selection(GtkTreeSelection *selection, guint keyva { navqueue_goto_line(doc, doc, line); state = keybindings_get_modifiers(state); - if (keyval != GDK_space && ! (state & GEANY_PRIMARY_MOD_MASK)) + if (keyval != GDK_KEY_space && ! (state & GEANY_PRIMARY_MOD_MASK)) change_focus_to_editor(doc, NULL); else handled = FALSE; @@ -936,7 +926,7 @@ static gboolean sidebar_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { may_steal_focus = FALSE; - if (ui_is_keyval_enter_or_return(event->keyval) || event->keyval == GDK_space) + if (ui_is_keyval_enter_or_return(event->keyval) || event->keyval == GDK_KEY_space) { GtkWidgetClass *widget_class = GTK_WIDGET_GET_CLASS(widget); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); diff --git a/src/socket.c b/src/socket.c index 26e23c8c42..6431bd48c0 100644 --- a/src/socket.c +++ b/src/socket.c @@ -67,7 +67,7 @@ #include "utils.h" #include "win32.h" -#include "gtkcompat.h" +#include #ifndef G_OS_WIN32 @@ -722,12 +722,8 @@ gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpoint #ifdef G_OS_WIN32 else if (strncmp(buf, "window", 6) == 0) { -# if GTK_CHECK_VERSION(3, 0, 0) HWND hwnd = (HWND) gdk_win32_window_get_handle(gtk_widget_get_window(window)); -# else - HWND hwnd = (HWND) gdk_win32_drawable_get_handle( - GDK_DRAWABLE(gtk_widget_get_window(window))); -# endif + socket_fd_write(sock, (gchar *)&hwnd, sizeof(hwnd)); } #endif @@ -742,9 +738,7 @@ gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpoint * gtk_window_present() really bring the main window into the foreground on some * window managers like Gnome's metacity. * Code taken from Gedit. */ -# if GTK_CHECK_VERSION(3, 0, 0) if (GDK_IS_X11_WINDOW(x11_window)) -# endif { gdk_x11_window_set_user_time(x11_window, gdk_x11_get_server_time(x11_window)); } diff --git a/src/stash.c b/src/stash.c index f056e7deb8..713615536a 100644 --- a/src/stash.c +++ b/src/stash.c @@ -85,10 +85,7 @@ /* GTK3 removed ComboBoxEntry, but we need a value to differentiate combo box with and * without entries, and it must not collide with other GTypes */ -#ifdef GTK_TYPE_COMBO_BOX_ENTRY -# define TYPE_COMBO_BOX_ENTRY GTK_TYPE_COMBO_BOX_ENTRY -#else /* !GTK_TYPE_COMBO_BOX_ENTRY */ -# define TYPE_COMBO_BOX_ENTRY get_combo_box_entry_type() +#define TYPE_COMBO_BOX_ENTRY get_combo_box_entry_type() static GType get_combo_box_entry_type(void) { static volatile gsize type = 0; @@ -100,7 +97,6 @@ static GType get_combo_box_entry_type(void) } return type; } -#endif /* !GTK_TYPE_COMBO_BOX_ENTRY */ struct StashPref diff --git a/src/symbols.c b/src/symbols.c index a54b6ef4c2..49a1d33d96 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -56,11 +56,10 @@ #include "SciLexer.h" -#include "gtkcompat.h" - #include #include #include +#include typedef struct @@ -1905,11 +1904,7 @@ static void goto_popup_position_func(GtkMenu *menu, gint *x, gint *y, gboolean * monitor_num = gdk_screen_get_monitor_at_point(screen, *x, *y); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_get_preferred_size(GTK_WIDGET(menu), NULL, &req); -#else - gtk_widget_size_request(GTK_WIDGET(menu), &req); -#endif #if GTK_CHECK_VERSION(3, 4, 0) gdk_screen_get_monitor_workarea(screen, monitor_num, &monitor); diff --git a/src/templates.c b/src/templates.c index 11193a430d..639cce06c2 100644 --- a/src/templates.c +++ b/src/templates.c @@ -42,10 +42,9 @@ #include "ui_utils.h" #include "utils.h" -#include "gtkcompat.h" - #include #include +#include GeanyTemplatePrefs template_prefs; diff --git a/src/toolbar.c b/src/toolbar.c index 1501e1bc03..7de7c5224d 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -398,9 +398,7 @@ GtkWidget *toolbar_init(void) gtk_ui_manager_insert_action_group(uim, group, 0); toolbar = toolbar_reload(NULL); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_style_context_add_class(gtk_widget_get_style_context(toolbar), "primary-toolbar"); -#endif gtk_settings = gtk_widget_get_settings(GTK_WIDGET(toolbar)); if (gtk_settings != NULL) @@ -1031,14 +1029,14 @@ static TBEditorWidget *tb_editor_create_dialog(GtkWindow *parent) g_signal_connect(button_add, "clicked", G_CALLBACK(tb_editor_btn_add_clicked_cb), tbw); g_signal_connect(button_remove, "clicked", G_CALLBACK(tb_editor_btn_remove_clicked_cb), tbw); - vbox_buttons = gtk_vbox_new(FALSE, 6); + vbox_buttons = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); /* FIXME this is a little hack'ish, any better ideas? */ gtk_box_pack_start(GTK_BOX(vbox_buttons), gtk_label_new(""), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_buttons), button_add, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_buttons), button_remove, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_buttons), gtk_label_new(""), TRUE, TRUE, 0); - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), swin_available, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox_buttons, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), swin_used, TRUE, TRUE, 0); diff --git a/src/tools.c b/src/tools.c index 6365a201a0..5f9e5c74d3 100644 --- a/src/tools.c +++ b/src/tools.c @@ -38,12 +38,11 @@ #include "utils.h" #include "win32.h" -#include "gtkcompat.h" - #include #include #include #include +#include enum @@ -427,7 +426,7 @@ static void cc_show_dialog_custom_commands(void) } } - buttonbox = gtk_hbutton_box_new(); + buttonbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_set_spacing(GTK_BOX(buttonbox), 6); gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0); cc.button_add = gtk_button_new_from_stock(GTK_STOCK_ADD); diff --git a/src/ui_utils.c b/src/ui_utils.c index 18aeabd13c..b6c7bf276f 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -51,11 +51,10 @@ #include "win32.h" #include "osx.h" -#include "gtkcompat.h" - #include #include #include +#include #include @@ -1499,7 +1498,7 @@ GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alig GEANY_API_SYMBOL GtkWidget *ui_dialog_vbox_new(GtkDialog *dialog) { - GtkWidget *vbox = gtk_vbox_new(FALSE, 12); /* need child vbox to set a separate border. */ + GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); /* need child vbox to set a separate border. */ gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox, TRUE, TRUE, 0); @@ -1634,7 +1633,7 @@ void ui_entry_add_activate_backward_signal(GtkEntry *entry) G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); binding_set = gtk_binding_set_by_class(GTK_ENTRY_GET_CLASS(entry)); - gtk_binding_entry_add_signal(binding_set, GDK_Return, GDK_SHIFT_MASK, "activate-backward", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Return, GDK_SHIFT_MASK, "activate-backward", 0); } } @@ -1919,11 +1918,11 @@ GtkWidget *ui_path_box_new(const gchar *title, GtkFileChooserAction action, GtkE { GtkWidget *vbox, *dirbtn, *openimg, *hbox, *path_entry, *parent, *next_parent; - hbox = gtk_hbox_new(FALSE, 6); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); path_entry = GTK_WIDGET(entry); /* prevent path_entry being vertically stretched to the height of dirbtn */ - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); parent = path_entry; while ((next_parent = gtk_widget_get_parent(parent)) != NULL) @@ -2505,7 +2504,6 @@ void ui_init_builder(void) } -#if GTK_CHECK_VERSION(3, 0, 0) static void load_css_theme(const gchar *fn, guint priority) { GtkCssProvider *provider = gtk_css_provider_new(); @@ -2526,7 +2524,6 @@ static void load_css_theme(const gchar *fn, guint priority) } -// see setup_gtk2_styles() in libmain.c for GTK+ 2-specific theme initialization static void init_css_styles(void) { gchar *theme_fn; @@ -2576,14 +2573,11 @@ static void add_css_config_file_item(void) ui_add_config_file_menu_item(theme_fn, NULL, NULL); g_free(theme_fn); } -#endif // GTK3 void ui_init(void) { -#if GTK_CHECK_VERSION(3, 0, 0) init_css_styles(); -#endif init_recent_files(); @@ -2632,9 +2626,7 @@ void ui_init(void) init_document_widgets(); create_config_files_menu(); -#if GTK_CHECK_VERSION(3, 0, 0) add_css_config_file_item(); -#endif } @@ -3009,7 +3001,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, /** Checks whether the passed @a keyval is the Enter or Return key. * There are three different Enter/Return key values - * (@c GDK_Return, @c GDK_ISO_Enter, @c GDK_KP_Enter). + * (@c GDK_KEY_Return, @c GDK_KEY_ISO_Enter, @c GDK_KEY_KP_Enter). * This is just a convenience function. * @param keyval A keyval. * @return @c TRUE if @a keyval is the one of the Enter/Return key values, otherwise @c FALSE. @@ -3017,7 +3009,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, GEANY_API_SYMBOL gboolean ui_is_keyval_enter_or_return(guint keyval) { - return (keyval == GDK_Return || keyval == GDK_ISO_Enter|| keyval == GDK_KP_Enter); + return (keyval == GDK_KEY_Return || keyval == GDK_KEY_ISO_Enter|| keyval == GDK_KEY_KP_Enter); } diff --git a/src/vte.c b/src/vte.c index ec8c5df378..4f3519e5b9 100644 --- a/src/vte.c +++ b/src/vte.c @@ -41,14 +41,13 @@ #include "utils.h" #include "keybindings.h" -#include "gtkcompat.h" - /* include stdlib.h AND unistd.h, because on GNU/Linux pid_t seems to be * in stdlib.h, on FreeBSD in unistd.h, sys/types.h is needed for C89 */ #include #include #include +#include #include #include #include @@ -132,12 +131,10 @@ struct VteFunctions void (*vte_terminal_select_all) (VteTerminal *terminal); void (*vte_terminal_set_audible_bell) (VteTerminal *terminal, gboolean is_audible); GtkAdjustment* (*vte_terminal_get_adjustment) (VteTerminal *terminal); -#if GTK_CHECK_VERSION(3, 0, 0) /* hack for the VTE 2.91 API using GdkRGBA: we wrap the API to keep using GdkColor on our side */ void (*vte_terminal_set_color_foreground_rgba) (VteTerminal *terminal, const GdkRGBA *foreground); void (*vte_terminal_set_color_bold_rgba) (VteTerminal *terminal, const GdkRGBA *foreground); void (*vte_terminal_set_color_background_rgba) (VteTerminal *terminal, const GdkRGBA *background); -#endif }; @@ -183,16 +180,13 @@ static const GtkTargetEntry dnd_targets[] = /* replacement for vte_terminal_get_adjustment() when it's not available */ static GtkAdjustment *default_vte_terminal_get_adjustment(VteTerminal *vte) { -#if GTK_CHECK_VERSION(3, 0, 0) if (GTK_IS_SCROLLABLE(vte)) return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(vte)); -#endif /* this is only valid in < 0.38, 0.38 broke ABI */ return vte->adjustment; } -#if GTK_CHECK_VERSION(3, 0, 0) /* Wrap VTE 2.91 API using GdkRGBA with GdkColor so we use a single API on our side */ static void rgba_from_color(GdkRGBA *rgba, const GdkColor *color) @@ -203,7 +197,7 @@ static void rgba_from_color(GdkRGBA *rgba, const GdkColor *color) rgba->alpha = 1.0; } -# define WRAP_RGBA_SETTER(name) \ +#define WRAP_RGBA_SETTER(name) \ static void wrap_##name(VteTerminal *terminal, const GdkColor *color) \ { \ GdkRGBA rgba; \ @@ -215,8 +209,7 @@ WRAP_RGBA_SETTER(vte_terminal_set_color_background) WRAP_RGBA_SETTER(vte_terminal_set_color_bold) WRAP_RGBA_SETTER(vte_terminal_set_color_foreground) -# undef WRAP_RGBA_SETTER -#endif +#undef WRAP_RGBA_SETTER static gchar **vte_get_child_environment(void) @@ -274,19 +267,12 @@ void vte_init(void) { gint i; const gchar *sonames[] = { -#if GTK_CHECK_VERSION(3, 0, 0) -# ifdef __APPLE__ +#ifdef __APPLE__ "libvte-2.91.0.dylib", "libvte-2.91.dylib", "libvte2_90.9.dylib", "libvte2_90.dylib", -# endif +#endif "libvte-2.91.so", "libvte-2.91.so.0", "libvte2_90.so", "libvte2_90.so.9", -#else /* GTK 2 */ -# ifdef __APPLE__ - "libvte.9.dylib", "libvte.dylib", -# endif - "libvte.so", "libvte.so.9", "libvte.so.8", "libvte.so.4", -#endif NULL }; @@ -350,14 +336,14 @@ static void create_vte(void) GtkWidget *vte, *scrollbar, *hbox; vc->vte = vte = vf->vte_terminal_new(); - scrollbar = gtk_vscrollbar_new(vf->vte_terminal_get_adjustment(VTE_TERMINAL(vte))); + scrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, vf->vte_terminal_get_adjustment(VTE_TERMINAL(vte))); gtk_widget_set_can_focus(scrollbar, FALSE); /* create menu now so copy/paste shortcuts work */ vc->menu = vte_create_popup_menu(); g_object_ref_sink(vc->menu); - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vte, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0); @@ -446,7 +432,7 @@ static void set_clean(gboolean value) static gboolean vte_keyrelease_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (ui_is_keyval_enter_or_return(event->keyval) || - ((event->keyval == GDK_c) && (event->state & GDK_CONTROL_MASK))) + ((event->keyval == GDK_KEY_c) && (event->state & GDK_CONTROL_MASK))) { /* assume any text on the prompt has been executed when pressing Enter/Return */ set_clean(TRUE); @@ -463,10 +449,10 @@ static gboolean vte_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer if (event->type != GDK_KEY_RELEASE) return FALSE; - if ((event->keyval == GDK_c || - event->keyval == GDK_d || - event->keyval == GDK_C || - event->keyval == GDK_D) && + if ((event->keyval == GDK_KEY_c || + event->keyval == GDK_KEY_d || + event->keyval == GDK_KEY_C || + event->keyval == GDK_KEY_D) && event->state & GDK_CONTROL_MASK && ! (event->state & GDK_SHIFT_MASK) && ! (event->state & GDK_MOD1_MASK)) { @@ -558,7 +544,6 @@ static void vte_set_cursor_blink_mode(void) } -#if GTK_CHECK_VERSION(3, 0, 0) static gboolean vte_is_2_91(void) { guint major = vf->vte_get_major_version ? vf->vte_get_major_version() : 0; @@ -569,7 +554,6 @@ static gboolean vte_is_2_91(void) /* 0.38 doesn't have runtime version checks, so check a symbol that didn't exist before */ vf->vte_terminal_spawn_sync != NULL); } -#endif static gboolean vte_register_symbols(GModule *mod) @@ -616,7 +600,6 @@ static gboolean vte_register_symbols(GModule *mod) BIND_REQUIRED_SYMBOL(vte_terminal_get_has_selection); BIND_REQUIRED_SYMBOL(vte_terminal_copy_clipboard); BIND_REQUIRED_SYMBOL(vte_terminal_paste_clipboard); -#if GTK_CHECK_VERSION(3, 0, 0) if (vte_is_2_91()) { BIND_REQUIRED_SYMBOL_RGBA_WRAPPED(vte_terminal_set_color_foreground); @@ -624,7 +607,6 @@ static gboolean vte_register_symbols(GModule *mod) BIND_REQUIRED_SYMBOL_RGBA_WRAPPED(vte_terminal_set_color_background); } else -#endif { BIND_REQUIRED_SYMBOL(vte_terminal_set_color_foreground); BIND_REQUIRED_SYMBOL(vte_terminal_set_color_bold); @@ -738,14 +720,14 @@ static GtkWidget *vte_create_popup_menu(void) item = gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, NULL); gtk_widget_add_accelerator(item, "activate", accel_group, - GDK_c, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); + GDK_KEY_c, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_COPY)); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PASTE, NULL); gtk_widget_add_accelerator(item, "activate", accel_group, - GDK_v, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); + GDK_KEY_v, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_PASTE));