|
|
d816b7 |
From 1af3e80a6134579bffd802f6855a5f368f75d99d Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 12:01:21 +0000
|
|
|
d816b7 |
Subject: [PATCH 1/7] Avoid gtk_label_set_xalign()
|
|
|
d816b7 |
|
|
|
d816b7 |
Depend against GTK+ versions older than 3.16.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/access.c | 8 ++++++++
|
|
|
d816b7 |
1 file changed, 8 insertions(+)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/access.c b/src/access.c
|
|
|
d816b7 |
index f67e06c..f469dba 100644
|
|
|
d816b7 |
--- a/src/access.c
|
|
|
d816b7 |
+++ b/src/access.c
|
|
|
d816b7 |
@@ -329,7 +329,15 @@ handle_access_dialog (XdpImplAccess *object,
|
|
|
d816b7 |
body_label = gtk_label_new (arg_body);
|
|
|
d816b7 |
gtk_widget_set_halign (body_label, GTK_ALIGN_START);
|
|
|
d816b7 |
g_object_set (body_label, "margin-top", 10, NULL);
|
|
|
d816b7 |
+#if GTK_CHECK_VERSION (3,16,0)
|
|
|
d816b7 |
gtk_label_set_xalign (GTK_LABEL (body_label), 0);
|
|
|
d816b7 |
+#else
|
|
|
d816b7 |
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
d816b7 |
+ /* This is deprecated in 3.14, but gtk_label_set_xalign() is not
|
|
|
d816b7 |
+ * available until 3.16. */
|
|
|
d816b7 |
+ gtk_misc_set_alignment (GTK_MISC (body_label), 0.0, 0.5);
|
|
|
d816b7 |
+G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
d816b7 |
+#endif
|
|
|
d816b7 |
gtk_label_set_line_wrap (GTK_LABEL (body_label), TRUE);
|
|
|
d816b7 |
gtk_label_set_max_width_chars (GTK_LABEL (body_label), 50);
|
|
|
d816b7 |
gtk_widget_show (body_label);
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From d7e23b9c3017467f0edfe7c9b127befe85aae2c6 Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 14:14:55 +0000
|
|
|
d816b7 |
Subject: [PATCH 2/7] Avoid G_DECLARE_* macros
|
|
|
d816b7 |
|
|
|
d816b7 |
Using the new G_DECLARE_FINAL_TYPE and G_DECLARE_DERIVABLE_TYPE means
|
|
|
d816b7 |
that GTK+ types must support g_autoptr(), which was only added in GTK+
|
|
|
d816b7 |
3.16.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/accountdialog.h | 6 +++++-
|
|
|
d816b7 |
src/appchooserdialog.h | 6 +++++-
|
|
|
d816b7 |
src/appchooserrow.h | 7 ++++++-
|
|
|
d816b7 |
src/externalwindow-wayland.c | 5 +++++
|
|
|
d816b7 |
src/externalwindow-wayland.h | 7 +++++--
|
|
|
d816b7 |
src/externalwindow-x11.c | 5 +++++
|
|
|
d816b7 |
src/externalwindow-x11.h | 7 +++++--
|
|
|
d816b7 |
src/externalwindow.h | 14 ++++++++++++--
|
|
|
d816b7 |
src/screenshotdialog.h | 6 +++++-
|
|
|
d816b7 |
9 files changed, 53 insertions(+), 10 deletions(-)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/accountdialog.h b/src/accountdialog.h
|
|
|
d816b7 |
index 1005e74..e209343 100644
|
|
|
d816b7 |
--- a/src/accountdialog.h
|
|
|
d816b7 |
+++ b/src/accountdialog.h
|
|
|
d816b7 |
@@ -1,6 +1,10 @@
|
|
|
d816b7 |
#include <gtk/gtk.h>
|
|
|
d816b7 |
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (AccountDialog, account_dialog, ACCOUNT, DIALOG, GtkWindow)
|
|
|
d816b7 |
+#define ACCOUNT_TYPE_DIALOG (account_dialog_get_type ())
|
|
|
d816b7 |
+#define ACCOUNT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST (object, ACCOUNT_TYPE_DIALOG, AccountDialog))
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+typedef struct _AccountDialog AccountDialog;
|
|
|
d816b7 |
+typedef struct _AccountDialogClass AccountDialogClass;
|
|
|
d816b7 |
|
|
|
d816b7 |
AccountDialog * account_dialog_new (const char *app_id,
|
|
|
d816b7 |
const char *user_name,
|
|
|
d816b7 |
diff --git a/src/appchooserdialog.h b/src/appchooserdialog.h
|
|
|
d816b7 |
index 2e1ba62..c9a6ea8 100644
|
|
|
d816b7 |
--- a/src/appchooserdialog.h
|
|
|
d816b7 |
+++ b/src/appchooserdialog.h
|
|
|
d816b7 |
@@ -22,7 +22,11 @@
|
|
|
d816b7 |
|
|
|
d816b7 |
#include <gtk/gtk.h>
|
|
|
d816b7 |
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (AppChooserDialog, app_chooser_dialog, APP, CHOOSER_DIALOG, GtkWindow)
|
|
|
d816b7 |
+#define APP_TYPE_CHOOSER_DIALOG (app_chooser_dialog_get_type ())
|
|
|
d816b7 |
+#define APP_CHOOSER_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST (object, APP_TYPE_CHOOSER_DIALOG, AppChooserDialog))
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+typedef struct _AppChooserDialog AppChooserDialog;
|
|
|
d816b7 |
+typedef struct _AppChooserDialogClass AppChooserDialogClass;
|
|
|
d816b7 |
|
|
|
d816b7 |
AppChooserDialog * app_chooser_dialog_new (const char **app_ids,
|
|
|
d816b7 |
const char *default_id,
|
|
|
d816b7 |
diff --git a/src/appchooserrow.h b/src/appchooserrow.h
|
|
|
d816b7 |
index 162f1e8..23ee2e4 100644
|
|
|
d816b7 |
--- a/src/appchooserrow.h
|
|
|
d816b7 |
+++ b/src/appchooserrow.h
|
|
|
d816b7 |
@@ -22,8 +22,13 @@
|
|
|
d816b7 |
|
|
|
d816b7 |
#include <gtk/gtk.h>
|
|
|
d816b7 |
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (AppChooserRow, app_chooser_row, APP, CHOOSER_ROW, GtkListBox)
|
|
|
d816b7 |
+#define APP_TYPE_CHOOSER_ROW (app_chooser_row_get_type ())
|
|
|
d816b7 |
+#define APP_CHOOSER_ROW(object) (G_TYPE_CHECK_INSTANCE_CAST (object, APP_TYPE_CHOOSER_ROW, AppChooserRow))
|
|
|
d816b7 |
|
|
|
d816b7 |
+typedef struct _AppChooserRow AppChooserRow;
|
|
|
d816b7 |
+typedef struct _AppChooserRowClass AppChooserRowClass;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+GType app_chooser_row_get_type (void);
|
|
|
d816b7 |
AppChooserRow *app_chooser_row_new (GAppInfo *info);
|
|
|
d816b7 |
void app_chooser_row_set_selected (AppChooserRow *row,
|
|
|
d816b7 |
gboolean selected);
|
|
|
d816b7 |
diff --git a/src/externalwindow-wayland.c b/src/externalwindow-wayland.c
|
|
|
d816b7 |
index cb6510c..c3c7820 100644
|
|
|
d816b7 |
--- a/src/externalwindow-wayland.c
|
|
|
d816b7 |
+++ b/src/externalwindow-wayland.c
|
|
|
d816b7 |
@@ -34,6 +34,11 @@ struct _ExternalWindowWayland
|
|
|
d816b7 |
char *handle_str;
|
|
|
d816b7 |
};
|
|
|
d816b7 |
|
|
|
d816b7 |
+struct _ExternalWindowWaylandClass
|
|
|
d816b7 |
+{
|
|
|
d816b7 |
+ ExternalWindowClass parent_class;
|
|
|
d816b7 |
+};
|
|
|
d816b7 |
+
|
|
|
d816b7 |
G_DEFINE_TYPE (ExternalWindowWayland, external_window_wayland,
|
|
|
d816b7 |
EXTERNAL_TYPE_WINDOW)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/externalwindow-wayland.h b/src/externalwindow-wayland.h
|
|
|
d816b7 |
index 5009244..ede29ef 100644
|
|
|
d816b7 |
--- a/src/externalwindow-wayland.h
|
|
|
d816b7 |
+++ b/src/externalwindow-wayland.h
|
|
|
d816b7 |
@@ -25,7 +25,10 @@
|
|
|
d816b7 |
#include "externalwindow.h"
|
|
|
d816b7 |
|
|
|
d816b7 |
#define EXTERNAL_TYPE_WINDOW_WAYLAND (external_window_wayland_get_type ())
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (ExternalWindowWayland, external_window_wayland,
|
|
|
d816b7 |
- EXTERNAL, WINDOW_WAYLAND, ExternalWindow)
|
|
|
d816b7 |
+#define EXTERNAL_WINDOW_WAYLAND(object) (G_TYPE_CHECK_INSTANCE_CAST (object, EXTERNAL_TYPE_WINDOW_WAYLAND, ExternalWindowWayland))
|
|
|
d816b7 |
|
|
|
d816b7 |
+typedef struct _ExternalWindowWayland ExternalWindowWayland;
|
|
|
d816b7 |
+typedef struct _ExternalWindowWaylandClass ExternalWindowWaylandClass;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+GType external_window_wayland_get_type (void);
|
|
|
d816b7 |
ExternalWindowWayland *external_window_wayland_new (const char *handle_str);
|
|
|
d816b7 |
diff --git a/src/externalwindow-x11.c b/src/externalwindow-x11.c
|
|
|
d816b7 |
index bc8e199..a61b124 100644
|
|
|
d816b7 |
--- a/src/externalwindow-x11.c
|
|
|
d816b7 |
+++ b/src/externalwindow-x11.c
|
|
|
d816b7 |
@@ -37,6 +37,11 @@ struct _ExternalWindowX11
|
|
|
d816b7 |
GdkWindow *foreign_gdk_window;
|
|
|
d816b7 |
};
|
|
|
d816b7 |
|
|
|
d816b7 |
+struct _ExternalWindowX11Class
|
|
|
d816b7 |
+{
|
|
|
d816b7 |
+ ExternalWindowClass parent_class;
|
|
|
d816b7 |
+};
|
|
|
d816b7 |
+
|
|
|
d816b7 |
G_DEFINE_TYPE (ExternalWindowX11, external_window_x11,
|
|
|
d816b7 |
EXTERNAL_TYPE_WINDOW)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/externalwindow-x11.h b/src/externalwindow-x11.h
|
|
|
d816b7 |
index 9cb9c6d..d380a3d 100644
|
|
|
d816b7 |
--- a/src/externalwindow-x11.h
|
|
|
d816b7 |
+++ b/src/externalwindow-x11.h
|
|
|
d816b7 |
@@ -26,7 +26,10 @@
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
#define EXTERNAL_TYPE_WINDOW_X11 (external_window_x11_get_type ())
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (ExternalWindowX11, external_window_x11,
|
|
|
d816b7 |
- EXTERNAL, WINDOW_X11, ExternalWindow)
|
|
|
d816b7 |
+#define EXTERNAL_WINDOW_X11(object) (G_TYPE_CHECK_INSTANCE_CAST (object, EXTERNAL_TYPE_WINDOW_X11, ExternalWindowX11))
|
|
|
d816b7 |
|
|
|
d816b7 |
+typedef struct _ExternalWindowX11 ExternalWindowX11;
|
|
|
d816b7 |
+typedef struct _ExternalWindowX11Class ExternalWindowX11Class;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+GType external_window_get_type (void);
|
|
|
d816b7 |
ExternalWindowX11 *external_window_x11_new (const char *handle_str);
|
|
|
d816b7 |
diff --git a/src/externalwindow.h b/src/externalwindow.h
|
|
|
d816b7 |
index 0ad09ee..8282fc2 100644
|
|
|
d816b7 |
--- a/src/externalwindow.h
|
|
|
d816b7 |
+++ b/src/externalwindow.h
|
|
|
d816b7 |
@@ -25,8 +25,17 @@
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
#define EXTERNAL_TYPE_WINDOW (external_window_get_type ())
|
|
|
d816b7 |
-G_DECLARE_DERIVABLE_TYPE (ExternalWindow, external_window,
|
|
|
d816b7 |
- EXTERNAL, WINDOW, GObject)
|
|
|
d816b7 |
+#define EXTERNAL_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST (object, EXTERNAL_TYPE_WINDOW, ExternalWindow))
|
|
|
d816b7 |
+#define EXTERNAL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, EXTERNAL_TYPE_WINDOW, ExternalWindowClass))
|
|
|
d816b7 |
+#define EXTERNAL_WINDOW_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS (klass, EXTERNAL_TYPE_WINDOW, ExternalWindowClass))
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+typedef struct _ExternalWindow ExternalWindow;
|
|
|
d816b7 |
+typedef struct _ExternalWindowClass ExternalWindowClass;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+struct _ExternalWindow
|
|
|
d816b7 |
+{
|
|
|
d816b7 |
+ GObject parent_instance;
|
|
|
d816b7 |
+};
|
|
|
d816b7 |
|
|
|
d816b7 |
struct _ExternalWindowClass
|
|
|
d816b7 |
{
|
|
|
d816b7 |
@@ -36,6 +45,7 @@ struct _ExternalWindowClass
|
|
|
d816b7 |
GdkWindow *child_window);
|
|
|
d816b7 |
};
|
|
|
d816b7 |
|
|
|
d816b7 |
+GType external_window_get_type (void);
|
|
|
d816b7 |
ExternalWindow *create_external_window_from_handle (const char *handle_str);
|
|
|
d816b7 |
|
|
|
d816b7 |
void external_window_set_parent_of (ExternalWindow *external_window,
|
|
|
d816b7 |
diff --git a/src/screenshotdialog.h b/src/screenshotdialog.h
|
|
|
d816b7 |
index c9d15cc..b7b19d0 100644
|
|
|
d816b7 |
--- a/src/screenshotdialog.h
|
|
|
d816b7 |
+++ b/src/screenshotdialog.h
|
|
|
d816b7 |
@@ -1,6 +1,10 @@
|
|
|
d816b7 |
#include <gtk/gtk.h>
|
|
|
d816b7 |
|
|
|
d816b7 |
-G_DECLARE_FINAL_TYPE (ScreenshotDialog, screenshot_dialog, SCREENSHOT, DIALOG, GtkWindow)
|
|
|
d816b7 |
+#define SCREENSHOT_TYPE_DIALOG (screenshot_dialog_get_type ())
|
|
|
d816b7 |
+#define SCREENSHOT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object, SCREENSHOT_TYPE_DIALOG, ScreenshotDialog)))
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+typedef struct _ScreenshotDialog ScreenshotDialog;
|
|
|
d816b7 |
+typedef struct _ScreenshotDialogClass ScreenshotDialogClass;
|
|
|
d816b7 |
|
|
|
d816b7 |
ScreenshotDialog * screenshot_dialog_new (const char *app_id,
|
|
|
d816b7 |
const char *filename);
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From e440d6927849195ba2443d4f460b1e1ffbda4d76 Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 15:04:11 +0000
|
|
|
d816b7 |
Subject: [PATCH 3/7] Avoid gtk_css_provider_load_from_resource()
|
|
|
d816b7 |
|
|
|
d816b7 |
Use gtk_css_provider_load_from_path() instead.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/appchooserdialog.c | 2 +-
|
|
|
d816b7 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c
|
|
|
d816b7 |
index 11b3a48..149d3d0 100644
|
|
|
d816b7 |
--- a/src/appchooserdialog.c
|
|
|
d816b7 |
+++ b/src/appchooserdialog.c
|
|
|
d816b7 |
@@ -241,7 +241,7 @@ app_chooser_dialog_new (const char **choices,
|
|
|
d816b7 |
if (provider == NULL)
|
|
|
d816b7 |
{
|
|
|
d816b7 |
provider = gtk_css_provider_new ();
|
|
|
d816b7 |
- gtk_css_provider_load_from_resource (provider, "/org/freedesktop/portal/desktop/gtk/appchooserdialog.css");
|
|
|
d816b7 |
+ gtk_css_provider_load_from_path (provider, "resource:///org/freedesktop/portal/desktop/gtk/appchooserdialog.css", NULL);
|
|
|
d816b7 |
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
|
|
|
d816b7 |
GTK_STYLE_PROVIDER (provider),
|
|
|
d816b7 |
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From e1cfee3c947aaa3b4f244484f3b953ec89398d62 Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 17:11:44 +0000
|
|
|
d816b7 |
Subject: [PATCH 4/7] Avoid gtk_entry_grab_focus_without_selecting()
|
|
|
d816b7 |
|
|
|
d816b7 |
It was not added until GTK+ 3.16.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/appchooserdialog.c | 5 +++++
|
|
|
d816b7 |
1 file changed, 5 insertions(+)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c
|
|
|
d816b7 |
index 149d3d0..0550e40 100644
|
|
|
d816b7 |
--- a/src/appchooserdialog.c
|
|
|
d816b7 |
+++ b/src/appchooserdialog.c
|
|
|
d816b7 |
@@ -181,7 +181,12 @@ search_toggled (GtkToggleButton *button,
|
|
|
d816b7 |
show_all (dialog);
|
|
|
d816b7 |
gtk_list_box_set_filter_func (GTK_LIST_BOX (dialog->list),
|
|
|
d816b7 |
filter_func, dialog, NULL);
|
|
|
d816b7 |
+#if GTK_CHECK_VERSION (3, 16, 0)
|
|
|
d816b7 |
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (dialog->search_entry));
|
|
|
d816b7 |
+#else
|
|
|
d816b7 |
+ gtk_widget_grab_focus (dialog->search_entry);
|
|
|
d816b7 |
+ gtk_editable_set_position (GTK_EDITABLE (dialog->search_entry), -1);
|
|
|
d816b7 |
+#endif
|
|
|
d816b7 |
}
|
|
|
d816b7 |
else
|
|
|
d816b7 |
{
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From 1a5a2b0fa182022c558310e82621063ef33c8a3e Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 17:12:29 +0000
|
|
|
d816b7 |
Subject: [PATCH 5/7] Avoid gtk_search_entry_handle_event()
|
|
|
d816b7 |
|
|
|
d816b7 |
Copy the necessary code from GTK+.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/appchooserdialog.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
d816b7 |
1 file changed, 51 insertions(+)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c
|
|
|
d816b7 |
index 0550e40..9254c20 100644
|
|
|
d816b7 |
--- a/src/appchooserdialog.c
|
|
|
d816b7 |
+++ b/src/appchooserdialog.c
|
|
|
d816b7 |
@@ -144,6 +144,57 @@ search_changed (GtkSearchEntry *entry,
|
|
|
d816b7 |
gtk_list_box_invalidate_filter (GTK_LIST_BOX (dialog->list));
|
|
|
d816b7 |
}
|
|
|
d816b7 |
|
|
|
d816b7 |
+/* gtk_search_entry_handle_event() was not added until GTK+ 3.16. */
|
|
|
d816b7 |
+#if !GTK_CHECK_VERSION (3, 16, 0)
|
|
|
d816b7 |
+static gboolean
|
|
|
d816b7 |
+gtk_search_entry_is_keynav_event (GdkEvent *event)
|
|
|
d816b7 |
+{
|
|
|
d816b7 |
+ GdkModifierType state = 0;
|
|
|
d816b7 |
+ guint keyval;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (!gdk_event_get_keyval (event, &keyval))
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ gdk_event_get_state (event, &state);
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (keyval == GDK_KEY_Tab || keyval == GDK_KEY_KP_Tab ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Up || keyval == GDK_KEY_KP_Up ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Down || keyval == GDK_KEY_KP_Down ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Left || keyval == GDK_KEY_KP_Left ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Right || keyval == GDK_KEY_KP_Right ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Home || keyval == GDK_KEY_KP_Home ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_End || keyval == GDK_KEY_KP_End ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Page_Up || keyval == GDK_KEY_KP_Page_Up ||
|
|
|
d816b7 |
+ keyval == GDK_KEY_Page_Down || keyval == GDK_KEY_KP_Page_Down ||
|
|
|
d816b7 |
+ ((state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) != 0))
|
|
|
d816b7 |
+ return TRUE;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ /* Other navigation events should get automatically
|
|
|
d816b7 |
+ * ignored as they will not change the content of the entry
|
|
|
d816b7 |
+ */
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+}
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+static gboolean
|
|
|
d816b7 |
+gtk_search_entry_handle_event (GtkSearchEntry *entry,
|
|
|
d816b7 |
+ GdkEvent *event)
|
|
|
d816b7 |
+{
|
|
|
d816b7 |
+ gboolean handled;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (!gtk_widget_get_realized (GTK_WIDGET (entry)))
|
|
|
d816b7 |
+ gtk_widget_realize (GTK_WIDGET (entry));
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (gtk_search_entry_is_keynav_event (event) ||
|
|
|
d816b7 |
+ event->key.keyval == GDK_KEY_space ||
|
|
|
d816b7 |
+ event->key.keyval == GDK_KEY_Menu)
|
|
|
d816b7 |
+ return GDK_EVENT_PROPAGATE;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ handled = gtk_widget_event (GTK_WIDGET (entry), event);
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ return handled ? GDK_EVENT_STOP : GDK_EVENT_PROPAGATE;
|
|
|
d816b7 |
+}
|
|
|
d816b7 |
+#endif
|
|
|
d816b7 |
+
|
|
|
d816b7 |
static gboolean
|
|
|
d816b7 |
app_chooser_dialog_key_press (GtkWidget *widget,
|
|
|
d816b7 |
GdkEventKey *event)
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From 436dff61282f7756e33d89564a694bc407d1158c Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Thu, 19 Jan 2017 17:26:46 +0000
|
|
|
d816b7 |
Subject: [PATCH 6/7] Avoid g_autoptr() with GtkPrint types
|
|
|
d816b7 |
|
|
|
d816b7 |
Support was not added until GTK+ 3.16.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/print.c | 12 +++++++++---
|
|
|
d816b7 |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/print.c b/src/print.c
|
|
|
d816b7 |
index 51004e0..06b9df2 100644
|
|
|
d816b7 |
--- a/src/print.c
|
|
|
d816b7 |
+++ b/src/print.c
|
|
|
d816b7 |
@@ -176,7 +176,7 @@ print_file (int fd,
|
|
|
d816b7 |
GtkPageSetup *page_setup,
|
|
|
d816b7 |
GError **error)
|
|
|
d816b7 |
{
|
|
|
d816b7 |
- g_autoptr(GtkPrintJob) job = NULL;
|
|
|
d816b7 |
+ GtkPrintJob *job;
|
|
|
d816b7 |
g_autofree char *title = NULL;
|
|
|
d816b7 |
|
|
|
d816b7 |
title = g_strdup_printf ("Document from %s", app_id);
|
|
|
d816b7 |
@@ -184,9 +184,13 @@ print_file (int fd,
|
|
|
d816b7 |
job = gtk_print_job_new (title, printer, settings, page_setup);
|
|
|
d816b7 |
|
|
|
d816b7 |
if (!gtk_print_job_set_source_fd (job, fd, error))
|
|
|
d816b7 |
- return FALSE;
|
|
|
d816b7 |
+ {
|
|
|
d816b7 |
+ g_object_unref (job);
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+ }
|
|
|
d816b7 |
|
|
|
d816b7 |
gtk_print_job_send (job, NULL, NULL, NULL);
|
|
|
d816b7 |
+ g_object_unref (job);
|
|
|
d816b7 |
|
|
|
d816b7 |
return TRUE;
|
|
|
d816b7 |
}
|
|
|
d816b7 |
@@ -215,7 +219,7 @@ handle_print_response (GtkDialog *dialog,
|
|
|
d816b7 |
case GTK_RESPONSE_OK:
|
|
|
d816b7 |
{
|
|
|
d816b7 |
GtkPrinter *printer;
|
|
|
d816b7 |
- g_autoptr(GtkPrintSettings) settings = NULL;
|
|
|
d816b7 |
+ GtkPrintSettings *settings;
|
|
|
d816b7 |
GtkPageSetup *page_setup;
|
|
|
d816b7 |
|
|
|
d816b7 |
printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (handle->dialog));
|
|
|
d816b7 |
@@ -231,6 +235,8 @@ handle_print_response (GtkDialog *dialog,
|
|
|
d816b7 |
handle->response = 2;
|
|
|
d816b7 |
else
|
|
|
d816b7 |
handle->response = 0;
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ g_object_unref (settings);
|
|
|
d816b7 |
}
|
|
|
d816b7 |
break;
|
|
|
d816b7 |
}
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|
|
|
d816b7 |
|
|
|
d816b7 |
From dfc24b7418a1ab92b0a29ec485a1795775db3aca Mon Sep 17 00:00:00 2001
|
|
|
d816b7 |
From: David King <amigadave@amigadave.com>
|
|
|
d816b7 |
Date: Mon, 23 Jan 2017 11:39:02 +0000
|
|
|
d816b7 |
Subject: [PATCH 7/7] Avoid gtk_print_job_set_source_fd()
|
|
|
d816b7 |
|
|
|
d816b7 |
On older versions of GTK+ than 3.22, use gtk_print_job_set_source_file()
|
|
|
d816b7 |
with a temporary file instead.
|
|
|
d816b7 |
---
|
|
|
d816b7 |
src/print.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
|
d816b7 |
1 file changed, 40 insertions(+)
|
|
|
d816b7 |
|
|
|
d816b7 |
diff --git a/src/print.c b/src/print.c
|
|
|
d816b7 |
index 06b9df2..57b1e45 100644
|
|
|
d816b7 |
--- a/src/print.c
|
|
|
d816b7 |
+++ b/src/print.c
|
|
|
d816b7 |
@@ -29,6 +29,8 @@
|
|
|
d816b7 |
|
|
|
d816b7 |
#include <gio/gio.h>
|
|
|
d816b7 |
#include <gio/gunixfdlist.h>
|
|
|
d816b7 |
+#include <gio/gunixinputstream.h>
|
|
|
d816b7 |
+#include <gio/gunixoutputstream.h>
|
|
|
d816b7 |
|
|
|
d816b7 |
#include "xdg-desktop-portal-dbus.h"
|
|
|
d816b7 |
|
|
|
d816b7 |
@@ -178,16 +180,54 @@ print_file (int fd,
|
|
|
d816b7 |
{
|
|
|
d816b7 |
GtkPrintJob *job;
|
|
|
d816b7 |
g_autofree char *title = NULL;
|
|
|
d816b7 |
+#if !GTK_CHECK_VERSION (3, 22, 0)
|
|
|
d816b7 |
+ g_autofree char *filename = NULL;
|
|
|
d816b7 |
+ g_autoptr(GUnixInputStream) istream = NULL;
|
|
|
d816b7 |
+ g_autoptr(GUnixOutputStream) ostream = NULL;
|
|
|
d816b7 |
+ int fd2;
|
|
|
d816b7 |
+#endif
|
|
|
d816b7 |
|
|
|
d816b7 |
title = g_strdup_printf ("Document from %s", app_id);
|
|
|
d816b7 |
|
|
|
d816b7 |
job = gtk_print_job_new (title, printer, settings, page_setup);
|
|
|
d816b7 |
|
|
|
d816b7 |
+#if GTK_CHECK_VERSION (3, 22, 0)
|
|
|
d816b7 |
if (!gtk_print_job_set_source_fd (job, fd, error))
|
|
|
d816b7 |
{
|
|
|
d816b7 |
g_object_unref (job);
|
|
|
d816b7 |
return FALSE;
|
|
|
d816b7 |
}
|
|
|
d816b7 |
+#else
|
|
|
d816b7 |
+ istream = g_unix_input_stream_new (fd, FALSE);
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if ((fd2 = g_file_open_tmp (PACKAGE_NAME "XXXXXX", &filename, error)) == -1)
|
|
|
d816b7 |
+ {
|
|
|
d816b7 |
+ g_object_unref (job);
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+ }
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ ostream = g_unix_output_stream_new (fd2, TRUE);
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (g_output_stream_splice (G_OUTPUT_STREAM (ostream),
|
|
|
d816b7 |
+ G_INPUT_STREAM (istream),
|
|
|
d816b7 |
+ G_OUTPUT_STREAM_SPLICE_NONE,
|
|
|
d816b7 |
+ NULL,
|
|
|
d816b7 |
+ error) == -1)
|
|
|
d816b7 |
+ {
|
|
|
d816b7 |
+ g_object_unref (job);
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+ }
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ if (!gtk_print_job_set_source_file (job, filename, error))
|
|
|
d816b7 |
+ {
|
|
|
d816b7 |
+ g_object_unref (job);
|
|
|
d816b7 |
+ return FALSE;
|
|
|
d816b7 |
+ }
|
|
|
d816b7 |
+
|
|
|
d816b7 |
+ /* The file will be removed when the GtkPrintJob closes it (once the job is
|
|
|
d816b7 |
+ * complete). */
|
|
|
d816b7 |
+ unlink (filename);
|
|
|
d816b7 |
+#endif
|
|
|
d816b7 |
|
|
|
d816b7 |
gtk_print_job_send (job, NULL, NULL, NULL);
|
|
|
d816b7 |
g_object_unref (job);
|
|
|
d816b7 |
--
|
|
|
d816b7 |
2.9.3
|
|
|
d816b7 |
|