[Xfce4-commits] <xfce4-dict:master> Add a paste button to the Speed Reader.
Enrico Tröger
noreply at xfce.org
Sun May 30 12:58:02 CEST 2010
Updating branch refs/heads/master
to ba4136fa7380336e614e80cb7428d535e47ec6e1 (commit)
from 3b9cd23c5fe85fd81697a2381d619e48d0ea23d3 (commit)
commit ba4136fa7380336e614e80cb7428d535e47ec6e1
Author: Enrico Tröger <enrico.troeger at uvena.de>
Date: Sun May 30 11:59:58 2010 +0200
Add a paste button to the Speed Reader.
ChangeLog | 2 ++
lib/speedreader.c | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e5dc7ff..8fbf52a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* lib/gui.c:
Quit/Close main window if Escape is pressed.
+ * lib/speedreader.c:
+ Add a paste button to the Speed Reader.
2010-01-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
diff --git a/lib/speedreader.c b/lib/speedreader.c
index ee5f22f..6fc9cf9 100644
--- a/lib/speedreader.c
+++ b/lib/speedreader.c
@@ -546,6 +546,14 @@ static void sr_clear_clicked_cb(GtkButton *button, GtkTextBuffer *buffer)
}
+static void sr_paste_clicked_cb(GtkButton *button, GtkTextBuffer *buffer)
+{
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ gtk_text_buffer_set_text(buffer, "", 0);
+ gtk_text_buffer_paste_clipboard(buffer, clipboard, NULL, TRUE);
+}
+
+
static void sr_spin_grouping_changed_cb(GtkSpinButton *button, GtkLabel *label)
{
gint count = gtk_spin_button_get_value_as_int(button);
@@ -563,7 +571,7 @@ static void xfd_speed_reader_init(XfdSpeedReader *dialog)
{
GtkWidget *label_intro, *label_words, *label_font, *label_grouping, *label_grouping_desc;
GtkWidget *vbox, *hbox_words, *hbox_font, *hbox_grouping, *swin, *textview;
- GtkWidget *vbox_text_buttons, *hbox_text, *button_clear, *button_open;
+ GtkWidget *vbox_text_buttons, *hbox_text, *button_clear, *button_paste, *button_open;
GtkSizeGroup *sizegroup;
XfdSpeedReaderPrivate *priv = XFD_SPEED_READER_GET_PRIVATE(dialog);
@@ -646,6 +654,15 @@ static void xfd_speed_reader_init(XfdSpeedReader *dialog)
gtk_widget_set_tooltip_text(button_open, _("Load the contents of a file"));
#endif
+ button_paste = gtk_button_new();
+ gtk_button_set_image(GTK_BUTTON(button_paste),
+ gtk_image_new_from_stock(GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU));
+ g_signal_connect(button_paste, "clicked", G_CALLBACK(sr_paste_clicked_cb), priv->buffer);
+#if GTK_CHECK_VERSION(2, 12, 0)
+ gtk_widget_set_tooltip_text(button_paste,
+ _("Clear the contents of the text field and paste the contents of the clipboard"));
+#endif
+
button_clear = gtk_button_new();
gtk_button_set_image(GTK_BUTTON(button_clear),
gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU));
@@ -656,6 +673,7 @@ static void xfd_speed_reader_init(XfdSpeedReader *dialog)
vbox_text_buttons = gtk_vbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(vbox_text_buttons), button_open, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox_text_buttons), button_paste, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox_text_buttons), button_clear, FALSE, FALSE, 0);
hbox_text = gtk_hbox_new(FALSE, 0);
More information about the Xfce4-commits
mailing list