pluma: Add GTK3 support

This commit is contained in:
Stefano Karapetsas 2013-10-30 00:56:56 +01:00
parent 5f87f64677
commit 7f0ccea481
31 changed files with 462 additions and 32 deletions

View File

@ -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))), gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
14); 14);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
#endif
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE);
gtk_window_set_title (GTK_WINDOW (dlg), ""); gtk_window_set_title (GTK_WINDOW (dlg), "");

View File

@ -320,7 +320,9 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg)
gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings")); gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings"));
gtk_window_set_default_size (GTK_WINDOW (dlg), 650, 400); 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); gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
#endif
/* HIG defaults */ /* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);

View File

@ -1085,7 +1085,9 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)
gtk_window_set_title (GTK_WINDOW (dlg), _("pluma Preferences")); gtk_window_set_title (GTK_WINDOW (dlg), _("pluma Preferences"));
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
#endif
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE); gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
/* HIG defaults */ /* HIG defaults */

View File

@ -34,7 +34,11 @@
#include <string.h> #include <string.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.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-search-dialog.h"
#include "pluma-history-entry.h" #include "pluma-history-entry.h"
@ -329,7 +333,9 @@ pluma_search_dialog_init (PlumaSearchDialog *dlg)
dlg->priv = PLUMA_SEARCH_DIALOG_GET_PRIVATE (dlg); dlg->priv = PLUMA_SEARCH_DIALOG_GET_PRIVATE (dlg);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
#endif
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE); gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (dlg), gtk_dialog_add_buttons (GTK_DIALOG (dlg),

View File

@ -632,7 +632,7 @@ pluma_app_get_active_window (PlumaApp *app)
* enough that the second instance comes up before the * enough that the second instance comes up before the
* first one shows its window. * 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)); gtk_widget_realize (GTK_WIDGET (app->priv->active_window));
return app->priv->active_window; return app->priv->active_window;

View File

@ -36,7 +36,12 @@
#include <string.h> #include <string.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.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-commands.h"
#include "pluma-debug.h" #include "pluma-debug.h"

View File

