tasque r114 - in trunk: . src



Author: sharm
Date: Sat Sep 27 15:37:23 2008
New Revision: 114
URL: http://svn.gnome.org/viewvc/tasque?rev=114&view=rev

Log:
* src/tasque.in: Add Mono --debug, --trace, and --profile support to
  "tasque" command.
* src/Application.cs: Use UIManager to construct/manage tray icon menu.
   Add Sandy and Brian to the "Authors" area of the About dialog.
* src/Makefile.am: Install .mdb file for debugging purposes.

Modified:
   trunk/ChangeLog
   trunk/src/Application.cs
   trunk/src/Makefile.am
   trunk/src/tasque.in

Modified: trunk/src/Application.cs
==============================================================================
--- trunk/src/Application.cs	(original)
+++ trunk/src/Application.cs	Sat Sep 27 15:37:23 2008
@@ -73,6 +73,23 @@
 		
 		private IBackend customBackend;
 
+		private UIManager uiManager;
+		private const string menuXml = @"
+<ui>
+	<popup name=""TrayIconMenu"">
+		<menuitem action=""ShowTasksAction""/>
+		<menuitem action=""NewTaskAction""/>
+		<separator/>
+		<menuitem action=""PreferencesAction""/>
+		<menuitem action=""AboutAction""/>
+		<separator/>
+		<menuitem action=""RefreshAction""/>
+		<separator/>
+		<menuitem action=""QuitAction""/>
+	</popup>
+</ui>
+";
+
 		public static IBackend Backend
 		{ 
 			get { return Application.Instance.backend; }
@@ -139,6 +156,11 @@
 			}
 		}
 
+		public UIManager UIManager
+		{
+			get { return uiManager; }
+		}
+
 		public static Preferences Preferences
 		{
 			get { return Application.Instance.preferences; }
@@ -166,6 +188,8 @@
 				"Tasque",
 				"Tasque",
 				args);
+			
+			RegisterUIManager ();
 
 			preferences = new Preferences (nativeApp.ConfDir);
 			
@@ -365,10 +389,6 @@
 			return true;
 		}
 
