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