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