← Back to team overview

zeitgeist team mailing list archive

[Merge] lp:~cando/activity-log-manager/925638 into lp:activity-log-manager

 

Stefano Candori has proposed merging lp:~cando/activity-log-manager/925638 into lp:activity-log-manager.

Requested reviews:
  Activity Log Manager (activity-log-manager)

For more details, see:
https://code.launchpad.net/~cando/activity-log-manager/925638/+merge/94543

In this branch i've fixed bug 925638 adding the usage and last used indication to ApplicationChooser.
Here's the screenshot: https://plus.google.com/u/0/photos/117377902943785951914/albums/5712696941390553921/5712696940324273794

I've also added a LDADD flag "-lm" to the Makefile fixing a undefined reference error to the Glib's fucntion ceil that i encounter here in fedora 16.
-- 
https://code.launchpad.net/~cando/activity-log-manager/925638/+merge/94543
Your team Activity Log Manager is requested to review the proposed merge of lp:~cando/activity-log-manager/925638 into lp:activity-log-manager.
=== modified file 'po/Makefile.in.in'
--- po/Makefile.in.in	2012-02-08 13:55:27 +0000
+++ po/Makefile.in.in	2012-02-24 13:43:20 +0000
@@ -49,8 +49,8 @@
 XGETTEXT = @XGETTEXT@
 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
-MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
-GENPOT   = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
+MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
+GENPOT   = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
 
 ALL_LINGUAS = @ALL_LINGUAS@
 
@@ -73,20 +73,15 @@
 .SUFFIXES:
 .SUFFIXES: .po .pox .gmo .mo .msg .cat
 
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V))
-INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
-INTLTOOL__v_MSGFMT_0 = @echo "  MSGFMT" $@;
-
 .po.pox:
 	$(MAKE) $(GETTEXT_PACKAGE).pot
 	$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
 
 .po.mo:
-	$(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
+	$(MSGFMT) -o $@ $<
 
 .po.gmo:
-	$(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \
+	file=`echo $* | sed 's,.*/,,'`.gmo \
 	  && rm -f $$file && $(GMSGFMT) -o $$file $<
 
 .po.cat:

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2012-02-21 10:29:34 +0000
+++ src/Makefile.am	2012-02-24 13:43:20 +0000
@@ -64,7 +64,8 @@
 	$(GTK_LIBS) \
 	$(ZEITGEIST_LIBS) \
 	$(GEE_LIBS) \
-	$(GIO_UNIX_LIBS)
+	$(GIO_UNIX_LIBS) \
+	-lm
 activity_log_manager_LDADD = \
 	$(SHARED_LIBS)
 libactivity_log_manager_la_LIBADD = \

=== modified file 'src/applications-widget.vala'
--- src/applications-widget.vala	2012-02-22 00:24:39 +0000
+++ src/applications-widget.vala	2012-02-24 13:43:20 +0000
@@ -413,6 +413,9 @@
 			APP_NAME,
 			ICON,
 			DESKTOP_FILE,
+			LAST_ACCESSED_STRING,
+			LAST_ACCESSED_INT,
+			USAGE,
 			N_COLS
 		}
 
@@ -437,6 +440,7 @@
 										typeof (Gdk.Pixbuf),
 										typeof (string),
 										typeof (string),
+										typeof (int64),
 										typeof (uint));
 			this.treeview = new TreeView.with_model (this.store);
 			this.treeview.set_headers_visible (true);
@@ -457,15 +461,28 @@
 			column_pix_name.pack_start (name_rend, true);
 			column_pix_name.add_attribute (name_rend, "text", 0);
 			column_pix_name.set_resizable (true);
+			column_pix_name.set_min_width (200);
+			column_pix_name.set_sort_column_id (0);
 
-			/*var column_used_name = new TreeViewColumn ();
+			var column_used_name = new TreeViewColumn ();
 			column_used_name.set_title ("Last Used");
 			this.treeview.append_column (column_used_name);
 			var used_rend = new CellRendererText ();
 			used_rend.set_property ("ellipsize", Pango.EllipsizeMode.END);
 			column_used_name.pack_start (used_rend, true);
-			column_used_name.add_attribute (used_rend, "used", 3);
-			column_used_name.set_resizable (true);*/
+			column_used_name.add_attribute (used_rend, "text", 3);
+			column_used_name.set_resizable (true);
+			column_used_name.set_min_width (200);
+			column_used_name.set_sort_column_id (4);
+			
+			var column_usage_name = new TreeViewColumn ();
+			column_usage_name.set_title ("Activity");
+			this.treeview.append_column (column_usage_name);
+			var usage_rend = new UsageCellRenderer ();
+			column_usage_name.pack_start (usage_rend, true);
+			column_usage_name.add_attribute (usage_rend, "usage", 5);
+			//column_usage_name.set_fixed_width (120);
+			column_usage_name.set_sort_column_id (5);
 			
 			var scroll = new ScrolledWindow (null, null);
 			scroll.add (this.treeview);
