Merge lp:~arthurborsboom/xpad/xpad-4.3 into lp:xpad

Proposed by Arthur Borsboom
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
Reviewer Review Type Date Requested Status
Arthur Borsboom Approve
Review via email: mp+222420@code.launchpad.net

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)

To post a comment you must log in.
Revision history for this message
Arthur Borsboom (arthurborsboom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-10-24 17:01:13 +0000
+++ ChangeLog 2014-06-07 00:27:40 +0000
@@ -1,5 +1,34 @@
1<<<<<<< TREE
1Version 4.22Version 4.2
2* New: Undo/redo functionality such as CTRL-Z (#1121740)3* New: Undo/redo functionality such as CTRL-Z (#1121740)
4=======
5Version 4.3
6* New: Toolbar - ability to add multiple separators (#351775)
7* New: Toolbar - ability to add paste button on toolbar (#351775)
8* New: Preferences - Ability to set the automatic start of Xpad in the Preferences menu (#405314)
9* New: Preferences - Ability to set the wait for systray option in the Preferences menu (#405314)
10* New: Preferences - Ability to delay the start of Xpad in the Preferences menu (#405314)
11* New: Preferences - Ability to set the automatic creation of a new pad at the start of Xpad in the Preferences menu
12* New: Preferences - Ability to set the automatic open/hide/restore of all pads at the start of Xpad in the Preferences menu (#405314)
13* Fix: Toolbar - improved default toolbar items to the commonly used items
14* Fix: Toolbar - improved item names
15* Fix: Toolbar - prevented a crash when erasing toolbar items
16* Fix: Preferences - Changed description of Edit Lock into Make pads read-only
17* Fix: Preferences - Make sure that the preference window is always presented up front to the user, when requested.
18* Fix: Technical - Migrated Xpad from GTK2 to GTK3 (#1242424)
19* Fix: Technical - Replaced deprecated Glib and GTK statements
20* Fix: Technical - Improved configure.ac for better debugging and code quality
21* Fix: Technical - Corrected commenting style to C89 standard
22* Fix: Technical - Reorganized code of preferences dialog in preparation of another change
23* Fix: Technical - Prevented an error while changing the Edit lock preference
24* Fix: Technical - Prevented a crash when using command line option -n (= new pad)
25* Fix: Technical - Improve the hiding of pads at Xpad launch (#405314)
26* Fix: Technical - Added thread safe handling of new preferences
27* Fix: Technical - Ensured the use of GNU C libraries, so the readlink function is available
28
29Version 4.2
30* New: Undo functionality such as CTRL-Z (#1121740)
31>>>>>>> MERGE-SOURCE
3* New: Tray click behaviour can now be configured (#345278, #304331, #890335)32* New: Tray click behaviour can now be configured (#345278, #304331, #890335)
4* New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705)33* New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705)
5* Fix: Theme color stays after application restart (#307669)34* Fix: Theme color stays after application restart (#307669)
635
=== modified file 'INSTALL'
--- INSTALL 2009-05-02 17:21:29 +0000
+++ INSTALL 2014-06-07 00:27:40 +0000
@@ -1,19 +1,25 @@
1Installation Instructions1Installation Instructions
2*************************2*************************
33
4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,4Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
52006, 2007, 2008 Free Software Foundation, Inc.5Inc.
66
7 This file is free documentation; the Free Software Foundation gives7 Copying and distribution of this file, with or without modification,
8unlimited permission to copy, distribute and modify it.8are permitted in any medium without royalty provided the copyright
9notice and this notice are preserved. This file is offered as-is,
10without warranty of any kind.
911
10Basic Installation12Basic Installation
11==================13==================
1214
13 Briefly, the shell commands `./configure; make; make install' should15 Briefly, the shell command `./configure && make && make install'
14configure, build, and install this package. The following16should configure, build, and install this package. The following
15more-detailed instructions are generic; see the `README' file for17more-detailed instructions are generic; see the `README' file for
16instructions specific to this package.18instructions specific to this package. Some packages provide this
19`INSTALL' file but do not implement all of the features documented
20below. The lack of an optional feature in a given package is not
21necessarily a bug. More recommendations for GNU packages can be found
22in *note Makefile Conventions: (standards)Makefile Conventions.
1723
18 The `configure' shell script attempts to guess correct values for24 The `configure' shell script attempts to guess correct values for
19various system-dependent variables used during compilation. It uses25various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@
42you want to change it or regenerate `configure' using a newer version48you want to change it or regenerate `configure' using a newer version
43of `autoconf'.49of `autoconf'.
4450
45The simplest way to compile this package is:51 The simplest way to compile this package is:
4652
47 1. `cd' to the directory containing the package's source code and type53 1. `cd' to the directory containing the package's source code and type
48 `./configure' to configure the package for your system.54 `./configure' to configure the package for your system.
@@ -53,12 +59,22 @@
53 2. Type `make' to compile the package.59 2. Type `make' to compile the package.
5460
55 3. Optionally, type `make check' to run any self-tests that come with61 3. Optionally, type `make check' to run any self-tests that come with
56 the package.62 the package, generally using the just-built uninstalled binaries.
5763
58 4. Type `make install' to install the programs and any data files and64 4. Type `make install' to install the programs and any data files and
59 documentation.65 documentation. When installing into a prefix owned by root, it is
6066 recommended that the package be configured and built as a regular
61 5. You can remove the program binaries and object files from the67 user, and only the `make install' phase executed with root
68 privileges.
69
70 5. Optionally, type `make installcheck' to repeat any self-tests, but
71 this time using the binaries in their final installed location.
72 This target does not install anything. Running this target as a
73 regular user, particularly if the prior `make install' required
74 root privileges, verifies that the installation completed
75 correctly.
76
77 6. You can remove the program binaries and object files from the
62 source code directory by typing `make clean'. To also remove the78 source code directory by typing `make clean'. To also remove the
63 files that `configure' created (so you can compile the package for79 files that `configure' created (so you can compile the package for
64 a different kind of computer), type `make distclean'. There is80 a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@
67 all sorts of other programs in order to regenerate files that came83 all sorts of other programs in order to regenerate files that came
68 with the distribution.84 with the distribution.
6985
70 6. Often, you can also type `make uninstall' to remove the installed86 7. Often, you can also type `make uninstall' to remove the installed
71 files again.87 files again. In practice, not all packages have tested that
88 uninstallation works correctly, even though it is required by the
89 GNU Coding Standards.
90
91 8. Some packages, particularly those that use Automake, provide `make
92 distcheck', which can by used by developers to test that all other
93 targets like `make install' and `make uninstall' work correctly.
94 This target is generally not run by end users.
7295
73Compilers and Options96Compilers and Options
74=====================97=====================
@@ -93,7 +116,8 @@
93own directory. To do this, you can use GNU `make'. `cd' to the116own directory. To do this, you can use GNU `make'. `cd' to the
94directory where you want the object files and executables to go and run117directory where you want the object files and executables to go and run
95the `configure' script. `configure' automatically checks for the118the `configure' script. `configure' automatically checks for the
96source code in the directory that `configure' is in and in `..'.119source code in the directory that `configure' is in and in `..'. This
120is known as a "VPATH" build.
97121
98 With a non-GNU `make', it is safer to compile the package for one122 With a non-GNU `make', it is safer to compile the package for one
99architecture at a time in the source code directory. After you have123architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@
120 By default, `make install' installs the package's commands under144 By default, `make install' installs the package's commands under
121`/usr/local/bin', include files under `/usr/local/include', etc. You145`/usr/local/bin', include files under `/usr/local/include', etc. You
122can specify an installation prefix other than `/usr/local' by giving146can specify an installation prefix other than `/usr/local' by giving
123`configure' the option `--prefix=PREFIX'.147`configure' the option `--prefix=PREFIX', where PREFIX must be an
148absolute file name.
124149
125 You can specify separate installation prefixes for150 You can specify separate installation prefixes for
126architecture-specific files and architecture-independent files. If you151architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@
131 In addition, if you use an unusual directory layout you can give156 In addition, if you use an unusual directory layout you can give
132options like `--bindir=DIR' to specify different values for particular157options like `--bindir=DIR' to specify different values for particular
133kinds of files. Run `configure --help' for a list of the directories158kinds of files. Run `configure --help' for a list of the directories
134you can set and what kinds of files go in them.159you can set and what kinds of files go in them. In general, the
160default for these options is expressed in terms of `${prefix}', so that
161specifying just `--prefix' will affect all of the other directory
162specifications that were not explicitly provided.
163
164 The most portable way to affect installation locations is to pass the
165correct locations to `configure'; however, many packages provide one or
166both of the following shortcuts of passing variable assignments to the
167`make install' command line to change installation locations without
168having to reconfigure or recompile.
169
170 The first method involves providing an override variable for each
171affected directory. For example, `make install
172prefix=/alternate/directory' will choose an alternate location for all
173directory configuration variables that were expressed in terms of
174`${prefix}'. Any directories that were specified during `configure',
175but not in terms of `${prefix}', must each be overridden at install
176time for the entire installation to be relocated. The approach of
177makefile variable overrides for each directory variable is required by
178the GNU Coding Standards, and ideally causes no recompilation.
179However, some platforms have known limitations with the semantics of
180shared libraries that end up requiring recompilation when using this
181method, particularly noticeable in packages that use GNU Libtool.
182
183 The second method involves providing the `DESTDIR' variable. For
184example, `make install DESTDIR=/alternate/directory' will prepend
185`/alternate/directory' before all installation names. The approach of
186`DESTDIR' overrides is not required by the GNU Coding Standards, and
187does not work on platforms that have drive letters. On the other hand,
188it does better at avoiding recompilation issues, and works well even
189when some directory options were not specified in terms of `${prefix}'
190at `configure' time.
191
192Optional Features
193=================
135194
136 If the package supports it, you can cause programs to be installed195 If the package supports it, you can cause programs to be installed
137with an extra prefix or suffix on their names by giving `configure' the196with an extra prefix or suffix on their names by giving `configure' the
138option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.197option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
139198
140Optional Features
141=================
142
143 Some packages pay attention to `--enable-FEATURE' options to199 Some packages pay attention to `--enable-FEATURE' options to
144`configure', where FEATURE indicates an optional part of the package.200`configure', where FEATURE indicates an optional part of the package.
145They may also pay attention to `--with-PACKAGE' options, where PACKAGE201They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@
152you can use the `configure' options `--x-includes=DIR' and208you can use the `configure' options `--x-includes=DIR' and
153`--x-libraries=DIR' to specify their locations.209`--x-libraries=DIR' to specify their locations.
154210
211 Some packages offer the ability to configure how verbose the
212execution of `make' will be. For these packages, running `./configure
213--enable-silent-rules' sets the default to minimal output, which can be
214overridden with `make V=1'; while running `./configure
215--disable-silent-rules' sets the default to verbose, which can be
216overridden with `make V=0'.
217
155Particular systems218Particular systems
156==================219==================
157220
@@ -159,10 +222,15 @@
159CC is not installed, it is recommended to use the following options in222CC is not installed, it is recommended to use the following options in
160order to use an ANSI C compiler:223order to use an ANSI C compiler:
161224
162 ./configure CC="cc -Ae"225 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
163226
164and if that doesn't work, install pre-built binaries of GCC for HP-UX.227and if that doesn't work, install pre-built binaries of GCC for HP-UX.
165228
229 HP-UX `make' updates targets which have the same time stamps as
230their prerequisites, which makes it generally unusable when shipped
231generated files such as `configure' are involved. Use GNU `make'
232instead.
233
166 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot234 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
167parse its `<wchar.h>' header file. The option `-nodtk' can be used as235parse its `<wchar.h>' header file. The option `-nodtk' can be used as
168a workaround. If GNU CC is not installed, it is therefore recommended236a workaround. If GNU CC is not installed, it is therefore recommended
@@ -174,6 +242,16 @@
174242
175 ./configure CC="cc -nodtk"243 ./configure CC="cc -nodtk"
176244
245 On Solaris, don't put `/usr/ucb' early in your `PATH'. This
246directory contains several dysfunctional programs; working variants of
247these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
248in your `PATH', put it _after_ `/usr/bin'.
249
250 On Haiku, software installed for all users goes in `/boot/common',
251not `/usr/local'. It is recommended to use the following options:
252
253 ./configure --prefix=/boot/common
254
177Specifying the System Type255Specifying the System Type
178==========================256==========================
179257
@@ -189,7 +267,8 @@
189267
190where SYSTEM can have one of these forms:268where SYSTEM can have one of these forms:
191269
192 OS KERNEL-OS270 OS
271 KERNEL-OS
193272
194 See the file `config.sub' for the possible values of each field. If273 See the file `config.sub' for the possible values of each field. If
195`config.sub' isn't included in this package, then this package doesn't274`config.sub' isn't included in this package, then this package doesn't
@@ -230,9 +309,10 @@
230overridden in the site shell script).309overridden in the site shell script).
231310
232Unfortunately, this technique does not work for `CONFIG_SHELL' due to311Unfortunately, this technique does not work for `CONFIG_SHELL' due to
233an Autoconf bug. Until the bug is fixed you can use this workaround:312an Autoconf limitation. Until the limitation is lifted, you can use
313this workaround:
234314
235 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash315 CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
236316
237`configure' Invocation317`configure' Invocation
238======================318======================
@@ -277,7 +357,7 @@
277 `configure' can determine that directory automatically.357 `configure' can determine that directory automatically.
278358
279`--prefix=DIR'359`--prefix=DIR'
280 Use DIR as the installation prefix. *Note Installation Names::360 Use DIR as the installation prefix. *note Installation Names::
281 for more details, including other options available for fine-tuning361 for more details, including other options available for fine-tuning
282 the installation locations.362 the installation locations.
283363
@@ -288,4 +368,3 @@
288368
289`configure' also accepts some other, not widely useful, options. Run369`configure' also accepts some other, not widely useful, options. Run
290`configure --help' for more details.370`configure --help' for more details.
291
292371
=== modified file 'configure.ac'
--- configure.ac 2013-10-31 21:17:36 +0000
+++ configure.ac 2014-06-07 00:27:40 +0000
@@ -20,19 +20,12 @@
20# Checks for GTK+ 3.020# Checks for GTK+ 3.0
21PKG_CHECK_MODULES(GTK, gtk+-3.0 gio-2.0)21PKG_CHECK_MODULES(GTK, gtk+-3.0 gio-2.0)
22AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")22AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
23# ensure that only allowed headers are included23AC_SUBST(GTK_LIBS)
24GTK_CFLAGS+="-DGTK_DISABLE_SINGLE_INCLUDES "
25# ensure that no gtk deprecated symbols are used
26GTK_CFLAGS+="-DGDK_DISABLE_DEPRECATED "
27GTK_CFLAGS+="-DGTK_DISABLE_DEPRECATED "
28# ensure use of accessors
29GTK_CFLAGS+="-DGSEAL_ENABLE "
30AC_SUBST(GTK_CFLAGS)24AC_SUBST(GTK_CFLAGS)
31AC_SUBST(GTK_LIBS)
3225
33PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38)26PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38)
27AC_SUBST(GLIB_LIBS)
34AC_SUBST(GLIB_CFLAGS)28AC_SUBST(GLIB_CFLAGS)
35AC_SUBST(GLIB_LIBS)
3629
37PKG_CHECK_MODULES(PANGO, pango >= 1.32)30PKG_CHECK_MODULES(PANGO, pango >= 1.32)
38AC_SUBST(PANGO_LIBS)31AC_SUBST(PANGO_LIBS)
@@ -46,6 +39,9 @@
46AC_SUBST(ATK_LIBS)39AC_SUBST(ATK_LIBS)
47AC_SUBST(ATK_CFLAGS)40AC_SUBST(ATK_CFLAGS)
4841
42# Force the use of GNU libraries, for the special case of the function readlink
43AC_GNU_SOURCE
44
49# Checks for typedefs, structures, and compiler characteristics.45# Checks for typedefs, structures, and compiler characteristics.
50AC_C_CONST46AC_C_CONST
51AC_TYPE_SIZE_T47AC_TYPE_SIZE_T
@@ -71,7 +67,7 @@
71 enable_debug="$enableval",67 enable_debug="$enableval",
72 enable_debug=no)68 enable_debug=no)
73if test "$enable_debug" = "yes"; then69if test "$enable_debug" = "yes"; then
74 DEBUG_CFLAGS="-ansi -Wall -Werror -g -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_MULTIHEAD_SAFE"70 DEBUG_CFLAGS="-ansi -Wall -Werror -g -O0 -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_MULTIHEAD_SAFE -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE"
75else71else
76 DEBUG_CFLAGS=""72 DEBUG_CFLAGS=""
77fi73fi
@@ -80,4 +76,3 @@
80# Sets up output files.76# Sets up output files.
81AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile images/Makefile po/Makefile.in autopackage/Makefile autopackage/default.apspec])77AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile images/Makefile po/Makefile.in autopackage/Makefile autopackage/default.apspec])
82AC_OUTPUT78AC_OUTPUT
83
8479
=== modified file 'src/fio.c'
--- src/fio.c 2013-10-31 21:17:36 +0000
+++ src/fio.c 2014-06-07 00:27:40 +0000
@@ -67,7 +67,7 @@
67 long offset = p - *string;67 long offset = p - *string;
68 *string = g_realloc (*string, strlen (*string) + diff + 1);68 *string = g_realloc (*string, strlen (*string) + diff + 1);
69 p = *string + offset;69 p = *string + offset;
70 g_memmove (p + rsize, p + osize, strlen (p + osize) + 1);70 memmove (p + rsize, p + osize, strlen (p + osize) + 1);
71 71
72 memcpy (p, replacement, rsize);72 memcpy (p, replacement, rsize);
73 73
@@ -173,12 +173,14 @@
173 if (!buf)173 if (!buf)
174 return 1;174 return 1;
175 175
176 /* because of the way we look for a matching variable name, which is176 /*
177 to look for an endline, the variable name, and a space, we insert a177 * because of the way we look for a matching variable name, which is
178 newline at the beginning, so that the first variable name is caught. */178 * to look for an endline, the variable name, and a space, we insert a
179 * newline at the beginning, so that the first variable name is caught.
180 */
179 len = strlen (buf);181 len = strlen (buf);
180 buf = g_realloc (buf, len + 2);182 buf = g_realloc (buf, len + 2);
181 g_memmove (buf + 1, buf, len + 1);183 memmove (buf + 1, buf, len + 1);
182 buf[0] = '\n';184 buf[0] = '\n';
183 185
184 va_start (ap, filename);186 va_start (ap, filename);
185187
=== modified file 'src/prefix.c'
--- src/prefix.c 2013-10-23 02:51:47 +0000
+++ src/prefix.c 2014-06-07 00:27:40 +0000
@@ -45,7 +45,6 @@
45 #define BR_PTHREADS 045 #define BR_PTHREADS 0
46#endif /* BR_PTHREADS */46#endif /* BR_PTHREADS */
4747
48#define _GNU_SOURCE
49#include <stdlib.h>48#include <stdlib.h>
50#include <stdio.h>49#include <stdio.h>
51#include <limits.h>50#include <limits.h>
5251
=== modified file 'src/xpad-app.c'
--- src/xpad-app.c 2013-10-31 21:17:36 +0000
+++ src/xpad-app.c 2014-06-07 00:27:40 +0000
@@ -62,7 +62,6 @@
62#define SUN_LEN(sunp) ((size_t)((struct sockaddr_un *)0)->sun_path + strlen((sunp)->sun_path))62#define SUN_LEN(sunp) ((size_t)((struct sockaddr_un *)0)->sun_path + strlen((sunp)->sun_path))
63#endif63#endif
6464
65
66static gint xpad_argc;65static gint xpad_argc;
67static gchar **xpad_argv;66static gchar **xpad_argv;
68static gboolean option_nonew;67static gboolean option_nonew;
@@ -84,18 +83,17 @@
84XpadSettings *xpad_global_settings;83XpadSettings *xpad_global_settings;
8584
86static gboolean process_local_args (gint *argc, gchar **argv[]);85static gboolean process_local_args (gint *argc, gchar **argv[]);
87static gboolean process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk);86static gboolean process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk, XpadSettings *xpad_settings);
8887
89static gboolean config_dir_exists (void);88static gboolean config_dir_exists (void);
90static gchar *make_config_dir (void);89static gchar *make_config_dir (void);
91static void register_stock_icons (void);90static void register_stock_icons (void);
92static gint xpad_app_load_pads (void);91static gint xpad_app_load_pads (void);
93static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group);92static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group);
94static gboolean xpad_app_first_idle_check (XpadPadGroup *group);93static gboolean xpad_app_first_idle_check (XpadPadGroup *group);
95static gboolean xpad_app_pass_args (void);94static gboolean xpad_app_pass_args (void);
96static gboolean xpad_app_open_proc_file (void);95static gboolean xpad_app_open_proc_file (void);
9796
98
99static void97static void
100xpad_app_init (int argc, char **argv)98xpad_app_init (int argc, char **argv)
101{99{
@@ -109,7 +107,7 @@
109 textdomain (GETTEXT_PACKAGE);107 textdomain (GETTEXT_PACKAGE);
110#endif108#endif
111109
112 have_gtk = gtk_init_check (&argc, &argv); // Leaves 135 referenced objects behind. No idea how to unref. Total up to here 135.110 have_gtk = gtk_init_check (&argc, &argv);
113 xpad_argc = argc;111 xpad_argc = argc;
114 xpad_argv = argv;112 xpad_argv = argv;
115 output = stdout;113 output = stdout;
@@ -129,7 +127,7 @@
129 process_local_args (&xpad_argc, &xpad_argv);127 process_local_args (&xpad_argc, &xpad_argv);
130 if (!xpad_app_pass_args ())128 if (!xpad_app_pass_args ())
131 {129 {
132 process_remote_args (&xpad_argc, &xpad_argv, FALSE);130 process_remote_args (&xpad_argc, &xpad_argv, FALSE, xpad_global_settings);
133 fprintf (output, "%s\n", _("Xpad is a graphical program. Please run it from your desktop."));131 fprintf (output, "%s\n", _("Xpad is a graphical program. Please run it from your desktop."));
134 }132 }
135 exit (0);133 exit (0);
@@ -139,7 +137,6 @@
139 gdk_set_program_class (PACKAGE);137 gdk_set_program_class (PACKAGE);
140138
141 /* Set up program path. */139 /* Set up program path. */
142
143 if (xpad_argc > 0)140 if (xpad_argc > 0)
144 program_path = g_find_program_in_path (xpad_argv[0]);141 program_path = g_find_program_in_path (xpad_argv[0]);
145 else142 else
@@ -153,30 +150,43 @@
153 /* Race condition here, between calls */150 /* Race condition here, between calls */
154 xpad_app_open_proc_file ();151 xpad_app_open_proc_file ();
155 152
156 register_stock_icons (); // Leaves 1039 referenced objects behind. No idea how to unref, except 1. Total up to here 1173.153 register_stock_icons ();
157 gtk_window_set_default_icon_name (PACKAGE);154 gtk_window_set_default_icon_name (PACKAGE);
158 155
159 pad_group = xpad_pad_group_new(); // Creates 1 referenced object; but does get unrefferenced. Total 1173.156 /* Read the Xpad configuration file from disk (if exists) */
160 process_remote_args (&xpad_argc, &xpad_argv, TRUE);157 xpad_global_settings = xpad_settings_new ();
161 158
162 xpad_tray_open (); // Creates 34 referenced objects; but only 14 get unrefferenced. Total 1193.159 /* Delay program startup, if user configured it, to wait for example for the loading of the systray. */
160 if (xpad_settings_get_autostart_delay (xpad_global_settings))
161 sleep(xpad_settings_get_autostart_delay (xpad_global_settings));
162
163 pad_group = xpad_pad_group_new();
164 process_remote_args (&xpad_argc, &xpad_argv, TRUE, xpad_global_settings);
165
166 xpad_tray_open ();
163 xpad_session_manager_init ();167 xpad_session_manager_init ();
164168
165 xpad_global_settings = xpad_settings_new (); // Creates 1 reference, 1 reference gets cleaned up. Total 1193
166
167 /* Initialize Xpad-periodic module */169 /* Initialize Xpad-periodic module */
168 Xpad_periodic_init();170 Xpad_periodic_init();
169 Xpad_periodic_set_callback("save-content", (XpadPeriodicFunc) xpad_pad_save_content);171 Xpad_periodic_set_callback("save-content", (XpadPeriodicFunc) xpad_pad_save_content);
170 Xpad_periodic_set_callback("save-info", (XpadPeriodicFunc) xpad_pad_save_info);172 Xpad_periodic_set_callback("save-info", (XpadPeriodicFunc) xpad_pad_save_info);
171 173
172 /* load all pads */174 /* load all pads */
173 pads_loaded_on_start = xpad_app_load_pads (); // each pad creates 333 references and leaves about 100 references behind. Total 1268.175 pads_loaded_on_start = xpad_app_load_pads ();
174 if (pads_loaded_on_start == 0 && !option_new) {176 if (pads_loaded_on_start == 0 && !option_new) {
175 if (!option_nonew) {177 if (!option_nonew) {
176 GtkWidget *pad = xpad_pad_new (pad_group);178 GtkWidget *pad = xpad_pad_new (pad_group);
177 gtk_widget_show (pad);179 gtk_widget_show (pad);
178 }180 }
179 }181 }
182
183 /* Since all pads have been loaded, reprocess the show/hide/toggle option for all pads */
184 if (have_gtk && (option_show))
185 xpad_pad_group_show_all (pad_group);
186 if (have_gtk && (option_hide))
187 xpad_pad_group_close_all (pad_group);
188 if (have_gtk && option_toggle)
189 xpad_pad_group_toggle_hide (pad_group);
180 190
181 g_idle_add ((GSourceFunc)xpad_app_first_idle_check, pad_group);191 g_idle_add ((GSourceFunc)xpad_app_first_idle_check, pad_group);
182 192
@@ -209,22 +219,22 @@
209 219
210 g_printerr ("%s\n", primary);220 g_printerr ("%s\n", primary);
211 221
212 dialog = xpad_app_alert_new (parent, GTK_STOCK_DIALOG_ERROR, primary, secondary);222 dialog = xpad_app_alert_dialog (parent, "dialog-error", primary, secondary);
213 gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_OK, 1, NULL);223 gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Ok"), GTK_RESPONSE_OK, NULL);
214 gtk_dialog_run (GTK_DIALOG (dialog));224 gtk_dialog_run (GTK_DIALOG (dialog));
215 gtk_widget_destroy (dialog);225 gtk_widget_destroy (dialog);
216 226
217 xpad_session_manager_stop_interact (FALSE);227 xpad_session_manager_stop_interact (FALSE);
218}228}
219229
220G_CONST_RETURN gchar *230const gchar *
221xpad_app_get_config_dir (void)231xpad_app_get_config_dir (void)
222{232{
223 return config_dir;233 return config_dir;
224}234}
225235
226/* Returns absolute path to our own executable. May be NULL. */236/* Returns absolute path to our own executable. May be NULL. */
227G_CONST_RETURN gchar *237const gchar *
228xpad_app_get_program_path (void)238xpad_app_get_program_path (void)
229{239{
230 return program_path;240 return program_path;
@@ -239,23 +249,23 @@
239void249void
240xpad_app_quit (void)250xpad_app_quit (void)
241{251{
242 // Free the memory used by the pads belonging to this group252 /* Free the memory used by the pads belonging to this group */
243 xpad_pad_group_destroy_pads (xpad_app_get_pad_group());253 xpad_pad_group_destroy_pads (xpad_app_get_pad_group());
244254
245 // Free the memory used by group.255 /* Free the memory used by group. */
246 g_object_unref (xpad_app_get_pad_group());256 g_object_unref (xpad_app_get_pad_group());
247257
248 // Free the memory used by the settings menu.258 /* Free the memory used by the settings menu. */
249 g_object_unref (xpad_global_settings);259 g_object_unref (xpad_global_settings);
250 xpad_global_settings = NULL; // This is needed due to the asynchronous finalizing process.260 xpad_global_settings = NULL; /* This is needed due to the asynchronous finalizing process. */
251261
252 // Free the memory used by the tray icon and its menu.262 /* Free the memory used by the tray icon and its menu. */
253 xpad_tray_close ();263 xpad_tray_close ();
254264
255 // Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind.265 /* Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind. */
256 g_object_unref (gtk_icon_theme_get_default ());266 g_object_unref (gtk_icon_theme_get_default ());
257267
258 // Give GTK the signal to clean the rest and quit the application.268 /* Give GTK the signal to clean the rest and quit the application. */
259 gtk_main_quit ();269 gtk_main_quit ();
260}270}
261271
@@ -338,24 +348,23 @@
338 return dir;348 return dir;
339}349}
340350
341
342/**351/**
343 * Creates an alert with 'stock' used to create an icon and parent text of 'parent',352 * Creates an alert with a named-icon used to create an icon and parent text of 'parent',
344 * secondary text of 'secondary'. No buttons are added.353 * secondary text of 'secondary'. No buttons are added.
345 */354 */
346GtkWidget *355GtkWidget *
347xpad_app_alert_new (GtkWindow *parent, const gchar *stock, const gchar *primary, const gchar *secondary)356xpad_app_alert_dialog (GtkWindow *parent, const gchar *icon_name, const gchar *primary, const gchar *secondary)
348{357{
349 GtkWidget *dialog, *hbox, *image, *label;358 GtkWidget *dialog, *hbox, *image, *label;
350 gchar *buf;359 gchar *buf;
351 360
352 dialog = gtk_dialog_new();361 dialog = gtk_dialog_new ();
353 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);362 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
354 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);363 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
355 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);364 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
356365
357 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);366 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
358 image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_DIALOG);367 image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
359 label = gtk_label_new (NULL);368 label = gtk_label_new (NULL);
360 369
361 if (secondary)370 if (secondary)
@@ -383,7 +392,6 @@
383 return dialog;392 return dialog;
384}393}
385394
386
387static void395static void
388register_stock_icons (void)396register_stock_icons (void)
389{397{
@@ -393,7 +401,6 @@
393 gtk_icon_theme_prepend_search_path (theme, THEME_DIR);401 gtk_icon_theme_prepend_search_path (theme, THEME_DIR);
394}402}
395403
396
397static gboolean404static gboolean
398xpad_app_quit_if_no_pads (XpadPadGroup *group)405xpad_app_quit_if_no_pads (XpadPadGroup *group)
399{406{
@@ -412,7 +419,6 @@
412 return FALSE;419 return FALSE;
413}420}
414421
415
416static gboolean422static gboolean
417xpad_app_first_idle_check (XpadPadGroup *group)423xpad_app_first_idle_check (XpadPadGroup *group)
418{424{
@@ -439,7 +445,6 @@
439 return FALSE;445 return FALSE;
440}446}
441447
442
443static void448static void
444xpad_app_pad_added (XpadPadGroup *group, XpadPad *pad)449xpad_app_pad_added (XpadPadGroup *group, XpadPad *pad)
445{450{
@@ -454,7 +459,7 @@
454{459{
455 gint opened = 0;460 gint opened = 0;
456 GDir *dir;461 GDir *dir;
457 G_CONST_RETURN gchar *name;462 const gchar *name;
458 463
459 g_signal_connect (pad_group, "pad-added", G_CALLBACK (xpad_app_pad_added), NULL);464 g_signal_connect (pad_group, "pad-added", G_CALLBACK (xpad_app_pad_added), NULL);
460 465
@@ -495,17 +500,6 @@
495 return opened;500 return opened;
496}501}
497502
498
499
500
501
502
503
504
505
506
507
508
509/*503/*
510converts main program arguments into one long string.504converts main program arguments into one long string.
511puts allocated string in dest, and returns size505puts allocated string in dest, and returns size
@@ -522,7 +516,7 @@
522 for (i = 0; i < argc; i++) {516 for (i = 0; i < argc; i++) {
523 string_length = strlen (argv[i]) + 1;517 string_length = strlen (argv[i]) + 1;
524518
525 // safe cast519 /* safe cast */
526 if( string_length <= UINT_MAX ) {520 if( string_length <= UINT_MAX ) {
527 size += (guint) string_length;521 size += (guint) string_length;
528 }522 }
@@ -549,7 +543,6 @@
549 return size;543 return size;
550}544}
551545
552
553/*546/*
554returns number of strings in newly allocated argv547returns number of strings in newly allocated argv
555*/548*/
@@ -576,7 +569,7 @@
576 569
577 if (tmp) {570 if (tmp) {
578 long int difference = tmp - string;571 long int difference = tmp - string;
579 // safe cast from long int to size_t572 /* safe cast from long int to size_t */
580 if (difference >= 0)573 if (difference >= 0)
581 len = (size_t) difference;574 len = (size_t) difference;
582 else {575 else {
@@ -645,19 +638,19 @@
645 /* here we redirect singleton->priv->output to the socket */638 /* here we redirect singleton->priv->output to the socket */
646 output = fdopen (client_fd, "w");639 output = fdopen (client_fd, "w");
647 640
648 if (!process_remote_args (&argc, &argv, TRUE))641 if (!process_remote_args (&argc, &argv, TRUE, xpad_global_settings))
649 {642 {
650 /* if there were no non-local arguments, insert --new as argument */643 /* if there were no non-local arguments, insert --new as argument */
651 gint c = 2;644 gint c = 2;
652 gchar **v = NULL;645 gchar **v = NULL;
653 unsigned long int my_size = 0;646 unsigned long int my_size = 0;
654 // safe cast647 /* safe cast */
655 my_size = sizeof (gchar *) * (long unsigned) c;648 my_size = sizeof (gchar *) * (long unsigned) c;
656 v = g_malloc (my_size);649 v = g_malloc (my_size);
657 v[0] = PACKAGE;650 v[0] = PACKAGE;
658 v[1] = "--new";651 v[1] = "--new";
659 652
660 process_remote_args (&c, &v, TRUE);653 process_remote_args (&c, &v, TRUE, xpad_global_settings);
661 654
662 g_free (v);655 g_free (v);
663 }656 }
@@ -676,8 +669,7 @@
676static gboolean669static gboolean
677can_read_from_server_fd (GIOChannel *source, GIOCondition condition, gpointer data)670can_read_from_server_fd (GIOChannel *source, GIOCondition condition, gpointer data)
678{671{
679 // A dirty way to silence the compiler for these unused variables.672 /* A dirty way to silence the compiler for these unused variables. */
680 // Feel free to implement these variables in the way they are ment to be used.
681 (void) source;673 (void) source;
682 (void) condition;674 (void) condition;
683 (void) data;675 (void) data;
@@ -784,27 +776,6 @@
784 return connected;776 return connected;
785}777}
786778
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808/**779/**
809 * Here are the functions called when arguments are passed to us.780 * Here are the functions called when arguments are passed to us.
810 */781 */
@@ -872,7 +843,7 @@
872}843}
873844
874static gboolean845static gboolean
875process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk)846process_remote_args (gint *argc, gchar **argv[], gboolean have_gtk, XpadSettings *xpad_settings)
876{847{
877 GError *error = NULL;848 GError *error = NULL;
878 GOptionContext *context;849 GOptionContext *context;
@@ -894,21 +865,17 @@
894 if (have_gtk && option_smid)865 if (have_gtk && option_smid)
895 xpad_session_manager_set_id (option_smid);866 xpad_session_manager_set_id (option_smid);
896 867
897 if (have_gtk && option_new)868 if (have_gtk && (option_new || xpad_settings_get_autostart_new_pad (xpad_settings)))
898 {869 {
899 GtkWidget *pad = xpad_pad_new (pad_group);870 GtkWidget *pad = xpad_pad_new (pad_group);
900 gtk_widget_show (pad);871 gtk_widget_show (pad);
901 }872 }
902873
903 if (have_gtk && option_show)874 if (xpad_settings_get_autostart_display_pads (xpad_settings) == 0)
904 xpad_pad_group_show_all (pad_group);875 option_show = TRUE;
905 876 if (xpad_settings_get_autostart_display_pads (xpad_settings) == 1)
906 if (have_gtk && option_hide)877 option_hide = TRUE;
907 xpad_pad_group_close_all (pad_group);878
908
909 if (have_gtk && option_toggle)
910 xpad_pad_group_toggle_hide (pad_group);
911
912 if (have_gtk && option_files)879 if (have_gtk && option_files)
913 {880 {
914 int i;881 int i;
915882
=== modified file 'src/xpad-app.h'
--- src/xpad-app.h 2013-10-31 21:17:36 +0000
+++ src/xpad-app.h 2014-06-07 00:27:40 +0000
@@ -26,10 +26,10 @@
26G_BEGIN_DECLS26G_BEGIN_DECLS
2727
28void xpad_app_error (GtkWindow *parent, const gchar *primary, const gchar *secondary);28void xpad_app_error (GtkWindow *parent, const gchar *primary, const gchar *secondary);
29GtkWidget *xpad_app_alert_new (GtkWindow *parent, const gchar *stock, const gchar *primary, const gchar *secondary);29GtkWidget *xpad_app_alert_dialog (GtkWindow *parent, const gchar *icon_name, const gchar *primary, const gchar *secondary);
3030
31G_CONST_RETURN gchar *xpad_app_get_config_dir (void);31const gchar *xpad_app_get_config_dir (void);
32G_CONST_RETURN gchar *xpad_app_get_program_path (void);32const gchar *xpad_app_get_program_path (void);
33XpadPadGroup *xpad_app_get_pad_group (void);33XpadPadGroup *xpad_app_get_pad_group (void);
34XpadSettings *xpad_global_settings;34XpadSettings *xpad_global_settings;
35gboolean xpad_app_get_translucent (void);35gboolean xpad_app_get_translucent (void);
3636
=== modified file 'src/xpad-pad-group.c'
--- src/xpad-pad-group.c 2013-10-31 21:17:36 +0000
+++ src/xpad-pad-group.c 2014-06-07 00:27:40 +0000
@@ -95,7 +95,7 @@
95{95{
96 XpadPadGroup *group = XPAD_PAD_GROUP (object);96 XpadPadGroup *group = XPAD_PAD_GROUP (object);
9797
98 // Save all pads of this group98 /* Save all pads of this group */
99 xpad_pad_group_save_unsaved_all(group);99 xpad_pad_group_save_unsaved_all(group);
100100
101 G_OBJECT_CLASS (xpad_pad_group_parent_class)->dispose (object);101 G_OBJECT_CLASS (xpad_pad_group_parent_class)->dispose (object);
@@ -123,7 +123,6 @@
123xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad)123xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad)
124{124{
125 g_object_ref(pad);125 g_object_ref(pad);
126 // g_object_ref_sink(GTK_OBJECT(pad));
127 126
128 group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad));127 group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad));
129 g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group);128 g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group);
130129
=== modified file 'src/xpad-pad-properties.c'
--- src/xpad-pad-properties.c 2013-10-31 21:17:36 +0000
+++ src/xpad-pad-properties.c 2014-06-07 00:27:40 +0000
@@ -273,8 +273,7 @@
273static void273static void
274change_text_color (GtkColorButton *button, XpadPadProperties *prop)274change_text_color (GtkColorButton *button, XpadPadProperties *prop)
275{275{
276 // A dirty way to silence the compiler for these unused variables.276 /* A dirty way to silence the compiler for these unused variables. */
277 // Feel free to implement these variables in the way they are ment to be used.
278 (void) button;277 (void) button;
279278
280 g_object_notify (G_OBJECT (prop), "text-color");279 g_object_notify (G_OBJECT (prop), "text-color");
@@ -283,8 +282,7 @@
283static void282static void
284change_back_color (GtkColorButton *button, XpadPadProperties *prop)283change_back_color (GtkColorButton *button, XpadPadProperties *prop)
285{284{
286 // A dirty way to silence the compiler for these unused variables.285 /* A dirty way to silence the compiler for these unused variables. */
287 // Feel free to implement these variables in the way they are ment to be used.
288 (void) button;286 (void) button;
289287
290 g_object_notify (G_OBJECT (prop), "back-color");288 g_object_notify (G_OBJECT (prop), "back-color");
@@ -293,8 +291,7 @@
293static void291static void
294change_font_face (GtkFontButton *button, XpadPadProperties *prop)292change_font_face (GtkFontButton *button, XpadPadProperties *prop)
295{293{
296 // A dirty way to silence the compiler for these unused variables.294 /* A dirty way to silence the compiler for these unused variables. */
297 // Feel free to implement these variables in the way they are ment to be used.
298 (void) button;295 (void) button;
299296
300 g_object_notify (G_OBJECT (prop), "fontname");297 g_object_notify (G_OBJECT (prop), "fontname");
@@ -333,7 +330,7 @@
333 g_object_notify (G_OBJECT (prop), "back_color");330 g_object_notify (G_OBJECT (prop), "back_color");
334}331}
335332
336G_CONST_RETURN GdkRGBA *333const GdkRGBA *
337xpad_pad_properties_get_back_color (XpadPadProperties *prop)334xpad_pad_properties_get_back_color (XpadPadProperties *prop)
338{335{
339 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp);336 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp);
@@ -347,7 +344,7 @@
347 g_object_notify (G_OBJECT (prop), "text_color");344 g_object_notify (G_OBJECT (prop), "text_color");
348}345}
349346
350G_CONST_RETURN GdkRGBA *347const GdkRGBA *
351xpad_pad_properties_get_text_color (XpadPadProperties *prop)348xpad_pad_properties_get_text_color (XpadPadProperties *prop)
352{349{
353 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp);350 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp);
@@ -361,7 +358,7 @@
361 g_object_notify (G_OBJECT (prop), "fontname");358 g_object_notify (G_OBJECT (prop), "fontname");
362}359}
363360
364G_CONST_RETURN gchar *xpad_pad_properties_get_fontname (XpadPadProperties *prop)361const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *prop)
365{362{
366 return gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton));363 return gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton));
367}364}
368365
=== modified file 'src/xpad-pad-properties.h'
--- src/xpad-pad-properties.h 2013-10-31 21:17:36 +0000
+++ src/xpad-pad-properties.h 2014-06-07 00:27:40 +0000
@@ -59,13 +59,13 @@
59gboolean xpad_pad_properties_get_follow_color_style (XpadPadProperties *pad_properties);59gboolean xpad_pad_properties_get_follow_color_style (XpadPadProperties *pad_properties);
6060
61void xpad_pad_properties_set_back_color (XpadPadProperties *pad_properties, const GdkRGBA *back);61void xpad_pad_properties_set_back_color (XpadPadProperties *pad_properties, const GdkRGBA *back);
62G_CONST_RETURN GdkRGBA *xpad_pad_properties_get_back_color (XpadPadProperties *pad_properties);62const GdkRGBA *xpad_pad_properties_get_back_color (XpadPadProperties *pad_properties);
6363
64void xpad_pad_properties_set_text_color (XpadPadProperties *pad_properties, const GdkRGBA *text);64void xpad_pad_properties_set_text_color (XpadPadProperties *pad_properties, const GdkRGBA *text);
65G_CONST_RETURN GdkRGBA *xpad_pad_properties_get_text_color (XpadPadProperties *pad_properties);65const GdkRGBA *xpad_pad_properties_get_text_color (XpadPadProperties *pad_properties);
6666
67void xpad_pad_properties_set_fontname (XpadPadProperties *pad_properties, const gchar *fontname);67void xpad_pad_properties_set_fontname (XpadPadProperties *pad_properties, const gchar *fontname);
68G_CONST_RETURN gchar *xpad_pad_properties_get_fontname (XpadPadProperties *pad_properties);68const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *pad_properties);
6969
70G_END_DECLS70G_END_DECLS
7171
7272
=== modified file 'src/xpad-pad.c'
--- src/xpad-pad.c 2013-11-01 20:16:37 +0000
+++ src/xpad-pad.c 2014-06-07 00:27:40 +0000
@@ -241,7 +241,7 @@
241 pad->priv->height = xpad_settings_get_height (xpad_global_settings);241 pad->priv->height = xpad_settings_get_height (xpad_global_settings);
242 pad->priv->infoname = NULL;242 pad->priv->infoname = NULL;
243 pad->priv->contentname = NULL;243 pad->priv->contentname = NULL;
244 pad->priv->sticky = xpad_settings_get_sticky (xpad_global_settings);244 pad->priv->sticky = xpad_settings_get_autostart_sticky (xpad_global_settings);
245 pad->priv->textview = NULL;245 pad->priv->textview = NULL;
246 pad->priv->scrollbar = NULL;246 pad->priv->scrollbar = NULL;
247 pad->priv->toolbar = NULL;247 pad->priv->toolbar = NULL;
@@ -289,7 +289,7 @@
289289
290 gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_global_settings));290 gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_global_settings));
291 gtk_window_set_default_size (GTK_WINDOW(pad), (gint) xpad_settings_get_width (xpad_global_settings), (gint) xpad_settings_get_height (xpad_global_settings));291 gtk_window_set_default_size (GTK_WINDOW(pad), (gint) xpad_settings_get_width (xpad_global_settings), (gint) xpad_settings_get_height (xpad_global_settings));
292 gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); // static gravity makes saving pad x,y work292 gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */
293 gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_global_settings));293 gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_global_settings));
294 gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_global_settings));294 gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_global_settings));
295 gtk_window_set_type_hint (GTK_WINDOW(pad), GDK_WINDOW_TYPE_HINT_NORMAL);295 gtk_window_set_type_hint (GTK_WINDOW(pad), GDK_WINDOW_TYPE_HINT_NORMAL);
@@ -318,7 +318,7 @@
318 gtk_widget_hide (pad->priv->toolbar);318 gtk_widget_hide (pad->priv->toolbar);
319 xpad_pad_notify_has_toolbar (pad);319 xpad_pad_notify_has_toolbar (pad);
320320
321 // Set up signals321 /* Set up signals */
322 gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK);322 gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK);
323 gtk_widget_add_events (pad->priv->toolbar, GDK_ALL_EVENTS_MASK);323 gtk_widget_add_events (pad->priv->toolbar, GDK_ALL_EVENTS_MASK);
324 g_signal_connect (pad->priv->textview, "button-press-event", G_CALLBACK (xpad_pad_text_view_button_press_event), pad);324 g_signal_connect (pad->priv->textview, "button-press-event", G_CALLBACK (xpad_pad_text_view_button_press_event), pad);
@@ -381,12 +381,12 @@
381 pad->priv->highlight_menu = NULL;381 pad->priv->highlight_menu = NULL;
382 }382 }
383383
384 // For some reason the clipboard handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error.384 /* For some reason the clipboard handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. */
385 if (GTK_IS_CLIPBOARD(pad->priv->clipboard)) {385 if (GTK_IS_CLIPBOARD(pad->priv->clipboard)) {
386 g_signal_handlers_disconnect_matched (pad->priv->clipboard, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad);386 g_signal_handlers_disconnect_matched (pad->priv->clipboard, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad);
387 }387 }
388388
389 // For some reason the toolbar handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error.389 /* For some reason the toolbar handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. */
390 if (XPAD_IS_TOOLBAR(pad->priv->toolbar)) {390 if (XPAD_IS_TOOLBAR(pad->priv->toolbar)) {
391 g_signal_handlers_disconnect_matched (pad->priv->toolbar, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad);391 g_signal_handlers_disconnect_matched (pad->priv->toolbar, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad);
392 gtk_widget_destroy(pad->priv->toolbar);392 gtk_widget_destroy(pad->priv->toolbar);
@@ -470,7 +470,9 @@
470 This is good, as some WMs don't like us changing the above parameters mid-run,470 This is good, as some WMs don't like us changing the above parameters mid-run,
471 even if we do a hide/show cycle. */471 even if we do a hide/show cycle. */
472 gtk_window_set_default_size (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height);472 gtk_window_set_default_size (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height);
473 gtk_window_reshow_with_initial_size (GTK_WINDOW (pad));473 gtk_widget_hide(GTK_WIDGET (pad));
474 gtk_widget_unrealize(GTK_WIDGET (pad));
475 gtk_widget_show(GTK_WIDGET (pad));
474}476}
475477
476static guint478static guint
@@ -488,7 +490,7 @@
488 &textx, &texty);490 &textx, &texty);
489 gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y);491 gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y);
490492
491 // Safe cast from gint to guint493 /* Safe cast from gint to guint */
492 if (y >= 0) {494 if (y >= 0) {
493 return (guint) y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview));495 return (guint) y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview));
494 }496 }
@@ -511,7 +513,7 @@
511 if (!pad->priv->toolbar_height)513 if (!pad->priv->toolbar_height)
512 {514 {
513 gtk_widget_get_preferred_size (pad->priv->toolbar, &req, NULL);515 gtk_widget_get_preferred_size (pad->priv->toolbar, &req, NULL);
514 // safe cast from gint to guint516 /* safe cast from gint to guint */
515 if (req.height >= 0) {517 if (req.height >= 0) {
516 pad->priv->toolbar_height = (guint) req.height;518 pad->priv->toolbar_height = (guint) req.height;
517 }519 }
@@ -625,7 +627,7 @@
625 g_return_if_fail (pad);627 g_return_if_fail (pad);
626628
627 XpadToolbar *toolbar = NULL;629 XpadToolbar *toolbar = NULL;
628 // safe cast to toolbar630 /* safe cast to toolbar */
629 if (XPAD_IS_TOOLBAR (pad->priv->toolbar)) {631 if (XPAD_IS_TOOLBAR (pad->priv->toolbar)) {
630 toolbar = XPAD_TOOLBAR (pad->priv->toolbar);632 toolbar = XPAD_TOOLBAR (pad->priv->toolbar);
631 g_return_if_fail (toolbar);633 g_return_if_fail (toolbar);
@@ -758,7 +760,7 @@
758{760{
759 g_return_if_fail (pad);761 g_return_if_fail (pad);
760762
761 // With the delayed saving functionality, it is necessary to clear the unsaved flags to prevent usage of non-existing object information.763 /* With the delayed saving functionality, it is necessary to clear the unsaved flags to prevent usage of non-existing object information. */
762 pad->priv->unsaved_info = FALSE;764 pad->priv->unsaved_info = FALSE;
763 pad->priv->unsaved_content = FALSE;765 pad->priv->unsaved_content = FALSE;
764766
@@ -766,31 +768,29 @@
766 {768 {
767 GtkWidget *dialog;769 GtkWidget *dialog;
768 gint response;770 gint response;
769 771
770 dialog = xpad_app_alert_new (GTK_WINDOW (pad), GTK_STOCK_DIALOG_WARNING,772 dialog = xpad_app_alert_dialog (GTK_WINDOW (pad), "dialog-warning", _("Delete this pad?"), _("All text of this pad will be irrevocably lost."));
771 _("Delete this pad?"),
772 _("All text of this pad will be irrevocably lost."));
773 773
774 if (!dialog)774 if (!dialog)
775 return;775 return;
776 776
777 gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, 1, GTK_STOCK_DELETE, 2, NULL);777 gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Delete"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_REJECT, NULL);
778 778
779 response = gtk_dialog_run (GTK_DIALOG (dialog));779 response = gtk_dialog_run (GTK_DIALOG (dialog));
780 780
781 gtk_widget_destroy (dialog);781 gtk_widget_destroy (dialog);
782 782
783 if (response != 2)783 if (response != GTK_RESPONSE_ACCEPT)
784 return;784 return;
785 }785 }
786 786
787 // These two if statements actually erase the pad on the harddisk.787 /* These two if statements actually erase the pad on the harddisk. */
788 if (pad->priv->infoname)788 if (pad->priv->infoname)
789 fio_remove_file (pad->priv->infoname);789 fio_remove_file (pad->priv->infoname);
790 if (pad->priv->contentname)790 if (pad->priv->contentname)
791 fio_remove_file (pad->priv->contentname);791 fio_remove_file (pad->priv->contentname);
792 792
793 // Remove the pad from the group and destroy it.793 /* Remove the pad from the group and destroy it. */
794 gtk_widget_destroy (GTK_WIDGET (pad));794 gtk_widget_destroy (GTK_WIDGET (pad));
795}795}
796796
@@ -847,7 +847,7 @@
847847
848 if (xpad_pad_properties_get_follow_color_style (prop))848 if (xpad_pad_properties_get_follow_color_style (prop))
849 {849 {
850 // Set the colors to the global preferences colors850 /* Set the colors to the global preferences colors */
851 const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings);851 const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings);
852 const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings);852 const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings);
853853
@@ -855,13 +855,13 @@
855 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color);855 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color);
856 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color);856 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color);
857857
858 // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors.858 /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */
859 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color);859 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color);
860 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color);860 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color);
861 }861 }
862 else862 else
863 {863 {
864 // Set the color to the individual pad properties colors864 /* Set the color to the individual pad properties colors */
865 const GdkRGBA *text_color = xpad_pad_properties_get_text_color (prop);865 const GdkRGBA *text_color = xpad_pad_properties_get_text_color (prop);
866 const GdkRGBA *back_color = xpad_pad_properties_get_back_color (prop);866 const GdkRGBA *back_color = xpad_pad_properties_get_back_color (prop);
867867
@@ -869,7 +869,7 @@
869 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color);869 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color);
870 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color);870 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, back_color);
871871
872 // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors.872 /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */
873 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color);873 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, back_color);
874 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color);874 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, text_color);
875 }875 }
@@ -955,8 +955,7 @@
955static void955static void
956xpad_pad_text_changed (XpadPad *pad, GtkTextBuffer *buffer)956xpad_pad_text_changed (XpadPad *pad, GtkTextBuffer *buffer)
957{957{
958 // A dirty way to silence the compiler for these unused variables.958 /* A dirty way to silence the compiler for these unused variables. */
959 // Feel free to implement these variables in the way they are ment to be used.
960 (void) buffer;959 (void) buffer;
961960
962 /* set title */961 /* set title */
@@ -969,7 +968,7 @@
969static gboolean968static gboolean
970xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event)969xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event)
971{970{
972 // safe cast from gint to guint971 /* safe cast from gint to guint */
973 if (event->height >= 0) {972 if (event->height >= 0) {
974 pad->priv->toolbar_height = (guint) event->height;973 pad->priv->toolbar_height = (guint) event->height;
975 }974 }
@@ -989,7 +988,7 @@
989 int eWidth = event->width;988 int eWidth = event->width;
990 int eHeight = event->height;989 int eHeight = event->height;
991 990
992 // safe cast from gint to guint991 /* safe cast from gint to guint */
993 if (eWidth >= 0 && eHeight >=0 ) {992 if (eWidth >= 0 && eHeight >=0 ) {
994 if (pad->priv->width != (guint) eWidth || pad->priv->height != (guint) eHeight)993 if (pad->priv->width != (guint) eWidth || pad->priv->height != (guint) eHeight)
995 pad->priv->toolbar_pad_resized = TRUE;994 pad->priv->toolbar_pad_resized = TRUE;
@@ -1022,8 +1021,7 @@
1022static gboolean1021static gboolean
1023xpad_pad_delete_event (XpadPad *pad, GdkEvent *event)1022xpad_pad_delete_event (XpadPad *pad, GdkEvent *event)
1024{1023{
1025 // A dirty way to silence the compiler for these unused variables.1024 /* A dirty way to silence the compiler for these unused variables. */
1026 // Feel free to implement these variables in the way they are ment to be used.
1027 (void) event;1025 (void) event;
10281026
1029 xpad_pad_close (pad);1027 xpad_pad_close (pad);
@@ -1042,8 +1040,7 @@
1042static gboolean1040static gboolean
1043xpad_pad_text_view_button_press_event (GtkWidget *text_view, GdkEventButton *event, XpadPad *pad)1041xpad_pad_text_view_button_press_event (GtkWidget *text_view, GdkEventButton *event, XpadPad *pad)
1044{1042{
1045 // A dirty way to silence the compiler for these unused variables.1043 /* A dirty way to silence the compiler for these unused variables. */
1046 // Feel free to implement these variables in the way they are ment to be used.
1047 (void) text_view;1044 (void) text_view;
10481045
1049 if (event->type == GDK_BUTTON_PRESS)1046 if (event->type == GDK_BUTTON_PRESS)
@@ -1312,31 +1309,35 @@
13121309
1313 if (!follow_color)1310 if (!follow_color)
1314 {1311 {
1315 // If, for some reason, one of the colors could not be retrieved1312 /*
1316 // (for example due to the migration to the new GdkRGBA colors), set the color to the default.1313 * If, for some reason, one of the colors could not be retrieved
1314 * (for example due to the migration to the new GdkRGBA colors),
1315 * set the color to the default.
1316 */
1317 if (text_color_string == NULL || background_color_string == NULL) {1317 if (text_color_string == NULL || background_color_string == NULL) {
1318 text = (GdkRGBA) {0, 0, 0, 1};1318 text = (GdkRGBA) {0, 0, 0, 1};
1319 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};1319 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};
1320 }1320 }
1321 else {1321 else {
1322 // If, for some reason, the parsing of the colors fail, set the color to the default.1322 /* If, for some reason, the parsing of the colors fail, set the color to the default. */
1323 if (!gdk_rgba_parse (&text, text_color_string) || !gdk_rgba_parse (&back, background_color_string)) {1323 if (!gdk_rgba_parse (&text, text_color_string) || !gdk_rgba_parse (&back, background_color_string)) {
1324 text = (GdkRGBA) {0, 0, 0, 1};1324 text = (GdkRGBA) {0, 0, 0, 1};
1325 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};1325 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};
1326 }1326 }
1327 }1327 }
13281328
1329 // Set the text and background color for this pad, as stated in its properties file.1329 /* Set the text and background color for this pad, as stated in its properties file. */
1330 gtk_widget_override_cursor (pad->priv->textview, &text, &text);1330 gtk_widget_override_cursor (pad->priv->textview, &text, &text);
1331 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &text);1331 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &text);
1332 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &back);1332 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, &back);
13331333
1334 // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors.1334 /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */
1335 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &back);1335 gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &back);
1336 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &text);1336 gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &text);
1337 }1337 }
1338 1338
1339 /* Find the sticky notes menu setting for this pad (which is on the global default),1339 /*
1340 * Find the sticky notes menu setting for this pad (which is on the global default),
1340 * and change its setting to the setting from the info file (pad specific default).1341 * and change its setting to the setting from the info file (pad specific default).
1341 */1342 */
1342 if(GTK_IS_CONTAINER(pad->priv->menu)) {1343 if(GTK_IS_CONTAINER(pad->priv->menu)) {
@@ -1635,8 +1636,10 @@
1635static void1636static void
1636menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check)1637menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check)
1637{1638{
1638 // A dirty way to silence the compiler for these unused variables.1639 /*
1639 // Feel free to implement these variables in the way they are ment to be used.1640 * A dirty way to silence the compiler for these unused variables.
1641 * Feel free to implement these variables in the way they are ment to be used.
1642 */
1640 (void) pad;1643 (void) pad;
16411644
1642 xpad_settings_set_has_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check));1645 xpad_settings_set_has_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check));
@@ -1645,8 +1648,10 @@
1645static void1648static void
1646menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check)1649menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check)
1647{1650{
1648 // A dirty way to silence the compiler for these unused variables.1651 /*
1649 // Feel free to implement these variables in the way they are ment to be used.1652 * A dirty way to silence the compiler for these unused variables.
1653 * Feel free to implement these variables in the way they are ment to be used.
1654 */
1650 (void) pad;1655 (void) pad;
16511656
1652 xpad_settings_set_has_scrollbar (xpad_global_settings, gtk_check_menu_item_get_active (check));1657 xpad_settings_set_has_scrollbar (xpad_global_settings, gtk_check_menu_item_get_active (check));
@@ -1655,8 +1660,10 @@
1655static void1660static void
1656menu_autohide (XpadPad *pad, GtkCheckMenuItem *check)1661menu_autohide (XpadPad *pad, GtkCheckMenuItem *check)
1657{1662{
1658 // A dirty way to silence the compiler for these unused variables.1663 /*
1659 // Feel free to implement these variables in the way they are ment to be used.1664 * A dirty way to silence the compiler for these unused variables.
1665 * Feel free to implement these variables in the way they are ment to be used.
1666 */
1660 (void) pad;1667 (void) pad;
16611668
1662 xpad_settings_set_autohide_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check));1669 xpad_settings_set_autohide_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check));
@@ -1665,8 +1672,10 @@
1665static void1672static void
1666menu_decorated (XpadPad *pad, GtkCheckMenuItem *check)1673menu_decorated (XpadPad *pad, GtkCheckMenuItem *check)
1667{1674{
1668 // A dirty way to silence the compiler for these unused variables.1675 /*
1669 // Feel free to implement these variables in the way they are ment to be used.1676 * A dirty way to silence the compiler for these unused variables.
1677 * Feel free to implement these variables in the way they are ment to be used.
1678 */
1670 (void) pad;1679 (void) pad;
16711680
1672 xpad_settings_set_has_decorations (xpad_global_settings, gtk_check_menu_item_get_active (check));1681 xpad_settings_set_has_decorations (xpad_global_settings, gtk_check_menu_item_get_active (check));
@@ -1686,33 +1695,24 @@
1686 return rv;1695 return rv;
1687}1696}
16881697
1698/* FIXME: Accelerators are working but not visible for menu items with an image (icon). */
1689#define MENU_ADD(mnemonic, image, key, mask, callback) {\1699#define MENU_ADD(mnemonic, image, key, mask, callback) {\
1690 item = gtk_image_menu_item_new_with_mnemonic (mnemonic);\
1691 if (image) {\1700 if (image) {\
1692 GtkWidget *imgwidget = gtk_image_new_from_stock (image, GTK_ICON_SIZE_MENU);\1701 item = gtk_menu_item_new ();\
1693 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), imgwidget);\1702 GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);\
1694 }\1703 GdkRGBA bg = {0, 0, 0, 0};\
1695 g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\1704 gtk_widget_override_background_color (hbox, GTK_STATE_FLAG_NORMAL, &bg);\
1696 if (key)\1705 gtk_container_add (GTK_CONTAINER (hbox), gtk_image_new_from_icon_name (image, GTK_ICON_SIZE_MENU));\
1697 gtk_widget_add_accelerator(item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\1706 gtk_container_add (GTK_CONTAINER (hbox), gtk_label_new_with_mnemonic (mnemonic));\
1698 gtk_container_add (GTK_CONTAINER (menu), item);\1707 gtk_container_add (GTK_CONTAINER (item), hbox);\
1699 gtk_widget_show (item);\1708 }\
1700 }1709 else {\
17011710 item = gtk_menu_item_new_with_mnemonic (mnemonic);\
1702#define MENU_ADD_STOCK(stock, callback) {\1711 }\
1703 item = gtk_image_menu_item_new_from_stock (stock, accel_group);\1712 g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\
1704 g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\1713 if (key)\
1705 gtk_container_add (GTK_CONTAINER (menu), item);\1714 gtk_widget_add_accelerator (item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\
1706 gtk_widget_show (item);\1715 gtk_container_add (GTK_CONTAINER (menu), item);\
1707 }
1708
1709#define MENU_ADD_STOCK_WITH_ACCEL(stock, callback, key, mask) {\
1710 item = gtk_image_menu_item_new_from_stock (stock, accel_group);\
1711 g_signal_connect_swapped (item, "activate", G_CALLBACK (callback), pad);\
1712 if (key)\
1713 gtk_widget_add_accelerator(item, "activate", accel_group, key, mask, GTK_ACCEL_VISIBLE);\
1714 gtk_container_add (GTK_CONTAINER (menu), item);\
1715 gtk_widget_show (item);\
1716 }1716 }
17171717
1718#define MENU_ADD_CHECK(mnemonic, active, callback) {\1718#define MENU_ADD_CHECK(mnemonic, active, callback) {\
@@ -1720,13 +1720,11 @@
1720 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), active);\1720 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), active);\
1721 g_signal_connect_swapped (item, "toggled", G_CALLBACK (callback), pad);\1721 g_signal_connect_swapped (item, "toggled", G_CALLBACK (callback), pad);\
1722 gtk_container_add (GTK_CONTAINER (menu), item);\1722 gtk_container_add (GTK_CONTAINER (menu), item);\
1723 gtk_widget_show (item);\
1724 }1723 }
17251724
1726#define MENU_ADD_SEP() {\1725#define MENU_ADD_SEP() {\
1727 item = gtk_separator_menu_item_new ();\1726 item = gtk_separator_menu_item_new ();\
1728 gtk_container_add (GTK_CONTAINER (menu), item);\1727 gtk_container_add (GTK_CONTAINER (menu), item);\
1729 gtk_widget_show (item);\
1730 }1728 }
17311729
1732static GtkWidget *1730static GtkWidget *
@@ -1736,82 +1734,65 @@
1736 1734
1737 uppermenu = gtk_menu_new ();1735 uppermenu = gtk_menu_new ();
1738 gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group);1736 gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group);
1739 1737
1738 /* Pad submenu */
1740 item = gtk_menu_item_new_with_mnemonic (_("_Pad"));1739 item = gtk_menu_item_new_with_mnemonic (_("_Pad"));
1741 gtk_container_add (GTK_CONTAINER (uppermenu), item);1740 gtk_container_add (GTK_CONTAINER (uppermenu), item);
1742 gtk_widget_show (item);
1743
1744 menu = gtk_menu_new ();1741 menu = gtk_menu_new ();
1745 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);1742 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1746 1743 MENU_ADD (_("_New"), "document-new", 0, 0, xpad_pad_spawn);
1747 MENU_ADD_STOCK (GTK_STOCK_NEW, xpad_pad_spawn);
1748 MENU_ADD_SEP ();1744 MENU_ADD_SEP ();
1749 MENU_ADD_CHECK (_("Show on _All Workspaces"), pad->priv->sticky, menu_sticky);1745 MENU_ADD_CHECK (_("Show on _All Workspaces"), pad->priv->sticky, menu_sticky);
1750 g_object_set_data (G_OBJECT (uppermenu), "sticky", item);1746 g_object_set_data (G_OBJECT (uppermenu), "sticky", item);
1751 MENU_ADD_STOCK (GTK_STOCK_PROPERTIES, xpad_pad_open_properties);1747 MENU_ADD (_("_Properties"), "document-properties", 0, 0, xpad_pad_open_properties);
1752 MENU_ADD_SEP ();1748 MENU_ADD_SEP ();
1753 MENU_ADD_STOCK (GTK_STOCK_CLOSE, xpad_pad_close);1749 MENU_ADD (_("_Close"), "window-close", 0, 0, xpad_pad_close);
1754 MENU_ADD_STOCK (GTK_STOCK_DELETE, xpad_pad_delete);1750 MENU_ADD (_("_Delete"), "edit-delete", 0, 0, xpad_pad_delete);
1755 1751
1752 /* Edit submenu */
1756 item = gtk_menu_item_new_with_mnemonic (_("_Edit"));1753 item = gtk_menu_item_new_with_mnemonic (_("_Edit"));
1757 gtk_container_add (GTK_CONTAINER (uppermenu), item);1754 gtk_container_add (GTK_CONTAINER (uppermenu), item);
1758 gtk_widget_show (item);
1759
1760 menu = gtk_menu_new ();1755 menu = gtk_menu_new ();
1761 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);1756 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1762 1757 MENU_ADD (_("_Undo"), "edit-undo", GDK_KEY_Z, GDK_CONTROL_MASK, menu_undo);
1763 MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_UNDO, menu_undo, GDK_KEY_Z, GDK_CONTROL_MASK);
1764 g_object_set_data (G_OBJECT (uppermenu), "undo", item);1758 g_object_set_data (G_OBJECT (uppermenu), "undo", item);
1765 1759 MENU_ADD (_("_Redo"), "edit-redo", GDK_KEY_R, GDK_CONTROL_MASK, menu_redo);
1766 MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_REDO, menu_redo, GDK_KEY_R, GDK_CONTROL_MASK);
1767 g_object_set_data (G_OBJECT (uppermenu), "redo", item);1760 g_object_set_data (G_OBJECT (uppermenu), "redo", item);
1768
1769 MENU_ADD_SEP();1761 MENU_ADD_SEP();
1770 1762 MENU_ADD (_("_Paste"), "edit-paste", 0, 0, menu_paste);
1771 MENU_ADD_STOCK (GTK_STOCK_PASTE, menu_paste);
1772 g_object_set_data (G_OBJECT (uppermenu), "paste", item);1763 g_object_set_data (G_OBJECT (uppermenu), "paste", item);
1773
1774 MENU_ADD_SEP ();1764 MENU_ADD_SEP ();
1765 MENU_ADD (_("_Preferences"), "preferences-system", 0, 0, xpad_pad_open_preferences);
17751766
1776 MENU_ADD_STOCK (GTK_STOCK_PREFERENCES, xpad_pad_open_preferences);1767 /* View submenu */
1777
1778
1779 item = gtk_menu_item_new_with_mnemonic (_("_View"));1768 item = gtk_menu_item_new_with_mnemonic (_("_View"));
1780 gtk_container_add (GTK_CONTAINER (uppermenu), item);1769 gtk_container_add (GTK_CONTAINER (uppermenu), item);
1781 gtk_widget_show (item);
1782
1783 menu = gtk_menu_new ();1770 menu = gtk_menu_new ();
1784 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);1771 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1785
1786 MENU_ADD_CHECK (_("_Toolbar"), xpad_settings_get_has_toolbar (xpad_global_settings), menu_toolbar);1772 MENU_ADD_CHECK (_("_Toolbar"), xpad_settings_get_has_toolbar (xpad_global_settings), menu_toolbar);
1787 MENU_ADD_CHECK (_("_Autohide Toolbar"), xpad_settings_get_autohide_toolbar (xpad_global_settings), menu_autohide);1773 MENU_ADD_CHECK (_("_Autohide Toolbar"), xpad_settings_get_autohide_toolbar (xpad_global_settings), menu_autohide);
1788 gtk_widget_set_sensitive (item, xpad_settings_get_has_toolbar (xpad_global_settings));1774 gtk_widget_set_sensitive (item, xpad_settings_get_has_toolbar (xpad_global_settings));
1789 MENU_ADD_CHECK (_("_Scrollbar"), xpad_settings_get_has_scrollbar (xpad_global_settings), menu_scrollbar);1775 MENU_ADD_CHECK (_("_Scrollbar"), xpad_settings_get_has_scrollbar (xpad_global_settings), menu_scrollbar);
1790 MENU_ADD_CHECK (_("_Window Decorations"), xpad_settings_get_has_decorations (xpad_global_settings), menu_decorated);1776 MENU_ADD_CHECK (_("_Window Decorations"), xpad_settings_get_has_decorations (xpad_global_settings), menu_decorated);
1791 1777
1792 1778 /* Notes submenu */
1793 item = gtk_menu_item_new_with_mnemonic (_("_Notes"));1779 item = gtk_menu_item_new_with_mnemonic (_("_Notes"));
1794 gtk_container_add (GTK_CONTAINER (uppermenu), item);1780 gtk_container_add (GTK_CONTAINER (uppermenu), item);
1795 gtk_widget_show (item);
1796
1797 menu = gtk_menu_new ();1781 menu = gtk_menu_new ();
1798 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);1782 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1799 g_object_set_data (G_OBJECT (uppermenu), "notes-menu", menu);1783 g_object_set_data (G_OBJECT (uppermenu), "notes-menu", menu);
1800
1801 MENU_ADD (_("_Show All"), NULL, 0, 0, menu_show_all);1784 MENU_ADD (_("_Show All"), NULL, 0, 0, menu_show_all);
1802 MENU_ADD (_("_Close All"), NULL, 0, 0, xpad_pad_close_all);1785 MENU_ADD (_("_Close All"), NULL, 0, 0, xpad_pad_close_all);
1803 1786
1804 /* The rest of the notes menu will get set up in the prep function below */1787 /* Help submenu */
1805
1806 item = gtk_menu_item_new_with_mnemonic (_("_Help"));1788 item = gtk_menu_item_new_with_mnemonic (_("_Help"));
1807 gtk_container_add (GTK_CONTAINER (uppermenu), item);1789 gtk_container_add (GTK_CONTAINER (uppermenu), item);
1808 gtk_widget_show (item);
1809
1810 menu = gtk_menu_new ();1790 menu = gtk_menu_new ();
1811 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);1791 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1792 MENU_ADD (_("_Help"), "help-browser", GDK_KEY_F1, 0, show_help);
1793 MENU_ADD (_("_About"), "help-about", 0, 0, menu_about);
1812 1794
1813 MENU_ADD (_("_Contents"), GTK_STOCK_HELP, GDK_KEY_F1, 0, show_help);1795 gtk_widget_show_all (uppermenu);
1814 MENU_ADD (_("_About"), GTK_STOCK_ABOUT, 0, 0, menu_about);
1815 1796
1816 return uppermenu;1797 return uppermenu;
1817}1798}
@@ -1909,15 +1890,17 @@
1909 menu = gtk_menu_new ();1890 menu = gtk_menu_new ();
1910 gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);1891 gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);
1911 1892
1912 MENU_ADD_STOCK (GTK_STOCK_CUT, menu_cut);1893 MENU_ADD (_("Cu_t"), "edit-cut", 0, 0, menu_cut);
1913 MENU_ADD_STOCK (GTK_STOCK_COPY, menu_copy);1894 MENU_ADD (_("_Copy"), "edit-copy", 0, 0, menu_copy);
1914 MENU_ADD_STOCK (GTK_STOCK_PASTE, menu_paste);1895 MENU_ADD (_("_Paste"), "edit-paste", 0, 0, menu_paste);
1915 g_object_set_data (G_OBJECT (menu), "paste", item);1896 g_object_set_data (G_OBJECT (menu), "paste", item);
1916 MENU_ADD_SEP ();1897 MENU_ADD_SEP ();
1917 MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_BOLD, menu_bold, GDK_KEY_b, GDK_CONTROL_MASK);1898 MENU_ADD (_("_Bold"), "format-text-bold", GDK_KEY_b, GDK_CONTROL_MASK, menu_bold);
1918 MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_ITALIC, menu_italic, GDK_KEY_i, GDK_CONTROL_MASK);1899 MENU_ADD (_("_Italic"), "format-text-italic", GDK_KEY_i, GDK_CONTROL_MASK, menu_italic);
1919 MENU_ADD_STOCK_WITH_ACCEL (GTK_STOCK_UNDERLINE, menu_underline, GDK_KEY_u, GDK_CONTROL_MASK);1900 MENU_ADD (_("_Underline"), "format-text-underline", GDK_KEY_u, GDK_CONTROL_MASK, menu_underline);
1920 MENU_ADD_STOCK (GTK_STOCK_STRIKETHROUGH, menu_strikethrough);1901 MENU_ADD (_("_Strikethrough"), "format-text-strikethrough", 0, 0, menu_strikethrough);
1902
1903 gtk_widget_show_all (menu);
1921 1904
1922 return menu;1905 return menu;
1923}1906}
@@ -1925,8 +1908,7 @@
1925static void1908static void
1926menu_prep_popup_highlight (XpadPad *pad, GtkWidget *menu)1909menu_prep_popup_highlight (XpadPad *pad, GtkWidget *menu)
1927{1910{
1928 // A dirty way to silence the compiler for these unused variables.1911 /* A dirty way to silence the compiler for these unused variables. */
1929 // Feel free to implement these variables in the way they are ment to be used.
1930 (void) pad;1912 (void) pad;
19311913
1932 GtkWidget *item;1914 GtkWidget *item;
@@ -1942,8 +1924,7 @@
1942static void1924static void
1943menu_popup (GtkWidget *menu, XpadPad *pad)1925menu_popup (GtkWidget *menu, XpadPad *pad)
1944{1926{
1945 // A dirty way to silence the compiler for these unused variables.1927 /* A dirty way to silence the compiler for these unused variables. */
1946 // Feel free to implement these variables in the way they are ment to be used.
1947 (void) menu;1928 (void) menu;
19481929
1949 g_signal_handlers_block_matched (pad, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) xpad_pad_leave_notify_event, NULL);1930 g_signal_handlers_block_matched (pad, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) xpad_pad_leave_notify_event, NULL);
@@ -1953,8 +1934,7 @@
1953static void1934static void
1954menu_popdown (GtkWidget *menu, XpadPad *pad)1935menu_popdown (GtkWidget *menu, XpadPad *pad)
1955{1936{
1956 // A dirty way to silence the compiler for these unused variables.1937 /* A dirty way to silence the compiler for these unused variables. */
1957 // Feel free to implement these variables in the way they are ment to be used.
1958 (void) menu;1938 (void) menu;
19591939
1960 cairo_rectangle_int_t rect;1940 cairo_rectangle_int_t rect;
@@ -1963,14 +1943,6 @@
1963 * We must check if we disabled off of pad and start the timeout if so.1943 * We must check if we disabled off of pad and start the timeout if so.
1964 */1944 */
19651945
1966 // TODO: The replacement GTK3 function below gives a Gdk-critical error.
1967 // However when setting the rectangular to a fixed x and y position, I don't see any negative effects.
1968 // What is the reason of getting the device position for making the menu dissapear?
1969
1970 // GTK2: gdk_window_get_pointer (gtk_widget_get_window(GTK_WIDGET(pad)), &rect.x, &rect.y, NULL);
1971 // GTK3: gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (pad)), GDK_SOURCE_MOUSE, &rect.x, &rect.y, NULL);
1972 // Gdk-CRITICAL **: gdk_window_get_device_position: assertion 'GDK_IS_DEVICE (device)' failed
1973
1974 rect.x = 10;1946 rect.x = 10;
1975 rect.y = 10;1947 rect.y = 10;
1976 rect.width = 1;1948 rect.width = 1;
@@ -1991,8 +1963,7 @@
1991static void1963static void
1992xpad_pad_toolbar_popup (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad)1964xpad_pad_toolbar_popup (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad)
1993{1965{
1994 // A dirty way to silence the compiler for these unused variables.1966 /* A dirty way to silence the compiler for these unused variables. */
1995 // Feel free to implement these variables in the way they are ment to be used.
1996 (void) toolbar;1967 (void) toolbar;
19971968
1998 menu_popup (GTK_WIDGET (menu), pad);1969 menu_popup (GTK_WIDGET (menu), pad);
@@ -2001,8 +1972,7 @@
2001static void1972static void
2002xpad_pad_toolbar_popdown (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad)1973xpad_pad_toolbar_popdown (GtkWidget *toolbar, GtkMenu *menu, XpadPad *pad)
2003{1974{
2004 // A dirty way to silence the compiler for these unused variables.1975 /* A dirty way to silence the compiler for these unused variables. */
2005 // Feel free to implement these variables in the way they are ment to be used.
2006 (void) toolbar;1976 (void) toolbar;
20071977
2008 menu_popdown (GTK_WIDGET (menu), pad);1978 menu_popdown (GTK_WIDGET (menu), pad);
20091979
=== modified file 'src/xpad-periodic.c'
--- src/xpad-periodic.c 2013-10-31 21:17:36 +0000
+++ src/xpad-periodic.c 2014-06-07 00:27:40 +0000
@@ -91,8 +91,7 @@
91************************/91************************/
92gint xppd_intercept (gpointer cdata)92gint xppd_intercept (gpointer cdata)
93{93{
94 // A dirty way to silence the compiler for these unused variables.94 /* A dirty way to silence the compiler for these unused variables. */
95 // Feel free to implement these variables in the way they are ment to be used.
96 (void) cdata;95 (void) cdata;
9796
98 int cnt=0;97 int cnt=0;
@@ -231,8 +230,7 @@
231230
232gint gprint_ignore (const char * fmt, ...)231gint gprint_ignore (const char * fmt, ...)
233{232{
234 // A dirty way to silence the compiler for these unused variables.233 /* A dirty way to silence the compiler for these unused variables. */
235 // Feel free to implement these variables in the way they are ment to be used.
236 (void) fmt;234 (void) fmt;
237235
238 return 0;236 return 0;
239237
=== modified file 'src/xpad-preferences.c'
--- src/xpad-preferences.c 2013-10-31 21:17:36 +0000
+++ src/xpad-preferences.c 2014-06-07 00:27:40 +0000
@@ -24,60 +24,90 @@
24#include "xpad-app.h"24#include "xpad-app.h"
25#include "xpad-preferences.h"25#include "xpad-preferences.h"
26#include "xpad-settings.h"26#include "xpad-settings.h"
27#include <sys/types.h>
28#include <sys/stat.h>
29#include <stdio.h>
30#include <stdlib.h>
31#include <unistd.h>
2732
28struct XpadPreferencesPrivate 33struct XpadPreferencesPrivate
29{34{
30 GtkWidget *fontcheck;35 GtkWidget *fontcheck;
31 GtkWidget *antifontcheck;36 GtkWidget *antifontcheck;
37 GtkWidget *fontbutton;
32 GtkWidget *colorcheck;38 GtkWidget *colorcheck;
33 GtkWidget *anticolorcheck;39 GtkWidget *anticolorcheck;
34 GtkWidget *colorbox;40 GtkWidget *colorbox;
35 41 GtkWidget *textbutton;
42 GtkWidget *backbutton;
43 GtkWidget *autostart_xpad;
44 GtkWidget *autostart_wait_systray;
45 GtkWidget *autostart_delay;
46 GtkWidget *autostart_new_pad;
47 GtkWidget *autostart_sticky;
48 GtkWidget *autostart_display_pads;
49 GtkWidget *trayconfigbox;
36 GtkWidget *editcheck;50 GtkWidget *editcheck;
37 GtkWidget *stickycheck;
38 GtkWidget *confirmcheck;51 GtkWidget *confirmcheck;
39 GtkWidget *trayconfigbox;52
40 53 gulong fontcheck_handler;
41 GtkWidget *textbutton;
42 GtkWidget *backbutton;
43 GtkWidget *fontbutton;
44
45 gulong notify_edit_handler;
46 gulong notify_sticky_handler;
47 gulong notify_confirm_handler;
48 gulong notify_font_handler;
49 gulong notify_back_handler;
50 gulong notify_text_handler;
51 gulong notify_tray_handler;
52 gulong font_handler;54 gulong font_handler;
55 gulong colorcheck_handler;
56 gulong text_handler;
53 gulong back_handler;57 gulong back_handler;
54 gulong text_handler;58 gulong autostart_xpad_handler;
55 gulong colorcheck_handler;59 gulong autostart_wait_systray_handler;
56 gulong fontcheck_handler;60 gulong autostart_delay_handler;
61 gulong autostart_new_pad_handler;
62 gulong autostart_sticky_handler;
63 gulong autostart_display_pads_handler;
64 gulong trayclick_handler;
57 gulong editcheck_handler;65 gulong editcheck_handler;
58 gulong stickycheck_handler;
59 gulong confirmcheck_handler;66 gulong confirmcheck_handler;
60 gulong trayclick_handler;67
68 gulong notify_font_handler;
69 gulong notify_text_handler;
70 gulong notify_back_handler;
71 gulong notify_autostart_wait_systray_handler;
72 gulong notify_autostart_delay_handler;
73 gulong notify_autostart_new_pad_handler;
74 gulong notify_autostart_sticky_handler;
75 gulong notify_autostart_display_pads_handler;
76 gulong notify_tray_handler;
77 gulong notify_edit_handler;
78 gulong notify_confirm_handler;
61};79};
6280
63G_DEFINE_TYPE_WITH_PRIVATE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG)81G_DEFINE_TYPE_WITH_PRIVATE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG)
6482
65static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref);83static void change_font_check (GtkToggleButton *button, XpadPreferences *pref);
66static void change_sticky_check (GtkToggleButton *button, XpadPreferences *pref);84static void change_font_face (GtkFontButton *button, XpadPreferences *pref);
67static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref);
68static void change_color_check (GtkToggleButton *button, XpadPreferences *pref);85static void change_color_check (GtkToggleButton *button, XpadPreferences *pref);
69static void change_font_check (GtkToggleButton *button, XpadPreferences *pref);
70static void change_text_color (GtkColorChooser *chooser, XpadPreferences *pref);86static void change_text_color (GtkColorChooser *chooser, XpadPreferences *pref);
71static void change_back_color (GtkColorChooser *chooser, XpadPreferences *pref);87static void change_back_color (GtkColorChooser *chooser, XpadPreferences *pref);
72static void change_font_face (GtkFontButton *button, XpadPreferences *pref);88static void change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref);
73static void change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref);89static void change_autostart_wait_systray (GtkToggleButton *button, XpadPreferences *pref);
74static void notify_edit (XpadPreferences *pref);90static void change_autostart_delay (GtkComboBox *box, XpadPreferences *pref);
75static void notify_sticky (XpadPreferences *pref);91static void change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref);
76static void notify_confirm (XpadPreferences *pref);92static void change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref);
93static void change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref);
94static void change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref);
95static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref);
96static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref);
97
77static void notify_fontname (XpadPreferences *pref);98static void notify_fontname (XpadPreferences *pref);
78static void notify_text_color (XpadPreferences *pref);99static void notify_text_color (XpadPreferences *pref);
79static void notify_back_color (XpadPreferences *pref);100static void notify_back_color (XpadPreferences *pref);
101
102static void notify_autostart_wait_systray (XpadPreferences *pref);
103static void notify_autostart_delay (XpadPreferences *pref);
104static void notify_autostart_new_pad (XpadPreferences *pref);
105static void notify_autostart_sticky (XpadPreferences *pref);
106static void notify_autostart_display_pads (XpadPreferences *pref);
80static void notify_tray_click (XpadPreferences *pref);107static void notify_tray_click (XpadPreferences *pref);
108static void notify_edit (XpadPreferences *pref);
109static void notify_confirm (XpadPreferences *pref);
110
81static void xpad_preferences_dispose (GObject *object);111static void xpad_preferences_dispose (GObject *object);
82static void xpad_preferences_finalize (GObject *object);112static void xpad_preferences_finalize (GObject *object);
83static void xpad_preferences_response (GtkDialog *dialog, gint response);113static void xpad_preferences_response (GtkDialog *dialog, gint response);
@@ -87,16 +117,13 @@
87void117void
88xpad_preferences_open (void)118xpad_preferences_open (void)
89{119{
90 if (_xpad_preferences)120 if (!_xpad_preferences)
91 {
92 gtk_window_present (GTK_WINDOW (_xpad_preferences));
93 }
94 else
95 {121 {
96 _xpad_preferences = GTK_WIDGET (g_object_new (XPAD_TYPE_PREFERENCES, NULL));122 _xpad_preferences = GTK_WIDGET (g_object_new (XPAD_TYPE_PREFERENCES, NULL));
97 g_signal_connect_swapped (_xpad_preferences, "destroy", G_CALLBACK (g_nullify_pointer), &_xpad_preferences);123 g_signal_connect_swapped (_xpad_preferences, "destroy", G_CALLBACK (g_nullify_pointer), &_xpad_preferences);
98 gtk_widget_show (_xpad_preferences);
99 }124 }
125
126 gtk_window_present (GTK_WINDOW (_xpad_preferences));
100}127}
101128
102static void129static void
@@ -106,7 +133,7 @@
106133
107 gobject_class->dispose = xpad_preferences_dispose;134 gobject_class->dispose = xpad_preferences_dispose;
108 gobject_class->finalize = xpad_preferences_finalize;135 gobject_class->finalize = xpad_preferences_finalize;
109}136}
110137
111static void138static void
112xpad_preferences_init (XpadPreferences *pref)139xpad_preferences_init (XpadPreferences *pref)
@@ -115,8 +142,9 @@
115 const GdkRGBA *color;142 const GdkRGBA *color;
116 const gchar *fontname;143 const gchar *fontname;
117 GtkStyleContext *style;144 GtkStyleContext *style;
118 GtkWidget *label, *appearance_frame, *alignment, *appearance_vbox;145 GtkWidget *appearance_frame, *start_frame, *tray_frame, *other_frame;
119 GtkWidget *options_frame, *options_vbox, *global_vbox, *tray_config_vbox;146 GtkWidget *global_vbox, *appearance_vbox, *autostart_vbox, *tray_vbox, *other_vbox;
147 GtkWidget *label, *alignment;
120 gchar *text;148 gchar *text;
121 GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);149 GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
122 GtkRequisition req;150 GtkRequisition req;
@@ -125,6 +153,7 @@
125 153
126 pref->priv = xpad_preferences_get_instance_private(pref);154 pref->priv = xpad_preferences_get_instance_private(pref);
127 155
156 /* Appearance options */
128 text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL);157 text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL);
129 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,158 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,
130 "label", text,159 "label", text,
@@ -148,8 +177,8 @@
148 NULL));177 NULL));
149 178
150 pref->priv->textbutton = gtk_color_button_new ();179 pref->priv->textbutton = gtk_color_button_new ();
180 pref->priv->fontbutton = gtk_font_button_new ();
151 pref->priv->backbutton = gtk_color_button_new ();181 pref->priv->backbutton = gtk_color_button_new ();
152 pref->priv->fontbutton = gtk_font_button_new ();
153 182
154 pref->priv->antifontcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use font from theme"));183 pref->priv->antifontcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use font from theme"));
155 pref->priv->fontcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->antifontcheck), _("Use this font:"));184 pref->priv->fontcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->antifontcheck), _("Use this font:"));
@@ -164,66 +193,26 @@
164 pref->priv->colorbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);193 pref->priv->colorbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
165 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);194 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
166195
196 label = gtk_label_new_with_mnemonic (_("Text:"));
197 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
198 gtk_size_group_add_widget (size_group_labels, label);
199 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
200 gtk_box_pack_start (GTK_BOX (hbox), pref->priv->textbutton, TRUE, TRUE, 0);
201 g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL);
202
203 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
204
167 label = gtk_label_new_with_mnemonic (_("Background:"));205 label = gtk_label_new_with_mnemonic (_("Background:"));
168 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);206 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
169 gtk_size_group_add_widget (size_group_labels, label);207 gtk_size_group_add_widget (size_group_labels, label);
170 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);208 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
171 gtk_box_pack_start (GTK_BOX (hbox), pref->priv->backbutton, TRUE, TRUE, 0);209 gtk_box_pack_start (GTK_BOX (hbox), pref->priv->backbutton, TRUE, TRUE, 0);
172 g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL);210 g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL);
173
174 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
175211
176 label = gtk_label_new_with_mnemonic (_("Foreground:"));
177 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
178 gtk_size_group_add_widget (size_group_labels, label);
179 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
180 gtk_box_pack_start (GTK_BOX (hbox), pref->priv->textbutton, TRUE, TRUE, 0);
181 g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL);
182
183 alignment = gtk_alignment_new (1, 1, 1, 1);
184 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
185 gtk_container_add (GTK_CONTAINER (alignment), pref->priv->colorbox);
186
187 pref->priv->editcheck = gtk_check_button_new_with_mnemonic (_("_Edit lock"));
188 pref->priv->stickycheck = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces"));
189 pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion"));
190
191 gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE);
192 gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE);
193 g_signal_connect (pref, "response", G_CALLBACK (xpad_preferences_response), NULL);
194 gtk_window_set_title (GTK_WINDOW (pref), _("Xpad Preferences"));
195
196 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->textbutton), FALSE);
197 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->backbutton), TRUE);
198
199 gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->textbutton), _("Set Foreground Color"));
200 gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->backbutton), _("Set Background Color"));
201 gtk_font_button_set_title (GTK_FONT_BUTTON (pref->priv->fontbutton), _("Set Font"));
202
203 /* Set current state */
204 style = gtk_widget_get_style_context (GTK_WIDGET(pref));212 style = gtk_widget_get_style_context (GTK_WIDGET(pref));
205 gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color);213 gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color);
206 gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color);214 gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color);
207 215
208 color = xpad_settings_get_back_color (xpad_global_settings);
209 if (color)
210 {
211 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
212 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color);
213 }
214 else
215 {
216 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
217 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
218 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &theme_background_color);
219 }
220
221 color = xpad_settings_get_text_color (xpad_global_settings);
222 if (color)
223 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color);
224 else
225 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color);
226
227 fontname = xpad_settings_get_fontname (xpad_global_settings);216 fontname = xpad_settings_get_fontname (xpad_global_settings);
228 if (fontname)217 if (fontname)
229 {218 {
@@ -241,10 +230,29 @@
241 gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), pango_font_description_to_string(font));230 gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), pango_font_description_to_string(font));
242 pango_font_description_free (font);231 pango_font_description_free (font);
243 }232 }
244 233
245 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings));234 color = xpad_settings_get_text_color (xpad_global_settings);
246 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->stickycheck), xpad_settings_get_sticky (xpad_global_settings));235 if (color)
247 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings));236 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color);
237 else
238 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color);
239
240 color = xpad_settings_get_back_color (xpad_global_settings);
241 if (color)
242 {
243 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
244 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color);
245 }
246 else
247 {
248 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
249 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
250 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &theme_background_color);
251 }
252
253 alignment = gtk_alignment_new (1, 1, 1, 1);
254 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
255 gtk_container_add (GTK_CONTAINER (alignment), pref->priv->colorbox);
248 256
249 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);257 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
250258
@@ -259,7 +267,15 @@
259 gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);267 gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
260 gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0);268 gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0);
261 269
262 text = g_strconcat ("<b>", _("Options"), "</b>", NULL);270 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->textbutton), FALSE);
271 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (pref->priv->backbutton), TRUE);
272
273 gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->textbutton), _("Set Foreground Color"));
274 gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->backbutton), _("Set Background Color"));
275 gtk_font_button_set_title (GTK_FONT_BUTTON (pref->priv->fontbutton), _("Set Font"));
276
277 /* Start options */
278 text = g_strconcat ("<b>", _("Startup"), "</b>", NULL);
263 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,279 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,
264 "label", text,280 "label", text,
265 "use-markup", TRUE,281 "use-markup", TRUE,
@@ -267,72 +283,187 @@
267 NULL));283 NULL));
268 g_free (text);284 g_free (text);
269285
270 options_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);286 autostart_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
271 gtk_box_set_homogeneous (GTK_BOX (options_vbox), FALSE);287 gtk_box_set_homogeneous (GTK_BOX (autostart_vbox), FALSE);
272288
273 alignment = gtk_alignment_new (1, 1, 1, 1);289 alignment = gtk_alignment_new (1, 1, 1, 1);
274 g_object_set (G_OBJECT (alignment),290 g_object_set (G_OBJECT (alignment),
275 "left-padding", 12,291 "left-padding", 12,
276 "top-padding", 12,292 "top-padding", 12,
277 "child", options_vbox,293 "child", autostart_vbox,
278 NULL);294 NULL);
279 options_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,295 start_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,
280 "label-widget", label,296 "label-widget", label,
281 "shadow-type", GTK_SHADOW_NONE,297 "shadow-type", GTK_SHADOW_NONE,
282 "child", alignment,298 "child", alignment,
283 NULL));299 NULL));
284300
285 // System tray configuration left-click behaviour301 pref->priv->autostart_xpad = gtk_check_button_new_with_mnemonic (_("_Start Xpad automatically after login"));
286 tray_config_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);302 gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_xpad, FALSE, FALSE, 0);
287 gtk_box_set_homogeneous (GTK_BOX (tray_config_vbox), FALSE);303 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_xpad), xpad_settings_get_autostart_xpad (xpad_global_settings));
288 pref->priv->trayconfigbox = gtk_combo_box_text_new();304
289 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("Do Nothing") );305 pref->priv->autostart_wait_systray = gtk_check_button_new_with_mnemonic (_("_Wait for systray (if possible)"));
290 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("Toggle Show All") );306 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
291 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("List of Pads") );307 gtk_box_pack_start (GTK_BOX (hbox), gtk_alignment_new (1, 1, 1, 1), FALSE, FALSE, 0);
292 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->trayconfigbox ), _("New Pad") );308 gtk_box_pack_start (GTK_BOX (hbox), pref->priv->autostart_wait_systray, FALSE, FALSE, 0);
293 gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->trayconfigbox ), (gint) xpad_settings_get_tray_click_handler(xpad_global_settings));309
310 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings));
311 if (xpad_settings_get_autostart_xpad (xpad_global_settings))
312 gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE);
313 else
314 gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE);
315 gtk_box_pack_start (GTK_BOX (autostart_vbox), hbox, FALSE, FALSE, 0);
316
317 pref->priv->autostart_new_pad = gtk_check_button_new_with_mnemonic (_("_Open a new empty pad"));
318 gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_new_pad, FALSE, FALSE, 0);
319 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings));
320
321 pref->priv->autostart_sticky = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces"));
322 gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_sticky, FALSE, FALSE, 0);
323 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings));
324
325 label = gtk_label_new (_("Delay in seconds"));
326 pref->priv->autostart_delay = gtk_combo_box_text_new();
327 guint i;
328 for (i=0; i<15; i++)
329 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_delay ), g_strdup_printf ("%i", i));
330 gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings));
331 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
332 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
333 gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_delay, TRUE, TRUE, 0);
334 gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0);
335
336 label = gtk_label_new_with_mnemonic(_("Display pads"));
337 pref->priv->autostart_display_pads = gtk_combo_box_text_new();
338 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Open all pads") );
339 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Hide all pads") );
340 gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Restore to previous state") );
341 gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->autostart_display_pads ), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings));
294 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);342 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
343 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
344 gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_display_pads, TRUE, TRUE, 0);
345 gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0);
346
347 /* Tray options */
348 text = g_strconcat ("<b>", _("Tray"), "</b>", NULL);
349 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,
350 "label", text,
351 "use-markup", TRUE,
352 "xalign", 0.0,
353 NULL));
354 g_free (text);
355
356 tray_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
357 gtk_box_set_homogeneous (GTK_BOX (tray_vbox), FALSE);
358
359 alignment = gtk_alignment_new (1, 1, 1, 1);
360 g_object_set (G_OBJECT (alignment),
361 "left-padding", 12,
362 "top-padding", 12,
363 "child", tray_vbox,
364 NULL);
365 tray_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,
366 "label-widget", label,
367 "shadow-type", GTK_SHADOW_NONE,
368 "child", alignment,
369 NULL));
370
295 label = gtk_label_new_with_mnemonic(_("Tray click behaviour"));371 label = gtk_label_new_with_mnemonic(_("Tray click behaviour"));
372 pref->priv->trayconfigbox = gtk_combo_box_text_new();
373 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Do Nothing") );
374 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Toggle Show All") );
375 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("List of Pads") );
376 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("New Pad") );
377 gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler (xpad_global_settings));
378 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
296 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);379 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
297 gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0);380 gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0);
298 gtk_box_pack_start(GTK_BOX(tray_config_vbox), hbox, TRUE, TRUE, 0);381 gtk_box_pack_start(GTK_BOX(tray_vbox), hbox, TRUE, TRUE, 0);
299382
300 // Edit, sticky and confirmation checkboxes383 /* Other options */
301 gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->editcheck, FALSE, FALSE, 0);384 text = g_strconcat ("<b>", _("Other"), "</b>", NULL);
302 gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->stickycheck, FALSE, FALSE, 0);385 label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL,
303 gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); 386 "label", text,
304 g_object_set (GTK_WIDGET(options_vbox), "child", tray_config_vbox, NULL);387 "use-markup", TRUE,
305 388 "xalign", 0.0,
306 global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);389 NULL));
307 gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE);390 g_free (text);
308 gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0);391
309 gtk_box_pack_start (GTK_BOX (global_vbox), options_frame, FALSE, FALSE, 0);392 other_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
310 gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6);393 gtk_box_set_homogeneous (GTK_BOX (other_vbox), FALSE);
311394
312 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0);395 alignment = gtk_alignment_new (1, 1, 1, 1);
313 396 g_object_set (G_OBJECT (alignment),
314 pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref);397 "left-padding", 12,
315 pref->priv->stickycheck_handler = g_signal_connect (pref->priv->stickycheck, "toggled", G_CALLBACK (change_sticky_check), pref);398 "top-padding", 12,
316 pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref);399 "child", other_vbox,
400 NULL);
401 other_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,
402 "label-widget", label,
403 "shadow-type", GTK_SHADOW_NONE,
404 "child", alignment,
405 NULL));
406
407 pref->priv->editcheck = gtk_check_button_new_with_mnemonic (_("_Make pads read-only"));
408 pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion"));
409
410 gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->editcheck, FALSE, FALSE, 0);
411 gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0);
412
413 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings));
414 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings));
415
416 /* Close button and window title */
417 gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE);
418 gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE);
419 g_signal_connect (pref, "response", G_CALLBACK (xpad_preferences_response), NULL);
420 gtk_window_set_title (GTK_WINDOW (pref), _("Xpad Preferences"));
421
422 /* Activate all handlers */
423 pref->priv->fontcheck_handler = g_signal_connect (pref->priv->fontcheck, "toggled", G_CALLBACK (change_font_check), pref);
424 pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref);
317 pref->priv->colorcheck_handler = g_signal_connect (pref->priv->colorcheck, "toggled", G_CALLBACK (change_color_check), pref);425 pref->priv->colorcheck_handler = g_signal_connect (pref->priv->colorcheck, "toggled", G_CALLBACK (change_color_check), pref);
318 pref->priv->fontcheck_handler = g_signal_connect (pref->priv->fontcheck, "toggled", G_CALLBACK (change_font_check), pref);
319 pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref);426 pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref);
320 pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref);427 pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref);
321 pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref);428
429 pref->priv->autostart_xpad_handler = g_signal_connect (pref->priv->autostart_xpad, "toggled", G_CALLBACK (change_autostart_xpad), pref);
430 pref->priv->autostart_wait_systray_handler = g_signal_connect (pref->priv->autostart_wait_systray, "toggled", G_CALLBACK (change_autostart_wait_systray), pref);
431 pref->priv->autostart_delay_handler = g_signal_connect(pref->priv->autostart_delay, "changed", G_CALLBACK(change_autostart_delay), pref);
432 pref->priv->autostart_new_pad_handler = g_signal_connect (pref->priv->autostart_new_pad, "toggled", G_CALLBACK (change_autostart_new_pad), pref);
433 pref->priv->autostart_sticky_handler = g_signal_connect (pref->priv->autostart_sticky, "toggled", G_CALLBACK (change_autostart_sticky), pref);
434 pref->priv->autostart_display_pads_handler = g_signal_connect (pref->priv->autostart_display_pads, "changed", G_CALLBACK (change_autostart_display_pads), pref);
435
322 pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref);436 pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref);
437 pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref);
438 pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref);
439
323 pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (notify_fontname), pref);440 pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (notify_fontname), pref);
324 pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref);441 pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref);
325 pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref);442 pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref);
326 pref->priv->notify_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::sticky", G_CALLBACK (notify_sticky), pref);443
444 pref->priv->notify_autostart_wait_systray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_wait_systray", G_CALLBACK (notify_autostart_wait_systray), pref);
445 pref->priv->notify_autostart_delay_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_delay", G_CALLBACK(notify_autostart_delay), pref);
446 pref->priv->notify_autostart_new_pad_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_new_pad", G_CALLBACK (notify_autostart_new_pad), pref);
447 pref->priv->notify_autostart_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_sticky", G_CALLBACK (notify_autostart_sticky), pref);
448 pref->priv->notify_autostart_display_pads_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_display_pads", G_CALLBACK (notify_autostart_display_pads), pref);
327 pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref);449 pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref);
328 pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref);450 pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref);
329 pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref);451 pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref);
330 452
331 g_object_unref (size_group_labels);453 g_object_unref (size_group_labels);
332 454
455 /* Make the preference dialog visible */
456 global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
457 gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE);
458 gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0);
459 gtk_box_pack_start (GTK_BOX (global_vbox), start_frame, FALSE, FALSE, 0);
460 gtk_box_pack_start (GTK_BOX (global_vbox), tray_frame, FALSE, FALSE, 0);
461 gtk_box_pack_start (GTK_BOX (global_vbox), other_frame, FALSE, FALSE, 0);
462 gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6);
463 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0);
333 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (pref)));464 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (pref)));
334 465
335 /* Make window not so squished */466 /* Make the preference window not so squished */
336 gtk_widget_get_preferred_size (GTK_WIDGET (pref), &req, NULL);467 gtk_widget_get_preferred_size (GTK_WIDGET (pref), &req, NULL);
337 g_object_set (G_OBJECT (pref), "default-width", (gint) (req.height * 0.8), NULL);468 g_object_set (G_OBJECT (pref), "default-width", (gint) (req.height * 0.8), NULL);
338}469}
@@ -361,6 +492,29 @@
361}492}
362493
363static void494static void
495change_font_check (GtkToggleButton *button, XpadPreferences *pref)
496{
497 g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler);
498
499 if (!gtk_toggle_button_get_active (button))
500 xpad_settings_set_fontname (xpad_global_settings, NULL);
501 else
502 xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton)));
503
504 gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button));
505
506 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler);
507}
508
509static void
510change_font_face (GtkFontButton *button, XpadPreferences *pref)
511{
512 g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler);
513 xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (button));
514 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler);
515}
516
517static void
364change_color_check (GtkToggleButton *button, XpadPreferences *pref)518change_color_check (GtkToggleButton *button, XpadPreferences *pref)
365{519{
366 g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler);520 g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler);
@@ -387,18 +541,196 @@
387}541}
388542
389static void543static void
390change_font_check (GtkToggleButton *button, XpadPreferences *pref)544change_text_color (GtkColorChooser *chooser, XpadPreferences *pref)
391{545{
392 g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler);546 GdkRGBA color = {0, 0, 0, 0};
393 547 gtk_color_chooser_get_rgba (chooser, &color);
394 if (!gtk_toggle_button_get_active (button))548
395 xpad_settings_set_fontname (xpad_global_settings, NULL);549 g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler);
396 else550 xpad_settings_set_text_color (xpad_global_settings, &color);
397 xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton)));551 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler);
398 552}
399 gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button));553
400 554static void
401 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler);555change_back_color (GtkColorChooser *chooser, XpadPreferences *pref)
556{
557 GdkRGBA color = {0, 0, 0, 0};
558 gtk_color_chooser_get_rgba (chooser, &color);
559
560 g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler);
561 xpad_settings_set_back_color (xpad_global_settings, &color);
562 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler);
563}
564
565static void
566change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref)
567{
568 gboolean autostart;
569
570 autostart = gtk_toggle_button_get_active (button);
571
572 if (autostart) {
573 /* Copy the xpad.desktop file to the autostart folder and enable/disable the wait for systray preference */
574 gboolean success;
575 char *source_filename;
576 char *destination_directory;
577 GFile *source, *destination;
578 GError *error = NULL;
579
580 /* Find the base directory where the application is installed /usr or /usr/local, to find the correct xpad.desktop file. */
581 char *szTmp = g_strdup_printf ("/proc/%d/exe", getpid());
582 enum { BUFFERSIZE = 1024 };
583 char buf[BUFFERSIZE];
584 ssize_t len = readlink(szTmp, buf, sizeof(buf)-1);
585
586 if (len == -1) {
587 gchar *errtext;
588 errtext = g_strdup_printf (_("Could not find the directory where Xpad is installed\n%s"), error->message);
589 xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext);
590 g_free (errtext);
591
592 gtk_toggle_button_set_active (button, FALSE);
593 }
594 else {
595 char basedir[len-8];
596 guint i;
597 for (i=0; i<len-8; i++)
598 basedir[i] = buf[i];
599 basedir[len-9] = '\0';
600
601 source_filename = g_strdup_printf ("%s/share/applications/xpad.desktop", basedir);
602 destination_directory = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME"));
603
604 source = g_file_new_for_path (source_filename);
605 destination = g_file_new_for_path (destination_directory);
606 success = g_file_copy (source, destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error);
607
608 if (!success) {
609 gchar *errtext;
610 errtext = g_strdup_printf (_("Could not copy %s to %s\n%s"), source_filename, destination_directory, error->message);
611 xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext);
612 g_free (errtext);
613
614 gtk_toggle_button_set_active (button, FALSE);
615 }
616 else {
617 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
618 gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE);
619 change_autostart_wait_systray (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), pref);
620 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
621 }
622 }
623 }
624 else {
625 /* Remove the xpad.desktop file from the autostart folder and enable/disable the wait for systray preference */
626 gboolean success;
627 char *filename;
628 GFile *file;
629 GError *error = NULL;
630
631 filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME"));
632 file = g_file_new_for_path (filename);
633 success = g_file_delete (file, NULL, &error);
634
635 if (!success) {
636 gchar *errtext;
637 errtext = g_strdup_printf (_("Could not delete %s\n%s"), filename, error->message);
638 xpad_app_error (NULL, _("Error disabling Xpad autostart"), errtext);
639 g_free (errtext);
640
641 gtk_toggle_button_set_active (button, TRUE);
642 }
643 else {
644 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
645 gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE);
646 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
647 }
648 }
649}
650
651static void
652change_autostart_wait_systray (GtkToggleButton *button, XpadPreferences *pref)
653{
654 GKeyFile *keyfile;
655 GKeyFileFlags flags;
656 GError *error = NULL;
657 char *filename;
658 gboolean wait_systray;
659
660 wait_systray = gtk_toggle_button_get_active (button);
661
662 /* Create a new GKeyFile object and a bitwise list of flags. */
663 keyfile = g_key_file_new ();
664 filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME"));
665 flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
666 error = NULL;
667
668 /* Load the GKeyFile from xpad.desktop or show an error message. */
669 if (!g_key_file_load_from_file (keyfile, filename, flags, &error)) {
670 gchar *errtext;
671 errtext = g_strdup_printf (_("Could not load %s\n%s"), filename, error->message);
672 xpad_app_error (NULL, _("Error changing wait for systray setting"), errtext);
673 g_free (errtext);
674
675 gtk_toggle_button_set_active (button, !wait_systray);
676 return;
677 }
678
679 g_key_file_set_boolean (keyfile, "Desktop Entry", "X-LXQt-Need-Tray", wait_systray);
680
681 if (!g_key_file_save_to_file (keyfile, filename, &error)) {
682 gchar *errtext;
683 errtext = g_strdup_printf (_("Could not save %s\n%s"), filename, error->message);
684 xpad_app_error (NULL, _("Error changing wait for systray setting"), errtext);
685 g_free (errtext);
686
687 gtk_toggle_button_set_active (button, !wait_systray);
688 return;
689 }
690
691 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
692 xpad_settings_set_autostart_wait_systray (xpad_global_settings, wait_systray);
693 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler);
694}
695
696static void
697change_autostart_delay (GtkComboBox *box, XpadPreferences *pref)
698{
699 g_signal_handler_block(xpad_global_settings, pref->priv->notify_autostart_delay_handler);
700 xpad_settings_set_autostart_delay (xpad_global_settings, (guint) gtk_combo_box_get_active(box));
701 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_delay_handler);
702}
703
704static void
705change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref)
706{
707 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler);
708 xpad_settings_set_autostart_new_pad (xpad_global_settings, gtk_toggle_button_get_active (button));
709 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler);
710}
711
712static void
713change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref)
714{
715 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_sticky_handler);
716 xpad_settings_set_autostart_sticky (xpad_global_settings, gtk_toggle_button_get_active (button));
717 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_sticky_handler);
718}
719
720static void
721change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref)
722{
723 g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_display_pads_handler);
724 xpad_settings_set_autostart_display_pads (xpad_global_settings, (guint) gtk_combo_box_get_active(box));
725 g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_autostart_display_pads_handler);
726}
727
728static void
729change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref)
730{
731 g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_handler);
732 xpad_settings_set_tray_click_handler (xpad_global_settings, (guint) gtk_combo_box_get_active(box));
733 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_tray_handler);
402}734}
403735
404static void736static void
@@ -410,14 +742,6 @@
410}742}
411743
412static void744static void
413change_sticky_check (GtkToggleButton *button, XpadPreferences *pref)
414{
415 g_signal_handler_block (xpad_global_settings, pref->priv->notify_sticky_handler);
416 xpad_settings_set_sticky (xpad_global_settings, gtk_toggle_button_get_active (button));
417 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_sticky_handler);
418}
419
420static void
421change_confirm_check (GtkToggleButton *button, XpadPreferences *pref)745change_confirm_check (GtkToggleButton *button, XpadPreferences *pref)
422{746{
423 g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler);747 g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler);
@@ -426,93 +750,6 @@
426}750}
427751
428static void752static void
429change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref)
430{
431 g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_handler);
432 xpad_settings_set_tray_click_handler(xpad_global_settings, (guint) gtk_combo_box_get_active(box));
433 g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_tray_handler);
434}
435
436static void
437change_text_color (GtkColorChooser *chooser, XpadPreferences *pref)
438{
439 GdkRGBA color = {0, 0, 0, 0};
440 gtk_color_chooser_get_rgba (chooser, &color);
441
442 g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler);
443 xpad_settings_set_text_color (xpad_global_settings, &color);
444 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler);
445}
446
447static void
448change_back_color (GtkColorChooser *chooser, XpadPreferences *pref)
449{
450 GdkRGBA color = {0, 0, 0, 0};
451 gtk_color_chooser_get_rgba (chooser, &color);
452
453 g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler);
454 xpad_settings_set_back_color (xpad_global_settings, &color);
455 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler);
456}
457
458static void
459change_font_face (GtkFontButton *button, XpadPreferences *pref)
460{
461 g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler);
462 xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (button));
463 g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler);
464}
465
466static void
467notify_back_color (XpadPreferences *pref)
468{
469 const GdkRGBA *color = xpad_settings_get_back_color (xpad_global_settings);
470
471 g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler);
472 g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler);
473
474 if (color)
475 {
476 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
477 gtk_widget_set_sensitive (pref->priv->colorbox, TRUE);
478 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color);
479 }
480 else
481 {
482 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
483 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
484 }
485
486 g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler);
487 g_signal_handler_unblock (pref->priv->backbutton, pref->priv->back_handler);
488}
489
490static void
491notify_text_color (XpadPreferences *pref)
492{
493 const GdkRGBA *color = xpad_settings_get_text_color (xpad_global_settings);
494
495 g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler);
496 g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler);
497
498 if (color)
499 {
500 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
501 gtk_widget_set_sensitive (pref->priv->colorbox, TRUE);
502 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color);
503
504 }
505 else
506 {
507 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
508 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
509 }
510
511 g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler);
512 g_signal_handler_unblock (pref->priv->textbutton, pref->priv->text_handler);
513}
514
515static void
516notify_fontname (XpadPreferences *pref)753notify_fontname (XpadPreferences *pref)
517{754{
518 const gchar *fontname = xpad_settings_get_fontname (xpad_global_settings);755 const gchar *fontname = xpad_settings_get_fontname (xpad_global_settings);
@@ -537,6 +774,103 @@
537}774}
538775
539static void776static void
777notify_text_color (XpadPreferences *pref)
778{
779 const GdkRGBA *color = xpad_settings_get_text_color (xpad_global_settings);
780
781 g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler);
782 g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler);
783
784 if (color)
785 {
786 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
787 gtk_widget_set_sensitive (pref->priv->colorbox, TRUE);
788 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color);
789
790 }
791 else
792 {
793 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
794 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
795 }
796
797 g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler);
798 g_signal_handler_unblock (pref->priv->textbutton, pref->priv->text_handler);
799}
800
801static void
802notify_back_color (XpadPreferences *pref)
803{
804 const GdkRGBA *color = xpad_settings_get_back_color (xpad_global_settings);
805
806 g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler);
807 g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler);
808
809 if (color)
810 {
811 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
812 gtk_widget_set_sensitive (pref->priv->colorbox, TRUE);
813 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color);
814 }
815 else
816 {
817 gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
818 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
819 }
820
821 g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler);
822 g_signal_handler_unblock (pref->priv->backbutton, pref->priv->back_handler);
823}
824
825static void
826notify_autostart_wait_systray (XpadPreferences *pref)
827{
828 g_signal_handler_block (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler);
829 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings));
830 g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler);
831}
832
833static void
834notify_autostart_delay (XpadPreferences *pref)
835{
836 g_signal_handler_block (pref->priv->autostart_delay, pref->priv->autostart_delay_handler);
837 gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings));
838 g_signal_handler_unblock (pref->priv->autostart_delay, pref->priv->autostart_delay_handler);
839}
840
841static void
842notify_autostart_new_pad (XpadPreferences *pref)
843{
844 g_signal_handler_block (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler);
845 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings));
846 g_signal_handler_unblock (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler);
847}
848
849static void
850notify_autostart_sticky (XpadPreferences *pref)
851{
852 g_signal_handler_block (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler);
853 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings));
854 g_signal_handler_unblock (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler);
855}
856
857static void
858notify_autostart_display_pads (XpadPreferences *pref)
859{
860 g_signal_handler_block (pref->priv->autostart_display_pads, pref->priv->autostart_display_pads_handler);
861 gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_display_pads), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings));
862 g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler);
863}
864
865static void
866notify_tray_click (XpadPreferences *pref)
867{
868 g_signal_handler_block (pref->priv->trayconfigbox, pref->priv->trayclick_handler);
869 gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler(xpad_global_settings));
870 g_signal_handler_unblock (pref->priv->trayconfigbox, pref->priv->trayclick_handler);
871}
872
873static void
540notify_edit (XpadPreferences *pref)874notify_edit (XpadPreferences *pref)
541{875{
542 g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler);876 g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler);
@@ -545,26 +879,9 @@
545}879}
546880
547static void881static void
548notify_sticky (XpadPreferences *pref)
549{
550 g_signal_handler_block (pref->priv->stickycheck, pref->priv->stickycheck_handler);
551 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->stickycheck), xpad_settings_get_sticky (xpad_global_settings));
552 g_signal_handler_unblock (pref->priv->stickycheck, pref->priv->stickycheck_handler);
553}
554
555static void
556notify_confirm (XpadPreferences *pref)882notify_confirm (XpadPreferences *pref)
557{883{
558 g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler);884 g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler);
559 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings));885 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings));
560 g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler);886 g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler);
561}887}
562
563static void
564notify_tray_click(XpadPreferences *pref)
565{
566 g_signal_handler_block(pref->priv->trayconfigbox, pref->priv->trayclick_handler);
567 gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->trayconfigbox), (gint) xpad_settings_get_tray_click_handler(xpad_global_settings));
568 g_signal_handler_unblock(pref->priv->trayconfigbox, pref->priv->trayclick_handler);
569}
570
571888
=== modified file 'src/xpad-session-manager.c'
--- src/xpad-session-manager.c 2013-10-31 21:17:36 +0000
+++ src/xpad-session-manager.c 2014-06-07 00:27:40 +0000
@@ -59,8 +59,7 @@
59xpad_session_manager_cycle (GIOChannel *source, GIOCondition condition,59xpad_session_manager_cycle (GIOChannel *source, GIOCondition condition,
60 gpointer data)60 gpointer data)
61{61{
62 // A dirty way to silence the compiler for these unused variables.62 /* A dirty way to silence the compiler for these unused variables. */
63 // Feel free to implement these variables in the way they are ment to be used.
64 (void) source;63 (void) source;
65 (void) condition;64 (void) condition;
66 (void) data;65 (void) data;
@@ -110,8 +109,7 @@
110static void109static void
111xpad_session_manager_start_interact_callback (SmcConn smc_conn, SmPointer client_data)110xpad_session_manager_start_interact_callback (SmcConn smc_conn, SmPointer client_data)
112{111{
113 // A dirty way to silence the compiler for these unused variables.112 /* A dirty way to silence the compiler for these unused variables. */
114 // Feel free to implement these variables in the way they are ment to be used.
115 (void) client_data;113 (void) client_data;
116 (void) smc_conn;114 (void) smc_conn;
117115
@@ -176,8 +174,7 @@
176xpad_session_manager_ice_connection_watch (IceConn ice_conn,174xpad_session_manager_ice_connection_watch (IceConn ice_conn,
177 IcePointer client_data, Bool opening, IcePointer *watch_data)175 IcePointer client_data, Bool opening, IcePointer *watch_data)
178{176{
179 // A dirty way to silence the compiler for these unused variables.177 /* A dirty way to silence the compiler for these unused variables. */
180 // Feel free to implement these variables in the way they are ment to be used.
181 (void) client_data;178 (void) client_data;
182 (void) watch_data;179 (void) watch_data;
183180
@@ -210,7 +207,7 @@
210 };207 };
211 SmProp *props[G_N_ELEMENTS (prop)];208 SmProp *props[G_N_ELEMENTS (prop)];
212 struct passwd *pw;209 struct passwd *pw;
213 uint i;210 guint i;
214 gchar *pid_str;211 gchar *pid_str;
215 gchar *command = g_strdup (xpad_app_get_program_path ());212 gchar *command = g_strdup (xpad_app_get_program_path ());
216 size_t string_length = 0;213 size_t string_length = 0;
@@ -227,7 +224,7 @@
227 224
228 pw = getpwuid (getuid ());225 pw = getpwuid (getuid ());
229226
230 // While setting all the properties, safe casts are being used.227 /* While setting all the properties, safe casts are being used. */
231 vals.user->value = pw ? pw->pw_name : "";228 vals.user->value = pw ? pw->pw_name : "";
232 string_length = strlen (vals.user->value);229 string_length = strlen (vals.user->value);
233 if (string_length <= INT_MAX)230 if (string_length <= INT_MAX)
@@ -354,8 +351,7 @@
354static void351static void
355xpad_session_manager_save_global (Bool fast)352xpad_session_manager_save_global (Bool fast)
356{353{
357 // A dirty way to silence the compiler for these unused variables.354 /* A dirty way to silence the compiler for these unused variables. */
358 // Feel free to implement these variables in the way they are ment to be used.
359 (void) fast;355 (void) fast;
360356
361 /* No need to do anything. Currently, all xpad pads are always current with357 /* No need to do anything. Currently, all xpad pads are always current with
@@ -365,12 +361,10 @@
365static void361static void
366xpad_session_manager_save_local (Bool fast)362xpad_session_manager_save_local (Bool fast)
367{363{
368 // A dirty way to silence the compiler for these unused variables.364 /* A dirty way to silence the compiler for these unused variables. */
369 // Feel free to implement these variables in the way they are ment to be used.
370 (void) fast;365 (void) fast;
371366
372 /* should also save cursor positions and open accessory windows */367 /* should also save cursor positions and open accessory windows */
373
374 if (set_props)368 if (set_props)
375 {369 {
376 xpad_session_manager_set_properties ();370 xpad_session_manager_set_properties ();
@@ -383,8 +377,7 @@
383 int save_type, Bool shutdown, int interact_style,377 int save_type, Bool shutdown, int interact_style,
384 Bool fast)378 Bool fast)
385{379{
386 // A dirty way to silence the compiler for these unused variables.380 /* A dirty way to silence the compiler for these unused variables. */
387 // Feel free to implement these variables in the way they are ment to be used.
388 (void) client_data;381 (void) client_data;
389382
390 RETURN_IF_BAD_CONN (smc_conn);383 RETURN_IF_BAD_CONN (smc_conn);
@@ -417,8 +410,7 @@
417static void410static void
418xpad_session_manager_die (SmcConn smc_conn, SmPointer client_data)411xpad_session_manager_die (SmcConn smc_conn, SmPointer client_data)
419{412{
420 // A dirty way to silence the compiler for these unused variables.413 /* A dirty way to silence the compiler for these unused variables. */
421 // Feel free to implement these variables in the way they are ment to be used.
422 (void) client_data;414 (void) client_data;
423415
424 RETURN_IF_BAD_CONN (smc_conn);416 RETURN_IF_BAD_CONN (smc_conn);
@@ -436,8 +428,7 @@
436static void428static void
437xpad_session_manager_shutdown_cancelled (SmcConn smc_conn, SmPointer client_data)429xpad_session_manager_shutdown_cancelled (SmcConn smc_conn, SmPointer client_data)
438{430{
439 // A dirty way to silence the compiler for these unused variables.431 /* A dirty way to silence the compiler for these unused variables. */
440 // Feel free to implement these variables in the way they are ment to be used.
441 (void) client_data;432 (void) client_data;
442433
443 RETURN_IF_BAD_CONN (smc_conn);434 RETURN_IF_BAD_CONN (smc_conn);
@@ -454,8 +445,7 @@
454static void445static void
455xpad_session_manager_save_complete (SmcConn smc_conn, SmPointer client_data)446xpad_session_manager_save_complete (SmcConn smc_conn, SmPointer client_data)
456{447{
457 // A dirty way to silence the compiler for these unused variables.448 /* A dirty way to silence the compiler for these unused variables. */
458 // Feel free to implement these variables in the way they are ment to be used.
459 (void) client_data;449 (void) client_data;
460450
461 RETURN_IF_BAD_CONN (smc_conn);451 RETURN_IF_BAD_CONN (smc_conn);
462452
=== modified file 'src/xpad-settings.c'
--- src/xpad-settings.c 2013-10-31 22:11:55 +0000
+++ src/xpad-settings.c 2014-06-07 00:27:40 +0000
@@ -30,7 +30,6 @@
30 gboolean has_decorations;30 gboolean has_decorations;
31 gboolean confirm_destroy;31 gboolean confirm_destroy;
32 gboolean edit_lock;32 gboolean edit_lock;
33 gboolean sticky;
34 guint tray_click_configuration;33 guint tray_click_configuration;
35 gboolean has_toolbar;34 gboolean has_toolbar;
36 gboolean autohide_toolbar;35 gboolean autohide_toolbar;
@@ -39,6 +38,11 @@
39 GdkRGBA *text;38 GdkRGBA *text;
40 gchar *fontname;39 gchar *fontname;
41 GSList *toolbar_buttons;40 GSList *toolbar_buttons;
41 gboolean autostart_wait_systray;
42 guint autostart_delay;
43 gboolean autostart_new_pad;
44 gboolean autostart_sticky;
45 guint autostart_display_pads;
42};46};
4347
44G_DEFINE_TYPE_WITH_PRIVATE(XpadSettings, xpad_settings, G_TYPE_OBJECT)48G_DEFINE_TYPE_WITH_PRIVATE(XpadSettings, xpad_settings, G_TYPE_OBJECT)
@@ -58,7 +62,6 @@
58 PROP_HEIGHT,62 PROP_HEIGHT,
59 PROP_HAS_DECORATIONS,63 PROP_HAS_DECORATIONS,
60 PROP_CONFIRM_DESTROY,64 PROP_CONFIRM_DESTROY,
61 PROP_STICKY,
62 PROP_EDIT_LOCK,65 PROP_EDIT_LOCK,
63 PROP_TRAY_CLICK_CONFIGURATION,66 PROP_TRAY_CLICK_CONFIGURATION,
64 PROP_HAS_TOOLBAR,67 PROP_HAS_TOOLBAR,
@@ -67,6 +70,11 @@
67 PROP_BACK_COLOR,70 PROP_BACK_COLOR,
68 PROP_TEXT_COLOR,71 PROP_TEXT_COLOR,
69 PROP_FONTNAME,72 PROP_FONTNAME,
73 PROP_AUTOSTART_WAIT_SYSTRAY,
74 PROP_AUTOSTART_DELAY,
75 PROP_AUTOSTART_NEW_PAD,
76 PROP_AUTOSTART_STICKY,
77 PROP_AUTOSTART_DISPLAY_PADS,
70 LAST_PROP78 LAST_PROP
71};79};
7280
@@ -95,8 +103,6 @@
95 gobject_class->set_property = xpad_settings_set_property;103 gobject_class->set_property = xpad_settings_set_property;
96 gobject_class->get_property = xpad_settings_get_property;104 gobject_class->get_property = xpad_settings_get_property;
97 105
98 /* Properties */
99
100 g_object_class_install_property (gobject_class,106 g_object_class_install_property (gobject_class,
101 PROP_WIDTH,107 PROP_WIDTH,
102 g_param_spec_uint ("width",108 g_param_spec_uint ("width",
@@ -134,14 +140,6 @@
134 G_PARAM_READWRITE));140 G_PARAM_READWRITE));
135 141
136 g_object_class_install_property (gobject_class,142 g_object_class_install_property (gobject_class,
137 PROP_STICKY,
138 g_param_spec_boolean ("sticky",
139 "Default Stickiness",
140 "Whether pads are sticky on creation",
141 FALSE,
142 G_PARAM_READWRITE));
143
144 g_object_class_install_property (gobject_class,
145 PROP_EDIT_LOCK,143 PROP_EDIT_LOCK,
146 g_param_spec_boolean ("edit_lock",144 g_param_spec_boolean ("edit_lock",
147 "Edit Lock",145 "Edit Lock",
@@ -204,9 +202,51 @@
204 "Default color of pad background",202 "Default color of pad background",
205 GDK_TYPE_RGBA,203 GDK_TYPE_RGBA,
206 G_PARAM_READWRITE));204 G_PARAM_READWRITE));
207 205
208 /* Signals */206 g_object_class_install_property (gobject_class,
209 207 PROP_AUTOSTART_WAIT_SYSTRAY,
208 g_param_spec_boolean ("autostart_wait_systray",
209 "Autostart Xpad wait for systray",
210 "Whether to wait for the systray before starting xpad automatically after login",
211 FALSE,
212 G_PARAM_READWRITE));
213
214 g_object_class_install_property (gobject_class,
215 PROP_AUTOSTART_DISPLAY_PADS,
216 g_param_spec_uint ("autostart_delay",
217 "Delay autostart of Xpad",
218 "How many seconds will Xpad wait before continuing startup",
219 0,
220 G_MAXUINT,
221 2,
222 G_PARAM_READWRITE));
223
224 g_object_class_install_property (gobject_class,
225 PROP_AUTOSTART_NEW_PAD,
226 g_param_spec_boolean ("autostart_new_pad",
227 "Autostart a new pad",
228 "Whether to create a new pad on startup",
229 FALSE,
230 G_PARAM_READWRITE));
231
232 g_object_class_install_property (gobject_class,
233 PROP_AUTOSTART_STICKY,
234 g_param_spec_boolean ("autostart_sticky",
235 "Default Stickiness",
236 "Whether pads are sticky on creation",
237 FALSE,
238 G_PARAM_READWRITE));
239
240 g_object_class_install_property (gobject_class,
241 PROP_AUTOSTART_DISPLAY_PADS,
242 g_param_spec_uint ("autostart_display_pads",
243 "Autostart display pads",
244 "How to show the different pads when Xpad is started",
245 0,
246 G_MAXUINT,
247 2,
248 G_PARAM_READWRITE));
249
210 signals[CHANGE_BUTTONS] = 250 signals[CHANGE_BUTTONS] =
211 g_signal_new ("change_buttons",251 g_signal_new ("change_buttons",
212 G_OBJECT_CLASS_TYPE (gobject_class),252 G_OBJECT_CLASS_TYPE (gobject_class),
@@ -229,7 +269,7 @@
229 settings->priv->height = 200;269 settings->priv->height = 200;
230 settings->priv->has_decorations = TRUE;270 settings->priv->has_decorations = TRUE;
231 settings->priv->confirm_destroy = TRUE;271 settings->priv->confirm_destroy = TRUE;
232 settings->priv->sticky = FALSE;272 settings->priv->autostart_sticky = FALSE;
233 settings->priv->edit_lock = FALSE;273 settings->priv->edit_lock = FALSE;
234 settings->priv->tray_click_configuration = 0;274 settings->priv->tray_click_configuration = 0;
235 settings->priv->fontname = NULL;275 settings->priv->fontname = NULL;
@@ -240,8 +280,19 @@
240 settings->priv->toolbar_buttons = NULL;280 settings->priv->toolbar_buttons = NULL;
241 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New"));281 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New"));
242 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete"));282 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete"));
243 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Close"));283 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Separator"));
244 284 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Cut"));
285 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Copy"));
286 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Paste"));
287 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Separator"));
288 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Undo"));
289 settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Redo"));
290
291 settings->priv->autostart_wait_systray = TRUE;
292 settings->priv->autostart_delay = 0;
293 settings->priv->autostart_new_pad = FALSE;
294 settings->priv->autostart_display_pads = 2;
295
245 load_from_file (settings, DEFAULTS_FILENAME);296 load_from_file (settings, DEFAULTS_FILENAME);
246}297}
247298
@@ -264,7 +315,7 @@
264 gdk_rgba_free (settings->priv->back);315 gdk_rgba_free (settings->priv->back);
265316
266 g_free (settings->priv->fontname);317 g_free (settings->priv->fontname);
267 318
268 G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object);319 G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object);
269}320}
270321
@@ -385,23 +436,6 @@
385 return settings->priv->has_toolbar;436 return settings->priv->has_toolbar;
386}437}
387438
388void xpad_settings_set_sticky (XpadSettings *settings, gboolean sticky)
389{
390 if (settings->priv->sticky == sticky)
391 return;
392
393 settings->priv->sticky = sticky;
394
395 save_to_file (settings, DEFAULTS_FILENAME);
396
397 g_object_notify (G_OBJECT (settings), "sticky");
398}
399
400gboolean xpad_settings_get_sticky (XpadSettings *settings)
401{
402 return settings->priv->sticky;
403}
404
405void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide)439void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide)
406{440{
407 if (settings->priv->autohide_toolbar == hide)441 if (settings->priv->autohide_toolbar == hide)
@@ -445,72 +479,12 @@
445 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);479 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);
446}480}
447481
448/* Unused function of previous developer
449gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new)
450{
451 GSList *element = NULL;
452 gpointer data;
453
454 if (button == new) {
455 g_slist_free(element);
456 return FALSE;
457 }
458
459 if (new >= (gint) g_slist_length (settings->priv->toolbar_buttons) || 0 > new ) {
460 g_slist_free(element);
461 return FALSE;
462 }
463
464 element = g_slist_nth (settings->priv->toolbar_buttons, button);
465 if (!element) {
466 g_slist_free(element);
467 return FALSE;
468 }
469
470 data = element->data;
471 settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element);
472 settings->priv->toolbar_buttons = g_slist_insert (settings->priv->toolbar_buttons, data, new);
473
474 save_to_file (settings, DEFAULTS_FILENAME);
475
476 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);
477
478 g_slist_free(element);
479
480 return TRUE;
481}
482*/
483
484static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element)482static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element)
485{483{
486 g_free (element->data);484 g_free (element->data);
487 settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element);485 settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element);
488}486}
489487
490/* Unused function of previous developer
491gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button)
492{
493 GSList *element;
494
495 element = g_slist_nth (settings->priv->toolbar_buttons, button);
496
497 if (!element) {
498 g_slist_free(element);
499 return FALSE;
500 }
501
502 xpad_settings_remove_toolbar_list_element (settings, element);
503
504 save_to_file (settings, DEFAULTS_FILENAME);
505
506 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);
507
508 g_slist_free(element);
509
510 return TRUE;
511}
512*/
513
514gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings)488gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings)
515{489{
516 if (settings->priv->toolbar_buttons == NULL)490 if (settings->priv->toolbar_buttons == NULL)
@@ -548,12 +522,10 @@
548 522
549 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);523 g_signal_emit (settings, signals[CHANGE_BUTTONS], 0);
550 524
551 g_slist_free(element);
552
553 return TRUE;525 return TRUE;
554}526}
555527
556G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings)528const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings)
557{529{
558 return settings->priv->toolbar_buttons;530 return settings->priv->toolbar_buttons;
559}531}
@@ -573,7 +545,7 @@
573 g_object_notify (G_OBJECT (settings), "back_color");545 g_object_notify (G_OBJECT (settings), "back_color");
574}546}
575547
576G_CONST_RETURN GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings)548const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings)
577{549{
578 return settings->priv->back;550 return settings->priv->back;
579}551}
@@ -593,7 +565,7 @@
593 g_object_notify (G_OBJECT (settings), "text_color");565 g_object_notify (G_OBJECT (settings), "text_color");
594}566}
595567
596G_CONST_RETURN GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings)568const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings)
597{569{
598 return settings->priv->text;570 return settings->priv->text;
599}571}
@@ -608,11 +580,93 @@
608 g_object_notify (G_OBJECT (settings), "fontname");580 g_object_notify (G_OBJECT (settings), "fontname");
609}581}
610582
611G_CONST_RETURN gchar *xpad_settings_get_fontname (XpadSettings *settings)583const gchar *xpad_settings_get_fontname (XpadSettings *settings)
612{584{
613 return settings->priv->fontname;585 return settings->priv->fontname;
614}586}
615587
588gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings)
589{
590 /* The existence of the xpad.desktop file in the autostart folder defines if autostarting is enabled or disabled */
591 const gchar *filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME"));
592 return g_file_test (filename, G_FILE_TEST_EXISTS);
593}
594
595void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf)
596{
597 if (settings->priv->autostart_wait_systray == conf)
598 return;
599
600 settings->priv->autostart_wait_systray = conf;
601 save_to_file (settings, DEFAULTS_FILENAME);
602 g_object_notify (G_OBJECT (settings), "autostart_wait_systray");
603}
604
605gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings)
606{
607 return settings->priv->autostart_wait_systray;
608}
609
610void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf)
611{
612 if (settings->priv->autostart_delay == conf)
613 return;
614
615 settings->priv->autostart_delay = conf;
616 save_to_file(settings, DEFAULTS_FILENAME);
617 g_object_notify (G_OBJECT (settings), "autostart_delay");
618}
619
620guint xpad_settings_get_autostart_delay (XpadSettings *settings)
621{
622 return settings->priv->autostart_delay;
623}
624
625void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf)
626{
627 if (settings->priv->autostart_new_pad == conf)
628 return;
629
630 settings->priv->autostart_new_pad = conf;
631 save_to_file (settings, DEFAULTS_FILENAME);
632 g_object_notify (G_OBJECT (settings), "autostart_new_pad");
633}
634
635gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings)
636{
637 return settings->priv->autostart_new_pad;
638}
639
640void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean sticky)
641{
642 if (settings->priv->autostart_sticky == sticky)
643 return;
644
645 settings->priv->autostart_sticky = sticky;
646 save_to_file (settings, DEFAULTS_FILENAME);
647 g_object_notify (G_OBJECT (settings), "autostart_sticky");
648}
649
650gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings)
651{
652 return settings->priv->autostart_sticky;
653}
654
655void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf)
656{
657 if (settings->priv->autostart_display_pads == conf)
658 return;
659
660 settings->priv->autostart_display_pads = conf;
661 save_to_file (settings, DEFAULTS_FILENAME);
662 g_object_notify (G_OBJECT (settings), "autostart_display_pads");
663}
664
665guint xpad_settings_get_autostart_display_pads(XpadSettings *settings)
666{
667 return settings->priv->autostart_display_pads;
668}
669
616static void670static void
617xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)671xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
618{672{
@@ -638,10 +692,6 @@
638 xpad_settings_set_confirm_destroy (settings, g_value_get_boolean (value));692 xpad_settings_set_confirm_destroy (settings, g_value_get_boolean (value));
639 break;693 break;
640 694
641 case PROP_STICKY:
642 xpad_settings_set_sticky (settings, g_value_get_boolean (value));
643 break;
644
645 case PROP_EDIT_LOCK:695 case PROP_EDIT_LOCK:
646 xpad_settings_set_edit_lock (settings, g_value_get_boolean (value));696 xpad_settings_set_edit_lock (settings, g_value_get_boolean (value));
647 break;697 break;
@@ -673,7 +723,27 @@
673 case PROP_FONTNAME:723 case PROP_FONTNAME:
674 xpad_settings_set_fontname (settings, g_value_get_string (value));724 xpad_settings_set_fontname (settings, g_value_get_string (value));
675 break;725 break;
726
727 case PROP_AUTOSTART_WAIT_SYSTRAY:
728 xpad_settings_set_autostart_wait_systray (settings, g_value_get_boolean (value));
729 break;
730
731 case PROP_AUTOSTART_DELAY:
732 xpad_settings_set_autostart_delay (settings, g_value_get_uint (value));
733 break;
734
735 case PROP_AUTOSTART_NEW_PAD:
736 xpad_settings_set_autostart_new_pad (settings, g_value_get_boolean (value));
737 break;
738
739 case PROP_AUTOSTART_STICKY:
740 xpad_settings_set_autostart_sticky (settings, g_value_get_boolean (value));
741 break;
676 742
743 case PROP_AUTOSTART_DISPLAY_PADS:
744 xpad_settings_set_autostart_display_pads (settings, g_value_get_uint (value));
745 break;
746
677 default:747 default:
678 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);748 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
679 break;749 break;
@@ -705,10 +775,6 @@
705 g_value_set_boolean (value, xpad_settings_get_confirm_destroy (settings));775 g_value_set_boolean (value, xpad_settings_get_confirm_destroy (settings));
706 break;776 break;
707 777
708 case PROP_STICKY:
709 g_value_set_boolean (value, xpad_settings_get_sticky (settings));
710 break;
711
712 case PROP_EDIT_LOCK:778 case PROP_EDIT_LOCK:
713 g_value_set_boolean (value, xpad_settings_get_edit_lock (settings));779 g_value_set_boolean (value, xpad_settings_get_edit_lock (settings));
714 break;780 break;
@@ -736,6 +802,26 @@
736 case PROP_FONTNAME:802 case PROP_FONTNAME:
737 g_value_set_string (value, xpad_settings_get_fontname (settings));803 g_value_set_string (value, xpad_settings_get_fontname (settings));
738 break;804 break;
805
806 case PROP_AUTOSTART_WAIT_SYSTRAY:
807 g_value_set_boolean (value, xpad_settings_get_autostart_wait_systray (settings));
808 break;
809
810 case PROP_AUTOSTART_DELAY:
811 g_value_set_uint (value, xpad_settings_get_autostart_delay (settings));
812 break;
813
814 case PROP_AUTOSTART_NEW_PAD:
815 g_value_set_boolean (value, xpad_settings_get_autostart_new_pad (settings));
816 break;
817
818 case PROP_AUTOSTART_STICKY:
819 g_value_set_boolean (value, xpad_settings_get_autostart_sticky (settings));
820 break;
821
822 case PROP_AUTOSTART_DISPLAY_PADS:
823 g_value_set_uint (value, xpad_settings_get_autostart_display_pads (settings));
824 break;
739 825
740 default:826 default:
741 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);827 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -766,14 +852,14 @@
766 if (settings->priv->back)852 if (settings->priv->back)
767 back = *settings->priv->back;853 back = *settings->priv->back;
768854
769 // get all the values from the default-style text file in the forms of booleans, ints or strings.855 /* get all the values from the default-style text file in the forms of booleans, ints or strings. */
770 if (fio_get_values_from_file (filename, 856 if (fio_get_values_from_file (filename,
771 "b|decorations", &settings->priv->has_decorations,857 "b|decorations", &settings->priv->has_decorations,
772 "u|height", &settings->priv->height,858 "u|height", &settings->priv->height,
773 "u|width", &settings->priv->width,859 "u|width", &settings->priv->width,
774 "b|confirm_destroy", &settings->priv->confirm_destroy,860 "b|confirm_destroy", &settings->priv->confirm_destroy,
775 "b|edit_lock", &settings->priv->edit_lock,861 "b|edit_lock", &settings->priv->edit_lock,
776 "b|sticky_on_start", &settings->priv->sticky,862 "b|sticky_on_start", &settings->priv->autostart_sticky,
777 "u|tray_click_configuration", &settings->priv->tray_click_configuration,863 "u|tray_click_configuration", &settings->priv->tray_click_configuration,
778 "s|back", &background_color_string,864 "s|back", &background_color_string,
779 "b|use_back", &use_back,865 "b|use_back", &use_back,
@@ -784,6 +870,10 @@
784 "b|auto_hide_toolbar", &settings->priv->autohide_toolbar,870 "b|auto_hide_toolbar", &settings->priv->autohide_toolbar,
785 "b|scrollbar", &settings->priv->has_scrollbar,871 "b|scrollbar", &settings->priv->has_scrollbar,
786 "s|buttons", &buttons,872 "s|buttons", &buttons,
873 "b|autostart_wait_systray", &settings->priv->autostart_wait_systray,
874 "u|autostart_delay", &settings->priv->autostart_delay,
875 "b|autostart_new_pad", &settings->priv->autostart_new_pad,
876 "u|autostart_display_pads", &settings->priv->autostart_display_pads,
787 NULL))877 NULL))
788 return;878 return;
789879
@@ -791,13 +881,16 @@
791 {881 {
792 gdk_rgba_free (settings->priv->text);882 gdk_rgba_free (settings->priv->text);
793883
794 // If, for some reason, one of the colors could not be retrieved884 /*
795 // (for example due to the migration to the new GdkRGBA colors), set the color to the default.885 * If, for some reason, one of the colors could not be retrieved
886 * (for example due to the migration to the new GdkRGBA colors),
887 * set the color to the default.
888 */
796 if (text_color_string == NULL) {889 if (text_color_string == NULL) {
797 text = (GdkRGBA) {0, 0, 0, 1};890 text = (GdkRGBA) {0, 0, 0, 1};
798 }891 }
799 else {892 else {
800 // If, for some reason, the parsing of the colors fail, set the color to the default.893 /* If, for some reason, the parsing of the colors fail, set the color to the default. */
801 if (!gdk_rgba_parse (&text, text_color_string)) {894 if (!gdk_rgba_parse (&text, text_color_string)) {
802 text = (GdkRGBA) {0, 0, 0, 1};895 text = (GdkRGBA) {0, 0, 0, 1};
803 }896 }
@@ -808,13 +901,16 @@
808901
809 gdk_rgba_free (settings->priv->back);902 gdk_rgba_free (settings->priv->back);
810 if (use_back) {903 if (use_back) {
811 // If, for some reason, one of the colors could not be retrieved904 /*
812 // (for example due to the migration to the new GdkRGBA colors), set the color to the default.905 * If, for some reason, one of the colors could not be retrieved
906 * (for example due to the migration to the new GdkRGBA colors),
907 * set the color to the default.
908 */
813 if (background_color_string == NULL) {909 if (background_color_string == NULL) {
814 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};910 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};
815 }911 }
816 else {912 else {
817 // If, for some reason, the parsing of the colors fail, set the color to the default.913 /* If, for some reason, the parsing of the colors fail, set the color to the default. */
818 if (!gdk_rgba_parse (&back, background_color_string)) {914 if (!gdk_rgba_parse (&back, background_color_string)) {
819 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};915 back = (GdkRGBA) {1, 0.933334350586, 0.6, 1};
820 }916 }
@@ -850,7 +946,7 @@
850 {946 {
851 settings->priv->toolbar_buttons = 947 settings->priv->toolbar_buttons =
852 g_slist_append (settings->priv->toolbar_buttons,948 g_slist_append (settings->priv->toolbar_buttons,
853 g_strstrip (button_names[i])); // takes ownership of string949 g_strstrip (button_names[i])); /* takes ownership of string */
854 }950 }
855 951
856 g_free (button_names);952 g_free (button_names);
@@ -886,7 +982,7 @@
886 "u|width", settings->priv->width,982 "u|width", settings->priv->width,
887 "b|confirm_destroy", settings->priv->confirm_destroy,983 "b|confirm_destroy", settings->priv->confirm_destroy,
888 "b|edit_lock", settings->priv->edit_lock,984 "b|edit_lock", settings->priv->edit_lock,
889 "b|sticky_on_start", settings->priv->sticky,985 "b|sticky_on_start", settings->priv->autostart_sticky,
890 "u|tray_click_configuration", settings->priv->tray_click_configuration,986 "u|tray_click_configuration", settings->priv->tray_click_configuration,
891 "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL",987 "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL",
892 "b|use_back", settings->priv->back ? TRUE : FALSE,988 "b|use_back", settings->priv->back ? TRUE : FALSE,
@@ -897,6 +993,10 @@
897 "b|auto_hide_toolbar", settings->priv->autohide_toolbar,993 "b|auto_hide_toolbar", settings->priv->autohide_toolbar,
898 "b|scrollbar", settings->priv->has_scrollbar,994 "b|scrollbar", settings->priv->has_scrollbar,
899 "s|buttons", buttons,995 "s|buttons", buttons,
996 "b|autostart_wait_systray", settings->priv->autostart_wait_systray,
997 "u|autostart_delay", settings->priv->autostart_delay,
998 "b|autostart_new_pad", settings->priv->autostart_new_pad,
999 "u|autostart_display_pads", settings->priv->autostart_display_pads,
900 NULL);1000 NULL);
901 1001
902 g_free (buttons);1002 g_free (buttons);
9031003
=== modified file 'src/xpad-settings.h'
--- src/xpad-settings.h 2013-10-31 21:17:36 +0000
+++ src/xpad-settings.h 2014-06-07 00:27:40 +0000
@@ -66,9 +66,6 @@
66void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm);66void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm);
67gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings);67gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings);
6868
69void xpad_settings_set_sticky (XpadSettings *settings, gboolean sticky);
70gboolean xpad_settings_get_sticky (XpadSettings *settings);
71
72void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock);69void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock);
73gboolean xpad_settings_get_edit_lock (XpadSettings *settings);70gboolean xpad_settings_get_edit_lock (XpadSettings *settings);
7471
@@ -82,23 +79,39 @@
82gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings);79gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings);
8380
84void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button);81void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button);
85// gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new);
86// gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button);
87gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings);82gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings);
88gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings);83gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings);
89G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings);84const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings);
9085
91void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back);86void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back);
92G_CONST_RETURN GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings);87const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings);
9388
94void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text);89void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text);
95G_CONST_RETURN GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings);90const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings);
9691
97void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname);92void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname);
98G_CONST_RETURN gchar *xpad_settings_get_fontname (XpadSettings *settings);93const gchar *xpad_settings_get_fontname (XpadSettings *settings);
9994
100void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf);95void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf);
101guint xpad_settings_get_tray_click_handler(XpadSettings *settings);96guint xpad_settings_get_tray_click_handler (XpadSettings *settings);
97
98void xpad_settings_set_autostart_xpad (XpadSettings *settings, gboolean conf);
99gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings);
100
101void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf);
102gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings);
103
104void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf);
105guint xpad_settings_get_autostart_delay (XpadSettings *settings);
106
107void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf);
108gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings);
109
110void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean conf);
111gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings);
112
113void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf);
114guint xpad_settings_get_autostart_display_pads (XpadSettings *settings);
102115
103G_END_DECLS116G_END_DECLS
104117
105118
=== modified file 'src/xpad-text-view.c'
--- src/xpad-text-view.c 2013-10-31 21:17:36 +0000
+++ src/xpad-text-view.c 2014-06-07 00:27:40 +0000
@@ -153,8 +153,7 @@
153static gboolean153static gboolean
154xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)154xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
155{155{
156 // A dirty way to silence the compiler for these unused variables.156 /* A dirty way to silence the compiler for these unused variables. */
157 // Feel free to implement these variables in the way they are ment to be used.
158 (void) event;157 (void) event;
159158
160 if (xpad_settings_get_edit_lock (xpad_global_settings))159 if (xpad_settings_get_edit_lock (xpad_global_settings))
@@ -200,13 +199,17 @@
200{199{
201 GdkCursor *cursor;200 GdkCursor *cursor;
202 gboolean editable;201 gboolean editable;
202 GdkWindow *view_window;
203 203
204 editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view));204 editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view));
205 gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), editable);205 gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), editable);
206 206
207 cursor = editable ? gdk_cursor_new (GDK_XTERM) : NULL;207 cursor = editable ? gdk_cursor_new (GDK_XTERM) : NULL;
208 208
209 gdk_window_set_cursor (gtk_text_view_get_window (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_TEXT), cursor);209 /* Only set for pads which are currently visible */
210 view_window = gtk_text_view_get_window (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_TEXT);
211 if (view_window != NULL)
212 gdk_window_set_cursor (view_window, cursor);
210 213
211 if (cursor)214 if (cursor)
212 g_object_unref (cursor);215 g_object_unref (cursor);
@@ -224,11 +227,11 @@
224 pango_font_description_free (fontdesc);227 pango_font_description_free (fontdesc);
225}228}
226229
227// Update the colors of the textview230/* Update the colors of the textview */
228static void231static void
229xpad_text_view_notify_colors (XpadTextView *view)232xpad_text_view_notify_colors (XpadTextView *view)
230{233{
231 // Set the colors of this individual pad to the global setting preference.234 /* Set the colors of this individual pad to the global setting preference. */
232 const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings);235 const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings);
233 const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings);236 const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings);
234237
@@ -236,7 +239,7 @@
236 gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color);239 gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color);
237 gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, back_color);240 gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, back_color);
238241
239 // Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors.242 /* Inverse the text and background colors for selected text, so it is likely to be visible by any choice of the colors. */
240 gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, back_color);243 gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, back_color);
241 gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, text_color);244 gtk_widget_override_background_color (GTK_WIDGET (view), GTK_STATE_FLAG_SELECTED, text_color);
242}245}
243246
=== modified file 'src/xpad-toolbar.c'
--- src/xpad-toolbar.c 2013-10-31 21:17:36 +0000
+++ src/xpad-toolbar.c 2014-06-07 00:27:40 +0000
@@ -35,8 +35,6 @@
35 guint move_button_release_handler;35 guint move_button_release_handler;
36 guint move_key_press_handler;36 guint move_key_press_handler;
37 XpadPad *pad;37 XpadPad *pad;
38 // GtkToolItem *move_button;
39 // GtkToolItem *tool_items;
40};38};
4139
42G_DEFINE_TYPE_WITH_PRIVATE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR)40G_DEFINE_TYPE_WITH_PRIVATE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR)
@@ -50,7 +48,7 @@
50typedef struct48typedef struct
51{49{
52 const gchar *name;50 const gchar *name;
53 const gchar *stock;51 const gchar *icon_name;
54 guint signal;52 guint signal;
55 guint type;53 guint type;
56 const gchar *desc;54 const gchar *desc;
@@ -78,23 +76,22 @@
7876
79static const XpadToolbarButton buttons[] =77static const XpadToolbarButton buttons[] =
80{78{
81 {"Clear", GTK_STOCK_CLEAR, ACTIVATE_CLEAR, XPAD_BUTTON_TYPE_BUTTON, N_("Clear Pad Contents"), N_("Add C_lear to Toolbar")},79 {"Clear", "edit-clear", ACTIVATE_CLEAR, XPAD_BUTTON_TYPE_BUTTON, N_("Clear Pad Contents"), N_("Add C_lear button")},
82 {"Close", GTK_STOCK_CLOSE, ACTIVATE_CLOSE, XPAD_BUTTON_TYPE_BUTTON, N_("Close and Save Pad"), N_("Add _Close to Toolbar")},80 {"Close", "window-close", ACTIVATE_CLOSE, XPAD_BUTTON_TYPE_BUTTON, N_("Close and Save Pad"), N_("Add _Close button")},
83 {"Copy", GTK_STOCK_COPY, ACTIVATE_COPY, XPAD_BUTTON_TYPE_BUTTON, N_("Copy to Clipboard"), N_("Add C_opy to Toolbar")},81 {"Copy", "edit-copy", ACTIVATE_COPY, XPAD_BUTTON_TYPE_BUTTON, N_("Copy to Clipboard"), N_("Add C_opy button")},
84 {"Cut", GTK_STOCK_CUT, ACTIVATE_CUT, XPAD_BUTTON_TYPE_BUTTON, N_("Cut to Clipboard"), N_("Add C_ut to Toolbar")},82 {"Cut", "edit-cut", ACTIVATE_CUT, XPAD_BUTTON_TYPE_BUTTON, N_("Cut to Clipboard"), N_("Add C_ut button")},
85 {"Delete", GTK_STOCK_DELETE, ACTIVATE_DELETE, XPAD_BUTTON_TYPE_BUTTON, N_("Delete Pad"), N_("Add _Delete to Toolbar")},83 {"Delete", "edit-delete", ACTIVATE_DELETE, XPAD_BUTTON_TYPE_BUTTON, N_("Delete Pad"), N_("Add _Delete button")},
86 {"New", GTK_STOCK_NEW, ACTIVATE_NEW, XPAD_BUTTON_TYPE_BUTTON, N_("Open New Pad"), N_("Add _New to Toolbar")},84 {"New", "document-new", ACTIVATE_NEW, XPAD_BUTTON_TYPE_BUTTON, N_("Open New Pad"), N_("Add _New button")},
87 {"Paste", GTK_STOCK_PASTE, ACTIVATE_PASTE, XPAD_BUTTON_TYPE_BUTTON, N_("Paste from Clipboard"), N_("Add Pa_ste to Toolbar")},85 {"Paste", "edit-paste", ACTIVATE_PASTE, XPAD_BUTTON_TYPE_BUTTON, N_("Paste from Clipboard"), N_("Add Pa_ste button")},
88 {"Preferences", GTK_STOCK_PREFERENCES, ACTIVATE_PREFERENCES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Preferences"), N_("Add Pr_eferences to Toolbar")},86 {"Preferences", "preferences-system", ACTIVATE_PREFERENCES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Preferences"), N_("Add Pr_eferences button")},
89 {"Properties", GTK_STOCK_PROPERTIES, ACTIVATE_PROPERTIES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Pad Properties"), N_("Add Proper_ties to Toolbar")},87 {"Properties", "document-properties", ACTIVATE_PROPERTIES, XPAD_BUTTON_TYPE_BUTTON, N_("Edit Pad Properties"), N_("Add Proper_ties button")},
90 {"Redo", GTK_STOCK_REDO, ACTIVATE_REDO, XPAD_BUTTON_TYPE_BUTTON, N_("Redo"), N_("Add _Redo to Toolbar")},88 {"Redo", "edit-redo", ACTIVATE_REDO, XPAD_BUTTON_TYPE_BUTTON, N_("Redo"), N_("Add _Redo button")},
91 {"Quit", GTK_STOCK_QUIT, ACTIVATE_QUIT, XPAD_BUTTON_TYPE_BUTTON, N_("Close All Pads"), N_("Add Close _All to Toolbar")},89 {"Quit", "application-exit", ACTIVATE_QUIT, XPAD_BUTTON_TYPE_BUTTON, N_("Close All Pads"), N_("Add Close _All button")},
92 {"Undo", GTK_STOCK_UNDO, ACTIVATE_UNDO, XPAD_BUTTON_TYPE_BUTTON, N_("Undo"), N_("Add _Undo to Toolbar")},90 {"Undo", "edit-undo", ACTIVATE_UNDO, XPAD_BUTTON_TYPE_BUTTON, N_("Undo"), N_("Add _Undo button")},
93 {"sep", NULL, 0, XPAD_BUTTON_TYPE_SEPARATOR, NULL, N_("Add a Se_parator to Toolbar")} /* Separator */91 {"Separator", NULL, 0, XPAD_BUTTON_TYPE_SEPARATOR, NULL, N_("Add Se_parator")}
94 /*{"Minimize to Tray", "gtk-goto-bottom", 1, N_("Minimize Pads to System Tray")}*/
95};92};
9693
97static G_CONST_RETURN XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name);94static const XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name);
98static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button);95static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button);
99static void xpad_toolbar_button_activated (GtkToolButton *button);96static void xpad_toolbar_button_activated (GtkToolButton *button);
100static void xpad_toolbar_change_buttons (XpadToolbar *toolbar);97static void xpad_toolbar_change_buttons (XpadToolbar *toolbar);
@@ -107,16 +104,6 @@
107static void xpad_toolbar_add_button (const gchar *button_name);104static void xpad_toolbar_add_button (const gchar *button_name);
108static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button);105static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button);
109106
110/* Unfinished new feature of previous developer
111static void xpad_toolbar_remove_button (GtkWidget *button);
112static gboolean xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event);
113static gboolean xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar);
114static gboolean xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button);
115static gboolean xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event);
116static gboolean xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event);
117static gboolean xpad_toolbar_move_button_end (XpadToolbar *toolbar);
118*/
119
120static guint signals[LAST_SIGNAL] = { 0 };107static guint signals[LAST_SIGNAL] = { 0 };
121108
122enum109enum
@@ -144,7 +131,6 @@
144 gobject_class->dispose = xpad_toolbar_dispose;131 gobject_class->dispose = xpad_toolbar_dispose;
145 gobject_class->finalize = xpad_toolbar_finalize;132 gobject_class->finalize = xpad_toolbar_finalize;
146 133
147 /* Signals */
148 signals[ACTIVATE_NEW] = 134 signals[ACTIVATE_NEW] =
149 g_signal_new ("activate-new",135 g_signal_new ("activate-new",
150 G_OBJECT_CLASS_TYPE (gobject_class),136 G_OBJECT_CLASS_TYPE (gobject_class),
@@ -344,11 +330,10 @@
344 }330 }
345}331}
346332
347static G_CONST_RETURN XpadToolbarButton *333static const XpadToolbarButton *
348xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name)334xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name)
349{335{
350 // A dirty way to silence the compiler for these unused variables.336 /* A dirty way to silence the compiler for these unused variables. */
351 // Feel free to implement these variables in the way they are ment to be used.
352 (void) toolbar;337 (void) toolbar;
353338
354 guint i;339 guint i;
@@ -363,7 +348,6 @@
363xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button)348xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button)
364{349{
365 GtkToolItem *item;350 GtkToolItem *item;
366 // GtkWidget *child;
367351
368 item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name));352 item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name));
369 if (item)353 if (item)
@@ -372,11 +356,13 @@
372 switch (button->type)356 switch (button->type)
373 {357 {
374 case XPAD_BUTTON_TYPE_BUTTON:358 case XPAD_BUTTON_TYPE_BUTTON:
375 item = GTK_TOOL_ITEM (gtk_tool_button_new_from_stock (button->stock));359 item = gtk_tool_button_new (NULL, button->name);
360 gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), button->icon_name);
376 g_signal_connect (item, "clicked", G_CALLBACK (xpad_toolbar_button_activated), NULL);361 g_signal_connect (item, "clicked", G_CALLBACK (xpad_toolbar_button_activated), NULL);
377 break;362 break;
378 case XPAD_BUTTON_TYPE_TOGGLE:363 case XPAD_BUTTON_TYPE_TOGGLE:
379 item = GTK_TOOL_ITEM (gtk_toggle_tool_button_new_from_stock (button->stock));364 item = gtk_tool_button_new (NULL, button->name);
365 gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), button->icon_name);
380 g_signal_connect (item, "toggled", G_CALLBACK (xpad_toolbar_button_activated), NULL);366 g_signal_connect (item, "toggled", G_CALLBACK (xpad_toolbar_button_activated), NULL);
381 break;367 break;
382 case XPAD_BUTTON_TYPE_SEPARATOR:368 case XPAD_BUTTON_TYPE_SEPARATOR:
@@ -414,7 +400,7 @@
414{400{
415 GList *list, *temp;401 GList *list, *temp;
416 const GSList *slist, *stemp;402 const GSList *slist, *stemp;
417 gint i = 0;403 guint i = 0;
418 guint j = 0;404 guint j = 0;
419 GtkToolItem *item;405 GtkToolItem *item;
420 406
@@ -430,16 +416,20 @@
430 g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL);416 g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL);
431 417
432 slist = xpad_settings_get_toolbar_buttons (xpad_global_settings);418 slist = xpad_settings_get_toolbar_buttons (xpad_global_settings);
419
433 for (stemp = slist; stemp; stemp = stemp->next)420 for (stemp = slist; stemp; stemp = stemp->next)
434 {421 {
435 const XpadToolbarButton *button;422 const XpadToolbarButton *button;
436 423
437 button = xpad_toolbar_button_lookup (toolbar, stemp->data);424 button = xpad_toolbar_button_lookup (toolbar, stemp->data);
438 if (!button)425
426 if (button->type == XPAD_BUTTON_TYPE_SEPARATOR)
427 item = gtk_separator_tool_item_new ();
428 else if (button->type == XPAD_BUTTON_TYPE_BUTTON)
429 item = xpad_toolbar_button_to_item (toolbar, button);
430 else
439 continue;431 continue;
440 432
441 item = xpad_toolbar_button_to_item (toolbar, button);
442
443 if (item)433 if (item)
444 {434 {
445 g_object_set_data (G_OBJECT (item), "xpad-button-num", GINT_TO_POINTER (i));435 g_object_set_data (G_OBJECT (item), "xpad-button-num", GINT_TO_POINTER (i));
@@ -462,7 +452,7 @@
462 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);452 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
463 gtk_widget_show_all (GTK_WIDGET (item));453 gtk_widget_show_all (GTK_WIDGET (item));
464 i++;454 i++;
465455
466 if (toolbar->priv->pad)456 if (toolbar->priv->pad)
467 {457 {
468 xpad_pad_notify_has_selection (toolbar->priv->pad);458 xpad_pad_notify_has_selection (toolbar->priv->pad);
@@ -497,8 +487,7 @@
497static gboolean487static gboolean
498xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button)488xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button)
499{489{
500 // A dirty way to silence the compiler for these unused variables.490 /* A dirty way to silence the compiler for these unused variables. */
501 // Feel free to implement these variables in the way they are ment to be used.
502 (void) x;491 (void) x;
503 (void) y;492 (void) y;
504493
@@ -515,60 +504,37 @@
515 for (i = 0; i < G_N_ELEMENTS (buttons); i++)504 for (i = 0; i < G_N_ELEMENTS (buttons); i++)
516 {505 {
517 const GSList *j;506 const GSList *j;
518 GtkWidget *item, *image;507 GtkWidget *item;
508
509 for (j = current_buttons; j; j = j->next)
510 if (g_ascii_strcasecmp (j->data, "Separator") && !g_ascii_strcasecmp (j->data, buttons[i].name))
511 break;
519 512
520 if (strcmp (buttons[i].name, "sep") != 0)513 if (j)
521 {514 {
522 for (j = current_buttons; j; j = j->next)515 is_button = TRUE;
523 if (!g_ascii_strcasecmp (j->data, buttons[i].name))
524 break;
525
526 if (j)
527 {
528 is_button = TRUE;
529 continue;
530 }
531 }
532 else
533 {
534 /* Don't let user add separators until we can allow clicks on them. */
535 continue;516 continue;
536 }517 }
537 518
538 item = gtk_image_menu_item_new_with_mnemonic (buttons[i].menu_desc);519 item = gtk_menu_item_new_with_mnemonic (buttons[i].menu_desc);
539
540 image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
541 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
542
543 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name);520 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name);
544
545 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);521 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);
546 gtk_widget_show (item);522 gtk_widget_show (item);
547 }523 }
548524
549 if (is_button)525 if (is_button)
550 {526 {
551 GtkWidget *item, *image;527 GtkWidget *item;
552528
553 item = gtk_image_menu_item_new_with_mnemonic (N_("Remove All _Buttons"));529 item = gtk_menu_item_new_with_mnemonic (N_("Remove All _Buttons"));
554 530 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL);
555 image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
556 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
557
558 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL);
559
560 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);531 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);
561 gtk_widget_show (item);532 gtk_widget_show (item);
562533
563 i++;534 i++;
564 535
565 item = gtk_image_menu_item_new_with_mnemonic (N_("Remo_ve Last Button"));536 item = gtk_menu_item_new_with_mnemonic (N_("Remo_ve Last Button"));
566
567 image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
568 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
569
570 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL);537 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL);
571
572 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);538 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1);
573 gtk_widget_show (item);539 gtk_widget_show (item);
574 }540 }
@@ -625,216 +591,3 @@
625 const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste");591 const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste");
626 xpad_toolbar_enable_button (toolbar, button, enable);592 xpad_toolbar_enable_button (toolbar, button, enable);
627}593}
628
629/*
630 * The code below was code in progress of a previous developer
631static gboolean
632xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event)
633{
634 // Ignore double-clicks and triple-clicks
635 if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
636 {
637 XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar"));
638 xpad_toolbar_popup_button_menu (widget, event, toolbar);
639 return TRUE;
640 }
641 else if (event->button == 2 && event->type == GDK_BUTTON_PRESS)
642 {
643 XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar"));
644 xpad_toolbar_move_button_start (toolbar, widget);
645 return TRUE;
646 }
647
648 return FALSE;
649}
650
651static gboolean
652xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar)
653{
654 GtkWidget *menu;
655 GtkWidget *item, *image;
656
657 menu = gtk_menu_new ();
658
659
660 item = gtk_image_menu_item_new_with_mnemonic (_("_Remove From Toolbar"));
661
662 image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
663 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
664
665 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_button), button);
666 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 0, 1);
667 gtk_widget_show (item);
668
669
670 item = gtk_menu_item_new_with_mnemonic (_("_Move"));
671 g_signal_connect_swapped (item, "activate", G_CALLBACK (move_menu_item_activated), button);
672 gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 1, 2);
673 gtk_widget_show (item);
674
675
676 g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar);
677
678 gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event ? event->button : 0, gtk_get_current_event_time ());
679
680 g_signal_emit (toolbar, signals[POPUP], 0, menu);
681
682 return TRUE;
683}
684
685static void
686xpad_toolbar_remove_button (GtkWidget *button)
687{
688 gint button_num;
689
690 button_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num"));
691
692 xpad_settings_remove_toolbar_button (xpad_global_settings, button_num);
693}
694
695static void
696move_menu_item_activated (GtkWidget *button)
697{
698 XpadToolbar *toolbar;
699
700 toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (button), "xpad-toolbar"));
701
702 xpad_toolbar_move_button_start (toolbar, button);
703}
704
705static gboolean
706xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button)
707{
708 GdkGrabStatus status;
709 GdkCursor *fleur_cursor;
710 GtkWidget *widget;
711
712 widget = GTK_WIDGET (toolbar);
713 gtk_grab_add (widget);
714
715 fleur_cursor = gdk_cursor_new (GDK_FLEUR);
716
717 // g_object_ref (button);
718 toolbar->priv->move_removed = FALSE;
719 toolbar->priv->move_button = GTK_TOOL_ITEM (button);
720 toolbar->priv->move_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num"));
721
722 toolbar->priv->move_button_release_handler = g_signal_connect (toolbar, "button-release-event", G_CALLBACK (xpad_toolbar_move_button_end), NULL);
723 toolbar->priv->move_key_press_handler = g_signal_connect (toolbar, "key-press-event", G_CALLBACK (xpad_toolbar_move_button_move_keyboard), NULL);
724 toolbar->priv->move_motion_handler = g_signal_connect (toolbar, "motion-notify-event", G_CALLBACK (xpad_toolbar_move_button_move), NULL);
725
726 status = gdk_pointer_grab (widget->window, FALSE,
727 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL,
728 fleur_cursor, gtk_get_current_event_time ());
729
730 gdk_cursor_unref (fleur_cursor);
731 gdk_flush ();
732
733 if (status != GDK_GRAB_SUCCESS)
734 {
735 xpad_toolbar_move_button_end (toolbar);
736 }
737
738 return TRUE;
739}
740
741static gboolean
742xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event)
743{
744 if (event->keyval == GDK_KEY_Left || event->keyval == GDK_KEY_KP_Left)
745 {
746 if (!toolbar->priv->move_removed)
747 {
748 toolbar->priv->move_removed = TRUE;
749 gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button));
750 }
751
752 if (toolbar->priv->move_index > 0)
753 toolbar->priv->move_index--;
754
755 gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index);
756 }
757 else if (event->keyval == GDK_KEY_Right || event->keyval == GDK_KEY_KP_Right)
758 {
759 gint max;
760
761 if (!toolbar->priv->move_removed)
762 {
763 toolbar->priv->move_removed = TRUE;
764 gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button));
765 }
766
767 max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2;
768
769 if (toolbar->priv->move_index < max)
770 toolbar->priv->move_index++;
771
772 gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index);
773 }
774 else if (event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space || event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter)
775 {
776 xpad_toolbar_move_button_end (toolbar);
777 return TRUE;
778 }
779
780 return TRUE;
781}
782
783static gboolean
784xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event)
785{
786 gint max;
787
788 if (!toolbar->priv->move_removed)
789 {
790 toolbar->priv->move_removed = TRUE;
791 gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button));
792 }
793
794 toolbar->priv->move_index = gtk_toolbar_get_drop_index (GTK_TOOLBAR (toolbar), event->x, event->y);
795
796 // Must not move past separator or grip
797 max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2;
798 toolbar->priv->move_index = MIN (toolbar->priv->move_index, max);
799
800 gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index);
801
802 return TRUE;
803}
804
805static gboolean
806xpad_toolbar_move_button_end (XpadToolbar *toolbar)
807{
808 gint old_spot;
809 gint max;
810
811 g_signal_handler_disconnect (toolbar, toolbar->priv->move_button_release_handler);
812 g_signal_handler_disconnect (toolbar, toolbar->priv->move_key_press_handler);
813 g_signal_handler_disconnect (toolbar, toolbar->priv->move_motion_handler);
814 toolbar->priv->move_button_release_handler = 0;
815 toolbar->priv->move_key_press_handler = 0;
816 toolbar->priv->move_motion_handler = 0;
817
818 gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), NULL, 0);
819
820 old_spot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (toolbar->priv->move_button), "xpad-button-num"));
821
822 // Must not move past separator or grip
823 max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2;
824 toolbar->priv->move_index = MIN (toolbar->priv->move_index, max);
825
826 if (!xpad_settings_move_toolbar_button (xpad_global_settings, old_spot, toolbar->priv->move_index) &&
827 toolbar->priv->move_removed)
828 {
829 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index);
830 }
831
832 // g_object_unref (toolbar->priv->move_button);
833 toolbar->priv->move_button = NULL;
834
835 gtk_grab_remove (GTK_WIDGET (toolbar));
836 gdk_pointer_ungrab (gtk_get_current_event_time ());
837 return TRUE;
838}
839
840*/
841594
=== modified file 'src/xpad-tray.c'
--- src/xpad-tray.c 2013-10-31 21:17:36 +0000
+++ src/xpad-tray.c 2014-06-07 00:27:40 +0000
@@ -38,15 +38,15 @@
38 LIST_OF_PADS,38 LIST_OF_PADS,
39 NEW_PAD39 NEW_PAD
40};40};
41// tray icon left click handler41/* tray icon left click handler */
42static void xpad_tray_activate_cb (GtkStatusIcon *icon);42static void xpad_tray_activate_cb (GtkStatusIcon *icon);
43// tray icon right click handler43/* tray icon right click handler */
44static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time);44static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time);
45// "toggle show all" menu item handler45/* "toggle show all" menu item handler */
46static void xpad_tray_show_hide_all (void);46static void xpad_tray_show_hide_all (void);
47// "show pads" menu item handler47/* "show pads" menu item handler */
48static void xpad_tray_show_windows_list (GtkStatusIcon *icon);48static void xpad_tray_show_windows_list (GtkStatusIcon *icon);
49// helper function to append pad window title as item to menu49/* helper function to append pad window title as item to menu */
50static void xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu);50static void xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu);
5151
52static GtkStatusIcon *docklet = NULL;52static GtkStatusIcon *docklet = NULL;
@@ -126,7 +126,7 @@
126xpad_tray_show_hide_all (void)126xpad_tray_show_hide_all (void)
127{127{
128 GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ());128 GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ());
129 // find if any pad is visible129 /* find if any pad is visible */
130 gboolean open = FALSE;130 gboolean open = FALSE;
131 GSList *i;131 GSList *i;
132 for(i = pads; i != NULL; i = i->next)132 for(i = pads; i != NULL; i = i->next)
@@ -161,7 +161,7 @@
161 no_any_pad = TRUE;161 no_any_pad = TRUE;
162 g_slist_free (pads);162 g_slist_free (pads);
163 163
164 item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL);164 item = gtk_menu_item_new_with_mnemonic (_("_New"));
165 g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ());165 g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ());
166 gtk_container_add (GTK_CONTAINER (menu), item);166 gtk_container_add (GTK_CONTAINER (menu), item);
167 gtk_widget_show (item);167 gtk_widget_show (item);
@@ -177,7 +177,7 @@
177 if (no_any_pad)177 if (no_any_pad)
178 gtk_widget_set_sensitive (item, FALSE);178 gtk_widget_set_sensitive (item, FALSE);
179 179
180 item = gtk_image_menu_item_new_with_mnemonic (_("_Close All"));180 item = gtk_menu_item_new_with_mnemonic (_("_Close All"));
181 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ());181 g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ());
182 gtk_container_add (GTK_CONTAINER (menu), item);182 gtk_container_add (GTK_CONTAINER (menu), item);
183 gtk_widget_show (item);183 gtk_widget_show (item);
@@ -188,15 +188,19 @@
188 gtk_container_add (GTK_CONTAINER (menu), item);188 gtk_container_add (GTK_CONTAINER (menu), item);
189 gtk_widget_show (item);189 gtk_widget_show (item);
190 190
191 // append window titles191 /* append window titles */
192 xpad_tray_append_pad_window_titles_to_menu (menu);192 xpad_tray_append_pad_window_titles_to_menu (menu);
193
194 item = gtk_separator_menu_item_new ();
195 gtk_container_add (GTK_CONTAINER (menu), item);
196 gtk_widget_show (item);
193 197
194 item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL);198 item = gtk_menu_item_new_with_mnemonic (_("_Preferences"));
195 g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL);199 g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL);
196 gtk_container_add (GTK_CONTAINER (menu), item);200 gtk_container_add (GTK_CONTAINER (menu), item);
197 gtk_widget_show (item);201 gtk_widget_show (item);
198 202
199 item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);203 item = gtk_menu_item_new_with_mnemonic (_("_Quit"));
200 g_signal_connect (item, "activate", G_CALLBACK (xpad_app_quit), NULL);204 g_signal_connect (item, "activate", G_CALLBACK (xpad_app_quit), NULL);
201 gtk_container_add (GTK_CONTAINER (menu), item);205 gtk_container_add (GTK_CONTAINER (menu), item);
202 gtk_widget_show (item);206 gtk_widget_show (item);
@@ -237,9 +241,9 @@
237 gint n;241 gint n;
238242
239 pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ());243 pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ());
240 // Order pads according to title.244 /* Order pads according to title. */
241 pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare);245 pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare);
242 // Populate list of windows.246 /* Populate list of windows. */
243 for (l = pads, n = 1; l; l = l->next, n++)247 for (l = pads, n = 1; l; l = l->next, n++)
244 {248 {
245 gchar *title;249 gchar *title;
246250
=== modified file 'src/xpad-undo.c'
--- src/xpad-undo.c 2013-10-23 02:51:47 +0000
+++ src/xpad-undo.c 2014-06-07 00:27:40 +0000
@@ -223,8 +223,7 @@
223static void223static void
224xpad_undo_begin_user_action (GtkTextBuffer *buffer, XpadUndo *undo)224xpad_undo_begin_user_action (GtkTextBuffer *buffer, XpadUndo *undo)
225{225{
226 // A dirty way to silence the compiler for these unused variables.226 /* A dirty way to silence the compiler for these unused variables. */
227 // Feel free to implement these variables in the way they are ment to be used.
228 (void) buffer;227 (void) buffer;
229228
230 undo->priv->user_action++;229 undo->priv->user_action++;
@@ -233,8 +232,7 @@
233static void232static void
234xpad_undo_end_user_action (GtkTextBuffer *buffer, XpadUndo *undo)233xpad_undo_end_user_action (GtkTextBuffer *buffer, XpadUndo *undo)
235{234{
236 // A dirty way to silence the compiler for these unused variables.235 /* A dirty way to silence the compiler for these unused variables. */
237 // Feel free to implement these variables in the way they are ment to be used.
238 (void) buffer;236 (void) buffer;
239237
240 if (undo->priv->user_action > 0)238 if (undo->priv->user_action > 0)
@@ -263,8 +261,10 @@
263 return curr;261 return curr;
264}262}
265263
266/* Redo is impossible after text insertion/deletion, only right after Undo (another Redo),264/*
267 so we have to remove every history entry after the current one if there is any */265 * Redo is impossible after text insertion/deletion, only right after Undo (another Redo),
266 * so we have to remove every history entry after the current one if there is any
267 */
268static void268static void
269xpad_undo_clear_redo_history (XpadUndo *undo)269xpad_undo_clear_redo_history (XpadUndo *undo)
270{270{
@@ -283,8 +283,7 @@
283static void283static void
284xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo)284xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo)
285{285{
286 // A dirty way to silence the compiler for these unused variables.286 /* A dirty way to silence the compiler for these unused variables. */
287 // Feel free to implement these variables in the way they are ment to be used.
288 (void) buffer;287 (void) buffer;
289288
290 if (undo->priv->frozen)289 if (undo->priv->frozen)
@@ -299,15 +298,17 @@
299298
300 gint pos = gtk_text_iter_get_offset (location);299 gint pos = gtk_text_iter_get_offset (location);
301300
302 // safe cast301 /* safe cast */
303 string_length = g_utf8_strlen (text, len);302 string_length = g_utf8_strlen (text, len);
304 if (string_length <= UINT_MAX)303 if (string_length <= UINT_MAX)
305 n_utf8_chars = (gint) string_length;304 n_utf8_chars = (gint) string_length;
306 else305 else
307 g_warning("Casting problem in undo insert text function. Please send a bugreport.");306 g_warning("Casting problem in undo insert text function. Please send a bugreport.");
308307
309 /* Merge similar actions. This is how Undo works in most editors, if there is a series of308 /*
310 1-letter insertions - they are merge for Undo */309 * Merge similar actions. This is how Undo works in most editors, if there
310 * is a series of 1-letter insertions - they are merge for Undo
311 */
311 if (undo->priv->history_curr->data)312 if (undo->priv->history_curr->data)
312 {313 {
313 UserAction *prev_action = undo->priv->history_curr->data;314 UserAction *prev_action = undo->priv->history_curr->data;
@@ -315,9 +316,9 @@
315 if (prev_action->action_type == USER_ACTION_INSERT_TEXT)316 if (prev_action->action_type == USER_ACTION_INSERT_TEXT)
316 {317 {
317 /* series of 1-letter insertions */318 /* series of 1-letter insertions */
318 if (n_utf8_chars == 1 // this is a 1-letter insertion319 if (n_utf8_chars == 1 /* this is a 1-letter insertion */
319 && pos == prev_action->end // placed right after the previous text320 && pos == prev_action->end /* placed right after the previous text */
320 && (prev_action->n_utf8_chars == 1 || prev_action->merged)) // with which we should merge321 && (prev_action->n_utf8_chars == 1 || prev_action->merged)) /* with which we should merge */
321 {322 {
322 /* if there was a space stop merging unless that was a series of spaces */323 /* if there was a space stop merging unless that was a series of spaces */
323 if ((!g_unichar_isspace ((gunichar) prev_action->text[0]) && !g_ascii_isspace ((gunichar) text[0])) ||324 if ((!g_unichar_isspace ((gunichar) prev_action->text[0]) && !g_ascii_isspace ((gunichar) text[0])) ||
@@ -345,13 +346,14 @@
345 action->n_utf8_chars = n_utf8_chars;346 action->n_utf8_chars = n_utf8_chars;
346 action->merged = FALSE;347 action->merged = FALSE;
347348
348 /* since each operation clears redo we know that there349 /*
349 is nothing after history_curr at this point so we350 * Since each operation clears redo we know that there is nothing
350 insert right after it. history_start won't change351 * after history_curr at this point so we insert right after it.
351 since it is a left guard - not NULL */352 * history_start won't change since it is a left guard - not NULL
353 */
352 GList *dummy_start = g_list_append (undo->priv->history_curr, action);354 GList *dummy_start = g_list_append (undo->priv->history_curr, action);
353 // A dirty way to silence the compiler for these unused variables.355
354 // Feel free to implement these variables in the way they are ment to be used.356 /* A dirty way to silence the compiler for these unused variables. */
355 (void) dummy_start;357 (void) dummy_start;
356358
357 undo->priv->history_curr = g_list_next (undo->priv->history_curr);359 undo->priv->history_curr = g_list_next (undo->priv->history_curr);
@@ -363,8 +365,7 @@
363static void365static void
364xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo)366xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo)
365{367{
366 // A dirty way to silence the compiler for these unused variables.368 /* A dirty way to silence the compiler for these unused variables. */
367 // Feel free to implement these variables in the way they are ment to be used.
368 (void) buffer;369 (void) buffer;
369370
370 if (undo->priv->frozen)371 if (undo->priv->frozen)
@@ -382,7 +383,7 @@
382 gint end_offset = gtk_text_iter_get_offset (end);383 gint end_offset = gtk_text_iter_get_offset (end);
383 gint len = abs (end_offset - start_offset);384 gint len = abs (end_offset - start_offset);
384385
385 // safe cast386 /* safe cast */
386 string_length = g_utf8_strlen (text, len);387 string_length = g_utf8_strlen (text, len);
387 if (string_length <= UINT_MAX)388 if (string_length <= UINT_MAX)
388 n_utf8_chars = (gint) string_length;389 n_utf8_chars = (gint) string_length;
@@ -399,8 +400,8 @@
399 action->merged = FALSE;400 action->merged = FALSE;
400401
401 GList *dummy_start = g_list_append (undo->priv->history_curr, action);402 GList *dummy_start = g_list_append (undo->priv->history_curr, action);
402 // A dirty way to silence the compiler for these unused variables.403
403 // Feel free to implement these variables in the way they are ment to be used.404 /* A dirty way to silence the compiler for these unused variables. */
404 (void) dummy_start;405 (void) dummy_start;
405406
406 undo->priv->history_curr = g_list_next (undo->priv->history_curr);407 undo->priv->history_curr = g_list_next (undo->priv->history_curr);
@@ -428,8 +429,8 @@
428 action->merged = FALSE;429 action->merged = FALSE;
429430
430 GList *dummy_start = g_list_append (undo->priv->history_curr, action);431 GList *dummy_start = g_list_append (undo->priv->history_curr, action);
431 // A dirty way to silence the compiler for these unused variables.432
432 // Feel free to implement these variables in the way they are ment to be used.433 /* A dirty way to silence the compiler for these unused variables. */
433 (void) dummy_start;434 (void) dummy_start;
434435
435 undo->priv->history_curr = g_list_next (undo->priv->history_curr);436 undo->priv->history_curr = g_list_next (undo->priv->history_curr);
@@ -456,8 +457,8 @@
456 action->merged = FALSE;457 action->merged = FALSE;
457458
458 GList *dummy_start = g_list_append (undo->priv->history_curr, action);459 GList *dummy_start = g_list_append (undo->priv->history_curr, action);
459 // A dirty way to silence the compiler for these unused variables.460
460 // Feel free to implement these variables in the way they are ment to be used.461 /* A dirty way to silence the compiler for these unused variables. */
461 (void) dummy_start;462 (void) dummy_start;
462463
463 undo->priv->history_curr = g_list_next (undo->priv->history_curr);464 undo->priv->history_curr = g_list_next (undo->priv->history_curr);
464465
=== modified file 'xpad.desktop.in'
--- xpad.desktop.in 2008-09-20 21:31:43 +0000
+++ xpad.desktop.in 2014-06-07 00:27:40 +0000
@@ -15,4 +15,4 @@
1515
16Type=Application16Type=Application
17Categories=GTK;Utility;17Categories=GTK;Utility;
1818X-LXQt-Need-Tray=true

Subscribers

People subscribed via source and target branches