Merge lp:~ted/indicator-appmenu/hudectomy into lp:indicator-appmenu/13.04

Proposed by Ted Gould
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 231
Merged at revision: 233
Proposed branch: lp:~ted/indicator-appmenu/hudectomy
Merge into: lp:indicator-appmenu/13.04
Diff against target: 15191 lines (+5/-14591)
101 files modified
Makefile.am (+2/-4)
configure.ac (+0/-24)
data/Makefile.am (+1/-12)
data/com.canonical.hud.service.in (+0/-3)
data/com.canonical.indicator.appmenu.hud.gschema.xml (+0/-16)
data/com.canonical.indicator.appmenu.hud.search.gschema.xml (+0/-72)
debian/control (+1/-6)
debian/indicator-appmenu-tools.install (+0/-7)
debian/indicator-appmenu.install (+0/-2)
docs/HUD Architecture.svg (+0/-368)
docs/Makefile.am (+0/-1)
docs/devel/Makefile.am (+0/-36)
docs/devel/hud-docs.xml (+0/-58)
docs/devel/hud-overview.xml (+0/-91)
docs/devel/hud-sections.txt (+0/-172)
docs/devel/hud.types (+0/-11)
docs/man/Makefile.am (+0/-16)
docs/man/hud-cli.xml (+0/-38)
docs/man/hud-dump-application.xml (+0/-45)
docs/man/hud-list-applications.xml (+0/-44)
docs/man/hud-verify-app-info.xml (+0/-35)
po/POTFILES.in (+0/-22)
src/Makefile.am (+1/-179)
src/create-db.h (+0/-4)
src/create-db.sql (+0/-2)
src/dump-app-info.c (+0/-174)
src/dump-app-info.h (+0/-30)
src/hud-cli.c (+0/-237)
src/hud-dump-application.c (+0/-73)
src/hud-list-applications (+0/-11)
src/hud-service.c (+0/-335)
src/hud-verify-app-info.c (+0/-100)
src/hud.xml (+0/-37)
src/hudappindicatorsource.c (+0/-432)
src/hudappindicatorsource.h (+0/-36)
src/hudappmenuregistrar.c (+0/-507)
src/hudappmenuregistrar.h (+0/-53)
src/huddbusmenucollector.c (+0/-679)
src/huddbusmenucollector.h (+0/-48)
src/huddebugsource.c (+0/-168)
src/huddebugsource.h (+0/-36)
src/hudindicatorsource.c (+0/-286)
src/hudindicatorsource.h (+0/-36)
src/huditem.c (+0/-343)
src/huditem.h (+0/-79)
src/hudmenumodelcollector.c (+0/-757)
src/hudmenumodelcollector.h (+0/-46)
src/hudquery.c (+0/-319)
src/hudquery.h (+0/-50)
src/hudresult.c (+0/-310)
src/hudresult.h (+0/-48)
src/hudsettings.c (+0/-128)
src/hudsettings.h (+0/-43)
src/hudsource.c (+0/-173)
src/hudsource.h (+0/-57)
src/hudsourcelist.c (+0/-165)
src/hudsourcelist.h (+0/-39)
src/hudstringlist.c (+0/-227)
src/hudstringlist.h (+0/-40)
src/hudtoken.c (+0/-406)
src/hudtoken.h (+0/-43)
src/hudwebappsource.c (+0/-376)
src/hudwebappsource.h (+0/-36)
src/hudwindowsource.c (+0/-372)
src/hudwindowsource.h (+0/-37)
src/load-app-info.c (+0/-319)
src/load-app-info.h (+0/-30)
src/shared-values.h (+0/-33)
tests/Makefile.am (+0/-447)
tests/bad-app-info/dual-headers.hud-app-info (+0/-3)
tests/bad-app-info/item-no-count.hud-app-info (+0/-8)
tests/bad-app-info/item-no-name.hud-app-info (+0/-8)
tests/bad-app-info/menu-no-name.hud-app-info (+0/-8)
tests/bad-app-info/missing-desktop.hud-app-info (+0/-7)
tests/bad-app-info/missing-menus.hud-app-info (+0/-6)
tests/bad-app-info/multiple-menus.hud-app-info (+0/-13)
tests/good-app-info/testapp.desktop.hud-app-info (+0/-8)
tests/good-app-info/testapp100.desktop.hud-app-info (+0/-8)
tests/good-app-info/tons-of-entries.hud-app-info (+0/-143)
tests/hud-performance.c (+0/-278)
tests/run-xvfb.sh (+0/-7)
tests/test-app-indicator.c (+0/-65)
tests/test-bad-app-info.c (+0/-100)
tests/test-dbus-message-count-send-query (+0/-4)
tests/test-dbus-message-count.in (+0/-18)
tests/test-dbus-message-count.json (+0/-2928)
tests/test-distance.c (+0/-267)
tests/test-load-app-info.c (+0/-82)
tests/test-result-highlighting.c (+0/-198)
tests/test-usage-db-ancient.c (+0/-39)
tests/test-usage-db-ancient.sql (+0/-7)
tests/test-usage-db-old.c (+0/-80)
tests/test-usage-db-old.sql (+0/-11)
tests/test-usage-db-simple.c (+0/-106)
tests/test-usage-db-simple.sql (+0/-11)
tests/test-usage-db-testapp.c (+0/-80)
tests/test-usage-dump-entries.sql (+0/-1)
tests/word-list.h (+0/-364)
tools-vala/Makefile.am (+0/-24)
tools-vala/hud-gtk.ui (+0/-119)
tools-vala/hud-gtk.vala (+0/-121)
To merge this branch: bzr merge lp:~ted/indicator-appmenu/hudectomy
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Mathieu Trudel-Lapierre Approve
Charles Kerr (community) Approve
Review via email: mp+131237@code.launchpad.net

Commit message

Remove the HUD files from indicator-appmenu

Description of the change

We've move the HUD to lp:hud. It shouldn't be here anymore.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

Cool.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Legit CI failure above, packaging needs to be updated:

