[gtk+] icon browser: Add a 'copy to clipboard' button
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] icon browser: Add a 'copy to clipboard' button
- Date: Sat, 3 Jun 2017 02:31:08 +0000 (UTC)
commit 04fbef7f1eb7e535e96a1df17d20b223af200a90
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 2 12:39:39 2017 -0700
icon browser: Add a 'copy to clipboard' button
This makes it more obvious how to use the icon.
demos/icon-browser/iconbrowserwin.c | 11 +++++++++++
demos/icon-browser/window.ui | 15 +++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c
index 2add75b..7e33622 100644
--- a/demos/icon-browser/iconbrowserwin.c
+++ b/demos/icon-browser/iconbrowserwin.c
@@ -281,6 +281,16 @@ key_press_event_cb (GtkWidget *widget,
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar), event);
}
+static void
+copy_to_clipboard (GtkButton *button,
+ IconBrowserWindow *win)
+{
+ GtkClipboard *clipboard;
+
+ clipboard = gtk_clipboard_get_default (gdk_display_get_default ());
+ gtk_clipboard_set_text (clipboard, gtk_window_get_title (GTK_WINDOW (win->details)), -1);
+}
+
static gboolean
icon_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -453,6 +463,7 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selected_context_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), key_press_event_cb);
+ gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
}
IconBrowserWindow *
diff --git a/demos/icon-browser/window.ui b/demos/icon-browser/window.ui
index 3cedca4..dd2564f 100644
--- a/demos/icon-browser/window.ui
+++ b/demos/icon-browser/window.ui
@@ -320,6 +320,21 @@
<property name="width">5</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Copy to Clipboard</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="margin">20</property>
+ <signal name="clicked" handler="copy_to_clipboard"/>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ <property name="width">5</property>
+ </packing>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]