diff options
32 files changed, 508 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index 2cae9044..639c6fb9 100644 --- a/configure.ac +++ b/configure.ac @@ -182,7 +182,6 @@ PKG_CHECK_MODULES(PLUMA, [ gio-2.0 >= 2.26.0 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gtksourceview-$GTK_API_VERSION >= 2.9.7 - mate-desktop-2.0 >= 1.9.0 ]) PKG_CHECK_MODULES(X11, [x11]) @@ -199,6 +198,28 @@ AC_SUBST(EGG_SMCLIENT_CFLAGS) AC_SUBST(EGG_SMCLIENT_LIBS) dnl ================================================================ +dnl Mate-desktop support +dnl ================================================================ + +MATEDESKTOP_REQUIRED=1.9.0 + +AC_ARG_WITH(matedesktop, + [AS_HELP_STRING([--without-matedesktop], + [Disable the use of matedesktop])], + [], + [with_matedesktop=yes]) + +AM_CONDITIONAL([WITH_MATEDESKTOP],[test "$with_matedesktop" = "yes"]) + +if test "$with_matedesktop" = "yes"; then + PKG_CHECK_MODULES([MATE_DESKTOP], mate-desktop-2.0 >= $MATEDESKTOP_REQUIRED) + AC_DEFINE([WITH_MATEDESKTOP],[1],[Define if mate-desktop support is enabled]) +fi + +AC_SUBST([MATE_DESKTOP_CFLAGS]) +AC_SUBST([MATE_DESKTOP_LIBS]) + +dnl ================================================================ dnl GSettings related settings dnl ================================================================ @@ -420,6 +441,7 @@ Configuration: Source code location: ${srcdir} Compiler: ${CC} GTK API version: $GTK_API_VERSION + MATE desktop Support: $with_matedesktop Python Plugins Support: $enable_python Spell Plugin enabled: $enable_enchant Gvfs metadata enabled: $enable_gvfs_metadata diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index 6a5c3891..7cef34cc 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -50,6 +50,10 @@ #define XML_UI_FILE "pluma-file-browser-widget-ui.xml" #define LOCATION_DATA_KEY "pluma-file-browser-widget-location" +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + enum { BOOKMARKS_ID, @@ -236,8 +240,13 @@ static void on_action_filter_binary (GtkAction * action, static void on_action_bookmark_open (GtkAction * action, PlumaFileBrowserWidget * obj); +#if GTK_CHECK_VERSION (3, 0, 0) +PLUMA_PLUGIN_DEFINE_TYPE (PlumaFileBrowserWidget, pluma_file_browser_widget, + GTK_TYPE_BOX) +#else PLUMA_PLUGIN_DEFINE_TYPE (PlumaFileBrowserWidget, pluma_file_browser_widget, GTK_TYPE_VBOX) +#endif static void free_name_icon (gpointer data) @@ -1263,7 +1272,11 @@ pluma_file_browser_widget_init (PlumaFileBrowserWidget * obj) free_name_icon); gtk_box_set_spacing (GTK_BOX (obj), 3); - +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), + GTK_ORIENTATION_VERTICAL); +#endif + #if GTK_CHECK_VERSION (3, 16, 0) display = gtk_widget_get_display (GTK_WIDGET (obj)); obj->priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); diff --git a/plugins/filebrowser/pluma-file-browser-widget.h b/plugins/filebrowser/pluma-file-browser-widget.h index 79e95c62..d7be9e4d 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.h +++ b/plugins/filebrowser/pluma-file-browser-widget.h @@ -48,14 +48,22 @@ gboolean (*PlumaFileBrowserWidgetFilterFunc) (PlumaFileBrowserWidget * obj, struct _PlumaFileBrowserWidget { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkVBox parent; +#endif PlumaFileBrowserWidgetPrivate *priv; }; struct _PlumaFileBrowserWidgetClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif /* Signals */ void (*uri_activated) (PlumaFileBrowserWidget * widget, diff --git a/plugins/spell/pluma-automatic-spell-checker.c b/plugins/spell/pluma-automatic-spell-checker.c index d3644445..f4de8835 100755 --- a/plugins/spell/pluma-automatic-spell-checker.c +++ b/plugins/spell/pluma-automatic-spell-checker.c @@ -454,7 +454,11 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) label = gtk_label_new (label_text); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); +#endif mi = gtk_menu_item_new (); gtk_container_add (GTK_CONTAINER(mi), label); diff --git a/plugins/taglist/pluma-taglist-plugin-panel.c b/plugins/taglist/pluma-taglist-plugin-panel.c index 682bedd6..13e5a83a 100755 --- a/plugins/taglist/pluma-taglist-plugin-panel.c +++ b/plugins/taglist/pluma-taglist-plugin-panel.c @@ -69,7 +69,11 @@ struct _PlumaTaglistPluginPanelPrivate gchar *data_dir; }; +#if GTK_CHECK_VERSION (3, 0, 0) +PLUMA_PLUGIN_DEFINE_TYPE (PlumaTaglistPluginPanel, pluma_taglist_plugin_panel, GTK_TYPE_BOX) +#else PLUMA_PLUGIN_DEFINE_TYPE (PlumaTaglistPluginPanel, pluma_taglist_plugin_panel, GTK_TYPE_VBOX) +#endif enum { @@ -641,8 +645,17 @@ add_preview_widget (PlumaTaglistPluginPanel *panel) gtk_label_set_line_wrap (GTK_LABEL (panel->priv->preview), TRUE); gtk_label_set_use_markup (GTK_LABEL (panel->priv->preview), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (panel->priv->preview, GTK_ALIGN_START); + gtk_widget_set_valign (panel->priv->preview, GTK_ALIGN_START); + gtk_widget_set_margin_start (panel->priv->preview, 6); + gtk_widget_set_margin_end (panel->priv->preview, 6); + gtk_widget_set_margin_top (panel->priv->preview, 6); + gtk_widget_set_margin_bottom (panel->priv->preview, 6); +#else gtk_misc_set_alignment (GTK_MISC (panel->priv->preview), 0, 0); - gtk_misc_set_padding (GTK_MISC (panel->priv->preview), 6, 6); + gtk_misc_set_padding (GTK_MISC (panel->priv->preview), 6, 6); +#endif gtk_label_set_selectable (GTK_LABEL (panel->priv->preview), TRUE); gtk_label_set_selectable (GTK_LABEL (panel->priv->preview), TRUE); gtk_label_set_ellipsize (GTK_LABEL (panel->priv->preview), @@ -675,6 +688,11 @@ pluma_taglist_plugin_panel_init (PlumaTaglistPluginPanel *panel) panel->priv = PLUMA_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel); panel->priv->data_dir = NULL; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), + GTK_ORIENTATION_VERTICAL); +#endif + /* Build the window content */ panel->priv->tag_groups_combo = gtk_combo_box_text_new (); gtk_box_pack_start (GTK_BOX (panel), diff --git a/plugins/taglist/pluma-taglist-plugin-panel.h b/plugins/taglist/pluma-taglist-plugin-panel.h index bcd42ed4..03738835 100755 --- a/plugins/taglist/pluma-taglist-plugin-panel.h +++ b/plugins/taglist/pluma-taglist-plugin-panel.h @@ -58,7 +58,11 @@ typedef struct _PlumaTaglistPluginPanel PlumaTaglistPluginPanel; struct _PlumaTaglistPluginPanel { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox vbox; +#else GtkVBox vbox; +#endif /*< private > */ PlumaTaglistPluginPanelPrivate *priv; @@ -71,7 +75,11 @@ typedef struct _PlumaTaglistPluginPanelClass PlumaTaglistPluginPanelClass; struct _PlumaTaglistPluginPanelClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif }; /* diff --git a/pluma/Makefile.am b/pluma/Makefile.am index 01914351..13a03742 100644 --- a/pluma/Makefile.am +++ b/pluma/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS = \ -I$(srcdir) \ -I$(srcdir)/smclient \ $(PLUMA_CFLAGS) \ + $(MATE_DESKTOP_CFLAGS) \ $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ -DDATADIR=\""$(datadir)"\" \ @@ -26,7 +27,8 @@ libpluma_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_ libpluma_la_LIBADD = \ dialogs/libdialogs.la \ - smclient/libeggsmclient.la + smclient/libeggsmclient.la \ + $(MATE_DESKTOP_LIBS) # PLUMA_LIBS must be the last to ensure correct order on some platforms libpluma_la_LIBADD += $(PLUMA_LIBS) -lICE diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.c b/pluma/dialogs/pluma-close-confirmation-dialog.c index 155fe499..45d97713 100755 --- a/pluma/dialogs/pluma-close-confirmation-dialog.c +++ b/pluma/dialogs/pluma-close-confirmation-dialog.c @@ -85,6 +85,11 @@ struct _PlumaCloseConfirmationDialogPrivate (priv->unsaved_documents->next == NULL)) ? \ SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + G_DEFINE_TYPE(PlumaCloseConfirmationDialog, pluma_close_confirmation_dialog, GTK_TYPE_DIALOG) static void set_unsaved_document (PlumaCloseConfirmationDialog *dlg, @@ -497,15 +502,28 @@ build_single_doc_dialog (PlumaCloseConfirmationDialog *dlg) doc = PLUMA_DOCUMENT (dlg->priv->unsaved_documents->data); /* Image */ +#if GTK_CHECK_VERSION (3, 10, 0) + image = gtk_image_new_from_icon_name ("dialog-warning", + GTK_ICON_SIZE_DIALOG); +#else image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); +#endif +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); +#endif /* Primary label */ primary_label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5); +#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); gtk_widget_set_can_focus (GTK_WIDGET (primary_label), FALSE); @@ -538,7 +556,11 @@ build_single_doc_dialog (PlumaCloseConfirmationDialog *dlg) secondary_label = gtk_label_new (str); g_free (str); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5); +#endif gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); gtk_widget_set_can_focus (GTK_WIDGET (secondary_label), FALSE); @@ -682,9 +704,18 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) hbox, TRUE, TRUE, 0); /* Image */ +#if GTK_CHECK_VERSION (3, 10, 0) + image = gtk_image_new_from_icon_name ("dialog-warning", + GTK_ICON_SIZE_DIALOG); +#else image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); +#endif +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); +#endif gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 12); @@ -694,7 +725,11 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) primary_label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5); +#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); if (priv->disable_save_to_disk) @@ -729,7 +764,11 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) gtk_box_pack_start (GTK_BOX (vbox2), select_label, FALSE, FALSE, 0); gtk_label_set_line_wrap (GTK_LABEL (select_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (select_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (select_label), 0.0, 0.5); +#endif scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0); @@ -751,7 +790,11 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) gtk_box_pack_start (GTK_BOX (vbox2), secondary_label, FALSE, FALSE, 0); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); gtk_label_set_mnemonic_widget (GTK_LABEL (select_label), treeview); diff --git a/pluma/pluma-close-button.c b/pluma/pluma-close-button.c index ab6ef4a5..be0cc421 100644 --- a/pluma/pluma-close-button.c +++ b/pluma/pluma-close-button.c @@ -30,8 +30,12 @@ pluma_close_button_style_set (GtkWidget *button, { gint h, w; +#if GTK_CHECK_VERSION (3, 10, 0) + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h); +#else gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button), GTK_ICON_SIZE_MENU, &w, &h); +#endif gtk_widget_set_size_request (button, w + 2, h + 2); diff --git a/pluma/pluma-commands-help.c b/pluma/pluma-commands-help.c index 2a94063e..1f69a58e 100644 --- a/pluma/pluma-commands-help.c +++ b/pluma/pluma-commands-help.c @@ -37,7 +37,9 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> +#ifdef WITH_MATEDESKTOP #include <libmate-desktop/mate-aboutdialog.h> +#endif #include "pluma-commands.h" #include "pluma-debug.h" @@ -85,8 +87,13 @@ void _pluma_cmd_help_about(GtkAction* action, PlumaWindow* window) pluma_debug (DEBUG_COMMANDS); +#ifdef WITH_MATEDESKTOP mate_show_about_dialog(GTK_WINDOW(window), +#else + gtk_show_about_dialog(GTK_WINDOW(window), +#endif "program-name", "Pluma", + "authors", authors, "comments", _(comments), "copyright", copyright, diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c index f99d9f43..f311b05a 100644 --- a/pluma/pluma-document.c +++ b/pluma/pluma-document.c @@ -2246,9 +2246,15 @@ _pluma_document_get_seconds_since_last_save_or_load (PlumaDocument *doc) static void get_search_match_colors (PlumaDocument *doc, gboolean *foreground_set, +#if GTK_CHECK_VERSION (3, 14, 0) + GdkRGBA *foreground, + gboolean *background_set, + GdkRGBA *background) +#else GdkColor *foreground, gboolean *background_set, GdkColor *background) +#endif { GtkSourceStyleScheme *style_scheme; GtkSourceStyle *style; @@ -2273,6 +2279,21 @@ get_search_match_colors (PlumaDocument *doc, if (*foreground_set) { +#if GTK_CHECK_VERSION (3, 14, 0) + if (fg == NULL || + !gdk_rgba_parse (foreground, fg)) + { + *foreground_set = FALSE; + } + } + + if (*background_set) + { + if (bg == NULL || + !gdk_rgba_parse (background, bg)) + { + *background_set = FALSE; +#else if (fg == NULL || !gdk_color_parse (fg, foreground)) { @@ -2286,6 +2307,7 @@ get_search_match_colors (PlumaDocument *doc, !gdk_color_parse (bg, background)) { *background_set = FALSE; +#endif } } @@ -2299,7 +2321,11 @@ get_search_match_colors (PlumaDocument *doc, "Falling back to hard-coded colors " "for the \"found\" text tag."); +#if GTK_CHECK_VERSION (3, 14, 0) + gdk_rgba_parse (background, "#FFFF78"); +#else gdk_color_parse ("#FFFF78", background); +#endif *background_set = TRUE; *foreground_set = FALSE; @@ -2311,8 +2337,13 @@ sync_found_tag (PlumaDocument *doc, GParamSpec *pspec, gpointer data) { +#if GTK_CHECK_VERSION (3, 14, 0) + GdkRGBA fg; + GdkRGBA bg; +#else GdkColor fg; GdkColor bg; +#endif gboolean fg_set; gboolean bg_set; @@ -2325,10 +2356,17 @@ sync_found_tag (PlumaDocument *doc, &bg_set, &bg); g_object_set (doc->priv->found_tag, +#if GTK_CHECK_VERSION (3, 14, 0) + "foreground-rgba", fg_set ? &fg : NULL, + NULL); + g_object_set (doc->priv->found_tag, + "background-rgba", bg_set ? &bg : NULL, +#else "foreground-gdk", fg_set ? &fg : NULL, NULL); g_object_set (doc->priv->found_tag, "background-gdk", bg_set ? &bg : NULL, +#endif NULL); } diff --git a/pluma/pluma-documents-panel.c b/pluma/pluma-documents-panel.c index 66d3405f..97308efe 100644 --- a/pluma/pluma-documents-panel.c +++ b/pluma/pluma-documents-panel.c @@ -53,7 +53,11 @@ struct _PlumaDocumentsPanelPrivate guint is_reodering : 1; }; +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE(PlumaDocumentsPanel, pluma_documents_panel, GTK_TYPE_BOX) +#else G_DEFINE_TYPE(PlumaDocumentsPanel, pluma_documents_panel, GTK_TYPE_VBOX) +#endif enum { @@ -535,8 +539,12 @@ menu_position (GtkMenu *menu, wy = rect.y; gdk_window_get_origin (gtk_widget_get_window (w), x, y); - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) { @@ -749,6 +757,11 @@ pluma_documents_panel_init (PlumaDocumentsPanel *panel) panel->priv->adding_tab = FALSE; panel->priv->is_reodering = FALSE; + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), + GTK_ORIENTATION_VERTICAL); +#endif /* Create the scrolled window */ sw = gtk_scrolled_window_new (NULL, NULL); diff --git a/pluma/pluma-documents-panel.h b/pluma/pluma-documents-panel.h index 614e234f..4c546f81 100644 --- a/pluma/pluma-documents-panel.h +++ b/pluma/pluma-documents-panel.h @@ -57,7 +57,11 @@ typedef struct _PlumaDocumentsPanel PlumaDocumentsPanel; struct _PlumaDocumentsPanel { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox vbox; +#else GtkVBox vbox; +#endif /*< private > */ PlumaDocumentsPanelPrivate *priv; @@ -70,7 +74,11 @@ typedef struct _PlumaDocumentsPanelClass PlumaDocumentsPanelClass; struct _PlumaDocumentsPanelClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif }; /* diff --git a/pluma/pluma-file-chooser-dialog.c b/pluma/pluma-file-chooser-dialog.c index 569545a8..17c872da 100644 --- a/pluma/pluma-file-chooser-dialog.c +++ b/pluma/pluma-file-chooser-dialog.c @@ -55,6 +55,10 @@ #define ALL_FILES _("All Files") #define ALL_TEXT_FILES _("All Text Files") +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + struct _PlumaFileChooserDialogPrivate { GtkWidget *option_menu; @@ -82,7 +86,11 @@ create_option_menu (PlumaFileChooserDialog *dialog) GtkWidget *menu; label = gtk_label_new_with_mnemonic (_("C_haracter Encoding:")); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); +#endif menu = pluma_encodings_combo_box_new ( gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE); @@ -147,7 +155,11 @@ create_newline_combo (PlumaFileChooserDialog *dialog) GtkTreeIter iter; label = gtk_label_new_with_mnemonic (_("L_ine Ending:")); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); +#endif store = gtk_list_store_new (2, G_TYPE_STRING, PLUMA_TYPE_DOCUMENT_NEWLINE_TYPE); combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); diff --git a/pluma/pluma-io-error-message-area.c b/pluma/pluma-io-error-message-area.c index 4cf0ac9b..450de637 100644 --- a/pluma/pluma-io-error-message-area.c +++ b/pluma/pluma-io-error-message-area.c @@ -50,6 +50,11 @@ #define MAX_URI_IN_DIALOG_LENGTH 50 +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + static gboolean is_recoverable_error (const GError *error) { @@ -121,7 +126,11 @@ set_message_area_text_and_icon (GtkWidget *message_area, image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0); +#endif vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -132,7 +141,11 @@ set_message_area_text_and_icon (GtkWidget *message_area, gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); +#endif gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); @@ -147,7 +160,11 @@ set_message_area_text_and_icon (GtkWidget *message_area, gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif } gtk_widget_show_all (hbox_content); @@ -509,7 +526,11 @@ create_conversion_error_message_area (const gchar *primary_text, image = gtk_image_new_from_stock ("gtk-dialog-error", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0); +#endif vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -520,7 +541,11 @@ create_conversion_error_message_area (const gchar *primary_text, gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); +#endif gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); @@ -535,7 +560,11 @@ create_conversion_error_message_area (const gchar *primary_text, gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif } create_combo_box (message_area, vbox); @@ -774,7 +803,11 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0); +#endif vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -789,7 +822,11 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); +#endif gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); @@ -804,7 +841,11 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif gtk_widget_show_all (hbox_content); set_contents (message_area, hbox_content); @@ -865,7 +906,11 @@ pluma_externally_modified_saving_error_message_area_new ( image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0); +#endif vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -884,7 +929,11 @@ pluma_externally_modified_saving_error_message_area_new ( gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); +#endif gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); @@ -898,7 +947,11 @@ pluma_externally_modified_saving_error_message_area_new ( gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif gtk_widget_show_all (hbox_content); set_contents (message_area, hbox_content); @@ -960,7 +1013,11 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_valign (image, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0); +#endif vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -983,7 +1040,11 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (primary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); +#endif gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); @@ -999,7 +1060,11 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (secondary_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5); +#endif gtk_widget_show_all (hbox_content); set_contents (message_area, hbox_content); diff --git a/pluma/pluma-panel.c b/pluma/pluma-panel.c index c3fdc03a..591fc5dd 100644 --- a/pluma/pluma-panel.c +++ b/pluma/pluma-panel.c @@ -43,6 +43,11 @@ #define PLUMA_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_PANEL, PlumaPanelPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + struct _PlumaPanelPrivate { GtkOrientation orientation; @@ -85,7 +90,11 @@ static GObject *pluma_panel_constructor (GType type, GObjectConstructParam *construct_properties); +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE(PlumaPanel, pluma_panel, GTK_TYPE_BOX) +#else G_DEFINE_TYPE(PlumaPanel, pluma_panel, GTK_TYPE_VBOX) +#endif static void pluma_panel_finalize (GObject *obj) @@ -186,8 +195,13 @@ pluma_panel_class_init (PlumaPanelClass *klass) g_object_class_install_property (object_class, PROP_ORIENTATION, +#if GTK_CHECK_VERSION (3, 0, 0) + g_param_spec_enum ("panel-orientation", + "Panel Orientation", +#else g_param_spec_enum ("orientation", "Orientation", +#endif "The panel's orientation", GTK_TYPE_ORIENTATION, GTK_ORIENTATION_VERTICAL, @@ -401,6 +415,11 @@ static void pluma_panel_init (PlumaPanel *panel) { panel->priv = PLUMA_PANEL_GET_PRIVATE (panel); + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), + GTK_ORIENTATION_VERTICAL); +#endif } static void @@ -528,7 +547,11 @@ build_vertical_panel (PlumaPanel *panel) 0); panel->priv->title_label = gtk_label_new (_("Empty")); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (panel->priv->title_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (panel->priv->title_label), 0, 0.5); +#endif gtk_label_set_ellipsize(GTK_LABEL (panel->priv->title_label), PANGO_ELLIPSIZE_END); gtk_box_pack_start (GTK_BOX (icon_name_hbox), @@ -626,8 +649,16 @@ build_tab_label (PlumaPanel *panel, /* setup label */ label = gtk_label_new (name); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); + gtk_widget_set_margin_start (label, 0); + gtk_widget_set_margin_end (label, 0); + gtk_widget_set_margin_top (label, 0); + gtk_widget_set_margin_bottom (label, 0); +#else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 0, 0); + gtk_misc_set_padding (GTK_MISC (label), 0, 0); +#endif gtk_box_pack_start (GTK_BOX (label_hbox), label, TRUE, TRUE, 0); gtk_widget_set_tooltip_text (label_ebox, name); @@ -693,7 +724,11 @@ pluma_panel_add_item (PlumaPanel *panel, tab_label = build_tab_label (panel, item, data->name, data->icon); menu_label = gtk_label_new (name); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (menu_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5); +#endif if (!gtk_widget_get_visible (item)) gtk_widget_show (item); diff --git a/pluma/pluma-panel.h b/pluma/pluma-panel.h index be13fb1e..1e3b3059 100644 --- a/pluma/pluma-panel.h +++ b/pluma/pluma-panel.h @@ -55,7 +55,11 @@ typedef struct _PlumaPanel PlumaPanel; struct _PlumaPanel { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox vbox; +#else GtkVBox vbox; +#endif /*< private > */ PlumaPanelPrivate *priv; @@ -68,7 +72,11 @@ typedef struct _PlumaPanelClass PlumaPanelClass; struct _PlumaPanelClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif void (* item_added) (PlumaPanel *panel, GtkWidget *item); diff --git a/pluma/pluma-plugin-manager.c b/pluma/pluma-plugin-manager.c index ae30ff8e..08a922b5 100644 --- a/pluma/pluma-plugin-manager.c +++ b/pluma/pluma-plugin-manager.c @@ -70,7 +70,11 @@ struct _PlumaPluginManagerPrivate GtkWidget *popup_menu; }; +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE(PlumaPluginManager, pluma_plugin_manager, GTK_TYPE_BOX) +#else G_DEFINE_TYPE(PlumaPluginManager, pluma_plugin_manager, GTK_TYPE_VBOX) +#endif static PlumaPluginInfo *plugin_manager_get_selected_plugin (PlumaPluginManager *pm); static void plugin_manager_toggle_active (PlumaPluginManager *pm, GtkTreeIter *iter, GtkTreeModel *model); @@ -790,6 +794,11 @@ pluma_plugin_manager_init (PlumaPluginManager *pm) pm->priv = PLUMA_PLUGIN_MANAGER_GET_PRIVATE (pm); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (pm), + GTK_ORIENTATION_VERTICAL); +#endif + /* * Always we create the manager, firstly we rescan the plugins directory */ @@ -799,7 +808,11 @@ pluma_plugin_manager_init (PlumaPluginManager *pm) label = gtk_label_new_with_mnemonic (_("Active _Plugins:")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (pm), label, FALSE, TRUE, 0); @@ -817,7 +830,11 @@ pluma_plugin_manager_init (PlumaPluginManager *pm) gtk_label_set_mnemonic_widget (GTK_LABEL (label), pm->priv->tree); +#if GTK_CHECK_VERSION (3, 0, 0) + hbuttonbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); +#else hbuttonbox = gtk_hbutton_box_new (); +#endif gtk_box_pack_start (GTK_BOX (pm), hbuttonbox, FALSE, FALSE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (hbuttonbox), 8); diff --git a/pluma/pluma-plugin-manager.h b/pluma/pluma-plugin-manager.h index d271e748..be8a6dc8 100644 --- a/pluma/pluma-plugin-manager.h +++ b/pluma/pluma-plugin-manager.h @@ -55,7 +55,11 @@ typedef struct _PlumaPluginManager PlumaPluginManager; struct _PlumaPluginManager { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox vbox; +#else GtkVBox vbox; +#endif /*< private > */ PlumaPluginManagerPrivate *priv; @@ -68,7 +72,11 @@ typedef struct _PlumaPluginManagerClass PlumaPluginManagerClass; struct _PlumaPluginManagerClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif }; /* diff --git a/pluma/pluma-print-preview.c b/pluma/pluma-print-preview.c index 51390cb7..ab111b6f 100644 --- a/pluma/pluma-print-preview.c +++ b/pluma/pluma-print-preview.c @@ -42,6 +42,10 @@ #define PRINTER_DPI (72.) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + struct _PlumaPrintPreviewPrivate { GtkPrintOperation *operation; @@ -83,7 +87,11 @@ struct _PlumaPrintPreviewPrivate guint cur_page; }; +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (PlumaPrintPreview, pluma_print_preview, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (PlumaPrintPreview, pluma_print_preview, GTK_TYPE_VBOX) +#endif static void pluma_print_preview_get_property (GObject *object, @@ -997,6 +1005,11 @@ pluma_print_preview_init (PlumaPrintPreview *preview) priv->context = NULL; priv->gtk_preview = NULL; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (preview), + GTK_ORIENTATION_VERTICAL); +#endif + create_bar (preview); create_preview_layout (preview); diff --git a/pluma/pluma-print-preview.h b/pluma/pluma-print-preview.h index ebb5fbdc..f0a1de99 100644 --- a/pluma/pluma-print-preview.h +++ b/pluma/pluma-print-preview.h @@ -48,13 +48,21 @@ typedef struct _PlumaPrintPreviewClass PlumaPrintPreviewClass; struct _PlumaPrintPreview { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkVBox parent; +#endif PlumaPrintPreviewPrivate *priv; }; struct _PlumaPrintPreviewClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif void (* close) (PlumaPrintPreview *preview); }; diff --git a/pluma/pluma-progress-message-area.c b/pluma/pluma-progress-message-area.c index bf1f8351..fc5e11ce 100644 --- a/pluma/pluma-progress-message-area.c +++ b/pluma/pluma-progress-message-area.c @@ -48,6 +48,11 @@ enum { #define PLUMA_PROGRESS_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_PROGRESS_MESSAGE_AREA, PlumaProgressMessageAreaPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + struct _PlumaProgressMessageAreaPrivate { GtkWidget *image; @@ -148,14 +153,23 @@ pluma_progress_message_area_init (PlumaProgressMessageArea *area) area->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show (area->priv->image); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER); + gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER); +#else gtk_misc_set_alignment (GTK_MISC (area->priv->image), 0.5, 0.5); +#endif gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 4); area->priv->label = gtk_label_new (""); gtk_widget_show (area->priv->label); gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (area->priv->label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (area->priv->label), 0, 0.5); +#endif gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), PANGO_ELLIPSIZE_END); diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c index c5b8ac3c..aaae9824 100644 --- a/pluma/pluma-status-combo-box.c +++ b/pluma/pluma-status-combo-box.c @@ -26,6 +26,10 @@ #define PLUMA_STATUS_COMBO_BOX_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_STATUS_COMBO_BOX, PlumaStatusComboBoxPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + struct _PlumaStatusComboBoxPrivate { GtkWidget *frame; @@ -176,8 +180,12 @@ menu_position_func (GtkMenu *menu, GtkAllocation allocation; *push_in = FALSE; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (gtk_widget_get_toplevel (GTK_WIDGET (menu)), NULL, &request); +#else gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request); +#endif /* get the origin... */ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y); @@ -201,8 +209,12 @@ button_press_event (GtkWidget *widget, GtkRequisition request; GtkAllocation allocation; gint max_height; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (combo->priv->menu, NULL, &request); +#else gtk_widget_size_request (combo->priv->menu, &request); +#endif gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation); /* do something relative to our own height here, maybe we can do better */ @@ -275,7 +287,11 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self) gtk_widget_show (self->priv->label); gtk_label_set_single_line_mode (GTK_LABEL (self->priv->label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->label), 0.0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->label, FALSE, TRUE, 0); @@ -283,13 +299,22 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self) gtk_widget_show (self->priv->item); gtk_label_set_single_line_mode (GTK_LABEL (self->priv->item), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->item, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->item), 0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->item, TRUE, TRUE, 0); self->priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); gtk_widget_show (self->priv->arrow); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->arrow, GTK_ALIGN_CENTER); + gtk_widget_set_valign (self->priv->arrow, GTK_ALIGN_CENTER); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->arrow), 0.5, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0); diff --git a/pluma/pluma-statusbar.c b/pluma/pluma-statusbar.c index 6b31bb5d..7854fd8b 100644 --- a/pluma/pluma-statusbar.c +++ b/pluma/pluma-statusbar.c @@ -42,6 +42,10 @@ PLUMA_TYPE_STATUSBAR,\ PlumaStatusbarPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + struct _PlumaStatusbarPrivate { GtkWidget *overwrite_mode_label; @@ -161,9 +165,20 @@ pluma_statusbar_init (PlumaStatusbar *statusbar) statusbar->priv->error_frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (statusbar->priv->error_frame), GTK_SHADOW_IN); +#if GTK_CHECK_VERSION (3, 10, 0) + error_image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_MENU); +#else error_image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_MENU); +#endif +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_margin_start (error_image, 4); + gtk_widget_set_margin_end (error_image, 4); + gtk_widget_set_margin_top (error_image, 0); + gtk_widget_set_margin_bottom (error_image, 0); +#else gtk_misc_set_padding (GTK_MISC (error_image), 4, 0); gtk_widget_show (error_image); +#endif statusbar->priv->error_event_box = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (statusbar->priv->error_event_box), diff --git a/pluma/pluma-tab-label.c b/pluma/pluma-tab-label.c index c429f11c..06f72c46 100644 --- a/pluma/pluma-tab-label.c +++ b/pluma/pluma-tab-label.c @@ -31,6 +31,10 @@ #define PLUMA_TAB_LABEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_TAB_LABEL, PlumaTabLabelPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + /* Signals */ enum { @@ -59,7 +63,11 @@ struct _PlumaTabLabelPrivate static guint signals[LAST_SIGNAL] = { 0 }; +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (PlumaTabLabel, pluma_tab_label, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (PlumaTabLabel, pluma_tab_label, GTK_TYPE_HBOX) +#endif static void pluma_tab_label_finalize (GObject *object) @@ -261,6 +269,10 @@ pluma_tab_label_init (PlumaTabLabel *tab_label) tab_label->priv->close_button_sensitive = TRUE; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (tab_label), + GTK_ORIENTATION_HORIZONTAL); +#endif ebox = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE); gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0); @@ -289,8 +301,16 @@ pluma_tab_label_init (PlumaTabLabel *tab_label) tab_label->priv->icon = icon; label = gtk_label_new (""); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); + gtk_widget_set_margin_start (label, 0); + gtk_widget_set_margin_end (label, 0); + gtk_widget_set_margin_top (label, 0); + gtk_widget_set_margin_bottom (label, 0); +#else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 0, 0); +#endif gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); tab_label->priv->label = label; diff --git a/pluma/pluma-tab-label.h b/pluma/pluma-tab-label.h index 7d8247e7..172ff766 100644 --- a/pluma/pluma-tab-label.h +++ b/pluma/pluma-tab-label.h @@ -41,13 +41,21 @@ typedef struct _PlumaTabLabelClass PlumaTabLabelClass; typedef struct _PlumaTabLabelPrivate PlumaTabLabelPrivate; struct _PlumaTabLabel { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkHBox parent; +#endif PlumaTabLabelPrivate *priv; }; struct _PlumaTabLabelClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif void (* close_clicked) (PlumaTabLabel *tab_label); }; diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c index 0e1e38ed..723dfaf1 100644 --- a/pluma/pluma-tab.c +++ b/pluma/pluma-tab.c @@ -86,7 +86,11 @@ struct _PlumaTabPrivate gint ask_if_externally_modified : 1; }; +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE(PlumaTab, pluma_tab, GTK_TYPE_BOX) +#else G_DEFINE_TYPE(PlumaTab, pluma_tab, GTK_TYPE_VBOX) +#endif enum { @@ -1485,6 +1489,11 @@ pluma_tab_init (PlumaTab *tab) tab->priv->save_flags = 0; tab->priv->ask_if_externally_modified = TRUE; + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (tab), + GTK_ORIENTATION_VERTICAL); +#endif /* Create the scrolled window */ sw = gtk_scrolled_window_new (NULL, NULL); @@ -1863,10 +1872,14 @@ _pluma_tab_get_icon (PlumaTab *tab) theme = gtk_icon_theme_get_for_screen (screen); g_return_val_if_fail (theme != NULL, NULL); +#if GTK_CHECK_VERSION (3, 10, 0) + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &icon_size); +#else gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (tab)), GTK_ICON_SIZE_MENU, NULL, &icon_size); +#endif switch (tab->priv->state) { diff --git a/pluma/pluma-tab.h b/pluma/pluma-tab.h index 209db62f..62d46521 100644 --- a/pluma/pluma-tab.h +++ b/pluma/pluma-tab.h @@ -77,7 +77,11 @@ typedef struct _PlumaTab PlumaTab; struct _PlumaTab { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox vbox; +#else GtkVBox vbox; +#endif /*< private > */ PlumaTabPrivate *priv; @@ -90,7 +94,11 @@ typedef struct _PlumaTabClass PlumaTabClass; struct _PlumaTabClass { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif }; /* diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index 571cf81f..19405ebf 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -134,7 +134,11 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu, widget = GTK_WIDGET (user_data); widget_get_origin (widget, x, y); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif gtk_widget_get_allocation (widget, &allocation); @@ -189,7 +193,11 @@ pluma_utils_menu_position_under_tree_view (GtkMenu *menu, if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL) { GtkRequisition requisition; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif *x += rect.width - requisition.width; } } @@ -1097,7 +1105,14 @@ handle_builder_error (const gchar *message, ...) g_free (msg_plain); g_free (msg); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_margin_start (label, 5); + gtk_widget_set_margin_end (label, 5); + gtk_widget_set_margin_top (label, 5); + gtk_widget_set_margin_bottom (label, 5); +#else gtk_misc_set_padding (GTK_MISC (label), 5, 5); +#endif return label; } diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index a9a1d54a..293d5da5 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -56,6 +56,10 @@ #define PLUMA_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_VIEW, PlumaViewPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + typedef enum { GOTO_LINE, @@ -966,12 +970,16 @@ hide_search_window (PlumaView *view, gboolean cancel) static gboolean search_entry_flush_timeout (PlumaView *view) { +#if !GTK_CHECK_VERSION (3, 0, 0) GDK_THREADS_ENTER (); +#endif view->priv->typeselect_flush_timeout = 0; hide_search_window (view, FALSE); +#if !GTK_CHECK_VERSION (3, 0, 0) GDK_THREADS_LEAVE (); +#endif return FALSE; } @@ -1185,11 +1193,15 @@ real_search_enable_popdown (gpointer data) { PlumaView *view = (PlumaView *)data; +#if !GTK_CHECK_VERSION (3, 0, 0) GDK_THREADS_ENTER (); +#endif view->priv->disable_popdown = FALSE; +#if !GTK_CHECK_VERSION (3, 0, 0) GDK_THREADS_LEAVE (); +#endif return FALSE; } diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index e12164ac..0126ec30 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -71,6 +71,10 @@ PLUMA_TYPE_WINDOW, \ PlumaWindowPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) +#endif + /* Signals */ enum { diff --git a/pluma/smclient/eggsmclient-xsmp.c b/pluma/smclient/eggsmclient-xsmp.c index df2aa583..a1a69594 100644 --- a/pluma/smclient/eggsmclient-xsmp.c +++ b/pluma/smclient/eggsmclient-xsmp.c @@ -367,9 +367,13 @@ sm_client_xsmp_startup (EggSMClient *client, xsmp->client_id = g_strdup (ret_client_id); free (ret_client_id); +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_enter (); +#endif gdk_x11_set_sm_client_id (xsmp->client_id); +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_leave (); +#endif g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -537,7 +541,9 @@ idle_do_pending_events (gpointer data) EggSMClientXSMP *xsmp = data; EggSMClient *client = data; +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_enter (); +#endif xsmp->idle = 0; @@ -562,7 +568,9 @@ idle_do_pending_events (gpointer data) } out: +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_leave (); +#endif return FALSE; } @@ -1284,9 +1292,13 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_enter (); +#endif status = IceProcessMessages (ice_conn, NULL, NULL); +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_threads_leave (); +#endif switch (status) { |