dh_install --fail-missing
dh_install: indicator-appmenu missing files (debian/tmp/usr/lib/*/hud-service), aborting
make[1]: *** [override_dh_install] Error 2
make[1]: Leaving directory `/tmp/buildd/indicator-appmenu-12.10.4daily12.11.23'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
E: Failed autobuilding of package

cyphermox advocates editing debian/indicator-appmenu.install to remove this expectation of finding the removed built files.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approve.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2012-12-03 17:40:45 +0000
3+++ Makefile.am 2013-02-19 17:11:22 +0000
4@@ -3,15 +3,13 @@
5 SUBDIRS = \
6 data \
7 po \
8- src \
9- docs
10+ src
11
12 if BUILD_TESTS
13 SUBDIRS += \
14 scripts \
15 tests \
16- tools \
17- tools-vala
18+ tools
19 endif
20
21 tests: src
22
23=== modified file 'configure.ac'
24--- configure.ac 2013-01-22 20:39:37 +0000
25+++ configure.ac 2013-02-19 17:11:22 +0000
26@@ -76,26 +76,6 @@
27 AC_SUBST(INDICATOR_LIBS)
28
29 ###########################
30-# Dependencies
31-###########################
32-
33-DBUSMENU_GLIB_REQUIRED_VERSION=0.4.0
34-BAMF_REQUIRED_VERSION=0.2.53
35-SQLITE_REQUIRED_VERSION=0.0
36-
37-PKG_CHECK_MODULES([HUD],[
38- dbusmenu-glib-0.4 >= $DBUSMENU_GLIB_REQUIRED_VERSION
39- gio-2.0 >= $GIO_REQUIRED_VERSION
40- libbamf3
41- sqlite3 >= $SQLITE_REQUIRED_VERSION
42-])
43-
44-PKG_CHECK_MODULES([HUD_CLIENT],[
45- gio-unix-2.0 >= $GIO_REQUIRED_VERSION
46- gtk+-3.0 >= $GTK_REQUIRED_VERSION
47-])
48-
49-###########################
50 # CLI Dependencies
51 ###########################
52
53@@ -233,12 +213,8 @@
54 data/Makefile
55 tools/Makefile
56 po/Makefile.in
57-tools-vala/Makefile
58 tests/Makefile
59 tests/manual/Makefile
60-docs/Makefile
61-docs/man/Makefile
62-docs/devel/Makefile
63 ])
64
65 ###########################
66
67=== modified file 'data/Makefile.am'
68--- data/Makefile.am 2012-12-03 17:40:45 +0000
69+++ data/Makefile.am 2013-02-19 17:11:22 +0000
70@@ -1,19 +1,8 @@
71 gsettings_SCHEMAS = \
72- com.canonical.indicator.appmenu.gschema.xml \
73- com.canonical.indicator.appmenu.hud.gschema.xml \
74- com.canonical.indicator.appmenu.hud.search.gschema.xml
75+ com.canonical.indicator.appmenu.gschema.xml
76
77 @GSETTINGS_RULES@
78
79-dbus_servicesdir = $(DBUSSERVICEDIR)
80-dbus_services_DATA = com.canonical.hud.service
81-
82-%.service: %.service.in
83- sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
84-
85 EXTRA_DIST = \
86- $(dbus_services_DATA:.service=.service.in) \
87 $(gsettings_SCHEMAS)
88
89-CLEANFILES = \
90- $(dbus_services_DATA)
91
92=== removed file 'data/com.canonical.hud.service.in'
93--- data/com.canonical.hud.service.in 2012-12-03 17:40:45 +0000
94+++ data/com.canonical.hud.service.in 1970-01-01 00:00:00 +0000
95@@ -1,3 +0,0 @@
96-[D-BUS Service]
97-Name=com.canonical.hud
98-Exec=@libexecdir@/hud-service
99
100=== removed file 'data/com.canonical.indicator.appmenu.hud.gschema.xml'
101--- data/com.canonical.indicator.appmenu.hud.gschema.xml 2012-12-03 17:40:45 +0000
102+++ data/com.canonical.indicator.appmenu.hud.gschema.xml 1970-01-01 00:00:00 +0000
103@@ -1,16 +0,0 @@
104-<?xml version='1.0' encoding='UTF-8'?>
105-
106-<schemalist>
107- <schema path='/com/canonical/indicator/appmenu/hud/' id='com.canonical.indicator.appmenu.hud' gettext-domain='indicator-appmenu'>
108- <key type='b' name='store-usage-data'>
109- <default>true</default>
110- <summary>Whether to store usage data</summary>
111- <description>
112- When the HUD executes operations it stores the execution in order to
113- make the future results better. Some users could choose to not want
114- this data to be stored. If that is the case they should disable this
115- property.
116- </description>
117- </key>
118- </schema>
119-</schemalist>
120
121=== removed file 'data/com.canonical.indicator.appmenu.hud.search.gschema.xml'
122--- data/com.canonical.indicator.appmenu.hud.search.gschema.xml 2012-12-03 17:40:45 +0000
123+++ data/com.canonical.indicator.appmenu.hud.search.gschema.xml 1970-01-01 00:00:00 +0000
124@@ -1,72 +0,0 @@
125-<?xml version='1.0' encoding='UTF-8'?>
126-
127-<schemalist>
128- <schema path='/com/canonical/indicator/appmenu/hud/search/'
129- id='com.canonical.indicator.appmenu.hud.search'
130- gettext-domain='indicator-appmenu'>
131- <key type='u' name='indicator-penalty'>
132- <default>50</default>
133- <summary>The penalty given to a menu item being in an indicator</summary>
134- <description>
135- In order to have the application's menu items appear higher in the search results a slight penalty is
136- given to the indicator menu items. This value represents the percentage of that penalty so a value of
137- '50' is a 50% additional to the calculated distance.
138- </description>
139- </key>
140-
141- <key type='u' name='add-penalty'>
142- <default>10</default>
143- <summary>Penalty for extra characters added to the search</summary>
144- <description>
145- The penalty for each extra character in the search string that does not appear in the text of a menu
146- item.
147-
148- This penalty would be applied if the user typed "fiile" when searching against the menu item "File", for
149- example.
150- </description>
151- </key>
152-
153- <key type='u' name='drop-penalty'>
154- <default>10</default>
155- <summary>Penalty applied if a character is dropped</summary>
156- <description>
157- The penalty for each character dropped from the search string, as compared with the text of a menu item.
158- This only applies to missing characters that are not at the end of the search term.
159-
160- This penalty would be applied if the user typed "fle" when searching against the menu item "File", for
161- example.
162- </description>
163- </key>
164-
165- <key type='u' name='end-drop-penalty'>
166- <default>1</default>
167- <summary>Penalty applied if a character is dropped from the end</summary>
168- <description>
169- The penalty for each missing character at the end of a search term.
170-
171- This penalty would be applied if the user typed "fil" when searching against the menu item "File", for
172- example.
173- </description>
174- </key>
175-
176- <key type='u' name='swap-penalty'>
177- <default>15</default>
178- <summary>Penalty applied when the characters are not the same</summary>
179- <description>
180- The penalty for each substituted character in the search term.
181-
182- The penalty would be applied if the user typed "fike" when searching against the menu item "File", for
183- example.
184- </description>
185- </key>
186-
187- <key type='u' name='max-distance'>
188- <default>30</default>
189- <summary>The highest distance value that is shown in the results</summary>
190- <description>
191- After the distances are calculated (including the indicator penalty) then all values above this max are
192- dropped. This means that the history for those entries aren't looked up as well.
193- </description>
194- </key>
195- </schema>
196-</schemalist>
197
198=== modified file 'debian/control'
199--- debian/control 2013-01-22 20:39:37 +0000
200+++ debian/control 2013-02-19 17:11:22 +0000
201@@ -17,13 +17,8 @@
202 libdbusmenu-gtk3-dev (>= 0.5.90),
203 libdbusmenu-jsonloader-dev (>= 0.5.90),
204 libbamf3-dev (>= 0.2.53),
205- libsqlite3-dev,
206- sqlite3,
207- libreadline-dev,
208- libncurses5-dev,
209 libappindicator3-dev,
210 indicator-application (>= 0.4.90),
211- valac-0.16,
212 Standards-Version: 3.9.2
213 Homepage: http://launchpad.net/indicator-appmenu
214 # If you aren't a member of ~indicator-applet-developers but need to upload
215@@ -36,6 +31,7 @@
216 Architecture: any
217 Depends: ${shlibs:Depends},
218 ${misc:Depends},
219+ hud,
220 Recommends: indicator-applet | indicator-renderer,
221 appmenu-gtk,
222 appmenu-gtk3,
223@@ -50,7 +46,6 @@
224 ${misc:Depends},
225 indicator-appmenu (= ${binary:Version}),
226 libdbusmenu-tools,
227- sqlite3,
228 Description: Tools for debuging application menus.
229 .
230 This package provides tools for supporting application menus.
231
232=== modified file 'debian/indicator-appmenu-tools.install'
233--- debian/indicator-appmenu-tools.install 2012-12-03 17:40:45 +0000
234+++ debian/indicator-appmenu-tools.install 2013-02-19 17:11:22 +0000
235@@ -1,10 +1,3 @@
236 debian/tmp/usr/lib/*/current-menu*
237 debian/tmp/usr/lib/*/menu-pusher
238 debian/tmp/usr/lib/*/mock-json-app
239-debian/tmp/usr/bin/hud-cli /usr/bin/
240-debian/tmp/usr/bin/hud-dump-application /usr/bin/
241-debian/tmp/usr/bin/hud-gtk /usr/bin/
242-debian/tmp/usr/bin/hud-list-applications /usr/bin/
243-debian/tmp/usr/bin/hud-verify-app-info /usr/bin/
244-debian/tmp/usr/share/man/ /usr/share/
245-debian/tmp/usr/share/hud-gtk /usr/share/
246
247=== modified file 'debian/indicator-appmenu.install'
248--- debian/indicator-appmenu.install 2012-12-03 17:40:45 +0000
249+++ debian/indicator-appmenu.install 2013-02-19 17:11:22 +0000
250@@ -1,6 +1,4 @@
251 debian/tmp/usr/lib/indicators3 /usr/lib
252 debian/source_indicator-appmenu.py /usr/share/apport/package-hooks/
253 debian/indicator-appmenu-crashdb.conf /etc/apport/crashdb.conf.d/
254-debian/tmp/usr/lib/*/hud-service
255-debian/tmp/usr/share/dbus-1/ /usr/share/
256 debian/tmp/usr/share/glib-2.0/ /usr/share/
257
258=== removed directory 'docs'
259=== removed file 'docs/HUD Architecture.svg'
260--- docs/HUD Architecture.svg 2012-12-03 17:40:45 +0000
261+++ docs/HUD Architecture.svg 1970-01-01 00:00:00 +0000
262@@ -1,368 +0,0 @@
263-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
264-<!-- Created with Inkscape (http://www.inkscape.org/) -->
265-
266-<svg
267- xmlns:dc="http://purl.org/dc/elements/1.1/"
268- xmlns:cc="http://creativecommons.org/ns#"
269- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
270- xmlns:svg="http://www.w3.org/2000/svg"
271- xmlns="http://www.w3.org/2000/svg"
272- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
273- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
274- width="706.61322"
275- height="774.54626"
276- id="svg2"
277- version="1.1"
278- inkscape:version="0.48.2 r9819"
279- sodipodi:docname="HUD Architecture.svg">
280- <defs
281- id="defs4">
282- <inkscape:path-effect
283- effect="spiro"
284- id="path-effect4218"
285- is_visible="true" />
286- <inkscape:path-effect
287- effect="spiro"
288- id="path-effect4214"
289- is_visible="true" />
290- <inkscape:path-effect
291- effect="spiro"
292- id="path-effect4210"
293- is_visible="true" />
294- <inkscape:path-effect
295- effect="spiro"
296- id="path-effect4206"
297- is_visible="true" />
298- <inkscape:path-effect
299- effect="spiro"
300- id="path-effect4054"
301- is_visible="true" />
302- <inkscape:path-effect
303- effect="spiro"
304- id="path-effect3863"
305- is_visible="true" />
306- <inkscape:path-effect
307- effect="spiro"
308- id="path-effect3829"
309- is_visible="true" />
310- <inkscape:path-effect
311- effect="spiro"
312- id="path-effect3825"
313- is_visible="true" />
314- </defs>
315- <sodipodi:namedview
316- id="base"
317- pagecolor="#ffffff"
318- bordercolor="#666666"
319- borderopacity="1.0"
320- inkscape:pageopacity="0.0"
321- inkscape:pageshadow="2"
322- inkscape:zoom="1.1071895"
323- inkscape:cx="232.7327"
324- inkscape:cy="382.51953"
325- inkscape:document-units="px"
326- inkscape:current-layer="layer1"
327- showgrid="false"
328- inkscape:showpageshadow="false"
329- inkscape:window-width="1680"
330- inkscape:window-height="1026"
331- inkscape:window-x="0"
332- inkscape:window-y="24"
333- inkscape:window-maximized="1"
334- fit-margin-top="50"
335- fit-margin-left="50"
336- fit-margin-right="50"
337- fit-margin-bottom="50" />
338- <metadata
339- id="metadata7">
340- <rdf:RDF>
341- <cc:Work
342- rdf:about="">
343- <dc:format>image/svg+xml</dc:format>
344- <dc:type
345- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
346- <dc:title />
347- </cc:Work>
348- </rdf:RDF>
349- </metadata>
350- <g
351- inkscape:label="Layer 1"
352- inkscape:groupmode="layer"
353- id="layer1"
354- transform="translate(-153.88477,-277.83542)">
355- <rect
356- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
357- id="rect2985"
358- width="192.93913"
359- height="104.04572"
360- x="241.00642"
361- y="328.33542" />
362- <rect
363- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
364- id="rect2985-3"
365- width="192.93913"
366- height="104.04572"
367- x="245.62126"
368- y="558.84198" />
369- <rect
370- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
371- id="rect2985-9"
372- width="192.93913"
373- height="104.04572"
374- x="586.43182"
375- y="384.48648" />
376- <rect
377- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
378- id="rect2985-7"
379- width="192.93913"
380- height="104.04572"
381- x="617.05884"
382- y="561.62695" />
383- <flowRoot
384- xml:space="preserve"
385- id="flowRoot3805"
386- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bumped BRK;-inkscape-font-specification:Bumped BRK"><flowRegion
387- id="flowRegion3807"><rect
388- id="rect3809"
389- width="187.07358"
390- height="95.192307"
391- x="242.53345"
392- y="43.193981"
393- style="font-family:Bumped BRK;-inkscape-font-specification:Bumped BRK" /></flowRegion><flowPara
394- id="flowPara3811" /></flowRoot> <flowRoot
395- xml:space="preserve"
396- id="flowRoot3813"
397- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
398- transform="translate(0,310.93426)"><flowRegion
399- id="flowRegion3815"><rect
400- id="rect3817"
401- width="175.48492"
402- height="46.354519"
403- x="249.15552"
404- y="52.299332"
405- style="text-align:center;text-anchor:middle"
406- ry="0"
407- rx="0" /></flowRegion><flowPara
408- id="flowPara3819"
409- style="font-weight:bold;-inkscape-font-specification:Ubuntu Bold">Unity</flowPara><flowPara
410- id="flowPara3821"
411- style="font-weight:bold;-inkscape-font-specification:Ubuntu Bold">GUI</flowPara></flowRoot> <path
412- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
413- d="m 449.47325,302.28261 c 29.69243,-2.03406 58.53652,-14.78861 80.02111,-35.38449 10.47599,-10.04266 19.17966,-21.79342 29.4484,-32.0479 8.83486,-8.8226 18.80808,-16.50398 29.59403,-22.79336"
414- id="path3823"
415- inkscape:path-effect="#path-effect3825"
416- inkscape:original-d="m 449.47325,302.28261 c 35.92724,5.92939 56.6183,-19.31435 80.02111,-35.38449 11.7014,-8.03507 19.73501,-22.46822 29.4484,-32.0479 9.7134,-9.57969 21.10658,-14.30591 29.59403,-22.79336"
417- inkscape:connector-curvature="0"
418- transform="translate(0,287.36218)"
419- sodipodi:nodetypes="cssc" />
420- <path
421- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
422- d="m 449.81773,318.01003 c 21.09159,-2.06081 42.43769,-1.50335 63.39297,1.65552 17.10783,2.5789 34.02902,6.89013 51.32108,7.44983 12.84929,0.4159 25.76421,-1.26865 38.07692,-4.96655"
423- id="path3827"
424- inkscape:path-effect="#path-effect3829"
425- inkscape:original-d="m 449.81773,318.01003 c 11.59516,1.94007 62.94692,-1.93293 63.39297,1.65552 1.01665,8.17897 40.57446,3.86763 51.32108,7.44983 19.17114,6.39038 20.04051,-0.45745 38.07692,-4.96655"
426- inkscape:connector-curvature="0"
427- transform="translate(0,287.36218)"
428- sodipodi:nodetypes="cssc" />
429- <flowRoot
430- xml:space="preserve"
431- id="flowRoot3813-1"
432- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
433- transform="translate(2.6759825,544.72955)"><flowRegion
434- id="flowRegion3815-4"><rect
435- id="rect3817-9"
436- width="175.48492"
437- height="46.354519"
438- x="249.15552"
439- y="52.299332"
440- style="text-align:center;text-anchor:middle"
441- ry="0"
442- rx="0" /></flowRegion><flowPara
443- id="flowPara3819-7"
444- style="font-weight:bold">HUD</flowPara><flowPara
445- id="flowPara3821-6"
446- style="font-weight:bold">Service</flowPara></flowRoot> <path
447- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
448- d="m 342.69231,158.25251 0,103.4699"
449- id="path3861"
450- inkscape:path-effect="#path-effect3863"
451- inkscape:original-d="m 342.69231,158.25251 c 0,102.64214 0,103.4699 0,103.4699"
452- inkscape:connector-curvature="0"
453- transform="translate(0,287.36218)" />
454- <text
455- xml:space="preserve"
456- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
457- x="658.00934"
458- y="442.75534"
459- id="text3865"
460- sodipodi:linespacing="100%"><tspan
461- sodipodi:role="line"
462- id="tspan3867"
463- x="658.00934"
464- y="442.75534"
465- style="font-weight:bold">BAMF</tspan></text>
466- <text
467- xml:space="preserve"
468- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
469- x="714.17834"
470- y="609.96881"
471- id="text3869"
472- sodipodi:linespacing="100%"><tspan
473- sodipodi:role="line"
474- id="tspan3871"
475- x="714.17834"
476- y="609.96881"
477- style="font-weight:bold">Indicator</tspan><tspan
478- sodipodi:role="line"
479- x="714.17834"
480- y="627.96881"
481- id="tspan3873"
482- style="font-weight:bold">AppMenu</tspan></text>
483- <text
484- xml:space="preserve"
485- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#444444;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
486- x="203.62877"
487- y="481.20834"
488- id="text3875"
489- sodipodi:linespacing="100%"><tspan
490- sodipodi:role="line"
491- id="tspan3877"
492- x="203.62877"
493- y="481.20834"
494- style="font-size:16px;fill:#444444;fill-opacity:1">Text Area</tspan><tspan
495- sodipodi:role="line"
496- x="203.62877"
497- y="497.20834"
498- id="tspan3879"
499- style="font-size:16px;fill:#444444;fill-opacity:1">Target Text</tspan><tspan
500- sodipodi:role="line"
501- x="203.62877"
502- y="513.20837"
503- id="tspan3881"
504- style="font-size:16px;fill:#444444;fill-opacity:1">Suggestions</tspan></text>
505- <text
506- xml:space="preserve"
507- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
508- x="470.16724"
509- y="506.04111"
510- id="text3883"
511- sodipodi:linespacing="100%"><tspan
512- sodipodi:role="line"
513- id="tspan3885"
514- x="470.16724"
515- y="506.04111">Focused</tspan><tspan
516- sodipodi:role="line"
517- x="470.16724"
518- y="524.04114"
519- id="tspan3925">Window</tspan></text>
520- <text
521- xml:space="preserve"
522- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
523- x="471.28049"
524- y="644.96588"
525- id="text3887"
526- sodipodi:linespacing="100%"><tspan
527- sodipodi:role="line"
528- id="tspan3889"
529- x="471.28049"
530- y="644.96588">Window to</tspan><tspan
531- sodipodi:role="line"
532- x="471.28049"
533- y="662.96588"
534- id="tspan3891">Menu mapping</tspan></text>
535- <rect
536- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
537- id="rect2985-3-6-2"
538- width="259.15988"
539- height="245.59258"
540- x="230.90923"
541- y="756.28912" />
542- <text
543- xml:space="preserve"
544- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
545- x="326.11465"
546- y="994.28821"
547- id="text3865-8-2"
548- sodipodi:linespacing="100%"><tspan
549- sodipodi:role="line"
550- id="tspan3867-7-3"
551- x="326.11465"
552- y="994.28821"
553- style="font-weight:bold">Window</tspan></text>
554- <rect
555- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
556- id="rect2985-7-7"
557- width="239.29364"
558- height="44.447052"
559- x="239.60066"
560- y="925.6922" />
561- <text
562- xml:space="preserve"
563- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:center;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:middle;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
564- x="359.65784"
565- y="953.23474"
566- id="text3887-1"
567- sodipodi:linespacing="100%"><tspan
568- sodipodi:role="line"
569- x="359.65784"
570- y="953.23474"
571- id="tspan3891-2">Appmenu Module</tspan></text>
572- <path
573- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
574- d="m 485.89465,652.84114 c 16.23733,-3.84221 30.5802,-15.04776 38.23686,-29.87304 6.96387,-13.48385 8.38625,-29.21496 7.3396,-44.35478 -1.04664,-15.13982 -4.41236,-30.01318 -6.51184,-45.04321 -2.74315,-19.63804 -3.3102,-39.70499 0.0347,-59.24953 3.34491,-19.54455 10.71754,-38.58634 22.79255,-54.3144 15.0578,-19.61323 37.35193,-33.53801 61.58305,-38.46438"
575- id="path4052"
576- inkscape:path-effect="#path-effect4054"
577- inkscape:original-d="m 485.89465,652.84114 c 69.8028,11.24543 30.70744,15.30352 38.23686,-29.87304 4.70103,-28.20618 0.82776,-60.68417 0.82776,-89.39799 0,-3.09441 20.32766,-111.06434 22.82725,-113.56393 2.41681,-2.4168 58.09902,-38.46438 61.58305,-38.46438"
578- inkscape:connector-curvature="0"
579- transform="translate(0,287.36218)"
580- sodipodi:nodetypes="csssc" />
581- <rect
582- style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
583- id="rect4056"
584- width="237.68489"
585- height="150.42575"
586- x="239.97879"
587- y="765.35535" />
588- <text
589- xml:space="preserve"
590- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:center;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:middle;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
591- x="358.56305"
592- y="846.6972"
593- id="text4093"
594- sodipodi:linespacing="100%"><tspan
595- sodipodi:role="line"
596- id="tspan4095"
597- x="358.56305"
598- y="846.6972">Menus</tspan></text>
599- <path
600- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
601- d="m 325.97456,760.29042 c -3.42872,-7.04416 -5.0107,-14.97733 -4.54619,-22.79786 0.46451,-7.82052 2.97446,-15.51064 7.21293,-22.0994 4.43899,-6.90047 10.66453,-12.51742 15.05132,-19.45118 4.11736,-6.5079 6.50844,-14.09719 6.86513,-21.78993"
602- id="path4204"
603- inkscape:path-effect="#path-effect4206"
604- inkscape:original-d="m 325.97456,760.29042 c -12.83313,-16.30425 -6.68734,-30.5721 2.66674,-44.89726 4.67704,-7.16258 10.74147,-11.99823 15.05132,-19.45118 4.30985,-7.45294 6.86513,-13.52319 6.86513,-21.78993"
605- inkscape:connector-curvature="0"
606- sodipodi:nodetypes="cssc" />
607- <text
608- xml:space="preserve"
609- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
610- x="357.66235"
611- y="720.89227"
612- id="text3118"
613- sodipodi:linespacing="100%"><tspan
614- sodipodi:role="line"
615- id="tspan3120"
616- x="357.66235"
617- y="720.89227">Dbusmenu</tspan></text>
618- <text
619- xml:space="preserve"
620- style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
621- x="556.55219"
622- y="804.53925"
623- id="text3118-3"
624- sodipodi:linespacing="100%"><tspan
625- sodipodi:role="line"
626- id="tspan3120-3"
627- x="556.55219"
628- y="804.53925">Registration</tspan></text>
629- </g>
630-</svg>
631
632=== removed file 'docs/Makefile.am'
633--- docs/Makefile.am 2012-12-03 17:40:45 +0000
634+++ docs/Makefile.am 1970-01-01 00:00:00 +0000
635@@ -1,1 +0,0 @@
636-SUBDIRS = man devel
637
638=== removed directory 'docs/devel'
639=== removed file 'docs/devel/Makefile.am'
640--- docs/devel/Makefile.am 2012-12-03 17:40:45 +0000
641+++ docs/devel/Makefile.am 1970-01-01 00:00:00 +0000
642@@ -1,36 +0,0 @@
643-include $(top_srcdir)/gtk-doc.make
644-
645-DOC_MODULE = hud
646-
647-DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml
648-
649-DOC_SOURCE_DIR = $(top_srcdir)/src
650-
651-MKDB_OPTIONS = --sgml-mode --output-format=xml
652-
653-HFILE_GLOB = $(DOC_SOURCE_DIR)/*.h
654-CFILE_GLOB = $(DOC_SOURCE_DIR)/*.c
655-
656-IGNORE_HFILES = \
657- MwmUtil.h \
658- create-db.h \
659- dbus-shared.h \
660- distance.h \
661- dump-app-info.h \
662- gen-application-menu-renderer.xml.h \
663- gen-application-menu-registrar.xml.h \
664- gdk-get-func.h \
665- hud.interface.h \
666- indicator-tracker.h \
667- load-app-info.h \
668- menuitem-collector.h \
669- shared-values.h \
670- usage-tracker.h \
671- utils.h \
672- window-menus.h
673-
674-GTKDOC_CFLAGS = -I$(top_srcdir)/src $(HUD_CFLAGS)
675-
676-GTKDOC_LIBS = $(top_builddir)/src/libhud-service.a \
677- $(HUD_LIBS) \
678- $(COVERAGE_LDFLAGS)
679
680=== removed file 'docs/devel/hud-docs.xml'
681--- docs/devel/hud-docs.xml 2012-12-03 17:40:45 +0000
682+++ docs/devel/hud-docs.xml 1970-01-01 00:00:00 +0000
683@@ -1,58 +0,0 @@
684-<?xml version="1.0"?>
685-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
686- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
687-[
688- <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
689- ]>
690-
691-<book id="index">
692- <bookinfo>
693- <title>hud-service Hacking Guide</title>
694- </bookinfo>
695-
696- <xi:include href="hud-overview.xml"/>
697-
698- <chapter>
699- <title>Data Types</title>
700- <xi:include href="xml/hudstringlist.xml"/>
701- </chapter>
702-
703- <chapter>
704- <title>Queries, Results, Items</title>
705- <xi:include href="xml/huditem.xml"/>
706- <xi:include href="xml/hudresult.xml"/>
707- <xi:include href="xml/hudquery.xml"/>
708- </chapter>
709-
710- <chapter>
711- <title>Sources</title>
712- <xi:include href="xml/hudsource.xml"/>
713- <xi:include href="xml/hudsourcelist.xml"/>
714- <xi:include href="xml/hudwindowsource.xml"/>
715- <xi:include href="xml/hudindicatorsource.xml"/>
716- <xi:include href="xml/hudappindicatorsource.xml"/>
717- <xi:include href="xml/huddbusmenucollector.xml"/>
718- <xi:include href="xml/hudmenumodelcollector.xml"/>
719- </chapter>
720-
721- <chapter>
722- <title>Utility API</title>
723- <xi:include href="xml/hudsettings.xml"/>
724- <xi:include href="xml/hudappmenuregistrar.xml"/>
725- </chapter>
726-
727- <chapter id="object-tree">
728- <title>Object Hierarchy</title>
729- <xi:include href="xml/tree_index.sgml"/>
730- </chapter>
731- <index id="api-index-full">
732- <title>API Index</title>
733- <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
734- </index>
735- <index id="deprecated-api-index" role="deprecated">
736- <title>Index of deprecated API</title>
737- <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
738- </index>
739-
740- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
741-</book>
742
743=== removed file 'docs/devel/hud-overview.xml'
744--- docs/devel/hud-overview.xml 2012-12-03 17:40:45 +0000
745+++ docs/devel/hud-overview.xml 1970-01-01 00:00:00 +0000
746@@ -1,91 +0,0 @@
747-<?xml version='1.0'?>
748-
749-
750-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
751- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
752-
753-<chapter>
754- <title>Overview</title>
755-
756- <para>
757- The HUD consists of the interface in the shell and a backend service, <literal>hud-service</literal>. This
758- document attempts to describe the internal architecture of the service.
759- </para>
760-
761- <para>
762- The most important type in the service is <link linkend="HudSource"><type>HudSource</type></link>. This is
763- an interface. Each source is an entity against which a search can be performed. There is one interface
764- method: <link linkend="hud-source-search"><function>hud_source_search()</function></link>. This is the main
765- mechanism by which queries are performed in the HUD. The interface also features a signal
766- <link linkend="HudSource-changed"><function>::changed</function></link> that is emitted when the result of
767- searching may have changed.
768- </para>
769-
770- <para>
771- Several implementations of <link linkend="HudSource"><type>HudSource</type></link> exist. A particular type
772- of source that gathers possible search results is referred to as a "collector". There are two of these:
773- <link linkend="HudMenuModelCollector"><type>HudMenuModelCollector</type></link> (for
774- <link linkend="GDBusMenuModel"><type>GDBusMenuModel</type></link>) and
775- <link linkend="HudDbusmenuCollector"><type>HudDbusmenuCollector</type></link> for Dbusmenu. These
776- "collector" sources only function when targetted at a particular endpoint (ie: a unique name and object path
777- on D-Bus). This is only useful for searching for items in one particular set of menus.
778- </para>
779-
780- <para>
781- <link linkend="HudSourceList"><type>HudWindowSource</type></link> acts as a multiplexer. It is responsible
782- for determining the currently focused window and performing searches submitted to it against the correct
783- collector for that window. Similarly, there are
784- <link linkend="HudSourceList"><type>HudIndicatorSource</type></link> and
785- <link linkend="HudSourceList"><type>HudAppIndicatorSource</type></link> for performing searches against the
786- system and application indicators, respectively.
787- </para>
788-
789- <para>
790- Finally, there is <link linkend="HudSourceList"><type>HudSourceList</type></link> which functions as a list
791- of multiple other <link linkend="HudSource"><type>HudSource</type></link>s (such that performing a search
792- against the list gives the combined result of searches performed against each of the contained sources).
793- </para>
794-
795- <para>
796- The <literal>hud-service</literal> initialises itself by creating the window, indicator and appindicator
797- sources and putting each of them into a <link linkend="HudSourceList"><type>HudSourceList</type></link>.
798- This is the source against which all queries submitted to the service are executed.
799- </para>
800-
801- <para>
802- Collectors are essentially a collection of <link linkend="HudItem"><type>HudItem</type></link>s. Each item
803- corresponds to an action that may appear in the results of a search made with the HUD. Items have a list of
804- strings describing themselves (eg: <literal>['File', 'Open']</literal> or
805- <literal>['Bluetooth', 'Settings...']</literal>) and some information about their origin (eg: the desktop
806- file of the application or indicator that created them). An item can be disabled, in which case it will
807- never appear in the results of a search. Items are activated using
808- <link linkend="hud-item-activate"><function>hud_item_activate()</function></link> which is implemented by
809- the collector in the appropriate way.
810- </para>
811-
812- <para>
813- The result of performing a search is a set of <link linkend="HudResult"><type>HudResult</type></link>s.
814- Each result refers to <link linkend="HudItem"><type>HudItem</type></link> along with information about why
815- that item matched, and how closely.
816- </para>
817-
818- <para>
819- The toplevel interface to performing a query is <link linkend="HudQuery"><type>HudQuery</type></link>. It
820- takes a search string and a reference to a <link linkend="HudSource"><type>HudSource</type></link> to search
821- (which, as implemented, is always the toplevel 'list' source). It submits the search to the source then
822- sorts the results by relevence. If the source changes, it resubmits the search. The interface of
823- <link linkend="HudQuery"><type>HudQuery</type></link> is an ordered sequence of results.
824- <link linkend="HudQuery"><type>HudQuery</type></link> has its own
825- <link linkend="HudQuery-changed"><function>::changed</function></link> signal.
826- </para>
827-
828- <para>
829- <literal>hud-service</literal> is essentially a simple D-Bus interface corresponding to
830- <link linkend="HudQuery"><type>HudQuery</type></link> as used against the toplevel source list. New queries
831- can be created using <function>StartQuery</function>. Queries can be destroyed using
832- <function>CloseQuery</function>. <link linkend="HudItem"><type>HudItem</type></link>s corresponding to
833- results from the query can be activated using <function>ExecuteQuery</function>. Finally, the
834- <link linkend="HudQuery-changed"><function>::changed</function></link> signal is reported as the
835- <function>UpdatedQuery</function> D-Bus signal.
836- </para>
837-</chapter>
838
839=== removed file 'docs/devel/hud-sections.txt'
840--- docs/devel/hud-sections.txt 2012-12-03 17:40:45 +0000
841+++ docs/devel/hud-sections.txt 1970-01-01 00:00:00 +0000
842@@ -1,172 +0,0 @@
843-<SECTION>
844-<FILE>hudsettings</FILE>
845-HudSettings
846-hud_settings
847-hud_settings_init
848-</SECTION>
849-
850-<SECTION>
851-<FILE>hudappmenuregistrar</FILE>
852-HudAppMenuRegistrar
853-HudAppMenuRegistrarObserverFunc
854-hud_app_menu_registrar_add_observer
855-hud_app_menu_registrar_get
856-hud_app_menu_registrar_remove_observer
857-<SUBSECTION Standard>
858-HUD_APP_MENU_REGISTRAR
859-HUD_IS_APP_MENU_REGISTRAR
860-HUD_TYPE_APP_MENU_REGISTRAR
861-hud_app_menu_registrar_get_type
862-</SECTION>
863-
864-<SECTION>
865-<FILE>huddbusmenucollector</FILE>
866-HudDbusmenuCollector
867-hud_dbusmenu_collector_new_for_endpoint
868-hud_dbusmenu_collector_new_for_window
869-hud_dbusmenu_collector_set_prefix
870-<SUBSECTION Standard>
871-HUD_DBUSMENU_COLLECTOR
872-HUD_IS_DBUSMENU_COLLECTOR
873-HUD_TYPE_DBUSMENU_COLLECTOR
874-hud_dbusmenu_collector_get_type
875-</SECTION>
876-
877-<SECTION>
878-<FILE>hudindicatorsource</FILE>
879-HudIndicatorSource
880-hud_indicator_source_new
881-<SUBSECTION Standard>
882-HUD_INDICATOR_SOURCE
883-HUD_IS_INDICATOR_SOURCE
884-HUD_TYPE_INDICATOR_SOURCE
885-hud_indicator_source_get_type
886-</SECTION>
887-
888-<SECTION>
889-<FILE>hudappindicatorsource</FILE>
890-HudAppIndicatorSource
891-hud_app_indicator_source_new
892-<SUBSECTION Standard>
893-HUD_APP_INDICATOR_SOURCE
894-HUD_IS_APP_INDICATOR_SOURCE
895-HUD_TYPE_APP_INDICATOR_SOURCE
896-hud_app_indicator_source_get_type
897-</SECTION>
898-
899-<SECTION>
900-<FILE>huditem</FILE>
901-<TITLE>HudItem</TITLE>
902-HudItem
903-HudItemClass
904-hud_item_activate
905-hud_item_construct
906-hud_item_get_app_icon
907-hud_item_get_enabled
908-hud_item_get_item_icon
909-hud_item_get_tokens
910-hud_item_get_usage
911-hud_item_new
912-<SUBSECTION Standard>
913-HUD_IS_ITEM
914-HUD_IS_ITEM_CLASS
915-HUD_ITEM
916-HUD_ITEM_CLASS
917-HUD_ITEM_GET_CLASS
918-HUD_TYPE_ITEM
919-HudItemPrivate
920-hud_item_get_type
921-</SECTION>
922-
923-<SECTION>
924-<FILE>hudmenumodelcollector</FILE>
925-HudMenuModelCollector
926-hud_menu_model_collector_get
927-<SUBSECTION Standard>
928-HUD_IS_MENU_MODEL_COLLECTOR
929-HUD_MENU_MODEL_COLLECTOR
930-HUD_TYPE_MENU_MODEL_COLLECTOR
931-hud_menu_model_collector_get_type
932-</SECTION>
933-
934-<SECTION>
935-<FILE>hudquery</FILE>
936-HudQuery
937-hud_query_close
938-hud_query_get_generation
939-hud_query_get_n_results
940-hud_query_get_query_key
941-hud_query_get_result_by_index
942-hud_query_lookup
943-hud_query_new
944-<SUBSECTION Standard>
945-HUD_IS_QUERY
946-HUD_QUERY
947-HUD_TYPE_QUERY
948-hud_query_get_type
949-</SECTION>
950-
951-<SECTION>
952-<FILE>hudresult</FILE>
953-HudResult
954-hud_result_get_distance
955-hud_result_get_html_description
956-hud_result_get_if_matched
957-hud_result_get_item
958-hud_result_new
959-<SUBSECTION Standard>
960-HUD_IS_RESULT
961-HUD_RESULT
962-HUD_TYPE_RESULT
963-hud_result_get_type
964-</SECTION>
965-
966-<SECTION>
967-<FILE>hudsource</FILE>
968-<TITLE>HudSource</TITLE>
969-HudSource
970-HudSourceInterface
971-hud_source_changed
972-hud_source_search
973-<SUBSECTION Standard>
974-HUD_IS_SOURCE
975-HUD_SOURCE
976-HUD_SOURCE_GET_IFACE
977-HUD_TYPE_SOURCE
978-hud_source_get_type
979-</SECTION>
980-
981-<SECTION>
982-<FILE>hudsourcelist</FILE>
983-HudSourceList
984-hud_source_list_add
985-hud_source_list_new
986-<SUBSECTION Standard>
987-HUD_IS_SOURCE_LIST
988-HUD_SOURCE_LIST
989-HUD_TYPE_SOURCE_LIST
990-hud_source_list_get_type
991-</SECTION>
992-
993-<SECTION>
994-<FILE>hudstringlist</FILE>
995-HudStringList
996-hud_string_list_cons
997-hud_string_list_cons_label
998-hud_string_list_get_head
999-hud_string_list_get_tail
1000-hud_string_list_pretty_print
1001-hud_string_list_ref
1002-hud_string_list_unref
1003-</SECTION>
1004-
1005-<SECTION>
1006-<FILE>hudwindowsource</FILE>
1007-HudWindowSource
1008-hud_window_source_new
1009-<SUBSECTION Standard>
1010-HUD_IS_WINDOW_SOURCE
1011-HUD_TYPE_WINDOW_SOURCE
1012-HUD_WINDOW_SOURCE
1013-hud_window_source_get_type
1014-</SECTION>
1015
1016=== removed file 'docs/devel/hud.types'
1017--- docs/devel/hud.types 2012-12-03 17:40:45 +0000
1018+++ docs/devel/hud.types 1970-01-01 00:00:00 +0000
1019@@ -1,11 +0,0 @@
1020-hud_app_indicator_source_get_type
1021-hud_app_menu_registrar_get_type
1022-hud_dbusmenu_collector_get_type
1023-hud_indicator_source_get_type
1024-hud_item_get_type
1025-hud_menu_model_collector_get_type
1026-hud_query_get_type
1027-hud_result_get_type
1028-hud_source_get_type
1029-hud_source_list_get_type
1030-hud_window_source_get_type
1031
1032=== removed directory 'docs/man'
1033=== removed file 'docs/man/Makefile.am'
1034--- docs/man/Makefile.am 2012-12-03 17:40:45 +0000
1035+++ docs/man/Makefile.am 1970-01-01 00:00:00 +0000
1036@@ -1,16 +0,0 @@
1037-
1038-man_MANS = \
1039- hud-cli.1 \
1040- hud-dump-application.1 \
1041- hud-list-applications.1 \
1042- hud-verify-app-info.1
1043-
1044-.xml.1:
1045- @env -u XML_CATALOG_FILES $(XSLT_PROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
1046-
1047-EXTRA_DIST = \
1048- $(man_MANS) \
1049- $(man_MANS:.1=.xml)
1050-
1051-CLEANFILES = \
1052- $(man_MANS)
1053
1054=== removed file 'docs/man/hud-cli.xml'
1055--- docs/man/hud-cli.xml 2012-12-03 17:40:45 +0000
1056+++ docs/man/hud-cli.xml 1970-01-01 00:00:00 +0000
1057@@ -1,38 +0,0 @@
1058-<refentry id="hud-cli" lang="en">
1059-
1060-<refmeta>
1061- <refentrytitle>hud-cli</refentrytitle>
1062- <manvolnum>1</manvolnum>
1063- <refmiscinfo class="manual">User Commands</refmiscinfo>
1064-</refmeta>
1065-
1066-<refnamediv>
1067- <refname>hud-cli</refname>
1068- <refpurpose>Tool to exercise the HUD on the command line</refpurpose>
1069-</refnamediv>
1070-
1071-<refsynopsisdiv>
1072- <cmdsynopsis>
1073- <command>hud-cli</command>
1074- </cmdsynopsis>
1075- <cmdsynopsis>
1076- <command>hud-cli</command>
1077- <arg choice="plain"><replaceable>search string</replaceable></arg>
1078- </cmdsynopsis>
1079-</refsynopsisdiv>
1080-
1081-<refsect1>
1082- <title>AUTHOR</title>
1083- <para>
1084- Written by Ted Gould <email>ted@canonical.com</email> and others.
1085- </para>
1086-</refsect1>
1087-
1088-<refsect1>
1089- <title>BUGS</title>
1090- <para>
1091- Bugs should be submitted to Launchpad: <ulink url="https://bugs.launchpad.net/indicator-appmenu/+filebug"/>
1092- </para>
1093-</refsect1>
1094-
1095-</refentry>
1096
1097=== removed file 'docs/man/hud-dump-application.xml'
1098--- docs/man/hud-dump-application.xml 2012-12-03 17:40:45 +0000
1099+++ docs/man/hud-dump-application.xml 1970-01-01 00:00:00 +0000
1100@@ -1,45 +0,0 @@
1101-<refentry id="hud-dump-application" lang="en">
1102-
1103-<refmeta>
1104- <refentrytitle>hud-dump-application</refentrytitle>
1105- <manvolnum>1</manvolnum>
1106- <refmiscinfo class="manual">User Commands</refmiscinfo>
1107-</refmeta>
1108-
1109-<refnamediv>
1110- <refname>hud-dump-application</refname>
1111- <refpurpose>Tool to dump information on an application from the HUD usage database</refpurpose>
1112-</refnamediv>
1113-
1114-<refsynopsisdiv>
1115- <cmdsynopsis>
1116- <command>hud-dump-application</command>
1117- <arg choice="plain"><replaceable>desktop file path</replaceable></arg>
1118- </cmdsynopsis>
1119-</refsynopsisdiv>
1120-
1121-<refsect1>
1122- <title>AUTHOR</title>
1123- <para>
1124- Written by Ted Gould <email>ted@canonical.com</email> and others.
1125- </para>
1126-</refsect1>
1127-
1128-<refsect1>
1129- <title>BUGS</title>
1130- <para>
1131- Bugs should be submitted to Launchpad: <ulink url="https://bugs.launchpad.net/indicator-appmenu/+filebug"/>
1132- </para>
1133-</refsect1>
1134-
1135-<refsect1>
1136- <title>SEE ALSO</title>
1137- <para>
1138- <citerefentry>
1139- <refentrytitle>hud-list-applications</refentrytitle>
1140- <manvolnum>1</manvolnum>
1141- </citerefentry>
1142- </para>
1143-</refsect1>
1144-
1145-</refentry>
1146
1147=== removed file 'docs/man/hud-list-applications.xml'
1148--- docs/man/hud-list-applications.xml 2012-12-03 17:40:45 +0000
1149+++ docs/man/hud-list-applications.xml 1970-01-01 00:00:00 +0000
1150@@ -1,44 +0,0 @@
1151-<refentry id="hud-list-applications" lang="en">
1152-
1153-<refmeta>
1154- <refentrytitle>hud-list-applications</refentrytitle>
1155- <manvolnum>1</manvolnum>
1156- <refmiscinfo class="manual">User Commands</refmiscinfo>
1157-</refmeta>
1158-
1159-<refnamediv>
1160- <refname>hud-list-applications</refname>
1161- <refpurpose>Tool to list the applications in the HUD usage database</refpurpose>
1162-</refnamediv>
1163-
1164-<refsynopsisdiv>
1165- <cmdsynopsis>
1166- <command>hud-list-applications</command>
1167- </cmdsynopsis>
1168-</refsynopsisdiv>
1169-
1170-<refsect1>
1171- <title>AUTHOR</title>
1172- <para>
1173- Written by Ted Gould <email>ted@canonical.com</email> and others.
1174- </para>
1175-</refsect1>
1176-
1177-<refsect1>
1178- <title>BUGS</title>
1179- <para>
1180- Bugs should be submitted to Launchpad: <ulink url="https://bugs.launchpad.net/indicator-appmenu/+filebug"/>
1181- </para>
1182-</refsect1>
1183-
1184-<refsect1>
1185- <title>SEE ALSO</title>
1186- <para>
1187- <citerefentry>
1188- <refentrytitle>hud-dump-application</refentrytitle>
1189- <manvolnum>1</manvolnum>
1190- </citerefentry>
1191- </para>
1192-</refsect1>
1193-
1194-</refentry>
1195
1196=== removed file 'docs/man/hud-verify-app-info.xml'
1197--- docs/man/hud-verify-app-info.xml 2012-12-03 17:40:45 +0000
1198+++ docs/man/hud-verify-app-info.xml 1970-01-01 00:00:00 +0000
1199@@ -1,35 +0,0 @@
1200-<refentry id="hud-verify-app-info" lang="en">
1201-
1202-<refmeta>
1203- <refentrytitle>hud-verify-app-info</refentrytitle>
1204- <manvolnum>1</manvolnum>
1205- <refmiscinfo class="manual">User Commands</refmiscinfo>
1206-</refmeta>
1207-
1208-<refnamediv>
1209- <refname>hud-verify-app-info</refname>
1210- <refpurpose>Tool to verify an app-info file that is expected to be used in the HUD</refpurpose>
1211-</refnamediv>
1212-
1213-<refsynopsisdiv>
1214- <cmdsynopsis>
1215- <command>hud-verify-app-info</command>
1216- <arg choice="plain"><replaceable>path to app info file</replaceable></arg>
1217- </cmdsynopsis>
1218-</refsynopsisdiv>
1219-
1220-<refsect1>
1221- <title>AUTHOR</title>
1222- <para>
1223- Written by Ted Gould <email>ted@canonical.com</email> and others.
1224- </para>
1225-</refsect1>
1226-
1227-<refsect1>
1228- <title>BUGS</title>
1229- <para>
1230- Bugs should be submitted to Launchpad: <ulink url="https://bugs.launchpad.net/indicator-appmenu/+filebug"/>
1231- </para>
1232-</refsect1>
1233-
1234-</refentry>
1235
1236=== modified file 'po/POTFILES.in'
1237--- po/POTFILES.in 2012-12-03 17:40:45 +0000
1238+++ po/POTFILES.in 2013-02-19 17:11:22 +0000
1239@@ -1,28 +1,6 @@
1240 data/com.canonical.indicator.appmenu.gschema.xml
1241-data/com.canonical.indicator.appmenu.hud.gschema.xml
1242-data/com.canonical.indicator.appmenu.hud.search.gschema.xml
1243-src/dump-app-info.c
1244 src/gdk-get-func.c
1245-src/hudappindicatorsource.c
1246-src/hudappmenuregistrar.c
1247-src/hud-cli.c
1248-src/huddbusmenucollector.c
1249-src/hud-dump-application.c
1250-src/hudindicatorsource.c
1251-src/huditem.c
1252-src/hudmenumodelcollector.c
1253-src/hudquery.c
1254-src/hudresult.c
1255-src/hud-service.c
1256-src/hudsource.c
1257-src/hudsourcelist.c
1258-src/hudstringlist.c
1259-src/hudtoken.c
1260-src/hud-verify-app-info.c
1261-src/hudwindowsource.c
1262 src/indicator-appmenu.c
1263-src/load-app-info.c
1264-src/usage-tracker.c
1265 src/window-menu.c
1266 src/window-menu-dbusmenu.c
1267 src/window-menu-model.c
1268
1269=== removed directory 'service'
1270=== modified file 'src/Makefile.am'
1271--- src/Makefile.am 2012-12-27 15:50:33 +0000
1272+++ src/Makefile.am 2013-02-19 17:11:22 +0000
1273@@ -1,18 +1,7 @@
1274 CLEANFILES =
1275 DISTCLEANFILES =
1276 BUILT_SOURCES =
1277-EXTRA_DIST = \
1278- hud-list-applications
1279-
1280-bin_PROGRAMS = \
1281- hud-dump-application \
1282- hud-verify-app-info
1283-
1284-bin_SCRIPTS = \
1285- hud-list-applications
1286-
1287-libexec_PROGRAMS = \
1288- hud-service
1289+EXTRA_DIST =
1290
1291 include $(top_srcdir)/Makefile.am.marshal
1292
1293@@ -80,173 +69,6 @@
1294 gen-application-menu-registrar.xml.c \
1295 gen-application-menu-registrar.xml.h
1296
1297-####################
1298-# HUD Service
1299-####################
1300-
1301-noinst_LIBRARIES = libhud-service.a
1302-
1303-libhud_service_a_SOURCES = \
1304- create-db.h \
1305- create-db.c \
1306- dump-app-info.h \
1307- dump-app-info.c \
1308- shared-values.h \
1309- hudsettings.h \
1310- hudsettings.c \
1311- hudappmenuregistrar.h \
1312- hudappmenuregistrar.c \
1313- huddbusmenucollector.h \
1314- huddbusmenucollector.c \
1315- hudmenumodelcollector.h \
1316- hudmenumodelcollector.c \
1317- hudappindicatorsource.h \
1318- hudappindicatorsource.c \
1319- hudwebappsource.h \
1320- hudwebappsource.c \
1321- hudindicatorsource.h \
1322- hudindicatorsource.c \
1323- hudwindowsource.h \
1324- hudwindowsource.c \
1325- huddebugsource.h \
1326- huddebugsource.c \
1327- hudsourcelist.h \
1328- hudsourcelist.c \
1329- hudsource.h \
1330- hudsource.c \
1331- hudtoken.h \
1332- hudtoken.c \
1333- hudquery.h \
1334- hudquery.c \
1335- hudstringlist.h \
1336- hudstringlist.c \
1337- huditem.h \
1338- huditem.c \
1339- hudresult.h \
1340- hudresult.c \
1341- hud.interface.h \
1342- hud.interface.c \
1343- load-app-info.h \
1344- load-app-info.c \
1345- usage-tracker.h \
1346- usage-tracker.c
1347-
1348-hud_service_SOURCES = hud-service.c
1349-
1350-libhud_service_a_CFLAGS = \
1351- $(HUD_CFLAGS) \
1352- $(COVERAGE_CFLAGS) \
1353- -DDATADIR=\""$(datadir)"\" \
1354- -Wall -Werror
1355-hud_service_CFLAGS = \
1356- $(HUD_CFLAGS) \
1357- $(COVERAGE_CFLAGS) \
1358- -DDATADIR=\""$(datadir)"\" \
1359- -Wall -Werror
1360-hud_service_LDADD = \
1361- libhud-service.a \
1362- $(HUD_LIBS)
1363-hud_service_LDFLAGS = \
1364- $(COVERAGE_LDFLAGS)
1365-
1366-
1367-create-db.c: create-db.sql
1368- echo "#include \"create-db.h\"" > $@
1369- echo -n "const gchar * create_db = \"" >> $@
1370- cat $< | xargs printf "%s " >> $@
1371- echo -n "\";" >> $@
1372-
1373-CLEANFILES += \
1374- create-db.c
1375-
1376-
1377-####################
1378-# HUD CLI
1379-####################
1380-
1381-hud_cli_SOURCES = \
1382- shared-values.h \
1383- hud-cli.c \
1384- hud.interface.h \
1385- hud.interface.c
1386-
1387-hud_cli_CFLAGS = \
1388- $(HUD_CFLAGS) \
1389- $(HUD_CLIENT_CFLAGS) \
1390- $(COVERAGE_CFLAGS) \
1391- -Wall -Werror
1392-
1393-hud_cli_LDFLAGS = \
1394- $(HUD_LIBS) \
1395- $(HUD_CLIENT_LIBS) \
1396- $(COVERAGE_LDFLAGS) \
1397- -lreadline -lcurses
1398-
1399-
1400-if BUILD_CLI
1401-bin_PROGRAMS += \
1402- hud-cli
1403-else
1404-EXTRA_DIST += \
1405- $(hud_cli_SOURCES)
1406-endif
1407-
1408-#######################
1409-# HUD Dump Application
1410-#######################
1411-
1412-hud_dump_application_SOURCES = \
1413- dump-app-info.h \
1414- dump-app-info.c \
1415- hud-dump-application.c
1416-
1417-hud_dump_application_CFLAGS = \
1418- $(HUD_CFLAGS) \
1419- $(COVERAGE_CFLAGS) \
1420- -Wall -Werror
1421-hud_dump_application_LDFLAGS = \
1422- $(COVERAGE_LDFLAGS) \
1423- $(HUD_LIBS)
1424-
1425-#######################
1426-# HUD Verify App Info
1427-#######################
1428-
1429-hud_verify_app_info_SOURCES = \
1430- create-db.h \
1431- create-db.c \
1432- load-app-info.h \
1433- load-app-info.c \
1434- hud-verify-app-info.c
1435-
1436-hud_verify_app_info_CFLAGS = \
1437- $(HUD_CFLAGS) \
1438- $(COVERAGE_CFLAGS) \
1439- -Wall -Werror
1440-hud_verify_app_info_LDFLAGS = \
1441- $(COVERAGE_LDFLAGS) \
1442- $(HUD_LIBS)
1443-
1444-####################
1445-# HUD DBus Interface
1446-####################
1447-
1448-EXTRA_DIST += \
1449- hud.xml \
1450- create-db.sql
1451-
1452-BUILT_SOURCES += \
1453- hud.interface.c \
1454- hud.interface.h
1455-
1456-%.interface.h: %.xml
1457- echo "extern const char * $(subst -,_,$(subst .,_,$(basename $(notdir $@))));" > $@
1458-
1459-%.interface.c: %.xml
1460- echo "const char * $(subst -,_,$(subst .,_,$(basename $(notdir $@)))) = " > $@
1461- sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@
1462- echo ";" >> $@
1463-
1464 CLEANFILES += $(BUILT_SOURCES)
1465
1466 EXTRA_DIST += $(DBUS_SPECS) clean-namespaces.xslt
1467
1468=== removed file 'src/create-db.h'
1469--- src/create-db.h 2012-12-03 17:40:45 +0000
1470+++ src/create-db.h 1970-01-01 00:00:00 +0000
1471@@ -1,4 +0,0 @@
1472-
1473-#include <glib.h>
1474-
1475-extern const gchar * create_db;
1476
1477=== removed file 'src/create-db.sql'
1478--- src/create-db.sql 2012-12-03 17:40:45 +0000
1479+++ src/create-db.sql 1970-01-01 00:00:00 +0000
1480@@ -1,2 +0,0 @@
1481-create table if not exists usage (application text, entry text, timestamp datetime);
1482-create index if not exists application_index on usage (application);
1483
1484=== removed file 'src/dump-app-info.c'
1485--- src/dump-app-info.c 2012-12-03 17:40:45 +0000
1486+++ src/dump-app-info.c 1970-01-01 00:00:00 +0000
1487@@ -1,174 +0,0 @@
1488-/*
1489-Prints out application info for debugging and CLI tools
1490-
1491-Copyright 2011 Canonical Ltd.
1492-
1493-Authors:
1494- Ted Gould <ted@canonical.com>
1495-
1496-This program is free software: you can redistribute it and/or modify it
1497-under the terms of the GNU General Public License version 3, as published
1498-by the Free Software Foundation.
1499-
1500-This program is distributed in the hope that it will be useful, but
1501-WITHOUT ANY WARRANTY; without even the implied warranties of
1502-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1503-PURPOSE. See the GNU General Public License for more details.
1504-
1505-You should have received a copy of the GNU General Public License along
1506-with this program. If not, see <http://www.gnu.org/licenses/>.
1507-*/
1508-
1509-#include "dump-app-info.h"
1510-#include "shared-values.h"
1511-
1512-typedef enum _tree_type_t tree_type_t;
1513-enum _tree_type_t {
1514- MENU_TYPE,
1515- ITEM_TYPE
1516-};
1517-
1518-typedef struct _menu_t menu_t;
1519-struct _menu_t {
1520- tree_type_t tree_type;
1521- gchar * name;
1522- int count;
1523- GList * subitems;
1524-};
1525-
1526-GList *
1527-place_on_tree (GList * tree_in, gchar ** entries)
1528-{
1529- menu_t * menu;
1530-
1531- if (entries[0] == NULL) {
1532- return tree_in;
1533- }
1534-
1535- GList * entry = tree_in;
1536- while (entry != NULL) {
1537- menu = (menu_t *)entry->data;
1538-
1539- if (g_strcmp0(menu->name, entries[0]) == 0) {
1540- break;
1541- }
1542-
1543- entry = g_list_next(entry);
1544- }
1545-
1546- if (entry != NULL) {
1547- if (menu->tree_type == ITEM_TYPE) {
1548- if (entries[1] != NULL) {
1549- g_warning("Error parsing on entry '%s'", entries[0]);
1550- } else {
1551- menu->count++;
1552- }
1553- } else {
1554- menu->subitems = place_on_tree(menu->subitems, &entries[1]);
1555- }
1556-
1557- return tree_in;
1558- }
1559-
1560- menu = g_new0(menu_t, 1);
1561- menu->name = g_strdup(entries[0]);
1562-
1563- if (entries[1] == NULL) {
1564- /* This is an item */
1565- menu->tree_type = ITEM_TYPE;
1566- menu->count = 1;
1567- menu->subitems = NULL;
1568- } else {
1569- /* This is a menu */
1570- menu->tree_type = MENU_TYPE;
1571- menu->subitems = place_on_tree(NULL, &entries[1]);
1572- }
1573-
1574- return g_list_append(tree_in, menu);
1575-}
1576-
1577-static int
1578-entry_cb (void * user_data, int columns, char ** values, char ** names)
1579-{
1580- GList ** tree = (GList **)user_data;
1581-
1582- gchar ** entries = g_strsplit(values[0], DB_SEPARATOR, -1);
1583-
1584- *tree = place_on_tree(*tree, entries);
1585-
1586- g_strfreev(entries);
1587-
1588- return SQLITE_OK;
1589-}
1590-
1591-void
1592-print_tree (GList * tree, guint tab_depth)
1593-{
1594- if (tree == NULL) {
1595- return;
1596- }
1597-
1598- int i;
1599- for (i = 0; i < tab_depth; i++) {
1600- g_print("\t");
1601- }
1602-
1603- menu_t * menu = (menu_t *)tree->data;
1604-
1605- if (menu->tree_type == ITEM_TYPE) {
1606- g_print("<item name=\"%s\" count=\"%d\" />\n", menu->name, menu->count);
1607- } else {
1608- g_print("<menu name=\"%s\">\n", menu->name);
1609-
1610- GList * subs = menu->subitems;
1611- while (subs != NULL) {
1612- print_tree(subs, tab_depth + 1);
1613- subs = g_list_next(subs);
1614- }
1615-
1616- for (i = 0; i < tab_depth; i++) {
1617- g_print("\t");
1618- }
1619- g_print("</menu>\n");
1620- }
1621-
1622- return;
1623-}
1624-
1625-void
1626-dump_app_info (const gchar * app, const gchar * domain, sqlite3 * db)
1627-{
1628- g_return_if_fail(app != NULL);
1629- g_return_if_fail(db != NULL);
1630-
1631- g_print("<hudappinfo>\n");
1632-
1633- g_print("\t<desktopfile path=\"%s\" />\n", app);
1634-
1635- if (domain != NULL) {
1636- g_print("\t<gettext-domain>%s</gettext-domain>\n", domain);
1637- }
1638-
1639- gchar * statement = g_strdup_printf("select entry from usage where application = '%s';", app);
1640-
1641- int exec_status = SQLITE_OK;
1642- gchar * failstring = NULL;
1643- GList * tree = NULL;
1644- exec_status = sqlite3_exec(db,
1645- statement,
1646- entry_cb, &tree, &failstring);
1647- if (exec_status != SQLITE_OK) {
1648- g_warning("Unable to get entries: %s", failstring);
1649- }
1650-
1651- g_free(statement);
1652-
1653- if (tree != NULL) {
1654- g_print("\t<menus>\n");
1655- print_tree(tree, 2);
1656- g_print("\t</menus>\n");
1657- }
1658-
1659- g_print("</hudappinfo>\n");
1660- return;
1661-}
1662
1663=== removed file 'src/dump-app-info.h'
1664--- src/dump-app-info.h 2012-12-03 17:40:45 +0000
1665+++ src/dump-app-info.h 1970-01-01 00:00:00 +0000
1666@@ -1,30 +0,0 @@
1667-/*
1668-Prints out application info for debugging and CLI tools
1669-
1670-Copyright 2011 Canonical Ltd.
1671-
1672-Authors:
1673- Ted Gould <ted@canonical.com>
1674-
1675-This program is free software: you can redistribute it and/or modify it
1676-under the terms of the GNU General Public License version 3, as published
1677-by the Free Software Foundation.
1678-
1679-This program is distributed in the hope that it will be useful, but
1680-WITHOUT ANY WARRANTY; without even the implied warranties of
1681-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1682-PURPOSE. See the GNU General Public License for more details.
1683-
1684-You should have received a copy of the GNU General Public License along
1685-with this program. If not, see <http://www.gnu.org/licenses/>.
1686-*/
1687-
1688-#ifndef __DUMP_APP_INFO_H__
1689-#define __DUMP_APP_INFO_H__
1690-
1691-#include <glib.h>
1692-#include <sqlite3.h>
1693-
1694-void dump_app_info (const gchar * app, const gchar * domain, sqlite3 * db);
1695-
1696-#endif /* __DUMP_APP_INFO_H__ */
1697
1698=== removed file 'src/hud-cli.c'
1699--- src/hud-cli.c 2013-01-22 20:39:37 +0000
1700+++ src/hud-cli.c 1970-01-01 00:00:00 +0000
1701@@ -1,237 +0,0 @@
1702-/*
1703-Small utility to excersise the HUD from the command line
1704-
1705-Copyright 2011 Canonical Ltd.
1706-
1707-Authors:
1708- Ted Gould <ted@canonical.com>
1709-
1710-This program is free software: you can redistribute it and/or modify it
1711-under the terms of the GNU General Public License version 3, as published
1712-by the Free Software Foundation.
1713-
1714-This program is distributed in the hope that it will be useful, but
1715-WITHOUT ANY WARRANTY; without even the implied warranties of
1716-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1717-PURPOSE. See the GNU General Public License for more details.
1718-
1719-You should have received a copy of the GNU General Public License along
1720-with this program. If not, see <http://www.gnu.org/licenses/>.
1721-*/
1722-
1723-#include <glib.h>
1724-#include <gio/gunixinputstream.h>
1725-#include <gtk/gtk.h>
1726-#include <unistd.h>
1727-#include <stdio.h>
1728-#include <readline/readline.h>
1729-#include <readline/history.h>
1730-#include <stdlib.h>
1731-#include <curses.h>
1732-
1733-#include "shared-values.h"
1734-#include "hud.interface.h"
1735-
1736-
1737-static void print_suggestions(const char * query);
1738-static GDBusProxy * proxy = NULL;
1739-static GVariant * last_key = NULL;
1740-static void update(char *string);
1741-void sighandler(int);
1742-
1743-WINDOW *twindow = NULL;
1744-int use_curses = 0;
1745-
1746-int
1747-main (int argc, char *argv[])
1748-{
1749- int single_char;
1750- int pos = 0;
1751-
1752- char *line = (char*) malloc(256 * sizeof(char));
1753-
1754- signal(SIGINT, sighandler);
1755-
1756- GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
1757- g_return_val_if_fail(session != NULL, 1);
1758-
1759- GDBusNodeInfo * nodeinfo = g_dbus_node_info_new_for_xml(hud_interface, NULL);
1760- g_return_val_if_fail(nodeinfo != NULL, 1);
1761-
1762- GDBusInterfaceInfo * ifaceinfo = g_dbus_node_info_lookup_interface(nodeinfo, DBUS_IFACE);
1763- g_return_val_if_fail(ifaceinfo != NULL, 1);
1764-
1765- proxy = g_dbus_proxy_new_sync(session,
1766- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
1767- ifaceinfo,
1768- DBUS_NAME,
1769- DBUS_PATH,
1770- DBUS_IFACE,
1771- NULL, NULL);
1772- g_return_val_if_fail(proxy != NULL, 1);
1773-
1774-
1775- // reading from pipe
1776- if (!isatty (STDIN_FILENO) ) {
1777- size_t a;
1778- int r;
1779- r = getline (&line, &a, stdin);
1780-
1781- if ( r == -1 ){
1782- perror("Error reading from pipe");
1783- exit(EXIT_FAILURE);
1784- }
1785-
1786- // get rid of newline
1787- if( line[r-1] == '\n' )
1788- line[r-1] = '\0';
1789-
1790- printf("\nsearch token: %s\n", line);
1791- print_suggestions( line );
1792- }
1793- // read command line parameter - hud-cli "search string"
1794- else if( argc > 1 ){
1795- printf("\nsearch token: %s\n", argv[1]);
1796- print_suggestions( argv[1] );
1797- }
1798- // interactive mode
1799- else{
1800- use_curses = 1;
1801-
1802- twindow = initscr();
1803- cbreak();
1804- keypad(stdscr, TRUE);
1805- noecho();
1806-
1807- /* initialize the query screen */
1808- update( "" );
1809-
1810- /* interactive shell interface */
1811- while( 1 ){
1812-
1813- single_char = getch();
1814- /* need to go left in the buffer */
1815- if ( single_char == KEY_BACKSPACE ){
1816- /* don't go too far left */
1817- if( pos > 0 ){
1818- pos--;
1819- line[pos] = '\0';
1820- update( line );
1821- }
1822- else
1823- ; /* we are at the beginning of the buffer already */
1824- }
1825- /* ENTER will trigger the action for the first selected suggestion */
1826- else if ( single_char == '\n' ){
1827-
1828- /* FIXME: execute action on RETURN */
1829- break;
1830- }
1831- /* add character to the buffer and terminate string */
1832- else if ( single_char != KEY_RESIZE ) {
1833- if ( pos < 256 -1 ){ // -1 for \0
1834- line[pos] = single_char;
1835- line[pos+1] = '\0';
1836- pos++;
1837- update( line );
1838- }
1839- else {
1840-
1841- }
1842- }
1843- else{
1844- // nothing to do
1845- }
1846- }
1847- endwin();
1848- }
1849-
1850- free(line);
1851-
1852- g_dbus_node_info_unref(nodeinfo);
1853- g_object_unref(session);
1854-
1855- return 0;
1856-}
1857-
1858-static void
1859-update( char *string ){
1860-
1861- werase(twindow);
1862- mvwprintw(twindow, 7, 10, "Search: %s", string);
1863-
1864- print_suggestions( string );
1865-
1866- // move cursor back to input line
1867- wmove( twindow, 7, 10 + 8 + strlen(string) );
1868-
1869- refresh();
1870-}
1871-
1872-
1873-static void
1874-print_suggestions (const char *query)
1875-{
1876- GError * error = NULL;
1877- GVariantBuilder querybuilder;
1878- g_variant_builder_init(&querybuilder, G_VARIANT_TYPE_TUPLE);
1879- g_variant_builder_add_value(&querybuilder, g_variant_new_string(query));
1880- g_variant_builder_add_value(&querybuilder, g_variant_new_int32(5));
1881-
1882- GVariant * suggests = g_dbus_proxy_call_sync(proxy,
1883- "StartQuery",
1884- g_variant_builder_end(&querybuilder),
1885- G_DBUS_CALL_FLAGS_NONE,
1886- -1,
1887- NULL,
1888- &error);
1889-
1890- if (error != NULL) {
1891- g_warning("Unable to get suggestions: %s", error->message);
1892- g_error_free(error);
1893- return ;
1894- }
1895-
1896- GVariant * target = g_variant_get_child_value(suggests, 0);
1897- g_variant_unref(target);
1898-
1899- GVariant * suggestions = g_variant_get_child_value(suggests, 1);
1900- GVariantIter iter;
1901- g_variant_iter_init(&iter, suggestions);
1902- gchar * suggestion = NULL;
1903- gchar * appicon = NULL;
1904- gchar * icon = NULL;
1905- gchar * complete = NULL;
1906- gchar * accel = NULL;
1907- GVariant * key = NULL;
1908-
1909- last_key = NULL;
1910-
1911- int i=0;
1912- char *clean_line;
1913-
1914- while (g_variant_iter_loop(&iter, "(sssssv)", &suggestion, &appicon, &icon, &complete, &accel, &key)) {
1915- if( use_curses)
1916- mvwprintw(twindow, 9 + i, 15, "%s", suggestion);
1917- else{
1918- pango_parse_markup(suggestion, -1, 0, NULL, &clean_line, NULL, NULL);
1919- printf("\t%s\n", clean_line);
1920- free(clean_line);
1921- }
1922- i++;
1923-
1924- }
1925-
1926- g_variant_unref(suggestions);
1927-
1928- /* NOTE: Ignoring the Query Key as we're not handling the signal now
1929- and just letting it timeout. */
1930-
1931- return;
1932-}
1933-
1934-void sighandler(int signal){
1935- endwin();
1936- g_object_unref(proxy);
1937- exit(EXIT_SUCCESS);
1938-}
1939
1940=== removed file 'src/hud-dump-application.c'
1941--- src/hud-dump-application.c 2012-12-03 17:40:45 +0000
1942+++ src/hud-dump-application.c 1970-01-01 00:00:00 +0000
1943@@ -1,73 +0,0 @@
1944-/*
1945-Small utility to dump application info in the HUD usage DB
1946-
1947-Copyright 2011 Canonical Ltd.
1948-
1949-Authors:
1950- Ted Gould <ted@canonical.com>
1951-
1952-This program is free software: you can redistribute it and/or modify it
1953-under the terms of the GNU General Public License version 3, as published
1954-by the Free Software Foundation.
1955-
1956-This program is distributed in the hope that it will be useful, but
1957-WITHOUT ANY WARRANTY; without even the implied warranties of
1958-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1959-PURPOSE. See the GNU General Public License for more details.
1960-
1961-You should have received a copy of the GNU General Public License along
1962-with this program. If not, see <http://www.gnu.org/licenses/>.
1963-*/
1964-
1965-#include <glib.h>
1966-#include "dump-app-info.h"
1967-
1968-int
1969-main (int argv, char * argc[])
1970-{
1971- if (argv != 2 && argv != 3) {
1972- g_printerr("Usage: %s <desktop file path> [gettext domain]\n", argc[0]);
1973- return 1;
1974- }
1975-
1976- const gchar * basecachedir = g_getenv("HUD_CACHE_DIR");
1977- if (basecachedir == NULL) {
1978- basecachedir = g_get_user_cache_dir();
1979- }
1980-
1981- gchar * cachedir = g_build_filename(basecachedir, "indicator-appmenu", NULL);
1982- if (!g_file_test(cachedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
1983- g_warning("Cache directory '%s' doesn't exist", cachedir);
1984- return 1;
1985- }
1986- g_free(cachedir);
1987-
1988- gchar * cachefile = g_build_filename(basecachedir, "indicator-appmenu", "hud-usage-log.sqlite", NULL);
1989- gboolean db_exists = g_file_test(cachefile, G_FILE_TEST_EXISTS);
1990-
1991- if (!db_exists) {
1992- g_warning("There is no HUD usage log: %s", cachefile);
1993- return 1;
1994- }
1995-
1996- sqlite3 * db;
1997- int open_status = sqlite3_open(cachefile, &db);
1998-
1999- if (open_status != SQLITE_OK) {
2000- g_warning("Error opening usage DB: %s", cachefile);
2001- sqlite3_close(db);
2002- return 1;
2003- }
2004-
2005- gchar * domain = NULL;
2006- if (argv == 3) {
2007- domain = argc[2];
2008- }
2009-
2010- dump_app_info(argc[1], domain, db);
2011-
2012- sqlite3_close(db);
2013- g_free(cachefile);
2014-
2015- return 0;
2016-}
2017
2018=== removed file 'src/hud-list-applications'
2019--- src/hud-list-applications 2012-12-03 17:40:45 +0000
2020+++ src/hud-list-applications 1970-01-01 00:00:00 +0000
2021@@ -1,11 +0,0 @@
2022-#!/bin/sh
2023-
2024-if [ -n $HUD_CACHE_DIR ]; then
2025- HUD_CACHE_DIR=~/.cache
2026-fi;
2027-
2028-FINAL_DIR="$HUD_CACHE_DIR/indicator-appmenu"
2029-
2030-if test -e $FINAL_DIR/hud-usage-log.sqlite; then
2031- sqlite3 $FINAL_DIR/hud-usage-log.sqlite "select distinct application from usage"
2032-fi
2033
2034=== removed file 'src/hud-service.c'
2035--- src/hud-service.c 2013-01-22 20:39:37 +0000
2036+++ src/hud-service.c 1970-01-01 00:00:00 +0000
2037@@ -1,335 +0,0 @@
2038-/*
2039- * Copyright © 2012 Canonical Ltd.
2040- *
2041- * This program is free software: you can redistribute it and/or modify it
2042- * under the terms of the GNU General Public License version 3, as
2043- * published by the Free Software Foundation.
2044- *
2045- * This program is distributed in the hope that it will be useful, but
2046- * WITHOUT ANY WARRANTY; without even the implied warranties of
2047- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2048- * PURPOSE. See the GNU General Public License for more details.
2049- *
2050- * You should have received a copy of the GNU General Public License along
2051- * with this program. If not, see <http://www.gnu.org/licenses/>.
2052- *
2053- * Author: Ryan Lortie <desrt@desrt.ca>
2054- */
2055-
2056-#define G_LOG_DOMAIN "hud-service"
2057-
2058-#include "config.h"
2059-
2060-#include <glib.h>
2061-#include <gio/gio.h>
2062-#include <stdlib.h>
2063-#include <locale.h>
2064-#include <libintl.h>
2065-
2066-#include "hudappindicatorsource.h"
2067-#include "hudindicatorsource.h"
2068-#include "hudwebappsource.h"
2069-#include "hudwindowsource.h"
2070-#include "huddebugsource.h"
2071-#include "hudsourcelist.h"
2072-#include "hudsettings.h"
2073-
2074-#include "hud.interface.h"
2075-#include "shared-values.h"
2076-#include "hudquery.h"
2077-
2078-/* The return value of 'StartQuery' and the signal parameters for
2079- * 'UpdatedQuery' are the same, so use a utility function for both.
2080- */
2081-GVariant *
2082-describe_query (HudQuery *query)
2083-{
2084- GVariantBuilder builder;
2085- gint n, i;
2086-
2087- n = hud_query_get_n_results (query);
2088-
2089- g_variant_builder_init (&builder, G_VARIANT_TYPE ("(sa(sssssv)v)"));
2090-
2091- /* Target */
2092- g_variant_builder_add (&builder, "s", "");
2093-
2094- /* List of results */
2095- g_variant_builder_open (&builder, G_VARIANT_TYPE ("a(sssssv)"));
2096- for (i = 0; i < n; i++)
2097- {
2098- HudResult *result = hud_query_get_result_by_index (query, i);
2099- HudItem *item;
2100-
2101- item = hud_result_get_item (result);
2102-
2103- g_variant_builder_add (&builder, "(sssssv)",
2104- hud_result_get_html_description (result),
2105- hud_item_get_app_icon (item),
2106- hud_item_get_item_icon (item),
2107- "" /* complete text */ , "" /* accel */,
2108- g_variant_new_uint64 (hud_item_get_id (item)));
2109- }
2110- g_variant_builder_close (&builder);
2111-
2112- /* Query key */
2113- g_variant_builder_add (&builder, "v", hud_query_get_query_key (query));
2114-
2115- return g_variant_builder_end (&builder);
2116-}
2117-
2118-static void
2119-query_changed (HudQuery *query,
2120- gpointer user_data)
2121-{
2122- GDBusConnection *connection = user_data;
2123-
2124- g_debug ("emit UpdatedQuery signal");
2125-
2126- g_dbus_connection_emit_signal (connection, NULL, DBUS_PATH,
2127- DBUS_IFACE, "UpdatedQuery",
2128- describe_query (query), NULL);
2129-}
2130-
2131-static GVariant *
2132-unpack_platform_data (GVariant *parameters)
2133-{
2134- GVariant *platform_data;
2135- gchar *startup_id;
2136- guint32 timestamp;
2137-
2138- g_variant_get_child (parameters, 1, "u", &timestamp);
2139- startup_id = g_strdup_printf ("_TIME%u", timestamp);
2140- platform_data = g_variant_new_parsed ("{'desktop-startup-id': < %s >}", startup_id);
2141- g_free (startup_id);
2142-
2143- return g_variant_ref_sink (platform_data);
2144-}
2145-
2146-static gboolean
2147-drop_query_timeout (gpointer user_data)
2148-{
2149- g_object_unref (user_data);
2150-
2151- return G_SOURCE_REMOVE;
2152-}
2153-
2154-static void
2155-bus_method (GDBusConnection *connection,
2156- const gchar *sender,
2157- const gchar *object_path,
2158- const gchar *interface_name,
2159- const gchar *method_name,
2160- GVariant *parameters,
2161- GDBusMethodInvocation *invocation,
2162- gpointer user_data)
2163-{
2164- HudSource *source = user_data;
2165-
2166- if (g_str_equal (method_name, "StartQuery"))
2167- {
2168- const gchar *search_string;
2169- gint num_results;
2170- HudQuery *query;
2171-
2172- g_variant_get (parameters, "(&si)", &search_string, &num_results);
2173- g_debug ("'StartQuery' from %s: '%s', %d", sender, search_string, num_results);
2174- query = hud_query_new (source, search_string, num_results);
2175- g_signal_connect_object (query, "changed", G_CALLBACK (query_changed), connection, 0);
2176- g_dbus_method_invocation_return_value (invocation, describe_query (query));
2177- g_object_unref (query);
2178- }
2179-
2180- else if (g_str_equal (method_name, "ExecuteQuery"))
2181- {
2182- GVariant *platform_data;
2183- GVariant *item_key;
2184- guint64 key_value;
2185- HudItem *item;
2186-
2187- g_variant_get_child (parameters, 0, "v", &item_key);
2188-
2189- if (!g_variant_is_of_type (item_key, G_VARIANT_TYPE_UINT64))
2190- {
2191- g_debug ("'ExecuteQuery' from %s: incorrect item key (not uint64)", sender);
2192- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
2193- "item key has invalid format");
2194- g_variant_unref (item_key);
2195- return;
2196- }
2197-
2198- key_value = g_variant_get_uint64 (item_key);
2199- g_variant_unref (item_key);
2200-
2201- item = hud_item_lookup (key_value);
2202- g_debug ("'ExecuteQuery' from %s, item #%"G_GUINT64_FORMAT": %p", sender, key_value, item);
2203-
2204- if (item == NULL)
2205- {
2206- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
2207- "item specified by item key does not exist");
2208- return;
2209- }
2210-
2211- platform_data = unpack_platform_data (parameters);
2212- hud_item_activate (item, platform_data);
2213- g_variant_unref (platform_data);
2214-
2215- g_dbus_method_invocation_return_value (invocation, NULL);
2216- }
2217-
2218- else if (g_str_equal (method_name, "CloseQuery"))
2219- {
2220- GVariant *query_key;
2221- HudQuery *query;
2222-
2223- g_debug ("Got 'CloseQuery' from %s", sender);
2224-
2225- g_variant_get (parameters, "(v)", &query_key);
2226- query = hud_query_lookup (query_key);
2227- g_variant_unref (query_key);
2228-
2229- if (query != NULL)
2230- {
2231- g_signal_handlers_disconnect_by_func (query, query_changed, connection);
2232- /* Unity does 'CloseQuery' immediately followed by
2233- * 'StartQuery' on every keystroke. Delay the destruction of
2234- * the query for a moment just in case a 'StartQuery' is on the
2235- * way.
2236- *
2237- * That way we can avoid allowing the use count to drop to
2238- * zero only to be increased again back to 1. This prevents a
2239- * bunch of dbusmenu "closed"/"opened" calls being sent.
2240- */
2241- g_timeout_add (1000, drop_query_timeout, g_object_ref (query));
2242- hud_query_close (query);
2243- }
2244-
2245- /* always success -- they may have just been closing a timed out query */
2246- g_dbus_method_invocation_return_value (invocation, NULL);
2247- }
2248-}
2249-
2250-static GMainLoop *mainloop = NULL;
2251-
2252-static GDBusInterfaceInfo *
2253-get_iface_info (void)
2254-{
2255- GDBusInterfaceInfo *iface_info;
2256- GDBusNodeInfo *node_info;
2257- GError *error = NULL;
2258-
2259- node_info = g_dbus_node_info_new_for_xml (hud_interface, &error);
2260- g_assert_no_error (error);
2261-
2262- iface_info = g_dbus_node_info_lookup_interface (node_info, DBUS_IFACE);
2263- g_assert (iface_info != NULL);
2264-
2265- g_dbus_interface_info_ref (iface_info);
2266- g_dbus_node_info_unref (node_info);
2267-
2268- return iface_info;
2269-}
2270-
2271-static void
2272-bus_acquired_cb (GDBusConnection *connection,
2273- const gchar *name,
2274- gpointer user_data)
2275-{
2276- HudSource *source = user_data;
2277- GDBusInterfaceVTable vtable = {
2278- bus_method
2279- };
2280- GError *error = NULL;
2281-
2282- g_debug ("Bus acquired (guid %s)", g_dbus_connection_get_guid (connection));
2283-
2284- if (!g_dbus_connection_register_object (connection, DBUS_PATH, get_iface_info (), &vtable, source, NULL, &error))
2285- {
2286- g_warning ("Unable to register path '"DBUS_PATH"': %s", error->message);
2287- g_main_loop_quit (mainloop);
2288- g_error_free (error);
2289- }
2290-}
2291-
2292-static void
2293-name_acquired_cb (GDBusConnection *connection,
2294- const gchar *name,
2295- gpointer user_data)
2296-{
2297- g_debug ("Acquired bus name '%s'", name);
2298-}
2299-
2300-static void
2301-name_lost_cb (GDBusConnection *connection,
2302- const gchar *name,
2303- gpointer user_data)
2304-{
2305- g_warning ("Unable to get name '%s'", name);
2306- g_main_loop_quit (mainloop);
2307-}
2308-
2309-int
2310-main (int argc, char **argv)
2311-{
2312- HudWindowSource *window_source;
2313- HudSourceList *source_list;
2314-
2315- setlocale (LC_ALL, "");
2316- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
2317- textdomain (GETTEXT_PACKAGE);
2318-
2319- hud_settings_init ();
2320-
2321- source_list = hud_source_list_new ();
2322-
2323- /* we will eventually pull GtkMenu out of this, so keep it around */
2324- window_source = hud_window_source_new ();
2325- hud_source_list_add (source_list, HUD_SOURCE (window_source));
2326-
2327- {
2328- HudIndicatorSource *source;
2329-
2330- source = hud_indicator_source_new ();
2331- hud_source_list_add (source_list, HUD_SOURCE (source));
2332- g_object_unref (source);
2333- }
2334-
2335- {
2336- HudAppIndicatorSource *source;
2337-
2338- source = hud_app_indicator_source_new ();
2339- hud_source_list_add (source_list, HUD_SOURCE (source));
2340- g_object_unref (source);
2341- }
2342-
2343- {
2344- HudWebappSource *source;
2345-
2346- source = hud_webapp_source_new (window_source);
2347- hud_source_list_add (source_list, HUD_SOURCE (source));
2348-
2349- g_object_unref (G_OBJECT (source));
2350- }
2351-
2352- if (getenv ("HUD_DEBUG_SOURCE"))
2353- {
2354- HudDebugSource *source;
2355-
2356- source = hud_debug_source_new ();
2357- hud_source_list_add (source_list, HUD_SOURCE (source));
2358- g_object_unref (source);
2359- }
2360-
2361- g_bus_own_name (G_BUS_TYPE_SESSION, DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE,
2362- bus_acquired_cb, name_acquired_cb, name_lost_cb, source_list, NULL);
2363-
2364- mainloop = g_main_loop_new (NULL, FALSE);
2365- g_main_loop_run (mainloop);
2366- g_main_loop_unref (mainloop);
2367-
2368- g_object_unref (window_source);
2369- g_object_unref (source_list);
2370-
2371- return 0;
2372-}
2373
2374=== removed file 'src/hud-verify-app-info.c'
2375--- src/hud-verify-app-info.c 2013-01-22 20:39:37 +0000
2376+++ src/hud-verify-app-info.c 1970-01-01 00:00:00 +0000
2377@@ -1,100 +0,0 @@
2378-/*
2379-Verify the validity of the App Info file to make sure it parses
2380-
2381-Copyright 2011 Canonical Ltd.
2382-
2383-Authors:
2384- Ted Gould <ted@canonical.com>
2385-
2386-This program is free software: you can redistribute it and/or modify it
2387-under the terms of the GNU General Public License version 3, as published
2388-by the Free Software Foundation.
2389-
2390-This program is distributed in the hope that it will be useful, but
2391-WITHOUT ANY WARRANTY; without even the implied warranties of
2392-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2393-PURPOSE. See the GNU General Public License for more details.
2394-
2395-You should have received a copy of the GNU General Public License along
2396-with this program. If not, see <http://www.gnu.org/licenses/>.
2397-*/
2398-
2399-#include <unistd.h>
2400-#include <glib-object.h>
2401-#include <glib/gstdio.h>
2402-#include "load-app-info.h"
2403-#include "create-db.h"
2404-
2405-static void
2406-build_db (sqlite3 * db)
2407-{
2408- /* Create the table */
2409- int exec_status = SQLITE_OK;
2410- gchar * failstring = NULL;
2411- exec_status = sqlite3_exec(db,
2412- create_db,
2413- NULL, NULL, &failstring);
2414- if (exec_status != SQLITE_OK) {
2415- g_warning("Unable to create table: %s", failstring);
2416- }
2417-
2418- /* Import data from the system */
2419-
2420- return;
2421-}
2422-
2423-int
2424-main (int argv, char * argc[])
2425-{
2426- gboolean passed = TRUE;
2427-
2428- if (argv != 2) {
2429- g_printerr("Usage: %s <app-info file path>\n", argc[0]);
2430- return 1;
2431- }
2432-
2433- gchar * filename = NULL;
2434- gint tmpfile = g_file_open_tmp("hud-verify-app-info-temp-db-XXXXXX", &filename, NULL);
2435-
2436- if (tmpfile < 0) {
2437- passed = FALSE;
2438- } else {
2439-
2440- close(tmpfile);
2441- /* NOTE: there is a small security bug here in that we're closing the
2442- file and reopening it, so the temp isn't really guaranteed to be
2443- safe. But, I don't think we're really worried about security in this
2444- utility. */
2445-
2446- sqlite3 * db = NULL;
2447- int open_status = sqlite3_open(filename, &db);
2448-
2449- if (open_status != SQLITE_OK) {
2450- g_warning("Error opening usage DB: %s", filename);
2451- passed = FALSE;
2452- } else {
2453-
2454- /* Create the table in the DB */
2455- build_db(db);
2456-
2457- passed = load_app_info(argc[1], db);
2458-
2459- sqlite3_close(db);
2460- }
2461- }
2462-
2463- if (filename != NULL) {
2464- if (g_getenv("HUD_VERIFY_NO_UNLINK") == NULL) {
2465- g_unlink(filename);
2466- } else {
2467- g_print("Temp db '%s' not deleted\n", filename);
2468- }
2469- g_free(filename);
2470- }
2471-
2472- if (passed) {
2473- return 0;
2474- } else {
2475- return 1;
2476- }
2477-}
2478
2479=== removed file 'src/hud.xml'
2480--- src/hud.xml 2012-12-03 17:40:45 +0000
2481+++ src/hud.xml 1970-01-01 00:00:00 +0000
2482@@ -1,37 +0,0 @@
2483-<?xml version="1.0" encoding="UTF-8"?>
2484-<node name="/">
2485- <interface name="com.canonical.hud">
2486-<!-- Properties -->
2487- <!-- None -->
2488-
2489-<!-- Functions -->
2490- <method name="StartQuery">
2491- <!-- in -->
2492- <arg type="s" name="query" direction="in" />
2493- <arg type="i" name="entries" direction="in" />
2494- <!-- out -->
2495- <arg type="s" name="target" direction="out" />
2496- <arg type="a(sssssv)" name="suggestions" direction="out" />
2497- <arg type="v" name="querykey" direction="out" />
2498- </method>
2499-
2500- <method name="ExecuteQuery">
2501- <arg type="v" name="key" direction="in" />
2502- <arg type="u" name="timestamp" direction="in" />
2503- </method>
2504-
2505- <method name="CloseQuery">
2506- <arg type="v" name="querykey" direction="in" />
2507- </method>
2508-
2509-<!-- Signals -->
2510- <signal name="UpdatedQuery">
2511- <arg type="s" name="target" direction="out" />
2512- <arg type="a(sssssv)" name="suggestions" direction="out" />
2513- <arg type="v" name="querykey" direction="out" />
2514- </signal>
2515-
2516-<!-- End of interesting stuff -->
2517-
2518- </interface>
2519-</node>
2520
2521=== removed file 'src/hudappindicatorsource.c'
2522--- src/hudappindicatorsource.c 2012-12-03 17:40:45 +0000
2523+++ src/hudappindicatorsource.c 1970-01-01 00:00:00 +0000
2524@@ -1,432 +0,0 @@
2525-/*
2526- * Copyright © 2012 Canonical Ltd.
2527- *
2528- * This program is free software: you can redistribute it and/or modify it
2529- * under the terms of the GNU General Public License version 3, as
2530- * published by the Free Software Foundation.
2531- *
2532- * This program is distributed in the hope that it will be useful, but
2533- * WITHOUT ANY WARRANTY; without even the implied warranties of
2534- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2535- * PURPOSE. See the GNU General Public License for more details.
2536- *
2537- * You should have received a copy of the GNU General Public License along
2538- * with this program. If not, see <http://www.gnu.org/licenses/>.
2539- *
2540- * Authors: Ryan Lortie <desrt@desrt.ca>
2541- * Ted Gould <ted@canonical.com>
2542- */
2543-
2544-#define G_LOG_DOMAIN "hudappindicatorsource"
2545-
2546-#include "hudappindicatorsource.h"
2547-
2548-#include <glib/gi18n.h>
2549-#include <gio/gio.h>
2550-
2551-#include "hudsettings.h"
2552-#include "huddbusmenucollector.h"
2553-#include "hudsource.h"
2554-
2555-/**
2556- * SECTION:hudappindicatorsource
2557- * @title: HudAppIndicatorSource
2558- * @short_description: a #HudSource to search through the application
2559- * indicators
2560- *
2561- * #HudAppIndicatorSource searches through the menus of application
2562- * indicators.
2563- **/
2564-
2565-/**
2566- * HudAppIndicatorSource:
2567- *
2568- * This is an opaque structure type.
2569- **/
2570-
2571-#define APP_INDICATOR_SERVICE_BUS_NAME "com.canonical.indicator.application"
2572-#define APP_INDICATOR_SERVICE_OBJECT_PATH "/com/canonical/indicator/application/service"
2573-#define APP_INDICATOR_SERVICE_IFACE "com.canonical.indicator.application.service"
2574-
2575-struct _HudAppIndicatorSource
2576-{
2577- GObject parent_instance;
2578-
2579- GSequence *indicators;
2580- guint subscription;
2581- GCancellable *cancellable;
2582- gint use_count;
2583- gboolean ready;
2584-};
2585-
2586-typedef GObjectClass HudAppIndicatorSourceClass;
2587-
2588-static void hud_app_indicator_source_iface_init (HudSourceInterface *iface);
2589-G_DEFINE_TYPE_WITH_CODE (HudAppIndicatorSource, hud_app_indicator_source, G_TYPE_OBJECT,
2590- G_IMPLEMENT_INTERFACE (HUD_TYPE_SOURCE, hud_app_indicator_source_iface_init))
2591-
2592-static void
2593-hud_app_indicator_source_collector_changed (HudSource *collector,
2594- gpointer user_data)
2595-{
2596- HudAppIndicatorSource *source = user_data;
2597-
2598- hud_source_changed (HUD_SOURCE (source));
2599-}
2600-
2601-static void
2602-hud_app_indicator_source_add_indicator (HudAppIndicatorSource *source,
2603- GVariant *description)
2604-{
2605- HudDbusmenuCollector *collector;
2606- const gchar *dbus_name;
2607- const gchar *dbus_path;
2608- GSequenceIter *iter;
2609- const gchar *id;
2610- const gchar *icon_name;
2611- gint32 position;
2612- gchar *title;
2613-
2614- g_variant_get_child (description, 0, "&s", &icon_name);
2615- g_variant_get_child (description, 1, "i", &position);
2616- g_variant_get_child (description, 2, "&s", &dbus_name);
2617- g_variant_get_child (description, 3, "&o", &dbus_path);
2618- g_variant_get_child (description, 8, "&s", &id);
2619- g_variant_get_child (description, 9, "s", &title);
2620-
2621- if (title[0] == '\0')
2622- {
2623- g_free (title);
2624- /* TRANSLATORS: This is used for Application indicators that
2625- are not providing a title string. The '%s' represents the
2626- unique ID that the app indicator provides, but it is usually
2627- the package name and not generally human readable. An example
2628- for Network Manager would be 'nm-applet'. */
2629- title = g_strdup_printf(_("Untitled Indicator (%s)"), id);
2630- }
2631- g_debug ("adding appindicator %s at %d ('%s', %s, %s, %s)", id, position, title, icon_name, dbus_name, dbus_path);
2632-
2633- collector = hud_dbusmenu_collector_new_for_endpoint (id, title, icon_name,
2634- hud_settings.indicator_penalty,
2635- dbus_name, dbus_path);
2636- g_signal_connect (collector, "changed", G_CALLBACK (hud_app_indicator_source_collector_changed), source);
2637-
2638- /* If query is active, mark new app indicator as used. */
2639- if (source->use_count)
2640- hud_source_use (HUD_SOURCE (collector));
2641-
2642- iter = g_sequence_get_iter_at_pos (source->indicators, position);
2643- g_sequence_insert_before (iter, collector);
2644- g_free (title);
2645-}
2646-
2647-static void
2648-hud_app_indicator_source_remove_indicator (HudAppIndicatorSource *source,
2649- GVariant *description)
2650-{
2651- GSequenceIter *iter;
2652- gint32 position;
2653-
2654- g_variant_get_child (description, 0, "i", &position);
2655-
2656- g_debug ("removing appindicator at %d", position);
2657-
2658- iter = g_sequence_get_iter_at_pos (source->indicators, position);
2659- if (!g_sequence_iter_is_end (iter))
2660- {
2661- HudDbusmenuCollector *collector;
2662-
2663- collector = g_sequence_get (iter);
2664- g_signal_handlers_disconnect_by_func (collector, hud_app_indicator_source_collector_changed, source);
2665- /* Drop use count if we added one... */
2666- if (source->use_count)
2667- hud_source_unuse (HUD_SOURCE (collector));
2668- g_sequence_remove (iter);
2669- }
2670-}
2671-
2672-static void
2673-hud_app_indicator_source_dbus_signal (GDBusConnection *connection,
2674- const gchar *sender_name,
2675- const gchar *object_path,
2676- const gchar *interface_name,
2677- const gchar *signal_name,
2678- GVariant *parameters,
2679- gpointer user_data)
2680-{
2681- HudAppIndicatorSource *source = user_data;
2682-
2683- g_debug ("got signal");
2684-
2685- if (!source->ready)
2686- {
2687- g_debug ("not ready, so ignoring signal");
2688- return;
2689- }
2690-
2691- if (g_str_equal (signal_name, "ApplicationAdded"))
2692- {
2693- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(sisossssss)")))
2694- return;
2695-
2696- hud_app_indicator_source_add_indicator (source, parameters);
2697- hud_source_changed (HUD_SOURCE (source));
2698- }
2699-
2700- else if (g_str_equal (signal_name, "ApplicationRemoved"))
2701- {
2702- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(i)")))
2703- return;
2704-
2705- hud_app_indicator_source_remove_indicator (source, parameters);
2706- hud_source_changed (HUD_SOURCE (source));
2707- }
2708-
2709- else if (g_str_equal (signal_name, "ApplicationTitleChanged"))
2710- {
2711- GSequenceIter *iter;
2712- const gchar *title;
2713- gint32 position;
2714-
2715- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(is)")))
2716- return;
2717-
2718- g_variant_get (parameters, "(i&s)", &position, &title);
2719-
2720- g_debug ("changing title of appindicator at %d to '%s'", position, title);
2721-
2722- iter = g_sequence_get_iter_at_pos (source->indicators, position);
2723- if (!g_sequence_iter_is_end (iter))
2724- {
2725- HudDbusmenuCollector *collector;
2726-
2727- collector = g_sequence_get (iter);
2728- hud_dbusmenu_collector_set_prefix (collector, title);
2729- }
2730- }
2731-
2732- else if (g_str_equal (signal_name, "ApplicationIconChanged"))
2733- {
2734- GSequenceIter *iter;
2735- const gchar *icon;
2736- gint32 position;
2737-
2738- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(iss)")))
2739- return;
2740-
2741- g_variant_get (parameters, "(i&ss)", &position, &icon, NULL);
2742-
2743- g_debug ("changing icon of appindicator at %d to '%s'", position, icon);
2744-
2745- iter = g_sequence_get_iter_at_pos (source->indicators, position);
2746- if (!g_sequence_iter_is_end (iter))
2747- {
2748- HudDbusmenuCollector *collector;
2749-
2750- collector = g_sequence_get (iter);
2751- hud_dbusmenu_collector_set_icon (collector, icon);
2752- }
2753- }
2754-}
2755-
2756-static void
2757-hud_app_indicator_source_ready (GObject *connection,
2758- GAsyncResult *result,
2759- gpointer user_data)
2760-{
2761- HudAppIndicatorSource *source = user_data;
2762- GError *error = NULL;
2763- GVariant *reply;
2764-
2765- g_debug ("GetApplications returned");
2766-
2767- g_clear_object (&source->cancellable);
2768-
2769- reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (connection), result, &error);
2770-
2771- if (reply)
2772- {
2773- GVariant *description;
2774- GVariantIter *iter;
2775-
2776- g_assert (!source->ready);
2777- source->ready = TRUE;
2778-
2779- g_debug ("going ready");
2780-
2781- g_variant_get (reply, "(a(sisossssss))", &iter);
2782- while ((description = g_variant_iter_next_value (iter)))
2783- {
2784- hud_app_indicator_source_add_indicator (source, description);
2785- g_variant_unref (description);
2786- }
2787- g_variant_iter_free (iter);
2788- g_variant_unref (reply);
2789-
2790- hud_source_changed (HUD_SOURCE (source));
2791- }
2792- else
2793- {
2794- g_warning ("GetApplications returned an error: %s", error->message);
2795- g_error_free (error);
2796- }
2797-
2798- g_object_unref (source);
2799-
2800- g_debug ("done handling GetApplications reply");
2801-}
2802-
2803-static void
2804-hud_app_indicator_source_name_appeared (GDBusConnection *connection,
2805- const gchar *name,
2806- const gchar *name_owner,
2807- gpointer user_data)
2808-{
2809- HudAppIndicatorSource *source = user_data;
2810-
2811- g_debug ("name appeared (owner is %s)", name_owner);
2812-
2813- g_assert (source->subscription == 0);
2814- source->subscription = g_dbus_connection_signal_subscribe (connection, name_owner,
2815- APP_INDICATOR_SERVICE_IFACE, NULL,
2816- APP_INDICATOR_SERVICE_OBJECT_PATH, NULL,
2817- G_DBUS_SIGNAL_FLAGS_NONE,
2818- hud_app_indicator_source_dbus_signal,
2819- source, NULL);
2820-
2821- g_assert (source->cancellable == NULL);
2822- source->cancellable = g_cancellable_new ();
2823- g_dbus_connection_call (connection, name_owner, APP_INDICATOR_SERVICE_OBJECT_PATH, APP_INDICATOR_SERVICE_IFACE,
2824- "GetApplications", NULL, G_VARIANT_TYPE ("(a(sisossssss))"),
2825- G_DBUS_CALL_FLAGS_NONE, -1, source->cancellable,
2826- hud_app_indicator_source_ready, g_object_ref (source));
2827-}
2828-
2829-static void
2830-hud_app_indicator_source_name_vanished (GDBusConnection *connection,
2831- const gchar *name,
2832- gpointer user_data)
2833-{
2834- HudAppIndicatorSource *source = user_data;
2835-
2836- g_debug ("name vanished");
2837-
2838- if (source->subscription > 0)
2839- {
2840- g_dbus_connection_signal_unsubscribe (connection, source->subscription);
2841- source->subscription = 0;
2842- }
2843-
2844- if (source->cancellable)
2845- {
2846- g_cancellable_cancel (source->cancellable);
2847- g_clear_object (&source->cancellable);
2848- }
2849-
2850- if (source->ready)
2851- {
2852- GSequenceIter *iter;
2853-
2854- source->ready = FALSE;
2855-
2856- iter = g_sequence_get_begin_iter (source->indicators);
2857- while (!g_sequence_iter_is_end (iter))
2858- {
2859- HudDbusmenuCollector *collector;
2860- GSequenceIter *next;
2861-
2862- collector = g_sequence_get (iter);
2863- g_signal_handlers_disconnect_by_func (collector, hud_app_indicator_source_collector_changed, source);
2864- next = g_sequence_iter_next (iter);
2865- g_sequence_remove (iter);
2866- iter = next;
2867- }
2868-
2869- hud_source_changed (HUD_SOURCE (source));
2870- }
2871-}
2872-
2873-static void
2874-hud_app_indicator_source_use (HudSource *hud_source)
2875-{
2876- HudAppIndicatorSource *source = HUD_APP_INDICATOR_SOURCE (hud_source);
2877-
2878- if (source->use_count == 0)
2879- g_sequence_foreach (source->indicators, (GFunc) hud_source_use, NULL);
2880-
2881- source->use_count++;
2882-}
2883-
2884-static void
2885-hud_app_indicator_source_unuse (HudSource *hud_source)
2886-{
2887- HudAppIndicatorSource *source = HUD_APP_INDICATOR_SOURCE (hud_source);
2888-
2889- g_return_if_fail (source->use_count > 0);
2890-
2891- source->use_count--;
2892-
2893- if (source->use_count == 0)
2894- g_sequence_foreach (source->indicators, (GFunc) hud_source_unuse, NULL);
2895-}
2896-
2897-static void
2898-hud_app_indicator_source_search (HudSource *hud_source,
2899- GPtrArray *results_array,
2900- HudTokenList *search_tokens)
2901-{
2902- HudAppIndicatorSource *source = HUD_APP_INDICATOR_SOURCE (hud_source);
2903- GSequenceIter *iter;
2904-
2905- iter = g_sequence_get_begin_iter (source->indicators);
2906-
2907- while (!g_sequence_iter_is_end (iter))
2908- {
2909- hud_source_search (g_sequence_get (iter), results_array, search_tokens);
2910- iter = g_sequence_iter_next (iter);
2911- }
2912-}
2913-
2914-static void
2915-hud_app_indicator_source_finalize (GObject *object)
2916-{
2917- g_assert_not_reached ();
2918-}
2919-
2920-static void
2921-hud_app_indicator_source_init (HudAppIndicatorSource *source)
2922-{
2923- g_debug ("online");
2924-
2925- source->indicators = g_sequence_new (g_object_unref);
2926- g_bus_watch_name (G_BUS_TYPE_SESSION, APP_INDICATOR_SERVICE_BUS_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE,
2927- hud_app_indicator_source_name_appeared, hud_app_indicator_source_name_vanished,
2928- g_object_ref (source), g_object_unref);
2929-}
2930-
2931-static void
2932-hud_app_indicator_source_iface_init (HudSourceInterface *iface)
2933-{
2934- iface->use = hud_app_indicator_source_use;
2935- iface->unuse = hud_app_indicator_source_unuse;
2936- iface->search = hud_app_indicator_source_search;
2937-}
2938-
2939-static void
2940-hud_app_indicator_source_class_init (HudAppIndicatorSourceClass *class)
2941-{
2942- class->finalize = hud_app_indicator_source_finalize;
2943-}
2944-
2945-/**
2946- * hud_app_indicator_source_new:
2947- *
2948- * Creates a #HudAppIndicatorSource.
2949- *
2950- * Returns: a new #HudAppIndicatorSource
2951- **/
2952-HudAppIndicatorSource *
2953-hud_app_indicator_source_new (void)
2954-{
2955- return g_object_new (HUD_TYPE_APP_INDICATOR_SOURCE, NULL);
2956-}
2957
2958=== removed file 'src/hudappindicatorsource.h'
2959--- src/hudappindicatorsource.h 2012-12-03 17:40:45 +0000
2960+++ src/hudappindicatorsource.h 1970-01-01 00:00:00 +0000
2961@@ -1,36 +0,0 @@
2962-/*
2963- * Copyright © 2012 Canonical Ltd.
2964- *
2965- * This program is free software: you can redistribute it and/or modify it
2966- * under the terms of the GNU General Public License version 3, as
2967- * published by the Free Software Foundation.
2968- *
2969- * This program is distributed in the hope that it will be useful, but
2970- * WITHOUT ANY WARRANTY; without even the implied warranties of
2971- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2972- * PURPOSE. See the GNU General Public License for more details.
2973- *
2974- * You should have received a copy of the GNU General Public License along
2975- * with this program. If not, see <http://www.gnu.org/licenses/>.
2976- *
2977- * Author: Ryan Lortie <desrt@desrt.ca>
2978- */
2979-
2980-#ifndef __HUD_APP_INDICATOR_SOURCE_H__
2981-#define __HUD_APP_INDICATOR_SOURCE_H__
2982-
2983-#include <glib-object.h>
2984-
2985-#define HUD_TYPE_APP_INDICATOR_SOURCE (hud_app_indicator_source_get_type ())
2986-#define HUD_APP_INDICATOR_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
2987- HUD_TYPE_APP_INDICATOR_SOURCE, HudAppIndicatorSource))
2988-#define HUD_IS_APP_INDICATOR_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
2989- HUD_TYPE_APP_INDICATOR_SOURCE))
2990-
2991-typedef struct _HudAppIndicatorSource HudAppIndicatorSource;
2992-
2993-GType hud_app_indicator_source_get_type (void);
2994-
2995-HudAppIndicatorSource * hud_app_indicator_source_new (void);
2996-
2997-#endif /* __HUD_APP_INDICATOR_SOURCE_H__ */
2998
2999=== removed file 'src/hudappmenuregistrar.c'
3000--- src/hudappmenuregistrar.c 2012-12-03 17:40:45 +0000
3001+++ src/hudappmenuregistrar.c 1970-01-01 00:00:00 +0000
3002@@ -1,507 +0,0 @@
3003-/*
3004- * Copyright © 2012 Canonical Ltd.
3005- *
3006- * This program is free software: you can redistribute it and/or modify it
3007- * under the terms of the GNU General Public License version 3, as
3008- * published by the Free Software Foundation.
3009- *
3010- * This program is distributed in the hope that it will be useful, but
3011- * WITHOUT ANY WARRANTY; without even the implied warranties of
3012- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3013- * PURPOSE. See the GNU General Public License for more details.
3014- *
3015- * You should have received a copy of the GNU General Public License along
3016- * with this program. If not, see <http://www.gnu.org/licenses/>.
3017- *
3018- * Author: Ryan Lortie <desrt@desrt.ca>
3019- */
3020-
3021-#define G_LOG_DOMAIN "hudappmenuregistrar"
3022-
3023-#include "hudappmenuregistrar.h"
3024-
3025-#include <gio/gio.h>
3026-
3027-/**
3028- * SECTION:hudappmenuregistrar
3029- * @title: HudAppMenuRegistrar
3030- * @short_description: client for the com.canonical.AppMenu.Registrar
3031- * D-Bus service
3032- *
3033- * The #HudAppMenuRegistrar is a singleton object that monitors the
3034- * com.canonical.AppMenu.Registrar D-Bus service.
3035- *
3036- * On instantiation, a D-Bus name watch is setup for the registrar.
3037- * When the registrar is found to exist, a local copy is made of the
3038- * windows and menus that the registrar knows about. Change
3039- * notifications are also monitored to keep the local cache in sync.
3040- *
3041- * After that point, all queries for information from the registrar are
3042- * satisfied from the local cache, without blocking.
3043- *
3044- * Information is acquired from #HudAppMenuRegistrar by using
3045- * hud_app_menu_registrar_add_observer(). This immediately calls a
3046- * callback with the initial information and makes future calls to the
3047- * same callback if the information is found to have changed.
3048- *
3049- * If the registrar is offline or the information is not yet available
3050- * at the time of the original query, the window will initially be
3051- * reported as having no menu but a change notification will arrive when
3052- * the proper information becomes available.
3053- **/
3054-
3055-/**
3056- * HudAppMenuRegistrar:
3057- *
3058- * This is an opaque structure type.
3059- **/
3060-
3061-#define APPMENU_REGISTRAR_BUS_NAME "com.canonical.AppMenu.Registrar"
3062-#define APPMENU_REGISTRAR_OBJECT_PATH "/com/canonical/AppMenu/Registrar"
3063-#define APPMENU_REGISTRAR_IFACE "com.canonical.AppMenu.Registrar"
3064-
3065-typedef struct
3066-{
3067- HudAppMenuRegistrarObserverFunc callback;
3068- gpointer user_data;
3069-} HudAppMenuRegistrarObserver;
3070-
3071-typedef struct
3072-{
3073- guint xid;
3074- gchar *bus_name;
3075- gchar *object_path;
3076- GSList *observers;
3077-} HudAppMenuRegistrarWindow;
3078-
3079-struct _HudAppMenuRegistrar
3080-{
3081- GObject parent_instance;
3082-
3083- guint subscription;
3084- GCancellable *cancellable;
3085- GHashTable *windows;
3086- gboolean notifying;
3087- gboolean ready;
3088-};
3089-
3090-typedef GObjectClass HudAppMenuRegistrarClass;
3091-
3092-G_DEFINE_TYPE (HudAppMenuRegistrar, hud_app_menu_registrar, G_TYPE_OBJECT)
3093-
3094-static void
3095-hud_app_menu_registrar_window_free (gpointer user_data)
3096-{
3097- HudAppMenuRegistrarWindow *window = user_data;
3098-
3099- g_assert (window->bus_name == NULL);
3100- g_assert (window->object_path == NULL);
3101- g_assert (window->observers == NULL);
3102-
3103- g_debug ("free window instance for %u", window->xid);
3104-
3105- g_slice_free (HudAppMenuRegistrarWindow, window);
3106-}
3107-
3108-static HudAppMenuRegistrarWindow *
3109-hud_app_menu_registrar_get_window (HudAppMenuRegistrar *registrar,
3110- guint xid)
3111-{
3112- HudAppMenuRegistrarWindow *window;
3113-
3114- window = g_hash_table_lookup (registrar->windows, GINT_TO_POINTER (xid));
3115-
3116- if (!window)
3117- {
3118- window = g_slice_new0 (HudAppMenuRegistrarWindow);
3119- window->xid = xid;
3120-
3121- g_debug ("create window instance for %u", xid);
3122- g_hash_table_insert (registrar->windows, GINT_TO_POINTER (xid), window);
3123- }
3124-
3125- return window;
3126-}
3127-
3128-static void
3129-hud_app_menu_registrar_possibly_free_window (HudAppMenuRegistrar *registrar,
3130- HudAppMenuRegistrarWindow *window)
3131-{
3132- if (window->bus_name == NULL && window->observers == NULL)
3133- g_hash_table_remove (registrar->windows, GINT_TO_POINTER (window->xid));
3134-}
3135-
3136-static void
3137-hud_app_menu_registrar_notify_window_observers (HudAppMenuRegistrar *registrar,
3138- HudAppMenuRegistrarWindow *window)
3139-{
3140- GSList *node;
3141-
3142- registrar->notifying = TRUE;
3143-
3144- for (node = window->observers; node; node = node->next)
3145- {
3146- HudAppMenuRegistrarObserver *observer = node->data;
3147-
3148- g_debug ("notifying %p about %u", observer->user_data, window->xid);
3149- (* observer->callback) (registrar, window->xid, window->bus_name, window->object_path, observer->user_data);
3150- }
3151-
3152- registrar->notifying = FALSE;
3153-}
3154-
3155-static void
3156-hud_app_menu_registrar_dbus_signal (GDBusConnection *connection,
3157- const gchar *sender_name,
3158- const gchar *object_path,
3159- const gchar *interface_name,
3160- const gchar *signal_name,
3161- GVariant *parameters,
3162- gpointer user_data)
3163-{
3164- HudAppMenuRegistrar *registrar = user_data;
3165-
3166- g_debug ("got signal");
3167-
3168- if (!registrar->ready)
3169- {
3170- g_debug ("not ready, so ignoring signal");
3171- return;
3172- }
3173-
3174- if (g_str_equal (signal_name, "WindowRegistered"))
3175- {
3176- HudAppMenuRegistrarWindow *window;
3177- guint xid;
3178-
3179- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(uso)")))
3180- return;
3181-
3182- g_variant_get_child (parameters, 0, "u", &xid);
3183- window = hud_app_menu_registrar_get_window (registrar, xid);
3184-
3185- g_free (window->bus_name);
3186- g_variant_get_child (parameters, 1, "s", &window->bus_name);
3187- g_free (window->object_path);
3188- g_variant_get_child (parameters, 2, "o", &window->object_path);
3189-
3190- g_debug ("xid %u is now at (%s, %s)", xid, window->bus_name, window->object_path);
3191-
3192- hud_app_menu_registrar_notify_window_observers (registrar, window);
3193- }
3194-
3195- else if (g_str_equal (signal_name, "WindowUnregistered"))
3196- {
3197- HudAppMenuRegistrarWindow *window;
3198- guint xid;
3199-
3200- if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(u)")))
3201- return;
3202-
3203- g_variant_get (parameters, 0, "u", &xid);
3204-
3205- g_debug ("xid %u disappeared", xid);
3206-
3207- window = hud_app_menu_registrar_get_window (registrar, xid);
3208-
3209- g_free (window->bus_name);
3210- window->bus_name = NULL;
3211- g_free (window->object_path);
3212- window->object_path = NULL;
3213-
3214- hud_app_menu_registrar_notify_window_observers (registrar, window);
3215-
3216- hud_app_menu_registrar_possibly_free_window (registrar, window);
3217- }
3218-}
3219-
3220-static void
3221-hud_app_menu_registrar_ready (GObject *source,
3222- GAsyncResult *result,
3223- gpointer user_data)
3224-{
3225- HudAppMenuRegistrar *registrar = user_data;
3226- GError *error = NULL;
3227- GVariant *reply;
3228-
3229- g_debug ("GetMenus returned");
3230-
3231- g_clear_object (&registrar->cancellable);
3232-
3233- reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source), result, &error);
3234-
3235- if (reply)
3236- {
3237- GVariantIter *iter;
3238- const gchar *bus_name;
3239- const gchar *object_path;
3240- guint xid;
3241-
3242- g_assert (!registrar->ready);
3243- registrar->ready = TRUE;
3244-
3245- g_debug ("going ready");
3246-
3247- g_variant_get (reply, "(a(uso))", &iter);
3248-
3249- while (g_variant_iter_next (iter, "(u&s&o)", &xid, &bus_name, &object_path))
3250- {
3251- HudAppMenuRegistrarWindow *window;
3252-
3253- window = hud_app_menu_registrar_get_window (registrar, xid);
3254-
3255- /* we were not ready until now, so we expect this to be unset */
3256- g_assert (window->bus_name == NULL);
3257-
3258- window->bus_name = g_strdup (bus_name);
3259- window->object_path = g_strdup (object_path);
3260-
3261- hud_app_menu_registrar_notify_window_observers (registrar, window);
3262- }
3263-
3264- g_variant_iter_free (iter);
3265- g_variant_unref (reply);
3266- }
3267- else
3268- {
3269- g_warning ("GetMenus returned an error: %s", error->message);
3270- g_error_free (error);
3271- }
3272-
3273- g_object_unref (registrar);
3274-
3275- g_debug ("done handling GetMenus reply");
3276-}
3277-
3278-static void
3279-hud_app_menu_registrar_name_appeared (GDBusConnection *connection,
3280- const gchar *name,
3281- const gchar *name_owner,
3282- gpointer user_data)
3283-{
3284- HudAppMenuRegistrar *registrar = user_data;
3285-
3286- g_debug ("name appeared (owner is %s)", name_owner);
3287-
3288- g_assert (registrar->subscription == 0);
3289- registrar->subscription = g_dbus_connection_signal_subscribe (connection, name_owner,
3290- APPMENU_REGISTRAR_IFACE, NULL,
3291- APPMENU_REGISTRAR_OBJECT_PATH, NULL,
3292- G_DBUS_SIGNAL_FLAGS_NONE,
3293- hud_app_menu_registrar_dbus_signal,
3294- registrar, NULL);
3295-
3296- g_assert (registrar->cancellable == NULL);
3297- registrar->cancellable = g_cancellable_new ();
3298- g_dbus_connection_call (connection, name_owner, APPMENU_REGISTRAR_OBJECT_PATH,
3299- APPMENU_REGISTRAR_IFACE, "GetMenus", NULL, G_VARIANT_TYPE ("(a(uso))"),
3300- G_DBUS_CALL_FLAGS_NONE, -1, registrar->cancellable,
3301- hud_app_menu_registrar_ready, g_object_ref (registrar));
3302-}
3303-
3304-static void
3305-hud_app_menu_registrar_name_vanished (GDBusConnection *connection,
3306- const gchar *name,
3307- gpointer user_data)
3308-{
3309- HudAppMenuRegistrar *registrar = user_data;
3310-
3311- g_debug ("name vanished");
3312-
3313- if (registrar->subscription > 0)
3314- {
3315- g_dbus_connection_signal_unsubscribe (connection, registrar->subscription);
3316- registrar->subscription = 0;
3317- }
3318-
3319- if (registrar->cancellable)
3320- {
3321- g_cancellable_cancel (registrar->cancellable);
3322- g_clear_object (&registrar->cancellable);
3323- }
3324-
3325- if (registrar->ready)
3326- {
3327- GHashTableIter iter;
3328- gpointer value;
3329-
3330- registrar->ready = FALSE;
3331-
3332- g_hash_table_iter_init (&iter, registrar->windows);
3333- while (g_hash_table_iter_next (&iter, NULL, &value))
3334- {
3335- HudAppMenuRegistrarWindow *window = value;
3336-
3337- g_free (window->bus_name);
3338- window->bus_name = NULL;
3339- g_free (window->object_path);
3340- window->object_path = NULL;
3341-
3342- hud_app_menu_registrar_notify_window_observers (registrar, window);
3343-
3344- /* Cannot go the normal route here because we are iterating... */
3345- if (window->observers == NULL)
3346- g_hash_table_iter_remove (&iter);
3347- }
3348- }
3349-}
3350-
3351-static void
3352-hud_app_menu_registrar_finalize (GObject *object)
3353-{
3354- /* This is an immortal singleton. If we're here, we have trouble. */
3355- g_assert_not_reached ();
3356-}
3357-
3358-static void
3359-hud_app_menu_registrar_init (HudAppMenuRegistrar *registrar)
3360-{
3361- g_debug ("online");
3362-
3363- registrar->windows = g_hash_table_new_full (NULL, NULL, NULL, hud_app_menu_registrar_window_free);
3364- g_bus_watch_name (G_BUS_TYPE_SESSION, APPMENU_REGISTRAR_BUS_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE,
3365- hud_app_menu_registrar_name_appeared, hud_app_menu_registrar_name_vanished,
3366- g_object_ref (registrar), g_object_unref);
3367-}
3368-
3369-static void
3370-hud_app_menu_registrar_class_init (HudAppMenuRegistrarClass *class)
3371-{
3372- class->finalize = hud_app_menu_registrar_finalize;
3373-}
3374-
3375-/**
3376- * HudAppMenuRegistrarObserverFunc:
3377- * @registrar: the #HudAppMenuRegistrar
3378- * @xid: the xid that we are notifying about
3379- * @bus_name: the bus name for the dbusmenu, or %NULL
3380- * @object_path: the object path for the dbusmenu, or %NULL
3381- * @user_data: the data pointer
3382- *
3383- * Notifies about the initial values for or changes to the bus name and
3384- * object path at which to find the dbusmenu for @xid.
3385- *
3386- * You should pass the values of @bus_name and @object_path to
3387- * dbusmenu_client_new() to get started.
3388- *
3389- * If no menu is available then @bus_name and @object_path will both be
3390- * given as %NULL.
3391- **/
3392-
3393-/**
3394- * hud_app_menu_registrar_add_observer:
3395- * @registrar: the #HudAppMenuRegistrar
3396- * @xid: the xid to begin observing
3397- * @callback: a #HudAppMenuRegistrarObserverFunc
3398- * @user_data: user data for @callback
3399- *
3400- * Begins observing @xid.
3401- *
3402- * @callback will be called exactly once before the function returns
3403- * with a set of initial values (the bus name and object path at which
3404- * to find the menu for the window).
3405- *
3406- * If the location of the menu for @xid changes (including being created
3407- * or destroyed) then @callback will be called each time an update is
3408- * required.
3409- *
3410- * It is possible that the values are not initially known because they
3411- * have not yet been retreived from the registrar or because the
3412- * registrar is not running. In this case, %NULL values will be
3413- * provided initially and @callback will be invoked again when the
3414- * real values are known.
3415- *
3416- * Call hud_app_menu_registrar_remove_observer() to when you are no
3417- * longer interested in @xid.
3418- **/
3419-void
3420-hud_app_menu_registrar_add_observer (HudAppMenuRegistrar *registrar,
3421- guint xid,
3422- HudAppMenuRegistrarObserverFunc callback,
3423- gpointer user_data)
3424-{
3425- HudAppMenuRegistrarObserver *observer;
3426- HudAppMenuRegistrarWindow *window;
3427-
3428- g_return_if_fail (xid != 0);
3429- g_return_if_fail (callback != NULL);
3430- g_return_if_fail (!registrar->notifying);
3431-
3432- g_debug ("observer added for xid %u (%p)", xid, user_data);
3433-
3434- observer = g_slice_new (HudAppMenuRegistrarObserver);
3435- observer->callback = callback;
3436- observer->user_data = user_data;
3437-
3438- window = hud_app_menu_registrar_get_window (registrar, xid);
3439- window->observers = g_slist_prepend (window->observers, observer);
3440-
3441- /* send the first update */
3442- (* callback) (registrar, xid, window->bus_name, window->object_path, user_data);
3443-}
3444-
3445-/**
3446- * hud_app_menu_registrar_remove_observer:
3447- * @registrar: the #HudAppMenuRegistrar
3448- * @xid: the xid to begin observing
3449- * @callback: a #HudAppMenuRegistrarObserverFunc
3450- * @user_data: user data for @callback
3451- *
3452- * Reverses the effect of a previous call to
3453- * hud_app_menu_registrar_add_observer().
3454- *
3455- * @callback and @user_data must be exactly equal to the values passed
3456- * to that function.
3457- *
3458- * One call does not remove all instances of @callback and @user_data.
3459- * You need to call this function the same number of times that you
3460- * called hud_app_menu_registrar_add_observer().
3461- **/
3462-void
3463-hud_app_menu_registrar_remove_observer (HudAppMenuRegistrar *registrar,
3464- guint xid,
3465- HudAppMenuRegistrarObserverFunc callback,
3466- gpointer user_data)
3467-{
3468- HudAppMenuRegistrarWindow *window;
3469- GSList **node;
3470-
3471- g_return_if_fail (xid != 0);
3472- g_return_if_fail (callback != NULL);
3473- g_return_if_fail (!registrar->notifying);
3474-
3475- g_debug ("observer removed for xid %u (%p)", xid, user_data);
3476-
3477- window = hud_app_menu_registrar_get_window (registrar, xid);
3478- for (node = &window->observers; *node; node = &(*node)->next)
3479- {
3480- HudAppMenuRegistrarObserver *observer = (*node)->data;
3481-
3482- if (observer->callback == callback && observer->user_data == user_data)
3483- {
3484- g_slice_free (HudAppMenuRegistrarObserver, observer);
3485- *node = g_slist_delete_link (*node, *node);
3486- break;
3487- }
3488- }
3489-
3490- hud_app_menu_registrar_possibly_free_window (registrar, window);
3491-}
3492-
3493-/**
3494- * hud_app_menu_registrar_get:
3495- *
3496- * Gets the singleton instance of #HudAppMenuRegistrar.
3497- *
3498- * Returns: (transfer none): the instance
3499- **/
3500-HudAppMenuRegistrar *
3501-hud_app_menu_registrar_get (void)
3502-{
3503- static HudAppMenuRegistrar *singleton;
3504-
3505- if (!singleton)
3506- singleton = g_object_new (HUD_TYPE_APP_MENU_REGISTRAR, NULL);
3507-
3508- return singleton;
3509-}
3510
3511=== removed file 'src/hudappmenuregistrar.h'
3512--- src/hudappmenuregistrar.h 2012-12-03 17:40:45 +0000
3513+++ src/hudappmenuregistrar.h 1970-01-01 00:00:00 +0000
3514@@ -1,53 +0,0 @@
3515-/*
3516- * Copyright © 2012 Canonical Ltd.
3517- *
3518- * This program is free software: you can redistribute it and/or modify it
3519- * under the terms of the GNU General Public License version 3, as
3520- * published by the Free Software Foundation.
3521- *
3522- * This program is distributed in the hope that it will be useful, but
3523- * WITHOUT ANY WARRANTY; without even the implied warranties of
3524- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3525- * PURPOSE. See the GNU General Public License for more details.
3526- *
3527- * You should have received a copy of the GNU General Public License along
3528- * with this program. If not, see <http://www.gnu.org/licenses/>.
3529- *
3530- * Author: Ryan Lortie <desrt@desrt.ca>
3531- */
3532-
3533-#ifndef __HUD_APP_MENU_REGISTRAR_H__
3534-#define __HUD_APP_MENU_REGISTRAR_H__
3535-
3536-#include <glib-object.h>
3537-
3538-#define HUD_TYPE_APP_MENU_REGISTRAR (hud_app_menu_registrar_get_type ())
3539-#define HUD_APP_MENU_REGISTRAR(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
3540- HUD_TYPE_APP_MENU_REGISTRAR, \
3541- HudAppMenuRegistrar))
3542-#define HUD_IS_APP_MENU_REGISTRAR(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
3543- HUD_TYPE_APP_MENU_REGISTRAR))
3544-
3545-typedef struct _HudAppMenuRegistrar HudAppMenuRegistrar;
3546-
3547-GType hud_app_menu_registrar_get_type (void);
3548-
3549-HudAppMenuRegistrar * hud_app_menu_registrar_get (void);
3550-
3551-typedef void (* HudAppMenuRegistrarObserverFunc) (HudAppMenuRegistrar *registrar,
3552- guint xid,
3553- const gchar *bus_name,
3554- const gchar *object_path,
3555- gpointer user_data);
3556-
3557-void hud_app_menu_registrar_add_observer (HudAppMenuRegistrar *registrar,
3558- guint xid,
3559- HudAppMenuRegistrarObserverFunc callback,
3560- gpointer user_data);
3561-
3562-void hud_app_menu_registrar_remove_observer (HudAppMenuRegistrar *registrar,
3563- guint xid,
3564- HudAppMenuRegistrarObserverFunc callback,
3565- gpointer user_data);
3566-
3567-#endif /* __HUD_APP_MENU_REGISTRAR_H__ */
3568
3569=== removed file 'src/huddbusmenucollector.c'
3570--- src/huddbusmenucollector.c 2012-12-03 17:40:45 +0000
3571+++ src/huddbusmenucollector.c 1970-01-01 00:00:00 +0000
3572@@ -1,679 +0,0 @@
3573-/*
3574- * Copyright © 2012 Canonical Ltd.
3575- *
3576- * This program is free software: you can redistribute it and/or modify it
3577- * under the terms of the GNU General Public License version 3, as
3578- * published by the Free Software Foundation.
3579- *
3580- * This program is distributed in the hope that it will be useful, but
3581- * WITHOUT ANY WARRANTY; without even the implied warranties of
3582- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3583- * PURPOSE. See the GNU General Public License for more details.
3584- *
3585- * You should have received a copy of the GNU General Public License along
3586- * with this program. If not, see <http://www.gnu.org/licenses/>.
3587- *
3588- * Authors: Ryan Lortie <desrt@desrt.ca>
3589- * Ted Gould <ted@canonical.com>
3590- */
3591-
3592-#define G_LOG_DOMAIN "huddbusmenucollector"
3593-
3594-#include "huddbusmenucollector.h"
3595-
3596-#include <libdbusmenu-glib/client.h>
3597-#include <string.h>
3598-
3599-#include "hudappmenuregistrar.h"
3600-#include "hudresult.h"
3601-#include "hudsource.h"
3602-
3603-/**
3604- * SECTION:huddbusmenucollector
3605- * @title: HudDbusmenuCollector
3606- * @short_description: a #HudSource that collects #HudItems from
3607- * Dbusmenu
3608- *
3609- * The #HudDbusmenuCollector collects menu items from a #DbusmenuClient.
3610- *
3611- * There are two modes of operation.
3612- *
3613- * In the simple mode, the collector is created with a specified
3614- * endpoint using hud_dbusmenu_collector_new_for_endpoint(). A
3615- * #DbusmenuClient is constructed using this endpoint and the collector
3616- * constructs #HudItems for the contents of the menu found there. This
3617- * mode is intended for use with indicators.
3618- *
3619- * For menus associated with application windows (ie: menubars), we must
3620- * consult the AppMenu registrar in order to discover the endpoint to
3621- * use. This second mode of the collector is used by calling
3622- * hud_dbusmenu_collector_new_for_window().
3623- **/
3624-
3625-/**
3626- * HudDbusmenuCollector:
3627- *
3628- * This is an opaque structure type.
3629- **/
3630-
3631-typedef struct
3632-{
3633- HudItem parent_instance;
3634-
3635- DbusmenuMenuitem *menuitem;
3636- gboolean is_opened;
3637-} HudDbusmenuItem;
3638-
3639-typedef HudItemClass HudDbusmenuItemClass;
3640-
3641-G_DEFINE_TYPE (HudDbusmenuItem, hud_dbusmenu_item, HUD_TYPE_ITEM)
3642-
3643-static void
3644-hud_dbusmenu_item_activate (HudItem *hud_item,
3645- GVariant *platform_data)
3646-{
3647- HudDbusmenuItem *item = (HudDbusmenuItem *) hud_item;
3648- const gchar *startup_id;
3649- guint32 timestamp = 0;
3650-
3651- if (g_variant_lookup (platform_data, "desktop-startup-id", "&s", &startup_id))
3652- {
3653- const gchar *time_tag;
3654-
3655- if ((time_tag = strstr (startup_id, "_TIME")))
3656- {
3657- gint64 result;
3658-
3659- result = g_ascii_strtoll (time_tag + 5, NULL, 10);
3660-
3661- if (0 <= result && result <= G_MAXINT32)
3662- timestamp = result;
3663- }
3664- }
3665-
3666- dbusmenu_menuitem_handle_event(item->menuitem, DBUSMENU_MENUITEM_EVENT_ACTIVATED, NULL, timestamp);
3667-}
3668-
3669-static void
3670-hud_dbusmenu_item_finalize (GObject *object)
3671-{
3672- HudDbusmenuItem *item = (HudDbusmenuItem *) object;
3673-
3674- g_object_unref (item->menuitem);
3675-
3676- G_OBJECT_CLASS (hud_dbusmenu_item_parent_class)
3677- ->finalize (object);
3678-}
3679-
3680-static void
3681-hud_dbusmenu_item_init (HudDbusmenuItem *item)
3682-{
3683-}
3684-
3685-static void
3686-hud_dbusmenu_item_class_init (HudDbusmenuItemClass *class)
3687-{
3688- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
3689-
3690- gobject_class->finalize = hud_dbusmenu_item_finalize;
3691- class->activate = hud_dbusmenu_item_activate;
3692-}
3693-
3694-static const gchar *
3695-hud_dbusmenu_item_get_label_property (const gchar *type)
3696-{
3697- static const gchar * const property_table[][2] =
3698- {
3699- { DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_LABEL },
3700- /* Indicator Messages */
3701- { "application-item", DBUSMENU_MENUITEM_PROP_LABEL },
3702- { "indicator-item", "indicator-label" },
3703- /* Indicator Datetime */
3704- { "appointment-item", "appointment-label" },
3705- { "timezone-item", "timezone-name" },
3706- /* Indicator Sound */
3707- { "x-canonical-sound-menu-player-metadata-type", "x-canonical-sound-menu-player-metadata-player-name" },
3708- { "x-canonical-sound-menu-mute-type", DBUSMENU_MENUITEM_PROP_LABEL },
3709- /* Indicator User */
3710- { "x-canonical-user-item", "user-item-name" }
3711- };
3712- static GHashTable *property_hash;
3713-
3714- if G_UNLIKELY (property_hash == NULL)
3715- {
3716- gint i;
3717-
3718- property_hash = g_hash_table_new (g_str_hash, g_str_equal);
3719-
3720- for (i = 0; i < G_N_ELEMENTS (property_table); i++)
3721- g_hash_table_insert (property_hash, (gpointer) property_table[i][0], (gpointer) property_table[i][1]);
3722- }
3723-
3724- if (type == NULL)
3725- return DBUSMENU_MENUITEM_PROP_LABEL;
3726-
3727- return g_hash_table_lookup (property_hash, type);
3728-}
3729-
3730-
3731-static HudDbusmenuItem *
3732-hud_dbusmenu_item_new (HudStringList *context,
3733- const gchar *desktop_file,
3734- const gchar *icon,
3735- DbusmenuMenuitem *menuitem)
3736-{
3737- HudStringList *tokens;
3738- HudDbusmenuItem *item;
3739- const gchar *type;
3740- const gchar *prop;
3741- gboolean enabled;
3742-
3743- type = dbusmenu_menuitem_property_get (menuitem, DBUSMENU_MENUITEM_PROP_TYPE);
3744- prop = hud_dbusmenu_item_get_label_property (type);
3745-
3746- if (prop && dbusmenu_menuitem_property_exist (menuitem, prop))
3747- {
3748- const gchar *label;
3749-
3750- label = dbusmenu_menuitem_property_get (menuitem, prop);
3751- tokens = hud_string_list_cons_label (label, context);
3752- enabled = TRUE;
3753- }
3754- else
3755- {
3756- tokens = hud_string_list_ref (context);
3757- enabled = FALSE;
3758- }
3759-
3760- if (enabled)
3761- enabled &= !dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE) ||
3762- dbusmenu_menuitem_property_get_bool (menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE);
3763-
3764- if (enabled)
3765- enabled &= !dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_ENABLED) ||
3766- dbusmenu_menuitem_property_get_bool (menuitem, DBUSMENU_MENUITEM_PROP_ENABLED);
3767-
3768- if (enabled)
3769- enabled &= !dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);
3770-
3771- item = hud_item_construct (hud_dbusmenu_item_get_type (), tokens, desktop_file, icon, enabled);
3772- item->menuitem = g_object_ref (menuitem);
3773-
3774- hud_string_list_unref (tokens);
3775-
3776- return item;
3777-}
3778-
3779-struct _HudDbusmenuCollector
3780-{
3781- GObject parent_instance;
3782-
3783- DbusmenuClient *client;
3784- DbusmenuMenuitem *root;
3785- gchar *application_id;
3786- HudStringList *prefix;
3787- gchar *icon;
3788- GHashTable *items;
3789- guint penalty;
3790- guint xid;
3791- gboolean alive;
3792- gint use_count;
3793- gboolean reentrance_check;
3794-};
3795-
3796-typedef GObjectClass HudDbusmenuCollectorClass;
3797-
3798-static void hud_dbusmenu_collector_iface_init (HudSourceInterface *iface);
3799-G_DEFINE_TYPE_WITH_CODE (HudDbusmenuCollector, hud_dbusmenu_collector, G_TYPE_OBJECT,
3800- G_IMPLEMENT_INTERFACE (HUD_TYPE_SOURCE, hud_dbusmenu_collector_iface_init))
3801-
3802-static void
3803-hud_dbusmenu_collector_open_submenu (gpointer key,
3804- gpointer value,
3805- gpointer user_data)
3806-{
3807- DbusmenuMenuitem *menuitem = key;
3808- HudDbusmenuItem *item = value;
3809-
3810- if (dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY))
3811- {
3812- dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, 0);
3813- item->is_opened = TRUE;
3814- }
3815-}
3816-
3817-static void
3818-hud_dbusmenu_collector_close_submenu (gpointer key,
3819- gpointer value,
3820- gpointer user_data)
3821-{
3822- DbusmenuMenuitem *menuitem = key;
3823- HudDbusmenuItem *item = value;
3824-
3825- if (item->is_opened)
3826- {
3827- dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_CLOSED, NULL, 0);
3828- item->is_opened = FALSE;
3829- }
3830-}
3831-
3832-static void
3833-hud_dbusmenu_collector_use (HudSource *source)
3834-{
3835- HudDbusmenuCollector *collector = HUD_DBUSMENU_COLLECTOR (source);
3836-
3837- collector->reentrance_check = TRUE;
3838-
3839- if (collector->use_count == 0)
3840- g_hash_table_foreach (collector->items, hud_dbusmenu_collector_open_submenu, NULL);
3841-
3842- collector->use_count++;
3843-
3844- collector->reentrance_check = FALSE;
3845-}
3846-
3847-static void
3848-hud_dbusmenu_collector_unuse (HudSource *source)
3849-{
3850- HudDbusmenuCollector *collector = HUD_DBUSMENU_COLLECTOR (source);
3851-
3852- g_return_if_fail (collector->use_count > 0);
3853-
3854- collector->reentrance_check = TRUE;
3855-
3856- collector->use_count--;
3857-
3858- if (collector->use_count == 0)
3859- g_hash_table_foreach (collector->items, hud_dbusmenu_collector_close_submenu, NULL);
3860-
3861- collector->reentrance_check = FALSE;
3862-}
3863-
3864-static void
3865-hud_dbusmenu_collector_search (HudSource *source,
3866- GPtrArray *results_array,
3867- HudTokenList *search_string)
3868-{
3869- HudDbusmenuCollector *collector = HUD_DBUSMENU_COLLECTOR (source);
3870- GHashTableIter iter;
3871- gpointer item;
3872-
3873- g_hash_table_iter_init (&iter, collector->items);
3874- while (g_hash_table_iter_next (&iter, NULL, &item))
3875- {
3876- HudResult *result;
3877-
3878- result = hud_result_get_if_matched (item, search_string, collector->penalty);
3879- if (result)
3880- g_ptr_array_add (results_array, result);
3881- }
3882-}
3883-
3884-static void
3885-hud_dbusmenu_collector_add_item (HudDbusmenuCollector *collector,
3886- HudStringList *context,
3887- DbusmenuMenuitem *menuitem);
3888-static void
3889-hud_dbusmenu_collector_remove_item (HudDbusmenuCollector *collector,
3890- DbusmenuMenuitem *menuitem);
3891-
3892-static void
3893-hud_dbusmenu_collector_child_added (DbusmenuMenuitem *menuitem,
3894- DbusmenuMenuitem *child,
3895- guint position,
3896- gpointer user_data)
3897-{
3898- HudDbusmenuCollector *collector = user_data;
3899- HudStringList *context;
3900- HudItem *item;
3901-
3902- g_assert (!collector->reentrance_check);
3903-
3904- item = g_hash_table_lookup (collector->items, menuitem);
3905- g_assert (item != NULL);
3906-
3907- context = hud_item_get_tokens (item);
3908-
3909- hud_dbusmenu_collector_add_item (collector, context, child);
3910-}
3911-
3912-static void
3913-hud_dbusmenu_collector_child_removed (DbusmenuMenuitem *menuitem,
3914- DbusmenuMenuitem *child,
3915- gpointer user_data)
3916-{
3917- HudDbusmenuCollector *collector = user_data;
3918-
3919- g_assert (!collector->reentrance_check);
3920-
3921- hud_dbusmenu_collector_remove_item (collector, child);
3922-}
3923-
3924-static void
3925-hud_dbusmenu_collector_property_changed (DbusmenuMenuitem *menuitem,
3926- const gchar *property_name,
3927- GVariant *new_value,
3928- gpointer user_data)
3929-{
3930- HudDbusmenuCollector *collector = user_data;
3931- DbusmenuMenuitem *parent;
3932- HudStringList *context;
3933- HudDbusmenuItem *item;
3934- gboolean was_open;
3935-
3936- g_assert (!collector->reentrance_check);
3937-
3938- parent = dbusmenu_menuitem_get_parent (menuitem);
3939-
3940- if (parent)
3941- {
3942- HudItem *parentitem;
3943-
3944- parentitem = g_hash_table_lookup (collector->items, parent);
3945- context = hud_item_get_tokens (parentitem);
3946- }
3947- else
3948- context = collector->prefix;
3949-
3950- item = g_hash_table_lookup (collector->items, menuitem);
3951- was_open = item->is_opened;
3952- g_hash_table_remove (collector->items, menuitem);
3953-
3954- item = hud_dbusmenu_item_new (context, collector->application_id, collector->icon, menuitem);
3955-
3956- if (collector->use_count && !was_open && dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY))
3957- {
3958- dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, 0);
3959- item->is_opened = TRUE;
3960- }
3961-
3962- g_hash_table_insert (collector->items, menuitem, item);
3963-
3964- hud_source_changed (HUD_SOURCE (collector));
3965-}
3966-
3967-static void
3968-hud_dbusmenu_collector_add_item (HudDbusmenuCollector *collector,
3969- HudStringList *context,
3970- DbusmenuMenuitem *menuitem)
3971-{
3972- HudDbusmenuItem *item;
3973- GList *child;
3974-
3975- item = hud_dbusmenu_item_new (context, collector->application_id, collector->icon, menuitem);
3976- context = hud_item_get_tokens (HUD_ITEM (item));
3977-
3978- g_signal_connect (menuitem, "property-changed", G_CALLBACK (hud_dbusmenu_collector_property_changed), collector);
3979- g_signal_connect (menuitem, "child-added", G_CALLBACK (hud_dbusmenu_collector_child_added), collector);
3980- g_signal_connect (menuitem, "child-removed", G_CALLBACK (hud_dbusmenu_collector_child_removed), collector);
3981-
3982- /* If we're actively being queried and we add a new submenu item, open it. */
3983- if (collector->use_count && dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY))
3984- {
3985- dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, 0);
3986- item->is_opened = TRUE;
3987- }
3988-
3989- g_hash_table_insert (collector->items, menuitem, item);
3990-
3991- for (child = dbusmenu_menuitem_get_children (menuitem); child; child = child->next)
3992- hud_dbusmenu_collector_add_item (collector, context, child->data);
3993-
3994- if (collector->alive)
3995- hud_source_changed (HUD_SOURCE (collector));
3996-}
3997-
3998-static void
3999-hud_dbusmenu_collector_remove_item (HudDbusmenuCollector *collector,
4000- DbusmenuMenuitem *menuitem)
4001-{
4002- GList *child;
4003-
4004- g_signal_handlers_disconnect_by_func (menuitem, hud_dbusmenu_collector_property_changed, collector);
4005- g_signal_handlers_disconnect_by_func (menuitem, hud_dbusmenu_collector_child_added, collector);
4006- g_signal_handlers_disconnect_by_func (menuitem, hud_dbusmenu_collector_child_removed, collector);
4007- g_hash_table_remove (collector->items, menuitem);
4008-
4009- for (child = dbusmenu_menuitem_get_children (menuitem); child; child = child->next)
4010- hud_dbusmenu_collector_remove_item (collector, child->data);
4011-
4012- if (collector->alive)
4013- hud_source_changed (HUD_SOURCE (collector));
4014-}
4015-
4016-static void
4017-hud_dbusmenu_collector_setup_root (HudDbusmenuCollector *collector,
4018- DbusmenuMenuitem *root)
4019-{
4020- if (collector->root)
4021- {
4022- /* If the collector has the submenus opened, close them before we
4023- * remove them all. The use_count being non-zero will cause them
4024- * to be reopened as they are added back below (if they will be).
4025- */
4026- if (collector->use_count > 0)
4027- g_hash_table_foreach (collector->items, hud_dbusmenu_collector_close_submenu, NULL);
4028-
4029- hud_dbusmenu_collector_remove_item (collector, collector->root);
4030- g_clear_object (&collector->root);
4031- }
4032-
4033- if (root)
4034- {
4035- hud_dbusmenu_collector_add_item (collector, collector->prefix, root);
4036- collector->root = g_object_ref (root);
4037- }
4038-}
4039-
4040-static void
4041-hud_dbusmenu_collector_root_changed (DbusmenuClient *client,
4042- DbusmenuMenuitem *root,
4043- gpointer user_data)
4044-{
4045- HudDbusmenuCollector *collector = user_data;
4046-
4047- g_assert (!collector->reentrance_check);
4048-
4049- hud_dbusmenu_collector_setup_root (collector, root);
4050-}
4051-
4052-static void
4053-hud_dbusmenu_collector_setup_endpoint (HudDbusmenuCollector *collector,
4054- const gchar *bus_name,
4055- const gchar *object_path)
4056-{
4057- g_debug ("endpoint is %s %s", bus_name, object_path);
4058-
4059- if (collector->client)
4060- {
4061- g_signal_handlers_disconnect_by_func (collector->client, hud_dbusmenu_collector_root_changed, collector);
4062- hud_dbusmenu_collector_setup_root (collector, NULL);
4063- g_clear_object (&collector->client);
4064- }
4065-
4066- if (bus_name && object_path)
4067- {
4068- collector->client = dbusmenu_client_new (bus_name, object_path);
4069- g_signal_connect_object (collector->client, "root-changed",
4070- G_CALLBACK (hud_dbusmenu_collector_root_changed), collector, 0);
4071- hud_dbusmenu_collector_setup_root (collector, dbusmenu_client_get_root (collector->client));
4072- }
4073-}
4074-
4075-static void
4076-hud_dbusmenu_collector_registrar_observer_func (HudAppMenuRegistrar *registrar,
4077- guint xid,
4078- const gchar *bus_name,
4079- const gchar *object_path,
4080- gpointer user_data)
4081-{
4082- HudDbusmenuCollector *collector = user_data;
4083-
4084- hud_dbusmenu_collector_setup_endpoint (collector, bus_name, object_path);
4085-}
4086-
4087-
4088-static void
4089-hud_dbusmenu_collector_finalize (GObject *object)
4090-{
4091- HudDbusmenuCollector *collector = HUD_DBUSMENU_COLLECTOR (object);
4092-
4093- if (collector->xid)
4094- hud_app_menu_registrar_remove_observer (hud_app_menu_registrar_get (), collector->xid,
4095- hud_dbusmenu_collector_registrar_observer_func, collector);
4096-
4097- /* remove all the items without firing change signals */
4098- collector->alive = FALSE;
4099- hud_dbusmenu_collector_setup_endpoint (collector, NULL, NULL);
4100-
4101- /* make sure the table is empty before we free it */
4102- g_assert (g_hash_table_size (collector->items) == 0);
4103- g_hash_table_unref (collector->items);
4104-
4105- g_free (collector->application_id);
4106- g_free (collector->icon);
4107-
4108- hud_string_list_unref (collector->prefix);
4109- g_clear_object (&collector->client);
4110-
4111- G_OBJECT_CLASS (hud_dbusmenu_collector_parent_class)
4112- ->finalize (object);
4113-}
4114-
4115-static void
4116-hud_dbusmenu_collector_init (HudDbusmenuCollector *collector)
4117-{
4118- collector->items = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
4119-}
4120-
4121-static void
4122-hud_dbusmenu_collector_iface_init (HudSourceInterface *iface)
4123-{
4124- iface->use = hud_dbusmenu_collector_use;
4125- iface->unuse = hud_dbusmenu_collector_unuse;
4126- iface->search = hud_dbusmenu_collector_search;
4127-}
4128-
4129-static void
4130-hud_dbusmenu_collector_class_init (HudDbusmenuCollectorClass *class)
4131-{
4132- class->finalize = hud_dbusmenu_collector_finalize;
4133-}
4134-
4135-/**
4136- * hud_dbusmenu_collector_new_for_endpoint:
4137- * @application_id: a unique identifier for the application
4138- * @prefix: the title to prefix to all items
4139- * @icon: the icon for the appliction
4140- * @penalty: the penalty to apply to all results
4141- * @bus_name: a D-Bus bus name
4142- * @object_path: an object path at the destination given by @bus_name
4143- *
4144- * Creates a new #HudDbusmenuCollector for the specified endpoint.
4145- *
4146- * Internally, a #DbusmenuClient is created for this endpoint. Searches
4147- * are performed against the contents of those menus.
4148- *
4149- * This call is intended to be used for indicators.
4150- *
4151- * If @prefix is non-%NULL (which, for indicators, it ought to be), then
4152- * it is prefixed to every item created by the collector.
4153- *
4154- * If @penalty is non-zero then all results returned from the collector
4155- * have their distance increased by a percentage equal to the penalty.
4156- * This allows items from indicators to score lower than they would
4157- * otherwise.
4158- *
4159- * Returns: a new #HudDbusmenuCollector
4160- **/
4161-HudDbusmenuCollector *
4162-hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,
4163- const gchar *prefix,
4164- const gchar *icon,
4165- guint penalty,
4166- const gchar *bus_name,
4167- const gchar *object_path)
4168-{
4169- HudDbusmenuCollector *collector;
4170-
4171- collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);
4172- collector->application_id = g_strdup (application_id);
4173- collector->icon = g_strdup (icon);
4174- if (prefix)
4175- collector->prefix = hud_string_list_cons (prefix, NULL);
4176- collector->penalty = penalty;
4177- hud_dbusmenu_collector_setup_endpoint (collector, bus_name, object_path);
4178-
4179- collector->alive = TRUE;
4180-
4181- return collector;
4182-}
4183-
4184-/**
4185- * hud_dbusmenu_collector_new_for_window:
4186- * @window: a #BamfWindow
4187- *
4188- * Creates a new #HudDbusmenuCollector for the endpoint indicated by the
4189- * #HudAppMenuRegistrar for @window.
4190- *
4191- * This call is intended to be used for application menus.
4192- *
4193- * Returns: a new #HudDbusmenuCollector
4194- **/
4195-HudDbusmenuCollector *
4196-hud_dbusmenu_collector_new_for_window (BamfWindow *window,
4197- const gchar *desktop_file,
4198- const gchar *icon)
4199-{
4200- HudDbusmenuCollector *collector;
4201-
4202- collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);
4203- collector->application_id = g_strdup (desktop_file);
4204- collector->icon = g_strdup (icon);
4205- collector->xid = bamf_window_get_xid (window);
4206- g_debug ("dbusmenu on %d", collector->xid);
4207- hud_app_menu_registrar_add_observer (hud_app_menu_registrar_get (), collector->xid,
4208- hud_dbusmenu_collector_registrar_observer_func, collector);
4209-
4210- collector->alive = TRUE;
4211-
4212- return collector;
4213-}
4214-
4215-/**
4216- * hud_dbusmenu_collector_set_prefix:
4217- * @collector: a #HudDbusmenuCollector
4218- * @prefix: the new prefix to use
4219- *
4220- * Changes the prefix applied to all items of the collector.
4221- *
4222- * This will involve destroying all of the items and recreating them
4223- * (since each item's prefix has to be changed).
4224- **/
4225-void
4226-hud_dbusmenu_collector_set_prefix (HudDbusmenuCollector *collector,
4227- const gchar *prefix)
4228-{
4229- hud_string_list_unref (collector->prefix);
4230- collector->prefix = hud_string_list_cons (prefix, NULL);
4231- hud_dbusmenu_collector_setup_root (collector, collector->root);
4232-}
4233-
4234-/**
4235- * hud_dbusmenu_collector_set_icon:
4236- * @collector: a #HudDbusmenuCollector
4237- * @icon: the application icon
4238- *
4239- * Changes the application icon used for all items of the collector.
4240- *
4241- * This will involve destroying all of the items and recreating them
4242- * (since each item's icon has to be changed).
4243- **/
4244-void
4245-hud_dbusmenu_collector_set_icon (HudDbusmenuCollector *collector,
4246- const gchar *icon)
4247-{
4248- g_free (collector->icon);
4249- collector->icon = g_strdup (icon);
4250- hud_dbusmenu_collector_setup_root (collector, collector->root);
4251-}
4252
4253=== removed file 'src/huddbusmenucollector.h'
4254--- src/huddbusmenucollector.h 2012-12-03 17:40:45 +0000
4255+++ src/huddbusmenucollector.h 1970-01-01 00:00:00 +0000
4256@@ -1,48 +0,0 @@
4257-/*
4258- * Copyright © 2012 Canonical Ltd.
4259- *
4260- * This program is free software: you can redistribute it and/or modify it
4261- * under the terms of the GNU General Public License version 3, as
4262- * published by the Free Software Foundation.
4263- *
4264- * This program is distributed in the hope that it will be useful, but
4265- * WITHOUT ANY WARRANTY; without even the implied warranties of
4266- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4267- * PURPOSE. See the GNU General Public License for more details.
4268- *
4269- * You should have received a copy of the GNU General Public License along
4270- * with this program. If not, see <http://www.gnu.org/licenses/>.
4271- *
4272- * Author: Ryan Lortie <desrt@desrt.ca>
4273- */
4274-
4275-#ifndef __HUD_DBUSMENU_COLLECTOR_H__
4276-#define __HUD_DBUSMENU_COLLECTOR_H__
4277-
4278-#include <libbamf/libbamf.h>
4279-
4280-#define HUD_TYPE_DBUSMENU_COLLECTOR (hud_dbusmenu_collector_get_type ())
4281-#define HUD_DBUSMENU_COLLECTOR(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
4282- HUD_TYPE_DBUSMENU_COLLECTOR, HudDbusmenuCollector))
4283-#define HUD_IS_DBUSMENU_COLLECTOR(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
4284- HUD_TYPE_DBUSMENU_COLLECTOR))
4285-
4286-typedef struct _HudDbusmenuCollector HudDbusmenuCollector;
4287-
4288-GType hud_dbusmenu_collector_get_type (void);
4289-
4290-HudDbusmenuCollector * hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,
4291- const gchar *prefix,
4292- const gchar *icon,
4293- guint penalty,
4294- const gchar *bus_name,
4295- const gchar *object_path);
4296-HudDbusmenuCollector * hud_dbusmenu_collector_new_for_window (BamfWindow *window,
4297- const gchar *desktop_file,
4298- const gchar *icon);
4299-void hud_dbusmenu_collector_set_prefix (HudDbusmenuCollector *collector,
4300- const gchar *prefix);
4301-void hud_dbusmenu_collector_set_icon (HudDbusmenuCollector *collector,
4302- const gchar *icon);
4303-
4304-#endif /* __HUD_DBUSMENU_COLLECTOR_H__ */
4305
4306=== removed file 'src/huddebugsource.c'
4307--- src/huddebugsource.c 2012-12-03 17:40:45 +0000
4308+++ src/huddebugsource.c 1970-01-01 00:00:00 +0000
4309@@ -1,168 +0,0 @@
4310-/*
4311- * Copyright © 2012 Canonical Ltd.
4312- *
4313- * This program is free software: you can redistribute it and/or modify it
4314- * under the terms of the GNU General Public License version 3, as
4315- * published by the Free Software Foundation.
4316- *
4317- * This program is distributed in the hope that it will be useful, but
4318- * WITHOUT ANY WARRANTY; without even the implied warranties of
4319- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4320- * PURPOSE. See the GNU General Public License for more details.
4321- *
4322- * You should have received a copy of the GNU General Public License along
4323- * with this program. If not, see <http://www.gnu.org/licenses/>.
4324- *
4325- * Author: Ryan Lortie <desrt@desrt.ca>
4326- */
4327-
4328-#include "huddebugsource.h"
4329-
4330-#include "hudsource.h"
4331-#include "hudresult.h"
4332-
4333-/**
4334- * SECTION:huddebugsource
4335- * @title: HudDebugSource
4336- * @short_description: a source to assist with debugging
4337- *
4338- * #HudDebugSource is a source for debugging purposes. It is not
4339- * enabled by default but you can have it added to the global list of
4340- * sources by setting the HUD_DEBUG_SOURCE environment variable.
4341- *
4342- * Presently it creates a #HudItem corresponding to the current date and
4343- * time (and updates it as the time changes).
4344- **/
4345-
4346-/**
4347- * HudDebugSource:
4348- *
4349- * This is an opaque structure type.
4350- **/
4351-
4352-struct _HudDebugSource
4353-{
4354- GObject parent_instance;
4355-
4356- HudItem *item;
4357- gint use_count;
4358- gint timeout;
4359-};
4360-
4361-typedef GObjectClass HudDebugSourceClass;
4362-
4363-static void hud_debug_source_iface_init (HudSourceInterface *iface);
4364-G_DEFINE_TYPE_WITH_CODE (HudDebugSource, hud_debug_source, G_TYPE_OBJECT,
4365- G_IMPLEMENT_INTERFACE (HUD_TYPE_SOURCE, hud_debug_source_iface_init))
4366-
4367-static gboolean
4368-hud_debug_source_timeout (gpointer user_data)
4369-{
4370- HudDebugSource *source = user_data;
4371- HudStringList *tokens;
4372- GDateTime *now;
4373- gchar *time;
4374-
4375- g_clear_object (&source->item);
4376-
4377- now = g_date_time_new_now_local ();
4378- time = g_date_time_format (now, "hud-debug time: %c");
4379- tokens = hud_string_list_cons (time, NULL);
4380- g_date_time_unref (now);
4381- g_free (time);
4382-
4383- source->item = hud_item_new (tokens, NULL, NULL, TRUE);
4384- hud_string_list_unref (tokens);
4385-
4386- hud_source_changed (HUD_SOURCE (source));
4387-
4388- return TRUE;
4389-}
4390-
4391-static void
4392-hud_debug_source_use (HudSource *hud_source)
4393-{
4394- HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);
4395-
4396- if (source->use_count == 0)
4397- source->timeout = g_timeout_add (1000, hud_debug_source_timeout, source);
4398-
4399- source->use_count++;
4400-}
4401-
4402-static void
4403-hud_debug_source_unuse (HudSource *hud_source)
4404-{
4405- HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);
4406-
4407- source->use_count--;
4408-
4409- if (source->use_count == 0)
4410- {
4411- g_source_remove (source->timeout);
4412- source->timeout = 0;
4413- }
4414-}
4415-
4416-static void
4417-hud_debug_source_search (HudSource *hud_source,
4418- GPtrArray *results_array,
4419- HudTokenList *search_string)
4420-{
4421- HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);
4422-
4423- if (source->item)
4424- {
4425- HudResult *result;
4426-
4427- result = hud_result_get_if_matched (source->item, search_string, 0);
4428- if (result != NULL)
4429- g_ptr_array_add (results_array, result);
4430- }
4431-}
4432-
4433-static void
4434-hud_debug_source_finalize (GObject *object)
4435-{
4436- HudDebugSource *source = HUD_DEBUG_SOURCE (object);
4437-
4438- g_clear_object (&source->item);
4439-
4440- if (source->timeout)
4441- g_source_remove (source->timeout);
4442-
4443- G_OBJECT_CLASS (hud_debug_source_parent_class)
4444- ->finalize (object);
4445-}
4446-
4447-static void
4448-hud_debug_source_init (HudDebugSource *source)
4449-{
4450-}
4451-
4452-static void
4453-hud_debug_source_iface_init (HudSourceInterface *iface)
4454-{
4455- iface->use = hud_debug_source_use;
4456- iface->unuse = hud_debug_source_unuse;
4457- iface->search = hud_debug_source_search;
4458-}
4459-
4460-static void
4461-hud_debug_source_class_init (HudDebugSourceClass *class)
4462-{
4463- class->finalize = hud_debug_source_finalize;
4464-}
4465-
4466-/**
4467- * hud_debug_source_new:
4468- *
4469- * Creates a #HudDebugSource.
4470- *
4471- * Returns: a new empty #HudDebugSource
4472- **/
4473-HudDebugSource *
4474-hud_debug_source_new (void)
4475-{
4476- return g_object_new (HUD_TYPE_DEBUG_SOURCE, NULL);
4477-}
4478
4479=== removed file 'src/huddebugsource.h'
4480--- src/huddebugsource.h 2012-12-03 17:40:45 +0000
4481+++ src/huddebugsource.h 1970-01-01 00:00:00 +0000
4482@@ -1,36 +0,0 @@
4483-/*
4484- * Copyright © 2012 Canonical Ltd.
4485- *
4486- * This program is free software: you can redistribute it and/or modify it
4487- * under the terms of the GNU General Public License version 3, as
4488- * published by the Free Software Foundation.
4489- *
4490- * This program is distributed in the hope that it will be useful, but
4491- * WITHOUT ANY WARRANTY; without even the implied warranties of
4492- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4493- * PURPOSE. See the GNU General Public License for more details.
4494- *
4495- * You should have received a copy of the GNU General Public License along
4496- * with this program. If not, see <http://www.gnu.org/licenses/>.
4497- *
4498- * Author: Ryan Lortie <desrt@desrt.ca>
4499- */
4500-
4501-#ifndef __HUD_DEBUG_SOURCE_H__
4502-#define __HUD_DEBUG_SOURCE_H__
4503-
4504-#include <glib-object.h>
4505-
4506-#define HUD_TYPE_DEBUG_SOURCE (hud_debug_source_get_type ())
4507-#define HUD_DEBUG_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
4508- HUD_TYPE_DEBUG_SOURCE, HudDebugSource))
4509-#define HUD_IS_DEBUG_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
4510- HUD_TYPE_DEBUG_SOURCE))
4511-
4512-typedef struct _HudDebugSource HudDebugSource;
4513-
4514-GType hud_debug_source_get_type (void);
4515-
4516-HudDebugSource * hud_debug_source_new (void);
4517-
4518-#endif /* __HUD_DEBUG_SOURCE_H__ */
4519
4520=== removed file 'src/hudindicatorsource.c'
4521--- src/hudindicatorsource.c 2012-12-03 17:40:45 +0000
4522+++ src/hudindicatorsource.c 1970-01-01 00:00:00 +0000
4523@@ -1,286 +0,0 @@
4524-/*
4525- * Copyright © 2012 Canonical Ltd.
4526- *
4527- * This program is free software: you can redistribute it and/or modify it
4528- * under the terms of the GNU General Public License version 3, as
4529- * published by the Free Software Foundation.
4530- *
4531- * This program is distributed in the hope that it will be useful, but
4532- * WITHOUT ANY WARRANTY; without even the implied warranties of
4533- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4534- * PURPOSE. See the GNU General Public License for more details.
4535- *
4536- * You should have received a copy of the GNU General Public License along
4537- * with this program. If not, see <http://www.gnu.org/licenses/>.
4538- *
4539- * Authors: Ryan Lortie <desrt@desrt.ca>
4540- * Ted Gould <ted@canonical.com>
4541- */
4542-
4543-#include "hudindicatorsource.h"
4544-
4545-#include <glib/gi18n.h>
4546-#include <gio/gio.h>
4547-
4548-#include "hudsettings.h"
4549-#include "huddbusmenucollector.h"
4550-#include "hudmenumodelcollector.h"
4551-#include "hudsource.h"
4552-
4553-/**
4554- * SECTION:hudindicatorsource
4555- * @title:HudIndicatorSource
4556- * @short_description: a #HudSource to search through the menus of
4557- * indicators
4558- *
4559- * #HudIndicatorSource searches through the menu items of the
4560- * indicators.
4561- **/
4562-
4563-/**
4564- * HudIndicatorSource:
4565- *
4566- * This is an opaque structure type.
4567- **/
4568-
4569-typedef struct
4570-{
4571- const gchar *dbus_name;
4572- const gchar *dbus_menu_path;
4573- const gchar *indicator_name;
4574- const gchar *user_visible_name;
4575- const gchar *icon;
4576- gboolean uses_gmenumodel;
4577-} IndicatorInfo;
4578-
4579-static const IndicatorInfo indicator_info[] = {
4580- {
4581- .dbus_name = "com.canonical.indicator.datetime",
4582- .dbus_menu_path = "/com/canonical/indicator/datetime/menu",
4583- .indicator_name = "indicator-datetime",
4584- .user_visible_name = N_("Date"),
4585- .icon = "office-calendar"
4586- },
4587- {
4588- .dbus_name = "com.canonical.indicator.session",
4589- .dbus_menu_path = "/com/canonical/indicator/session/menu",
4590- .indicator_name = "indicator-session-device",
4591- .user_visible_name = N_("Device"),
4592- .icon = "system-devices-panel"
4593- },
4594- {
4595- .dbus_name = "com.canonical.indicator.session",
4596- .dbus_menu_path = "/com/canonical/indicator/users/menu",
4597- .indicator_name = "indicator-session-user",
4598- .user_visible_name = N_("Users"),
4599- .icon = "avatar-default"
4600- },
4601- {
4602- .dbus_name = "com.canonical.indicator.sound",
4603- .dbus_menu_path = "/com/canonical/indicator/sound/menu",
4604- .indicator_name = "indicator-sound",
4605- .user_visible_name = N_("Sound"),
4606- .icon = "audio-volume-high-panel"
4607- },
4608- {
4609- .dbus_name = "com.canonical.indicator.messages",
4610- .dbus_menu_path = "/com/canonical/indicator/messages/menu",
4611- .indicator_name = "indicator-messages",
4612- .user_visible_name = N_("Messages"),
4613- .icon = "indicator-messages",
4614- .uses_gmenumodel = TRUE
4615- }
4616-};
4617-
4618-typedef struct
4619-{
4620- const IndicatorInfo *info;
4621- HudIndicatorSource *source;
4622- HudSource *collector;
4623-} HudIndicatorSourceIndicator;
4624-
4625-struct _HudIndicatorSource
4626-{
4627- GObject parent_instance;
4628-
4629- HudIndicatorSourceIndicator *indicators;
4630- gint n_indicators;
4631- gint use_count;
4632-};
4633-
4634-typedef GObjectClass HudIndicatorSourceClass;
4635-
4636-static void hud_indicator_source_iface_init (HudSourceInterface *iface);
4637-G_DEFINE_TYPE_WITH_CODE (HudIndicatorSource, hud_indicator_source, G_TYPE_OBJECT,
4638- G_IMPLEMENT_INTERFACE (HUD_TYPE_SOURCE, hud_indicator_source_iface_init))
4639-
4640-static void
4641-hud_indicator_source_use (HudSource *hud_source)
4642-{
4643- HudIndicatorSource *source = HUD_INDICATOR_SOURCE (hud_source);
4644- gint i;
4645-
4646- if (source->use_count == 0)
4647- {
4648- for (i = 0; i < source->n_indicators; i++)
4649- if (source->indicators[i].collector)
4650- hud_source_use (source->indicators[i].collector);
4651- }
4652-
4653- source->use_count++;
4654-}
4655-
4656-static void
4657-hud_indicator_source_unuse (HudSource *hud_source)
4658-{
4659- HudIndicatorSource *source = HUD_INDICATOR_SOURCE (hud_source);
4660- gint i;
4661-
4662- g_return_if_fail (source->use_count > 0);
4663-
4664- source->use_count--;
4665-
4666- if (source->use_count == 0)
4667- {
4668- for (i = 0; i < source->n_indicators; i++)
4669- if (source->indicators[i].collector)
4670- hud_source_unuse (source->indicators[i].collector);
4671- }
4672-}
4673-
4674-static void
4675-hud_indicator_source_search (HudSource *hud_source,
4676- GPtrArray *results_array,
4677- HudTokenList *search_string)
4678-{
4679- HudIndicatorSource *source = HUD_INDICATOR_SOURCE (hud_source);
4680- gint i;
4681-
4682- for (i = 0; i < source->n_indicators; i++)
4683- if (source->indicators[i].collector)
4684- hud_source_search (source->indicators[i].collector, results_array, search_string);
4685-}
4686-
4687-static void
4688-hud_indicator_source_finalize (GObject *object)
4689-{
4690- g_assert_not_reached ();
4691-}
4692-
4693-static void
4694-hud_indicator_source_collector_changed (HudSource *source,
4695- gpointer user_data)
4696-{
4697- HudIndicatorSourceIndicator *indicator = user_data;
4698-
4699- hud_source_changed (HUD_SOURCE (indicator->source));
4700-}
4701-
4702-static void
4703-hud_indicator_source_name_appeared (GDBusConnection *connection,
4704- const gchar *name,
4705- const gchar *name_owner,
4706- gpointer user_data)
4707-{
4708- HudIndicatorSourceIndicator *indicator = user_data;
4709-
4710- if (indicator->info->uses_gmenumodel)
4711- {
4712- HudMenuModelCollector *collector;
4713-
4714- collector = hud_menu_model_collector_new_for_endpoint (indicator->info->indicator_name,
4715- _(indicator->info->user_visible_name),
4716- indicator->info->icon,
4717- hud_settings.indicator_penalty,
4718- name_owner,
4719- indicator->info->dbus_menu_path);
4720-
4721- indicator->collector = HUD_SOURCE (collector);
4722- }
4723- else
4724- {
4725- HudDbusmenuCollector *collector;
4726-
4727- collector = hud_dbusmenu_collector_new_for_endpoint (indicator->info->indicator_name,
4728- _(indicator->info->user_visible_name),
4729- indicator->info->icon,
4730- hud_settings.indicator_penalty,
4731- name_owner, indicator->info->dbus_menu_path);
4732- indicator->collector = HUD_SOURCE (collector);
4733- }
4734-
4735- g_signal_connect (indicator->collector, "changed",
4736- G_CALLBACK (hud_indicator_source_collector_changed), indicator);
4737-
4738- /* Set initial use count on new indicator if query is active. */
4739- if (indicator->source->use_count)
4740- hud_source_use (indicator->collector);
4741-
4742- hud_source_changed (HUD_SOURCE (indicator->source));
4743-}
4744-
4745-static void
4746-hud_indicator_source_name_vanished (GDBusConnection *connection,
4747- const gchar *name,
4748- gpointer user_data)
4749-{
4750- HudIndicatorSourceIndicator *indicator = user_data;
4751-
4752- if (indicator->collector)
4753- {
4754- g_signal_handlers_disconnect_by_func (indicator->collector, hud_indicator_source_collector_changed, indicator);
4755- /* Drop our use count on dying indicator (if any) */
4756- if (indicator->source->use_count)
4757- hud_source_unuse (indicator->collector);
4758- g_clear_object (&indicator->collector);
4759- }
4760-
4761- hud_source_changed (HUD_SOURCE (indicator->source));
4762-}
4763-
4764-static void
4765-hud_indicator_source_init (HudIndicatorSource *source)
4766-{
4767- gint i;
4768-
4769- source->n_indicators = G_N_ELEMENTS (indicator_info);
4770- source->indicators = g_new0 (HudIndicatorSourceIndicator, source->n_indicators);
4771-
4772- for (i = 0; i < source->n_indicators; i++)
4773- {
4774- HudIndicatorSourceIndicator *indicator = &source->indicators[i];
4775-
4776- indicator->info = &indicator_info[i];
4777- indicator->source = source;
4778-
4779- g_bus_watch_name (G_BUS_TYPE_SESSION, indicator->info->dbus_name, G_BUS_NAME_WATCHER_FLAGS_NONE,
4780- hud_indicator_source_name_appeared, hud_indicator_source_name_vanished, indicator, NULL);
4781- }
4782-}
4783-
4784-static void
4785-hud_indicator_source_iface_init (HudSourceInterface *iface)
4786-{
4787- iface->use = hud_indicator_source_use;
4788- iface->unuse = hud_indicator_source_unuse;
4789- iface->search = hud_indicator_source_search;
4790-}
4791-
4792-static void
4793-hud_indicator_source_class_init (HudIndicatorSourceClass *class)
4794-{
4795- class->finalize = hud_indicator_source_finalize;
4796-}
4797-
4798-/**
4799- * hud_indicator_source_new:
4800- *
4801- * Creates a #HudIndicatorSource.
4802- *
4803- * Returns: a new #HudIndicatorSource
4804- **/
4805-HudIndicatorSource *
4806-hud_indicator_source_new (void)
4807-{
4808- return g_object_new (HUD_TYPE_INDICATOR_SOURCE, NULL);
4809-}
4810
4811=== removed file 'src/hudindicatorsource.h'
4812--- src/hudindicatorsource.h 2012-12-03 17:40:45 +0000
4813+++ src/hudindicatorsource.h 1970-01-01 00:00:00 +0000
4814@@ -1,36 +0,0 @@
4815-/*
4816- * Copyright © 2012 Canonical Ltd.
4817- *
4818- * This program is free software: you can redistribute it and/or modify it
4819- * under the terms of the GNU General Public License version 3, as
4820- * published by the Free Software Foundation.
4821- *
4822- * This program is distributed in the hope that it will be useful, but
4823- * WITHOUT ANY WARRANTY; without even the implied warranties of
4824- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4825- * PURPOSE. See the GNU General Public License for more details.
4826- *
4827- * You should have received a copy of the GNU General Public License along
4828- * with this program. If not, see <http://www.gnu.org/licenses/>.
4829- *
4830- * Author: Ryan Lortie <desrt@desrt.ca>
4831- */
4832-
4833-#ifndef __HUD_INDICATOR_SOURCE_H__
4834-#define __HUD_INDICATOR_SOURCE_H__
4835-
4836-#include <glib-object.h>
4837-
4838-#define HUD_TYPE_INDICATOR_SOURCE (hud_indicator_source_get_type ())
4839-#define HUD_INDICATOR_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
4840- HUD_TYPE_INDICATOR_SOURCE, HudIndicatorSource))
4841-#define HUD_IS_INDICATOR_SOURCE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
4842- HUD_TYPE_INDICATOR_SOURCE))
4843-
4844-typedef struct _HudIndicatorSource HudIndicatorSource;
4845-
4846-GType hud_indicator_source_get_type (void);
4847-
4848-HudIndicatorSource * hud_indicator_source_new (void);
4849-
4850-#endif /* __HUD_INDICATOR_SOURCE_H__ */
4851
4852=== removed file 'src/huditem.c'
4853--- src/huditem.c 2012-12-03 17:40:45 +0000
4854+++ src/huditem.c 1970-01-01 00:00:00 +0000
4855@@ -1,343 +0,0 @@
4856-/*
4857- * Copyright © 2012 Canonical Ltd.
4858- *
4859- * This program is free software: you can redistribute it and/or modify it
4860- * under the terms of the GNU General Public License version 3, as
4861- * published by the Free Software Foundation.
4862- *
4863- * This program is distributed in the hope that it will be useful, but
4864- * WITHOUT ANY WARRANTY; without even the implied warranties of
4865- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4866- * PURPOSE. See the GNU General Public License for more details.
4867- *
4868- * You should have received a copy of the GNU General Public License along
4869- * with this program. If not, see <http://www.gnu.org/licenses/>.
4870- *
4871- * Author: Ryan Lortie <desrt@desrt.ca>
4872- */
4873-
4874-#include "huditem.h"
4875-
4876-#include "usage-tracker.h"
4877-#include "hudtoken.h"
4878-
4879-/**
4880- * SECTION:huditem
4881- * @title: HudItem
4882- * @short_description: a user-interesting item that can be activated
4883- *
4884- * A #HudItem represents a user-interesting action that can be activated
4885- * from the Hud user interface.
4886- **/
4887-
4888-/**
4889- * HudItem:
4890- *
4891- * This is an opaque structure type.
4892- **/
4893-
4894-/**
4895- * HudItemClass:
4896- * @parent_class: the #GObjectClass
4897- * @activate: virtual function pointer for hud_item_activate()
4898- *
4899- * This is the class vtable for #HudItem.
4900- **/
4901-
4902-static GHashTable *hud_item_table;
4903-static guint64 hud_item_next_id;
4904-
4905-struct _HudItemPrivate
4906-{
4907- GObject parent_instance;
4908-
4909- gchar *desktop_file;
4910-
4911- HudTokenList *token_list;
4912- HudStringList *tokens;
4913- gchar *usage_tag;
4914- gchar *app_icon;
4915- gboolean enabled;
4916- guint usage;
4917- guint64 id;
4918-};
4919-
4920-G_DEFINE_TYPE (HudItem, hud_item, G_TYPE_OBJECT)
4921-
4922-static void
4923-hud_item_finalize (GObject *object)
4924-{
4925- HudItem *item = HUD_ITEM (object);
4926-
4927- g_hash_table_remove (hud_item_table, &item->priv->id);
4928- hud_token_list_free (item->priv->token_list);
4929- hud_string_list_unref (item->priv->tokens);
4930- g_free (item->priv->desktop_file);
4931- g_free (item->priv->app_icon);
4932- g_free (item->priv->usage_tag);
4933-
4934- G_OBJECT_CLASS (hud_item_parent_class)
4935- ->finalize (object);
4936-}
4937-
4938-static void
4939-hud_item_init (HudItem *item)
4940-{
4941- item->priv = G_TYPE_INSTANCE_GET_PRIVATE (item, HUD_TYPE_ITEM, HudItemPrivate);
4942-}
4943-
4944-static void
4945-hud_item_class_init (HudItemClass *class)
4946-{
4947- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
4948-
4949- hud_item_table = g_hash_table_new (g_int64_hash, g_int64_equal);
4950-
4951- gobject_class->finalize = hud_item_finalize;
4952-
4953- g_type_class_add_private (class, sizeof (HudItemPrivate));
4954-}
4955-
4956-static void
4957-hud_item_format_tokens (GString *string,
4958- HudStringList *tokens)
4959-{
4960- HudStringList *tail;
4961-
4962- tail = hud_string_list_get_tail (tokens);
4963-
4964- if (tail)
4965- {
4966- hud_item_format_tokens (string, tail);
4967- g_string_append (string, "||");
4968- }
4969-
4970- g_string_append (string, hud_string_list_get_head (tokens));
4971-}
4972-
4973-static void
4974-hud_item_setup_usage (HudItem *item)
4975-{
4976- GString *tag;
4977-
4978- if (item->priv->tokens && item->priv->enabled)
4979- {
4980- tag = g_string_new (NULL);
4981- hud_item_format_tokens (tag, item->priv->tokens);
4982- item->priv->usage_tag = g_string_free (tag, FALSE);
4983- item->priv->usage = usage_tracker_get_usage (usage_tracker_get_instance (),
4984- item->priv->desktop_file, item->priv->usage_tag);
4985- }
4986-}
4987-
4988-/**
4989- * hud_item_construct:
4990- * @g_type: a #GType
4991- * @tokens: the search tokens for the item
4992- * @desktop_file: the desktop file of the provider of the item
4993- * @app_icon: the icon name for the application that created this item
4994- * @enabled: if the item is enabled
4995- *
4996- * This is the Vala-style chain-up constructor corresponding to
4997- * hud_item_new(). @g_type must be a subtype of #HudItem.
4998- *
4999- * Only subclasses of #HudItem should call this.
5000- *
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches