summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpluma/dialogs/pluma-close-confirmation-dialog.c2
-rwxr-xr-xpluma/dialogs/pluma-encodings-dialog.c2
-rwxr-xr-xpluma/dialogs/pluma-preferences-dialog.c2
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.c6
-rw-r--r--pluma/pluma-app.c2
-rw-r--r--pluma/pluma-commands-search.c5
-rw-r--r--pluma/pluma-document.c79
-rw-r--r--pluma/pluma-documents-panel.c17
-rw-r--r--pluma/pluma-encodings-combo-box.c4
-rw-r--r--pluma/pluma-encodings-combo-box.h2
-rw-r--r--pluma/pluma-file-chooser-dialog.c5
-rw-r--r--pluma/pluma-history-entry.c18
-rw-r--r--pluma/pluma-history-entry.h8
-rw-r--r--pluma/pluma-io-error-message-area.c40
-rw-r--r--pluma/pluma-language-manager.c6
-rw-r--r--pluma/pluma-language-manager.h1
-rw-r--r--pluma/pluma-notebook.c41
-rw-r--r--pluma/pluma-panel.c13
-rw-r--r--pluma/pluma-prefs-manager-app.c8
-rw-r--r--pluma/pluma-print-job.c4
-rw-r--r--pluma/pluma-print-preview.c9
-rw-r--r--pluma/pluma-session.c4
-rw-r--r--pluma/pluma-status-combo-box.c19
-rw-r--r--pluma/pluma-statusbar.c13
-rw-r--r--pluma/pluma-style-scheme-manager.c16
-rw-r--r--pluma/pluma-utils.c25
-rw-r--r--pluma/pluma-view.c110
-rw-r--r--pluma/pluma-window.c20
-rw-r--r--pluma/pluma.c6
-rwxr-xr-xpluma/smclient/eggsmclient-private.h3
-rwxr-xr-xpluma/smclient/eggsmclient-xsmp.c4
31 files changed, 462 insertions, 32 deletions
diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.c b/pluma/dialogs/pluma-close-confirmation-dialog.c
index a3bcdfd2..ae430bf8 100755
--- a/pluma/dialogs/pluma-close-confirmation-dialog.c
+++ b/pluma/dialogs/pluma-close-confirmation-dialog.c
@@ -199,7 +199,9 @@ pluma_close_confirmation_dialog_init (PlumaCloseConfirmationDialog *dlg)
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
14);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+#endif
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE);
gtk_window_set_title (GTK_WINDOW (dlg), "");
diff --git a/pluma/dialogs/pluma-encodings-dialog.c b/pluma/dialogs/pluma-encodings-dialog.c
index 443cc017..263a4aae 100755
--- a/pluma/dialogs/pluma-encodings-dialog.c
+++ b/pluma/dialogs/pluma-encodings-dialog.c
@@ -320,7 +320,9 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg)
gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings"));
gtk_window_set_default_size (GTK_WINDOW (dlg), 650, 400);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+#endif
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c
index b7b6e544..66cff4f6 100755
--- a/pluma/dialogs/pluma-preferences-dialog.c
+++ b/pluma/dialogs/pluma-preferences-dialog.c
@@ -1085,7 +1085,9 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)
gtk_window_set_title (GTK_WINDOW (dlg), _("pluma Preferences"));
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+#endif
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
/* HIG defaults */
diff --git a/pluma/dialogs/pluma-search-dialog.c b/pluma/dialogs/pluma-search-dialog.c
index 7db2a2bc..ac7181d8 100755
--- a/pluma/dialogs/pluma-search-dialog.c
+++ b/pluma/dialogs/pluma-search-dialog.c
@@ -34,7 +34,11 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include "pluma-search-dialog.h"
#include "pluma-history-entry.h"
@@ -329,7 +333,9 @@ pluma_search_dialog_init (PlumaSearchDialog *dlg)
dlg->priv = PLUMA_SEARCH_DIALOG_GET_PRIVATE (dlg);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+#endif
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
diff --git a/pluma/pluma-app.c b/pluma/pluma-app.c
index 2ba277c9..48eb1dc1 100644
--- a/pluma/pluma-app.c
+++ b/pluma/pluma-app.c
@@ -632,7 +632,7 @@ pluma_app_get_active_window (PlumaApp *app)
* enough that the second instance comes up before the
* first one shows its window.
*/
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (app->priv->active_window)))
+ if (!gtk_widget_get_realized (GTK_WIDGET (app->priv->active_window)))
gtk_widget_realize (GTK_WIDGET (app->priv->active_window));
return app->priv->active_window;
diff --git a/pluma/pluma-commands-search.c b/pluma/pluma-commands-search.c
index ee1b5129..7e15357e 100644
--- a/pluma/pluma-commands-search.c
+++ b/pluma/pluma-commands-search.c
@@ -36,7 +36,12 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#define GTK_OBJECT G_OBJECT
+#endif
#include "pluma-commands.h"
#include "pluma-debug.h"
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 9940e876..ec53a315 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -38,7 +38,10 @@
#include <stdlib.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#if !GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksourceiter.h>
+#endif
#include "pluma-prefs-manager-app.h"
#include "pluma-document.h"
@@ -173,7 +176,11 @@ enum {
static guint document_signals[LAST_SIGNAL] = { 0 };
+#if GTK_CHECK_VERSION (3, 0, 0)
+G_DEFINE_TYPE(PlumaDocument, pluma_document, GTK_SOURCE_TYPE_BUFFER)
+#else
G_DEFINE_TYPE(PlumaDocument, pluma_document, GTK_TYPE_SOURCE_BUFFER)
+#endif
GQuark
pluma_document_error_quark (void)
@@ -1842,7 +1849,11 @@ pluma_document_search_forward (PlumaDocument *doc,
GtkTextIter *match_end)
{
GtkTextIter iter;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkTextSearchFlags search_flags;
+#else
GtkSourceSearchFlags search_flags;
+#endif
gboolean found = FALSE;
GtkTextIter m_start;
GtkTextIter m_end;
@@ -1865,17 +1876,29 @@ pluma_document_search_forward (PlumaDocument *doc,
gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &iter);
else
iter = *start;
-
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
+#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
+#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+#endif
}
while (!found)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ found = gtk_text_iter_forward_search (&iter,
+#else
found = gtk_source_iter_forward_search (&iter,
+#endif
doc->priv->search_text,
search_flags,
&m_start,
@@ -1911,7 +1934,11 @@ pluma_document_search_backward (PlumaDocument *doc,
GtkTextIter *match_end)
{
GtkTextIter iter;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkTextSearchFlags search_flags;
+#else
GtkSourceSearchFlags search_flags;
+#endif
gboolean found = FALSE;
GtkTextIter m_start;
GtkTextIter m_end;
@@ -1934,17 +1961,29 @@ pluma_document_search_backward (PlumaDocument *doc,
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
else
iter = *end;
-
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
+#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
+#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+#endif
}
while (!found)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ found = gtk_text_iter_backward_search (&iter,
+#else
found = gtk_source_iter_backward_search (&iter,
+#endif
doc->priv->search_text,
search_flags,
&m_start,
@@ -1981,7 +2020,11 @@ pluma_document_replace_all (PlumaDocument *doc,
GtkTextIter iter;
GtkTextIter m_start;
GtkTextIter m_end;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkTextSearchFlags search_flags = 0;
+#else
GtkSourceSearchFlags search_flags = 0;
+#endif
gboolean found = TRUE;
gint cont = 0;
gchar *search_text;
@@ -2006,11 +2049,19 @@ pluma_document_replace_all (PlumaDocument *doc,
gtk_text_buffer_get_start_iter (buffer, &iter);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
+#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (flags))
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
+#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+#endif
}
replace_text_len = strlen (replace_text);
@@ -2033,7 +2084,11 @@ pluma_document_replace_all (PlumaDocument *doc,
do
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ found = gtk_text_iter_forward_search (&iter,
+#else
found = gtk_source_iter_forward_search (&iter,
+#endif
search_text,
search_flags,
&m_start,
@@ -2236,8 +2291,12 @@ search_region (PlumaDocument *doc,
{
GtkTextIter iter;
GtkTextIter m_start;
- GtkTextIter m_end;
+ GtkTextIter m_end;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkTextSearchFlags search_flags = 0;
+#else
GtkSourceSearchFlags search_flags = 0;
+#endif
gboolean found = TRUE;
GtkTextBuffer *buffer;
@@ -2296,12 +2355,20 @@ search_region (PlumaDocument *doc,
return;
iter = *start;
-
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
+#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
+#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+#endif
}
do
@@ -2309,7 +2376,11 @@ search_region (PlumaDocument *doc,
if ((end != NULL) && gtk_text_iter_is_end (end))
end = NULL;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ found = gtk_text_iter_forward_search (&iter,
+#else
found = gtk_source_iter_forward_search (&iter,
+#endif
doc->priv->search_text,
search_flags,
&m_start,
diff --git a/pluma/pluma-documents-panel.c b/pluma/pluma-documents-panel.c
index 924f7060..ea2739e1 100644
--- a/pluma/pluma-documents-panel.c
+++ b/pluma/pluma-documents-panel.c
@@ -516,11 +516,18 @@ menu_position (GtkMenu *menu,
GtkTreePath *path;
GdkRectangle rect;
gint wx, wy;
+ GtkAllocation allocation;
GtkRequisition requisition;
GtkWidget *w;
w = panel->priv->treeview;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_allocation(w, &allocation);
+#else
+ allocation = w->allocation;
+#endif
+
path = get_current_path (panel);
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w),
@@ -531,21 +538,25 @@ menu_position (GtkMenu *menu,
wx = rect.x;
wy = rect.y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_origin (gtk_widget_get_window (w), x, y);
+#else
gdk_window_get_origin (w->window, x, y);
+#endif
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{
- *x += w->allocation.x + w->allocation.width - requisition.width - 10;
+ *x += allocation.x + allocation.width - requisition.width - 10;
}
else
{
- *x += w->allocation.x + 10;
+ *x += allocation.x + 10;
}
wy = MAX (*y + 5, *y + wy + 5);
- wy = MIN (wy, *y + w->allocation.height - requisition.height - 5);
+ wy = MIN (wy, *y + allocation.height - requisition.height - 5);
*y = wy;
diff --git a/pluma/pluma-encodings-combo-box.c b/pluma/pluma-encodings-combo-box.c
index 7ba22e85..9d7fcc5e 100644
--- a/pluma/pluma-encodings-combo-box.c
+++ b/pluma/pluma-encodings-combo-box.c
@@ -212,7 +212,11 @@ add_or_remove (PlumaEncodingsComboBox *menu,
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ wg = gtk_window_get_group (GTK_WINDOW (toplevel));
+#else
wg = GTK_WINDOW (toplevel)->group;
+#endif
if (wg == NULL)
{
wg = gtk_window_group_new ();
diff --git a/pluma/pluma-encodings-combo-box.h b/pluma/pluma-encodings-combo-box.h
index cd3b7880..f6465cbf 100644
--- a/pluma/pluma-encodings-combo-box.h
+++ b/pluma/pluma-encodings-combo-box.h
@@ -32,7 +32,7 @@
#ifndef __PLUMA_ENCODINGS_COMBO_BOX_H__
#define __PLUMA_ENCODINGS_COMBO_BOX_H__
-#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtk.h>
#include <pluma/pluma-encodings.h>
G_BEGIN_DECLS
diff --git a/pluma/pluma-file-chooser-dialog.c b/pluma/pluma-file-chooser-dialog.c
index 02f0de06..389ba85a 100644
--- a/pluma/pluma-file-chooser-dialog.c
+++ b/pluma/pluma-file-chooser-dialog.c
@@ -39,6 +39,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gtksourceview/gtksource.h>
#include "pluma-file-chooser-dialog.h"
#include "pluma-encodings-combo-box.h"
@@ -294,7 +295,11 @@ all_text_files_filter (const GtkFileFilterInfo *filter_info,
GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *languages);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (lang), FALSE);
+#else
g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), FALSE);
+#endif
++languages;
mime_types = gtk_source_language_get_mime_types (lang);
diff --git a/pluma/pluma-history-entry.c b/pluma/pluma-history-entry.c
index 0511553f..bb772594 100644
--- a/pluma/pluma-history-entry.c
+++ b/pluma/pluma-history-entry.c
@@ -64,7 +64,11 @@ struct _PlumaHistoryEntryPrivate
GSettings *settings;
};
+#if GTK_CHECK_VERSION (3, 0, 0)
+G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
+#else
G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_ENTRY)
+#endif
static void
pluma_history_entry_set_property (GObject *object,
@@ -116,12 +120,20 @@ pluma_history_entry_get_property (GObject *object,
}
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+pluma_history_entry_dispose (GObject *object)
+#else
pluma_history_entry_destroy (GtkObject *object)
+#endif
{
pluma_history_entry_set_enable_completion (PLUMA_HISTORY_ENTRY (object),
FALSE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ G_OBJECT_CLASS (pluma_history_entry_parent_class)->dispose (object);
+#else
GTK_OBJECT_CLASS (pluma_history_entry_parent_class)->destroy (object);
+#endif
}
static void
@@ -146,12 +158,18 @@ static void
pluma_history_entry_class_init (PlumaHistoryEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+#endif
object_class->set_property = pluma_history_entry_set_property;
object_class->get_property = pluma_history_entry_get_property;
object_class->finalize = pluma_history_entry_finalize;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ object_class->dispose = pluma_history_entry_dispose;
+#else
gtkobject_class->destroy = pluma_history_entry_destroy;
+#endif
g_object_class_install_property (object_class,
PROP_HISTORY_ID,
diff --git a/pluma/pluma-history-entry.h b/pluma/pluma-history-entry.h
index 9e2eb0bb..eba621f9 100644
--- a/pluma/pluma-history-entry.h
+++ b/pluma/pluma-history-entry.h
@@ -48,12 +48,20 @@ typedef struct _PlumaHistoryEntryPrivate PlumaHistoryEntryPrivate;
struct _PlumaHistoryEntryClass
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkComboBoxTextClass parent_class;
+#else
GtkComboBoxEntryClass parent_class;
+#endif
};
struct _PlumaHistoryEntry
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkComboBoxText parent_instance;
+#else
GtkComboBoxEntry parent_instance;
+#endif
PlumaHistoryEntryPrivate *priv;
};
diff --git a/pluma/pluma-io-error-message-area.c b/pluma/pluma-io-error-message-area.c
index d6504634..38e19cca 100644
--- a/pluma/pluma-io-error-message-area.c
+++ b/pluma/pluma-io-error-message-area.c
@@ -144,7 +144,11 @@ set_message_area_text_and_icon (GtkWidget *message_area,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (primary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL)
@@ -154,7 +158,11 @@ set_message_area_text_and_icon (GtkWidget *message_area,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (secondary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+#endif
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);
@@ -570,7 +578,11 @@ create_conversion_error_message_area (const gchar *primary_text,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (primary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL)
@@ -580,7 +592,11 @@ create_conversion_error_message_area (const gchar *primary_text,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (secondary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+#endif
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);
@@ -853,7 +869,11 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri)
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (primary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("pluma opened this instance of the file in a non-editable way. "
@@ -863,7 +883,11 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri)
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (secondary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+#endif
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);
@@ -959,7 +983,11 @@ pluma_externally_modified_saving_error_message_area_new (
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (primary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("If you save it, all the external changes could be lost. Save it anyway?");
@@ -968,7 +996,11 @@ pluma_externally_modified_saving_error_message_area_new (
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (secondary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+#endif
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);
@@ -1069,7 +1101,11 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (primary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("pluma could not back up the old copy of the file before saving the new one. "
@@ -1080,7 +1116,11 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (secondary_label, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+#endif
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);
diff --git a/pluma/pluma-language-manager.c b/pluma/pluma-language-manager.c
index 15554955..903e8275 100644
--- a/pluma/pluma-language-manager.c
+++ b/pluma/pluma-language-manager.c
@@ -30,6 +30,8 @@
*/
#include <string.h>
+#include <gtk/gtk.h>
+#include <gtksourceview/gtksource.h>
#include "pluma-language-manager.h"
#include "pluma-prefs-manager.h"
@@ -76,7 +78,11 @@ pluma_language_manager_list_languages_sorted (GtkSourceLanguageManager *lm,
GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *ids);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (lang), NULL);
+#else
g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), NULL);
+#endif
++ids;
if (include_hidden || !gtk_source_language_get_hidden (lang))
diff --git a/pluma/pluma-language-manager.h b/pluma/pluma-language-manager.h
index e5596262..0970b7cf 100644
--- a/pluma/pluma-language-manager.h
+++ b/pluma/pluma-language-manager.h
@@ -32,6 +32,7 @@
#ifndef __PLUMA_LANGUAGES_MANAGER_H__
#define __PLUMA_LANGUAGES_MANAGER_H__
+#include <glib-object.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
G_BEGIN_DECLS
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index 7a73397d..c792f4bb 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -100,7 +100,11 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+pluma_notebook_dispose (GObject *object)
+#else
pluma_notebook_destroy (GtkObject *object)
+#endif
{
PlumaNotebook *notebook = PLUMA_NOTEBOOK (object);
@@ -120,19 +124,29 @@ pluma_notebook_destroy (GtkObject *object)
notebook->priv->destroy_has_run = TRUE;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ G_OBJECT_CLASS (pluma_notebook_parent_class)->dispose (object);
+#else
GTK_OBJECT_CLASS (pluma_notebook_parent_class)->destroy (object);
+#endif
}
static void
pluma_notebook_class_init (PlumaNotebookClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+#endif
GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass);
object_class->finalize = pluma_notebook_finalize;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ object_class->dispose = pluma_notebook_dispose;
+#else
gtkobject_class->destroy = pluma_notebook_destroy;
-
+#endif
+
notebook_class->change_current_page = pluma_notebook_change_current_page;
signals[TAB_ADDED] =
@@ -247,10 +261,12 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));
+#if !GTK_CHECK_VERSION (3, 0, 0)
if (GTK_NOTEBOOK (notebook)->first_tab == NULL)
{
return AFTER_ALL_TABS;
}
+#endif
/* For some reason unfullscreen + quick click can
cause a wrong click event to be reported to the tab */
@@ -261,6 +277,7 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
while ((page = gtk_notebook_get_nth_page (nb, page_num)) != NULL)
{
+ GtkAllocation allocation;
GtkWidget *tab;
gint max_x, max_y;
gint x_root, y_root;
@@ -268,17 +285,31 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (!gtk_widget_get_mapped (tab))
+#else
if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
+#endif
{
++page_num;
continue;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window (tab)),
+#else
gdk_window_get_origin (GDK_WINDOW (tab->window),
+#endif
&x_root, &y_root);
- max_x = x_root + tab->allocation.x + tab->allocation.width;
- max_y = y_root + tab->allocation.y + tab->allocation.height;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_allocation(tab, &allocation);
+#else
+ allocation = tab->allocation;
+#endif
+
+ max_x = x_root + allocation.x + allocation.width;
+ max_y = y_root + allocation.y + allocation.height;
if (((tab_pos == GTK_POS_TOP) ||
(tab_pos == GTK_POS_BOTTOM)) &&
@@ -658,7 +689,11 @@ pluma_notebook_new (void)
static void
pluma_notebook_switch_page_cb (GtkNotebook *notebook,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *page,
+#else
GtkNotebookPage *page,
+#endif
guint page_num,
gpointer data)
{
diff --git a/pluma/pluma-panel.c b/pluma/pluma-panel.c
index 0123bcab..353e97c6 100644
--- a/pluma/pluma-panel.c
+++ b/pluma/pluma-panel.c
@@ -34,6 +34,9 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include "pluma-close-button.h"
#include "pluma-window.h"
@@ -271,6 +274,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
case GTK_IMAGE_EMPTY:
gtk_image_clear (image);
break;
+#if !GTK_CHECK_VERSION (3, 0, 0)
case GTK_IMAGE_PIXMAP:
{
GdkPixmap *pm;
@@ -289,6 +293,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
gtk_image_set_from_image (image, i, bm);
}
break;
+#endif
case GTK_IMAGE_PIXBUF:
{
GdkPixbuf *pb;
@@ -367,7 +372,11 @@ sync_title (PlumaPanel *panel,
static void
notebook_page_changed (GtkNotebook *notebook,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *page,
+#else
GtkNotebookPage *page,
+#endif
guint page_num,
PlumaPanel *panel)
{
@@ -697,7 +706,11 @@ pluma_panel_add_item (PlumaPanel *panel,
menu_label = gtk_label_new (name);
gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (!gtk_widget_get_visible (item))
+#else
if (!GTK_WIDGET_VISIBLE (item))
+#endif
gtk_widget_show (item);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (panel->priv->notebook),
diff --git a/pluma/pluma-prefs-manager-app.c b/pluma/pluma-prefs-manager-app.c
index 18db8fac..8d74d45b 100644
--- a/pluma/pluma-prefs-manager-app.c
+++ b/pluma/pluma-prefs-manager-app.c
@@ -1207,7 +1207,11 @@ pluma_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
while (l != NULL)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
+#else
g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
+#endif
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
enable);
@@ -1313,7 +1317,11 @@ pluma_prefs_manager_source_style_scheme_changed (GSettings *settings,
docs = pluma_app_get_documents (pluma_app_get_default ());
for (l = docs; l != NULL; l = l->next)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
+#else
g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
+#endif
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data),
style);
diff --git a/pluma/pluma-print-job.c b/pluma/pluma-print-job.c
index 69de06c3..72b24154 100644
--- a/pluma/pluma-print-job.c
+++ b/pluma/pluma-print-job.c
@@ -517,7 +517,11 @@ create_compositor (PlumaPrintJob *job)
print_font_numbers = pluma_prefs_manager_get_print_font_numbers ();
job->priv->compositor = GTK_SOURCE_PRINT_COMPOSITOR (
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_object_new (GTK_SOURCE_TYPE_PRINT_COMPOSITOR,
+#else
g_object_new (GTK_TYPE_SOURCE_PRINT_COMPOSITOR,
+#endif
"buffer", GTK_SOURCE_BUFFER (job->priv->doc),
"tab-width", gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (job->priv->view)),
"highlight-syntax", gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (job->priv->doc)) &&
diff --git a/pluma/pluma-print-preview.c b/pluma/pluma-print-preview.c
index c37d85fa..350f7367 100644
--- a/pluma/pluma-print-preview.c
+++ b/pluma/pluma-print-preview.c
@@ -34,8 +34,11 @@
#include <math.h>
#include <stdlib.h>
#include <glib/gi18n.h>
-#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include <cairo-pdf.h>
@@ -956,7 +959,11 @@ create_preview_layout (PlumaPrintPreview *preview)
GDK_BUTTON_PRESS_MASK |
GDK_KEY_PRESS_MASK);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_focus (priv->layout, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (priv->layout, GTK_CAN_FOCUS);
+#endif
g_signal_connect (priv->layout,
"key-press-event",
diff --git a/pluma/pluma-session.c b/pluma/pluma-session.c
index cdb1a4ee..2cc4ec39 100644
--- a/pluma/pluma-session.c
+++ b/pluma/pluma-session.c
@@ -54,6 +54,10 @@
#include "dialogs/pluma-close-confirmation-dialog.h"
#include "smclient/eggsmclient.h"
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
+#endif
+
/* The master client we use for SM */
static EggSMClient *master_client = NULL;
diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c
index b7741aec..ed0f4917 100644
--- a/pluma/pluma-status-combo-box.c
+++ b/pluma/pluma-status-combo-box.c
@@ -173,18 +173,25 @@ menu_position_func (GtkMenu *menu,
PlumaStatusComboBox *combo)
{
GtkRequisition request;
+ GtkAllocation allocation;
*push_in = FALSE;
gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request);
/* get the origin... */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y);
+ gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
+#else
gdk_window_get_origin (GTK_WIDGET (combo)->window, x, y);
+ allocation = GTK_WIDGET (combo)->allocation;
+#endif
/* make the menu as wide as the widget */
- if (request.width < GTK_WIDGET (combo)->allocation.width)
+ if (request.width < allocation.width)
{
- gtk_widget_set_size_request (GTK_WIDGET (menu), GTK_WIDGET (combo)->allocation.width, -1);
+ gtk_widget_set_size_request (GTK_WIDGET (menu), allocation.width, -1);
}
/* position it above the widget */
@@ -197,12 +204,18 @@ button_press_event (GtkWidget *widget,
PlumaStatusComboBox *combo)
{
GtkRequisition request;
+ GtkAllocation allocation;
gint max_height;
gtk_widget_size_request (combo->priv->menu, &request);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
+#else
+ allocation = GTK_WIDGET (combo)->allocation;
+#endif
/* do something relative to our own height here, maybe we can do better */
- max_height = GTK_WIDGET (combo)->allocation.height * 20;
+ max_height = allocation.height * 20;
if (request.height > max_height)
{
diff --git a/pluma/pluma-statusbar.c b/pluma/pluma-statusbar.c
index e0c9d0d0..21ab1053 100644
--- a/pluma/pluma-statusbar.c
+++ b/pluma/pluma-statusbar.c
@@ -76,6 +76,15 @@ get_overwrite_mode_length (void)
return 2 + MAX (g_utf8_strlen (_("OVR"), -1), g_utf8_strlen (_("INS"), -1));
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar, gboolean state)
+{
+ /* nothing */
+ /* https://developer.gnome.org/gtk3/stable/ch24s02.html#id-1.6.3.4.17 */
+}
+#endif
+
static void
pluma_statusbar_notify (GObject *object,
GParamSpec *pspec)
@@ -389,7 +398,11 @@ pluma_statusbar_flash_message (PlumaStatusbar *statusbar,
msg);
statusbar->priv->flash_timeout = g_timeout_add (flash_length,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ (GSourceFunc) remove_message_timeout,
+#else
(GtkFunction) remove_message_timeout,
+#endif
statusbar);
g_free (msg);
diff --git a/pluma/pluma-style-scheme-manager.c b/pluma/pluma-style-scheme-manager.c
index a0eefc11..73625141 100644
--- a/pluma/pluma-style-scheme-manager.c
+++ b/pluma/pluma-style-scheme-manager.c
@@ -28,6 +28,10 @@
* $Id$
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <string.h>
#include <errno.h>
@@ -103,7 +107,11 @@ pluma_style_scheme_manager_list_schemes_sorted (GtkSourceStyleSchemeManager *man
const gchar * const * scheme_ids;
GSList *schemes = NULL;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
+#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), NULL);
+#endif
scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);
@@ -254,7 +262,11 @@ _pluma_style_scheme_manager_install_scheme (GtkSourceStyleSchemeManager *manager
const gchar* const *ids;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
+#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), NULL);
+#endif
g_return_val_if_fail (fname != NULL, NULL);
dirname = g_path_get_dirname (fname);
@@ -343,7 +355,11 @@ _pluma_style_scheme_manager_uninstall_scheme (GtkSourceStyleSchemeManager *manag
GtkSourceStyleScheme *scheme;
const gchar *filename;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), FALSE);
+#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), FALSE);
+#endif
g_return_val_if_fail (id != NULL, FALSE);
scheme = gtk_source_style_scheme_manager_get_scheme (manager, id);
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index b452eddd..bf0a6862 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -125,22 +125,29 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu,
{
GtkWidget *widget;
GtkRequisition requisition;
+ GtkAllocation allocation;
widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_allocation (widget, &allocation);
+#else
+ allocation = widget->allocation;
+#endif
+
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
- *x += widget->allocation.x + widget->allocation.width - requisition.width;
+ *x += allocation.x + allocation.width - requisition.width;
}
else
{
- *x += widget->allocation.x;
+ *x += allocation.x;
}
- *y += widget->allocation.y + widget->allocation.height;
+ *y += allocation.y + allocation.height;
*push_in = TRUE;
}
@@ -234,7 +241,11 @@ pluma_dialog_add_button (GtkDialog *dialog,
button = pluma_gtk_button_new_with_stock_icon (text, stock_id);
g_return_val_if_fail (button != NULL, NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_can_default (button, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
gtk_widget_show (button);
@@ -900,10 +911,18 @@ pluma_utils_get_window_workspace (GtkWindow *gtkwindow)
guint ret = PLUMA_ALL_WORKSPACES;
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_return_val_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtkwindow)), 0);
+#else
g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);
+#endif
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ display = gdk_window_get_display (window);
+#else
display = gdk_drawable_get_display (window);
+#endif
gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index cbd2299c..5132e966 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -37,7 +37,12 @@
#include <string.h>
#include <stdlib.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#include <gtksourceview/gtksourceview.h>
+#endif
#include <glib/gi18n.h>
@@ -48,6 +53,9 @@
#include "pluma-marshal.h"
#include "pluma-utils.h"
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
+#endif
#define PLUMA_VIEW_SCROLL_MARGIN 0.02
#define PLUMA_VIEW_SEARCH_DIALOG_TIMEOUT (30*1000) /* 30 seconds */
@@ -100,7 +108,11 @@ struct _PlumaViewPrivate
/* The search entry completion is shared among all the views */
GtkListStore *search_completion_model = NULL;
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void pluma_view_dispose (GObject *object);
+#else
static void pluma_view_destroy (GtkObject *object);
+#endif
static void pluma_view_finalize (GObject *object);
static gint pluma_view_focus_out (GtkWidget *widget,
GdkEventFocus *event);
@@ -131,9 +143,13 @@ static gboolean reset_searched_text (PlumaView *view);
static void hide_search_window (PlumaView *view,
gboolean cancel);
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+static gboolean pluma_view_draw (GtkWidget *widget,
+ cairo_t *cr);
+#else
static gint pluma_view_expose (GtkWidget *widget,
GdkEventExpose *event);
+#endif
static void search_highlight_updated_cb (PlumaDocument *doc,
GtkTextIter *start,
GtkTextIter *end,
@@ -143,7 +159,11 @@ static void pluma_view_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,
gint count);
+#if GTK_CHECK_VERSION (3, 0, 0)
+G_DEFINE_TYPE(PlumaView, pluma_view, GTK_SOURCE_TYPE_VIEW)
+#else
G_DEFINE_TYPE(PlumaView, pluma_view, GTK_TYPE_SOURCE_VIEW)
+#endif
/* Signals */
enum
@@ -178,17 +198,27 @@ static void
pluma_view_class_init (PlumaViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+#endif
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
GtkBindingSet *binding_set;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ object_class->dispose = pluma_view_dispose;
+#else
gtkobject_class->destroy = pluma_view_destroy;
+#endif
object_class->finalize = pluma_view_finalize;
widget_class->focus_out_event = pluma_view_focus_out;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ widget_class->draw = pluma_view_draw;
+#else
widget_class->expose_event = pluma_view_expose;
+#endif
/*
* Override the gtk_text_view_drag_motion and drag_drop
@@ -389,7 +419,11 @@ pluma_view_init (PlumaView *view)
}
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+pluma_view_dispose (GObject *object)
+#else
pluma_view_destroy (GtkObject *object)
+#endif
{
PlumaView *view;
@@ -414,7 +448,11 @@ pluma_view_destroy (GtkObject *object)
current_buffer_removed (view);
g_signal_handlers_disconnect_by_func (view, on_notify_buffer_cb, NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ (* G_OBJECT_CLASS (pluma_view_parent_class)->dispose) (object);
+#else
(* GTK_OBJECT_CLASS (pluma_view_parent_class)->destroy) (object);
+#endif
}
static void
@@ -900,14 +938,20 @@ send_focus_change (GtkWidget *widget,
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
g_object_ref (widget);
-
+
+#if !GTK_CHECK_VERSION (2, 21, 0)
if (in)
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
+#endif
fevent->focus_change.type = GDK_FOCUS_CHANGE;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
+#else
fevent->focus_change.window = g_object_ref (widget->window);
+#endif
fevent->focus_change.in = in;
gtk_widget_event (widget, fevent);
@@ -974,7 +1018,11 @@ update_search_window_position (PlumaView *view)
{
gint x, y;
gint view_x, view_y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkWindow *view_window = gtk_widget_get_window (GTK_WIDGET (view));
+#else
GdkWindow *view_window = GTK_WIDGET (view)->window;
+#endif
gtk_widget_realize (view->priv->search_window);
@@ -1428,16 +1476,25 @@ ensure_search_window (PlumaView *view)
GtkWidget *vbox;
GtkWidget *toplevel;
GtkEntryCompletion *completion;
+ GtkWindowGroup *group;
+ GtkWindowGroup *search_group;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ group = gtk_window_get_group (GTK_WINDOW (toplevel));
+ search_group = gtk_window_get_group (GTK_WINDOW (toplevel));
+#else
+ group = GTK_WINDOW (toplevel)->group;
+ search_group = GTK_WINDOW (view->priv->search_window)->group;
+#endif
if (view->priv->search_window != NULL)
{
- if (GTK_WINDOW (toplevel)->group)
- gtk_window_group_add_window (GTK_WINDOW (toplevel)->group,
+ if (group)
+ gtk_window_group_add_window (group,
GTK_WINDOW (view->priv->search_window));
- else if (GTK_WINDOW (view->priv->search_window)->group)
- gtk_window_group_remove_window (GTK_WINDOW (view->priv->search_window)->group,
+ else if (search_group)
+ gtk_window_group_remove_window (search_group,
GTK_WINDOW (view->priv->search_window));
customize_for_search_mode (view);
@@ -1447,8 +1504,8 @@ ensure_search_window (PlumaView *view)
view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
- if (GTK_WINDOW (toplevel)->group)
- gtk_window_group_add_window (GTK_WINDOW (toplevel)->group,
+ if (group)
+ gtk_window_group_add_window (group,
GTK_WINDOW (view->priv->search_window));
gtk_window_set_modal (GTK_WINDOW (view->priv->search_window), TRUE);
@@ -1746,7 +1803,11 @@ start_interactive_search_real (PlumaView *view)
GTK_WIDGET_VISIBLE (view->priv->search_window))
return TRUE;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (!gtk_widget_has_focus (view))
+#else
if (!GTK_WIDGET_HAS_FOCUS (view))
+#endif
return FALSE;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
@@ -1816,18 +1877,31 @@ start_interactive_goto_line (PlumaView *view)
return start_interactive_search_real (view);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static gboolean
+pluma_view_draw (GtkWidget *widget,
+ cairo_t *cr)
+#else
static gint
pluma_view_expose (GtkWidget *widget,
GdkEventExpose *event)
+#endif
{
GtkTextView *text_view;
PlumaDocument *doc;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkWindow *window;
+#endif
text_view = GTK_TEXT_VIEW (widget);
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (text_view));
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT);
+ if (gtk_cairo_should_draw_window (cr, window) &&
+#else
if ((event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)) &&
+#endif
pluma_document_get_enable_search_highlighting (doc))
{
GdkRectangle visible_rect;
@@ -1846,7 +1920,11 @@ pluma_view_expose (GtkWidget *widget,
&iter2);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ return GTK_WIDGET_CLASS (pluma_view_parent_class)->draw (widget, cr);
+#else
return (* GTK_WIDGET_CLASS (pluma_view_parent_class)->expose_event)(widget, event);
+#endif
}
static GdkAtom
@@ -1882,7 +1960,13 @@ pluma_view_drag_motion (GtkWidget *widget,
/* If this is a URL, deal with it here */
if (drag_get_uri_target (widget, context) != GDK_NONE)
{
- gdk_drag_status (context, context->suggested_action, timestamp);
+ gdk_drag_status (context,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_drag_context_get_suggested_action (context),
+#else
+ context->suggested_action,
+#endif
+ timestamp);
result = TRUE;
}
@@ -2062,6 +2146,7 @@ search_highlight_updated_cb (PlumaDocument *doc,
}
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
/* There is no "official" way to reset the im context in GtkTextView */
static void
reset_im_context (GtkTextView *text_view)
@@ -2072,6 +2157,7 @@ reset_im_context (GtkTextView *text_view)
gtk_im_context_reset (text_view->im_context);
}
}
+#endif
static void
delete_line (GtkTextView *text_view,
@@ -2083,7 +2169,11 @@ delete_line (GtkTextView *text_view,
buffer = gtk_text_view_get_buffer (text_view);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_text_view_reset_im_context (text_view);
+#else
reset_im_context (text_view);
+#endif
/* If there is a selection delete the selected lines and
* ignore count */
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index e4f6a541..b783d62c 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <gtksourceview/gtksource.h>
#include "pluma-ui.h"
#include "pluma-window.h"
@@ -61,6 +62,10 @@
#include "osx/pluma-osx.h"
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
+#endif
+
#define LANGUAGE_NONE (const gchar *)"LangNone"
#define PLUMA_UIFILE "pluma-ui.xml"
#define TAB_WIDTH_DATA "PlumaWindowTabWidthData"
@@ -2434,8 +2439,12 @@ language_changed (GObject *object,
}
static void
-notebook_switch_page (GtkNotebook *book,
+notebook_switch_page (GtkNotebook *book,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *pg,
+#else
GtkNotebookPage *pg,
+#endif
gint page_num,
PlumaWindow *window)
{
@@ -3597,13 +3606,20 @@ static void
vpaned_restore_position (GtkWidget *widget,
PlumaWindow *window)
{
+ GtkAllocation allocation;
gint pos;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_allocation (widget, &allocation);
+#else
+ allocation = widget->allocation;
+#endif
+
pluma_debug_message (DEBUG_WINDOW,
"Restoring vpaned position: bottom panel size %d",
window->priv->bottom_panel_size);
- pos = widget->allocation.height -
+ pos = allocation.height -
MAX (50, window->priv->bottom_panel_size);
gtk_paned_set_position (GTK_PANED (window->priv->vpaned), pos);
diff --git a/pluma/pluma.c b/pluma/pluma.c
index 61babb3f..a2e911af 100644
--- a/pluma/pluma.c
+++ b/pluma/pluma.c
@@ -397,7 +397,7 @@ on_message_received (const char *message,
* terminal. We also need to make sure that the window
* has been realized otherwise it will not work. lame.
*/
- if (!GTK_WIDGET_REALIZED (window))
+ if (!gtk_widget_get_realized (window))
gtk_widget_realize (GTK_WIDGET (window));
#ifdef GDK_WINDOWING_X11
@@ -556,10 +556,14 @@ main (int argc, char *argv[])
gchar *icon_dir;
/* Init type system as soon as possible */
+#if !GLIB_CHECK_VERSION (2, 36, 0)
g_type_init ();
+#endif
/* Init glib threads asap */
+#if !GLIB_CHECK_VERSION (2, 32, 0)
g_thread_init (NULL);
+#endif
/* Setup debugging */
pluma_debug_init ();
diff --git a/pluma/smclient/eggsmclient-private.h b/pluma/smclient/eggsmclient-private.h
index 2e41d6d9..d13035bf 100755
--- a/pluma/smclient/eggsmclient-private.h
+++ b/pluma/smclient/eggsmclient-private.h
@@ -20,7 +20,10 @@
#ifndef __EGG_SM_CLIENT_PRIVATE_H__
#define __EGG_SM_CLIENT_PRIVATE_H__
+#include <gtk/gtk.h>
+#if !GTK_CHECK_VERSION (3, 0, 0)
#include <gdkconfig.h>
+#endif
#include "eggsmclient.h"
G_BEGIN_DECLS
diff --git a/pluma/smclient/eggsmclient-xsmp.c b/pluma/smclient/eggsmclient-xsmp.c
index 75fced19..688e20eb 100755
--- a/pluma/smclient/eggsmclient-xsmp.c
+++ b/pluma/smclient/eggsmclient-xsmp.c
@@ -367,7 +367,11 @@ sm_client_xsmp_startup (EggSMClient *client,
free (ret_client_id);
gdk_threads_enter ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_x11_set_sm_client_id (xsmp->client_id);
+#else
gdk_set_sm_client_id (xsmp->client_id);
+#endif
gdk_threads_leave ();
g_debug ("Got client ID \"%s\"", xsmp->client_id);