@ -38,7 +38,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksourceiter.h> #include <gtksourceview/gtksourceiter.h>
#endif
#include "pluma-prefs-manager-app.h" #include "pluma-prefs-manager-app.h"
#include "pluma-document.h" #include "pluma-document.h"
@ -173,7 +176,11 @@ enum {
static guint document_signals[LAST_SIGNAL] = { 0 }; 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) G_DEFINE_TYPE(PlumaDocument, pluma_document, GTK_TYPE_SOURCE_BUFFER)
#endif
GQuark GQuark
pluma_document_error_quark (void) pluma_document_error_quark (void)
@ -1842,7 +1849,11 @@ pluma_document_search_forward (PlumaDocument *doc,
GtkTextIter *match_end) GtkTextIter *match_end)
{ {
GtkTextIter iter; GtkTextIter iter;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags;
#else
GtkSourceSearchFlags search_flags; GtkSourceSearchFlags search_flags;
#endif
gboolean found = FALSE; gboolean found = FALSE;
GtkTextIter m_start; GtkTextIter m_start;
GtkTextIter m_end; GtkTextIter m_end;
@ -1865,17 +1876,29 @@ pluma_document_search_forward (PlumaDocument *doc,
gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &iter); gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &iter);
else else
iter = *start; 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; search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags)) 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; search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
} }
while (!found) while (!found)
{ {
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter, found = gtk_source_iter_forward_search (&iter,
#endif
doc->priv->search_text, doc->priv->search_text,
search_flags, search_flags,
&m_start, &m_start,
@ -1911,7 +1934,11 @@ pluma_document_search_backward (PlumaDocument *doc,
GtkTextIter *match_end) GtkTextIter *match_end)
{ {
GtkTextIter iter; GtkTextIter iter;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags;
#else
GtkSourceSearchFlags search_flags; GtkSourceSearchFlags search_flags;
#endif
gboolean found = FALSE; gboolean found = FALSE;
GtkTextIter m_start; GtkTextIter m_start;
GtkTextIter m_end; GtkTextIter m_end;
@ -1934,17 +1961,29 @@ pluma_document_search_backward (PlumaDocument *doc,
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter); gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
else else
iter = *end; 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; search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags)) 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; search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
} }
while (!found) while (!found)
{ {
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_backward_search (&iter,
#else
found = gtk_source_iter_backward_search (&iter, found = gtk_source_iter_backward_search (&iter,
#endif
doc->priv->search_text, doc->priv->search_text,
search_flags, search_flags,
&m_start, &m_start,
@ -1981,7 +2020,11 @@ pluma_document_replace_all (PlumaDocument *doc,
GtkTextIter iter; GtkTextIter iter;
GtkTextIter m_start; 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; GtkSourceSearchFlags search_flags = 0;
#endif
gboolean found = TRUE; gboolean found = TRUE;
gint cont = 0; gint cont = 0;
gchar *search_text; gchar *search_text;
@ -2006,11 +2049,19 @@ pluma_document_replace_all (PlumaDocument *doc,
gtk_text_buffer_get_start_iter (buffer, &iter); 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; search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (flags)) 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; search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
} }
replace_text_len = strlen (replace_text); replace_text_len = strlen (replace_text);
@ -2033,7 +2084,11 @@ pluma_document_replace_all (PlumaDocument *doc,
do do
{ {
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter, found = gtk_source_iter_forward_search (&iter,
#endif
search_text, search_text,
search_flags, search_flags,
&m_start, &m_start,
@ -2236,8 +2291,12 @@ search_region (PlumaDocument *doc,
{ {
GtkTextIter iter; GtkTextIter iter;
GtkTextIter m_start; 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; GtkSourceSearchFlags search_flags = 0;
#endif
gboolean found = TRUE; gboolean found = TRUE;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
@ -2296,12 +2355,20 @@ search_region (PlumaDocument *doc,
return; return;
iter = *start; 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; search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags)) 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; search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
} }
do do
@ -2309,7 +2376,11 @@ search_region (PlumaDocument *doc,
if ((end != NULL) && gtk_text_iter_is_end (end)) if ((end != NULL) && gtk_text_iter_is_end (end))
end = NULL; end = NULL;
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter, found = gtk_source_iter_forward_search (&iter,
#endif
doc->priv->search_text, doc->priv->search_text,
search_flags, search_flags,
&m_start, &m_start,

View File

@ -516,11 +516,18 @@ menu_position (GtkMenu *menu,
GtkTreePath *path; GtkTreePath *path;
GdkRectangle rect; GdkRectangle rect;
gint wx, wy; gint wx, wy;
GtkAllocation allocation;
GtkRequisition requisition; GtkRequisition requisition;
GtkWidget *w; GtkWidget *w;
w = panel->priv->treeview; 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); path = get_current_path (panel);
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w), gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w),
@ -531,21 +538,25 @@ menu_position (GtkMenu *menu,
wx = rect.x; wx = rect.x;
wy = rect.y; 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); gdk_window_get_origin (w->window, x, y);
#endif
gtk_widget_size_request (GTK_WIDGET (menu), &requisition); gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) 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 else
{ {
*x += w->allocation.x + 10; *x += allocation.x + 10;
} }
wy = MAX (*y + 5, *y + wy + 5); 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; *y = wy;

View File

@ -212,7 +212,11 @@ add_or_remove (PlumaEncodingsComboBox *menu,
gtk_window_set_transient_for (GTK_WINDOW (dialog), gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel)); GTK_WINDOW (toplevel));
#if GTK_CHECK_VERSION (3, 0, 0)
wg = gtk_window_get_group (GTK_WINDOW (toplevel));
#else
wg = GTK_WINDOW (toplevel)->group; wg = GTK_WINDOW (toplevel)->group;
#endif
if (wg == NULL) if (wg == NULL)
{ {
wg = gtk_window_group_new (); wg = gtk_window_group_new ();

View File

@ -32,7 +32,7 @@
#ifndef __PLUMA_ENCODINGS_COMBO_BOX_H__ #ifndef __PLUMA_ENCODINGS_COMBO_BOX_H__
#define __PLUMA_ENCODINGS_COMBO_BOX_H__ #define __PLUMA_ENCODINGS_COMBO_BOX_H__
#include <gtk/gtkoptionmenu.h> #include <gtk/gtk.h>
#include <pluma/pluma-encodings.h> #include <pluma/pluma-encodings.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -39,6 +39,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
#include "pluma-file-chooser-dialog.h" #include "pluma-file-chooser-dialog.h"
#include "pluma-encodings-combo-box.h" #include "pluma-encodings-combo-box.h"
@ -294,7 +295,11 @@ all_text_files_filter (const GtkFileFilterInfo *filter_info,
GtkSourceLanguage *lang; GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *languages); 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); g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), FALSE);
#endif
++languages; ++languages;
mime_types = gtk_source_language_get_mime_types (lang); mime_types = gtk_source_language_get_mime_types (lang);

View File

@ -64,7 +64,11 @@ struct _PlumaHistoryEntryPrivate
GSettings *settings; 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) G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_ENTRY)
#endif
static void static void
pluma_history_entry_set_property (GObject *object, pluma_history_entry_set_property (GObject *object,
@ -116,12 +120,20 @@ pluma_history_entry_get_property (GObject *object,
} }
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
pluma_history_entry_dispose (GObject *object)
#else
pluma_history_entry_destroy (GtkObject *object) pluma_history_entry_destroy (GtkObject *object)
#endif
{ {
pluma_history_entry_set_enable_completion (PLUMA_HISTORY_ENTRY (object), pluma_history_entry_set_enable_completion (PLUMA_HISTORY_ENTRY (object),
FALSE); 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); GTK_OBJECT_CLASS (pluma_history_entry_parent_class)->destroy (object);
#endif
} }
static void static void
@ -146,12 +158,18 @@ static void
pluma_history_entry_class_init (PlumaHistoryEntryClass *klass) pluma_history_entry_class_init (PlumaHistoryEntryClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
#endif
object_class->set_property = pluma_history_entry_set_property; object_class->set_property = pluma_history_entry_set_property;
object_class->get_property = pluma_history_entry_get_property; object_class->get_property = pluma_history_entry_get_property;
object_class->finalize = pluma_history_entry_finalize; 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; gtkobject_class->destroy = pluma_history_entry_destroy;
#endif
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_HISTORY_ID, PROP_HISTORY_ID,

View File

@ -48,12 +48,20 @@ typedef struct _PlumaHistoryEntryPrivate PlumaHistoryEntryPrivate;
struct _PlumaHistoryEntryClass struct _PlumaHistoryEntryClass
{ {
#if GTK_CHECK_VERSION (3, 0, 0)
GtkComboBoxTextClass parent_class;
#else
GtkComboBoxEntryClass parent_class; GtkComboBoxEntryClass parent_class;
#endif
}; };
struct _PlumaHistoryEntry struct _PlumaHistoryEntry
{ {
#if GTK_CHECK_VERSION (3, 0, 0)
GtkComboBoxText parent_instance;
#else
GtkComboBoxEntry parent_instance; GtkComboBoxEntry parent_instance;
#endif
PlumaHistoryEntryPrivate *priv; PlumaHistoryEntryPrivate *priv;
}; };

View File

@ -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_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (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); 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); GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL) if (secondary_text != NULL)
@ -154,7 +158,11 @@ set_message_area_text_and_icon (GtkWidget *message_area,
secondary_label = gtk_label_new (secondary_markup); secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup); g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); 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); GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (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_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (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); 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); GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL) if (secondary_text != NULL)
@ -580,7 +592,11 @@ create_conversion_error_message_area (const gchar *primary_text,
secondary_label = gtk_label_new (secondary_markup); secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup); g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); 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); GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (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_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (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); 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); GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("pluma opened this instance of the file in a non-editable way. " 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); secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup); g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); 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); GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (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_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (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); 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); GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); 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?"); 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); secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup); g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); 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); GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (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_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (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); 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); GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); 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. " 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); secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup); g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); 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); GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
#endif
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);

