[Goodies-commits] r7381 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Wed May 20 21:37:38 CEST 2009
Author: mmassonnet
Date: 2009-05-20 19:37:38 +0000 (Wed, 20 May 2009)
New Revision: 7381
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/application.vala
xfce4-notes-plugin/trunk/panel-plugin/window.vala
Log:
Display existing notes in the menu Go
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-05-20 17:08:42 UTC (rev 7380)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-05-20 19:37:38 UTC (rev 7381)
@@ -1,5 +1,11 @@
2009-05-20 Mike Massonnet <mmassonnet at xfce.org>
+Display existing notes in the menu Go
+ * panel-plugin/window.vala:
+ - On menu_go.show refresh the list of existing notes
+
+2009-05-20 Mike Massonnet <mmassonnet at xfce.org>
+
Set font for current note
* panel-plugin/hypertextview.vala:
- Make the font property settable (it was a construct only)
Modified: xfce4-notes-plugin/trunk/panel-plugin/application.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-05-20 17:08:42 UTC (rev 7380)
+++ xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-05-20 19:37:38 UTC (rev 7381)
@@ -30,26 +30,10 @@
/* TODO Load existing notes */
/* Load an empty note */
var window = new Xnp.Window ();
- var note = window.insert_note ();
- note.notify += note_property_notify;
- note.save_data += (n) => { debug ("app.note.save-data %s", n); };
- note.name = "cartoon";
+ window.insert_note ();
window.show ();
}
- /**
- * note_property_notify:
- *
- * Emitted when a property is changed.
- */
- private void note_property_notify (GLib.Object object, GLib.ParamSpec pspec) {
- var note = (Xnp.Note)object;
- debug ("notify %s", pspec.name);
- if (pspec.name == "name") {
- debug ("name of note changed to `%s'", note.name);
- }
- }
-
/**/
static int main (string[] args) {
Gtk.init (ref args);
Modified: xfce4-notes-plugin/trunk/panel-plugin/window.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-20 17:08:42 UTC (rev 7380)
+++ xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-20 19:37:38 UTC (rev 7381)
@@ -501,21 +501,10 @@
/* Navigation */
var menu_go = new Gtk.Menu ();
+ update_menu_go (menu_go);
+ menu_go.show += update_menu_go;
mi.set_submenu (menu_go);
- mi = new Gtk.SeparatorMenuItem ();
- menu_go.append (mi);
-
- mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ADD, null);
- mi.add_accelerator ("activate", this.accel_group, 'N',
- Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.MASK);
- menu_go.append (mi);
-
- mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_REMOVE, null);
- mi.add_accelerator ("activate", this.accel_group, 'W',
- Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.MASK);
- menu_go.append (mi);
-
/* Properties */
mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_PROPERTIES, null);
menu.append (mi);
@@ -571,6 +560,48 @@
return menu;
}
+ /**
+ * update_menu_go:
+ *
+ * Update the menu Go when it is shown.
+ */
+ private void update_menu_go (Gtk.Menu menu) {
+ /* Clean existing items */
+ menu. at foreach ((w) => {
+ w.destroy ();
+ });
+
+ /* Build the menu */
+ if (this.notebook != null) {
+ int n_pages = this.notebook.get_n_pages ();
+ for (int p = 0; p < n_pages; p++) {
+ var note = (Xnp.Note)(this.notebook.get_nth_page (p));
+ var mi = new Gtk.MenuItem.with_label (note.name);
+ mi.set_data ("page", (void*)p);
+ mi.activate += (i) => {
+ int page = (int)i.get_data ("page");
+ notebook.set_current_page (page);
+ };
+ menu.append (mi);
+ }
+ }
+
+ var mi_separator = new Gtk.SeparatorMenuItem ();
+ menu.append (mi_separator);
+
+ var mi_image = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ADD, null);
+ mi_image.add_accelerator ("activate", this.accel_group, 'N',
+ Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.MASK);
+ menu.append (mi_image);
+
+ mi_image = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_REMOVE, null);
+ mi_image.add_accelerator ("activate", this.accel_group, 'W',
+ Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.MASK);
+ menu.append (mi_image);
+
+ menu.show_all ();
+ }
+
/*
* Private methods
*/
More information about the Goodies-commits
mailing list