[Goodies-commits] r7464 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Sat Jun 6 11:05:59 CEST 2009
Author: mmassonnet
Date: 2009-06-06 09:05:59 +0000 (Sat, 06 Jun 2009)
New Revision: 7464
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/NEWS
xfce4-notes-plugin/trunk/README
xfce4-notes-plugin/trunk/TODO
xfce4-notes-plugin/trunk/panel-plugin/application.vala
xfce4-notes-plugin/trunk/panel-plugin/note.vala
Log:
Vala Xfconf settings
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-06-06 09:05:59 UTC (rev 7464)
@@ -1,3 +1,18 @@
+2009-06-06 Mike Massonnet <mmassonnet at xfce.org>
+
+Vala Xfconf settings
+ * panel-plugin/application.vala:
+ - Use Xfconf to bind and set settings.
+ - Made the font option global.
+ - Xfconf properties:
+ /global/background-color
+ /global/font-description
+ /global/skip-taskbar-hint
+ /new-window/always-on-top
+ /new-window/sticky
+ /new-window/height
+ /new-window/width
+
2009-06-04 Mike Massonnet <mmassonnet at xfce.org>
Properly save window geometry
Modified: xfce4-notes-plugin/trunk/NEWS
===================================================================
--- xfce4-notes-plugin/trunk/NEWS 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/NEWS 2009-06-06 09:05:59 UTC (rev 7464)
@@ -1,10 +1,17 @@
VERSION 1.7.0
-- New window menu layout with navigation for notes
-- Dropped show-tabs option from the window in favor of a navigation bar
-- ? Made font option apply per note instead of every notes from the window
-- New vala objects Window and Note, based on the existing code inside notes.c
-- New vala object Application to build window with notes and save on-disk
+- Renamed "Window" to "Group"
+- New window menu layout with a submenu "Go" to navigate through the notes
+- Support for hyperlinks in the notes to click'n'open
+- Dropped the tabs from the window in favor of a navigation bar
+- Made the font option global instead of per window
+- Changed the default Xfconf channel from xfce4-notes-plugin to xfce4-panel
+ with the base property /plugins/notes
+- New Vala objects, mostly based on the existing code from notes.c
+ - HypertextView, Note and Window
+ - Note is a dummy Gtk.Bin that wraps a ScrolledWindow with a HypertextView
+ and sends save-data signals as needed
+ - Application to build notes, use Xfconf settings and save on-disk
VERSION 1.6.4
Modified: xfce4-notes-plugin/trunk/README
===================================================================
--- xfce4-notes-plugin/trunk/README 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/README 2009-06-06 09:05:59 UTC (rev 7464)
@@ -1,9 +1,9 @@
- Xfce4-notes-plugin
+ Xfce4 Notes Plugin
====================
The notes plugin provides you a quick way to write down a todo list,
to paste a piece of code, to leave a note to your friend, or whatever
-else you had like to do with it.
+else you had like to do with a post'it.
“ I like to write down a todo list and mark what I did,
and once I'm done with the whole job I destroy the note.
@@ -28,6 +28,8 @@
… 2026 ⁂ 2042
☐ 2610 ☑ 2611
+ Update 2009-06-06: actually I switched to the application
+ Tasks from the Pimlico project in regard to todo lists.
”, Mike
The notes are saved under $XDG_DATA_HOME/notes/[0]. This way you can
@@ -58,6 +60,7 @@
* libgtk+2 2.10
* libxfce4panel 4.4.0
* libxfcegui4 4.4.0
+* xfconf 4.6.0
Install
Modified: xfce4-notes-plugin/trunk/TODO
===================================================================
--- xfce4-notes-plugin/trunk/TODO 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/TODO 2009-06-06 09:05:59 UTC (rev 7464)
@@ -1,2 +0,0 @@
-* HypertextView for hyperlinks
-* (Type-ahead style) search
Modified: xfce4-notes-plugin/trunk/panel-plugin/application.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-06-06 09:05:59 UTC (rev 7464)
@@ -18,6 +18,7 @@
*/
using Gtk;
+using Xfconf;
namespace Xnp {
@@ -26,6 +27,7 @@
private SList<Xnp.Window> window_list;
private string notes_path;
private string config_file;
+ private Xfconf.Channel xfconf_channel;
construct {
notes_path = "%s/notes".printf (GLib.Environment.get_user_data_dir ());
@@ -33,6 +35,14 @@
}
public Application () {
+ try {
+ Xfconf.init ();
+ xfconf_channel = new Xfconf.Channel.with_property_base ("xfce4-panel", "/plugins/notes");
+ }
+ catch (Xfconf.Error e) {
+ warning ("%s", e.message);
+ }
+
string name;
bool found = false;
try {
@@ -42,17 +52,19 @@
found = true;
}
}
- catch (Error e) {
+ catch (GLib.Error e) {
GLib.DirUtils.create_with_parents (notes_path, 0700);
}
if (found == false) {
- create_window (null);
+ create_window ();
}
}
~Application () {
save_windows_configuration ();
save_notes ();
+ xfconf_channel.unref ();
+ Xfconf.shutdown ();
}
/*
@@ -65,9 +77,24 @@
* Creates a new Xnp.Window and stores it inside window_list.
* If a name is given, it assumes it can load existing notes.
*/
- public void create_window (string? name) {
+ public void create_window (string? name = null) {
var window = new Xnp.Window ();
+ /* Global settings */
+ Xfconf.Property.bind (xfconf_channel, "/global/skip-taskbar-hint",
+ typeof (bool), window, "skip-taskbar-hint");
+
+ /* Default settings */
+ if (name == null) {
+ window.above = xfconf_channel.get_bool ("/new-window/always-on-top", false);
+ window.sticky = xfconf_channel.get_bool ("/new-window/sticky", true);
+ int width = xfconf_channel.get_int ("/new-window/width", 0);
+ int height = xfconf_channel.get_int ("/new-window/height", 0);
+ if (width > 0 && height > 0) {
+ window.resize (width, height);
+ }
+ }
+
/* Set window name */
if (name == null) {
string window_name = "Notes";
@@ -95,6 +122,8 @@
/* Insert initial notes */
if (name == null) {
var note = window.insert_note ();
+ Xfconf.Property.bind (xfconf_channel, "/global/font-description",
+ typeof (string), note.text_view, "font");
string window_path = "%s/%s".printf (notes_path, window.name);
GLib.DirUtils.create_with_parents (window_path, 0700);
@@ -120,13 +149,16 @@
delete_window (win);
}
else if (action == "create-new-window") {
- create_window (null);
+ create_window ();
}
};
window.save_data += (win, note) => {
save_note (win, note);
};
window.note_inserted += (win, note) => {
+ Xfconf.Property.bind (xfconf_channel, "/global/font-description",
+ typeof (string), note.text_view, "font");
+
string path = "%s/%s/%s".printf (notes_path, win.name, note.name);
try {
GLib.FileUtils.set_contents (path, "", -1);
@@ -165,6 +197,8 @@
note.name = name;
var buffer = note.text_view.get_buffer ();
buffer.set_text (contents, -1);
+ Xfconf.Property.bind (xfconf_channel, "/global/font-description",
+ typeof (string), note.text_view, "font");
}
catch (FileError e) {
warning ("%s", e.message);
@@ -197,7 +231,7 @@
if (visible)
window.show ();
}
- catch (Error e) {
+ catch (GLib.Error e) {
warning ("%s: %s", config_file, e.message);
window.show ();
}
@@ -342,7 +376,7 @@
}
}
else {
- create_window (null);
+ create_window ();
}
}
Modified: xfce4-notes-plugin/trunk/panel-plugin/note.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/note.vala 2009-06-06 07:47:32 UTC (rev 7463)
+++ xfce4-notes-plugin/trunk/panel-plugin/note.vala 2009-06-06 09:05:59 UTC (rev 7464)
@@ -37,15 +37,13 @@
}
set {
this._dirty = value;
+ if (this.save_timeout > 0) {
+ Source.remove (this.save_timeout);
+ }
if (value == false) {
- if (this.save_timeout > 0) {
- Source.remove (this.save_timeout);
- this.save_timeout = 0;
- }
+ this.save_timeout = 0;
}
else {
- if (this.save_timeout > 0)
- Source.remove (this.save_timeout);
this.save_timeout = Timeout.add_seconds (60, save_cb);
}
}
More information about the Goodies-commits
mailing list