View File

@ -30,6 +30,8 @@
*/ */
#include <string.h> #include <string.h>
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
#include "pluma-language-manager.h" #include "pluma-language-manager.h"
#include "pluma-prefs-manager.h" #include "pluma-prefs-manager.h"
@ -76,7 +78,11 @@ pluma_language_manager_list_languages_sorted (GtkSourceLanguageManager *lm,
GtkSourceLanguage *lang; GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *ids); 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); g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), NULL);
#endif
++ids; ++ids;
if (include_hidden || !gtk_source_language_get_hidden (lang)) if (include_hidden || !gtk_source_language_get_hidden (lang))

View File

@ -32,6 +32,7 @@
#ifndef __PLUMA_LANGUAGES_MANAGER_H__ #ifndef __PLUMA_LANGUAGES_MANAGER_H__
#define __PLUMA_LANGUAGES_MANAGER_H__ #define __PLUMA_LANGUAGES_MANAGER_H__
#include <glib-object.h>
#include <gtksourceview/gtksourcelanguagemanager.h> #include <gtksourceview/gtksourcelanguagemanager.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -100,7 +100,11 @@ enum
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
pluma_notebook_dispose (GObject *object)
#else
pluma_notebook_destroy (GtkObject *object) pluma_notebook_destroy (GtkObject *object)
#endif
{ {
PlumaNotebook *notebook = PLUMA_NOTEBOOK (object); PlumaNotebook *notebook = PLUMA_NOTEBOOK (object);
@ -120,19 +124,29 @@ pluma_notebook_destroy (GtkObject *object)
notebook->priv->destroy_has_run = TRUE; 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); GTK_OBJECT_CLASS (pluma_notebook_parent_class)->destroy (object);
#endif
} }
static void static void
pluma_notebook_class_init (PlumaNotebookClass *klass) pluma_notebook_class_init (PlumaNotebookClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
#endif
GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass); GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass);
object_class->finalize = pluma_notebook_finalize; 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; gtkobject_class->destroy = pluma_notebook_destroy;
#endif
notebook_class->change_current_page = pluma_notebook_change_current_page; notebook_class->change_current_page = pluma_notebook_change_current_page;
signals[TAB_ADDED] = signals[TAB_ADDED] =
@ -247,10 +261,12 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (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) if (GTK_NOTEBOOK (notebook)->first_tab == NULL)
{ {
return AFTER_ALL_TABS; return AFTER_ALL_TABS;
} }
#endif
/* For some reason unfullscreen + quick click can /* For some reason unfullscreen + quick click can
cause a wrong click event to be reported to the tab */ 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) while ((page = gtk_notebook_get_nth_page (nb, page_num)) != NULL)
{ {
GtkAllocation allocation;
GtkWidget *tab; GtkWidget *tab;
gint max_x, max_y; gint max_x, max_y;
gint x_root, y_root; gint x_root, y_root;
@ -268,17 +285,31 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
tab = gtk_notebook_get_tab_label (nb, page); tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS); 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))) if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
#endif
{ {
++page_num; ++page_num;
continue; 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), gdk_window_get_origin (GDK_WINDOW (tab->window),
#endif
&x_root, &y_root); &x_root, &y_root);
max_x = x_root + tab->allocation.x + tab->allocation.width; #if GTK_CHECK_VERSION (3, 0, 0)
max_y = y_root + tab->allocation.y + tab->allocation.height; 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) || if (((tab_pos == GTK_POS_TOP) ||
(tab_pos == GTK_POS_BOTTOM)) && (tab_pos == GTK_POS_BOTTOM)) &&
@ -658,7 +689,11 @@ pluma_notebook_new (void)
static void static void
pluma_notebook_switch_page_cb (GtkNotebook *notebook, pluma_notebook_switch_page_cb (GtkNotebook *notebook,
#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *page,
#else
GtkNotebookPage *page, GtkNotebookPage *page,
#endif
guint page_num, guint page_num,
gpointer data) gpointer data)
{ {

View File

@ -34,6 +34,9 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkkeysyms.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-close-button.h"
#include "pluma-window.h" #include "pluma-window.h"
@ -271,6 +274,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
case GTK_IMAGE_EMPTY: case GTK_IMAGE_EMPTY:
gtk_image_clear (image); gtk_image_clear (image);
break; break;
#if !GTK_CHECK_VERSION (3, 0, 0)
case GTK_IMAGE_PIXMAP: case GTK_IMAGE_PIXMAP:
{ {
GdkPixmap *pm; GdkPixmap *pm;
@ -289,6 +293,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
gtk_image_set_from_image (image, i, bm); gtk_image_set_from_image (image, i, bm);
} }
break; break;
#endif
case GTK_IMAGE_PIXBUF: case GTK_IMAGE_PIXBUF:
{ {
GdkPixbuf *pb; GdkPixbuf *pb;
@ -367,7 +372,11 @@ sync_title (PlumaPanel *panel,
static void static void
notebook_page_changed (GtkNotebook *notebook, notebook_page_changed (GtkNotebook *notebook,
#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *page,
#else
GtkNotebookPage *page, GtkNotebookPage *page,
#endif
guint page_num, guint page_num,
PlumaPanel *panel) PlumaPanel *panel)
{ {
@ -697,7 +706,11 @@ pluma_panel_add_item (PlumaPanel *panel,
menu_label = gtk_label_new (name); menu_label = gtk_label_new (name);
gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5); 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)) if (!GTK_WIDGET_VISIBLE (item))
#endif
gtk_widget_show (item); gtk_widget_show (item);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (panel->priv->notebook), gtk_notebook_append_page_menu (GTK_NOTEBOOK (panel->priv->notebook),

View File

@ -1207,7 +1207,11 @@ pluma_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
while (l != NULL) 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)); g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
#endif
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data), gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
enable); enable);
@ -1313,7 +1317,11 @@ pluma_prefs_manager_source_style_scheme_changed (GSettings *settings,
docs = pluma_app_get_documents (pluma_app_get_default ()); docs = pluma_app_get_documents (pluma_app_get_default ());
for (l = docs; l != NULL; l = l->next) 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)); g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
#endif
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data), gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data),
style); style);

