diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 21:10:39 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 22:00:53 +0200 |
commit | ded899933c50a976d10144f526ffd6a5e58e6ced (patch) | |
tree | 1e9ca020b7e6dc77dee430728c939ff42ca3939c /src/sdgui.c | |
parent | 832842bf81fbc194b75c9440e2944aa2390bf427 (diff) | |
download | tdv-ded899933c50a976d10144f526ffd6a5e58e6ced.tar.gz tdv-ded899933c50a976d10144f526ffd6a5e58e6ced.tar.xz tdv-ded899933c50a976d10144f526ffd6a5e58e6ced.zip |
sdgui: make Ctrl+click put hovered word in search
Diffstat (limited to 'src/sdgui.c')
-rw-r--r-- | src/sdgui.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sdgui.c b/src/sdgui.c index 457e72e..72fdaac 100644 --- a/src/sdgui.c +++ b/src/sdgui.c @@ -128,6 +128,15 @@ on_changed (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED gpointer data) } static void +on_send (G_GNUC_UNUSED StardictView *view, + const char *word, G_GNUC_UNUSED gpointer data) +{ + GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (g.entry)); + gtk_entry_buffer_set_text (buf, word, -1); + gtk_editable_select_region (GTK_EDITABLE (g.entry), 0, -1); +} + +static void on_selection_received (G_GNUC_UNUSED GtkClipboard *clipboard, const gchar *text, G_GNUC_UNUSED gpointer data) { @@ -529,6 +538,8 @@ main (int argc, char *argv[]) gtk_drag_dest_add_uri_targets (g.view); g_signal_connect (g.view, "drag-data-received", G_CALLBACK (on_drag_data_received), NULL); + g_signal_connect (g.view, "send", + G_CALLBACK (on_send), NULL); gtk_widget_show_all (g.window); gtk_main (); |