@@ -529,7 +546,8 @@
 			foreach(AppInfo app_info in all_infos)
 			{
 				string id = app_info.get_id ();
-				int64? last_accessed_time = 0;//all_actors.lookup(id);
+				int64? last_accessed_time = all_actors.lookup(id);
+				stdout.printf("%l", all_actors.lookup(id));
 			
 				if(last_accessed_time != null)
 				{
@@ -538,7 +556,8 @@
 					var usage = (uint)Math.ceil(current_state);
 					current_state = current_state - step_dec;
 
-					insert_liststore(app_info, last_accessed, usage);
+					insert_liststore(app_info, last_accessed, last_accessed_time,
+									usage);
 				}
 				else
 					other_appinfo.append(app_info);
@@ -549,7 +568,8 @@
 			}*/
 		}
 
-		public void insert_liststore(AppInfo app_info, string last_accessed, uint usage) {
+		public void insert_liststore(AppInfo app_info, string last_accessed, 
+									int64 last_accessed_time, uint usage) {
 			string id = app_info.get_id ();
 			var name = app_info.get_name ();
 
@@ -563,7 +583,8 @@
 			{
 				TreeIter iter;
 				this.treeview.liststore.append(out iter);
-				this.treeview.liststore.set(iter, 0, name, 1, pix, 2, id, -1);//, 3, last_accessed, 4, usage, -1);
+				this.treeview.liststore.set(iter, 0, name, 1, pix, 2, id,
+											3, last_accessed, 4, last_accessed_time, 5, usage, -1);
 				this.blocked_apps.insert(id, new AppChooseInfo(name, pix, last_accessed, usage));
 			}
 			else
@@ -594,6 +615,69 @@
 		}
 	}
 	
+	public class UsageCellRenderer : CellRenderer {
+
+	private const int RECT_NUM = 10;
+	private const int RECT_WIDTH = 5;
+	private const int RECT_HEIGHT = 20;
+	private const int RECT_SPACING = 3;
+	private const int xpadding = 25;
+	private const int ypadding = 10;
+	
+	private int usage_num;
+	
+	public int usage {
+			get {
+				return usage_num;
+			}
+			set {
+				if(value > 10) usage_num = 10;
+				else usage_num = value;
+			}
+		}
+	
+    public UsageCellRenderer () {
+        GLib.Object ();
+        this.usage_num = 0;
+    }
+
+    public override void get_size (Widget widget, Gdk.Rectangle? cell_area,
+                                   out int x_offset, out int y_offset,
+                                   out int width, out int height)
+    {
+        x_offset = xpadding;
+        y_offset = ypadding;
+        width = RECT_WIDTH * RECT_NUM + xpadding * 2 + RECT_SPACING * 9;
+        height = RECT_HEIGHT + ypadding * 2;
+    }
+
+    /* render method */
+    public override void render (Cairo.Context ctx, Widget widget,
+                                 Gdk.Rectangle background_area,
+                                 Gdk.Rectangle cell_area,
+                                 CellRendererState flags)
+    {
+    	int x = cell_area.x + xpadding;
+		int y = cell_area.y + ypadding;
+		for (int i = 0; i < usage; i++)
+		{
+			ctx.set_source_rgb(0.4, 0.4, 0.4);
+			ctx.rectangle(x, y, RECT_WIDTH, RECT_HEIGHT);
+			ctx.fill();
+			x += RECT_SPACING + RECT_WIDTH;
+		}
+		
+		for (int i = 0; i < RECT_NUM - usage; i++)
+		{
+			ctx.set_source_rgb(0.7, 0.7, 0.7);
+			ctx.rectangle(x, y, RECT_WIDTH, RECT_HEIGHT);
+			ctx.fill();
+			x += RECT_SPACING + RECT_WIDTH;
+		}
+
+	}
+}
+	
 	public class AppChooseInfo {
 		private string app_name;
 		private Gdk.Pixbuf? app_icon;


Follow ups