Merge lp:~kamstrup/gnome-zeitgeist/gnome-zeitgeist-run-uninstalled into lp:gnome-zeitgeist

Proposed by Mikkel Kamstrup Erlandsen
Status: Needs review
Proposed branch: lp:~kamstrup/gnome-zeitgeist/gnome-zeitgeist-run-uninstalled
Merge into: lp:gnome-zeitgeist
Diff against target: None lines
To merge this branch: bzr merge lp:~kamstrup/gnome-zeitgeist/gnome-zeitgeist-run-uninstalled
Reviewer Review Type Date Requested Status
Seif Lotfy Pending
Review via email: mp+7496@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

This branch makes it possible to run the journal without installing it - that is, directly from the source dir

Unmerged revisions

754. By Mikkel Kamstrup Erlandsen

Merge with trunk

753. By Mikkel Kamstrup Erlandsen

Apply changes necessary to run zeitgeist uninstalled, directly from a (compiled) source checkout

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/Makefile.am'
2--- data/Makefile.am 2009-06-11 14:02:56 +0000
3+++ data/Makefile.am 2009-06-16 10:25:12 +0000
4@@ -1,5 +1,8 @@
5 SUBDIRS = logo
6
7+pixmapdir = $(datadir)
8+pixmap_DATA = gnome-zeitgeist.xpm
9+
10 pkgdata_DATA = \
11 bookmark-new.svg \
12 calendar.svg \
13
14=== renamed file 'data/logo/gnome-zeitgeist.png' => 'data/gnome-zeitgeist.png'
15=== renamed file 'data/logo/gnome-zeitgeist.xpm' => 'data/gnome-zeitgeist.xpm'
16=== modified file 'data/logo/Makefile.am'
17--- data/logo/Makefile.am 2009-05-24 21:38:30 +0000
18+++ data/logo/Makefile.am 2009-06-04 21:49:42 +0000
19@@ -1,6 +1,3 @@
20-pixmapdir = $(datadir)
21-pixmap_DATA = gnome-zeitgeist.xpm
22-
23 hicolordir = $(datadir)/icons/hicolor
24 tango_icons = \
25 22x22/apps/gnome-zeitgeist.png \
26
27=== modified file 'zeitgeist-journal'
28--- zeitgeist-journal 2009-05-23 21:49:10 +0000
29+++ zeitgeist-journal 2009-06-04 21:49:42 +0000
30@@ -24,7 +24,7 @@
31 # Window
32 self.set_title("GNOME Zeitgeist")
33 self.set_resizable(True)
34- self.set_icon_from_file("%s/scalable/apps/gnome-zeitgeist.svg" % config.hicolordir)
35+ self.set_icon(icon_factory.load_icon("gnome-zeitgeist.png", 192))
36 self._visible = True
37 self.connect("destroy", gtk.main_quit)
38 self.connect_after("check-resize", self.window_state_event_cb)
39@@ -59,8 +59,7 @@
40 self.notebook.append_page(bookmarks, label)
41 self.notebook.set_tab_label_packing(bookmarks, True, True, gtk.PACK_START)
42
43- journal = "%s/calendar.svg" % config.pkgdatadir
44- label = self.create_tab_label(_("Journal"), journal)
45+ label = self.create_tab_label(_("Journal"), "calendar.svg")
46 self.notebook.append_page(timeline, label)
47 self.notebook.set_tab_label_packing(timeline, True, True, gtk.PACK_START)
48
49@@ -105,7 +104,7 @@
50
51 def _create_toolbar_buttons(self):
52 self.star_button = gtk.ToggleToolButton()
53- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size("%s/bookmark-new.svg" % config.pkgdatadir, 24, 24)
54+ pixbuf = icon_factory.load_icon("bookmark-new.svg", 24)
55 self.star_button.set_icon_widget(gtk.image_new_from_pixbuf(pixbuf))
56 self.star_button.set_label(_("Stars"))
57 self.star_button.set_tooltip_text(_("Stars"))
58
59=== modified file 'zeitgeist/gui/zeitgeist_journal_widgets.py'
60--- zeitgeist/gui/zeitgeist_journal_widgets.py 2009-06-15 17:50:28 +0000
61+++ zeitgeist/gui/zeitgeist_journal_widgets.py 2009-06-16 10:25:12 +0000
62@@ -752,8 +752,7 @@
63 self.home.connect("clicked", timeline.reset_date)
64
65 self.search = gtk.ToggleToolButton()
66- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
67- "%s/32x32/apps/gnome-zeitgeist.png" % config.hicolordir, 24, 24)
68+ pixbuf = icon_factory.load_icon("gnome-zeitgeist.png", 24)
69 self.search.set_icon_widget(gtk.image_new_from_pixbuf(pixbuf))
70 self.search.set_label(_("Search"))
71 self.search.set_tooltip_text(_("Search for activities"))
72@@ -802,17 +801,17 @@
73
74 gtk.Notebook.__init__(self)
75
76- label = self.create_tab_label(_("Tags"), htb)
77+ label = self.create_tab_label(_("Tags"))
78 self.append_page(htb, label)
79 self.set_tab_label_packing(htb, True, True, gtk.PACK_START)
80
81- label = self.create_tab_label(_("Calendar"), calendar)
82+ label = self.create_tab_label(_("Calendar"))
83 self.append_page(calendar, label)
84 self.set_tab_label_packing(calendar, True, True, gtk.PACK_START)
85
86 vbox = gtk.VBox()
87 #vbox.pack_start(calendar, False, False)
88- label = self.create_tab_label(_("Filters"), vbox)
89+ label = self.create_tab_label(_("Filters"))
90 enable_grouping = gtk.CheckButton()
91 enable_grouping.set_label(_("Enable Grouping"))
92 enable_grouping.set_active(True)
93@@ -831,12 +830,14 @@
94 timeline.group = widget.get_active()
95 timeline.load_month()
96
97- def create_tab_label(self, title, stock):
98- icon = gtk.image_new_from_pixbuf(icon_factory.load_icon(stock, icon_size = 16 ,cache = False))
99- label = gtk.Label(title)
100+ def create_tab_label(self, title, stock=None):
101+ box = gtk.HBox()
102+
103+ if stock:
104+ icon = gtk.image_new_from_pixbuf(icon_factory.load_icon(stock, icon_size = 16 ,cache = False))
105+ box.pack_start(icon, False, False)
106
107- box = gtk.HBox()
108- box.pack_start(icon, False, False)
109+ label = gtk.Label(title)
110 box.pack_start(label, True, True)
111 box.show_all()
112
113
114=== modified file 'zeitgeist/gui/zeitgeist_util.py'
115--- zeitgeist/gui/zeitgeist_util.py 2009-06-13 13:17:10 +0000
116+++ zeitgeist/gui/zeitgeist_util.py 2009-06-16 10:25:12 +0000
117@@ -5,6 +5,7 @@
118 """
119
120 import os
121+import sys
122 import gtk
123 import gnome.ui
124 import gobject
125@@ -184,6 +185,14 @@
126 icon_size)
127 if retval:
128 return retval
129+
130+ # We couldn't find the icon anywhere, try seeing if we are
131+ # running uninstalled and load it from the source dir if so
132+ srcdir = os.path.join(os.path.dirname(__file__), "..", "..")
133+ if os.path.exists(os.path.join(srcdir, "configure.ac")):
134+ return self.load_icon_from_path(os.path.join(srcdir, "data", icon_value),
135+ icon_size)
136+
137 return None
138
139 def transparentize(self, pixbuf, percent):
140@@ -195,47 +204,49 @@
141
142 def greyscale(self, pixbuf):
143 pixbuf = pixbuf.copy()
144- for row in pixbuf.get_pixels_array():
145- for pix in row:
146- pix[0] = pix[1] = pix[2] = (int(pix[0]) + int(pix[1]) + int(pix[2])) / 3
147+ for row in pixbuf.get_pixels_array():
148+ for pix in row:
149+ pix[0] = pix[1] = pix[2] = (int(pix[0]) + int(pix[1]) + int(pix[2])) / 3
150 return pixbuf
151
152 def load_icon(self, icon_value, icon_size, force_size=True, cache=True):
153- if not self.icon_dict.has_key(icon_value) or not cache:
154- try:
155- if isinstance(icon_value, gtk.gdk.Pixbuf):
156- return icon_value
157- elif os.path.isabs(icon_value):
158- icon = self.load_icon_from_path(icon_value, icon_size)
159- if icon:
160- return icon
161- icon_name = os.path.basename(icon_value)
162- else:
163- icon_name = icon_value
164-
165- if icon_name.endswith(".png"):
166- icon_name = icon_name[:-len(".png")]
167- elif icon_name.endswith(".xpm"):
168- icon_name = icon_name[:-len(".xpm")]
169- elif icon_name.endswith(".svg"):
170- icon_name = icon_name[:-len(".svg")]
171-
172- icon = None
173- info = icon_theme.lookup_icon(icon_name, icon_size, gtk.ICON_LOOKUP_USE_BUILTIN)
174- if info:
175- if icon_name.startswith("gtk-"):
176- icon = info.load_icon()
177- elif info.get_filename():
178- icon = self.load_icon_from_path(info.get_filename(), icon_size)
179- else:
180- icon = self.load_icon_from_data_dirs(icon_value, icon_size)
181-
182- if cache:
183- self.icon_dict[icon_value] = icon
184- return icon
185- except Exception:
186- self.icon_dict[icon_value] = None
187- return None
188+ if not self.icon_dict.has_key(icon_value) or cache==False:
189+ #print "creating icon for "+icon_value
190+ if isinstance(icon_value, gtk.gdk.Pixbuf):
191+ return icon_value
192+
193+ if os.path.isabs(icon_value):
194+ icon = self.load_icon_from_path(icon_value, icon_size)
195+ if icon:
196+ return icon
197+ icon_name = os.path.basename(icon_value)
198+ else:
199+ icon_name = icon_value
200+
201+ if icon_name.endswith(".png"):
202+ icon_name = icon_name[:-len(".png")]
203+ elif icon_name.endswith(".xpm"):
204+ icon_name = icon_name[:-len(".xpm")]
205+ elif icon_name.endswith(".svg"):
206+ icon_name = icon_name[:-len(".svg")]
207+
208+ icon = None
209+ info = icon_theme.lookup_icon(icon_name, icon_size, gtk.ICON_LOOKUP_USE_BUILTIN)
210+ if info:
211+ if icon_name.startswith("gtk-"):
212+ icon = info.load_icon()
213+ elif info.get_filename():
214+ icon = self.load_icon_from_path(info.get_filename(), icon_size)
215+ else:
216+ icon = self.load_icon_from_data_dirs(icon_value, icon_size)
217+
218+ if cache:
219+ self.icon_dict[icon_value] = icon
220+
221+ if not icon:
222+ raise IOError("Failed to find icon '%s'" % icon_value)
223+
224+ return icon
225 else:
226 return self.icon_dict[icon_value]
227
228
229=== modified file 'zeitgeist/gui/zeitgeist_util_widgets.py'
230--- zeitgeist/gui/zeitgeist_util_widgets.py 2009-06-12 15:47:09 +0000
231+++ zeitgeist/gui/zeitgeist_util_widgets.py 2009-06-16 10:25:12 +0000
232@@ -56,8 +56,7 @@
233
234 self.fromImage = [ ( "text/plain", 0, TARGET_TYPE_TEXT ), ( "image/x-xpixmap", 0, TARGET_TYPE_PIXMAP ) ]
235
236- self.active_image = gtk.gdk.pixbuf_new_from_file_at_size(
237- "%s/bookmark-new.svg" % config.pkgdatadir, 24, 24)
238+ self.active_image = icon_factory.load_icon("bookmark-new.svg", 24)
239
240 self.inactive_image = icon_factory.greyscale(self.active_image)
241 self.inactive_image = icon_factory.transparentize(self.inactive_image,50)

Subscribers

People subscribed via source and target branches