diff --git a/po/de.po b/po/de.po index 8d3e02a..d8c5a01 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-10-26 03:39+0200\n" +"POT-Creation-Date: 2010-10-26 04:16+0200\n" "PO-Revision-Date: 2010-04-07 22:05+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: German\n" @@ -16,176 +16,180 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:70 +#: ../src/callbacks.c:67 msgid "Text editor preferences" msgstr "Text Editor Einstellungen" -#: ../src/callbacks.c:87 +#: ../src/callbacks.c:84 msgid "Font:" msgstr "" -#: ../src/editor.c:59 +#: ../src/editor.c:64 msgid "_New" msgstr "_Neu" -#: ../src/editor.c:61 +#: ../src/editor.c:66 msgid "_Open" msgstr "_Offnen" -#: ../src/editor.c:64 +#: ../src/editor.c:69 msgid "_Save" msgstr "" -#: ../src/editor.c:66 +#: ../src/editor.c:71 msgid "_Save as..." msgstr "" -#: ../src/editor.c:69 +#: ../src/editor.c:74 msgid "_Close" msgstr "_Schliessen" -#: ../src/editor.c:76 +#: ../src/editor.c:81 msgid "_Undo" msgstr "" -#: ../src/editor.c:78 +#: ../src/editor.c:83 msgid "_Redo" msgstr "" -#: ../src/editor.c:80 +#: ../src/editor.c:85 msgid "_Cut" msgstr "" -#: ../src/editor.c:81 +#: ../src/editor.c:86 msgid "_Copy" msgstr "" -#: ../src/editor.c:82 +#: ../src/editor.c:87 msgid "_Paste" msgstr "" -#: ../src/editor.c:84 +#: ../src/editor.c:89 msgid "Select _all" msgstr "" -#: ../src/editor.c:91 +#: ../src/editor.c:96 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:93 +#: ../src/editor.c:98 msgid "_Find" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:101 msgid "_Preferences" msgstr "_Einstellungen" -#: ../src/editor.c:103 +#: ../src/editor.c:108 msgid "_About" msgstr "_Info" -#: ../src/editor.c:114 +#: ../src/editor.c:119 msgid "_File" msgstr "_Datei" -#: ../src/editor.c:115 +#: ../src/editor.c:120 msgid "_Edit" msgstr "" -#: ../src/editor.c:116 +#: ../src/editor.c:121 msgid "_Help" msgstr "" -#: ../src/editor.c:123 +#: ../src/editor.c:128 msgid "New" msgstr "" -#: ../src/editor.c:124 +#: ../src/editor.c:129 msgid "Open" msgstr "" -#: ../src/editor.c:126 +#: ../src/editor.c:131 msgid "Save" msgstr "" -#: ../src/editor.c:127 +#: ../src/editor.c:132 msgid "Save as" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:136 msgid "Preferences" msgstr "" -#: ../src/editor.c:221 +#: ../src/editor.c:227 msgid "Text editor - " msgstr "" -#: ../src/editor.c:222 +#: ../src/editor.c:228 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:293 ../src/editor.c:298 +#: ../src/editor.c:341 +msgid "Could not save configuration" +msgstr "" + +#: ../src/editor.c:355 ../src/editor.c:360 msgid "Error" msgstr "Fehler" -#: ../src/editor.c:325 ../src/editor.c:334 ../src/editor.c:444 -#: ../src/editor.c:458 ../src/editor.c:588 ../src/editor.c:593 +#: ../src/editor.c:387 ../src/editor.c:396 ../src/editor.c:506 +#: ../src/editor.c:520 ../src/editor.c:650 ../src/editor.c:655 msgid "Warning" msgstr "Achtung" -#: ../src/editor.c:329 +#: ../src/editor.c:391 msgid "" "There are unsaved changes.\n" "Are you sure you want to close?" msgstr "" -#: ../src/editor.c:364 +#: ../src/editor.c:426 msgid "Find text" msgstr "" -#: ../src/editor.c:371 +#: ../src/editor.c:433 msgid "Text:" msgstr "Text:" -#: ../src/editor.c:378 +#: ../src/editor.c:440 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:380 +#: ../src/editor.c:442 msgid "Wrap" msgstr "" -#: ../src/editor.c:403 +#: ../src/editor.c:465 msgid "Text not found" msgstr "" -#: ../src/editor.c:448 +#: ../src/editor.c:510 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:455 +#: ../src/editor.c:517 msgid "Discard" msgstr "" -#: ../src/editor.c:514 +#: ../src/editor.c:576 msgid "Open file..." msgstr "Offnen..." -#: ../src/editor.c:564 +#: ../src/editor.c:626 msgid "Partial write" msgstr "" -#: ../src/editor.c:592 +#: ../src/editor.c:654 msgid "File exists. Overwrite?" msgstr "" -#: ../src/editor.c:601 +#: ../src/editor.c:663 msgid "Allocation error" msgstr "" -#: ../src/editor.c:616 +#: ../src/editor.c:678 msgid "Save as..." msgstr "" diff --git a/po/es.po b/po/es.po index 345a1e2..3758bf2 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-10-26 03:39+0200\n" +"POT-Creation-Date: 2010-10-26 04:16+0200\n" "PO-Revision-Date: 2010-04-07 22:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: Spanish\n" @@ -16,176 +16,180 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:70 +#: ../src/callbacks.c:67 msgid "Text editor preferences" msgstr "" -#: ../src/callbacks.c:87 +#: ../src/callbacks.c:84 msgid "Font:" msgstr "" -#: ../src/editor.c:59 +#: ../src/editor.c:64 msgid "_New" msgstr "" -#: ../src/editor.c:61 +#: ../src/editor.c:66 msgid "_Open" msgstr "" -#: ../src/editor.c:64 +#: ../src/editor.c:69 msgid "_Save" msgstr "" -#: ../src/editor.c:66 +#: ../src/editor.c:71 msgid "_Save as..." msgstr "" -#: ../src/editor.c:69 +#: ../src/editor.c:74 msgid "_Close" msgstr "" -#: ../src/editor.c:76 +#: ../src/editor.c:81 msgid "_Undo" msgstr "" -#: ../src/editor.c:78 +#: ../src/editor.c:83 msgid "_Redo" msgstr "" -#: ../src/editor.c:80 +#: ../src/editor.c:85 msgid "_Cut" msgstr "" -#: ../src/editor.c:81 +#: ../src/editor.c:86 msgid "_Copy" msgstr "" -#: ../src/editor.c:82 +#: ../src/editor.c:87 msgid "_Paste" msgstr "" -#: ../src/editor.c:84 +#: ../src/editor.c:89 msgid "Select _all" msgstr "" -#: ../src/editor.c:91 +#: ../src/editor.c:96 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:93 +#: ../src/editor.c:98 msgid "_Find" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:101 msgid "_Preferences" msgstr "" -#: ../src/editor.c:103 +#: ../src/editor.c:108 msgid "_About" msgstr "" -#: ../src/editor.c:114 +#: ../src/editor.c:119 msgid "_File" msgstr "" -#: ../src/editor.c:115 +#: ../src/editor.c:120 msgid "_Edit" msgstr "" -#: ../src/editor.c:116 +#: ../src/editor.c:121 msgid "_Help" msgstr "" -#: ../src/editor.c:123 +#: ../src/editor.c:128 msgid "New" msgstr "" -#: ../src/editor.c:124 +#: ../src/editor.c:129 msgid "Open" msgstr "" -#: ../src/editor.c:126 +#: ../src/editor.c:131 msgid "Save" msgstr "" -#: ../src/editor.c:127 +#: ../src/editor.c:132 msgid "Save as" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:136 msgid "Preferences" msgstr "" -#: ../src/editor.c:221 +#: ../src/editor.c:227 msgid "Text editor - " msgstr "" -#: ../src/editor.c:222 +#: ../src/editor.c:228 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:293 ../src/editor.c:298 +#: ../src/editor.c:341 +msgid "Could not save configuration" +msgstr "" + +#: ../src/editor.c:355 ../src/editor.c:360 msgid "Error" msgstr "" -#: ../src/editor.c:325 ../src/editor.c:334 ../src/editor.c:444 -#: ../src/editor.c:458 ../src/editor.c:588 ../src/editor.c:593 +#: ../src/editor.c:387 ../src/editor.c:396 ../src/editor.c:506 +#: ../src/editor.c:520 ../src/editor.c:650 ../src/editor.c:655 msgid "Warning" msgstr "" -#: ../src/editor.c:329 +#: ../src/editor.c:391 msgid "" "There are unsaved changes.\n" "Are you sure you want to close?" msgstr "" -#: ../src/editor.c:364 +#: ../src/editor.c:426 msgid "Find text" msgstr "" -#: ../src/editor.c:371 +#: ../src/editor.c:433 msgid "Text:" msgstr "" -#: ../src/editor.c:378 +#: ../src/editor.c:440 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:380 +#: ../src/editor.c:442 msgid "Wrap" msgstr "" -#: ../src/editor.c:403 +#: ../src/editor.c:465 msgid "Text not found" msgstr "" -#: ../src/editor.c:448 +#: ../src/editor.c:510 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:455 +#: ../src/editor.c:517 msgid "Discard" msgstr "" -#: ../src/editor.c:514 +#: ../src/editor.c:576 msgid "Open file..." msgstr "" -#: ../src/editor.c:564 +#: ../src/editor.c:626 msgid "Partial write" msgstr "" -#: ../src/editor.c:592 +#: ../src/editor.c:654 msgid "File exists. Overwrite?" msgstr "" -#: ../src/editor.c:601 +#: ../src/editor.c:663 msgid "Allocation error" msgstr "" -#: ../src/editor.c:616 +#: ../src/editor.c:678 msgid "Save as..." msgstr "" diff --git a/po/fr.po b/po/fr.po index 565986f..feca95b 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-10-26 03:39+0200\n" +"POT-Creation-Date: 2010-10-26 04:16+0200\n" "PO-Revision-Date: 2010-04-11 12:32+0200\n" "Last-Translator: Calimero \n" "Language-Team: French\n" @@ -16,124 +16,128 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: ../src/callbacks.c:70 +#: ../src/callbacks.c:67 msgid "Text editor preferences" msgstr "Préférences de l'éditeur de texte" -#: ../src/callbacks.c:87 +#: ../src/callbacks.c:84 msgid "Font:" msgstr "Police :" -#: ../src/editor.c:59 +#: ../src/editor.c:64 msgid "_New" msgstr "_Nouveau" -#: ../src/editor.c:61 +#: ../src/editor.c:66 msgid "_Open" msgstr "_Ouvrir" -#: ../src/editor.c:64 +#: ../src/editor.c:69 msgid "_Save" msgstr "_Enregistrer" -#: ../src/editor.c:66 +#: ../src/editor.c:71 msgid "_Save as..." msgstr "_Enregistrer sous..." -#: ../src/editor.c:69 +#: ../src/editor.c:74 msgid "_Close" msgstr "_Fermer" -#: ../src/editor.c:76 +#: ../src/editor.c:81 msgid "_Undo" msgstr "_Annuler" -#: ../src/editor.c:78 +#: ../src/editor.c:83 msgid "_Redo" msgstr "_Rétablir" -#: ../src/editor.c:80 +#: ../src/editor.c:85 msgid "_Cut" msgstr "Co_uper" -#: ../src/editor.c:81 +#: ../src/editor.c:86 msgid "_Copy" msgstr "_Copier" -#: ../src/editor.c:82 +#: ../src/editor.c:87 msgid "_Paste" msgstr "C_oller" -#: ../src/editor.c:84 +#: ../src/editor.c:89 msgid "Select _all" msgstr "Sélectionner _tout" -#: ../src/editor.c:91 +#: ../src/editor.c:96 msgid "_Unselect all" msgstr "Tout _désélectionner" -#: ../src/editor.c:93 +#: ../src/editor.c:98 msgid "_Find" msgstr "_Rechercher" -#: ../src/editor.c:96 +#: ../src/editor.c:101 msgid "_Preferences" msgstr "_Préférences" -#: ../src/editor.c:103 +#: ../src/editor.c:108 msgid "_About" msgstr "À _propos" -#: ../src/editor.c:114 +#: ../src/editor.c:119 msgid "_File" msgstr "_Fichier" -#: ../src/editor.c:115 +#: ../src/editor.c:120 msgid "_Edit" msgstr "É_dition" -#: ../src/editor.c:116 +#: ../src/editor.c:121 msgid "_Help" msgstr "_Aide" -#: ../src/editor.c:123 +#: ../src/editor.c:128 msgid "New" msgstr "Nouveau" -#: ../src/editor.c:124 +#: ../src/editor.c:129 msgid "Open" msgstr "Ouvrir" -#: ../src/editor.c:126 +#: ../src/editor.c:131 msgid "Save" msgstr "Enregistrer" -#: ../src/editor.c:127 +#: ../src/editor.c:132 msgid "Save as" msgstr "Enregistrer sous" -#: ../src/editor.c:131 +#: ../src/editor.c:136 msgid "Preferences" msgstr "Préférences" -#: ../src/editor.c:221 +#: ../src/editor.c:227 msgid "Text editor - " msgstr "Éditeur de texte - " -#: ../src/editor.c:222 +#: ../src/editor.c:228 msgid "(Untitled)" msgstr "(Sans titre)" -#: ../src/editor.c:293 ../src/editor.c:298 +#: ../src/editor.c:341 +msgid "Could not save configuration" +msgstr "Erreur lors de la sauvegarde de la configuration" + +#: ../src/editor.c:355 ../src/editor.c:360 msgid "Error" msgstr "Erreur" -#: ../src/editor.c:325 ../src/editor.c:334 ../src/editor.c:444 -#: ../src/editor.c:458 ../src/editor.c:588 ../src/editor.c:593 +#: ../src/editor.c:387 ../src/editor.c:396 ../src/editor.c:506 +#: ../src/editor.c:520 ../src/editor.c:650 ../src/editor.c:655 msgid "Warning" msgstr "Avertissement" -#: ../src/editor.c:329 +#: ../src/editor.c:391 msgid "" "There are unsaved changes.\n" "Are you sure you want to close?" @@ -141,27 +145,27 @@ msgstr "" "Il y a des modifications non enregistrées.\n" "Voulez-vous fermer tout de même ?" -#: ../src/editor.c:364 +#: ../src/editor.c:426 msgid "Find text" msgstr "Rechercher" -#: ../src/editor.c:371 +#: ../src/editor.c:433 msgid "Text:" msgstr "Texte :" -#: ../src/editor.c:378 +#: ../src/editor.c:440 msgid "Case-sensitive" msgstr "Sensible à la casse" -#: ../src/editor.c:380 +#: ../src/editor.c:442 msgid "Wrap" msgstr "Boucler" -#: ../src/editor.c:403 +#: ../src/editor.c:465 msgid "Text not found" msgstr "Texte non trouvé" -#: ../src/editor.c:448 +#: ../src/editor.c:510 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" @@ -169,27 +173,27 @@ msgstr "" "Il y a des changements non enregistrés.\n" "Êtes-vous sûr de vouloir les annuler ?" -#: ../src/editor.c:455 +#: ../src/editor.c:517 msgid "Discard" msgstr "Annuler" -#: ../src/editor.c:514 +#: ../src/editor.c:576 msgid "Open file..." msgstr "Ouvrir un fichier..." -#: ../src/editor.c:564 +#: ../src/editor.c:626 msgid "Partial write" msgstr "Écriture partielle" -#: ../src/editor.c:592 +#: ../src/editor.c:654 msgid "File exists. Overwrite?" msgstr "Le fichier existe. L'écraser ?" -#: ../src/editor.c:601 +#: ../src/editor.c:663 msgid "Allocation error" msgstr "Erreur d'allocation" -#: ../src/editor.c:616 +#: ../src/editor.c:678 msgid "Save as..." msgstr "Enregistrer sous..." diff --git a/po/it.po b/po/it.po index 6a043f7..143845f 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-10-26 03:39+0200\n" +"POT-Creation-Date: 2010-10-26 04:16+0200\n" "PO-Revision-Date: 2010-04-09 16:43+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: Italian\n" @@ -17,176 +17,180 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/callbacks.c:70 +#: ../src/callbacks.c:67 msgid "Text editor preferences" msgstr "" -#: ../src/callbacks.c:87 +#: ../src/callbacks.c:84 msgid "Font:" msgstr "" -#: ../src/editor.c:59 +#: ../src/editor.c:64 msgid "_New" msgstr "" -#: ../src/editor.c:61 +#: ../src/editor.c:66 msgid "_Open" msgstr "" -#: ../src/editor.c:64 +#: ../src/editor.c:69 msgid "_Save" msgstr "" -#: ../src/editor.c:66 +#: ../src/editor.c:71 msgid "_Save as..." msgstr "" -#: ../src/editor.c:69 +#: ../src/editor.c:74 msgid "_Close" msgstr "" -#: ../src/editor.c:76 +#: ../src/editor.c:81 msgid "_Undo" msgstr "" -#: ../src/editor.c:78 +#: ../src/editor.c:83 msgid "_Redo" msgstr "" -#: ../src/editor.c:80 +#: ../src/editor.c:85 msgid "_Cut" msgstr "" -#: ../src/editor.c:81 +#: ../src/editor.c:86 msgid "_Copy" msgstr "" -#: ../src/editor.c:82 +#: ../src/editor.c:87 msgid "_Paste" msgstr "" -#: ../src/editor.c:84 +#: ../src/editor.c:89 msgid "Select _all" msgstr "" -#: ../src/editor.c:91 +#: ../src/editor.c:96 msgid "_Unselect all" msgstr "" -#: ../src/editor.c:93 +#: ../src/editor.c:98 msgid "_Find" msgstr "" -#: ../src/editor.c:96 +#: ../src/editor.c:101 msgid "_Preferences" msgstr "" -#: ../src/editor.c:103 +#: ../src/editor.c:108 msgid "_About" msgstr "" -#: ../src/editor.c:114 +#: ../src/editor.c:119 msgid "_File" msgstr "" -#: ../src/editor.c:115 +#: ../src/editor.c:120 msgid "_Edit" msgstr "" -#: ../src/editor.c:116 +#: ../src/editor.c:121 msgid "_Help" msgstr "" -#: ../src/editor.c:123 +#: ../src/editor.c:128 msgid "New" msgstr "" -#: ../src/editor.c:124 +#: ../src/editor.c:129 msgid "Open" msgstr "" -#: ../src/editor.c:126 +#: ../src/editor.c:131 msgid "Save" msgstr "" -#: ../src/editor.c:127 +#: ../src/editor.c:132 msgid "Save as" msgstr "" -#: ../src/editor.c:131 +#: ../src/editor.c:136 msgid "Preferences" msgstr "" -#: ../src/editor.c:221 +#: ../src/editor.c:227 msgid "Text editor - " msgstr "" -#: ../src/editor.c:222 +#: ../src/editor.c:228 msgid "(Untitled)" msgstr "" -#: ../src/editor.c:293 ../src/editor.c:298 +#: ../src/editor.c:341 +msgid "Could not save configuration" +msgstr "" + +#: ../src/editor.c:355 ../src/editor.c:360 msgid "Error" msgstr "" -#: ../src/editor.c:325 ../src/editor.c:334 ../src/editor.c:444 -#: ../src/editor.c:458 ../src/editor.c:588 ../src/editor.c:593 +#: ../src/editor.c:387 ../src/editor.c:396 ../src/editor.c:506 +#: ../src/editor.c:520 ../src/editor.c:650 ../src/editor.c:655 msgid "Warning" msgstr "" -#: ../src/editor.c:329 +#: ../src/editor.c:391 msgid "" "There are unsaved changes.\n" "Are you sure you want to close?" msgstr "" -#: ../src/editor.c:364 +#: ../src/editor.c:426 msgid "Find text" msgstr "" -#: ../src/editor.c:371 +#: ../src/editor.c:433 msgid "Text:" msgstr "" -#: ../src/editor.c:378 +#: ../src/editor.c:440 msgid "Case-sensitive" msgstr "" -#: ../src/editor.c:380 +#: ../src/editor.c:442 msgid "Wrap" msgstr "" -#: ../src/editor.c:403 +#: ../src/editor.c:465 msgid "Text not found" msgstr "" -#: ../src/editor.c:448 +#: ../src/editor.c:510 msgid "" "There are unsaved changes.\n" "Are you sure you want to discard them?" msgstr "" -#: ../src/editor.c:455 +#: ../src/editor.c:517 msgid "Discard" msgstr "" -#: ../src/editor.c:514 +#: ../src/editor.c:576 msgid "Open file..." msgstr "" -#: ../src/editor.c:564 +#: ../src/editor.c:626 msgid "Partial write" msgstr "" -#: ../src/editor.c:592 +#: ../src/editor.c:654 msgid "File exists. Overwrite?" msgstr "" -#: ../src/editor.c:601 +#: ../src/editor.c:663 msgid "Allocation error" msgstr "" -#: ../src/editor.c:616 +#: ../src/editor.c:678 msgid "Save as..." msgstr "" diff --git a/src/Makefile b/src/Makefile index 043de47..c6f6b78 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ CPPFLAGSF= -I $(PREFIX)/include CPPFLAGS= CFLAGSF = -W `pkg-config --cflags gtk+-2.0` CFLAGS = -Wall -g -O2 -pedantic -LDFLAGSF= `pkg-config --libs gtk+-2.0` -lDesktop +LDFLAGSF= `pkg-config --libs gtk+-2.0` -lSystem -lDesktop LDFLAGS = -L $(PREFIX)/lib -Wl,-rpath,$(PREFIX)/lib RM = rm -f LN = ln -f @@ -24,7 +24,7 @@ editor_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) editor: $(editor_OBJS) $(CC) -o editor $(editor_OBJS) $(editor_LDFLAGS) -callbacks.o: callbacks.c callbacks.h +callbacks.o: callbacks.c editor.h callbacks.h $(CC) $(editor_CFLAGS) -c callbacks.c editor.o: editor.c callbacks.h editor.h ../config.h diff --git a/src/callbacks.c b/src/callbacks.c index 0fb5138..66d82fe 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -53,7 +53,6 @@ static void _preferences_on_ok(gpointer data); void on_edit_preferences(gpointer data) { Editor * editor = data; - PangoFontDescription * desc; GtkWidget * vbox; GtkWidget * hbox; GtkWidget * widget; @@ -64,8 +63,6 @@ void on_edit_preferences(gpointer data) gtk_widget_show(editor->pr_window); return; } - desc = pango_font_description_new(); - pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD); editor->pr_window = gtk_dialog_new_with_buttons( _("Text editor preferences"), GTK_WINDOW(editor->window), @@ -85,7 +82,6 @@ void on_edit_preferences(gpointer data) group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); /* font */ widget = gtk_label_new(_("Font:")); - gtk_widget_modify_font(widget, desc); gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 4); editor->pr_font = gtk_font_button_new(); gtk_font_button_set_use_font(GTK_FONT_BUTTON(editor->pr_font), TRUE); @@ -99,7 +95,7 @@ void on_edit_preferences(gpointer data) static void _preferences_set(Editor * editor) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(editor->pr_font), - editor->font); + editor_get_font(editor)); } static gboolean _preferences_on_closex(gpointer data) @@ -136,6 +132,7 @@ static void _preferences_on_ok(gpointer data) gtk_widget_hide(editor->pr_window); font = gtk_font_button_get_font_name(GTK_FONT_BUTTON(editor->pr_font)); editor_set_font(editor, font); + editor_config_save(editor); } diff --git a/src/editor.c b/src/editor.c index c8fed10..9b78631 100644 --- a/src/editor.c +++ b/src/editor.c @@ -33,6 +33,11 @@ static char const _license[] = /* Editor */ /* private */ +/* constants */ +#define EDITOR_CONFIG_FILE ".editor" +#define EDITOR_DEFAULT_FONT "Monospace 9" + + /* variables */ static char const * _authors[] = { @@ -136,6 +141,7 @@ static DesktopToolbar _editor_toolbar[] = /* prototypes */ +static char * _editor_config_filename(void); static gboolean _editor_find(Editor * editor, char const * text, gboolean sensitive, gboolean wrap); @@ -149,20 +155,21 @@ Editor * editor_new(void) { Editor * editor; GtkAccelGroup * group; - GtkSettings * settings; GtkWidget * vbox; GtkWidget * widget; PangoFontDescription * desc; if((editor = malloc(sizeof(*editor))) == NULL) return NULL; - editor->font = NULL; - settings = gtk_settings_get_default(); - g_object_get(G_OBJECT(settings), "gtk-font-name", &editor->font, NULL); - if(editor->font == NULL) - editor->font = EDITOR_DEFAULT_FONT; + editor->config = config_new(); + if(editor->config == NULL) + { + editor_delete(editor); + return NULL; + } editor->filename = NULL; editor->search = 0; + editor_config_load(editor); /* widgets */ group = gtk_accel_group_new(); editor->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -193,8 +200,7 @@ Editor * editor_new(void) /* FIXME make it an option */ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(editor->view), GTK_WRAP_WORD_CHAR); - desc = pango_font_description_from_string(editor->font); - pango_font_description_set_family(desc, "monospace"); + desc = pango_font_description_from_string(editor_get_font(editor)); editor_set_font(editor, pango_font_description_to_string(desc)); pango_font_description_free(desc); gtk_container_add(GTK_CONTAINER(widget), editor->view); @@ -230,19 +236,50 @@ void editor_delete(Editor * editor) #ifdef DEBUG fprintf(stderr, "DEBUG: %s()\n", __func__); #endif + if(editor->config != NULL) + config_delete(editor->config); free(editor); } /* accessors */ +/* editor_get_font */ +char const * editor_get_font(Editor * editor) +{ + char const * p; + char * q; + GtkSettings * settings; + PangoFontDescription * desc; + + if((p = config_get(editor->config, NULL, "font")) != NULL) + return p; + settings = gtk_settings_get_default(); + g_object_get(G_OBJECT(settings), "gtk-font-name", &q, NULL); + if(q != NULL) + { + desc = pango_font_description_from_string(q); + g_free(q); + pango_font_description_set_family(desc, "monospace"); + q = pango_font_description_to_string(desc); + config_set(editor->config, NULL, "font", q); + g_free(q); + pango_font_description_free(desc); + if((p = config_get(editor->config, NULL, "font")) != NULL) + return p; + } + return EDITOR_DEFAULT_FONT; +} + + +/* editor_set_font */ void editor_set_font(Editor * editor, char const * font) { PangoFontDescription * desc; - editor->font = font; desc = pango_font_description_from_string(font); gtk_widget_modify_font(editor->view, desc); pango_font_description_free(desc); + config_set(editor->config, NULL, "font", font); } @@ -281,6 +318,31 @@ static gboolean _about_on_closex(gpointer data) } +/* editor_config_load */ +void editor_config_load(Editor * editor) +{ + char * filename; + + if((filename = _editor_config_filename()) == NULL) + return; + config_load(editor->config, filename); /* we can ignore errors */ + free(filename); +} + + +/* editor_config_save */ +void editor_config_save(Editor * editor) +{ + char * filename; + + if((filename = _editor_config_filename()) == NULL) + return; + if(config_save(editor->config, filename) != 0) + editor_error(editor, _("Could not save configuration"), 0); + free(filename); +} + + /* editor_error */ int editor_error(Editor * editor, char const * message, int ret) { @@ -664,6 +726,23 @@ void editor_unselect_all(Editor * editor) /* private */ /* functions */ +/* editor_config_filename */ +static char * _editor_config_filename(void) +{ + char const * homedir; + size_t len; + char * filename; + + if((homedir = getenv("HOME")) == NULL) + homedir = g_get_home_dir(); + len = strlen(homedir) + 1 + sizeof(EDITOR_CONFIG_FILE); + if((filename = malloc(len)) == NULL) + return NULL; + snprintf(filename, len, "%s/%s", homedir, EDITOR_CONFIG_FILE); + return filename; +} + + /* editor_find */ static char const * _find_string(char const * big, char const * little, gboolean sensitive); diff --git a/src/editor.h b/src/editor.h index ffda211..706131d 100644 --- a/src/editor.h +++ b/src/editor.h @@ -18,6 +18,7 @@ #ifndef EDITOR_EDITOR_H # define EDITOR_EDITOR_H +# include # include @@ -25,10 +26,11 @@ /* types */ typedef struct _Editor { - char const * font; char * filename; size_t search; + Config * config; + /* widgets */ GtkWidget * window; GtkWidget * view; @@ -46,20 +48,20 @@ typedef struct _Editor } Editor; -/* constants */ -# define EDITOR_DEFAULT_FONT "monospace" - - /* functions */ Editor * editor_new(void); void editor_delete(Editor * editor); /* accessors */ +char const * editor_get_font(Editor * editor); void editor_set_font(Editor * editor, char const * font); /* useful */ void editor_about(Editor * editor); +void editor_config_load(Editor * editor); +void editor_config_save(Editor * editor); + int editor_error(Editor * editor, char const * message, int ret); gboolean editor_close(Editor * editor); diff --git a/src/project.conf b/src/project.conf index 95545c6..e637d01 100644 --- a/src/project.conf +++ b/src/project.conf @@ -3,7 +3,7 @@ cppflags_force=-I $(PREFIX)/include #cppflags=-D EMBEDDED cflags_force=-W `pkg-config --cflags gtk+-2.0` cflags=-Wall -g -O2 -pedantic -ldflags_force=`pkg-config --libs gtk+-2.0` -lDesktop +ldflags_force=`pkg-config --libs gtk+-2.0` -lSystem -lDesktop ldflags=-L $(PREFIX)/lib -Wl,-rpath,$(PREFIX)/lib dist=Makefile,callbacks.h,editor.h @@ -13,7 +13,7 @@ sources=callbacks.c,editor.c,main.c install=$(BINDIR) [callbacks.c] -depends=callbacks.h +depends=editor.h,callbacks.h [editor.c] depends=callbacks.h,editor.h,../config.h