Stefano Candori has proposed merging
lp:~cando/activity-log-manager/appdialog-fixes 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/appdialog-fixes/+merge/97629
In this branch i've added a bunch of fixes regarding the
ApplicationChooserDialog.
See the commit below for the explanation of the changes.
--
https://code.launchpad.net/~cando/activity-log-manager/appdialog-fixes/+merge/97629
Your team Activity Log Manager is requested to review the proposed merge of
lp:~cando/activity-log-manager/appdialog-fixes into lp:activity-log-manager.
=== modified file 'src/applications-widget.vala'
--- src/applications-widget.vala 2012-03-12 14:45:32 +
+++ src/applications-widget.vala 2012-03-15 12:34:23 +
@@ -347,20 +347,34 @@
this.pack_start (scroll);
}
- public static Gdk.Pixbuf? get_pixbuf_from_gio_icon (Icon icon, int size=32) {
+ public static Gdk.Pixbuf? get_pixbuf_from_gio_icon (Icon? icon, int size=32) {
Gdk.Pixbuf? pix = null;
- var icon_info = IconTheme.get_default ().lookup_by_gicon (icon ,
- size,
- IconLookupFlags.FORCE_SVG);
- if (icon_info != null) {
-try {
- pix = icon_info.load_icon ();
-}
-catch (Error e){
- return null;
-}
- }
-
+ IconTheme theme = IconTheme.get_default ();
+ IconInfo icon_info = null;
+ /*If the application hasn't an icon in the current theme
+ let's use the gtk-execute icon:
+ http://developer.gnome.org/gtk3/3.2/gtk3-Stock-Items.html#GTK-STOCK-EXECUTE:CAPS
+ */
+ if(icon == null) {
+icon_info = theme.lookup_icon (gtk-execute ,
+size,
+IconLookupFlags.FORCE_SVG);
+ }
+ else {
+icon_info = theme.lookup_by_gicon (icon ,
+ size,
+ IconLookupFlags.FORCE_SVG);
+if (icon_info == null)
+ icon_info = theme.lookup_icon (gtk-execute ,
+size,
+IconLookupFlags.FORCE_SVG);
+ }
+ try {
+pix = icon_info.load_icon ();
+ }
+ catch (Error e){
+return null;
+ }
return pix;
}
@@ -375,7 +389,13 @@
// Insert only when it is empty
if(this.blocked_apps.lookup(app) == null)
- this.blocked_apps.insert(app, new AppChooseInfo(app_info.get_id(), app_info.get_name(), pix, , 0));
+ this.blocked_apps.insert(app, new AppChooseInfo(
+ app_info.get_id(),
+ app_info.get_name(),
+ pix,
+ ,
+ 0,
+ 0));
}
}
@@ -466,7 +486,7 @@
private void set_up_ui () {
var column_pix_name = new TreeViewColumn ();
- column_pix_name.set_title (Name);
+ column_pix_name.set_title (_(Name));
this.treeview.append_column (column_pix_name);
var pix_rend = new CellRendererPixbuf ();
column_pix_name.pack_start (pix_rend, false);
@@ -477,10 +497,11 @@
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_max_width (400);
column_pix_name.set_sort_column_id (0);
var column_used_name = new TreeViewColumn ();
- column_used_name.set_title (Last Used);
+ 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);
@@ -488,11 +509,12 @@
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_max_width (400);
column_used_name.set_sort_column_id (4);
- used_rend.set_property(xalign, 1);
+ used_rend.set_property(xalign, 0);
var column_usage_name = new TreeViewColumn ();
- column_usage_name.set_title (Activity);
+ 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);
@@ -557,6 +579,18 @@
}
}
+ private int compare_dates(DateTime now, DateTime time) {
+ int res = -1;
+ int now_y, now_m, now_d, time_y, time_m, time_d;
+ now.get_ymd(out now_y, out now_m, out now_d);
+ time.get_ymd(out time_y, out time_m, out time_d);
+ if (now_y == time_y now_m == time_m now_d == time_d)
+return 0;
+ else if (now_y == time_y now_m == time_m now_d == time_d + 1)
+return 1;
+ return res;
+ }
+
public void handle_app_population(HashTablestring, int64? all_actors) {
all_actors_list = all_actors;
@@ -570,18 +604,27 @@
{
string id = app_info.get_id ();
int64? last_accessed_time = all_actors.lookup(id);
-//
if(last_accessed_time != null)
{
var time = new DateTime.from_unix_local (last_accessed_time/1000);
- var last_accessed = time.format(%e %B %Y);
+ var now = new