[polari] lib: Add a wrapper for gtk_widget_get_clipboard()



commit 3ba36e61404f8c41ba8346353257dc77a8a06ce6
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 3 14:10:25 2014 +0200

    lib: Add a wrapper for gtk_widget_get_clipboard()
    
    It takes an unintrospectable GdkAtom parameter, so we need a C helper.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712163

 src/Makefile-lib.am   |    2 ++
 src/lib/polari-util.c |   33 +++++++++++++++++++++++++++++++++
 src/lib/polari-util.h |   26 ++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile-lib.am b/src/Makefile-lib.am
index 466b9c2..ae7f99b 100644
--- a/src/Makefile-lib.am
+++ b/src/Makefile-lib.am
@@ -4,12 +4,14 @@ libpolari_headers = \
        lib/polari-drag-helper.h \
        lib/polari-fixed-size-frame.h \
        lib/polari-room.h \
+       lib/polari-util.h \
        $(NULL)
 
 libpolari_sources = \
        lib/polari-drag-helper.c \
        lib/polari-fixed-size-frame.c \
        lib/polari-room.c \
+       lib/polari-util.c \
        $(NULL)
 
 libpolari_1_0_la_SOURCES = $(libpolari_headers) $(libpolari_sources)
diff --git a/src/lib/polari-util.c b/src/lib/polari-util.c
new file mode 100644
index 0000000..ac7f986
--- /dev/null
+++ b/src/lib/polari-util.c
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#include "polari-util.h"
+
+/**
+ * polari_util_get_clipboard_for_widget:
+ * @widget: (transfer none): a #GtkWidget
+ *
+ * Get the GDK_SELECTION_CLIPBOARD clipboard for @widget.
+ *
+ * Returns: (transfer none): a #GtkClipboard
+ */
+GtkClipboard *
+polari_util_get_clipboard_for_widget (GtkWidget *widget)
+{
+  return gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
+}
diff --git a/src/lib/polari-util.h b/src/lib/polari-util.h
new file mode 100644
index 0000000..e49d96a
--- /dev/null
+++ b/src/lib/polari-util.h
@@ -0,0 +1,26 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#ifndef __POLARI_UTIL_H__
+#define __POLARI_UTIL_H__
+
+#include <gtk/gtk.h>
+
+GtkClipboard *polari_util_get_clipboard_for_widget (GtkWidget *widget);
+
+#endif /* __POLARI_UTIL_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]