From 70a9d462ec240b59bab82bc46ac60f64cb801a40 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 30 Oct 2013 23:13:21 +0100 Subject: [PATCH] filebrowser: Improve GTK3 support --- plugins/filebrowser/pluma-file-browser-view.c | 6 +++++- plugins/filebrowser/pluma-file-browser-widget.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c index eaad61f..6092248 100644 --- a/plugins/filebrowser/pluma-file-browser-view.c +++ b/plugins/filebrowser/pluma-file-browser-view.c @@ -323,7 +323,7 @@ set_click_policy_property (PlumaFileBrowserView *obj, obj->priv->hover_path = NULL; } - if (GTK_WIDGET_REALIZED (GTK_WIDGET (obj))) { + if (gtk_widget_get_realized (GTK_WIDGET (obj))) { win = gtk_widget_get_window (GTK_WIDGET (obj)); gdk_window_set_cursor (win, NULL); @@ -642,7 +642,11 @@ key_press_event (GtkWidget *widget, handled = FALSE; break; } +#if GTK_CHECK_VERSION (3, 0, 0) + if (!gtk_widget_has_focus (widget)) { +#else if (!GTK_WIDGET_HAS_FOCUS (widget)) { +#endif handled = FALSE; break; } diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index 8e9a0a8..6e6be10 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -997,7 +997,11 @@ create_toolbar (PlumaFileBrowserWidget * obj, "DirectoryPrevious"); g_object_set (action, "is_important", TRUE, "short_label", _("Previous location"), NULL); +#if GTK_CHECK_VERSION (2, 16, 0) + gtk_activatable_set_related_action (GTK_ACTIVATABLE (widget), action); +#else gtk_action_connect_proxy (action, widget); +#endif gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget), 0); /* Next directory menu tool item */ @@ -1018,7 +1022,11 @@ create_toolbar (PlumaFileBrowserWidget * obj, "DirectoryNext"); g_object_set (action, "is_important", TRUE, "short_label", _("Previous location"), NULL); +#if GTK_CHECK_VERSION (2, 16, 0) + gtk_activatable_set_related_action (GTK_ACTIVATABLE (widget), action); +#else gtk_action_connect_proxy (action, widget); +#endif gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget), 1); gtk_box_pack_start (GTK_BOX (obj), toolbar, FALSE, FALSE, 0);