Merge lp:~awn-testing/awn/awn-rewrite-ua-support into lp:~awn-core/awn/trunk-rewrite
- awn-rewrite-ua-support
- Merge into trunk-rewrite
Status: | Superseded |
---|---|
Proposed branch: | lp:~awn-testing/awn/awn-rewrite-ua-support |
Merge into: | lp:~awn-core/awn/trunk-rewrite |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~awn-testing/awn/awn-rewrite-ua-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Awn-core | Pending | ||
Review via email: mp+8821@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-07-15.
Commit message
Description of the change
moonbeam (rcryderman) wrote : | # |
- 838. By moonbeam
-
* .bzrignore:
* INSTALL:
Sync with files in Rewrite.
* src/awn-applet- manager. c:
Removed some debugs. - 839. By moonbeam
-
* src/awn-
ua-alignment. c:
Destroy the socket when ua/screenlet removed from the ua_acitive_list. - 840. By Julien Lavergne
-
Fix tabs in awnClass.py (require by PEP8)
- 841. By Julien Lavergne
-
Fix also tabs in AwnDefs.py.in
- 842. By moonbeam
-
* applets/
uawrapper/ awn-ua- wrapper. h:
Removed leftover file - 843. By moonbeam
-
* libawn/
awn-alignment. c:
Sync file with rewrite. - 844. By moonbeam
-
* src/awn-
applet- manager. c:
* src/awn-applet- manager. h:
* src/awn-ua-alignment. c:
Various whitespace fixes.
Modified awn_ua_get_all_ server_ flags() .
Removed touch_quark set on UaAlignment() for UAAlignment. - 845. By moonbeam
-
Merge rewrite.
- 846. By moonbeam
-
* applets/uawrapper/:
Removed empty dir. - 847. By moonbeam
-
Merged rewrite
- 848. By Michal Hruby
-
Changes to the DBus interface
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2009-07-09 07:12:27 +0000 | |||
3 | +++ .bzrignore 2009-07-13 18:05:02 +0000 | |||
4 | @@ -107,6 +107,12 @@ | |||
5 | 107 | src/stamp-awnmarshal.h | 107 | src/stamp-awnmarshal.h |
6 | 108 | applets/taskmanager/taskmanager-marshal.c | 108 | applets/taskmanager/taskmanager-marshal.c |
7 | 109 | applets/taskmanager/taskmanager-marshal.h | 109 | applets/taskmanager/taskmanager-marshal.h |
8 | 110 | debian/patches/*.log | ||
9 | 111 | debian/stamp* | ||
10 | 112 | debian/libawn*/* | ||
11 | 113 | debian/avant-*/* | ||
12 | 114 | debian/python*/* | ||
13 | 115 | debian/awn*/* | ||
14 | 110 | doltcompile | 116 | doltcompile |
15 | 111 | doltlibtool | 117 | doltlibtool |
16 | 112 | m4/lt*.m4 | 118 | m4/lt*.m4 |
17 | 113 | 119 | ||
18 | === modified file 'INSTALL' | |||
19 | --- INSTALL 2009-05-22 09:16:20 +0000 | |||
20 | +++ INSTALL 2009-06-25 04:55:53 +0000 | |||
21 | @@ -2,15 +2,15 @@ | |||
22 | 2 | ************************* | 2 | ************************* |
23 | 3 | 3 | ||
24 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, |
26 | 5 | 2006, 2007, 2008 Free Software Foundation, Inc. | 5 | 2006, 2007 Free Software Foundation, Inc. |
27 | 6 | 6 | ||
29 | 7 | This file is free documentation; the Free Software Foundation gives | 7 | This file is free documentation; the Free Software Foundation gives |
30 | 8 | unlimited permission to copy, distribute and modify it. | 8 | unlimited permission to copy, distribute and modify it. |
31 | 9 | 9 | ||
32 | 10 | Basic Installation | 10 | Basic Installation |
33 | 11 | ================== | 11 | ================== |
34 | 12 | 12 | ||
36 | 13 | Briefly, the shell commands `./configure; make; make install' should | 13 | Briefly, the shell commands `./configure; make; make install' should |
37 | 14 | configure, build, and install this package. The following | 14 | configure, build, and install this package. The following |
38 | 15 | more-detailed instructions are generic; see the `README' file for | 15 | more-detailed instructions are generic; see the `README' file for |
39 | 16 | instructions specific to this package. | 16 | instructions specific to this package. |
40 | @@ -73,9 +73,9 @@ | |||
41 | 73 | Compilers and Options | 73 | Compilers and Options |
42 | 74 | ===================== | 74 | ===================== |
43 | 75 | 75 | ||
47 | 76 | Some systems require unusual options for compilation or linking that | 76 | Some systems require unusual options for compilation or linking that the |
48 | 77 | the `configure' script does not know about. Run `./configure --help' | 77 | `configure' script does not know about. Run `./configure --help' for |
49 | 78 | for details on some of the pertinent environment variables. | 78 | details on some of the pertinent environment variables. |
50 | 79 | 79 | ||
51 | 80 | You can give `configure' initial values for configuration parameters | 80 | You can give `configure' initial values for configuration parameters |
52 | 81 | by setting variables in the command line or in the environment. Here | 81 | by setting variables in the command line or in the environment. Here |
53 | @@ -88,7 +88,7 @@ | |||
54 | 88 | Compiling For Multiple Architectures | 88 | Compiling For Multiple Architectures |
55 | 89 | ==================================== | 89 | ==================================== |
56 | 90 | 90 | ||
58 | 91 | You can compile the package for more than one kind of computer at the | 91 | You can compile the package for more than one kind of computer at the |
59 | 92 | same time, by placing the object files for each architecture in their | 92 | same time, by placing the object files for each architecture in their |
60 | 93 | own directory. To do this, you can use GNU `make'. `cd' to the | 93 | own directory. To do this, you can use GNU `make'. `cd' to the |
61 | 94 | directory where you want the object files and executables to go and run | 94 | directory where you want the object files and executables to go and run |
62 | @@ -100,24 +100,10 @@ | |||
63 | 100 | installed the package for one architecture, use `make distclean' before | 100 | installed the package for one architecture, use `make distclean' before |
64 | 101 | reconfiguring for another architecture. | 101 | reconfiguring for another architecture. |
65 | 102 | 102 | ||
66 | 103 | On MacOS X 10.5 and later systems, you can create libraries and | ||
67 | 104 | executables that work on multiple system types--known as "fat" or | ||
68 | 105 | "universal" binaries--by specifying multiple `-arch' options to the | ||
69 | 106 | compiler but only a single `-arch' option to the preprocessor. Like | ||
70 | 107 | this: | ||
71 | 108 | |||
72 | 109 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ | ||
73 | 110 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ | ||
74 | 111 | CPP="gcc -E" CXXCPP="g++ -E" | ||
75 | 112 | |||
76 | 113 | This is not guaranteed to produce working output in all cases, you | ||
77 | 114 | may have to build one architecture at a time and combine the results | ||
78 | 115 | using the `lipo' tool if you have problems. | ||
79 | 116 | |||
80 | 117 | Installation Names | 103 | Installation Names |
81 | 118 | ================== | 104 | ================== |
82 | 119 | 105 | ||
84 | 120 | By default, `make install' installs the package's commands under | 106 | By default, `make install' installs the package's commands under |
85 | 121 | `/usr/local/bin', include files under `/usr/local/include', etc. You | 107 | `/usr/local/bin', include files under `/usr/local/include', etc. You |
86 | 122 | can specify an installation prefix other than `/usr/local' by giving | 108 | can specify an installation prefix other than `/usr/local' by giving |
87 | 123 | `configure' the option `--prefix=PREFIX'. | 109 | `configure' the option `--prefix=PREFIX'. |
88 | @@ -140,7 +126,7 @@ | |||
89 | 140 | Optional Features | 126 | Optional Features |
90 | 141 | ================= | 127 | ================= |
91 | 142 | 128 | ||
93 | 143 | Some packages pay attention to `--enable-FEATURE' options to | 129 | Some packages pay attention to `--enable-FEATURE' options to |
94 | 144 | `configure', where FEATURE indicates an optional part of the package. | 130 | `configure', where FEATURE indicates an optional part of the package. |
95 | 145 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE | 131 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE |
96 | 146 | is something like `gnu-as' or `x' (for the X Window System). The | 132 | is something like `gnu-as' or `x' (for the X Window System). The |
97 | @@ -152,36 +138,14 @@ | |||
98 | 152 | you can use the `configure' options `--x-includes=DIR' and | 138 | you can use the `configure' options `--x-includes=DIR' and |
99 | 153 | `--x-libraries=DIR' to specify their locations. | 139 | `--x-libraries=DIR' to specify their locations. |
100 | 154 | 140 | ||
101 | 155 | Particular systems | ||
102 | 156 | ================== | ||
103 | 157 | |||
104 | 158 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU | ||
105 | 159 | CC is not installed, it is recommended to use the following options in | ||
106 | 160 | order to use an ANSI C compiler: | ||
107 | 161 | |||
108 | 162 | ./configure CC="cc -Ae" | ||
109 | 163 | |||
110 | 164 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. | ||
111 | 165 | |||
112 | 166 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot | ||
113 | 167 | parse its `<wchar.h>' header file. The option `-nodtk' can be used as | ||
114 | 168 | a workaround. If GNU CC is not installed, it is therefore recommended | ||
115 | 169 | to try | ||
116 | 170 | |||
117 | 171 | ./configure CC="cc" | ||
118 | 172 | |||
119 | 173 | and if that doesn't work, try | ||
120 | 174 | |||
121 | 175 | ./configure CC="cc -nodtk" | ||
122 | 176 | |||
123 | 177 | Specifying the System Type | 141 | Specifying the System Type |
124 | 178 | ========================== | 142 | ========================== |
125 | 179 | 143 | ||
131 | 180 | There may be some features `configure' cannot figure out | 144 | There may be some features `configure' cannot figure out automatically, |
132 | 181 | automatically, but needs to determine by the type of machine the package | 145 | but needs to determine by the type of machine the package will run on. |
133 | 182 | will run on. Usually, assuming the package is built to be run on the | 146 | Usually, assuming the package is built to be run on the _same_ |
134 | 183 | _same_ architectures, `configure' can figure that out, but if it prints | 147 | architectures, `configure' can figure that out, but if it prints a |
135 | 184 | a message saying it cannot guess the machine type, give it the | 148 | message saying it cannot guess the machine type, give it the |
136 | 185 | `--build=TYPE' option. TYPE can either be a short name for the system | 149 | `--build=TYPE' option. TYPE can either be a short name for the system |
137 | 186 | type, such as `sun4', or a canonical name which has the form: | 150 | type, such as `sun4', or a canonical name which has the form: |
138 | 187 | 151 | ||
139 | @@ -207,9 +171,9 @@ | |||
140 | 207 | Sharing Defaults | 171 | Sharing Defaults |
141 | 208 | ================ | 172 | ================ |
142 | 209 | 173 | ||
146 | 210 | If you want to set default values for `configure' scripts to share, | 174 | If you want to set default values for `configure' scripts to share, you |
147 | 211 | you can create a site shell script called `config.site' that gives | 175 | can create a site shell script called `config.site' that gives default |
148 | 212 | default values for variables like `CC', `cache_file', and `prefix'. | 176 | values for variables like `CC', `cache_file', and `prefix'. |
149 | 213 | `configure' looks for `PREFIX/share/config.site' if it exists, then | 177 | `configure' looks for `PREFIX/share/config.site' if it exists, then |
150 | 214 | `PREFIX/etc/config.site' if it exists. Or, you can set the | 178 | `PREFIX/etc/config.site' if it exists. Or, you can set the |
151 | 215 | `CONFIG_SITE' environment variable to the location of the site script. | 179 | `CONFIG_SITE' environment variable to the location of the site script. |
152 | @@ -218,7 +182,7 @@ | |||
153 | 218 | Defining Variables | 182 | Defining Variables |
154 | 219 | ================== | 183 | ================== |
155 | 220 | 184 | ||
157 | 221 | Variables not defined in a site shell script can be set in the | 185 | Variables not defined in a site shell script can be set in the |
158 | 222 | environment passed to `configure'. However, some packages may run | 186 | environment passed to `configure'. However, some packages may run |
159 | 223 | configure again during the build, and the customized values of these | 187 | configure again during the build, and the customized values of these |
160 | 224 | variables may be lost. In order to avoid this problem, you should set | 188 | variables may be lost. In order to avoid this problem, you should set |
161 | @@ -237,19 +201,11 @@ | |||
162 | 237 | `configure' Invocation | 201 | `configure' Invocation |
163 | 238 | ====================== | 202 | ====================== |
164 | 239 | 203 | ||
167 | 240 | `configure' recognizes the following options to control how it | 204 | `configure' recognizes the following options to control how it operates. |
166 | 241 | operates. | ||
168 | 242 | 205 | ||
169 | 243 | `--help' | 206 | `--help' |
170 | 244 | `-h' | 207 | `-h' |
179 | 245 | Print a summary of all of the options to `configure', and exit. | 208 | Print a summary of the options to `configure', and exit. |
172 | 246 | |||
173 | 247 | `--help=short' | ||
174 | 248 | `--help=recursive' | ||
175 | 249 | Print a summary of the options unique to this package's | ||
176 | 250 | `configure', and exit. The `short' variant lists options used | ||
177 | 251 | only in the top level, while the `recursive' variant lists options | ||
178 | 252 | also present in any nested packages. | ||
180 | 253 | 209 | ||
181 | 254 | `--version' | 210 | `--version' |
182 | 255 | `-V' | 211 | `-V' |
183 | @@ -276,16 +232,6 @@ | |||
184 | 276 | Look for the package's source code in directory DIR. Usually | 232 | Look for the package's source code in directory DIR. Usually |
185 | 277 | `configure' can determine that directory automatically. | 233 | `configure' can determine that directory automatically. |
186 | 278 | 234 | ||
187 | 279 | `--prefix=DIR' | ||
188 | 280 | Use DIR as the installation prefix. *Note Installation Names:: | ||
189 | 281 | for more details, including other options available for fine-tuning | ||
190 | 282 | the installation locations. | ||
191 | 283 | |||
192 | 284 | `--no-create' | ||
193 | 285 | `-n' | ||
194 | 286 | Run the configure checks, but stop before creating any output | ||
195 | 287 | files. | ||
196 | 288 | |||
197 | 289 | `configure' also accepts some other, not widely useful, options. Run | 235 | `configure' also accepts some other, not widely useful, options. Run |
198 | 290 | `configure --help' for more details. | 236 | `configure --help' for more details. |
199 | 291 | 237 | ||
200 | 292 | 238 | ||
201 | === added directory 'applets/uawrapper' | |||
202 | === added file 'applets/uawrapper/awn-ua-wrapper.h' | |||
203 | --- applets/uawrapper/awn-ua-wrapper.h 1970-01-01 00:00:00 +0000 | |||
204 | +++ applets/uawrapper/awn-ua-wrapper.h 2009-06-25 04:55:53 +0000 | |||
205 | @@ -0,0 +1,42 @@ | |||
206 | 1 | /* awn-ua-wrapper.h */ | ||
207 | 2 | |||
208 | 3 | #ifndef _AWN_UA_WRAPPER | ||
209 | 4 | #define _AWN_UA_WRAPPER | ||
210 | 5 | |||
211 | 6 | #include <glib-object.h> | ||
212 | 7 | #include <libawn/libawn.h> | ||
213 | 8 | |||
214 | 9 | G_BEGIN_DECLS | ||
215 | 10 | |||
216 | 11 | #define AWN_TYPE_UA_WRAPPER awn_ua_wrapper_get_type() | ||
217 | 12 | |||
218 | 13 | #define AWN_UA_WRAPPER(obj) \ | ||
219 | 14 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_UA_WRAPPER, AwnUAWrapper)) | ||
220 | 15 | |||
221 | 16 | #define AWN_UA_WRAPPER_CLASS(klass) \ | ||
222 | 17 | (G_TYPE_CHECK_CLASS_CAST ((klass), AWN_TYPE_UA_WRAPPER, AwnUAWrapperClass)) | ||
223 | 18 | |||
224 | 19 | #define AWN_IS_UA_WRAPPER(obj) \ | ||
225 | 20 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_UA_WRAPPER)) | ||
226 | 21 | |||
227 | 22 | #define AWN_IS_UA_WRAPPER_CLASS(klass) \ | ||
228 | 23 | (G_TYPE_CHECK_CLASS_TYPE ((klass), AWN_TYPE_UA_WRAPPER)) | ||
229 | 24 | |||
230 | 25 | #define AWN_UA_WRAPPER_GET_CLASS(obj) \ | ||
231 | 26 | (G_TYPE_INSTANCE_GET_CLASS ((obj), AWN_TYPE_UA_WRAPPER, AwnUAWrapperClass)) | ||
232 | 27 | |||
233 | 28 | typedef struct { | ||
234 | 29 | AwnApplet parent; | ||
235 | 30 | } AwnUAWrapper; | ||
236 | 31 | |||
237 | 32 | typedef struct { | ||
238 | 33 | AwnAppletClass parent_class; | ||
239 | 34 | } AwnUAWrapperClass; | ||
240 | 35 | |||
241 | 36 | GType awn_ua_wrapper_get_type (void); | ||
242 | 37 | |||
243 | 38 | AwnUAWrapper* awn_ua_wrapper_new (gchar* uid, gint panel_id); | ||
244 | 39 | |||
245 | 40 | G_END_DECLS | ||
246 | 41 | |||
247 | 42 | #endif /* _AWN_UA_WRAPPER */ | ||
248 | 0 | 43 | ||
249 | === modified file 'awn-settings/awnClass.py' | |||
250 | --- awn-settings/awnClass.py 2009-07-10 00:56:51 +0000 | |||
251 | +++ awn-settings/awnClass.py 2009-07-14 17:57:18 +0000 | |||
252 | @@ -1537,16 +1537,22 @@ | |||
253 | 1537 | os.unlink(filename) | 1537 | os.unlink(filename) |
254 | 1538 | 1538 | ||
255 | 1539 | def _apply (self): | 1539 | def _apply (self): |
257 | 1540 | l = [] | 1540 | applets_list = [] |
258 | 1541 | ua_list = [] | ||
259 | 1542 | |||
260 | 1541 | it = self.active_model.get_iter_first () | 1543 | it = self.active_model.get_iter_first () |
261 | 1542 | while (it): | 1544 | while (it): |
262 | 1543 | path = self.active_model.get_value (it, 1) | 1545 | path = self.active_model.get_value (it, 1) |
263 | 1544 | uid = self.active_model.get_value (it, 2) | 1546 | uid = self.active_model.get_value (it, 2) |
264 | 1545 | s = "%s::%s" % (path, uid) | 1547 | s = "%s::%s" % (path, uid) |
266 | 1546 | l.append (s) | 1548 | if path.endswith(".desktop"): |
267 | 1549 | applets_list.append(s) | ||
268 | 1550 | else: | ||
269 | 1551 | ua_list.append(s) | ||
270 | 1552 | |||
271 | 1547 | it= self.active_model.iter_next (it) | 1553 | it= self.active_model.iter_next (it) |
272 | 1548 | 1554 | ||
274 | 1549 | self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, l) | 1555 | self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets_list) |
275 | 1550 | 1556 | ||
276 | 1551 | def up_clicked (self, button): | 1557 | def up_clicked (self, button): |
277 | 1552 | select = self.treeview.get_selection() | 1558 | select = self.treeview.get_selection() |
278 | @@ -1592,18 +1598,32 @@ | |||
279 | 1592 | 1598 | ||
280 | 1593 | applets = self.client.get_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING) | 1599 | applets = self.client.get_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING) |
281 | 1594 | 1600 | ||
282 | 1601 | ua_applets = self.client.get_list(defs.PANEL, defs.UA_LIST, awn.CONFIG_LIST_STRING) | ||
283 | 1602 | |||
284 | 1603 | for ua in ua_applets: | ||
285 | 1604 | tokens = ua.split("::") | ||
286 | 1605 | applets.insert(int(tokens[1]), ua) | ||
287 | 1606 | |||
288 | 1595 | self.refresh_icon_list (applets, self.active_model) | 1607 | self.refresh_icon_list (applets, self.active_model) |
289 | 1596 | 1608 | ||
290 | 1597 | def refresh_icon_list (self, applets, model): | 1609 | def refresh_icon_list (self, applets, model): |
298 | 1598 | for a in applets: | 1610 | for a in applets: |
299 | 1599 | tokens = a.split("::") | 1611 | tokens = a.split("::") |
300 | 1600 | path = tokens[0] | 1612 | if tokens[0].endswith(".desktop"): |
301 | 1601 | uid = tokens[1] | 1613 | path = tokens[0] |
302 | 1602 | icon, text, name = self.make_row(path) | 1614 | uid = tokens[1] |
303 | 1603 | if len (text) < 2: | 1615 | icon, text, name = self.make_row(path) |
304 | 1604 | continue; | 1616 | if len (text) < 2: |
305 | 1617 | continue; | ||
306 | 1605 | 1618 | ||
308 | 1606 | model.append([icon, path, uid, text]) | 1619 | model.append([icon, path, uid, text]) |
309 | 1620 | else: | ||
310 | 1621 | path = tokens[0] | ||
311 | 1622 | uid = tokens[1] | ||
312 | 1623 | theme = gtk.icon_theme_get_default () | ||
313 | 1624 | icon = theme.load_icon ("screenlets", 32, 0) | ||
314 | 1625 | text = tokens[0] | ||
315 | 1626 | model.append([icon, path, uid, text]) | ||
316 | 1607 | 1627 | ||
317 | 1608 | def load_applets (self): | 1628 | def load_applets (self): |
318 | 1609 | applets = self.applets_by_categories() | 1629 | applets = self.applets_by_categories() |
319 | @@ -1645,7 +1665,21 @@ | |||
320 | 1645 | applets = l.values() | 1665 | applets = l.values() |
321 | 1646 | 1666 | ||
322 | 1647 | if not None in applets and self.load_finished: | 1667 | if not None in applets and self.load_finished: |
324 | 1648 | self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets) | 1668 | applets_list = [] |
325 | 1669 | ua_list = [] | ||
326 | 1670 | for a in applets: | ||
327 | 1671 | tokens = a.split("::") | ||
328 | 1672 | path = tokens[0] | ||
329 | 1673 | if path.endswith(".desktop"): | ||
330 | 1674 | applets_list.append(a) | ||
331 | 1675 | else: | ||
332 | 1676 | position = applets.index(a) | ||
333 | 1677 | ua = tokens[0] + "::" + str(position) | ||
334 | 1678 | ua_list.append(ua) | ||
335 | 1679 | |||
336 | 1680 | self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets_list) | ||
337 | 1681 | self.client.set_list(defs.PANEL, defs.UA_LIST, awn.CONFIG_LIST_STRING, ua_list) | ||
338 | 1682 | |||
339 | 1649 | 1683 | ||
340 | 1650 | def callback_widget_filter_applets(self, data=None): | 1684 | def callback_widget_filter_applets(self, data=None): |
341 | 1651 | model = self.choose_categorie.get_model() | 1685 | model = self.choose_categorie.get_model() |
342 | 1652 | 1686 | ||
343 | === modified file 'awn-settings/awnDefs.py.in' | |||
344 | --- awn-settings/awnDefs.py.in 2009-07-10 00:56:51 +0000 | |||
345 | +++ awn-settings/awnDefs.py.in 2009-07-14 19:09:25 +0000 | |||
346 | @@ -59,6 +59,7 @@ | |||
347 | 59 | EXPAND = "expand" #bool | 59 | EXPAND = "expand" #bool |
348 | 60 | CLICKTHROUGH = "clickthrough" #int | 60 | CLICKTHROUGH = "clickthrough" #int |
349 | 61 | BEHAVIOR = "behavior" #int | 61 | BEHAVIOR = "behavior" #int |
350 | 62 | UA_LIST = "ua_active_list" #list-string | ||
351 | 62 | 63 | ||
352 | 63 | PANELS = "panels" #group | 64 | PANELS = "panels" #group |
353 | 64 | PANEL_LIST = "panel_list" #int | 65 | PANEL_LIST = "panel_list" #int |
354 | 65 | 66 | ||
355 | === modified file 'data/awn.schema-ini.in' | |||
356 | --- data/awn.schema-ini.in 2009-07-06 22:12:25 +0000 | |||
357 | +++ data/awn.schema-ini.in 2009-07-14 18:01:40 +0000 | |||
358 | @@ -28,6 +28,16 @@ | |||
359 | 28 | default = @APPLETDATADIR@/taskmanager.desktop::1 | 28 | default = @APPLETDATADIR@/taskmanager.desktop::1 |
360 | 29 | description = The list of applets for this panel ordered from ltr or ttb. | 29 | description = The list of applets for this panel ordered from ltr or ttb. |
361 | 30 | 30 | ||
362 | 31 | [panel/ua_list] | ||
363 | 32 | type = list-string | ||
364 | 33 | default = | ||
365 | 34 | description = The list of UA Screenlets that have been previous added in the form ScreeneletInstance::Position. | ||
366 | 35 | |||
367 | 36 | [panel/ua_active_list] | ||
368 | 37 | type = list-string | ||
369 | 38 | default = | ||
370 | 39 | description = The active list UA Screenlets for this panel. | ||
371 | 40 | |||
372 | 31 | [panel/monitor_force] | 41 | [panel/monitor_force] |
373 | 32 | type = bool | 42 | type = bool |
374 | 33 | default = False | 43 | default = False |
375 | 34 | 44 | ||
376 | === modified file 'libawn/awn-alignment.c' | |||
377 | --- libawn/awn-alignment.c 2009-03-26 23:47:26 +0000 | |||
378 | +++ libawn/awn-alignment.c 2009-06-25 18:26:59 +0000 | |||
379 | @@ -192,6 +192,18 @@ | |||
380 | 192 | return alignment; | 192 | return alignment; |
381 | 193 | } | 193 | } |
382 | 194 | 194 | ||
383 | 195 | GtkWidget* | ||
384 | 196 | awn_alignment_new (void) | ||
385 | 197 | { | ||
386 | 198 | GtkWidget *alignment; | ||
387 | 199 | |||
388 | 200 | alignment = g_object_new(AWN_TYPE_ALIGNMENT, | ||
389 | 201 | NULL); | ||
390 | 202 | |||
391 | 203 | return alignment; | ||
392 | 204 | } | ||
393 | 205 | |||
394 | 206 | |||
395 | 195 | static void | 207 | static void |
396 | 196 | on_orient_changed (AwnAlignment *alignment, AwnOrientation orient) | 208 | on_orient_changed (AwnAlignment *alignment, AwnOrientation orient) |
397 | 197 | { | 209 | { |
398 | 198 | 210 | ||
399 | === modified file 'libawn/awn-alignment.h' | |||
400 | --- libawn/awn-alignment.h 2009-03-22 23:12:16 +0000 | |||
401 | +++ libawn/awn-alignment.h 2009-06-25 18:26:59 +0000 | |||
402 | @@ -80,6 +80,8 @@ | |||
403 | 80 | void awn_alignment_set_offset_modifier (AwnAlignment *alignment, | 80 | void awn_alignment_set_offset_modifier (AwnAlignment *alignment, |
404 | 81 | gint modifier); | 81 | gint modifier); |
405 | 82 | 82 | ||
406 | 83 | GtkWidget* awn_alignment_new (void); | ||
407 | 84 | |||
408 | 83 | G_END_DECLS | 85 | G_END_DECLS |
409 | 84 | 86 | ||
410 | 85 | #endif | 87 | #endif |
411 | 86 | 88 | ||
412 | === modified file 'src/Makefile.am' | |||
413 | --- src/Makefile.am 2009-06-21 13:23:05 +0000 | |||
414 | +++ src/Makefile.am 2009-07-13 18:20:16 +0000 | |||
415 | @@ -27,6 +27,7 @@ | |||
416 | 27 | awn-app-glue.h \ | 27 | awn-app-glue.h \ |
417 | 28 | awn-applet-manager.c \ | 28 | awn-applet-manager.c \ |
418 | 29 | awn-applet-manager.h \ | 29 | awn-applet-manager.h \ |
419 | 30 | awn-applet-manager-glue.h \ | ||
420 | 30 | awn-applet-proxy.c \ | 31 | awn-applet-proxy.c \ |
421 | 31 | awn-applet-proxy.h \ | 32 | awn-applet-proxy.h \ |
422 | 32 | awn-background.c \ | 33 | awn-background.c \ |
423 | @@ -51,6 +52,8 @@ | |||
424 | 51 | awn-panel-glue.h \ | 52 | awn-panel-glue.h \ |
425 | 52 | awn-throbber.c \ | 53 | awn-throbber.c \ |
426 | 53 | awn-throbber.h \ | 54 | awn-throbber.h \ |
427 | 55 | awn-ua-alignment.c \ | ||
428 | 56 | awn-ua-alignment.h \ | ||
429 | 54 | awn-x.h \ | 57 | awn-x.h \ |
430 | 55 | awn-x.c \ | 58 | awn-x.c \ |
431 | 56 | inlinepixbufs.h \ | 59 | inlinepixbufs.h \ |
432 | @@ -65,9 +68,13 @@ | |||
433 | 65 | awn-panel-glue.h: awn-panel-dbus.xml Makefile | 68 | awn-panel-glue.h: awn-panel-dbus.xml Makefile |
434 | 66 | $(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $< | 69 | $(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $< |
435 | 67 | 70 | ||
436 | 71 | awn-applet-manager-glue.h: awn-applet-manager-dbus.xml Makefile | ||
437 | 72 | $(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_ua --mode=glib-server --output=$@ $< | ||
438 | 73 | |||
439 | 68 | BUILT_SOURCES = \ | 74 | BUILT_SOURCES = \ |
440 | 69 | awn-app-glue.h \ | 75 | awn-app-glue.h \ |
441 | 70 | awn-panel-glue.h \ | 76 | awn-panel-glue.h \ |
442 | 77 | awn-applet-manager-glue.h \ | ||
443 | 71 | $(MARSHALFILES) \ | 78 | $(MARSHALFILES) \ |
444 | 72 | $(NULL) | 79 | $(NULL) |
445 | 73 | 80 | ||
446 | @@ -76,6 +83,7 @@ | |||
447 | 76 | EXTRA_DIST = \ | 83 | EXTRA_DIST = \ |
448 | 77 | awn-app-dbus.xml \ | 84 | awn-app-dbus.xml \ |
449 | 78 | awn-panel-dbus.xml \ | 85 | awn-panel-dbus.xml \ |
450 | 86 | awn-applet-manager-dbus.xml \ | ||
451 | 79 | $(NULL) | 87 | $(NULL) |
452 | 80 | 88 | ||
453 | 81 | # vim: set ts=8 sts=8 sw=8 : | 89 | # vim: set ts=8 sts=8 sw=8 : |
454 | 82 | 90 | ||
455 | === added file 'src/awn-applet-manager-dbus.xml' | |||
456 | --- src/awn-applet-manager-dbus.xml 1970-01-01 00:00:00 +0000 | |||
457 | +++ src/awn-applet-manager-dbus.xml 2009-06-02 22:11:19 +0000 | |||
458 | @@ -0,0 +1,21 @@ | |||
459 | 1 | <?xml version="1.0"?> | ||
460 | 2 | <node name="/org/awnproject/Awn/UA"> | ||
461 | 3 | <interface name="org.awnproject.Awn.UA"> | ||
462 | 4 | <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_ua"/> | ||
463 | 5 | |||
464 | 6 | <!-- Methods --> | ||
465 | 7 | <method name="add_applet"> | ||
466 | 8 | <arg name="name" type="s" direction="in" /> | ||
467 | 9 | <arg name="uid" type="x" direction="in" /> | ||
468 | 10 | <arg name="width" type="i" direction="in" /> | ||
469 | 11 | <arg name="height" type="i" direction="in" /> | ||
470 | 12 | <arg name="size_type" type="s" direction="in" /> | ||
471 | 13 | </method> | ||
472 | 14 | |||
473 | 15 | <method name="get_all_server_flags"> | ||
474 | 16 | <arg name="name" type="s" direction="in" /> | ||
475 | 17 | <arg name="hash" type="a{ss}" direction="out" /> | ||
476 | 18 | </method> | ||
477 | 19 | |||
478 | 20 | </interface> | ||
479 | 21 | </node> | ||
480 | 0 | 22 | ||
481 | === modified file 'src/awn-applet-manager.c' | |||
482 | --- src/awn-applet-manager.c 2009-07-09 07:12:27 +0000 | |||
483 | +++ src/awn-applet-manager.c 2009-07-14 20:38:19 +0000 | |||
484 | @@ -16,22 +16,26 @@ | |||
485 | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
486 | 17 | * | 17 | * |
487 | 18 | * Author : Neil Jagdish Patel <njpatel@gmail.com> | 18 | * Author : Neil Jagdish Patel <njpatel@gmail.com> |
489 | 19 | * | 19 | *bind |
490 | 20 | */ | 20 | */ |
491 | 21 | 21 | ||
492 | 22 | #include "config.h" | 22 | #include "config.h" |
493 | 23 | 23 | ||
495 | 24 | #include <libawn/awn-config-bridge.h> | 24 | #include <libawn/libawn.h> |
496 | 25 | #include <dbus/dbus-glib.h> | ||
497 | 26 | #include <dbus/dbus-glib-bindings.h> | ||
498 | 25 | #include <libawn/awn-utils.h> | 27 | #include <libawn/awn-utils.h> |
499 | 26 | #include <math.h> | 28 | #include <math.h> |
500 | 27 | 29 | ||
501 | 28 | #include "awn-defines.h" | 30 | #include "awn-defines.h" |
502 | 29 | #include "awn-applet-manager.h" | 31 | #include "awn-applet-manager.h" |
504 | 30 | 32 | #include "awn-ua-alignment.h" | |
505 | 31 | #include "awn-applet-proxy.h" | 33 | #include "awn-applet-proxy.h" |
506 | 32 | #include "awn-throbber.h" | 34 | #include "awn-throbber.h" |
507 | 33 | #include "xutils.h" | 35 | #include "xutils.h" |
508 | 34 | 36 | ||
509 | 37 | #define MAX_UA_LIST_ENTRIES 50 | ||
510 | 38 | |||
511 | 35 | G_DEFINE_TYPE (AwnAppletManager, awn_applet_manager, GTK_TYPE_BOX) | 39 | G_DEFINE_TYPE (AwnAppletManager, awn_applet_manager, GTK_TYPE_BOX) |
512 | 36 | 40 | ||
513 | 37 | #define AWN_APPLET_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, \ | 41 | #define AWN_APPLET_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, \ |
514 | @@ -44,8 +48,15 @@ | |||
515 | 44 | AwnOrientation orient; | 48 | AwnOrientation orient; |
516 | 45 | gint offset; | 49 | gint offset; |
517 | 46 | gint size; | 50 | gint size; |
518 | 51 | |||
519 | 47 | GSList *applet_list; | 52 | GSList *applet_list; |
520 | 48 | 53 | ||
521 | 54 | /*ua_list does not serve the same purpose as the applet_list | ||
522 | 55 | It's a list of unique UA names plus their position in the panel | ||
523 | 56 | */ | ||
524 | 57 | GSList *ua_list; | ||
525 | 58 | GSList *ua_active_list; | ||
526 | 59 | |||
527 | 49 | gboolean docklet_mode; | 60 | gboolean docklet_mode; |
528 | 50 | GtkWidget *docklet_widget; | 61 | GtkWidget *docklet_widget; |
529 | 51 | 62 | ||
530 | @@ -60,6 +71,7 @@ | |||
531 | 60 | 71 | ||
532 | 61 | /* Current box class */ | 72 | /* Current box class */ |
533 | 62 | GtkWidgetClass *klass; | 73 | GtkWidgetClass *klass; |
534 | 74 | |||
535 | 63 | }; | 75 | }; |
536 | 64 | 76 | ||
537 | 65 | enum | 77 | enum |
538 | @@ -71,6 +83,8 @@ | |||
539 | 71 | PROP_OFFSET, | 83 | PROP_OFFSET, |
540 | 72 | PROP_SIZE, | 84 | PROP_SIZE, |
541 | 73 | PROP_APPLET_LIST, | 85 | PROP_APPLET_LIST, |
542 | 86 | PROP_UA_LIST, | ||
543 | 87 | PROP_UA_ACTIVE_LIST, | ||
544 | 74 | PROP_EXPANDS | 88 | PROP_EXPANDS |
545 | 75 | }; | 89 | }; |
546 | 76 | 90 | ||
547 | @@ -123,6 +137,20 @@ | |||
548 | 123 | AWN_GROUP_PANEL, AWN_PANEL_APPLET_LIST, | 137 | AWN_GROUP_PANEL, AWN_PANEL_APPLET_LIST, |
549 | 124 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | 138 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, |
550 | 125 | object, "applet_list"); | 139 | object, "applet_list"); |
551 | 140 | awn_config_bridge_bind_list (bridge, priv->client, | ||
552 | 141 | AWN_GROUP_PANEL, AWN_PANEL_UA_LIST, | ||
553 | 142 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
554 | 143 | object, "ua_list"); | ||
555 | 144 | awn_config_bridge_bind_list (bridge, priv->client, | ||
556 | 145 | AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST, | ||
557 | 146 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
558 | 147 | object, "ua_active_list"); | ||
559 | 148 | /* | ||
560 | 149 | ua_active_list should be empty when awn starts... | ||
561 | 150 | */ | ||
562 | 151 | awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST, | ||
563 | 152 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
564 | 153 | NULL, NULL); | ||
565 | 126 | } | 154 | } |
566 | 127 | 155 | ||
567 | 128 | static void | 156 | static void |
568 | @@ -165,10 +193,15 @@ | |||
569 | 165 | case PROP_SIZE: | 193 | case PROP_SIZE: |
570 | 166 | g_value_set_int (value, priv->size); | 194 | g_value_set_int (value, priv->size); |
571 | 167 | break; | 195 | break; |
572 | 168 | |||
573 | 169 | case PROP_APPLET_LIST: | 196 | case PROP_APPLET_LIST: |
574 | 170 | g_value_set_pointer (value, priv->applet_list); | 197 | g_value_set_pointer (value, priv->applet_list); |
575 | 171 | break; | 198 | break; |
576 | 199 | case PROP_UA_LIST: | ||
577 | 200 | g_value_set_pointer (value, priv->ua_list); | ||
578 | 201 | break; | ||
579 | 202 | case PROP_UA_ACTIVE_LIST: | ||
580 | 203 | g_value_set_pointer (value, priv->ua_active_list); | ||
581 | 204 | break; | ||
582 | 172 | case PROP_EXPANDS: | 205 | case PROP_EXPANDS: |
583 | 173 | g_value_set_boolean (value, priv->expands); | 206 | g_value_set_boolean (value, priv->expands); |
584 | 174 | break; | 207 | break; |
585 | @@ -208,6 +241,16 @@ | |||
586 | 208 | priv->applet_list = g_value_get_pointer (value); | 241 | priv->applet_list = g_value_get_pointer (value); |
587 | 209 | awn_applet_manager_refresh_applets (manager); | 242 | awn_applet_manager_refresh_applets (manager); |
588 | 210 | break; | 243 | break; |
589 | 244 | case PROP_UA_LIST: | ||
590 | 245 | free_list (priv->ua_list); | ||
591 | 246 | priv->ua_list = g_value_get_pointer (value); | ||
592 | 247 | awn_applet_manager_refresh_applets (manager); | ||
593 | 248 | break; | ||
594 | 249 | case PROP_UA_ACTIVE_LIST: | ||
595 | 250 | free_list (priv->ua_active_list); | ||
596 | 251 | priv->ua_active_list = g_value_get_pointer (value); | ||
597 | 252 | awn_applet_manager_refresh_applets (manager); | ||
598 | 253 | break; | ||
599 | 211 | default: | 254 | default: |
600 | 212 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 255 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
601 | 213 | } | 256 | } |
602 | @@ -240,6 +283,8 @@ | |||
603 | 240 | G_OBJECT_CLASS (awn_applet_manager_parent_class)->dispose (object); | 283 | G_OBJECT_CLASS (awn_applet_manager_parent_class)->dispose (object); |
604 | 241 | } | 284 | } |
605 | 242 | 285 | ||
606 | 286 | #include "awn-applet-manager-glue.h" | ||
607 | 287 | |||
608 | 243 | static void | 288 | static void |
609 | 244 | awn_applet_manager_class_init (AwnAppletManagerClass *klass) | 289 | awn_applet_manager_class_init (AwnAppletManagerClass *klass) |
610 | 245 | { | 290 | { |
611 | @@ -294,6 +339,20 @@ | |||
612 | 294 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | 339 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
613 | 295 | 340 | ||
614 | 296 | g_object_class_install_property (obj_class, | 341 | g_object_class_install_property (obj_class, |
615 | 342 | PROP_UA_LIST, | ||
616 | 343 | g_param_spec_pointer ("ua_list", | ||
617 | 344 | "UA List", | ||
618 | 345 | "The rememebered screenlet positions for this panel", | ||
619 | 346 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | ||
620 | 347 | |||
621 | 348 | g_object_class_install_property (obj_class, | ||
622 | 349 | PROP_UA_ACTIVE_LIST, | ||
623 | 350 | g_param_spec_pointer ("ua-active-list", | ||
624 | 351 | "UA Active List", | ||
625 | 352 | "The list of acitve screenlets for this panel", | ||
626 | 353 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | ||
627 | 354 | |||
628 | 355 | g_object_class_install_property (obj_class, | ||
629 | 297 | PROP_EXPANDS, | 356 | PROP_EXPANDS, |
630 | 298 | g_param_spec_boolean ("expands", | 357 | g_param_spec_boolean ("expands", |
631 | 299 | "Expands", | 358 | "Expands", |
632 | @@ -321,12 +380,18 @@ | |||
633 | 321 | G_TYPE_NONE, 0); | 380 | G_TYPE_NONE, 0); |
634 | 322 | 381 | ||
635 | 323 | g_type_class_add_private (obj_class, sizeof (AwnAppletManagerPrivate)); | 382 | g_type_class_add_private (obj_class, sizeof (AwnAppletManagerPrivate)); |
636 | 383 | |||
637 | 384 | dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), | ||
638 | 385 | &dbus_glib_awn_ua_object_info); | ||
639 | 386 | |||
640 | 324 | } | 387 | } |
641 | 325 | 388 | ||
642 | 326 | static void | 389 | static void |
643 | 327 | awn_applet_manager_init (AwnAppletManager *manager) | 390 | awn_applet_manager_init (AwnAppletManager *manager) |
644 | 328 | { | 391 | { |
645 | 329 | AwnAppletManagerPrivate *priv; | 392 | AwnAppletManagerPrivate *priv; |
646 | 393 | DBusGConnection *connection; | ||
647 | 394 | GError *error = NULL; | ||
648 | 330 | 395 | ||
649 | 331 | priv = manager->priv = AWN_APPLET_MANAGER_GET_PRIVATE (manager); | 396 | priv = manager->priv = AWN_APPLET_MANAGER_GET_PRIVATE (manager); |
650 | 332 | 397 | ||
651 | @@ -338,6 +403,21 @@ | |||
652 | 338 | priv->extra_widgets = g_hash_table_new (g_direct_hash, g_direct_equal); | 403 | priv->extra_widgets = g_hash_table_new (g_direct_hash, g_direct_equal); |
653 | 339 | 404 | ||
654 | 340 | gtk_widget_show_all (GTK_WIDGET (manager)); | 405 | gtk_widget_show_all (GTK_WIDGET (manager)); |
655 | 406 | |||
656 | 407 | /* Grab a connection to the bus */ | ||
657 | 408 | connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); | ||
658 | 409 | if (connection == NULL) | ||
659 | 410 | { | ||
660 | 411 | g_warning ("Unable to make connection to the D-Bus session bus: %s", | ||
661 | 412 | error->message); | ||
662 | 413 | g_error_free (error); | ||
663 | 414 | gtk_main_quit (); | ||
664 | 415 | } | ||
665 | 416 | |||
666 | 417 | dbus_g_connection_register_g_object (connection, | ||
667 | 418 | AWN_DBUS_MANAGER_PATH, | ||
668 | 419 | G_OBJECT (GTK_WIDGET (manager))); | ||
669 | 420 | |||
670 | 341 | } | 421 | } |
671 | 342 | 422 | ||
672 | 343 | GtkWidget * | 423 | GtkWidget * |
673 | @@ -505,7 +585,7 @@ | |||
674 | 505 | g_type_class_unref (priv->klass); | 585 | g_type_class_unref (priv->klass); |
675 | 506 | priv->klass = NULL; | 586 | priv->klass = NULL; |
676 | 507 | } | 587 | } |
678 | 508 | 588 | // g_debug ("%s, orient = %d",__func__,priv->orient); | |
679 | 509 | switch (priv->orient) | 589 | switch (priv->orient) |
680 | 510 | { | 590 | { |
681 | 511 | case AWN_ORIENTATION_TOP: | 591 | case AWN_ORIENTATION_TOP: |
682 | @@ -547,7 +627,10 @@ | |||
683 | 547 | { | 627 | { |
684 | 548 | g_free (l->data); | 628 | g_free (l->data); |
685 | 549 | } | 629 | } |
687 | 550 | g_slist_free (list); | 630 | if (list) |
688 | 631 | { | ||
689 | 632 | g_slist_free (list); | ||
690 | 633 | } | ||
691 | 551 | } | 634 | } |
692 | 552 | 635 | ||
693 | 553 | /* | 636 | /* |
694 | @@ -647,6 +730,7 @@ | |||
695 | 647 | gint i = 0; | 730 | gint i = 0; |
696 | 648 | gint applet_num = 0; | 731 | gint applet_num = 0; |
697 | 649 | 732 | ||
698 | 733 | g_debug ("%s",__func__); | ||
699 | 650 | if (!GTK_WIDGET_REALIZED (manager)) | 734 | if (!GTK_WIDGET_REALIZED (manager)) |
700 | 651 | return; | 735 | return; |
701 | 652 | 736 | ||
702 | @@ -684,12 +768,14 @@ | |||
703 | 684 | continue; | 768 | continue; |
704 | 685 | } | 769 | } |
705 | 686 | 770 | ||
706 | 771 | // g_debug ("%s: %s, %s",__func__,tokens[0],tokens[1]); | ||
707 | 687 | /* See if the applet already exists */ | 772 | /* See if the applet already exists */ |
708 | 688 | applet = g_hash_table_lookup (priv->applets, tokens[1]); | 773 | applet = g_hash_table_lookup (priv->applets, tokens[1]); |
709 | 689 | 774 | ||
710 | 690 | /* If not, create it */ | 775 | /* If not, create it */ |
711 | 691 | if (applet == NULL) | 776 | if (applet == NULL) |
712 | 692 | { | 777 | { |
713 | 778 | g_debug ("applet does not exist"); | ||
714 | 693 | applet = create_applet (manager, tokens[0], tokens[1]); | 779 | applet = create_applet (manager, tokens[0], tokens[1]); |
715 | 694 | if (!applet) | 780 | if (!applet) |
716 | 695 | { | 781 | { |
717 | @@ -752,6 +838,7 @@ | |||
718 | 752 | gtk_box_pack_start (GTK_BOX (manager), widget, FALSE, FALSE, 0); | 838 | gtk_box_pack_start (GTK_BOX (manager), widget, FALSE, FALSE, 0); |
719 | 753 | /* caller is supposed to call gtk_widget_show! */ | 839 | /* caller is supposed to call gtk_widget_show! */ |
720 | 754 | } | 840 | } |
721 | 841 | g_print ("Gint : %i : ", pos); | ||
722 | 755 | g_hash_table_replace (priv->extra_widgets, widget, GINT_TO_POINTER (pos)); | 842 | g_hash_table_replace (priv->extra_widgets, widget, GINT_TO_POINTER (pos)); |
723 | 756 | 843 | ||
724 | 757 | awn_applet_manager_refresh_applets (manager); | 844 | awn_applet_manager_refresh_applets (manager); |
725 | @@ -769,6 +856,159 @@ | |||
726 | 769 | } | 856 | } |
727 | 770 | } | 857 | } |
728 | 771 | 858 | ||
729 | 859 | /*DBUS*/ | ||
730 | 860 | /* | ||
731 | 861 | Description of this dbus interface. | ||
732 | 862 | |||
733 | 863 | @action(IFACE) | ||
734 | 864 | def add_applet (self, id, plug_id, width, height, size_type): | ||
735 | 865 | """ | ||
736 | 866 | Add an applet. | ||
737 | 867 | |||
738 | 868 | id: A unique string used to identify the applet. | ||
739 | 869 | plug_id: The applet's gtk.Plug's xid. | ||
740 | 870 | width: A recommended width. This will be interpreted according to size_type. | ||
741 | 871 | height A recommended height. This will be interpreted according to size_type. | ||
742 | 872 | size_type: Determines the meaning of width and height. | ||
743 | 873 | May be one of the following values: | ||
744 | 874 | "scalable"- The applet may be resized as long as the width/height ratio is kept. | ||
745 | 875 | "static"- The applet should be displayed at exactly the size requested. | ||
746 | 876 | "static-width"- The applet's width should remain static, and the server may change the height. | ||
747 | 877 | "static-height"- The applet's height should remain static, and the server may change the width. | ||
748 | 878 | "dynamic"- The applet may be resized to any size. | ||
749 | 879 | desktop_path: Path to the desktop file. | ||
750 | 880 | """ | ||
751 | 881 | # NOTE: Melange currently ignores the size_type parameter. | ||
752 | 882 | container = ToplevelContainer(plug_id, id, self, width, height, | ||
753 | 883 | size_type, backend=self.backend) | ||
754 | 884 | self.containers.append(container) | ||
755 | 885 | */ | ||
756 | 886 | gboolean | ||
757 | 887 | awn_ua_add_applet ( AwnAppletManager *manager, | ||
758 | 888 | gchar *name, | ||
759 | 889 | glong xid, | ||
760 | 890 | gint width, | ||
761 | 891 | gint height, | ||
762 | 892 | gchar *size_type, | ||
763 | 893 | GError **error) | ||
764 | 894 | { | ||
765 | 895 | g_return_val_if_fail (AWN_IS_APPLET_MANAGER (manager),FALSE); | ||
766 | 896 | g_return_val_if_fail ( (g_strcmp0(size_type,"scalable")==0 ) || | ||
767 | 897 | (g_strcmp0(size_type,"dynamic")==0 ), FALSE ); | ||
768 | 898 | |||
769 | 899 | GdkWindow* plugwin; | ||
770 | 900 | AwnAppletManagerPrivate *priv = manager->priv; | ||
771 | 901 | gint pos = g_slist_length (priv->applet_list); | ||
772 | 902 | GdkNativeWindow native_window = (GdkNativeWindow) xid; | ||
773 | 903 | gchar * tmp = g_strdup_printf ("%s::%d",name,pos); | ||
774 | 904 | gchar * ua_list_entry = NULL; | ||
775 | 905 | GtkWidget *ua_alignment; | ||
776 | 906 | double ua_ratio; | ||
777 | 907 | |||
778 | 908 | /* | ||
779 | 909 | Is there an entry in ua_list for this particular screenlet instance(name). | ||
780 | 910 | The comparision function used ignores the position. | ||
781 | 911 | */ | ||
782 | 912 | GSList * search = g_slist_find_custom (priv->ua_list,tmp,awn_ua_alignment_list_cmp); | ||
783 | 913 | if (search) | ||
784 | 914 | { | ||
785 | 915 | /* There's already an entry in ua_list so use that. */ | ||
786 | 916 | GStrv tokens; | ||
787 | 917 | ua_list_entry = g_strdup (search->data) ; | ||
788 | 918 | g_free (tmp); | ||
789 | 919 | /* Get the position where the screenlet should be placed*/ | ||
790 | 920 | tokens = g_strsplit (search->data,"::",2); | ||
791 | 921 | if (tokens && tokens[1]) | ||
792 | 922 | { | ||
793 | 923 | pos = atoi (tokens[1]); | ||
794 | 924 | } | ||
795 | 925 | g_strfreev (tokens); | ||
796 | 926 | /* remove the link... that data will be appended at to the list*/ | ||
797 | 927 | g_free (search->data); | ||
798 | 928 | priv->ua_list = g_slist_delete_link (priv->ua_list,search); | ||
799 | 929 | search = NULL; | ||
800 | 930 | } | ||
801 | 931 | else | ||
802 | 932 | { | ||
803 | 933 | /* | ||
804 | 934 | This screenlet instance is not recorded in ua_list. It will end up being | ||
805 | 935 | placed at the end of the bar | ||
806 | 936 | */ | ||
807 | 937 | ua_list_entry = tmp; | ||
808 | 938 | } | ||
809 | 939 | |||
810 | 940 | /* | ||
811 | 941 | Calculated here and passed to the awn_ua_alignment_new(). AwnUAAlignment | ||
812 | 942 | could recalculate the ratio on bar resizes based on the, then current, | ||
813 | 943 | dimensions of the widget but over time the amount of error in the the | ||
814 | 944 | calcs would increase | ||
815 | 945 | */ | ||
816 | 946 | ua_ratio = width / (double) height; | ||
817 | 947 | ua_alignment = awn_ua_alignment_new(manager,ua_list_entry,ua_ratio); | ||
818 | 948 | |||
819 | 949 | g_signal_connect_swapped (awn_ua_alignment_get_socket(AWN_UA_ALIGNMENT(ua_alignment)), | ||
820 | 950 | "plug-added", | ||
821 | 951 | G_CALLBACK (_applet_plug_added), | ||
822 | 952 | manager); | ||
823 | 953 | |||
824 | 954 | awn_applet_manager_add_widget(manager, GTK_WIDGET (ua_alignment), pos); | ||
825 | 955 | gtk_widget_show_all (ua_alignment); | ||
826 | 956 | |||
827 | 957 | plugwin = awn_ua_alignment_add_id (AWN_UA_ALIGNMENT(ua_alignment),native_window); | ||
828 | 958 | |||
829 | 959 | g_object_set_qdata (G_OBJECT (ua_alignment), | ||
830 | 960 | priv->touch_quark, GINT_TO_POINTER (0)); | ||
831 | 961 | |||
832 | 962 | if (!plugwin) | ||
833 | 963 | { | ||
834 | 964 | g_warning ("UA Plug was not created within socket."); | ||
835 | 965 | gtk_widget_destroy (ua_alignment); | ||
836 | 966 | return FALSE; | ||
837 | 967 | } | ||
838 | 968 | |||
839 | 969 | /* | ||
840 | 970 | Either add the new entry into ua_list or move an existing entry to the | ||
841 | 971 | end of ua_list_entry | ||
842 | 972 | */ | ||
843 | 973 | priv->ua_list = g_slist_append (priv->ua_list,g_strdup(ua_list_entry)); | ||
844 | 974 | |||
845 | 975 | /* Keep the length of ua_list reasonable */ | ||
846 | 976 | if (g_slist_length (priv->ua_list) > MAX_UA_LIST_ENTRIES) | ||
847 | 977 | { | ||
848 | 978 | GSList * iter; | ||
849 | 979 | int i = g_slist_length (priv->ua_list) - MAX_UA_LIST_ENTRIES; | ||
850 | 980 | for(iter = priv->ua_list; i && iter ; iter = priv->ua_list ) | ||
851 | 981 | { | ||
852 | 982 | g_free (iter->data); | ||
853 | 983 | priv->ua_list = g_slist_delete_link (priv->ua_list,iter); | ||
854 | 984 | i--; | ||
855 | 985 | } | ||
856 | 986 | } | ||
857 | 987 | awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_LIST, | ||
858 | 988 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
859 | 989 | priv->ua_list, NULL); | ||
860 | 990 | /*Add our newly active screenlet to thend of the active list */ | ||
861 | 991 | priv->ua_active_list = g_slist_append (priv->ua_active_list,g_strdup(ua_list_entry)); | ||
862 | 992 | awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST, | ||
863 | 993 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
864 | 994 | priv->ua_active_list, NULL); | ||
865 | 995 | |||
866 | 996 | return TRUE; | ||
867 | 997 | } | ||
868 | 998 | |||
869 | 999 | gboolean | ||
870 | 1000 | awn_ua_get_all_server_flags ( AwnAppletManager *manager, | ||
871 | 1001 | GHashTable *hash, | ||
872 | 1002 | gchar *name, | ||
873 | 1003 | GError **error) | ||
874 | 1004 | { | ||
875 | 1005 | /* Future function to return capability of the server | ||
876 | 1006 | For now, it return nothing*/ | ||
877 | 1007 | return TRUE; | ||
878 | 1008 | } | ||
879 | 1009 | |||
880 | 1010 | |||
881 | 1011 | /*End DBUS*/ | ||
882 | 772 | void | 1012 | void |
883 | 773 | awn_applet_manager_show_applets (AwnAppletManager *manager) | 1013 | awn_applet_manager_show_applets (AwnAppletManager *manager) |
884 | 774 | { | 1014 | { |
885 | 775 | 1015 | ||
886 | === modified file 'src/awn-applet-manager.h' | |||
887 | --- src/awn-applet-manager.h 2009-07-08 20:38:35 +0000 | |||
888 | +++ src/awn-applet-manager.h 2009-07-13 18:05:02 +0000 | |||
889 | @@ -25,6 +25,7 @@ | |||
890 | 25 | #include <gtk/gtk.h> | 25 | #include <gtk/gtk.h> |
891 | 26 | 26 | ||
892 | 27 | #include <libawn/awn-config-client.h> | 27 | #include <libawn/awn-config-client.h> |
893 | 28 | #include <libawn/awn-defines.h> | ||
894 | 28 | 29 | ||
895 | 29 | #include "awn-panel.h" | 30 | #include "awn-panel.h" |
896 | 30 | 31 | ||
897 | @@ -82,9 +83,25 @@ | |||
898 | 82 | 83 | ||
899 | 83 | gboolean awn_applet_manager_get_expands (AwnAppletManager *manager); | 84 | gboolean awn_applet_manager_get_expands (AwnAppletManager *manager); |
900 | 84 | 85 | ||
904 | 85 | void awn_applet_manager_set_applet_flags (AwnAppletManager *manager, | 86 | |
905 | 86 | const gchar *uid, | 87 | |
906 | 87 | AwnAppletFlags flags); | 88 | gboolean awn_ua_get_all_server_flags (AwnAppletManager *manager, |
907 | 89 | GHashTable *hash, | ||
908 | 90 | gchar *name, | ||
909 | 91 | GError **error); | ||
910 | 92 | |||
911 | 93 | gboolean awn_ua_add_applet ( AwnAppletManager *manager, | ||
912 | 94 | gchar *name, | ||
913 | 95 | glong xid, | ||
914 | 96 | gint width, | ||
915 | 97 | gint height, | ||
916 | 98 | gchar *size_type, | ||
917 | 99 | GError **error); | ||
918 | 100 | |||
919 | 101 | |||
920 | 102 | void awn_applet_manager_set_applet_flags (AwnAppletManager *manager, | ||
921 | 103 | const gchar *uid, | ||
922 | 104 | AwnAppletFlags flags); | ||
923 | 88 | 105 | ||
924 | 89 | void awn_applet_manager_show_applets (AwnAppletManager *manager); | 106 | void awn_applet_manager_show_applets (AwnAppletManager *manager); |
925 | 90 | void awn_applet_manager_hide_applets (AwnAppletManager *manager); | 107 | void awn_applet_manager_hide_applets (AwnAppletManager *manager); |
926 | 91 | 108 | ||
927 | === modified file 'src/awn-applet-proxy.c' | |||
928 | --- src/awn-applet-proxy.c 2009-07-08 21:17:59 +0000 | |||
929 | +++ src/awn-applet-proxy.c 2009-07-13 18:05:02 +0000 | |||
930 | @@ -276,6 +276,7 @@ | |||
931 | 276 | 1, G_TYPE_INT); | 276 | 1, G_TYPE_INT); |
932 | 277 | 277 | ||
933 | 278 | g_type_class_add_private (obj_class, sizeof (AwnAppletProxyPrivate)); | 278 | g_type_class_add_private (obj_class, sizeof (AwnAppletProxyPrivate)); |
934 | 279 | |||
935 | 279 | } | 280 | } |
936 | 280 | 281 | ||
937 | 281 | static gboolean | 282 | static gboolean |
938 | @@ -349,6 +350,8 @@ | |||
939 | 349 | return proxy; | 350 | return proxy; |
940 | 350 | } | 351 | } |
941 | 351 | 352 | ||
942 | 353 | |||
943 | 354 | |||
944 | 352 | /* | 355 | /* |
945 | 353 | * GtkSocket callbacks | 356 | * GtkSocket callbacks |
946 | 354 | */ | 357 | */ |
947 | @@ -552,4 +555,3 @@ | |||
948 | 552 | priv->idle_id = g_idle_add (awn_applet_proxy_idle_cb, proxy); | 555 | priv->idle_id = g_idle_add (awn_applet_proxy_idle_cb, proxy); |
949 | 553 | } | 556 | } |
950 | 554 | } | 557 | } |
951 | 555 | |||
952 | 556 | 558 | ||
953 | === modified file 'src/awn-defines.h' | |||
954 | --- src/awn-defines.h 2009-04-18 00:36:20 +0000 | |||
955 | +++ src/awn-defines.h 2009-07-14 18:01:40 +0000 | |||
956 | @@ -28,6 +28,7 @@ | |||
957 | 28 | 28 | ||
958 | 29 | #define AWN_DBUS_APP_PATH AWN_DBUS_PATH | 29 | #define AWN_DBUS_APP_PATH AWN_DBUS_PATH |
959 | 30 | #define AWN_DBUS_PANEL_PATH AWN_DBUS_PATH"/Panel" | 30 | #define AWN_DBUS_PANEL_PATH AWN_DBUS_PATH"/Panel" |
960 | 31 | #define AWN_DBUS_MANAGER_PATH AWN_DBUS_PATH"/UA" | ||
961 | 31 | 32 | ||
962 | 32 | /* FIXME: Move some of these out into libawn when we can */ | 33 | /* FIXME: Move some of these out into libawn when we can */ |
963 | 33 | #define AWN_GROUP_PANEL "panel" | 34 | #define AWN_GROUP_PANEL "panel" |
964 | @@ -38,6 +39,8 @@ | |||
965 | 38 | #define AWN_PANEL_SIZE "size" | 39 | #define AWN_PANEL_SIZE "size" |
966 | 39 | #define AWN_PANEL_AUTOHIDE "autohide" | 40 | #define AWN_PANEL_AUTOHIDE "autohide" |
967 | 40 | #define AWN_PANEL_APPLET_LIST "applet_list" | 41 | #define AWN_PANEL_APPLET_LIST "applet_list" |
968 | 42 | #define AWN_PANEL_UA_LIST "ua_list" | ||
969 | 43 | #define AWN_PANEL_UA_ACTIVE_LIST "ua_active_list" | ||
970 | 41 | #define AWN_PANEL_MONITOR_HEIGHT "monitor_height" | 44 | #define AWN_PANEL_MONITOR_HEIGHT "monitor_height" |
971 | 42 | #define AWN_PANEL_MONITOR_WIDTH "monitor_width" | 45 | #define AWN_PANEL_MONITOR_WIDTH "monitor_width" |
972 | 43 | #define AWN_PANEL_MONITOR_FORCE "monitor_force" | 46 | #define AWN_PANEL_MONITOR_FORCE "monitor_force" |
973 | 44 | 47 | ||
974 | === added file 'src/awn-ua-alignment.c' | |||
975 | --- src/awn-ua-alignment.c 1970-01-01 00:00:00 +0000 | |||
976 | +++ src/awn-ua-alignment.c 2009-07-14 19:09:25 +0000 | |||
977 | @@ -0,0 +1,469 @@ | |||
978 | 1 | /* | ||
979 | 2 | * Copyright (C) 2009 Rodney Cryderman <rcryderman@gmail.com> | ||
980 | 3 | * | ||
981 | 4 | * This program is free software; you can redistribute it and/or modify | ||
982 | 5 | * it under the terms of the GNU General Public License as published by | ||
983 | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
984 | 7 | * (at your option) any later version. | ||
985 | 8 | * | ||
986 | 9 | * This program is distributed in the hope that it will be useful, | ||
987 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
988 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
989 | 12 | * GNU General Public License for more details. | ||
990 | 13 | * | ||
991 | 14 | * You should have received a copy of the GNU General Public License | ||
992 | 15 | * along with this program; if not, write to the Free Software | ||
993 | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
994 | 17 | * | ||
995 | 18 | * | ||
996 | 19 | */ | ||
997 | 20 | |||
998 | 21 | /* awn-ua-alignment.c */ | ||
999 | 22 | #include <stdlib.h> | ||
1000 | 23 | #include "awn-ua-alignment.h" | ||
1001 | 24 | #include "awn-defines.h" | ||
1002 | 25 | |||
1003 | 26 | G_DEFINE_TYPE (AwnUAAlignment, awn_ua_alignment, GTK_TYPE_ALIGNMENT) | ||
1004 | 27 | |||
1005 | 28 | #define AWN_UA_ALIGNMENT_GET_PRIVATE(o) \ | ||
1006 | 29 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentPrivate)) | ||
1007 | 30 | |||
1008 | 31 | typedef struct _AwnUAAlignmentPrivate AwnUAAlignmentPrivate; | ||
1009 | 32 | |||
1010 | 33 | struct _AwnUAAlignmentPrivate | ||
1011 | 34 | { | ||
1012 | 35 | GtkWidget * socket; | ||
1013 | 36 | GtkWidget * applet_manager; | ||
1014 | 37 | |||
1015 | 38 | gchar *ua_list_entry; | ||
1016 | 39 | double ua_ratio; | ||
1017 | 40 | |||
1018 | 41 | guint notify_size_id; | ||
1019 | 42 | guint notify_orient_id; | ||
1020 | 43 | guint notify_offset_id; | ||
1021 | 44 | guint notify_ua_list_id; | ||
1022 | 45 | }; | ||
1023 | 46 | |||
1024 | 47 | enum | ||
1025 | 48 | { | ||
1026 | 49 | PROP_0, | ||
1027 | 50 | PROP_APPLET_MANAGER, | ||
1028 | 51 | PROP_UA_LIST_ENTRY, | ||
1029 | 52 | PROP_UA_RATIO | ||
1030 | 53 | }; | ||
1031 | 54 | |||
1032 | 55 | |||
1033 | 56 | static gboolean awn_ua_alignment_plug_removed (GtkWidget * socket, | ||
1034 | 57 | AwnUAAlignment * self); | ||
1035 | 58 | static void awn_ua_alignment_list_change(GObject *object, | ||
1036 | 59 | GParamSpec *param_spec, | ||
1037 | 60 | gpointer user_data); | ||
1038 | 61 | static void awn_ua_alignment_orient_change(GObject *object, | ||
1039 | 62 | GParamSpec *param_spec, | ||
1040 | 63 | gpointer user_data); | ||
1041 | 64 | static void awn_ua_alignment_size_change(GObject *object, | ||
1042 | 65 | GParamSpec *param_spec, | ||
1043 | 66 | gpointer user_data); | ||
1044 | 67 | static void awn_ua_alignment_offset_change(GObject *object, | ||
1045 | 68 | GParamSpec *param_spec, | ||
1046 | 69 | gpointer user_data); | ||
1047 | 70 | |||
1048 | 71 | |||
1049 | 72 | static void | ||
1050 | 73 | awn_ua_alignment_get_property (GObject *object, guint property_id, | ||
1051 | 74 | GValue *value, GParamSpec *pspec) | ||
1052 | 75 | { | ||
1053 | 76 | AwnUAAlignmentPrivate * priv; | ||
1054 | 77 | |||
1055 | 78 | priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object); | ||
1056 | 79 | |||
1057 | 80 | switch (property_id) | ||
1058 | 81 | { | ||
1059 | 82 | case PROP_APPLET_MANAGER: | ||
1060 | 83 | g_value_set_object (value,priv->applet_manager); | ||
1061 | 84 | break; | ||
1062 | 85 | case PROP_UA_LIST_ENTRY: | ||
1063 | 86 | g_value_set_string (value,priv->ua_list_entry); | ||
1064 | 87 | break; | ||
1065 | 88 | case PROP_UA_RATIO: | ||
1066 | 89 | g_value_set_double (value,priv->ua_ratio); | ||
1067 | 90 | break; | ||
1068 | 91 | default: | ||
1069 | 92 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
1070 | 93 | } | ||
1071 | 94 | } | ||
1072 | 95 | |||
1073 | 96 | static void | ||
1074 | 97 | awn_ua_alignment_set_property (GObject *object, guint property_id, | ||
1075 | 98 | const GValue *value, GParamSpec *pspec) | ||
1076 | 99 | { | ||
1077 | 100 | AwnUAAlignmentPrivate * priv; | ||
1078 | 101 | |||
1079 | 102 | priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object); | ||
1080 | 103 | switch (property_id) | ||
1081 | 104 | { | ||
1082 | 105 | case PROP_APPLET_MANAGER: | ||
1083 | 106 | priv->applet_manager = g_value_get_object (value); | ||
1084 | 107 | break; | ||
1085 | 108 | case PROP_UA_LIST_ENTRY: | ||
1086 | 109 | g_free (priv->ua_list_entry); | ||
1087 | 110 | priv->ua_list_entry = g_value_dup_string (value); | ||
1088 | 111 | break; | ||
1089 | 112 | case PROP_UA_RATIO: | ||
1090 | 113 | priv->ua_ratio = g_value_get_double (value); | ||
1091 | 114 | break; | ||
1092 | 115 | default: | ||
1093 | 116 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
1094 | 117 | } | ||
1095 | 118 | } | ||
1096 | 119 | |||
1097 | 120 | static void | ||
1098 | 121 | awn_ua_alignment_dispose (GObject *object) | ||
1099 | 122 | { | ||
1100 | 123 | G_OBJECT_CLASS (awn_ua_alignment_parent_class)->dispose (object); | ||
1101 | 124 | } | ||
1102 | 125 | |||
1103 | 126 | static void | ||
1104 | 127 | awn_ua_alignment_finalize (GObject *object) | ||
1105 | 128 | { | ||
1106 | 129 | AwnUAAlignmentPrivate * priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object); | ||
1107 | 130 | g_debug ("%s",__func__); | ||
1108 | 131 | if (priv->ua_list_entry) | ||
1109 | 132 | { | ||
1110 | 133 | g_free (priv->ua_list_entry); | ||
1111 | 134 | } | ||
1112 | 135 | G_OBJECT_CLASS (awn_ua_alignment_parent_class)->finalize (object); | ||
1113 | 136 | } | ||
1114 | 137 | |||
1115 | 138 | static void | ||
1116 | 139 | awn_ua_alignment_constructed (GObject *object) | ||
1117 | 140 | { | ||
1118 | 141 | AwnUAAlignmentPrivate * priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object); | ||
1119 | 142 | |||
1120 | 143 | if (G_OBJECT_CLASS (awn_ua_alignment_parent_class)->constructed) | ||
1121 | 144 | { | ||
1122 | 145 | G_OBJECT_CLASS (awn_ua_alignment_parent_class)->constructed (object); | ||
1123 | 146 | } | ||
1124 | 147 | |||
1125 | 148 | gtk_container_add (GTK_CONTAINER(object),priv->socket); | ||
1126 | 149 | awn_ua_alignment_orient_change (NULL,NULL,object); | ||
1127 | 150 | priv->notify_offset_id = g_signal_connect (priv->applet_manager, | ||
1128 | 151 | "notify::offset", | ||
1129 | 152 | G_CALLBACK(awn_ua_alignment_offset_change), | ||
1130 | 153 | object); | ||
1131 | 154 | priv->notify_orient_id = g_signal_connect_after (priv->applet_manager, | ||
1132 | 155 | "notify::orient", | ||
1133 | 156 | G_CALLBACK(awn_ua_alignment_orient_change), | ||
1134 | 157 | object); | ||
1135 | 158 | priv->notify_size_id = g_signal_connect_after (priv->applet_manager, | ||
1136 | 159 | "notify::size", | ||
1137 | 160 | G_CALLBACK(awn_ua_alignment_size_change), | ||
1138 | 161 | object); | ||
1139 | 162 | priv->notify_ua_list_id = g_signal_connect_after (priv->applet_manager, | ||
1140 | 163 | "notify::ua-active-list", | ||
1141 | 164 | G_CALLBACK(awn_ua_alignment_list_change), | ||
1142 | 165 | object); | ||
1143 | 166 | } | ||
1144 | 167 | |||
1145 | 168 | static void | ||
1146 | 169 | awn_ua_alignment_class_init (AwnUAAlignmentClass *klass) | ||
1147 | 170 | { | ||
1148 | 171 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
1149 | 172 | GParamSpec *pspec; | ||
1150 | 173 | |||
1151 | 174 | object_class->get_property = awn_ua_alignment_get_property; | ||
1152 | 175 | object_class->set_property = awn_ua_alignment_set_property; | ||
1153 | 176 | object_class->dispose = awn_ua_alignment_dispose; | ||
1154 | 177 | object_class->finalize = awn_ua_alignment_finalize; | ||
1155 | 178 | object_class->constructed = awn_ua_alignment_constructed; | ||
1156 | 179 | |||
1157 | 180 | pspec = g_param_spec_object ("applet-manager", | ||
1158 | 181 | "Awn Applet Manager", | ||
1159 | 182 | "Awn Applet Manager", | ||
1160 | 183 | AWN_TYPE_APPLET_MANAGER, | ||
1161 | 184 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||
1162 | 185 | g_object_class_install_property (object_class, PROP_APPLET_MANAGER, pspec); | ||
1163 | 186 | |||
1164 | 187 | pspec = g_param_spec_string ("ua-list-entry", | ||
1165 | 188 | "UA List entry", | ||
1166 | 189 | "UA List entry", | ||
1167 | 190 | NULL, | ||
1168 | 191 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||
1169 | 192 | g_object_class_install_property (object_class, PROP_UA_LIST_ENTRY, pspec); | ||
1170 | 193 | |||
1171 | 194 | pspec = g_param_spec_double ("ua-ratio", | ||
1172 | 195 | "UA Ratio", | ||
1173 | 196 | "UA Ratio", | ||
1174 | 197 | 0.0, | ||
1175 | 198 | 100.0, | ||
1176 | 199 | 1.0, | ||
1177 | 200 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||
1178 | 201 | g_object_class_install_property (object_class, PROP_UA_RATIO, pspec); | ||
1179 | 202 | |||
1180 | 203 | g_type_class_add_private (klass, sizeof (AwnUAAlignmentPrivate)); | ||
1181 | 204 | } | ||
1182 | 205 | |||
1183 | 206 | static void | ||
1184 | 207 | awn_ua_alignment_init (AwnUAAlignment *self) | ||
1185 | 208 | { | ||
1186 | 209 | AwnUAAlignmentPrivate *priv; | ||
1187 | 210 | |||
1188 | 211 | priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1189 | 212 | priv->socket = gtk_socket_new (); | ||
1190 | 213 | } | ||
1191 | 214 | |||
1192 | 215 | GtkWidget* | ||
1193 | 216 | awn_ua_alignment_new (AwnAppletManager *manager,gchar * ua_list_entry,double ua_ratio) | ||
1194 | 217 | { | ||
1195 | 218 | return g_object_new (AWN_TYPE_UA_ALIGNMENT, | ||
1196 | 219 | "applet-manager",manager, | ||
1197 | 220 | "ua-list-entry",ua_list_entry, | ||
1198 | 221 | "ua-ratio",ua_ratio, | ||
1199 | 222 | NULL); | ||
1200 | 223 | } | ||
1201 | 224 | |||
1202 | 225 | GtkWidget* | ||
1203 | 226 | awn_ua_alignment_get_socket (AwnUAAlignment *self) | ||
1204 | 227 | { | ||
1205 | 228 | AwnUAAlignmentPrivate *priv; | ||
1206 | 229 | |||
1207 | 230 | priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1208 | 231 | return priv->socket; | ||
1209 | 232 | } | ||
1210 | 233 | |||
1211 | 234 | |||
1212 | 235 | GdkWindow * | ||
1213 | 236 | awn_ua_alignment_add_id (AwnUAAlignment *self,GdkNativeWindow native_window) | ||
1214 | 237 | { | ||
1215 | 238 | GdkWindow * plugwin; | ||
1216 | 239 | AwnUAAlignmentPrivate *priv; | ||
1217 | 240 | |||
1218 | 241 | priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1219 | 242 | gtk_socket_add_id (GTK_SOCKET(priv->socket), native_window); | ||
1220 | 243 | plugwin = gtk_socket_get_plug_window (GTK_SOCKET(priv->socket)); | ||
1221 | 244 | g_signal_connect (priv->socket,"plug-removed", | ||
1222 | 245 | G_CALLBACK(awn_ua_alignment_plug_removed),self); | ||
1223 | 246 | gtk_widget_realize (priv->socket); | ||
1224 | 247 | gtk_widget_show_all (priv->socket); | ||
1225 | 248 | return plugwin; | ||
1226 | 249 | } | ||
1227 | 250 | |||
1228 | 251 | |||
1229 | 252 | static gboolean | ||
1230 | 253 | awn_ua_alignment_plug_removed (GtkWidget * socket,AwnUAAlignment * self) | ||
1231 | 254 | { | ||
1232 | 255 | |||
1233 | 256 | GSList * search; | ||
1234 | 257 | GSList * ua_active_list; | ||
1235 | 258 | GSList * orig_active_list; | ||
1236 | 259 | GSList * iter; | ||
1237 | 260 | AwnConfigClient *client; | ||
1238 | 261 | |||
1239 | 262 | AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1240 | 263 | |||
1241 | 264 | g_signal_handler_disconnect (priv->applet_manager,priv->notify_size_id); | ||
1242 | 265 | g_signal_handler_disconnect (priv->applet_manager,priv->notify_orient_id); | ||
1243 | 266 | g_signal_handler_disconnect (priv->applet_manager,priv->notify_offset_id); | ||
1244 | 267 | g_signal_handler_disconnect (priv->applet_manager,priv->notify_ua_list_id); | ||
1245 | 268 | |||
1246 | 269 | g_object_get ( priv->applet_manager, | ||
1247 | 270 | "ua_active_list",&orig_active_list, | ||
1248 | 271 | "client",&client, | ||
1249 | 272 | NULL); | ||
1250 | 273 | ua_active_list = g_slist_copy (orig_active_list); | ||
1251 | 274 | for (iter = ua_active_list;iter;iter = iter->next) | ||
1252 | 275 | { | ||
1253 | 276 | iter->data = g_strdup(iter->data); | ||
1254 | 277 | } | ||
1255 | 278 | search = g_slist_find_custom (ua_active_list,priv->ua_list_entry, | ||
1256 | 279 | (GCompareFunc)g_strcmp0); | ||
1257 | 280 | if (search) | ||
1258 | 281 | { | ||
1259 | 282 | ua_active_list = g_slist_delete_link (ua_active_list,search); | ||
1260 | 283 | } | ||
1261 | 284 | awn_config_client_set_list (client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST, | ||
1262 | 285 | AWN_CONFIG_CLIENT_LIST_TYPE_STRING, | ||
1263 | 286 | ua_active_list, NULL); | ||
1264 | 287 | g_object_set (priv->applet_manager, | ||
1265 | 288 | "ua-active-list",ua_active_list, | ||
1266 | 289 | NULL); | ||
1267 | 290 | awn_applet_manager_remove_widget(AWN_APPLET_MANAGER(priv->applet_manager), | ||
1268 | 291 | GTK_WIDGET (self)); | ||
1269 | 292 | return FALSE; | ||
1270 | 293 | } | ||
1271 | 294 | |||
1272 | 295 | /*UA*/ | ||
1273 | 296 | gint | ||
1274 | 297 | awn_ua_alignment_list_cmp (gconstpointer a, gconstpointer b) | ||
1275 | 298 | { | ||
1276 | 299 | const gchar * str1 = a; | ||
1277 | 300 | const gchar * str2 = b; | ||
1278 | 301 | gchar * search = NULL; | ||
1279 | 302 | GStrv tokens = g_strsplit (str1,"::",2); | ||
1280 | 303 | g_return_val_if_fail (tokens,-1); | ||
1281 | 304 | |||
1282 | 305 | search = g_strstr_len (str2,-1,tokens[0]); | ||
1283 | 306 | g_strfreev (tokens); | ||
1284 | 307 | |||
1285 | 308 | if (!search) | ||
1286 | 309 | { | ||
1287 | 310 | return -1; | ||
1288 | 311 | }; | ||
1289 | 312 | return 0; | ||
1290 | 313 | } | ||
1291 | 314 | |||
1292 | 315 | static void | ||
1293 | 316 | awn_ua_alignment_offset_change(GObject *object,GParamSpec *param_spec,gpointer user_data) | ||
1294 | 317 | { | ||
1295 | 318 | AwnUAAlignment * self = user_data; | ||
1296 | 319 | gint offset; | ||
1297 | 320 | gint orient; | ||
1298 | 321 | AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1299 | 322 | |||
1300 | 323 | g_object_get ( priv->applet_manager, | ||
1301 | 324 | "offset",&offset, | ||
1302 | 325 | "orient",&orient, | ||
1303 | 326 | NULL); | ||
1304 | 327 | |||
1305 | 328 | switch (orient) | ||
1306 | 329 | { | ||
1307 | 330 | case AWN_ORIENTATION_TOP: | ||
1308 | 331 | gtk_alignment_set_padding (GTK_ALIGNMENT(self), offset, 0, 0, 0); | ||
1309 | 332 | break; | ||
1310 | 333 | case AWN_ORIENTATION_BOTTOM: | ||
1311 | 334 | gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, offset, 0, 0); | ||
1312 | 335 | break; | ||
1313 | 336 | case AWN_ORIENTATION_LEFT: | ||
1314 | 337 | gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, 0, offset, 0); | ||
1315 | 338 | break; | ||
1316 | 339 | case AWN_ORIENTATION_RIGHT: | ||
1317 | 340 | gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, 0, 0, offset); | ||
1318 | 341 | break; | ||
1319 | 342 | default: | ||
1320 | 343 | g_warning ("%s: recieved invalid orient %d",__func__,orient); | ||
1321 | 344 | } | ||
1322 | 345 | } | ||
1323 | 346 | |||
1324 | 347 | static void | ||
1325 | 348 | awn_ua_alignment_size_change(GObject *object,GParamSpec *param_spec,gpointer user_data) | ||
1326 | 349 | { | ||
1327 | 350 | AwnUAAlignment * self = user_data; | ||
1328 | 351 | gint offset; | ||
1329 | 352 | gint orient; | ||
1330 | 353 | gint size; | ||
1331 | 354 | AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1332 | 355 | |||
1333 | 356 | g_object_get ( priv->applet_manager, | ||
1334 | 357 | "offset",&offset, | ||
1335 | 358 | "orient",&orient, | ||
1336 | 359 | "size",&size, | ||
1337 | 360 | NULL); | ||
1338 | 361 | GtkRequisition req; | ||
1339 | 362 | |||
1340 | 363 | req.width = req.height = size; | ||
1341 | 364 | switch (orient) | ||
1342 | 365 | { | ||
1343 | 366 | case AWN_ORIENTATION_TOP: | ||
1344 | 367 | case AWN_ORIENTATION_BOTTOM: | ||
1345 | 368 | req.width = size * priv->ua_ratio; | ||
1346 | 369 | req.height = size; | ||
1347 | 370 | break; | ||
1348 | 371 | case AWN_ORIENTATION_LEFT: | ||
1349 | 372 | case AWN_ORIENTATION_RIGHT: | ||
1350 | 373 | req.width = size; | ||
1351 | 374 | req.height = size * 1.0 / priv->ua_ratio; | ||
1352 | 375 | break; | ||
1353 | 376 | default: | ||
1354 | 377 | g_warning ("%s: recieved invalid orient %d",__func__,orient); | ||
1355 | 378 | } | ||
1356 | 379 | gtk_widget_set_size_request (GTK_WIDGET(self),req.width,req.height); | ||
1357 | 380 | } | ||
1358 | 381 | |||
1359 | 382 | static void | ||
1360 | 383 | awn_ua_alignment_orient_change(GObject *object,GParamSpec *param_spec,gpointer user_data) | ||
1361 | 384 | { | ||
1362 | 385 | |||
1363 | 386 | AwnUAAlignment * self = user_data; | ||
1364 | 387 | gint orient; | ||
1365 | 388 | AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1366 | 389 | |||
1367 | 390 | g_object_get ( priv->applet_manager, | ||
1368 | 391 | "orient",&orient, | ||
1369 | 392 | NULL); | ||
1370 | 393 | switch (orient) | ||
1371 | 394 | { | ||
1372 | 395 | case AWN_ORIENTATION_TOP: | ||
1373 | 396 | gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 0.0, 1.0, 0.5); | ||
1374 | 397 | break; | ||
1375 | 398 | case AWN_ORIENTATION_BOTTOM: | ||
1376 | 399 | gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 1.0, 1.0, 0.5); | ||
1377 | 400 | break; | ||
1378 | 401 | case AWN_ORIENTATION_LEFT: | ||
1379 | 402 | gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 0.0, 0.5, 1.0); | ||
1380 | 403 | break; | ||
1381 | 404 | case AWN_ORIENTATION_RIGHT: | ||
1382 | 405 | gtk_alignment_set (GTK_ALIGNMENT(self), 1.0, 0.0, 0.5, 1.0); | ||
1383 | 406 | break; | ||
1384 | 407 | default: | ||
1385 | 408 | g_warning ("%s: recieved invalid orient %d",__func__,orient); | ||
1386 | 409 | } | ||
1387 | 410 | awn_ua_alignment_offset_change (object,param_spec,self); | ||
1388 | 411 | awn_ua_alignment_size_change (object,param_spec,self); | ||
1389 | 412 | } | ||
1390 | 413 | |||
1391 | 414 | static void | ||
1392 | 415 | awn_ua_alignment_list_change(GObject *object,GParamSpec *param_spec,gpointer user_data) | ||
1393 | 416 | { | ||
1394 | 417 | AwnUAAlignment * self = user_data; | ||
1395 | 418 | gint orient; | ||
1396 | 419 | AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self); | ||
1397 | 420 | GSList * ua_active_list; | ||
1398 | 421 | |||
1399 | 422 | g_object_get ( priv->applet_manager, | ||
1400 | 423 | "orient",&orient, | ||
1401 | 424 | "ua_active_list",&ua_active_list, | ||
1402 | 425 | NULL); | ||
1403 | 426 | |||
1404 | 427 | GSList * search = g_slist_find_custom (ua_active_list, | ||
1405 | 428 | priv->ua_list_entry, | ||
1406 | 429 | (GCompareFunc)g_strcmp0); | ||
1407 | 430 | if (search) | ||
1408 | 431 | { | ||
1409 | 432 | g_debug ("Found... do not need to update %s",priv->ua_list_entry); | ||
1410 | 433 | } | ||
1411 | 434 | else | ||
1412 | 435 | { | ||
1413 | 436 | search = g_slist_find_custom (ua_active_list,priv->ua_list_entry,awn_ua_alignment_list_cmp); | ||
1414 | 437 | if (search) | ||
1415 | 438 | { | ||
1416 | 439 | g_debug ("Moving %s to %s",priv->ua_list_entry,(gchar*)search->data); | ||
1417 | 440 | GStrv tokens; | ||
1418 | 441 | gint pos = -1; | ||
1419 | 442 | g_free (priv->ua_list_entry); | ||
1420 | 443 | priv->ua_list_entry = g_strdup(search->data); | ||
1421 | 444 | tokens = g_strsplit (search->data,"::",2); | ||
1422 | 445 | if (tokens && tokens[1]) | ||
1423 | 446 | { | ||
1424 | 447 | pos = atoi (tokens[1]); | ||
1425 | 448 | } | ||
1426 | 449 | g_strfreev (tokens); | ||
1427 | 450 | if (pos != -1) | ||
1428 | 451 | { | ||
1429 | 452 | awn_applet_manager_add_widget(AWN_APPLET_MANAGER(priv->applet_manager), | ||
1430 | 453 | GTK_WIDGET (self), | ||
1431 | 454 | pos); | ||
1432 | 455 | } | ||
1433 | 456 | } | ||
1434 | 457 | else | ||
1435 | 458 | { | ||
1436 | 459 | g_debug ("looks like %s was removed from panel/ua_list",priv->ua_list_entry); | ||
1437 | 460 | /* | ||
1438 | 461 | aantn as expected this does not kill the screenlet. What is the best way to | ||
1439 | 462 | tell it that we want it to go away? | ||
1440 | 463 | */ | ||
1441 | 464 | awn_applet_manager_remove_widget(AWN_APPLET_MANAGER(priv->applet_manager), | ||
1442 | 465 | GTK_WIDGET (self)); | ||
1443 | 466 | gtk_widget_destroy (GTK_WIDGET(self)); | ||
1444 | 467 | } | ||
1445 | 468 | } | ||
1446 | 469 | } | ||
1447 | 0 | 470 | ||
1448 | === added file 'src/awn-ua-alignment.h' | |||
1449 | --- src/awn-ua-alignment.h 1970-01-01 00:00:00 +0000 | |||
1450 | +++ src/awn-ua-alignment.h 2009-07-14 02:56:28 +0000 | |||
1451 | @@ -0,0 +1,68 @@ | |||
1452 | 1 | /* | ||
1453 | 2 | * Copyright (C) 2009 Rodney Cryderman <rcryderman@gmail.com> | ||
1454 | 3 | * | ||
1455 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1456 | 5 | * it under the terms of the GNU General Public License as published by | ||
1457 | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
1458 | 7 | * (at your option) any later version. | ||
1459 | 8 | * | ||
1460 | 9 | * This program is distributed in the hope that it will be useful, | ||
1461 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1462 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1463 | 12 | * GNU General Public License for more details. | ||
1464 | 13 | * | ||
1465 | 14 | * You should have received a copy of the GNU General Public License | ||
1466 | 15 | * along with this program; if not, write to the Free Software | ||
1467 | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1468 | 17 | * | ||
1469 | 18 | * | ||
1470 | 19 | */ | ||
1471 | 20 | |||
1472 | 21 | /* awn-ua-alignment.h */ | ||
1473 | 22 | |||
1474 | 23 | #ifndef _AWN_UA_ALIGNMENT | ||
1475 | 24 | #define _AWN_UA_ALIGNMENT | ||
1476 | 25 | |||
1477 | 26 | #include <gtk/gtk.h> | ||
1478 | 27 | #include "awn-applet-manager.h" | ||
1479 | 28 | |||
1480 | 29 | G_BEGIN_DECLS | ||
1481 | 30 | |||
1482 | 31 | #define AWN_TYPE_UA_ALIGNMENT awn_ua_alignment_get_type() | ||
1483 | 32 | |||
1484 | 33 | #define AWN_UA_ALIGNMENT(obj) \ | ||
1485 | 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignment)) | ||
1486 | 35 | |||
1487 | 36 | #define AWN_UA_ALIGNMENT_CLASS(klass) \ | ||
1488 | 37 | (G_TYPE_CHECK_CLASS_CAST ((klass), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentClass)) | ||
1489 | 38 | |||
1490 | 39 | #define AWN_IS_UA_ALIGNMENT(obj) \ | ||
1491 | 40 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_UA_ALIGNMENT)) | ||
1492 | 41 | |||
1493 | 42 | #define AWN_IS_UA_ALIGNMENT_CLASS(klass) \ | ||
1494 | 43 | (G_TYPE_CHECK_CLASS_TYPE ((klass), AWN_TYPE_UA_ALIGNMENT)) | ||
1495 | 44 | |||
1496 | 45 | #define AWN_UA_ALIGNMENT_GET_CLASS(obj) \ | ||
1497 | 46 | (G_TYPE_INSTANCE_GET_CLASS ((obj), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentClass)) | ||
1498 | 47 | |||
1499 | 48 | typedef struct { | ||
1500 | 49 | GtkAlignment parent; | ||
1501 | 50 | } AwnUAAlignment; | ||
1502 | 51 | |||
1503 | 52 | typedef struct { | ||
1504 | 53 | GtkAlignmentClass parent_class; | ||
1505 | 54 | } AwnUAAlignmentClass; | ||
1506 | 55 | |||
1507 | 56 | GType awn_ua_alignment_get_type (void); | ||
1508 | 57 | |||
1509 | 58 | GtkWidget* awn_ua_alignment_new (AwnAppletManager *manager,gchar * ua_list_entry,double ua_ratio); | ||
1510 | 59 | |||
1511 | 60 | GtkWidget* awn_ua_alignment_get_socket (AwnUAAlignment *self); | ||
1512 | 61 | |||
1513 | 62 | GdkWindow * awn_ua_alignment_add_id (AwnUAAlignment *self, GdkNativeWindow native_window); | ||
1514 | 63 | |||
1515 | 64 | gint awn_ua_alignment_list_cmp (gconstpointer a, gconstpointer b); | ||
1516 | 65 | |||
1517 | 66 | G_END_DECLS | ||
1518 | 67 | |||
1519 | 68 | #endif /* _AWN_UA_ALIGNMENT */ |
It may not perfect, but I think it's good enough for a merge at this point. There's some design ugliness due to the alignment being outside of the socket. But most of the ua specific code is in its own object. And if UA/screenlets are not being used then there is close to zero impact on the code paths used by awn.