Merge lp:~arthurborsboom/xpad/xpad-4.3 into lp:xpad
- xpad-4.3
- Merge into trunk
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 678 | ||||||||||||
Proposed branch: | lp:~arthurborsboom/xpad/xpad-4.3 | ||||||||||||
Merge into: | lp:xpad | ||||||||||||
Diff against target: |
4000 lines (+1251/-1035) (has conflicts) 21 files modified
ChangeLog (+29/-0) INSTALL (+105/-26) configure.ac (+6/-11) src/fio.c (+7/-5) src/prefix.c (+0/-1) src/xpad-app.c (+55/-88) src/xpad-app.h (+3/-3) src/xpad-pad-group.c (+1/-2) src/xpad-pad-properties.c (+6/-9) src/xpad-pad-properties.h (+3/-3) src/xpad-pad.c (+104/-134) src/xpad-periodic.c (+2/-4) src/xpad-preferences.c (+574/-257) src/xpad-session-manager.c (+11/-21) src/xpad-settings.c (+220/-120) src/xpad-settings.h (+23/-10) src/xpad-text-view.c (+9/-6) src/xpad-toolbar.c (+45/-292) src/xpad-tray.c (+17/-13) src/xpad-undo.c (+30/-29) xpad.desktop.in (+1/-1) Text conflict in ChangeLog |
||||||||||||
To merge this branch: | bzr merge lp:~arthurborsboom/xpad/xpad-4.3 | ||||||||||||
Related bugs: |
|
||||||||||||
Related blueprints: |
Transparent background
(Low)
Xpad - autostart options
(Medium)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Arthur Borsboom | Approve | ||
Review via email: mp+222420@code.launchpad.net |
Commit message
Description of the change
* New: Toolbar - ability to add multiple separators (#351775)
* New: Toolbar - ability to add paste button on toolbar (#351775)
* New: Preferences - Ability to set the automatic start of Xpad in the Preferences menu (#405314)
* New: Preferences - Ability to set the wait for systray option in the Preferences menu (#405314)
* New: Preferences - Ability to delay the start of Xpad in the Preferences menu (#405314)
* New: Preferences - Ability to set the automatic creation of a new pad at the start of Xpad in the Preferences menu
* New: Preferences - Ability to set the automatic open/hide/restore of all pads at the start of Xpad in the Preferences menu (#405314)
* Fix: Toolbar - improved default toolbar items to the commonly used items
* Fix: Toolbar - improved item names
* Fix: Toolbar - prevented a crash when erasing toolbar items
* Fix: Preferences - Changed description of Edit Lock into Make pads read-only
* Fix: Preferences - Make sure that the preference window is always presented up front to the user, when requested.
And many technical fixes (see change log)
Arthur Borsboom (arthurborsboom) : | # |
Preview Diff
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2013-10-24 17:01:13 +0000 | |||
3 | +++ ChangeLog 2014-06-07 00:27:40 +0000 | |||
4 | @@ -1,5 +1,34 @@ | |||
5 | 1 | <<<<<<< TREE | ||
6 | 1 | Version 4.2 | 2 | Version 4.2 |
7 | 2 | * New: Undo/redo functionality such as CTRL-Z (#1121740) | 3 | * New: Undo/redo functionality such as CTRL-Z (#1121740) |
8 | 4 | ======= | ||
9 | 5 | Version 4.3 | ||
10 | 6 | * New: Toolbar - ability to add multiple separators (#351775) | ||
11 | 7 | * New: Toolbar - ability to add paste button on toolbar (#351775) | ||
12 | 8 | * New: Preferences - Ability to set the automatic start of Xpad in the Preferences menu (#405314) | ||
13 | 9 | * New: Preferences - Ability to set the wait for systray option in the Preferences menu (#405314) | ||
14 | 10 | * New: Preferences - Ability to delay the start of Xpad in the Preferences menu (#405314) | ||
15 | 11 | * New: Preferences - Ability to set the automatic creation of a new pad at the start of Xpad in the Preferences menu | ||
16 | 12 | * New: Preferences - Ability to set the automatic open/hide/restore of all pads at the start of Xpad in the Preferences menu (#405314) | ||
17 | 13 | * Fix: Toolbar - improved default toolbar items to the commonly used items | ||
18 | 14 | * Fix: Toolbar - improved item names | ||
19 | 15 | * Fix: Toolbar - prevented a crash when erasing toolbar items | ||
20 | 16 | * Fix: Preferences - Changed description of Edit Lock into Make pads read-only | ||
21 | 17 | * Fix: Preferences - Make sure that the preference window is always presented up front to the user, when requested. | ||
22 | 18 | * Fix: Technical - Migrated Xpad from GTK2 to GTK3 (#1242424) | ||
23 | 19 | * Fix: Technical - Replaced deprecated Glib and GTK statements | ||
24 | 20 | * Fix: Technical - Improved configure.ac for better debugging and code quality | ||
25 | 21 | * Fix: Technical - Corrected commenting style to C89 standard | ||
26 | 22 | * Fix: Technical - Reorganized code of preferences dialog in preparation of another change | ||
27 | 23 | * Fix: Technical - Prevented an error while changing the Edit lock preference | ||
28 | 24 | * Fix: Technical - Prevented a crash when using command line option -n (= new pad) | ||
29 | 25 | * Fix: Technical - Improve the hiding of pads at Xpad launch (#405314) | ||
30 | 26 | * Fix: Technical - Added thread safe handling of new preferences | ||
31 | 27 | * Fix: Technical - Ensured the use of GNU C libraries, so the readlink function is available | ||
32 | 28 | |||
33 | 29 | Version 4.2 | ||
34 | 30 | * New: Undo functionality such as CTRL-Z (#1121740) | ||
35 | 31 | >>>>>>> MERGE-SOURCE | ||
36 | 3 | * New: Tray click behaviour can now be configured (#345278, #304331, #890335) | 32 | * New: Tray click behaviour can now be configured (#345278, #304331, #890335) |
37 | 4 | * New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705) | 33 | * New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705) |
38 | 5 | * Fix: Theme color stays after application restart (#307669) | 34 | * Fix: Theme color stays after application restart (#307669) |
39 | 6 | 35 | ||
40 | === modified file 'INSTALL' | |||
41 | --- INSTALL 2009-05-02 17:21:29 +0000 | |||
42 | +++ INSTALL 2014-06-07 00:27:40 +0000 | |||
43 | @@ -1,19 +1,25 @@ | |||
44 | 1 | Installation Instructions | 1 | Installation Instructions |
45 | 2 | ************************* | 2 | ************************* |
46 | 3 | 3 | ||
49 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, | 4 | Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, |
50 | 5 | 2006, 2007, 2008 Free Software Foundation, Inc. | 5 | Inc. |
51 | 6 | 6 | ||
54 | 7 | This file is free documentation; the Free Software Foundation gives | 7 | Copying and distribution of this file, with or without modification, |
55 | 8 | unlimited permission to copy, distribute and modify it. | 8 | are permitted in any medium without royalty provided the copyright |
56 | 9 | notice and this notice are preserved. This file is offered as-is, | ||
57 | 10 | without warranty of any kind. | ||
58 | 9 | 11 | ||
59 | 10 | Basic Installation | 12 | Basic Installation |
60 | 11 | ================== | 13 | ================== |
61 | 12 | 14 | ||
64 | 13 | Briefly, the shell commands `./configure; make; make install' should | 15 | Briefly, the shell command `./configure && make && make install' |
65 | 14 | configure, build, and install this package. The following | 16 | should configure, build, and install this package. The following |
66 | 15 | more-detailed instructions are generic; see the `README' file for | 17 | more-detailed instructions are generic; see the `README' file for |
68 | 16 | instructions specific to this package. | 18 | instructions specific to this package. Some packages provide this |
69 | 19 | `INSTALL' file but do not implement all of the features documented | ||
70 | 20 | below. The lack of an optional feature in a given package is not | ||
71 | 21 | necessarily a bug. More recommendations for GNU packages can be found | ||
72 | 22 | in *note Makefile Conventions: (standards)Makefile Conventions. | ||
73 | 17 | 23 | ||
74 | 18 | The `configure' shell script attempts to guess correct values for | 24 | The `configure' shell script attempts to guess correct values for |
75 | 19 | various system-dependent variables used during compilation. It uses | 25 | various system-dependent variables used during compilation. It uses |
76 | @@ -42,7 +48,7 @@ | |||
77 | 42 | you want to change it or regenerate `configure' using a newer version | 48 | you want to change it or regenerate `configure' using a newer version |
78 | 43 | of `autoconf'. | 49 | of `autoconf'. |
79 | 44 | 50 | ||
81 | 45 | The simplest way to compile this package is: | 51 | The simplest way to compile this package is: |
82 | 46 | 52 | ||
83 | 47 | 1. `cd' to the directory containing the package's source code and type | 53 | 1. `cd' to the directory containing the package's source code and type |
84 | 48 | `./configure' to configure the package for your system. | 54 | `./configure' to configure the package for your system. |
85 | @@ -53,12 +59,22 @@ | |||
86 | 53 | 2. Type `make' to compile the package. | 59 | 2. Type `make' to compile the package. |
87 | 54 | 60 | ||
88 | 55 | 3. Optionally, type `make check' to run any self-tests that come with | 61 | 3. Optionally, type `make check' to run any self-tests that come with |
90 | 56 | the package. | 62 | the package, generally using the just-built uninstalled binaries. |
91 | 57 | 63 | ||
92 | 58 | 4. Type `make install' to install the programs and any data files and | 64 | 4. Type `make install' to install the programs and any data files and |
96 | 59 | documentation. | 65 | documentation. When installing into a prefix owned by root, it is |
97 | 60 | 66 | recommended that the package be configured and built as a regular | |
98 | 61 | 5. You can remove the program binaries and object files from the | 67 | user, and only the `make install' phase executed with root |
99 | 68 | privileges. | ||
100 | 69 | |||
101 | 70 | 5. Optionally, type `make installcheck' to repeat any self-tests, but | ||
102 | 71 | this time using the binaries in their final installed location. | ||
103 | 72 | This target does not install anything. Running this target as a | ||
104 | 73 | regular user, particularly if the prior `make install' required | ||
105 | 74 | root privileges, verifies that the installation completed | ||
106 | 75 | correctly. | ||
107 | 76 | |||
108 | 77 | 6. You can remove the program binaries and object files from the | ||
109 | 62 | source code directory by typing `make clean'. To also remove the | 78 | source code directory by typing `make clean'. To also remove the |
110 | 63 | files that `configure' created (so you can compile the package for | 79 | files that `configure' created (so you can compile the package for |
111 | 64 | a different kind of computer), type `make distclean'. There is | 80 | a different kind of computer), type `make distclean'. There is |
112 | @@ -67,8 +83,15 @@ | |||
113 | 67 | all sorts of other programs in order to regenerate files that came | 83 | all sorts of other programs in order to regenerate files that came |
114 | 68 | with the distribution. | 84 | with the distribution. |
115 | 69 | 85 | ||
118 | 70 | 6. Often, you can also type `make uninstall' to remove the installed | 86 | 7. Often, you can also type `make uninstall' to remove the installed |
119 | 71 | files again. | 87 | files again. In practice, not all packages have tested that |
120 | 88 | uninstallation works correctly, even though it is required by the | ||
121 | 89 | GNU Coding Standards. | ||
122 | 90 | |||
123 | 91 | 8. Some packages, particularly those that use Automake, provide `make | ||
124 | 92 | distcheck', which can by used by developers to test that all other | ||
125 | 93 | targets like `make install' and `make uninstall' work correctly. | ||
126 | 94 | This target is generally not run by end users. | ||
127 | 72 | 95 | ||
128 | 73 | Compilers and Options | 96 | Compilers and Options |
129 | 74 | ===================== | 97 | ===================== |
130 | @@ -93,7 +116,8 @@ | |||
131 | 93 | own directory. To do this, you can use GNU `make'. `cd' to the | 116 | own directory. To do this, you can use GNU `make'. `cd' to the |
132 | 94 | directory where you want the object files and executables to go and run | 117 | directory where you want the object files and executables to go and run |
133 | 95 | the `configure' script. `configure' automatically checks for the | 118 | the `configure' script. `configure' automatically checks for the |
135 | 96 | source code in the directory that `configure' is in and in `..'. | 119 | source code in the directory that `configure' is in and in `..'. This |
136 | 120 | is known as a "VPATH" build. | ||
137 | 97 | 121 | ||
138 | 98 | With a non-GNU `make', it is safer to compile the package for one | 122 | With a non-GNU `make', it is safer to compile the package for one |
139 | 99 | architecture at a time in the source code directory. After you have | 123 | architecture at a time in the source code directory. After you have |
140 | @@ -120,7 +144,8 @@ | |||
141 | 120 | By default, `make install' installs the package's commands under | 144 | By default, `make install' installs the package's commands under |
142 | 121 | `/usr/local/bin', include files under `/usr/local/include', etc. You | 145 | `/usr/local/bin', include files under `/usr/local/include', etc. You |
143 | 122 | can specify an installation prefix other than `/usr/local' by giving | 146 | can specify an installation prefix other than `/usr/local' by giving |
145 | 123 | `configure' the option `--prefix=PREFIX'. | 147 | `configure' the option `--prefix=PREFIX', where PREFIX must be an |
146 | 148 | absolute file name. | ||
147 | 124 | 149 | ||
148 | 125 | You can specify separate installation prefixes for | 150 | You can specify separate installation prefixes for |
149 | 126 | architecture-specific files and architecture-independent files. If you | 151 | architecture-specific files and architecture-independent files. If you |
150 | @@ -131,15 +156,46 @@ | |||
151 | 131 | In addition, if you use an unusual directory layout you can give | 156 | In addition, if you use an unusual directory layout you can give |
152 | 132 | options like `--bindir=DIR' to specify different values for particular | 157 | options like `--bindir=DIR' to specify different values for particular |
153 | 133 | kinds of files. Run `configure --help' for a list of the directories | 158 | kinds of files. Run `configure --help' for a list of the directories |
155 | 134 | you can set and what kinds of files go in them. | 159 | you can set and what kinds of files go in them. In general, the |
156 | 160 | default for these options is expressed in terms of `${prefix}', so that | ||
157 | 161 | specifying just `--prefix' will affect all of the other directory | ||
158 | 162 | specifications that were not explicitly provided. | ||
159 | 163 | |||
160 | 164 | The most portable way to affect installation locations is to pass the | ||
161 | 165 | correct locations to `configure'; however, many packages provide one or | ||
162 | 166 | both of the following shortcuts of passing variable assignments to the | ||
163 | 167 | `make install' command line to change installation locations without | ||
164 | 168 | having to reconfigure or recompile. | ||
165 | 169 | |||
166 | 170 | The first method involves providing an override variable for each | ||
167 | 171 | affected directory. For example, `make install | ||
168 | 172 | prefix=/alternate/directory' will choose an alternate location for all | ||
169 | 173 | directory configuration variables that were expressed in terms of | ||
170 | 174 | `${prefix}'. Any directories that were specified during `configure', | ||
171 | 175 | but not in terms of `${prefix}', must each be overridden at install | ||
172 | 176 | time for the entire installation to be relocated. The approach of | ||
173 | 177 | makefile variable overrides for each directory variable is required by | ||
174 | 178 | the GNU Coding Standards, and ideally causes no recompilation. | ||
175 | 179 | However, some platforms have known limitations with the semantics of | ||
176 | 180 | shared libraries that end up requiring recompilation when using this | ||
177 | 181 | method, particularly noticeable in packages that use GNU Libtool. | ||
178 | 182 | |||
179 | 183 | The second method involves providing the `DESTDIR' variable. For | ||
180 | 184 | example, `make install DESTDIR=/alternate/directory' will prepend | ||
181 | 185 | `/alternate/directory' before all installation names. The approach of | ||
182 | 186 | `DESTDIR' overrides is not required by the GNU Coding Standards, and | ||
183 | 187 | does not work on platforms that have drive letters. On the other hand, | ||
184 | 188 | it does better at avoiding recompilation issues, and works well even | ||
185 | 189 | when some directory options were not specified in terms of `${prefix}' | ||
186 | 190 | at `configure' time. | ||
187 | 191 | |||
188 | 192 | Optional Features | ||
189 | 193 | ================= | ||
190 | 135 | 194 | ||
191 | 136 | If the package supports it, you can cause programs to be installed | 195 | If the package supports it, you can cause programs to be installed |
192 | 137 | with an extra prefix or suffix on their names by giving `configure' the | 196 | with an extra prefix or suffix on their names by giving `configure' the |
193 | 138 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. | 197 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. |
194 | 139 | 198 | ||
195 | 140 | Optional Features | ||
196 | 141 | ================= | ||
197 | 142 | |||
198 | 143 | Some packages pay attention to `--enable-FEATURE' options to | 199 | Some packages pay attention to `--enable-FEATURE' options to |
199 | 144 | `configure', where FEATURE indicates an optional part of the package. | 200 | `configure', where FEATURE indicates an optional part of the package. |
200 | 145 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE | 201 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE |
201 | @@ -152,6 +208,13 @@ | |||
202 | 152 | you can use the `configure' options `--x-includes=DIR' and | 208 | you can use the `configure' options `--x-includes=DIR' and |
203 | 153 | `--x-libraries=DIR' to specify their locations. | 209 | `--x-libraries=DIR' to specify their locations. |
204 | 154 | 210 | ||
205 | 211 | Some packages offer the ability to configure how verbose the | ||
206 | 212 | execution of `make' will be. For these packages, running `./configure | ||
207 | 213 | --enable-silent-rules' sets the default to minimal output, which can be | ||
208 | 214 | overridden with `make V=1'; while running `./configure | ||
209 | 215 | --disable-silent-rules' sets the default to verbose, which can be | ||
210 | 216 | overridden with `make V=0'. | ||
211 | 217 | |||
212 | 155 | Particular systems | 218 | Particular systems |
213 | 156 | ================== | 219 | ================== |
214 | 157 | 220 | ||
215 | @@ -159,10 +222,15 @@ | |||
216 | 159 | CC is not installed, it is recommended to use the following options in | 222 | CC is not installed, it is recommended to use the following options in |
217 | 160 | order to use an ANSI C compiler: | 223 | order to use an ANSI C compiler: |
218 | 161 | 224 | ||
220 | 162 | ./configure CC="cc -Ae" | 225 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" |
221 | 163 | 226 | ||
222 | 164 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. | 227 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. |
223 | 165 | 228 | ||
224 | 229 | HP-UX `make' updates targets which have the same time stamps as | ||
225 | 230 | their prerequisites, which makes it generally unusable when shipped | ||
226 | 231 | generated files such as `configure' are involved. Use GNU `make' | ||
227 | 232 | instead. | ||
228 | 233 | |||
229 | 166 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot | 234 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot |
230 | 167 | parse its `<wchar.h>' header file. The option `-nodtk' can be used as | 235 | parse its `<wchar.h>' header file. The option `-nodtk' can be used as |
231 | 168 | a workaround. If GNU CC is not installed, it is therefore recommended | 236 | a workaround. If GNU CC is not installed, it is therefore recommended |
232 | @@ -174,6 +242,16 @@ | |||
233 | 174 | 242 | ||
234 | 175 | ./configure CC="cc -nodtk" | 243 | ./configure CC="cc -nodtk" |
235 | 176 | 244 | ||
236 | 245 | On Solaris, don't put `/usr/ucb' early in your `PATH'. This | ||
237 | 246 | directory contains several dysfunctional programs; working variants of | ||
238 | 247 | these programs are available in `/usr/bin'. So, if you need `/usr/ucb' | ||
239 | 248 | in your `PATH', put it _after_ `/usr/bin'. | ||
240 | 249 | |||
241 | 250 | On Haiku, software installed for all users goes in `/boot/common', | ||
242 | 251 | not `/usr/local'. It is recommended to use the following options: | ||
243 | 252 | |||
244 | 253 | ./configure --prefix=/boot/common | ||
245 | 254 | |||
246 | 177 | Specifying the System Type | 255 | Specifying the System Type |
247 | 178 | ========================== | 256 | ========================== |
248 | 179 | 257 | ||
249 | @@ -189,7 +267,8 @@ | |||
250 | 189 | 267 | ||
251 | 190 | where SYSTEM can have one of these forms: | 268 | where SYSTEM can have one of these forms: |
252 | 191 | 269 | ||
254 | 192 | OS KERNEL-OS | 270 | OS |
255 | 271 | KERNEL-OS | ||
256 | 193 | 272 | ||
257 | 194 | See the file `config.sub' for the possible values of each field. If | 273 | See the file `config.sub' for the possible values of each field. If |
258 | 195 | `config.sub' isn't included in this package, then this package doesn't | 274 | `config.sub' isn't included in this package, then this package doesn't |
259 | @@ -230,9 +309,10 @@ | |||
260 | 230 | overridden in the site shell script). | 309 | overridden in the site shell script). |
261 | 231 | 310 | ||
262 | 232 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to | 311 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to |
264 | 233 | an Autoconf bug. Until the bug is fixed you can use this workaround: | 312 | an Autoconf limitation. Until the limitation is lifted, you can use |
265 | 313 | this workaround: | ||
266 | 234 | 314 | ||
268 | 235 | CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash | 315 | CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash |
269 | 236 | 316 | ||
270 | 237 | `configure' Invocation | 317 | `configure' Invocation |
271 | 238 | ====================== | 318 | ====================== |
272 | @@ -277,7 +357,7 @@ | |||
273 | 277 | `configure' can determine that directory automatically. | 357 | `configure' can determine that directory automatically. |
274 | 278 | 358 | ||
275 | 279 | `--prefix=DIR' | 359 | `--prefix=DIR' |
277 | 280 | Use DIR as the installation prefix. *Note Installation Names:: | 360 | Use DIR as the installation prefix. *note Installation Names:: |
278 | 281 | for more details, including other options available for fine-tuning | 361 | for more details, including other options available for fine-tuning |
279 | 282 | the installation locations. | 362 | the installation locations. |
280 | 283 | 363 | ||
281 | @@ -288,4 +368,3 @@ | |||
282 | 288 | 368 | ||
283 | 289 | `configure' also accepts some other, not widely useful, options. Run | 369 | `configure' also accepts some other, not widely useful, options. Run |
284 | 290 | `configure --help' for more details. | 370 | `configure --help' for more details. |
285 | 291 | |||
286 | 292 | 371 | ||
287 | === modified file 'configure.ac' | |||
288 | --- configure.ac 2013-10-31 21:17:36 +0000 | |||
289 | +++ configure.ac 2014-06-07 00:27:40 +0000 | |||
290 | @@ -20,19 +20,12 @@ | |||
291 | 20 | # Checks for GTK+ 3.0 | 20 | # Checks for GTK+ 3.0 |
292 | 21 | PKG_CHECK_MODULES(GTK, gtk+-3.0 gio-2.0) | 21 | PKG_CHECK_MODULES(GTK, gtk+-3.0 gio-2.0) |
293 | 22 | AM_CONDITIONAL(GTK, test -n "$GTK_LIBS") | 22 | AM_CONDITIONAL(GTK, test -n "$GTK_LIBS") |
301 | 23 | # ensure that only allowed headers are included | 23 | AC_SUBST(GTK_LIBS) |
295 | 24 | GTK_CFLAGS+="-DGTK_DISABLE_SINGLE_INCLUDES " | ||
296 | 25 | # ensure that no gtk deprecated symbols are used | ||
297 | 26 | GTK_CFLAGS+="-DGDK_DISABLE_DEPRECATED " | ||
298 | 27 | GTK_CFLAGS+="-DGTK_DISABLE_DEPRECATED " | ||
299 | 28 | # ensure use of accessors | ||
300 | 29 | GTK_CFLAGS+="-DGSEAL_ENABLE " | ||
302 | 30 | AC_SUBST(GTK_CFLAGS) | 24 | AC_SUBST(GTK_CFLAGS) |
303 | 31 | AC_SUBST(GTK_LIBS) | ||
304 | 32 | 25 | ||
305 | 33 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38) | 26 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38) |
306 | 27 | AC_SUBST(GLIB_LIBS) | ||
307 | 34 | AC_SUBST(GLIB_CFLAGS) | 28 | AC_SUBST(GLIB_CFLAGS) |
308 | 35 | AC_SUBST(GLIB_LIBS) | ||
309 | 36 | 29 | ||
310 | 37 | PKG_CHECK_MODULES(PANGO, pango >= 1.32) | 30 | PKG_CHECK_MODULES(PANGO, pango >= 1.32) |
311 | 38 | AC_SUBST(PANGO_LIBS) | 31 | AC_SUBST(PANGO_LIBS) |
312 | @@ -46,6 +39,9 @@ | |||
313 | 46 | AC_SUBST(ATK_LIBS) | 39 | AC_SUBST(ATK_LIBS) |
314 | 47 | AC_SUBST(ATK_CFLAGS) | 40 | AC_SUBST(ATK_CFLAGS) |
315 | 48 | 41 | ||
316 | 42 | # Force the use of GNU libraries, for the special case of the function readlink | ||
317 | 43 | AC_GNU_SOURCE | ||
318 | 44 | |||
319 | 49 | # Checks for typedefs, structures, and compiler characteristics. | 45 | # Checks for typedefs, structures, and compiler characteristics. |
320 | 50 | AC_C_CONST | 46 | AC_C_CONST |
321 | 51 | AC_TYPE_SIZE_T | 47 | AC_TYPE_SIZE_T |
322 | @@ -71,7 +67,7 @@ | |||
323 | 71 | enable_debug="$enableval", | 67 | enable_debug="$enableval", |
324 | 72 | enable_debug=no) | 68 | enable_debug=no) |
325 | 73 | if test "$enable_debug" = "yes"; then | 69 | if test "$enable_debug" = "yes"; then |
327 | 74 | DEBUG_CFLAGS="-ansi -Wall -Werror -g -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_MULTIHEAD_SAFE" | 70 | DEBUG_CFLAGS="-ansi -Wall -Werror -g -O0 -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_MULTIHEAD_SAFE -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE" |
328 | 75 | else | 71 | else |
329 | 76 | DEBUG_CFLAGS="" | 72 | DEBUG_CFLAGS="" |
330 | 77 | fi | 73 | fi |
331 | @@ -80,4 +76,3 @@ | |||
332 | 80 | # Sets up output files. | 76 | # Sets up output files. |
333 | 81 | AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile images/Makefile po/Makefile.in autopackage/Makefile autopackage/default.apspec]) | 77 | AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile images/Makefile po/Makefile.in autopackage/Makefile autopackage/default.apspec]) |
334 | 82 | AC_OUTPUT | 78 | AC_OUTPUT |
335 | 83 | |||
336 | 84 | 79 | ||
337 | === modified file 'src/fio.c' | |||
338 | --- src/fio.c 2013-10-31 21:17:36 +0000 | |||
339 | +++ src/fio.c 2014-06-07 00:27:40 +0000 | |||
340 | @@ -67,7 +67,7 @@ | |||
341 | 67 | long offset = p - *string; | 67 | long offset = p - *string; |
342 | 68 | *string = g_realloc (*string, strlen (*string) + diff + 1); | 68 | *string = g_realloc (*string, strlen (*string) + diff + 1); |
343 | 69 | p = *string + offset; | 69 | p = *string + offset; |
345 | 70 | g_memmove (p + rsize, p + osize, strlen (p + osize) + 1); | 70 | memmove (p + rsize, p + osize, strlen (p + osize) + 1); |
346 | 71 | 71 | ||
347 | 72 | memcpy (p, replacement, rsize); | 72 | memcpy (p, replacement, rsize); |
348 | 73 | 73 | ||
349 | @@ -173,12 +173,14 @@ | |||
350 | 173 | if (!buf) | 173 | if (!buf) |
351 | 174 | return 1; | 174 | return 1; |
352 | 175 | 175 | ||
356 | 176 | /* because of the way we look for a matching variable name, which is | 176 | /* |
357 | 177 | to look for an endline, the variable name, and a space, we insert a | 177 | * because of the way we look for a matching variable name, which is |
358 | 178 | newline at the beginning, so that the first variable name is caught. */ | 178 | * to look for an endline, the variable name, and a space, we insert a |
359 | 179 | * newline at the beginning, so that the first variable name is caught. | ||
360 | 180 | */ | ||
361 | 179 | len = strlen (buf); | 181 | len = strlen (buf); |
362 | 180 | buf = g_realloc (buf, len + 2); | 182 | buf = g_realloc (buf, len + 2); |
364 | 181 | g_memmove (buf + 1, buf, len + 1); | 183 | memmove (buf + 1, buf, len + 1); |
365 | 182 | buf[0] = '\n'; | 184 | buf[0] = '\n'; |
366 | 183 | 185 | ||
367 | 184 | va_start (ap, filename); | 186 | va_start (ap, filename); |
368 | 185 | 187 | ||
369 | === modified file 'src/prefix.c' | |||
370 | --- src/prefix.c 2013-10-23 02:51:47 +0000 | |||
371 | +++ src/prefix.c 2014-06-07 00:27:40 +0000 | |||
372 | @@ -45,7 +45,6 @@ | |||
373 | 45 | #define BR_PTHREADS 0 | 45 | #define BR_PTHREADS 0 |
374 | 46 | #endif /* BR_PTHREADS */ | 46 | #endif /* BR_PTHREADS */ |
375 | 47 | 47 | ||
376 | 48 | #define _GNU_SOURCE | ||
377 | 49 | #include <stdlib.h> | 48 | #include <stdlib.h> |
378 | 50 | #include <stdio.h> | 49 | #include <stdio.h> |
379 | 51 | #include <limits.h> | 50 | #include <limits.h> |
380 | 52 | 51 | ||
381 | === modified file 'src/xpad-app.c' | |||
382 | --- src/xpad-app.c 2013-10-31 21:17:36 +0000 | |||
383 | +++ src/xpad-app.c 2014-06-07 00:27:40 +0000 | |||
384 | @@ -62,7 +62,6 @@ | |||
385 | 62 | #define SUN_LEN(sunp) ((size_t)((struct sockaddr_un *)0)->sun_path + strlen((sunp)->sun_path)) | 62 | #define SUN_LEN(sunp) ((size_t)((struct sockaddr_un *)0)->sun_path + strlen((sunp)->sun_path)) |
386 | 63 | #endif | 63 | #endif |
387 | 64 | 64 | ||
388 | 65 | |||
389 | 66 | static gint xpad_argc; | 65 | static gint xpad_argc; |
390 | 67 | static gchar **xpad_argv; | 66 | static gchar **xpad_argv; |
391 | 68 | static gboolean option_nonew; | 67 | static gboolean option_nonew; |
392 | @@ -84,18 +83,17 @@ | |||
393 | 84 | XpadSettings *xpad_global_settings; | 83 | XpadSettings *xpad_global_settings; |
394 | 85 | 84 | ||
395 | 86 | static gboolean process_local_args (gint *argc, gchar **argv[]); | 85 | static gboolean process_local_args (gint *argc, gchar **argv[]); |
397 | 87 | static gboolean process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk); | 86 | static gboolean process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk, XpadSettings *xpad_settings); |
398 | 88 | 87 | ||
399 | 89 | static gboolean config_dir_exists (void); | 88 | static gboolean config_dir_exists (void); |
400 | 90 | static gchar *make_config_dir (void); | 89 | static gchar *make_config_dir (void); |
403 | 91 | static void register_stock_icons (void); | 90 | static void register_stock_icons (void); |
404 | 92 | static gint xpad_app_load_pads (void); | 91 | static gint xpad_app_load_pads (void); |
405 | 93 | static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group); | 92 | static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group); |
406 | 94 | static gboolean xpad_app_first_idle_check (XpadPadGroup *group); | 93 | static gboolean xpad_app_first_idle_check (XpadPadGroup *group); |
407 | 95 | static gboolean xpad_app_pass_args (void); | 94 | static gboolean xpad_app_pass_args (void); |
408 | 96 | static gboolean xpad_app_open_proc_file (void); | 95 | static gboolean xpad_app_open_proc_file (void); |
409 | 97 | 96 | ||
410 | 98 | |||
411 | 99 | static void | 97 | static void |
412 | 100 | xpad_app_init (int argc, char **argv) | 98 | xpad_app_init (int argc, char **argv) |
413 | 101 | { | 99 | { |
414 | @@ -109,7 +107,7 @@ | |||
415 | 109 | textdomain (GETTEXT_PACKAGE); | 107 | textdomain (GETTEXT_PACKAGE); |
416 | 110 | #endif | 108 | #endif |
417 | 111 | 109 | ||
419 | 112 | have_gtk = gtk_init_check (&argc, &argv); // Leaves 135 referenced objects behind. No idea how to unref. Total up to here 135. | 110 | have_gtk = gtk_init_check (&argc, &argv); |
420 | 113 | xpad_argc = argc; | 111 | xpad_argc = argc; |
421 | 114 | xpad_argv = argv; | 112 | xpad_argv = argv; |
422 | 115 | output = stdout; | 113 | output = stdout; |
423 | @@ -129,7 +127,7 @@ | |||
424 | 129 | process_local_args (&xpad_argc, &xpad_argv); | 127 | process_local_args (&xpad_argc, &xpad_argv); |
425 | 130 | if (!xpad_app_pass_args ()) | 128 | if (!xpad_app_pass_args ()) |
426 | 131 | { | 129 | { |
428 | 132 | process_remote_args (&xpad_argc, &xpad_argv, FALSE); | 130 | process_remote_args (&xpad_argc, &xpad_argv, FALSE, xpad_global_settings); |
429 | 133 | fprintf (output, "%s\n", _("Xpad is a graphical program. Please run it from your desktop.")); | 131 | fprintf (output, "%s\n", _("Xpad is a graphical program. Please run it from your desktop.")); |
430 | 134 | } | 132 | } |
431 | 135 | exit (0); | 133 | exit (0); |
432 | @@ -139,7 +137,6 @@ | |||
433 | 139 | gdk_set_program_class (PACKAGE); | 137 | gdk_set_program_class (PACKAGE); |
434 | 140 | 138 | ||
435 | 141 | /* Set up program path. */ | 139 | /* Set up program path. */ |
436 | 142 | |||
437 | 143 | if (xpad_argc > 0) | 140 | if (xpad_argc > 0) |
438 | 144 | program_path = g_find_program_in_path (xpad_argv[0]); | 141 | program_path = g_find_program_in_path (xpad_argv[0]); |
439 | 145 | else | 142 | else |
440 | @@ -153,30 +150,43 @@ | |||
441 | 153 | /* Race condition here, between calls */ | 150 | /* Race condition here, between calls */ |
442 | 154 | xpad_app_open_proc_file (); | 151 | xpad_app_open_proc_file (); |
443 | 155 | 152 | ||
445 | 156 | register_stock_icons (); // Leaves 1039 referenced objects behind. No idea how to unref, except 1. Total up to here 1173. | 153 | register_stock_icons (); |
446 | 157 | gtk_window_set_default_icon_name (PACKAGE); | 154 | gtk_window_set_default_icon_name (PACKAGE); |
447 | 158 | 155 | ||
452 | 159 | pad_group = xpad_pad_group_new(); // Creates 1 referenced object; but does get unrefferenced. Total 1173. | 156 | /* Read the Xpad configuration file from disk (if exists) */ |
453 | 160 | process_remote_args (&xpad_argc, &xpad_argv, TRUE); | 157 | xpad_global_settings = xpad_settings_new (); |
454 | 161 | 158 | ||
455 | 162 | xpad_tray_open (); // Creates 34 referenced objects; but only 14 get unrefferenced. Total 1193. | 159 | /* Delay program startup, if user configured it, to wait for example for the loading of the systray. */ |
456 | 160 | if (xpad_settings_get_autostart_delay (xpad_global_settings)) | ||
457 | 161 | sleep(xpad_settings_get_autostart_delay (xpad_global_settings)); | ||
458 | 162 | |||
459 | 163 | pad_group = xpad_pad_group_new(); | ||
460 | 164 | process_remote_args (&xpad_argc, &xpad_argv, TRUE, xpad_global_settings); | ||
461 | 165 | |||
462 | 166 | xpad_tray_open (); | ||
463 | 163 | xpad_session_manager_init (); | 167 | xpad_session_manager_init (); |
464 | 164 | 168 | ||
465 | 165 | xpad_global_settings = xpad_settings_new (); // Creates 1 reference, 1 reference gets cleaned up. Total 1193 | ||
466 | 166 | |||
467 | 167 | /* Initialize Xpad-periodic module */ | 169 | /* Initialize Xpad-periodic module */ |
468 | 168 | Xpad_periodic_init(); | 170 | Xpad_periodic_init(); |
469 | 169 | Xpad_periodic_set_callback("save-content", (XpadPeriodicFunc) xpad_pad_save_content); | 171 | Xpad_periodic_set_callback("save-content", (XpadPeriodicFunc) xpad_pad_save_content); |
470 | 170 | Xpad_periodic_set_callback("save-info", (XpadPeriodicFunc) xpad_pad_save_info); | 172 | Xpad_periodic_set_callback("save-info", (XpadPeriodicFunc) xpad_pad_save_info); |
471 | 171 | 173 | ||
472 | 172 | /* load all pads */ | 174 | /* load all pads */ |
474 | 173 | pads_loaded_on_start = xpad_app_load_pads (); // each pad creates 333 references and leaves about 100 references behind. Total 1268. | 175 | pads_loaded_on_start = xpad_app_load_pads (); |
475 | 174 | if (pads_loaded_on_start == 0 && !option_new) { | 176 | if (pads_loaded_on_start == 0 && !option_new) { |
476 | 175 | if (!option_nonew) { | 177 | if (!option_nonew) { |
477 | 176 | GtkWidget *pad = xpad_pad_new (pad_group); | 178 | GtkWidget *pad = xpad_pad_new (pad_group); |
478 | 177 | gtk_widget_show (pad); | 179 | gtk_widget_show (pad); |
479 | 178 | } | 180 | } |
480 | 179 | } | 181 | } |
481 | 182 | |||
482 | 183 | /* Since all pads have been loaded, reprocess the show/hide/toggle option for all pads */ | ||
483 | 184 | if (have_gtk && (option_show)) | ||
484 | 185 | xpad_pad_group_show_all (pad_group); | ||
485 | 186 | if (have_gtk && (option_hide)) | ||
486 | 187 | xpad_pad_group_close_all (pad_group); | ||
487 | 188 | if (have_gtk && option_toggle) | ||
488 | 189 | xpad_pad_group_toggle_hide (pad_group); | ||
489 | 180 | 190 | ||
490 | 181 | g_idle_add ((GSourceFunc)xpad_app_first_idle_check, pad_group); | 191 | g_idle_add ((GSourceFunc)xpad_app_first_idle_check, pad_group); |
491 | 182 | 192 | ||
492 | @@ -209,22 +219,22 @@ | |||
493 | 209 | 219 | ||
494 | 210 | g_printerr ("%s\n", primary); | 220 | g_printerr ("%s\n", primary); |
495 | 211 | 221 | ||
498 | 212 | dialog = xpad_app_alert_new (parent, GTK_STOCK_DIALOG_ERROR, primary, secondary); | 222 | dialog = xpad_app_alert_dialog (parent, "dialog-error", primary, secondary); |
499 | 213 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_OK, 1, NULL); | 223 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Ok"), GTK_RESPONSE_OK, NULL); |
500 | 214 | gtk_dialog_run (GTK_DIALOG (dialog)); | 224 | gtk_dialog_run (GTK_DIALOG (dialog)); |
501 | 215 | gtk_widget_destroy (dialog); | 225 | gtk_widget_destroy (dialog); |
502 | 216 | 226 | ||
503 | 217 | xpad_session_manager_stop_interact (FALSE); | 227 | xpad_session_manager_stop_interact (FALSE); |
504 | 218 | } | 228 | } |
505 | 219 | 229 | ||
507 | 220 | G_CONST_RETURN gchar * | 230 | const gchar * |
508 | 221 | xpad_app_get_config_dir (void) | 231 | xpad_app_get_config_dir (void) |
509 | 222 | { | 232 | { |
510 | 223 | return config_dir; | 233 | return config_dir; |
511 | 224 | } | 234 | } |
512 | 225 | 235 | ||
513 | 226 | /* Returns absolute path to our own executable. May be NULL. */ | 236 | /* Returns absolute path to our own executable. May be NULL. */ |
515 | 227 | G_CONST_RETURN gchar * | 237 | const gchar * |
516 | 228 | xpad_app_get_program_path (void) | 238 | xpad_app_get_program_path (void) |
517 | 229 | { | 239 | { |
518 | 230 | return program_path; | 240 | return program_path; |
519 | @@ -239,23 +249,23 @@ | |||
520 | 239 | void | 249 | void |
521 | 240 | xpad_app_quit (void) | 250 | xpad_app_quit (void) |
522 | 241 | { | 251 | { |
524 | 242 | // Free the memory used by the pads belonging to this group | 252 | /* Free the memory used by the pads belonging to this group */ |
525 | 243 | xpad_pad_group_destroy_pads (xpad_app_get_pad_group()); | 253 | xpad_pad_group_destroy_pads (xpad_app_get_pad_group()); |
526 | 244 | 254 | ||
528 | 245 | // Free the memory used by group. | 255 | /* Free the memory used by group. */ |
529 | 246 | g_object_unref (xpad_app_get_pad_group()); | 256 | g_object_unref (xpad_app_get_pad_group()); |
530 | 247 | 257 | ||
532 | 248 | // Free the memory used by the settings menu. | 258 | /* Free the memory used by the settings menu. */ |
533 | 249 | g_object_unref (xpad_global_settings); | 259 | g_object_unref (xpad_global_settings); |
535 | 250 | xpad_global_settings = NULL; // This is needed due to the asynchronous finalizing process. | 260 | xpad_global_settings = NULL; /* This is needed due to the asynchronous finalizing process. */ |
536 | 251 | 261 | ||
538 | 252 | // Free the memory used by the tray icon and its menu. | 262 | /* Free the memory used by the tray icon and its menu. */ |
539 | 253 | xpad_tray_close (); | 263 | xpad_tray_close (); |
540 | 254 | 264 | ||
542 | 255 | // Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind. | 265 | /* Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind. */ |
543 | 256 | g_object_unref (gtk_icon_theme_get_default ()); | 266 | g_object_unref (gtk_icon_theme_get_default ()); |
544 | 257 | 267 | ||
546 | 258 | // Give GTK the signal to clean the rest and quit the application. | 268 | /* Give GTK the signal to clean the rest and quit the application. */ |
547 | 259 | gtk_main_quit (); | 269 | gtk_main_quit (); |
548 | 260 | } | 270 | } |
549 | 261 | 271 | ||
550 | @@ -338,24 +348,23 @@ | |||
551 | 338 | return dir; | 348 | return dir; |
552 | 339 | } | 349 | } |
553 | 340 | 350 | ||
554 | 341 | |||
555 | 342 | /** | 351 | /** |
557 | 343 | * Creates an alert with 'stock' used to create an icon and parent text of 'parent', | 352 | * Creates an alert with a named-icon used to create an icon and parent text of 'parent', |
558 | 344 | * secondary text of 'secondary'. No buttons are added. | 353 | * secondary text of 'secondary'. No buttons are added. |
559 | 345 | */ | 354 | */ |
560 | 346 | GtkWidget * | 355 | GtkWidget * |
562 | 347 | xpad_app_alert_new (GtkWindow *parent, const gchar *stock, const gchar *primary, const gchar *secondary) | 356 | xpad_app_alert_dialog (GtkWindow *parent, const gchar *icon_name, const gchar *primary, const gchar *secondary) |
563 | 348 | { | 357 | { |
564 | 349 | GtkWidget *dialog, *hbox, *image, *label; | 358 | GtkWidget *dialog, *hbox, *image, *label; |
565 | 350 | gchar *buf; | 359 | gchar *buf; |
566 | 351 | 360 | ||
568 | 352 | dialog = gtk_dialog_new(); | 361 | dialog = gtk_dialog_new (); |
569 | 353 | gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); | 362 | gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); |
570 | 354 | gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); | 363 | gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); |
571 | 355 | gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); | 364 | gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); |
572 | 356 | 365 | ||
573 | 357 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); | 366 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); |
575 | 358 | image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_DIALOG); | 367 | image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); |
576 | 359 | label = gtk_label_new (NULL); | 368 | label = gtk_label_new (NULL); |
577 | 360 | 369 | ||
578 | 361 | if (secondary) | 370 | if (secondary) |
579 | @@ -383,7 +392,6 @@ | |||
580 | 383 | return dialog; | 392 | return dialog; |
581 | 384 | } | 393 | } |
582 | 385 | 394 | ||
583 | 386 | |||
584 | 387 | static void | 395 | static void |
585 | 388 | register_stock_icons (void) | 396 | register_stock_icons (void) |
586 | 389 | { | 397 | { |
587 | @@ -393,7 +401,6 @@ | |||
588 | 393 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); | 401 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); |
589 | 394 | } | 402 | } |
590 | 395 | 403 | ||
591 | 396 | |||
592 | 397 | static gboolean | 404 | static gboolean |
593 | 398 | xpad_app_quit_if_no_pads (XpadPadGroup *group) | 405 | xpad_app_quit_if_no_pads (XpadPadGroup *group) |
594 | 399 | { | 406 | { |
595 | @@ -412,7 +419,6 @@ | |||
596 | 412 | return FALSE; | 419 | return FALSE; |
597 | 413 | } | 420 | } |
598 | 414 | 421 | ||
599 | 415 | |||
600 | 416 | static gboolean | 422 | static gboolean |
601 | 417 | xpad_app_first_idle_check (XpadPadGroup *group) | 423 | xpad_app_first_idle_check (XpadPadGroup *group) |
602 | 418 | { | 424 | { |
603 | @@ -439,7 +445,6 @@ | |||
604 | 439 | return FALSE; | 445 | return FALSE; |
605 | 440 | } | 446 | } |
606 | 441 | 447 | ||
607 | 442 | |||
608 | 443 | static void | 448 | static void |
609 | 444 | xpad_app_pad_added (XpadPadGroup *group, XpadPad *pad) | 449 | xpad_app_pad_added (XpadPadGroup *group, XpadPad *pad) |
610 | 445 | { | 450 | { |
611 | @@ -454,7 +459,7 @@ | |||
612 | 454 | { | 459 | { |
613 | 455 | gint opened = 0; | 460 | gint opened = 0; |
614 | 456 | GDir *dir; | 461 | GDir *dir; |
616 | 457 | G_CONST_RETURN gchar *name; | 462 | const gchar *name; |
617 | 458 | 463 | ||
618 | 459 | g_signal_connect (pad_group, "pad-added", G_CALLBACK (xpad_app_pad_added), NULL); | 464 | g_signal_connect (pad_group, "pad-added", G_CALLBACK (xpad_app_pad_added), NULL); |
619 | 460 | 465 | ||
620 | @@ -495,17 +500,6 @@ | |||
621 | 495 | return opened; | 500 | return opened; |
622 | 496 | } | 501 | } |
623 | 497 | 502 | ||
624 | 498 | |||
625 | 499 | |||
626 | 500 | |||
627 | 501 | |||
628 | 502 | |||
629 | 503 | |||
630 | 504 | |||
631 | 505 | |||
632 | 506 | |||
633 | 507 | |||
634 | 508 | |||
635 | 509 | /* | 503 | /* |
636 | 510 | converts main program arguments into one long string. | 504 | converts main program arguments into one long string. |
637 | 511 | puts allocated string in dest, and returns size | 505 | puts allocated string in dest, and returns size |
638 | @@ -522,7 +516,7 @@ | |||
639 | 522 | for (i = 0; i < argc; i++) { | 516 | for (i = 0; i < argc; i++) { |
640 | 523 | string_length = strlen (argv[i]) + 1; | 517 | string_length = strlen (argv[i]) + 1; |
641 | 524 | 518 | ||
643 | 525 | // safe cast | 519 | /* safe cast */ |
644 | 526 | if( string_length <= UINT_MAX ) { | 520 | if( string_length <= UINT_MAX ) { |
645 | 527 | size += (guint) string_length; | 521 | size += (guint) string_length; |
646 | 528 | } | 522 | } |
647 | @@ -549,7 +543,6 @@ | |||
648 | 549 | return size; | 543 | return size; |
649 | 550 | } | 544 | } |
650 | 551 | 545 | ||
651 | 552 | |||
652 | 553 | /* | 546 | /* |
653 | 554 | returns number of strings in newly allocated argv | 547 | returns number of strings in newly allocated argv |
654 | 555 | */ | 548 | */ |
655 | @@ -576,7 +569,7 @@ | |||
656 | 576 | 569 | ||
657 | 577 | if (tmp) { | 570 | if (tmp) { |
658 | 578 | long int difference = tmp - string; | 571 | long int difference = tmp - string; |
660 | 579 | // safe cast from long int to size_t | 572 | /* safe cast from long int to size_t */ |
661 | 580 | if (difference >= 0) | 573 | if (difference >= 0) |
662 | 581 | len = (size_t) difference; | 574 | len = (size_t) difference; |
663 | 582 | else { | 575 | else { |
664 | @@ -645,19 +638,19 @@ | |||
665 | 645 | /* here we redirect singleton->priv->output to the socket */ | 638 | /* here we redirect singleton->priv->output to the socket */ |
666 | 646 | output = fdopen (client_fd, "w"); | 639 | output = fdopen (client_fd, "w"); |
667 | 647 | 640 | ||
669 | 648 | if (!process_remote_args (&argc, &argv, TRUE)) | 641 | if (!process_remote_args (&argc, &argv, TRUE, xpad_global_settings)) |
670 | 649 | { | 642 | { |
671 | 650 | /* if there were no non-local arguments, insert --new as argument */ | 643 | /* if there were no non-local arguments, insert --new as argument */ |
672 | 651 | gint c = 2; | 644 | gint c = 2; |
673 | 652 | gchar **v = NULL; | 645 | gchar **v = NULL; |
674 | 653 | unsigned long int my_size = 0; | 646 | unsigned long int my_size = 0; |
676 | 654 | // safe cast | 647 | /* safe cast */ |
677 | 655 | my_size = sizeof (gchar *) * (long unsigned) c; | 648 | my_size = sizeof (gchar *) * (long unsigned) c; |
678 | 656 | v = g_malloc (my_size); | 649 | v = g_malloc (my_size); |
679 | 657 | v[0] = PACKAGE; | 650 | v[0] = PACKAGE; |
680 | 658 | v[1] = "--new"; | 651 | v[1] = "--new"; |
681 | 659 | 652 | ||
683 | 660 | process_remote_args (&c, &v, TRUE); | 653 | process_remote_args (&c, &v, TRUE, xpad_global_settings); |
684 | 661 | 654 | ||
685 | 662 | g_free (v); | 655 | g_free (v); |
686 | 663 | } | 656 | } |
687 | @@ -676,8 +669,7 @@ | |||
688 | 676 | static gboolean | 669 | static gboolean |
689 | 677 | can_read_from_server_fd (GIOChannel *source, GIOCondition condition, gpointer data) | 670 | can_read_from_server_fd (GIOChannel *source, GIOCondition condition, gpointer data) |
690 | 678 | { | 671 | { |
693 | 679 | // A dirty way to silence the compiler for these unused variables. | 672 | /* A dirty way to silence the compiler for these unused variables. */ |
692 | 680 | // Feel free to implement these variables in the way they are ment to be used. | ||
694 | 681 | (void) source; | 673 | (void) source; |
695 | 682 | (void) condition; | 674 | (void) condition; |
696 | 683 | (void) data; | 675 | (void) data; |
697 | @@ -784,27 +776,6 @@ | |||
698 | 784 | return connected; | 776 | return connected; |
699 | 785 | } | 777 | } |
700 | 786 | 778 | ||
701 | 787 | |||
702 | 788 | |||
703 | 789 | |||
704 | 790 | |||
705 | 791 | |||
706 | 792 | |||
707 | 793 | |||
708 | 794 | |||
709 | 795 | |||
710 | 796 | |||
711 | 797 | |||
712 | 798 | |||
713 | 799 | |||
714 | 800 | |||
715 | 801 | |||
716 | 802 | |||
717 | 803 | |||
718 | 804 | |||
719 | 805 | |||
720 | 806 | |||
721 | 807 | |||
722 | 808 | /** | 779 | /** |
723 | 809 | * Here are the functions called when arguments are passed to us. | 780 | * Here are the functions called when arguments are passed to us. |
724 | 810 | */ | 781 | */ |
725 | @@ -872,7 +843,7 @@ | |||
726 | 872 | } | 843 | } |
727 | 873 | 844 | ||
728 | 874 | static gboolean | 845 | static gboolean |
730 | 875 | process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk) | 846 | process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk, XpadSettings *xpad_settings) |
731 | 876 | { | 847 | { |
732 | 877 | GError *error = NULL; | 848 | GError *error = NULL; |
733 | 878 | GOptionContext *context; | 849 | GOptionContext *context; |
734 | @@ -894,21 +865,17 @@ | |||
735 | 894 | if (have_gtk && option_smid) | 865 | if (have_gtk && option_smid) |
736 | 895 | xpad_session_manager_set_id (option_smid); | 866 | xpad_session_manager_set_id (option_smid); |
737 | 896 | 867 | ||
739 | 897 | if (have_gtk && option_new) | 868 | if (have_gtk && (option_new || xpad_settings_get_autostart_new_pad (xpad_settings))) |
740 | 898 | { | 869 | { |
741 | 899 | GtkWidget *pad = xpad_pad_new (pad_group); | 870 | GtkWidget *pad = xpad_pad_new (pad_group); |
742 | 900 | gtk_widget_show (pad); | 871 | gtk_widget_show (pad); |
743 | 901 | } | 872 | } |
744 | 902 | 873 | ||
754 | 903 | if (have_gtk && option_show) | 874 | if (xpad_settings_get_autostart_display_pads (xpad_settings) == 0) |
755 | 904 | xpad_pad_group_show_all (pad_group); | 875 | option_show = TRUE; |
756 | 905 | 876 | if (xpad_settings_get_autostart_display_pads (xpad_settings) == 1) | |
757 | 906 | if (have_gtk && option_hide) | 877 | option_hide = TRUE; |
758 | 907 | xpad_pad_group_close_all (pad_group); | 878 | |
750 | 908 | |||
751 | 909 | if (have_gtk && option_toggle) | ||
752 | 910 | xpad_pad_group_toggle_hide (pad_group); | ||
753 | 911 | |||
759 | 912 | if (have_gtk && option_files) | 879 | if (have_gtk && option_files) |
760 | 913 | { | 880 | { |
761 | 914 | int i; | 881 | int i; |
762 | 915 | 882 | ||
763 | === modified file 'src/xpad-app.h' | |||
764 | --- src/xpad-app.h 2013-10-31 21:17:36 +0000 | |||
765 | +++ src/xpad-app.h 2014-06-07 00:27:40 +0000 | |||
766 | @@ -26,10 +26,10 @@ | |||
767 | 26 | G_BEGIN_DECLS | 26 | G_BEGIN_DECLS |
768 | 27 | 27 | ||
769 | 28 | void xpad_app_error (GtkWindow *parent, const gchar *primary, const gchar *secondary); | 28 | void xpad_app_error (GtkWindow *parent, const gchar *primary, const gchar *secondary); |
771 | 29 | GtkWidget *xpad_app_alert_new (GtkWindow *parent, const gchar *stock, const gchar *primary, const gchar *secondary); | 29 | GtkWidget *xpad_app_alert_dialog (GtkWindow *parent, const gchar *icon_name, const gchar *primary, const gchar *secondary); |
772 | 30 | 30 | ||
775 | 31 | G_CONST_RETURN gchar *xpad_app_get_config_dir (void); | 31 | const gchar *xpad_app_get_config_dir (void); |
776 | 32 | G_CONST_RETURN gchar *xpad_app_get_program_path (void); | 32 | const gchar *xpad_app_get_program_path (void); |
777 | 33 | XpadPadGroup *xpad_app_get_pad_group (void); | 33 | XpadPadGroup *xpad_app_get_pad_group (void); |
778 | 34 | XpadSettings *xpad_global_settings; | 34 | XpadSettings *xpad_global_settings; |
779 | 35 | gboolean xpad_app_get_translucent (void); | 35 | gboolean xpad_app_get_translucent (void); |
780 | 36 | 36 | ||
781 | === modified file 'src/xpad-pad-group.c' | |||
782 | --- src/xpad-pad-group.c 2013-10-31 21:17:36 +0000 | |||
783 | +++ src/xpad-pad-group.c 2014-06-07 00:27:40 +0000 | |||
784 | @@ -95,7 +95,7 @@ | |||
785 | 95 | { | 95 | { |
786 | 96 | XpadPadGroup *group = XPAD_PAD_GROUP (object); | 96 | XpadPadGroup *group = XPAD_PAD_GROUP (object); |
787 | 97 | 97 | ||
789 | 98 | // Save all pads of this group | 98 | /* Save all pads of this group */ |
790 | 99 | xpad_pad_group_save_unsaved_all(group); | 99 | xpad_pad_group_save_unsaved_all(group); |
791 | 100 | 100 | ||
792 | 101 | G_OBJECT_CLASS (xpad_pad_group_parent_class)->dispose (object); | 101 | G_OBJECT_CLASS (xpad_pad_group_parent_class)->dispose (object); |
793 | @@ -123,7 +123,6 @@ | |||
794 | 123 | xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad) | 123 | xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad) |
795 | 124 | { | 124 | { |
796 | 125 | g_object_ref(pad); | 125 | g_object_ref(pad); |
797 | 126 | // g_object_ref_sink(GTK_OBJECT(pad)); | ||
798 | 127 | 126 | ||
799 | 128 | group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad)); | 127 | group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad)); |
800 | 129 | g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group); | 128 | g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group); |
801 | 130 | 129 | ||
802 | === modified file 'src/xpad-pad-properties.c' | |||
803 | --- src/xpad-pad-properties.c 2013-10-31 21:17:36 +0000 | |||
804 | +++ src/xpad-pad-properties.c 2014-06-07 00:27:40 +0000 | |||
805 | @@ -273,8 +273,7 @@ | |||
806 | 273 | static void | 273 | static void |
807 | 274 | change_text_color (GtkColorButton *button, XpadPadProperties *prop) | 274 | change_text_color (GtkColorButton *button, XpadPadProperties *prop) |
808 | 275 | { | 275 | { |
811 | 276 | // A dirty way to silence the compiler for these unused variables. | 276 | /* A dirty way to silence the compiler for these unused variables. */ |
810 | 277 | // Feel free to implement these variables in the way they are ment to be used. | ||
812 | 278 | (void) button; | 277 | (void) button; |
813 | 279 | 278 | ||
814 | 280 | g_object_notify (G_OBJECT (prop), "text-color"); | 279 | g_object_notify (G_OBJECT (prop), "text-color"); |
815 | @@ -283,8 +282,7 @@ | |||
816 | 283 | static void | 282 | static void |
817 | 284 | change_back_color (GtkColorButton *button, XpadPadProperties *prop) | 283 | change_back_color (GtkColorButton *button, XpadPadProperties *prop) |
818 | 285 | { | 284 | { |
821 | 286 | // A dirty way to silence the compiler for these unused variables. | 285 | /* A dirty way to silence the compiler for these unused variables. */ |
820 | 287 | // Feel free to implement these variables in the way they are ment to be used. | ||
822 | 288 | (void) button; | 286 | (void) button; |
823 | 289 | 287 | ||
824 | 290 | g_object_notify (G_OBJECT (prop), "back-color"); | 288 | g_object_notify (G_OBJECT (prop), "back-color"); |
825 | @@ -293,8 +291,7 @@ | |||
826 | 293 | static void | 291 | static void |
827 | 294 | change_font_face (GtkFontButton *button, XpadPadProperties *prop) | 292 | change_font_face (GtkFontButton *button, XpadPadProperties *prop) |
828 | 295 | { | 293 | { |
831 | 296 | // A dirty way to silence the compiler for these unused variables. | 294 | /* A dirty way to silence the compiler for these unused variables. */ |
830 | 297 | // Feel free to implement these variables in the way they are ment to be used. | ||
832 | 298 | (void) button; | 295 | (void) button; |
833 | 299 | 296 | ||
834 | 300 | g_object_notify (G_OBJECT (prop), "fontname"); | 297 | g_object_notify (G_OBJECT (prop), "fontname"); |
835 | @@ -333,7 +330,7 @@ | |||
836 | 333 | g_object_notify (G_OBJECT (prop), "back_color"); | 330 | g_object_notify (G_OBJECT (prop), "back_color"); |
837 | 334 | } | 331 | } |
838 | 335 | 332 | ||
840 | 336 | G_CONST_RETURN GdkRGBA * | 333 | const GdkRGBA * |
841 | 337 | xpad_pad_properties_get_back_color (XpadPadProperties *prop) | 334 | xpad_pad_properties_get_back_color (XpadPadProperties *prop) |
842 | 338 | { | 335 | { |
843 | 339 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp); | 336 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp); |
844 | @@ -347,7 +344,7 @@ | |||
845 | 347 | g_object_notify (G_OBJECT (prop), "text_color"); | 344 | g_object_notify (G_OBJECT (prop), "text_color"); |
846 | 348 | } | 345 | } |
847 | 349 | 346 | ||
849 | 350 | G_CONST_RETURN GdkRGBA * | 347 | const GdkRGBA * |
850 | 351 | xpad_pad_properties_get_text_color (XpadPadProperties *prop) | 348 | xpad_pad_properties_get_text_color (XpadPadProperties *prop) |
851 | 352 | { | 349 | { |
852 | 353 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp); | 350 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp); |
853 | @@ -361,7 +358,7 @@ | |||
854 | 361 | g_object_notify (G_OBJECT (prop), "fontname"); | 358 | g_object_notify (G_OBJECT (prop), "fontname"); |
855 | 362 | } | 359 | } |
856 | 363 | 360 | ||
858 | 364 | G_CONST_RETURN gchar *xpad_pad_properties_get_fontname (XpadPadProperties *prop) | 361 | const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *prop) |
859 | 365 | { | 362 | { |
860 | 366 | return gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton)); | 363 | return gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton)); |
861 | 367 | } | 364 | } |
862 | 368 | 365 | ||
863 | === modified file 'src/xpad-pad-properties.h' | |||
864 | --- src/xpad-pad-properties.h 2013-10-31 21:17:36 +0000 | |||
865 | +++ src/xpad-pad-properties.h 2014-06-07 00:27:40 +0000 | |||
866 | @@ -59,13 +59,13 @@ | |||
867 | 59 | gboolean xpad_pad_properties_get_follow_color_style (XpadPadProperties *pad_properties); | 59 | gboolean xpad_pad_properties_get_follow_color_style (XpadPadProperties *pad_properties); |
868 | 60 | 60 | ||
869 | 61 | void xpad_pad_properties_set_back_color (XpadPadProperties *pad_properties, const GdkRGBA *back); | 61 | void xpad_pad_properties_set_back_color (XpadPadProperties *pad_properties, const GdkRGBA *back); |
871 | 62 | G_CONST_RETURN GdkRGBA *xpad_pad_properties_get_back_color (XpadPadProperties *pad_properties); | 62 | const GdkRGBA *xpad_pad_properties_get_back_color (XpadPadProperties *pad_properties); |
872 | 63 | 63 | ||
873 | 64 | void xpad_pad_properties_set_text_color (XpadPadProperties *pad_properties, const GdkRGBA *text); | 64 | void xpad_pad_properties_set_text_color (XpadPadProperties *pad_properties, const GdkRGBA *text); |
875 | 65 | G_CONST_RETURN GdkRGBA *xpad_pad_properties_get_text_color (XpadPadProperties *pad_properties); | 65 | const GdkRGBA *xpad_pad_properties_get_text_color (XpadPadProperties *pad_properties); |
876 | 66 | 66 | ||
877 | 67 | void xpad_pad_properties_set_fontname (XpadPadProperties *pad_properties, const gchar *fontname); | 67 | void xpad_pad_properties_set_fontname (XpadPadProperties *pad_properties, const gchar *fontname); |
879 | 68 | G_CONST_RETURN gchar *xpad_pad_properties_get_fontname (XpadPadProperties *pad_properties); | 68 | const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *pad_properties); |
880 | 69 | 69 | ||
881 | 70 | G_END_DECLS | 70 | G_END_DECLS |
882 | 71 | 71 | ||
883 | 72 | 72 | ||
884 | === modified file 'src/xpad-pad.c' | |||
885 | --- src/xpad-pad.c 2013-11-01 20:16:37 +0000 | |||
886 | +++ src/xpad-pad.c 2014-06-07 00:27:40 +0000 | |||
887 | @@ -241,7 +241,7 @@ | |||
888 | 241 | pad->priv->height = xpad_settings_get_height (xpad_global_settings); | 241 | pad->priv->height = xpad_settings_get_height (xpad_global_settings); |
889 | 242 | pad->priv->infoname = NULL; | 242 | pad->priv->infoname = NULL; |
890 | 243 | pad->priv->contentname = NULL; | 243 | pad->priv->contentname = NULL; |
892 | 244 | pad->priv->sticky = xpad_settings_get_sticky (xpad_global_settings); | 244 | pad->priv->sticky = xpad_settings_get_autostart_sticky (xpad_global_settings); |
893 | 245 | pad->priv->textview = NULL; | 245 | pad->priv->textview = NULL; |
894 | 246 | pad->priv->scrollbar = NULL; | 246 | pad->priv->scrollbar = NULL; |
895 | 247 | pad->priv->toolbar = NULL; | 247 | pad->priv->toolbar = NULL; |
896 | @@ -289,7 +289,7 @@ | |||
897 | 289 | 289 | ||
898 | 290 | gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_global_settings)); | 290 | gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_global_settings)); |
899 | 291 | gtk_window_set_default_size (GTK_WINDOW(pad), (gint) xpad_settings_get_width (xpad_global_settings), (gint) xpad_settings_get_height (xpad_global_settings)); | 291 | gtk_window_set_default_size (GTK_WINDOW(pad), (gint) xpad_settings_get_width (xpad_global_settings), (gint) xpad_settings_get_height (xpad_global_settings)); |
901 | 292 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); // static gravity makes saving pad x,y work | 292 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */ |
902 | 293 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_global_settings)); | 293 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_global_settings)); |
903 | 294 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_global_settings)); | 294 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_global_settings)); |
904 | 295 | gtk_window_set_type_hint (GTK_WINDOW(pad), GDK_WINDOW_TYPE_HINT_NORMAL); | 295 | gtk_window_set_type_hint (GTK_WINDOW(pad), GDK_WINDOW_TYPE_HINT_NORMAL); |
905 | @@ -318,7 +318,7 @@ | |||
906 | 318 | gtk_widget_hide (pad->priv->toolbar); | 318 | gtk_widget_hide (pad->priv->toolbar); |
907 | 319 | xpad_pad_notify_has_toolbar (pad); | 319 | xpad_pad_notify_has_toolbar (pad); |
908 | 320 | 320 | ||
910 | 321 | // Set up signals | 321 | /* Set up signals */ |
911 | 322 | gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK); | 322 | gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK); |
912 | 323 | gtk_widget_add_events (pad->priv->toolbar, GDK_ALL_EVENTS_MASK); | 323 | gtk_widget_add_events (pad->priv->toolbar, GDK_ALL_EVENTS_MASK); |
913 | 324 | g_signal_connect (pad->priv->textview, "button-press-event", G_CALLBACK (xpad_pad_text_view_button_press_event), pad); | 324 | g_signal_connect (pad->priv->textview, "button-press-event", G_CALLBACK (xpad_pad_text_view_button_press_event), pad); |
914 | @@ -381,12 +381,12 @@ | |||
915 | 381 | pad->priv->highlight_menu = NULL; | 381 | pad->priv->highlight_menu = NULL; |
916 | 382 | } | 382 | } |
917 | 383 | 383 | ||
919 | 384 | // For some reason the clipboard handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. | 384 | /* For some reason the clipboard handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. */ |
920 | 385 | if (GTK_IS_CLIPBOARD(pad->priv->clipboard)) { | 385 | if (GTK_IS_CLIPBOARD(pad->priv->clipboard)) { |
921 | 386 | g_signal_handlers_disconnect_matched (pad->priv->clipboard, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | 386 | g_signal_handlers_disconnect_matched (pad->priv->clipboard, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); |
922 | 387 | } | 387 | } |
923 | 388 | 388 | ||
925 | 389 | // For some reason the toolbar handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. | 389 | /* For some reason the toolbar handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. */ |
926 | 390 | if (XPAD_IS_TOOLBAR(pad->priv->toolbar)) { | 390 | if (XPAD_IS_TOOLBAR(pad->priv->toolbar)) { |
927 | 391 | g_signal_handlers_disconnect_matched (pad->priv->toolbar, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | 391 | g_signal_handlers_disconnect_matched (pad->priv->toolbar, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); |
928 | 392 | gtk_widget_destroy(pad->priv->toolbar); | 392 | gtk_widget_destroy(pad->priv->toolbar); |
929 | @@ -470,7 +470,9 @@ | |||
930 | 470 | This is good, as some WMs don't like us changing the above parameters mid-run, | 470 | This is good, as some WMs don't like us changing the above parameters mid-run, |
931 | 471 | even if we do a hide/show cycle. */ | 471 | even if we do a hide/show cycle. */ |
932 | 472 | gtk_window_set_default_size (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); | 472 | gtk_window_set_default_size (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); |
934 | 473 | gtk_window_reshow_with_initial_size (GTK_WINDOW (pad)); | 473 | gtk_widget_hide(GTK_WIDGET (pad)); |
935 | 474 | gtk_widget_unrealize(GTK_WIDGET (pad)); | ||
936 | 475 | gtk_widget_show(GTK_WIDGET (pad)); | ||
937 | 474 | } | 476 | } |
938 | 475 | 477 | ||
939 | 476 | static guint | 478 | static guint |
940 | @@ -488,7 +490,7 @@ | |||
941 | 488 | &textx, &texty); | 490 | &textx, &texty); |
942 | 489 | gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y); | 491 | gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y); |
943 | 490 | 492 | ||
945 | 491 | // Safe cast from gint to guint | 493 | /* Safe cast from gint to guint */ |
946 | 492 | if (y >= 0) { | 494 | if (y >= 0) { |
947 | 493 | return (guint) y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview)); | 495 | return (guint) y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview)); |
948 | 494 | } | 496 | } |
949 | @@ -511,7 +513,7 @@ | |||
950 | 511 | if (!pad->priv->toolbar_height) | 513 | if (!pad->priv->toolbar_height) |
951 | 512 | { | 514 | { |
952 | 513 | gtk_widget_get_preferred_size (pad->priv->toolbar, &req, NULL); | 515 | gtk_widget_get_preferred_size (pad->priv->toolbar, &req, NULL); |
954 | 514 | // safe cast from gint to guint | 516 | /* safe cast from gint to guint */ |
955 | 515 | if (req.height >= 0) { | 517 | if (req.height >= 0) { |
956 | 516 | pad->priv->toolbar_height = (guint) req.height; | 518 | pad->priv->toolbar_height = (guint) req.height; |
957 | 517 | } | 519 | } |
958 | @@ -625,7 +627,7 @@ | |||
959 | 625 | g_return_if_fail (pad); | 627 | g_return_if_fail (pad); |
960 | 626 | 628 | ||
961 | 627 | XpadToolbar *toolbar = NULL; | 629 | XpadToolbar *toolbar = NULL; |
963 | 628 | // safe cast to toolbar | 630 | /* safe cast to toolbar */ |
964 | 629 | if (XPAD_IS_TOOLBAR (pad->priv->toolbar)) { | 631 | if (XPAD_IS_TOOLBAR (pad->priv->toolbar)) { |
965 | 630 | toolbar = XPAD_TOOLBAR (pad->priv->toolbar); | 632 | toolbar = XPAD_TOOLBAR (pad->priv->toolbar); |
966 | 631 | g_return_if_fail (toolbar); | 633 | g_return_if_fail (toolbar); |
967 | @@ -758,7 +760,7 @@ | |||
968 | 758 | { | 760 | { |
969 | 759 | g_return_if_fail (pad); | 761 | g_return_if_fail (pad); |
970 | 760 | 762 | ||
972 | 761 | // With the delayed saving functionality, it is necessary to clear the unsaved flags to prevent usage of non-existing object information. | 763 | /* With the delayed saving functionality, it is necessary to clear the unsaved flags to prevent usage of non-existing object information. */ |
973 | 762 | pad->priv->unsaved_info = FALSE; | 764 | pad->priv->unsaved_info = FALSE; |
974 | 763 | pad->priv->unsaved_content = FALSE; | 765 | pad->priv->unsaved_content = FALSE; |
975 | 764 | 766 | ||
976 | @@ -766,31 +768,29 @@ | |||
977 | 766 | { | 768 | { |
978 | 767 | GtkWidget *dialog; | 769 | GtkWidget *dialog; |
979 | 768 | gint response; | 770 | gint response; |
984 | 769 | 771 | ||
985 | 770 | dialog = xpad_app_alert_new (GTK_WINDOW (pad), GTK_STOCK_DIALOG_WARNING, | 772 | dialog = xpad_app_alert_dialog (GTK_WINDOW (pad), "dialog-warning", _("Delete this pad?"), _("All text of this pad will be irrevocably lost.")); |
982 | 771 | _("Delete this pad?"), | ||
983 | 772 | _("All text of this pad will be irrevocably lost.")); | ||
986 | 773 | 773 | ||
987 | 774 | if (!dialog) | 774 | if (!dialog) |
988 | 775 | return; | 775 | return; |
992 | 776 | 776 | ||
993 | 777 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, 1, GTK_STOCK_DELETE, 2, NULL); | 777 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Delete"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_REJECT, NULL); |
994 | 778 | 778 | ||
995 | 779 | response = gtk_dialog_run (GTK_DIALOG (dialog)); | 779 | response = gtk_dialog_run (GTK_DIALOG (dialog)); |
996 | 780 | 780 | ||
997 | 781 | gtk_widget_destroy (dialog); | 781 | gtk_widget_destroy (dialog); |
998 | 782 | 782 | ||
1000 | 783 | if (response != 2) | 783 | if (response != GTK_RESPONSE_ACCEPT) |
1001 | 784 | return; | 784 | return; |
1002 | 785 | } | 785 | } |
1003 | 786 | 786 | ||
1005 | 787 | // These two if statements actually erase the pad on the harddisk. | 787 | /* These two if statements actually erase the pad on the harddisk. */ |
1006 | 788 | if (pad->priv->infoname) | 788 | if (pad->priv->infoname) |
1007 | 789 | fio_remove_file (pad->priv->infoname); | 789 | fio_remove_file (pad->priv->infoname); |
1008 | 790 | if (pad->priv->contentname) | 790 | if (pad->priv->contentname) |
1009 | 791 | fio_remove_file (pad->priv->contentname); | 791 | fio_remove_file (pad->priv->contentname); |
1010 | 792 | 792 | ||
1012 | 793 | // Remove the pad from the group and destroy it. | 793 | /* Remove the pad from the group and destroy it. */ |
1013 | 794 | gtk_widget_destroy (GTK_WIDGET (pad)); | 794 | gtk_widget_destroy (GTK_WIDGET (pad)); |
1014 | 795 | } | 795 | } |
1015 | 796 | 796 | ||
1016 | @@ -847,7 +847,7 @@ | |||
1017 | 847 | 847 | ||
1018 | 848 | if (xpad_pad_properties_get_follow_color_style (prop)) | 848 | if (xpad_pad_properties_get_follow_color_style (prop)) |
1019 | 849 | { | 849 | { |
1021 | 850 | // Set the colors to the global preferences colors | 850 | /* Set the colors to the global preferences colors */ |
1022 | 851 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); | 851 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); |
1023 | 852 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); | 852 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); |
1024 | 853 | 853 | ||
1025 | @@ -855,13 +855,13 @@ | |||
1026 | 855 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); | 855 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); |
1027 | 856 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color); | 856 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color); |
1028 | 857 | 857 | ||
1030 | 858 | // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. | 858 | /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */ |
1031 | 859 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color); | 859 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color); |
1032 | 860 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color); | 860 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color); |
1033 | 861 | } | 861 | } |
1034 | 862 | else | 862 | else |
1035 | 863 | { | 863 | { |
1037 | 864 | // Set the color to the individual pad properties colors | 864 | /* Set the color to the individual pad properties colors */ |
1038 | 865 | const GdkRGBA *text_color = xpad_pad_properties_get_text_color (prop); | 865 | const GdkRGBA *text_color = xpad_pad_properties_get_text_color (prop); |
1039 | 866 | const GdkRGBA *back_color = xpad_pad_properties_get_back_color (prop); | 866 | const GdkRGBA *back_color = xpad_pad_properties_get_back_color (prop); |
1040 | 867 | 867 | ||
1041 | @@ -869,7 +869,7 @@ | |||
1042 | 869 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); | 869 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); |
1043 | 870 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color); | 870 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color); |
1044 | 871 | 871 | ||
1046 | 872 | // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. | 872 | /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */ |
1047 | 873 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color); | 873 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color); |
1048 | 874 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color); | 874 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color); |
1049 | 875 | } | 875 | } |
1050 | @@ -955,8 +955,7 @@ | |||
1051 | 955 | static void | 955 | static void |
1052 | 956 | xpad_pad_text_changed (XpadPad *pad, GtkTextBuffer *buffer) | 956 | xpad_pad_text_changed (XpadPad *pad, GtkTextBuffer *buffer) |
1053 | 957 | { | 957 | { |
1056 | 958 | // A dirty way to silence the compiler for these unused variables. | 958 | /* A dirty way to silence the compiler for these unused variables. */ |
1055 | 959 | // Feel free to implement these variables in the way they are ment to be used. | ||
1057 | 960 | (void) buffer; | 959 | (void) buffer; |
1058 | 961 | 960 | ||
1059 | 962 | /* set title */ | 961 | /* set title */ |
1060 | @@ -969,7 +968,7 @@ | |||
1061 | 969 | static gboolean | 968 | static gboolean |
1062 | 970 | xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event) | 969 | xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event) |
1063 | 971 | { | 970 | { |
1065 | 972 | // safe cast from gint to guint | 971 | /* safe cast from gint to guint */ |
1066 | 973 | if (event->height >= 0) { | 972 | if (event->height >= 0) { |
1067 | 974 | pad->priv->toolbar_height = (guint) event->height; | 973 | pad->priv->toolbar_height = (guint) event->height; |
1068 | 975 | } | 974 | } |
1069 | @@ -989,7 +988,7 @@ | |||
1070 | 989 | int eWidth = event->width; | 988 | int eWidth = event->width; |
1071 | 990 | int eHeight = event->height; | 989 | int eHeight = event->height; |
1072 | 991 | 990 | ||
1074 | 992 | // safe cast from gint to guint | 991 | /* safe cast from gint to guint */ |
1075 | 993 | if (eWidth >= 0 && eHeight >=0 ) { | 992 | if (eWidth >= 0 && eHeight >=0 ) { |
1076 | 994 | if (pad->priv->width != (guint) eWidth || pad->priv->height != (guint) eHeight) | 993 | if (pad->priv->width != (guint) eWidth || pad->priv->height != (guint) eHeight) |
1077 | 995 | pad->priv->toolbar_pad_resized = TRUE; | 994 | pad->priv->toolbar_pad_resized = TRUE; |
1078 | @@ -1022,8 +1021,7 @@ | |||
1079 | 1022 | static gboolean | 1021 | static gboolean |
1080 | 1023 | xpad_pad_delete_event (XpadPad *pad, GdkEvent *event) | 1022 | xpad_pad_delete_event (XpadPad *pad, GdkEvent *event) |
1081 | 1024 | { | 1023 | { |
1084 | 1025 | // A dirty way to silence the compiler for these unused variables. | 1024 | /* A dirty way to silence the compiler for these unused variables. */ |
1083 | 1026 | // Feel free to implement these variables in the way they are ment to be used. | ||
1085 | 1027 | (void) event; | 1025 | (void) event; |
1086 | 1028 | 1026 | ||
1087 | 1029 | xpad_pad_close (pad); | 1027 | xpad_pad_close (pad); |
1088 | @@ -1042,8 +1040,7 @@ | |||
1089 | 1042 | static gboolean | 1040 | static gboolean |
1090 | 1043 | xpad_pad_text_view_button_press_event (GtkWidget *text_view, GdkEventButton *event, XpadPad *pad) | 1041 | xpad_pad_text_view_button_press_event (GtkWidget *text_view, GdkEventButton *event, XpadPad *pad) |
1091 | 1044 | { | 1042 | { |
1094 | 1045 | // A dirty way to silence the compiler for these unused variables. | 1043 | /* A dirty way to silence the compiler for these unused variables. */ |
1093 | 1046 | // Feel free to implement these variables in the way they are ment to be used. | ||
1095 | 1047 | (void) text_view; | 1044 | (void) text_view; |
1096 | 1048 | 1045 | ||
1097 | 1049 | if (event->type == GDK_BUTTON_PRESS) | 1046 | if (event->type == GDK_BUTTON_PRESS) |
1098 | @@ -1312,31 +1309,35 @@ | |||
1099 | 1312 | 1309 | ||
1100 | 1313 | if (!follow_color) | 1310 | if (!follow_color) |
1101 | 1314 | { | 1311 | { |
1104 | 1315 | // If, for some reason, one of the colors could not be retrieved | 1312 | /* |
1105 | 1316 | // (for example due to the migration to the new GdkRGBA colors), set the color to the default. | 1313 | * If, for some reason, one of the colors could not be retrieved |
1106 | 1314 | * (for example due to the migration to the new GdkRGBA colors), | ||
1107 | 1315 | * set the color to the default. | ||
1108 | 1316 | */ | ||
1109 | 1317 | if (text_color_string == NULL || background_color_string == NULL) { | 1317 | if (text_color_string == NULL || background_color_string == NULL) { |
1110 | 1318 | text = (GdkRGBA) {0, 0, 0, 1}; | 1318 | text = (GdkRGBA) {0, 0, 0, 1}; |
1111 | 1319 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 1319 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
1112 | 1320 | } | 1320 | } |
1113 | 1321 | else { | 1321 | else { |
1115 | 1322 | // If, for some reason, the parsing of the colors fail, set the color to the default. | 1322 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ |
1116 | 1323 | if (!gdk_rgba_parse (&text, text_color_string) || !gdk_rgba_parse (&back, background_color_string)) { | 1323 | if (!gdk_rgba_parse (&text, text_color_string) || !gdk_rgba_parse (&back, background_color_string)) { |
1117 | 1324 | text = (GdkRGBA) {0, 0, 0, 1}; | 1324 | text = (GdkRGBA) {0, 0, 0, 1}; |
1118 | 1325 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 1325 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
1119 | 1326 | } | 1326 | } |
1120 | 1327 | } | 1327 | } |
1121 | 1328 | 1328 | ||
1123 | 1329 | // Set the text and background color for this pad, as stated in its properties file. | 1329 | /* Set the text and background color for this pad, as stated in its properties file. */ |
1124 | 1330 | gtk_widget_override_cursor (pad->priv->textview, &text, &text); | 1330 | gtk_widget_override_cursor (pad->priv->textview, &text, &text); |
1125 | 1331 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &text); | 1331 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &text); |
1126 | 1332 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &back); | 1332 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &back); |
1127 | 1333 | 1333 | ||
1129 | 1334 | // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. | 1334 | /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */ |
1130 | 1335 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &back); | 1335 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &back); |
1131 | 1336 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &text); | 1336 | gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &text); |
1132 | 1337 | } | 1337 | } |
1133 | 1338 | 1338 | ||
1135 | 1339 | /* Find the sticky notes menu setting for this pad (which is on the global default), | 1339 | /* |
1136 | 1340 | * Find the sticky notes menu setting for this pad (which is on the global default), | ||
1137 | 1340 | * and change its setting to the setting from the info file (pad specific default). | 1341 | * and change its setting to the setting from the info file (pad specific default). |
1138 | 1341 | */ | 1342 | */ |
1139 | 1342 | if(GTK_IS_CONTAINER(pad->priv->menu)) { | 1343 | if(GTK_IS_CONTAINER(pad->priv->menu)) { |
1140 | @@ -1635,8 +1636,10 @@ | |||
1141 | 1635 | static void | 1636 | static void |
1142 | 1636 | menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check) | 1637 | menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check) |
1143 | 1637 | { | 1638 | { |
1146 | 1638 | // A dirty way to silence the compiler for these unused variables. | 1639 | /* |
1147 | 1639 | // Feel free to implement these variables in the way they are ment to be used. | 1640 | * A dirty way to silence the compiler for these unused variables. |
1148 | 1641 | * Feel free to implement these variables in the way they are ment to be used. | ||
1149 | 1642 | */ | ||
1150 | 1640 | (void) pad; | 1643 | (void) pad; |
1151 | 1641 | 1644 | ||
1152 | 1642 | xpad_settings_set_has_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1645 | xpad_settings_set_has_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); |
1153 | @@ -1645,8 +1648,10 @@ | |||
1154 | 1645 | static void | 1648 | static void |
1155 | 1646 | menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check) | 1649 | menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check) |
1156 | 1647 | { | 1650 | { |
1159 | 1648 | // A dirty way to silence the compiler for these unused variables. | 1651 | /* |
1160 | 1649 | // Feel free to implement these variables in the way they are ment to be used. | 1652 | * A dirty way to silence the compiler for these unused variables. |
1161 | 1653 | * Feel free to implement these variables in the way they are ment to be used. | ||
1162 | 1654 | */ | ||
1163 | 1650 | (void) pad; | 1655 | (void) pad; |
1164 | 1651 | 1656 | ||
1165 | 1652 | xpad_settings_set_has_scrollbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1657 | xpad_settings_set_has_scrollbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); |
1166 | @@ -1655,8 +1660,10 @@ | |||
1167 | 1655 | static void | 1660 | static void |
1168 | 1656 | menu_autohide (XpadPad *pad, GtkCheckMenuItem *check) | 1661 | menu_autohide (XpadPad *pad, GtkCheckMenuItem *check) |
1169 | 1657 | { | 1662 | { |
1172 | 1658 | // A dirty way to silence the compiler for these unused variables. | 1663 | /* |
1173 | 1659 | // Feel free to implement these variables in the way they are ment to be used. | 1664 | * A dirty way to silence the compiler for these unused variables. |
1174 | 1665 | * Feel free to implement these variables in the way they are ment to be used. | ||
1175 | 1666 | */ | ||
1176 | 1660 | (void) pad; | 1667 | (void) pad; |
1177 | 1661 | 1668 | ||
1178 | 1662 | xpad_settings_set_autohide_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1669 | xpad_settings_set_autohide_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); |
1179 | @@ -1665,8 +1672,10 @@ | |||
1180 | 1665 | static void | 1672 | static void |
1181 | 1666 | menu_decorated (XpadPad *pad, GtkCheckMenuItem *check) | 1673 | menu_decorated (XpadPad *pad, GtkCheckMenuItem *check) |
1182 | 1667 | { | 1674 | { |
1185 | 1668 | // A dirty way to silence the compiler for these unused variables. | 1675 | /* |
1186 | 1669 | // Feel free to implement these variables in the way they are ment to be used. | 1676 | * A dirty way to silence the compiler for these unused variables. |
1187 | 1677 | * Feel free to implement these variables in the way they are ment to be used. | ||
1188 | 1678 | */ | ||
1189 | 1670 | (void) pad; | 1679 | (void) pad; |
1190 | 1671 | 1680 | ||
1191 | 1672 | xpad_settings_set_has_decorations (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1681 | xpad_settings_set_has_decorations (xpad_global_settings, gtk_check_menu_item_get_active (check)); |
1192 | @@ -1686,33 +1695,24 @@ | |||
1193 | 1686 | return rv; | 1695 | return rv; |
1194 | 1687 | } | 1696 | } |
1195 | 1688 | 1697 | ||
1196 | 1698 | /* FIXME: Accelerators are working but not visible for menu items with an image (icon). */ | ||
1197 | 1689 | #define MENU_ADD(mnemonic, image, key, mask, callback) {\ | 1699 | #define MENU_ADD(mnemonic, image, key, mask, callback) {\ |
1198 | 1690 | item = gtk_image_menu_item_new_with_mnemonic (mnemonic);\ | ||
1199 | 1691 | if (image) {\ | 1700 | if (image) {\ |
1224 | 1692 | GtkWidget *imgwidget = gtk_image_new_from_stock (image, GTK_ICON_SIZE_MENU);\ | 1701 | item = gtk_menu_item_new ();\ |
1225 | 1693 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), imgwidget);\ | 1702 | GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);\ |
1226 | 1694 | }\ | 1703 | GdkRGBA bg = {0, 0, 0, 0};\ |
1227 | 1695 | g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\ | 1704 | gtk_widget_override_background_color (hbox, GTK_STATE_FLAG_NORMAL, &bg);\ |
1228 | 1696 | if (key)\ | 1705 | gtk_container_add (GTK_CONTAINER (hbox), gtk_image_new_from_icon_name (image, GTK_ICON_SIZE_MENU));\ |
1229 | 1697 | gtk_widget_add_accelerator(item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\ | 1706 | gtk_container_add (GTK_CONTAINER (hbox), gtk_label_new_with_mnemonic (mnemonic));\ |
1230 | 1698 | gtk_container_add (GTK_CONTAINER (menu), item);\ | 1707 | gtk_container_add (GTK_CONTAINER (item), hbox);\ |
1231 | 1699 | gtk_widget_show (item);\ | 1708 | }\ |
1232 | 1700 | } | 1709 | else {\ |
1233 | 1701 | 1710 | item = gtk_menu_item_new_with_mnemonic (mnemonic);\ | |
1234 | 1702 | #define MENU_ADD_STOCK(stock, callback) {\ | 1711 | }\ |
1235 | 1703 | item = gtk_image_menu_item_new_from_stock (stock, accel_group);\ | 1712 | g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\ |
1236 | 1704 | g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\ | 1713 | if (key)\ |
1237 | 1705 | gtk_container_add (GTK_CONTAINER (menu), item);\ | 1714 | gtk_widget_add_accelerator (item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\ |
1238 | 1706 | gtk_widget_show (item);\ | 1715 | gtk_container_add (GTK_CONTAINER (menu), item);\ |
1215 | 1707 | } | ||
1216 | 1708 | |||
1217 | 1709 | #define MENU_ADD_STOCK_WITH_ACCEL(stock, callback, key, mask) {\ | ||
1218 | 1710 | item = gtk_image_menu_item_new_from_stock (stock, accel_group);\ | ||
1219 | 1711 | g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\ | ||
1220 | 1712 | if (key)\ | ||
1221 | 1713 | gtk_widget_add_accelerator(item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\ | ||
1222 | 1714 | gtk_container_add (GTK_CONTAINER (menu), item);\ | ||
1223 | 1715 | gtk_widget_show (item);\ | ||
1239 | 1716 | } | 1716 | } |
1240 | 1717 | 1717 | ||
1241 | 1718 | #define MENU_ADD_CHECK(mnemonic, active, callback) {\ | 1718 | #define MENU_ADD_CHECK(mnemonic, active, callback) {\ |
1242 | @@ -1720,13 +1720,11 @@ | |||
1243 | 1720 | gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), active);\ | 1720 | gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), active);\ |
1244 | 1721 | g_signal_connect_swapped (item, "toggled", G_CALLBACK (callback), pad);\ | 1721 | g_signal_connect_swapped (item, "toggled", G_CALLBACK (callback), pad);\ |
1245 | 1722 | gtk_container_add (GTK_CONTAINER (menu), item);\ | 1722 | gtk_container_add (GTK_CONTAINER (menu), item);\ |
1246 | 1723 | gtk_widget_show (item);\ | ||
1247 | 1724 | } | 1723 | } |
1248 | 1725 | 1724 | ||
1249 | 1726 | #define MENU_ADD_SEP() {\ | 1725 | #define MENU_ADD_SEP() {\ |
1250 | 1727 | item = gtk_separator_menu_item_new ();\ | 1726 | item = gtk_separator_menu_item_new ();\ |
1251 | 1728 | gtk_container_add (GTK_CONTAINER (menu), item);\ | 1727 | gtk_container_add (GTK_CONTAINER (menu), item);\ |
1252 | 1729 | gtk_widget_show (item);\ | ||
1253 | 1730 | } | 1728 | } |
1254 | 1731 | 1729 | ||
1255 | 1732 | static GtkWidget * | 1730 | static GtkWidget * |
1256 | @@ -1736,82 +1734,65 @@ | |||
1257 | 1736 | 1734 | ||
1258 | 1737 | uppermenu = gtk_menu_new (); | 1735 | uppermenu = gtk_menu_new (); |
1259 | 1738 | gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group); | 1736 | gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group); |
1261 | 1739 | 1737 | ||
1262 | 1738 | /* Pad submenu */ | ||
1263 | 1740 | item = gtk_menu_item_new_with_mnemonic (_("_Pad")); | 1739 | item = gtk_menu_item_new_with_mnemonic (_("_Pad")); |
1264 | 1741 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1740 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
1265 | 1742 | gtk_widget_show (item); | ||
1266 | 1743 | |||
1267 | 1744 | menu = gtk_menu_new (); | 1741 | menu = gtk_menu_new (); |
1268 | 1745 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1742 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
1271 | 1746 | 1743 | MENU_ADD (_("_New"), "document-new", 0, 0, xpad_pad_spawn); | |
1270 | 1747 | MENU_ADD_STOCK (GTK_STOCK_NEW, xpad_pad_spawn); | ||
1272 | 1748 | MENU_ADD_SEP (); | 1744 | MENU_ADD_SEP (); |
1273 | 1749 | MENU_ADD_CHECK (_("Show on _All Workspaces"), pad->priv->sticky, menu_sticky); | 1745 | MENU_ADD_CHECK (_("Show on _All Workspaces"), pad->priv->sticky, menu_sticky); |
1274 | 1750 | g_object_set_data (G_OBJECT (uppermenu), "sticky", item); | 1746 | g_object_set_data (G_OBJECT (uppermenu), "sticky", item); |
1276 | 1751 | MENU_ADD_STOCK (GTK_STOCK_PROPERTIES, xpad_pad_open_properties); | 1747 | MENU_ADD (_("_Properties"), "document-properties", 0, 0, xpad_pad_open_properties); |
1277 | 1752 | MENU_ADD_SEP (); | 1748 | MENU_ADD_SEP (); |
1281 | 1753 | MENU_ADD_STOCK (GTK_STOCK_CLOSE, xpad_pad_close); | 1749 | MENU_ADD (_("_Close"), "window-close", 0, 0, xpad_pad_close); |
1282 | 1754 | MENU_ADD_STOCK (GTK_STOCK_DELETE, xpad_pad_delete); | 1750 | MENU_ADD (_("_Delete"), "edit-delete", 0, 0, xpad_pad_delete); |
1283 | 1755 | 1751 | ||
1284 | 1752 | /* Edit submenu */ | ||
1285 | 1756 | item = gtk_menu_item_new_with_mnemonic (_("_Edit")); | 1753 | item = gtk_menu_item_new_with_mnemonic (_("_Edit")); |
1286 | 1757 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1754 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
1287 | 1758 | gtk_widget_show (item); | ||
1288 | 1759 | |||
1289 | 1760 | menu = gtk_menu_new (); | 1755 | menu = gtk_menu_new (); |
1290 | 1761 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1756 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
1293 | 1762 | 1757 | MENU_ADD (_("_Undo"), "edit-undo", GDK_KEY_Z, GDK_CONTROL_MASK, menu_undo); | |
1292 | 1763 | MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_UNDO, menu_undo, GDK_KEY_Z, GDK_CONTROL_MASK); | ||
1294 | 1764 | g_object_set_data (G_OBJECT (uppermenu), "undo", item); | 1758 | g_object_set_data (G_OBJECT (uppermenu), "undo", item); |
1297 | 1765 | 1759 | MENU_ADD (_("_Redo"), "edit-redo", GDK_KEY_R, GDK_CONTROL_MASK, menu_redo); | |
1296 | 1766 | MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_REDO, menu_redo, GDK_KEY_R, GDK_CONTROL_MASK); | ||
1298 | 1767 | g_object_set_data (G_OBJECT (uppermenu), "redo", item); | 1760 | g_object_set_data (G_OBJECT (uppermenu), "redo", item); |
1299 | 1768 | |||
1300 | 1769 | MENU_ADD_SEP(); | 1761 | MENU_ADD_SEP(); |
1303 | 1770 | 1762 | MENU_ADD (_("_Paste"), "edit-paste", 0, 0, menu_paste); | |
1302 | 1771 | MENU_ADD_STOCK (GTK_STOCK_PASTE, menu_paste); | ||
1304 | 1772 | g_object_set_data (G_OBJECT (uppermenu), "paste", item); | 1763 | g_object_set_data (G_OBJECT (uppermenu), "paste", item); |
1305 | 1773 | |||
1306 | 1774 | MENU_ADD_SEP (); | 1764 | MENU_ADD_SEP (); |
1307 | 1765 | MENU_ADD (_("_Preferences"), "preferences-system", 0, 0, xpad_pad_open_preferences); | ||
1308 | 1775 | 1766 | ||
1312 | 1776 | MENU_ADD_STOCK (GTK_STOCK_PREFERENCES, xpad_pad_open_preferences); | 1767 | /* View submenu */ |
1310 | 1777 | |||
1311 | 1778 | |||
1313 | 1779 | item = gtk_menu_item_new_with_mnemonic (_("_View")); | 1768 | item = gtk_menu_item_new_with_mnemonic (_("_View")); |
1314 | 1780 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1769 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
1315 | 1781 | gtk_widget_show (item); | ||
1316 | 1782 | |||
1317 | 1783 | menu = gtk_menu_new (); | 1770 | menu = gtk_menu_new (); |
1318 | 1784 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1771 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
1319 | 1785 | |||
1320 | 1786 | MENU_ADD_CHECK (_("_Toolbar"), xpad_settings_get_has_toolbar (xpad_global_settings), menu_toolbar); | 1772 | MENU_ADD_CHECK (_("_Toolbar"), xpad_settings_get_has_toolbar (xpad_global_settings), menu_toolbar); |
1321 | 1787 | MENU_ADD_CHECK (_("_Autohide Toolbar"), xpad_settings_get_autohide_toolbar (xpad_global_settings), menu_autohide); | 1773 | MENU_ADD_CHECK (_("_Autohide Toolbar"), xpad_settings_get_autohide_toolbar (xpad_global_settings), menu_autohide); |
1322 | 1788 | gtk_widget_set_sensitive (item, xpad_settings_get_has_toolbar (xpad_global_settings)); | 1774 | gtk_widget_set_sensitive (item, xpad_settings_get_has_toolbar (xpad_global_settings)); |
1323 | 1789 | MENU_ADD_CHECK (_("_Scrollbar"), xpad_settings_get_has_scrollbar (xpad_global_settings), menu_scrollbar); | 1775 | MENU_ADD_CHECK (_("_Scrollbar"), xpad_settings_get_has_scrollbar (xpad_global_settings), menu_scrollbar); |
1324 | 1790 | MENU_ADD_CHECK (_("_Window Decorations"), xpad_settings_get_has_decorations (xpad_global_settings), menu_decorated); | 1776 | MENU_ADD_CHECK (_("_Window Decorations"), xpad_settings_get_has_decorations (xpad_global_settings), menu_decorated); |
1325 | 1791 | 1777 | ||
1327 | 1792 | 1778 | /* Notes submenu */ | |
1328 | 1793 | item = gtk_menu_item_new_with_mnemonic (_("_Notes")); | 1779 | item = gtk_menu_item_new_with_mnemonic (_("_Notes")); |
1329 | 1794 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1780 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
1330 | 1795 | gtk_widget_show (item); | ||
1331 | 1796 | |||
1332 | 1797 | menu = gtk_menu_new (); | 1781 | menu = gtk_menu_new (); |
1333 | 1798 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1782 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
1334 | 1799 | g_object_set_data (G_OBJECT (uppermenu), "notes-menu", menu); | 1783 | g_object_set_data (G_OBJECT (uppermenu), "notes-menu", menu); |
1335 | 1800 | |||
1336 | 1801 | MENU_ADD (_("_Show All"), NULL, 0, 0, menu_show_all); | 1784 | MENU_ADD (_("_Show All"), NULL, 0, 0, menu_show_all); |
1337 | 1802 | MENU_ADD (_("_Close All"), NULL, 0, 0, xpad_pad_close_all); | 1785 | MENU_ADD (_("_Close All"), NULL, 0, 0, xpad_pad_close_all); |
1341 | 1803 | 1786 | ||
1342 | 1804 | /* The rest of the notes menu will get set up in the prep function below */ | 1787 | /* Help submenu */ |
1340 | 1805 | |||
1343 | 1806 | item = gtk_menu_item_new_with_mnemonic (_("_Help")); | 1788 | item = gtk_menu_item_new_with_mnemonic (_("_Help")); |
1344 | 1807 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1789 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
1345 | 1808 | gtk_widget_show (item); | ||
1346 | 1809 | |||
1347 | 1810 | menu = gtk_menu_new (); | 1790 | menu = gtk_menu_new (); |
1348 | 1811 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1791 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
1349 | 1792 | MENU_ADD (_("_Help"), "help-browser", GDK_KEY_F1, 0, show_help); | ||
1350 | 1793 | MENU_ADD (_("_About"), "help-about", 0, 0, menu_about); | ||
1351 | 1812 | 1794 | ||
1354 | 1813 | MENU_ADD (_("_Contents"), GTK_STOCK_HELP, GDK_KEY_F1, 0, show_help); | 1795 | gtk_widget_show_all (uppermenu); |
1353 | 1814 | MENU_ADD (_("_About"), GTK_STOCK_ABOUT, 0, 0, menu_about); | ||
1355 | 1815 | 1796 | ||
1356 | 1816 | return uppermenu; | 1797 | return uppermenu; |
1357 | 1817 | } | 1798 | } |
1358 | @@ -1909,15 +1890,17 @@ | |||
1359 | 1909 | menu = gtk_menu_new (); | 1890 | menu = gtk_menu_new (); |
1360 | 1910 | gtk_menu_set_accel_group (GTK_MENU (menu), accel_group); | 1891 | gtk_menu_set_accel_group (GTK_MENU (menu), accel_group); |
1361 | 1911 | 1892 | ||
1365 | 1912 | MENU_ADD_STOCK (GTK_STOCK_CUT, menu_cut); | 1893 | MENU_ADD (_("Cu_t"), "edit-cut", 0, 0, menu_cut); |
1366 | 1913 | MENU_ADD_STOCK (GTK_STOCK_COPY, menu_copy); | 1894 | MENU_ADD (_("_Copy"), "edit-copy", 0, 0, menu_copy); |
1367 | 1914 | MENU_ADD_STOCK (GTK_STOCK_PASTE, menu_paste); | 1895 | MENU_ADD (_("_Paste"), "edit-paste", 0, 0, menu_paste); |
1368 | 1915 | g_object_set_data (G_OBJECT (menu), "paste", item); | 1896 | g_object_set_data (G_OBJECT (menu), "paste", item); |
1369 | 1916 | MENU_ADD_SEP (); | 1897 | MENU_ADD_SEP (); |
1374 | 1917 | MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_BOLD, menu_bold, GDK_KEY_b, GDK_CONTROL_MASK); | 1898 | MENU_ADD (_("_Bold"), "format-text-bold", GDK_KEY_b, GDK_CONTROL_MASK, menu_bold); |
1375 | 1918 | MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_ITALIC, menu_italic, GDK_KEY_i, GDK_CONTROL_MASK); | 1899 | MENU_ADD (_("_Italic"), "format-text-italic", GDK_KEY_i, GDK_CONTROL_MASK, menu_italic); |
1376 | 1919 | MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_UNDERLINE, menu_underline, GDK_KEY_u, GDK_CONTROL_MASK); | 1900 | MENU_ADD (_("_Underline"), "format-text-underline", GDK_KEY_u, GDK_CONTROL_MASK, menu_underline); |
1377 | 1920 | MENU_ADD_STOCK (GTK_STOCK_STRIKETHROUGH, menu_strikethrough); | 1901 | MENU_ADD (_("_Strikethrough"), "format-text-strikethrough", 0, 0, menu_strikethrough); |
1378 | 1902 | |||
1379 | 1903 | gtk_widget_show_all (menu); | ||
1380 | 1921 | 1904 | ||
1381 | 1922 | return menu; | 1905 | return menu; |
1382 | 1923 | } | 1906 | } |
1383 | @@ -1925,8 +1908,7 @@ | |||
1384 | 1925 | static void | 1908 | static void |
1385 | 1926 | menu_prep_popup_highlight (XpadPad *pad, GtkWidget *menu) | 1909 | menu_prep_popup_highlight (XpadPad *pad, GtkWidget *menu) |
1386 | 1927 | { | 1910 | { |
1389 | 1928 | // A dirty way to silence the compiler for these unused variables. | 1911 | /* A dirty way to silence the compiler for these unused variables. */ |
1388 | 1929 | // Feel free to implement these variables in the way they are ment to be used. | ||
1390 | 1930 | (void) pad; | 1912 | (void) pad; |
1391 | 1931 | 1913 | ||
1392 | 1932 | GtkWidget *item; | 1914 | GtkWidget *item; |
1393 | @@ -1942,8 +1924,7 @@ | |||
1394 | 1942 | static void | 1924 | static void |
1395 | 1943 | menu_popup (GtkWidget *menu, XpadPad *pad) | 1925 | menu_popup (GtkWidget *menu, XpadPad *pad) |
1396 | 1944 | { | 1926 | { |
1399 | 1945 | // A dirty way to silence the compiler for these unused variables. | 1927 | /* A dirty way to silence the compiler for these unused variables. */ |
1398 | 1946 | // Feel free to implement these variables in the way they are ment to be used. | ||
1400 | 1947 | (void) menu; | 1928 | (void) menu; |
1401 | 1948 | 1929 | ||
1402 | 1949 | g_signal_handlers_block_matched (pad, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) xpad_pad_leave_notify_event, NULL); | 1930 | g_signal_handlers_block_matched (pad, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) xpad_pad_leave_notify_event, NULL); |
1403 | @@ -1953,8 +1934,7 @@ | |||
1404 | 1953 | static void | 1934 | static void |
1405 | 1954 | menu_popdown (GtkWidget *menu, XpadPad *pad) | 1935 | menu_popdown (GtkWidget *menu, XpadPad *pad) |
1406 | 1955 | { | 1936 | { |
1409 | 1956 | // A dirty way to silence the compiler for these unused variables. | 1937 | /* A dirty way to silence the compiler for these unused variables. */ |
1408 | 1957 | // Feel free to implement these variables in the way they are ment to be used. | ||
1410 | 1958 | (void) menu; | 1938 | (void) menu; |
1411 | 1959 | 1939 | ||
1412 | 1960 | cairo_rectangle_int_t rect; | 1940 | cairo_rectangle_int_t rect; |
1413 | @@ -1963,14 +1943,6 @@ | |||
1414 | 1963 | * We must check if we disabled off of pad and start the timeout if so. | 1943 | * We must check if we disabled off of pad and start the timeout if so. |
1415 | 1964 | */ | 1944 | */ |
1416 | 1965 | 1945 | ||
1417 | 1966 | // TODO: The replacement GTK3 function below gives a Gdk-critical error. | ||
1418 | 1967 | // However when setting the rectangular to a fixed x and y position, I don't see any negative effects. | ||
1419 | 1968 | // What is the reason of getting the device position for making the menu dissapear? | ||
1420 | 1969 | |||
1421 | 1970 | // GTK2: gdk_window_get_pointer (gtk_widget_get_window(GTK_WIDGET(pad)), &rect.x, &rect.y, NULL); | ||
1422 | 1971 | // GTK3: gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (pad)), GDK_SOURCE_MOUSE, &rect.x, &rect.y, NULL); | ||
1423 | 1972 | // Gdk-CRITICAL **: gdk_window_get_device_position: assertion 'GDK_IS_DEVICE (device)' failed | ||
1424 | 1973 | |||
1425 | 1974 | rect.x = 10; | 1946 | rect.x = 10; |
1426 | 1975 | rect.y = 10; | 1947 | rect.y = 10; |
1427 | 1976 | rect.width = 1; | 1948 | rect.width = 1; |
1428 | @@ -1991,8 +1963,7 @@ | |||
1429 | 1991 | static void | 1963 | static void |
1430 | 1992 | xpad_pad_toolbar_popup (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad) | 1964 | xpad_pad_toolbar_popup (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad) |
1431 | 1993 | { | 1965 | { |
1434 | 1994 | // A dirty way to silence the compiler for these unused variables. | 1966 | /* A dirty way to silence the compiler for these unused variables. */ |
1433 | 1995 | // Feel free to implement these variables in the way they are ment to be used. | ||
1435 | 1996 | (void) toolbar; | 1967 | (void) toolbar; |
1436 | 1997 | 1968 | ||
1437 | 1998 | menu_popup (GTK_WIDGET (menu), pad); | 1969 | menu_popup (GTK_WIDGET (menu), pad); |
1438 | @@ -2001,8 +1972,7 @@ | |||
1439 | 2001 | static void | 1972 | static void |
1440 | 2002 | xpad_pad_toolbar_popdown (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad) | 1973 | xpad_pad_toolbar_popdown (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad) |
1441 | 2003 | { | 1974 | { |
1444 | 2004 | // A dirty way to silence the compiler for these unused variables. | 1975 | /* A dirty way to silence the compiler for these unused variables. */ |
1443 | 2005 | // Feel free to implement these variables in the way they are ment to be used. | ||
1445 | 2006 | (void) toolbar; | 1976 | (void) toolbar; |
1446 | 2007 | 1977 | ||
1447 | 2008 | menu_popdown (GTK_WIDGET (menu), pad); | 1978 | menu_popdown (GTK_WIDGET (menu), pad); |
1448 | 2009 | 1979 | ||
1449 | === modified file 'src/xpad-periodic.c' | |||
1450 | --- src/xpad-periodic.c 2013-10-31 21:17:36 +0000 | |||
1451 | +++ src/xpad-periodic.c 2014-06-07 00:27:40 +0000 | |||
1452 | @@ -91,8 +91,7 @@ | |||
1453 | 91 | ************************/ | 91 | ************************/ |
1454 | 92 | gint xppd_intercept (gpointer cdata) | 92 | gint xppd_intercept (gpointer cdata) |
1455 | 93 | { | 93 | { |
1458 | 94 | // A dirty way to silence the compiler for these unused variables. | 94 | /* A dirty way to silence the compiler for these unused variables. */ |
1457 | 95 | // Feel free to implement these variables in the way they are ment to be used. | ||
1459 | 96 | (void) cdata; | 95 | (void) cdata; |
1460 | 97 | 96 | ||
1461 | 98 | int cnt=0; | 97 | int cnt=0; |
1462 | @@ -231,8 +230,7 @@ | |||
1463 | 231 | 230 | ||
1464 | 232 | gint gprint_ignore (const char * fmt, ...) | 231 | gint gprint_ignore (const char * fmt, ...) |
1465 | 233 | { | 232 | { |
1468 | 234 | // A dirty way to silence the compiler for these unused variables. | 233 | /* A dirty way to silence the compiler for these unused variables. */ |
1467 | 235 | // Feel free to implement these variables in the way they are ment to be used. | ||
1469 | 236 | (void) fmt; | 234 | (void) fmt; |
1470 | 237 | 235 | ||
1471 | 238 | return 0; | 236 | return 0; |
1472 | 239 | 237 | ||
1473 | === modified file 'src/xpad-preferences.c' | |||
1474 | --- src/xpad-preferences.c 2013-10-31 21:17:36 +0000 | |||
1475 | +++ src/xpad-preferences.c 2014-06-07 00:27:40 +0000 | |||
1476 | @@ -24,60 +24,90 @@ | |||
1477 | 24 | #include "xpad-app.h" | 24 | #include "xpad-app.h" |
1478 | 25 | #include "xpad-preferences.h" | 25 | #include "xpad-preferences.h" |
1479 | 26 | #include "xpad-settings.h" | 26 | #include "xpad-settings.h" |
1480 | 27 | #include <sys/types.h> | ||
1481 | 28 | #include <sys/stat.h> | ||
1482 | 29 | #include <stdio.h> | ||
1483 | 30 | #include <stdlib.h> | ||
1484 | 31 | #include <unistd.h> | ||
1485 | 27 | 32 | ||
1486 | 28 | struct XpadPreferencesPrivate | 33 | struct XpadPreferencesPrivate |
1487 | 29 | { | 34 | { |
1488 | 30 | GtkWidget *fontcheck; | 35 | GtkWidget *fontcheck; |
1489 | 31 | GtkWidget *antifontcheck; | 36 | GtkWidget *antifontcheck; |
1490 | 37 | GtkWidget *fontbutton; | ||
1491 | 32 | GtkWidget *colorcheck; | 38 | GtkWidget *colorcheck; |
1492 | 33 | GtkWidget *anticolorcheck; | 39 | GtkWidget *anticolorcheck; |
1495 | 34 | GtkWidget *colorbox; | 40 | GtkWidget *colorbox; |
1496 | 35 | 41 | GtkWidget *textbutton; | |
1497 | 42 | GtkWidget *backbutton; | ||
1498 | 43 | GtkWidget *autostart_xpad; | ||
1499 | 44 | GtkWidget *autostart_wait_systray; | ||
1500 | 45 | GtkWidget *autostart_delay; | ||
1501 | 46 | GtkWidget *autostart_new_pad; | ||
1502 | 47 | GtkWidget *autostart_sticky; | ||
1503 | 48 | GtkWidget *autostart_display_pads; | ||
1504 | 49 | GtkWidget *trayconfigbox; | ||
1505 | 36 | GtkWidget *editcheck; | 50 | GtkWidget *editcheck; |
1506 | 37 | GtkWidget *stickycheck; | ||
1507 | 38 | GtkWidget *confirmcheck; | 51 | GtkWidget *confirmcheck; |
1521 | 39 | GtkWidget *trayconfigbox; | 52 | |
1522 | 40 | 53 | gulong fontcheck_handler; | |
1510 | 41 | GtkWidget *textbutton; | ||
1511 | 42 | GtkWidget *backbutton; | ||
1512 | 43 | GtkWidget *fontbutton; | ||
1513 | 44 | |||
1514 | 45 | gulong notify_edit_handler; | ||
1515 | 46 | gulong notify_sticky_handler; | ||
1516 | 47 | gulong notify_confirm_handler; | ||
1517 | 48 | gulong notify_font_handler; | ||
1518 | 49 | gulong notify_back_handler; | ||
1519 | 50 | gulong notify_text_handler; | ||
1520 | 51 | gulong notify_tray_handler; | ||
1523 | 52 | gulong font_handler; | 54 | gulong font_handler; |
1524 | 55 | gulong colorcheck_handler; | ||
1525 | 56 | gulong text_handler; | ||
1526 | 53 | gulong back_handler; | 57 | gulong back_handler; |
1530 | 54 | gulong text_handler; | 58 | gulong autostart_xpad_handler; |
1531 | 55 | gulong colorcheck_handler; | 59 | gulong autostart_wait_systray_handler; |
1532 | 56 | gulong fontcheck_handler; | 60 | gulong autostart_delay_handler; |
1533 | 61 | gulong autostart_new_pad_handler; | ||
1534 | 62 | gulong autostart_sticky_handler; | ||
1535 | 63 | gulong autostart_display_pads_handler; | ||
1536 | 64 | gulong trayclick_handler; | ||
1537 | 57 | gulong editcheck_handler; | 65 | gulong editcheck_handler; |
1538 | 58 | gulong stickycheck_handler; | ||
1539 | 59 | gulong confirmcheck_handler; | 66 | gulong confirmcheck_handler; |
1541 | 60 | gulong trayclick_handler; | 67 | |
1542 | 68 | gulong notify_font_handler; | ||
1543 | 69 | gulong notify_text_handler; | ||
1544 | 70 | gulong notify_back_handler; | ||
1545 | 71 | gulong notify_autostart_wait_systray_handler; | ||
1546 | 72 | gulong notify_autostart_delay_handler; | ||
1547 | 73 | gulong notify_autostart_new_pad_handler; | ||
1548 | 74 | gulong notify_autostart_sticky_handler; | ||
1549 | 75 | gulong notify_autostart_display_pads_handler; | ||
1550 | 76 | gulong notify_tray_handler; | ||
1551 | 77 | gulong notify_edit_handler; | ||
1552 | 78 | gulong notify_confirm_handler; | ||
1553 | 61 | }; | 79 | }; |
1554 | 62 | 80 | ||
1555 | 63 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG) | 81 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG) |
1556 | 64 | 82 | ||
1560 | 65 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); | 83 | static void change_font_check (GtkToggleButton *button, XpadPreferences *pref); |
1561 | 66 | static void change_sticky_check (GtkToggleButton *button, XpadPreferences *pref); | 84 | static void change_font_face (GtkFontButton *button, XpadPreferences *pref); |
1559 | 67 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); | ||
1562 | 68 | static void change_color_check (GtkToggleButton *button, XpadPreferences *pref); | 85 | static void change_color_check (GtkToggleButton *button, XpadPreferences *pref); |
1563 | 69 | static void change_font_check (GtkToggleButton *button, XpadPreferences *pref); | ||
1564 | 70 | static void change_text_color (GtkColorChooser *chooser, XpadPreferences *pref); | 86 | static void change_text_color (GtkColorChooser *chooser, XpadPreferences *pref); |
1565 | 71 | static void change_back_color (GtkColorChooser *chooser, XpadPreferences *pref); | 87 | static void change_back_color (GtkColorChooser *chooser, XpadPreferences *pref); |
1571 | 72 | static void change_font_face (GtkFontButton *button, XpadPreferences *pref); | 88 | static void change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref); |
1572 | 73 | static void change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref); | 89 | static void change_autostart_wait_systray (GtkToggleButton *button, XpadPreferences *pref); |
1573 | 74 | static void notify_edit (XpadPreferences *pref); | 90 | static void change_autostart_delay (GtkComboBox *box, XpadPreferences *pref); |
1574 | 75 | static void notify_sticky (XpadPreferences *pref); | 91 | static void change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref); |
1575 | 76 | static void notify_confirm (XpadPreferences *pref); | 92 | static void change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref); |
1576 | 93 | static void change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref); | ||
1577 | 94 | static void change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref); | ||
1578 | 95 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); | ||
1579 | 96 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); | ||
1580 | 97 | |||
1581 | 77 | static void notify_fontname (XpadPreferences *pref); | 98 | static void notify_fontname (XpadPreferences *pref); |
1582 | 78 | static void notify_text_color (XpadPreferences *pref); | 99 | static void notify_text_color (XpadPreferences *pref); |
1583 | 79 | static void notify_back_color (XpadPreferences *pref); | 100 | static void notify_back_color (XpadPreferences *pref); |
1584 | 101 | |||
1585 | 102 | static void notify_autostart_wait_systray (XpadPreferences *pref); | ||
1586 | 103 | static void notify_autostart_delay (XpadPreferences *pref); | ||
1587 | 104 | static void notify_autostart_new_pad (XpadPreferences *pref); | ||
1588 | 105 | static void notify_autostart_sticky (XpadPreferences *pref); | ||
1589 | 106 | static void notify_autostart_display_pads (XpadPreferences *pref); | ||
1590 | 80 | static void notify_tray_click (XpadPreferences *pref); | 107 | static void notify_tray_click (XpadPreferences *pref); |
1591 | 108 | static void notify_edit (XpadPreferences *pref); | ||
1592 | 109 | static void notify_confirm (XpadPreferences *pref); | ||
1593 | 110 | |||
1594 | 81 | static void xpad_preferences_dispose (GObject *object); | 111 | static void xpad_preferences_dispose (GObject *object); |
1595 | 82 | static void xpad_preferences_finalize (GObject *object); | 112 | static void xpad_preferences_finalize (GObject *object); |
1596 | 83 | static void xpad_preferences_response (GtkDialog *dialog, gint response); | 113 | static void xpad_preferences_response (GtkDialog *dialog, gint response); |
1597 | @@ -87,16 +117,13 @@ | |||
1598 | 87 | void | 117 | void |
1599 | 88 | xpad_preferences_open (void) | 118 | xpad_preferences_open (void) |
1600 | 89 | { | 119 | { |
1606 | 90 | if (_xpad_preferences) | 120 | if (!_xpad_preferences) |
1602 | 91 | { | ||
1603 | 92 | gtk_window_present (GTK_WINDOW (_xpad_preferences)); | ||
1604 | 93 | } | ||
1605 | 94 | else | ||
1607 | 95 | { | 121 | { |
1608 | 96 | _xpad_preferences = GTK_WIDGET (g_object_new (XPAD_TYPE_PREFERENCES, NULL)); | 122 | _xpad_preferences = GTK_WIDGET (g_object_new (XPAD_TYPE_PREFERENCES, NULL)); |
1609 | 97 | g_signal_connect_swapped (_xpad_preferences, "destroy", G_CALLBACK (g_nullify_pointer), &_xpad_preferences); | 123 | g_signal_connect_swapped (_xpad_preferences, "destroy", G_CALLBACK (g_nullify_pointer), &_xpad_preferences); |
1610 | 98 | gtk_widget_show (_xpad_preferences); | ||
1611 | 99 | } | 124 | } |
1612 | 125 | |||
1613 | 126 | gtk_window_present (GTK_WINDOW (_xpad_preferences)); | ||
1614 | 100 | } | 127 | } |
1615 | 101 | 128 | ||
1616 | 102 | static void | 129 | static void |
1617 | @@ -106,7 +133,7 @@ | |||
1618 | 106 | 133 | ||
1619 | 107 | gobject_class->dispose = xpad_preferences_dispose; | 134 | gobject_class->dispose = xpad_preferences_dispose; |
1620 | 108 | gobject_class->finalize = xpad_preferences_finalize; | 135 | gobject_class->finalize = xpad_preferences_finalize; |
1622 | 109 | } | 136 | } |
1623 | 110 | 137 | ||
1624 | 111 | static void | 138 | static void |
1625 | 112 | xpad_preferences_init (XpadPreferences *pref) | 139 | xpad_preferences_init (XpadPreferences *pref) |
1626 | @@ -115,8 +142,9 @@ | |||
1627 | 115 | const GdkRGBA *color; | 142 | const GdkRGBA *color; |
1628 | 116 | const gchar *fontname; | 143 | const gchar *fontname; |
1629 | 117 | GtkStyleContext *style; | 144 | GtkStyleContext *style; |
1632 | 118 | GtkWidget *label, *appearance_frame, *alignment, *appearance_vbox; | 145 | GtkWidget *appearance_frame, *start_frame, *tray_frame, *other_frame; |
1633 | 119 | GtkWidget *options_frame, *options_vbox, *global_vbox, *tray_config_vbox; | 146 | GtkWidget *global_vbox, *appearance_vbox, *autostart_vbox, *tray_vbox, *other_vbox; |
1634 | 147 | GtkWidget *label, *alignment; | ||
1635 | 120 | gchar *text; | 148 | gchar *text; |
1636 | 121 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | 149 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
1637 | 122 | GtkRequisition req; | 150 | GtkRequisition req; |
1638 | @@ -125,6 +153,7 @@ | |||
1639 | 125 | 153 | ||
1640 | 126 | pref->priv = xpad_preferences_get_instance_private(pref); | 154 | pref->priv = xpad_preferences_get_instance_private(pref); |
1641 | 127 | 155 | ||
1642 | 156 | /* Appearance options */ | ||
1643 | 128 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); | 157 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); |
1644 | 129 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | 158 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
1645 | 130 | "label", text, | 159 | "label", text, |
1646 | @@ -148,8 +177,8 @@ | |||
1647 | 148 | NULL)); | 177 | NULL)); |
1648 | 149 | 178 | ||
1649 | 150 | pref->priv->textbutton = gtk_color_button_new (); | 179 | pref->priv->textbutton = gtk_color_button_new (); |
1650 | 180 | pref->priv->fontbutton = gtk_font_button_new (); | ||
1651 | 151 | pref->priv->backbutton = gtk_color_button_new (); | 181 | pref->priv->backbutton = gtk_color_button_new (); |
1652 | 152 | pref->priv->fontbutton = gtk_font_button_new (); | ||
1653 | 153 | 182 | ||
1654 | 154 | pref->priv->antifontcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use font from theme")); | 183 | pref->priv->antifontcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use font from theme")); |
1655 | 155 | pref->priv->fontcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->antifontcheck), _("Use this font:")); | 184 | pref->priv->fontcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->antifontcheck), _("Use this font:")); |
1656 | @@ -164,66 +193,26 @@ | |||
1657 | 164 | pref->priv->colorbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 193 | pref->priv->colorbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); |
1658 | 165 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | 194 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); |
1659 | 166 | 195 | ||
1660 | 196 | label = gtk_label_new_with_mnemonic (_("Text:")); | ||
1661 | 197 | gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); | ||
1662 | 198 | gtk_size_group_add_widget (size_group_labels, label); | ||
1663 | 199 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); | ||
1664 | 200 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->textbutton, TRUE, TRUE, 0); | ||
1665 | 201 | g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); | ||
1666 | 202 | |||
1667 | 203 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | ||
1668 | 204 | |||
1669 | 167 | label = gtk_label_new_with_mnemonic (_("Background:")); | 205 | label = gtk_label_new_with_mnemonic (_("Background:")); |
1670 | 168 | gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); | 206 | gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); |
1671 | 169 | gtk_size_group_add_widget (size_group_labels, label); | 207 | gtk_size_group_add_widget (size_group_labels, label); |
1672 | 170 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); | 208 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1673 | 171 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->backbutton, TRUE, TRUE, 0); | 209 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->backbutton, TRUE, TRUE, 0); |
1674 | 172 | g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); | 210 | g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); |
1675 | 173 | |||
1676 | 174 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | ||
1677 | 175 | 211 | ||
1678 | 176 | label = gtk_label_new_with_mnemonic (_("Foreground:")); | ||
1679 | 177 | gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); | ||
1680 | 178 | gtk_size_group_add_widget (size_group_labels, label); | ||
1681 | 179 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); | ||
1682 | 180 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->textbutton, TRUE, TRUE, 0); | ||
1683 | 181 | g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); | ||
1684 | 182 | |||
1685 | 183 | alignment = gtk_alignment_new (1, 1, 1, 1); | ||
1686 | 184 | gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); | ||
1687 | 185 | gtk_container_add (GTK_CONTAINER (alignment), pref->priv->colorbox); | ||
1688 | 186 | |||
1689 | 187 | pref->priv->editcheck = gtk_check_button_new_with_mnemonic (_("_Edit lock")); | ||
1690 | 188 | pref->priv->stickycheck = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces")); | ||
1691 | 189 | pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion")); | ||
1692 | 190 | |||
1693 | 191 | gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE); | ||
1694 | 192 | gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE); | ||
1695 | 193 | g_signal_connect (pref, "response", G_CALLBACK (xpad_preferences_response), NULL); | ||
1696 | 194 | gtk_window_set_title (GTK_WINDOW (pref), _("Xpad Preferences")); | ||
1697 | 195 | |||
1698 | 196 | gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->textbutton), FALSE); | ||
1699 | 197 | gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->backbutton), TRUE); | ||
1700 | 198 | |||
1701 | 199 | gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->textbutton), _("Set Foreground Color")); | ||
1702 | 200 | gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->backbutton), _("Set Background Color")); | ||
1703 | 201 | gtk_font_button_set_title (GTK_FONT_BUTTON (pref->priv->fontbutton), _("Set Font")); | ||
1704 | 202 | |||
1705 | 203 | /* Set current state */ | ||
1706 | 204 | style = gtk_widget_get_style_context (GTK_WIDGET(pref)); | 212 | style = gtk_widget_get_style_context (GTK_WIDGET(pref)); |
1707 | 205 | gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color); | 213 | gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color); |
1708 | 206 | gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color); | 214 | gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color); |
1729 | 207 | 215 | ||
1710 | 208 | color = xpad_settings_get_back_color (xpad_global_settings); | ||
1711 | 209 | if (color) | ||
1712 | 210 | { | ||
1713 | 211 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
1714 | 212 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | ||
1715 | 213 | } | ||
1716 | 214 | else | ||
1717 | 215 | { | ||
1718 | 216 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
1719 | 217 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
1720 | 218 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &theme_background_color); | ||
1721 | 219 | } | ||
1722 | 220 | |||
1723 | 221 | color = xpad_settings_get_text_color (xpad_global_settings); | ||
1724 | 222 | if (color) | ||
1725 | 223 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); | ||
1726 | 224 | else | ||
1727 | 225 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color); | ||
1728 | 226 | |||
1730 | 227 | fontname = xpad_settings_get_fontname (xpad_global_settings); | 216 | fontname = xpad_settings_get_fontname (xpad_global_settings); |
1731 | 228 | if (fontname) | 217 | if (fontname) |
1732 | 229 | { | 218 | { |
1733 | @@ -241,10 +230,29 @@ | |||
1734 | 241 | gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), pango_font_description_to_string(font)); | 230 | gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), pango_font_description_to_string(font)); |
1735 | 242 | pango_font_description_free (font); | 231 | pango_font_description_free (font); |
1736 | 243 | } | 232 | } |
1741 | 244 | 233 | ||
1742 | 245 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings)); | 234 | color = xpad_settings_get_text_color (xpad_global_settings); |
1743 | 246 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->stickycheck), xpad_settings_get_sticky (xpad_global_settings)); | 235 | if (color) |
1744 | 247 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); | 236 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); |
1745 | 237 | else | ||
1746 | 238 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color); | ||
1747 | 239 | |||
1748 | 240 | color = xpad_settings_get_back_color (xpad_global_settings); | ||
1749 | 241 | if (color) | ||
1750 | 242 | { | ||
1751 | 243 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
1752 | 244 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | ||
1753 | 245 | } | ||
1754 | 246 | else | ||
1755 | 247 | { | ||
1756 | 248 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
1757 | 249 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
1758 | 250 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &theme_background_color); | ||
1759 | 251 | } | ||
1760 | 252 | |||
1761 | 253 | alignment = gtk_alignment_new (1, 1, 1, 1); | ||
1762 | 254 | gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); | ||
1763 | 255 | gtk_container_add (GTK_CONTAINER (alignment), pref->priv->colorbox); | ||
1764 | 248 | 256 | ||
1765 | 249 | vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 257 | vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); |
1766 | 250 | 258 | ||
1767 | @@ -259,7 +267,15 @@ | |||
1768 | 259 | gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); | 267 | gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); |
1769 | 260 | gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0); | 268 | gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0); |
1770 | 261 | 269 | ||
1772 | 262 | text = g_strconcat ("<b>", _("Options"), "</b>", NULL); | 270 | gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->textbutton), FALSE); |
1773 | 271 | gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->backbutton), TRUE); | ||
1774 | 272 | |||
1775 | 273 | gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->textbutton), _("Set Foreground Color")); | ||
1776 | 274 | gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->backbutton), _("Set Background Color")); | ||
1777 | 275 | gtk_font_button_set_title (GTK_FONT_BUTTON (pref->priv->fontbutton), _("Set Font")); | ||
1778 | 276 | |||
1779 | 277 | /* Start options */ | ||
1780 | 278 | text = g_strconcat ("<b>", _("Startup"), "</b>", NULL); | ||
1781 | 263 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | 279 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
1782 | 264 | "label", text, | 280 | "label", text, |
1783 | 265 | "use-markup", TRUE, | 281 | "use-markup", TRUE, |
1784 | @@ -267,72 +283,187 @@ | |||
1785 | 267 | NULL)); | 283 | NULL)); |
1786 | 268 | g_free (text); | 284 | g_free (text); |
1787 | 269 | 285 | ||
1790 | 270 | options_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 286 | autostart_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); |
1791 | 271 | gtk_box_set_homogeneous (GTK_BOX (options_vbox), FALSE); | 287 | gtk_box_set_homogeneous (GTK_BOX (autostart_vbox), FALSE); |
1792 | 272 | 288 | ||
1793 | 273 | alignment = gtk_alignment_new (1, 1, 1, 1); | 289 | alignment = gtk_alignment_new (1, 1, 1, 1); |
1794 | 274 | g_object_set (G_OBJECT (alignment), | 290 | g_object_set (G_OBJECT (alignment), |
1795 | 275 | "left-padding", 12, | 291 | "left-padding", 12, |
1796 | 276 | "top-padding", 12, | 292 | "top-padding", 12, |
1798 | 277 | "child", options_vbox, | 293 | "child", autostart_vbox, |
1799 | 278 | NULL); | 294 | NULL); |
1801 | 279 | options_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, | 295 | start_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, |
1802 | 280 | "label-widget", label, | 296 | "label-widget", label, |
1803 | 281 | "shadow-type", GTK_SHADOW_NONE, | 297 | "shadow-type", GTK_SHADOW_NONE, |
1804 | 282 | "child", alignment, | 298 | "child", alignment, |
1805 | 283 | NULL)); | 299 | NULL)); |
1816 | 284 | 300 | ||
1817 | 285 | // System tray configuration left-click behaviour | 301 | pref->priv->autostart_xpad = gtk_check_button_new_with_mnemonic (_("_Start Xpad automatically after login")); |
1818 | 286 | tray_config_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 302 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_xpad, FALSE, FALSE, 0); |
1819 | 287 | gtk_box_set_homogeneous (GTK_BOX (tray_config_vbox), FALSE); | 303 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_xpad), xpad_settings_get_autostart_xpad (xpad_global_settings)); |
1820 | 288 | pref->priv->trayconfigbox = gtk_combo_box_text_new(); | 304 | |
1821 | 289 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("Do Nothing") ); | 305 | pref->priv->autostart_wait_systray = gtk_check_button_new_with_mnemonic (_("_Wait for systray (if possible)")); |
1822 | 290 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("Toggle Show All") ); | 306 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20); |
1823 | 291 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("List of Pads") ); | 307 | gtk_box_pack_start (GTK_BOX (hbox), gtk_alignment_new (1, 1, 1, 1), FALSE, FALSE, 0); |
1824 | 292 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("New Pad") ); | 308 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->autostart_wait_systray, FALSE, FALSE, 0); |
1825 | 293 | gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->trayconfigbox ), (gint) xpad_settings_get_tray_click_handler(xpad_global_settings)); | 309 | |
1826 | 310 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings)); | ||
1827 | 311 | if (xpad_settings_get_autostart_xpad (xpad_global_settings)) | ||
1828 | 312 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE); | ||
1829 | 313 | else | ||
1830 | 314 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE); | ||
1831 | 315 | gtk_box_pack_start (GTK_BOX (autostart_vbox), hbox, FALSE, FALSE, 0); | ||
1832 | 316 | |||
1833 | 317 | pref->priv->autostart_new_pad = gtk_check_button_new_with_mnemonic (_("_Open a new empty pad")); | ||
1834 | 318 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_new_pad, FALSE, FALSE, 0); | ||
1835 | 319 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings)); | ||
1836 | 320 | |||
1837 | 321 | pref->priv->autostart_sticky = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces")); | ||
1838 | 322 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_sticky, FALSE, FALSE, 0); | ||
1839 | 323 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings)); | ||
1840 | 324 | |||
1841 | 325 | label = gtk_label_new (_("Delay in seconds")); | ||
1842 | 326 | pref->priv->autostart_delay = gtk_combo_box_text_new(); | ||
1843 | 327 | guint i; | ||
1844 | 328 | for (i=0; i<15; i++) | ||
1845 | 329 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_delay ), g_strdup_printf ("%i", i)); | ||
1846 | 330 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings)); | ||
1847 | 331 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | ||
1848 | 332 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | ||
1849 | 333 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_delay, TRUE, TRUE, 0); | ||
1850 | 334 | gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0); | ||
1851 | 335 | |||
1852 | 336 | label = gtk_label_new_with_mnemonic(_("Display pads")); | ||
1853 | 337 | pref->priv->autostart_display_pads = gtk_combo_box_text_new(); | ||
1854 | 338 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Open all pads") ); | ||
1855 | 339 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Hide all pads") ); | ||
1856 | 340 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Restore to previous state") ); | ||
1857 | 341 | gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->autostart_display_pads ), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings)); | ||
1858 | 294 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | 342 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); |
1859 | 343 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | ||
1860 | 344 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_display_pads, TRUE, TRUE, 0); | ||
1861 | 345 | gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0); | ||
1862 | 346 | |||
1863 | 347 | /* Tray options */ | ||
1864 | 348 | text = g_strconcat ("<b>", _("Tray"), "</b>", NULL); | ||
1865 | 349 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | ||
1866 | 350 | "label", text, | ||
1867 | 351 | "use-markup", TRUE, | ||
1868 | 352 | "xalign", 0.0, | ||
1869 | 353 | NULL)); | ||
1870 | 354 | g_free (text); | ||
1871 | 355 | |||
1872 | 356 | tray_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | ||
1873 | 357 | gtk_box_set_homogeneous (GTK_BOX (tray_vbox), FALSE); | ||
1874 | 358 | |||
1875 | 359 | alignment = gtk_alignment_new (1, 1, 1, 1); | ||
1876 | 360 | g_object_set (G_OBJECT (alignment), | ||
1877 | 361 | "left-padding", 12, | ||
1878 | 362 | "top-padding", 12, | ||
1879 | 363 | "child", tray_vbox, | ||
1880 | 364 | NULL); | ||
1881 | 365 | tray_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, | ||
1882 | 366 | "label-widget", label, | ||
1883 | 367 | "shadow-type", GTK_SHADOW_NONE, | ||
1884 | 368 | "child", alignment, | ||
1885 | 369 | NULL)); | ||
1886 | 370 | |||
1887 | 295 | label = gtk_label_new_with_mnemonic(_("Tray click behaviour")); | 371 | label = gtk_label_new_with_mnemonic(_("Tray click behaviour")); |
1888 | 372 | pref->priv->trayconfigbox = gtk_combo_box_text_new(); | ||
1889 | 373 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Do Nothing") ); | ||
1890 | 374 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Toggle Show All") ); | ||
1891 | 375 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("List of Pads") ); | ||
1892 | 376 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("New Pad") ); | ||
1893 | 377 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler (xpad_global_settings)); | ||
1894 | 378 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | ||
1895 | 296 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 379 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1896 | 297 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0); | 380 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0); |
1916 | 298 | gtk_box_pack_start(GTK_BOX(tray_config_vbox), hbox, TRUE, TRUE, 0); | 381 | gtk_box_pack_start(GTK_BOX(tray_vbox), hbox, TRUE, TRUE, 0); |
1917 | 299 | 382 | ||
1918 | 300 | // Edit, sticky and confirmation checkboxes | 383 | /* Other options */ |
1919 | 301 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->editcheck, FALSE, FALSE, 0); | 384 | text = g_strconcat ("<b>", _("Other"), "</b>", NULL); |
1920 | 302 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->stickycheck, FALSE, FALSE, 0); | 385 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
1921 | 303 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); | 386 | "label", text, |
1922 | 304 | g_object_set (GTK_WIDGET(options_vbox), "child", tray_config_vbox, NULL); | 387 | "use-markup", TRUE, |
1923 | 305 | 388 | "xalign", 0.0, | |
1924 | 306 | global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 389 | NULL)); |
1925 | 307 | gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE); | 390 | g_free (text); |
1926 | 308 | gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0); | 391 | |
1927 | 309 | gtk_box_pack_start (GTK_BOX (global_vbox), options_frame, FALSE, FALSE, 0); | 392 | other_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); |
1928 | 310 | gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6); | 393 | gtk_box_set_homogeneous (GTK_BOX (other_vbox), FALSE); |
1929 | 311 | 394 | ||
1930 | 312 | gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0); | 395 | alignment = gtk_alignment_new (1, 1, 1, 1); |
1931 | 313 | 396 | g_object_set (G_OBJECT (alignment), | |
1932 | 314 | pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref); | 397 | "left-padding", 12, |
1933 | 315 | pref->priv->stickycheck_handler = g_signal_connect (pref->priv->stickycheck, "toggled", G_CALLBACK (change_sticky_check), pref); | 398 | "top-padding", 12, |
1934 | 316 | pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref); | 399 | "child", other_vbox, |
1935 | 400 | NULL); | ||
1936 | 401 | other_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, | ||
1937 | 402 | "label-widget", label, | ||
1938 | 403 | "shadow-type", GTK_SHADOW_NONE, | ||
1939 | 404 | "child", alignment, | ||
1940 | 405 | NULL)); | ||
1941 | 406 | |||
1942 | 407 | pref->priv->editcheck = gtk_check_button_new_with_mnemonic (_("_Make pads read-only")); | ||
1943 | 408 | pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion")); | ||
1944 | 409 | |||
1945 | 410 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->editcheck, FALSE, FALSE, 0); | ||
1946 | 411 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); | ||
1947 | 412 | |||
1948 | 413 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings)); | ||
1949 | 414 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); | ||
1950 | 415 | |||
1951 | 416 | /* Close button and window title */ | ||
1952 | 417 | gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE); | ||
1953 | 418 | gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE); | ||
1954 | 419 | g_signal_connect (pref, "response", G_CALLBACK (xpad_preferences_response), NULL); | ||
1955 | 420 | gtk_window_set_title (GTK_WINDOW (pref), _("Xpad Preferences")); | ||
1956 | 421 | |||
1957 | 422 | /* Activate all handlers */ | ||
1958 | 423 | pref->priv->fontcheck_handler = g_signal_connect (pref->priv->fontcheck, "toggled", G_CALLBACK (change_font_check), pref); | ||
1959 | 424 | pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref); | ||
1960 | 317 | pref->priv->colorcheck_handler = g_signal_connect (pref->priv->colorcheck, "toggled", G_CALLBACK (change_color_check), pref); | 425 | pref->priv->colorcheck_handler = g_signal_connect (pref->priv->colorcheck, "toggled", G_CALLBACK (change_color_check), pref); |
1961 | 318 | pref->priv->fontcheck_handler = g_signal_connect (pref->priv->fontcheck, "toggled", G_CALLBACK (change_font_check), pref); | ||
1962 | 319 | pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref); | 426 | pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref); |
1963 | 320 | pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref); | 427 | pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref); |
1965 | 321 | pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref); | 428 | |
1966 | 429 | pref->priv->autostart_xpad_handler = g_signal_connect (pref->priv->autostart_xpad, "toggled", G_CALLBACK (change_autostart_xpad), pref); | ||
1967 | 430 | pref->priv->autostart_wait_systray_handler = g_signal_connect (pref->priv->autostart_wait_systray, "toggled", G_CALLBACK (change_autostart_wait_systray), pref); | ||
1968 | 431 | pref->priv->autostart_delay_handler = g_signal_connect(pref->priv->autostart_delay, "changed", G_CALLBACK(change_autostart_delay), pref); | ||
1969 | 432 | pref->priv->autostart_new_pad_handler = g_signal_connect (pref->priv->autostart_new_pad, "toggled", G_CALLBACK (change_autostart_new_pad), pref); | ||
1970 | 433 | pref->priv->autostart_sticky_handler = g_signal_connect (pref->priv->autostart_sticky, "toggled", G_CALLBACK (change_autostart_sticky), pref); | ||
1971 | 434 | pref->priv->autostart_display_pads_handler = g_signal_connect (pref->priv->autostart_display_pads, "changed", G_CALLBACK (change_autostart_display_pads), pref); | ||
1972 | 435 | |||
1973 | 322 | pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref); | 436 | pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref); |
1974 | 437 | pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref); | ||
1975 | 438 | pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref); | ||
1976 | 439 | |||
1977 | 323 | pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (notify_fontname), pref); | 440 | pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (notify_fontname), pref); |
1978 | 324 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref); | 441 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref); |
1979 | 325 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref); | 442 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref); |
1981 | 326 | pref->priv->notify_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::sticky", G_CALLBACK (notify_sticky), pref); | 443 | |
1982 | 444 | pref->priv->notify_autostart_wait_systray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_wait_systray", G_CALLBACK (notify_autostart_wait_systray), pref); | ||
1983 | 445 | pref->priv->notify_autostart_delay_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_delay", G_CALLBACK(notify_autostart_delay), pref); | ||
1984 | 446 | pref->priv->notify_autostart_new_pad_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_new_pad", G_CALLBACK (notify_autostart_new_pad), pref); | ||
1985 | 447 | pref->priv->notify_autostart_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_sticky", G_CALLBACK (notify_autostart_sticky), pref); | ||
1986 | 448 | pref->priv->notify_autostart_display_pads_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_display_pads", G_CALLBACK (notify_autostart_display_pads), pref); | ||
1987 | 327 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref); | 449 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref); |
1988 | 328 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); | 450 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); |
1989 | 329 | pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref); | 451 | pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref); |
1990 | 330 | 452 | ||
1991 | 331 | g_object_unref (size_group_labels); | 453 | g_object_unref (size_group_labels); |
1993 | 332 | 454 | ||
1994 | 455 | /* Make the preference dialog visible */ | ||
1995 | 456 | global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | ||
1996 | 457 | gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE); | ||
1997 | 458 | gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0); | ||
1998 | 459 | gtk_box_pack_start (GTK_BOX (global_vbox), start_frame, FALSE, FALSE, 0); | ||
1999 | 460 | gtk_box_pack_start (GTK_BOX (global_vbox), tray_frame, FALSE, FALSE, 0); | ||
2000 | 461 | gtk_box_pack_start (GTK_BOX (global_vbox), other_frame, FALSE, FALSE, 0); | ||
2001 | 462 | gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6); | ||
2002 | 463 | gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0); | ||
2003 | 333 | gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (pref))); | 464 | gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (pref))); |
2004 | 334 | 465 | ||
2006 | 335 | /* Make window not so squished */ | 466 | /* Make the preference window not so squished */ |
2007 | 336 | gtk_widget_get_preferred_size (GTK_WIDGET (pref), &req, NULL); | 467 | gtk_widget_get_preferred_size (GTK_WIDGET (pref), &req, NULL); |
2008 | 337 | g_object_set (G_OBJECT (pref), "default-width", (gint) (req.height * 0.8), NULL); | 468 | g_object_set (G_OBJECT (pref), "default-width", (gint) (req.height * 0.8), NULL); |
2009 | 338 | } | 469 | } |
2010 | @@ -361,6 +492,29 @@ | |||
2011 | 361 | } | 492 | } |
2012 | 362 | 493 | ||
2013 | 363 | static void | 494 | static void |
2014 | 495 | change_font_check (GtkToggleButton *button, XpadPreferences *pref) | ||
2015 | 496 | { | ||
2016 | 497 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | ||
2017 | 498 | |||
2018 | 499 | if (!gtk_toggle_button_get_active (button)) | ||
2019 | 500 | xpad_settings_set_fontname (xpad_global_settings, NULL); | ||
2020 | 501 | else | ||
2021 | 502 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton))); | ||
2022 | 503 | |||
2023 | 504 | gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button)); | ||
2024 | 505 | |||
2025 | 506 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); | ||
2026 | 507 | } | ||
2027 | 508 | |||
2028 | 509 | static void | ||
2029 | 510 | change_font_face (GtkFontButton *button, XpadPreferences *pref) | ||
2030 | 511 | { | ||
2031 | 512 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | ||
2032 | 513 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (button)); | ||
2033 | 514 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); | ||
2034 | 515 | } | ||
2035 | 516 | |||
2036 | 517 | static void | ||
2037 | 364 | change_color_check (GtkToggleButton *button, XpadPreferences *pref) | 518 | change_color_check (GtkToggleButton *button, XpadPreferences *pref) |
2038 | 365 | { | 519 | { |
2039 | 366 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); | 520 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); |
2040 | @@ -387,18 +541,196 @@ | |||
2041 | 387 | } | 541 | } |
2042 | 388 | 542 | ||
2043 | 389 | static void | 543 | static void |
2056 | 390 | change_font_check (GtkToggleButton *button, XpadPreferences *pref) | 544 | change_text_color (GtkColorChooser *chooser, XpadPreferences *pref) |
2057 | 391 | { | 545 | { |
2058 | 392 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | 546 | GdkRGBA color = {0, 0, 0, 0}; |
2059 | 393 | 547 | gtk_color_chooser_get_rgba (chooser, &color); | |
2060 | 394 | if (!gtk_toggle_button_get_active (button)) | 548 | |
2061 | 395 | xpad_settings_set_fontname (xpad_global_settings, NULL); | 549 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); |
2062 | 396 | else | 550 | xpad_settings_set_text_color (xpad_global_settings, &color); |
2063 | 397 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton))); | 551 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); |
2064 | 398 | 552 | } | |
2065 | 399 | gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button)); | 553 | |
2066 | 400 | 554 | static void | |
2067 | 401 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); | 555 | change_back_color (GtkColorChooser *chooser, XpadPreferences *pref) |
2068 | 556 | { | ||
2069 | 557 | GdkRGBA color = {0, 0, 0, 0}; | ||
2070 | 558 | gtk_color_chooser_get_rgba (chooser, &color); | ||
2071 | 559 | |||
2072 | 560 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); | ||
2073 | 561 | xpad_settings_set_back_color (xpad_global_settings, &color); | ||
2074 | 562 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); | ||
2075 | 563 | } | ||
2076 | 564 | |||
2077 | 565 | static void | ||
2078 | 566 | change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref) | ||
2079 | 567 | { | ||
2080 | 568 | gboolean autostart; | ||
2081 | 569 | |||
2082 | 570 | autostart = gtk_toggle_button_get_active (button); | ||
2083 | 571 | |||
2084 | 572 | if (autostart) { | ||
2085 | 573 | /* Copy the xpad.desktop file to the autostart folder and enable/disable the wait for systray preference */ | ||
2086 | 574 | gboolean success; | ||
2087 | 575 | char *source_filename; | ||
2088 | 576 | char *destination_directory; | ||
2089 | 577 | GFile *source, *destination; | ||
2090 | 578 | GError *error = NULL; | ||
2091 | 579 | |||
2092 | 580 | /* Find the base directory where the application is installed /usr or /usr/local, to find the correct xpad.desktop file. */ | ||
2093 | 581 | char *szTmp = g_strdup_printf ("/proc/%d/exe", getpid()); | ||
2094 | 582 | enum { BUFFERSIZE = 1024 }; | ||
2095 | 583 | char buf[BUFFERSIZE]; | ||
2096 | 584 | ssize_t len = readlink(szTmp, buf, sizeof(buf)-1); | ||
2097 | 585 | |||
2098 | 586 | if (len == -1) { | ||
2099 | 587 | gchar *errtext; | ||
2100 | 588 | errtext = g_strdup_printf (_("Could not find the directory where Xpad is installed\n%s"), error->message); | ||
2101 | 589 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext); | ||
2102 | 590 | g_free (errtext); | ||
2103 | 591 | |||
2104 | 592 | gtk_toggle_button_set_active (button, FALSE); | ||
2105 | 593 | } | ||
2106 | 594 | else { | ||
2107 | 595 | char basedir[len-8]; | ||
2108 | 596 | guint i; | ||
2109 | 597 | for (i=0; i<len-8; i++) | ||
2110 | 598 | basedir[i] = buf[i]; | ||
2111 | 599 | basedir[len-9] = '\0'; | ||
2112 | 600 | |||
2113 | 601 | source_filename = g_strdup_printf ("%s/share/applications/xpad.desktop", basedir); | ||
2114 | 602 | destination_directory = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
2115 | 603 | |||
2116 | 604 | source = g_file_new_for_path (source_filename); | ||
2117 | 605 | destination = g_file_new_for_path (destination_directory); | ||
2118 | 606 | success = g_file_copy (source, destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); | ||
2119 | 607 | |||
2120 | 608 | if (!success) { | ||
2121 | 609 | gchar *errtext; | ||
2122 | 610 | errtext = g_strdup_printf (_("Could not copy %s to %s\n%s"), source_filename, destination_directory, error->message); | ||
2123 | 611 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext); | ||
2124 | 612 | g_free (errtext); | ||
2125 | 613 | |||
2126 | 614 | gtk_toggle_button_set_active (button, FALSE); | ||
2127 | 615 | } | ||
2128 | 616 | else { | ||
2129 | 617 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2130 | 618 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE); | ||
2131 | 619 | change_autostart_wait_systray (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), pref); | ||
2132 | 620 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2133 | 621 | } | ||
2134 | 622 | } | ||
2135 | 623 | } | ||
2136 | 624 | else { | ||
2137 | 625 | /* Remove the xpad.desktop file from the autostart folder and enable/disable the wait for systray preference */ | ||
2138 | 626 | gboolean success; | ||
2139 | 627 | char *filename; | ||
2140 | 628 | GFile *file; | ||
2141 | 629 | GError *error = NULL; | ||
2142 | 630 | |||
2143 | 631 | filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
2144 | 632 | file = g_file_new_for_path (filename); | ||
2145 | 633 | success = g_file_delete (file, NULL, &error); | ||
2146 | 634 | |||
2147 | 635 | if (!success) { | ||
2148 | 636 | gchar *errtext; | ||
2149 | 637 | errtext = g_strdup_printf (_("Could not delete %s\n%s"), filename, error->message); | ||
2150 | 638 | xpad_app_error (NULL, _("Error disabling Xpad autostart"), errtext); | ||
2151 | 639 | g_free (errtext); | ||
2152 | 640 | |||
2153 | 641 | gtk_toggle_button_set_active (button, TRUE); | ||
2154 | 642 | } | ||
2155 | 643 | else { | ||
2156 | 644 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2157 | 645 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE); | ||
2158 | 646 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2159 | 647 | } | ||
2160 | 648 | } | ||
2161 | 649 | } | ||
2162 | 650 | |||
2163 | 651 | static void | ||
2164 | 652 | change_autostart_wait_systray (GtkToggleButton *button, XpadPreferences *pref) | ||
2165 | 653 | { | ||
2166 | 654 | GKeyFile *keyfile; | ||
2167 | 655 | GKeyFileFlags flags; | ||
2168 | 656 | GError *error = NULL; | ||
2169 | 657 | char *filename; | ||
2170 | 658 | gboolean wait_systray; | ||
2171 | 659 | |||
2172 | 660 | wait_systray = gtk_toggle_button_get_active (button); | ||
2173 | 661 | |||
2174 | 662 | /* Create a new GKeyFile object and a bitwise list of flags. */ | ||
2175 | 663 | keyfile = g_key_file_new (); | ||
2176 | 664 | filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
2177 | 665 | flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; | ||
2178 | 666 | error = NULL; | ||
2179 | 667 | |||
2180 | 668 | /* Load the GKeyFile from xpad.desktop or show an error message. */ | ||
2181 | 669 | if (!g_key_file_load_from_file (keyfile, filename, flags, &error)) { | ||
2182 | 670 | gchar *errtext; | ||
2183 | 671 | errtext = g_strdup_printf (_("Could not load %s\n%s"), filename, error->message); | ||
2184 | 672 | xpad_app_error (NULL, _("Error changing wait for systray setting"), errtext); | ||
2185 | 673 | g_free (errtext); | ||
2186 | 674 | |||
2187 | 675 | gtk_toggle_button_set_active (button, !wait_systray); | ||
2188 | 676 | return; | ||
2189 | 677 | } | ||
2190 | 678 | |||
2191 | 679 | g_key_file_set_boolean (keyfile, "Desktop Entry", "X-LXQt-Need-Tray", wait_systray); | ||
2192 | 680 | |||
2193 | 681 | if (!g_key_file_save_to_file (keyfile, filename, &error)) { | ||
2194 | 682 | gchar *errtext; | ||
2195 | 683 | errtext = g_strdup_printf (_("Could not save %s\n%s"), filename, error->message); | ||
2196 | 684 | xpad_app_error (NULL, _("Error changing wait for systray setting"), errtext); | ||
2197 | 685 | g_free (errtext); | ||
2198 | 686 | |||
2199 | 687 | gtk_toggle_button_set_active (button, !wait_systray); | ||
2200 | 688 | return; | ||
2201 | 689 | } | ||
2202 | 690 | |||
2203 | 691 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2204 | 692 | xpad_settings_set_autostart_wait_systray (xpad_global_settings, wait_systray); | ||
2205 | 693 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
2206 | 694 | } | ||
2207 | 695 | |||
2208 | 696 | static void | ||
2209 | 697 | change_autostart_delay (GtkComboBox *box, XpadPreferences *pref) | ||
2210 | 698 | { | ||
2211 | 699 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
2212 | 700 | xpad_settings_set_autostart_delay (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | ||
2213 | 701 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
2214 | 702 | } | ||
2215 | 703 | |||
2216 | 704 | static void | ||
2217 | 705 | change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref) | ||
2218 | 706 | { | ||
2219 | 707 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); | ||
2220 | 708 | xpad_settings_set_autostart_new_pad (xpad_global_settings, gtk_toggle_button_get_active (button)); | ||
2221 | 709 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); | ||
2222 | 710 | } | ||
2223 | 711 | |||
2224 | 712 | static void | ||
2225 | 713 | change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref) | ||
2226 | 714 | { | ||
2227 | 715 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); | ||
2228 | 716 | xpad_settings_set_autostart_sticky (xpad_global_settings, gtk_toggle_button_get_active (button)); | ||
2229 | 717 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); | ||
2230 | 718 | } | ||
2231 | 719 | |||
2232 | 720 | static void | ||
2233 | 721 | change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref) | ||
2234 | 722 | { | ||
2235 | 723 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); | ||
2236 | 724 | xpad_settings_set_autostart_display_pads (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | ||
2237 | 725 | g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); | ||
2238 | 726 | } | ||
2239 | 727 | |||
2240 | 728 | static void | ||
2241 | 729 | change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref) | ||
2242 | 730 | { | ||
2243 | 731 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_handler); | ||
2244 | 732 | xpad_settings_set_tray_click_handler (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | ||
2245 | 733 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_tray_handler); | ||
2246 | 402 | } | 734 | } |
2247 | 403 | 735 | ||
2248 | 404 | static void | 736 | static void |
2249 | @@ -410,14 +742,6 @@ | |||
2250 | 410 | } | 742 | } |
2251 | 411 | 743 | ||
2252 | 412 | static void | 744 | static void |
2253 | 413 | change_sticky_check (GtkToggleButton *button, XpadPreferences *pref) | ||
2254 | 414 | { | ||
2255 | 415 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_sticky_handler); | ||
2256 | 416 | xpad_settings_set_sticky (xpad_global_settings, gtk_toggle_button_get_active (button)); | ||
2257 | 417 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_sticky_handler); | ||
2258 | 418 | } | ||
2259 | 419 | |||
2260 | 420 | static void | ||
2261 | 421 | change_confirm_check (GtkToggleButton *button, XpadPreferences *pref) | 745 | change_confirm_check (GtkToggleButton *button, XpadPreferences *pref) |
2262 | 422 | { | 746 | { |
2263 | 423 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler); | 747 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler); |
2264 | @@ -426,93 +750,6 @@ | |||
2265 | 426 | } | 750 | } |
2266 | 427 | 751 | ||
2267 | 428 | static void | 752 | static void |
2268 | 429 | change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref) | ||
2269 | 430 | { | ||
2270 | 431 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_handler); | ||
2271 | 432 | xpad_settings_set_tray_click_handler(xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | ||
2272 | 433 | g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_tray_handler); | ||
2273 | 434 | } | ||
2274 | 435 | |||
2275 | 436 | static void | ||
2276 | 437 | change_text_color (GtkColorChooser *chooser, XpadPreferences *pref) | ||
2277 | 438 | { | ||
2278 | 439 | GdkRGBA color = {0, 0, 0, 0}; | ||
2279 | 440 | gtk_color_chooser_get_rgba (chooser, &color); | ||
2280 | 441 | |||
2281 | 442 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); | ||
2282 | 443 | xpad_settings_set_text_color (xpad_global_settings, &color); | ||
2283 | 444 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); | ||
2284 | 445 | } | ||
2285 | 446 | |||
2286 | 447 | static void | ||
2287 | 448 | change_back_color (GtkColorChooser *chooser, XpadPreferences *pref) | ||
2288 | 449 | { | ||
2289 | 450 | GdkRGBA color = {0, 0, 0, 0}; | ||
2290 | 451 | gtk_color_chooser_get_rgba (chooser, &color); | ||
2291 | 452 | |||
2292 | 453 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); | ||
2293 | 454 | xpad_settings_set_back_color (xpad_global_settings, &color); | ||
2294 | 455 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); | ||
2295 | 456 | } | ||
2296 | 457 | |||
2297 | 458 | static void | ||
2298 | 459 | change_font_face (GtkFontButton *button, XpadPreferences *pref) | ||
2299 | 460 | { | ||
2300 | 461 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | ||
2301 | 462 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (button)); | ||
2302 | 463 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); | ||
2303 | 464 | } | ||
2304 | 465 | |||
2305 | 466 | static void | ||
2306 | 467 | notify_back_color (XpadPreferences *pref) | ||
2307 | 468 | { | ||
2308 | 469 | const GdkRGBA *color = xpad_settings_get_back_color (xpad_global_settings); | ||
2309 | 470 | |||
2310 | 471 | g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler); | ||
2311 | 472 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2312 | 473 | |||
2313 | 474 | if (color) | ||
2314 | 475 | { | ||
2315 | 476 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
2316 | 477 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | ||
2317 | 478 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | ||
2318 | 479 | } | ||
2319 | 480 | else | ||
2320 | 481 | { | ||
2321 | 482 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
2322 | 483 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
2323 | 484 | } | ||
2324 | 485 | |||
2325 | 486 | g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2326 | 487 | g_signal_handler_unblock (pref->priv->backbutton, pref->priv->back_handler); | ||
2327 | 488 | } | ||
2328 | 489 | |||
2329 | 490 | static void | ||
2330 | 491 | notify_text_color (XpadPreferences *pref) | ||
2331 | 492 | { | ||
2332 | 493 | const GdkRGBA *color = xpad_settings_get_text_color (xpad_global_settings); | ||
2333 | 494 | |||
2334 | 495 | g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler); | ||
2335 | 496 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2336 | 497 | |||
2337 | 498 | if (color) | ||
2338 | 499 | { | ||
2339 | 500 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
2340 | 501 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | ||
2341 | 502 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); | ||
2342 | 503 | |||
2343 | 504 | } | ||
2344 | 505 | else | ||
2345 | 506 | { | ||
2346 | 507 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
2347 | 508 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
2348 | 509 | } | ||
2349 | 510 | |||
2350 | 511 | g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2351 | 512 | g_signal_handler_unblock (pref->priv->textbutton, pref->priv->text_handler); | ||
2352 | 513 | } | ||
2353 | 514 | |||
2354 | 515 | static void | ||
2355 | 516 | notify_fontname (XpadPreferences *pref) | 753 | notify_fontname (XpadPreferences *pref) |
2356 | 517 | { | 754 | { |
2357 | 518 | const gchar *fontname = xpad_settings_get_fontname (xpad_global_settings); | 755 | const gchar *fontname = xpad_settings_get_fontname (xpad_global_settings); |
2358 | @@ -537,6 +774,103 @@ | |||
2359 | 537 | } | 774 | } |
2360 | 538 | 775 | ||
2361 | 539 | static void | 776 | static void |
2362 | 777 | notify_text_color (XpadPreferences *pref) | ||
2363 | 778 | { | ||
2364 | 779 | const GdkRGBA *color = xpad_settings_get_text_color (xpad_global_settings); | ||
2365 | 780 | |||
2366 | 781 | g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler); | ||
2367 | 782 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2368 | 783 | |||
2369 | 784 | if (color) | ||
2370 | 785 | { | ||
2371 | 786 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
2372 | 787 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | ||
2373 | 788 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); | ||
2374 | 789 | |||
2375 | 790 | } | ||
2376 | 791 | else | ||
2377 | 792 | { | ||
2378 | 793 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
2379 | 794 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
2380 | 795 | } | ||
2381 | 796 | |||
2382 | 797 | g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2383 | 798 | g_signal_handler_unblock (pref->priv->textbutton, pref->priv->text_handler); | ||
2384 | 799 | } | ||
2385 | 800 | |||
2386 | 801 | static void | ||
2387 | 802 | notify_back_color (XpadPreferences *pref) | ||
2388 | 803 | { | ||
2389 | 804 | const GdkRGBA *color = xpad_settings_get_back_color (xpad_global_settings); | ||
2390 | 805 | |||
2391 | 806 | g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler); | ||
2392 | 807 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2393 | 808 | |||
2394 | 809 | if (color) | ||
2395 | 810 | { | ||
2396 | 811 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | ||
2397 | 812 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | ||
2398 | 813 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | ||
2399 | 814 | } | ||
2400 | 815 | else | ||
2401 | 816 | { | ||
2402 | 817 | gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); | ||
2403 | 818 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); | ||
2404 | 819 | } | ||
2405 | 820 | |||
2406 | 821 | g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler); | ||
2407 | 822 | g_signal_handler_unblock (pref->priv->backbutton, pref->priv->back_handler); | ||
2408 | 823 | } | ||
2409 | 824 | |||
2410 | 825 | static void | ||
2411 | 826 | notify_autostart_wait_systray (XpadPreferences *pref) | ||
2412 | 827 | { | ||
2413 | 828 | g_signal_handler_block (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | ||
2414 | 829 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings)); | ||
2415 | 830 | g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | ||
2416 | 831 | } | ||
2417 | 832 | |||
2418 | 833 | static void | ||
2419 | 834 | notify_autostart_delay (XpadPreferences *pref) | ||
2420 | 835 | { | ||
2421 | 836 | g_signal_handler_block (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
2422 | 837 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings)); | ||
2423 | 838 | g_signal_handler_unblock (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
2424 | 839 | } | ||
2425 | 840 | |||
2426 | 841 | static void | ||
2427 | 842 | notify_autostart_new_pad (XpadPreferences *pref) | ||
2428 | 843 | { | ||
2429 | 844 | g_signal_handler_block (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); | ||
2430 | 845 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings)); | ||
2431 | 846 | g_signal_handler_unblock (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); | ||
2432 | 847 | } | ||
2433 | 848 | |||
2434 | 849 | static void | ||
2435 | 850 | notify_autostart_sticky (XpadPreferences *pref) | ||
2436 | 851 | { | ||
2437 | 852 | g_signal_handler_block (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); | ||
2438 | 853 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings)); | ||
2439 | 854 | g_signal_handler_unblock (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); | ||
2440 | 855 | } | ||
2441 | 856 | |||
2442 | 857 | static void | ||
2443 | 858 | notify_autostart_display_pads (XpadPreferences *pref) | ||
2444 | 859 | { | ||
2445 | 860 | g_signal_handler_block (pref->priv->autostart_display_pads, pref->priv->autostart_display_pads_handler); | ||
2446 | 861 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_display_pads), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings)); | ||
2447 | 862 | g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | ||
2448 | 863 | } | ||
2449 | 864 | |||
2450 | 865 | static void | ||
2451 | 866 | notify_tray_click (XpadPreferences *pref) | ||
2452 | 867 | { | ||
2453 | 868 | g_signal_handler_block (pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
2454 | 869 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler(xpad_global_settings)); | ||
2455 | 870 | g_signal_handler_unblock (pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
2456 | 871 | } | ||
2457 | 872 | |||
2458 | 873 | static void | ||
2459 | 540 | notify_edit (XpadPreferences *pref) | 874 | notify_edit (XpadPreferences *pref) |
2460 | 541 | { | 875 | { |
2461 | 542 | g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler); | 876 | g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler); |
2462 | @@ -545,26 +879,9 @@ | |||
2463 | 545 | } | 879 | } |
2464 | 546 | 880 | ||
2465 | 547 | static void | 881 | static void |
2466 | 548 | notify_sticky (XpadPreferences *pref) | ||
2467 | 549 | { | ||
2468 | 550 | g_signal_handler_block (pref->priv->stickycheck, pref->priv->stickycheck_handler); | ||
2469 | 551 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->stickycheck), xpad_settings_get_sticky (xpad_global_settings)); | ||
2470 | 552 | g_signal_handler_unblock (pref->priv->stickycheck, pref->priv->stickycheck_handler); | ||
2471 | 553 | } | ||
2472 | 554 | |||
2473 | 555 | static void | ||
2474 | 556 | notify_confirm (XpadPreferences *pref) | 882 | notify_confirm (XpadPreferences *pref) |
2475 | 557 | { | 883 | { |
2476 | 558 | g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); | 884 | g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); |
2477 | 559 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); | 885 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); |
2478 | 560 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); | 886 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); |
2479 | 561 | } | 887 | } |
2480 | 562 | |||
2481 | 563 | static void | ||
2482 | 564 | notify_tray_click(XpadPreferences *pref) | ||
2483 | 565 | { | ||
2484 | 566 | g_signal_handler_block(pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
2485 | 567 | gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->trayconfigbox), (gint) xpad_settings_get_tray_click_handler(xpad_global_settings)); | ||
2486 | 568 | g_signal_handler_unblock(pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
2487 | 569 | } | ||
2488 | 570 | |||
2489 | 571 | 888 | ||
2490 | === modified file 'src/xpad-session-manager.c' | |||
2491 | --- src/xpad-session-manager.c 2013-10-31 21:17:36 +0000 | |||
2492 | +++ src/xpad-session-manager.c 2014-06-07 00:27:40 +0000 | |||
2493 | @@ -59,8 +59,7 @@ | |||
2494 | 59 | xpad_session_manager_cycle (GIOChannel *source, GIOCondition condition, | 59 | xpad_session_manager_cycle (GIOChannel *source, GIOCondition condition, |
2495 | 60 | gpointer data) | 60 | gpointer data) |
2496 | 61 | { | 61 | { |
2499 | 62 | // A dirty way to silence the compiler for these unused variables. | 62 | /* A dirty way to silence the compiler for these unused variables. */ |
2498 | 63 | // Feel free to implement these variables in the way they are ment to be used. | ||
2500 | 64 | (void) source; | 63 | (void) source; |
2501 | 65 | (void) condition; | 64 | (void) condition; |
2502 | 66 | (void) data; | 65 | (void) data; |
2503 | @@ -110,8 +109,7 @@ | |||
2504 | 110 | static void | 109 | static void |
2505 | 111 | xpad_session_manager_start_interact_callback (SmcConn smc_conn, SmPointer client_data) | 110 | xpad_session_manager_start_interact_callback (SmcConn smc_conn, SmPointer client_data) |
2506 | 112 | { | 111 | { |
2509 | 113 | // A dirty way to silence the compiler for these unused variables. | 112 | /* A dirty way to silence the compiler for these unused variables. */ |
2508 | 114 | // Feel free to implement these variables in the way they are ment to be used. | ||
2510 | 115 | (void) client_data; | 113 | (void) client_data; |
2511 | 116 | (void) smc_conn; | 114 | (void) smc_conn; |
2512 | 117 | 115 | ||
2513 | @@ -176,8 +174,7 @@ | |||
2514 | 176 | xpad_session_manager_ice_connection_watch (IceConn ice_conn, | 174 | xpad_session_manager_ice_connection_watch (IceConn ice_conn, |
2515 | 177 | IcePointer client_data, Bool opening, IcePointer *watch_data) | 175 | IcePointer client_data, Bool opening, IcePointer *watch_data) |
2516 | 178 | { | 176 | { |
2519 | 179 | // A dirty way to silence the compiler for these unused variables. | 177 | /* A dirty way to silence the compiler for these unused variables. */ |
2518 | 180 | // Feel free to implement these variables in the way they are ment to be used. | ||
2520 | 181 | (void) client_data; | 178 | (void) client_data; |
2521 | 182 | (void) watch_data; | 179 | (void) watch_data; |
2522 | 183 | 180 | ||
2523 | @@ -210,7 +207,7 @@ | |||
2524 | 210 | }; | 207 | }; |
2525 | 211 | SmProp *props[G_N_ELEMENTS (prop)]; | 208 | SmProp *props[G_N_ELEMENTS (prop)]; |
2526 | 212 | struct passwd *pw; | 209 | struct passwd *pw; |
2528 | 213 | uint i; | 210 | guint i; |
2529 | 214 | gchar *pid_str; | 211 | gchar *pid_str; |
2530 | 215 | gchar *command = g_strdup (xpad_app_get_program_path ()); | 212 | gchar *command = g_strdup (xpad_app_get_program_path ()); |
2531 | 216 | size_t string_length = 0; | 213 | size_t string_length = 0; |
2532 | @@ -227,7 +224,7 @@ | |||
2533 | 227 | 224 | ||
2534 | 228 | pw = getpwuid (getuid ()); | 225 | pw = getpwuid (getuid ()); |
2535 | 229 | 226 | ||
2537 | 230 | // While setting all the properties, safe casts are being used. | 227 | /* While setting all the properties, safe casts are being used. */ |
2538 | 231 | vals.user->value = pw ? pw->pw_name : ""; | 228 | vals.user->value = pw ? pw->pw_name : ""; |
2539 | 232 | string_length = strlen (vals.user->value); | 229 | string_length = strlen (vals.user->value); |
2540 | 233 | if (string_length <= INT_MAX) | 230 | if (string_length <= INT_MAX) |
2541 | @@ -354,8 +351,7 @@ | |||
2542 | 354 | static void | 351 | static void |
2543 | 355 | xpad_session_manager_save_global (Bool fast) | 352 | xpad_session_manager_save_global (Bool fast) |
2544 | 356 | { | 353 | { |
2547 | 357 | // A dirty way to silence the compiler for these unused variables. | 354 | /* A dirty way to silence the compiler for these unused variables. */ |
2546 | 358 | // Feel free to implement these variables in the way they are ment to be used. | ||
2548 | 359 | (void) fast; | 355 | (void) fast; |
2549 | 360 | 356 | ||
2550 | 361 | /* No need to do anything. Currently, all xpad pads are always current with | 357 | /* No need to do anything. Currently, all xpad pads are always current with |
2551 | @@ -365,12 +361,10 @@ | |||
2552 | 365 | static void | 361 | static void |
2553 | 366 | xpad_session_manager_save_local (Bool fast) | 362 | xpad_session_manager_save_local (Bool fast) |
2554 | 367 | { | 363 | { |
2557 | 368 | // A dirty way to silence the compiler for these unused variables. | 364 | /* A dirty way to silence the compiler for these unused variables. */ |
2556 | 369 | // Feel free to implement these variables in the way they are ment to be used. | ||
2558 | 370 | (void) fast; | 365 | (void) fast; |
2559 | 371 | 366 | ||
2560 | 372 | /* should also save cursor positions and open accessory windows */ | 367 | /* should also save cursor positions and open accessory windows */ |
2561 | 373 | |||
2562 | 374 | if (set_props) | 368 | if (set_props) |
2563 | 375 | { | 369 | { |
2564 | 376 | xpad_session_manager_set_properties (); | 370 | xpad_session_manager_set_properties (); |
2565 | @@ -383,8 +377,7 @@ | |||
2566 | 383 | int save_type, Bool shutdown, int interact_style, | 377 | int save_type, Bool shutdown, int interact_style, |
2567 | 384 | Bool fast) | 378 | Bool fast) |
2568 | 385 | { | 379 | { |
2571 | 386 | // A dirty way to silence the compiler for these unused variables. | 380 | /* A dirty way to silence the compiler for these unused variables. */ |
2570 | 387 | // Feel free to implement these variables in the way they are ment to be used. | ||
2572 | 388 | (void) client_data; | 381 | (void) client_data; |
2573 | 389 | 382 | ||
2574 | 390 | RETURN_IF_BAD_CONN (smc_conn); | 383 | RETURN_IF_BAD_CONN (smc_conn); |
2575 | @@ -417,8 +410,7 @@ | |||
2576 | 417 | static void | 410 | static void |
2577 | 418 | xpad_session_manager_die (SmcConn smc_conn, SmPointer client_data) | 411 | xpad_session_manager_die (SmcConn smc_conn, SmPointer client_data) |
2578 | 419 | { | 412 | { |
2581 | 420 | // A dirty way to silence the compiler for these unused variables. | 413 | /* A dirty way to silence the compiler for these unused variables. */ |
2580 | 421 | // Feel free to implement these variables in the way they are ment to be used. | ||
2582 | 422 | (void) client_data; | 414 | (void) client_data; |
2583 | 423 | 415 | ||
2584 | 424 | RETURN_IF_BAD_CONN (smc_conn); | 416 | RETURN_IF_BAD_CONN (smc_conn); |
2585 | @@ -436,8 +428,7 @@ | |||
2586 | 436 | static void | 428 | static void |
2587 | 437 | xpad_session_manager_shutdown_cancelled (SmcConn smc_conn, SmPointer client_data) | 429 | xpad_session_manager_shutdown_cancelled (SmcConn smc_conn, SmPointer client_data) |
2588 | 438 | { | 430 | { |
2591 | 439 | // A dirty way to silence the compiler for these unused variables. | 431 | /* A dirty way to silence the compiler for these unused variables. */ |
2590 | 440 | // Feel free to implement these variables in the way they are ment to be used. | ||
2592 | 441 | (void) client_data; | 432 | (void) client_data; |
2593 | 442 | 433 | ||
2594 | 443 | RETURN_IF_BAD_CONN (smc_conn); | 434 | RETURN_IF_BAD_CONN (smc_conn); |
2595 | @@ -454,8 +445,7 @@ | |||
2596 | 454 | static void | 445 | static void |
2597 | 455 | xpad_session_manager_save_complete (SmcConn smc_conn, SmPointer client_data) | 446 | xpad_session_manager_save_complete (SmcConn smc_conn, SmPointer client_data) |
2598 | 456 | { | 447 | { |
2601 | 457 | // A dirty way to silence the compiler for these unused variables. | 448 | /* A dirty way to silence the compiler for these unused variables. */ |
2600 | 458 | // Feel free to implement these variables in the way they are ment to be used. | ||
2602 | 459 | (void) client_data; | 449 | (void) client_data; |
2603 | 460 | 450 | ||
2604 | 461 | RETURN_IF_BAD_CONN (smc_conn); | 451 | RETURN_IF_BAD_CONN (smc_conn); |
2605 | 462 | 452 | ||
2606 | === modified file 'src/xpad-settings.c' | |||
2607 | --- src/xpad-settings.c 2013-10-31 22:11:55 +0000 | |||
2608 | +++ src/xpad-settings.c 2014-06-07 00:27:40 +0000 | |||
2609 | @@ -30,7 +30,6 @@ | |||
2610 | 30 | gboolean has_decorations; | 30 | gboolean has_decorations; |
2611 | 31 | gboolean confirm_destroy; | 31 | gboolean confirm_destroy; |
2612 | 32 | gboolean edit_lock; | 32 | gboolean edit_lock; |
2613 | 33 | gboolean sticky; | ||
2614 | 34 | guint tray_click_configuration; | 33 | guint tray_click_configuration; |
2615 | 35 | gboolean has_toolbar; | 34 | gboolean has_toolbar; |
2616 | 36 | gboolean autohide_toolbar; | 35 | gboolean autohide_toolbar; |
2617 | @@ -39,6 +38,11 @@ | |||
2618 | 39 | GdkRGBA *text; | 38 | GdkRGBA *text; |
2619 | 40 | gchar *fontname; | 39 | gchar *fontname; |
2620 | 41 | GSList *toolbar_buttons; | 40 | GSList *toolbar_buttons; |
2621 | 41 | gboolean autostart_wait_systray; | ||
2622 | 42 | guint autostart_delay; | ||
2623 | 43 | gboolean autostart_new_pad; | ||
2624 | 44 | gboolean autostart_sticky; | ||
2625 | 45 | guint autostart_display_pads; | ||
2626 | 42 | }; | 46 | }; |
2627 | 43 | 47 | ||
2628 | 44 | G_DEFINE_TYPE_WITH_PRIVATE(XpadSettings, xpad_settings, G_TYPE_OBJECT) | 48 | G_DEFINE_TYPE_WITH_PRIVATE(XpadSettings, xpad_settings, G_TYPE_OBJECT) |
2629 | @@ -58,7 +62,6 @@ | |||
2630 | 58 | PROP_HEIGHT, | 62 | PROP_HEIGHT, |
2631 | 59 | PROP_HAS_DECORATIONS, | 63 | PROP_HAS_DECORATIONS, |
2632 | 60 | PROP_CONFIRM_DESTROY, | 64 | PROP_CONFIRM_DESTROY, |
2633 | 61 | PROP_STICKY, | ||
2634 | 62 | PROP_EDIT_LOCK, | 65 | PROP_EDIT_LOCK, |
2635 | 63 | PROP_TRAY_CLICK_CONFIGURATION, | 66 | PROP_TRAY_CLICK_CONFIGURATION, |
2636 | 64 | PROP_HAS_TOOLBAR, | 67 | PROP_HAS_TOOLBAR, |
2637 | @@ -67,6 +70,11 @@ | |||
2638 | 67 | PROP_BACK_COLOR, | 70 | PROP_BACK_COLOR, |
2639 | 68 | PROP_TEXT_COLOR, | 71 | PROP_TEXT_COLOR, |
2640 | 69 | PROP_FONTNAME, | 72 | PROP_FONTNAME, |
2641 | 73 | PROP_AUTOSTART_WAIT_SYSTRAY, | ||
2642 | 74 | PROP_AUTOSTART_DELAY, | ||
2643 | 75 | PROP_AUTOSTART_NEW_PAD, | ||
2644 | 76 | PROP_AUTOSTART_STICKY, | ||
2645 | 77 | PROP_AUTOSTART_DISPLAY_PADS, | ||
2646 | 70 | LAST_PROP | 78 | LAST_PROP |
2647 | 71 | }; | 79 | }; |
2648 | 72 | 80 | ||
2649 | @@ -95,8 +103,6 @@ | |||
2650 | 95 | gobject_class->set_property = xpad_settings_set_property; | 103 | gobject_class->set_property = xpad_settings_set_property; |
2651 | 96 | gobject_class->get_property = xpad_settings_get_property; | 104 | gobject_class->get_property = xpad_settings_get_property; |
2652 | 97 | 105 | ||
2653 | 98 | /* Properties */ | ||
2654 | 99 | |||
2655 | 100 | g_object_class_install_property (gobject_class, | 106 | g_object_class_install_property (gobject_class, |
2656 | 101 | PROP_WIDTH, | 107 | PROP_WIDTH, |
2657 | 102 | g_param_spec_uint ("width", | 108 | g_param_spec_uint ("width", |
2658 | @@ -134,14 +140,6 @@ | |||
2659 | 134 | G_PARAM_READWRITE)); | 140 | G_PARAM_READWRITE)); |
2660 | 135 | 141 | ||
2661 | 136 | g_object_class_install_property (gobject_class, | 142 | g_object_class_install_property (gobject_class, |
2662 | 137 | PROP_STICKY, | ||
2663 | 138 | g_param_spec_boolean ("sticky", | ||
2664 | 139 | "Default Stickiness", | ||
2665 | 140 | "Whether pads are sticky on creation", | ||
2666 | 141 | FALSE, | ||
2667 | 142 | G_PARAM_READWRITE)); | ||
2668 | 143 | |||
2669 | 144 | g_object_class_install_property (gobject_class, | ||
2670 | 145 | PROP_EDIT_LOCK, | 143 | PROP_EDIT_LOCK, |
2671 | 146 | g_param_spec_boolean ("edit_lock", | 144 | g_param_spec_boolean ("edit_lock", |
2672 | 147 | "Edit Lock", | 145 | "Edit Lock", |
2673 | @@ -204,9 +202,51 @@ | |||
2674 | 204 | "Default color of pad background", | 202 | "Default color of pad background", |
2675 | 205 | GDK_TYPE_RGBA, | 203 | GDK_TYPE_RGBA, |
2676 | 206 | G_PARAM_READWRITE)); | 204 | G_PARAM_READWRITE)); |
2680 | 207 | 205 | ||
2681 | 208 | /* Signals */ | 206 | g_object_class_install_property (gobject_class, |
2682 | 209 | 207 | PROP_AUTOSTART_WAIT_SYSTRAY, | |
2683 | 208 | g_param_spec_boolean ("autostart_wait_systray", | ||
2684 | 209 | "Autostart Xpad wait for systray", | ||
2685 | 210 | "Whether to wait for the systray before starting xpad automatically after login", | ||
2686 | 211 | FALSE, | ||
2687 | 212 | G_PARAM_READWRITE)); | ||
2688 | 213 | |||
2689 | 214 | g_object_class_install_property (gobject_class, | ||
2690 | 215 | PROP_AUTOSTART_DISPLAY_PADS, | ||
2691 | 216 | g_param_spec_uint ("autostart_delay", | ||
2692 | 217 | "Delay autostart of Xpad", | ||
2693 | 218 | "How many seconds will Xpad wait before continuing startup", | ||
2694 | 219 | 0, | ||
2695 | 220 | G_MAXUINT, | ||
2696 | 221 | 2, | ||
2697 | 222 | G_PARAM_READWRITE)); | ||
2698 | 223 | |||
2699 | 224 | g_object_class_install_property (gobject_class, | ||
2700 | 225 | PROP_AUTOSTART_NEW_PAD, | ||
2701 | 226 | g_param_spec_boolean ("autostart_new_pad", | ||
2702 | 227 | "Autostart a new pad", | ||
2703 | 228 | "Whether to create a new pad on startup", | ||
2704 | 229 | FALSE, | ||
2705 | 230 | G_PARAM_READWRITE)); | ||
2706 | 231 | |||
2707 | 232 | g_object_class_install_property (gobject_class, | ||
2708 | 233 | PROP_AUTOSTART_STICKY, | ||
2709 | 234 | g_param_spec_boolean ("autostart_sticky", | ||
2710 | 235 | "Default Stickiness", | ||
2711 | 236 | "Whether pads are sticky on creation", | ||
2712 | 237 | FALSE, | ||
2713 | 238 | G_PARAM_READWRITE)); | ||
2714 | 239 | |||
2715 | 240 | g_object_class_install_property (gobject_class, | ||
2716 | 241 | PROP_AUTOSTART_DISPLAY_PADS, | ||
2717 | 242 | g_param_spec_uint ("autostart_display_pads", | ||
2718 | 243 | "Autostart display pads", | ||
2719 | 244 | "How to show the different pads when Xpad is started", | ||
2720 | 245 | 0, | ||
2721 | 246 | G_MAXUINT, | ||
2722 | 247 | 2, | ||
2723 | 248 | G_PARAM_READWRITE)); | ||
2724 | 249 | |||
2725 | 210 | signals[CHANGE_BUTTONS] = | 250 | signals[CHANGE_BUTTONS] = |
2726 | 211 | g_signal_new ("change_buttons", | 251 | g_signal_new ("change_buttons", |
2727 | 212 | G_OBJECT_CLASS_TYPE (gobject_class), | 252 | G_OBJECT_CLASS_TYPE (gobject_class), |
2728 | @@ -229,7 +269,7 @@ | |||
2729 | 229 | settings->priv->height = 200; | 269 | settings->priv->height = 200; |
2730 | 230 | settings->priv->has_decorations = TRUE; | 270 | settings->priv->has_decorations = TRUE; |
2731 | 231 | settings->priv->confirm_destroy = TRUE; | 271 | settings->priv->confirm_destroy = TRUE; |
2733 | 232 | settings->priv->sticky = FALSE; | 272 | settings->priv->autostart_sticky = FALSE; |
2734 | 233 | settings->priv->edit_lock = FALSE; | 273 | settings->priv->edit_lock = FALSE; |
2735 | 234 | settings->priv->tray_click_configuration = 0; | 274 | settings->priv->tray_click_configuration = 0; |
2736 | 235 | settings->priv->fontname = NULL; | 275 | settings->priv->fontname = NULL; |
2737 | @@ -240,8 +280,19 @@ | |||
2738 | 240 | settings->priv->toolbar_buttons = NULL; | 280 | settings->priv->toolbar_buttons = NULL; |
2739 | 241 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New")); | 281 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New")); |
2740 | 242 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete")); | 282 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete")); |
2743 | 243 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Close")); | 283 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Separator")); |
2744 | 244 | 284 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Cut")); | |
2745 | 285 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Copy")); | ||
2746 | 286 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Paste")); | ||
2747 | 287 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Separator")); | ||
2748 | 288 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Undo")); | ||
2749 | 289 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Redo")); | ||
2750 | 290 | |||
2751 | 291 | settings->priv->autostart_wait_systray = TRUE; | ||
2752 | 292 | settings->priv->autostart_delay = 0; | ||
2753 | 293 | settings->priv->autostart_new_pad = FALSE; | ||
2754 | 294 | settings->priv->autostart_display_pads = 2; | ||
2755 | 295 | |||
2756 | 245 | load_from_file (settings, DEFAULTS_FILENAME); | 296 | load_from_file (settings, DEFAULTS_FILENAME); |
2757 | 246 | } | 297 | } |
2758 | 247 | 298 | ||
2759 | @@ -264,7 +315,7 @@ | |||
2760 | 264 | gdk_rgba_free (settings->priv->back); | 315 | gdk_rgba_free (settings->priv->back); |
2761 | 265 | 316 | ||
2762 | 266 | g_free (settings->priv->fontname); | 317 | g_free (settings->priv->fontname); |
2764 | 267 | 318 | ||
2765 | 268 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); | 319 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); |
2766 | 269 | } | 320 | } |
2767 | 270 | 321 | ||
2768 | @@ -385,23 +436,6 @@ | |||
2769 | 385 | return settings->priv->has_toolbar; | 436 | return settings->priv->has_toolbar; |
2770 | 386 | } | 437 | } |
2771 | 387 | 438 | ||
2772 | 388 | void xpad_settings_set_sticky (XpadSettings *settings, gboolean sticky) | ||
2773 | 389 | { | ||
2774 | 390 | if (settings->priv->sticky == sticky) | ||
2775 | 391 | return; | ||
2776 | 392 | |||
2777 | 393 | settings->priv->sticky = sticky; | ||
2778 | 394 | |||
2779 | 395 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2780 | 396 | |||
2781 | 397 | g_object_notify (G_OBJECT (settings), "sticky"); | ||
2782 | 398 | } | ||
2783 | 399 | |||
2784 | 400 | gboolean xpad_settings_get_sticky (XpadSettings *settings) | ||
2785 | 401 | { | ||
2786 | 402 | return settings->priv->sticky; | ||
2787 | 403 | } | ||
2788 | 404 | |||
2789 | 405 | void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide) | 439 | void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide) |
2790 | 406 | { | 440 | { |
2791 | 407 | if (settings->priv->autohide_toolbar == hide) | 441 | if (settings->priv->autohide_toolbar == hide) |
2792 | @@ -445,72 +479,12 @@ | |||
2793 | 445 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 479 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
2794 | 446 | } | 480 | } |
2795 | 447 | 481 | ||
2796 | 448 | /* Unused function of previous developer | ||
2797 | 449 | gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new) | ||
2798 | 450 | { | ||
2799 | 451 | GSList *element = NULL; | ||
2800 | 452 | gpointer data; | ||
2801 | 453 | |||
2802 | 454 | if (button == new) { | ||
2803 | 455 | g_slist_free(element); | ||
2804 | 456 | return FALSE; | ||
2805 | 457 | } | ||
2806 | 458 | |||
2807 | 459 | if (new >= (gint) g_slist_length (settings->priv->toolbar_buttons) || 0 > new ) { | ||
2808 | 460 | g_slist_free(element); | ||
2809 | 461 | return FALSE; | ||
2810 | 462 | } | ||
2811 | 463 | |||
2812 | 464 | element = g_slist_nth (settings->priv->toolbar_buttons, button); | ||
2813 | 465 | if (!element) { | ||
2814 | 466 | g_slist_free(element); | ||
2815 | 467 | return FALSE; | ||
2816 | 468 | } | ||
2817 | 469 | |||
2818 | 470 | data = element->data; | ||
2819 | 471 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); | ||
2820 | 472 | settings->priv->toolbar_buttons = g_slist_insert (settings->priv->toolbar_buttons, data, new); | ||
2821 | 473 | |||
2822 | 474 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2823 | 475 | |||
2824 | 476 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | ||
2825 | 477 | |||
2826 | 478 | g_slist_free(element); | ||
2827 | 479 | |||
2828 | 480 | return TRUE; | ||
2829 | 481 | } | ||
2830 | 482 | */ | ||
2831 | 483 | |||
2832 | 484 | static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element) | 482 | static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element) |
2833 | 485 | { | 483 | { |
2834 | 486 | g_free (element->data); | 484 | g_free (element->data); |
2835 | 487 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); | 485 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); |
2836 | 488 | } | 486 | } |
2837 | 489 | 487 | ||
2838 | 490 | /* Unused function of previous developer | ||
2839 | 491 | gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button) | ||
2840 | 492 | { | ||
2841 | 493 | GSList *element; | ||
2842 | 494 | |||
2843 | 495 | element = g_slist_nth (settings->priv->toolbar_buttons, button); | ||
2844 | 496 | |||
2845 | 497 | if (!element) { | ||
2846 | 498 | g_slist_free(element); | ||
2847 | 499 | return FALSE; | ||
2848 | 500 | } | ||
2849 | 501 | |||
2850 | 502 | xpad_settings_remove_toolbar_list_element (settings, element); | ||
2851 | 503 | |||
2852 | 504 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2853 | 505 | |||
2854 | 506 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | ||
2855 | 507 | |||
2856 | 508 | g_slist_free(element); | ||
2857 | 509 | |||
2858 | 510 | return TRUE; | ||
2859 | 511 | } | ||
2860 | 512 | */ | ||
2861 | 513 | |||
2862 | 514 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings) | 488 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings) |
2863 | 515 | { | 489 | { |
2864 | 516 | if (settings->priv->toolbar_buttons == NULL) | 490 | if (settings->priv->toolbar_buttons == NULL) |
2865 | @@ -548,12 +522,10 @@ | |||
2866 | 548 | 522 | ||
2867 | 549 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 523 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
2868 | 550 | 524 | ||
2869 | 551 | g_slist_free(element); | ||
2870 | 552 | |||
2871 | 553 | return TRUE; | 525 | return TRUE; |
2872 | 554 | } | 526 | } |
2873 | 555 | 527 | ||
2875 | 556 | G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings) | 528 | const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings) |
2876 | 557 | { | 529 | { |
2877 | 558 | return settings->priv->toolbar_buttons; | 530 | return settings->priv->toolbar_buttons; |
2878 | 559 | } | 531 | } |
2879 | @@ -573,7 +545,7 @@ | |||
2880 | 573 | g_object_notify (G_OBJECT (settings), "back_color"); | 545 | g_object_notify (G_OBJECT (settings), "back_color"); |
2881 | 574 | } | 546 | } |
2882 | 575 | 547 | ||
2884 | 576 | G_CONST_RETURN GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings) | 548 | const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings) |
2885 | 577 | { | 549 | { |
2886 | 578 | return settings->priv->back; | 550 | return settings->priv->back; |
2887 | 579 | } | 551 | } |
2888 | @@ -593,7 +565,7 @@ | |||
2889 | 593 | g_object_notify (G_OBJECT (settings), "text_color"); | 565 | g_object_notify (G_OBJECT (settings), "text_color"); |
2890 | 594 | } | 566 | } |
2891 | 595 | 567 | ||
2893 | 596 | G_CONST_RETURN GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings) | 568 | const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings) |
2894 | 597 | { | 569 | { |
2895 | 598 | return settings->priv->text; | 570 | return settings->priv->text; |
2896 | 599 | } | 571 | } |
2897 | @@ -608,11 +580,93 @@ | |||
2898 | 608 | g_object_notify (G_OBJECT (settings), "fontname"); | 580 | g_object_notify (G_OBJECT (settings), "fontname"); |
2899 | 609 | } | 581 | } |
2900 | 610 | 582 | ||
2902 | 611 | G_CONST_RETURN gchar *xpad_settings_get_fontname (XpadSettings *settings) | 583 | const gchar *xpad_settings_get_fontname (XpadSettings *settings) |
2903 | 612 | { | 584 | { |
2904 | 613 | return settings->priv->fontname; | 585 | return settings->priv->fontname; |
2905 | 614 | } | 586 | } |
2906 | 615 | 587 | ||
2907 | 588 | gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings) | ||
2908 | 589 | { | ||
2909 | 590 | /* The existence of the xpad.desktop file in the autostart folder defines if autostarting is enabled or disabled */ | ||
2910 | 591 | const gchar *filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
2911 | 592 | return g_file_test (filename, G_FILE_TEST_EXISTS); | ||
2912 | 593 | } | ||
2913 | 594 | |||
2914 | 595 | void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf) | ||
2915 | 596 | { | ||
2916 | 597 | if (settings->priv->autostart_wait_systray == conf) | ||
2917 | 598 | return; | ||
2918 | 599 | |||
2919 | 600 | settings->priv->autostart_wait_systray = conf; | ||
2920 | 601 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2921 | 602 | g_object_notify (G_OBJECT (settings), "autostart_wait_systray"); | ||
2922 | 603 | } | ||
2923 | 604 | |||
2924 | 605 | gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings) | ||
2925 | 606 | { | ||
2926 | 607 | return settings->priv->autostart_wait_systray; | ||
2927 | 608 | } | ||
2928 | 609 | |||
2929 | 610 | void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf) | ||
2930 | 611 | { | ||
2931 | 612 | if (settings->priv->autostart_delay == conf) | ||
2932 | 613 | return; | ||
2933 | 614 | |||
2934 | 615 | settings->priv->autostart_delay = conf; | ||
2935 | 616 | save_to_file(settings, DEFAULTS_FILENAME); | ||
2936 | 617 | g_object_notify (G_OBJECT (settings), "autostart_delay"); | ||
2937 | 618 | } | ||
2938 | 619 | |||
2939 | 620 | guint xpad_settings_get_autostart_delay (XpadSettings *settings) | ||
2940 | 621 | { | ||
2941 | 622 | return settings->priv->autostart_delay; | ||
2942 | 623 | } | ||
2943 | 624 | |||
2944 | 625 | void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf) | ||
2945 | 626 | { | ||
2946 | 627 | if (settings->priv->autostart_new_pad == conf) | ||
2947 | 628 | return; | ||
2948 | 629 | |||
2949 | 630 | settings->priv->autostart_new_pad = conf; | ||
2950 | 631 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2951 | 632 | g_object_notify (G_OBJECT (settings), "autostart_new_pad"); | ||
2952 | 633 | } | ||
2953 | 634 | |||
2954 | 635 | gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings) | ||
2955 | 636 | { | ||
2956 | 637 | return settings->priv->autostart_new_pad; | ||
2957 | 638 | } | ||
2958 | 639 | |||
2959 | 640 | void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean sticky) | ||
2960 | 641 | { | ||
2961 | 642 | if (settings->priv->autostart_sticky == sticky) | ||
2962 | 643 | return; | ||
2963 | 644 | |||
2964 | 645 | settings->priv->autostart_sticky = sticky; | ||
2965 | 646 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2966 | 647 | g_object_notify (G_OBJECT (settings), "autostart_sticky"); | ||
2967 | 648 | } | ||
2968 | 649 | |||
2969 | 650 | gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings) | ||
2970 | 651 | { | ||
2971 | 652 | return settings->priv->autostart_sticky; | ||
2972 | 653 | } | ||
2973 | 654 | |||
2974 | 655 | void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf) | ||
2975 | 656 | { | ||
2976 | 657 | if (settings->priv->autostart_display_pads == conf) | ||
2977 | 658 | return; | ||
2978 | 659 | |||
2979 | 660 | settings->priv->autostart_display_pads = conf; | ||
2980 | 661 | save_to_file (settings, DEFAULTS_FILENAME); | ||
2981 | 662 | g_object_notify (G_OBJECT (settings), "autostart_display_pads"); | ||
2982 | 663 | } | ||
2983 | 664 | |||
2984 | 665 | guint xpad_settings_get_autostart_display_pads(XpadSettings *settings) | ||
2985 | 666 | { | ||
2986 | 667 | return settings->priv->autostart_display_pads; | ||
2987 | 668 | } | ||
2988 | 669 | |||
2989 | 616 | static void | 670 | static void |
2990 | 617 | xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | 671 | xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
2991 | 618 | { | 672 | { |
2992 | @@ -638,10 +692,6 @@ | |||
2993 | 638 | xpad_settings_set_confirm_destroy (settings, g_value_get_boolean (value)); | 692 | xpad_settings_set_confirm_destroy (settings, g_value_get_boolean (value)); |
2994 | 639 | break; | 693 | break; |
2995 | 640 | 694 | ||
2996 | 641 | case PROP_STICKY: | ||
2997 | 642 | xpad_settings_set_sticky (settings, g_value_get_boolean (value)); | ||
2998 | 643 | break; | ||
2999 | 644 | |||
3000 | 645 | case PROP_EDIT_LOCK: | 695 | case PROP_EDIT_LOCK: |
3001 | 646 | xpad_settings_set_edit_lock (settings, g_value_get_boolean (value)); | 696 | xpad_settings_set_edit_lock (settings, g_value_get_boolean (value)); |
3002 | 647 | break; | 697 | break; |
3003 | @@ -673,7 +723,27 @@ | |||
3004 | 673 | case PROP_FONTNAME: | 723 | case PROP_FONTNAME: |
3005 | 674 | xpad_settings_set_fontname (settings, g_value_get_string (value)); | 724 | xpad_settings_set_fontname (settings, g_value_get_string (value)); |
3006 | 675 | break; | 725 | break; |
3007 | 726 | |||
3008 | 727 | case PROP_AUTOSTART_WAIT_SYSTRAY: | ||
3009 | 728 | xpad_settings_set_autostart_wait_systray (settings, g_value_get_boolean (value)); | ||
3010 | 729 | break; | ||
3011 | 730 | |||
3012 | 731 | case PROP_AUTOSTART_DELAY: | ||
3013 | 732 | xpad_settings_set_autostart_delay (settings, g_value_get_uint (value)); | ||
3014 | 733 | break; | ||
3015 | 734 | |||
3016 | 735 | case PROP_AUTOSTART_NEW_PAD: | ||
3017 | 736 | xpad_settings_set_autostart_new_pad (settings, g_value_get_boolean (value)); | ||
3018 | 737 | break; | ||
3019 | 738 | |||
3020 | 739 | case PROP_AUTOSTART_STICKY: | ||
3021 | 740 | xpad_settings_set_autostart_sticky (settings, g_value_get_boolean (value)); | ||
3022 | 741 | break; | ||
3023 | 676 | 742 | ||
3024 | 743 | case PROP_AUTOSTART_DISPLAY_PADS: | ||
3025 | 744 | xpad_settings_set_autostart_display_pads (settings, g_value_get_uint (value)); | ||
3026 | 745 | break; | ||
3027 | 746 | |||
3028 | 677 | default: | 747 | default: |
3029 | 678 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 748 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
3030 | 679 | break; | 749 | break; |
3031 | @@ -705,10 +775,6 @@ | |||
3032 | 705 | g_value_set_boolean (value, xpad_settings_get_confirm_destroy (settings)); | 775 | g_value_set_boolean (value, xpad_settings_get_confirm_destroy (settings)); |
3033 | 706 | break; | 776 | break; |
3034 | 707 | 777 | ||
3035 | 708 | case PROP_STICKY: | ||
3036 | 709 | g_value_set_boolean (value, xpad_settings_get_sticky (settings)); | ||
3037 | 710 | break; | ||
3038 | 711 | |||
3039 | 712 | case PROP_EDIT_LOCK: | 778 | case PROP_EDIT_LOCK: |
3040 | 713 | g_value_set_boolean (value, xpad_settings_get_edit_lock (settings)); | 779 | g_value_set_boolean (value, xpad_settings_get_edit_lock (settings)); |
3041 | 714 | break; | 780 | break; |
3042 | @@ -736,6 +802,26 @@ | |||
3043 | 736 | case PROP_FONTNAME: | 802 | case PROP_FONTNAME: |
3044 | 737 | g_value_set_string (value, xpad_settings_get_fontname (settings)); | 803 | g_value_set_string (value, xpad_settings_get_fontname (settings)); |
3045 | 738 | break; | 804 | break; |
3046 | 805 | |||
3047 | 806 | case PROP_AUTOSTART_WAIT_SYSTRAY: | ||
3048 | 807 | g_value_set_boolean (value, xpad_settings_get_autostart_wait_systray (settings)); | ||
3049 | 808 | break; | ||
3050 | 809 | |||
3051 | 810 | case PROP_AUTOSTART_DELAY: | ||
3052 | 811 | g_value_set_uint (value, xpad_settings_get_autostart_delay (settings)); | ||
3053 | 812 | break; | ||
3054 | 813 | |||
3055 | 814 | case PROP_AUTOSTART_NEW_PAD: | ||
3056 | 815 | g_value_set_boolean (value, xpad_settings_get_autostart_new_pad (settings)); | ||
3057 | 816 | break; | ||
3058 | 817 | |||
3059 | 818 | case PROP_AUTOSTART_STICKY: | ||
3060 | 819 | g_value_set_boolean (value, xpad_settings_get_autostart_sticky (settings)); | ||
3061 | 820 | break; | ||
3062 | 821 | |||
3063 | 822 | case PROP_AUTOSTART_DISPLAY_PADS: | ||
3064 | 823 | g_value_set_uint (value, xpad_settings_get_autostart_display_pads (settings)); | ||
3065 | 824 | break; | ||
3066 | 739 | 825 | ||
3067 | 740 | default: | 826 | default: |
3068 | 741 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 827 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
3069 | @@ -766,14 +852,14 @@ | |||
3070 | 766 | if (settings->priv->back) | 852 | if (settings->priv->back) |
3071 | 767 | back = *settings->priv->back; | 853 | back = *settings->priv->back; |
3072 | 768 | 854 | ||
3074 | 769 | // get all the values from the default-style text file in the forms of booleans, ints or strings. | 855 | /* get all the values from the default-style text file in the forms of booleans, ints or strings. */ |
3075 | 770 | if (fio_get_values_from_file (filename, | 856 | if (fio_get_values_from_file (filename, |
3076 | 771 | "b|decorations", &settings->priv->has_decorations, | 857 | "b|decorations", &settings->priv->has_decorations, |
3077 | 772 | "u|height", &settings->priv->height, | 858 | "u|height", &settings->priv->height, |
3078 | 773 | "u|width", &settings->priv->width, | 859 | "u|width", &settings->priv->width, |
3079 | 774 | "b|confirm_destroy", &settings->priv->confirm_destroy, | 860 | "b|confirm_destroy", &settings->priv->confirm_destroy, |
3080 | 775 | "b|edit_lock", &settings->priv->edit_lock, | 861 | "b|edit_lock", &settings->priv->edit_lock, |
3082 | 776 | "b|sticky_on_start", &settings->priv->sticky, | 862 | "b|sticky_on_start", &settings->priv->autostart_sticky, |
3083 | 777 | "u|tray_click_configuration", &settings->priv->tray_click_configuration, | 863 | "u|tray_click_configuration", &settings->priv->tray_click_configuration, |
3084 | 778 | "s|back", &background_color_string, | 864 | "s|back", &background_color_string, |
3085 | 779 | "b|use_back", &use_back, | 865 | "b|use_back", &use_back, |
3086 | @@ -784,6 +870,10 @@ | |||
3087 | 784 | "b|auto_hide_toolbar", &settings->priv->autohide_toolbar, | 870 | "b|auto_hide_toolbar", &settings->priv->autohide_toolbar, |
3088 | 785 | "b|scrollbar", &settings->priv->has_scrollbar, | 871 | "b|scrollbar", &settings->priv->has_scrollbar, |
3089 | 786 | "s|buttons", &buttons, | 872 | "s|buttons", &buttons, |
3090 | 873 | "b|autostart_wait_systray", &settings->priv->autostart_wait_systray, | ||
3091 | 874 | "u|autostart_delay", &settings->priv->autostart_delay, | ||
3092 | 875 | "b|autostart_new_pad", &settings->priv->autostart_new_pad, | ||
3093 | 876 | "u|autostart_display_pads", &settings->priv->autostart_display_pads, | ||
3094 | 787 | NULL)) | 877 | NULL)) |
3095 | 788 | return; | 878 | return; |
3096 | 789 | 879 | ||
3097 | @@ -791,13 +881,16 @@ | |||
3098 | 791 | { | 881 | { |
3099 | 792 | gdk_rgba_free (settings->priv->text); | 882 | gdk_rgba_free (settings->priv->text); |
3100 | 793 | 883 | ||
3103 | 794 | // If, for some reason, one of the colors could not be retrieved | 884 | /* |
3104 | 795 | // (for example due to the migration to the new GdkRGBA colors), set the color to the default. | 885 | * If, for some reason, one of the colors could not be retrieved |
3105 | 886 | * (for example due to the migration to the new GdkRGBA colors), | ||
3106 | 887 | * set the color to the default. | ||
3107 | 888 | */ | ||
3108 | 796 | if (text_color_string == NULL) { | 889 | if (text_color_string == NULL) { |
3109 | 797 | text = (GdkRGBA) {0, 0, 0, 1}; | 890 | text = (GdkRGBA) {0, 0, 0, 1}; |
3110 | 798 | } | 891 | } |
3111 | 799 | else { | 892 | else { |
3113 | 800 | // If, for some reason, the parsing of the colors fail, set the color to the default. | 893 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ |
3114 | 801 | if (!gdk_rgba_parse (&text, text_color_string)) { | 894 | if (!gdk_rgba_parse (&text, text_color_string)) { |
3115 | 802 | text = (GdkRGBA) {0, 0, 0, 1}; | 895 | text = (GdkRGBA) {0, 0, 0, 1}; |
3116 | 803 | } | 896 | } |
3117 | @@ -808,13 +901,16 @@ | |||
3118 | 808 | 901 | ||
3119 | 809 | gdk_rgba_free (settings->priv->back); | 902 | gdk_rgba_free (settings->priv->back); |
3120 | 810 | if (use_back) { | 903 | if (use_back) { |
3123 | 811 | // If, for some reason, one of the colors could not be retrieved | 904 | /* |
3124 | 812 | // (for example due to the migration to the new GdkRGBA colors), set the color to the default. | 905 | * If, for some reason, one of the colors could not be retrieved |
3125 | 906 | * (for example due to the migration to the new GdkRGBA colors), | ||
3126 | 907 | * set the color to the default. | ||
3127 | 908 | */ | ||
3128 | 813 | if (background_color_string == NULL) { | 909 | if (background_color_string == NULL) { |
3129 | 814 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 910 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
3130 | 815 | } | 911 | } |
3131 | 816 | else { | 912 | else { |
3133 | 817 | // If, for some reason, the parsing of the colors fail, set the color to the default. | 913 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ |
3134 | 818 | if (!gdk_rgba_parse (&back, background_color_string)) { | 914 | if (!gdk_rgba_parse (&back, background_color_string)) { |
3135 | 819 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 915 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
3136 | 820 | } | 916 | } |
3137 | @@ -850,7 +946,7 @@ | |||
3138 | 850 | { | 946 | { |
3139 | 851 | settings->priv->toolbar_buttons = | 947 | settings->priv->toolbar_buttons = |
3140 | 852 | g_slist_append (settings->priv->toolbar_buttons, | 948 | g_slist_append (settings->priv->toolbar_buttons, |
3142 | 853 | g_strstrip (button_names[i])); // takes ownership of string | 949 | g_strstrip (button_names[i])); /* takes ownership of string */ |
3143 | 854 | } | 950 | } |
3144 | 855 | 951 | ||
3145 | 856 | g_free (button_names); | 952 | g_free (button_names); |
3146 | @@ -886,7 +982,7 @@ | |||
3147 | 886 | "u|width", settings->priv->width, | 982 | "u|width", settings->priv->width, |
3148 | 887 | "b|confirm_destroy", settings->priv->confirm_destroy, | 983 | "b|confirm_destroy", settings->priv->confirm_destroy, |
3149 | 888 | "b|edit_lock", settings->priv->edit_lock, | 984 | "b|edit_lock", settings->priv->edit_lock, |
3151 | 889 | "b|sticky_on_start", settings->priv->sticky, | 985 | "b|sticky_on_start", settings->priv->autostart_sticky, |
3152 | 890 | "u|tray_click_configuration", settings->priv->tray_click_configuration, | 986 | "u|tray_click_configuration", settings->priv->tray_click_configuration, |
3153 | 891 | "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL", | 987 | "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL", |
3154 | 892 | "b|use_back", settings->priv->back ? TRUE : FALSE, | 988 | "b|use_back", settings->priv->back ? TRUE : FALSE, |
3155 | @@ -897,6 +993,10 @@ | |||
3156 | 897 | "b|auto_hide_toolbar", settings->priv->autohide_toolbar, | 993 | "b|auto_hide_toolbar", settings->priv->autohide_toolbar, |
3157 | 898 | "b|scrollbar", settings->priv->has_scrollbar, | 994 | "b|scrollbar", settings->priv->has_scrollbar, |
3158 | 899 | "s|buttons", buttons, | 995 | "s|buttons", buttons, |
3159 | 996 | "b|autostart_wait_systray", settings->priv->autostart_wait_systray, | ||
3160 | 997 | "u|autostart_delay", settings->priv->autostart_delay, | ||
3161 | 998 | "b|autostart_new_pad", settings->priv->autostart_new_pad, | ||
3162 | 999 | "u|autostart_display_pads", settings->priv->autostart_display_pads, | ||
3163 | 900 | NULL); | 1000 | NULL); |
3164 | 901 | 1001 | ||
3165 | 902 | g_free (buttons); | 1002 | g_free (buttons); |
3166 | 903 | 1003 | ||
3167 | === modified file 'src/xpad-settings.h' | |||
3168 | --- src/xpad-settings.h 2013-10-31 21:17:36 +0000 | |||
3169 | +++ src/xpad-settings.h 2014-06-07 00:27:40 +0000 | |||
3170 | @@ -66,9 +66,6 @@ | |||
3171 | 66 | void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm); | 66 | void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm); |
3172 | 67 | gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings); | 67 | gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings); |
3173 | 68 | 68 | ||
3174 | 69 | void xpad_settings_set_sticky (XpadSettings *settings, gboolean sticky); | ||
3175 | 70 | gboolean xpad_settings_get_sticky (XpadSettings *settings); | ||
3176 | 71 | |||
3177 | 72 | void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock); | 69 | void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock); |
3178 | 73 | gboolean xpad_settings_get_edit_lock (XpadSettings *settings); | 70 | gboolean xpad_settings_get_edit_lock (XpadSettings *settings); |
3179 | 74 | 71 | ||
3180 | @@ -82,23 +79,39 @@ | |||
3181 | 82 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings); | 79 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings); |
3182 | 83 | 80 | ||
3183 | 84 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); | 81 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); |
3184 | 85 | // gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new); | ||
3185 | 86 | // gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button); | ||
3186 | 87 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); | 82 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); |
3187 | 88 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); | 83 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); |
3189 | 89 | G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); | 84 | const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); |
3190 | 90 | 85 | ||
3191 | 91 | void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back); | 86 | void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back); |
3193 | 92 | G_CONST_RETURN GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings); | 87 | const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings); |
3194 | 93 | 88 | ||
3195 | 94 | void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text); | 89 | void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text); |
3197 | 95 | G_CONST_RETURN GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings); | 90 | const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings); |
3198 | 96 | 91 | ||
3199 | 97 | void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname); | 92 | void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname); |
3201 | 98 | G_CONST_RETURN gchar *xpad_settings_get_fontname (XpadSettings *settings); | 93 | const gchar *xpad_settings_get_fontname (XpadSettings *settings); |
3202 | 99 | 94 | ||
3203 | 100 | void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf); | 95 | void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf); |
3205 | 101 | guint xpad_settings_get_tray_click_handler(XpadSettings *settings); | 96 | guint xpad_settings_get_tray_click_handler (XpadSettings *settings); |
3206 | 97 | |||
3207 | 98 | void xpad_settings_set_autostart_xpad (XpadSettings *settings, gboolean conf); | ||
3208 | 99 | gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings); | ||
3209 | 100 | |||
3210 | 101 | void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf); | ||
3211 | 102 | gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings); | ||
3212 | 103 | |||
3213 | 104 | void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf); | ||
3214 | 105 | guint xpad_settings_get_autostart_delay (XpadSettings *settings); | ||
3215 | 106 | |||
3216 | 107 | void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf); | ||
3217 | 108 | gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings); | ||
3218 | 109 | |||
3219 | 110 | void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean conf); | ||
3220 | 111 | gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings); | ||
3221 | 112 | |||
3222 | 113 | void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf); | ||
3223 | 114 | guint xpad_settings_get_autostart_display_pads (XpadSettings *settings); | ||
3224 | 102 | 115 | ||
3225 | 103 | G_END_DECLS | 116 | G_END_DECLS |
3226 | 104 | 117 | ||
3227 | 105 | 118 | ||
3228 | === modified file 'src/xpad-text-view.c' | |||
3229 | --- src/xpad-text-view.c 2013-10-31 21:17:36 +0000 | |||
3230 | +++ src/xpad-text-view.c 2014-06-07 00:27:40 +0000 | |||
3231 | @@ -153,8 +153,7 @@ | |||
3232 | 153 | static gboolean | 153 | static gboolean |
3233 | 154 | xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event) | 154 | xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event) |
3234 | 155 | { | 155 | { |
3237 | 156 | // A dirty way to silence the compiler for these unused variables. | 156 | /* A dirty way to silence the compiler for these unused variables. */ |
3236 | 157 | // Feel free to implement these variables in the way they are ment to be used. | ||
3238 | 158 | (void) event; | 157 | (void) event; |
3239 | 159 | 158 | ||
3240 | 160 | if (xpad_settings_get_edit_lock (xpad_global_settings)) | 159 | if (xpad_settings_get_edit_lock (xpad_global_settings)) |
3241 | @@ -200,13 +199,17 @@ | |||
3242 | 200 | { | 199 | { |
3243 | 201 | GdkCursor *cursor; | 200 | GdkCursor *cursor; |
3244 | 202 | gboolean editable; | 201 | gboolean editable; |
3245 | 202 | GdkWindow *view_window; | ||
3246 | 203 | 203 | ||
3247 | 204 | editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view)); | 204 | editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view)); |
3248 | 205 | gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), editable); | 205 | gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), editable); |
3249 | 206 | 206 | ||
3250 | 207 | cursor = editable ? gdk_cursor_new (GDK_XTERM) : NULL; | 207 | cursor = editable ? gdk_cursor_new (GDK_XTERM) : NULL; |
3251 | 208 | 208 | ||
3253 | 209 | gdk_window_set_cursor (gtk_text_view_get_window (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_TEXT), cursor); | 209 | /* Only set for pads which are currently visible */ |
3254 | 210 | view_window = gtk_text_view_get_window (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_TEXT); | ||
3255 | 211 | if (view_window != NULL) | ||
3256 | 212 | gdk_window_set_cursor (view_window, cursor); | ||
3257 | 210 | 213 | ||
3258 | 211 | if (cursor) | 214 | if (cursor) |
3259 | 212 | g_object_unref (cursor); | 215 | g_object_unref (cursor); |
3260 | @@ -224,11 +227,11 @@ | |||
3261 | 224 | pango_font_description_free (fontdesc); | 227 | pango_font_description_free (fontdesc); |
3262 | 225 | } | 228 | } |
3263 | 226 | 229 | ||
3265 | 227 | // Update the colors of the textview | 230 | /* Update the colors of the textview */ |
3266 | 228 | static void | 231 | static void |
3267 | 229 | xpad_text_view_notify_colors (XpadTextView *view) | 232 | xpad_text_view_notify_colors (XpadTextView *view) |
3268 | 230 | { | 233 | { |
3270 | 231 | // Set the colors of this individual pad to the global setting preference. | 234 | /* Set the colors of this individual pad to the global setting preference. */ |
3271 | 232 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); | 235 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); |
3272 | 233 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); | 236 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); |
3273 | 234 | 237 | ||
3274 | @@ -236,7 +239,7 @@ | |||
3275 | 236 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color); | 239 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color); |
3276 | 237 | gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, back_color); | 240 | gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, back_color); |
3277 | 238 | 241 | ||
3279 | 239 | // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. | 242 | /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */ |
3280 | 240 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, back_color); | 243 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, back_color); |
3281 | 241 | gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, text_color); | 244 | gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, text_color); |
3282 | 242 | } | 245 | } |
3283 | 243 | 246 | ||
3284 | === modified file 'src/xpad-toolbar.c' | |||
3285 | --- src/xpad-toolbar.c 2013-10-31 21:17:36 +0000 | |||
3286 | +++ src/xpad-toolbar.c 2014-06-07 00:27:40 +0000 | |||
3287 | @@ -35,8 +35,6 @@ | |||
3288 | 35 | guint move_button_release_handler; | 35 | guint move_button_release_handler; |
3289 | 36 | guint move_key_press_handler; | 36 | guint move_key_press_handler; |
3290 | 37 | XpadPad *pad; | 37 | XpadPad *pad; |
3291 | 38 | // GtkToolItem *move_button; | ||
3292 | 39 | // GtkToolItem *tool_items; | ||
3293 | 40 | }; | 38 | }; |
3294 | 41 | 39 | ||
3295 | 42 | G_DEFINE_TYPE_WITH_PRIVATE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR) | 40 | G_DEFINE_TYPE_WITH_PRIVATE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR) |
3296 | @@ -50,7 +48,7 @@ | |||
3297 | 50 | typedef struct | 48 | typedef struct |
3298 | 51 | { | 49 | { |
3299 | 52 | const gchar *name; | 50 | const gchar *name; |
3301 | 53 | const gchar *stock; | 51 | const gchar *icon_name; |
3302 | 54 | guint signal; | 52 | guint signal; |
3303 | 55 | guint type; | 53 | guint type; |
3304 | 56 | const gchar *desc; | 54 | const gchar *desc; |
3305 | @@ -78,23 +76,22 @@ | |||
3306 | 78 | 76 | ||
3307 | 79 | static const XpadToolbarButton buttons[] = | 77 | static const XpadToolbarButton buttons[] = |
3308 | 80 | { | 78 | { |
3323 | 81 | {"Clear", GTK_STOCK_CLEAR, ACTIVATE_CLEAR, XPAD_BUTTON_TYPE_BUTTON, N_("Clear Pad Contents"), N_("Add C_lear to Toolbar")}, | 79 | {"Clear", "edit-clear", ACTIVATE_CLEAR, XPAD_BUTTON_TYPE_BUTTON, N_("Clear Pad Contents"), N_("Add C_lear button")}, |
3324 | 82 | {"Close", GTK_STOCK_CLOSE, ACTIVATE_CLOSE, XPAD_BUTTON_TYPE_BUTTON, N_("Close and Save Pad"), N_("Add _Close to Toolbar")}, | 80 | {"Close", "window-close", ACTIVATE_CLOSE, XPAD_BUTTON_TYPE_BUTTON, N_("Close and Save Pad"), N_("Add _Close button")}, |
3325 | 83 | {"Copy", GTK_STOCK_COPY, ACTIVATE_COPY, XPAD_BUTTON_TYPE_BUTTON, N_("Copy to Clipboard"), N_("Add C_opy to Toolbar")}, | 81 | {"Copy", "edit-copy", ACTIVATE_COPY, XPAD_BUTTON_TYPE_BUTTON, N_("Copy to Clipboard"), N_("Add C_opy button")}, |
3326 | 84 | {"Cut", GTK_STOCK_CUT, ACTIVATE_CUT, XPAD_BUTTON_TYPE_BUTTON, N_("Cut to Clipboard"), N_("Add C_ut to Toolbar")}, | 82 | {"Cut", "edit-cut", ACTIVATE_CUT, XPAD_BUTTON_TYPE_BUTTON, N_("Cut to Clipboard"), N_("Add C_ut button")}, |
3327 | 85 | {"Delete", GTK_STOCK_DELETE, ACTIVATE_DELETE, XPAD_BUTTON_TYPE_BUTTON, N_("Delete Pad"), N_("Add _Delete to Toolbar")}, | 83 | {"Delete", "edit-delete", ACTIVATE_DELETE, XPAD_BUTTON_TYPE_BUTTON, N_("Delete Pad"), N_("Add _Delete button")}, |
3328 | 86 | {"New", GTK_STOCK_NEW, ACTIVATE_NEW, XPAD_BUTTON_TYPE_BUTTON, N_("Open New Pad"), N_("Add _New to Toolbar")}, | 84 | {"New", "document-new", ACTIVATE_NEW, XPAD_BUTTON_TYPE_BUTTON, N_("Open New Pad"), N_("Add _New button")}, |
3329 | 87 | {"Paste", GTK_STOCK_PASTE, ACTIVATE_PASTE, XPAD_BUTTON_TYPE_BUTTON, N_("Paste from Clipboard"), N_("Add Pa_ste to Toolbar")}, | 85 | {"Paste", "edit-paste", ACTIVATE_PASTE, XPAD_BUTTON_TYPE_BUTTON, N_("Paste from Clipboard"), N_("Add Pa_ste button")}, |
3330 | 88 | {"Preferences", GTK_STOCK_PREFERENCES, ACTIVATE_PREFERENCES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Preferences"), N_("Add Pr_eferences to Toolbar")}, | 86 | {"Preferences", "preferences-system", ACTIVATE_PREFERENCES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Preferences"), N_("Add Pr_eferences button")}, |
3331 | 89 | {"Properties", GTK_STOCK_PROPERTIES, ACTIVATE_PROPERTIES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Pad Properties"), N_("Add Proper_ties to Toolbar")}, | 87 | {"Properties", "document-properties", ACTIVATE_PROPERTIES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Pad Properties"), N_("Add Proper_ties button")}, |
3332 | 90 | {"Redo", GTK_STOCK_REDO, ACTIVATE_REDO, XPAD_BUTTON_TYPE_BUTTON, N_("Redo"), N_("Add _Redo to Toolbar")}, | 88 | {"Redo", "edit-redo", ACTIVATE_REDO, XPAD_BUTTON_TYPE_BUTTON, N_("Redo"), N_("Add _Redo button")}, |
3333 | 91 | {"Quit", GTK_STOCK_QUIT, ACTIVATE_QUIT, XPAD_BUTTON_TYPE_BUTTON, N_("Close All Pads"), N_("Add Close _All to Toolbar")}, | 89 | {"Quit", "application-exit", ACTIVATE_QUIT, XPAD_BUTTON_TYPE_BUTTON, N_("Close All Pads"), N_("Add Close _All button")}, |
3334 | 92 | {"Undo", GTK_STOCK_UNDO, ACTIVATE_UNDO, XPAD_BUTTON_TYPE_BUTTON, N_("Undo"), N_("Add _Undo to Toolbar")}, | 90 | {"Undo", "edit-undo", ACTIVATE_UNDO, XPAD_BUTTON_TYPE_BUTTON, N_("Undo"), N_("Add _Undo button")}, |
3335 | 93 | {"sep", NULL, 0, XPAD_BUTTON_TYPE_SEPARATOR, NULL, N_("Add a Se_parator to Toolbar")} /* Separator */ | 91 | {"Separator", NULL, 0, XPAD_BUTTON_TYPE_SEPARATOR, NULL, N_("Add Se_parator")} |
3322 | 94 | /*{"Minimize to Tray", "gtk-goto-bottom", 1, N_("Minimize Pads to System Tray")}*/ | ||
3336 | 95 | }; | 92 | }; |
3337 | 96 | 93 | ||
3339 | 97 | static G_CONST_RETURN XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name); | 94 | static const XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name); |
3340 | 98 | static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button); | 95 | static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button); |
3341 | 99 | static void xpad_toolbar_button_activated (GtkToolButton *button); | 96 | static void xpad_toolbar_button_activated (GtkToolButton *button); |
3342 | 100 | static void xpad_toolbar_change_buttons (XpadToolbar *toolbar); | 97 | static void xpad_toolbar_change_buttons (XpadToolbar *toolbar); |
3343 | @@ -107,16 +104,6 @@ | |||
3344 | 107 | static void xpad_toolbar_add_button (const gchar *button_name); | 104 | static void xpad_toolbar_add_button (const gchar *button_name); |
3345 | 108 | static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button); | 105 | static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button); |
3346 | 109 | 106 | ||
3347 | 110 | /* Unfinished new feature of previous developer | ||
3348 | 111 | static void xpad_toolbar_remove_button (GtkWidget *button); | ||
3349 | 112 | static gboolean xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event); | ||
3350 | 113 | static gboolean xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar); | ||
3351 | 114 | static gboolean xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button); | ||
3352 | 115 | static gboolean xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event); | ||
3353 | 116 | static gboolean xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event); | ||
3354 | 117 | static gboolean xpad_toolbar_move_button_end (XpadToolbar *toolbar); | ||
3355 | 118 | */ | ||
3356 | 119 | |||
3357 | 120 | static guint signals[LAST_SIGNAL] = { 0 }; | 107 | static guint signals[LAST_SIGNAL] = { 0 }; |
3358 | 121 | 108 | ||
3359 | 122 | enum | 109 | enum |
3360 | @@ -144,7 +131,6 @@ | |||
3361 | 144 | gobject_class->dispose = xpad_toolbar_dispose; | 131 | gobject_class->dispose = xpad_toolbar_dispose; |
3362 | 145 | gobject_class->finalize = xpad_toolbar_finalize; | 132 | gobject_class->finalize = xpad_toolbar_finalize; |
3363 | 146 | 133 | ||
3364 | 147 | /* Signals */ | ||
3365 | 148 | signals[ACTIVATE_NEW] = | 134 | signals[ACTIVATE_NEW] = |
3366 | 149 | g_signal_new ("activate-new", | 135 | g_signal_new ("activate-new", |
3367 | 150 | G_OBJECT_CLASS_TYPE (gobject_class), | 136 | G_OBJECT_CLASS_TYPE (gobject_class), |
3368 | @@ -344,11 +330,10 @@ | |||
3369 | 344 | } | 330 | } |
3370 | 345 | } | 331 | } |
3371 | 346 | 332 | ||
3373 | 347 | static G_CONST_RETURN XpadToolbarButton * | 333 | static const XpadToolbarButton * |
3374 | 348 | xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name) | 334 | xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name) |
3375 | 349 | { | 335 | { |
3378 | 350 | // A dirty way to silence the compiler for these unused variables. | 336 | /* A dirty way to silence the compiler for these unused variables. */ |
3377 | 351 | // Feel free to implement these variables in the way they are ment to be used. | ||
3379 | 352 | (void) toolbar; | 337 | (void) toolbar; |
3380 | 353 | 338 | ||
3381 | 354 | guint i; | 339 | guint i; |
3382 | @@ -363,7 +348,6 @@ | |||
3383 | 363 | xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button) | 348 | xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button) |
3384 | 364 | { | 349 | { |
3385 | 365 | GtkToolItem *item; | 350 | GtkToolItem *item; |
3386 | 366 | // GtkWidget *child; | ||
3387 | 367 | 351 | ||
3388 | 368 | item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name)); | 352 | item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name)); |
3389 | 369 | if (item) | 353 | if (item) |
3390 | @@ -372,11 +356,13 @@ | |||
3391 | 372 | switch (button->type) | 356 | switch (button->type) |
3392 | 373 | { | 357 | { |
3393 | 374 | case XPAD_BUTTON_TYPE_BUTTON: | 358 | case XPAD_BUTTON_TYPE_BUTTON: |
3395 | 375 | item = GTK_TOOL_ITEM (gtk_tool_button_new_from_stock (button->stock)); | 359 | item = gtk_tool_button_new (NULL, button->name); |
3396 | 360 | gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), button->icon_name); | ||
3397 | 376 | g_signal_connect (item, "clicked", G_CALLBACK (xpad_toolbar_button_activated), NULL); | 361 | g_signal_connect (item, "clicked", G_CALLBACK (xpad_toolbar_button_activated), NULL); |
3398 | 377 | break; | 362 | break; |
3399 | 378 | case XPAD_BUTTON_TYPE_TOGGLE: | 363 | case XPAD_BUTTON_TYPE_TOGGLE: |
3401 | 379 | item = GTK_TOOL_ITEM (gtk_toggle_tool_button_new_from_stock (button->stock)); | 364 | item = gtk_tool_button_new (NULL, button->name); |
3402 | 365 | gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), button->icon_name); | ||
3403 | 380 | g_signal_connect (item, "toggled", G_CALLBACK (xpad_toolbar_button_activated), NULL); | 366 | g_signal_connect (item, "toggled", G_CALLBACK (xpad_toolbar_button_activated), NULL); |
3404 | 381 | break; | 367 | break; |
3405 | 382 | case XPAD_BUTTON_TYPE_SEPARATOR: | 368 | case XPAD_BUTTON_TYPE_SEPARATOR: |
3406 | @@ -414,7 +400,7 @@ | |||
3407 | 414 | { | 400 | { |
3408 | 415 | GList *list, *temp; | 401 | GList *list, *temp; |
3409 | 416 | const GSList *slist, *stemp; | 402 | const GSList *slist, *stemp; |
3411 | 417 | gint i = 0; | 403 | guint i = 0; |
3412 | 418 | guint j = 0; | 404 | guint j = 0; |
3413 | 419 | GtkToolItem *item; | 405 | GtkToolItem *item; |
3414 | 420 | 406 | ||
3415 | @@ -430,16 +416,20 @@ | |||
3416 | 430 | g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL); | 416 | g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL); |
3417 | 431 | 417 | ||
3418 | 432 | slist = xpad_settings_get_toolbar_buttons (xpad_global_settings); | 418 | slist = xpad_settings_get_toolbar_buttons (xpad_global_settings); |
3419 | 419 | |||
3420 | 433 | for (stemp = slist; stemp; stemp = stemp->next) | 420 | for (stemp = slist; stemp; stemp = stemp->next) |
3421 | 434 | { | 421 | { |
3422 | 435 | const XpadToolbarButton *button; | 422 | const XpadToolbarButton *button; |
3424 | 436 | 423 | ||
3425 | 437 | button = xpad_toolbar_button_lookup (toolbar, stemp->data); | 424 | button = xpad_toolbar_button_lookup (toolbar, stemp->data); |
3427 | 438 | if (!button) | 425 | |
3428 | 426 | if (button->type == XPAD_BUTTON_TYPE_SEPARATOR) | ||
3429 | 427 | item = gtk_separator_tool_item_new (); | ||
3430 | 428 | else if (button->type == XPAD_BUTTON_TYPE_BUTTON) | ||
3431 | 429 | item = xpad_toolbar_button_to_item (toolbar, button); | ||
3432 | 430 | else | ||
3433 | 439 | continue; | 431 | continue; |
3434 | 440 | 432 | ||
3435 | 441 | item = xpad_toolbar_button_to_item (toolbar, button); | ||
3436 | 442 | |||
3437 | 443 | if (item) | 433 | if (item) |
3438 | 444 | { | 434 | { |
3439 | 445 | g_object_set_data (G_OBJECT (item), "xpad-button-num", GINT_TO_POINTER (i)); | 435 | g_object_set_data (G_OBJECT (item), "xpad-button-num", GINT_TO_POINTER (i)); |
3440 | @@ -462,7 +452,7 @@ | |||
3441 | 462 | gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); | 452 | gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); |
3442 | 463 | gtk_widget_show_all (GTK_WIDGET (item)); | 453 | gtk_widget_show_all (GTK_WIDGET (item)); |
3443 | 464 | i++; | 454 | i++; |
3445 | 465 | 455 | ||
3446 | 466 | if (toolbar->priv->pad) | 456 | if (toolbar->priv->pad) |
3447 | 467 | { | 457 | { |
3448 | 468 | xpad_pad_notify_has_selection (toolbar->priv->pad); | 458 | xpad_pad_notify_has_selection (toolbar->priv->pad); |
3449 | @@ -497,8 +487,7 @@ | |||
3450 | 497 | static gboolean | 487 | static gboolean |
3451 | 498 | xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button) | 488 | xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button) |
3452 | 499 | { | 489 | { |
3455 | 500 | // A dirty way to silence the compiler for these unused variables. | 490 | /* A dirty way to silence the compiler for these unused variables. */ |
3454 | 501 | // Feel free to implement these variables in the way they are ment to be used. | ||
3456 | 502 | (void) x; | 491 | (void) x; |
3457 | 503 | (void) y; | 492 | (void) y; |
3458 | 504 | 493 | ||
3459 | @@ -515,60 +504,37 @@ | |||
3460 | 515 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) | 504 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) |
3461 | 516 | { | 505 | { |
3462 | 517 | const GSList *j; | 506 | const GSList *j; |
3464 | 518 | GtkWidget *item, *image; | 507 | GtkWidget *item; |
3465 | 508 | |||
3466 | 509 | for (j = current_buttons; j; j = j->next) | ||
3467 | 510 | if (g_ascii_strcasecmp (j->data, "Separator") && !g_ascii_strcasecmp (j->data, buttons[i].name)) | ||
3468 | 511 | break; | ||
3469 | 519 | 512 | ||
3485 | 520 | if (strcmp (buttons[i].name, "sep") != 0) | 513 | if (j) |
3486 | 521 | { | 514 | { |
3487 | 522 | for (j = current_buttons; j; j = j->next) | 515 | is_button = TRUE; |
3473 | 523 | if (!g_ascii_strcasecmp (j->data, buttons[i].name)) | ||
3474 | 524 | break; | ||
3475 | 525 | |||
3476 | 526 | if (j) | ||
3477 | 527 | { | ||
3478 | 528 | is_button = TRUE; | ||
3479 | 529 | continue; | ||
3480 | 530 | } | ||
3481 | 531 | } | ||
3482 | 532 | else | ||
3483 | 533 | { | ||
3484 | 534 | /* Don't let user add separators until we can allow clicks on them. */ | ||
3488 | 535 | continue; | 516 | continue; |
3489 | 536 | } | 517 | } |
3490 | 537 | 518 | ||
3496 | 538 | item = gtk_image_menu_item_new_with_mnemonic (buttons[i].menu_desc); | 519 | item = gtk_menu_item_new_with_mnemonic (buttons[i].menu_desc); |
3492 | 539 | |||
3493 | 540 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
3494 | 541 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
3495 | 542 | |||
3497 | 543 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name); | 520 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name); |
3498 | 544 | |||
3499 | 545 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | 521 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); |
3500 | 546 | gtk_widget_show (item); | 522 | gtk_widget_show (item); |
3501 | 547 | } | 523 | } |
3502 | 548 | 524 | ||
3503 | 549 | if (is_button) | 525 | if (is_button) |
3504 | 550 | { | 526 | { |
3506 | 551 | GtkWidget *item, *image; | 527 | GtkWidget *item; |
3507 | 552 | 528 | ||
3515 | 553 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remove All _Buttons")); | 529 | item = gtk_menu_item_new_with_mnemonic (N_("Remove All _Buttons")); |
3516 | 554 | 530 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL); | |
3510 | 555 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
3511 | 556 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
3512 | 557 | |||
3513 | 558 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL); | ||
3514 | 559 | |||
3517 | 560 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | 531 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); |
3518 | 561 | gtk_widget_show (item); | 532 | gtk_widget_show (item); |
3519 | 562 | 533 | ||
3520 | 563 | i++; | 534 | i++; |
3521 | 564 | 535 | ||
3527 | 565 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remo_ve Last Button")); | 536 | item = gtk_menu_item_new_with_mnemonic (N_("Remo_ve Last Button")); |
3523 | 566 | |||
3524 | 567 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
3525 | 568 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
3526 | 569 | |||
3528 | 570 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL); | 537 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL); |
3529 | 571 | |||
3530 | 572 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | 538 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); |
3531 | 573 | gtk_widget_show (item); | 539 | gtk_widget_show (item); |
3532 | 574 | } | 540 | } |
3533 | @@ -625,216 +591,3 @@ | |||
3534 | 625 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste"); | 591 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste"); |
3535 | 626 | xpad_toolbar_enable_button (toolbar, button, enable); | 592 | xpad_toolbar_enable_button (toolbar, button, enable); |
3536 | 627 | } | 593 | } |
3537 | 628 | |||
3538 | 629 | /* | ||
3539 | 630 | * The code below was code in progress of a previous developer | ||
3540 | 631 | static gboolean | ||
3541 | 632 | xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event) | ||
3542 | 633 | { | ||
3543 | 634 | // Ignore double-clicks and triple-clicks | ||
3544 | 635 | if (event->button == 3 && event->type == GDK_BUTTON_PRESS) | ||
3545 | 636 | { | ||
3546 | 637 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
3547 | 638 | xpad_toolbar_popup_button_menu (widget, event, toolbar); | ||
3548 | 639 | return TRUE; | ||
3549 | 640 | } | ||
3550 | 641 | else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) | ||
3551 | 642 | { | ||
3552 | 643 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
3553 | 644 | xpad_toolbar_move_button_start (toolbar, widget); | ||
3554 | 645 | return TRUE; | ||
3555 | 646 | } | ||
3556 | 647 | |||
3557 | 648 | return FALSE; | ||
3558 | 649 | } | ||
3559 | 650 | |||
3560 | 651 | static gboolean | ||
3561 | 652 | xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar) | ||
3562 | 653 | { | ||
3563 | 654 | GtkWidget *menu; | ||
3564 | 655 | GtkWidget *item, *image; | ||
3565 | 656 | |||
3566 | 657 | menu = gtk_menu_new (); | ||
3567 | 658 | |||
3568 | 659 | |||
3569 | 660 | item = gtk_image_menu_item_new_with_mnemonic (_("_Remove From Toolbar")); | ||
3570 | 661 | |||
3571 | 662 | image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); | ||
3572 | 663 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
3573 | 664 | |||
3574 | 665 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_button), button); | ||
3575 | 666 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 0, 1); | ||
3576 | 667 | gtk_widget_show (item); | ||
3577 | 668 | |||
3578 | 669 | |||
3579 | 670 | item = gtk_menu_item_new_with_mnemonic (_("_Move")); | ||
3580 | 671 | g_signal_connect_swapped (item, "activate", G_CALLBACK (move_menu_item_activated), button); | ||
3581 | 672 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 1, 2); | ||
3582 | 673 | gtk_widget_show (item); | ||
3583 | 674 | |||
3584 | 675 | |||
3585 | 676 | g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar); | ||
3586 | 677 | |||
3587 | 678 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event ? event->button : 0, gtk_get_current_event_time ()); | ||
3588 | 679 | |||
3589 | 680 | g_signal_emit (toolbar, signals[POPUP], 0, menu); | ||
3590 | 681 | |||
3591 | 682 | return TRUE; | ||
3592 | 683 | } | ||
3593 | 684 | |||
3594 | 685 | static void | ||
3595 | 686 | xpad_toolbar_remove_button (GtkWidget *button) | ||
3596 | 687 | { | ||
3597 | 688 | gint button_num; | ||
3598 | 689 | |||
3599 | 690 | button_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); | ||
3600 | 691 | |||
3601 | 692 | xpad_settings_remove_toolbar_button (xpad_global_settings, button_num); | ||
3602 | 693 | } | ||
3603 | 694 | |||
3604 | 695 | static void | ||
3605 | 696 | move_menu_item_activated (GtkWidget *button) | ||
3606 | 697 | { | ||
3607 | 698 | XpadToolbar *toolbar; | ||
3608 | 699 | |||
3609 | 700 | toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (button), "xpad-toolbar")); | ||
3610 | 701 | |||
3611 | 702 | xpad_toolbar_move_button_start (toolbar, button); | ||
3612 | 703 | } | ||
3613 | 704 | |||
3614 | 705 | static gboolean | ||
3615 | 706 | xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button) | ||
3616 | 707 | { | ||
3617 | 708 | GdkGrabStatus status; | ||
3618 | 709 | GdkCursor *fleur_cursor; | ||
3619 | 710 | GtkWidget *widget; | ||
3620 | 711 | |||
3621 | 712 | widget = GTK_WIDGET (toolbar); | ||
3622 | 713 | gtk_grab_add (widget); | ||
3623 | 714 | |||
3624 | 715 | fleur_cursor = gdk_cursor_new (GDK_FLEUR); | ||
3625 | 716 | |||
3626 | 717 | // g_object_ref (button); | ||
3627 | 718 | toolbar->priv->move_removed = FALSE; | ||
3628 | 719 | toolbar->priv->move_button = GTK_TOOL_ITEM (button); | ||
3629 | 720 | toolbar->priv->move_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); | ||
3630 | 721 | |||
3631 | 722 | toolbar->priv->move_button_release_handler = g_signal_connect (toolbar, "button-release-event", G_CALLBACK (xpad_toolbar_move_button_end), NULL); | ||
3632 | 723 | toolbar->priv->move_key_press_handler = g_signal_connect (toolbar, "key-press-event", G_CALLBACK (xpad_toolbar_move_button_move_keyboard), NULL); | ||
3633 | 724 | toolbar->priv->move_motion_handler = g_signal_connect (toolbar, "motion-notify-event", G_CALLBACK (xpad_toolbar_move_button_move), NULL); | ||
3634 | 725 | |||
3635 | 726 | status = gdk_pointer_grab (widget->window, FALSE, | ||
3636 | 727 | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, | ||
3637 | 728 | fleur_cursor, gtk_get_current_event_time ()); | ||
3638 | 729 | |||
3639 | 730 | gdk_cursor_unref (fleur_cursor); | ||
3640 | 731 | gdk_flush (); | ||
3641 | 732 | |||
3642 | 733 | if (status != GDK_GRAB_SUCCESS) | ||
3643 | 734 | { | ||
3644 | 735 | xpad_toolbar_move_button_end (toolbar); | ||
3645 | 736 | } | ||
3646 | 737 | |||
3647 | 738 | return TRUE; | ||
3648 | 739 | } | ||
3649 | 740 | |||
3650 | 741 | static gboolean | ||
3651 | 742 | xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event) | ||
3652 | 743 | { | ||
3653 | 744 | if (event->keyval == GDK_KEY_Left || event->keyval == GDK_KEY_KP_Left) | ||
3654 | 745 | { | ||
3655 | 746 | if (!toolbar->priv->move_removed) | ||
3656 | 747 | { | ||
3657 | 748 | toolbar->priv->move_removed = TRUE; | ||
3658 | 749 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | ||
3659 | 750 | } | ||
3660 | 751 | |||
3661 | 752 | if (toolbar->priv->move_index > 0) | ||
3662 | 753 | toolbar->priv->move_index--; | ||
3663 | 754 | |||
3664 | 755 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | ||
3665 | 756 | } | ||
3666 | 757 | else if (event->keyval == GDK_KEY_Right || event->keyval == GDK_KEY_KP_Right) | ||
3667 | 758 | { | ||
3668 | 759 | gint max; | ||
3669 | 760 | |||
3670 | 761 | if (!toolbar->priv->move_removed) | ||
3671 | 762 | { | ||
3672 | 763 | toolbar->priv->move_removed = TRUE; | ||
3673 | 764 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | ||
3674 | 765 | } | ||
3675 | 766 | |||
3676 | 767 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | ||
3677 | 768 | |||
3678 | 769 | if (toolbar->priv->move_index < max) | ||
3679 | 770 | toolbar->priv->move_index++; | ||
3680 | 771 | |||
3681 | 772 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | ||
3682 | 773 | } | ||
3683 | 774 | else if (event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space || event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) | ||
3684 | 775 | { | ||
3685 | 776 | xpad_toolbar_move_button_end (toolbar); | ||
3686 | 777 | return TRUE; | ||
3687 | 778 | } | ||
3688 | 779 | |||
3689 | 780 | return TRUE; | ||
3690 | 781 | } | ||
3691 | 782 | |||
3692 | 783 | static gboolean | ||
3693 | 784 | xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event) | ||
3694 | 785 | { | ||
3695 | 786 | gint max; | ||
3696 | 787 | |||
3697 | 788 | if (!toolbar->priv->move_removed) | ||
3698 | 789 | { | ||
3699 | 790 | toolbar->priv->move_removed = TRUE; | ||
3700 | 791 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | ||
3701 | 792 | } | ||
3702 | 793 | |||
3703 | 794 | toolbar->priv->move_index = gtk_toolbar_get_drop_index (GTK_TOOLBAR (toolbar), event->x, event->y); | ||
3704 | 795 | |||
3705 | 796 | // Must not move past separator or grip | ||
3706 | 797 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | ||
3707 | 798 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); | ||
3708 | 799 | |||
3709 | 800 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | ||
3710 | 801 | |||
3711 | 802 | return TRUE; | ||
3712 | 803 | } | ||
3713 | 804 | |||
3714 | 805 | static gboolean | ||
3715 | 806 | xpad_toolbar_move_button_end (XpadToolbar *toolbar) | ||
3716 | 807 | { | ||
3717 | 808 | gint old_spot; | ||
3718 | 809 | gint max; | ||
3719 | 810 | |||
3720 | 811 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_button_release_handler); | ||
3721 | 812 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_key_press_handler); | ||
3722 | 813 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_motion_handler); | ||
3723 | 814 | toolbar->priv->move_button_release_handler = 0; | ||
3724 | 815 | toolbar->priv->move_key_press_handler = 0; | ||
3725 | 816 | toolbar->priv->move_motion_handler = 0; | ||
3726 | 817 | |||
3727 | 818 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), NULL, 0); | ||
3728 | 819 | |||
3729 | 820 | old_spot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (toolbar->priv->move_button), "xpad-button-num")); | ||
3730 | 821 | |||
3731 | 822 | // Must not move past separator or grip | ||
3732 | 823 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | ||
3733 | 824 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); | ||
3734 | 825 | |||
3735 | 826 | if (!xpad_settings_move_toolbar_button (xpad_global_settings, old_spot, toolbar->priv->move_index) && | ||
3736 | 827 | toolbar->priv->move_removed) | ||
3737 | 828 | { | ||
3738 | 829 | gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | ||
3739 | 830 | } | ||
3740 | 831 | |||
3741 | 832 | // g_object_unref (toolbar->priv->move_button); | ||
3742 | 833 | toolbar->priv->move_button = NULL; | ||
3743 | 834 | |||
3744 | 835 | gtk_grab_remove (GTK_WIDGET (toolbar)); | ||
3745 | 836 | gdk_pointer_ungrab (gtk_get_current_event_time ()); | ||
3746 | 837 | return TRUE; | ||
3747 | 838 | } | ||
3748 | 839 | |||
3749 | 840 | */ | ||
3750 | 841 | 594 | ||
3751 | === modified file 'src/xpad-tray.c' | |||
3752 | --- src/xpad-tray.c 2013-10-31 21:17:36 +0000 | |||
3753 | +++ src/xpad-tray.c 2014-06-07 00:27:40 +0000 | |||
3754 | @@ -38,15 +38,15 @@ | |||
3755 | 38 | LIST_OF_PADS, | 38 | LIST_OF_PADS, |
3756 | 39 | NEW_PAD | 39 | NEW_PAD |
3757 | 40 | }; | 40 | }; |
3759 | 41 | // tray icon left click handler | 41 | /* tray icon left click handler */ |
3760 | 42 | static void xpad_tray_activate_cb (GtkStatusIcon *icon); | 42 | static void xpad_tray_activate_cb (GtkStatusIcon *icon); |
3762 | 43 | // tray icon right click handler | 43 | /* tray icon right click handler */ |
3763 | 44 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); | 44 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); |
3765 | 45 | // "toggle show all" menu item handler | 45 | /* "toggle show all" menu item handler */ |
3766 | 46 | static void xpad_tray_show_hide_all (void); | 46 | static void xpad_tray_show_hide_all (void); |
3768 | 47 | // "show pads" menu item handler | 47 | /* "show pads" menu item handler */ |
3769 | 48 | static void xpad_tray_show_windows_list (GtkStatusIcon *icon); | 48 | static void xpad_tray_show_windows_list (GtkStatusIcon *icon); |
3771 | 49 | // helper function to append pad window title as item to menu | 49 | /* helper function to append pad window title as item to menu */ |
3772 | 50 | static void xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu); | 50 | static void xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu); |
3773 | 51 | 51 | ||
3774 | 52 | static GtkStatusIcon *docklet = NULL; | 52 | static GtkStatusIcon *docklet = NULL; |
3775 | @@ -126,7 +126,7 @@ | |||
3776 | 126 | xpad_tray_show_hide_all (void) | 126 | xpad_tray_show_hide_all (void) |
3777 | 127 | { | 127 | { |
3778 | 128 | GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | 128 | GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); |
3780 | 129 | // find if any pad is visible | 129 | /* find if any pad is visible */ |
3781 | 130 | gboolean open = FALSE; | 130 | gboolean open = FALSE; |
3782 | 131 | GSList *i; | 131 | GSList *i; |
3783 | 132 | for(i = pads; i != NULL; i = i->next) | 132 | for(i = pads; i != NULL; i = i->next) |
3784 | @@ -161,7 +161,7 @@ | |||
3785 | 161 | no_any_pad = TRUE; | 161 | no_any_pad = TRUE; |
3786 | 162 | g_slist_free (pads); | 162 | g_slist_free (pads); |
3787 | 163 | 163 | ||
3789 | 164 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); | 164 | item = gtk_menu_item_new_with_mnemonic (_("_New")); |
3790 | 165 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ()); | 165 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ()); |
3791 | 166 | gtk_container_add (GTK_CONTAINER (menu), item); | 166 | gtk_container_add (GTK_CONTAINER (menu), item); |
3792 | 167 | gtk_widget_show (item); | 167 | gtk_widget_show (item); |
3793 | @@ -177,7 +177,7 @@ | |||
3794 | 177 | if (no_any_pad) | 177 | if (no_any_pad) |
3795 | 178 | gtk_widget_set_sensitive (item, FALSE); | 178 | gtk_widget_set_sensitive (item, FALSE); |
3796 | 179 | 179 | ||
3798 | 180 | item = gtk_image_menu_item_new_with_mnemonic (_("_Close All")); | 180 | item = gtk_menu_item_new_with_mnemonic (_("_Close All")); |
3799 | 181 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ()); | 181 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ()); |
3800 | 182 | gtk_container_add (GTK_CONTAINER (menu), item); | 182 | gtk_container_add (GTK_CONTAINER (menu), item); |
3801 | 183 | gtk_widget_show (item); | 183 | gtk_widget_show (item); |
3802 | @@ -188,15 +188,19 @@ | |||
3803 | 188 | gtk_container_add (GTK_CONTAINER (menu), item); | 188 | gtk_container_add (GTK_CONTAINER (menu), item); |
3804 | 189 | gtk_widget_show (item); | 189 | gtk_widget_show (item); |
3805 | 190 | 190 | ||
3807 | 191 | // append window titles | 191 | /* append window titles */ |
3808 | 192 | xpad_tray_append_pad_window_titles_to_menu (menu); | 192 | xpad_tray_append_pad_window_titles_to_menu (menu); |
3809 | 193 | |||
3810 | 194 | item = gtk_separator_menu_item_new (); | ||
3811 | 195 | gtk_container_add (GTK_CONTAINER (menu), item); | ||
3812 | 196 | gtk_widget_show (item); | ||
3813 | 193 | 197 | ||
3815 | 194 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL); | 198 | item = gtk_menu_item_new_with_mnemonic (_("_Preferences")); |
3816 | 195 | g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL); | 199 | g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL); |
3817 | 196 | gtk_container_add (GTK_CONTAINER (menu), item); | 200 | gtk_container_add (GTK_CONTAINER (menu), item); |
3818 | 197 | gtk_widget_show (item); | 201 | gtk_widget_show (item); |
3819 | 198 | 202 | ||
3821 | 199 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL); | 203 | item = gtk_menu_item_new_with_mnemonic (_("_Quit")); |
3822 | 200 | g_signal_connect (item, "activate", G_CALLBACK (xpad_app_quit), NULL); | 204 | g_signal_connect (item, "activate", G_CALLBACK (xpad_app_quit), NULL); |
3823 | 201 | gtk_container_add (GTK_CONTAINER (menu), item); | 205 | gtk_container_add (GTK_CONTAINER (menu), item); |
3824 | 202 | gtk_widget_show (item); | 206 | gtk_widget_show (item); |
3825 | @@ -237,9 +241,9 @@ | |||
3826 | 237 | gint n; | 241 | gint n; |
3827 | 238 | 242 | ||
3828 | 239 | pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | 243 | pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); |
3830 | 240 | // Order pads according to title. | 244 | /* Order pads according to title. */ |
3831 | 241 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); | 245 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); |
3833 | 242 | // Populate list of windows. | 246 | /* Populate list of windows. */ |
3834 | 243 | for (l = pads, n = 1; l; l = l->next, n++) | 247 | for (l = pads, n = 1; l; l = l->next, n++) |
3835 | 244 | { | 248 | { |
3836 | 245 | gchar *title; | 249 | gchar *title; |
3837 | 246 | 250 | ||
3838 | === modified file 'src/xpad-undo.c' | |||
3839 | --- src/xpad-undo.c 2013-10-23 02:51:47 +0000 | |||
3840 | +++ src/xpad-undo.c 2014-06-07 00:27:40 +0000 | |||
3841 | @@ -223,8 +223,7 @@ | |||
3842 | 223 | static void | 223 | static void |
3843 | 224 | xpad_undo_begin_user_action (GtkTextBuffer *buffer, XpadUndo *undo) | 224 | xpad_undo_begin_user_action (GtkTextBuffer *buffer, XpadUndo *undo) |
3844 | 225 | { | 225 | { |
3847 | 226 | // A dirty way to silence the compiler for these unused variables. | 226 | /* A dirty way to silence the compiler for these unused variables. */ |
3846 | 227 | // Feel free to implement these variables in the way they are ment to be used. | ||
3848 | 228 | (void) buffer; | 227 | (void) buffer; |
3849 | 229 | 228 | ||
3850 | 230 | undo->priv->user_action++; | 229 | undo->priv->user_action++; |
3851 | @@ -233,8 +232,7 @@ | |||
3852 | 233 | static void | 232 | static void |
3853 | 234 | xpad_undo_end_user_action (GtkTextBuffer *buffer, XpadUndo *undo) | 233 | xpad_undo_end_user_action (GtkTextBuffer *buffer, XpadUndo *undo) |
3854 | 235 | { | 234 | { |
3857 | 236 | // A dirty way to silence the compiler for these unused variables. | 235 | /* A dirty way to silence the compiler for these unused variables. */ |
3856 | 237 | // Feel free to implement these variables in the way they are ment to be used. | ||
3858 | 238 | (void) buffer; | 236 | (void) buffer; |
3859 | 239 | 237 | ||
3860 | 240 | if (undo->priv->user_action > 0) | 238 | if (undo->priv->user_action > 0) |
3861 | @@ -263,8 +261,10 @@ | |||
3862 | 263 | return curr; | 261 | return curr; |
3863 | 264 | } | 262 | } |
3864 | 265 | 263 | ||
3867 | 266 | /* Redo is impossible after text insertion/deletion, only right after Undo (another Redo), | 264 | /* |
3868 | 267 | so we have to remove every history entry after the current one if there is any */ | 265 | * Redo is impossible after text insertion/deletion, only right after Undo (another Redo), |
3869 | 266 | * so we have to remove every history entry after the current one if there is any | ||
3870 | 267 | */ | ||
3871 | 268 | static void | 268 | static void |
3872 | 269 | xpad_undo_clear_redo_history (XpadUndo *undo) | 269 | xpad_undo_clear_redo_history (XpadUndo *undo) |
3873 | 270 | { | 270 | { |
3874 | @@ -283,8 +283,7 @@ | |||
3875 | 283 | static void | 283 | static void |
3876 | 284 | xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo) | 284 | xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo) |
3877 | 285 | { | 285 | { |
3880 | 286 | // A dirty way to silence the compiler for these unused variables. | 286 | /* A dirty way to silence the compiler for these unused variables. */ |
3879 | 287 | // Feel free to implement these variables in the way they are ment to be used. | ||
3881 | 288 | (void) buffer; | 287 | (void) buffer; |
3882 | 289 | 288 | ||
3883 | 290 | if (undo->priv->frozen) | 289 | if (undo->priv->frozen) |
3884 | @@ -299,15 +298,17 @@ | |||
3885 | 299 | 298 | ||
3886 | 300 | gint pos = gtk_text_iter_get_offset (location); | 299 | gint pos = gtk_text_iter_get_offset (location); |
3887 | 301 | 300 | ||
3889 | 302 | // safe cast | 301 | /* safe cast */ |
3890 | 303 | string_length = g_utf8_strlen (text, len); | 302 | string_length = g_utf8_strlen (text, len); |
3891 | 304 | if (string_length <= UINT_MAX) | 303 | if (string_length <= UINT_MAX) |
3892 | 305 | n_utf8_chars = (gint) string_length; | 304 | n_utf8_chars = (gint) string_length; |
3893 | 306 | else | 305 | else |
3894 | 307 | g_warning("Casting problem in undo insert text function. Please send a bugreport."); | 306 | g_warning("Casting problem in undo insert text function. Please send a bugreport."); |
3895 | 308 | 307 | ||
3898 | 309 | /* Merge similar actions. This is how Undo works in most editors, if there is a series of | 308 | /* |
3899 | 310 | 1-letter insertions - they are merge for Undo */ | 309 | * Merge similar actions. This is how Undo works in most editors, if there |
3900 | 310 | * is a series of 1-letter insertions - they are merge for Undo | ||
3901 | 311 | */ | ||
3902 | 311 | if (undo->priv->history_curr->data) | 312 | if (undo->priv->history_curr->data) |
3903 | 312 | { | 313 | { |
3904 | 313 | UserAction *prev_action = undo->priv->history_curr->data; | 314 | UserAction *prev_action = undo->priv->history_curr->data; |
3905 | @@ -315,9 +316,9 @@ | |||
3906 | 315 | if (prev_action->action_type == USER_ACTION_INSERT_TEXT) | 316 | if (prev_action->action_type == USER_ACTION_INSERT_TEXT) |
3907 | 316 | { | 317 | { |
3908 | 317 | /* series of 1-letter insertions */ | 318 | /* series of 1-letter insertions */ |
3912 | 318 | if (n_utf8_chars == 1 // this is a 1-letter insertion | 319 | if (n_utf8_chars == 1 /* this is a 1-letter insertion */ |
3913 | 319 | && pos == prev_action->end // placed right after the previous text | 320 | && pos == prev_action->end /* placed right after the previous text */ |
3914 | 320 | && (prev_action->n_utf8_chars == 1 || prev_action->merged)) // with which we should merge | 321 | && (prev_action->n_utf8_chars == 1 || prev_action->merged)) /* with which we should merge */ |
3915 | 321 | { | 322 | { |
3916 | 322 | /* if there was a space stop merging unless that was a series of spaces */ | 323 | /* if there was a space stop merging unless that was a series of spaces */ |
3917 | 323 | if ((!g_unichar_isspace ((gunichar) prev_action->text[0]) && !g_ascii_isspace ((gunichar) text[0])) || | 324 | if ((!g_unichar_isspace ((gunichar) prev_action->text[0]) && !g_ascii_isspace ((gunichar) text[0])) || |
3918 | @@ -345,13 +346,14 @@ | |||
3919 | 345 | action->n_utf8_chars = n_utf8_chars; | 346 | action->n_utf8_chars = n_utf8_chars; |
3920 | 346 | action->merged = FALSE; | 347 | action->merged = FALSE; |
3921 | 347 | 348 | ||
3926 | 348 | /* since each operation clears redo we know that there | 349 | /* |
3927 | 349 | is nothing after history_curr at this point so we | 350 | * Since each operation clears redo we know that there is nothing |
3928 | 350 | insert right after it. history_start won't change | 351 | * after history_curr at this point so we insert right after it. |
3929 | 351 | since it is a left guard - not NULL */ | 352 | * history_start won't change since it is a left guard - not NULL |
3930 | 353 | */ | ||
3931 | 352 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); | 354 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); |
3934 | 353 | // A dirty way to silence the compiler for these unused variables. | 355 | |
3935 | 354 | // Feel free to implement these variables in the way they are ment to be used. | 356 | /* A dirty way to silence the compiler for these unused variables. */ |
3936 | 355 | (void) dummy_start; | 357 | (void) dummy_start; |
3937 | 356 | 358 | ||
3938 | 357 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); | 359 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); |
3939 | @@ -363,8 +365,7 @@ | |||
3940 | 363 | static void | 365 | static void |
3941 | 364 | xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo) | 366 | xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo) |
3942 | 365 | { | 367 | { |
3945 | 366 | // A dirty way to silence the compiler for these unused variables. | 368 | /* A dirty way to silence the compiler for these unused variables. */ |
3944 | 367 | // Feel free to implement these variables in the way they are ment to be used. | ||
3946 | 368 | (void) buffer; | 369 | (void) buffer; |
3947 | 369 | 370 | ||
3948 | 370 | if (undo->priv->frozen) | 371 | if (undo->priv->frozen) |
3949 | @@ -382,7 +383,7 @@ | |||
3950 | 382 | gint end_offset = gtk_text_iter_get_offset (end); | 383 | gint end_offset = gtk_text_iter_get_offset (end); |
3951 | 383 | gint len = abs (end_offset - start_offset); | 384 | gint len = abs (end_offset - start_offset); |
3952 | 384 | 385 | ||
3954 | 385 | // safe cast | 386 | /* safe cast */ |
3955 | 386 | string_length = g_utf8_strlen (text, len); | 387 | string_length = g_utf8_strlen (text, len); |
3956 | 387 | if (string_length <= UINT_MAX) | 388 | if (string_length <= UINT_MAX) |
3957 | 388 | n_utf8_chars = (gint) string_length; | 389 | n_utf8_chars = (gint) string_length; |
3958 | @@ -399,8 +400,8 @@ | |||
3959 | 399 | action->merged = FALSE; | 400 | action->merged = FALSE; |
3960 | 400 | 401 | ||
3961 | 401 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); | 402 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); |
3964 | 402 | // A dirty way to silence the compiler for these unused variables. | 403 | |
3965 | 403 | // Feel free to implement these variables in the way they are ment to be used. | 404 | /* A dirty way to silence the compiler for these unused variables. */ |
3966 | 404 | (void) dummy_start; | 405 | (void) dummy_start; |
3967 | 405 | 406 | ||
3968 | 406 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); | 407 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); |
3969 | @@ -428,8 +429,8 @@ | |||
3970 | 428 | action->merged = FALSE; | 429 | action->merged = FALSE; |
3971 | 429 | 430 | ||
3972 | 430 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); | 431 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); |
3975 | 431 | // A dirty way to silence the compiler for these unused variables. | 432 | |
3976 | 432 | // Feel free to implement these variables in the way they are ment to be used. | 433 | /* A dirty way to silence the compiler for these unused variables. */ |
3977 | 433 | (void) dummy_start; | 434 | (void) dummy_start; |
3978 | 434 | 435 | ||
3979 | 435 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); | 436 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); |
3980 | @@ -456,8 +457,8 @@ | |||
3981 | 456 | action->merged = FALSE; | 457 | action->merged = FALSE; |
3982 | 457 | 458 | ||
3983 | 458 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); | 459 | GList *dummy_start = g_list_append (undo->priv->history_curr, action); |
3986 | 459 | // A dirty way to silence the compiler for these unused variables. | 460 | |
3987 | 460 | // Feel free to implement these variables in the way they are ment to be used. | 461 | /* A dirty way to silence the compiler for these unused variables. */ |
3988 | 461 | (void) dummy_start; | 462 | (void) dummy_start; |
3989 | 462 | 463 | ||
3990 | 463 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); | 464 | undo->priv->history_curr = g_list_next (undo->priv->history_curr); |
3991 | 464 | 465 | ||
3992 | === modified file 'xpad.desktop.in' | |||
3993 | --- xpad.desktop.in 2008-09-20 21:31:43 +0000 | |||
3994 | +++ xpad.desktop.in 2014-06-07 00:27:40 +0000 | |||
3995 | @@ -15,4 +15,4 @@ | |||
3996 | 15 | 15 | ||
3997 | 16 | Type=Application | 16 | Type=Application |
3998 | 17 | Categories=GTK;Utility; | 17 | Categories=GTK;Utility; |
4000 | 18 | 18 | X-LXQt-Need-Tray=true |