[Xfce4-commits] <postler:master> Add a 'Quote' button which works on selected text
Christian Dywan
noreply at xfce.org
Mon Jun 21 20:12:08 CEST 2010
Updating branch refs/heads/master
to e84d4398f421d35fdb469f9ed0bef789ed8ab083 (commit)
from 05301c23f527e55023fd2756cd5aeaf6676f000e (commit)
commit e84d4398f421d35fdb469f9ed0bef789ed8ab083
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jun 20 19:48:57 2010 +0200
Add a 'Quote' button which works on selected text
postler/postler-composer.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 41830d2..b9820c0 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -39,6 +39,7 @@ public class Postler.Composer : Gtk.Window {
<menuitem action="Close"/>
</menu>
<menu action="Edit">
+ <menuitem action="Quote"/>
<menuitem action="InsertEmoticonGrin"/>
<menuitem action="InsertEmoticonWink"/>
<menuitem action="InsertEmoticonSad"/>
@@ -57,6 +58,7 @@ public class Postler.Composer : Gtk.Window {
<toolitem action="AddressBook"/>
<toolitem action="Preferences"/>
<separator expand="true"/>
+ <toolitem action="Quote"/>
<toolitem action="InsertEmoticonGrin"/>
<toolitem action="InsertEmoticonWink"/>
<toolitem action="InsertEmoticonSad"/>
@@ -121,6 +123,14 @@ public class Postler.Composer : Gtk.Window {
printf (text.replace ("'", "\\'")));
}
+ void action_quote () {
+ if (!content.can_copy_clipboard ())
+ content.select_all ();
+ var clipboard = content.get_clipboard (Gdk.SELECTION_PRIMARY);
+ string selected = clipboard.wait_for_text ();
+ insert_text ("> " + selected.replace ("\n", "\\n> "));
+ }
+
void action_insert_emoticon (Gtk.Action action) {
unowned string name = action.name;
string emoticon;
@@ -150,6 +160,8 @@ public class Postler.Composer : Gtk.Window {
N_("Open the addressbook"), null },
{ "Preferences", Gtk.STOCK_PREFERENCES, null, "<Ctrl><Alt>p",
N_("Configure the application preferences"), action_preferences },
+ { "Quote", Gtk.STOCK_INDENT, N_("_Quote the selected text"), "",
+ N_("Mark the selected text as a quote"), action_quote },
{ "InsertEmoticonGrin", STOCK_FACE_GRIN, N_("Insert _Grinning Face"), "",
N_("Insert a grinning face"), action_insert_emoticon },
{ "InsertEmoticonWink", STOCK_FACE_WINK, N_("Insert _Winking Face"), "",
More information about the Xfce4-commits
mailing list