~ricotz/slingshot/port-gmenu3

« back to all changes in this revision

Viewing changes to src/Widgets/SearchItem.vala

  • Committer: RabbitBot
  • Author(s): Corentin Noël
  • Date: 2014-01-14 13:05:03 UTC
  • mfrom: (396.1.1 slingshot)
  • Revision ID: rabbitbot-20140114130503-vl01yvhtdlu0dvs4
* Removed every using statement
* Changed VWidgets and HWidgets to Widgets with the corresponding orientation (Gtk deprecation)
* Ported Zeitgeist parts to version 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
//
18
18
 
19
 
using Gtk;
20
 
using Gdk;
21
 
 
22
19
namespace Slingshot.Widgets {
23
20
 
24
 
    public class SearchItem : Button {
 
21
    public class SearchItem : Gtk.Button {
25
22
 
26
23
        private Backend.App app;
27
 
        private Pixbuf icon;
 
24
        private Gdk.Pixbuf icon;
28
25
        private string icon_name;
29
 
        private Label name_label;
30
 
        private Label desc_label;
 
26
        private Gtk.Label name_label;
 
27
        private Gtk.Label desc_label;
31
28
 
32
29
        public bool in_box = false;
33
30
        public int icon_size = 64;
40
37
            icon = app.icon;
41
38
            icon_name = app.icon_name;
42
39
 
43
 
            name_label = new Label ("<b><span size=\"larger\">" + fix (app.name) + "</span></b>");
 
40
            name_label = new Gtk.Label ("<b><span size=\"larger\">" + fix (app.name) + "</span></b>");
44
41
            name_label.set_ellipsize (Pango.EllipsizeMode.END);
45
42
            name_label.use_markup = true;
46
43
            name_label.xalign = 0.0f;
47
44
 
48
 
            desc_label = new Label (fix (app.description));
 
45
            desc_label = new Gtk.Label (fix (app.description));
49
46
            desc_label.set_ellipsize (Pango.EllipsizeMode.END);
50
47
            desc_label.xalign = 0.0f;
51
48
 
52
 
            var vbox = new Box (Orientation.VERTICAL, 0);
 
49
            var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
53
50
            vbox.homogeneous = false;
54
51
            vbox.pack_start (name_label, false, true, 0);
55
52
            vbox.pack_start (desc_label, false, true, 0);
60
57
        }
61
58
 
62
59
        protected override bool draw (Cairo.Context cr) {
63
 
            Allocation size;
 
60
            Gtk.Allocation size;
64
61
            get_allocation (out size);
65
62
 
66
63
            base.draw (cr);
67
64
 
68
 
            Pixbuf scaled_icon = app.load_icon (icon_size);
 
65
            Gdk.Pixbuf scaled_icon = app.load_icon (icon_size);
69
66
 
70
67
            height_request = icon_size + 10;
71
68
 
72
69
            // Draw icon
73
 
            cairo_set_source_pixbuf (cr, scaled_icon, 74 - icon_size, 5);
 
70
            Gdk.cairo_set_source_pixbuf (cr, scaled_icon, 74 - icon_size, 5);
74
71
            cr.paint ();
75
72
 
76
73
            return true;
81
78
        }
82
79
    }
83
80
 
84
 
}
 
81
}
 
 
b'\\ No newline at end of file'