[Goodies-commits] r7860 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Wed Jul 29 15:08:19 CEST 2009
Author: mmassonnet
Date: 2009-07-29 13:08:19 +0000 (Wed, 29 Jul 2009)
New Revision: 7860
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/application.vala
xfce4-notes-plugin/trunk/panel-plugin/window.vala
Log:
Deleting the last note also deletes the window (bug #5535)
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-07-29 11:24:23 UTC (rev 7859)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-07-29 13:08:19 UTC (rev 7860)
@@ -1,3 +1,15 @@
+2009-07-29 Mike Massonnet <mmassonnet at xfce.org>
+
+Deleting the last note also deletes the window (bug #5535)
+ * panel-plugin/window.vala:
+ - Install a new public property n_pages that is automatically
+ incremented and decremented.
+ - Instead of inserting a new note when the notebook is empty, send a
+ delete action to the window.
+ * panel-plugin/application.vala:
+ - Only warn and ask the user to delete the window if there is at
+ least one remaining note.
+
2009-07-13 Mike Massonnet <mmassonnet at xfce.org>
Show tabs option is back
@@ -6,7 +18,7 @@
bind to xfconf /global/show-tabs.
* panel-plugin/application.vala:
- Bind xfconf setting /global/show-tabs to the property "show-tabs"
- in the XnpWindow class.
+ on the XnpWindow objects.
2009-06-18 Mike Massonnet <mmassonnet at xfce.org>
Modified: xfce4-notes-plugin/trunk/panel-plugin/application.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-07-29 11:24:23 UTC (rev 7859)
+++ xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-07-29 13:08:19 UTC (rev 7860)
@@ -360,12 +360,14 @@
* Delete the window.
*/
private void delete_window (Xnp.Window window) {
- var dialog = new Gtk.MessageDialog (window, Gtk.DialogFlags.DESTROY_WITH_PARENT,
- Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, _("Are you sure you want to delete this group?"));
- int res = dialog.run ();
- dialog.destroy ();
- if (res != Gtk.ResponseType.YES)
- return;
+ if (window.n_pages >= 1) {
+ var dialog = new Gtk.MessageDialog (window, Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, _("Are you sure you want to delete this group?"));
+ int res = dialog.run ();
+ dialog.destroy ();
+ if (res != Gtk.ResponseType.YES)
+ return;
+ }
string name;
string path = "%s/%s".printf (notes_path, window.name);
Modified: xfce4-notes-plugin/trunk/panel-plugin/window.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-07-29 11:24:23 UTC (rev 7859)
+++ xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-07-29 13:08:19 UTC (rev 7860)
@@ -80,6 +80,7 @@
private unowned SList<unowned Xnp.Window> window_list;
public new string name { default = _("Notes"); get; set; }
+ public int n_pages { get; set; }
private bool _above;
public bool above {
@@ -916,6 +917,7 @@
note.save_data += (note) => { save_data (note); };
note.show ();
+ this.n_pages++;
this.notebook.insert_page (note, null, page);
this.note_inserted (note);
return note;
@@ -947,11 +949,12 @@
return;
}
+ this.n_pages--;
this.notebook.remove_page (page);
this.note_deleted (note);
note.destroy ();
if (this.notebook.get_n_pages () == 0)
- this.insert_note ();
+ action ("delete");
}
/**
More information about the Goodies-commits
mailing list