[Xfce4-commits] <xfce4-vala:master> Make the panel plugin example a bit more complete

Mike Massonnet noreply at xfce.org
Wed Dec 23 16:04:01 CET 2009


Updating branch refs/heads/master
         to 26bdc6e30f47a425bf753553495cdc709c341061 (commit)
       from 1d9ddee37a6da07f2ae05d7bbce82a800db6583a (commit)

commit 26bdc6e30f47a425bf753553495cdc709c341061
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Wed Dec 23 15:58:38 2009 +0100

    Make the panel plugin example a bit more complete
    
    The plugin needs to call Gtk.main_quit() when it gets free'd or
    destroy'd. I settled for the destroy signal cause it separates a bit the
    logic of what do do on free or destroy. This is new, and if you don't do
    this call, the wrapper process will still be around after you remove the
    plugin from the panel.
    
    Connected a few signal to populate the example and made the button an
    action widget so it can be right clicked.

 examples/panel-plugin/button.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/examples/panel-plugin/button.vala b/examples/panel-plugin/button.vala
index a7d19b4..e951d63 100644
--- a/examples/panel-plugin/button.vala
+++ b/examples/panel-plugin/button.vala
@@ -15,6 +15,22 @@ public class ButtonPlugin : Xfce.PanelPlugin {
 		button = new Gtk.Button.with_label ("Hello World!");
 		add (button);
 		button.show ();
+
+		add_action_widget (button);
+
+		save.connect (() => { debug ("save yourself"); });
+		free_data.connect (() => { debug ("free yourself"); });
+		size_changed.connect (() => { debug ("panel size changed"); });
+
+		menu_show_about ();
+		about.connect (() => {
+				Gtk.show_about_dialog (null,
+					"program-name", "Button",
+					"comments", "Test plugin for the Xfce 4.7 Panel",
+					null);
+			});
+
+		destroy.connect (() => { Gtk.main_quit (); });
 	}
 }
 



More information about the Xfce4-commits mailing list