-		private void UpdateTrayIcon()
-		{
-		}
-
 		private void SetupTrayIcon ()
 		{
 			trayIcon = new Gtk.StatusIcon();
@@ -411,7 +431,9 @@
 		{
 			string [] authors = new string [] {
 				"Boyd Timothy <btimothy gmail com>",
-				"Calvin Gaisford <calvinrg gmail com>"
+				"Calvin Gaisford <calvinrg gmail com>",
+				"Sandy Armstrong <sanfordarmstrong gmail com>",
+				"Brian G. Merrell <bgmerrell novell com>"
 			};
 
 			/* string [] documenters = new string [] {
@@ -471,8 +493,6 @@
 		{
 			Application.Backend.Refresh();
 		}
-		
-		
 
 		private void OnTrayIconClick (object sender, EventArgs args) // handler for mouse click
 		{
@@ -481,52 +501,13 @@
 
 		private void OnTrayIconPopupMenu (object sender, EventArgs args)
 		{
-			// FIXME: Eventually get all these into UIManagerLayout.xml file
-			Menu popupMenu = new Menu();
-
-			ImageMenuItem showTasksItem = new ImageMenuItem
-				(Catalog.GetString ("Show Tasks ..."));
+			Menu popupMenu = (Menu) uiManager.GetWidget ("/TrayIconMenu");
 
-			showTasksItem.Image = new Gtk.Image(Utilities.GetIcon ("tasque-16", 16));
-			showTasksItem.Sensitive = backend != null && backend.Initialized;
-			showTasksItem.Activated += OnShowTaskWindow;
-			popupMenu.Add (showTasksItem);
-			
-			ImageMenuItem newTaskItem = new ImageMenuItem
-				(Catalog.GetString ("New Task ..."));
-			newTaskItem.Image = new Gtk.Image (Gtk.Stock.New, IconSize.Menu);
-			newTaskItem.Sensitive = backend != null && backend.Initialized;
-			newTaskItem.Activated += OnNewTask;
-			popupMenu.Add (newTaskItem);
-
-			SeparatorMenuItem separator = new SeparatorMenuItem ();
-			popupMenu.Add (separator);
-
-			ImageMenuItem preferences = new ImageMenuItem (Gtk.Stock.Preferences, null);
-			preferences.Activated += OnPreferences;
-			popupMenu.Add (preferences);
-
-			ImageMenuItem about = new ImageMenuItem (Gtk.Stock.About, null);
-			about.Activated += OnAbout;
-			popupMenu.Add (about);
-
-			separator = new SeparatorMenuItem ();
-			popupMenu.Add (separator);
-
-			ImageMenuItem refreshAction = new ImageMenuItem
-				(Catalog.GetString ("Refresh Tasks"));
-
-			refreshAction.Image = new Gtk.Image(Utilities.GetIcon (Gtk.Stock.Execute, 16));
-			refreshAction.Sensitive = backend != null && backend.Initialized;
-			refreshAction.Activated += OnRefreshAction;
-			popupMenu.Add (refreshAction);
-			
-			separator = new SeparatorMenuItem ();
-			popupMenu.Add (separator);
-			
-			ImageMenuItem quit = new ImageMenuItem ( Gtk.Stock.Quit, null);
-			quit.Activated += OnQuit;
-			popupMenu.Add (quit);
+			bool backendItemsSensitive = (backend != null && backend.Initialized);
+			
+			uiManager.GetAction ("/TrayIconMenu/NewTaskAction").Sensitive = backendItemsSensitive;
+			uiManager.GetAction ("/TrayIconMenu/RefreshAction").Sensitive = backendItemsSensitive;
+			uiManager.GetAction ("/TrayIconMenu/ShowTasksAction").Sensitive = backendItemsSensitive;
 
 			popupMenu.ShowAll(); // shows everything
 			popupMenu.Popup();
@@ -571,7 +552,6 @@
 		}
 #endif
 
-
 		public void StartMainLoop ()
 		{
 			nativeApp.StartMainLoop ();
@@ -582,5 +562,51 @@
 			OnQuit (null, null);
 		}
 
+		private void RegisterUIManager ()
+		{
+			ActionGroup trayActionGroup = new ActionGroup ("Tray");
+			trayActionGroup.Add (new ActionEntry [] {
+				new ActionEntry ("ShowTasksAction",
+				                 null,
+				                 Catalog.GetString ("Show Tasks ..."),
+				                 null,
+				                 null,
+				                 OnShowTaskWindow),
+				
+				new ActionEntry ("NewTaskAction",
+				                 Stock.New,
+				                 Catalog.GetString ("New Task ..."),
+				                 null,
+				                 null,
+				                 OnNewTask),
+				
+				new ActionEntry ("AboutAction",
+				                 Stock.About,
+				                 OnAbout),
+				
+				new ActionEntry ("PreferencesAction",
+				                 Stock.Preferences,
+				                 OnPreferences),
+				
+				new ActionEntry ("RefreshAction",
+				                 Stock.Execute,
+				                 Catalog.GetString ("Refresh Tasks ..."),
+				                 null,
+				                 null,
+				                 OnRefreshAction),
+				
+				new ActionEntry ("QuitAction",
+				                 Stock.Quit,
+				                 OnQuit)
+			});
+			
+			uiManager = new UIManager ();
+			uiManager.AddUiFromString (menuXml);
+			uiManager.InsertActionGroup (trayActionGroup, 0);
+			
+			ImageMenuItem showTasksItem = (ImageMenuItem)
+					uiManager.GetWidget ("/TrayIconMenu/ShowTasksAction");
+			showTasksItem.Image = new Gtk.Image(Utilities.GetIcon ("tasque-16", 16));
+		}
 	}
 }

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Sep 27 15:37:23 2008
@@ -129,7 +129,7 @@
 	$(CSC) -unsafe -out:$@ $(CSFLAGS) $(NOTIFY_SHARP_CSFLAGS) $^ $(ASSEMBLIES) $(RESOURCES)
 
 tasquelibdir = $(prefix)/lib/tasque
-tasquelib_DATA = $(TARGET) $(TARGET).config
+tasquelib_DATA = $(TARGET) $(TARGET).config $(TARGET).mdb
 
 bin_SCRIPTS = $(WRAPPER)
 
@@ -145,6 +145,8 @@
 		< $< > $@
 	chmod +x $(WRAPPER)
 
+$(TARGET).mdb: $(TARGET)
+
 $(TARGET).config: $(srcdir)/$(TARGET).config.in Makefile
 	sed -e "s|\ pkglibdir\@|$(pkglibdir)|" \
 	    < $< > $@

Modified: trunk/src/tasque.in
==============================================================================
--- trunk/src/tasque.in	(original)
+++ trunk/src/tasque.in	Sat Sep 27 15:37:23 2008
@@ -6,4 +6,23 @@
 
 cd ${libdir}
 
-exec -a "Tasque" mono "Tasque.exe" "$@"
+for arg in $*; do
+	case "x--debug" in ("x$arg")
+	    TASQUE_DEBUG=$arg
+	esac
+
+	case "x--trace=" in ("x${arg:0:8}")
+	    TASQUE_TRACE=$arg
+	esac
+
+	case "x--profile=" in ("x${arg:0:10}")
+	    TASQUE_PROFILE=$arg
+	esac
+done
+
+if [ -n "$TASQUE_DEBUG" -o -n "$TASQUE_TRACE" -o -n "$TASQUE_PROFILE" -o -n "$MONO_EXTRA_ARGS" ]; then
+	MONO_OPTIONS="$TASQUE_DEBUG $TASQUE_TRACE $TASQUE_PROFILE $MONO_EXTRA_ARGS"
+	echo "** Running Mono with $MONO_OPTIONS **"
+fi
+
+exec -a "Tasque" mono $MONO_OPTIONS "Tasque.exe" "$@"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]