Merge lp:~arthurborsboom/xpad/xpad-4.3 into lp:xpad
- xpad-4.3
- Merge into trunk
Proposed by
Arthur Borsboom
| Status: | Merged | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Merged at revision: | 679 | ||||||||||||
| Proposed branch: | lp:~arthurborsboom/xpad/xpad-4.3 | ||||||||||||
| Merge into: | lp:xpad | ||||||||||||
| Diff against target: |
3868 lines (+935/-1228) (has conflicts) 33 files modified
ChangeLog (+5/-0) src/fio.c (+5/-9) src/fio.h (+1/-2) src/help.c (+2/-4) src/help.h (+21/-0) src/xpad-app.c (+54/-53) src/xpad-app.h (+20/-18) src/xpad-grip-tool-item.c (+21/-19) src/xpad-grip-tool-item.h (+20/-19) src/xpad-pad-group.c (+26/-26) src/xpad-pad-group.h (+20/-18) src/xpad-pad-properties.c (+19/-86) src/xpad-pad-properties.h (+1/-16) src/xpad-pad.c (+106/-83) src/xpad-pad.h (+1/-0) src/xpad-periodic.c (+27/-37) src/xpad-periodic.h (+21/-9) src/xpad-preferences.c (+186/-195) src/xpad-preferences.h (+1/-0) src/xpad-session-manager.c (+6/-12) src/xpad-session-manager.h (+2/-1) src/xpad-settings.c (+209/-426) src/xpad-settings.h (+2/-55) src/xpad-text-buffer.c (+23/-22) src/xpad-text-buffer.h (+21/-21) src/xpad-text-view.c (+40/-28) src/xpad-text-view.h (+20/-20) src/xpad-toolbar.c (+3/-6) src/xpad-toolbar.h (+0/-3) src/xpad-tray.c (+43/-27) src/xpad-tray.h (+4/-5) src/xpad-undo.c (+3/-4) src/xpad-undo.h (+2/-4) Contents conflict in po/xpad.pot |
||||||||||||
| To merge this branch: | bzr merge lp:~arthurborsboom/xpad/xpad-4.3 | ||||||||||||
| Related bugs: |
|
||||||||||||
| Related blueprints: |
Transparent background
(Low)
Xpad - autostart options
(Medium)
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Arthur Borsboom | Approve | ||
|
Review via email:
|
|||
Commit message
Description of the change
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
| 1 | === modified file 'ChangeLog' | |||
| 2 | --- ChangeLog 2014-06-07 00:36:45 +0000 | |||
| 3 | +++ ChangeLog 2014-06-13 15:52:27 +0000 | |||
| 4 | @@ -1,4 +1,5 @@ | |||
| 5 | 1 | Version 4.3 | 1 | Version 4.3 |
| 6 | 2 | * New: Systray - ability to hide the tray icon (#890334) | ||
| 7 | 2 | * New: Toolbar - ability to add multiple separators (#351775) | 3 | * New: Toolbar - ability to add multiple separators (#351775) |
| 8 | 3 | * New: Toolbar - ability to add paste button on toolbar (#351775) | 4 | * New: Toolbar - ability to add paste button on toolbar (#351775) |
| 9 | 4 | * New: Preferences - Ability to set the automatic start of Xpad in the Preferences menu (#405314) | 5 | * New: Preferences - Ability to set the automatic start of Xpad in the Preferences menu (#405314) |
| 10 | @@ -21,6 +22,10 @@ | |||
| 11 | 21 | * Fix: Technical - Improve the hiding of pads at Xpad launch (#405314) | 22 | * Fix: Technical - Improve the hiding of pads at Xpad launch (#405314) |
| 12 | 22 | * Fix: Technical - Added thread safe handling of new preferences | 23 | * Fix: Technical - Added thread safe handling of new preferences |
| 13 | 23 | * Fix: Technical - Ensured the use of GNU C libraries, so the readlink function is available | 24 | * Fix: Technical - Ensured the use of GNU C libraries, so the readlink function is available |
| 14 | 25 | * Fix: Technical - Prevented dispose functions calling NULL objects leading to errors | ||
| 15 | 26 | * Fix: Technical - Reduced the amount of functions by using generic setters and getters | ||
| 16 | 27 | * Fix: Technical - Reduced the number of includes | ||
| 17 | 28 | * Fix: Credits - all files use the same credits format | ||
| 18 | 24 | 29 | ||
| 19 | 25 | Version 4.2 | 30 | Version 4.2 |
| 20 | 26 | * New: Undo functionality such as CTRL-Z (#1121740) | 31 | * New: Undo functionality such as CTRL-Z (#1121740) |
| 21 | 27 | 32 | ||
| 22 | === renamed file 'po/xpad.pot' => 'po/xpad.pot.THIS' | |||
| 23 | === modified file 'src/fio.c' | |||
| 24 | --- src/fio.c 2014-06-04 21:08:58 +0000 | |||
| 25 | +++ src/fio.c 2014-06-13 15:52:27 +0000 | |||
| 26 | @@ -1,7 +1,8 @@ | |||
| 27 | 1 | /* | 1 | /* |
| 28 | 2 | 2 | ||
| 29 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 31 | 4 | Copytight (c) 2011 David Hull | 4 | Copyright (c) 2011 David Hull |
| 32 | 5 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 33 | 5 | 6 | ||
| 34 | 6 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 35 | 7 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| 36 | @@ -19,16 +20,11 @@ | |||
| 37 | 19 | 20 | ||
| 38 | 20 | */ | 21 | */ |
| 39 | 21 | 22 | ||
| 41 | 22 | #include "../config.h" | 23 | #include <stdlib.h> |
| 42 | 24 | #include <gio/gio.h> | ||
| 43 | 25 | #include <glib/gstdio.h> | ||
| 44 | 23 | #include <glib/gi18n.h> | 26 | #include <glib/gi18n.h> |
| 45 | 24 | #include <glib/gstdio.h> | ||
| 46 | 25 | #include <gio/gio.h> | ||
| 47 | 26 | #include <errno.h> | ||
| 48 | 27 | #include <string.h> | 27 | #include <string.h> |
| 49 | 28 | #include <stdlib.h> | ||
| 50 | 29 | #include <stdio.h> | ||
| 51 | 30 | #include <unistd.h> | ||
| 52 | 31 | #include "fio.h" | ||
| 53 | 32 | #include "xpad-app.h" | 28 | #include "xpad-app.h" |
| 54 | 33 | 29 | ||
| 55 | 34 | /* Sets filename to full path of filename (prepends xpad_app_get_config_dir () | 30 | /* Sets filename to full path of filename (prepends xpad_app_get_config_dir () |
| 56 | 35 | 31 | ||
| 57 | === modified file 'src/fio.h' | |||
| 58 | --- src/fio.h 2008-09-21 00:03:40 +0000 | |||
| 59 | +++ src/fio.h 2014-06-13 15:52:27 +0000 | |||
| 60 | @@ -1,6 +1,7 @@ | |||
| 61 | 1 | /* | 1 | /* |
| 62 | 2 | 2 | ||
| 63 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 64 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 65 | 4 | 5 | ||
| 66 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 67 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 68 | @@ -21,8 +22,6 @@ | |||
| 69 | 21 | #ifndef _FIO_H_ | 22 | #ifndef _FIO_H_ |
| 70 | 22 | #define _FIO_H_ | 23 | #define _FIO_H_ |
| 71 | 23 | 24 | ||
| 72 | 24 | #include <gtk/gtk.h> | ||
| 73 | 25 | |||
| 74 | 26 | gchar *fio_get_file (const gchar *name); | 25 | gchar *fio_get_file (const gchar *name); |
| 75 | 27 | gboolean fio_set_file (const gchar *name, const gchar *value); | 26 | gboolean fio_set_file (const gchar *name, const gchar *value); |
| 76 | 28 | void fio_remove_file (const gchar *filename); | 27 | void fio_remove_file (const gchar *filename); |
| 77 | 29 | 28 | ||
| 78 | === modified file 'src/help.c' | |||
| 79 | --- src/help.c 2013-10-31 21:17:36 +0000 | |||
| 80 | +++ src/help.c 2014-06-13 15:52:27 +0000 | |||
| 81 | @@ -1,6 +1,7 @@ | |||
| 82 | 1 | /* | 1 | /* |
| 83 | 2 | 2 | ||
| 84 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 85 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 86 | 4 | 5 | ||
| 87 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 88 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 89 | @@ -18,11 +19,8 @@ | |||
| 90 | 18 | 19 | ||
| 91 | 19 | */ | 20 | */ |
| 92 | 20 | 21 | ||
| 94 | 21 | #include "../config.h" | 22 | #include <gtk/gtk.h> |
| 95 | 22 | #include <glib/gi18n.h> | 23 | #include <glib/gi18n.h> |
| 96 | 23 | #include <string.h> | ||
| 97 | 24 | #include <gtk/gtk.h> | ||
| 98 | 25 | #include "help.h" | ||
| 99 | 26 | 24 | ||
| 100 | 27 | GtkWidget *help_window = NULL; | 25 | GtkWidget *help_window = NULL; |
| 101 | 28 | 26 | ||
| 102 | 29 | 27 | ||
| 103 | === modified file 'src/help.h' | |||
| 104 | --- src/help.h 2003-09-02 19:13:44 +0000 | |||
| 105 | +++ src/help.h 2014-06-13 15:52:27 +0000 | |||
| 106 | @@ -1,3 +1,24 @@ | |||
| 107 | 1 | /* | ||
| 108 | 2 | |||
| 109 | 3 | Copyright (c) 2001-2007 Michael Terry | ||
| 110 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 111 | 5 | |||
| 112 | 6 | This program is free software; you can redistribute it and/or modify | ||
| 113 | 7 | it under the terms of the GNU General Public License as published by | ||
| 114 | 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 115 | 9 | (at your option) any later version. | ||
| 116 | 10 | |||
| 117 | 11 | This program is distributed in the hope that it will be useful, | ||
| 118 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 119 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 120 | 14 | GNU General Public License for more details. | ||
| 121 | 15 | |||
| 122 | 16 | You should have received a copy of the GNU General Public License | ||
| 123 | 17 | along with this program; if not, write to the Free Software | ||
| 124 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 125 | 19 | |||
| 126 | 20 | */ | ||
| 127 | 21 | |||
| 128 | 1 | #ifndef HELP_H | 22 | #ifndef HELP_H |
| 129 | 2 | #define HELP_H | 23 | #define HELP_H |
| 130 | 3 | 24 | ||
| 131 | 4 | 25 | ||
| 132 | === modified file 'src/xpad-app.c' | |||
| 133 | --- src/xpad-app.c 2014-06-07 00:19:07 +0000 | |||
| 134 | +++ src/xpad-app.c 2014-06-13 15:52:27 +0000 | |||
| 135 | @@ -1,50 +1,44 @@ | |||
| 155 | 1 | /** | 1 | /* |
| 156 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 157 | 3 | * Copyright (c) 2009 Paul Ivanov | 3 | Copyright (c) 2001-2007 Michael Terry |
| 158 | 4 | * Copyright (c) 2013 Arthur Borsboom | 4 | Copyright (c) 2009 Paul Ivanov |
| 159 | 5 | * | 5 | Copyright (c) 2013-2014 Arthur Borsboom |
| 160 | 6 | * This program is free software; you can redistribute it and/or modify | 6 | |
| 161 | 7 | * it under the terms of the GNU General Public License as published by | 7 | This program is free software; you can redistribute it and/or modify |
| 162 | 8 | * the Free Software Foundation; either version 3 of the License, or | 8 | it under the terms of the GNU General Public License as published by |
| 163 | 9 | * (at your option) any later version. | 9 | the Free Software Foundation; either version 3 of the License, or |
| 164 | 10 | * | 10 | (at your option) any later version. |
| 165 | 11 | * This program is distributed in the hope that it will be useful, | 11 | |
| 166 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | This program is distributed in the hope that it will be useful, |
| 167 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 168 | 14 | * GNU General Public License for more details. | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 169 | 15 | * | 15 | GNU General Public License for more details. |
| 170 | 16 | * You should have received a copy of the GNU General Public License | 16 | |
| 171 | 17 | * along with this program; if not, write to the Free Software | 17 | You should have received a copy of the GNU General Public License |
| 172 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | along with this program; if not, write to the Free Software |
| 173 | 19 | */ | 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 174 | 20 | |||
| 175 | 21 | */ | ||
| 176 | 20 | 22 | ||
| 177 | 21 | /* required by socket stuff */ | 23 | /* required by socket stuff */ |
| 178 | 22 | /* define _GNU_SOURCE here because that makes our sockets work nice | 24 | /* define _GNU_SOURCE here because that makes our sockets work nice |
| 179 | 23 | Unfortunately, we lose portability... */ | 25 | Unfortunately, we lose portability... */ |
| 181 | 24 | #define _GNU_SOURCE 1 | 26 | |
| 182 | 25 | #include "../config.h" | 27 | #include "../config.h" |
| 193 | 26 | #include <stdio.h> | 28 | #include <glib.h> |
| 184 | 27 | #include <unistd.h> | ||
| 185 | 28 | #include <sys/un.h> | ||
| 186 | 29 | #include <sys/socket.h> | ||
| 187 | 30 | #include <sys/select.h> | ||
| 188 | 31 | #include <errno.h> | ||
| 189 | 32 | |||
| 190 | 33 | #include <string.h> | ||
| 191 | 34 | #include <stdlib.h> /* for exit */ | ||
| 192 | 35 | |||
| 194 | 36 | #include <glib/gi18n.h> | 29 | #include <glib/gi18n.h> |
| 195 | 37 | #include <glib/gstdio.h> | 30 | #include <glib/gstdio.h> |
| 198 | 38 | 31 | #include <string.h> | |
| 199 | 39 | #include "fio.h" /* for fio_get_info_from_file */ | 32 | #include <sys/socket.h> |
| 200 | 33 | #include <sys/un.h> | ||
| 201 | 34 | #include <stdio.h> | ||
| 202 | 35 | #include <stdlib.h> | ||
| 203 | 40 | #include "help.h" | 36 | #include "help.h" |
| 204 | 41 | #include "prefix.h" | ||
| 205 | 42 | #include "xpad-app.h" | 37 | #include "xpad-app.h" |
| 206 | 43 | #include "xpad-pad.h" | 38 | #include "xpad-pad.h" |
| 207 | 44 | #include "xpad-pad-group.h" | 39 | #include "xpad-pad-group.h" |
| 208 | 45 | #include "xpad-periodic.h" | 40 | #include "xpad-periodic.h" |
| 209 | 46 | #include "xpad-session-manager.h" | 41 | #include "xpad-session-manager.h" |
| 210 | 47 | #include "xpad-settings.h" | ||
| 211 | 48 | #include "xpad-tray.h" | 42 | #include "xpad-tray.h" |
| 212 | 49 | 43 | ||
| 213 | 50 | /* Seems that some systems (sun-sparc-solaris2.8 at least), need the following three #defines. | 44 | /* Seems that some systems (sun-sparc-solaris2.8 at least), need the following three #defines. |
| 214 | @@ -87,8 +81,8 @@ | |||
| 215 | 87 | 81 | ||
| 216 | 88 | static gboolean config_dir_exists (void); | 82 | static gboolean config_dir_exists (void); |
| 217 | 89 | static gchar *make_config_dir (void); | 83 | static gchar *make_config_dir (void); |
| 220 | 90 | static void register_stock_icons (void); | 84 | static void register_stock_icons (void); |
| 221 | 91 | static gint xpad_app_load_pads (void); | 85 | static gint xpad_app_load_pads (void); |
| 222 | 92 | static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group); | 86 | static gboolean xpad_app_quit_if_no_pads (XpadPadGroup *group); |
| 223 | 93 | static gboolean xpad_app_first_idle_check (XpadPadGroup *group); | 87 | static gboolean xpad_app_first_idle_check (XpadPadGroup *group); |
| 224 | 94 | static gboolean xpad_app_pass_args (void); | 88 | static gboolean xpad_app_pass_args (void); |
| 225 | @@ -157,13 +151,16 @@ | |||
| 226 | 157 | xpad_global_settings = xpad_settings_new (); | 151 | xpad_global_settings = xpad_settings_new (); |
| 227 | 158 | 152 | ||
| 228 | 159 | /* Delay program startup, if user configured it, to wait for example for the loading of the systray. */ | 153 | /* Delay program startup, if user configured it, to wait for example for the loading of the systray. */ |
| 231 | 160 | if (xpad_settings_get_autostart_delay (xpad_global_settings)) | 154 | guint autostart_delay; |
| 232 | 161 | sleep(xpad_settings_get_autostart_delay (xpad_global_settings)); | 155 | g_object_get (xpad_global_settings, "autostart-delay", &autostart_delay, NULL); |
| 233 | 156 | |||
| 234 | 157 | if (autostart_delay) | ||
| 235 | 158 | sleep(autostart_delay); | ||
| 236 | 162 | 159 | ||
| 237 | 163 | pad_group = xpad_pad_group_new(); | 160 | pad_group = xpad_pad_group_new(); |
| 238 | 164 | process_remote_args (&xpad_argc, &xpad_argv, TRUE, xpad_global_settings); | 161 | process_remote_args (&xpad_argc, &xpad_argv, TRUE, xpad_global_settings); |
| 239 | 165 | 162 | ||
| 241 | 166 | xpad_tray_open (); | 163 | xpad_tray_init (xpad_global_settings); |
| 242 | 167 | xpad_session_manager_init (); | 164 | xpad_session_manager_init (); |
| 243 | 168 | 165 | ||
| 244 | 169 | /* Initialize Xpad-periodic module */ | 166 | /* Initialize Xpad-periodic module */ |
| 245 | @@ -198,8 +195,7 @@ | |||
| 246 | 198 | } | 195 | } |
| 247 | 199 | 196 | ||
| 248 | 200 | gint main (gint argc, gchar **argv) | 197 | gint main (gint argc, gchar **argv) |
| 251 | 201 | { | 198 | { xpad_app_init (argc, argv); |
| 250 | 202 | xpad_app_init (argc, argv); | ||
| 252 | 203 | 199 | ||
| 253 | 204 | gtk_main (); | 200 | gtk_main (); |
| 254 | 205 | 201 | ||
| 255 | @@ -255,13 +251,13 @@ | |||
| 256 | 255 | /* Free the memory used by group. */ | 251 | /* Free the memory used by group. */ |
| 257 | 256 | g_object_unref (xpad_app_get_pad_group()); | 252 | g_object_unref (xpad_app_get_pad_group()); |
| 258 | 257 | 253 | ||
| 259 | 254 | /* Free the memory used by the tray icon and its menu. */ | ||
| 260 | 255 | xpad_tray_dispose (xpad_global_settings); | ||
| 261 | 256 | |||
| 262 | 258 | /* Free the memory used by the settings menu. */ | 257 | /* Free the memory used by the settings menu. */ |
| 263 | 259 | g_object_unref (xpad_global_settings); | 258 | g_object_unref (xpad_global_settings); |
| 264 | 260 | xpad_global_settings = NULL; /* This is needed due to the asynchronous finalizing process. */ | 259 | xpad_global_settings = NULL; /* This is needed due to the asynchronous finalizing process. */ |
| 265 | 261 | 260 | ||
| 266 | 262 | /* Free the memory used by the tray icon and its menu. */ | ||
| 267 | 263 | xpad_tray_close (); | ||
| 268 | 264 | |||
| 269 | 265 | /* Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind. */ | 261 | /* Free the theme reference. Unfortunately GTK3 leaves about 1000 objects behind. */ |
| 270 | 266 | g_object_unref (gtk_icon_theme_get_default ()); | 262 | g_object_unref (gtk_icon_theme_get_default ()); |
| 271 | 267 | 263 | ||
| 272 | @@ -395,9 +391,7 @@ | |||
| 273 | 395 | static void | 391 | static void |
| 274 | 396 | register_stock_icons (void) | 392 | register_stock_icons (void) |
| 275 | 397 | { | 393 | { |
| 279 | 398 | GtkIconTheme *theme; | 394 | GtkIconTheme *theme = gtk_icon_theme_get_default (); |
| 277 | 399 | |||
| 278 | 400 | theme = gtk_icon_theme_get_default (); | ||
| 280 | 401 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); | 395 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); |
| 281 | 402 | } | 396 | } |
| 282 | 403 | 397 | ||
| 283 | @@ -865,17 +859,24 @@ | |||
| 284 | 865 | if (have_gtk && option_smid) | 859 | if (have_gtk && option_smid) |
| 285 | 866 | xpad_session_manager_set_id (option_smid); | 860 | xpad_session_manager_set_id (option_smid); |
| 286 | 867 | 861 | ||
| 288 | 868 | if (have_gtk && (option_new || xpad_settings_get_autostart_new_pad (xpad_settings))) | 862 | if (!option_new) |
| 289 | 863 | g_object_get (xpad_global_settings, "autostart-new-pad", &option_new, NULL); | ||
| 290 | 864 | |||
| 291 | 865 | if (have_gtk && option_new) | ||
| 292 | 869 | { | 866 | { |
| 293 | 870 | GtkWidget *pad = xpad_pad_new (pad_group); | 867 | GtkWidget *pad = xpad_pad_new (pad_group); |
| 294 | 871 | gtk_widget_show (pad); | 868 | gtk_widget_show (pad); |
| 295 | 872 | } | 869 | } |
| 296 | 870 | |||
| 297 | 871 | if (!option_hide && !option_show) { | ||
| 298 | 872 | guint display_pads; | ||
| 299 | 873 | g_object_get (xpad_settings, "autostart-display-pads", &display_pads, NULL); | ||
| 300 | 874 | if (display_pads == 0) | ||
| 301 | 875 | option_show = TRUE; | ||
| 302 | 876 | else if (display_pads == 1) | ||
| 303 | 877 | option_hide = TRUE; | ||
| 304 | 878 | } | ||
| 305 | 873 | 879 | ||
| 306 | 874 | if (xpad_settings_get_autostart_display_pads (xpad_settings) == 0) | ||
| 307 | 875 | option_show = TRUE; | ||
| 308 | 876 | if (xpad_settings_get_autostart_display_pads (xpad_settings) == 1) | ||
| 309 | 877 | option_hide = TRUE; | ||
| 310 | 878 | |||
| 311 | 879 | if (have_gtk && option_files) | 880 | if (have_gtk && option_files) |
| 312 | 880 | { | 881 | { |
| 313 | 881 | int i; | 882 | int i; |
| 314 | 882 | 883 | ||
| 315 | === modified file 'src/xpad-app.h' | |||
| 316 | --- src/xpad-app.h 2014-06-04 12:36:36 +0000 | |||
| 317 | +++ src/xpad-app.h 2014-06-13 15:52:27 +0000 | |||
| 318 | @@ -1,20 +1,23 @@ | |||
| 336 | 1 | /** | 1 | /* |
| 337 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 338 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 339 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 340 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 341 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 342 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 343 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 344 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 345 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 346 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 347 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 348 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 349 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 350 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 351 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 352 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 353 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 354 | 19 | |||
| 355 | 20 | */ | ||
| 356 | 18 | 21 | ||
| 357 | 19 | #ifndef __XPAD_APP_H__ | 22 | #ifndef __XPAD_APP_H__ |
| 358 | 20 | #define __XPAD_APP_H__ | 23 | #define __XPAD_APP_H__ |
| 359 | @@ -32,7 +35,6 @@ | |||
| 360 | 32 | const gchar *xpad_app_get_program_path (void); | 35 | const gchar *xpad_app_get_program_path (void); |
| 361 | 33 | XpadPadGroup *xpad_app_get_pad_group (void); | 36 | XpadPadGroup *xpad_app_get_pad_group (void); |
| 362 | 34 | XpadSettings *xpad_global_settings; | 37 | XpadSettings *xpad_global_settings; |
| 363 | 35 | gboolean xpad_app_get_translucent (void); | ||
| 364 | 36 | void xpad_app_quit (void); | 38 | void xpad_app_quit (void); |
| 365 | 37 | 39 | ||
| 366 | 38 | G_END_DECLS | 40 | G_END_DECLS |
| 367 | 39 | 41 | ||
| 368 | === modified file 'src/xpad-grip-tool-item.c' | |||
| 369 | --- src/xpad-grip-tool-item.c 2013-10-31 21:17:36 +0000 | |||
| 370 | +++ src/xpad-grip-tool-item.c 2014-06-13 15:52:27 +0000 | |||
| 371 | @@ -1,22 +1,24 @@ | |||
| 391 | 1 | /** | 1 | /* |
| 392 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 393 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 394 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 395 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 396 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 397 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 398 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 399 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 400 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 401 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 402 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 403 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 404 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 405 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 406 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 407 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 408 | 18 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 409 | 19 | #include "../config.h" | 19 | |
| 410 | 20 | */ | ||
| 411 | 21 | |||
| 412 | 20 | #include "xpad-grip-tool-item.h" | 22 | #include "xpad-grip-tool-item.h" |
| 413 | 21 | 23 | ||
| 414 | 22 | struct XpadGripToolItemPrivate | 24 | struct XpadGripToolItemPrivate |
| 415 | 23 | 25 | ||
| 416 | === modified file 'src/xpad-grip-tool-item.h' | |||
| 417 | --- src/xpad-grip-tool-item.h 2008-09-21 00:03:40 +0000 | |||
| 418 | +++ src/xpad-grip-tool-item.h 2014-06-13 15:52:27 +0000 | |||
| 419 | @@ -1,20 +1,23 @@ | |||
| 437 | 1 | /** | 1 | /* |
| 438 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 439 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 440 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 441 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 442 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 443 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 444 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 445 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 446 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 447 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 448 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 449 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 450 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 451 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 452 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 453 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 454 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 455 | 19 | |||
| 456 | 20 | */ | ||
| 457 | 18 | 21 | ||
| 458 | 19 | #ifndef __XPAD_GRIP_TOOL_ITEM_H__ | 22 | #ifndef __XPAD_GRIP_TOOL_ITEM_H__ |
| 459 | 20 | #define __XPAD_GRIP_TOOL_ITEM_H__ | 23 | #define __XPAD_GRIP_TOOL_ITEM_H__ |
| 460 | @@ -37,8 +40,6 @@ | |||
| 461 | 37 | struct XpadGripToolItem | 40 | struct XpadGripToolItem |
| 462 | 38 | { | 41 | { |
| 463 | 39 | GtkToolItem parent; | 42 | GtkToolItem parent; |
| 464 | 40 | |||
| 465 | 41 | /* private */ | ||
| 466 | 42 | XpadGripToolItemPrivate *priv; | 43 | XpadGripToolItemPrivate *priv; |
| 467 | 43 | }; | 44 | }; |
| 468 | 44 | 45 | ||
| 469 | 45 | 46 | ||
| 470 | === modified file 'src/xpad-pad-group.c' | |||
| 471 | --- src/xpad-pad-group.c 2014-06-04 12:36:36 +0000 | |||
| 472 | +++ src/xpad-pad-group.c 2014-06-13 15:52:27 +0000 | |||
| 473 | @@ -1,25 +1,26 @@ | |||
| 494 | 1 | /** | 1 | /* |
| 495 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 496 | 3 | * Copyright (c) 2009 Paul Ivanov | 3 | Copyright (c) 2001-2007 Michael Terry |
| 497 | 4 | * | 4 | Copyright (c) 2009 Paul Ivanov |
| 498 | 5 | * This program is free software; you can redistribute it and/or modify | 5 | Copyright (c) 2013-2014 Arthur Borsboom |
| 499 | 6 | * it under the terms of the GNU General Public License as published by | 6 | |
| 500 | 7 | * the Free Software Foundation; either version 3 of the License, or | 7 | This program is free software; you can redistribute it and/or modify |
| 501 | 8 | * (at your option) any later version. | 8 | it under the terms of the GNU General Public License as published by |
| 502 | 9 | * | 9 | the Free Software Foundation; either version 3 of the License, or |
| 503 | 10 | * This program is distributed in the hope that it will be useful, | 10 | (at your option) any later version. |
| 504 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | |
| 505 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | This program is distributed in the hope that it will be useful, |
| 506 | 13 | * GNU General Public License for more details. | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 507 | 14 | * | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 508 | 15 | * You should have received a copy of the GNU General Public License | 15 | GNU General Public License for more details. |
| 509 | 16 | * along with this program; if not, write to the Free Software | 16 | |
| 510 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | You should have received a copy of the GNU General Public License |
| 511 | 18 | */ | 18 | along with this program; if not, write to the Free Software |
| 512 | 19 | 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 513 | 20 | #include "../config.h" | 20 | |
| 514 | 21 | */ | ||
| 515 | 22 | |||
| 516 | 21 | #include "xpad-pad-group.h" | 23 | #include "xpad-pad-group.h" |
| 517 | 22 | #include "xpad-settings.h" | ||
| 518 | 23 | #include "xpad-pad.h" | 24 | #include "xpad-pad.h" |
| 519 | 24 | 25 | ||
| 520 | 25 | struct XpadPadGroupPrivate | 26 | struct XpadPadGroupPrivate |
| 521 | @@ -29,8 +30,9 @@ | |||
| 522 | 29 | 30 | ||
| 523 | 30 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPadGroup, xpad_pad_group, G_TYPE_OBJECT) | 31 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPadGroup, xpad_pad_group, G_TYPE_OBJECT) |
| 524 | 31 | 32 | ||
| 527 | 32 | static void xpad_pad_group_dispose (GObject *object); | 33 | static void xpad_pad_group_dispose (GObject *object); |
| 528 | 33 | static void xpad_pad_group_finalize (GObject *object); | 34 | static void xpad_pad_group_finalize (GObject *object); |
| 529 | 35 | static void xpad_pad_group_save_unsaved_all (XpadPadGroup *group); | ||
| 530 | 34 | 36 | ||
| 531 | 35 | enum { | 37 | enum { |
| 532 | 36 | PROP_0 | 38 | PROP_0 |
| 533 | @@ -180,9 +182,7 @@ | |||
| 534 | 180 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_close, NULL); | 182 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_close, NULL); |
| 535 | 181 | } | 183 | } |
| 536 | 182 | 184 | ||
| 540 | 183 | void | 185 | static void xpad_pad_group_save_unsaved_all (XpadPadGroup *group) { |
| 538 | 184 | xpad_pad_group_save_unsaved_all (XpadPadGroup *group) | ||
| 539 | 185 | { | ||
| 541 | 186 | if (group) | 186 | if (group) |
| 542 | 187 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_save_unsaved, NULL); | 187 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_save_unsaved, NULL); |
| 543 | 188 | } | 188 | } |
| 544 | 189 | 189 | ||
| 545 | === modified file 'src/xpad-pad-group.h' | |||
| 546 | --- src/xpad-pad-group.h 2013-10-18 18:31:20 +0000 | |||
| 547 | +++ src/xpad-pad-group.h 2014-06-13 15:52:27 +0000 | |||
| 548 | @@ -1,20 +1,23 @@ | |||
| 566 | 1 | /** | 1 | /* |
| 567 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 568 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 569 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 570 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 571 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 572 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 573 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 574 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 575 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 576 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 577 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 578 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 579 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 580 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 581 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 582 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 583 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 584 | 19 | |||
| 585 | 20 | */ | ||
| 586 | 18 | 21 | ||
| 587 | 19 | #ifndef __XPAD_PAD_GROUP_H__ | 22 | #ifndef __XPAD_PAD_GROUP_H__ |
| 588 | 20 | #define __XPAD_PAD_GROUP_H__ | 23 | #define __XPAD_PAD_GROUP_H__ |
| 589 | @@ -63,7 +66,6 @@ | |||
| 590 | 63 | void xpad_pad_group_toggle_hide (XpadPadGroup *group); | 66 | void xpad_pad_group_toggle_hide (XpadPadGroup *group); |
| 591 | 64 | GSList * xpad_pad_group_get_pads (XpadPadGroup *group); | 67 | GSList * xpad_pad_group_get_pads (XpadPadGroup *group); |
| 592 | 65 | gint xpad_pad_group_num_visible_pads (XpadPadGroup *group); | 68 | gint xpad_pad_group_num_visible_pads (XpadPadGroup *group); |
| 593 | 66 | void xpad_pad_group_save_unsaved_all (XpadPadGroup *group); | ||
| 594 | 67 | void xpad_pad_group_destroy_pads (XpadPadGroup *group); | 69 | void xpad_pad_group_destroy_pads (XpadPadGroup *group); |
| 595 | 68 | 70 | ||
| 596 | 69 | G_END_DECLS | 71 | G_END_DECLS |
| 597 | 70 | 72 | ||
| 598 | === modified file 'src/xpad-pad-properties.c' | |||
| 599 | --- src/xpad-pad-properties.c 2014-06-04 12:36:36 +0000 | |||
| 600 | +++ src/xpad-pad-properties.c 2014-06-13 15:52:27 +0000 | |||
| 601 | @@ -1,6 +1,7 @@ | |||
| 602 | 1 | /* | 1 | /* |
| 603 | 2 | 2 | ||
| 604 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 605 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 606 | 4 | 5 | ||
| 607 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 608 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 609 | @@ -18,9 +19,9 @@ | |||
| 610 | 18 | 19 | ||
| 611 | 19 | */ | 20 | */ |
| 612 | 20 | 21 | ||
| 614 | 21 | #include "../config.h" | 22 | #include <gtk/gtk.h> |
| 615 | 23 | #include "xpad-pad-properties.h" | ||
| 616 | 22 | #include <glib/gi18n.h> | 24 | #include <glib/gi18n.h> |
| 617 | 23 | #include "xpad-pad-properties.h" | ||
| 618 | 24 | 25 | ||
| 619 | 25 | struct XpadPadPropertiesPrivate | 26 | struct XpadPadPropertiesPrivate |
| 620 | 26 | { | 27 | { |
| 621 | @@ -258,7 +259,7 @@ | |||
| 622 | 258 | change_color_check (GtkToggleButton *button, XpadPadProperties *prop) | 259 | change_color_check (GtkToggleButton *button, XpadPadProperties *prop) |
| 623 | 259 | { | 260 | { |
| 624 | 260 | gtk_widget_set_sensitive (prop->priv->colorbox, gtk_toggle_button_get_active (button)); | 261 | gtk_widget_set_sensitive (prop->priv->colorbox, gtk_toggle_button_get_active (button)); |
| 626 | 261 | 262 | ||
| 627 | 262 | g_object_notify (G_OBJECT (prop), "follow-color-style"); | 263 | g_object_notify (G_OBJECT (prop), "follow-color-style"); |
| 628 | 263 | } | 264 | } |
| 629 | 264 | 265 | ||
| 630 | @@ -266,7 +267,7 @@ | |||
| 631 | 266 | change_font_check (GtkToggleButton *button, XpadPadProperties *prop) | 267 | change_font_check (GtkToggleButton *button, XpadPadProperties *prop) |
| 632 | 267 | { | 268 | { |
| 633 | 268 | gtk_widget_set_sensitive (prop->priv->fontbutton, gtk_toggle_button_get_active (button)); | 269 | gtk_widget_set_sensitive (prop->priv->fontbutton, gtk_toggle_button_get_active (button)); |
| 635 | 269 | 270 | ||
| 636 | 270 | g_object_notify (G_OBJECT (prop), "follow-font-style"); | 271 | g_object_notify (G_OBJECT (prop), "follow-font-style"); |
| 637 | 271 | } | 272 | } |
| 638 | 272 | 273 | ||
| 639 | @@ -297,99 +298,31 @@ | |||
| 640 | 297 | g_object_notify (G_OBJECT (prop), "fontname"); | 298 | g_object_notify (G_OBJECT (prop), "fontname"); |
| 641 | 298 | } | 299 | } |
| 642 | 299 | 300 | ||
| 643 | 300 | void | ||
| 644 | 301 | xpad_pad_properties_set_follow_font_style (XpadPadProperties *prop, gboolean follow) | ||
| 645 | 302 | { | ||
| 646 | 303 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->priv->fontcheck), !follow); | ||
| 647 | 304 | g_object_notify (G_OBJECT (prop), "follow_font_style"); | ||
| 648 | 305 | } | ||
| 649 | 306 | |||
| 650 | 307 | gboolean | ||
| 651 | 308 | xpad_pad_properties_get_follow_font_style (XpadPadProperties *prop) | ||
| 652 | 309 | { | ||
| 653 | 310 | return !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->priv->fontcheck)); | ||
| 654 | 311 | } | ||
| 655 | 312 | |||
| 656 | 313 | void | ||
| 657 | 314 | xpad_pad_properties_set_follow_color_style (XpadPadProperties *prop, gboolean follow) | ||
| 658 | 315 | { | ||
| 659 | 316 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->priv->colorcheck), !follow); | ||
| 660 | 317 | g_object_notify (G_OBJECT (prop), "follow_color_style"); | ||
| 661 | 318 | } | ||
| 662 | 319 | |||
| 663 | 320 | gboolean | ||
| 664 | 321 | xpad_pad_properties_get_follow_color_style (XpadPadProperties *prop) | ||
| 665 | 322 | { | ||
| 666 | 323 | return !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->priv->colorcheck)); | ||
| 667 | 324 | } | ||
| 668 | 325 | |||
| 669 | 326 | void | ||
| 670 | 327 | xpad_pad_properties_set_back_color (XpadPadProperties *prop, const GdkRGBA *back) | ||
| 671 | 328 | { | ||
| 672 | 329 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), back); | ||
| 673 | 330 | g_object_notify (G_OBJECT (prop), "back_color"); | ||
| 674 | 331 | } | ||
| 675 | 332 | |||
| 676 | 333 | const GdkRGBA * | ||
| 677 | 334 | xpad_pad_properties_get_back_color (XpadPadProperties *prop) | ||
| 678 | 335 | { | ||
| 679 | 336 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp); | ||
| 680 | 337 | return &prop->priv->backtmp; | ||
| 681 | 338 | } | ||
| 682 | 339 | |||
| 683 | 340 | void | ||
| 684 | 341 | xpad_pad_properties_set_text_color (XpadPadProperties *prop, const GdkRGBA *text) | ||
| 685 | 342 | { | ||
| 686 | 343 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), text); | ||
| 687 | 344 | g_object_notify (G_OBJECT (prop), "text_color"); | ||
| 688 | 345 | } | ||
| 689 | 346 | |||
| 690 | 347 | const GdkRGBA * | ||
| 691 | 348 | xpad_pad_properties_get_text_color (XpadPadProperties *prop) | ||
| 692 | 349 | { | ||
| 693 | 350 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp); | ||
| 694 | 351 | return &prop->priv->texttmp; | ||
| 695 | 352 | } | ||
| 696 | 353 | |||
| 697 | 354 | void | ||
| 698 | 355 | xpad_pad_properties_set_fontname (XpadPadProperties *prop, const gchar *fontname) | ||
| 699 | 356 | { | ||
| 700 | 357 | gtk_font_button_set_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton), fontname); | ||
| 701 | 358 | g_object_notify (G_OBJECT (prop), "fontname"); | ||
| 702 | 359 | } | ||
| 703 | 360 | |||
| 704 | 361 | const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *prop) | ||
| 705 | 362 | { | ||
| 706 | 363 | return gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton)); | ||
| 707 | 364 | } | ||
| 708 | 365 | |||
| 709 | 366 | static void | 301 | static void |
| 710 | 367 | xpad_pad_properties_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | 302 | xpad_pad_properties_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
| 711 | 368 | { | 303 | { |
| 715 | 369 | XpadPadProperties *prop; | 304 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (object); |
| 713 | 370 | |||
| 714 | 371 | prop = XPAD_PAD_PROPERTIES (object); | ||
| 716 | 372 | 305 | ||
| 717 | 373 | switch (prop_id) | 306 | switch (prop_id) |
| 718 | 374 | { | 307 | { |
| 719 | 375 | case PROP_FOLLOW_FONT_STYLE: | 308 | case PROP_FOLLOW_FONT_STYLE: |
| 721 | 376 | xpad_pad_properties_set_follow_font_style (prop, g_value_get_boolean (value)); | 309 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->priv->fontcheck), !g_value_get_boolean (value)); |
| 722 | 377 | break; | 310 | break; |
| 723 | 378 | 311 | ||
| 724 | 379 | case PROP_FOLLOW_COLOR_STYLE: | 312 | case PROP_FOLLOW_COLOR_STYLE: |
| 726 | 380 | xpad_pad_properties_set_follow_color_style (prop, g_value_get_boolean (value)); | 313 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->priv->colorcheck), !g_value_get_boolean (value)); |
| 727 | 381 | break; | 314 | break; |
| 728 | 382 | 315 | ||
| 729 | 383 | case PROP_BACK_COLOR: | 316 | case PROP_BACK_COLOR: |
| 731 | 384 | xpad_pad_properties_set_back_color (prop, g_value_get_boxed (value)); | 317 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), g_value_get_boxed (value)); |
| 732 | 385 | break; | 318 | break; |
| 733 | 386 | 319 | ||
| 734 | 387 | case PROP_TEXT_COLOR: | 320 | case PROP_TEXT_COLOR: |
| 736 | 388 | xpad_pad_properties_set_text_color (prop, g_value_get_boxed (value)); | 321 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), g_value_get_boxed (value)); |
| 737 | 389 | break; | 322 | break; |
| 738 | 390 | 323 | ||
| 739 | 391 | case PROP_FONTNAME: | 324 | case PROP_FONTNAME: |
| 741 | 392 | xpad_pad_properties_set_fontname (prop, g_value_get_string (value)); | 325 | gtk_font_button_set_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton), g_value_get_string (value)); |
| 742 | 393 | break; | 326 | break; |
| 743 | 394 | 327 | ||
| 744 | 395 | default: | 328 | default: |
| 745 | @@ -401,30 +334,30 @@ | |||
| 746 | 401 | static void | 334 | static void |
| 747 | 402 | xpad_pad_properties_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | 335 | xpad_pad_properties_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
| 748 | 403 | { | 336 | { |
| 752 | 404 | XpadPadProperties *prop; | 337 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (object); |
| 750 | 405 | |||
| 751 | 406 | prop = XPAD_PAD_PROPERTIES (object); | ||
| 753 | 407 | 338 | ||
| 754 | 408 | switch (prop_id) | 339 | switch (prop_id) |
| 755 | 409 | { | 340 | { |
| 756 | 410 | case PROP_FOLLOW_FONT_STYLE: | 341 | case PROP_FOLLOW_FONT_STYLE: |
| 758 | 411 | g_value_set_boolean (value, xpad_pad_properties_get_follow_font_style (prop)); | 342 | g_value_set_boolean (value, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->priv->fontcheck))); |
| 759 | 412 | break; | 343 | break; |
| 760 | 413 | 344 | ||
| 761 | 414 | case PROP_FOLLOW_COLOR_STYLE: | 345 | case PROP_FOLLOW_COLOR_STYLE: |
| 763 | 415 | g_value_set_boolean (value, xpad_pad_properties_get_follow_color_style (prop)); | 346 | g_value_set_boolean (value, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->priv->colorcheck))); |
| 764 | 416 | break; | 347 | break; |
| 765 | 417 | 348 | ||
| 766 | 418 | case PROP_BACK_COLOR: | 349 | case PROP_BACK_COLOR: |
| 768 | 419 | g_value_set_static_boxed (value, xpad_pad_properties_get_back_color (prop)); | 350 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->backbutton), &prop->priv->backtmp); |
| 769 | 351 | g_value_set_static_boxed (value, &prop->priv->backtmp); | ||
| 770 | 420 | break; | 352 | break; |
| 771 | 421 | 353 | ||
| 772 | 422 | case PROP_TEXT_COLOR: | 354 | case PROP_TEXT_COLOR: |
| 774 | 423 | g_value_set_static_boxed (value, xpad_pad_properties_get_text_color (prop)); | 355 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop->priv->textbutton), &prop->priv->texttmp); |
| 775 | 356 | g_value_set_static_boxed (value, &prop->priv->texttmp); | ||
| 776 | 424 | break; | 357 | break; |
| 777 | 425 | 358 | ||
| 778 | 426 | case PROP_FONTNAME: | 359 | case PROP_FONTNAME: |
| 780 | 427 | g_value_set_string (value, xpad_pad_properties_get_fontname (prop)); | 360 | g_value_set_string (value, gtk_font_button_get_font_name (GTK_FONT_BUTTON (prop->priv->fontbutton))); |
| 781 | 428 | break; | 361 | break; |
| 782 | 429 | 362 | ||
| 783 | 430 | default: | 363 | default: |
| 784 | 431 | 364 | ||
| 785 | === modified file 'src/xpad-pad-properties.h' | |||
| 786 | --- src/xpad-pad-properties.h 2014-06-04 12:36:36 +0000 | |||
| 787 | +++ src/xpad-pad-properties.h 2014-06-13 15:52:27 +0000 | |||
| 788 | @@ -1,6 +1,7 @@ | |||
| 789 | 1 | /* | 1 | /* |
| 790 | 2 | 2 | ||
| 791 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 792 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 793 | 4 | 5 | ||
| 794 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 795 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 796 | @@ -38,7 +39,6 @@ | |||
| 797 | 38 | 39 | ||
| 798 | 39 | struct XpadPadProperties | 40 | struct XpadPadProperties |
| 799 | 40 | { | 41 | { |
| 800 | 41 | /* private */ | ||
| 801 | 42 | GtkDialog parent; | 42 | GtkDialog parent; |
| 802 | 43 | XpadPadPropertiesPrivate *priv; | 43 | XpadPadPropertiesPrivate *priv; |
| 803 | 44 | }; | 44 | }; |
| 804 | @@ -52,21 +52,6 @@ | |||
| 805 | 52 | 52 | ||
| 806 | 53 | GtkWidget *xpad_pad_properties_new (void); | 53 | GtkWidget *xpad_pad_properties_new (void); |
| 807 | 54 | 54 | ||
| 808 | 55 | void xpad_pad_properties_set_follow_font_style (XpadPadProperties *pad_properties, gboolean follow); | ||
| 809 | 56 | gboolean xpad_pad_properties_get_follow_font_style (XpadPadProperties *pad_properties); | ||
| 810 | 57 | |||
| 811 | 58 | void xpad_pad_properties_set_follow_color_style (XpadPadProperties *pad_properties, gboolean follow); | ||
| 812 | 59 | gboolean xpad_pad_properties_get_follow_color_style (XpadPadProperties *pad_properties); | ||
| 813 | 60 | |||
| 814 | 61 | void xpad_pad_properties_set_back_color (XpadPadProperties *pad_properties, const GdkRGBA *back); | ||
| 815 | 62 | const GdkRGBA *xpad_pad_properties_get_back_color (XpadPadProperties *pad_properties); | ||
| 816 | 63 | |||
| 817 | 64 | void xpad_pad_properties_set_text_color (XpadPadProperties *pad_properties, const GdkRGBA *text); | ||
| 818 | 65 | const GdkRGBA *xpad_pad_properties_get_text_color (XpadPadProperties *pad_properties); | ||
| 819 | 66 | |||
| 820 | 67 | void xpad_pad_properties_set_fontname (XpadPadProperties *pad_properties, const gchar *fontname); | ||
| 821 | 68 | const gchar *xpad_pad_properties_get_fontname (XpadPadProperties *pad_properties); | ||
| 822 | 69 | |||
| 823 | 70 | G_END_DECLS | 55 | G_END_DECLS |
| 824 | 71 | 56 | ||
| 825 | 72 | #endif /* __XPAD_PAD_PROPERTIES_H__ */ | 57 | #endif /* __XPAD_PAD_PROPERTIES_H__ */ |
| 826 | 73 | 58 | ||
| 827 | === modified file 'src/xpad-pad.c' | |||
| 828 | --- src/xpad-pad.c 2014-06-07 00:36:45 +0000 | |||
| 829 | +++ src/xpad-pad.c 2014-06-13 15:52:27 +0000 | |||
| 830 | @@ -5,7 +5,7 @@ | |||
| 831 | 5 | Copyright (c) 2011 Sergei Riaguzov | 5 | Copyright (c) 2011 Sergei Riaguzov |
| 832 | 6 | Copyright (c) 2011 Dennis Hilmar | 6 | Copyright (c) 2011 Dennis Hilmar |
| 833 | 7 | Copyright (c) 2011 OBATA Akio | 7 | Copyright (c) 2011 OBATA Akio |
| 835 | 8 | Copyright (c) 2013 Arthur Borsboom | 8 | Copyright (c) 2013-2014 Arthur Borsboom |
| 836 | 9 | 9 | ||
| 837 | 10 | This program is free software; you can redistribute it and/or modify | 10 | This program is free software; you can redistribute it and/or modify |
| 838 | 11 | it under the terms of the GNU General Public License as published by | 11 | it under the terms of the GNU General Public License as published by |
| 839 | @@ -24,9 +24,8 @@ | |||
| 840 | 24 | */ | 24 | */ |
| 841 | 25 | 25 | ||
| 842 | 26 | #include "../config.h" | 26 | #include "../config.h" |
| 843 | 27 | #include <gtk/gtk.h> | ||
| 844 | 27 | #include <glib/gi18n.h> | 28 | #include <glib/gi18n.h> |
| 845 | 28 | #include <gdk/gdkkeysyms.h> | ||
| 846 | 29 | #include <string.h> | ||
| 847 | 30 | #include "fio.h" | 29 | #include "fio.h" |
| 848 | 31 | #include "help.h" | 30 | #include "help.h" |
| 849 | 32 | #include "xpad-app.h" | 31 | #include "xpad-app.h" |
| 850 | @@ -34,13 +33,12 @@ | |||
| 851 | 34 | #include "xpad-pad-properties.h" | 33 | #include "xpad-pad-properties.h" |
| 852 | 35 | #include "xpad-periodic.h" | 34 | #include "xpad-periodic.h" |
| 853 | 36 | #include "xpad-preferences.h" | 35 | #include "xpad-preferences.h" |
| 854 | 37 | #include "xpad-settings.h" | ||
| 855 | 38 | #include "xpad-text-buffer.h" | 36 | #include "xpad-text-buffer.h" |
| 856 | 39 | #include "xpad-text-view.h" | 37 | #include "xpad-text-view.h" |
| 857 | 40 | #include "xpad-toolbar.h" | 38 | #include "xpad-toolbar.h" |
| 858 | 41 | #include "xpad-tray.h" | 39 | #include "xpad-tray.h" |
| 859 | 42 | 40 | ||
| 861 | 43 | struct XpadPadPrivate | 41 | struct XpadPadPrivate |
| 862 | 44 | { | 42 | { |
| 863 | 45 | /* saved values */ | 43 | /* saved values */ |
| 864 | 46 | gint x, y; | 44 | gint x, y; |
| 865 | @@ -125,6 +123,7 @@ | |||
| 866 | 125 | static void xpad_pad_open_properties (XpadPad *pad); | 123 | static void xpad_pad_open_properties (XpadPad *pad); |
| 867 | 126 | static void xpad_pad_open_preferences (); | 124 | static void xpad_pad_open_preferences (); |
| 868 | 127 | static void xpad_pad_quit (); | 125 | static void xpad_pad_quit (); |
| 869 | 126 | /* static void xpad_pad_show_all (XpadPad *pad); */ | ||
| 870 | 128 | static void xpad_pad_close_all (XpadPad *pad); | 127 | static void xpad_pad_close_all (XpadPad *pad); |
| 871 | 129 | static void xpad_pad_sync_title (XpadPad *pad); | 128 | static void xpad_pad_sync_title (XpadPad *pad); |
| 872 | 130 | static void xpad_pad_set_group (XpadPad *pad, XpadPadGroup *group); | 129 | static void xpad_pad_set_group (XpadPad *pad, XpadPadGroup *group); |
| 873 | @@ -237,11 +236,8 @@ | |||
| 874 | 237 | pad->priv->x = 0; | 236 | pad->priv->x = 0; |
| 875 | 238 | pad->priv->y = 0; | 237 | pad->priv->y = 0; |
| 876 | 239 | pad->priv->location_valid = FALSE; | 238 | pad->priv->location_valid = FALSE; |
| 877 | 240 | pad->priv->width = xpad_settings_get_width (xpad_global_settings); | ||
| 878 | 241 | pad->priv->height = xpad_settings_get_height (xpad_global_settings); | ||
| 879 | 242 | pad->priv->infoname = NULL; | 239 | pad->priv->infoname = NULL; |
| 880 | 243 | pad->priv->contentname = NULL; | 240 | pad->priv->contentname = NULL; |
| 881 | 244 | pad->priv->sticky = xpad_settings_get_autostart_sticky (xpad_global_settings); | ||
| 882 | 245 | pad->priv->textview = NULL; | 241 | pad->priv->textview = NULL; |
| 883 | 246 | pad->priv->scrollbar = NULL; | 242 | pad->priv->scrollbar = NULL; |
| 884 | 247 | pad->priv->toolbar = NULL; | 243 | pad->priv->toolbar = NULL; |
| 885 | @@ -253,6 +249,10 @@ | |||
| 886 | 253 | pad->priv->unsaved_content = FALSE; | 249 | pad->priv->unsaved_content = FALSE; |
| 887 | 254 | pad->priv->unsaved_info = FALSE; | 250 | pad->priv->unsaved_info = FALSE; |
| 888 | 255 | pad->priv->group = NULL; | 251 | pad->priv->group = NULL; |
| 889 | 252 | g_object_get (xpad_global_settings, | ||
| 890 | 253 | "width", &pad->priv->width, | ||
| 891 | 254 | "height", &pad->priv->height, | ||
| 892 | 255 | "autostart-sticky", &pad->priv->sticky, NULL); | ||
| 893 | 256 | 256 | ||
| 894 | 257 | XpadTextView *text_view = XPAD_TEXT_VIEW (xpad_text_view_new ()); | 257 | XpadTextView *text_view = XPAD_TEXT_VIEW (xpad_text_view_new ()); |
| 895 | 258 | xpad_text_view_set_pad (text_view, pad); | 258 | xpad_text_view_set_pad (text_view, pad); |
| 896 | @@ -287,12 +287,13 @@ | |||
| 897 | 287 | 287 | ||
| 898 | 288 | gtk_container_child_set (GTK_CONTAINER (vbox), pad->priv->toolbar, "expand", FALSE, NULL); | 288 | gtk_container_child_set (GTK_CONTAINER (vbox), pad->priv->toolbar, "expand", FALSE, NULL); |
| 899 | 289 | 289 | ||
| 902 | 290 | gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_global_settings)); | 290 | gboolean decorations; |
| 903 | 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 | g_object_get (xpad_global_settings, "has-decorations", &decorations, NULL); |
| 904 | 292 | gtk_window_set_decorated (GTK_WINDOW(pad), decorations); | ||
| 905 | 293 | gtk_window_set_default_size (GTK_WINDOW(pad), (gint) pad->priv->width, (gint) pad->priv->height); | ||
| 906 | 292 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */ | 294 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */ |
| 910 | 293 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_global_settings)); | 295 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad), decorations); |
| 911 | 294 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_global_settings)); | 296 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !decorations); |
| 909 | 295 | gtk_window_set_type_hint (GTK_WINDOW(pad), GDK_WINDOW_TYPE_HINT_NORMAL); | ||
| 912 | 296 | gtk_window_set_position (GTK_WINDOW(pad), GTK_WIN_POS_MOUSE); | 297 | gtk_window_set_position (GTK_WINDOW(pad), GTK_WIN_POS_MOUSE); |
| 913 | 297 | 298 | ||
| 914 | 298 | g_object_set (G_OBJECT (pad), | 299 | g_object_set (G_OBJECT (pad), |
| 915 | @@ -432,11 +433,12 @@ | |||
| 916 | 432 | static void | 433 | static void |
| 917 | 433 | xpad_pad_notify_has_scrollbar (XpadPad *pad) | 434 | xpad_pad_notify_has_scrollbar (XpadPad *pad) |
| 918 | 434 | { | 435 | { |
| 921 | 435 | if (xpad_settings_get_has_scrollbar (xpad_global_settings)) | 436 | gboolean has_scrollbar; |
| 922 | 436 | { | 437 | g_object_get (xpad_global_settings, "has-scrollbar", &has_scrollbar, NULL); |
| 923 | 438 | |||
| 924 | 439 | if (has_scrollbar) | ||
| 925 | 437 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pad->priv->scrollbar), | 440 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pad->priv->scrollbar), |
| 926 | 438 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 441 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
| 927 | 439 | } | ||
| 928 | 440 | else | 442 | else |
| 929 | 441 | { | 443 | { |
| 930 | 442 | GtkAdjustment *v, *h; | 444 | GtkAdjustment *v, *h; |
| 931 | @@ -456,7 +458,8 @@ | |||
| 932 | 456 | static void | 458 | static void |
| 933 | 457 | xpad_pad_notify_has_decorations (XpadPad *pad) | 459 | xpad_pad_notify_has_decorations (XpadPad *pad) |
| 934 | 458 | { | 460 | { |
| 936 | 459 | gboolean decorations = xpad_settings_get_has_decorations (xpad_global_settings); | 461 | gboolean decorations; |
| 937 | 462 | g_object_get (xpad_global_settings, "has-decorations", &decorations, NULL); | ||
| 938 | 460 | 463 | ||
| 939 | 461 | /** | 464 | /** |
| 940 | 462 | * There are two modes of operation: a normal mode and a 'stealth' mode. | 465 | * There are two modes of operation: a normal mode and a 'stealth' mode. |
| 941 | @@ -564,11 +567,11 @@ | |||
| 942 | 564 | static void | 567 | static void |
| 943 | 565 | xpad_pad_notify_has_toolbar (XpadPad *pad) | 568 | xpad_pad_notify_has_toolbar (XpadPad *pad) |
| 944 | 566 | { | 569 | { |
| 950 | 567 | if (xpad_settings_get_has_toolbar (xpad_global_settings)) | 570 | gboolean has_toolbar, autohide_toolbar; |
| 951 | 568 | { | 571 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL); |
| 952 | 569 | if (!xpad_settings_get_autohide_toolbar (xpad_global_settings)) | 572 | |
| 953 | 570 | xpad_pad_show_toolbar (pad); | 573 | if (has_toolbar && !autohide_toolbar) |
| 954 | 571 | } | 574 | xpad_pad_show_toolbar (pad); |
| 955 | 572 | else | 575 | else |
| 956 | 573 | xpad_pad_hide_toolbar (pad); | 576 | xpad_pad_hide_toolbar (pad); |
| 957 | 574 | } | 577 | } |
| 958 | @@ -579,9 +582,10 @@ | |||
| 959 | 579 | if (!pad || !pad->priv || !pad->priv->toolbar_timeout) | 582 | if (!pad || !pad->priv || !pad->priv->toolbar_timeout) |
| 960 | 580 | return FALSE; | 583 | return FALSE; |
| 961 | 581 | 584 | ||
| 965 | 582 | if (pad->priv->toolbar_timeout && | 585 | gboolean has_toolbar, autohide_toolbar; |
| 966 | 583 | xpad_settings_get_autohide_toolbar (xpad_global_settings) && | 586 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL); |
| 967 | 584 | xpad_settings_get_has_toolbar (xpad_global_settings)) | 587 | |
| 968 | 588 | if (pad->priv->toolbar_timeout && autohide_toolbar && has_toolbar) | ||
| 969 | 585 | xpad_pad_hide_toolbar (pad); | 589 | xpad_pad_hide_toolbar (pad); |
| 970 | 586 | 590 | ||
| 971 | 587 | pad->priv->toolbar_timeout = 0; | 591 | pad->priv->toolbar_timeout = 0; |
| 972 | @@ -592,7 +596,10 @@ | |||
| 973 | 592 | static void | 596 | static void |
| 974 | 593 | xpad_pad_notify_autohide_toolbar (XpadPad *pad) | 597 | xpad_pad_notify_autohide_toolbar (XpadPad *pad) |
| 975 | 594 | { | 598 | { |
| 977 | 595 | if (xpad_settings_get_autohide_toolbar (xpad_global_settings)) | 599 | gboolean autohide_toolbar; |
| 978 | 600 | g_object_get (xpad_global_settings, "autohide-toolbar", &autohide_toolbar, NULL); | ||
| 979 | 601 | |||
| 980 | 602 | if (autohide_toolbar) | ||
| 981 | 596 | { | 603 | { |
| 982 | 597 | /* Likely not to be in pad when turning setting on */ | 604 | /* Likely not to be in pad when turning setting on */ |
| 983 | 598 | if (!pad->priv->toolbar_timeout) | 605 | if (!pad->priv->toolbar_timeout) |
| 984 | @@ -600,7 +607,10 @@ | |||
| 985 | 600 | } | 607 | } |
| 986 | 601 | else | 608 | else |
| 987 | 602 | { | 609 | { |
| 989 | 603 | if (xpad_settings_get_has_toolbar (xpad_global_settings)) | 610 | gboolean has_toolbar; |
| 990 | 611 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, NULL); | ||
| 991 | 612 | |||
| 992 | 613 | if (has_toolbar) | ||
| 993 | 604 | xpad_pad_show_toolbar(pad); | 614 | xpad_pad_show_toolbar(pad); |
| 994 | 605 | } | 615 | } |
| 995 | 606 | } | 616 | } |
| 996 | @@ -660,8 +670,10 @@ | |||
| 997 | 660 | static gboolean | 670 | static gboolean |
| 998 | 661 | xpad_pad_enter_notify_event (GtkWidget *pad, GdkEventCrossing *event) | 671 | xpad_pad_enter_notify_event (GtkWidget *pad, GdkEventCrossing *event) |
| 999 | 662 | { | 672 | { |
| 1002 | 663 | if (xpad_settings_get_has_toolbar (xpad_global_settings) && | 673 | gboolean has_toolbar, autohide_toolbar; |
| 1003 | 664 | xpad_settings_get_autohide_toolbar (xpad_global_settings) && | 674 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL); |
| 1004 | 675 | |||
| 1005 | 676 | if (has_toolbar && autohide_toolbar && | ||
| 1006 | 665 | event->detail != GDK_NOTIFY_INFERIOR && | 677 | event->detail != GDK_NOTIFY_INFERIOR && |
| 1007 | 666 | event->mode == GDK_CROSSING_NORMAL) | 678 | event->mode == GDK_CROSSING_NORMAL) |
| 1008 | 667 | { | 679 | { |
| 1009 | @@ -675,8 +687,10 @@ | |||
| 1010 | 675 | static gboolean | 687 | static gboolean |
| 1011 | 676 | xpad_pad_leave_notify_event (GtkWidget *pad, GdkEventCrossing *event) | 688 | xpad_pad_leave_notify_event (GtkWidget *pad, GdkEventCrossing *event) |
| 1012 | 677 | { | 689 | { |
| 1015 | 678 | if (xpad_settings_get_has_toolbar (xpad_global_settings) && | 690 | gboolean has_toolbar, autohide_toolbar; |
| 1016 | 679 | xpad_settings_get_autohide_toolbar (xpad_global_settings) && | 691 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL); |
| 1017 | 692 | |||
| 1018 | 693 | if (has_toolbar && autohide_toolbar && | ||
| 1019 | 680 | event->detail != GDK_NOTIFY_INFERIOR && | 694 | event->detail != GDK_NOTIFY_INFERIOR && |
| 1020 | 681 | event->mode == GDK_CROSSING_NORMAL) | 695 | event->mode == GDK_CROSSING_NORMAL) |
| 1021 | 682 | { | 696 | { |
| 1022 | @@ -741,7 +755,8 @@ | |||
| 1023 | 741 | gchar *content; | 755 | gchar *content; |
| 1024 | 742 | gboolean confirm; | 756 | gboolean confirm; |
| 1025 | 743 | 757 | ||
| 1027 | 744 | if (!xpad_settings_get_confirm_destroy (xpad_global_settings)) | 758 | g_object_get (xpad_global_settings, "confirm-destroy", &confirm, NULL); |
| 1028 | 759 | if (!confirm) | ||
| 1029 | 745 | return FALSE; | 760 | return FALSE; |
| 1030 | 746 | 761 | ||
| 1031 | 747 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)); | 762 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)); |
| 1032 | @@ -821,12 +836,15 @@ | |||
| 1033 | 821 | prop_notify_follow_font (XpadPad *pad) | 836 | prop_notify_follow_font (XpadPad *pad) |
| 1034 | 822 | { | 837 | { |
| 1035 | 823 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); | 838 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); |
| 1040 | 824 | 839 | ||
| 1041 | 825 | xpad_text_view_set_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview), xpad_pad_properties_get_follow_font_style (prop)); | 840 | gboolean follow_font_style; |
| 1042 | 826 | 841 | g_object_get (prop, "follow-font-style", &follow_font_style, NULL); | |
| 1043 | 827 | if (!xpad_pad_properties_get_follow_font_style (prop)) | 842 | xpad_text_view_set_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview), follow_font_style); |
| 1044 | 843 | |||
| 1045 | 844 | if (!follow_font_style) | ||
| 1046 | 828 | { | 845 | { |
| 1048 | 829 | const gchar *font = xpad_pad_properties_get_fontname (prop); | 846 | const gchar *font; |
| 1049 | 847 | g_object_get (prop, "fontname", &font, NULL); | ||
| 1050 | 830 | PangoFontDescription *fontdesc; | 848 | PangoFontDescription *fontdesc; |
| 1051 | 831 | 849 | ||
| 1052 | 832 | fontdesc = font ? pango_font_description_from_string (font) : NULL; | 850 | fontdesc = font ? pango_font_description_from_string (font) : NULL; |
| 1053 | @@ -843,13 +861,15 @@ | |||
| 1054 | 843 | { | 861 | { |
| 1055 | 844 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); | 862 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); |
| 1056 | 845 | 863 | ||
| 1058 | 846 | xpad_text_view_set_follow_color_style (XPAD_TEXT_VIEW (pad->priv->textview), xpad_pad_properties_get_follow_color_style (prop)); | 864 | gboolean follow_color_style; |
| 1059 | 865 | g_object_get (prop, "follow-color-style", &follow_color_style, NULL); | ||
| 1060 | 866 | xpad_text_view_set_follow_color_style (XPAD_TEXT_VIEW (pad->priv->textview), follow_color_style); | ||
| 1061 | 847 | 867 | ||
| 1063 | 848 | if (xpad_pad_properties_get_follow_color_style (prop)) | 868 | if (follow_color_style) |
| 1064 | 849 | { | 869 | { |
| 1065 | 850 | /* Set the colors to the global preferences colors */ | 870 | /* Set the colors to the global preferences colors */ |
| 1068 | 851 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); | 871 | const GdkRGBA *text_color, *back_color; |
| 1069 | 852 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); | 872 | g_object_get (xpad_global_settings, "text-color", &text_color, "back-color", &back_color, NULL); |
| 1070 | 853 | 873 | ||
| 1071 | 854 | gtk_widget_override_cursor (pad->priv->textview, text_color, text_color); | 874 | gtk_widget_override_cursor (pad->priv->textview, text_color, text_color); |
| 1072 | 855 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); | 875 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); |
| 1073 | @@ -862,8 +882,8 @@ | |||
| 1074 | 862 | else | 882 | else |
| 1075 | 863 | { | 883 | { |
| 1076 | 864 | /* Set the color to the individual pad properties colors */ | 884 | /* Set the color to the individual pad properties colors */ |
| 1079 | 865 | const GdkRGBA *text_color = xpad_pad_properties_get_text_color (prop); | 885 | const GdkRGBA *text_color, *back_color; |
| 1080 | 866 | const GdkRGBA *back_color = xpad_pad_properties_get_back_color (prop); | 886 | g_object_get (prop, "text-color", &text_color, "back-color", &back_color, NULL); |
| 1081 | 867 | 887 | ||
| 1082 | 868 | gtk_widget_override_cursor (pad->priv->textview, text_color, text_color); | 888 | gtk_widget_override_cursor (pad->priv->textview, text_color, text_color); |
| 1083 | 869 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); | 889 | gtk_widget_override_color (pad->priv->textview, GTK_STATE_FLAG_NORMAL, text_color); |
| 1084 | @@ -882,7 +902,8 @@ | |||
| 1085 | 882 | { | 902 | { |
| 1086 | 883 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); | 903 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (pad->priv->properties); |
| 1087 | 884 | 904 | ||
| 1089 | 885 | const gchar *font = xpad_pad_properties_get_fontname (prop); | 905 | const gchar *font; |
| 1090 | 906 | g_object_get (prop, "fontname", &font, NULL); | ||
| 1091 | 886 | PangoFontDescription *fontdesc; | 907 | PangoFontDescription *fontdesc; |
| 1092 | 887 | 908 | ||
| 1093 | 888 | fontdesc = font ? pango_font_description_from_string (font) : NULL; | 909 | fontdesc = font ? pango_font_description_from_string (font) : NULL; |
| 1094 | @@ -923,8 +944,8 @@ | |||
| 1095 | 923 | g_object_set (G_OBJECT (pad->priv->properties), | 944 | g_object_set (G_OBJECT (pad->priv->properties), |
| 1096 | 924 | "follow-font-style", xpad_text_view_get_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview)), | 945 | "follow-font-style", xpad_text_view_get_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview)), |
| 1097 | 925 | "follow-color-style", xpad_text_view_get_follow_color_style (XPAD_TEXT_VIEW (pad->priv->textview)), | 946 | "follow-color-style", xpad_text_view_get_follow_color_style (XPAD_TEXT_VIEW (pad->priv->textview)), |
| 1098 | 947 | "text-color", &widget_text_color, | ||
| 1099 | 926 | "back-color", &widget_background_color, | 948 | "back-color", &widget_background_color, |
| 1100 | 927 | "text-color", &widget_text_color, | ||
| 1101 | 928 | "fontname", pango_font_description_to_string(font), | 949 | "fontname", pango_font_description_to_string(font), |
| 1102 | 929 | NULL); | 950 | NULL); |
| 1103 | 930 | pango_font_description_free (font); | 951 | pango_font_description_free (font); |
| 1104 | @@ -1280,8 +1301,11 @@ | |||
| 1105 | 1280 | pad->priv->unsaved_info = FALSE; | 1301 | pad->priv->unsaved_info = FALSE; |
| 1106 | 1281 | 1302 | ||
| 1107 | 1282 | pad->priv->location_valid = TRUE; | 1303 | pad->priv->location_valid = TRUE; |
| 1110 | 1283 | if (xpad_settings_get_has_toolbar (xpad_global_settings) && | 1304 | |
| 1111 | 1284 | !xpad_settings_get_autohide_toolbar (xpad_global_settings)) | 1305 | gboolean has_toolbar, autohide_toolbar; |
| 1112 | 1306 | g_object_get (xpad_global_settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL); | ||
| 1113 | 1307 | |||
| 1114 | 1308 | if (has_toolbar && !autohide_toolbar) | ||
| 1115 | 1285 | { | 1309 | { |
| 1116 | 1286 | pad->priv->toolbar_height = 0; | 1310 | pad->priv->toolbar_height = 0; |
| 1117 | 1287 | xpad_pad_hide_toolbar (pad); | 1311 | xpad_pad_hide_toolbar (pad); |
| 1118 | @@ -1443,7 +1467,7 @@ | |||
| 1119 | 1443 | const gchar *artists[] = {"Michael Terry <mike@mterry.name>", NULL}; | 1467 | const gchar *artists[] = {"Michael Terry <mike@mterry.name>", NULL}; |
| 1120 | 1444 | const gchar *authors[] = {"Arthur Borsboom <arthurborsboom@gmail.com>", "Jeroen Vermeulen <jtv@xs4all.nl>", "Michael Terry <mike@mterry.name>", "Paul Ivanov <pivanov@berkeley.edu>", "Sachin Raut <great.sachin@gmail.com>", NULL}; | 1468 | const gchar *authors[] = {"Arthur Borsboom <arthurborsboom@gmail.com>", "Jeroen Vermeulen <jtv@xs4all.nl>", "Michael Terry <mike@mterry.name>", "Paul Ivanov <pivanov@berkeley.edu>", "Sachin Raut <great.sachin@gmail.com>", NULL}; |
| 1121 | 1445 | const gchar *comments = _("Sticky notes"); | 1469 | const gchar *comments = _("Sticky notes"); |
| 1123 | 1446 | const gchar *copyright = "© 2001-2013 Michael Terry"; | 1470 | const gchar *copyright = "© 2001-2014 Michael Terry"; |
| 1124 | 1447 | /* Translators: please translate this as your own name and optionally email | 1471 | /* Translators: please translate this as your own name and optionally email |
| 1125 | 1448 | like so: "Your Name <your@email.com>" */ | 1472 | like so: "Your Name <your@email.com>" */ |
| 1126 | 1449 | const gchar *translator_credits = _("translator-credits"); | 1473 | const gchar *translator_credits = _("translator-credits"); |
| 1127 | @@ -1562,6 +1586,17 @@ | |||
| 1128 | 1562 | i = NULL; | 1586 | i = NULL; |
| 1129 | 1563 | } | 1587 | } |
| 1130 | 1564 | 1588 | ||
| 1131 | 1589 | /* | ||
| 1132 | 1590 | static void | ||
| 1133 | 1591 | xpad_pad_show_all (XpadPad *pad) | ||
| 1134 | 1592 | { | ||
| 1135 | 1593 | if (!pad->priv->group) | ||
| 1136 | 1594 | return; | ||
| 1137 | 1595 | |||
| 1138 | 1596 | xpad_pad_group_show_all (pad->priv->group); | ||
| 1139 | 1597 | } | ||
| 1140 | 1598 | */ | ||
| 1141 | 1599 | |||
| 1142 | 1565 | static void | 1600 | static void |
| 1143 | 1566 | xpad_pad_close_all (XpadPad *pad) | 1601 | xpad_pad_close_all (XpadPad *pad) |
| 1144 | 1567 | { | 1602 | { |
| 1145 | @@ -1636,49 +1671,37 @@ | |||
| 1146 | 1636 | static void | 1671 | static void |
| 1147 | 1637 | menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check) | 1672 | menu_toolbar (XpadPad *pad, GtkCheckMenuItem *check) |
| 1148 | 1638 | { | 1673 | { |
| 1153 | 1639 | /* | 1674 | /* A dirty way to silence the compiler for these unused variables. */ |
| 1150 | 1640 | * A dirty way to silence the compiler for these unused variables. | ||
| 1151 | 1641 | * Feel free to implement these variables in the way they are ment to be used. | ||
| 1152 | 1642 | */ | ||
| 1154 | 1643 | (void) pad; | 1675 | (void) pad; |
| 1155 | 1644 | 1676 | ||
| 1157 | 1645 | xpad_settings_set_has_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1677 | g_object_set (xpad_global_settings, "has-toolbar", gtk_check_menu_item_get_active (check), NULL); |
| 1158 | 1646 | } | 1678 | } |
| 1159 | 1647 | 1679 | ||
| 1160 | 1648 | static void | 1680 | static void |
| 1161 | 1649 | menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check) | 1681 | menu_scrollbar (XpadPad *pad, GtkCheckMenuItem *check) |
| 1162 | 1650 | { | 1682 | { |
| 1167 | 1651 | /* | 1683 | /* A dirty way to silence the compiler for these unused variables. */ |
| 1164 | 1652 | * A dirty way to silence the compiler for these unused variables. | ||
| 1165 | 1653 | * Feel free to implement these variables in the way they are ment to be used. | ||
| 1166 | 1654 | */ | ||
| 1168 | 1655 | (void) pad; | 1684 | (void) pad; |
| 1169 | 1656 | 1685 | ||
| 1171 | 1657 | xpad_settings_set_has_scrollbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1686 | g_object_set (xpad_global_settings, "has-scrollbar", gtk_check_menu_item_get_active (check), NULL); |
| 1172 | 1658 | } | 1687 | } |
| 1173 | 1659 | 1688 | ||
| 1174 | 1660 | static void | 1689 | static void |
| 1175 | 1661 | menu_autohide (XpadPad *pad, GtkCheckMenuItem *check) | 1690 | menu_autohide (XpadPad *pad, GtkCheckMenuItem *check) |
| 1176 | 1662 | { | 1691 | { |
| 1181 | 1663 | /* | 1692 | /* A dirty way to silence the compiler for these unused variables. */ |
| 1178 | 1664 | * A dirty way to silence the compiler for these unused variables. | ||
| 1179 | 1665 | * Feel free to implement these variables in the way they are ment to be used. | ||
| 1180 | 1666 | */ | ||
| 1182 | 1667 | (void) pad; | 1693 | (void) pad; |
| 1183 | 1668 | 1694 | ||
| 1185 | 1669 | xpad_settings_set_autohide_toolbar (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1695 | g_object_set (xpad_global_settings, "autohide-toolbar", gtk_check_menu_item_get_active (check), NULL); |
| 1186 | 1670 | } | 1696 | } |
| 1187 | 1671 | 1697 | ||
| 1188 | 1672 | static void | 1698 | static void |
| 1189 | 1673 | menu_decorated (XpadPad *pad, GtkCheckMenuItem *check) | 1699 | menu_decorated (XpadPad *pad, GtkCheckMenuItem *check) |
| 1190 | 1674 | { | 1700 | { |
| 1195 | 1675 | /* | 1701 | /* A dirty way to silence the compiler for these unused variables. */ |
| 1192 | 1676 | * A dirty way to silence the compiler for these unused variables. | ||
| 1193 | 1677 | * Feel free to implement these variables in the way they are ment to be used. | ||
| 1194 | 1678 | */ | ||
| 1196 | 1679 | (void) pad; | 1702 | (void) pad; |
| 1197 | 1680 | 1703 | ||
| 1199 | 1681 | xpad_settings_set_has_decorations (xpad_global_settings, gtk_check_menu_item_get_active (check)); | 1704 | g_object_set (xpad_global_settings, "has-decorations", gtk_check_menu_item_get_active (check), NULL); |
| 1200 | 1682 | } | 1705 | } |
| 1201 | 1683 | 1706 | ||
| 1202 | 1684 | static gint | 1707 | static gint |
| 1203 | @@ -1731,6 +1754,13 @@ | |||
| 1204 | 1731 | menu_get_popup_no_highlight (XpadPad *pad, GtkAccelGroup *accel_group) | 1754 | menu_get_popup_no_highlight (XpadPad *pad, GtkAccelGroup *accel_group) |
| 1205 | 1732 | { | 1755 | { |
| 1206 | 1733 | GtkWidget *uppermenu, *menu, *item; | 1756 | GtkWidget *uppermenu, *menu, *item; |
| 1207 | 1757 | gboolean has_toolbar, autohide_toolbar, has_scrollbar, decorations; | ||
| 1208 | 1758 | |||
| 1209 | 1759 | g_object_get (xpad_global_settings, | ||
| 1210 | 1760 | "has-toolbar", &has_toolbar, | ||
| 1211 | 1761 | "autohide-toolbar", &autohide_toolbar, | ||
| 1212 | 1762 | "has-decorations", &decorations, | ||
| 1213 | 1763 | "has-scrollbar", &has_scrollbar, NULL); | ||
| 1214 | 1734 | 1764 | ||
| 1215 | 1735 | uppermenu = gtk_menu_new (); | 1765 | uppermenu = gtk_menu_new (); |
| 1216 | 1736 | gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group); | 1766 | gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group); |
| 1217 | @@ -1769,11 +1799,11 @@ | |||
| 1218 | 1769 | gtk_container_add (GTK_CONTAINER (uppermenu), item); | 1799 | gtk_container_add (GTK_CONTAINER (uppermenu), item); |
| 1219 | 1770 | menu = gtk_menu_new (); | 1800 | menu = gtk_menu_new (); |
| 1220 | 1771 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); | 1801 | gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); |
| 1226 | 1772 | MENU_ADD_CHECK (_("_Toolbar"), xpad_settings_get_has_toolbar (xpad_global_settings), menu_toolbar); | 1802 | MENU_ADD_CHECK (_("_Toolbar"), has_toolbar, menu_toolbar); |
| 1227 | 1773 | MENU_ADD_CHECK (_("_Autohide Toolbar"), xpad_settings_get_autohide_toolbar (xpad_global_settings), menu_autohide); | 1803 | MENU_ADD_CHECK (_("_Autohide Toolbar"), autohide_toolbar, menu_autohide); |
| 1228 | 1774 | gtk_widget_set_sensitive (item, xpad_settings_get_has_toolbar (xpad_global_settings)); | 1804 | gtk_widget_set_sensitive (item, has_toolbar); |
| 1229 | 1775 | MENU_ADD_CHECK (_("_Scrollbar"), xpad_settings_get_has_scrollbar (xpad_global_settings), menu_scrollbar); | 1805 | MENU_ADD_CHECK (_("_Scrollbar"), has_scrollbar, menu_scrollbar); |
| 1230 | 1776 | MENU_ADD_CHECK (_("_Window Decorations"), xpad_settings_get_has_decorations (xpad_global_settings), menu_decorated); | 1806 | MENU_ADD_CHECK (_("_Window Decorations"), decorations, menu_decorated); |
| 1231 | 1777 | 1807 | ||
| 1232 | 1778 | /* Notes submenu */ | 1808 | /* Notes submenu */ |
| 1233 | 1779 | item = gtk_menu_item_new_with_mnemonic (_("_Notes")); | 1809 | item = gtk_menu_item_new_with_mnemonic (_("_Notes")); |
| 1234 | @@ -1843,16 +1873,12 @@ | |||
| 1235 | 1843 | MENU_ADD_SEP (); | 1873 | MENU_ADD_SEP (); |
| 1236 | 1844 | g_object_set_data (G_OBJECT (menu), "notes-sep", item); | 1874 | g_object_set_data (G_OBJECT (menu), "notes-sep", item); |
| 1237 | 1845 | 1875 | ||
| 1241 | 1846 | /** | 1876 | /* Order pads according to title */ |
| 1239 | 1847 | * Order pads according to title. | ||
| 1240 | 1848 | */ | ||
| 1242 | 1849 | pads = xpad_pad_group_get_pads (current_pad->priv->group); | 1877 | pads = xpad_pad_group_get_pads (current_pad->priv->group); |
| 1243 | 1850 | 1878 | ||
| 1244 | 1851 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); | 1879 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); |
| 1245 | 1852 | 1880 | ||
| 1249 | 1853 | /** | 1881 | /* Populate list of windows */ |
| 1247 | 1854 | * Populate list of windows. | ||
| 1248 | 1855 | */ | ||
| 1250 | 1856 | for (l = pads, n = 1; l; l = l->next, n++) | 1882 | for (l = pads, n = 1; l; l = l->next, n++) |
| 1251 | 1857 | { | 1883 | { |
| 1252 | 1858 | gchar *title; | 1884 | gchar *title; |
| 1253 | @@ -1939,10 +1965,7 @@ | |||
| 1254 | 1939 | 1965 | ||
| 1255 | 1940 | cairo_rectangle_int_t rect; | 1966 | cairo_rectangle_int_t rect; |
| 1256 | 1941 | 1967 | ||
| 1261 | 1942 | /** | 1968 | /* We must check if we disabled off of pad and start the timeout if so. */ |
| 1258 | 1943 | * We must check if we disabled off of pad and start the timeout if so. | ||
| 1259 | 1944 | */ | ||
| 1260 | 1945 | |||
| 1262 | 1946 | rect.x = 10; | 1969 | rect.x = 10; |
| 1263 | 1947 | rect.y = 10; | 1970 | rect.y = 10; |
| 1264 | 1948 | rect.width = 1; | 1971 | rect.width = 1; |
| 1265 | 1949 | 1972 | ||
| 1266 | === modified file 'src/xpad-pad.h' | |||
| 1267 | --- src/xpad-pad.h 2013-10-09 22:02:22 +0000 | |||
| 1268 | +++ src/xpad-pad.h 2014-06-13 15:52:27 +0000 | |||
| 1269 | @@ -3,6 +3,7 @@ | |||
| 1270 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 1271 | 4 | Copyright (c) 2009 Paul Ivanov | 4 | Copyright (c) 2009 Paul Ivanov |
| 1272 | 5 | Copyright (c) 2011 Sergei Riaguzov | 5 | Copyright (c) 2011 Sergei Riaguzov |
| 1273 | 6 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 1274 | 6 | 7 | ||
| 1275 | 7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
| 1276 | 8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
| 1277 | 9 | 10 | ||
| 1278 | === modified file 'src/xpad-periodic.c' | |||
| 1279 | --- src/xpad-periodic.c 2014-06-04 12:36:36 +0000 | |||
| 1280 | +++ src/xpad-periodic.c 2014-06-13 15:52:27 +0000 | |||
| 1281 | @@ -1,8 +1,26 @@ | |||
| 1283 | 1 | #include "../config.h" | 1 | /* |
| 1284 | 2 | |||
| 1285 | 3 | Copyright (c) 2001-2007 Michael Terry | ||
| 1286 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 1287 | 5 | |||
| 1288 | 6 | This program is free software; you can redistribute it and/or modify | ||
| 1289 | 7 | it under the terms of the GNU General Public License as published by | ||
| 1290 | 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 1291 | 9 | (at your option) any later version. | ||
| 1292 | 10 | |||
| 1293 | 11 | This program is distributed in the hope that it will be useful, | ||
| 1294 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1295 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 1296 | 14 | GNU General Public License for more details. | ||
| 1297 | 15 | |||
| 1298 | 16 | You should have received a copy of the GNU General Public License | ||
| 1299 | 17 | along with this program; if not, write to the Free Software | ||
| 1300 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 1301 | 19 | |||
| 1302 | 20 | */ | ||
| 1303 | 21 | |||
| 1304 | 2 | #include <stdlib.h> | 22 | #include <stdlib.h> |
| 1305 | 3 | #include <stdio.h> | ||
| 1306 | 4 | #include <string.h> | 23 | #include <string.h> |
| 1307 | 5 | #include <stdarg.h> | ||
| 1308 | 6 | #include "xpad-periodic.h" | 24 | #include "xpad-periodic.h" |
| 1309 | 7 | 25 | ||
| 1310 | 8 | #ifdef SHOW_DEBUG | 26 | #ifdef SHOW_DEBUG |
| 1311 | @@ -45,8 +63,9 @@ | |||
| 1312 | 45 | /* prototypes */ | 63 | /* prototypes */ |
| 1313 | 46 | static gint xppd_intercept (gpointer); | 64 | static gint xppd_intercept (gpointer); |
| 1314 | 47 | static gint gprint_ignore(const char *, ...); | 65 | static gint gprint_ignore(const char *, ...); |
| 1315 | 66 | static void Xpad_periodic_signal (const char * cbname, void * xpad_pad); | ||
| 1316 | 67 | static void Xpad_periodic_error_exit (const char *, ...); | ||
| 1317 | 48 | 68 | ||
| 1318 | 49 | static void xpad_sigref_dump2 (gint); | ||
| 1319 | 50 | static gboolean str_equal (const char *, const char *); | 69 | static gboolean str_equal (const char *, const char *); |
| 1320 | 51 | 70 | ||
| 1321 | 52 | /* global variables */ | 71 | /* global variables */ |
| 1322 | @@ -149,7 +168,7 @@ | |||
| 1323 | 149 | } | 168 | } |
| 1324 | 150 | 169 | ||
| 1325 | 151 | if (! isdone) { | 170 | if (! isdone) { |
| 1327 | 152 | printf("Failed to install signal callback: %s\n", cbname); | 171 | g_print("Failed to install signal callback: %s\n", cbname); |
| 1328 | 153 | exit(1); | 172 | exit(1); |
| 1329 | 154 | } | 173 | } |
| 1330 | 155 | 174 | ||
| 1331 | @@ -166,8 +185,7 @@ | |||
| 1332 | 166 | Xpad_periodic_signal("save-content", xpad_pad); | 185 | Xpad_periodic_signal("save-content", xpad_pad); |
| 1333 | 167 | } | 186 | } |
| 1334 | 168 | 187 | ||
| 1337 | 169 | void Xpad_periodic_signal (const char * cbname, void * xpad_pad) | 188 | static void Xpad_periodic_signal (const char * cbname, void * xpad_pad) { |
| 1336 | 170 | { | ||
| 1338 | 171 | int isdone = 0; | 189 | int isdone = 0; |
| 1339 | 172 | int tnx=0, snx=0; | 190 | int tnx=0, snx=0; |
| 1340 | 173 | XpadPeriodicFunc func_ptr = 0; | 191 | XpadPeriodicFunc func_ptr = 0; |
| 1341 | @@ -236,38 +254,10 @@ | |||
| 1342 | 236 | return 0; | 254 | return 0; |
| 1343 | 237 | } | 255 | } |
| 1344 | 238 | 256 | ||
| 1364 | 239 | void xpad_sigref_dump2 (gint twhich) | 257 | static void Xpad_periodic_error_exit (const char * fmt, ...) { |
| 1346 | 240 | { | ||
| 1347 | 241 | int tlen = 0, cnt = 0; | ||
| 1348 | 242 | Xpadsigref * xlist = 0; | ||
| 1349 | 243 | if (0 == twhich) { xlist = xpptr->template; } | ||
| 1350 | 244 | if (1 == twhich) { xlist = xpptr->sigs; } | ||
| 1351 | 245 | if (0 == twhich) { tlen = xpptr->template_len; } | ||
| 1352 | 246 | if (1 == twhich) { tlen = xpptr->sigs_len; } | ||
| 1353 | 247 | |||
| 1354 | 248 | for (cnt = 0; cnt < tlen; ++cnt) { | ||
| 1355 | 249 | Xpadsigref * xitem = xlist + cnt; | ||
| 1356 | 250 | if (0 == xitem->signame) { continue; } | ||
| 1357 | 251 | printf("%3d: %s : %p : %p\n", cnt, xitem->signame, | ||
| 1358 | 252 | xitem->func_ptr, xitem->data); | ||
| 1359 | 253 | } | ||
| 1360 | 254 | } | ||
| 1361 | 255 | |||
| 1362 | 256 | void Xpad_periodic_error_exit (const char * fmt, ...) | ||
| 1363 | 257 | { | ||
| 1365 | 258 | va_list app; | 258 | va_list app; |
| 1366 | 259 | va_start(app, fmt); | 259 | va_start(app, fmt); |
| 1368 | 260 | vprintf(fmt, app); | 260 | g_print(fmt, app); |
| 1369 | 261 | va_end(app); | 261 | va_end(app); |
| 1370 | 262 | exit(1); | 262 | exit(1); |
| 1371 | 263 | } | 263 | } |
| 1372 | 264 | |||
| 1373 | 265 | void Xpad_periodic_test (void) | ||
| 1374 | 266 | { | ||
| 1375 | 267 | puts("Template:"); | ||
| 1376 | 268 | xpad_sigref_dump2(0); | ||
| 1377 | 269 | exit(0); | ||
| 1378 | 270 | } | ||
| 1379 | 271 | |||
| 1380 | 272 | |||
| 1381 | 273 | /* vim: set ts=4 sw=4 :vim */ | ||
| 1382 | 274 | 264 | ||
| 1383 | === modified file 'src/xpad-periodic.h' | |||
| 1384 | --- src/xpad-periodic.h 2013-10-09 14:46:10 +0000 | |||
| 1385 | +++ src/xpad-periodic.h 2014-06-13 15:52:27 +0000 | |||
| 1386 | @@ -1,8 +1,28 @@ | |||
| 1387 | 1 | /* | ||
| 1388 | 2 | |||
| 1389 | 3 | Copyright (c) 2001-2007 Michael Terry | ||
| 1390 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 1391 | 5 | |||
| 1392 | 6 | This program is free software; you can redistribute it and/or modify | ||
| 1393 | 7 | it under the terms of the GNU General Public License as published by | ||
| 1394 | 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 1395 | 9 | (at your option) any later version. | ||
| 1396 | 10 | |||
| 1397 | 11 | This program is distributed in the hope that it will be useful, | ||
| 1398 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1399 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 1400 | 14 | GNU General Public License for more details. | ||
| 1401 | 15 | |||
| 1402 | 16 | You should have received a copy of the GNU General Public License | ||
| 1403 | 17 | along with this program; if not, write to the Free Software | ||
| 1404 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 1405 | 19 | |||
| 1406 | 20 | */ | ||
| 1407 | 1 | 21 | ||
| 1408 | 2 | #ifndef XPAD_PERIODIC_H | 22 | #ifndef XPAD_PERIODIC_H |
| 1409 | 3 | #define XPAD_PERIODIC_H | 23 | #define XPAD_PERIODIC_H |
| 1410 | 4 | 24 | ||
| 1412 | 5 | #include <gtk/gtk.h> | 25 | #include <glib.h> |
| 1413 | 6 | 26 | ||
| 1414 | 7 | typedef void (*XpadPeriodicFunc)(void *); | 27 | typedef void (*XpadPeriodicFunc)(void *); |
| 1415 | 8 | 28 | ||
| 1416 | @@ -30,13 +50,5 @@ | |||
| 1417 | 30 | ************************/ | 50 | ************************/ |
| 1418 | 31 | void Xpad_periodic_save_content_delayed (void * xpad_pad); | 51 | void Xpad_periodic_save_content_delayed (void * xpad_pad); |
| 1419 | 32 | void Xpad_periodic_save_info_delayed (void * xpad_pad); | 52 | void Xpad_periodic_save_info_delayed (void * xpad_pad); |
| 1420 | 33 | void Xpad_periodic_signal (const char * cbname, void * xpad_pad); | ||
| 1421 | 34 | |||
| 1422 | 35 | void Xpad_periodic_test (); /* aborts program */ | ||
| 1423 | 36 | void Xpad_periodic_error_exit (const char *, ...); /* ditto */ | ||
| 1424 | 37 | 53 | ||
| 1425 | 38 | #endif /* XPAD_PERIODIC_H */ | 54 | #endif /* XPAD_PERIODIC_H */ |
| 1426 | 39 | |||
| 1427 | 40 | /************************ | ||
| 1428 | 41 | ************************/ | ||
| 1429 | 42 | /* vim: set ts=4 sw=4 :vim */ | ||
| 1430 | 43 | 55 | ||
| 1431 | === modified file 'src/xpad-preferences.c' | |||
| 1432 | --- src/xpad-preferences.c 2014-06-07 00:19:07 +0000 | |||
| 1433 | +++ src/xpad-preferences.c 2014-06-13 15:52:27 +0000 | |||
| 1434 | @@ -1,6 +1,7 @@ | |||
| 1435 | 1 | /* | 1 | /* |
| 1436 | 2 | 2 | ||
| 1437 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 1438 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 1439 | 4 | 5 | ||
| 1440 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 1441 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 1442 | @@ -18,17 +19,10 @@ | |||
| 1443 | 18 | 19 | ||
| 1444 | 19 | */ | 20 | */ |
| 1445 | 20 | 21 | ||
| 1446 | 21 | #include "../config.h" | ||
| 1447 | 22 | #include <glib/gi18n.h> | 22 | #include <glib/gi18n.h> |
| 1449 | 23 | #include <string.h> | 23 | #include <gtk/gtk.h> |
| 1450 | 24 | #include "xpad-preferences.h" | ||
| 1451 | 24 | #include "xpad-app.h" | 25 | #include "xpad-app.h" |
| 1452 | 25 | #include "xpad-preferences.h" | ||
| 1453 | 26 | #include "xpad-settings.h" | ||
| 1454 | 27 | #include <sys/types.h> | ||
| 1455 | 28 | #include <sys/stat.h> | ||
| 1456 | 29 | #include <stdio.h> | ||
| 1457 | 30 | #include <stdlib.h> | ||
| 1458 | 31 | #include <unistd.h> | ||
| 1459 | 32 | 26 | ||
| 1460 | 33 | struct XpadPreferencesPrivate | 27 | struct XpadPreferencesPrivate |
| 1461 | 34 | { | 28 | { |
| 1462 | @@ -46,7 +40,8 @@ | |||
| 1463 | 46 | GtkWidget *autostart_new_pad; | 40 | GtkWidget *autostart_new_pad; |
| 1464 | 47 | GtkWidget *autostart_sticky; | 41 | GtkWidget *autostart_sticky; |
| 1465 | 48 | GtkWidget *autostart_display_pads; | 42 | GtkWidget *autostart_display_pads; |
| 1467 | 49 | GtkWidget *trayconfigbox; | 43 | GtkWidget *tray_enabled; |
| 1468 | 44 | GtkWidget *tray_click_configuration; | ||
| 1469 | 50 | GtkWidget *editcheck; | 45 | GtkWidget *editcheck; |
| 1470 | 51 | GtkWidget *confirmcheck; | 46 | GtkWidget *confirmcheck; |
| 1471 | 52 | 47 | ||
| 1472 | @@ -61,19 +56,22 @@ | |||
| 1473 | 61 | gulong autostart_new_pad_handler; | 56 | gulong autostart_new_pad_handler; |
| 1474 | 62 | gulong autostart_sticky_handler; | 57 | gulong autostart_sticky_handler; |
| 1475 | 63 | gulong autostart_display_pads_handler; | 58 | gulong autostart_display_pads_handler; |
| 1477 | 64 | gulong trayclick_handler; | 59 | gulong tray_enabled_handler; |
| 1478 | 60 | gulong tray_click_handler; | ||
| 1479 | 65 | gulong editcheck_handler; | 61 | gulong editcheck_handler; |
| 1480 | 66 | gulong confirmcheck_handler; | 62 | gulong confirmcheck_handler; |
| 1481 | 67 | 63 | ||
| 1482 | 68 | gulong notify_font_handler; | 64 | gulong notify_font_handler; |
| 1483 | 69 | gulong notify_text_handler; | 65 | gulong notify_text_handler; |
| 1484 | 70 | gulong notify_back_handler; | 66 | gulong notify_back_handler; |
| 1485 | 67 | gulong notify_autostart_xpad_handler; | ||
| 1486 | 71 | gulong notify_autostart_wait_systray_handler; | 68 | gulong notify_autostart_wait_systray_handler; |
| 1487 | 72 | gulong notify_autostart_delay_handler; | 69 | gulong notify_autostart_delay_handler; |
| 1488 | 73 | gulong notify_autostart_new_pad_handler; | 70 | gulong notify_autostart_new_pad_handler; |
| 1489 | 74 | gulong notify_autostart_sticky_handler; | 71 | gulong notify_autostart_sticky_handler; |
| 1490 | 75 | gulong notify_autostart_display_pads_handler; | 72 | gulong notify_autostart_display_pads_handler; |
| 1492 | 76 | gulong notify_tray_handler; | 73 | gulong notify_tray_enabled_handler; |
| 1493 | 74 | gulong notify_tray_click_handler; | ||
| 1494 | 77 | gulong notify_edit_handler; | 75 | gulong notify_edit_handler; |
| 1495 | 78 | gulong notify_confirm_handler; | 76 | gulong notify_confirm_handler; |
| 1496 | 79 | }; | 77 | }; |
| 1497 | @@ -91,19 +89,21 @@ | |||
| 1498 | 91 | static void change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref); | 89 | static void change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref); |
| 1499 | 92 | static void change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref); | 90 | static void change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref); |
| 1500 | 93 | static void change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref); | 91 | static void change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref); |
| 1502 | 94 | static void change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref); | 92 | static void change_tray_enabled (GtkToggleButton *button, XpadPreferences *pref); |
| 1503 | 93 | static void change_tray_click (GtkComboBox *box, XpadPreferences *pref); | ||
| 1504 | 95 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); | 94 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); |
| 1505 | 96 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); | 95 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); |
| 1506 | 97 | 96 | ||
| 1507 | 98 | static void notify_fontname (XpadPreferences *pref); | 97 | static void notify_fontname (XpadPreferences *pref); |
| 1508 | 99 | static void notify_text_color (XpadPreferences *pref); | 98 | static void notify_text_color (XpadPreferences *pref); |
| 1509 | 100 | static void notify_back_color (XpadPreferences *pref); | 99 | static void notify_back_color (XpadPreferences *pref); |
| 1511 | 101 | 100 | static void notify_autostart_xpad (XpadPreferences *pref); | |
| 1512 | 102 | static void notify_autostart_wait_systray (XpadPreferences *pref); | 101 | static void notify_autostart_wait_systray (XpadPreferences *pref); |
| 1513 | 103 | static void notify_autostart_delay (XpadPreferences *pref); | 102 | static void notify_autostart_delay (XpadPreferences *pref); |
| 1514 | 104 | static void notify_autostart_new_pad (XpadPreferences *pref); | 103 | static void notify_autostart_new_pad (XpadPreferences *pref); |
| 1515 | 105 | static void notify_autostart_sticky (XpadPreferences *pref); | 104 | static void notify_autostart_sticky (XpadPreferences *pref); |
| 1516 | 106 | static void notify_autostart_display_pads (XpadPreferences *pref); | 105 | static void notify_autostart_display_pads (XpadPreferences *pref); |
| 1517 | 106 | static void notify_tray_enabled (XpadPreferences *pref); | ||
| 1518 | 107 | static void notify_tray_click (XpadPreferences *pref); | 107 | static void notify_tray_click (XpadPreferences *pref); |
| 1519 | 108 | static void notify_edit (XpadPreferences *pref); | 108 | static void notify_edit (XpadPreferences *pref); |
| 1520 | 109 | static void notify_confirm (XpadPreferences *pref); | 109 | static void notify_confirm (XpadPreferences *pref); |
| 1521 | @@ -139,7 +139,7 @@ | |||
| 1522 | 139 | xpad_preferences_init (XpadPreferences *pref) | 139 | xpad_preferences_init (XpadPreferences *pref) |
| 1523 | 140 | { | 140 | { |
| 1524 | 141 | GtkWidget *hbox, *font_hbox, *vbox; | 141 | GtkWidget *hbox, *font_hbox, *vbox; |
| 1526 | 142 | const GdkRGBA *color; | 142 | const GdkRGBA *text_color, *back_color; |
| 1527 | 143 | const gchar *fontname; | 143 | const gchar *fontname; |
| 1528 | 144 | GtkStyleContext *style; | 144 | GtkStyleContext *style; |
| 1529 | 145 | GtkWidget *appearance_frame, *start_frame, *tray_frame, *other_frame; | 145 | GtkWidget *appearance_frame, *start_frame, *tray_frame, *other_frame; |
| 1530 | @@ -150,9 +150,26 @@ | |||
| 1531 | 150 | GtkRequisition req; | 150 | GtkRequisition req; |
| 1532 | 151 | GdkRGBA theme_text_color = {0, 0, 0, 0}; | 151 | GdkRGBA theme_text_color = {0, 0, 0, 0}; |
| 1533 | 152 | GdkRGBA theme_background_color = {0, 0, 0, 0}; | 152 | GdkRGBA theme_background_color = {0, 0, 0, 0}; |
| 1534 | 153 | guint tray_click_configuration, autostart_delay, autostart_display_pads; | ||
| 1535 | 154 | gboolean confirm_destroy, edit_lock, autostart_xpad, autostart_wait_systray, autostart_new_pad, autostart_sticky; | ||
| 1536 | 153 | 155 | ||
| 1537 | 154 | pref->priv = xpad_preferences_get_instance_private(pref); | 156 | pref->priv = xpad_preferences_get_instance_private(pref); |
| 1538 | 155 | 157 | ||
| 1539 | 158 | g_object_get (xpad_global_settings, | ||
| 1540 | 159 | "fontname", &fontname, | ||
| 1541 | 160 | "text-color", &text_color, | ||
| 1542 | 161 | "back-color", &back_color, | ||
| 1543 | 162 | "confirm-destroy", &confirm_destroy, | ||
| 1544 | 163 | "edit-lock", &edit_lock, | ||
| 1545 | 164 | "tray-click-configuration", &tray_click_configuration, | ||
| 1546 | 165 | "autostart-xpad", &autostart_xpad, | ||
| 1547 | 166 | "autostart-wait-systray", &autostart_wait_systray, | ||
| 1548 | 167 | "autostart-new-pad", &autostart_new_pad, | ||
| 1549 | 168 | "autostart-sticky", &autostart_sticky, | ||
| 1550 | 169 | "autostart-delay", &autostart_delay, | ||
| 1551 | 170 | "autostart-display-pads", &autostart_display_pads, | ||
| 1552 | 171 | NULL); | ||
| 1553 | 172 | |||
| 1554 | 156 | /* Appearance options */ | 173 | /* Appearance options */ |
| 1555 | 157 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); | 174 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); |
| 1556 | 158 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | 175 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
| 1557 | @@ -213,7 +230,6 @@ | |||
| 1558 | 213 | gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color); | 230 | gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &theme_text_color); |
| 1559 | 214 | gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color); | 231 | gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &theme_background_color); |
| 1560 | 215 | 232 | ||
| 1561 | 216 | fontname = xpad_settings_get_fontname (xpad_global_settings); | ||
| 1562 | 217 | if (fontname) | 233 | if (fontname) |
| 1563 | 218 | { | 234 | { |
| 1564 | 219 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->fontcheck), TRUE); | 235 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->fontcheck), TRUE); |
| 1565 | @@ -231,17 +247,15 @@ | |||
| 1566 | 231 | pango_font_description_free (font); | 247 | pango_font_description_free (font); |
| 1567 | 232 | } | 248 | } |
| 1568 | 233 | 249 | ||
| 1572 | 234 | color = xpad_settings_get_text_color (xpad_global_settings); | 250 | if (text_color) |
| 1573 | 235 | if (color) | 251 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), text_color); |
| 1571 | 236 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); | ||
| 1574 | 237 | else | 252 | else |
| 1575 | 238 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color); | 253 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &theme_text_color); |
| 1576 | 239 | 254 | ||
| 1579 | 240 | color = xpad_settings_get_back_color (xpad_global_settings); | 255 | if (back_color) |
| 1578 | 241 | if (color) | ||
| 1580 | 242 | { | 256 | { |
| 1581 | 243 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | 257 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); |
| 1583 | 244 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | 258 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), back_color); |
| 1584 | 245 | } | 259 | } |
| 1585 | 246 | else | 260 | else |
| 1586 | 247 | { | 261 | { |
| 1587 | @@ -300,15 +314,15 @@ | |||
| 1588 | 300 | 314 | ||
| 1589 | 301 | pref->priv->autostart_xpad = gtk_check_button_new_with_mnemonic (_("_Start Xpad automatically after login")); | 315 | pref->priv->autostart_xpad = gtk_check_button_new_with_mnemonic (_("_Start Xpad automatically after login")); |
| 1590 | 302 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_xpad, FALSE, FALSE, 0); | 316 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_xpad, FALSE, FALSE, 0); |
| 1592 | 303 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_xpad), xpad_settings_get_autostart_xpad (xpad_global_settings)); | 317 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_xpad), autostart_xpad); |
| 1593 | 304 | 318 | ||
| 1594 | 305 | pref->priv->autostart_wait_systray = gtk_check_button_new_with_mnemonic (_("_Wait for systray (if possible)")); | 319 | pref->priv->autostart_wait_systray = gtk_check_button_new_with_mnemonic (_("_Wait for systray (if possible)")); |
| 1595 | 306 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20); | 320 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20); |
| 1596 | 307 | gtk_box_pack_start (GTK_BOX (hbox), gtk_alignment_new (1, 1, 1, 1), FALSE, FALSE, 0); | 321 | gtk_box_pack_start (GTK_BOX (hbox), gtk_alignment_new (1, 1, 1, 1), FALSE, FALSE, 0); |
| 1597 | 308 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->autostart_wait_systray, FALSE, FALSE, 0); | 322 | gtk_box_pack_start (GTK_BOX (hbox), pref->priv->autostart_wait_systray, FALSE, FALSE, 0); |
| 1598 | 309 | 323 | ||
| 1601 | 310 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings)); | 324 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), autostart_wait_systray); |
| 1602 | 311 | if (xpad_settings_get_autostart_xpad (xpad_global_settings)) | 325 | if (autostart_xpad) |
| 1603 | 312 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE); | 326 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE); |
| 1604 | 313 | else | 327 | else |
| 1605 | 314 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE); | 328 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE); |
| 1606 | @@ -316,19 +330,19 @@ | |||
| 1607 | 316 | 330 | ||
| 1608 | 317 | pref->priv->autostart_new_pad = gtk_check_button_new_with_mnemonic (_("_Open a new empty pad")); | 331 | pref->priv->autostart_new_pad = gtk_check_button_new_with_mnemonic (_("_Open a new empty pad")); |
| 1609 | 318 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_new_pad, FALSE, FALSE, 0); | 332 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_new_pad, FALSE, FALSE, 0); |
| 1611 | 319 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings)); | 333 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), autostart_new_pad); |
| 1612 | 320 | 334 | ||
| 1613 | 321 | pref->priv->autostart_sticky = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces")); | 335 | pref->priv->autostart_sticky = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces")); |
| 1614 | 322 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_sticky, FALSE, FALSE, 0); | 336 | gtk_box_pack_start (GTK_BOX (autostart_vbox), pref->priv->autostart_sticky, FALSE, FALSE, 0); |
| 1616 | 323 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings)); | 337 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), autostart_sticky); |
| 1617 | 324 | 338 | ||
| 1618 | 325 | label = gtk_label_new (_("Delay in seconds")); | 339 | label = gtk_label_new (_("Delay in seconds")); |
| 1619 | 326 | pref->priv->autostart_delay = gtk_combo_box_text_new(); | 340 | pref->priv->autostart_delay = gtk_combo_box_text_new(); |
| 1620 | 327 | guint i; | 341 | guint i; |
| 1621 | 328 | for (i=0; i<15; i++) | 342 | for (i=0; i<15; i++) |
| 1625 | 329 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_delay ), g_strdup_printf ("%i", i)); | 343 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->autostart_delay), g_strdup_printf ("%i", i)); |
| 1626 | 330 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings)); | 344 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), autostart_delay); |
| 1627 | 331 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | 345 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); |
| 1628 | 332 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 346 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 1629 | 333 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_delay, TRUE, TRUE, 0); | 347 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_delay, TRUE, TRUE, 0); |
| 1630 | 334 | gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0); | 348 | gtk_box_pack_start(GTK_BOX(autostart_vbox), hbox, TRUE, TRUE, 0); |
| 1631 | @@ -338,7 +352,7 @@ | |||
| 1632 | 338 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Open all pads") ); | 352 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Open all pads") ); |
| 1633 | 339 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Hide all pads") ); | 353 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Hide all pads") ); |
| 1634 | 340 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Restore to previous state") ); | 354 | gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT( pref->priv->autostart_display_pads ), _("Restore to previous state") ); |
| 1636 | 341 | gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->autostart_display_pads ), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings)); | 355 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_display_pads), (guint) autostart_display_pads); |
| 1637 | 342 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | 356 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); |
| 1638 | 343 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 357 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 1639 | 344 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_display_pads, TRUE, TRUE, 0); | 358 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->autostart_display_pads, TRUE, TRUE, 0); |
| 1640 | @@ -368,16 +382,19 @@ | |||
| 1641 | 368 | "child", alignment, | 382 | "child", alignment, |
| 1642 | 369 | NULL)); | 383 | NULL)); |
| 1643 | 370 | 384 | ||
| 1644 | 385 | pref->priv->tray_enabled = gtk_check_button_new_with_mnemonic (_("_Enable tray icon")); | ||
| 1645 | 386 | gtk_box_pack_start (GTK_BOX (tray_vbox), pref->priv->tray_enabled, FALSE, FALSE, 0); | ||
| 1646 | 387 | |||
| 1647 | 371 | label = gtk_label_new_with_mnemonic(_("Tray click behaviour")); | 388 | label = gtk_label_new_with_mnemonic(_("Tray click behaviour")); |
| 1654 | 372 | pref->priv->trayconfigbox = gtk_combo_box_text_new(); | 389 | pref->priv->tray_click_configuration = gtk_combo_box_text_new(); |
| 1655 | 373 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Do Nothing") ); | 390 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->tray_click_configuration), _("Do Nothing") ); |
| 1656 | 374 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("Toggle Show All") ); | 391 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->tray_click_configuration), _("Toggle Show All") ); |
| 1657 | 375 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("List of Pads") ); | 392 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->tray_click_configuration), _("List of Pads") ); |
| 1658 | 376 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->trayconfigbox), _("New Pad") ); | 393 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref->priv->tray_click_configuration), _("New Pad") ); |
| 1659 | 377 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler (xpad_global_settings)); | 394 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->tray_click_configuration), tray_click_configuration); |
| 1660 | 378 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); | 395 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); |
| 1661 | 379 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 396 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 1663 | 380 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0); | 397 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->tray_click_configuration, TRUE, TRUE, 0); |
| 1664 | 381 | gtk_box_pack_start(GTK_BOX(tray_vbox), hbox, TRUE, TRUE, 0); | 398 | gtk_box_pack_start(GTK_BOX(tray_vbox), hbox, TRUE, TRUE, 0); |
| 1665 | 382 | 399 | ||
| 1666 | 383 | /* Other options */ | 400 | /* Other options */ |
| 1667 | @@ -408,10 +425,10 @@ | |||
| 1668 | 408 | pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion")); | 425 | pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion")); |
| 1669 | 409 | 426 | ||
| 1670 | 410 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->editcheck, FALSE, FALSE, 0); | 427 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->editcheck, FALSE, FALSE, 0); |
| 1672 | 411 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); | 428 | gtk_box_pack_start (GTK_BOX (other_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); |
| 1673 | 412 | 429 | ||
| 1676 | 413 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings)); | 430 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), edit_lock); |
| 1677 | 414 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); | 431 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), confirm_destroy); |
| 1678 | 415 | 432 | ||
| 1679 | 416 | /* Close button and window title */ | 433 | /* Close button and window title */ |
| 1680 | 417 | gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE); | 434 | gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE); |
| 1681 | @@ -433,7 +450,8 @@ | |||
| 1682 | 433 | pref->priv->autostart_sticky_handler = g_signal_connect (pref->priv->autostart_sticky, "toggled", G_CALLBACK (change_autostart_sticky), pref); | 450 | pref->priv->autostart_sticky_handler = g_signal_connect (pref->priv->autostart_sticky, "toggled", G_CALLBACK (change_autostart_sticky), pref); |
| 1683 | 434 | pref->priv->autostart_display_pads_handler = g_signal_connect (pref->priv->autostart_display_pads, "changed", G_CALLBACK (change_autostart_display_pads), pref); | 451 | pref->priv->autostart_display_pads_handler = g_signal_connect (pref->priv->autostart_display_pads, "changed", G_CALLBACK (change_autostart_display_pads), pref); |
| 1684 | 435 | 452 | ||
| 1686 | 436 | pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref); | 453 | pref->priv->tray_enabled_handler = g_signal_connect (pref->priv->tray_enabled, "toggled", G_CALLBACK (change_tray_enabled), pref); |
| 1687 | 454 | pref->priv->tray_click_handler = g_signal_connect(pref->priv->tray_click_configuration, "changed", G_CALLBACK(change_tray_click), pref); | ||
| 1688 | 437 | pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref); | 455 | pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref); |
| 1689 | 438 | pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref); | 456 | pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref); |
| 1690 | 439 | 457 | ||
| 1691 | @@ -441,23 +459,28 @@ | |||
| 1692 | 441 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref); | 459 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (notify_text_color), pref); |
| 1693 | 442 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref); | 460 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (notify_back_color), pref); |
| 1694 | 443 | 461 | ||
| 1700 | 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); | 462 | pref->priv->notify_autostart_xpad_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart-xpad", G_CALLBACK (notify_autostart_xpad), pref); |
| 1701 | 445 | pref->priv->notify_autostart_delay_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_delay", G_CALLBACK(notify_autostart_delay), pref); | 463 | 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); |
| 1702 | 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); | 464 | pref->priv->notify_autostart_delay_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart-delay", G_CALLBACK(notify_autostart_delay), pref); |
| 1703 | 447 | pref->priv->notify_autostart_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart_sticky", G_CALLBACK (notify_autostart_sticky), pref); | 465 | 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); |
| 1704 | 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); | 466 | pref->priv->notify_autostart_sticky_handler = g_signal_connect_swapped (xpad_global_settings, "notify::autostart-sticky", G_CALLBACK (notify_autostart_sticky), pref); |
| 1705 | 467 | 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); | ||
| 1706 | 449 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref); | 468 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_global_settings, "notify::edit-lock", G_CALLBACK (notify_edit), pref); |
| 1707 | 450 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); | 469 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_global_settings, "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); |
| 1709 | 451 | pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref); | 470 | pref->priv->notify_tray_enabled_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray-enabled", G_CALLBACK (notify_tray_enabled), pref); |
| 1710 | 471 | pref->priv->notify_tray_click_handler = g_signal_connect_swapped (xpad_global_settings, "notify::tray-click-configuration", G_CALLBACK(notify_tray_click), pref); | ||
| 1711 | 452 | 472 | ||
| 1712 | 453 | g_object_unref (size_group_labels); | 473 | g_object_unref (size_group_labels); |
| 1713 | 454 | 474 | ||
| 1714 | 475 | /* Initiliaze the GUI logic */ | ||
| 1715 | 476 | g_object_notify (G_OBJECT (xpad_global_settings), "tray-enabled"); | ||
| 1716 | 477 | |||
| 1717 | 455 | /* Make the preference dialog visible */ | 478 | /* Make the preference dialog visible */ |
| 1718 | 456 | global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); | 479 | global_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); |
| 1719 | 457 | gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE); | 480 | gtk_box_set_homogeneous (GTK_BOX (global_vbox), FALSE); |
| 1720 | 458 | gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0); | 481 | gtk_box_pack_start (GTK_BOX (global_vbox), appearance_frame, FALSE, FALSE, 0); |
| 1721 | 459 | gtk_box_pack_start (GTK_BOX (global_vbox), start_frame, FALSE, FALSE, 0); | 482 | gtk_box_pack_start (GTK_BOX (global_vbox), start_frame, FALSE, FALSE, 0); |
| 1723 | 460 | gtk_box_pack_start (GTK_BOX (global_vbox), tray_frame, FALSE, FALSE, 0); | 483 | gtk_box_pack_start (GTK_BOX (global_vbox), tray_frame, FALSE, FALSE, 0); |
| 1724 | 461 | gtk_box_pack_start (GTK_BOX (global_vbox), other_frame, FALSE, FALSE, 0); | 484 | gtk_box_pack_start (GTK_BOX (global_vbox), other_frame, FALSE, FALSE, 0); |
| 1725 | 462 | gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6); | 485 | gtk_container_set_border_width (GTK_CONTAINER (global_vbox), 6); |
| 1726 | 463 | gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0); | 486 | gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pref))), global_vbox, FALSE, FALSE, 0); |
| 1727 | @@ -497,9 +520,9 @@ | |||
| 1728 | 497 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | 520 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); |
| 1729 | 498 | 521 | ||
| 1730 | 499 | if (!gtk_toggle_button_get_active (button)) | 522 | if (!gtk_toggle_button_get_active (button)) |
| 1732 | 500 | xpad_settings_set_fontname (xpad_global_settings, NULL); | 523 | g_object_set (xpad_global_settings, "fontname", NULL, NULL); |
| 1733 | 501 | else | 524 | else |
| 1735 | 502 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton))); | 525 | g_object_set (xpad_global_settings, "fontname", gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton)), NULL); |
| 1736 | 503 | 526 | ||
| 1737 | 504 | gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button)); | 527 | gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button)); |
| 1738 | 505 | 528 | ||
| 1739 | @@ -510,142 +533,58 @@ | |||
| 1740 | 510 | change_font_face (GtkFontButton *button, XpadPreferences *pref) | 533 | change_font_face (GtkFontButton *button, XpadPreferences *pref) |
| 1741 | 511 | { | 534 | { |
| 1742 | 512 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); | 535 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_font_handler); |
| 1744 | 513 | xpad_settings_set_fontname (xpad_global_settings, gtk_font_button_get_font_name (button)); | 536 | g_object_set (xpad_global_settings, "fontname", gtk_font_button_get_font_name (button), NULL); |
| 1745 | 514 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); | 537 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_font_handler); |
| 1746 | 515 | } | 538 | } |
| 1747 | 516 | 539 | ||
| 1748 | 517 | static void | 540 | static void |
| 1749 | 518 | change_color_check (GtkToggleButton *button, XpadPreferences *pref) | 541 | change_color_check (GtkToggleButton *button, XpadPreferences *pref) |
| 1750 | 519 | { | 542 | { |
| 1751 | 543 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); | ||
| 1752 | 520 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); | 544 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); |
| 1753 | 521 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); | ||
| 1754 | 522 | 545 | ||
| 1755 | 523 | if (!gtk_toggle_button_get_active (button)) | 546 | if (!gtk_toggle_button_get_active (button)) |
| 1760 | 524 | { | 547 | g_object_set (xpad_global_settings, "text-color", NULL, "back-color", NULL, NULL); |
| 1757 | 525 | xpad_settings_set_text_color (xpad_global_settings, NULL); | ||
| 1758 | 526 | xpad_settings_set_back_color (xpad_global_settings, NULL); | ||
| 1759 | 527 | } | ||
| 1761 | 528 | else | 548 | else |
| 1762 | 529 | { | 549 | { |
| 1768 | 530 | GdkRGBA color; | 550 | GdkRGBA text_color, back_color; |
| 1769 | 531 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &color); | 551 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), &text_color); |
| 1770 | 532 | xpad_settings_set_text_color (xpad_global_settings, &color); | 552 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &back_color); |
| 1771 | 533 | gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), &color); | 553 | g_object_set (xpad_global_settings, "text-color", &text_color, "back-color", &back_color, NULL); |
| 1767 | 534 | xpad_settings_set_back_color (xpad_global_settings, &color); | ||
| 1772 | 535 | } | 554 | } |
| 1773 | 536 | 555 | ||
| 1774 | 537 | gtk_widget_set_sensitive (pref->priv->colorbox, gtk_toggle_button_get_active (button)); | 556 | gtk_widget_set_sensitive (pref->priv->colorbox, gtk_toggle_button_get_active (button)); |
| 1775 | 538 | 557 | ||
| 1776 | 558 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); | ||
| 1777 | 539 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); | 559 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); |
| 1778 | 540 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); | ||
| 1779 | 541 | } | 560 | } |
| 1780 | 542 | 561 | ||
| 1781 | 543 | static void | 562 | static void |
| 1782 | 544 | change_text_color (GtkColorChooser *chooser, XpadPreferences *pref) | 563 | change_text_color (GtkColorChooser *chooser, XpadPreferences *pref) |
| 1783 | 545 | { | 564 | { |
| 1786 | 546 | GdkRGBA color = {0, 0, 0, 0}; | 565 | GdkRGBA text_color = {0, 0, 0, 0}; |
| 1787 | 547 | gtk_color_chooser_get_rgba (chooser, &color); | 566 | gtk_color_chooser_get_rgba (chooser, &text_color); |
| 1788 | 548 | 567 | ||
| 1789 | 549 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); | 568 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_text_handler); |
| 1791 | 550 | xpad_settings_set_text_color (xpad_global_settings, &color); | 569 | g_object_set (xpad_global_settings, "text-color", &text_color, NULL); |
| 1792 | 551 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); | 570 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_text_handler); |
| 1793 | 552 | } | 571 | } |
| 1794 | 553 | 572 | ||
| 1795 | 554 | static void | 573 | static void |
| 1796 | 555 | change_back_color (GtkColorChooser *chooser, XpadPreferences *pref) | 574 | change_back_color (GtkColorChooser *chooser, XpadPreferences *pref) |
| 1797 | 556 | { | 575 | { |
| 1800 | 557 | GdkRGBA color = {0, 0, 0, 0}; | 576 | GdkRGBA back_color = {0, 0, 0, 0}; |
| 1801 | 558 | gtk_color_chooser_get_rgba (chooser, &color); | 577 | gtk_color_chooser_get_rgba (chooser, &back_color); |
| 1802 | 559 | 578 | ||
| 1803 | 560 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); | 579 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_back_handler); |
| 1805 | 561 | xpad_settings_set_back_color (xpad_global_settings, &color); | 580 | g_object_set (xpad_global_settings, "back-color", &back_color, NULL); |
| 1806 | 562 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); | 581 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_back_handler); |
| 1807 | 563 | } | 582 | } |
| 1808 | 564 | 583 | ||
| 1809 | 565 | static void | 584 | static void |
| 1810 | 566 | change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref) | 585 | change_autostart_xpad (GtkToggleButton *button, XpadPreferences *pref) |
| 1811 | 567 | { | 586 | { |
| 1893 | 568 | gboolean autostart; | 587 | g_object_set (xpad_global_settings, "autostart-xpad", gtk_toggle_button_get_active (button), NULL); |
| 1813 | 569 | |||
| 1814 | 570 | autostart = gtk_toggle_button_get_active (button); | ||
| 1815 | 571 | |||
| 1816 | 572 | if (autostart) { | ||
| 1817 | 573 | /* Copy the xpad.desktop file to the autostart folder and enable/disable the wait for systray preference */ | ||
| 1818 | 574 | gboolean success; | ||
| 1819 | 575 | char *source_filename; | ||
| 1820 | 576 | char *destination_directory; | ||
| 1821 | 577 | GFile *source, *destination; | ||
| 1822 | 578 | GError *error = NULL; | ||
| 1823 | 579 | |||
| 1824 | 580 | /* Find the base directory where the application is installed /usr or /usr/local, to find the correct xpad.desktop file. */ | ||
| 1825 | 581 | char *szTmp = g_strdup_printf ("/proc/%d/exe", getpid()); | ||
| 1826 | 582 | enum { BUFFERSIZE = 1024 }; | ||
| 1827 | 583 | char buf[BUFFERSIZE]; | ||
| 1828 | 584 | ssize_t len = readlink(szTmp, buf, sizeof(buf)-1); | ||
| 1829 | 585 | |||
| 1830 | 586 | if (len == -1) { | ||
| 1831 | 587 | gchar *errtext; | ||
| 1832 | 588 | errtext = g_strdup_printf (_("Could not find the directory where Xpad is installed\n%s"), error->message); | ||
| 1833 | 589 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext); | ||
| 1834 | 590 | g_free (errtext); | ||
| 1835 | 591 | |||
| 1836 | 592 | gtk_toggle_button_set_active (button, FALSE); | ||
| 1837 | 593 | } | ||
| 1838 | 594 | else { | ||
| 1839 | 595 | char basedir[len-8]; | ||
| 1840 | 596 | guint i; | ||
| 1841 | 597 | for (i=0; i<len-8; i++) | ||
| 1842 | 598 | basedir[i] = buf[i]; | ||
| 1843 | 599 | basedir[len-9] = '\0'; | ||
| 1844 | 600 | |||
| 1845 | 601 | source_filename = g_strdup_printf ("%s/share/applications/xpad.desktop", basedir); | ||
| 1846 | 602 | destination_directory = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
| 1847 | 603 | |||
| 1848 | 604 | source = g_file_new_for_path (source_filename); | ||
| 1849 | 605 | destination = g_file_new_for_path (destination_directory); | ||
| 1850 | 606 | success = g_file_copy (source, destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); | ||
| 1851 | 607 | |||
| 1852 | 608 | if (!success) { | ||
| 1853 | 609 | gchar *errtext; | ||
| 1854 | 610 | errtext = g_strdup_printf (_("Could not copy %s to %s\n%s"), source_filename, destination_directory, error->message); | ||
| 1855 | 611 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), errtext); | ||
| 1856 | 612 | g_free (errtext); | ||
| 1857 | 613 | |||
| 1858 | 614 | gtk_toggle_button_set_active (button, FALSE); | ||
| 1859 | 615 | } | ||
| 1860 | 616 | else { | ||
| 1861 | 617 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
| 1862 | 618 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, TRUE); | ||
| 1863 | 619 | change_autostart_wait_systray (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), pref); | ||
| 1864 | 620 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
| 1865 | 621 | } | ||
| 1866 | 622 | } | ||
| 1867 | 623 | } | ||
| 1868 | 624 | else { | ||
| 1869 | 625 | /* Remove the xpad.desktop file from the autostart folder and enable/disable the wait for systray preference */ | ||
| 1870 | 626 | gboolean success; | ||
| 1871 | 627 | char *filename; | ||
| 1872 | 628 | GFile *file; | ||
| 1873 | 629 | GError *error = NULL; | ||
| 1874 | 630 | |||
| 1875 | 631 | filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
| 1876 | 632 | file = g_file_new_for_path (filename); | ||
| 1877 | 633 | success = g_file_delete (file, NULL, &error); | ||
| 1878 | 634 | |||
| 1879 | 635 | if (!success) { | ||
| 1880 | 636 | gchar *errtext; | ||
| 1881 | 637 | errtext = g_strdup_printf (_("Could not delete %s\n%s"), filename, error->message); | ||
| 1882 | 638 | xpad_app_error (NULL, _("Error disabling Xpad autostart"), errtext); | ||
| 1883 | 639 | g_free (errtext); | ||
| 1884 | 640 | |||
| 1885 | 641 | gtk_toggle_button_set_active (button, TRUE); | ||
| 1886 | 642 | } | ||
| 1887 | 643 | else { | ||
| 1888 | 644 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
| 1889 | 645 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, FALSE); | ||
| 1890 | 646 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | ||
| 1891 | 647 | } | ||
| 1892 | 648 | } | ||
| 1894 | 649 | } | 588 | } |
| 1895 | 650 | 589 | ||
| 1896 | 651 | static void | 590 | static void |
| 1897 | @@ -689,23 +628,15 @@ | |||
| 1898 | 689 | } | 628 | } |
| 1899 | 690 | 629 | ||
| 1900 | 691 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | 630 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); |
| 1902 | 692 | xpad_settings_set_autostart_wait_systray (xpad_global_settings, wait_systray); | 631 | g_object_set (xpad_global_settings, "autostart-wait-systray", wait_systray, NULL); |
| 1903 | 693 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); | 632 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_wait_systray_handler); |
| 1904 | 694 | } | 633 | } |
| 1905 | 695 | 634 | ||
| 1906 | 696 | static void | 635 | static void |
| 1907 | 697 | change_autostart_delay (GtkComboBox *box, XpadPreferences *pref) | ||
| 1908 | 698 | { | ||
| 1909 | 699 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
| 1910 | 700 | xpad_settings_set_autostart_delay (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | ||
| 1911 | 701 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
| 1912 | 702 | } | ||
| 1913 | 703 | |||
| 1914 | 704 | static void | ||
| 1915 | 705 | change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref) | 636 | change_autostart_new_pad (GtkToggleButton *button, XpadPreferences *pref) |
| 1916 | 706 | { | 637 | { |
| 1917 | 707 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); | 638 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); |
| 1919 | 708 | xpad_settings_set_autostart_new_pad (xpad_global_settings, gtk_toggle_button_get_active (button)); | 639 | g_object_set (xpad_global_settings, "autostart-new-pad", gtk_toggle_button_get_active (button), NULL); |
| 1920 | 709 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); | 640 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_new_pad_handler); |
| 1921 | 710 | } | 641 | } |
| 1922 | 711 | 642 | ||
| 1923 | @@ -713,31 +644,45 @@ | |||
| 1924 | 713 | change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref) | 644 | change_autostart_sticky (GtkToggleButton *button, XpadPreferences *pref) |
| 1925 | 714 | { | 645 | { |
| 1926 | 715 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); | 646 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); |
| 1928 | 716 | xpad_settings_set_autostart_sticky (xpad_global_settings, gtk_toggle_button_get_active (button)); | 647 | g_object_set (xpad_global_settings, "autostart-sticky", gtk_toggle_button_get_active (button), NULL); |
| 1929 | 717 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); | 648 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_sticky_handler); |
| 1930 | 718 | } | 649 | } |
| 1931 | 719 | 650 | ||
| 1932 | 720 | static void | 651 | static void |
| 1933 | 652 | change_autostart_delay (GtkComboBox *box, XpadPreferences *pref) | ||
| 1934 | 653 | { | ||
| 1935 | 654 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
| 1936 | 655 | g_object_set (xpad_global_settings, "autostart-delay", (guint) gtk_combo_box_get_active (box), NULL); | ||
| 1937 | 656 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_autostart_delay_handler); | ||
| 1938 | 657 | } | ||
| 1939 | 658 | |||
| 1940 | 659 | static void | ||
| 1941 | 721 | change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref) | 660 | change_autostart_display_pads (GtkComboBox *box, XpadPreferences *pref) |
| 1942 | 722 | { | 661 | { |
| 1943 | 723 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); | 662 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); |
| 1945 | 724 | xpad_settings_set_autostart_display_pads (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | 663 | g_object_set (xpad_global_settings, "autostart-display-pads", (guint) gtk_combo_box_get_active (box), NULL); |
| 1946 | 725 | g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); | 664 | g_signal_handler_unblock(xpad_global_settings, pref->priv->notify_autostart_display_pads_handler); |
| 1947 | 726 | } | 665 | } |
| 1948 | 727 | 666 | ||
| 1949 | 728 | static void | 667 | static void |
| 1955 | 729 | change_tray_click_configuration (GtkComboBox *box, XpadPreferences *pref) | 668 | change_tray_enabled (GtkToggleButton *button, XpadPreferences *pref) |
| 1956 | 730 | { | 669 | { |
| 1957 | 731 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_handler); | 670 | g_object_set (xpad_global_settings, "tray-enabled", gtk_toggle_button_get_active (button), NULL); |
| 1958 | 732 | xpad_settings_set_tray_click_handler (xpad_global_settings, (guint) gtk_combo_box_get_active(box)); | 671 | } |
| 1959 | 733 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_tray_handler); | 672 | |
| 1960 | 673 | static void | ||
| 1961 | 674 | change_tray_click (GtkComboBox *box, XpadPreferences *pref) | ||
| 1962 | 675 | { | ||
| 1963 | 676 | g_signal_handler_block(xpad_global_settings, pref->priv->notify_tray_click_handler); | ||
| 1964 | 677 | g_object_set (xpad_global_settings, "tray-click-configuration", (guint) gtk_combo_box_get_active (box), NULL); | ||
| 1965 | 678 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_tray_click_handler); | ||
| 1966 | 734 | } | 679 | } |
| 1967 | 735 | 680 | ||
| 1968 | 736 | static void | 681 | static void |
| 1969 | 737 | change_edit_check (GtkToggleButton *button, XpadPreferences *pref) | 682 | change_edit_check (GtkToggleButton *button, XpadPreferences *pref) |
| 1970 | 738 | { | 683 | { |
| 1971 | 739 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_edit_handler); | 684 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_edit_handler); |
| 1973 | 740 | xpad_settings_set_edit_lock (xpad_global_settings, gtk_toggle_button_get_active (button)); | 685 | g_object_set (xpad_global_settings, "edit-lock", gtk_toggle_button_get_active (button), NULL); |
| 1974 | 741 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_edit_handler); | 686 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_edit_handler); |
| 1975 | 742 | } | 687 | } |
| 1976 | 743 | 688 | ||
| 1977 | @@ -745,14 +690,15 @@ | |||
| 1978 | 745 | change_confirm_check (GtkToggleButton *button, XpadPreferences *pref) | 690 | change_confirm_check (GtkToggleButton *button, XpadPreferences *pref) |
| 1979 | 746 | { | 691 | { |
| 1980 | 747 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler); | 692 | g_signal_handler_block (xpad_global_settings, pref->priv->notify_confirm_handler); |
| 1982 | 748 | xpad_settings_set_confirm_destroy (xpad_global_settings, gtk_toggle_button_get_active (button)); | 693 | g_object_set (xpad_global_settings, "confirm-destroy", gtk_toggle_button_get_active (button), NULL); |
| 1983 | 749 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_confirm_handler); | 694 | g_signal_handler_unblock (xpad_global_settings, pref->priv->notify_confirm_handler); |
| 1984 | 750 | } | 695 | } |
| 1985 | 751 | 696 | ||
| 1986 | 752 | static void | 697 | static void |
| 1987 | 753 | notify_fontname (XpadPreferences *pref) | 698 | notify_fontname (XpadPreferences *pref) |
| 1988 | 754 | { | 699 | { |
| 1990 | 755 | const gchar *fontname = xpad_settings_get_fontname (xpad_global_settings); | 700 | const gchar *fontname; |
| 1991 | 701 | g_object_get (xpad_global_settings, "fontname", &fontname, NULL); | ||
| 1992 | 756 | 702 | ||
| 1993 | 757 | g_signal_handler_block (pref->priv->fontbutton, pref->priv->font_handler); | 703 | g_signal_handler_block (pref->priv->fontbutton, pref->priv->font_handler); |
| 1994 | 758 | g_signal_handler_block (pref->priv->fontcheck, pref->priv->fontcheck_handler); | 704 | g_signal_handler_block (pref->priv->fontcheck, pref->priv->fontcheck_handler); |
| 1995 | @@ -776,16 +722,17 @@ | |||
| 1996 | 776 | static void | 722 | static void |
| 1997 | 777 | notify_text_color (XpadPreferences *pref) | 723 | notify_text_color (XpadPreferences *pref) |
| 1998 | 778 | { | 724 | { |
| 2000 | 779 | const GdkRGBA *color = xpad_settings_get_text_color (xpad_global_settings); | 725 | const GdkRGBA *text_color; |
| 2001 | 726 | g_object_get (xpad_global_settings, "text-color", &text_color, NULL); | ||
| 2002 | 780 | 727 | ||
| 2003 | 781 | g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler); | 728 | g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler); |
| 2004 | 782 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | 729 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); |
| 2005 | 783 | 730 | ||
| 2007 | 784 | if (color) | 731 | if (text_color) |
| 2008 | 785 | { | 732 | { |
| 2009 | 786 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | 733 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); |
| 2010 | 787 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | 734 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); |
| 2012 | 788 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), color); | 735 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->textbutton), text_color); |
| 2013 | 789 | 736 | ||
| 2014 | 790 | } | 737 | } |
| 2015 | 791 | else | 738 | else |
| 2016 | @@ -801,16 +748,17 @@ | |||
| 2017 | 801 | static void | 748 | static void |
| 2018 | 802 | notify_back_color (XpadPreferences *pref) | 749 | notify_back_color (XpadPreferences *pref) |
| 2019 | 803 | { | 750 | { |
| 2022 | 804 | const GdkRGBA *color = xpad_settings_get_back_color (xpad_global_settings); | 751 | const GdkRGBA *back_color; |
| 2023 | 805 | 752 | g_object_get (xpad_global_settings, "back-color", &back_color, NULL); | |
| 2024 | 753 | |||
| 2025 | 806 | g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler); | 754 | g_signal_handler_block (pref->priv->backbutton, pref->priv->back_handler); |
| 2026 | 807 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); | 755 | g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler); |
| 2027 | 808 | 756 | ||
| 2029 | 809 | if (color) | 757 | if (back_color) |
| 2030 | 810 | { | 758 | { |
| 2031 | 811 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); | 759 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); |
| 2032 | 812 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); | 760 | gtk_widget_set_sensitive (pref->priv->colorbox, TRUE); |
| 2034 | 813 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), color); | 761 | gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (pref->priv->backbutton), back_color); |
| 2035 | 814 | } | 762 | } |
| 2036 | 815 | else | 763 | else |
| 2037 | 816 | { | 764 | { |
| 2038 | @@ -823,65 +771,108 @@ | |||
| 2039 | 823 | } | 771 | } |
| 2040 | 824 | 772 | ||
| 2041 | 825 | static void | 773 | static void |
| 2042 | 774 | notify_autostart_xpad (XpadPreferences *pref) | ||
| 2043 | 775 | { | ||
| 2044 | 776 | gboolean value; | ||
| 2045 | 777 | g_object_get (xpad_global_settings, "autostart-xpad", &value, NULL); | ||
| 2046 | 778 | g_signal_handler_block (pref->priv->autostart_xpad, pref->priv->autostart_xpad_handler); | ||
| 2047 | 779 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_xpad), value); | ||
| 2048 | 780 | gtk_widget_set_sensitive (pref->priv->autostart_wait_systray, value); | ||
| 2049 | 781 | if (value) | ||
| 2050 | 782 | change_autostart_wait_systray (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), pref); | ||
| 2051 | 783 | g_signal_handler_unblock (pref->priv->autostart_xpad, pref->priv->autostart_xpad_handler); | ||
| 2052 | 784 | } | ||
| 2053 | 785 | |||
| 2054 | 786 | static void | ||
| 2055 | 826 | notify_autostart_wait_systray (XpadPreferences *pref) | 787 | notify_autostart_wait_systray (XpadPreferences *pref) |
| 2056 | 827 | { | 788 | { |
| 2057 | 789 | gboolean value; | ||
| 2058 | 790 | g_object_get (xpad_global_settings, "autostart-wait-systray", &value, NULL); | ||
| 2059 | 828 | g_signal_handler_block (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | 791 | g_signal_handler_block (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); |
| 2061 | 829 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), xpad_settings_get_autostart_wait_systray (xpad_global_settings)); | 792 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_wait_systray), value); |
| 2062 | 830 | g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | 793 | g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); |
| 2063 | 831 | } | 794 | } |
| 2064 | 832 | 795 | ||
| 2065 | 833 | static void | ||
| 2066 | 834 | notify_autostart_delay (XpadPreferences *pref) | ||
| 2067 | 835 | { | ||
| 2068 | 836 | g_signal_handler_block (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
| 2069 | 837 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), (guint) xpad_settings_get_autostart_delay (xpad_global_settings)); | ||
| 2070 | 838 | g_signal_handler_unblock (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
| 2071 | 839 | } | ||
| 2072 | 840 | |||
| 2073 | 841 | static void | 796 | static void |
| 2074 | 842 | notify_autostart_new_pad (XpadPreferences *pref) | 797 | notify_autostart_new_pad (XpadPreferences *pref) |
| 2075 | 843 | { | 798 | { |
| 2076 | 799 | gboolean value; | ||
| 2077 | 800 | g_object_get (xpad_global_settings, "autostart-new-pad", &value, NULL); | ||
| 2078 | 844 | g_signal_handler_block (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); | 801 | g_signal_handler_block (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); |
| 2080 | 845 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), xpad_settings_get_autostart_new_pad (xpad_global_settings)); | 802 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_new_pad), value); |
| 2081 | 846 | g_signal_handler_unblock (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); | 803 | g_signal_handler_unblock (pref->priv->autostart_new_pad, pref->priv->autostart_new_pad_handler); |
| 2082 | 847 | } | 804 | } |
| 2083 | 848 | 805 | ||
| 2084 | 849 | static void | 806 | static void |
| 2085 | 850 | notify_autostart_sticky (XpadPreferences *pref) | 807 | notify_autostart_sticky (XpadPreferences *pref) |
| 2086 | 851 | { | 808 | { |
| 2087 | 809 | gboolean value; | ||
| 2088 | 810 | g_object_get (xpad_global_settings, "autostart-sticky", &value, NULL); | ||
| 2089 | 852 | g_signal_handler_block (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); | 811 | g_signal_handler_block (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); |
| 2091 | 853 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), xpad_settings_get_autostart_sticky (xpad_global_settings)); | 812 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->autostart_sticky), value); |
| 2092 | 854 | g_signal_handler_unblock (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); | 813 | g_signal_handler_unblock (pref->priv->autostart_sticky, pref->priv->autostart_sticky_handler); |
| 2093 | 855 | } | 814 | } |
| 2094 | 856 | 815 | ||
| 2095 | 857 | static void | 816 | static void |
| 2096 | 817 | notify_autostart_delay (XpadPreferences *pref) | ||
| 2097 | 818 | { | ||
| 2098 | 819 | guint value; | ||
| 2099 | 820 | g_object_get (xpad_global_settings, "autostart-delay", &value, NULL); | ||
| 2100 | 821 | g_signal_handler_block (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
| 2101 | 822 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_delay), value); | ||
| 2102 | 823 | g_signal_handler_unblock (pref->priv->autostart_delay, pref->priv->autostart_delay_handler); | ||
| 2103 | 824 | } | ||
| 2104 | 825 | |||
| 2105 | 826 | static void | ||
| 2106 | 858 | notify_autostart_display_pads (XpadPreferences *pref) | 827 | notify_autostart_display_pads (XpadPreferences *pref) |
| 2107 | 859 | { | 828 | { |
| 2108 | 829 | guint value; | ||
| 2109 | 830 | g_object_get (xpad_global_settings, "autostart-display-pads", &value, NULL); | ||
| 2110 | 860 | g_signal_handler_block (pref->priv->autostart_display_pads, pref->priv->autostart_display_pads_handler); | 831 | g_signal_handler_block (pref->priv->autostart_display_pads, pref->priv->autostart_display_pads_handler); |
| 2113 | 861 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_display_pads), (guint) xpad_settings_get_autostart_display_pads (xpad_global_settings)); | 832 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->autostart_display_pads), value); |
| 2114 | 862 | g_signal_handler_unblock (pref->priv->autostart_wait_systray, pref->priv->autostart_wait_systray_handler); | 833 | g_signal_handler_unblock (pref->priv->autostart_display_pads, pref->priv->autostart_display_pads_handler); |
| 2115 | 834 | } | ||
| 2116 | 835 | |||
| 2117 | 836 | static void | ||
| 2118 | 837 | notify_tray_enabled (XpadPreferences *pref) | ||
| 2119 | 838 | { | ||
| 2120 | 839 | gboolean value; | ||
| 2121 | 840 | g_object_get (xpad_global_settings, "tray-enabled", &value, NULL); | ||
| 2122 | 841 | g_signal_handler_block (pref->priv->tray_enabled, pref->priv->tray_enabled_handler); | ||
| 2123 | 842 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->tray_enabled), value); | ||
| 2124 | 843 | gtk_widget_set_sensitive (pref->priv->tray_click_configuration, value); | ||
| 2125 | 844 | gtk_widget_set_sensitive (pref->priv->autostart_display_pads, value); | ||
| 2126 | 845 | if (!value) | ||
| 2127 | 846 | g_object_set (xpad_global_settings, "autostart-display-pads", 0, NULL); | ||
| 2128 | 847 | g_signal_handler_unblock (pref->priv->tray_enabled, pref->priv->tray_enabled_handler); | ||
| 2129 | 863 | } | 848 | } |
| 2130 | 864 | 849 | ||
| 2131 | 865 | static void | 850 | static void |
| 2132 | 866 | notify_tray_click (XpadPreferences *pref) | 851 | notify_tray_click (XpadPreferences *pref) |
| 2133 | 867 | { | 852 | { |
| 2137 | 868 | g_signal_handler_block (pref->priv->trayconfigbox, pref->priv->trayclick_handler); | 853 | guint value; |
| 2138 | 869 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->trayconfigbox), (guint) xpad_settings_get_tray_click_handler(xpad_global_settings)); | 854 | g_object_get (xpad_global_settings, "tray-click-configuration", &value, NULL); |
| 2139 | 870 | g_signal_handler_unblock (pref->priv->trayconfigbox, pref->priv->trayclick_handler); | 855 | g_signal_handler_block (pref->priv->tray_click_configuration, pref->priv->tray_click_handler); |
| 2140 | 856 | gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->tray_click_configuration), value); | ||
| 2141 | 857 | g_signal_handler_unblock (pref->priv->tray_click_configuration, pref->priv->tray_click_handler); | ||
| 2142 | 871 | } | 858 | } |
| 2143 | 872 | 859 | ||
| 2144 | 873 | static void | 860 | static void |
| 2145 | 874 | notify_edit (XpadPreferences *pref) | 861 | notify_edit (XpadPreferences *pref) |
| 2146 | 875 | { | 862 | { |
| 2147 | 863 | gboolean value; | ||
| 2148 | 864 | g_object_get (xpad_global_settings, "edit-lock", &value, NULL); | ||
| 2149 | 876 | g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler); | 865 | g_signal_handler_block (pref->priv->editcheck, pref->priv->editcheck_handler); |
| 2151 | 877 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_global_settings)); | 866 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), value); |
| 2152 | 878 | g_signal_handler_unblock (pref->priv->editcheck, pref->priv->editcheck_handler); | 867 | g_signal_handler_unblock (pref->priv->editcheck, pref->priv->editcheck_handler); |
| 2153 | 879 | } | 868 | } |
| 2154 | 880 | 869 | ||
| 2155 | 881 | static void | 870 | static void |
| 2156 | 882 | notify_confirm (XpadPreferences *pref) | 871 | notify_confirm (XpadPreferences *pref) |
| 2157 | 883 | { | 872 | { |
| 2158 | 873 | gboolean value; | ||
| 2159 | 874 | g_object_get (xpad_global_settings, "confirm-destroy", &value, NULL); | ||
| 2160 | 884 | g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); | 875 | g_signal_handler_block (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); |
| 2162 | 885 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_global_settings)); | 876 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), value); |
| 2163 | 886 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); | 877 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); |
| 2164 | 887 | } | 878 | } |
| 2165 | 888 | 879 | ||
| 2166 | === modified file 'src/xpad-preferences.h' | |||
| 2167 | --- src/xpad-preferences.h 2008-09-21 00:03:40 +0000 | |||
| 2168 | +++ src/xpad-preferences.h 2014-06-13 15:52:27 +0000 | |||
| 2169 | @@ -1,6 +1,7 @@ | |||
| 2170 | 1 | /* | 1 | /* |
| 2171 | 2 | 2 | ||
| 2172 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 2173 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 2174 | 4 | 5 | ||
| 2175 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 2176 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 2177 | 7 | 8 | ||
| 2178 | === modified file 'src/xpad-session-manager.c' | |||
| 2179 | --- src/xpad-session-manager.c 2014-06-04 12:36:36 +0000 | |||
| 2180 | +++ src/xpad-session-manager.c 2014-06-13 15:52:27 +0000 | |||
| 2181 | @@ -1,6 +1,7 @@ | |||
| 2182 | 1 | /* | 1 | /* |
| 2183 | 2 | 2 | ||
| 2184 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 2185 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 2186 | 4 | 5 | ||
| 2187 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 2188 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 2189 | @@ -18,22 +19,15 @@ | |||
| 2190 | 18 | 19 | ||
| 2191 | 19 | */ | 20 | */ |
| 2192 | 20 | 21 | ||
| 2193 | 21 | #include "../config.h" | ||
| 2194 | 22 | #include "xpad-session-manager.h" | ||
| 2195 | 23 | |||
| 2196 | 24 | #ifndef X_DISPLAY_MISSING | 22 | #ifndef X_DISPLAY_MISSING |
| 2197 | 25 | 23 | ||
| 2198 | 24 | #include <glib.h> | ||
| 2199 | 25 | #include <pwd.h> | ||
| 2200 | 26 | #include <stdlib.h> | ||
| 2201 | 27 | #include <string.h> | ||
| 2202 | 26 | #include <gdk/gdkx.h> | 28 | #include <gdk/gdkx.h> |
| 2203 | 27 | #include <X11/SM/SMlib.h> | 29 | #include <X11/SM/SMlib.h> |
| 2213 | 28 | #include <stdio.h> /* only for printf */ | 30 | #include "xpad-session-manager.h" |
| 2205 | 29 | #include <sys/types.h> /* for getuid and getpwuid */ | ||
| 2206 | 30 | #include <sys/select.h> /* for select */ | ||
| 2207 | 31 | #include <stdlib.h> /* for free */ | ||
| 2208 | 32 | #include <string.h> /* for strlen */ | ||
| 2209 | 33 | #include <unistd.h> /* for getuid */ | ||
| 2210 | 34 | #include <pwd.h> /* for getpwuid */ | ||
| 2211 | 35 | #include <sys/types.h> /* for getuid and getpwuid */ | ||
| 2212 | 36 | #include <sys/time.h> /* for struct timeval */ | ||
| 2214 | 37 | #include "xpad-app.h" | 31 | #include "xpad-app.h" |
| 2215 | 38 | 32 | ||
| 2216 | 39 | static SmcConn xpad_session_manager_conn = NULL; | 33 | static SmcConn xpad_session_manager_conn = NULL; |
| 2217 | 40 | 34 | ||
| 2218 | === modified file 'src/xpad-session-manager.h' | |||
| 2219 | --- src/xpad-session-manager.h 2008-09-21 00:03:40 +0000 | |||
| 2220 | +++ src/xpad-session-manager.h 2014-06-13 15:52:27 +0000 | |||
| 2221 | @@ -1,6 +1,7 @@ | |||
| 2222 | 1 | /* | 1 | /* |
| 2223 | 2 | 2 | ||
| 2224 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 2225 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 2226 | 4 | 5 | ||
| 2227 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 2228 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 2229 | @@ -21,7 +22,7 @@ | |||
| 2230 | 21 | #ifndef __XPAD_SESSION_MANAGER_H__ | 22 | #ifndef __XPAD_SESSION_MANAGER_H__ |
| 2231 | 22 | #define __XPAD_SESSION_MANAGER_H__ | 23 | #define __XPAD_SESSION_MANAGER_H__ |
| 2232 | 23 | 24 | ||
| 2234 | 24 | #include <gtk/gtk.h> | 25 | #include <glib.h> |
| 2235 | 25 | 26 | ||
| 2236 | 26 | gboolean xpad_session_manager_start_interact (gboolean error); | 27 | gboolean xpad_session_manager_start_interact (gboolean error); |
| 2237 | 27 | void xpad_session_manager_stop_interact (gboolean stop_shutdown); | 28 | void xpad_session_manager_stop_interact (gboolean stop_shutdown); |
| 2238 | 28 | 29 | ||
| 2239 | === modified file 'src/xpad-settings.c' | |||
| 2240 | --- src/xpad-settings.c 2014-06-07 00:19:07 +0000 | |||
| 2241 | +++ src/xpad-settings.c 2014-06-13 15:52:27 +0000 | |||
| 2242 | @@ -1,6 +1,7 @@ | |||
| 2243 | 1 | /* | 1 | /* |
| 2244 | 2 | 2 | ||
| 2245 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 2246 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 2247 | 4 | 5 | ||
| 2248 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 2249 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 2250 | @@ -18,10 +19,12 @@ | |||
| 2251 | 18 | 19 | ||
| 2252 | 19 | */ | 20 | */ |
| 2253 | 20 | 21 | ||
| 2255 | 21 | #include "../config.h" | 22 | #include <glib/gi18n.h> |
| 2256 | 23 | #include <gtk/gtk.h> | ||
| 2257 | 22 | #include <string.h> | 24 | #include <string.h> |
| 2258 | 25 | #include "fio.h" | ||
| 2259 | 23 | #include "xpad-settings.h" | 26 | #include "xpad-settings.h" |
| 2261 | 24 | #include "fio.h" | 27 | #include "xpad-app.h" |
| 2262 | 25 | 28 | ||
| 2263 | 26 | struct XpadSettingsPrivate | 29 | struct XpadSettingsPrivate |
| 2264 | 27 | { | 30 | { |
| 2265 | @@ -30,13 +33,14 @@ | |||
| 2266 | 30 | gboolean has_decorations; | 33 | gboolean has_decorations; |
| 2267 | 31 | gboolean confirm_destroy; | 34 | gboolean confirm_destroy; |
| 2268 | 32 | gboolean edit_lock; | 35 | gboolean edit_lock; |
| 2269 | 36 | gboolean tray_enabled; | ||
| 2270 | 33 | guint tray_click_configuration; | 37 | guint tray_click_configuration; |
| 2271 | 34 | gboolean has_toolbar; | 38 | gboolean has_toolbar; |
| 2272 | 35 | gboolean autohide_toolbar; | 39 | gboolean autohide_toolbar; |
| 2273 | 36 | gboolean has_scrollbar; | 40 | gboolean has_scrollbar; |
| 2274 | 41 | GdkRGBA *text; | ||
| 2275 | 37 | GdkRGBA *back; | 42 | GdkRGBA *back; |
| 2278 | 38 | GdkRGBA *text; | 43 | const gchar *fontname; |
| 2277 | 39 | gchar *fontname; | ||
| 2279 | 40 | GSList *toolbar_buttons; | 44 | GSList *toolbar_buttons; |
| 2280 | 41 | gboolean autostart_wait_systray; | 45 | gboolean autostart_wait_systray; |
| 2281 | 42 | guint autostart_delay; | 46 | guint autostart_delay; |
| 2282 | @@ -63,13 +67,15 @@ | |||
| 2283 | 63 | PROP_HAS_DECORATIONS, | 67 | PROP_HAS_DECORATIONS, |
| 2284 | 64 | PROP_CONFIRM_DESTROY, | 68 | PROP_CONFIRM_DESTROY, |
| 2285 | 65 | PROP_EDIT_LOCK, | 69 | PROP_EDIT_LOCK, |
| 2286 | 70 | PROP_TRAY_ENABLED, | ||
| 2287 | 66 | PROP_TRAY_CLICK_CONFIGURATION, | 71 | PROP_TRAY_CLICK_CONFIGURATION, |
| 2288 | 67 | PROP_HAS_TOOLBAR, | 72 | PROP_HAS_TOOLBAR, |
| 2289 | 68 | PROP_AUTOHIDE_TOOLBAR, | 73 | PROP_AUTOHIDE_TOOLBAR, |
| 2290 | 69 | PROP_HAS_SCROLLBAR, | 74 | PROP_HAS_SCROLLBAR, |
| 2291 | 75 | PROP_TEXT_COLOR, | ||
| 2292 | 70 | PROP_BACK_COLOR, | 76 | PROP_BACK_COLOR, |
| 2293 | 71 | PROP_TEXT_COLOR, | ||
| 2294 | 72 | PROP_FONTNAME, | 77 | PROP_FONTNAME, |
| 2295 | 78 | PROP_AUTOSTART_XPAD, | ||
| 2296 | 73 | PROP_AUTOSTART_WAIT_SYSTRAY, | 79 | PROP_AUTOSTART_WAIT_SYSTRAY, |
| 2297 | 74 | PROP_AUTOSTART_DELAY, | 80 | PROP_AUTOSTART_DELAY, |
| 2298 | 75 | PROP_AUTOSTART_NEW_PAD, | 81 | PROP_AUTOSTART_NEW_PAD, |
| 2299 | @@ -125,7 +131,7 @@ | |||
| 2300 | 125 | 131 | ||
| 2301 | 126 | g_object_class_install_property (gobject_class, | 132 | g_object_class_install_property (gobject_class, |
| 2302 | 127 | PROP_HAS_DECORATIONS, | 133 | PROP_HAS_DECORATIONS, |
| 2304 | 128 | g_param_spec_boolean ("has_decorations", | 134 | g_param_spec_boolean ("has-decorations", |
| 2305 | 129 | "Has Decorations", | 135 | "Has Decorations", |
| 2306 | 130 | "Whether pads have window decorations", | 136 | "Whether pads have window decorations", |
| 2307 | 131 | TRUE, | 137 | TRUE, |
| 2308 | @@ -133,7 +139,7 @@ | |||
| 2309 | 133 | 139 | ||
| 2310 | 134 | g_object_class_install_property (gobject_class, | 140 | g_object_class_install_property (gobject_class, |
| 2311 | 135 | PROP_CONFIRM_DESTROY, | 141 | PROP_CONFIRM_DESTROY, |
| 2313 | 136 | g_param_spec_boolean ("confirm_destroy", | 142 | g_param_spec_boolean ("confirm-destroy", |
| 2314 | 137 | "Confirm Destroy", | 143 | "Confirm Destroy", |
| 2315 | 138 | "Whether destroying a pad requires user confirmation", | 144 | "Whether destroying a pad requires user confirmation", |
| 2316 | 139 | TRUE, | 145 | TRUE, |
| 2317 | @@ -141,31 +147,39 @@ | |||
| 2318 | 141 | 147 | ||
| 2319 | 142 | g_object_class_install_property (gobject_class, | 148 | g_object_class_install_property (gobject_class, |
| 2320 | 143 | PROP_EDIT_LOCK, | 149 | PROP_EDIT_LOCK, |
| 2322 | 144 | g_param_spec_boolean ("edit_lock", | 150 | g_param_spec_boolean ("edit-lock", |
| 2323 | 145 | "Edit Lock", | 151 | "Edit Lock", |
| 2324 | 146 | "Whether edit lock mode is enabled", | 152 | "Whether edit lock mode is enabled", |
| 2325 | 147 | FALSE, | 153 | FALSE, |
| 2326 | 148 | G_PARAM_READWRITE)); | 154 | G_PARAM_READWRITE)); |
| 2327 | 149 | g_object_class_install_property (gobject_class, | 155 | g_object_class_install_property (gobject_class, |
| 2328 | 156 | PROP_TRAY_ENABLED, | ||
| 2329 | 157 | g_param_spec_boolean ("tray-enabled", | ||
| 2330 | 158 | "Enable the tray icon", | ||
| 2331 | 159 | "Whether to enable or disable the systray icon", | ||
| 2332 | 160 | TRUE, | ||
| 2333 | 161 | G_PARAM_READWRITE)); | ||
| 2334 | 162 | |||
| 2335 | 163 | g_object_class_install_property (gobject_class, | ||
| 2336 | 150 | PROP_TRAY_CLICK_CONFIGURATION, | 164 | PROP_TRAY_CLICK_CONFIGURATION, |
| 2339 | 151 | g_param_spec_uint ("tray_click_configuration", | 165 | g_param_spec_uint ("tray-click-configuration", |
| 2340 | 152 | "Tray Click Configuration", | 166 | "Tray click configuration", |
| 2341 | 153 | "What configuration is selected on tray click", | 167 | "What configuration is selected on tray click", |
| 2342 | 154 | 0, | 168 | 0, |
| 2343 | 155 | G_MAXUINT, | 169 | G_MAXUINT, |
| 2345 | 156 | 2, | 170 | 0, |
| 2346 | 157 | G_PARAM_READWRITE)); | 171 | G_PARAM_READWRITE)); |
| 2347 | 158 | g_object_class_install_property (gobject_class, | 172 | g_object_class_install_property (gobject_class, |
| 2348 | 159 | PROP_HAS_TOOLBAR, | 173 | PROP_HAS_TOOLBAR, |
| 2351 | 160 | g_param_spec_boolean ("has_toolbar", | 174 | g_param_spec_boolean ("has-toolbar", |
| 2352 | 161 | "Has Toolbar", | 175 | "Each pad has a toolbar", |
| 2353 | 162 | "Whether pads have toolbars", | 176 | "Whether pads have toolbars", |
| 2354 | 163 | TRUE, | 177 | TRUE, |
| 2355 | 164 | G_PARAM_READWRITE)); | 178 | G_PARAM_READWRITE)); |
| 2356 | 165 | 179 | ||
| 2357 | 166 | g_object_class_install_property (gobject_class, | 180 | g_object_class_install_property (gobject_class, |
| 2358 | 167 | PROP_AUTOHIDE_TOOLBAR, | 181 | PROP_AUTOHIDE_TOOLBAR, |
| 2360 | 168 | g_param_spec_boolean ("autohide_toolbar", | 182 | g_param_spec_boolean ("autohide-toolbar", |
| 2361 | 169 | "Autohide Toolbar", | 183 | "Autohide Toolbar", |
| 2362 | 170 | "Whether toolbars hide when not used", | 184 | "Whether toolbars hide when not used", |
| 2363 | 171 | TRUE, | 185 | TRUE, |
| 2364 | @@ -173,10 +187,10 @@ | |||
| 2365 | 173 | 187 | ||
| 2366 | 174 | g_object_class_install_property (gobject_class, | 188 | g_object_class_install_property (gobject_class, |
| 2367 | 175 | PROP_HAS_SCROLLBAR, | 189 | PROP_HAS_SCROLLBAR, |
| 2369 | 176 | g_param_spec_boolean ("has_scrollbar", | 190 | g_param_spec_boolean ("has-scrollbar", |
| 2370 | 177 | "Has Scrollbar", | 191 | "Has Scrollbar", |
| 2371 | 178 | "Whether pads have scrollbars", | 192 | "Whether pads have scrollbars", |
| 2373 | 179 | FALSE, | 193 | TRUE, |
| 2374 | 180 | G_PARAM_READWRITE)); | 194 | G_PARAM_READWRITE)); |
| 2375 | 181 | 195 | ||
| 2376 | 182 | g_object_class_install_property (gobject_class, | 196 | g_object_class_install_property (gobject_class, |
| 2377 | @@ -189,7 +203,7 @@ | |||
| 2378 | 189 | 203 | ||
| 2379 | 190 | g_object_class_install_property (gobject_class, | 204 | g_object_class_install_property (gobject_class, |
| 2380 | 191 | PROP_TEXT_COLOR, | 205 | PROP_TEXT_COLOR, |
| 2382 | 192 | g_param_spec_boxed ("text_color", | 206 | g_param_spec_boxed ("text-color", |
| 2383 | 193 | "Text Color", | 207 | "Text Color", |
| 2384 | 194 | "Default color of pad text", | 208 | "Default color of pad text", |
| 2385 | 195 | GDK_TYPE_RGBA, | 209 | GDK_TYPE_RGBA, |
| 2386 | @@ -197,33 +211,31 @@ | |||
| 2387 | 197 | 211 | ||
| 2388 | 198 | g_object_class_install_property (gobject_class, | 212 | g_object_class_install_property (gobject_class, |
| 2389 | 199 | PROP_BACK_COLOR, | 213 | PROP_BACK_COLOR, |
| 2391 | 200 | g_param_spec_boxed ("back_color", | 214 | g_param_spec_boxed ("back-color", |
| 2392 | 201 | "Back Color", | 215 | "Back Color", |
| 2393 | 202 | "Default color of pad background", | 216 | "Default color of pad background", |
| 2394 | 203 | GDK_TYPE_RGBA, | 217 | GDK_TYPE_RGBA, |
| 2395 | 204 | G_PARAM_READWRITE)); | 218 | G_PARAM_READWRITE)); |
| 2396 | 205 | 219 | ||
| 2397 | 206 | g_object_class_install_property (gobject_class, | 220 | g_object_class_install_property (gobject_class, |
| 2398 | 221 | PROP_AUTOSTART_XPAD, | ||
| 2399 | 222 | g_param_spec_boolean ("autostart-xpad", | ||
| 2400 | 223 | "Automatically start xpad", | ||
| 2401 | 224 | "Whether to start xpad after login", | ||
| 2402 | 225 | FALSE, | ||
| 2403 | 226 | G_PARAM_READWRITE)); | ||
| 2404 | 227 | |||
| 2405 | 228 | g_object_class_install_property (gobject_class, | ||
| 2406 | 207 | PROP_AUTOSTART_WAIT_SYSTRAY, | 229 | PROP_AUTOSTART_WAIT_SYSTRAY, |
| 2408 | 208 | g_param_spec_boolean ("autostart_wait_systray", | 230 | g_param_spec_boolean ("autostart-wait-systray", |
| 2409 | 209 | "Autostart Xpad wait for systray", | 231 | "Autostart Xpad wait for systray", |
| 2410 | 210 | "Whether to wait for the systray before starting xpad automatically after login", | 232 | "Whether to wait for the systray before starting xpad automatically after login", |
| 2412 | 211 | FALSE, | 233 | TRUE, |
| 2413 | 212 | G_PARAM_READWRITE)); | 234 | G_PARAM_READWRITE)); |
| 2414 | 213 | 235 | ||
| 2415 | 214 | g_object_class_install_property (gobject_class, | 236 | g_object_class_install_property (gobject_class, |
| 2416 | 215 | PROP_AUTOSTART_DISPLAY_PADS, | ||
| 2417 | 216 | g_param_spec_uint ("autostart_delay", | ||
| 2418 | 217 | "Delay autostart of Xpad", | ||
| 2419 | 218 | "How many seconds will Xpad wait before continuing startup", | ||
| 2420 | 219 | 0, | ||
| 2421 | 220 | G_MAXUINT, | ||
| 2422 | 221 | 2, | ||
| 2423 | 222 | G_PARAM_READWRITE)); | ||
| 2424 | 223 | |||
| 2425 | 224 | g_object_class_install_property (gobject_class, | ||
| 2426 | 225 | PROP_AUTOSTART_NEW_PAD, | 237 | PROP_AUTOSTART_NEW_PAD, |
| 2428 | 226 | g_param_spec_boolean ("autostart_new_pad", | 238 | g_param_spec_boolean ("autostart-new-pad", |
| 2429 | 227 | "Autostart a new pad", | 239 | "Autostart a new pad", |
| 2430 | 228 | "Whether to create a new pad on startup", | 240 | "Whether to create a new pad on startup", |
| 2431 | 229 | FALSE, | 241 | FALSE, |
| 2432 | @@ -231,15 +243,25 @@ | |||
| 2433 | 231 | 243 | ||
| 2434 | 232 | g_object_class_install_property (gobject_class, | 244 | g_object_class_install_property (gobject_class, |
| 2435 | 233 | PROP_AUTOSTART_STICKY, | 245 | PROP_AUTOSTART_STICKY, |
| 2437 | 234 | g_param_spec_boolean ("autostart_sticky", | 246 | g_param_spec_boolean ("autostart-sticky", |
| 2438 | 235 | "Default Stickiness", | 247 | "Default Stickiness", |
| 2439 | 236 | "Whether pads are sticky on creation", | 248 | "Whether pads are sticky on creation", |
| 2440 | 237 | FALSE, | 249 | FALSE, |
| 2441 | 238 | G_PARAM_READWRITE)); | 250 | G_PARAM_READWRITE)); |
| 2442 | 239 | 251 | ||
| 2443 | 240 | g_object_class_install_property (gobject_class, | 252 | g_object_class_install_property (gobject_class, |
| 2444 | 253 | PROP_AUTOSTART_DELAY, | ||
| 2445 | 254 | g_param_spec_uint ("autostart-delay", | ||
| 2446 | 255 | "Delay autostart of Xpad", | ||
| 2447 | 256 | "How many seconds will Xpad wait before continuing startup", | ||
| 2448 | 257 | 0, | ||
| 2449 | 258 | G_MAXUINT, | ||
| 2450 | 259 | 0, | ||
| 2451 | 260 | G_PARAM_READWRITE)); | ||
| 2452 | 261 | |||
| 2453 | 262 | g_object_class_install_property (gobject_class, | ||
| 2454 | 241 | PROP_AUTOSTART_DISPLAY_PADS, | 263 | PROP_AUTOSTART_DISPLAY_PADS, |
| 2456 | 242 | g_param_spec_uint ("autostart_display_pads", | 264 | g_param_spec_uint ("autostart-display-pads", |
| 2457 | 243 | "Autostart display pads", | 265 | "Autostart display pads", |
| 2458 | 244 | "How to show the different pads when Xpad is started", | 266 | "How to show the different pads when Xpad is started", |
| 2459 | 245 | 0, | 267 | 0, |
| 2460 | @@ -265,18 +287,6 @@ | |||
| 2461 | 265 | settings->priv->text = gdk_rgba_copy(&(GdkRGBA) {0, 0, 0, 1}); | 287 | settings->priv->text = gdk_rgba_copy(&(GdkRGBA) {0, 0, 0, 1}); |
| 2462 | 266 | settings->priv->back = gdk_rgba_copy(&(GdkRGBA) {1, 0.933334350586, 0.6, 1}); | 288 | settings->priv->back = gdk_rgba_copy(&(GdkRGBA) {1, 0.933334350586, 0.6, 1}); |
| 2463 | 267 | 289 | ||
| 2464 | 268 | settings->priv->width = 200; | ||
| 2465 | 269 | settings->priv->height = 200; | ||
| 2466 | 270 | settings->priv->has_decorations = TRUE; | ||
| 2467 | 271 | settings->priv->confirm_destroy = TRUE; | ||
| 2468 | 272 | settings->priv->autostart_sticky = FALSE; | ||
| 2469 | 273 | settings->priv->edit_lock = FALSE; | ||
| 2470 | 274 | settings->priv->tray_click_configuration = 0; | ||
| 2471 | 275 | settings->priv->fontname = NULL; | ||
| 2472 | 276 | settings->priv->has_toolbar = TRUE; | ||
| 2473 | 277 | settings->priv->autohide_toolbar = TRUE; | ||
| 2474 | 278 | settings->priv->has_scrollbar = TRUE; | ||
| 2475 | 279 | |||
| 2476 | 280 | settings->priv->toolbar_buttons = NULL; | 290 | settings->priv->toolbar_buttons = NULL; |
| 2477 | 281 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New")); | 291 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New")); |
| 2478 | 282 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete")); | 292 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Delete")); |
| 2479 | @@ -288,11 +298,6 @@ | |||
| 2480 | 288 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Undo")); | 298 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Undo")); |
| 2481 | 289 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Redo")); | 299 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("Redo")); |
| 2482 | 290 | 300 | ||
| 2483 | 291 | settings->priv->autostart_wait_systray = TRUE; | ||
| 2484 | 292 | settings->priv->autostart_delay = 0; | ||
| 2485 | 293 | settings->priv->autostart_new_pad = FALSE; | ||
| 2486 | 294 | settings->priv->autostart_display_pads = 2; | ||
| 2487 | 295 | |||
| 2488 | 296 | load_from_file (settings, DEFAULTS_FILENAME); | 301 | load_from_file (settings, DEFAULTS_FILENAME); |
| 2489 | 297 | } | 302 | } |
| 2490 | 298 | 303 | ||
| 2491 | @@ -313,163 +318,10 @@ | |||
| 2492 | 313 | gdk_rgba_free (settings->priv->text); | 318 | gdk_rgba_free (settings->priv->text); |
| 2493 | 314 | if (settings->priv->back) | 319 | if (settings->priv->back) |
| 2494 | 315 | gdk_rgba_free (settings->priv->back); | 320 | gdk_rgba_free (settings->priv->back); |
| 2495 | 316 | |||
| 2496 | 317 | g_free (settings->priv->fontname); | ||
| 2497 | 318 | 321 | ||
| 2498 | 319 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); | 322 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); |
| 2499 | 320 | } | 323 | } |
| 2500 | 321 | 324 | ||
| 2501 | 322 | void xpad_settings_set_width (XpadSettings *settings, guint width) | ||
| 2502 | 323 | { | ||
| 2503 | 324 | if (settings->priv->width == width) | ||
| 2504 | 325 | return; | ||
| 2505 | 326 | |||
| 2506 | 327 | settings->priv->width = width; | ||
| 2507 | 328 | |||
| 2508 | 329 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2509 | 330 | |||
| 2510 | 331 | g_object_notify (G_OBJECT (settings), "width"); | ||
| 2511 | 332 | } | ||
| 2512 | 333 | |||
| 2513 | 334 | guint xpad_settings_get_width (XpadSettings *settings) | ||
| 2514 | 335 | { | ||
| 2515 | 336 | return settings->priv->width; | ||
| 2516 | 337 | } | ||
| 2517 | 338 | |||
| 2518 | 339 | void xpad_settings_set_height (XpadSettings *settings, guint height) | ||
| 2519 | 340 | { | ||
| 2520 | 341 | if (settings->priv->height == height) | ||
| 2521 | 342 | return; | ||
| 2522 | 343 | |||
| 2523 | 344 | settings->priv->height = height; | ||
| 2524 | 345 | |||
| 2525 | 346 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2526 | 347 | |||
| 2527 | 348 | g_object_notify (G_OBJECT (settings), "height"); | ||
| 2528 | 349 | } | ||
| 2529 | 350 | |||
| 2530 | 351 | guint xpad_settings_get_height (XpadSettings *settings) | ||
| 2531 | 352 | { | ||
| 2532 | 353 | return settings->priv->height; | ||
| 2533 | 354 | } | ||
| 2534 | 355 | |||
| 2535 | 356 | void xpad_settings_set_has_decorations (XpadSettings *settings, gboolean decorations) | ||
| 2536 | 357 | { | ||
| 2537 | 358 | if (settings->priv->has_decorations == decorations) | ||
| 2538 | 359 | return; | ||
| 2539 | 360 | |||
| 2540 | 361 | settings->priv->has_decorations = decorations; | ||
| 2541 | 362 | |||
| 2542 | 363 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2543 | 364 | |||
| 2544 | 365 | g_object_notify (G_OBJECT (settings), "has_decorations"); | ||
| 2545 | 366 | } | ||
| 2546 | 367 | |||
| 2547 | 368 | gboolean xpad_settings_get_has_decorations (XpadSettings *settings) | ||
| 2548 | 369 | { | ||
| 2549 | 370 | return settings->priv->has_decorations; | ||
| 2550 | 371 | } | ||
| 2551 | 372 | |||
| 2552 | 373 | void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm) | ||
| 2553 | 374 | { | ||
| 2554 | 375 | if (settings->priv->confirm_destroy == confirm) | ||
| 2555 | 376 | return; | ||
| 2556 | 377 | |||
| 2557 | 378 | settings->priv->confirm_destroy = confirm; | ||
| 2558 | 379 | |||
| 2559 | 380 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2560 | 381 | |||
| 2561 | 382 | g_object_notify (G_OBJECT (settings), "confirm_destroy"); | ||
| 2562 | 383 | } | ||
| 2563 | 384 | |||
| 2564 | 385 | gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings) | ||
| 2565 | 386 | { | ||
| 2566 | 387 | return settings->priv->confirm_destroy; | ||
| 2567 | 388 | } | ||
| 2568 | 389 | |||
| 2569 | 390 | void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock) | ||
| 2570 | 391 | { | ||
| 2571 | 392 | if (settings->priv->edit_lock == lock) | ||
| 2572 | 393 | return; | ||
| 2573 | 394 | |||
| 2574 | 395 | settings->priv->edit_lock = lock; | ||
| 2575 | 396 | |||
| 2576 | 397 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2577 | 398 | |||
| 2578 | 399 | g_object_notify (G_OBJECT (settings), "edit_lock"); | ||
| 2579 | 400 | } | ||
| 2580 | 401 | |||
| 2581 | 402 | gboolean xpad_settings_get_edit_lock (XpadSettings *settings) | ||
| 2582 | 403 | { | ||
| 2583 | 404 | return settings->priv->edit_lock; | ||
| 2584 | 405 | } | ||
| 2585 | 406 | |||
| 2586 | 407 | void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf) | ||
| 2587 | 408 | { | ||
| 2588 | 409 | if (settings->priv->tray_click_configuration == conf) | ||
| 2589 | 410 | return; | ||
| 2590 | 411 | |||
| 2591 | 412 | settings->priv->tray_click_configuration = conf; | ||
| 2592 | 413 | save_to_file(settings, DEFAULTS_FILENAME); | ||
| 2593 | 414 | g_object_notify (G_OBJECT (settings), "tray_click_configuration"); | ||
| 2594 | 415 | } | ||
| 2595 | 416 | |||
| 2596 | 417 | guint xpad_settings_get_tray_click_handler(XpadSettings *settings) | ||
| 2597 | 418 | { | ||
| 2598 | 419 | return settings->priv->tray_click_configuration; | ||
| 2599 | 420 | } | ||
| 2600 | 421 | |||
| 2601 | 422 | void xpad_settings_set_has_toolbar (XpadSettings *settings, gboolean toolbar) | ||
| 2602 | 423 | { | ||
| 2603 | 424 | if (settings->priv->has_toolbar == toolbar) | ||
| 2604 | 425 | return; | ||
| 2605 | 426 | |||
| 2606 | 427 | settings->priv->has_toolbar = toolbar; | ||
| 2607 | 428 | |||
| 2608 | 429 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2609 | 430 | |||
| 2610 | 431 | g_object_notify (G_OBJECT (settings), "has_toolbar"); | ||
| 2611 | 432 | } | ||
| 2612 | 433 | |||
| 2613 | 434 | gboolean xpad_settings_get_has_toolbar (XpadSettings *settings) | ||
| 2614 | 435 | { | ||
| 2615 | 436 | return settings->priv->has_toolbar; | ||
| 2616 | 437 | } | ||
| 2617 | 438 | |||
| 2618 | 439 | void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide) | ||
| 2619 | 440 | { | ||
| 2620 | 441 | if (settings->priv->autohide_toolbar == hide) | ||
| 2621 | 442 | return; | ||
| 2622 | 443 | |||
| 2623 | 444 | settings->priv->autohide_toolbar = hide; | ||
| 2624 | 445 | |||
| 2625 | 446 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2626 | 447 | |||
| 2627 | 448 | g_object_notify (G_OBJECT (settings), "autohide_toolbar"); | ||
| 2628 | 449 | } | ||
| 2629 | 450 | |||
| 2630 | 451 | gboolean xpad_settings_get_autohide_toolbar (XpadSettings *settings) | ||
| 2631 | 452 | { | ||
| 2632 | 453 | return settings->priv->autohide_toolbar; | ||
| 2633 | 454 | } | ||
| 2634 | 455 | |||
| 2635 | 456 | void xpad_settings_set_has_scrollbar (XpadSettings *settings, gboolean scrollbar) | ||
| 2636 | 457 | { | ||
| 2637 | 458 | if (settings->priv->has_scrollbar == scrollbar) | ||
| 2638 | 459 | return; | ||
| 2639 | 460 | |||
| 2640 | 461 | settings->priv->has_scrollbar = scrollbar; | ||
| 2641 | 462 | |||
| 2642 | 463 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2643 | 464 | |||
| 2644 | 465 | g_object_notify (G_OBJECT (settings), "has_scrollbar"); | ||
| 2645 | 466 | } | ||
| 2646 | 467 | |||
| 2647 | 468 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings) | ||
| 2648 | 469 | { | ||
| 2649 | 470 | return settings->priv->has_scrollbar; | ||
| 2650 | 471 | } | ||
| 2651 | 472 | |||
| 2652 | 473 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button) | 325 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button) |
| 2653 | 474 | { | 326 | { |
| 2654 | 475 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup (button)); | 327 | settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup (button)); |
| 2655 | @@ -530,313 +382,254 @@ | |||
| 2656 | 530 | return settings->priv->toolbar_buttons; | 382 | return settings->priv->toolbar_buttons; |
| 2657 | 531 | } | 383 | } |
| 2658 | 532 | 384 | ||
| 2659 | 533 | void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back) | ||
| 2660 | 534 | { | ||
| 2661 | 535 | if (settings->priv->back) | ||
| 2662 | 536 | gdk_rgba_free (settings->priv->back); | ||
| 2663 | 537 | |||
| 2664 | 538 | if (back) | ||
| 2665 | 539 | settings->priv->back = gdk_rgba_copy (back); | ||
| 2666 | 540 | else | ||
| 2667 | 541 | settings->priv->back = NULL; | ||
| 2668 | 542 | |||
| 2669 | 543 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2670 | 544 | |||
| 2671 | 545 | g_object_notify (G_OBJECT (settings), "back_color"); | ||
| 2672 | 546 | } | ||
| 2673 | 547 | |||
| 2674 | 548 | const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings) | ||
| 2675 | 549 | { | ||
| 2676 | 550 | return settings->priv->back; | ||
| 2677 | 551 | } | ||
| 2678 | 552 | |||
| 2679 | 553 | void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text) | ||
| 2680 | 554 | { | ||
| 2681 | 555 | if (settings->priv->text) | ||
| 2682 | 556 | gdk_rgba_free (settings->priv->text); | ||
| 2683 | 557 | |||
| 2684 | 558 | if (text) | ||
| 2685 | 559 | settings->priv->text = gdk_rgba_copy (text); | ||
| 2686 | 560 | else | ||
| 2687 | 561 | settings->priv->text = NULL; | ||
| 2688 | 562 | |||
| 2689 | 563 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2690 | 564 | |||
| 2691 | 565 | g_object_notify (G_OBJECT (settings), "text_color"); | ||
| 2692 | 566 | } | ||
| 2693 | 567 | |||
| 2694 | 568 | const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings) | ||
| 2695 | 569 | { | ||
| 2696 | 570 | return settings->priv->text; | ||
| 2697 | 571 | } | ||
| 2698 | 572 | |||
| 2699 | 573 | void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname) | ||
| 2700 | 574 | { | ||
| 2701 | 575 | g_free (settings->priv->fontname); | ||
| 2702 | 576 | settings->priv->fontname = g_strdup (fontname); | ||
| 2703 | 577 | |||
| 2704 | 578 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2705 | 579 | |||
| 2706 | 580 | g_object_notify (G_OBJECT (settings), "fontname"); | ||
| 2707 | 581 | } | ||
| 2708 | 582 | |||
| 2709 | 583 | const gchar *xpad_settings_get_fontname (XpadSettings *settings) | ||
| 2710 | 584 | { | ||
| 2711 | 585 | return settings->priv->fontname; | ||
| 2712 | 586 | } | ||
| 2713 | 587 | |||
| 2714 | 588 | gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings) | ||
| 2715 | 589 | { | ||
| 2716 | 590 | /* The existence of the xpad.desktop file in the autostart folder defines if autostarting is enabled or disabled */ | ||
| 2717 | 591 | const gchar *filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
| 2718 | 592 | return g_file_test (filename, G_FILE_TEST_EXISTS); | ||
| 2719 | 593 | } | ||
| 2720 | 594 | |||
| 2721 | 595 | void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf) | ||
| 2722 | 596 | { | ||
| 2723 | 597 | if (settings->priv->autostart_wait_systray == conf) | ||
| 2724 | 598 | return; | ||
| 2725 | 599 | |||
| 2726 | 600 | settings->priv->autostart_wait_systray = conf; | ||
| 2727 | 601 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2728 | 602 | g_object_notify (G_OBJECT (settings), "autostart_wait_systray"); | ||
| 2729 | 603 | } | ||
| 2730 | 604 | |||
| 2731 | 605 | gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings) | ||
| 2732 | 606 | { | ||
| 2733 | 607 | return settings->priv->autostart_wait_systray; | ||
| 2734 | 608 | } | ||
| 2735 | 609 | |||
| 2736 | 610 | void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf) | ||
| 2737 | 611 | { | ||
| 2738 | 612 | if (settings->priv->autostart_delay == conf) | ||
| 2739 | 613 | return; | ||
| 2740 | 614 | |||
| 2741 | 615 | settings->priv->autostart_delay = conf; | ||
| 2742 | 616 | save_to_file(settings, DEFAULTS_FILENAME); | ||
| 2743 | 617 | g_object_notify (G_OBJECT (settings), "autostart_delay"); | ||
| 2744 | 618 | } | ||
| 2745 | 619 | |||
| 2746 | 620 | guint xpad_settings_get_autostart_delay (XpadSettings *settings) | ||
| 2747 | 621 | { | ||
| 2748 | 622 | return settings->priv->autostart_delay; | ||
| 2749 | 623 | } | ||
| 2750 | 624 | |||
| 2751 | 625 | void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf) | ||
| 2752 | 626 | { | ||
| 2753 | 627 | if (settings->priv->autostart_new_pad == conf) | ||
| 2754 | 628 | return; | ||
| 2755 | 629 | |||
| 2756 | 630 | settings->priv->autostart_new_pad = conf; | ||
| 2757 | 631 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2758 | 632 | g_object_notify (G_OBJECT (settings), "autostart_new_pad"); | ||
| 2759 | 633 | } | ||
| 2760 | 634 | |||
| 2761 | 635 | gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings) | ||
| 2762 | 636 | { | ||
| 2763 | 637 | return settings->priv->autostart_new_pad; | ||
| 2764 | 638 | } | ||
| 2765 | 639 | |||
| 2766 | 640 | void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean sticky) | ||
| 2767 | 641 | { | ||
| 2768 | 642 | if (settings->priv->autostart_sticky == sticky) | ||
| 2769 | 643 | return; | ||
| 2770 | 644 | |||
| 2771 | 645 | settings->priv->autostart_sticky = sticky; | ||
| 2772 | 646 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2773 | 647 | g_object_notify (G_OBJECT (settings), "autostart_sticky"); | ||
| 2774 | 648 | } | ||
| 2775 | 649 | |||
| 2776 | 650 | gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings) | ||
| 2777 | 651 | { | ||
| 2778 | 652 | return settings->priv->autostart_sticky; | ||
| 2779 | 653 | } | ||
| 2780 | 654 | |||
| 2781 | 655 | void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf) | ||
| 2782 | 656 | { | ||
| 2783 | 657 | if (settings->priv->autostart_display_pads == conf) | ||
| 2784 | 658 | return; | ||
| 2785 | 659 | |||
| 2786 | 660 | settings->priv->autostart_display_pads = conf; | ||
| 2787 | 661 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2788 | 662 | g_object_notify (G_OBJECT (settings), "autostart_display_pads"); | ||
| 2789 | 663 | } | ||
| 2790 | 664 | |||
| 2791 | 665 | guint xpad_settings_get_autostart_display_pads(XpadSettings *settings) | ||
| 2792 | 666 | { | ||
| 2793 | 667 | return settings->priv->autostart_display_pads; | ||
| 2794 | 668 | } | ||
| 2795 | 669 | |||
| 2796 | 670 | static void | 385 | static void |
| 2797 | 671 | xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | 386 | xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
| 2798 | 672 | { | 387 | { |
| 2802 | 673 | XpadSettings *settings; | 388 | XpadSettings *settings = XPAD_SETTINGS (object); |
| 2800 | 674 | |||
| 2801 | 675 | settings = XPAD_SETTINGS (object); | ||
| 2803 | 676 | 389 | ||
| 2804 | 677 | switch (prop_id) | 390 | switch (prop_id) |
| 2805 | 678 | { | 391 | { |
| 2806 | 392 | case PROP_WIDTH: | ||
| 2807 | 393 | settings->priv->width = g_value_get_uint (value); | ||
| 2808 | 394 | break; | ||
| 2809 | 395 | |||
| 2810 | 679 | case PROP_HEIGHT: | 396 | case PROP_HEIGHT: |
| 2816 | 680 | xpad_settings_set_height (settings, g_value_get_uint (value)); | 397 | settings->priv->height = g_value_get_uint (value); |
| 2812 | 681 | break; | ||
| 2813 | 682 | |||
| 2814 | 683 | case PROP_WIDTH: | ||
| 2815 | 684 | xpad_settings_set_width (settings, g_value_get_uint (value)); | ||
| 2817 | 685 | break; | 398 | break; |
| 2818 | 686 | 399 | ||
| 2819 | 687 | case PROP_HAS_DECORATIONS: | 400 | case PROP_HAS_DECORATIONS: |
| 2821 | 688 | xpad_settings_set_has_decorations (settings, g_value_get_boolean (value)); | 401 | settings->priv->has_decorations = g_value_get_boolean (value); |
| 2822 | 689 | break; | 402 | break; |
| 2823 | 690 | 403 | ||
| 2824 | 691 | case PROP_CONFIRM_DESTROY: | 404 | case PROP_CONFIRM_DESTROY: |
| 2826 | 692 | xpad_settings_set_confirm_destroy (settings, g_value_get_boolean (value)); | 405 | settings->priv->confirm_destroy = g_value_get_boolean (value); |
| 2827 | 693 | break; | 406 | break; |
| 2828 | 694 | 407 | ||
| 2829 | 695 | case PROP_EDIT_LOCK: | 408 | case PROP_EDIT_LOCK: |
| 2831 | 696 | xpad_settings_set_edit_lock (settings, g_value_get_boolean (value)); | 409 | settings->priv->edit_lock = g_value_get_boolean (value); |
| 2832 | 697 | break; | 410 | break; |
| 2833 | 698 | 411 | ||
| 2834 | 412 | case PROP_TRAY_ENABLED: | ||
| 2835 | 413 | settings->priv->tray_enabled = g_value_get_boolean (value); | ||
| 2836 | 414 | break; | ||
| 2837 | 415 | |||
| 2838 | 699 | case PROP_TRAY_CLICK_CONFIGURATION: | 416 | case PROP_TRAY_CLICK_CONFIGURATION: |
| 2840 | 700 | xpad_settings_set_tray_click_handler(settings, g_value_get_uint(value)); | 417 | settings->priv->tray_click_configuration = g_value_get_uint(value); |
| 2841 | 701 | break; | 418 | break; |
| 2842 | 702 | 419 | ||
| 2843 | 703 | case PROP_HAS_TOOLBAR: | 420 | case PROP_HAS_TOOLBAR: |
| 2845 | 704 | xpad_settings_set_has_toolbar (settings, g_value_get_boolean (value)); | 421 | settings->priv->has_toolbar = g_value_get_boolean (value); |
| 2846 | 705 | break; | 422 | break; |
| 2847 | 706 | 423 | ||
| 2848 | 707 | case PROP_AUTOHIDE_TOOLBAR: | 424 | case PROP_AUTOHIDE_TOOLBAR: |
| 2850 | 708 | xpad_settings_set_autohide_toolbar (settings, g_value_get_boolean (value)); | 425 | settings->priv->autohide_toolbar = g_value_get_boolean (value); |
| 2851 | 709 | break; | 426 | break; |
| 2852 | 710 | 427 | ||
| 2853 | 711 | case PROP_HAS_SCROLLBAR: | 428 | case PROP_HAS_SCROLLBAR: |
| 2855 | 712 | xpad_settings_set_has_scrollbar (settings, g_value_get_boolean (value)); | 429 | settings->priv->has_scrollbar = g_value_get_boolean (value); |
| 2856 | 713 | break; | 430 | break; |
| 2857 | 714 | 431 | ||
| 2858 | 432 | case PROP_TEXT_COLOR: | ||
| 2859 | 433 | if (settings->priv->text) | ||
| 2860 | 434 | gdk_rgba_free (settings->priv->text); | ||
| 2861 | 435 | if (g_value_get_boxed (value)) | ||
| 2862 | 436 | settings->priv->text = gdk_rgba_copy (g_value_get_boxed (value)); | ||
| 2863 | 437 | else | ||
| 2864 | 438 | settings->priv->text = NULL; | ||
| 2865 | 439 | break; | ||
| 2866 | 440 | |||
| 2867 | 715 | case PROP_BACK_COLOR: | 441 | case PROP_BACK_COLOR: |
| 2875 | 716 | xpad_settings_set_back_color (settings, g_value_get_boxed (value)); | 442 | if (settings->priv->back) |
| 2876 | 717 | break; | 443 | gdk_rgba_free (settings->priv->back); |
| 2877 | 718 | 444 | if (g_value_get_boxed (value)) | |
| 2878 | 719 | case PROP_TEXT_COLOR: | 445 | settings->priv->back = gdk_rgba_copy (g_value_get_boxed (value)); |
| 2879 | 720 | xpad_settings_set_text_color (settings, g_value_get_boxed (value)); | 446 | else |
| 2880 | 721 | break; | 447 | settings->priv->back = NULL; |
| 2881 | 722 | 448 | break; | |
| 2882 | 449 | |||
| 2883 | 723 | case PROP_FONTNAME: | 450 | case PROP_FONTNAME: |
| 2885 | 724 | xpad_settings_set_fontname (settings, g_value_get_string (value)); | 451 | if (value) |
| 2886 | 452 | settings->priv->fontname = g_value_dup_string (value); | ||
| 2887 | 453 | else | ||
| 2888 | 454 | settings->priv->fontname = NULL; | ||
| 2889 | 455 | break; | ||
| 2890 | 456 | |||
| 2891 | 457 | case PROP_AUTOSTART_XPAD: | ||
| 2892 | 458 | if (g_value_get_boolean (value)) { | ||
| 2893 | 459 | /* Copy the xpad.desktop file to the autostart folder and enable/disable the wait for systray preference */ | ||
| 2894 | 460 | gboolean success; | ||
| 2895 | 461 | char *source_filename, *destination_directory; | ||
| 2896 | 462 | GFile *source, *destination; | ||
| 2897 | 463 | GError *error = NULL; | ||
| 2898 | 464 | |||
| 2899 | 465 | /* Find the base directory where the application is installed /usr or /usr/local, to find the correct xpad.desktop file. */ | ||
| 2900 | 466 | const char *program_path = xpad_app_get_program_path(); | ||
| 2901 | 467 | |||
| 2902 | 468 | if (!program_path) | ||
| 2903 | 469 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), g_strdup_printf (_("Could not find the directory where Xpad is installed\n%s"), error->message)); | ||
| 2904 | 470 | else { | ||
| 2905 | 471 | size_t len = strlen(program_path); | ||
| 2906 | 472 | char basedir[len-8]; | ||
| 2907 | 473 | guint i; | ||
| 2908 | 474 | for (i=0; i<len-8; i++) | ||
| 2909 | 475 | basedir[i] = program_path[i]; | ||
| 2910 | 476 | basedir[len-9] = '\0'; | ||
| 2911 | 477 | |||
| 2912 | 478 | source_filename = g_strdup_printf ("%s/share/applications/xpad.desktop", basedir); | ||
| 2913 | 479 | destination_directory = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
| 2914 | 480 | |||
| 2915 | 481 | source = g_file_new_for_path (source_filename); | ||
| 2916 | 482 | destination = g_file_new_for_path (destination_directory); | ||
| 2917 | 483 | success = g_file_copy (source, destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); | ||
| 2918 | 484 | |||
| 2919 | 485 | if (!success) | ||
| 2920 | 486 | xpad_app_error (NULL, _("Error enabling Xpad autostart"), g_strdup_printf (_("Could not copy %s to %s\n%s"), source_filename, destination_directory, error->message)); | ||
| 2921 | 487 | } | ||
| 2922 | 488 | } | ||
| 2923 | 489 | else { | ||
| 2924 | 490 | /* Remove the xpad.desktop file from the autostart folder and enable/disable the wait for systray preference */ | ||
| 2925 | 491 | gboolean success; | ||
| 2926 | 492 | char *filename; | ||
| 2927 | 493 | GFile *file; | ||
| 2928 | 494 | GError *error = NULL; | ||
| 2929 | 495 | |||
| 2930 | 496 | filename = g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")); | ||
| 2931 | 497 | file = g_file_new_for_path (filename); | ||
| 2932 | 498 | success = g_file_delete (file, NULL, &error); | ||
| 2933 | 499 | |||
| 2934 | 500 | if (!success) | ||
| 2935 | 501 | xpad_app_error (NULL, _("Error disabling Xpad autostart"), g_strdup_printf (_("Could not delete %s\n%s"), filename, error->message)); | ||
| 2936 | 502 | } | ||
| 2937 | 725 | break; | 503 | break; |
| 2938 | 726 | 504 | ||
| 2939 | 727 | case PROP_AUTOSTART_WAIT_SYSTRAY: | 505 | case PROP_AUTOSTART_WAIT_SYSTRAY: |
| 2945 | 728 | xpad_settings_set_autostart_wait_systray (settings, g_value_get_boolean (value)); | 506 | settings->priv->autostart_wait_systray = g_value_get_boolean (value); |
| 2941 | 729 | break; | ||
| 2942 | 730 | |||
| 2943 | 731 | case PROP_AUTOSTART_DELAY: | ||
| 2944 | 732 | xpad_settings_set_autostart_delay (settings, g_value_get_uint (value)); | ||
| 2946 | 733 | break; | 507 | break; |
| 2947 | 734 | 508 | ||
| 2948 | 735 | case PROP_AUTOSTART_NEW_PAD: | 509 | case PROP_AUTOSTART_NEW_PAD: |
| 2950 | 736 | xpad_settings_set_autostart_new_pad (settings, g_value_get_boolean (value)); | 510 | settings->priv->autostart_new_pad = g_value_get_boolean (value); |
| 2951 | 737 | break; | 511 | break; |
| 2952 | 738 | 512 | ||
| 2953 | 739 | case PROP_AUTOSTART_STICKY: | 513 | case PROP_AUTOSTART_STICKY: |
| 2955 | 740 | xpad_settings_set_autostart_sticky (settings, g_value_get_boolean (value)); | 514 | settings->priv->autostart_sticky = g_value_get_boolean (value); |
| 2956 | 741 | break; | 515 | break; |
| 2957 | 742 | 516 | ||
| 2958 | 517 | case PROP_AUTOSTART_DELAY: | ||
| 2959 | 518 | settings->priv->autostart_delay = g_value_get_uint (value); | ||
| 2960 | 519 | break; | ||
| 2961 | 520 | |||
| 2962 | 743 | case PROP_AUTOSTART_DISPLAY_PADS: | 521 | case PROP_AUTOSTART_DISPLAY_PADS: |
| 2964 | 744 | xpad_settings_set_autostart_display_pads (settings, g_value_get_uint (value)); | 522 | settings->priv->autostart_display_pads = g_value_get_uint (value); |
| 2965 | 745 | break; | 523 | break; |
| 2966 | 746 | 524 | ||
| 2967 | 747 | default: | 525 | default: |
| 2968 | 748 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 526 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 2970 | 749 | break; | 527 | return; |
| 2971 | 750 | } | 528 | } |
| 2972 | 529 | save_to_file (settings, DEFAULTS_FILENAME); | ||
| 2973 | 751 | } | 530 | } |
| 2974 | 752 | 531 | ||
| 2975 | 753 | static void | 532 | static void |
| 2976 | 754 | xpad_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | 533 | xpad_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
| 2977 | 755 | { | 534 | { |
| 2981 | 756 | XpadSettings *settings; | 535 | XpadSettings *settings = XPAD_SETTINGS (object); |
| 2979 | 757 | |||
| 2980 | 758 | settings = XPAD_SETTINGS (object); | ||
| 2982 | 759 | 536 | ||
| 2983 | 760 | switch (prop_id) | 537 | switch (prop_id) |
| 2984 | 761 | { | 538 | { |
| 2985 | 539 | case PROP_WIDTH: | ||
| 2986 | 540 | g_value_set_uint (value, settings->priv->width); | ||
| 2987 | 541 | break; | ||
| 2988 | 542 | |||
| 2989 | 762 | case PROP_HEIGHT: | 543 | case PROP_HEIGHT: |
| 2995 | 763 | g_value_set_uint (value, xpad_settings_get_height (settings)); | 544 | g_value_set_uint (value, settings->priv->height); |
| 2991 | 764 | break; | ||
| 2992 | 765 | |||
| 2993 | 766 | case PROP_WIDTH: | ||
| 2994 | 767 | g_value_set_uint (value, xpad_settings_get_width (settings)); | ||
| 2996 | 768 | break; | 545 | break; |
| 2997 | 769 | 546 | ||
| 2998 | 770 | case PROP_HAS_DECORATIONS: | 547 | case PROP_HAS_DECORATIONS: |
| 3000 | 771 | g_value_set_boolean (value, xpad_settings_get_has_decorations (settings)); | 548 | g_value_set_boolean (value, settings->priv->has_decorations); |
| 3001 | 772 | break; | 549 | break; |
| 3002 | 773 | 550 | ||
| 3003 | 774 | case PROP_CONFIRM_DESTROY: | 551 | case PROP_CONFIRM_DESTROY: |
| 3005 | 775 | g_value_set_boolean (value, xpad_settings_get_confirm_destroy (settings)); | 552 | g_value_set_boolean (value, settings->priv->confirm_destroy); |
| 3006 | 776 | break; | 553 | break; |
| 3007 | 777 | 554 | ||
| 3008 | 778 | case PROP_EDIT_LOCK: | 555 | case PROP_EDIT_LOCK: |
| 3010 | 779 | g_value_set_boolean (value, xpad_settings_get_edit_lock (settings)); | 556 | g_value_set_boolean (value, settings->priv->edit_lock); |
| 3011 | 780 | break; | 557 | break; |
| 3012 | 781 | 558 | ||
| 3013 | 559 | case PROP_TRAY_ENABLED: | ||
| 3014 | 560 | g_value_set_boolean (value, settings->priv->tray_enabled); | ||
| 3015 | 561 | break; | ||
| 3016 | 562 | |||
| 3017 | 563 | case PROP_TRAY_CLICK_CONFIGURATION: | ||
| 3018 | 564 | g_value_set_uint (value, settings->priv->tray_click_configuration); | ||
| 3019 | 565 | break; | ||
| 3020 | 566 | |||
| 3021 | 782 | case PROP_HAS_TOOLBAR: | 567 | case PROP_HAS_TOOLBAR: |
| 3023 | 783 | g_value_set_boolean (value, xpad_settings_get_has_toolbar (settings)); | 568 | g_value_set_boolean (value, settings->priv->has_toolbar); |
| 3024 | 784 | break; | 569 | break; |
| 3025 | 785 | 570 | ||
| 3026 | 786 | case PROP_AUTOHIDE_TOOLBAR: | 571 | case PROP_AUTOHIDE_TOOLBAR: |
| 3028 | 787 | g_value_set_boolean (value, xpad_settings_get_autohide_toolbar (settings)); | 572 | g_value_set_boolean (value, settings->priv->autohide_toolbar); |
| 3029 | 788 | break; | 573 | break; |
| 3030 | 789 | 574 | ||
| 3031 | 790 | case PROP_HAS_SCROLLBAR: | 575 | case PROP_HAS_SCROLLBAR: |
| 3033 | 791 | g_value_set_boolean (value, xpad_settings_get_has_scrollbar (settings)); | 576 | g_value_set_boolean (value, settings->priv->has_scrollbar); |
| 3034 | 577 | break; | ||
| 3035 | 578 | |||
| 3036 | 579 | case PROP_TEXT_COLOR: | ||
| 3037 | 580 | if (settings->priv->text) | ||
| 3038 | 581 | g_value_set_static_boxed (value, settings->priv->text); | ||
| 3039 | 582 | else | ||
| 3040 | 583 | value = NULL; | ||
| 3041 | 792 | break; | 584 | break; |
| 3042 | 793 | 585 | ||
| 3043 | 794 | case PROP_BACK_COLOR: | 586 | case PROP_BACK_COLOR: |
| 3049 | 795 | g_value_set_static_boxed (value, xpad_settings_get_back_color (settings)); | 587 | if (settings->priv->back) |
| 3050 | 796 | break; | 588 | g_value_set_static_boxed (value, settings->priv->back); |
| 3051 | 797 | 589 | else | |
| 3052 | 798 | case PROP_TEXT_COLOR: | 590 | value = NULL; |
| 3048 | 799 | g_value_set_static_boxed (value, xpad_settings_get_text_color (settings)); | ||
| 3053 | 800 | break; | 591 | break; |
| 3054 | 801 | 592 | ||
| 3055 | 802 | case PROP_FONTNAME: | 593 | case PROP_FONTNAME: |
| 3057 | 803 | g_value_set_string (value, xpad_settings_get_fontname (settings)); | 594 | if (settings->priv->fontname) |
| 3058 | 595 | g_value_set_string (value, settings->priv->fontname); | ||
| 3059 | 596 | else | ||
| 3060 | 597 | value = NULL; | ||
| 3061 | 598 | break; | ||
| 3062 | 599 | |||
| 3063 | 600 | case PROP_AUTOSTART_XPAD: | ||
| 3064 | 601 | g_value_set_boolean (value, g_file_test (g_strdup_printf ("%s/.config/autostart/xpad.desktop", g_getenv ("HOME")), G_FILE_TEST_EXISTS)); | ||
| 3065 | 804 | break; | 602 | break; |
| 3066 | 805 | 603 | ||
| 3067 | 806 | case PROP_AUTOSTART_WAIT_SYSTRAY: | 604 | case PROP_AUTOSTART_WAIT_SYSTRAY: |
| 3073 | 807 | g_value_set_boolean (value, xpad_settings_get_autostart_wait_systray (settings)); | 605 | g_value_set_boolean (value, settings->priv->autostart_wait_systray); |
| 3069 | 808 | break; | ||
| 3070 | 809 | |||
| 3071 | 810 | case PROP_AUTOSTART_DELAY: | ||
| 3072 | 811 | g_value_set_uint (value, xpad_settings_get_autostart_delay (settings)); | ||
| 3074 | 812 | break; | 606 | break; |
| 3075 | 813 | 607 | ||
| 3076 | 814 | case PROP_AUTOSTART_NEW_PAD: | 608 | case PROP_AUTOSTART_NEW_PAD: |
| 3078 | 815 | g_value_set_boolean (value, xpad_settings_get_autostart_new_pad (settings)); | 609 | g_value_set_boolean (value, settings->priv->autostart_new_pad); |
| 3079 | 816 | break; | 610 | break; |
| 3080 | 817 | 611 | ||
| 3081 | 818 | case PROP_AUTOSTART_STICKY: | 612 | case PROP_AUTOSTART_STICKY: |
| 3083 | 819 | g_value_set_boolean (value, xpad_settings_get_autostart_sticky (settings)); | 613 | g_value_set_boolean (value, settings->priv->autostart_sticky); |
| 3084 | 820 | break; | 614 | break; |
| 3085 | 821 | 615 | ||
| 3086 | 616 | case PROP_AUTOSTART_DELAY: | ||
| 3087 | 617 | g_value_set_uint (value, settings->priv->autostart_delay); | ||
| 3088 | 618 | break; | ||
| 3089 | 619 | |||
| 3090 | 822 | case PROP_AUTOSTART_DISPLAY_PADS: | 620 | case PROP_AUTOSTART_DISPLAY_PADS: |
| 3092 | 823 | g_value_set_uint (value, xpad_settings_get_autostart_display_pads (settings)); | 621 | g_value_set_uint (value, settings->priv->autostart_display_pads); |
| 3093 | 824 | break; | 622 | break; |
| 3095 | 825 | 623 | ||
| 3096 | 826 | default: | 624 | default: |
| 3097 | 827 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 625 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 3099 | 828 | break; | 626 | return; |
| 3100 | 829 | } | 627 | } |
| 3101 | 830 | } | 628 | } |
| 3102 | 831 | 629 | ||
| 3103 | 832 | static void | 630 | static void |
| 3104 | 833 | load_from_file (XpadSettings *settings, const gchar *filename) | 631 | load_from_file (XpadSettings *settings, const gchar *filename) |
| 3105 | 834 | { | 632 | { |
| 3106 | 835 | /** | ||
| 3107 | 836 | * We need to set up int values for all these to take the value from the file. | ||
| 3108 | 837 | * These will be assigned back to the appropriate values after load. | ||
| 3109 | 838 | */ | ||
| 3110 | 839 | |||
| 3111 | 840 | gchar *buttons = NULL; | 633 | gchar *buttons = NULL; |
| 3112 | 841 | gchar *text_color_string = NULL; | 634 | gchar *text_color_string = NULL; |
| 3113 | 842 | gchar *background_color_string = NULL; | 635 | gchar *background_color_string = NULL; |
| 3114 | @@ -860,6 +653,7 @@ | |||
| 3115 | 860 | "b|confirm_destroy", &settings->priv->confirm_destroy, | 653 | "b|confirm_destroy", &settings->priv->confirm_destroy, |
| 3116 | 861 | "b|edit_lock", &settings->priv->edit_lock, | 654 | "b|edit_lock", &settings->priv->edit_lock, |
| 3117 | 862 | "b|sticky_on_start", &settings->priv->autostart_sticky, | 655 | "b|sticky_on_start", &settings->priv->autostart_sticky, |
| 3118 | 656 | "b|tray_enabled", &settings->priv->tray_enabled, | ||
| 3119 | 863 | "u|tray_click_configuration", &settings->priv->tray_click_configuration, | 657 | "u|tray_click_configuration", &settings->priv->tray_click_configuration, |
| 3120 | 864 | "s|back", &background_color_string, | 658 | "s|back", &background_color_string, |
| 3121 | 865 | "b|use_back", &use_back, | 659 | "b|use_back", &use_back, |
| 3122 | @@ -877,8 +671,7 @@ | |||
| 3123 | 877 | NULL)) | 671 | NULL)) |
| 3124 | 878 | return; | 672 | return; |
| 3125 | 879 | 673 | ||
| 3128 | 880 | if (use_text) | 674 | if (use_text) { |
| 3127 | 881 | { | ||
| 3129 | 882 | gdk_rgba_free (settings->priv->text); | 675 | gdk_rgba_free (settings->priv->text); |
| 3130 | 883 | 676 | ||
| 3131 | 884 | /* | 677 | /* |
| 3132 | @@ -886,15 +679,12 @@ | |||
| 3133 | 886 | * (for example due to the migration to the new GdkRGBA colors), | 679 | * (for example due to the migration to the new GdkRGBA colors), |
| 3134 | 887 | * set the color to the default. | 680 | * set the color to the default. |
| 3135 | 888 | */ | 681 | */ |
| 3137 | 889 | if (text_color_string == NULL) { | 682 | if (text_color_string == NULL) |
| 3138 | 890 | text = (GdkRGBA) {0, 0, 0, 1}; | 683 | text = (GdkRGBA) {0, 0, 0, 1}; |
| 3141 | 891 | } | 684 | else |
| 3140 | 892 | else { | ||
| 3142 | 893 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ | 685 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ |
| 3144 | 894 | if (!gdk_rgba_parse (&text, text_color_string)) { | 686 | if (!gdk_rgba_parse (&text, text_color_string)) |
| 3145 | 895 | text = (GdkRGBA) {0, 0, 0, 1}; | 687 | text = (GdkRGBA) {0, 0, 0, 1}; |
| 3146 | 896 | } | ||
| 3147 | 897 | } | ||
| 3148 | 898 | 688 | ||
| 3149 | 899 | settings->priv->text = gdk_rgba_copy (&text); | 689 | settings->priv->text = gdk_rgba_copy (&text); |
| 3150 | 900 | } | 690 | } |
| 3151 | @@ -906,15 +696,12 @@ | |||
| 3152 | 906 | * (for example due to the migration to the new GdkRGBA colors), | 696 | * (for example due to the migration to the new GdkRGBA colors), |
| 3153 | 907 | * set the color to the default. | 697 | * set the color to the default. |
| 3154 | 908 | */ | 698 | */ |
| 3156 | 909 | if (background_color_string == NULL) { | 699 | if (background_color_string == NULL) |
| 3157 | 910 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 700 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
| 3160 | 911 | } | 701 | else |
| 3159 | 912 | else { | ||
| 3161 | 913 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ | 702 | /* If, for some reason, the parsing of the colors fail, set the color to the default. */ |
| 3163 | 914 | if (!gdk_rgba_parse (&back, background_color_string)) { | 703 | if (!gdk_rgba_parse (&back, background_color_string)) |
| 3164 | 915 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; | 704 | back = (GdkRGBA) {1, 0.933334350586, 0.6, 1}; |
| 3165 | 916 | } | ||
| 3166 | 917 | } | ||
| 3167 | 918 | 705 | ||
| 3168 | 919 | settings->priv->back = gdk_rgba_copy (&back); | 706 | settings->priv->back = gdk_rgba_copy (&back); |
| 3169 | 920 | } | 707 | } |
| 3170 | @@ -922,10 +709,7 @@ | |||
| 3171 | 922 | settings->priv->back = NULL; | 709 | settings->priv->back = NULL; |
| 3172 | 923 | 710 | ||
| 3173 | 924 | if (settings->priv->fontname && strcmp (settings->priv->fontname, "NULL") == 0) | 711 | if (settings->priv->fontname && strcmp (settings->priv->fontname, "NULL") == 0) |
| 3174 | 925 | { | ||
| 3175 | 926 | g_free (settings->priv->fontname); | ||
| 3176 | 927 | settings->priv->fontname = NULL; | 712 | settings->priv->fontname = NULL; |
| 3177 | 928 | } | ||
| 3178 | 929 | 713 | ||
| 3179 | 930 | if (buttons) | 714 | if (buttons) |
| 3180 | 931 | { | 715 | { |
| 3181 | @@ -943,11 +727,9 @@ | |||
| 3182 | 943 | } | 727 | } |
| 3183 | 944 | 728 | ||
| 3184 | 945 | for (i = 0; button_names[i]; ++i) | 729 | for (i = 0; button_names[i]; ++i) |
| 3185 | 946 | { | ||
| 3186 | 947 | settings->priv->toolbar_buttons = | 730 | settings->priv->toolbar_buttons = |
| 3187 | 948 | g_slist_append (settings->priv->toolbar_buttons, | 731 | g_slist_append (settings->priv->toolbar_buttons, |
| 3188 | 949 | g_strstrip (button_names[i])); /* takes ownership of string */ | 732 | g_strstrip (button_names[i])); /* takes ownership of string */ |
| 3189 | 950 | } | ||
| 3190 | 951 | 733 | ||
| 3191 | 952 | g_free (button_names); | 734 | g_free (button_names); |
| 3192 | 953 | g_free (buttons); | 735 | g_free (buttons); |
| 3193 | @@ -983,6 +765,7 @@ | |||
| 3194 | 983 | "b|confirm_destroy", settings->priv->confirm_destroy, | 765 | "b|confirm_destroy", settings->priv->confirm_destroy, |
| 3195 | 984 | "b|edit_lock", settings->priv->edit_lock, | 766 | "b|edit_lock", settings->priv->edit_lock, |
| 3196 | 985 | "b|sticky_on_start", settings->priv->autostart_sticky, | 767 | "b|sticky_on_start", settings->priv->autostart_sticky, |
| 3197 | 768 | "b|tray_enabled", settings->priv->tray_enabled, | ||
| 3198 | 986 | "u|tray_click_configuration", settings->priv->tray_click_configuration, | 769 | "u|tray_click_configuration", settings->priv->tray_click_configuration, |
| 3199 | 987 | "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL", | 770 | "s|back", settings->priv->back ? gdk_rgba_to_string (settings->priv->back) : "NULL", |
| 3200 | 988 | "b|use_back", settings->priv->back ? TRUE : FALSE, | 771 | "b|use_back", settings->priv->back ? TRUE : FALSE, |
| 3201 | 989 | 772 | ||
| 3202 | === modified file 'src/xpad-settings.h' | |||
| 3203 | --- src/xpad-settings.h 2014-06-07 00:19:07 +0000 | |||
| 3204 | +++ src/xpad-settings.h 2014-06-13 15:52:27 +0000 | |||
| 3205 | @@ -1,6 +1,7 @@ | |||
| 3206 | 1 | /* | 1 | /* |
| 3207 | 2 | 2 | ||
| 3208 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3209 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 3210 | 4 | 5 | ||
| 3211 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 3212 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 3213 | @@ -21,7 +22,7 @@ | |||
| 3214 | 21 | #ifndef __XPAD_SETTINGS_H__ | 22 | #ifndef __XPAD_SETTINGS_H__ |
| 3215 | 22 | #define __XPAD_SETTINGS_H__ | 23 | #define __XPAD_SETTINGS_H__ |
| 3216 | 23 | 24 | ||
| 3218 | 24 | #include <gtk/gtk.h> | 25 | #include <glib.h> |
| 3219 | 25 | 26 | ||
| 3220 | 26 | G_BEGIN_DECLS | 27 | G_BEGIN_DECLS |
| 3221 | 27 | 28 | ||
| 3222 | @@ -54,65 +55,11 @@ | |||
| 3223 | 54 | 55 | ||
| 3224 | 55 | XpadSettings *xpad_settings_new (void); | 56 | XpadSettings *xpad_settings_new (void); |
| 3225 | 56 | 57 | ||
| 3226 | 57 | void xpad_settings_set_width (XpadSettings *settings, guint width); | ||
| 3227 | 58 | guint xpad_settings_get_width (XpadSettings *settings); | ||
| 3228 | 59 | |||
| 3229 | 60 | void xpad_settings_set_height (XpadSettings *settings, guint height); | ||
| 3230 | 61 | guint xpad_settings_get_height (XpadSettings *settings); | ||
| 3231 | 62 | |||
| 3232 | 63 | void xpad_settings_set_has_decorations (XpadSettings *settings, gboolean decorations); | ||
| 3233 | 64 | gboolean xpad_settings_get_has_decorations (XpadSettings *settings); | ||
| 3234 | 65 | |||
| 3235 | 66 | void xpad_settings_set_confirm_destroy (XpadSettings *settings, gboolean confirm); | ||
| 3236 | 67 | gboolean xpad_settings_get_confirm_destroy (XpadSettings *settings); | ||
| 3237 | 68 | |||
| 3238 | 69 | void xpad_settings_set_edit_lock (XpadSettings *settings, gboolean lock); | ||
| 3239 | 70 | gboolean xpad_settings_get_edit_lock (XpadSettings *settings); | ||
| 3240 | 71 | |||
| 3241 | 72 | void xpad_settings_set_has_toolbar (XpadSettings *settings, gboolean toolbar); | ||
| 3242 | 73 | gboolean xpad_settings_get_has_toolbar (XpadSettings *settings); | ||
| 3243 | 74 | |||
| 3244 | 75 | void xpad_settings_set_autohide_toolbar (XpadSettings *settings, gboolean hide); | ||
| 3245 | 76 | gboolean xpad_settings_get_autohide_toolbar (XpadSettings *settings); | ||
| 3246 | 77 | |||
| 3247 | 78 | void xpad_settings_set_has_scrollbar (XpadSettings *settings, gboolean scrollbar); | ||
| 3248 | 79 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings); | ||
| 3249 | 80 | |||
| 3250 | 81 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); | 58 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); |
| 3251 | 82 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); | 59 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); |
| 3252 | 83 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); | 60 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); |
| 3253 | 84 | const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); | 61 | const GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); |
| 3254 | 85 | 62 | ||
| 3255 | 86 | void xpad_settings_set_back_color (XpadSettings *settings, const GdkRGBA *back); | ||
| 3256 | 87 | const GdkRGBA *xpad_settings_get_back_color (XpadSettings *settings); | ||
| 3257 | 88 | |||
| 3258 | 89 | void xpad_settings_set_text_color (XpadSettings *settings, const GdkRGBA *text); | ||
| 3259 | 90 | const GdkRGBA *xpad_settings_get_text_color (XpadSettings *settings); | ||
| 3260 | 91 | |||
| 3261 | 92 | void xpad_settings_set_fontname (XpadSettings *settings, const gchar *fontname); | ||
| 3262 | 93 | const gchar *xpad_settings_get_fontname (XpadSettings *settings); | ||
| 3263 | 94 | |||
| 3264 | 95 | void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf); | ||
| 3265 | 96 | guint xpad_settings_get_tray_click_handler (XpadSettings *settings); | ||
| 3266 | 97 | |||
| 3267 | 98 | void xpad_settings_set_autostart_xpad (XpadSettings *settings, gboolean conf); | ||
| 3268 | 99 | gboolean xpad_settings_get_autostart_xpad (XpadSettings *settings); | ||
| 3269 | 100 | |||
| 3270 | 101 | void xpad_settings_set_autostart_wait_systray (XpadSettings *settings, gboolean conf); | ||
| 3271 | 102 | gboolean xpad_settings_get_autostart_wait_systray (XpadSettings *settings); | ||
| 3272 | 103 | |||
| 3273 | 104 | void xpad_settings_set_autostart_delay (XpadSettings *settings, guint conf); | ||
| 3274 | 105 | guint xpad_settings_get_autostart_delay (XpadSettings *settings); | ||
| 3275 | 106 | |||
| 3276 | 107 | void xpad_settings_set_autostart_new_pad (XpadSettings *settings, gboolean conf); | ||
| 3277 | 108 | gboolean xpad_settings_get_autostart_new_pad (XpadSettings *settings); | ||
| 3278 | 109 | |||
| 3279 | 110 | void xpad_settings_set_autostart_sticky (XpadSettings *settings, gboolean conf); | ||
| 3280 | 111 | gboolean xpad_settings_get_autostart_sticky (XpadSettings *settings); | ||
| 3281 | 112 | |||
| 3282 | 113 | void xpad_settings_set_autostart_display_pads (XpadSettings *settings, guint conf); | ||
| 3283 | 114 | guint xpad_settings_get_autostart_display_pads (XpadSettings *settings); | ||
| 3284 | 115 | |||
| 3285 | 116 | G_END_DECLS | 63 | G_END_DECLS |
| 3286 | 117 | 64 | ||
| 3287 | 118 | #endif /* __XPAD_SETTINGS_H__ */ | 65 | #endif /* __XPAD_SETTINGS_H__ */ |
| 3288 | 119 | 66 | ||
| 3289 | === modified file 'src/xpad-text-buffer.c' | |||
| 3290 | --- src/xpad-text-buffer.c 2013-11-01 20:16:37 +0000 | |||
| 3291 | +++ src/xpad-text-buffer.c 2014-06-13 15:52:27 +0000 | |||
| 3292 | @@ -1,26 +1,27 @@ | |||
| 3314 | 1 | /** | 1 | /* |
| 3315 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 3316 | 3 | * Copyright (c) 2011 Sergei Riaguzov | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3317 | 4 | * | 4 | Copyright (c) 2011 Sergei Riaguzov |
| 3318 | 5 | * This program is free software; you can redistribute it and/or modify | 5 | Copyright (c) 2013-2014 Arthur Borsboom |
| 3319 | 6 | * it under the terms of the GNU General Public License as published by | 6 | |
| 3320 | 7 | * the Free Software Foundation; either version 3 of the License, or | 7 | This program is free software; you can redistribute it and/or modify |
| 3321 | 8 | * (at your option) any later version. | 8 | it under the terms of the GNU General Public License as published by |
| 3322 | 9 | * | 9 | the Free Software Foundation; either version 3 of the License, or |
| 3323 | 10 | * This program is distributed in the hope that it will be useful, | 10 | (at your option) any later version. |
| 3324 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | |
| 3325 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | This program is distributed in the hope that it will be useful, |
| 3326 | 13 | * GNU General Public License for more details. | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3327 | 14 | * | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 3328 | 15 | * You should have received a copy of the GNU General Public License | 15 | GNU General Public License for more details. |
| 3329 | 16 | * along with this program; if not, write to the Free Software | 16 | |
| 3330 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | You should have received a copy of the GNU General Public License |
| 3331 | 18 | */ | 18 | along with this program; if not, write to the Free Software |
| 3332 | 19 | 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 3333 | 20 | #include "../config.h" | 20 | |
| 3334 | 21 | #include "xpad-text-buffer.h" | 21 | */ |
| 3335 | 22 | |||
| 3336 | 23 | #include "xpad-pad.h" | ||
| 3337 | 22 | #include "xpad-undo.h" | 24 | #include "xpad-undo.h" |
| 3338 | 23 | #include "xpad-pad.h" | ||
| 3339 | 24 | 25 | ||
| 3340 | 25 | struct XpadTextBufferPrivate | 26 | struct XpadTextBufferPrivate |
| 3341 | 26 | { | 27 | { |
| 3342 | 27 | 28 | ||
| 3343 | === modified file 'src/xpad-text-buffer.h' | |||
| 3344 | --- src/xpad-text-buffer.h 2013-10-18 18:31:20 +0000 | |||
| 3345 | +++ src/xpad-text-buffer.h 2014-06-13 15:52:27 +0000 | |||
| 3346 | @@ -1,26 +1,28 @@ | |||
| 3365 | 1 | /** | 1 | /* |
| 3366 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 3367 | 3 | * Copyright (c) 2011 Sergei Riaguzov | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3368 | 4 | * | 4 | Copyright (c) 2011 Sergei Riaguzov |
| 3369 | 5 | * This program is free software; you can redistribute it and/or modify | 5 | Copyright (c) 2013-2014 Arthur Borsboom |
| 3370 | 6 | * it under the terms of the GNU General Public License as published by | 6 | |
| 3371 | 7 | * the Free Software Foundation; either version 3 of the License, or | 7 | This program is free software; you can redistribute it and/or modify |
| 3372 | 8 | * (at your option) any later version. | 8 | it under the terms of the GNU General Public License as published by |
| 3373 | 9 | * | 9 | the Free Software Foundation; either version 3 of the License, or |
| 3374 | 10 | * This program is distributed in the hope that it will be useful, | 10 | (at your option) any later version. |
| 3375 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | |
| 3376 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | This program is distributed in the hope that it will be useful, |
| 3377 | 13 | * GNU General Public License for more details. | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3378 | 14 | * | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 3379 | 15 | * You should have received a copy of the GNU General Public License | 15 | GNU General Public License for more details. |
| 3380 | 16 | * along with this program; if not, write to the Free Software | 16 | |
| 3381 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | You should have received a copy of the GNU General Public License |
| 3382 | 18 | */ | 18 | along with this program; if not, write to the Free Software |
| 3383 | 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 3384 | 20 | |||
| 3385 | 21 | */ | ||
| 3386 | 19 | 22 | ||
| 3387 | 20 | #ifndef __XPAD_TEXT_BUFFER_H__ | 23 | #ifndef __XPAD_TEXT_BUFFER_H__ |
| 3388 | 21 | #define __XPAD_TEXT_BUFFER_H__ | 24 | #define __XPAD_TEXT_BUFFER_H__ |
| 3389 | 22 | 25 | ||
| 3390 | 23 | #include <gtk/gtk.h> | ||
| 3391 | 24 | #include "xpad-pad.h" | 26 | #include "xpad-pad.h" |
| 3392 | 25 | 27 | ||
| 3393 | 26 | G_BEGIN_DECLS | 28 | G_BEGIN_DECLS |
| 3394 | @@ -39,8 +41,6 @@ | |||
| 3395 | 39 | struct XpadTextBuffer | 41 | struct XpadTextBuffer |
| 3396 | 40 | { | 42 | { |
| 3397 | 41 | GtkTextBuffer parent; | 43 | GtkTextBuffer parent; |
| 3398 | 42 | |||
| 3399 | 43 | /* private */ | ||
| 3400 | 44 | XpadTextBufferPrivate *priv; | 44 | XpadTextBufferPrivate *priv; |
| 3401 | 45 | }; | 45 | }; |
| 3402 | 46 | 46 | ||
| 3403 | 47 | 47 | ||
| 3404 | === modified file 'src/xpad-text-view.c' | |||
| 3405 | --- src/xpad-text-view.c 2014-06-04 15:59:25 +0000 | |||
| 3406 | +++ src/xpad-text-view.c 2014-06-13 15:52:27 +0000 | |||
| 3407 | @@ -1,25 +1,27 @@ | |||
| 3427 | 1 | /** | 1 | /* |
| 3428 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 3429 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3430 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 3431 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 3432 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 3433 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 3434 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 3435 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 3436 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 3437 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 3438 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3439 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 3440 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 3441 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 3442 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 3443 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 3444 | 18 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 3445 | 19 | #include "../config.h" | 19 | |
| 3446 | 20 | */ | ||
| 3447 | 21 | |||
| 3448 | 22 | #include <gtk/gtk.h> | ||
| 3449 | 20 | #include "xpad-text-view.h" | 23 | #include "xpad-text-view.h" |
| 3450 | 21 | #include "xpad-text-buffer.h" | 24 | #include "xpad-text-buffer.h" |
| 3451 | 22 | #include "xpad-settings.h" | ||
| 3452 | 23 | #include "xpad-app.h" | 25 | #include "xpad-app.h" |
| 3453 | 24 | 26 | ||
| 3454 | 25 | struct XpadTextViewPrivate | 27 | struct XpadTextViewPrivate |
| 3455 | @@ -117,7 +119,6 @@ | |||
| 3456 | 117 | view->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (xpad_text_view_notify_fontname), view); | 119 | view->priv->notify_font_handler = g_signal_connect_swapped (xpad_global_settings, "notify::fontname", G_CALLBACK (xpad_text_view_notify_fontname), view); |
| 3457 | 118 | view->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (xpad_text_view_notify_colors), view); | 120 | view->priv->notify_text_handler = g_signal_connect_swapped (xpad_global_settings, "notify::text-color", G_CALLBACK (xpad_text_view_notify_colors), view); |
| 3458 | 119 | view->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (xpad_text_view_notify_colors), view); | 121 | view->priv->notify_back_handler = g_signal_connect_swapped (xpad_global_settings, "notify::back-color", G_CALLBACK (xpad_text_view_notify_colors), view); |
| 3459 | 120 | |||
| 3460 | 121 | xpad_text_view_notify_colors (view); | 122 | xpad_text_view_notify_colors (view); |
| 3461 | 122 | xpad_text_view_notify_fontname (view); | 123 | xpad_text_view_notify_fontname (view); |
| 3462 | 123 | } | 124 | } |
| 3463 | @@ -147,7 +148,9 @@ | |||
| 3464 | 147 | static void | 148 | static void |
| 3465 | 148 | xpad_text_view_realize (XpadTextView *view) | 149 | xpad_text_view_realize (XpadTextView *view) |
| 3466 | 149 | { | 150 | { |
| 3468 | 150 | gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !xpad_settings_get_edit_lock (xpad_global_settings)); | 151 | gboolean edit_lock; |
| 3469 | 152 | g_object_get (xpad_global_settings, "edit-lock", &edit_lock, NULL); | ||
| 3470 | 153 | gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !edit_lock); | ||
| 3471 | 151 | } | 154 | } |
| 3472 | 152 | 155 | ||
| 3473 | 153 | static gboolean | 156 | static gboolean |
| 3474 | @@ -156,7 +159,10 @@ | |||
| 3475 | 156 | /* A dirty way to silence the compiler for these unused variables. */ | 159 | /* A dirty way to silence the compiler for these unused variables. */ |
| 3476 | 157 | (void) event; | 160 | (void) event; |
| 3477 | 158 | 161 | ||
| 3479 | 159 | if (xpad_settings_get_edit_lock (xpad_global_settings)) | 162 | gboolean edit_lock; |
| 3480 | 163 | g_object_get (xpad_global_settings, "edit-lock", &edit_lock, NULL); | ||
| 3481 | 164 | |||
| 3482 | 165 | if (edit_lock) | ||
| 3483 | 160 | { | 166 | { |
| 3484 | 161 | gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), FALSE); | 167 | gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), FALSE); |
| 3485 | 162 | return TRUE; | 168 | return TRUE; |
| 3486 | @@ -168,8 +174,11 @@ | |||
| 3487 | 168 | static gboolean | 174 | static gboolean |
| 3488 | 169 | xpad_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event) | 175 | xpad_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event) |
| 3489 | 170 | { | 176 | { |
| 3490 | 177 | gboolean edit_lock; | ||
| 3491 | 178 | g_object_get (xpad_global_settings, "edit-lock", &edit_lock, NULL); | ||
| 3492 | 179 | |||
| 3493 | 171 | if (event->button == 1 && | 180 | if (event->button == 1 && |
| 3495 | 172 | xpad_settings_get_edit_lock (xpad_global_settings) && | 181 | edit_lock && |
| 3496 | 173 | !gtk_text_view_get_editable (GTK_TEXT_VIEW (widget))) | 182 | !gtk_text_view_get_editable (GTK_TEXT_VIEW (widget))) |
| 3497 | 174 | { | 183 | { |
| 3498 | 175 | if (event->type == GDK_2BUTTON_PRESS) | 184 | if (event->type == GDK_2BUTTON_PRESS) |
| 3499 | @@ -191,7 +200,9 @@ | |||
| 3500 | 191 | xpad_text_view_notify_edit_lock (XpadTextView *view) | 200 | xpad_text_view_notify_edit_lock (XpadTextView *view) |
| 3501 | 192 | { | 201 | { |
| 3502 | 193 | /* chances are good that they don't have the text view focused while it changed, so make non-editable if edit lock turned on */ | 202 | /* chances are good that they don't have the text view focused while it changed, so make non-editable if edit lock turned on */ |
| 3504 | 194 | gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !xpad_settings_get_edit_lock (xpad_global_settings)); | 203 | gboolean edit_lock; |
| 3505 | 204 | g_object_get (xpad_global_settings, "edit-lock", &edit_lock, NULL); | ||
| 3506 | 205 | gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !edit_lock); | ||
| 3507 | 195 | } | 206 | } |
| 3508 | 196 | 207 | ||
| 3509 | 197 | static void | 208 | static void |
| 3510 | @@ -218,7 +229,8 @@ | |||
| 3511 | 218 | static void | 229 | static void |
| 3512 | 219 | xpad_text_view_notify_fontname (XpadTextView *view) | 230 | xpad_text_view_notify_fontname (XpadTextView *view) |
| 3513 | 220 | { | 231 | { |
| 3515 | 221 | const gchar *font = xpad_settings_get_fontname (xpad_global_settings); | 232 | const gchar *font; |
| 3516 | 233 | g_object_get (xpad_global_settings, "fontname", &font, NULL); | ||
| 3517 | 222 | PangoFontDescription *fontdesc; | 234 | PangoFontDescription *fontdesc; |
| 3518 | 223 | 235 | ||
| 3519 | 224 | fontdesc = font ? pango_font_description_from_string (font) : NULL; | 236 | fontdesc = font ? pango_font_description_from_string (font) : NULL; |
| 3520 | @@ -232,8 +244,8 @@ | |||
| 3521 | 232 | xpad_text_view_notify_colors (XpadTextView *view) | 244 | xpad_text_view_notify_colors (XpadTextView *view) |
| 3522 | 233 | { | 245 | { |
| 3523 | 234 | /* Set the colors of this individual pad to the global setting preference. */ | 246 | /* Set the colors of this individual pad to the global setting preference. */ |
| 3526 | 235 | const GdkRGBA *text_color = xpad_settings_get_text_color (xpad_global_settings); | 247 | const GdkRGBA *text_color, *back_color; |
| 3527 | 236 | const GdkRGBA *back_color = xpad_settings_get_back_color (xpad_global_settings); | 248 | g_object_get (xpad_global_settings, "text-color", &text_color, "back-color", &back_color, NULL); |
| 3528 | 237 | 249 | ||
| 3529 | 238 | gtk_widget_override_cursor (GTK_WIDGET (view), text_color, text_color); | 250 | gtk_widget_override_cursor (GTK_WIDGET (view), text_color, text_color); |
| 3530 | 239 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color); | 251 | gtk_widget_override_color (GTK_WIDGET (view), GTK_STATE_FLAG_NORMAL, text_color); |
| 3531 | 240 | 252 | ||
| 3532 | === modified file 'src/xpad-text-view.h' | |||
| 3533 | --- src/xpad-text-view.h 2011-11-16 18:10:04 +0000 | |||
| 3534 | +++ src/xpad-text-view.h 2014-06-13 15:52:27 +0000 | |||
| 3535 | @@ -1,25 +1,27 @@ | |||
| 3553 | 1 | /** | 1 | /* |
| 3554 | 2 | * Copyright (c) 2004-2007 Michael Terry | 2 | |
| 3555 | 3 | * | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3556 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | Copyright (c) 2013-2014 Arthur Borsboom |
| 3557 | 5 | * it under the terms of the GNU General Public License as published by | 5 | |
| 3558 | 6 | * the Free Software Foundation; either version 3 of the License, or | 6 | This program is free software; you can redistribute it and/or modify |
| 3559 | 7 | * (at your option) any later version. | 7 | it under the terms of the GNU General Public License as published by |
| 3560 | 8 | * | 8 | the Free Software Foundation; either version 3 of the License, or |
| 3561 | 9 | * This program is distributed in the hope that it will be useful, | 9 | (at your option) any later version. |
| 3562 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | |
| 3563 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | This program is distributed in the hope that it will be useful, |
| 3564 | 12 | * GNU General Public License for more details. | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3565 | 13 | * | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 3566 | 14 | * You should have received a copy of the GNU General Public License | 14 | GNU General Public License for more details. |
| 3567 | 15 | * along with this program; if not, write to the Free Software | 15 | |
| 3568 | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | You should have received a copy of the GNU General Public License |
| 3569 | 17 | */ | 17 | along with this program; if not, write to the Free Software |
| 3570 | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 3571 | 19 | |||
| 3572 | 20 | */ | ||
| 3573 | 18 | 21 | ||
| 3574 | 19 | #ifndef __XPAD_TEXT_VIEW_H__ | 22 | #ifndef __XPAD_TEXT_VIEW_H__ |
| 3575 | 20 | #define __XPAD_TEXT_VIEW_H__ | 23 | #define __XPAD_TEXT_VIEW_H__ |
| 3576 | 21 | 24 | ||
| 3577 | 22 | #include <gtk/gtk.h> | ||
| 3578 | 23 | #include "xpad-pad.h" | 25 | #include "xpad-pad.h" |
| 3579 | 24 | 26 | ||
| 3580 | 25 | G_BEGIN_DECLS | 27 | G_BEGIN_DECLS |
| 3581 | @@ -38,8 +40,6 @@ | |||
| 3582 | 38 | struct XpadTextView | 40 | struct XpadTextView |
| 3583 | 39 | { | 41 | { |
| 3584 | 40 | GtkTextView parent; | 42 | GtkTextView parent; |
| 3585 | 41 | |||
| 3586 | 42 | /* private */ | ||
| 3587 | 43 | XpadTextViewPrivate *priv; | 43 | XpadTextViewPrivate *priv; |
| 3588 | 44 | }; | 44 | }; |
| 3589 | 45 | 45 | ||
| 3590 | 46 | 46 | ||
| 3591 | === modified file 'src/xpad-toolbar.c' | |||
| 3592 | --- src/xpad-toolbar.c 2014-06-04 12:36:36 +0000 | |||
| 3593 | +++ src/xpad-toolbar.c 2014-06-13 15:52:27 +0000 | |||
| 3594 | @@ -1,6 +1,7 @@ | |||
| 3595 | 1 | /* | 1 | /* |
| 3596 | 2 | 2 | ||
| 3597 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3598 | 4 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 3599 | 4 | 5 | ||
| 3600 | 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 3601 | 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 3602 | @@ -18,14 +19,10 @@ | |||
| 3603 | 18 | 19 | ||
| 3604 | 19 | */ | 20 | */ |
| 3605 | 20 | 21 | ||
| 3606 | 21 | #include "../config.h" | ||
| 3607 | 22 | #include <string.h> | ||
| 3608 | 23 | #include <gdk/gdkkeysyms.h> | ||
| 3609 | 24 | #include <glib/gi18n.h> | 22 | #include <glib/gi18n.h> |
| 3610 | 23 | #include "xpad-app.h" | ||
| 3611 | 24 | #include "xpad-grip-tool-item.h" | ||
| 3612 | 25 | #include "xpad-toolbar.h" | 25 | #include "xpad-toolbar.h" |
| 3613 | 26 | #include "xpad-settings.h" | ||
| 3614 | 27 | #include "xpad-grip-tool-item.h" | ||
| 3615 | 28 | #include "xpad-app.h" | ||
| 3616 | 29 | 26 | ||
| 3617 | 30 | struct XpadToolbarPrivate | 27 | struct XpadToolbarPrivate |
| 3618 | 31 | { | 28 | { |
| 3619 | 32 | 29 | ||
| 3620 | === modified file 'src/xpad-toolbar.h' | |||
| 3621 | --- src/xpad-toolbar.h 2011-11-16 18:10:04 +0000 | |||
| 3622 | +++ src/xpad-toolbar.h 2014-06-13 15:52:27 +0000 | |||
| 3623 | @@ -21,7 +21,6 @@ | |||
| 3624 | 21 | #ifndef __XPAD_TOOLBAR_H__ | 21 | #ifndef __XPAD_TOOLBAR_H__ |
| 3625 | 22 | #define __XPAD_TOOLBAR_H__ | 22 | #define __XPAD_TOOLBAR_H__ |
| 3626 | 23 | 23 | ||
| 3627 | 24 | #include <gtk/gtk.h> | ||
| 3628 | 25 | #include "xpad-pad.h" | 24 | #include "xpad-pad.h" |
| 3629 | 26 | 25 | ||
| 3630 | 27 | G_BEGIN_DECLS | 26 | G_BEGIN_DECLS |
| 3631 | @@ -40,8 +39,6 @@ | |||
| 3632 | 40 | struct XpadToolbar | 39 | struct XpadToolbar |
| 3633 | 41 | { | 40 | { |
| 3634 | 42 | GtkToolbar parent; | 41 | GtkToolbar parent; |
| 3635 | 43 | |||
| 3636 | 44 | /* private */ | ||
| 3637 | 45 | XpadToolbarPrivate *priv; | 42 | XpadToolbarPrivate *priv; |
| 3638 | 46 | }; | 43 | }; |
| 3639 | 47 | 44 | ||
| 3640 | 48 | 45 | ||
| 3641 | === modified file 'src/xpad-tray.c' | |||
| 3642 | --- src/xpad-tray.c 2014-06-04 12:36:36 +0000 | |||
| 3643 | +++ src/xpad-tray.c 2014-06-13 15:52:27 +0000 | |||
| 3644 | @@ -2,7 +2,7 @@ | |||
| 3645 | 2 | 2 | ||
| 3646 | 3 | Copyright (c) 2002 Jamis Buck | 3 | Copyright (c) 2002 Jamis Buck |
| 3647 | 4 | Copyright (c) 2003-2007 Michael Terry | 4 | Copyright (c) 2003-2007 Michael Terry |
| 3649 | 5 | Copyright (c) 2013 Arthur Borsboom | 5 | Copyright (c) 2013-2014 Arthur Borsboom |
| 3650 | 6 | 6 | ||
| 3651 | 7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 3652 | 8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| 3653 | @@ -21,12 +21,11 @@ | |||
| 3654 | 21 | */ | 21 | */ |
| 3655 | 22 | 22 | ||
| 3656 | 23 | #include "../config.h" | 23 | #include "../config.h" |
| 3657 | 24 | #include <gtk/gtk.h> | ||
| 3658 | 24 | #include <glib/gi18n.h> | 25 | #include <glib/gi18n.h> |
| 3659 | 25 | #include <gtk/gtk.h> | ||
| 3660 | 26 | #include "fio.h" | 26 | #include "fio.h" |
| 3661 | 27 | #include "xpad-app.h" | 27 | #include "xpad-app.h" |
| 3662 | 28 | #include "xpad-pad.h" | 28 | #include "xpad-pad.h" |
| 3663 | 29 | #include "xpad-pad-group.h" | ||
| 3664 | 30 | #include "xpad-preferences.h" | 29 | #include "xpad-preferences.h" |
| 3665 | 31 | #include "xpad-settings.h" | 30 | #include "xpad-settings.h" |
| 3666 | 32 | #include "xpad-tray.h" | 31 | #include "xpad-tray.h" |
| 3667 | @@ -38,12 +37,17 @@ | |||
| 3668 | 38 | LIST_OF_PADS, | 37 | LIST_OF_PADS, |
| 3669 | 39 | NEW_PAD | 38 | NEW_PAD |
| 3670 | 40 | }; | 39 | }; |
| 3671 | 40 | |||
| 3672 | 41 | static void xpad_tray_open (XpadSettings *settings); | ||
| 3673 | 42 | static void xpad_tray_close (); | ||
| 3674 | 43 | /* Enable/disable the tray icon */ | ||
| 3675 | 44 | static void xpad_tray_toggle (XpadSettings *settings); | ||
| 3676 | 41 | /* tray icon left click handler */ | 45 | /* tray icon left click handler */ |
| 3678 | 42 | static void xpad_tray_activate_cb (GtkStatusIcon *icon); | 46 | static void xpad_tray_activate_cb (GtkStatusIcon *icon, XpadSettings *settings); |
| 3679 | 43 | /* tray icon right click handler */ | 47 | /* tray icon right click handler */ |
| 3680 | 44 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); | 48 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); |
| 3681 | 45 | /* "toggle show all" menu item handler */ | 49 | /* "toggle show all" menu item handler */ |
| 3683 | 46 | static void xpad_tray_show_hide_all (void); | 50 | static void xpad_tray_show_hide_all (); |
| 3684 | 47 | /* "show pads" menu item handler */ | 51 | /* "show pads" menu item handler */ |
| 3685 | 48 | static void xpad_tray_show_windows_list (GtkStatusIcon *icon); | 52 | static void xpad_tray_show_windows_list (GtkStatusIcon *icon); |
| 3686 | 49 | /* helper function to append pad window title as item to menu */ | 53 | /* helper function to append pad window title as item to menu */ |
| 3687 | @@ -52,35 +56,42 @@ | |||
| 3688 | 52 | static GtkStatusIcon *docklet = NULL; | 56 | static GtkStatusIcon *docklet = NULL; |
| 3689 | 53 | static GtkWidget *menu = NULL; | 57 | static GtkWidget *menu = NULL; |
| 3690 | 54 | 58 | ||
| 3693 | 55 | void | 59 | void xpad_tray_init (XpadSettings *settings) { |
| 3694 | 56 | xpad_tray_open () | 60 | xpad_tray_toggle (settings); |
| 3695 | 61 | g_signal_connect (settings, "notify::tray-enabled", G_CALLBACK (xpad_tray_toggle), NULL); | ||
| 3696 | 62 | } | ||
| 3697 | 63 | |||
| 3698 | 64 | static void xpad_tray_toggle (XpadSettings *settings) { | ||
| 3699 | 65 | gboolean tray_enabled; | ||
| 3700 | 66 | g_object_get (settings, "tray-enabled", &tray_enabled, NULL); | ||
| 3701 | 67 | |||
| 3702 | 68 | if (tray_enabled) { | ||
| 3703 | 69 | if (!docklet) | ||
| 3704 | 70 | xpad_tray_open (settings); | ||
| 3705 | 71 | } | ||
| 3706 | 72 | else | ||
| 3707 | 73 | xpad_tray_close (); | ||
| 3708 | 74 | } | ||
| 3709 | 75 | |||
| 3710 | 76 | static void xpad_tray_open (XpadSettings *settings) | ||
| 3711 | 57 | { | 77 | { |
| 3717 | 58 | GtkIconTheme *theme; | 78 | GtkIconTheme *theme = gtk_icon_theme_get_default (); |
| 3718 | 59 | 79 | ||
| 3719 | 60 | theme = gtk_icon_theme_get_default (); | 80 | if (!gtk_icon_theme_has_icon (theme, PACKAGE)) |
| 3715 | 61 | |||
| 3716 | 62 | if (!gtk_icon_theme_has_icon (theme, PACKAGE)) { | ||
| 3720 | 63 | return; | 81 | return; |
| 3721 | 64 | } | ||
| 3722 | 65 | 82 | ||
| 3723 | 66 | if (gtk_icon_theme_has_icon (theme, "xpad-panel")) | 83 | if (gtk_icon_theme_has_icon (theme, "xpad-panel")) |
| 3724 | 67 | { | ||
| 3725 | 68 | docklet = gtk_status_icon_new_from_icon_name ("xpad-panel"); | 84 | docklet = gtk_status_icon_new_from_icon_name ("xpad-panel"); |
| 3726 | 69 | } | ||
| 3727 | 70 | else | 85 | else |
| 3728 | 71 | { | ||
| 3729 | 72 | docklet = gtk_status_icon_new_from_icon_name (PACKAGE); | 86 | docklet = gtk_status_icon_new_from_icon_name (PACKAGE); |
| 3730 | 73 | } | ||
| 3731 | 74 | 87 | ||
| 3734 | 75 | if (docklet) | 88 | if (docklet) { |
| 3733 | 76 | { | ||
| 3735 | 77 | g_signal_connect (docklet, "activate", G_CALLBACK (xpad_tray_activate_cb), NULL); | 89 | g_signal_connect (docklet, "activate", G_CALLBACK (xpad_tray_activate_cb), NULL); |
| 3736 | 78 | g_signal_connect (docklet, "popup-menu", G_CALLBACK (xpad_tray_popup_menu_cb), NULL); | 90 | g_signal_connect (docklet, "popup-menu", G_CALLBACK (xpad_tray_popup_menu_cb), NULL); |
| 3737 | 79 | } | 91 | } |
| 3738 | 80 | } | 92 | } |
| 3739 | 81 | 93 | ||
| 3742 | 82 | void | 94 | static void xpad_tray_close (XpadSettings *settings) |
| 3741 | 83 | xpad_tray_close (void) | ||
| 3743 | 84 | { | 95 | { |
| 3744 | 85 | if (docklet) { | 96 | if (docklet) { |
| 3745 | 86 | g_object_unref (docklet); | 97 | g_object_unref (docklet); |
| 3746 | @@ -91,8 +102,13 @@ | |||
| 3747 | 91 | gtk_widget_destroy(menu); | 102 | gtk_widget_destroy(menu); |
| 3748 | 92 | } | 103 | } |
| 3749 | 93 | 104 | ||
| 3750 | 105 | void xpad_tray_dispose (XpadSettings *settings) { | ||
| 3751 | 106 | g_signal_handlers_disconnect_by_func(settings, xpad_tray_toggle, NULL); | ||
| 3752 | 107 | xpad_tray_close (settings); | ||
| 3753 | 108 | } | ||
| 3754 | 109 | |||
| 3755 | 94 | gboolean | 110 | gboolean |
| 3757 | 95 | xpad_tray_is_open (void) | 111 | xpad_tray_is_open () |
| 3758 | 96 | { | 112 | { |
| 3759 | 97 | if (docklet) | 113 | if (docklet) |
| 3760 | 98 | return gtk_status_icon_is_embedded (docklet); | 114 | return gtk_status_icon_is_embedded (docklet); |
| 3761 | @@ -123,7 +139,7 @@ | |||
| 3762 | 123 | } | 139 | } |
| 3763 | 124 | 140 | ||
| 3764 | 125 | static void | 141 | static void |
| 3766 | 126 | xpad_tray_show_hide_all (void) | 142 | xpad_tray_show_hide_all () |
| 3767 | 127 | { | 143 | { |
| 3768 | 128 | GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | 144 | GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); |
| 3769 | 129 | /* find if any pad is visible */ | 145 | /* find if any pad is visible */ |
| 3770 | @@ -208,10 +224,10 @@ | |||
| 3771 | 208 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gtk_status_icon_position_menu, icon, button, time); | 224 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gtk_status_icon_position_menu, icon, button, time); |
| 3772 | 209 | } | 225 | } |
| 3773 | 210 | 226 | ||
| 3778 | 211 | static void | 227 | static void xpad_tray_activate_cb (GtkStatusIcon *icon, XpadSettings *settings) { |
| 3779 | 212 | xpad_tray_activate_cb (GtkStatusIcon *icon) | 228 | guint tray_click_configuration; |
| 3780 | 213 | { | 229 | g_object_get (settings, "tray-click-configuration", &tray_click_configuration, NULL); |
| 3781 | 214 | switch (xpad_settings_get_tray_click_handler(xpad_global_settings)) | 230 | switch (tray_click_configuration) |
| 3782 | 215 | { | 231 | { |
| 3783 | 216 | case TOGGLE_SHOW_ALL: | 232 | case TOGGLE_SHOW_ALL: |
| 3784 | 217 | xpad_tray_show_hide_all(); | 233 | xpad_tray_show_hide_all(); |
| 3785 | 218 | 234 | ||
| 3786 | === modified file 'src/xpad-tray.h' | |||
| 3787 | --- src/xpad-tray.h 2008-09-21 00:03:40 +0000 | |||
| 3788 | +++ src/xpad-tray.h 2014-06-13 15:52:27 +0000 | |||
| 3789 | @@ -2,6 +2,7 @@ | |||
| 3790 | 2 | 2 | ||
| 3791 | 3 | Copyright (c) 2002 Jamis Buck | 3 | Copyright (c) 2002 Jamis Buck |
| 3792 | 4 | Copyright (c) 2003-2007 Michael Terry | 4 | Copyright (c) 2003-2007 Michael Terry |
| 3793 | 5 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 3794 | 5 | 6 | ||
| 3795 | 6 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 3796 | 7 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| 3797 | @@ -22,10 +23,8 @@ | |||
| 3798 | 22 | #ifndef __XPAD_TRAY_H__ | 23 | #ifndef __XPAD_TRAY_H__ |
| 3799 | 23 | #define __XPAD_TRAY_H__ | 24 | #define __XPAD_TRAY_H__ |
| 3800 | 24 | 25 | ||
| 3806 | 25 | #include <gtk/gtk.h> | 26 | void xpad_tray_init (XpadSettings *settings); |
| 3807 | 26 | 27 | void xpad_tray_dispose (XpadSettings *settings); | |
| 3808 | 27 | void xpad_tray_open (void); | 28 | gboolean xpad_tray_is_open (); |
| 3804 | 28 | void xpad_tray_close (void); | ||
| 3805 | 29 | gboolean xpad_tray_is_open (void); | ||
| 3809 | 30 | 29 | ||
| 3810 | 31 | #endif /* __TRAY_H__ */ | 30 | #endif /* __TRAY_H__ */ |
| 3811 | 32 | 31 | ||
| 3812 | === modified file 'src/xpad-undo.c' | |||
| 3813 | --- src/xpad-undo.c 2014-06-04 12:36:36 +0000 | |||
| 3814 | +++ src/xpad-undo.c 2014-06-13 15:52:27 +0000 | |||
| 3815 | @@ -2,6 +2,7 @@ | |||
| 3816 | 2 | 2 | ||
| 3817 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3818 | 4 | Copyright (c) 2010 Sergei Riaguzov | 4 | Copyright (c) 2010 Sergei Riaguzov |
| 3819 | 5 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 3820 | 5 | 6 | ||
| 3821 | 6 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 3822 | 7 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| 3823 | @@ -19,12 +20,10 @@ | |||
| 3824 | 19 | 20 | ||
| 3825 | 20 | */ | 21 | */ |
| 3826 | 21 | 22 | ||
| 3829 | 22 | 23 | #include <glib.h> | |
| 3828 | 23 | #include "../config.h" | ||
| 3830 | 24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| 3832 | 25 | #include <glib.h> | 25 | #include "xpad-text-buffer.h" |
| 3833 | 26 | #include "xpad-undo.h" | 26 | #include "xpad-undo.h" |
| 3834 | 27 | #include "xpad-text-buffer.h" | ||
| 3835 | 28 | 27 | ||
| 3836 | 29 | struct XpadUndoPrivate | 28 | struct XpadUndoPrivate |
| 3837 | 30 | { | 29 | { |
| 3838 | 31 | 30 | ||
| 3839 | === modified file 'src/xpad-undo.h' | |||
| 3840 | --- src/xpad-undo.h 2011-11-16 18:10:04 +0000 | |||
| 3841 | +++ src/xpad-undo.h 2014-06-13 15:52:27 +0000 | |||
| 3842 | @@ -2,6 +2,7 @@ | |||
| 3843 | 2 | 2 | ||
| 3844 | 3 | Copyright (c) 2001-2007 Michael Terry | 3 | Copyright (c) 2001-2007 Michael Terry |
| 3845 | 4 | Copyright (c) 2010 Sergei Riaguzov | 4 | Copyright (c) 2010 Sergei Riaguzov |
| 3846 | 5 | Copyright (c) 2013-2014 Arthur Borsboom | ||
| 3847 | 5 | 6 | ||
| 3848 | 6 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 3849 | 7 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| 3850 | @@ -22,9 +23,8 @@ | |||
| 3851 | 22 | #ifndef __XPAD_UNDO_H__ | 23 | #ifndef __XPAD_UNDO_H__ |
| 3852 | 23 | #define __XPAD_UNDO_H__ | 24 | #define __XPAD_UNDO_H__ |
| 3853 | 24 | 25 | ||
| 3855 | 25 | #include <gtk/gtk.h> | 26 | #include <glib.h> |
| 3856 | 26 | #include "xpad-text-buffer.h" | 27 | #include "xpad-text-buffer.h" |
| 3857 | 27 | #include "xpad-pad.h" | ||
| 3858 | 28 | 28 | ||
| 3859 | 29 | G_BEGIN_DECLS | 29 | G_BEGIN_DECLS |
| 3860 | 30 | 30 | ||
| 3861 | @@ -42,8 +42,6 @@ | |||
| 3862 | 42 | struct XpadUndo | 42 | struct XpadUndo |
| 3863 | 43 | { | 43 | { |
| 3864 | 44 | GObject parent; | 44 | GObject parent; |
| 3865 | 45 | |||
| 3866 | 46 | /* private */ | ||
| 3867 | 47 | XpadUndoPrivate *priv; | 45 | XpadUndoPrivate *priv; |
| 3868 | 48 | }; | 46 | }; |
| 3869 | 49 | 47 | ||
