[Goodies-commits] r7379 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Wed May 20 18:45:42 CEST 2009
Author: mmassonnet
Date: 2009-05-20 16:45:41 +0000 (Wed, 20 May 2009)
New Revision: 7379
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/window.vala
Log:
Follow above/sticky states
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-05-20 08:59:24 UTC (rev 7378)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-05-20 16:45:41 UTC (rev 7379)
@@ -1,5 +1,14 @@
2009-05-20 Mike Massonnet <mmassonnet at xfce.org>
+Follow above/sticky states
+ * panel-plugin/window.vala:
+ - Switch above/sticky states through the new window properties above
+ and sticky
+ - Toggle the menu items mi_above and mi_sticky to keep them valid
+ through the window_state_cb()
+
+2009-05-20 Mike Massonnet <mmassonnet at xfce.org>
+
Update window title on note name changes (not simply on renames)
* panel-plugin/window.vala:
- Update the window title by connecting to note.notify for changes
Modified: xfce4-notes-plugin/trunk/panel-plugin/window.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-20 08:59:24 UTC (rev 7378)
+++ xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-20 16:45:41 UTC (rev 7379)
@@ -31,10 +31,10 @@
private int width;
private int height;
- private bool above;
- private bool sticky;
private Gtk.AccelGroup accel_group;
private Gtk.Menu menu;
+ private Gtk.CheckMenuItem mi_above;
+ private Gtk.CheckMenuItem mi_sticky;
private Gtk.Label title_label;
private Gtk.VBox content_box;
private Gtk.Notebook notebook;
@@ -50,6 +50,31 @@
private Gdk.Cursor CURSOR_BOTTOM = new Gdk.Cursor (Gdk.CursorType.BOTTOM_SIDE);
private Gdk.Cursor CURSOR_BOTTOM_LC = new Gdk.Cursor (Gdk.CursorType.BOTTOM_LEFT_CORNER);
+ private bool _above;
+ public bool above {
+ get {
+ return this._above;
+ }
+ set {
+ this._above = value;
+ set_keep_above (value);
+ }
+ }
+
+ private bool _sticky;
+ public bool sticky {
+ get {
+ return this._sticky;
+ }
+ set {
+ this._sticky = value;
+ if (value == true)
+ stick ();
+ else
+ unstick ();
+ }
+ }
+
construct {
this.name = "xfce4-notes-plugin";
this.title = "Notes";
@@ -59,6 +84,7 @@
this.default_width = 300;
this.decorated = false;
this.icon_name = "xfce4-notes-plugin";
+ this.sticky = true;
}
public Window () {
@@ -381,10 +407,10 @@
if ((bool)(event.changed_mask & Gdk.WindowState.ABOVE)) {
/* FIXME above state is never notified despit
* of xfwm4 switching the state */
- this.above = (bool)(event.new_window_state & Gdk.WindowState.ABOVE);
+ this.mi_above.active = (bool)(event.new_window_state & Gdk.WindowState.ABOVE);
}
if ((bool)(event.changed_mask & Gdk.WindowState.STICKY)) {
- this.sticky = (bool)(event.new_window_state & Gdk.WindowState.STICKY);
+ this.mi_sticky.active = (bool)(event.new_window_state & Gdk.WindowState.STICKY);
}
return false;
}
@@ -473,6 +499,7 @@
var mi = new Gtk.MenuItem.with_mnemonic ("_Go");
menu.append (mi);
+ /* Navigation */
var menu_go = new Gtk.Menu ();
mi.set_submenu (menu_go);
@@ -489,6 +516,7 @@
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);
@@ -529,17 +557,21 @@
mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_SELECT_FONT, null);
menu.append (mi);
- mi = new Gtk.CheckMenuItem.with_label ("Always on top");
+ mi = this.mi_above = new Gtk.CheckMenuItem.with_label ("Always on top");
+ ((Gtk.CheckMenuItem)mi).active = this.above;
+ ((Gtk.CheckMenuItem)mi).toggled += (o) => { above = o.active; };
menu.append (mi);
- mi = new Gtk.CheckMenuItem.with_label ("Sticky window");
+ mi = this.mi_sticky = new Gtk.CheckMenuItem.with_label ("Sticky window");
+ ((Gtk.CheckMenuItem)mi).active = this.sticky;
+ ((Gtk.CheckMenuItem)mi).toggled += (o) => { sticky = o.active; };
menu.append (mi);
return menu;
}
/*
- * Shade/unshade
+ * Private methods
*/
/**
@@ -568,8 +600,25 @@
}
}
+ /**
+ * update_navigation_sensitivity:
+ *
+ * Update the goleft/right sensitivities.
+ */
+ private void update_navigation_sensitivity (int page_num) {
+ int n_pages = notebook.get_n_pages ();
+ if (n_pages <= 1) {
+ this.goleft_box.sensitive = false;
+ this.goright_box.sensitive = false;
+ }
+ else {
+ this.goleft_box.sensitive = page_num == 0 ? false : true;
+ this.goright_box.sensitive = page_num + 1 == n_pages ? false : true;
+ }
+ }
+
/*
- * Tabs, navigation
+ * Public methods
*/
/**
@@ -580,7 +629,8 @@
*/
public Xnp.Note insert_note () {
int position = this.notebook.get_current_page () + 1;
- var note = new Xnp.Note ("my-note");
+ string name = "Notes";
+ var note = new Xnp.Note (name);
note.notify += note_notify;
note.save_data += (o, n) => { print ("note `%s' save-data\n", n); };
@@ -654,22 +704,6 @@
dialog.destroy ();
}
- /**
- * update_navigation_sensitivity:
- *
- * Update the goleft/right sensitivities.
- */
- private void update_navigation_sensitivity (int page_num) {
- int n_pages = notebook.get_n_pages ();
- if (n_pages <= 1) {
- this.goleft_box.sensitive = false;
- this.goright_box.sensitive = false;
- }
- else {
- this.goleft_box.sensitive = page_num == 0 ? false : true;
- this.goright_box.sensitive = page_num + 1 == n_pages ? false : true;
- }
- }
/*
static int main (string[] args) {
Gtk.init (ref args);
More information about the Goodies-commits
mailing list