From 441eaaf4dc3d67d910b9fc518ed9653bd923d438 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 26 Jan 2011 00:18:42 +0000 Subject: [PATCH] Implemented pasting text from the menu --- po/de.po | 70 ++++++++++++++++++++++---------------------- po/es.po | 70 ++++++++++++++++++++++---------------------- po/fr.po | 78 ++++++++++++++++++++++--------------------------- po/it.po | 70 ++++++++++++++++++++++---------------------- src/callbacks.c | 9 ++++++ src/callbacks.h | 1 + src/editor.c | 18 ++++++++++-- src/editor.h | 2 ++ 8 files changed, 168 insertions(+), 150 deletions(-) diff --git a/po/de.po b/po/de.po index 1e9585f..01c0d4f 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Editor 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-11-27 16:20+0100\n" +"POT-Creation-Date: 2011-01-26 01:17+0100\n" "PO-Revision-Date: 2010-04-07 22:05+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: German\n" @@ -16,11 +16,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:67 +#: ../src/callbacks.c:76 msgid "Text editor preferences" msgstr "Text Editor Einstellungen" -#: ../src/callbacks.c:84 +#: ../src/callbacks.c:93 msgid "Font:" msgstr "" @@ -64,132 +64,132 @@ msgstr "" msgid "_Paste" msgstr "" -#: ../src/editor.c:89 +#: ../src/editor.c:90 msgid "Select _all" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:97 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:98 +#: ../src/editor.c:99 msgid "_Find" msgstr "" -#: ../src/editor.c:101 +#: ../src/editor.c:102 msgid "_Preferences" msgstr "_Einstellungen" -#: ../src/editor.c:108 +#: ../src/editor.c:109 msgid "_About" msgstr "_Info" -#: ../src/editor.c:119 +#: ../src/editor.c:120 msgid "_File" msgstr "_Datei" -#: ../src/editor.c:120 +#: ../src/editor.c:121 msgid "_Edit" msgstr "_Bearbeitung" -#: ../src/editor.c:121 +#: ../src/editor.c:122 msgid "_Help" msgstr "_Hilfe" -#: ../src/editor.c:128 +#: ../src/editor.c:129 msgid "New" msgstr "" -#: ../src/editor.c:129 +#: ../src/editor.c:130 msgid "Open" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:132 msgid "Save" msgstr "" -#: ../src/editor.c:132 +#: ../src/editor.c:133 msgid "Save as" msgstr "" -#: ../src/editor.c:136 +#: ../src/editor.c:137 msgid "Preferences" msgstr "Einstellungen" -#: ../src/editor.c:227 +#: ../src/editor.c:228 msgid "Text editor - " msgstr "" -#: ../src/editor.c:228 +#: ../src/editor.c:229 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:341 +#: ../src/editor.c:342 msgid "Could not save configuration" msgstr "" -#: ../src/editor.c:355 ../src/editor.c:360 +#: ../src/editor.c:356 ../src/editor.c:361 msgid "Error" msgstr "Fehler" -#: ../src/editor.c:387 ../src/editor.c:397 ../src/editor.c:509 -#: ../src/editor.c:523 ../src/editor.c:650 ../src/editor.c:655 +#: ../src/editor.c:388 ../src/editor.c:398 ../src/editor.c:510 +#: ../src/editor.c:524 ../src/editor.c:664 ../src/editor.c:669 msgid "Warning" msgstr "Achtung" -#: ../src/editor.c:391 +#: ../src/editor.c:392 msgid "" "There are unsaved changes.\n" "Discard or save them?" msgstr "" -#: ../src/editor.c:429 +#: ../src/editor.c:430 msgid "Find text" msgstr "" -#: ../src/editor.c:436 +#: ../src/editor.c:437 msgid "Text:" msgstr "Text:" -#: ../src/editor.c:443 +#: ../src/editor.c:444 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:445 +#: ../src/editor.c:446 msgid "Wrap" msgstr "" -#: ../src/editor.c:468 +#: ../src/editor.c:469 msgid "Text not found" msgstr "" -#: ../src/editor.c:513 +#: ../src/editor.c:514 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:520 +#: ../src/editor.c:521 msgid "Discard" msgstr "" -#: ../src/editor.c:579 +#: ../src/editor.c:580 msgid "Open file..." msgstr "Offnen..." -#: ../src/editor.c:626 +#: ../src/editor.c:640 msgid "Partial write" msgstr "" -#: ../src/editor.c:654 +#: ../src/editor.c:668 msgid "This file already exists. Overwrite?" msgstr "" -#: ../src/editor.c:663 +#: ../src/editor.c:677 msgid "Allocation error" msgstr "" -#: ../src/editor.c:678 +#: ../src/editor.c:692 msgid "Save as..." msgstr "" diff --git a/po/es.po b/po/es.po index 0de0f22..1bfd204 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Editor 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-11-27 16:20+0100\n" +"POT-Creation-Date: 2011-01-26 01:17+0100\n" "PO-Revision-Date: 2010-04-07 22:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: Spanish\n" @@ -16,11 +16,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:67 +#: ../src/callbacks.c:76 msgid "Text editor preferences" msgstr "" -#: ../src/callbacks.c:84 +#: ../src/callbacks.c:93 msgid "Font:" msgstr "" @@ -64,132 +64,132 @@ msgstr "" msgid "_Paste" msgstr "" -#: ../src/editor.c:89 +#: ../src/editor.c:90 msgid "Select _all" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:97 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:98 +#: ../src/editor.c:99 msgid "_Find" msgstr "" -#: ../src/editor.c:101 +#: ../src/editor.c:102 msgid "_Preferences" msgstr "_Preferencias" -#: ../src/editor.c:108 +#: ../src/editor.c:109 msgid "_About" msgstr "" -#: ../src/editor.c:119 +#: ../src/editor.c:120 msgid "_File" msgstr "" -#: ../src/editor.c:120 +#: ../src/editor.c:121 msgid "_Edit" msgstr "" -#: ../src/editor.c:121 +#: ../src/editor.c:122 msgid "_Help" msgstr "" -#: ../src/editor.c:128 +#: ../src/editor.c:129 msgid "New" msgstr "" -#: ../src/editor.c:129 +#: ../src/editor.c:130 msgid "Open" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:132 msgid "Save" msgstr "" -#: ../src/editor.c:132 +#: ../src/editor.c:133 msgid "Save as" msgstr "" -#: ../src/editor.c:136 +#: ../src/editor.c:137 msgid "Preferences" msgstr "" -#: ../src/editor.c:227 +#: ../src/editor.c:228 msgid "Text editor - " msgstr "" -#: ../src/editor.c:228 +#: ../src/editor.c:229 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:341 +#: ../src/editor.c:342 msgid "Could not save configuration" msgstr "" -#: ../src/editor.c:355 ../src/editor.c:360 +#: ../src/editor.c:356 ../src/editor.c:361 msgid "Error" msgstr "" -#: ../src/editor.c:387 ../src/editor.c:397 ../src/editor.c:509 -#: ../src/editor.c:523 ../src/editor.c:650 ../src/editor.c:655 +#: ../src/editor.c:388 ../src/editor.c:398 ../src/editor.c:510 +#: ../src/editor.c:524 ../src/editor.c:664 ../src/editor.c:669 msgid "Warning" msgstr "" -#: ../src/editor.c:391 +#: ../src/editor.c:392 msgid "" "There are unsaved changes.\n" "Discard or save them?" msgstr "" -#: ../src/editor.c:429 +#: ../src/editor.c:430 msgid "Find text" msgstr "" -#: ../src/editor.c:436 +#: ../src/editor.c:437 msgid "Text:" msgstr "" -#: ../src/editor.c:443 +#: ../src/editor.c:444 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:445 +#: ../src/editor.c:446 msgid "Wrap" msgstr "" -#: ../src/editor.c:468 +#: ../src/editor.c:469 msgid "Text not found" msgstr "" -#: ../src/editor.c:513 +#: ../src/editor.c:514 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:520 +#: ../src/editor.c:521 msgid "Discard" msgstr "" -#: ../src/editor.c:579 +#: ../src/editor.c:580 msgid "Open file..." msgstr "" -#: ../src/editor.c:626 +#: ../src/editor.c:640 msgid "Partial write" msgstr "" -#: ../src/editor.c:654 +#: ../src/editor.c:668 msgid "This file already exists. Overwrite?" msgstr "" -#: ../src/editor.c:663 +#: ../src/editor.c:677 msgid "Allocation error" msgstr "" -#: ../src/editor.c:678 +#: ../src/editor.c:692 msgid "Save as..." msgstr "" diff --git a/po/fr.po b/po/fr.po index 6ba6d21..4e834f6 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Editor 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-11-27 16:20+0100\n" +"POT-Creation-Date: 2011-01-26 01:17+0100\n" "PO-Revision-Date: 2010-04-11 12:32+0200\n" "Last-Translator: Calimero \n" "Language-Team: French\n" @@ -16,11 +16,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: ../src/callbacks.c:67 +#: ../src/callbacks.c:76 msgid "Text editor preferences" msgstr "Préférences de l'éditeur de texte" -#: ../src/callbacks.c:84 +#: ../src/callbacks.c:93 msgid "Font:" msgstr "Police :" @@ -64,80 +64,80 @@ msgstr "_Copier" msgid "_Paste" msgstr "C_oller" -#: ../src/editor.c:89 +#: ../src/editor.c:90 msgid "Select _all" msgstr "Sélectionner _tout" -#: ../src/editor.c:96 +#: ../src/editor.c:97 msgid "_Unselect all" msgstr "Tout _désélectionner" -#: ../src/editor.c:98 +#: ../src/editor.c:99 msgid "_Find" msgstr "_Rechercher" -#: ../src/editor.c:101 +#: ../src/editor.c:102 msgid "_Preferences" msgstr "_Préférences" -#: ../src/editor.c:108 +#: ../src/editor.c:109 msgid "_About" msgstr "À _propos" -#: ../src/editor.c:119 +#: ../src/editor.c:120 msgid "_File" msgstr "_Fichier" -#: ../src/editor.c:120 +#: ../src/editor.c:121 msgid "_Edit" msgstr "É_dition" -#: ../src/editor.c:121 +#: ../src/editor.c:122 msgid "_Help" msgstr "_Aide" -#: ../src/editor.c:128 +#: ../src/editor.c:129 msgid "New" msgstr "Nouveau" -#: ../src/editor.c:129 +#: ../src/editor.c:130 msgid "Open" msgstr "Ouvrir" -#: ../src/editor.c:131 +#: ../src/editor.c:132 msgid "Save" msgstr "Enregistrer" -#: ../src/editor.c:132 +#: ../src/editor.c:133 msgid "Save as" msgstr "Enregistrer sous" -#: ../src/editor.c:136 +#: ../src/editor.c:137 msgid "Preferences" msgstr "Préférences" -#: ../src/editor.c:227 +#: ../src/editor.c:228 msgid "Text editor - " msgstr "Éditeur de texte - " -#: ../src/editor.c:228 +#: ../src/editor.c:229 msgid "(Untitled)" msgstr "(Sans titre)" -#: ../src/editor.c:341 +#: ../src/editor.c:342 msgid "Could not save configuration" msgstr "Erreur lors de la sauvegarde de la configuration" -#: ../src/editor.c:355 ../src/editor.c:360 +#: ../src/editor.c:356 ../src/editor.c:361 msgid "Error" msgstr "Erreur" -#: ../src/editor.c:387 ../src/editor.c:397 ../src/editor.c:509 -#: ../src/editor.c:523 ../src/editor.c:650 ../src/editor.c:655 +#: ../src/editor.c:388 ../src/editor.c:398 ../src/editor.c:510 +#: ../src/editor.c:524 ../src/editor.c:664 ../src/editor.c:669 msgid "Warning" msgstr "Avertissement" -#: ../src/editor.c:391 +#: ../src/editor.c:392 msgid "" "There are unsaved changes.\n" "Discard or save them?" @@ -145,27 +145,27 @@ msgstr "" "Il y a des changements non enregistrés.\n" "Ignorer ou sauvegarder ?" -#: ../src/editor.c:429 +#: ../src/editor.c:430 msgid "Find text" msgstr "Rechercher" -#: ../src/editor.c:436 +#: ../src/editor.c:437 msgid "Text:" msgstr "Texte :" -#: ../src/editor.c:443 +#: ../src/editor.c:444 msgid "Case-sensitive" msgstr "Sensible à la casse" -#: ../src/editor.c:445 +#: ../src/editor.c:446 msgid "Wrap" msgstr "Boucler" -#: ../src/editor.c:468 +#: ../src/editor.c:469 msgid "Text not found" msgstr "Texte non trouvé" -#: ../src/editor.c:513 +#: ../src/editor.c:514 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" @@ -173,38 +173,30 @@ msgstr "" "Il y a des changements non enregistrés.\n" "Êtes-vous sûr de vouloir les annuler ?" -#: ../src/editor.c:520 +#: ../src/editor.c:521 msgid "Discard" msgstr "Annuler" -#: ../src/editor.c:579 +#: ../src/editor.c:580 msgid "Open file..." msgstr "Ouvrir un fichier..." -#: ../src/editor.c:626 +#: ../src/editor.c:640 msgid "Partial write" msgstr "Écriture partielle" -#: ../src/editor.c:654 +#: ../src/editor.c:668 msgid "This file already exists. Overwrite?" msgstr "Le fichier existe déjà. L'écraser ?" -#: ../src/editor.c:663 +#: ../src/editor.c:677 msgid "Allocation error" msgstr "Erreur d'allocation" -#: ../src/editor.c:678 +#: ../src/editor.c:692 msgid "Save as..." msgstr "Enregistrer sous..." #: ../src/main.c:43 msgid "Usage: editor [file]\n" msgstr "Usage: editor [fichier]\n" - -#, fuzzy -#~ msgid "" -#~ "There are unsaved changes.\n" -#~ "Are you sure you want to close?" -#~ msgstr "" -#~ "Il y a des changements non enregistrés.\n" -#~ "Êtes-vous sûr de vouloir les annuler ?" diff --git a/po/it.po b/po/it.po index 7172ccf..2ac1669 100644 --- a/po/it.po +++ b/po/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Editor 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-11-27 16:20+0100\n" +"POT-Creation-Date: 2011-01-26 01:17+0100\n" "PO-Revision-Date: 2010-04-09 16:43+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: Italian\n" @@ -17,11 +17,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:67 +#: ../src/callbacks.c:76 msgid "Text editor preferences" msgstr "" -#: ../src/callbacks.c:84 +#: ../src/callbacks.c:93 msgid "Font:" msgstr "" @@ -65,132 +65,132 @@ msgstr "" msgid "_Paste" msgstr "" -#: ../src/editor.c:89 +#: ../src/editor.c:90 msgid "Select _all" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:97 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:98 +#: ../src/editor.c:99 msgid "_Find" msgstr "" -#: ../src/editor.c:101 +#: ../src/editor.c:102 msgid "_Preferences" msgstr "" -#: ../src/editor.c:108 +#: ../src/editor.c:109 msgid "_About" msgstr "" -#: ../src/editor.c:119 +#: ../src/editor.c:120 msgid "_File" msgstr "" -#: ../src/editor.c:120 +#: ../src/editor.c:121 msgid "_Edit" msgstr "" -#: ../src/editor.c:121 +#: ../src/editor.c:122 msgid "_Help" msgstr "" -#: ../src/editor.c:128 +#: ../src/editor.c:129 msgid "New" msgstr "" -#: ../src/editor.c:129 +#: ../src/editor.c:130 msgid "Open" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:132 msgid "Save" msgstr "" -#: ../src/editor.c:132 +#: ../src/editor.c:133 msgid "Save as" msgstr "" -#: ../src/editor.c:136 +#: ../src/editor.c:137 msgid "Preferences" msgstr "" -#: ../src/editor.c:227 +#: ../src/editor.c:228 msgid "Text editor - " msgstr "" -#: ../src/editor.c:228 +#: ../src/editor.c:229 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:341 +#: ../src/editor.c:342 msgid "Could not save configuration" msgstr "" -#: ../src/editor.c:355 ../src/editor.c:360 +#: ../src/editor.c:356 ../src/editor.c:361 msgid "Error" msgstr "" -#: ../src/editor.c:387 ../src/editor.c:397 ../src/editor.c:509 -#: ../src/editor.c:523 ../src/editor.c:650 ../src/editor.c:655 +#: ../src/editor.c:388 ../src/editor.c:398 ../src/editor.c:510 +#: ../src/editor.c:524 ../src/editor.c:664 ../src/editor.c:669 msgid "Warning" msgstr "" -#: ../src/editor.c:391 +#: ../src/editor.c:392 msgid "" "There are unsaved changes.\n" "Discard or save them?" msgstr "" -#: ../src/editor.c:429 +#: ../src/editor.c:430 msgid "Find text" msgstr "" -#: ../src/editor.c:436 +#: ../src/editor.c:437 msgid "Text:" msgstr "" -#: ../src/editor.c:443 +#: ../src/editor.c:444 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:445 +#: ../src/editor.c:446 msgid "Wrap" msgstr "" -#: ../src/editor.c:468 +#: ../src/editor.c:469 msgid "Text not found" msgstr "" -#: ../src/editor.c:513 +#: ../src/editor.c:514 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:520 +#: ../src/editor.c:521 msgid "Discard" msgstr "" -#: ../src/editor.c:579 +#: ../src/editor.c:580 msgid "Open file..." msgstr "" -#: ../src/editor.c:626 +#: ../src/editor.c:640 msgid "Partial write" msgstr "" -#: ../src/editor.c:654 +#: ../src/editor.c:668 msgid "This file already exists. Overwrite?" msgstr "" -#: ../src/editor.c:663 +#: ../src/editor.c:677 msgid "Allocation error" msgstr "" -#: ../src/editor.c:678 +#: ../src/editor.c:692 msgid "Save as..." msgstr "" diff --git a/src/callbacks.c b/src/callbacks.c index 66d82fe..f9e7cda 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -42,6 +42,15 @@ void on_edit_find(gpointer data) } +/* on_edit_paste */ +void on_edit_paste(gpointer data) +{ + Editor * editor = data; + + editor_paste(editor); +} + + /* on_edit_preferences */ static void _preferences_set(Editor * editor); static gboolean _preferences_on_closex(gpointer data); diff --git a/src/callbacks.h b/src/callbacks.h index d1af6a1..baaf4a8 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -24,6 +24,7 @@ /* functions */ gboolean on_closex(gpointer data); void on_edit_find(gpointer data); +void on_edit_paste(gpointer data); void on_edit_preferences(gpointer data); void on_edit_select_all(gpointer data); void on_edit_unselect_all(gpointer data); diff --git a/src/editor.c b/src/editor.c index 320997b..62e981d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1,6 +1,6 @@ /* $Id$ */ static char const _copyright[] = -"Copyright (c) 2010 Pierre Pronchery "; +"Copyright (c) 2011 Pierre Pronchery "; /* This file is part of DeforaOS Desktop Editor */ static char const _license[] = "This program is free software: you can redistribute it and/or modify\n" @@ -84,7 +84,8 @@ static DesktopMenu _editor_menu_edit[] = { "", NULL, NULL, 0, 0 }, { N_("_Cut"), NULL, GTK_STOCK_CUT, 0, 0 }, /* FIXME implement */ { N_("_Copy"), NULL, GTK_STOCK_COPY, 0, 0 }, /* FIXME implement */ - { N_("_Paste"), NULL, GTK_STOCK_PASTE, 0, 0 }, /* FIXME implement */ + { N_("_Paste"), G_CALLBACK(on_edit_paste), GTK_STOCK_PASTE, + GDK_CONTROL_MASK, GDK_v }, { "", NULL, NULL, 0, 0 }, { N_("Select _all"), G_CALLBACK(on_edit_select_all), #if GTK_CHECK_VERSION(2, 10, 0) @@ -592,6 +593,19 @@ void editor_open_dialog(Editor * editor) } +/* editor_paste */ +void editor_paste(Editor * editor) +{ + GtkTextBuffer * buffer; + GtkClipboard * clipboard; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(editor->view)); + clipboard = gtk_widget_get_clipboard(editor->view, + GDK_SELECTION_CLIPBOARD); + gtk_text_buffer_paste_clipboard(buffer, clipboard, NULL, TRUE); +} + + /* editor_save */ gboolean editor_save(Editor * editor) { diff --git a/src/editor.h b/src/editor.h index 706131d..163e7f0 100644 --- a/src/editor.h +++ b/src/editor.h @@ -68,6 +68,8 @@ gboolean editor_close(Editor * editor); void editor_open(Editor * editor, char const * filename); void editor_open_dialog(Editor * editor); +void editor_paste(Editor * editor); + gboolean editor_save(Editor * editor); gboolean editor_save_as(Editor * editor, char const * filename); gboolean editor_save_as_dialog(Editor * editor);