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