View File

@ -517,7 +517,11 @@ create_compositor (PlumaPrintJob *job)
print_font_numbers = pluma_prefs_manager_get_print_font_numbers (); print_font_numbers = pluma_prefs_manager_get_print_font_numbers ();
job->priv->compositor = GTK_SOURCE_PRINT_COMPOSITOR ( 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, g_object_new (GTK_TYPE_SOURCE_PRINT_COMPOSITOR,
#endif
"buffer", GTK_SOURCE_BUFFER (job->priv->doc), "buffer", GTK_SOURCE_BUFFER (job->priv->doc),
"tab-width", gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (job->priv->view)), "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)) && "highlight-syntax", gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (job->priv->doc)) &&

View File

@ -34,8 +34,11 @@
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.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> #include <cairo-pdf.h>
@ -956,7 +959,11 @@ create_preview_layout (PlumaPrintPreview *preview)
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_PRESS_MASK |
GDK_KEY_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); GTK_WIDGET_SET_FLAGS (priv->layout, GTK_CAN_FOCUS);
#endif
g_signal_connect (priv->layout, g_signal_connect (priv->layout,
"key-press-event", "key-press-event",

View File

@ -54,6 +54,10 @@
#include "dialogs/pluma-close-confirmation-dialog.h" #include "dialogs/pluma-close-confirmation-dialog.h"
#include "smclient/eggsmclient.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 */ /* The master client we use for SM */
static EggSMClient *master_client = NULL; static EggSMClient *master_client = NULL;

View File

@ -173,18 +173,25 @@ menu_position_func (GtkMenu *menu,
PlumaStatusComboBox *combo) PlumaStatusComboBox *combo)
{ {
GtkRequisition request; GtkRequisition request;
GtkAllocation allocation;
*push_in = FALSE; *push_in = FALSE;
gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request); gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request);
/* get the origin... */ /* 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); gdk_window_get_origin (GTK_WIDGET (combo)->window, x, y);
allocation = GTK_WIDGET (combo)->allocation;
#endif
/* make the menu as wide as the widget */ /* 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 */ /* position it above the widget */
@ -197,12 +204,18 @@ button_press_event (GtkWidget *widget,
PlumaStatusComboBox *combo) PlumaStatusComboBox *combo)
{ {
GtkRequisition request; GtkRequisition request;
GtkAllocation allocation;
gint max_height; gint max_height;
gtk_widget_size_request (combo->priv->menu, &request); 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 */ /* 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) if (request.height > max_height)
{ {

View File

@ -76,6 +76,15 @@ get_overwrite_mode_length (void)
return 2 + MAX (g_utf8_strlen (_("OVR"), -1), g_utf8_strlen (_("INS"), -1)); 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 static void
pluma_statusbar_notify (GObject *object, pluma_statusbar_notify (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
@ -389,7 +398,11 @@ pluma_statusbar_flash_message (PlumaStatusbar *statusbar,
msg); msg);
statusbar->priv->flash_timeout = g_timeout_add (flash_length, 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, (GtkFunction) remove_message_timeout,
#endif
statusbar); statusbar);
g_free (msg); g_free (msg);

View File

@ -28,6 +28,10 @@
* $Id$ * $Id$
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -103,7 +107,11 @@ pluma_style_scheme_manager_list_schemes_sorted (GtkSourceStyleSchemeManager *man
const gchar * const * scheme_ids; const gchar * const * scheme_ids;
GSList *schemes = NULL; 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); 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); 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; 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); g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), NULL);
#endif
g_return_val_if_fail (fname != NULL, NULL); g_return_val_if_fail (fname != NULL, NULL);
dirname = g_path_get_dirname (fname); dirname = g_path_get_dirname (fname);
@ -343,7 +355,11 @@ _pluma_style_scheme_manager_uninstall_scheme (GtkSourceStyleSchemeManager *manag
GtkSourceStyleScheme *scheme; GtkSourceStyleScheme *scheme;
const gchar *filename; 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); g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), FALSE);
#endif
g_return_val_if_fail (id != NULL, FALSE); g_return_val_if_fail (id != NULL, FALSE);
scheme = gtk_source_style_scheme_manager_get_scheme (manager, id); scheme = gtk_source_style_scheme_manager_get_scheme (manager, id);

View File

@ -125,22 +125,29 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu,
{ {
GtkWidget *widget; GtkWidget *widget;
GtkRequisition requisition; GtkRequisition requisition;
GtkAllocation allocation;
widget = GTK_WIDGET (user_data); widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y); widget_get_origin (widget, x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition); 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) 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 else
{ {
*x += widget->allocation.x; *x += allocation.x;
} }
*y += widget->allocation.y + widget->allocation.height; *y += allocation.y + allocation.height;
*push_in = TRUE; *push_in = TRUE;
} }
@ -234,7 +241,11 @@ pluma_dialog_add_button (GtkDialog *dialog,
button = pluma_gtk_button_new_with_stock_icon (text, stock_id); button = pluma_gtk_button_new_with_stock_icon (text, stock_id);
g_return_val_if_fail (button != NULL, NULL); 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); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
#endif
gtk_widget_show (button); gtk_widget_show (button);
@ -900,10 +911,18 @@ pluma_utils_get_window_workspace (GtkWindow *gtkwindow)
guint ret = PLUMA_ALL_WORKSPACES; guint ret = PLUMA_ALL_WORKSPACES;
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0); 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); g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);
#endif
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow)); 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); display = gdk_drawable_get_display (window);
#endif
gdk_error_trap_push (); gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),

View File

@ -37,7 +37,12 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.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> #include <glib/gi18n.h>
@ -48,6 +53,9 @@
#include "pluma-marshal.h" #include "pluma-marshal.h"
#include "pluma-utils.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_SCROLL_MARGIN 0.02
#define PLUMA_VIEW_SEARCH_DIALOG_TIMEOUT (30*1000) /* 30 seconds */ #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 */ /* The search entry completion is shared among all the views */
GtkListStore *search_completion_model = NULL; 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); static void pluma_view_destroy (GtkObject *object);
#endif
static void pluma_view_finalize (GObject *object); static void pluma_view_finalize (GObject *object);
static gint pluma_view_focus_out (GtkWidget *widget, static gint pluma_view_focus_out (GtkWidget *widget,
GdkEventFocus *event); GdkEventFocus *event);
@ -131,9 +143,13 @@ static gboolean reset_searched_text (PlumaView *view);
static void hide_search_window (PlumaView *view, static void hide_search_window (PlumaView *view,
gboolean cancel); 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, static gint pluma_view_expose (GtkWidget *widget,
GdkEventExpose *event); GdkEventExpose *event);
#endif
static void search_highlight_updated_cb (PlumaDocument *doc, static void search_highlight_updated_cb (PlumaDocument *doc,
GtkTextIter *start, GtkTextIter *start,
GtkTextIter *end, GtkTextIter *end,
@ -143,7 +159,11 @@ static void pluma_view_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type, GtkDeleteType type,
gint count); 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) G_DEFINE_TYPE(PlumaView, pluma_view, GTK_TYPE_SOURCE_VIEW)
#endif
/* Signals */ /* Signals */
enum enum
@ -178,17 +198,27 @@ static void
pluma_view_class_init (PlumaViewClass *klass) pluma_view_class_init (PlumaViewClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
#endif
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass); GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
GtkBindingSet *binding_set; GtkBindingSet *binding_set;
#if GTK_CHECK_VERSION (3, 0, 0)
object_class->dispose = pluma_view_dispose;
#else
gtkobject_class->destroy = pluma_view_destroy; gtkobject_class->destroy = pluma_view_destroy;
#endif
object_class->finalize = pluma_view_finalize; object_class->finalize = pluma_view_finalize;
widget_class->focus_out_event = pluma_view_focus_out; 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; widget_class->expose_event = pluma_view_expose;
#endif
/* /*
* Override the gtk_text_view_drag_motion and drag_drop * Override the gtk_text_view_drag_motion and drag_drop
@ -389,7 +419,11 @@ pluma_view_init (PlumaView *view)
} }
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
pluma_view_dispose (GObject *object)
#else
pluma_view_destroy (GtkObject *object) pluma_view_destroy (GtkObject *object)
#endif
{ {
PlumaView *view; PlumaView *view;
@ -414,7 +448,11 @@ pluma_view_destroy (GtkObject *object)
current_buffer_removed (view); current_buffer_removed (view);
g_signal_handlers_disconnect_by_func (view, on_notify_buffer_cb, NULL); 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); (* GTK_OBJECT_CLASS (pluma_view_parent_class)->destroy) (object);
#endif
} }
static void static void
@ -900,14 +938,20 @@ send_focus_change (GtkWidget *widget,
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE); GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
g_object_ref (widget); g_object_ref (widget);
#if !GTK_CHECK_VERSION (2, 21, 0)
if (in) if (in)
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
else else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
#endif
fevent->focus_change.type = GDK_FOCUS_CHANGE; 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); fevent->focus_change.window = g_object_ref (widget->window);
#endif
fevent->focus_change.in = in; fevent->focus_change.in = in;
gtk_widget_event (widget, fevent); gtk_widget_event (widget, fevent);
@ -974,7 +1018,11 @@ update_search_window_position (PlumaView *view)
{ {
gint x, y; gint x, y;
gint view_x, view_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; GdkWindow *view_window = GTK_WIDGET (view)->window;
#endif
gtk_widget_realize (view->priv->search_window); gtk_widget_realize (view->priv->search_window);
@ -1428,16 +1476,25 @@ ensure_search_window (PlumaView *view)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *toplevel; GtkWidget *toplevel;
GtkEntryCompletion *completion; GtkEntryCompletion *completion;
GtkWindowGroup *group;
GtkWindowGroup *search_group;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); 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 (view->priv->search_window != NULL)
{ {
if (GTK_WINDOW (toplevel)->group) if (group)
gtk_window_group_add_window (GTK_WINDOW (toplevel)->group, gtk_window_group_add_window (group,
GTK_WINDOW (view->priv->search_window)); GTK_WINDOW (view->priv->search_window));
else if (GTK_WINDOW (view->priv->search_window)->group) else if (search_group)
gtk_window_group_remove_window (GTK_WINDOW (view->priv->search_window)->group, gtk_window_group_remove_window (search_group,
GTK_WINDOW (view->priv->search_window)); GTK_WINDOW (view->priv->search_window));
customize_for_search_mode (view); customize_for_search_mode (view);
@ -1447,8 +1504,8 @@ ensure_search_window (PlumaView *view)
view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP); view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
if (GTK_WINDOW (toplevel)->group) if (group)
gtk_window_group_add_window (GTK_WINDOW (toplevel)->group, gtk_window_group_add_window (group,
GTK_WINDOW (view->priv->search_window)); GTK_WINDOW (view->priv->search_window));
gtk_window_set_modal (GTK_WINDOW (view->priv->search_window), TRUE); 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)) GTK_WIDGET_VISIBLE (view->priv->search_window))
return TRUE; return TRUE;
#if GTK_CHECK_VERSION (3, 0, 0)
if (!gtk_widget_has_focus (view))
#else
if (!GTK_WIDGET_HAS_FOCUS (view)) if (!GTK_WIDGET_HAS_FOCUS (view))
#endif
return FALSE; return FALSE;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); 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); 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 static gint
pluma_view_expose (GtkWidget *widget, pluma_view_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
#endif
{ {
GtkTextView *text_view; GtkTextView *text_view;
PlumaDocument *doc; PlumaDocument *doc;
#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *window;
#endif
text_view = GTK_TEXT_VIEW (widget); text_view = GTK_TEXT_VIEW (widget);
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (text_view)); 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)) && if ((event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)) &&
#endif
pluma_document_get_enable_search_highlighting (doc)) pluma_document_get_enable_search_highlighting (doc))
{ {
GdkRectangle visible_rect; GdkRectangle visible_rect;
@ -1846,7 +1920,11 @@ pluma_view_expose (GtkWidget *widget,
&iter2); &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); return (* GTK_WIDGET_CLASS (pluma_view_parent_class)->expose_event)(widget, event);
#endif
} }
static GdkAtom static GdkAtom
@ -1882,7 +1960,13 @@ pluma_view_drag_motion (GtkWidget *widget,
/* If this is a URL, deal with it here */ /* If this is a URL, deal with it here */
if (drag_get_uri_target (widget, context) != GDK_NONE) 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; 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 */ /* There is no "official" way to reset the im context in GtkTextView */
static void static void
reset_im_context (GtkTextView *text_view) reset_im_context (GtkTextView *text_view)
@ -2072,6 +2157,7 @@ reset_im_context (GtkTextView *text_view)
gtk_im_context_reset (text_view->im_context); gtk_im_context_reset (text_view->im_context);
} }
} }
#endif
static void static void
delete_line (GtkTextView *text_view, delete_line (GtkTextView *text_view,
@ -2083,7 +2169,11 @@ delete_line (GtkTextView *text_view,
buffer = gtk_text_view_get_buffer (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); reset_im_context (text_view);
#endif
/* If there is a selection delete the selected lines and /* If there is a selection delete the selected lines and
* ignore count */ * ignore count */

View File

@ -38,6 +38,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <gtksourceview/gtksource.h>
#include "pluma-ui.h" #include "pluma-ui.h"
#include "pluma-window.h" #include "pluma-window.h"
@ -61,6 +62,10 @@
#include "osx/pluma-osx.h" #include "osx/pluma-osx.h"
#endif #endif
#if GTK_CHECK_VERSION (3, 0, 0)
#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
#endif
#define LANGUAGE_NONE (const gchar *)"LangNone" #define LANGUAGE_NONE (const gchar *)"LangNone"
#define PLUMA_UIFILE "pluma-ui.xml" #define PLUMA_UIFILE "pluma-ui.xml"
#define TAB_WIDTH_DATA "PlumaWindowTabWidthData" #define TAB_WIDTH_DATA "PlumaWindowTabWidthData"
@ -2434,8 +2439,12 @@ language_changed (GObject *object,
} }
static void static void
notebook_switch_page (GtkNotebook *book, notebook_switch_page (GtkNotebook *book,
#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *pg,
#else
GtkNotebookPage *pg, GtkNotebookPage *pg,
#endif
gint page_num, gint page_num,
PlumaWindow *window) PlumaWindow *window)
{ {
@ -3597,13 +3606,20 @@ static void
vpaned_restore_position (GtkWidget *widget, vpaned_restore_position (GtkWidget *widget,
PlumaWindow *window) PlumaWindow *window)
{ {
GtkAllocation allocation;
gint pos; 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, pluma_debug_message (DEBUG_WINDOW,
"Restoring vpaned position: bottom panel size %d", "Restoring vpaned position: bottom panel size %d",
window->priv->bottom_panel_size); window->priv->bottom_panel_size);
pos = widget->allocation.height - pos = allocation.height -
MAX (50, window->priv->bottom_panel_size); MAX (50, window->priv->bottom_panel_size);
gtk_paned_set_position (GTK_PANED (window->priv->vpaned), pos); gtk_paned_set_position (GTK_PANED (window->priv->vpaned), pos);

View File

@ -397,7 +397,7 @@ on_message_received (const char *message,
* terminal. We also need to make sure that the window * terminal. We also need to make sure that the window
* has been realized otherwise it will not work. lame. * 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)); gtk_widget_realize (GTK_WIDGET (window));
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
@ -556,10 +556,14 @@ main (int argc, char *argv[])
gchar *icon_dir; gchar *icon_dir;
/* Init type system as soon as possible */ /* Init type system as soon as possible */
#if !GLIB_CHECK_VERSION (2, 36, 0)
g_type_init (); g_type_init ();
#endif
/* Init glib threads asap */ /* Init glib threads asap */
#if !GLIB_CHECK_VERSION (2, 32, 0)
g_thread_init (NULL); g_thread_init (NULL);
#endif
/* Setup debugging */ /* Setup debugging */
pluma_debug_init (); pluma_debug_init ();

View File

@ -20,7 +20,10 @@
#ifndef __EGG_SM_CLIENT_PRIVATE_H__ #ifndef __EGG_SM_CLIENT_PRIVATE_H__
#define __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> #include <gdkconfig.h>
#endif
#include "eggsmclient.h" #include "eggsmclient.h"
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -367,7 +367,11 @@ sm_client_xsmp_startup (EggSMClient *client,
free (ret_client_id); free (ret_client_id);
gdk_threads_enter (); 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); gdk_set_sm_client_id (xsmp->client_id);
#endif
gdk_threads_leave (); gdk_threads_leave ();
g_debug ("Got client ID \"%s\"", xsmp->client_id); g_debug ("Got client ID \"%s\"", xsmp->client_id);