diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-06-02 12:39:39 -0700 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-06-02 22:29:21 -0400 |
commit | 04fbef7f1eb7e535e96a1df17d20b223af200a90 (patch) | |
tree | 7d1f692ef1fd3d9d7c6c1affe9d7d68fe8b751b9 /demos | |
parent | 7a3984ee629d67b0e35ff156aface760780e0f6d (diff) | |
download | gtk+-04fbef7f1eb7e535e96a1df17d20b223af200a90.tar.gz |
icon browser: Add a 'copy to clipboard' button
This makes it more obvious how to use the icon.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/icon-browser/iconbrowserwin.c | 11 | ||||
-rw-r--r-- | 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 2add75b5a5..7e33622b4d 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 3cedca4b63..dd2564f792 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> |