[tracker/needle: 4/53] tracker-needle: Fixed icon sizes



commit ca41a6bd335875620cd97f3ca95bde40c0db2bf1
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Jun 29 21:00:46 2010 +0100

    tracker-needle: Fixed icon sizes

 src/needle/needle.ui   |    4 ++++
 src/needle/needle.vala |   39 +++++++++++++++++++++++----------------
 2 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/src/needle/needle.ui b/src/needle/needle.ui
index 326733e..3e752f7 100644
--- a/src/needle/needle.ui
+++ b/src/needle/needle.ui
@@ -16,6 +16,7 @@
             <child>
               <object class="GtkToolButton" id="toolbutton_back">
                 <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Go back in search history</property>
                 <property name="label" translatable="yes">toolbutton1</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-go-back</property>
@@ -28,6 +29,7 @@
             <child>
               <object class="GtkToolButton" id="toolbutton_forward">
                 <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Go forward in search history</property>
                 <property name="label" translatable="yes">toolbutton1</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-go-forward</property>
@@ -49,6 +51,7 @@
             <child>
               <object class="GtkRadioToolButton" id="toolbutton_view_list">
                 <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Display results in a list view</property>
                 <property name="is_important">True</property>
                 <property name="label" translatable="yes">_List</property>
                 <property name="use_underline">True</property>
@@ -64,6 +67,7 @@
             <child>
               <object class="GtkRadioToolButton" id="toolbutton_view_icons">
                 <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Display results in an icon view</property>
                 <property name="is_important">True</property>
                 <property name="label" translatable="yes">_Icons</property>
                 <property name="use_underline">True</property>
diff --git a/src/needle/needle.vala b/src/needle/needle.vala
index 5d78035..0e6a208 100644
--- a/src/needle/needle.vala
+++ b/src/needle/needle.vala
@@ -128,8 +128,9 @@ public class Needle {
 
 	private void setup_ui_results (TreeView treeview, IconView iconview) {
 		// Setup treeview
-		store = new ListStore (7,
-							   typeof (Gdk.Pixbuf),  // Icon
+		store = new ListStore (8,
+							   typeof (Gdk.Pixbuf),  // Icon small
+							   typeof (Gdk.Pixbuf),  // Icon big
 							   typeof (string),      // URN
 							   typeof (string),      // URL
 							   typeof (string),      // File name
@@ -146,7 +147,7 @@ public class Needle {
 
 		var renderer2 = new CellRendererText ();
     	col.pack_start (renderer2, true);
-	    col.add_attribute (renderer2, "text", 3);
+	    col.add_attribute (renderer2, "text", 4);
 
 	    col.set_title ("File");
 	    col.set_resizable (true);
@@ -154,16 +155,16 @@ public class Needle {
 	    col.set_sizing (Gtk.TreeViewColumnSizing.AUTOSIZE);
 	    treeview.append_column (col);   
 	    
-		treeview.insert_column_with_attributes (-1, "Last Changed", new CellRendererText (), "text", 4, null);
-		treeview.insert_column_with_attributes (-1, "Size", new CellRendererText (), "text", 5, null);
+		treeview.insert_column_with_attributes (-1, "Last Changed", new CellRendererText (), "text", 5, null);
+		treeview.insert_column_with_attributes (-1, "Size", new CellRendererText (), "text", 6, null);
 		treeview.row_activated.connect (view_row_selected);
 
 		// Setup iconview
 		iconview.set_model (store);
 		iconview.set_item_width (96);
 		iconview.set_selection_mode (Gtk.SelectionMode.SINGLE);
-		iconview.set_pixbuf_column (0);
-		iconview.set_text_column (3);
+		iconview.set_pixbuf_column (1);
+		iconview.set_text_column (4);
 		//iconview.row_activated += view_row_selected;
 	}
 
@@ -277,7 +278,11 @@ public class Needle {
 			var screen = window.get_screen ();
 			var theme = IconTheme.get_for_screen (screen);
 
-			int size = 24;
+			var size_small = 0;
+			Gtk.icon_size_lookup (Gtk.IconSize.DND, out size_small, null) ;  //24; // Small
+
+			var size_big = 0;
+			Gtk.icon_size_lookup (Gtk.IconSize.DIALOG, out size_big, null) ;  //32; // Big
 
 			for (int i = 0; i < result.length[0]; i++) {
 				debug ("--> %s", result[i,0]);
@@ -287,7 +292,8 @@ public class Needle {
 				debug ("  --> %s", result[i,4]);
 
 				// Get icon
-				Gdk.Pixbuf pixbuf = item_get_pixbuf (theme, result[i,1], size);
+				Gdk.Pixbuf pixbuf_small = item_get_pixbuf (theme, result[i,1], size_small);
+				Gdk.Pixbuf pixbuf_big = item_get_pixbuf (theme, result[i,1], size_big);
 				string file_size = GLib.format_size_for_display (result[i,4].to_int());
 				string file_time = item_get_time (result[i,3]);
 								
@@ -296,13 +302,14 @@ public class Needle {
 				store.append (out iter);
 				
 				store.set (iter, 
-						   0, pixbuf,
-						   1, result[i,0],
-						   2, result[i,1],
-						   3, result[i,2],
-						   4, file_time,
-						   5, file_size, 
-						   6, result[i,5],
+						   0, pixbuf_small,
+						   1, pixbuf_big,
+						   2, result[i,0],
+						   3, result[i,1],
+						   4, result[i,2],
+						   5, file_time,
+						   6, file_size, 
+						   7, result[i,5],
 						   -1);
 			}
 		} catch (DBus.Error e) {



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