Merge lp:~arthurborsboom/xpad/xpad-4.2 into lp:xpad
- xpad-4.2
- Merge into trunk
Proposed by
Arthur Borsboom
| Status: | Merged | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Merged at revision: | 657 | ||||||||||||||||||||
| Proposed branch: | lp:~arthurborsboom/xpad/xpad-4.2 | ||||||||||||||||||||
| Merge into: | lp:xpad | ||||||||||||||||||||
| Diff against target: |
3440 lines (+1176/-1007) 18 files modified
ChangeLog (+445/-13) NEWS (+0/-430) src/help.c (+2/-2) src/xpad-app.c (+33/-12) src/xpad-grip-tool-item.c (+23/-14) src/xpad-pad-group.c (+37/-27) src/xpad-pad-group.h (+1/-0) src/xpad-pad-properties.c (+26/-6) src/xpad-pad.c (+154/-77) src/xpad-preferences.c (+12/-9) src/xpad-settings.c (+46/-17) src/xpad-settings.h (+2/-2) src/xpad-text-buffer.c (+84/-77) src/xpad-text-buffer.h (+1/-1) src/xpad-text-view.c (+16/-15) src/xpad-toolbar.c (+268/-271) src/xpad-tray.c (+10/-6) src/xpad-undo.c (+16/-28) |
||||||||||||||||||||
| To merge this branch: | bzr merge lp:~arthurborsboom/xpad/xpad-4.2 | ||||||||||||||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Arthur Borsboom | Approve | ||
|
Review via email:
|
|||
Commit message
Description of the change
Fixed crash after deleting pad(s).
Fixed memory leaks
Updated help
Updated changelog
To post a comment you must log in.
Revision history for this message
| Arthur Borsboom (arthurborsboom) : | # |
review:
Approve
lp:~arthurborsboom/xpad/xpad-4.2
updated
- 657. By Arthur Borsboom
-
Fixed crash after deleting pad(s).\nFixed memory leaks.\nUpdated help.\nUpdated changelog.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'ChangeLog' | |||
| 2 | --- ChangeLog 2013-10-09 04:26:23 +0000 | |||
| 3 | +++ ChangeLog 2013-10-18 18:35:35 +0000 | |||
| 4 | @@ -1,16 +1,448 @@ | |||
| 18 | 1 | Changes in v4.2 - Arthur Borsboom <arthurborsboom@gmail.com> | 1 | Version 4.1 |
| 19 | 2 | 2 | * New: Undo functionality such as CTRL-Z (#1121740) | |
| 20 | 3 | - New: Undo functionality such as CTRL-Z (#1121740) | 3 | * New: Tray click behaviour can now be configured (#345278, #304331, #890335) |
| 21 | 4 | - New: Tray click behaviour can now be configured (#345278, #304331, #890335) | 4 | * New: Tray icon can be hidden (#890334) |
| 22 | 5 | - New: Tray icon can be hidden (#890334) | 5 | * New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705) |
| 23 | 6 | - New: Theme builders can now use seperate tray icon by adding xpad-panel.xvg (#907705) | 6 | * Fix: Theme color stays after application restart (#307669) |
| 24 | 7 | - Fix: Theme color stays after application restart (#307669) | 7 | * Fix: Translation - get many new translations in from translators (thanks guys!!) |
| 25 | 8 | - Fix: Translation - get many new translations in from translators (thanks guys!!) | 8 | * Fix: Translation - French typo (#1216388) |
| 26 | 9 | - Fix: Translation - French typo (#1216388) | 9 | * Fix: Translation - Russian typo which prevented the Help from working (#973825) |
| 27 | 10 | - Fix: Translation - Russian typo which prevented the Help from working (#973825) | 10 | * Fix: added missing configure script (#890492) |
| 28 | 11 | - Fix: added missing configure script (#890492) | 11 | * Fix: performance improvement by reducing the amount of harddisk writes (#1072698, #1207564, #782320) |
| 29 | 12 | - Fix: performance improvement by reducing the amount of harddisk writes (#1072698, #1207564, #782320) | 12 | * Fix: can now compile against glib-2.34.1 (#974011) |
| 30 | 13 | - Fix: can now compile against glib-2.34.1 (#974011) | 13 | * Fix: no errors or crashes after a delete of a pad (#1237211, #1237563) |
| 31 | 14 | * Fix: different memory leaks (#1237211, #1237563) | ||
| 32 | 15 | |||
| 33 | 16 | Version 4.1 | ||
| 34 | 17 | * Undo/Redo for xpad and bug-fixes. Feature by Sergei Riaguzov | ||
| 35 | 18 | * Bug #490445: crash when right-clicking on tray icon to display list of notes. Patch by David Hull | ||
| 36 | 19 | * Bug #360142: Add keyboard shortcuts for formatting. Patch by Dennis Hilmar | ||
| 37 | 20 | * Bug #591978: xpad critical start. Patch by OBATA Akio | ||
| 38 | 21 | |||
| 39 | 22 | |||
| 40 | 23 | Version 4.0 | ||
| 41 | 24 | * Added --toggle (between --hide and --show). Patch by Paul Ivanov. | ||
| 42 | 25 | * Updated French, Japanese, Russian, Spanish, and Swedish translations | ||
| 43 | 26 | * New Croatian, Estonian, German, Portuguese, Thai, and Turkish translations | ||
| 44 | 27 | |||
| 45 | 28 | |||
| 46 | 29 | Version 3.1 | ||
| 47 | 30 | * Updated Danish, French, Russian, Spanish, and Swedish translations | ||
| 48 | 31 | * New Czech, Japanese, and Latvian translations | ||
| 49 | 32 | |||
| 50 | 33 | |||
| 51 | 34 | Version 3.0 | ||
| 52 | 35 | * Don't wake up every 20 milliseconds to check session management messages. | ||
| 53 | 36 | Rather, wait for an event. | ||
| 54 | 37 | * Add --hide/--show, removed --hide-old. --hide and --show affect all pads | ||
| 55 | 38 | on startup or can be used on an already running xpad instance. Patch by | ||
| 56 | 39 | Jan Losinski. | ||
| 57 | 40 | * Update icon to be less aliased | ||
| 58 | 41 | * Relicense as GPL v3+ | ||
| 59 | 42 | |||
| 60 | 43 | |||
| 61 | 44 | Version 2.14 | ||
| 62 | 45 | * Fix 100% CPU bug | ||
| 63 | 46 | |||
| 64 | 47 | |||
| 65 | 48 | Version 2.13 | ||
| 66 | 49 | * Requires GTK+ 2.12 | ||
| 67 | 50 | * Fix pads possibly not remembering location after close | ||
| 68 | 51 | * Fix pad-closed state not being remembered | ||
| 69 | 52 | * Uses native status icon code in GTK+ | ||
| 70 | 53 | * Maybe, possibly fix some 'pad on all workspaces' problems | ||
| 71 | 54 | * New Chinese (simplified) translation (Meng Jie) | ||
| 72 | 55 | * New English (British) translation (David Lodge) | ||
| 73 | 56 | * New Finnish translation (Jorma Karvonen) | ||
| 74 | 57 | * New Korean translation (KwangSub Lee) | ||
| 75 | 58 | * Updated Dutch translation (Benno Schulenberg) | ||
| 76 | 59 | * Updated Slovak translation (Andrej Kacian) | ||
| 77 | 60 | * Fixed Danish, Swedish translations | ||
| 78 | 61 | |||
| 79 | 62 | |||
| 80 | 63 | Version 2.12 | ||
| 81 | 64 | * Fix a crash when loading pads with formatting | ||
| 82 | 65 | |||
| 83 | 66 | |||
| 84 | 67 | Version 2.11 | ||
| 85 | 68 | * If window decorations are turned on, pads will now show up in the taskbar | ||
| 86 | 69 | * Added -f option to open a file as a note | ||
| 87 | 70 | * New Chinese (simplified) translation (Meng Jie) | ||
| 88 | 71 | * New Danish translation (Morten Bo Johansen) | ||
| 89 | 72 | * New Swedish translation (Daniel Nylander) | ||
| 90 | 73 | * Updated Chinese (traditional) translation (Wei-Lun Chao) | ||
| 91 | 74 | |||
| 92 | 75 | |||
| 93 | 76 | Version 2.10 | ||
| 94 | 77 | * Fix a possible crash when deleting pads with autohide toolbar | ||
| 95 | 78 | * Make toolbar buttons smaller | ||
| 96 | 79 | * Make toolbar appear inside pad if there is enough unused space | ||
| 97 | 80 | * New Slovak translation (Andrej Kacian) | ||
| 98 | 81 | * New Slovenian translation (Matej Urbančič) | ||
| 99 | 82 | |||
| 100 | 83 | |||
| 101 | 84 | Version 2.9 | ||
| 102 | 85 | * Fix pads saving slightly off bad x,y values | ||
| 103 | 86 | * Fix pads saving bad heights when toolbar always on (Sham Chukoury) | ||
| 104 | 87 | * Fix possible crash from not allocating enough memory (Federico Schwindt) | ||
| 105 | 88 | * New Malay translation (Sharuzzaman Ahmat Raslan) | ||
| 106 | 89 | |||
| 107 | 90 | |||
| 108 | 91 | Version 2.8 | ||
| 109 | 92 | * Allow translations to be used (broken for a couple versions) | ||
| 110 | 93 | * New Chinese (traditional) translation (Wei-Lun Chao) | ||
| 111 | 94 | * Removed half-baked Esperanto translation | ||
| 112 | 95 | |||
| 113 | 96 | |||
| 114 | 97 | Version 2.7 | ||
| 115 | 98 | * Stop pads from popping toolbar while the pad is moving/resizing | ||
| 116 | 99 | * Make sure pads use correct sizes when autohide is off (Sham Chukoury) | ||
| 117 | 100 | * New Bulgarian translation (Yavor Doganov) | ||
| 118 | 101 | * New Kinyarwanda translation (Steve Murphy et al) | ||
| 119 | 102 | |||
| 120 | 103 | |||
| 121 | 104 | Version 2.6 | ||
| 122 | 105 | * Stop pad windows from 'jumping' when dragged via the toolbar | ||
| 123 | 106 | * Updated Hungarian translation (Németh Csaba) | ||
| 124 | 107 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 125 | 108 | * Updated Vietnamese translation (Clytie Siddall) | ||
| 126 | 109 | |||
| 127 | 110 | |||
| 128 | 111 | Version 2.5 | ||
| 129 | 112 | * Stop making all new pads start in top left | ||
| 130 | 113 | * Stop closing xpad if toggling window decorations with only one pad open | ||
| 131 | 114 | * Stop losing pad contents if upgrading from old versions of xpad | ||
| 132 | 115 | |||
| 133 | 116 | |||
| 134 | 117 | Version 2.4 | ||
| 135 | 118 | * Create the configuration directory if it doesn't exist | ||
| 136 | 119 | |||
| 137 | 120 | |||
| 138 | 121 | Version 2.3 | ||
| 139 | 122 | * Fixed a compile bug with binreloc and threading | ||
| 140 | 123 | |||
| 141 | 124 | |||
| 142 | 125 | Version 2.2 | ||
| 143 | 126 | * Bumped GTK+ dependency to 2.6 | ||
| 144 | 127 | * New About dialog (using GtkAboutDialog) | ||
| 145 | 128 | * New default location for configuration files: ~/.config/xpad | ||
| 146 | 129 | * Updated icon (now uses lighter colors) | ||
| 147 | 130 | * Use GOption for command-line parsing | ||
| 148 | 131 | * New command-line option --hide-old (or -H) to not show old pads | ||
| 149 | 132 | * Renamed command-line option --nonew to --no-new and added -N shortcut | ||
| 150 | 133 | * Allow running from console if we don't need to do anything graphical | ||
| 151 | 134 | * Readded keyboard shortcuts | ||
| 152 | 135 | * Updated antiquated man page | ||
| 153 | 136 | * New Hungarian translation (Németh Csaba) | ||
| 154 | 137 | * New Vietnamese translation (Clytie Siddall) | ||
| 155 | 138 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 156 | 139 | |||
| 157 | 140 | |||
| 158 | 141 | Version 2.1 | ||
| 159 | 142 | * Fix tray icon being the wrong size | ||
| 160 | 143 | * Fix xpad to close when no tray and no open pads | ||
| 161 | 144 | |||
| 162 | 145 | |||
| 163 | 146 | Version 2.0 | ||
| 164 | 147 | * Fix notes list to display correct number of pads | ||
| 165 | 148 | * Fix notification icon from not doing anything | ||
| 166 | 149 | * Fix compilation when BinReloc is disabled | ||
| 167 | 150 | * Fix compilation with gcc 3.4 | ||
| 168 | 151 | * Fix endianness issue with preference files | ||
| 169 | 152 | * Updated Dutch translation (Elros Cyriatan) | ||
| 170 | 153 | |||
| 171 | 154 | |||
| 172 | 155 | Version 2.0-b3 | ||
| 173 | 156 | * Use BinReloc to allow any-prefix installs of xpad to work | ||
| 174 | 157 | * Fixed a double-free bug that caused some problems with new pads | ||
| 175 | 158 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 176 | 159 | * Updated Spanish translation (Ramon Rey Vicente) | ||
| 177 | 160 | |||
| 178 | 161 | |||
| 179 | 162 | Version 2.0-b2 | ||
| 180 | 163 | * Redesigned preferences and pad properties dialogs | ||
| 181 | 164 | * If the tray disappears (e.g. killall gnome-panel), xpad's icon reappears | ||
| 182 | 165 | * More formally ask window manager to make us skip taskbar and pager | ||
| 183 | 166 | * New, lighter default color for pads | ||
| 184 | 167 | * Lots of internal code cleanup | ||
| 185 | 168 | * Fixed a crasher with not being able to find window icons | ||
| 186 | 169 | * Fixed some crashers with turning off toolbar | ||
| 187 | 170 | * Fixed bug with text cursor color being one color change behind | ||
| 188 | 171 | |||
| 189 | 172 | |||
| 190 | 173 | Version 2.0-b1 | ||
| 191 | 174 | * The text cursor is now always the same color as the text color | ||
| 192 | 175 | * Formatting can now be applied to selected text | ||
| 193 | 176 | * Pads remember their hidden state | ||
| 194 | 177 | * Rewritten toolbar, allowing easier adding/removing/moving buttons | ||
| 195 | 178 | * Simplified preferences dialog; many functions are now accessed from popup menu | ||
| 196 | 179 | * --new now also loads the old pads, instead of the previous broken behavior | ||
| 197 | 180 | * Fixed bug with pads over the 9th not having numbers in note lists | ||
| 198 | 181 | * Fixed bug with inter process communicating causing only first communication to work | ||
| 199 | 182 | * Fixed bug with pads becoming unstyled after closing and reopening | ||
| 200 | 183 | * New Afrikaans translation (Petri Jooste) | ||
| 201 | 184 | * New French translation (Michel Robitaille) | ||
| 202 | 185 | |||
| 203 | 186 | |||
| 204 | 187 | Version 1.13 | ||
| 205 | 188 | * Don't close xpad if no pads are open but the system tray is | ||
| 206 | 189 | * Made translations work again | ||
| 207 | 190 | * New Spanish translation (Ramon Rey Vicente) | ||
| 208 | 191 | * Updated Dutch translation (Elros Cyriatan) | ||
| 209 | 192 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 210 | 193 | |||
| 211 | 194 | |||
| 212 | 195 | Version 1.12 | ||
| 213 | 196 | * Fixed segfault when clicking on auto-hide toolbar preference | ||
| 214 | 197 | * Fixed segfault when changing the first toolbar button | ||
| 215 | 198 | * Added Irish translation (by Kevin Patrick Scannell) | ||
| 216 | 199 | |||
| 217 | 200 | |||
| 218 | 201 | Version 1.11 | ||
| 219 | 202 | * Added Dutch translation (by t.c.witte@phys.uu.nl) | ||
| 220 | 203 | * Added partial Esperanto translation (by mterry@fastmail.fm) | ||
| 221 | 204 | * Added Romanian translation (by eugenh@urban-grafx.ro) | ||
| 222 | 205 | * Added Russian translation (by avl@cad.ru) | ||
| 223 | 206 | * Added missing "include <sys/time.h>" (by netgeek@speakeasy.net) | ||
| 224 | 207 | * Added missing #defines for solaris (by alan@cesma.usb.ve) | ||
| 225 | 208 | * Added new icon and install icon family into new location per icon theme spec | ||
| 226 | 209 | * Fixed disk-full-causes-xpad-contents-to-disappear bug | ||
| 227 | 210 | * Made pads not show up in taskbar | ||
| 228 | 211 | * Added 'pads start sticky' option | ||
| 229 | 212 | |||
| 230 | 213 | |||
| 231 | 214 | Version 1.10.1 | ||
| 232 | 215 | * Fixed some compile-time issues, particularly with GTK+ 2.0 | ||
| 233 | 216 | |||
| 234 | 217 | |||
| 235 | 218 | Version 1.10 | ||
| 236 | 219 | * Rewrote applet popup menu to be more consistent and hopefully useful | ||
| 237 | 220 | * Fixed crash when closing a pad that had provided text in a cut/paste | ||
| 238 | 221 | * Normalize pad dimensions when opening in case the values got messed up | ||
| 239 | 222 | * Misc. small bugs | ||
| 240 | 223 | |||
| 241 | 224 | |||
| 242 | 225 | Version 1.9.1 | ||
| 243 | 226 | * Fix a segfault when show all is selected after a new pad is made | ||
| 244 | 227 | |||
| 245 | 228 | |||
| 246 | 229 | Version 1.9 | ||
| 247 | 230 | * Now use automake/autoconf, which allows for more complete build control | ||
| 248 | 231 | * Now use gettext, allowing easy translation of xpad | ||
| 249 | 232 | * Now auto-apply any pad changes to hard drive, making xpad a tad more | ||
| 250 | 233 | reliable | ||
| 251 | 234 | * Now can easily change settings for only one pad | ||
| 252 | 235 | * A little more sane title generation -- now just uses first line | ||
| 253 | 236 | * X session management support | ||
| 254 | 237 | * | ||
| 255 | 238 | * Popup menu is decluttered and altered, with the HIG in mind | ||
| 256 | 239 | * Fixed crash on exit if we didn't init docklet | ||
| 257 | 240 | * Fixed new pads randomly starting up as white background | ||
| 258 | 241 | * Cut/copy/paste are now unsensitive if no content to copy or paste | ||
| 259 | 242 | * Pads now play nice with the X clipboard (middle mouse button) | ||
| 260 | 243 | * Fixed a bug with the notification area applet | ||
| 261 | 244 | * Fixed misc. small bugs | ||
| 262 | 245 | |||
| 263 | 246 | |||
| 264 | 247 | Version 1.8 | ||
| 265 | 248 | * Allow using system text color, background color, and font | ||
| 266 | 249 | * Eggtray now appears, allowing users to hide all pads (thanks | ||
| 267 | 250 | jgb3@email.byu.edu) | ||
| 268 | 251 | * Now we compile using autoconf | ||
| 269 | 252 | * | ||
| 270 | 253 | * Xpad won't take 100% cpu sometimes when idle | ||
| 271 | 254 | * Fixed bug that screwed up last toolbar button's toggle setting | ||
| 272 | 255 | * Fixed toolbar hiding when you right click on another pad | ||
| 273 | 256 | * Fixed style locking and sticky status changing on menu popup | ||
| 274 | 257 | * No deletion confirmation if pad is only whitespace | ||
| 275 | 258 | |||
| 276 | 259 | |||
| 277 | 260 | Version 1.7 | ||
| 278 | 261 | * Popup alerts are more pleasing. (HIG compliant) | ||
| 279 | 262 | * Added --nonew flag to prevent creation of new pads. | ||
| 280 | 263 | * Changed --new flag to only open a new pad, not try to open old pads too. | ||
| 281 | 264 | * Changed window titles from quoted to ellipses at the end. | ||
| 282 | 265 | * Option to turn off toolbar auto-hide. | ||
| 283 | 266 | * Added --list, -l, --show, -s. | ||
| 284 | 267 | |||
| 285 | 268 | |||
| 286 | 269 | Version 1.6.1 | ||
| 287 | 270 | * Fix segfault on startup if toolbar is disabled. | ||
| 288 | 271 | |||
| 289 | 272 | |||
| 290 | 273 | Version 1.6 | ||
| 291 | 274 | * Rearrange popup menu | ||
| 292 | 275 | * More meaningful window titles | ||
| 293 | 276 | * Add popup menu submenu that allows you to choose window to show | ||
| 294 | 277 | * Allow reopening of closed pads | ||
| 295 | 278 | * The return of cut/copy/paste | ||
| 296 | 279 | * Native sticky support | ||
| 297 | 280 | * Add a show all command -- via command line or menu | ||
| 298 | 281 | * Allow turning off of scrollbars | ||
| 299 | 282 | * Allow reshowing of closed pads (without restarting xpad) | ||
| 300 | 283 | * | ||
| 301 | 284 | * Stopped style lock from turning on accidentally | ||
| 302 | 285 | * Properly handle WM closures | ||
| 303 | 286 | * Better HIG-style support of keyboard accelerators | ||
| 304 | 287 | |||
| 305 | 288 | |||
| 306 | 289 | Version 1.5.1 | ||
| 307 | 290 | * Fix a possible segfault on startup | ||
| 308 | 291 | |||
| 309 | 292 | |||
| 310 | 293 | Version 1.5 | ||
| 311 | 294 | * Fixed a bug that stopped saving of defaults on shutdown | ||
| 312 | 295 | * Better error reporting | ||
| 313 | 296 | * Added a toolbar with customizable buttons | ||
| 314 | 297 | * Added some new command line options | ||
| 315 | 298 | * Allow style locking | ||
| 316 | 299 | * Allow pad clearing | ||
| 317 | 300 | * Added all new preference help window | ||
| 318 | 301 | |||
| 319 | 302 | |||
| 320 | 303 | Version 1.4 | ||
| 321 | 304 | * Code cleanup | ||
| 322 | 305 | * We now compile clean with -ansi and -pedantic! ;) | ||
| 323 | 306 | * Should take up a little less memory | ||
| 324 | 307 | * Fixed several memory leaks | ||
| 325 | 308 | * Should be able to compile on windows and beos. | ||
| 326 | 309 | -- PLEASE let me know how this works for you. | ||
| 327 | 310 | * Added scrollbars if window isn't big enough to handle text | ||
| 328 | 311 | -- this fixes two known bugs | ||
| 329 | 312 | * New xpad processes now handled gracefully | ||
| 330 | 313 | * Added further optimizations to compilation | ||
| 331 | 314 | -- let me know if this causes you problems | ||
| 332 | 315 | * Fixed some possible buffer overflows | ||
| 333 | 316 | * Fixed some warnings/errors on gcc3 compilation | ||
| 334 | 317 | * Cursor icon changes when edit lock is on | ||
| 335 | 318 | |||
| 336 | 319 | |||
| 337 | 320 | Version 1.3 | ||
| 338 | 321 | * Added a padding option (thanks Nagy Mate) | ||
| 339 | 322 | * Redesigned dialogs | ||
| 340 | 323 | * Preferences now auto-apply | ||
| 341 | 324 | * You can now choose what the wm close button does, defaults to close | ||
| 342 | 325 | * Pads have individual titles now | ||
| 343 | 326 | * Xpad gets along better with various wm's now | ||
| 344 | 327 | * Cursor no longer blinks if you can't edit pad | ||
| 345 | 328 | * Fixed double-clicking-doesn't-select-text-when-edit-lock-is-on bug | ||
| 346 | 329 | * Pads can no longer be individually closed (unless wm decor is on) | ||
| 347 | 330 | |||
| 348 | 331 | |||
| 349 | 332 | Version 1.2.1 | ||
| 350 | 333 | * Fixed segfault on startup if no ~/.xpad directory, plus some related bugs | ||
| 351 | 334 | |||
| 352 | 335 | |||
| 353 | 336 | Version 1.2 | ||
| 354 | 337 | * Fixed an issue causing black on black with big-endian architectures | ||
| 355 | 338 | * Added "Edit Lock" mode | ||
| 356 | 339 | * General code cleanup | ||
| 357 | 340 | |||
| 358 | 341 | |||
| 359 | 342 | Version 1.1 | ||
| 360 | 343 | * Simplified popup menu (removed GTK+ default cut/copy/paste/input | ||
| 361 | 344 | method/insert). If you used them, and miss them, let me know. | ||
| 362 | 345 | * Added keyboard shortcuts for most menu items | ||
| 363 | 346 | * Expanded help dialog to include shortcuts | ||
| 364 | 347 | * Allow border left-drags, right-drags, and right clicks | ||
| 365 | 348 | |||
| 366 | 349 | |||
| 367 | 350 | Version 1.0.2 | ||
| 368 | 351 | * Stopped pads from losing their place on x shut down | ||
| 369 | 352 | |||
| 370 | 353 | |||
| 371 | 354 | Version 1.0.1 | ||
| 372 | 355 | * Fixed a possible runtime warning with autosaving | ||
| 373 | 356 | * Made window icon code more robust | ||
| 374 | 357 | * Added icons for all menu items | ||
| 375 | 358 | |||
| 376 | 359 | |||
| 377 | 360 | Version 1.0 | ||
| 378 | 361 | * Added an open file dialog | ||
| 379 | 362 | * Added a save as dialog | ||
| 380 | 363 | * Closed pads are handled more consistently | ||
| 381 | 364 | * Unified color/font change screens | ||
| 382 | 365 | * Fixed font not being saved correctly | ||
| 383 | 366 | * Added ability to fine tune default pad settings, including size (before | ||
| 384 | 367 | this was all handled transparently, but size was not always updated) | ||
| 385 | 368 | * Added optional confirmation to pad destroys | ||
| 386 | 369 | * Window decorations can now be turned on (in global pref screen) | ||
| 387 | 370 | * Added border color and border width options | ||
| 388 | 371 | * Added gui for sync time (autosaving) control | ||
| 389 | 372 | * Took out --sync-time and -s (you can do same thing with above gui) | ||
| 390 | 373 | * Stopped new pads always being placed in same spot | ||
| 391 | 374 | * Added help screen, which opens when you click on "help" from right-click | ||
| 392 | 375 | menu and on first run | ||
| 393 | 376 | * Much cleaner internal api | ||
| 394 | 377 | * Made xpad more theme-friendly | ||
| 395 | 378 | * Resizing/moving now works even if numpad is on | ||
| 396 | 379 | * Xpad 1.0 can now open much older versions of xpad's files (tested to 0.2.1) | ||
| 397 | 380 | * Added app icon (thanks nestor di) | ||
| 398 | 381 | |||
| 399 | 382 | |||
| 400 | 383 | Version 0.2.5 | ||
| 401 | 384 | * Added --help | ||
| 402 | 385 | * Added short forms of arguments (e.g. -h, -v, -V, -s) | ||
| 403 | 386 | * Added more output messages | ||
| 404 | 387 | * Stopped pad raising above popup on right click | ||
| 405 | 388 | * Fixed bug where old pads wouldn't open upon startup | ||
| 406 | 389 | * No size limit on pads | ||
| 407 | 390 | |||
| 408 | 391 | |||
| 409 | 392 | Version 0.2.4 | ||
| 410 | 393 | * Fixed small memory leak if no default-style file | ||
| 411 | 394 | * Pads rise to foreground if clicked on now | ||
| 412 | 395 | * Added "close all" option on popup | ||
| 413 | 396 | * Prints out a message when autosaving | ||
| 414 | 397 | * Added --verbosity= option. (0 is default - no messages; 1 is | ||
| 415 | 398 | moderate - important things like autosaving; 2 is debug - | ||
| 416 | 399 | more info than necessary) | ||
| 417 | 400 | * Removed some possible buffer overflows if text is too large (a hardcoded | ||
| 418 | 401 | limit of 20k chars now) | ||
| 419 | 402 | * Misc. code cleanups | ||
| 420 | 403 | |||
| 421 | 404 | |||
| 422 | 405 | Version 0.2.3.1 | ||
| 423 | 406 | * Fixed nasty bug where, if you didn't have a working ~/.xpad/default-styles | ||
| 424 | 407 | file, it would seg-fault. my bad | ||
| 425 | 408 | |||
| 426 | 409 | |||
| 427 | 410 | Version 0.2.3 | ||
| 428 | 411 | * Perfected (?) syncing. Now will recover cleanly from anything -- including | ||
| 429 | 412 | power shut off or random interrupts. This fixes the "pad contents | ||
| 430 | 413 | disappearing on X-shutdown" bug | ||
| 431 | 414 | * Moved menu items around a bit | ||
| 432 | 415 | * Remembers preferred size (only if you change fonts/colors. on TODO) | ||
| 433 | 416 | * Not always centered now | ||
| 434 | 417 | |||
| 435 | 418 | |||
| 436 | 419 | Version 0.2.2 | ||
| 437 | 420 | * Debian-friendly Makefile fixes | ||
| 438 | 421 | * Cleaned up code | ||
| 439 | 422 | |||
| 440 | 423 | |||
| 441 | 424 | Version 0.2.1 | ||
| 442 | 425 | * Changed saving to be more fault-tolerant | ||
| 443 | 426 | * Added about screen with version info | ||
| 444 | 427 | |||
| 445 | 428 | |||
| 446 | 429 | Version 0.2 | ||
| 447 | 430 | * Ported to gtk+-2.0 | ||
| 448 | 431 | * Now can change font color | ||
| 449 | 432 | * If xpad is already running, will open new pad, not open old pads again | ||
| 450 | 433 | * In-xpad moving and resizing now works | ||
| 451 | 434 | * Xpad now recovers better from being interrupted | ||
| 452 | 435 | * Remembers your preferred style | ||
| 453 | 436 | * Many small bugfixes | ||
| 454 | 437 | * Code reorganization | ||
| 455 | 438 | |||
| 456 | 439 | |||
| 457 | 440 | Version 0.1.9.2 | ||
| 458 | 441 | * Cleaner lack of decorations | ||
| 459 | 442 | * Fixed "double-click on menu" bug | ||
| 460 | 443 | * Fixed segfault when only a font size change was requested | ||
| 461 | 444 | * Added close and destroy items to menu. Now you can close a window without | ||
| 462 | 445 | losing content | ||
| 463 | 14 | 446 | ||
| 464 | 15 | 2004-09-29 Jeroen T. Vermeulen <jtv@xs4all.nl> | 447 | 2004-09-29 Jeroen T. Vermeulen <jtv@xs4all.nl> |
| 465 | 16 | 448 | ||
| 466 | 17 | 449 | ||
| 467 | === removed file 'NEWS' | |||
| 468 | --- NEWS 2011-11-14 17:10:03 +0000 | |||
| 469 | +++ NEWS 1970-01-01 00:00:00 +0000 | |||
| 470 | @@ -1,430 +0,0 @@ | |||
| 471 | 1 | Version 4.1 | ||
| 472 | 2 | * Undo/Redo for xpad and bug-fixes. Feature by Sergei Riaguzov | ||
| 473 | 3 | * Bug #490445: crash when right-clicking on tray icon to display list of notes. Patch by David Hull | ||
| 474 | 4 | * Bug #360142: Add keyboard shortcuts for formatting. Patch by Dennis Hilmar | ||
| 475 | 5 | * Bug #591978: xpad critical start. Patch by OBATA Akio | ||
| 476 | 6 | |||
| 477 | 7 | |||
| 478 | 8 | Version 4.0 | ||
| 479 | 9 | * Added --toggle (between --hide and --show). Patch by Paul Ivanov. | ||
| 480 | 10 | * Updated French, Japanese, Russian, Spanish, and Swedish translations | ||
| 481 | 11 | * New Croatian, Estonian, German, Portuguese, Thai, and Turkish translations | ||
| 482 | 12 | |||
| 483 | 13 | |||
| 484 | 14 | Version 3.1 | ||
| 485 | 15 | * Updated Danish, French, Russian, Spanish, and Swedish translations | ||
| 486 | 16 | * New Czech, Japanese, and Latvian translations | ||
| 487 | 17 | |||
| 488 | 18 | |||
| 489 | 19 | Version 3.0 | ||
| 490 | 20 | * Don't wake up every 20 milliseconds to check session management messages. | ||
| 491 | 21 | Rather, wait for an event. | ||
| 492 | 22 | * Add --hide/--show, removed --hide-old. --hide and --show affect all pads | ||
| 493 | 23 | on startup or can be used on an already running xpad instance. Patch by | ||
| 494 | 24 | Jan Losinski. | ||
| 495 | 25 | * Update icon to be less aliased | ||
| 496 | 26 | * Relicense as GPL v3+ | ||
| 497 | 27 | |||
| 498 | 28 | |||
| 499 | 29 | Version 2.14 | ||
| 500 | 30 | * Fix 100% CPU bug | ||
| 501 | 31 | |||
| 502 | 32 | |||
| 503 | 33 | Version 2.13 | ||
| 504 | 34 | * Requires GTK+ 2.12 | ||
| 505 | 35 | * Fix pads possibly not remembering location after close | ||
| 506 | 36 | * Fix pad-closed state not being remembered | ||
| 507 | 37 | * Uses native status icon code in GTK+ | ||
| 508 | 38 | * Maybe, possibly fix some 'pad on all workspaces' problems | ||
| 509 | 39 | * New Chinese (simplified) translation (Meng Jie) | ||
| 510 | 40 | * New English (British) translation (David Lodge) | ||
| 511 | 41 | * New Finnish translation (Jorma Karvonen) | ||
| 512 | 42 | * New Korean translation (KwangSub Lee) | ||
| 513 | 43 | * Updated Dutch translation (Benno Schulenberg) | ||
| 514 | 44 | * Updated Slovak translation (Andrej Kacian) | ||
| 515 | 45 | * Fixed Danish, Swedish translations | ||
| 516 | 46 | |||
| 517 | 47 | |||
| 518 | 48 | Version 2.12 | ||
| 519 | 49 | * Fix a crash when loading pads with formatting | ||
| 520 | 50 | |||
| 521 | 51 | |||
| 522 | 52 | Version 2.11 | ||
| 523 | 53 | * If window decorations are turned on, pads will now show up in the taskbar | ||
| 524 | 54 | * Added -f option to open a file as a note | ||
| 525 | 55 | * New Chinese (simplified) translation (Meng Jie) | ||
| 526 | 56 | * New Danish translation (Morten Bo Johansen) | ||
| 527 | 57 | * New Swedish translation (Daniel Nylander) | ||
| 528 | 58 | * Updated Chinese (traditional) translation (Wei-Lun Chao) | ||
| 529 | 59 | |||
| 530 | 60 | |||
| 531 | 61 | Version 2.10 | ||
| 532 | 62 | * Fix a possible crash when deleting pads with autohide toolbar | ||
| 533 | 63 | * Make toolbar buttons smaller | ||
| 534 | 64 | * Make toolbar appear inside pad if there is enough unused space | ||
| 535 | 65 | * New Slovak translation (Andrej Kacian) | ||
| 536 | 66 | * New Slovenian translation (Matej Urbančič) | ||
| 537 | 67 | |||
| 538 | 68 | |||
| 539 | 69 | Version 2.9 | ||
| 540 | 70 | * Fix pads saving slightly off bad x,y values | ||
| 541 | 71 | * Fix pads saving bad heights when toolbar always on (Sham Chukoury) | ||
| 542 | 72 | * Fix possible crash from not allocating enough memory (Federico Schwindt) | ||
| 543 | 73 | * New Malay translation (Sharuzzaman Ahmat Raslan) | ||
| 544 | 74 | |||
| 545 | 75 | |||
| 546 | 76 | Version 2.8 | ||
| 547 | 77 | * Allow translations to be used (broken for a couple versions) | ||
| 548 | 78 | * New Chinese (traditional) translation (Wei-Lun Chao) | ||
| 549 | 79 | * Removed half-baked Esperanto translation | ||
| 550 | 80 | |||
| 551 | 81 | |||
| 552 | 82 | Version 2.7 | ||
| 553 | 83 | * Stop pads from popping toolbar while the pad is moving/resizing | ||
| 554 | 84 | * Make sure pads use correct sizes when autohide is off (Sham Chukoury) | ||
| 555 | 85 | * New Bulgarian translation (Yavor Doganov) | ||
| 556 | 86 | * New Kinyarwanda translation (Steve Murphy et al) | ||
| 557 | 87 | |||
| 558 | 88 | |||
| 559 | 89 | Version 2.6 | ||
| 560 | 90 | * Stop pad windows from 'jumping' when dragged via the toolbar | ||
| 561 | 91 | * Updated Hungarian translation (Németh Csaba) | ||
| 562 | 92 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 563 | 93 | * Updated Vietnamese translation (Clytie Siddall) | ||
| 564 | 94 | |||
| 565 | 95 | |||
| 566 | 96 | Version 2.5 | ||
| 567 | 97 | * Stop making all new pads start in top left | ||
| 568 | 98 | * Stop closing xpad if toggling window decorations with only one pad open | ||
| 569 | 99 | * Stop losing pad contents if upgrading from old versions of xpad | ||
| 570 | 100 | |||
| 571 | 101 | |||
| 572 | 102 | Version 2.4 | ||
| 573 | 103 | * Create the configuration directory if it doesn't exist | ||
| 574 | 104 | |||
| 575 | 105 | |||
| 576 | 106 | Version 2.3 | ||
| 577 | 107 | * Fixed a compile bug with binreloc and threading | ||
| 578 | 108 | |||
| 579 | 109 | |||
| 580 | 110 | Version 2.2 | ||
| 581 | 111 | * Bumped GTK+ dependency to 2.6 | ||
| 582 | 112 | * New About dialog (using GtkAboutDialog) | ||
| 583 | 113 | * New default location for configuration files: ~/.config/xpad | ||
| 584 | 114 | * Updated icon (now uses lighter colors) | ||
| 585 | 115 | * Use GOption for command-line parsing | ||
| 586 | 116 | * New command-line option --hide-old (or -H) to not show old pads | ||
| 587 | 117 | * Renamed command-line option --nonew to --no-new and added -N shortcut | ||
| 588 | 118 | * Allow running from console if we don't need to do anything graphical | ||
| 589 | 119 | * Readded keyboard shortcuts | ||
| 590 | 120 | * Updated antiquated man page | ||
| 591 | 121 | * New Hungarian translation (Németh Csaba) | ||
| 592 | 122 | * New Vietnamese translation (Clytie Siddall) | ||
| 593 | 123 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 594 | 124 | |||
| 595 | 125 | |||
| 596 | 126 | Version 2.1 | ||
| 597 | 127 | * Fix tray icon being the wrong size | ||
| 598 | 128 | * Fix xpad to close when no tray and no open pads | ||
| 599 | 129 | |||
| 600 | 130 | |||
| 601 | 131 | Version 2.0 | ||
| 602 | 132 | * Fix notes list to display correct number of pads | ||
| 603 | 133 | * Fix notification icon from not doing anything | ||
| 604 | 134 | * Fix compilation when BinReloc is disabled | ||
| 605 | 135 | * Fix compilation with gcc 3.4 | ||
| 606 | 136 | * Fix endianness issue with preference files | ||
| 607 | 137 | * Updated Dutch translation (Elros Cyriatan) | ||
| 608 | 138 | |||
| 609 | 139 | |||
| 610 | 140 | Version 2.0-b3 | ||
| 611 | 141 | * Use BinReloc to allow any-prefix installs of xpad to work | ||
| 612 | 142 | * Fixed a double-free bug that caused some problems with new pads | ||
| 613 | 143 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 614 | 144 | * Updated Spanish translation (Ramon Rey Vicente) | ||
| 615 | 145 | |||
| 616 | 146 | |||
| 617 | 147 | Version 2.0-b2 | ||
| 618 | 148 | * Redesigned preferences and pad properties dialogs | ||
| 619 | 149 | * If the tray disappears (e.g. killall gnome-panel), xpad's icon reappears | ||
| 620 | 150 | * More formally ask window manager to make us skip taskbar and pager | ||
| 621 | 151 | * New, lighter default color for pads | ||
| 622 | 152 | * Lots of internal code cleanup | ||
| 623 | 153 | * Fixed a crasher with not being able to find window icons | ||
| 624 | 154 | * Fixed some crashers with turning off toolbar | ||
| 625 | 155 | * Fixed bug with text cursor color being one color change behind | ||
| 626 | 156 | |||
| 627 | 157 | |||
| 628 | 158 | Version 2.0-b1 | ||
| 629 | 159 | * The text cursor is now always the same color as the text color | ||
| 630 | 160 | * Formatting can now be applied to selected text | ||
| 631 | 161 | * Pads remember their hidden state | ||
| 632 | 162 | * Rewritten toolbar, allowing easier adding/removing/moving buttons | ||
| 633 | 163 | * Simplified preferences dialog; many functions are now accessed from popup menu | ||
| 634 | 164 | * --new now also loads the old pads, instead of the previous broken behavior | ||
| 635 | 165 | * Fixed bug with pads over the 9th not having numbers in note lists | ||
| 636 | 166 | * Fixed bug with inter process communicating causing only first communication to work | ||
| 637 | 167 | * Fixed bug with pads becoming unstyled after closing and reopening | ||
| 638 | 168 | * New Afrikaans translation (Petri Jooste) | ||
| 639 | 169 | * New French translation (Michel Robitaille) | ||
| 640 | 170 | |||
| 641 | 171 | |||
| 642 | 172 | Version 1.13 | ||
| 643 | 173 | * Don't close xpad if no pads are open but the system tray is | ||
| 644 | 174 | * Made translations work again | ||
| 645 | 175 | * New Spanish translation (Ramon Rey Vicente) | ||
| 646 | 176 | * Updated Dutch translation (Elros Cyriatan) | ||
| 647 | 177 | * Updated Irish translation (Kevin Patrick Scannell) | ||
| 648 | 178 | |||
| 649 | 179 | |||
| 650 | 180 | Version 1.12 | ||
| 651 | 181 | * Fixed segfault when clicking on auto-hide toolbar preference | ||
| 652 | 182 | * Fixed segfault when changing the first toolbar button | ||
| 653 | 183 | * Added Irish translation (by Kevin Patrick Scannell) | ||
| 654 | 184 | |||
| 655 | 185 | |||
| 656 | 186 | Version 1.11 | ||
| 657 | 187 | * Added Dutch translation (by t.c.witte@phys.uu.nl) | ||
| 658 | 188 | * Added partial Esperanto translation (by mterry@fastmail.fm) | ||
| 659 | 189 | * Added Romanian translation (by eugenh@urban-grafx.ro) | ||
| 660 | 190 | * Added Russian translation (by avl@cad.ru) | ||
| 661 | 191 | * Added missing "include <sys/time.h>" (by netgeek@speakeasy.net) | ||
| 662 | 192 | * Added missing #defines for solaris (by alan@cesma.usb.ve) | ||
| 663 | 193 | * Added new icon and install icon family into new location per icon theme spec | ||
| 664 | 194 | * Fixed disk-full-causes-xpad-contents-to-disappear bug | ||
| 665 | 195 | * Made pads not show up in taskbar | ||
| 666 | 196 | * Added 'pads start sticky' option | ||
| 667 | 197 | |||
| 668 | 198 | |||
| 669 | 199 | Version 1.10.1 | ||
| 670 | 200 | * Fixed some compile-time issues, particularly with GTK+ 2.0 | ||
| 671 | 201 | |||
| 672 | 202 | |||
| 673 | 203 | Version 1.10 | ||
| 674 | 204 | * Rewrote applet popup menu to be more consistent and hopefully useful | ||
| 675 | 205 | * Fixed crash when closing a pad that had provided text in a cut/paste | ||
| 676 | 206 | * Normalize pad dimensions when opening in case the values got messed up | ||
| 677 | 207 | * Misc. small bugs | ||
| 678 | 208 | |||
| 679 | 209 | |||
| 680 | 210 | Version 1.9.1 | ||
| 681 | 211 | * Fix a segfault when show all is selected after a new pad is made | ||
| 682 | 212 | |||
| 683 | 213 | |||
| 684 | 214 | Version 1.9 | ||
| 685 | 215 | * Now use automake/autoconf, which allows for more complete build control | ||
| 686 | 216 | * Now use gettext, allowing easy translation of xpad | ||
| 687 | 217 | * Now auto-apply any pad changes to hard drive, making xpad a tad more | ||
| 688 | 218 | reliable | ||
| 689 | 219 | * Now can easily change settings for only one pad | ||
| 690 | 220 | * A little more sane title generation -- now just uses first line | ||
| 691 | 221 | * X session management support | ||
| 692 | 222 | * | ||
| 693 | 223 | * Popup menu is decluttered and altered, with the HIG in mind | ||
| 694 | 224 | * Fixed crash on exit if we didn't init docklet | ||
| 695 | 225 | * Fixed new pads randomly starting up as white background | ||
| 696 | 226 | * Cut/copy/paste are now unsensitive if no content to copy or paste | ||
| 697 | 227 | * Pads now play nice with the X clipboard (middle mouse button) | ||
| 698 | 228 | * Fixed a bug with the notification area applet | ||
| 699 | 229 | * Fixed misc. small bugs | ||
| 700 | 230 | |||
| 701 | 231 | |||
| 702 | 232 | Version 1.8 | ||
| 703 | 233 | * Allow using system text color, background color, and font | ||
| 704 | 234 | * Eggtray now appears, allowing users to hide all pads (thanks | ||
| 705 | 235 | jgb3@email.byu.edu) | ||
| 706 | 236 | * Now we compile using autoconf | ||
| 707 | 237 | * | ||
| 708 | 238 | * Xpad won't take 100% cpu sometimes when idle | ||
| 709 | 239 | * Fixed bug that screwed up last toolbar button's toggle setting | ||
| 710 | 240 | * Fixed toolbar hiding when you right click on another pad | ||
| 711 | 241 | * Fixed style locking and sticky status changing on menu popup | ||
| 712 | 242 | * No deletion confirmation if pad is only whitespace | ||
| 713 | 243 | |||
| 714 | 244 | |||
| 715 | 245 | Version 1.7 | ||
| 716 | 246 | * Popup alerts are more pleasing. (HIG compliant) | ||
| 717 | 247 | * Added --nonew flag to prevent creation of new pads. | ||
| 718 | 248 | * Changed --new flag to only open a new pad, not try to open old pads too. | ||
| 719 | 249 | * Changed window titles from quoted to ellipses at the end. | ||
| 720 | 250 | * Option to turn off toolbar auto-hide. | ||
| 721 | 251 | * Added --list, -l, --show, -s. | ||
| 722 | 252 | |||
| 723 | 253 | |||
| 724 | 254 | Version 1.6.1 | ||
| 725 | 255 | * Fix segfault on startup if toolbar is disabled. | ||
| 726 | 256 | |||
| 727 | 257 | |||
| 728 | 258 | Version 1.6 | ||
| 729 | 259 | * Rearrange popup menu | ||
| 730 | 260 | * More meaningful window titles | ||
| 731 | 261 | * Add popup menu submenu that allows you to choose window to show | ||
| 732 | 262 | * Allow reopening of closed pads | ||
| 733 | 263 | * The return of cut/copy/paste | ||
| 734 | 264 | * Native sticky support | ||
| 735 | 265 | * Add a show all command -- via command line or menu | ||
| 736 | 266 | * Allow turning off of scrollbars | ||
| 737 | 267 | * Allow reshowing of closed pads (without restarting xpad) | ||
| 738 | 268 | * | ||
| 739 | 269 | * Stopped style lock from turning on accidentally | ||
| 740 | 270 | * Properly handle WM closures | ||
| 741 | 271 | * Better HIG-style support of keyboard accelerators | ||
| 742 | 272 | |||
| 743 | 273 | |||
| 744 | 274 | Version 1.5.1 | ||
| 745 | 275 | * Fix a possible segfault on startup | ||
| 746 | 276 | |||
| 747 | 277 | |||
| 748 | 278 | Version 1.5 | ||
| 749 | 279 | * Fixed a bug that stopped saving of defaults on shutdown | ||
| 750 | 280 | * Better error reporting | ||
| 751 | 281 | * Added a toolbar with customizable buttons | ||
| 752 | 282 | * Added some new command line options | ||
| 753 | 283 | * Allow style locking | ||
| 754 | 284 | * Allow pad clearing | ||
| 755 | 285 | * Added all new preference help window | ||
| 756 | 286 | |||
| 757 | 287 | |||
| 758 | 288 | Version 1.4 | ||
| 759 | 289 | * Code cleanup | ||
| 760 | 290 | * We now compile clean with -ansi and -pedantic! ;) | ||
| 761 | 291 | * Should take up a little less memory | ||
| 762 | 292 | * Fixed several memory leaks | ||
| 763 | 293 | * Should be able to compile on windows and beos. | ||
| 764 | 294 | -- PLEASE let me know how this works for you. | ||
| 765 | 295 | * Added scrollbars if window isn't big enough to handle text | ||
| 766 | 296 | -- this fixes two known bugs | ||
| 767 | 297 | * New xpad processes now handled gracefully | ||
| 768 | 298 | * Added further optimizations to compilation | ||
| 769 | 299 | -- let me know if this causes you problems | ||
| 770 | 300 | * Fixed some possible buffer overflows | ||
| 771 | 301 | * Fixed some warnings/errors on gcc3 compilation | ||
| 772 | 302 | * Cursor icon changes when edit lock is on | ||
| 773 | 303 | |||
| 774 | 304 | |||
| 775 | 305 | Version 1.3 | ||
| 776 | 306 | * Added a padding option (thanks Nagy Mate) | ||
| 777 | 307 | * Redesigned dialogs | ||
| 778 | 308 | * Preferences now auto-apply | ||
| 779 | 309 | * You can now choose what the wm close button does, defaults to close | ||
| 780 | 310 | * Pads have individual titles now | ||
| 781 | 311 | * Xpad gets along better with various wm's now | ||
| 782 | 312 | * Cursor no longer blinks if you can't edit pad | ||
| 783 | 313 | * Fixed double-clicking-doesn't-select-text-when-edit-lock-is-on bug | ||
| 784 | 314 | * Pads can no longer be individually closed (unless wm decor is on) | ||
| 785 | 315 | |||
| 786 | 316 | |||
| 787 | 317 | Version 1.2.1 | ||
| 788 | 318 | * Fixed segfault on startup if no ~/.xpad directory, plus some related bugs | ||
| 789 | 319 | |||
| 790 | 320 | |||
| 791 | 321 | Version 1.2 | ||
| 792 | 322 | * Fixed an issue causing black on black with big-endian architectures | ||
| 793 | 323 | * Added "Edit Lock" mode | ||
| 794 | 324 | * General code cleanup | ||
| 795 | 325 | |||
| 796 | 326 | |||
| 797 | 327 | Version 1.1 | ||
| 798 | 328 | * Simplified popup menu (removed GTK+ default cut/copy/paste/input | ||
| 799 | 329 | method/insert). If you used them, and miss them, let me know. | ||
| 800 | 330 | * Added keyboard shortcuts for most menu items | ||
| 801 | 331 | * Expanded help dialog to include shortcuts | ||
| 802 | 332 | * Allow border left-drags, right-drags, and right clicks | ||
| 803 | 333 | |||
| 804 | 334 | |||
| 805 | 335 | Version 1.0.2 | ||
| 806 | 336 | * Stopped pads from losing their place on x shut down | ||
| 807 | 337 | |||
| 808 | 338 | |||
| 809 | 339 | Version 1.0.1 | ||
| 810 | 340 | * Fixed a possible runtime warning with autosaving | ||
| 811 | 341 | * Made window icon code more robust | ||
| 812 | 342 | * Added icons for all menu items | ||
| 813 | 343 | |||
| 814 | 344 | |||
| 815 | 345 | Version 1.0 | ||
| 816 | 346 | * Added an open file dialog | ||
| 817 | 347 | * Added a save as dialog | ||
| 818 | 348 | * Closed pads are handled more consistently | ||
| 819 | 349 | * Unified color/font change screens | ||
| 820 | 350 | * Fixed font not being saved correctly | ||
| 821 | 351 | * Added ability to fine tune default pad settings, including size (before | ||
| 822 | 352 | this was all handled transparently, but size was not always updated) | ||
| 823 | 353 | * Added optional confirmation to pad destroys | ||
| 824 | 354 | * Window decorations can now be turned on (in global pref screen) | ||
| 825 | 355 | * Added border color and border width options | ||
| 826 | 356 | * Added gui for sync time (autosaving) control | ||
| 827 | 357 | * Took out --sync-time and -s (you can do same thing with above gui) | ||
| 828 | 358 | * Stopped new pads always being placed in same spot | ||
| 829 | 359 | * Added help screen, which opens when you click on "help" from right-click | ||
| 830 | 360 | menu and on first run | ||
| 831 | 361 | * Much cleaner internal api | ||
| 832 | 362 | * Made xpad more theme-friendly | ||
| 833 | 363 | * Resizing/moving now works even if numpad is on | ||
| 834 | 364 | * Xpad 1.0 can now open much older versions of xpad's files (tested to 0.2.1) | ||
| 835 | 365 | * Added app icon (thanks nestor di) | ||
| 836 | 366 | |||
| 837 | 367 | |||
| 838 | 368 | Version 0.2.5 | ||
| 839 | 369 | * Added --help | ||
| 840 | 370 | * Added short forms of arguments (e.g. -h, -v, -V, -s) | ||
| 841 | 371 | * Added more output messages | ||
| 842 | 372 | * Stopped pad raising above popup on right click | ||
| 843 | 373 | * Fixed bug where old pads wouldn't open upon startup | ||
| 844 | 374 | * No size limit on pads | ||
| 845 | 375 | |||
| 846 | 376 | |||
| 847 | 377 | Version 0.2.4 | ||
| 848 | 378 | * Fixed small memory leak if no default-style file | ||
| 849 | 379 | * Pads rise to foreground if clicked on now | ||
| 850 | 380 | * Added "close all" option on popup | ||
| 851 | 381 | * Prints out a message when autosaving | ||
| 852 | 382 | * Added --verbosity= option. (0 is default - no messages; 1 is | ||
| 853 | 383 | moderate - important things like autosaving; 2 is debug - | ||
| 854 | 384 | more info than necessary) | ||
| 855 | 385 | * Removed some possible buffer overflows if text is too large (a hardcoded | ||
| 856 | 386 | limit of 20k chars now) | ||
| 857 | 387 | * Misc. code cleanups | ||
| 858 | 388 | |||
| 859 | 389 | |||
| 860 | 390 | Version 0.2.3.1 | ||
| 861 | 391 | * Fixed nasty bug where, if you didn't have a working ~/.xpad/default-styles | ||
| 862 | 392 | file, it would seg-fault. my bad | ||
| 863 | 393 | |||
| 864 | 394 | |||
| 865 | 395 | Version 0.2.3 | ||
| 866 | 396 | * Perfected (?) syncing. Now will recover cleanly from anything -- including | ||
| 867 | 397 | power shut off or random interrupts. This fixes the "pad contents | ||
| 868 | 398 | disappearing on X-shutdown" bug | ||
| 869 | 399 | * Moved menu items around a bit | ||
| 870 | 400 | * Remembers preferred size (only if you change fonts/colors. on TODO) | ||
| 871 | 401 | * Not always centered now | ||
| 872 | 402 | |||
| 873 | 403 | |||
| 874 | 404 | Version 0.2.2 | ||
| 875 | 405 | * Debian-friendly Makefile fixes | ||
| 876 | 406 | * Cleaned up code | ||
| 877 | 407 | |||
| 878 | 408 | |||
| 879 | 409 | Version 0.2.1 | ||
| 880 | 410 | * Changed saving to be more fault-tolerant | ||
| 881 | 411 | * Added about screen with version info | ||
| 882 | 412 | |||
| 883 | 413 | |||
| 884 | 414 | Version 0.2 | ||
| 885 | 415 | * Ported to gtk+-2.0 | ||
| 886 | 416 | * Now can change font color | ||
| 887 | 417 | * If xpad is already running, will open new pad, not open old pads again | ||
| 888 | 418 | * In-xpad moving and resizing now works | ||
| 889 | 419 | * Xpad now recovers better from being interrupted | ||
| 890 | 420 | * Remembers your preferred style | ||
| 891 | 421 | * Many small bugfixes | ||
| 892 | 422 | * Code reorganization | ||
| 893 | 423 | |||
| 894 | 424 | |||
| 895 | 425 | Version 0.1.9.2 | ||
| 896 | 426 | * Cleaner lack of decorations | ||
| 897 | 427 | * Fixed "double-click on menu" bug | ||
| 898 | 428 | * Fixed segfault when only a font size change was requested | ||
| 899 | 429 | * Added close and destroy items to menu. Now you can close a window without | ||
| 900 | 430 | losing content | ||
| 901 | 431 | 0 | ||
| 902 | === modified file 'src/help.c' | |||
| 903 | --- src/help.c 2008-09-21 00:03:40 +0000 | |||
| 904 | +++ src/help.c 2013-10-18 18:35:35 +0000 | |||
| 905 | @@ -59,8 +59,8 @@ | |||
| 906 | 59 | _("Most actions are available throught the popup menu " | 59 | _("Most actions are available throught the popup menu " |
| 907 | 60 | "that appears when you right click on a pad. Try it out and " | 60 | "that appears when you right click on a pad. Try it out and " |
| 908 | 61 | "enjoy."), | 61 | "enjoy."), |
| 911 | 62 | _("Please send comments or bug reports to " | 62 | _("Please send ideas or bug reports to\n" |
| 912 | 63 | "xpad-devel@lists.sourceforge.net")); | 63 | "https://bugs.launchpad.net/xpad/+filebug")); |
| 913 | 64 | 64 | ||
| 914 | 65 | gtk_label_set_markup (GTK_LABEL (helptext), helptextbuf); | 65 | gtk_label_set_markup (GTK_LABEL (helptext), helptextbuf); |
| 915 | 66 | 66 | ||
| 916 | 67 | 67 | ||
| 917 | === modified file 'src/xpad-app.c' | |||
| 918 | --- src/xpad-app.c 2013-10-09 14:46:10 +0000 | |||
| 919 | +++ src/xpad-app.c 2013-10-18 18:35:35 +0000 | |||
| 920 | @@ -42,6 +42,7 @@ | |||
| 921 | 42 | #include "xpad-pad-group.h" | 42 | #include "xpad-pad-group.h" |
| 922 | 43 | #include "xpad-periodic.h" | 43 | #include "xpad-periodic.h" |
| 923 | 44 | #include "xpad-session-manager.h" | 44 | #include "xpad-session-manager.h" |
| 924 | 45 | #include "xpad-settings.h" | ||
| 925 | 45 | #include "xpad-tray.h" | 46 | #include "xpad-tray.h" |
| 926 | 46 | 47 | ||
| 927 | 47 | /* Seems that some systems (sun-sparc-solaris2.8 at least), need the following three #defines. | 48 | /* Seems that some systems (sun-sparc-solaris2.8 at least), need the following three #defines. |
| 928 | @@ -98,8 +99,8 @@ | |||
| 929 | 98 | { | 99 | { |
| 930 | 99 | gboolean first_time; | 100 | gboolean first_time; |
| 931 | 100 | gboolean have_gtk; | 101 | gboolean have_gtk; |
| 934 | 101 | /* GdkVisual *visual;*/ | 102 | // GdkVisual *visual; |
| 935 | 102 | 103 | ||
| 936 | 103 | /* Set up i18n */ | 104 | /* Set up i18n */ |
| 937 | 104 | #ifdef ENABLE_NLS | 105 | #ifdef ENABLE_NLS |
| 938 | 105 | gtk_set_locale (); | 106 | gtk_set_locale (); |
| 939 | @@ -107,7 +108,7 @@ | |||
| 940 | 107 | bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); | 108 | bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); |
| 941 | 108 | textdomain (GETTEXT_PACKAGE); | 109 | textdomain (GETTEXT_PACKAGE); |
| 942 | 109 | #endif | 110 | #endif |
| 944 | 110 | 111 | ||
| 945 | 111 | have_gtk = gtk_init_check (&argc, &argv); | 112 | have_gtk = gtk_init_check (&argc, &argv); |
| 946 | 112 | xpad_argc = argc; | 113 | xpad_argc = argc; |
| 947 | 113 | xpad_argv = argv; | 114 | xpad_argv = argv; |
| 948 | @@ -253,7 +254,19 @@ | |||
| 949 | 253 | void | 254 | void |
| 950 | 254 | xpad_app_quit (void) | 255 | xpad_app_quit (void) |
| 951 | 255 | { | 256 | { |
| 953 | 256 | xpad_pad_group_save_unsaved_all(xpad_app_get_pad_group()); | 257 | // Free the memory used by the pads belonging to this group |
| 954 | 258 | xpad_pad_group_destroy_pads(xpad_app_get_pad_group()); | ||
| 955 | 259 | |||
| 956 | 260 | // Free the memory used by group. | ||
| 957 | 261 | g_object_unref(xpad_app_get_pad_group()); | ||
| 958 | 262 | |||
| 959 | 263 | // Free the memory used by the settings menu. | ||
| 960 | 264 | g_object_unref(XPAD_SETTINGS(xpad_settings())); | ||
| 961 | 265 | |||
| 962 | 266 | // Free the memory used by the tray icon and its menu. | ||
| 963 | 267 | xpad_tray_close(); | ||
| 964 | 268 | |||
| 965 | 269 | // Give GTK the signal to clean the rest and quit the application. | ||
| 966 | 257 | gtk_main_quit(); | 270 | gtk_main_quit(); |
| 967 | 258 | } | 271 | } |
| 968 | 259 | 272 | ||
| 969 | @@ -290,21 +303,24 @@ | |||
| 970 | 290 | { | 303 | { |
| 971 | 291 | GSList *dirs = NULL, *i; | 304 | GSList *dirs = NULL, *i; |
| 972 | 292 | gchar *dirname; | 305 | gchar *dirname; |
| 974 | 293 | 306 | ||
| 975 | 294 | dirname = g_strdup (path); | 307 | dirname = g_strdup (path); |
| 976 | 308 | |||
| 977 | 295 | while (!g_file_test (dirname, G_FILE_TEST_EXISTS)) | 309 | while (!g_file_test (dirname, G_FILE_TEST_EXISTS)) |
| 978 | 296 | { | 310 | { |
| 979 | 297 | dirs = g_slist_prepend (dirs, dirname); | 311 | dirs = g_slist_prepend (dirs, dirname); |
| 980 | 298 | dirname = g_path_get_dirname (dirname); | 312 | dirname = g_path_get_dirname (dirname); |
| 981 | 299 | } | 313 | } |
| 982 | 300 | g_free (dirname); | 314 | g_free (dirname); |
| 984 | 301 | 315 | ||
| 985 | 302 | for (i = dirs; i; i = i->next) | 316 | for (i = dirs; i; i = i->next) |
| 986 | 303 | { | 317 | { |
| 987 | 304 | g_mkdir ((gchar *) i->data, 0700); | 318 | g_mkdir ((gchar *) i->data, 0700); |
| 988 | 305 | g_free (i->data); | 319 | g_free (i->data); |
| 989 | 306 | } | 320 | } |
| 991 | 307 | g_slist_free (dirs); | 321 | |
| 992 | 322 | g_slist_free(dirs); | ||
| 993 | 323 | g_slist_free(i); | ||
| 994 | 308 | } | 324 | } |
| 995 | 309 | 325 | ||
| 996 | 310 | /** | 326 | /** |
| 997 | @@ -315,9 +331,9 @@ | |||
| 998 | 315 | make_config_dir (void) | 331 | make_config_dir (void) |
| 999 | 316 | { | 332 | { |
| 1000 | 317 | gchar *dir = NULL; | 333 | gchar *dir = NULL; |
| 1002 | 318 | 334 | ||
| 1003 | 319 | make_path (g_get_user_config_dir ()); | 335 | make_path (g_get_user_config_dir ()); |
| 1005 | 320 | 336 | ||
| 1006 | 321 | dir = g_build_filename (g_get_user_config_dir (), PACKAGE, NULL); | 337 | dir = g_build_filename (g_get_user_config_dir (), PACKAGE, NULL); |
| 1007 | 322 | 338 | ||
| 1008 | 323 | if (!g_file_test (dir, G_FILE_TEST_EXISTS)) | 339 | if (!g_file_test (dir, G_FILE_TEST_EXISTS)) |
| 1009 | @@ -391,7 +407,7 @@ | |||
| 1010 | 391 | register_stock_icons (void) | 407 | register_stock_icons (void) |
| 1011 | 392 | { | 408 | { |
| 1012 | 393 | GtkIconTheme *theme; | 409 | GtkIconTheme *theme; |
| 1014 | 394 | 410 | ||
| 1015 | 395 | theme = gtk_icon_theme_get_default (); | 411 | theme = gtk_icon_theme_get_default (); |
| 1016 | 396 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); | 412 | gtk_icon_theme_prepend_search_path (theme, THEME_DIR); |
| 1017 | 397 | } | 413 | } |
| 1018 | @@ -699,6 +715,7 @@ | |||
| 1019 | 699 | gint size; | 715 | gint size; |
| 1020 | 700 | gint bytesRead; | 716 | gint bytesRead; |
| 1021 | 701 | gboolean connected = FALSE; | 717 | gboolean connected = FALSE; |
| 1022 | 718 | ssize_t error = NULL; | ||
| 1023 | 702 | 719 | ||
| 1024 | 703 | /* create master socket */ | 720 | /* create master socket */ |
| 1025 | 704 | client_fd = socket (PF_LOCAL, SOCK_STREAM, 0); | 721 | client_fd = socket (PF_LOCAL, SOCK_STREAM, 0); |
| 1026 | @@ -713,10 +730,14 @@ | |||
| 1027 | 713 | size = args_to_string (xpad_argc, xpad_argv, &args) + 1; | 730 | size = args_to_string (xpad_argc, xpad_argv, &args) + 1; |
| 1028 | 714 | 731 | ||
| 1029 | 715 | /* first, write length of string */ | 732 | /* first, write length of string */ |
| 1031 | 716 | write (client_fd, &size, sizeof (size)); | 733 | error = write (client_fd, &size, sizeof (size)); |
| 1032 | 734 | if (error == -1) | ||
| 1033 | 735 | g_error("There is a problem writing information to the socket."); | ||
| 1034 | 717 | 736 | ||
| 1035 | 718 | /* now, write string */ | 737 | /* now, write string */ |
| 1037 | 719 | write (client_fd, args, size); | 738 | error = write (client_fd, args, (size_t) size); |
| 1038 | 739 | if (error == -1) | ||
| 1039 | 740 | g_error("There is a problem writing information to the socket."); | ||
| 1040 | 720 | 741 | ||
| 1041 | 721 | do | 742 | do |
| 1042 | 722 | { | 743 | { |
| 1043 | 723 | 744 | ||
| 1044 | === modified file 'src/xpad-grip-tool-item.c' | |||
| 1045 | --- src/xpad-grip-tool-item.c 2008-09-21 00:03:40 +0000 | |||
| 1046 | +++ src/xpad-grip-tool-item.c 2013-10-18 18:35:35 +0000 | |||
| 1047 | @@ -18,15 +18,16 @@ | |||
| 1048 | 18 | 18 | ||
| 1049 | 19 | #include "xpad-grip-tool-item.h" | 19 | #include "xpad-grip-tool-item.h" |
| 1050 | 20 | 20 | ||
| 1051 | 21 | G_DEFINE_TYPE(XpadGripToolItem, xpad_grip_tool_item, GTK_TYPE_TOOL_ITEM) | ||
| 1052 | 22 | #define XPAD_GRIP_TOOL_ITEM_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_GRIP_TOOL_ITEM, XpadGripToolItemPrivate)) | ||
| 1053 | 23 | |||
| 1054 | 24 | struct XpadGripToolItemPrivate | 21 | struct XpadGripToolItemPrivate |
| 1055 | 25 | { | 22 | { |
| 1056 | 26 | GtkWidget *drawbox; | 23 | GtkWidget *drawbox; |
| 1057 | 27 | }; | 24 | }; |
| 1058 | 28 | 25 | ||
| 1060 | 29 | /*static void xpad_grip_tool_item_size_request (GtkWidget *widget, GtkRequisition *requisition);*/ | 26 | G_DEFINE_TYPE_WITH_PRIVATE(XpadGripToolItem, xpad_grip_tool_item, GTK_TYPE_TOOL_ITEM) |
| 1061 | 27 | |||
| 1062 | 28 | static void xpad_grip_tool_item_dispose (GObject *object); | ||
| 1063 | 29 | static void xpad_grip_tool_item_finalize (GObject *object); | ||
| 1064 | 30 | |||
| 1065 | 30 | static gboolean xpad_grip_tool_item_event_box_expose (GtkWidget *widget, GdkEventExpose *event); | 31 | static gboolean xpad_grip_tool_item_event_box_expose (GtkWidget *widget, GdkEventExpose *event); |
| 1066 | 31 | static void xpad_grip_tool_item_event_box_realize (GtkWidget *widget); | 32 | static void xpad_grip_tool_item_event_box_realize (GtkWidget *widget); |
| 1067 | 32 | static gboolean xpad_grip_tool_item_button_pressed_event (GtkWidget *widget, GdkEventButton *event); | 33 | static gboolean xpad_grip_tool_item_button_pressed_event (GtkWidget *widget, GdkEventButton *event); |
| 1068 | @@ -40,15 +41,10 @@ | |||
| 1069 | 40 | static void | 41 | static void |
| 1070 | 41 | xpad_grip_tool_item_class_init (XpadGripToolItemClass *klass) | 42 | xpad_grip_tool_item_class_init (XpadGripToolItemClass *klass) |
| 1071 | 42 | { | 43 | { |
| 1081 | 43 | GObjectClass *gobject_class; | 44 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 1082 | 44 | GtkContainerClass *container_class; | 45 | |
| 1083 | 45 | GtkWidgetClass *widget_class; | 46 | gobject_class->dispose = xpad_grip_tool_item_dispose; |
| 1084 | 46 | 47 | gobject_class->finalize = xpad_grip_tool_item_finalize; | |
| 1076 | 47 | gobject_class = (GObjectClass *)klass; | ||
| 1077 | 48 | container_class = (GtkContainerClass *)klass; | ||
| 1078 | 49 | widget_class = (GtkWidgetClass *)klass; | ||
| 1079 | 50 | |||
| 1080 | 51 | g_type_class_add_private (gobject_class, sizeof (XpadGripToolItemPrivate)); | ||
| 1085 | 52 | } | 48 | } |
| 1086 | 53 | 49 | ||
| 1087 | 54 | static void | 50 | static void |
| 1088 | @@ -57,7 +53,7 @@ | |||
| 1089 | 57 | GtkWidget *alignment; | 53 | GtkWidget *alignment; |
| 1090 | 58 | gboolean right; | 54 | gboolean right; |
| 1091 | 59 | 55 | ||
| 1093 | 60 | grip->priv = XPAD_GRIP_TOOL_ITEM_GET_PRIVATE (grip); | 56 | grip->priv = xpad_grip_tool_item_get_instance_private(grip); |
| 1094 | 61 | 57 | ||
| 1095 | 62 | grip->priv->drawbox = gtk_drawing_area_new (); | 58 | grip->priv->drawbox = gtk_drawing_area_new (); |
| 1096 | 63 | gtk_widget_add_events (grip->priv->drawbox, GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK); | 59 | gtk_widget_add_events (grip->priv->drawbox, GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK); |
| 1097 | @@ -73,6 +69,19 @@ | |||
| 1098 | 73 | gtk_container_add (GTK_CONTAINER (grip), alignment); | 69 | gtk_container_add (GTK_CONTAINER (grip), alignment); |
| 1099 | 74 | } | 70 | } |
| 1100 | 75 | 71 | ||
| 1101 | 72 | static void | ||
| 1102 | 73 | xpad_grip_tool_item_dispose (GObject *object) | ||
| 1103 | 74 | { | ||
| 1104 | 75 | G_OBJECT_CLASS (xpad_grip_tool_item_parent_class)->dispose (object); | ||
| 1105 | 76 | } | ||
| 1106 | 77 | |||
| 1107 | 78 | static void | ||
| 1108 | 79 | xpad_grip_tool_item_finalize (GObject *object) | ||
| 1109 | 80 | { | ||
| 1110 | 81 | G_OBJECT_CLASS (xpad_grip_tool_item_parent_class)->finalize (object); | ||
| 1111 | 82 | } | ||
| 1112 | 83 | |||
| 1113 | 84 | |||
| 1114 | 76 | static gboolean | 85 | static gboolean |
| 1115 | 77 | xpad_grip_tool_item_button_pressed_event (GtkWidget *widget, GdkEventButton *event) | 86 | xpad_grip_tool_item_button_pressed_event (GtkWidget *widget, GdkEventButton *event) |
| 1116 | 78 | { | 87 | { |
| 1117 | 79 | 88 | ||
| 1118 | === modified file 'src/xpad-pad-group.c' | |||
| 1119 | --- src/xpad-pad-group.c 2013-10-09 14:46:10 +0000 | |||
| 1120 | +++ src/xpad-pad-group.c 2013-10-18 18:35:35 +0000 | |||
| 1121 | @@ -18,20 +18,18 @@ | |||
| 1122 | 18 | */ | 18 | */ |
| 1123 | 19 | 19 | ||
| 1124 | 20 | #include "xpad-pad-group.h" | 20 | #include "xpad-pad-group.h" |
| 1125 | 21 | #include "xpad-settings.h" | ||
| 1126 | 21 | #include "xpad-pad.h" | 22 | #include "xpad-pad.h" |
| 1127 | 22 | 23 | ||
| 1128 | 23 | G_DEFINE_TYPE(XpadPadGroup, xpad_pad_group, G_TYPE_OBJECT) | ||
| 1129 | 24 | |||
| 1130 | 25 | #define XPAD_PAD_GROUP_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_PAD_GROUP, XpadPadGroupPrivate)) | ||
| 1131 | 26 | |||
| 1132 | 27 | struct XpadPadGroupPrivate | 24 | struct XpadPadGroupPrivate |
| 1133 | 28 | { | 25 | { |
| 1134 | 29 | GSList *pads; | 26 | GSList *pads; |
| 1135 | 30 | }; | 27 | }; |
| 1136 | 31 | 28 | ||
| 1137 | 29 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPadGroup, xpad_pad_group, G_TYPE_OBJECT) | ||
| 1138 | 30 | |||
| 1139 | 32 | static void xpad_pad_group_dispose (GObject *object); | 31 | static void xpad_pad_group_dispose (GObject *object); |
| 1142 | 33 | 32 | static void xpad_pad_group_finalize (GObject *object); | |
| 1141 | 34 | static void xpad_pad_group_destroy_pads (XpadPadGroup *group); | ||
| 1143 | 35 | 33 | ||
| 1144 | 36 | enum { | 34 | enum { |
| 1145 | 37 | PROP_0 | 35 | PROP_0 |
| 1146 | @@ -53,11 +51,20 @@ | |||
| 1147 | 53 | } | 51 | } |
| 1148 | 54 | 52 | ||
| 1149 | 55 | static void | 53 | static void |
| 1150 | 54 | xpad_pad_group_init (XpadPadGroup *group) | ||
| 1151 | 55 | { | ||
| 1152 | 56 | group->priv = xpad_pad_group_get_instance_private(group); | ||
| 1153 | 57 | |||
| 1154 | 58 | group->priv->pads = NULL; | ||
| 1155 | 59 | } | ||
| 1156 | 60 | |||
| 1157 | 61 | static void | ||
| 1158 | 56 | xpad_pad_group_class_init (XpadPadGroupClass *klass) | 62 | xpad_pad_group_class_init (XpadPadGroupClass *klass) |
| 1159 | 57 | { | 63 | { |
| 1160 | 58 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | 64 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
| 1161 | 59 | 65 | ||
| 1162 | 60 | object_class->dispose = xpad_pad_group_dispose; | 66 | object_class->dispose = xpad_pad_group_dispose; |
| 1163 | 67 | object_class->finalize = xpad_pad_group_finalize; | ||
| 1164 | 61 | 68 | ||
| 1165 | 62 | signals[PAD_ADDED] = | 69 | signals[PAD_ADDED] = |
| 1166 | 63 | g_signal_new ("pad_added", | 70 | g_signal_new ("pad_added", |
| 1167 | @@ -80,8 +87,6 @@ | |||
| 1168 | 80 | G_TYPE_NONE, | 87 | G_TYPE_NONE, |
| 1169 | 81 | 1, | 88 | 1, |
| 1170 | 82 | GTK_TYPE_WIDGET); | 89 | GTK_TYPE_WIDGET); |
| 1171 | 83 | |||
| 1172 | 84 | g_type_class_add_private (object_class, sizeof (XpadPadGroupPrivate)); | ||
| 1173 | 85 | } | 90 | } |
| 1174 | 86 | 91 | ||
| 1175 | 87 | static void | 92 | static void |
| 1176 | @@ -89,31 +94,35 @@ | |||
| 1177 | 89 | { | 94 | { |
| 1178 | 90 | XpadPadGroup *group = XPAD_PAD_GROUP (object); | 95 | XpadPadGroup *group = XPAD_PAD_GROUP (object); |
| 1179 | 91 | 96 | ||
| 1181 | 92 | xpad_pad_group_destroy_pads (group); | 97 | // Save all pads of this group |
| 1182 | 98 | xpad_pad_group_save_unsaved_all(group); | ||
| 1183 | 99 | |||
| 1184 | 100 | G_OBJECT_CLASS (xpad_pad_group_parent_class)->dispose (object); | ||
| 1185 | 93 | } | 101 | } |
| 1186 | 94 | 102 | ||
| 1187 | 95 | static void | 103 | static void |
| 1189 | 96 | xpad_pad_group_init (XpadPadGroup *group) | 104 | xpad_pad_group_finalize (GObject *object) |
| 1190 | 97 | { | 105 | { |
| 1193 | 98 | group->priv = XPAD_PAD_GROUP_GET_PRIVATE (group); | 106 | XpadPadGroup *group = XPAD_PAD_GROUP (object); |
| 1194 | 99 | 107 | ||
| 1195 | 108 | g_slist_free (group->priv->pads); | ||
| 1196 | 100 | group->priv->pads = NULL; | 109 | group->priv->pads = NULL; |
| 1197 | 110 | |||
| 1198 | 111 | G_OBJECT_CLASS (xpad_pad_group_parent_class)->finalize (object); | ||
| 1199 | 101 | } | 112 | } |
| 1200 | 102 | 113 | ||
| 1201 | 103 | |||
| 1202 | 104 | GSList * | 114 | GSList * |
| 1203 | 105 | xpad_pad_group_get_pads (XpadPadGroup *group) | 115 | xpad_pad_group_get_pads (XpadPadGroup *group) |
| 1204 | 106 | { | 116 | { |
| 1205 | 107 | return g_slist_copy (group->priv->pads); | 117 | return g_slist_copy (group->priv->pads); |
| 1206 | 108 | } | 118 | } |
| 1207 | 109 | 119 | ||
| 1210 | 110 | 120 | /* Add a pad to this group */ | |
| 1209 | 111 | /* Subsumes a pad into this group */ | ||
| 1211 | 112 | void | 121 | void |
| 1212 | 113 | xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad) | 122 | xpad_pad_group_add (XpadPadGroup *group, GtkWidget *pad) |
| 1213 | 114 | { | 123 | { |
| 1214 | 115 | g_object_ref(pad); | 124 | g_object_ref(pad); |
| 1216 | 116 | g_object_ref_sink(GTK_OBJECT(pad)); | 125 | // g_object_ref_sink(GTK_OBJECT(pad)); |
| 1217 | 117 | 126 | ||
| 1218 | 118 | group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad)); | 127 | group->priv->pads = g_slist_append (group->priv->pads, XPAD_PAD (pad)); |
| 1219 | 119 | g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group); | 128 | g_signal_connect_swapped (pad, "destroy", G_CALLBACK (xpad_pad_group_remove), group); |
| 1220 | @@ -121,21 +130,19 @@ | |||
| 1221 | 121 | g_signal_emit (group, signals[PAD_ADDED], 0, pad); | 130 | g_signal_emit (group, signals[PAD_ADDED], 0, pad); |
| 1222 | 122 | } | 131 | } |
| 1223 | 123 | 132 | ||
| 1226 | 124 | 133 | /* Remove a pad from this group */ | |
| 1225 | 125 | /* Removes a pad from this group */ | ||
| 1227 | 126 | void | 134 | void |
| 1228 | 127 | xpad_pad_group_remove (XpadPadGroup *group, GtkWidget *pad) | 135 | xpad_pad_group_remove (XpadPadGroup *group, GtkWidget *pad) |
| 1229 | 128 | { | 136 | { |
| 1230 | 129 | group->priv->pads = g_slist_remove (group->priv->pads, XPAD_PAD (pad)); | 137 | group->priv->pads = g_slist_remove (group->priv->pads, XPAD_PAD (pad)); |
| 1232 | 130 | 138 | g_object_unref(pad); | |
| 1233 | 139 | pad = NULL; | ||
| 1234 | 140 | |||
| 1235 | 131 | g_signal_emit (group, signals[PAD_REMOVED], 0, pad); | 141 | g_signal_emit (group, signals[PAD_REMOVED], 0, pad); |
| 1236 | 132 | |||
| 1237 | 133 | g_object_unref(pad); | ||
| 1238 | 134 | } | 142 | } |
| 1239 | 135 | 143 | ||
| 1243 | 136 | 144 | /* Delete all the current pads in the group */ | |
| 1244 | 137 | /* Deletes all the current pads in the group */ | 145 | void |
| 1242 | 138 | static void | ||
| 1245 | 139 | xpad_pad_group_destroy_pads (XpadPadGroup *group) | 146 | xpad_pad_group_destroy_pads (XpadPadGroup *group) |
| 1246 | 140 | { | 147 | { |
| 1247 | 141 | g_slist_foreach (group->priv->pads, (GFunc) gtk_widget_destroy, NULL); | 148 | g_slist_foreach (group->priv->pads, (GFunc) gtk_widget_destroy, NULL); |
| 1248 | @@ -143,6 +150,11 @@ | |||
| 1249 | 143 | group->priv->pads = NULL; | 150 | group->priv->pads = NULL; |
| 1250 | 144 | } | 151 | } |
| 1251 | 145 | 152 | ||
| 1252 | 153 | guint | ||
| 1253 | 154 | xpad_pad_group_num_pads (XpadPadGroup *group) | ||
| 1254 | 155 | { | ||
| 1255 | 156 | return g_slist_length(group->priv->pads); | ||
| 1256 | 157 | } | ||
| 1257 | 146 | 158 | ||
| 1258 | 147 | gint | 159 | gint |
| 1259 | 148 | xpad_pad_group_num_visible_pads (XpadPadGroup *group) | 160 | xpad_pad_group_num_visible_pads (XpadPadGroup *group) |
| 1260 | @@ -156,11 +168,11 @@ | |||
| 1261 | 156 | if (GTK_WIDGET_VISIBLE(GTK_WIDGET(i->data))) | 168 | if (GTK_WIDGET_VISIBLE(GTK_WIDGET(i->data))) |
| 1262 | 157 | num ++; | 169 | num ++; |
| 1263 | 158 | } | 170 | } |
| 1264 | 171 | g_slist_free(i); | ||
| 1265 | 159 | } | 172 | } |
| 1266 | 160 | return num; | 173 | return num; |
| 1267 | 161 | } | 174 | } |
| 1268 | 162 | 175 | ||
| 1269 | 163 | |||
| 1270 | 164 | void | 176 | void |
| 1271 | 165 | xpad_pad_group_close_all (XpadPadGroup *group) | 177 | xpad_pad_group_close_all (XpadPadGroup *group) |
| 1272 | 166 | { | 178 | { |
| 1273 | @@ -182,11 +194,9 @@ | |||
| 1274 | 182 | g_slist_foreach (group->priv->pads, (GFunc) gtk_widget_show, NULL); | 194 | g_slist_foreach (group->priv->pads, (GFunc) gtk_widget_show, NULL); |
| 1275 | 183 | } | 195 | } |
| 1276 | 184 | 196 | ||
| 1277 | 185 | |||
| 1278 | 186 | void | 197 | void |
| 1279 | 187 | xpad_pad_group_toggle_hide(XpadPadGroup *group) | 198 | xpad_pad_group_toggle_hide(XpadPadGroup *group) |
| 1280 | 188 | { | 199 | { |
| 1281 | 189 | if (group) | 200 | if (group) |
| 1282 | 190 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_toggle, NULL); | 201 | g_slist_foreach (group->priv->pads, (GFunc) xpad_pad_toggle, NULL); |
| 1283 | 191 | } | 202 | } |
| 1284 | 192 | |||
| 1285 | 193 | 203 | ||
| 1286 | === modified file 'src/xpad-pad-group.h' | |||
| 1287 | --- src/xpad-pad-group.h 2013-10-09 14:46:10 +0000 | |||
| 1288 | +++ src/xpad-pad-group.h 2013-10-18 18:35:35 +0000 | |||
| 1289 | @@ -64,6 +64,7 @@ | |||
| 1290 | 64 | GSList * xpad_pad_group_get_pads (XpadPadGroup *group); | 64 | GSList * xpad_pad_group_get_pads (XpadPadGroup *group); |
| 1291 | 65 | gint xpad_pad_group_num_visible_pads (XpadPadGroup *group); | 65 | gint xpad_pad_group_num_visible_pads (XpadPadGroup *group); |
| 1292 | 66 | void xpad_pad_group_save_unsaved_all (XpadPadGroup *group); | 66 | void xpad_pad_group_save_unsaved_all (XpadPadGroup *group); |
| 1293 | 67 | void xpad_pad_group_destroy_pads (XpadPadGroup *group); | ||
| 1294 | 67 | 68 | ||
| 1295 | 68 | G_END_DECLS | 69 | G_END_DECLS |
| 1296 | 69 | 70 | ||
| 1297 | 70 | 71 | ||
| 1298 | === modified file 'src/xpad-pad-properties.c' | |||
| 1299 | --- src/xpad-pad-properties.c 2008-09-21 00:03:40 +0000 | |||
| 1300 | +++ src/xpad-pad-properties.c 2013-10-18 18:35:35 +0000 | |||
| 1301 | @@ -22,9 +22,6 @@ | |||
| 1302 | 22 | #include <glib/gi18n.h> | 22 | #include <glib/gi18n.h> |
| 1303 | 23 | #include "xpad-pad-properties.h" | 23 | #include "xpad-pad-properties.h" |
| 1304 | 24 | 24 | ||
| 1305 | 25 | G_DEFINE_TYPE(XpadPadProperties, xpad_pad_properties, GTK_TYPE_DIALOG) | ||
| 1306 | 26 | #define XPAD_PAD_PROPERTIES_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_PAD_PROPERTIES, XpadPadPropertiesPrivate)) | ||
| 1307 | 27 | |||
| 1308 | 28 | struct XpadPadPropertiesPrivate | 25 | struct XpadPadPropertiesPrivate |
| 1309 | 29 | { | 26 | { |
| 1310 | 30 | GtkWidget *fontcheck; | 27 | GtkWidget *fontcheck; |
| 1311 | @@ -40,6 +37,10 @@ | |||
| 1312 | 40 | GtkWidget *fontbutton; | 37 | GtkWidget *fontbutton; |
| 1313 | 41 | }; | 38 | }; |
| 1314 | 42 | 39 | ||
| 1315 | 40 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPadProperties, xpad_pad_properties, GTK_TYPE_DIALOG) | ||
| 1316 | 41 | |||
| 1317 | 42 | static void xpad_pad_properties_dispose (GObject *object); | ||
| 1318 | 43 | static void xpad_pad_properties_finalize (GObject *object); | ||
| 1319 | 43 | static void xpad_pad_properties_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | 44 | static void xpad_pad_properties_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
| 1320 | 44 | static void xpad_pad_properties_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | 45 | static void xpad_pad_properties_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
| 1321 | 45 | static void xpad_pad_properties_response (GtkDialog *dialog, gint response); | 46 | static void xpad_pad_properties_response (GtkDialog *dialog, gint response); |
| 1322 | @@ -71,6 +72,8 @@ | |||
| 1323 | 71 | { | 72 | { |
| 1324 | 72 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 73 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 1325 | 73 | 74 | ||
| 1326 | 75 | gobject_class->dispose = xpad_pad_properties_dispose; | ||
| 1327 | 76 | gobject_class->finalize = xpad_pad_properties_finalize; | ||
| 1328 | 74 | gobject_class->set_property = xpad_pad_properties_set_property; | 77 | gobject_class->set_property = xpad_pad_properties_set_property; |
| 1329 | 75 | gobject_class->get_property = xpad_pad_properties_get_property; | 78 | gobject_class->get_property = xpad_pad_properties_get_property; |
| 1330 | 76 | 79 | ||
| 1331 | @@ -115,8 +118,6 @@ | |||
| 1332 | 115 | "The name of the font for the pad", | 118 | "The name of the font for the pad", |
| 1333 | 116 | NULL, | 119 | NULL, |
| 1334 | 117 | G_PARAM_READWRITE)); | 120 | G_PARAM_READWRITE)); |
| 1335 | 118 | |||
| 1336 | 119 | g_type_class_add_private (gobject_class, sizeof (XpadPadPropertiesPrivate)); | ||
| 1337 | 120 | } | 121 | } |
| 1338 | 121 | 122 | ||
| 1339 | 122 | static void | 123 | static void |
| 1340 | @@ -127,7 +128,7 @@ | |||
| 1341 | 127 | gchar *text; | 128 | gchar *text; |
| 1342 | 128 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | 129 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
| 1343 | 129 | 130 | ||
| 1345 | 130 | prop->priv = XPAD_PAD_PROPERTIES_GET_PRIVATE (prop); | 131 | prop->priv = xpad_pad_properties_get_instance_private(prop); |
| 1346 | 131 | 132 | ||
| 1347 | 132 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); | 133 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); |
| 1348 | 133 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | 134 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
| 1349 | @@ -233,6 +234,25 @@ | |||
| 1350 | 233 | } | 234 | } |
| 1351 | 234 | 235 | ||
| 1352 | 235 | static void | 236 | static void |
| 1353 | 237 | xpad_pad_properties_dispose (GObject *object) | ||
| 1354 | 238 | { | ||
| 1355 | 239 | G_OBJECT_CLASS (xpad_pad_properties_parent_class)->dispose (object); | ||
| 1356 | 240 | } | ||
| 1357 | 241 | |||
| 1358 | 242 | static void | ||
| 1359 | 243 | xpad_pad_properties_finalize (GObject *object) | ||
| 1360 | 244 | { | ||
| 1361 | 245 | XpadPadProperties *prop = XPAD_PAD_PROPERTIES (object); | ||
| 1362 | 246 | |||
| 1363 | 247 | if (&prop->priv->texttmp) | ||
| 1364 | 248 | gdk_color_free (&prop->priv->texttmp); | ||
| 1365 | 249 | if (&prop->priv->backtmp != NULL) | ||
| 1366 | 250 | gdk_color_free (&prop->priv->backtmp); | ||
| 1367 | 251 | |||
| 1368 | 252 | G_OBJECT_CLASS (xpad_pad_properties_parent_class)->finalize (object); | ||
| 1369 | 253 | } | ||
| 1370 | 254 | |||
| 1371 | 255 | static void | ||
| 1372 | 236 | xpad_pad_properties_response (GtkDialog *dialog, gint response) | 256 | xpad_pad_properties_response (GtkDialog *dialog, gint response) |
| 1373 | 237 | { | 257 | { |
| 1374 | 238 | if (response == GTK_RESPONSE_CLOSE) | 258 | if (response == GTK_RESPONSE_CLOSE) |
| 1375 | 239 | 259 | ||
| 1376 | === modified file 'src/xpad-pad.c' | |||
| 1377 | --- src/xpad-pad.c 2013-10-11 19:45:49 +0000 | |||
| 1378 | +++ src/xpad-pad.c 2013-10-18 18:35:35 +0000 | |||
| 1379 | @@ -40,13 +40,11 @@ | |||
| 1380 | 40 | #include "xpad-toolbar.h" | 40 | #include "xpad-toolbar.h" |
| 1381 | 41 | #include "xpad-tray.h" | 41 | #include "xpad-tray.h" |
| 1382 | 42 | 42 | ||
| 1383 | 43 | G_DEFINE_TYPE(XpadPad, xpad_pad, GTK_TYPE_WINDOW) | ||
| 1384 | 44 | #define XPAD_PAD_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_PAD, XpadPadPrivate)) | ||
| 1385 | 45 | |||
| 1386 | 46 | struct XpadPadPrivate | 43 | struct XpadPadPrivate |
| 1387 | 47 | { | 44 | { |
| 1388 | 48 | /* saved values */ | 45 | /* saved values */ |
| 1390 | 49 | gint x, y, width, height; | 46 | gint x, y; |
| 1391 | 47 | guint width, height; | ||
| 1392 | 50 | gboolean location_valid; | 48 | gboolean location_valid; |
| 1393 | 51 | gchar *infoname; | 49 | gchar *infoname; |
| 1394 | 52 | gchar *contentname; | 50 | gchar *contentname; |
| 1395 | @@ -59,7 +57,7 @@ | |||
| 1396 | 59 | /* toolbar stuff */ | 57 | /* toolbar stuff */ |
| 1397 | 60 | GtkWidget *toolbar; | 58 | GtkWidget *toolbar; |
| 1398 | 61 | guint toolbar_timeout; | 59 | guint toolbar_timeout; |
| 1400 | 62 | gint toolbar_height; | 60 | guint toolbar_height; |
| 1401 | 63 | gboolean toolbar_expanded; | 61 | gboolean toolbar_expanded; |
| 1402 | 64 | gboolean toolbar_pad_resized; | 62 | gboolean toolbar_pad_resized; |
| 1403 | 65 | 63 | ||
| 1404 | @@ -72,10 +70,14 @@ | |||
| 1405 | 72 | 70 | ||
| 1406 | 73 | gboolean unsaved_content; | 71 | gboolean unsaved_content; |
| 1407 | 74 | gboolean unsaved_info; | 72 | gboolean unsaved_info; |
| 1408 | 73 | |||
| 1409 | 74 | GtkClipboard *clipboard; | ||
| 1410 | 75 | 75 | ||
| 1411 | 76 | XpadPadGroup *group; | 76 | XpadPadGroup *group; |
| 1412 | 77 | }; | 77 | }; |
| 1413 | 78 | 78 | ||
| 1414 | 79 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPad, xpad_pad, GTK_TYPE_WINDOW) | ||
| 1415 | 80 | |||
| 1416 | 79 | enum | 81 | enum |
| 1417 | 80 | { | 82 | { |
| 1418 | 81 | CLOSED, | 83 | CLOSED, |
| 1419 | @@ -221,8 +223,6 @@ | |||
| 1420 | 221 | "Pad Group", | 223 | "Pad Group", |
| 1421 | 222 | "Pad group for this pad", | 224 | "Pad group for this pad", |
| 1422 | 223 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | 225 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
| 1423 | 224 | |||
| 1424 | 225 | g_type_class_add_private (gobject_class, sizeof (XpadPadPrivate)); | ||
| 1425 | 226 | } | 226 | } |
| 1426 | 227 | 227 | ||
| 1427 | 228 | /* Class pad - initializer */ | 228 | /* Class pad - initializer */ |
| 1428 | @@ -231,9 +231,8 @@ | |||
| 1429 | 231 | { | 231 | { |
| 1430 | 232 | GtkWidget *vbox; | 232 | GtkWidget *vbox; |
| 1431 | 233 | GtkAccelGroup *accel_group; | 233 | GtkAccelGroup *accel_group; |
| 1432 | 234 | GtkClipboard *clipboard; | ||
| 1433 | 235 | 234 | ||
| 1435 | 236 | pad->priv = XPAD_PAD_GET_PRIVATE (pad); | 235 | pad->priv = xpad_pad_get_instance_private(pad); |
| 1436 | 237 | 236 | ||
| 1437 | 238 | pad->priv->x = 0; | 237 | pad->priv->x = 0; |
| 1438 | 239 | pad->priv->y = 0; | 238 | pad->priv->y = 0; |
| 1439 | @@ -251,8 +250,8 @@ | |||
| 1440 | 251 | pad->priv->toolbar_expanded = FALSE; | 250 | pad->priv->toolbar_expanded = FALSE; |
| 1441 | 252 | pad->priv->toolbar_pad_resized = TRUE; | 251 | pad->priv->toolbar_pad_resized = TRUE; |
| 1442 | 253 | pad->priv->properties = NULL; | 252 | pad->priv->properties = NULL; |
| 1445 | 254 | pad->priv->unsaved_content = TRUE; | 253 | pad->priv->unsaved_content = FALSE; |
| 1446 | 255 | pad->priv->unsaved_info = TRUE; | 254 | pad->priv->unsaved_info = FALSE; |
| 1447 | 256 | pad->priv->group = NULL; | 255 | pad->priv->group = NULL; |
| 1448 | 257 | 256 | ||
| 1449 | 258 | XpadTextView *text_view = g_object_new (XPAD_TYPE_TEXT_VIEW, | 257 | XpadTextView *text_view = g_object_new (XPAD_TYPE_TEXT_VIEW, |
| 1450 | @@ -277,12 +276,11 @@ | |||
| 1451 | 277 | 276 | ||
| 1452 | 278 | accel_group = gtk_accel_group_new (); | 277 | accel_group = gtk_accel_group_new (); |
| 1453 | 279 | gtk_window_add_accel_group (GTK_WINDOW (pad), accel_group); | 278 | gtk_window_add_accel_group (GTK_WINDOW (pad), accel_group); |
| 1454 | 280 | g_object_unref (G_OBJECT (accel_group)); | ||
| 1455 | 281 | pad->priv->menu = menu_get_popup_no_highlight (pad, accel_group); | 279 | pad->priv->menu = menu_get_popup_no_highlight (pad, accel_group); |
| 1456 | 282 | pad->priv->highlight_menu = menu_get_popup_highlight (pad, accel_group); | 280 | pad->priv->highlight_menu = menu_get_popup_highlight (pad, accel_group); |
| 1457 | 283 | gtk_accel_group_connect (accel_group, GDK_Q, GDK_CONTROL_MASK, 0, | 281 | gtk_accel_group_connect (accel_group, GDK_Q, GDK_CONTROL_MASK, 0, |
| 1458 | 284 | g_cclosure_new_swap (G_CALLBACK (xpad_pad_quit), pad, NULL)); | 282 | g_cclosure_new_swap (G_CALLBACK (xpad_pad_quit), pad, NULL)); |
| 1460 | 285 | 283 | g_object_unref (G_OBJECT (accel_group)); | |
| 1461 | 286 | 284 | ||
| 1462 | 287 | vbox = GTK_WIDGET (g_object_new (GTK_TYPE_VBOX, | 285 | vbox = GTK_WIDGET (g_object_new (GTK_TYPE_VBOX, |
| 1463 | 288 | "homogeneous", FALSE, | 286 | "homogeneous", FALSE, |
| 1464 | @@ -293,7 +291,7 @@ | |||
| 1465 | 293 | gtk_container_child_set (GTK_CONTAINER (vbox), pad->priv->toolbar, "expand", FALSE, NULL); | 291 | gtk_container_child_set (GTK_CONTAINER (vbox), pad->priv->toolbar, "expand", FALSE, NULL); |
| 1466 | 294 | 292 | ||
| 1467 | 295 | gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_settings ())); | 293 | gtk_window_set_decorated (GTK_WINDOW(pad), xpad_settings_get_has_decorations (xpad_settings ())); |
| 1469 | 296 | gtk_window_set_default_size (GTK_WINDOW(pad), xpad_settings_get_width (xpad_settings ()), xpad_settings_get_height (xpad_settings ())); | 294 | gtk_window_set_default_size (GTK_WINDOW(pad), (gint) xpad_settings_get_width (xpad_settings ()), (gint) xpad_settings_get_height (xpad_settings ())); |
| 1470 | 297 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */ | 295 | gtk_window_set_gravity (GTK_WINDOW(pad), GDK_GRAVITY_STATIC); /* static gravity makes saving pad x,y work */ |
| 1471 | 298 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_settings ())); | 296 | gtk_window_set_skip_pager_hint (GTK_WINDOW(pad),xpad_settings_get_has_decorations (xpad_settings ())); |
| 1472 | 299 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_settings ())); | 297 | gtk_window_set_skip_taskbar_hint (GTK_WINDOW(pad), !xpad_settings_get_has_decorations (xpad_settings ())); |
| 1473 | @@ -309,7 +307,19 @@ | |||
| 1474 | 309 | xpad_pad_notify_clipboard_owner_changed (pad); | 307 | xpad_pad_notify_clipboard_owner_changed (pad); |
| 1475 | 310 | xpad_pad_notify_undo_redo_changed (pad); | 308 | xpad_pad_notify_undo_redo_changed (pad); |
| 1476 | 311 | 309 | ||
| 1478 | 312 | clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); | 310 | pad->priv->clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); |
| 1479 | 311 | |||
| 1480 | 312 | if (pad->priv->sticky) | ||
| 1481 | 313 | gtk_window_stick (GTK_WINDOW (pad)); | ||
| 1482 | 314 | else | ||
| 1483 | 315 | gtk_window_unstick (GTK_WINDOW (pad)); | ||
| 1484 | 316 | |||
| 1485 | 317 | xpad_pad_sync_title (pad); | ||
| 1486 | 318 | |||
| 1487 | 319 | gtk_widget_show_all (vbox); | ||
| 1488 | 320 | |||
| 1489 | 321 | gtk_widget_hide (pad->priv->toolbar); | ||
| 1490 | 322 | xpad_pad_notify_has_toolbar (pad); | ||
| 1491 | 313 | 323 | ||
| 1492 | 314 | /* Set up signals */ | 324 | /* Set up signals */ |
| 1493 | 315 | gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK); | 325 | gtk_widget_add_events (GTK_WIDGET (pad), GDK_BUTTON_PRESS_MASK | GDK_PROPERTY_CHANGE_MASK); |
| 1494 | @@ -332,7 +342,7 @@ | |||
| 1495 | 332 | g_signal_connect_swapped (xpad_settings (), "notify::autohide-toolbar", G_CALLBACK (xpad_pad_notify_autohide_toolbar), pad); | 342 | g_signal_connect_swapped (xpad_settings (), "notify::autohide-toolbar", G_CALLBACK (xpad_pad_notify_autohide_toolbar), pad); |
| 1496 | 333 | g_signal_connect_swapped (xpad_settings (), "notify::has-scrollbar", G_CALLBACK (xpad_pad_notify_has_scrollbar), pad); | 343 | g_signal_connect_swapped (xpad_settings (), "notify::has-scrollbar", G_CALLBACK (xpad_pad_notify_has_scrollbar), pad); |
| 1497 | 334 | g_signal_connect_swapped (gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)), "notify::has-selection", G_CALLBACK (xpad_pad_notify_has_selection), pad); | 344 | g_signal_connect_swapped (gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)), "notify::has-selection", G_CALLBACK (xpad_pad_notify_has_selection), pad); |
| 1499 | 335 | g_signal_connect_swapped (clipboard, "owner-change", G_CALLBACK (xpad_pad_notify_clipboard_owner_changed), pad); | 345 | g_signal_connect_swapped (pad->priv->clipboard, "owner-change", G_CALLBACK (xpad_pad_notify_clipboard_owner_changed), pad); |
| 1500 | 336 | 346 | ||
| 1501 | 337 | g_signal_connect_swapped (pad->priv->toolbar, "activate-new", G_CALLBACK (xpad_pad_spawn), pad); | 347 | g_signal_connect_swapped (pad->priv->toolbar, "activate-new", G_CALLBACK (xpad_pad_spawn), pad); |
| 1502 | 338 | g_signal_connect_swapped (pad->priv->toolbar, "activate-clear", G_CALLBACK (xpad_pad_clear), pad); | 348 | g_signal_connect_swapped (pad->priv->toolbar, "activate-clear", G_CALLBACK (xpad_pad_clear), pad); |
| 1503 | @@ -352,18 +362,6 @@ | |||
| 1504 | 352 | 362 | ||
| 1505 | 353 | g_signal_connect (pad->priv->menu, "deactivate", G_CALLBACK (xpad_pad_popup_deactivate), pad); | 363 | g_signal_connect (pad->priv->menu, "deactivate", G_CALLBACK (xpad_pad_popup_deactivate), pad); |
| 1506 | 354 | g_signal_connect (pad->priv->highlight_menu, "deactivate", G_CALLBACK (xpad_pad_popup_deactivate), pad); | 364 | g_signal_connect (pad->priv->highlight_menu, "deactivate", G_CALLBACK (xpad_pad_popup_deactivate), pad); |
| 1507 | 355 | |||
| 1508 | 356 | if (pad->priv->sticky) | ||
| 1509 | 357 | gtk_window_stick (GTK_WINDOW (pad)); | ||
| 1510 | 358 | else | ||
| 1511 | 359 | gtk_window_unstick (GTK_WINDOW (pad)); | ||
| 1512 | 360 | |||
| 1513 | 361 | xpad_pad_sync_title (pad); | ||
| 1514 | 362 | |||
| 1515 | 363 | gtk_widget_show_all (vbox); | ||
| 1516 | 364 | |||
| 1517 | 365 | gtk_widget_hide (pad->priv->toolbar); | ||
| 1518 | 366 | xpad_pad_notify_has_toolbar (pad); | ||
| 1519 | 367 | } | 365 | } |
| 1520 | 368 | 366 | ||
| 1521 | 369 | static void | 367 | static void |
| 1522 | @@ -389,18 +387,31 @@ | |||
| 1523 | 389 | xpad_pad_dispose (GObject *object) | 387 | xpad_pad_dispose (GObject *object) |
| 1524 | 390 | { | 388 | { |
| 1525 | 391 | XpadPad *pad = XPAD_PAD (object); | 389 | XpadPad *pad = XPAD_PAD (object); |
| 1538 | 392 | 390 | ||
| 1539 | 393 | if (pad->priv->toolbar_timeout) | 391 | if (pad->priv->group) { |
| 1540 | 394 | { | 392 | g_object_unref(pad->priv->group); |
| 1541 | 395 | g_source_remove (pad->priv->toolbar_timeout); | 393 | pad->priv->group = NULL; |
| 1542 | 396 | pad->priv->toolbar_timeout = 0; | 394 | } |
| 1543 | 397 | } | 395 | |
| 1544 | 398 | 396 | if (GTK_IS_WIDGET(pad->priv->menu)) { | |
| 1545 | 399 | if (pad->priv->properties) | 397 | gtk_widget_destroy (pad->priv->menu); |
| 1546 | 400 | gtk_widget_destroy (pad->priv->properties); | 398 | pad->priv->menu = NULL; |
| 1547 | 401 | 399 | } | |
| 1548 | 402 | gtk_widget_destroy (pad->priv->menu); | 400 | |
| 1549 | 403 | gtk_widget_destroy (pad->priv->highlight_menu); | 401 | if (GTK_IS_WIDGET(pad->priv->highlight_menu)) { |
| 1550 | 402 | gtk_widget_destroy (pad->priv->highlight_menu); | ||
| 1551 | 403 | pad->priv->highlight_menu = NULL; | ||
| 1552 | 404 | } | ||
| 1553 | 405 | |||
| 1554 | 406 | if (GTK_IS_CLIPBOARD(pad->priv->clipboard)) { | ||
| 1555 | 407 | // For some reason the clipboard handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. | ||
| 1556 | 408 | g_signal_handlers_disconnect_matched (pad->priv->clipboard, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | ||
| 1557 | 409 | } | ||
| 1558 | 410 | |||
| 1559 | 411 | if (GTK_IS_TOOLBAR(pad->priv->toolbar)) { | ||
| 1560 | 412 | // For some reason the toolbar handler does not get automatically disconnected (or not at the right moment), leading to errors after deleting a pad. This manual disconnect prevents this error. | ||
| 1561 | 413 | g_signal_handlers_disconnect_matched (pad->priv->toolbar, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | ||
| 1562 | 414 | } | ||
| 1563 | 404 | 415 | ||
| 1564 | 405 | G_OBJECT_CLASS (xpad_pad_parent_class)->dispose (object); | 416 | G_OBJECT_CLASS (xpad_pad_parent_class)->dispose (object); |
| 1565 | 406 | } | 417 | } |
| 1566 | @@ -409,12 +420,12 @@ | |||
| 1567 | 409 | xpad_pad_finalize (GObject *object) | 420 | xpad_pad_finalize (GObject *object) |
| 1568 | 410 | { | 421 | { |
| 1569 | 411 | XpadPad *pad = XPAD_PAD (object); | 422 | XpadPad *pad = XPAD_PAD (object); |
| 1571 | 412 | 423 | ||
| 1572 | 424 | g_signal_handlers_disconnect_matched (xpad_settings (), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | ||
| 1573 | 425 | |||
| 1574 | 413 | g_free (pad->priv->infoname); | 426 | g_free (pad->priv->infoname); |
| 1575 | 414 | g_free (pad->priv->contentname); | 427 | g_free (pad->priv->contentname); |
| 1576 | 415 | 428 | ||
| 1577 | 416 | g_signal_handlers_disconnect_matched (xpad_settings (), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pad); | ||
| 1578 | 417 | |||
| 1579 | 418 | G_OBJECT_CLASS (xpad_pad_parent_class)->finalize (object); | 429 | G_OBJECT_CLASS (xpad_pad_parent_class)->finalize (object); |
| 1580 | 419 | } | 430 | } |
| 1581 | 420 | 431 | ||
| 1582 | @@ -458,11 +469,11 @@ | |||
| 1583 | 458 | /* reshow_with_initial_size() seems to set the window back to a never-shown state. | 469 | /* reshow_with_initial_size() seems to set the window back to a never-shown state. |
| 1584 | 459 | This is good, as some WMs don't like us changing the above parameters mid-run, | 470 | This is good, as some WMs don't like us changing the above parameters mid-run, |
| 1585 | 460 | even if we do a hide/show cycle. */ | 471 | even if we do a hide/show cycle. */ |
| 1587 | 461 | gtk_window_set_default_size (GTK_WINDOW (pad), pad->priv->width, pad->priv->height); | 472 | gtk_window_set_default_size (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); |
| 1588 | 462 | gtk_window_reshow_with_initial_size (GTK_WINDOW (pad)); | 473 | gtk_window_reshow_with_initial_size (GTK_WINDOW (pad)); |
| 1589 | 463 | } | 474 | } |
| 1590 | 464 | 475 | ||
| 1592 | 465 | static gint | 476 | static guint |
| 1593 | 466 | xpad_pad_text_and_toolbar_height (XpadPad *pad) | 477 | xpad_pad_text_and_toolbar_height (XpadPad *pad) |
| 1594 | 467 | { | 478 | { |
| 1595 | 468 | GdkRectangle rec; | 479 | GdkRectangle rec; |
| 1596 | @@ -477,7 +488,14 @@ | |||
| 1597 | 477 | &textx, &texty); | 488 | &textx, &texty); |
| 1598 | 478 | gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y); | 489 | gtk_widget_translate_coordinates(pad->priv->textview, GTK_WIDGET(pad), textx, texty, &x, &y); |
| 1599 | 479 | 490 | ||
| 1601 | 480 | return y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview)); | 491 | // Safe cast from gint to guint |
| 1602 | 492 | if (y >= 0) { | ||
| 1603 | 493 | return (guint) y + pad->priv->toolbar_height + gtk_container_get_border_width(GTK_CONTAINER(pad->priv->textview)); | ||
| 1604 | 494 | } | ||
| 1605 | 495 | else { | ||
| 1606 | 496 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_toolbar_size_allocate' the variable 'event->height' is not a postive number. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1607 | 497 | return 0; | ||
| 1608 | 498 | } | ||
| 1609 | 481 | } | 499 | } |
| 1610 | 482 | 500 | ||
| 1611 | 483 | static void | 501 | static void |
| 1612 | @@ -493,7 +511,14 @@ | |||
| 1613 | 493 | if (!pad->priv->toolbar_height) | 511 | if (!pad->priv->toolbar_height) |
| 1614 | 494 | { | 512 | { |
| 1615 | 495 | gtk_widget_size_request (pad->priv->toolbar, &req); | 513 | gtk_widget_size_request (pad->priv->toolbar, &req); |
| 1617 | 496 | pad->priv->toolbar_height = req.height; | 514 | // safe cast from gint to guint |
| 1618 | 515 | if (req.height >= 0) { | ||
| 1619 | 516 | pad->priv->toolbar_height = (guint) req.height; | ||
| 1620 | 517 | } | ||
| 1621 | 518 | else { | ||
| 1622 | 519 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_show_toolbar' the variable 'req.height' is not a postive number. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1623 | 520 | pad->priv->toolbar_height = 0; | ||
| 1624 | 521 | } | ||
| 1625 | 497 | } | 522 | } |
| 1626 | 498 | 523 | ||
| 1627 | 499 | /* Do we have room for the toolbar without covering text? */ | 524 | /* Do we have room for the toolbar without covering text? */ |
| 1628 | @@ -501,7 +526,7 @@ | |||
| 1629 | 501 | { | 526 | { |
| 1630 | 502 | pad->priv->toolbar_expanded = TRUE; | 527 | pad->priv->toolbar_expanded = TRUE; |
| 1631 | 503 | pad->priv->height += pad->priv->toolbar_height; | 528 | pad->priv->height += pad->priv->toolbar_height; |
| 1633 | 504 | gtk_window_resize (GTK_WINDOW (pad), pad->priv->width, pad->priv->height); | 529 | gtk_window_resize (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); |
| 1634 | 505 | } | 530 | } |
| 1635 | 506 | else | 531 | else |
| 1636 | 507 | pad->priv->toolbar_expanded = FALSE; | 532 | pad->priv->toolbar_expanded = FALSE; |
| 1637 | @@ -526,7 +551,7 @@ | |||
| 1638 | 526 | (pad->priv->toolbar_pad_resized && xpad_pad_text_and_toolbar_height (pad) >= pad->priv->height)) | 551 | (pad->priv->toolbar_pad_resized && xpad_pad_text_and_toolbar_height (pad) >= pad->priv->height)) |
| 1639 | 527 | { | 552 | { |
| 1640 | 528 | pad->priv->height -= pad->priv->toolbar_height; | 553 | pad->priv->height -= pad->priv->toolbar_height; |
| 1642 | 529 | gtk_window_resize (GTK_WINDOW (pad), pad->priv->width, pad->priv->height); | 554 | gtk_window_resize (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); |
| 1643 | 530 | pad->priv->toolbar_expanded = FALSE; | 555 | pad->priv->toolbar_expanded = FALSE; |
| 1644 | 531 | } | 556 | } |
| 1645 | 532 | if (GTK_WIDGET (pad)->window) | 557 | if (GTK_WIDGET (pad)->window) |
| 1646 | @@ -549,6 +574,9 @@ | |||
| 1647 | 549 | static gboolean | 574 | static gboolean |
| 1648 | 550 | toolbar_timeout (XpadPad *pad) | 575 | toolbar_timeout (XpadPad *pad) |
| 1649 | 551 | { | 576 | { |
| 1650 | 577 | if (pad || !pad->priv || !pad->priv->toolbar_timeout) | ||
| 1651 | 578 | return FALSE; | ||
| 1652 | 579 | |||
| 1653 | 552 | if (pad->priv->toolbar_timeout && | 580 | if (pad->priv->toolbar_timeout && |
| 1654 | 553 | xpad_settings_get_autohide_toolbar (xpad_settings ()) && | 581 | xpad_settings_get_autohide_toolbar (xpad_settings ()) && |
| 1655 | 554 | xpad_settings_get_has_toolbar (xpad_settings ())) | 582 | xpad_settings_get_has_toolbar (xpad_settings ())) |
| 1656 | @@ -597,11 +625,17 @@ | |||
| 1657 | 597 | g_return_if_fail (pad); | 625 | g_return_if_fail (pad); |
| 1658 | 598 | 626 | ||
| 1659 | 599 | XpadToolbar *toolbar = NULL; | 627 | XpadToolbar *toolbar = NULL; |
| 1662 | 600 | toolbar = XPAD_TOOLBAR (pad->priv->toolbar); | 628 | // safe cast to toolbar |
| 1663 | 601 | g_return_if_fail (toolbar); | 629 | if (XPAD_IS_TOOLBAR(pad->priv->toolbar)) { |
| 1664 | 630 | toolbar = XPAD_TOOLBAR (pad->priv->toolbar); | ||
| 1665 | 631 | g_return_if_fail (toolbar); | ||
| 1666 | 602 | 632 | ||
| 1669 | 603 | GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); | 633 | GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); |
| 1670 | 604 | xpad_toolbar_enable_paste_button (toolbar, gtk_clipboard_wait_is_text_available (clipboard)); | 634 | xpad_toolbar_enable_paste_button (toolbar, gtk_clipboard_wait_is_text_available (clipboard)); |
| 1671 | 635 | } | ||
| 1672 | 636 | else { | ||
| 1673 | 637 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_notify_clipboard_owner_changed' the variable 'pad->priv->toolbar' is not of type toolbar. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1674 | 638 | } | ||
| 1675 | 605 | } | 639 | } |
| 1676 | 606 | 640 | ||
| 1677 | 607 | void | 641 | void |
| 1678 | @@ -722,6 +756,12 @@ | |||
| 1679 | 722 | static void | 756 | static void |
| 1680 | 723 | xpad_pad_delete (XpadPad *pad) | 757 | xpad_pad_delete (XpadPad *pad) |
| 1681 | 724 | { | 758 | { |
| 1682 | 759 | g_return_if_fail (pad); | ||
| 1683 | 760 | |||
| 1684 | 761 | // With the delayed saving functionality, it is necessary to clear the unsaved flags to prevent usage of non-existing object information. | ||
| 1685 | 762 | pad->priv->unsaved_info = FALSE; | ||
| 1686 | 763 | pad->priv->unsaved_content = FALSE; | ||
| 1687 | 764 | |||
| 1688 | 725 | if (should_confirm_delete (pad)) | 765 | if (should_confirm_delete (pad)) |
| 1689 | 726 | { | 766 | { |
| 1690 | 727 | GtkWidget *dialog; | 767 | GtkWidget *dialog; |
| 1691 | @@ -744,11 +784,13 @@ | |||
| 1692 | 744 | return; | 784 | return; |
| 1693 | 745 | } | 785 | } |
| 1694 | 746 | 786 | ||
| 1695 | 787 | // These two if statements actually erase the pad on the harddisk. | ||
| 1696 | 747 | if (pad->priv->infoname) | 788 | if (pad->priv->infoname) |
| 1697 | 748 | fio_remove_file (pad->priv->infoname); | 789 | fio_remove_file (pad->priv->infoname); |
| 1698 | 749 | if (pad->priv->contentname) | 790 | if (pad->priv->contentname) |
| 1699 | 750 | fio_remove_file (pad->priv->contentname); | 791 | fio_remove_file (pad->priv->contentname); |
| 1700 | 751 | 792 | ||
| 1701 | 793 | // Remove the pad from the group and destroy it. | ||
| 1702 | 752 | gtk_widget_destroy (GTK_WIDGET (pad)); | 794 | gtk_widget_destroy (GTK_WIDGET (pad)); |
| 1703 | 753 | } | 795 | } |
| 1704 | 754 | 796 | ||
| 1705 | @@ -915,7 +957,14 @@ | |||
| 1706 | 915 | static gboolean | 957 | static gboolean |
| 1707 | 916 | xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event) | 958 | xpad_pad_toolbar_size_allocate (XpadPad *pad, GtkAllocation *event) |
| 1708 | 917 | { | 959 | { |
| 1710 | 918 | pad->priv->toolbar_height = event->height; | 960 | // safe cast from gint to guint |
| 1711 | 961 | if (event->height >= 0) { | ||
| 1712 | 962 | pad->priv->toolbar_height = (guint) event->height; | ||
| 1713 | 963 | } | ||
| 1714 | 964 | else { | ||
| 1715 | 965 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_toolbar_size_allocate' the variable 'event->height' is not a postive number. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1716 | 966 | pad->priv->toolbar_height = 0; | ||
| 1717 | 967 | } | ||
| 1718 | 919 | return FALSE; | 968 | return FALSE; |
| 1719 | 920 | } | 969 | } |
| 1720 | 921 | 970 | ||
| 1721 | @@ -924,17 +973,27 @@ | |||
| 1722 | 924 | { | 973 | { |
| 1723 | 925 | if (!GTK_WIDGET_VISIBLE (pad)) | 974 | if (!GTK_WIDGET_VISIBLE (pad)) |
| 1724 | 926 | return FALSE; | 975 | return FALSE; |
| 1725 | 976 | |||
| 1726 | 977 | int eWidth = event->width; | ||
| 1727 | 978 | int eHeight = event->height; | ||
| 1728 | 927 | 979 | ||
| 1731 | 928 | if (pad->priv->width != event->width || pad->priv->height != event->height) | 980 | // safe cast from gint to guint |
| 1732 | 929 | pad->priv->toolbar_pad_resized = TRUE; | 981 | if (eWidth >= 0 && eHeight >=0 ) { |
| 1733 | 982 | if (pad->priv->width != (guint) eWidth || pad->priv->height != (guint) eHeight) | ||
| 1734 | 983 | pad->priv->toolbar_pad_resized = TRUE; | ||
| 1735 | 984 | |||
| 1736 | 985 | pad->priv->width = (guint) event->width; | ||
| 1737 | 986 | pad->priv->height = (guint) event->height; | ||
| 1738 | 987 | } | ||
| 1739 | 988 | else { | ||
| 1740 | 989 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_configure_event' the variable 'event->width' or 'event->height' is not a postive number. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1741 | 990 | } | ||
| 1742 | 930 | 991 | ||
| 1743 | 931 | pad->priv->x = event->x; | 992 | pad->priv->x = event->x; |
| 1744 | 932 | pad->priv->y = event->y; | 993 | pad->priv->y = event->y; |
| 1745 | 933 | pad->priv->width = event->width; | ||
| 1746 | 934 | pad->priv->height = event->height; | ||
| 1747 | 935 | pad->priv->location_valid = TRUE; | 994 | pad->priv->location_valid = TRUE; |
| 1748 | 936 | 995 | ||
| 1750 | 937 | xpad_pad_save_content_delayed(pad); | 996 | xpad_pad_save_info_delayed(pad); |
| 1751 | 938 | 997 | ||
| 1752 | 939 | /* Sometimes when moving, if the toolbar tries to hide itself, | 998 | /* Sometimes when moving, if the toolbar tries to hide itself, |
| 1753 | 940 | the window manager will not resize it correctly. So, we make | 999 | the window manager will not resize it correctly. So, we make |
| 1754 | @@ -974,7 +1033,7 @@ | |||
| 1755 | 974 | case 1: | 1033 | case 1: |
| 1756 | 975 | if ((event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK) | 1034 | if ((event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK) |
| 1757 | 976 | { | 1035 | { |
| 1759 | 977 | gtk_window_begin_move_drag (GTK_WINDOW (pad), event->button, event->x_root, event->y_root, event->time); | 1036 | gtk_window_begin_move_drag (GTK_WINDOW (pad), (gint) event->button, (gint) event->x_root, (gint) event->y_root, event->time); |
| 1760 | 978 | return TRUE; | 1037 | return TRUE; |
| 1761 | 979 | } | 1038 | } |
| 1762 | 980 | break; | 1039 | break; |
| 1763 | @@ -989,7 +1048,7 @@ | |||
| 1764 | 989 | else | 1048 | else |
| 1765 | 990 | edge = GDK_WINDOW_EDGE_SOUTH_WEST; | 1049 | edge = GDK_WINDOW_EDGE_SOUTH_WEST; |
| 1766 | 991 | 1050 | ||
| 1768 | 992 | gtk_window_begin_resize_drag (GTK_WINDOW (pad), edge, event->button, event->x_root, event->y_root, event->time); | 1051 | gtk_window_begin_resize_drag (GTK_WINDOW (pad), edge, (gint) event->button, (gint) event->x_root, (gint) event->y_root, event->time); |
| 1769 | 993 | } | 1052 | } |
| 1770 | 994 | else | 1053 | else |
| 1771 | 995 | { | 1054 | { |
| 1772 | @@ -1010,7 +1069,7 @@ | |||
| 1773 | 1010 | switch (event->button) | 1069 | switch (event->button) |
| 1774 | 1011 | { | 1070 | { |
| 1775 | 1012 | case 1: | 1071 | case 1: |
| 1777 | 1013 | gtk_window_begin_move_drag (GTK_WINDOW (pad), event->button, event->x_root, event->y_root, event->time); | 1072 | gtk_window_begin_move_drag (GTK_WINDOW (pad), (gint) event->button, (gint) event->x_root, (gint) event->y_root, event->time); |
| 1778 | 1014 | return TRUE; | 1073 | return TRUE; |
| 1779 | 1015 | 1074 | ||
| 1780 | 1016 | case 3: | 1075 | case 3: |
| 1781 | @@ -1023,7 +1082,7 @@ | |||
| 1782 | 1023 | else | 1082 | else |
| 1783 | 1024 | edge = GDK_WINDOW_EDGE_SOUTH_WEST; | 1083 | edge = GDK_WINDOW_EDGE_SOUTH_WEST; |
| 1784 | 1025 | 1084 | ||
| 1786 | 1026 | gtk_window_begin_resize_drag (GTK_WINDOW (pad), edge, event->button, event->x_root, event->y_root, event->time); | 1085 | gtk_window_begin_resize_drag (GTK_WINDOW (pad), edge, (gint) event->button, (gint) event->x_root, (gint) event->y_root, event->time); |
| 1787 | 1027 | } | 1086 | } |
| 1788 | 1028 | else | 1087 | else |
| 1789 | 1029 | { | 1088 | { |
| 1790 | @@ -1059,6 +1118,8 @@ | |||
| 1791 | 1059 | xpad_pad_set_group (XpadPad *pad, XpadPadGroup *group) | 1118 | xpad_pad_set_group (XpadPad *pad, XpadPadGroup *group) |
| 1792 | 1060 | { | 1119 | { |
| 1793 | 1061 | pad->priv->group = group; | 1120 | pad->priv->group = group; |
| 1794 | 1121 | g_object_ref(pad->priv->group); | ||
| 1795 | 1122 | |||
| 1796 | 1062 | if (group) | 1123 | if (group) |
| 1797 | 1063 | xpad_pad_group_add (group, GTK_WIDGET (pad)); | 1124 | xpad_pad_group_add (group, GTK_WIDGET (pad)); |
| 1798 | 1064 | } | 1125 | } |
| 1799 | @@ -1143,6 +1204,9 @@ | |||
| 1800 | 1143 | gchar *content; | 1204 | gchar *content; |
| 1801 | 1144 | GtkTextBuffer *buffer; | 1205 | GtkTextBuffer *buffer; |
| 1802 | 1145 | 1206 | ||
| 1803 | 1207 | if (!pad->priv->unsaved_content) | ||
| 1804 | 1208 | return; | ||
| 1805 | 1209 | |||
| 1806 | 1146 | /* create content file if it doesn't exist yet */ | 1210 | /* create content file if it doesn't exist yet */ |
| 1807 | 1147 | if (!pad->priv->contentname) | 1211 | if (!pad->priv->contentname) |
| 1808 | 1148 | { | 1212 | { |
| 1809 | @@ -1150,9 +1214,13 @@ | |||
| 1810 | 1150 | if (!pad->priv->contentname) | 1214 | if (!pad->priv->contentname) |
| 1811 | 1151 | return; | 1215 | return; |
| 1812 | 1152 | } | 1216 | } |
| 1816 | 1153 | 1217 | ||
| 1817 | 1154 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)); | 1218 | if (GTK_IS_TEXT_VIEW(pad->priv->textview)) { |
| 1818 | 1155 | content = xpad_text_buffer_get_text_with_tags (XPAD_TEXT_BUFFER (buffer)); | 1219 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (pad->priv->textview)); |
| 1819 | 1220 | content = xpad_text_buffer_get_text_with_tags (XPAD_TEXT_BUFFER (buffer)); | ||
| 1820 | 1221 | } | ||
| 1821 | 1222 | else | ||
| 1822 | 1223 | g_warning("There is a problem in the program Xpad. In function 'xpad_pad_save_content' the variable 'pad->priv->textview' is not of type textview. Please send a bugreport to https://bugs.launchpad.net/xpad/+filebug to help improve Xpad."); | ||
| 1823 | 1156 | 1224 | ||
| 1824 | 1157 | fio_set_file (pad->priv->contentname, content); | 1225 | fio_set_file (pad->priv->contentname, content); |
| 1825 | 1158 | 1226 | ||
| 1826 | @@ -1204,7 +1272,7 @@ | |||
| 1827 | 1204 | xpad_pad_show_toolbar (pad); /* these will resize pad at correct height */ | 1272 | xpad_pad_show_toolbar (pad); /* these will resize pad at correct height */ |
| 1828 | 1205 | } | 1273 | } |
| 1829 | 1206 | else | 1274 | else |
| 1831 | 1207 | gtk_window_resize (GTK_WINDOW (pad), pad->priv->width, pad->priv->height); | 1275 | gtk_window_resize (GTK_WINDOW (pad), (gint) pad->priv->width, (gint) pad->priv->height); |
| 1832 | 1208 | gtk_window_move (GTK_WINDOW (pad), pad->priv->x, pad->priv->y); | 1276 | gtk_window_move (GTK_WINDOW (pad), pad->priv->x, pad->priv->y); |
| 1833 | 1209 | 1277 | ||
| 1834 | 1210 | xpad_text_view_set_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview), follow_font); | 1278 | xpad_text_view_set_follow_font_style (XPAD_TEXT_VIEW (pad->priv->textview), follow_font); |
| 1835 | @@ -1268,14 +1336,21 @@ | |||
| 1836 | 1268 | 1336 | ||
| 1837 | 1269 | if (show) | 1337 | if (show) |
| 1838 | 1270 | *show = !hidden; | 1338 | *show = !hidden; |
| 1839 | 1339 | |||
| 1840 | 1340 | g_free(fontname); | ||
| 1841 | 1271 | } | 1341 | } |
| 1842 | 1272 | 1342 | ||
| 1843 | 1273 | void | 1343 | void |
| 1844 | 1274 | xpad_pad_save_info (XpadPad *pad) | 1344 | xpad_pad_save_info (XpadPad *pad) |
| 1845 | 1275 | { | 1345 | { |
| 1849 | 1276 | gint height; | 1346 | guint height = NULL; |
| 1850 | 1277 | GtkStyle *style; | 1347 | GtkStyle *style = NULL; |
| 1851 | 1278 | gchar *fontname; | 1348 | gchar *fontname = NULL; |
| 1852 | 1349 | |||
| 1853 | 1350 | g_return_if_fail (pad); | ||
| 1854 | 1351 | |||
| 1855 | 1352 | if (!pad->priv->unsaved_info) | ||
| 1856 | 1353 | return; | ||
| 1857 | 1279 | 1354 | ||
| 1858 | 1280 | /* Must create pad info file if it doesn't exist yet */ | 1355 | /* Must create pad info file if it doesn't exist yet */ |
| 1859 | 1281 | if (!pad->priv->infoname) | 1356 | if (!pad->priv->infoname) |
| 1860 | @@ -1327,7 +1402,7 @@ | |||
| 1861 | 1327 | menu_about (XpadPad *pad) | 1402 | menu_about (XpadPad *pad) |
| 1862 | 1328 | { | 1403 | { |
| 1863 | 1329 | const gchar *artists[] = {"Michael Terry <mike@mterry.name>", NULL}; | 1404 | const gchar *artists[] = {"Michael Terry <mike@mterry.name>", NULL}; |
| 1865 | 1330 | const gchar *authors[] = {"Arthur Borsboom <arthurborsboom@gmail.com", "Jeroen Vermeulen <jtv@xs4all.nl>", "Michael Terry <mike@mterry.name>", "Paul Ivanov <pivanov@berkeley.edu>", NULL}; | 1405 | const gchar *authors[] = {"Arthur Borsboom <arthurborsboom@gmail.com>", "Jeroen Vermeulen <jtv@xs4all.nl>", "Michael Terry <mike@mterry.name>", "Paul Ivanov <pivanov@berkeley.edu>", NULL}; |
| 1866 | 1331 | const gchar *comments = _("Sticky notes"); | 1406 | const gchar *comments = _("Sticky notes"); |
| 1867 | 1332 | const gchar *copyright = "© 2001-2007 Michael Terry"; | 1407 | const gchar *copyright = "© 2001-2007 Michael Terry"; |
| 1868 | 1333 | /* we use g_strdup_printf because C89 has size limits on static strings */ | 1408 | /* we use g_strdup_printf because C89 has size limits on static strings */ |
| 1869 | @@ -1460,6 +1535,9 @@ | |||
| 1870 | 1460 | gtk_window_present (GTK_WINDOW (pad)); | 1535 | gtk_window_present (GTK_WINDOW (pad)); |
| 1871 | 1461 | 1536 | ||
| 1872 | 1462 | g_slist_free (pads); | 1537 | g_slist_free (pads); |
| 1873 | 1538 | g_slist_free (i); | ||
| 1874 | 1539 | pads = NULL; | ||
| 1875 | 1540 | i = NULL; | ||
| 1876 | 1463 | } | 1541 | } |
| 1877 | 1464 | 1542 | ||
| 1878 | 1465 | static void | 1543 | static void |
| 1879 | @@ -1530,7 +1608,7 @@ | |||
| 1880 | 1530 | gtk_window_stick (GTK_WINDOW (pad)); | 1608 | gtk_window_stick (GTK_WINDOW (pad)); |
| 1881 | 1531 | else | 1609 | else |
| 1882 | 1532 | gtk_window_unstick (GTK_WINDOW (pad)); | 1610 | gtk_window_unstick (GTK_WINDOW (pad)); |
| 1884 | 1533 | xpad_pad_save_info (pad); | 1611 | xpad_pad_save_info_delayed (pad); |
| 1885 | 1534 | } | 1612 | } |
| 1886 | 1535 | 1613 | ||
| 1887 | 1536 | static void | 1614 | static void |
| 1888 | @@ -1781,6 +1859,9 @@ | |||
| 1889 | 1781 | g_free (key); | 1859 | g_free (key); |
| 1890 | 1782 | } | 1860 | } |
| 1891 | 1783 | g_slist_free (pads); | 1861 | g_slist_free (pads); |
| 1892 | 1862 | g_slist_free (l); | ||
| 1893 | 1863 | pads = NULL; | ||
| 1894 | 1864 | l = NULL; | ||
| 1895 | 1784 | } | 1865 | } |
| 1896 | 1785 | } | 1866 | } |
| 1897 | 1786 | 1867 | ||
| 1898 | @@ -1893,10 +1974,6 @@ | |||
| 1899 | 1893 | } | 1974 | } |
| 1900 | 1894 | 1975 | ||
| 1901 | 1895 | /* These functions below are used to reduce the amounts of writes, hence improve the performance. */ | 1976 | /* These functions below are used to reduce the amounts of writes, hence improve the performance. */ |
| 1902 | 1896 | void xpad2_save_content (void * vptr) | ||
| 1903 | 1897 | { | ||
| 1904 | 1898 | xpad_pad_save_content(vptr); | ||
| 1905 | 1899 | } | ||
| 1906 | 1900 | void xpad_pad_save_content_delayed (XpadPad *pad) | 1977 | void xpad_pad_save_content_delayed (XpadPad *pad) |
| 1907 | 1901 | { | 1978 | { |
| 1908 | 1902 | pad->priv->unsaved_content = TRUE; | 1979 | pad->priv->unsaved_content = TRUE; |
| 1909 | @@ -1913,6 +1990,6 @@ | |||
| 1910 | 1913 | xpad_pad_save_content(pad); | 1990 | xpad_pad_save_content(pad); |
| 1911 | 1914 | } | 1991 | } |
| 1912 | 1915 | if(pad->priv->unsaved_info == TRUE) { | 1992 | if(pad->priv->unsaved_info == TRUE) { |
| 1914 | 1916 | xpad_pad_save_info(pad); | 1993 | xpad_pad_save_info(pad); |
| 1915 | 1917 | } | 1994 | } |
| 1916 | 1918 | } | 1995 | } |
| 1917 | 1919 | 1996 | ||
| 1918 | === modified file 'src/xpad-preferences.c' | |||
| 1919 | --- src/xpad-preferences.c 2008-09-21 00:03:40 +0000 | |||
| 1920 | +++ src/xpad-preferences.c 2013-10-18 18:35:35 +0000 | |||
| 1921 | @@ -25,9 +25,6 @@ | |||
| 1922 | 25 | #include "xpad-preferences.h" | 25 | #include "xpad-preferences.h" |
| 1923 | 26 | #include "xpad-settings.h" | 26 | #include "xpad-settings.h" |
| 1924 | 27 | 27 | ||
| 1925 | 28 | G_DEFINE_TYPE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG) | ||
| 1926 | 29 | #define XPAD_PREFERENCES_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_PREFERENCES, XpadPreferencesPrivate)) | ||
| 1927 | 30 | |||
| 1928 | 31 | struct XpadPreferencesPrivate | 28 | struct XpadPreferencesPrivate |
| 1929 | 32 | { | 29 | { |
| 1930 | 33 | GtkWidget *fontcheck; | 30 | GtkWidget *fontcheck; |
| 1931 | @@ -60,6 +57,8 @@ | |||
| 1932 | 60 | guint confirmcheck_handler; | 57 | guint confirmcheck_handler; |
| 1933 | 61 | }; | 58 | }; |
| 1934 | 62 | 59 | ||
| 1935 | 60 | G_DEFINE_TYPE_WITH_PRIVATE(XpadPreferences, xpad_preferences, GTK_TYPE_DIALOG) | ||
| 1936 | 61 | |||
| 1937 | 63 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); | 62 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); |
| 1938 | 64 | static void change_sticky_check (GtkToggleButton *button, XpadPreferences *pref); | 63 | static void change_sticky_check (GtkToggleButton *button, XpadPreferences *pref); |
| 1939 | 65 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); | 64 | static void change_confirm_check (GtkToggleButton *button, XpadPreferences *pref); |
| 1940 | @@ -74,6 +73,7 @@ | |||
| 1941 | 74 | static void notify_fontname (XpadPreferences *pref); | 73 | static void notify_fontname (XpadPreferences *pref); |
| 1942 | 75 | static void notify_text_color (XpadPreferences *pref); | 74 | static void notify_text_color (XpadPreferences *pref); |
| 1943 | 76 | static void notify_back_color (XpadPreferences *pref); | 75 | static void notify_back_color (XpadPreferences *pref); |
| 1944 | 76 | static void xpad_preferences_dispose (GObject *object); | ||
| 1945 | 77 | static void xpad_preferences_finalize (GObject *object); | 77 | static void xpad_preferences_finalize (GObject *object); |
| 1946 | 78 | static void xpad_preferences_response (GtkDialog *dialog, gint response); | 78 | static void xpad_preferences_response (GtkDialog *dialog, gint response); |
| 1947 | 79 | 79 | ||
| 1948 | @@ -98,10 +98,9 @@ | |||
| 1949 | 98 | xpad_preferences_class_init (XpadPreferencesClass *klass) | 98 | xpad_preferences_class_init (XpadPreferencesClass *klass) |
| 1950 | 99 | { | 99 | { |
| 1951 | 100 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 100 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 1953 | 101 | 101 | ||
| 1954 | 102 | gobject_class->dispose = xpad_preferences_dispose; | ||
| 1955 | 102 | gobject_class->finalize = xpad_preferences_finalize; | 103 | gobject_class->finalize = xpad_preferences_finalize; |
| 1956 | 103 | |||
| 1957 | 104 | g_type_class_add_private (gobject_class, sizeof (XpadPreferencesPrivate)); | ||
| 1958 | 105 | } | 104 | } |
| 1959 | 106 | 105 | ||
| 1960 | 107 | static void | 106 | static void |
| 1961 | @@ -117,7 +116,7 @@ | |||
| 1962 | 117 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | 116 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
| 1963 | 118 | GtkRequisition req; | 117 | GtkRequisition req; |
| 1964 | 119 | 118 | ||
| 1966 | 120 | pref->priv = XPAD_PREFERENCES_GET_PRIVATE (pref); | 119 | pref->priv = xpad_preferences_get_instance_private(pref); |
| 1967 | 121 | 120 | ||
| 1968 | 122 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); | 121 | text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); |
| 1969 | 123 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, | 122 | label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, |
| 1970 | @@ -312,12 +311,16 @@ | |||
| 1971 | 312 | } | 311 | } |
| 1972 | 313 | 312 | ||
| 1973 | 314 | static void | 313 | static void |
| 1974 | 314 | xpad_preferences_dispose (GObject *object) | ||
| 1975 | 315 | { | ||
| 1976 | 316 | G_OBJECT_CLASS (xpad_preferences_parent_class)->dispose (object); | ||
| 1977 | 317 | } | ||
| 1978 | 318 | |||
| 1979 | 319 | static void | ||
| 1980 | 315 | xpad_preferences_finalize (GObject *object) | 320 | xpad_preferences_finalize (GObject *object) |
| 1981 | 316 | { | 321 | { |
| 1982 | 317 | XpadPreferences *pref = XPAD_PREFERENCES (object); | 322 | XpadPreferences *pref = XPAD_PREFERENCES (object); |
| 1983 | 318 | 323 | ||
| 1984 | 319 | g_signal_handlers_disconnect_matched (xpad_settings (), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pref); | ||
| 1985 | 320 | |||
| 1986 | 321 | G_OBJECT_CLASS (xpad_preferences_parent_class)->finalize (object); | 324 | G_OBJECT_CLASS (xpad_preferences_parent_class)->finalize (object); |
| 1987 | 322 | } | 325 | } |
| 1988 | 323 | 326 | ||
| 1989 | 324 | 327 | ||
| 1990 | === modified file 'src/xpad-settings.c' | |||
| 1991 | --- src/xpad-settings.c 2013-10-07 20:07:46 +0000 | |||
| 1992 | +++ src/xpad-settings.c 2013-10-18 18:35:35 +0000 | |||
| 1993 | @@ -22,11 +22,6 @@ | |||
| 1994 | 22 | #include "xpad-settings.h" | 22 | #include "xpad-settings.h" |
| 1995 | 23 | #include "fio.h" | 23 | #include "fio.h" |
| 1996 | 24 | 24 | ||
| 1997 | 25 | G_DEFINE_TYPE(XpadSettings, xpad_settings, G_TYPE_OBJECT) | ||
| 1998 | 26 | #define XPAD_SETTINGS_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_SETTINGS, XpadSettingsPrivate)) | ||
| 1999 | 27 | |||
| 2000 | 28 | #define DEFAULTS_FILENAME "default-style" | ||
| 2001 | 29 | |||
| 2002 | 30 | struct XpadSettingsPrivate | 25 | struct XpadSettingsPrivate |
| 2003 | 31 | { | 26 | { |
| 2004 | 32 | guint width; | 27 | guint width; |
| 2005 | @@ -44,6 +39,10 @@ | |||
| 2006 | 44 | GSList *toolbar_buttons; | 39 | GSList *toolbar_buttons; |
| 2007 | 45 | }; | 40 | }; |
| 2008 | 46 | 41 | ||
| 2009 | 42 | G_DEFINE_TYPE_WITH_PRIVATE(XpadSettings, xpad_settings, G_TYPE_OBJECT) | ||
| 2010 | 43 | |||
| 2011 | 44 | #define DEFAULTS_FILENAME "default-style" | ||
| 2012 | 45 | |||
| 2013 | 47 | enum | 46 | enum |
| 2014 | 48 | { | 47 | { |
| 2015 | 49 | CHANGE_BUTTONS, | 48 | CHANGE_BUTTONS, |
| 2016 | @@ -72,6 +71,7 @@ | |||
| 2017 | 72 | static void save_to_file (XpadSettings *settings, const gchar *filename); | 71 | static void save_to_file (XpadSettings *settings, const gchar *filename); |
| 2018 | 73 | static void xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | 72 | static void xpad_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
| 2019 | 74 | static void xpad_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | 73 | static void xpad_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
| 2020 | 74 | static void xpad_settings_dispose (GObject *object); | ||
| 2021 | 75 | static void xpad_settings_finalize (GObject *object); | 75 | static void xpad_settings_finalize (GObject *object); |
| 2022 | 76 | 76 | ||
| 2023 | 77 | static XpadSettings *_xpad_settings = NULL; | 77 | static XpadSettings *_xpad_settings = NULL; |
| 2024 | @@ -91,7 +91,8 @@ | |||
| 2025 | 91 | xpad_settings_class_init (XpadSettingsClass *klass) | 91 | xpad_settings_class_init (XpadSettingsClass *klass) |
| 2026 | 92 | { | 92 | { |
| 2027 | 93 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 93 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 2029 | 94 | 94 | ||
| 2030 | 95 | gobject_class->dispose = xpad_settings_dispose; | ||
| 2031 | 95 | gobject_class->finalize = xpad_settings_finalize; | 96 | gobject_class->finalize = xpad_settings_finalize; |
| 2032 | 96 | gobject_class->set_property = xpad_settings_set_property; | 97 | gobject_class->set_property = xpad_settings_set_property; |
| 2033 | 97 | gobject_class->get_property = xpad_settings_get_property; | 98 | gobject_class->get_property = xpad_settings_get_property; |
| 2034 | @@ -207,8 +208,6 @@ | |||
| 2035 | 207 | G_STRUCT_OFFSET (XpadSettingsClass, change_buttons), | 208 | G_STRUCT_OFFSET (XpadSettingsClass, change_buttons), |
| 2036 | 208 | NULL, NULL, | 209 | NULL, NULL, |
| 2037 | 209 | g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); | 210 | g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 2038 | 210 | |||
| 2039 | 211 | g_type_class_add_private (gobject_class, sizeof (XpadSettingsPrivate)); | ||
| 2040 | 212 | } | 211 | } |
| 2041 | 213 | 212 | ||
| 2042 | 214 | static void | 213 | static void |
| 2043 | @@ -216,7 +215,7 @@ | |||
| 2044 | 216 | { | 215 | { |
| 2045 | 217 | GdkColor back, text; | 216 | GdkColor back, text; |
| 2046 | 218 | 217 | ||
| 2048 | 219 | settings->priv = XPAD_SETTINGS_GET_PRIVATE (settings); | 218 | settings->priv = xpad_settings_get_instance_private(settings); |
| 2049 | 220 | 219 | ||
| 2050 | 221 | /* A pleasant light yellow color, similar to | 220 | /* A pleasant light yellow color, similar to |
| 2051 | 222 | commercial sticky notes. */ | 221 | commercial sticky notes. */ |
| 2052 | @@ -253,13 +252,23 @@ | |||
| 2053 | 253 | } | 252 | } |
| 2054 | 254 | 253 | ||
| 2055 | 255 | static void | 254 | static void |
| 2056 | 255 | xpad_settings_dispose (GObject *object) | ||
| 2057 | 256 | { | ||
| 2058 | 257 | G_OBJECT_CLASS (xpad_settings_parent_class)->dispose (object); | ||
| 2059 | 258 | } | ||
| 2060 | 259 | |||
| 2061 | 260 | static void | ||
| 2062 | 256 | xpad_settings_finalize (GObject *object) | 261 | xpad_settings_finalize (GObject *object) |
| 2063 | 257 | { | 262 | { |
| 2064 | 258 | XpadSettings *settings = XPAD_SETTINGS (object); | 263 | XpadSettings *settings = XPAD_SETTINGS (object); |
| 2065 | 259 | 264 | ||
| 2066 | 260 | g_slist_free (settings->priv->toolbar_buttons); | 265 | g_slist_free (settings->priv->toolbar_buttons); |
| 2069 | 261 | gdk_color_free (settings->priv->text); | 266 | |
| 2070 | 262 | gdk_color_free (settings->priv->back); | 267 | if (settings->priv->text) |
| 2071 | 268 | gdk_color_free (settings->priv->text); | ||
| 2072 | 269 | if (settings->priv->back) | ||
| 2073 | 270 | gdk_color_free (settings->priv->back); | ||
| 2074 | 271 | |||
| 2075 | 263 | g_free (settings->priv->fontname); | 272 | g_free (settings->priv->fontname); |
| 2076 | 264 | 273 | ||
| 2077 | 265 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); | 274 | G_OBJECT_CLASS (xpad_settings_parent_class)->finalize (object); |
| 2078 | @@ -427,20 +436,27 @@ | |||
| 2079 | 427 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 436 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
| 2080 | 428 | } | 437 | } |
| 2081 | 429 | 438 | ||
| 2082 | 439 | /* Unused function of previous developer | ||
| 2083 | 430 | gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new) | 440 | gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new) |
| 2084 | 431 | { | 441 | { |
| 2086 | 432 | GSList *element; | 442 | GSList *element = NULL; |
| 2087 | 433 | gpointer data; | 443 | gpointer data; |
| 2088 | 434 | 444 | ||
| 2090 | 435 | if (button == new) | 445 | if (button == new) { |
| 2091 | 446 | g_slist_free(element); | ||
| 2092 | 436 | return FALSE; | 447 | return FALSE; |
| 2093 | 448 | } | ||
| 2094 | 437 | 449 | ||
| 2096 | 438 | if (new >= g_slist_length (settings->priv->toolbar_buttons) || 0 > new ) | 450 | if (new >= (gint) g_slist_length (settings->priv->toolbar_buttons) || 0 > new ) { |
| 2097 | 451 | g_slist_free(element); | ||
| 2098 | 439 | return FALSE; | 452 | return FALSE; |
| 2099 | 453 | } | ||
| 2100 | 440 | 454 | ||
| 2101 | 441 | element = g_slist_nth (settings->priv->toolbar_buttons, button); | 455 | element = g_slist_nth (settings->priv->toolbar_buttons, button); |
| 2103 | 442 | if (!element) | 456 | if (!element) { |
| 2104 | 457 | g_slist_free(element); | ||
| 2105 | 443 | return FALSE; | 458 | return FALSE; |
| 2106 | 459 | } | ||
| 2107 | 444 | 460 | ||
| 2108 | 445 | data = element->data; | 461 | data = element->data; |
| 2109 | 446 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); | 462 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); |
| 2110 | @@ -450,8 +466,11 @@ | |||
| 2111 | 450 | 466 | ||
| 2112 | 451 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 467 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
| 2113 | 452 | 468 | ||
| 2114 | 469 | g_slist_free(element); | ||
| 2115 | 470 | |||
| 2116 | 453 | return TRUE; | 471 | return TRUE; |
| 2117 | 454 | } | 472 | } |
| 2118 | 473 | */ | ||
| 2119 | 455 | 474 | ||
| 2120 | 456 | static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element) | 475 | static void xpad_settings_remove_toolbar_list_element (XpadSettings *settings, GSList *element) |
| 2121 | 457 | { | 476 | { |
| 2122 | @@ -459,14 +478,17 @@ | |||
| 2123 | 459 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); | 478 | settings->priv->toolbar_buttons = g_slist_delete_link (settings->priv->toolbar_buttons, element); |
| 2124 | 460 | } | 479 | } |
| 2125 | 461 | 480 | ||
| 2126 | 481 | /* Unused function of previous developer | ||
| 2127 | 462 | gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button) | 482 | gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button) |
| 2128 | 463 | { | 483 | { |
| 2129 | 464 | GSList *element; | 484 | GSList *element; |
| 2130 | 465 | 485 | ||
| 2131 | 466 | element = g_slist_nth (settings->priv->toolbar_buttons, button); | 486 | element = g_slist_nth (settings->priv->toolbar_buttons, button); |
| 2132 | 467 | 487 | ||
| 2134 | 468 | if (!element) | 488 | if (!element) { |
| 2135 | 489 | g_slist_free(element); | ||
| 2136 | 469 | return FALSE; | 490 | return FALSE; |
| 2137 | 491 | } | ||
| 2138 | 470 | 492 | ||
| 2139 | 471 | xpad_settings_remove_toolbar_list_element (settings, element); | 493 | xpad_settings_remove_toolbar_list_element (settings, element); |
| 2140 | 472 | 494 | ||
| 2141 | @@ -474,8 +496,11 @@ | |||
| 2142 | 474 | 496 | ||
| 2143 | 475 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 497 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
| 2144 | 476 | 498 | ||
| 2145 | 499 | g_slist_free(element); | ||
| 2146 | 500 | |||
| 2147 | 477 | return TRUE; | 501 | return TRUE; |
| 2148 | 478 | } | 502 | } |
| 2149 | 503 | */ | ||
| 2150 | 479 | 504 | ||
| 2151 | 480 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings) | 505 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings) |
| 2152 | 481 | { | 506 | { |
| 2153 | @@ -503,8 +528,10 @@ | |||
| 2154 | 503 | 528 | ||
| 2155 | 504 | element = g_slist_last (settings->priv->toolbar_buttons); | 529 | element = g_slist_last (settings->priv->toolbar_buttons); |
| 2156 | 505 | 530 | ||
| 2158 | 506 | if (!element) | 531 | if (!element) { |
| 2159 | 532 | g_slist_free(element); | ||
| 2160 | 507 | return FALSE; | 533 | return FALSE; |
| 2161 | 534 | } | ||
| 2162 | 508 | 535 | ||
| 2163 | 509 | xpad_settings_remove_toolbar_list_element (settings, element); | 536 | xpad_settings_remove_toolbar_list_element (settings, element); |
| 2164 | 510 | 537 | ||
| 2165 | @@ -512,6 +539,8 @@ | |||
| 2166 | 512 | 539 | ||
| 2167 | 513 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); | 540 | g_signal_emit (settings, signals[CHANGE_BUTTONS], 0); |
| 2168 | 514 | 541 | ||
| 2169 | 542 | g_slist_free(element); | ||
| 2170 | 543 | |||
| 2171 | 515 | return TRUE; | 544 | return TRUE; |
| 2172 | 516 | } | 545 | } |
| 2173 | 517 | 546 | ||
| 2174 | 518 | 547 | ||
| 2175 | === modified file 'src/xpad-settings.h' | |||
| 2176 | --- src/xpad-settings.h 2011-11-16 20:16:17 +0000 | |||
| 2177 | +++ src/xpad-settings.h 2013-10-18 18:35:35 +0000 | |||
| 2178 | @@ -82,8 +82,8 @@ | |||
| 2179 | 82 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings); | 82 | gboolean xpad_settings_get_has_scrollbar (XpadSettings *settings); |
| 2180 | 83 | 83 | ||
| 2181 | 84 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); | 84 | void xpad_settings_add_toolbar_button (XpadSettings *settings, const gchar *button); |
| 2184 | 85 | gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new); | 85 | // gboolean xpad_settings_move_toolbar_button (XpadSettings *settings, gint button, gint new); |
| 2185 | 86 | gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button); | 86 | // gboolean xpad_settings_remove_toolbar_button (XpadSettings *settings, gint button); |
| 2186 | 87 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); | 87 | gboolean xpad_settings_remove_all_toolbar_buttons (XpadSettings *settings); |
| 2187 | 88 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); | 88 | gboolean xpad_settings_remove_last_toolbar_button (XpadSettings *settings); |
| 2188 | 89 | G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); | 89 | G_CONST_RETURN GSList *xpad_settings_get_toolbar_buttons (XpadSettings *settings); |
| 2189 | 90 | 90 | ||
| 2190 | === modified file 'src/xpad-text-buffer.c' | |||
| 2191 | --- src/xpad-text-buffer.c 2011-11-16 18:10:04 +0000 | |||
| 2192 | +++ src/xpad-text-buffer.c 2013-10-18 18:35:35 +0000 | |||
| 2193 | @@ -21,22 +21,20 @@ | |||
| 2194 | 21 | #include "xpad-undo.h" | 21 | #include "xpad-undo.h" |
| 2195 | 22 | #include "xpad-pad.h" | 22 | #include "xpad-pad.h" |
| 2196 | 23 | 23 | ||
| 2197 | 24 | G_DEFINE_TYPE(XpadTextBuffer, xpad_text_buffer, GTK_TYPE_TEXT_BUFFER) | ||
| 2198 | 25 | #define XPAD_TEXT_BUFFER_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_TEXT_BUFFER, XpadTextBufferPrivate)) | ||
| 2199 | 26 | |||
| 2200 | 27 | struct XpadTextBufferPrivate | 24 | struct XpadTextBufferPrivate |
| 2201 | 28 | { | 25 | { |
| 2202 | 29 | XpadUndo *undo; | 26 | XpadUndo *undo; |
| 2203 | 30 | XpadPad *pad; | 27 | XpadPad *pad; |
| 2204 | 28 | GtkTextTagTable *tag_table; | ||
| 2205 | 31 | }; | 29 | }; |
| 2206 | 32 | 30 | ||
| 2207 | 31 | G_DEFINE_TYPE_WITH_PRIVATE(XpadTextBuffer, xpad_text_buffer, GTK_TYPE_TEXT_BUFFER) | ||
| 2208 | 32 | |||
| 2209 | 33 | /* Unicode chars in the Private Use Area. */ | 33 | /* Unicode chars in the Private Use Area. */ |
| 2210 | 34 | static gunichar TAG_CHAR = 0xe000; | 34 | static gunichar TAG_CHAR = 0xe000; |
| 2211 | 35 | 35 | ||
| 2212 | 36 | static GtkTextTagTable *create_tag_table (void); | 36 | static GtkTextTagTable *create_tag_table (void); |
| 2213 | 37 | 37 | ||
| 2214 | 38 | static GtkTextTagTable *global_text_tag_table = NULL; | ||
| 2215 | 39 | |||
| 2216 | 40 | enum | 38 | enum |
| 2217 | 41 | { | 39 | { |
| 2218 | 42 | PROP_0, | 40 | PROP_0, |
| 2219 | @@ -44,81 +42,24 @@ | |||
| 2220 | 44 | LAST_PROP | 42 | LAST_PROP |
| 2221 | 45 | }; | 43 | }; |
| 2222 | 46 | 44 | ||
| 2223 | 45 | static void xpad_text_buffer_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | ||
| 2224 | 46 | static void xpad_text_buffer_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | ||
| 2225 | 47 | static void xpad_text_buffer_dispose (GObject *object); | ||
| 2226 | 48 | static void xpad_text_buffer_finalize (GObject *object); | ||
| 2227 | 49 | |||
| 2228 | 47 | XpadTextBuffer * | 50 | XpadTextBuffer * |
| 2296 | 48 | xpad_text_buffer_new (XpadPad *pad) | 51 | xpad_text_buffer_new (void) |
| 2297 | 49 | { | 52 | { |
| 2298 | 50 | if (!global_text_tag_table) | 53 | XpadPad *pad = NULL; |
| 2299 | 51 | global_text_tag_table = create_tag_table (); /* FIXME: never freed */ | 54 | return g_object_new (XPAD_TYPE_TEXT_BUFFER, "pad", pad, NULL); |
| 2233 | 52 | |||
| 2234 | 53 | return XPAD_TEXT_BUFFER (g_object_new (XPAD_TYPE_TEXT_BUFFER, "tag_table", global_text_tag_table, "pad", pad, NULL)); | ||
| 2235 | 54 | } | ||
| 2236 | 55 | |||
| 2237 | 56 | static void | ||
| 2238 | 57 | xpad_text_buffer_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | ||
| 2239 | 58 | { | ||
| 2240 | 59 | XpadTextBuffer *text_buffer = XPAD_TEXT_BUFFER (object); | ||
| 2241 | 60 | |||
| 2242 | 61 | switch (prop_id) | ||
| 2243 | 62 | { | ||
| 2244 | 63 | case PROP_PAD: | ||
| 2245 | 64 | if (text_buffer->priv->pad && G_IS_OBJECT (text_buffer->priv->pad)) | ||
| 2246 | 65 | g_object_unref (text_buffer->priv->pad); | ||
| 2247 | 66 | if (G_VALUE_HOLDS_POINTER (value) && G_IS_OBJECT (g_value_get_pointer (value))) | ||
| 2248 | 67 | { | ||
| 2249 | 68 | text_buffer->priv->pad = g_value_get_pointer (value); | ||
| 2250 | 69 | g_object_ref (text_buffer->priv->pad); | ||
| 2251 | 70 | } | ||
| 2252 | 71 | break; | ||
| 2253 | 72 | |||
| 2254 | 73 | default: | ||
| 2255 | 74 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 2256 | 75 | break; | ||
| 2257 | 76 | } | ||
| 2258 | 77 | } | ||
| 2259 | 78 | |||
| 2260 | 79 | static void | ||
| 2261 | 80 | xpad_text_buffer_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | ||
| 2262 | 81 | { | ||
| 2263 | 82 | XpadTextBuffer *text_buffer = XPAD_TEXT_BUFFER (object); | ||
| 2264 | 83 | |||
| 2265 | 84 | switch (prop_id) | ||
| 2266 | 85 | { | ||
| 2267 | 86 | case PROP_PAD: | ||
| 2268 | 87 | g_value_set_pointer (value, text_buffer->priv->pad); | ||
| 2269 | 88 | break; | ||
| 2270 | 89 | |||
| 2271 | 90 | default: | ||
| 2272 | 91 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 2273 | 92 | break; | ||
| 2274 | 93 | } | ||
| 2275 | 94 | } | ||
| 2276 | 95 | |||
| 2277 | 96 | |||
| 2278 | 97 | static void | ||
| 2279 | 98 | xpad_text_buffer_finalize (GObject *object) | ||
| 2280 | 99 | { | ||
| 2281 | 100 | XpadTextBuffer *text_buffer = XPAD_TEXT_BUFFER (object); | ||
| 2282 | 101 | |||
| 2283 | 102 | if (text_buffer->priv->pad) | ||
| 2284 | 103 | { | ||
| 2285 | 104 | g_object_unref (text_buffer->priv->pad); | ||
| 2286 | 105 | text_buffer->priv->pad = NULL; | ||
| 2287 | 106 | } | ||
| 2288 | 107 | |||
| 2289 | 108 | if (text_buffer->priv->undo) | ||
| 2290 | 109 | { | ||
| 2291 | 110 | g_free (text_buffer->priv->undo); | ||
| 2292 | 111 | text_buffer->priv->undo = NULL; | ||
| 2293 | 112 | } | ||
| 2294 | 113 | |||
| 2295 | 114 | G_OBJECT_CLASS (xpad_text_buffer_parent_class)->finalize (object); | ||
| 2300 | 115 | } | 55 | } |
| 2301 | 116 | 56 | ||
| 2302 | 117 | static void | 57 | static void |
| 2303 | 118 | xpad_text_buffer_class_init (XpadTextBufferClass *klass) | 58 | xpad_text_buffer_class_init (XpadTextBufferClass *klass) |
| 2304 | 119 | { | 59 | { |
| 2305 | 120 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 60 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 2307 | 121 | 61 | ||
| 2308 | 62 | gobject_class->dispose = xpad_text_buffer_dispose; | ||
| 2309 | 122 | gobject_class->finalize = xpad_text_buffer_finalize; | 63 | gobject_class->finalize = xpad_text_buffer_finalize; |
| 2310 | 123 | gobject_class->set_property = xpad_text_buffer_set_property; | 64 | gobject_class->set_property = xpad_text_buffer_set_property; |
| 2311 | 124 | gobject_class->get_property = xpad_text_buffer_get_property; | 65 | gobject_class->get_property = xpad_text_buffer_get_property; |
| 2312 | @@ -129,18 +70,85 @@ | |||
| 2313 | 129 | "Pad", | 70 | "Pad", |
| 2314 | 130 | "Pad connected to this buffer", | 71 | "Pad connected to this buffer", |
| 2315 | 131 | G_PARAM_READWRITE)); | 72 | G_PARAM_READWRITE)); |
| 2316 | 132 | |||
| 2317 | 133 | g_type_class_add_private (gobject_class, sizeof (XpadTextBufferPrivate)); | ||
| 2318 | 134 | } | 73 | } |
| 2319 | 135 | 74 | ||
| 2320 | 136 | static void | 75 | static void |
| 2321 | 137 | xpad_text_buffer_init (XpadTextBuffer *buffer) | 76 | xpad_text_buffer_init (XpadTextBuffer *buffer) |
| 2322 | 138 | { | 77 | { |
| 2324 | 139 | buffer->priv = XPAD_TEXT_BUFFER_GET_PRIVATE (buffer); | 78 | buffer->priv = xpad_text_buffer_get_instance_private(buffer); |
| 2325 | 140 | 79 | ||
| 2326 | 80 | buffer->priv->tag_table = create_tag_table (); | ||
| 2327 | 141 | buffer->priv->undo = xpad_undo_new (buffer); | 81 | buffer->priv->undo = xpad_undo_new (buffer); |
| 2328 | 142 | } | 82 | } |
| 2329 | 143 | 83 | ||
| 2330 | 84 | static void | ||
| 2331 | 85 | xpad_text_buffer_dispose (GObject *object) | ||
| 2332 | 86 | { | ||
| 2333 | 87 | XpadTextBuffer *buffer = XPAD_TEXT_BUFFER (object); | ||
| 2334 | 88 | |||
| 2335 | 89 | if (buffer->priv->pad) { | ||
| 2336 | 90 | g_object_unref (buffer->priv->pad); | ||
| 2337 | 91 | buffer->priv->pad = NULL; | ||
| 2338 | 92 | } | ||
| 2339 | 93 | |||
| 2340 | 94 | if (buffer->priv->undo) { | ||
| 2341 | 95 | g_object_unref (buffer->priv->undo); | ||
| 2342 | 96 | buffer->priv->undo = NULL; | ||
| 2343 | 97 | } | ||
| 2344 | 98 | |||
| 2345 | 99 | if (buffer->priv->tag_table) { | ||
| 2346 | 100 | g_object_unref(buffer->priv->tag_table); | ||
| 2347 | 101 | buffer->priv->tag_table = NULL; | ||
| 2348 | 102 | } | ||
| 2349 | 103 | G_OBJECT_CLASS (xpad_text_buffer_parent_class)->dispose (object); | ||
| 2350 | 104 | } | ||
| 2351 | 105 | |||
| 2352 | 106 | static void | ||
| 2353 | 107 | xpad_text_buffer_finalize (GObject *object) | ||
| 2354 | 108 | { | ||
| 2355 | 109 | G_OBJECT_CLASS (xpad_text_buffer_parent_class)->finalize (object); | ||
| 2356 | 110 | } | ||
| 2357 | 111 | |||
| 2358 | 112 | static void | ||
| 2359 | 113 | xpad_text_buffer_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | ||
| 2360 | 114 | { | ||
| 2361 | 115 | XpadTextBuffer *buffer = XPAD_TEXT_BUFFER (object); | ||
| 2362 | 116 | |||
| 2363 | 117 | switch (prop_id) | ||
| 2364 | 118 | { | ||
| 2365 | 119 | case PROP_PAD: | ||
| 2366 | 120 | if (buffer->priv->pad && G_IS_OBJECT (buffer->priv->pad)) | ||
| 2367 | 121 | g_object_unref (buffer->priv->pad); | ||
| 2368 | 122 | if (G_VALUE_HOLDS_POINTER (value) && G_IS_OBJECT (g_value_get_pointer (value))) | ||
| 2369 | 123 | { | ||
| 2370 | 124 | buffer->priv->pad = g_value_get_pointer (value); | ||
| 2371 | 125 | g_object_ref (buffer->priv->pad); | ||
| 2372 | 126 | } | ||
| 2373 | 127 | break; | ||
| 2374 | 128 | |||
| 2375 | 129 | default: | ||
| 2376 | 130 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 2377 | 131 | break; | ||
| 2378 | 132 | } | ||
| 2379 | 133 | } | ||
| 2380 | 134 | |||
| 2381 | 135 | static void | ||
| 2382 | 136 | xpad_text_buffer_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | ||
| 2383 | 137 | { | ||
| 2384 | 138 | XpadTextBuffer *buffer = XPAD_TEXT_BUFFER (object); | ||
| 2385 | 139 | |||
| 2386 | 140 | switch (prop_id) | ||
| 2387 | 141 | { | ||
| 2388 | 142 | case PROP_PAD: | ||
| 2389 | 143 | g_value_set_pointer (value, buffer->priv->pad); | ||
| 2390 | 144 | break; | ||
| 2391 | 145 | |||
| 2392 | 146 | default: | ||
| 2393 | 147 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 2394 | 148 | break; | ||
| 2395 | 149 | } | ||
| 2396 | 150 | } | ||
| 2397 | 151 | |||
| 2398 | 144 | void | 152 | void |
| 2399 | 145 | xpad_text_buffer_set_text_with_tags (XpadTextBuffer *buffer, const gchar *text) | 153 | xpad_text_buffer_set_text_with_tags (XpadTextBuffer *buffer, const gchar *text) |
| 2400 | 146 | { | 154 | { |
| 2401 | @@ -432,4 +440,3 @@ | |||
| 2402 | 432 | 440 | ||
| 2403 | 433 | g_object_set (G_OBJECT (buffer), "pad", pad, NULL); | 441 | g_object_set (G_OBJECT (buffer), "pad", pad, NULL); |
| 2404 | 434 | } | 442 | } |
| 2405 | 435 | |||
| 2406 | 436 | 443 | ||
| 2407 | === modified file 'src/xpad-text-buffer.h' | |||
| 2408 | --- src/xpad-text-buffer.h 2011-11-16 18:10:04 +0000 | |||
| 2409 | +++ src/xpad-text-buffer.h 2013-10-18 18:35:35 +0000 | |||
| 2410 | @@ -51,7 +51,7 @@ | |||
| 2411 | 51 | 51 | ||
| 2412 | 52 | GType xpad_text_buffer_get_type (void); | 52 | GType xpad_text_buffer_get_type (void); |
| 2413 | 53 | 53 | ||
| 2415 | 54 | XpadTextBuffer *xpad_text_buffer_new (XpadPad *pad); | 54 | XpadTextBuffer *xpad_text_buffer_new (void); |
| 2416 | 55 | 55 | ||
| 2417 | 56 | void xpad_text_buffer_set_text_with_tags (XpadTextBuffer *buffer, const gchar *text); | 56 | void xpad_text_buffer_set_text_with_tags (XpadTextBuffer *buffer, const gchar *text); |
| 2418 | 57 | gchar *xpad_text_buffer_get_text_with_tags (XpadTextBuffer *buffer); | 57 | gchar *xpad_text_buffer_get_text_with_tags (XpadTextBuffer *buffer); |
| 2419 | 58 | 58 | ||
| 2420 | === modified file 'src/xpad-text-view.c' | |||
| 2421 | --- src/xpad-text-view.c 2011-11-16 18:10:04 +0000 | |||
| 2422 | +++ src/xpad-text-view.c 2013-10-18 18:35:35 +0000 | |||
| 2423 | @@ -20,9 +20,6 @@ | |||
| 2424 | 20 | #include "xpad-text-buffer.h" | 20 | #include "xpad-text-buffer.h" |
| 2425 | 21 | #include "xpad-settings.h" | 21 | #include "xpad-settings.h" |
| 2426 | 22 | 22 | ||
| 2427 | 23 | G_DEFINE_TYPE(XpadTextView, xpad_text_view, GTK_TYPE_TEXT_VIEW) | ||
| 2428 | 24 | #define XPAD_TEXT_VIEW_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_TEXT_VIEW, XpadTextViewPrivate)) | ||
| 2429 | 25 | |||
| 2430 | 26 | struct XpadTextViewPrivate | 23 | struct XpadTextViewPrivate |
| 2431 | 27 | { | 24 | { |
| 2432 | 28 | gboolean follow_font_style; | 25 | gboolean follow_font_style; |
| 2433 | @@ -33,10 +30,13 @@ | |||
| 2434 | 33 | XpadTextBuffer *buffer; | 30 | XpadTextBuffer *buffer; |
| 2435 | 34 | }; | 31 | }; |
| 2436 | 35 | 32 | ||
| 2437 | 33 | G_DEFINE_TYPE_WITH_PRIVATE(XpadTextView, xpad_text_view, GTK_TYPE_TEXT_VIEW) | ||
| 2438 | 34 | |||
| 2439 | 36 | static void xpad_text_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | 35 | static void xpad_text_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
| 2440 | 37 | static void xpad_text_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | 36 | static void xpad_text_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
| 2441 | 37 | static void xpad_text_view_dispose (GObject *object); | ||
| 2442 | 38 | static void xpad_text_view_finalize (GObject *object); | ||
| 2443 | 38 | static void xpad_text_view_realize (XpadTextView *widget); | 39 | static void xpad_text_view_realize (XpadTextView *widget); |
| 2444 | 39 | static void xpad_text_view_finalize (GObject *object); | ||
| 2445 | 40 | static gboolean xpad_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event); | 40 | static gboolean xpad_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event); |
| 2446 | 41 | static gboolean xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event); | 41 | static gboolean xpad_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event); |
| 2447 | 42 | static void xpad_text_view_notify_edit_lock (XpadTextView *view); | 42 | static void xpad_text_view_notify_edit_lock (XpadTextView *view); |
| 2448 | @@ -64,7 +64,8 @@ | |||
| 2449 | 64 | xpad_text_view_class_init (XpadTextViewClass *klass) | 64 | xpad_text_view_class_init (XpadTextViewClass *klass) |
| 2450 | 65 | { | 65 | { |
| 2451 | 66 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 66 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 2453 | 67 | 67 | ||
| 2454 | 68 | gobject_class->dispose = xpad_text_view_dispose; | ||
| 2455 | 68 | gobject_class->finalize = xpad_text_view_finalize; | 69 | gobject_class->finalize = xpad_text_view_finalize; |
| 2456 | 69 | gobject_class->set_property = xpad_text_view_set_property; | 70 | gobject_class->set_property = xpad_text_view_set_property; |
| 2457 | 70 | gobject_class->get_property = xpad_text_view_get_property; | 71 | gobject_class->get_property = xpad_text_view_get_property; |
| 2458 | @@ -86,8 +87,6 @@ | |||
| 2459 | 86 | "Whether to use the default xpad color style", | 87 | "Whether to use the default xpad color style", |
| 2460 | 87 | TRUE, | 88 | TRUE, |
| 2461 | 88 | G_PARAM_READWRITE)); | 89 | G_PARAM_READWRITE)); |
| 2462 | 89 | |||
| 2463 | 90 | g_type_class_add_private (gobject_class, sizeof (XpadTextViewPrivate)); | ||
| 2464 | 91 | } | 90 | } |
| 2465 | 92 | 91 | ||
| 2466 | 93 | static void | 92 | static void |
| 2467 | @@ -95,12 +94,12 @@ | |||
| 2468 | 95 | { | 94 | { |
| 2469 | 96 | gchar *name; | 95 | gchar *name; |
| 2470 | 97 | 96 | ||
| 2472 | 98 | view->priv = XPAD_TEXT_VIEW_GET_PRIVATE (view); | 97 | view->priv = xpad_text_view_get_instance_private(view); |
| 2473 | 99 | 98 | ||
| 2474 | 100 | view->priv->follow_font_style = TRUE; | 99 | view->priv->follow_font_style = TRUE; |
| 2475 | 101 | view->priv->follow_color_style = TRUE; | 100 | view->priv->follow_color_style = TRUE; |
| 2476 | 102 | 101 | ||
| 2478 | 103 | view->priv->buffer = xpad_text_buffer_new (NULL); | 102 | view->priv->buffer = xpad_text_buffer_new(); |
| 2479 | 104 | gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER (view->priv->buffer)); | 103 | gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER (view->priv->buffer)); |
| 2480 | 105 | 104 | ||
| 2481 | 106 | gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); | 105 | gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); |
| 2482 | @@ -126,18 +125,20 @@ | |||
| 2483 | 126 | } | 125 | } |
| 2484 | 127 | 126 | ||
| 2485 | 128 | static void | 127 | static void |
| 2487 | 129 | xpad_text_view_finalize (GObject *object) | 128 | xpad_text_view_dispose (GObject *object) |
| 2488 | 130 | { | 129 | { |
| 2489 | 131 | XpadTextView *view = XPAD_TEXT_VIEW (object); | 130 | XpadTextView *view = XPAD_TEXT_VIEW (object); |
| 2490 | 132 | 131 | ||
| 2493 | 133 | if (view->priv->buffer) | 132 | if (view->priv->buffer) { |
| 2492 | 134 | { | ||
| 2494 | 135 | g_object_unref (view->priv->buffer); | 133 | g_object_unref (view->priv->buffer); |
| 2495 | 136 | view->priv->buffer = NULL; | ||
| 2496 | 137 | } | 134 | } |
| 2497 | 138 | 135 | ||
| 2500 | 139 | g_signal_handlers_disconnect_matched (xpad_settings (), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view); | 136 | G_OBJECT_CLASS (xpad_text_view_parent_class)->dispose (object); |
| 2501 | 140 | 137 | } | |
| 2502 | 138 | |||
| 2503 | 139 | static void | ||
| 2504 | 140 | xpad_text_view_finalize (GObject *object) | ||
| 2505 | 141 | { | ||
| 2506 | 141 | G_OBJECT_CLASS (xpad_text_view_parent_class)->finalize (object); | 142 | G_OBJECT_CLASS (xpad_text_view_parent_class)->finalize (object); |
| 2507 | 142 | } | 143 | } |
| 2508 | 143 | 144 | ||
| 2509 | 144 | 145 | ||
| 2510 | === modified file 'src/xpad-toolbar.c' | |||
| 2511 | --- src/xpad-toolbar.c 2011-11-16 20:39:04 +0000 | |||
| 2512 | +++ src/xpad-toolbar.c 2013-10-18 18:35:35 +0000 | |||
| 2513 | @@ -26,25 +26,24 @@ | |||
| 2514 | 26 | #include "xpad-settings.h" | 26 | #include "xpad-settings.h" |
| 2515 | 27 | #include "xpad-grip-tool-item.h" | 27 | #include "xpad-grip-tool-item.h" |
| 2516 | 28 | 28 | ||
| 2517 | 29 | G_DEFINE_TYPE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR) | ||
| 2518 | 30 | #define XPAD_TOOLBAR_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_TOOLBAR, XpadToolbarPrivate)) | ||
| 2519 | 31 | |||
| 2520 | 32 | enum { | ||
| 2521 | 33 | XPAD_BUTTON_TYPE_SEPARATOR, | ||
| 2522 | 34 | XPAD_BUTTON_TYPE_BUTTON, | ||
| 2523 | 35 | XPAD_BUTTON_TYPE_TOGGLE | ||
| 2524 | 36 | }; | ||
| 2525 | 37 | |||
| 2526 | 38 | struct XpadToolbarPrivate | 29 | struct XpadToolbarPrivate |
| 2527 | 39 | { | 30 | { |
| 2528 | 40 | GtkToolItem *move_button; | ||
| 2529 | 41 | gboolean move_removed; | 31 | gboolean move_removed; |
| 2530 | 42 | guint move_index; | 32 | guint move_index; |
| 2531 | 43 | guint move_motion_handler; | 33 | guint move_motion_handler; |
| 2532 | 44 | guint move_button_release_handler; | 34 | guint move_button_release_handler; |
| 2533 | 45 | guint move_key_press_handler; | 35 | guint move_key_press_handler; |
| 2534 | 46 | GtkToolItem *tool_items; | ||
| 2535 | 47 | XpadPad *pad; | 36 | XpadPad *pad; |
| 2536 | 37 | // GtkToolItem *move_button; | ||
| 2537 | 38 | // GtkToolItem *tool_items; | ||
| 2538 | 39 | }; | ||
| 2539 | 40 | |||
| 2540 | 41 | G_DEFINE_TYPE_WITH_PRIVATE(XpadToolbar, xpad_toolbar, GTK_TYPE_TOOLBAR) | ||
| 2541 | 42 | |||
| 2542 | 43 | enum { | ||
| 2543 | 44 | XPAD_BUTTON_TYPE_SEPARATOR, | ||
| 2544 | 45 | XPAD_BUTTON_TYPE_BUTTON, | ||
| 2545 | 46 | XPAD_BUTTON_TYPE_TOGGLE | ||
| 2546 | 48 | }; | 47 | }; |
| 2547 | 49 | 48 | ||
| 2548 | 50 | typedef struct | 49 | typedef struct |
| 2549 | @@ -94,26 +93,28 @@ | |||
| 2550 | 94 | /*{"Minimize to Tray", "gtk-goto-bottom", 1, N_("Minimize Pads to System Tray")}*/ | 93 | /*{"Minimize to Tray", "gtk-goto-bottom", 1, N_("Minimize Pads to System Tray")}*/ |
| 2551 | 95 | }; | 94 | }; |
| 2552 | 96 | 95 | ||
| 2553 | 97 | |||
| 2554 | 98 | static G_CONST_RETURN XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name); | 96 | static G_CONST_RETURN XpadToolbarButton *xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name); |
| 2555 | 99 | static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button); | 97 | static GtkToolItem *xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button); |
| 2556 | 100 | static void xpad_toolbar_button_activated (GtkToolButton *button); | 98 | static void xpad_toolbar_button_activated (GtkToolButton *button); |
| 2557 | 101 | static void xpad_toolbar_change_buttons (XpadToolbar *toolbar); | 99 | static void xpad_toolbar_change_buttons (XpadToolbar *toolbar); |
| 2558 | 100 | static void xpad_toolbar_dispose (GObject *object); | ||
| 2559 | 102 | static void xpad_toolbar_finalize (GObject *object); | 101 | static void xpad_toolbar_finalize (GObject *object); |
| 2560 | 103 | static void xpad_toolbar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | 102 | static void xpad_toolbar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
| 2561 | 104 | static void xpad_toolbar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | 103 | static void xpad_toolbar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
| 2562 | 105 | static void xpad_toolbar_remove_all_buttons (); | 104 | static void xpad_toolbar_remove_all_buttons (); |
| 2563 | 106 | static void xpad_toolbar_remove_last_button (); | 105 | static void xpad_toolbar_remove_last_button (); |
| 2564 | 107 | static void xpad_toolbar_add_button (const gchar *button_name); | 106 | static void xpad_toolbar_add_button (const gchar *button_name); |
| 2565 | 107 | static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button); | ||
| 2566 | 108 | |||
| 2567 | 109 | /* Unfinished new feature of previous developer | ||
| 2568 | 108 | static void xpad_toolbar_remove_button (GtkWidget *button); | 110 | static void xpad_toolbar_remove_button (GtkWidget *button); |
| 2569 | 109 | static gboolean xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event); | 111 | static gboolean xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event); |
| 2570 | 110 | static gboolean xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button); | ||
| 2571 | 111 | static gboolean xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar); | 112 | static gboolean xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar); |
| 2572 | 112 | |||
| 2573 | 113 | static gboolean xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button); | 113 | static gboolean xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button); |
| 2574 | 114 | static gboolean xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event); | 114 | static gboolean xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event); |
| 2575 | 115 | static gboolean xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event); | 115 | static gboolean xpad_toolbar_move_button_move_keyboard (XpadToolbar *toolbar, GdkEventKey *event); |
| 2576 | 116 | static gboolean xpad_toolbar_move_button_end (XpadToolbar *toolbar); | 116 | static gboolean xpad_toolbar_move_button_end (XpadToolbar *toolbar); |
| 2577 | 117 | */ | ||
| 2578 | 117 | 118 | ||
| 2579 | 118 | static guint signals[LAST_SIGNAL] = { 0 }; | 119 | static guint signals[LAST_SIGNAL] = { 0 }; |
| 2580 | 119 | 120 | ||
| 2581 | @@ -139,6 +140,7 @@ | |||
| 2582 | 139 | gtktoolbar_class->popup_context_menu = xpad_toolbar_popup_context_menu; | 140 | gtktoolbar_class->popup_context_menu = xpad_toolbar_popup_context_menu; |
| 2583 | 140 | gobject_class->set_property = xpad_toolbar_set_property; | 141 | gobject_class->set_property = xpad_toolbar_set_property; |
| 2584 | 141 | gobject_class->get_property = xpad_toolbar_get_property; | 142 | gobject_class->get_property = xpad_toolbar_get_property; |
| 2585 | 143 | gobject_class->dispose = xpad_toolbar_dispose; | ||
| 2586 | 142 | gobject_class->finalize = xpad_toolbar_finalize; | 144 | gobject_class->finalize = xpad_toolbar_finalize; |
| 2587 | 143 | 145 | ||
| 2588 | 144 | /* Signals */ | 146 | /* Signals */ |
| 2589 | @@ -260,16 +262,13 @@ | |||
| 2590 | 260 | "Pad ", | 262 | "Pad ", |
| 2591 | 261 | "Pad associated with this toolbar", | 263 | "Pad associated with this toolbar", |
| 2592 | 262 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); | 264 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
| 2593 | 263 | |||
| 2594 | 264 | g_type_class_add_private (gobject_class, sizeof (XpadToolbarPrivate)); | ||
| 2595 | 265 | } | 265 | } |
| 2596 | 266 | 266 | ||
| 2597 | 267 | static void | 267 | static void |
| 2598 | 268 | xpad_toolbar_init (XpadToolbar *toolbar) | 268 | xpad_toolbar_init (XpadToolbar *toolbar) |
| 2599 | 269 | { | 269 | { |
| 2601 | 270 | toolbar->priv = XPAD_TOOLBAR_GET_PRIVATE (toolbar); | 270 | toolbar->priv = xpad_toolbar_get_instance_private(toolbar); |
| 2602 | 271 | 271 | ||
| 2603 | 272 | toolbar->priv->pad = NULL; | ||
| 2604 | 273 | toolbar->priv->move_motion_handler = 0; | 272 | toolbar->priv->move_motion_handler = 0; |
| 2605 | 274 | toolbar->priv->move_button_release_handler = 0; | 273 | toolbar->priv->move_button_release_handler = 0; |
| 2606 | 275 | toolbar->priv->move_key_press_handler = 0; | 274 | toolbar->priv->move_key_press_handler = 0; |
| 2607 | @@ -286,17 +285,21 @@ | |||
| 2608 | 286 | } | 285 | } |
| 2609 | 287 | 286 | ||
| 2610 | 288 | static void | 287 | static void |
| 2611 | 288 | xpad_toolbar_dispose (GObject *object) | ||
| 2612 | 289 | { | ||
| 2613 | 290 | XpadToolbar *toolbar = XPAD_TOOLBAR (object); | ||
| 2614 | 291 | |||
| 2615 | 292 | if (toolbar->priv->pad) { | ||
| 2616 | 293 | g_object_unref (toolbar->priv->pad); | ||
| 2617 | 294 | toolbar->priv->pad = NULL; | ||
| 2618 | 295 | } | ||
| 2619 | 296 | |||
| 2620 | 297 | G_OBJECT_CLASS (xpad_toolbar_parent_class)->dispose (object); | ||
| 2621 | 298 | } | ||
| 2622 | 299 | |||
| 2623 | 300 | static void | ||
| 2624 | 289 | xpad_toolbar_finalize (GObject *object) | 301 | xpad_toolbar_finalize (GObject *object) |
| 2625 | 290 | { | 302 | { |
| 2626 | 291 | XpadToolbar *toolbar = XPAD_TOOLBAR (object); | ||
| 2627 | 292 | |||
| 2628 | 293 | if (toolbar->priv->move_button) | ||
| 2629 | 294 | g_object_unref (toolbar->priv->move_button); | ||
| 2630 | 295 | if (toolbar->priv->pad) | ||
| 2631 | 296 | g_object_unref (toolbar->priv->pad); | ||
| 2632 | 297 | |||
| 2633 | 298 | g_signal_handlers_disconnect_matched (xpad_settings (), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, toolbar); | ||
| 2634 | 299 | |||
| 2635 | 300 | G_OBJECT_CLASS (xpad_toolbar_parent_class)->finalize (object); | 303 | G_OBJECT_CLASS (xpad_toolbar_parent_class)->finalize (object); |
| 2636 | 301 | } | 304 | } |
| 2637 | 302 | 305 | ||
| 2638 | @@ -340,30 +343,10 @@ | |||
| 2639 | 340 | } | 343 | } |
| 2640 | 341 | } | 344 | } |
| 2641 | 342 | 345 | ||
| 2642 | 343 | static gboolean | ||
| 2643 | 344 | xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event) | ||
| 2644 | 345 | { | ||
| 2645 | 346 | /* Ignore double-clicks and triple-clicks */ | ||
| 2646 | 347 | if (event->button == 3 && event->type == GDK_BUTTON_PRESS) | ||
| 2647 | 348 | { | ||
| 2648 | 349 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
| 2649 | 350 | xpad_toolbar_popup_button_menu (widget, event, toolbar); | ||
| 2650 | 351 | return TRUE; | ||
| 2651 | 352 | } | ||
| 2652 | 353 | else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) | ||
| 2653 | 354 | { | ||
| 2654 | 355 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
| 2655 | 356 | xpad_toolbar_move_button_start (toolbar, widget); | ||
| 2656 | 357 | return TRUE; | ||
| 2657 | 358 | } | ||
| 2658 | 359 | |||
| 2659 | 360 | return FALSE; | ||
| 2660 | 361 | } | ||
| 2661 | 362 | |||
| 2662 | 363 | static G_CONST_RETURN XpadToolbarButton * | 346 | static G_CONST_RETURN XpadToolbarButton * |
| 2663 | 364 | xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name) | 347 | xpad_toolbar_button_lookup (XpadToolbar *toolbar, const gchar *name) |
| 2664 | 365 | { | 348 | { |
| 2666 | 366 | gint i; | 349 | guint i; |
| 2667 | 367 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) | 350 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) |
| 2668 | 368 | if (!g_ascii_strcasecmp (name, buttons[i].name)) | 351 | if (!g_ascii_strcasecmp (name, buttons[i].name)) |
| 2669 | 369 | return &buttons[i]; | 352 | return &buttons[i]; |
| 2670 | @@ -375,7 +358,7 @@ | |||
| 2671 | 375 | xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button) | 358 | xpad_toolbar_button_to_item (XpadToolbar *toolbar, const XpadToolbarButton *button) |
| 2672 | 376 | { | 359 | { |
| 2673 | 377 | GtkToolItem *item; | 360 | GtkToolItem *item; |
| 2675 | 378 | GtkWidget *child; | 361 | // GtkWidget *child; |
| 2676 | 379 | 362 | ||
| 2677 | 380 | item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name)); | 363 | item = GTK_TOOL_ITEM (g_object_get_data (G_OBJECT (toolbar), button->name)); |
| 2678 | 381 | if (item) | 364 | if (item) |
| 2679 | @@ -406,17 +389,6 @@ | |||
| 2680 | 406 | if (button->desc) | 389 | if (button->desc) |
| 2681 | 407 | gtk_tool_item_set_tooltip_text (item, _(button->desc)); | 390 | gtk_tool_item_set_tooltip_text (item, _(button->desc)); |
| 2682 | 408 | 391 | ||
| 2683 | 409 | // This won't work anymore because we make some buttons insensitive | ||
| 2684 | 410 | // so we cannot handle right clicks on them anymore. That's why we just add "Remove all butons" | ||
| 2685 | 411 | // and "Remove last button" to toolbar context menu | ||
| 2686 | 412 | /* | ||
| 2687 | 413 | child = gtk_bin_get_child (GTK_BIN (item)); | ||
| 2688 | 414 | if (child) | ||
| 2689 | 415 | { | ||
| 2690 | 416 | g_signal_connect_swapped (child, "button-press-event", G_CALLBACK (xpad_toolbar_button_press_event), item); | ||
| 2691 | 417 | } | ||
| 2692 | 418 | */ | ||
| 2693 | 419 | |||
| 2694 | 420 | return item; | 392 | return item; |
| 2695 | 421 | } | 393 | } |
| 2696 | 422 | 394 | ||
| 2697 | @@ -437,7 +409,8 @@ | |||
| 2698 | 437 | { | 409 | { |
| 2699 | 438 | GList *list, *temp; | 410 | GList *list, *temp; |
| 2700 | 439 | const GSList *slist, *stemp; | 411 | const GSList *slist, *stemp; |
| 2702 | 440 | gint i = 0, j; | 412 | gint i = 0; |
| 2703 | 413 | guint j = 0; | ||
| 2704 | 441 | GtkToolItem *item; | 414 | GtkToolItem *item; |
| 2705 | 442 | 415 | ||
| 2706 | 443 | list = gtk_container_get_children (GTK_CONTAINER (toolbar)); | 416 | list = gtk_container_get_children (GTK_CONTAINER (toolbar)); |
| 2707 | @@ -446,6 +419,7 @@ | |||
| 2708 | 446 | gtk_widget_destroy (temp->data); | 419 | gtk_widget_destroy (temp->data); |
| 2709 | 447 | 420 | ||
| 2710 | 448 | g_list_free (list); | 421 | g_list_free (list); |
| 2711 | 422 | g_list_free (temp); | ||
| 2712 | 449 | 423 | ||
| 2713 | 450 | for (j = 0; j < G_N_ELEMENTS (buttons); j++) | 424 | for (j = 0; j < G_N_ELEMENTS (buttons); j++) |
| 2714 | 451 | g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL); | 425 | g_object_set_data (G_OBJECT (toolbar), buttons[j].name, NULL); |
| 2715 | @@ -510,48 +484,247 @@ | |||
| 2716 | 510 | } | 484 | } |
| 2717 | 511 | 485 | ||
| 2718 | 512 | static void | 486 | static void |
| 2719 | 487 | menu_deactivated (GtkWidget *menu, GtkToolbar *toolbar) | ||
| 2720 | 488 | { | ||
| 2721 | 489 | g_signal_emit (toolbar, signals[POPDOWN], 0, menu); | ||
| 2722 | 490 | } | ||
| 2723 | 491 | |||
| 2724 | 492 | static gboolean | ||
| 2725 | 493 | xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button) | ||
| 2726 | 494 | { | ||
| 2727 | 495 | GtkWidget *menu; | ||
| 2728 | 496 | const GSList *current_buttons; | ||
| 2729 | 497 | guint i; | ||
| 2730 | 498 | |||
| 2731 | 499 | menu = gtk_menu_new (); | ||
| 2732 | 500 | |||
| 2733 | 501 | current_buttons = xpad_settings_get_toolbar_buttons (xpad_settings ()); | ||
| 2734 | 502 | |||
| 2735 | 503 | gboolean is_button = FALSE; | ||
| 2736 | 504 | |||
| 2737 | 505 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) | ||
| 2738 | 506 | { | ||
| 2739 | 507 | const GSList *j; | ||
| 2740 | 508 | GtkWidget *item, *image; | ||
| 2741 | 509 | |||
| 2742 | 510 | if (strcmp (buttons[i].name, "sep") != 0) | ||
| 2743 | 511 | { | ||
| 2744 | 512 | for (j = current_buttons; j; j = j->next) | ||
| 2745 | 513 | if (!g_ascii_strcasecmp (j->data, buttons[i].name)) | ||
| 2746 | 514 | break; | ||
| 2747 | 515 | |||
| 2748 | 516 | if (j) | ||
| 2749 | 517 | { | ||
| 2750 | 518 | is_button = TRUE; | ||
| 2751 | 519 | continue; | ||
| 2752 | 520 | } | ||
| 2753 | 521 | } | ||
| 2754 | 522 | else | ||
| 2755 | 523 | { | ||
| 2756 | 524 | /* Don't let user add separators until we can allow clicks on them. */ | ||
| 2757 | 525 | continue; | ||
| 2758 | 526 | } | ||
| 2759 | 527 | |||
| 2760 | 528 | item = gtk_image_menu_item_new_with_mnemonic (buttons[i].menu_desc); | ||
| 2761 | 529 | |||
| 2762 | 530 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 2763 | 531 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 2764 | 532 | |||
| 2765 | 533 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name); | ||
| 2766 | 534 | |||
| 2767 | 535 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 2768 | 536 | gtk_widget_show (item); | ||
| 2769 | 537 | } | ||
| 2770 | 538 | |||
| 2771 | 539 | if (is_button) | ||
| 2772 | 540 | { | ||
| 2773 | 541 | GtkWidget *item, *image; | ||
| 2774 | 542 | |||
| 2775 | 543 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remove All _Buttons")); | ||
| 2776 | 544 | |||
| 2777 | 545 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 2778 | 546 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 2779 | 547 | |||
| 2780 | 548 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL); | ||
| 2781 | 549 | |||
| 2782 | 550 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 2783 | 551 | gtk_widget_show (item); | ||
| 2784 | 552 | |||
| 2785 | 553 | i++; | ||
| 2786 | 554 | |||
| 2787 | 555 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remo_ve Last Button")); | ||
| 2788 | 556 | |||
| 2789 | 557 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 2790 | 558 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 2791 | 559 | |||
| 2792 | 560 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL); | ||
| 2793 | 561 | |||
| 2794 | 562 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 2795 | 563 | gtk_widget_show (item); | ||
| 2796 | 564 | } | ||
| 2797 | 565 | |||
| 2798 | 566 | g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar); | ||
| 2799 | 567 | |||
| 2800 | 568 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, (guint) ((button < 0) ? 0 : button), gtk_get_current_event_time ()); | ||
| 2801 | 569 | |||
| 2802 | 570 | g_signal_emit (toolbar, signals[POPUP], 0, menu); | ||
| 2803 | 571 | |||
| 2804 | 572 | return TRUE; | ||
| 2805 | 573 | } | ||
| 2806 | 574 | |||
| 2807 | 575 | static void | ||
| 2808 | 576 | xpad_toolbar_enable_button (XpadToolbar *toolbar, const XpadToolbarButton *button, gboolean enable) | ||
| 2809 | 577 | { | ||
| 2810 | 578 | g_return_if_fail (button); | ||
| 2811 | 579 | GtkToolItem *item = xpad_toolbar_button_to_item (toolbar, button); | ||
| 2812 | 580 | if (item) | ||
| 2813 | 581 | gtk_widget_set_sensitive (GTK_WIDGET (item), enable); | ||
| 2814 | 582 | } | ||
| 2815 | 583 | |||
| 2816 | 584 | void | ||
| 2817 | 585 | xpad_toolbar_enable_undo_button (XpadToolbar *toolbar, gboolean enable) | ||
| 2818 | 586 | { | ||
| 2819 | 587 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Undo"); | ||
| 2820 | 588 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 2821 | 589 | } | ||
| 2822 | 590 | |||
| 2823 | 591 | void | ||
| 2824 | 592 | xpad_toolbar_enable_redo_button (XpadToolbar *toolbar, gboolean enable) | ||
| 2825 | 593 | { | ||
| 2826 | 594 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Redo"); | ||
| 2827 | 595 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 2828 | 596 | } | ||
| 2829 | 597 | |||
| 2830 | 598 | void | ||
| 2831 | 599 | xpad_toolbar_enable_cut_button (XpadToolbar *toolbar, gboolean enable) | ||
| 2832 | 600 | { | ||
| 2833 | 601 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Cut"); | ||
| 2834 | 602 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 2835 | 603 | } | ||
| 2836 | 604 | |||
| 2837 | 605 | void | ||
| 2838 | 606 | xpad_toolbar_enable_copy_button (XpadToolbar *toolbar, gboolean enable) | ||
| 2839 | 607 | { | ||
| 2840 | 608 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Copy"); | ||
| 2841 | 609 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 2842 | 610 | } | ||
| 2843 | 611 | |||
| 2844 | 612 | void | ||
| 2845 | 613 | xpad_toolbar_enable_paste_button (XpadToolbar *toolbar, gboolean enable) | ||
| 2846 | 614 | { | ||
| 2847 | 615 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste"); | ||
| 2848 | 616 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 2849 | 617 | } | ||
| 2850 | 618 | |||
| 2851 | 619 | /* | ||
| 2852 | 620 | * The code below was code in progress of a previous developer | ||
| 2853 | 621 | static gboolean | ||
| 2854 | 622 | xpad_toolbar_button_press_event (GtkWidget *widget, GdkEventButton *event) | ||
| 2855 | 623 | { | ||
| 2856 | 624 | // Ignore double-clicks and triple-clicks | ||
| 2857 | 625 | if (event->button == 3 && event->type == GDK_BUTTON_PRESS) | ||
| 2858 | 626 | { | ||
| 2859 | 627 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
| 2860 | 628 | xpad_toolbar_popup_button_menu (widget, event, toolbar); | ||
| 2861 | 629 | return TRUE; | ||
| 2862 | 630 | } | ||
| 2863 | 631 | else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) | ||
| 2864 | 632 | { | ||
| 2865 | 633 | XpadToolbar *toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (widget), "xpad-toolbar")); | ||
| 2866 | 634 | xpad_toolbar_move_button_start (toolbar, widget); | ||
| 2867 | 635 | return TRUE; | ||
| 2868 | 636 | } | ||
| 2869 | 637 | |||
| 2870 | 638 | return FALSE; | ||
| 2871 | 639 | } | ||
| 2872 | 640 | |||
| 2873 | 641 | static gboolean | ||
| 2874 | 642 | xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar) | ||
| 2875 | 643 | { | ||
| 2876 | 644 | GtkWidget *menu; | ||
| 2877 | 645 | GtkWidget *item, *image; | ||
| 2878 | 646 | |||
| 2879 | 647 | menu = gtk_menu_new (); | ||
| 2880 | 648 | |||
| 2881 | 649 | |||
| 2882 | 650 | item = gtk_image_menu_item_new_with_mnemonic (_("_Remove From Toolbar")); | ||
| 2883 | 651 | |||
| 2884 | 652 | image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); | ||
| 2885 | 653 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 2886 | 654 | |||
| 2887 | 655 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_button), button); | ||
| 2888 | 656 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 0, 1); | ||
| 2889 | 657 | gtk_widget_show (item); | ||
| 2890 | 658 | |||
| 2891 | 659 | |||
| 2892 | 660 | item = gtk_menu_item_new_with_mnemonic (_("_Move")); | ||
| 2893 | 661 | g_signal_connect_swapped (item, "activate", G_CALLBACK (move_menu_item_activated), button); | ||
| 2894 | 662 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 1, 2); | ||
| 2895 | 663 | gtk_widget_show (item); | ||
| 2896 | 664 | |||
| 2897 | 665 | |||
| 2898 | 666 | g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar); | ||
| 2899 | 667 | |||
| 2900 | 668 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event ? event->button : 0, gtk_get_current_event_time ()); | ||
| 2901 | 669 | |||
| 2902 | 670 | g_signal_emit (toolbar, signals[POPUP], 0, menu); | ||
| 2903 | 671 | |||
| 2904 | 672 | return TRUE; | ||
| 2905 | 673 | } | ||
| 2906 | 674 | |||
| 2907 | 675 | static void | ||
| 2908 | 513 | xpad_toolbar_remove_button (GtkWidget *button) | 676 | xpad_toolbar_remove_button (GtkWidget *button) |
| 2909 | 514 | { | 677 | { |
| 2910 | 515 | gint button_num; | 678 | gint button_num; |
| 2912 | 516 | 679 | ||
| 2913 | 517 | button_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); | 680 | button_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); |
| 2915 | 518 | 681 | ||
| 2916 | 519 | xpad_settings_remove_toolbar_button (xpad_settings (), button_num); | 682 | xpad_settings_remove_toolbar_button (xpad_settings (), button_num); |
| 2917 | 520 | } | 683 | } |
| 2918 | 521 | 684 | ||
| 2919 | 685 | static void | ||
| 2920 | 686 | move_menu_item_activated (GtkWidget *button) | ||
| 2921 | 687 | { | ||
| 2922 | 688 | XpadToolbar *toolbar; | ||
| 2923 | 689 | |||
| 2924 | 690 | toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (button), "xpad-toolbar")); | ||
| 2925 | 691 | |||
| 2926 | 692 | xpad_toolbar_move_button_start (toolbar, button); | ||
| 2927 | 693 | } | ||
| 2928 | 694 | |||
| 2929 | 522 | static gboolean | 695 | static gboolean |
| 2930 | 523 | xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button) | 696 | xpad_toolbar_move_button_start (XpadToolbar *toolbar, GtkWidget *button) |
| 2931 | 524 | { | 697 | { |
| 2932 | 525 | GdkGrabStatus status; | 698 | GdkGrabStatus status; |
| 2933 | 526 | GdkCursor *fleur_cursor; | 699 | GdkCursor *fleur_cursor; |
| 2934 | 527 | GtkWidget *widget; | 700 | GtkWidget *widget; |
| 2936 | 528 | 701 | ||
| 2937 | 529 | widget = GTK_WIDGET (toolbar); | 702 | widget = GTK_WIDGET (toolbar); |
| 2938 | 530 | gtk_grab_add (widget); | 703 | gtk_grab_add (widget); |
| 2940 | 531 | 704 | ||
| 2941 | 532 | fleur_cursor = gdk_cursor_new (GDK_FLEUR); | 705 | fleur_cursor = gdk_cursor_new (GDK_FLEUR); |
| 2944 | 533 | 706 | ||
| 2945 | 534 | g_object_ref (button); | 707 | // g_object_ref (button); |
| 2946 | 535 | toolbar->priv->move_removed = FALSE; | 708 | toolbar->priv->move_removed = FALSE; |
| 2947 | 536 | toolbar->priv->move_button = GTK_TOOL_ITEM (button); | 709 | toolbar->priv->move_button = GTK_TOOL_ITEM (button); |
| 2948 | 537 | toolbar->priv->move_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); | 710 | toolbar->priv->move_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "xpad-button-num")); |
| 2950 | 538 | 711 | ||
| 2951 | 539 | toolbar->priv->move_button_release_handler = g_signal_connect (toolbar, "button-release-event", G_CALLBACK (xpad_toolbar_move_button_end), NULL); | 712 | toolbar->priv->move_button_release_handler = g_signal_connect (toolbar, "button-release-event", G_CALLBACK (xpad_toolbar_move_button_end), NULL); |
| 2952 | 540 | toolbar->priv->move_key_press_handler = g_signal_connect (toolbar, "key-press-event", G_CALLBACK (xpad_toolbar_move_button_move_keyboard), NULL); | 713 | toolbar->priv->move_key_press_handler = g_signal_connect (toolbar, "key-press-event", G_CALLBACK (xpad_toolbar_move_button_move_keyboard), NULL); |
| 2953 | 541 | toolbar->priv->move_motion_handler = g_signal_connect (toolbar, "motion-notify-event", G_CALLBACK (xpad_toolbar_move_button_move), NULL); | 714 | toolbar->priv->move_motion_handler = g_signal_connect (toolbar, "motion-notify-event", G_CALLBACK (xpad_toolbar_move_button_move), NULL); |
| 2955 | 542 | 715 | ||
| 2956 | 543 | status = gdk_pointer_grab (widget->window, FALSE, | 716 | status = gdk_pointer_grab (widget->window, FALSE, |
| 2957 | 544 | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, | 717 | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, |
| 2958 | 545 | fleur_cursor, gtk_get_current_event_time ()); | 718 | fleur_cursor, gtk_get_current_event_time ()); |
| 2960 | 546 | 719 | ||
| 2961 | 547 | gdk_cursor_unref (fleur_cursor); | 720 | gdk_cursor_unref (fleur_cursor); |
| 2962 | 548 | gdk_flush (); | 721 | gdk_flush (); |
| 2964 | 549 | 722 | ||
| 2965 | 550 | if (status != GDK_GRAB_SUCCESS) | 723 | if (status != GDK_GRAB_SUCCESS) |
| 2966 | 551 | { | 724 | { |
| 2967 | 552 | xpad_toolbar_move_button_end (toolbar); | 725 | xpad_toolbar_move_button_end (toolbar); |
| 2968 | 553 | } | 726 | } |
| 2970 | 554 | 727 | ||
| 2971 | 555 | return TRUE; | 728 | return TRUE; |
| 2972 | 556 | } | 729 | } |
| 2973 | 557 | 730 | ||
| 2974 | @@ -565,27 +738,27 @@ | |||
| 2975 | 565 | toolbar->priv->move_removed = TRUE; | 738 | toolbar->priv->move_removed = TRUE; |
| 2976 | 566 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | 739 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); |
| 2977 | 567 | } | 740 | } |
| 2979 | 568 | 741 | ||
| 2980 | 569 | if (toolbar->priv->move_index > 0) | 742 | if (toolbar->priv->move_index > 0) |
| 2981 | 570 | toolbar->priv->move_index--; | 743 | toolbar->priv->move_index--; |
| 2983 | 571 | 744 | ||
| 2984 | 572 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | 745 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); |
| 2985 | 573 | } | 746 | } |
| 2986 | 574 | else if (event->keyval == GDK_Right || event->keyval == GDK_KP_Right) | 747 | else if (event->keyval == GDK_Right || event->keyval == GDK_KP_Right) |
| 2987 | 575 | { | 748 | { |
| 2988 | 576 | gint max; | 749 | gint max; |
| 2990 | 577 | 750 | ||
| 2991 | 578 | if (!toolbar->priv->move_removed) | 751 | if (!toolbar->priv->move_removed) |
| 2992 | 579 | { | 752 | { |
| 2993 | 580 | toolbar->priv->move_removed = TRUE; | 753 | toolbar->priv->move_removed = TRUE; |
| 2994 | 581 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | 754 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); |
| 2995 | 582 | } | 755 | } |
| 2997 | 583 | 756 | ||
| 2998 | 584 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | 757 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; |
| 3000 | 585 | 758 | ||
| 3001 | 586 | if (toolbar->priv->move_index < max) | 759 | if (toolbar->priv->move_index < max) |
| 3002 | 587 | toolbar->priv->move_index++; | 760 | toolbar->priv->move_index++; |
| 3004 | 588 | 761 | ||
| 3005 | 589 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | 762 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); |
| 3006 | 590 | } | 763 | } |
| 3007 | 591 | else if (event->keyval == GDK_space || event->keyval == GDK_KP_Space || event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) | 764 | else if (event->keyval == GDK_space || event->keyval == GDK_KP_Space || event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) |
| 3008 | @@ -593,7 +766,7 @@ | |||
| 3009 | 593 | xpad_toolbar_move_button_end (toolbar); | 766 | xpad_toolbar_move_button_end (toolbar); |
| 3010 | 594 | return TRUE; | 767 | return TRUE; |
| 3011 | 595 | } | 768 | } |
| 3013 | 596 | 769 | ||
| 3014 | 597 | return TRUE; | 770 | return TRUE; |
| 3015 | 598 | } | 771 | } |
| 3016 | 599 | 772 | ||
| 3017 | @@ -601,21 +774,21 @@ | |||
| 3018 | 601 | xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event) | 774 | xpad_toolbar_move_button_move (XpadToolbar *toolbar, GdkEventMotion *event) |
| 3019 | 602 | { | 775 | { |
| 3020 | 603 | gint max; | 776 | gint max; |
| 3022 | 604 | 777 | ||
| 3023 | 605 | if (!toolbar->priv->move_removed) | 778 | if (!toolbar->priv->move_removed) |
| 3024 | 606 | { | 779 | { |
| 3025 | 607 | toolbar->priv->move_removed = TRUE; | 780 | toolbar->priv->move_removed = TRUE; |
| 3026 | 608 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); | 781 | gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->priv->move_button)); |
| 3027 | 609 | } | 782 | } |
| 3029 | 610 | 783 | ||
| 3030 | 611 | toolbar->priv->move_index = gtk_toolbar_get_drop_index (GTK_TOOLBAR (toolbar), event->x, event->y); | 784 | toolbar->priv->move_index = gtk_toolbar_get_drop_index (GTK_TOOLBAR (toolbar), event->x, event->y); |
| 3033 | 612 | 785 | ||
| 3034 | 613 | /* Must not move past separator or grip */ | 786 | // Must not move past separator or grip |
| 3035 | 614 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | 787 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; |
| 3036 | 615 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); | 788 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); |
| 3038 | 616 | 789 | ||
| 3039 | 617 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | 790 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); |
| 3041 | 618 | 791 | ||
| 3042 | 619 | return TRUE; | 792 | return TRUE; |
| 3043 | 620 | } | 793 | } |
| 3044 | 621 | 794 | ||
| 3045 | @@ -624,210 +797,34 @@ | |||
| 3046 | 624 | { | 797 | { |
| 3047 | 625 | gint old_spot; | 798 | gint old_spot; |
| 3048 | 626 | gint max; | 799 | gint max; |
| 3050 | 627 | 800 | ||
| 3051 | 628 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_button_release_handler); | 801 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_button_release_handler); |
| 3052 | 629 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_key_press_handler); | 802 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_key_press_handler); |
| 3053 | 630 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_motion_handler); | 803 | g_signal_handler_disconnect (toolbar, toolbar->priv->move_motion_handler); |
| 3054 | 631 | toolbar->priv->move_button_release_handler = 0; | 804 | toolbar->priv->move_button_release_handler = 0; |
| 3055 | 632 | toolbar->priv->move_key_press_handler = 0; | 805 | toolbar->priv->move_key_press_handler = 0; |
| 3056 | 633 | toolbar->priv->move_motion_handler = 0; | 806 | toolbar->priv->move_motion_handler = 0; |
| 3058 | 634 | 807 | ||
| 3059 | 635 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), NULL, 0); | 808 | gtk_toolbar_set_drop_highlight_item (GTK_TOOLBAR (toolbar), NULL, 0); |
| 3061 | 636 | 809 | ||
| 3062 | 637 | old_spot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (toolbar->priv->move_button), "xpad-button-num")); | 810 | old_spot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (toolbar->priv->move_button), "xpad-button-num")); |
| 3065 | 638 | 811 | ||
| 3066 | 639 | /* Must not move past separator or grip */ | 812 | // Must not move past separator or grip |
| 3067 | 640 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; | 813 | max = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar)) - 2; |
| 3068 | 641 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); | 814 | toolbar->priv->move_index = MIN (toolbar->priv->move_index, max); |
| 3070 | 642 | 815 | ||
| 3071 | 643 | if (!xpad_settings_move_toolbar_button (xpad_settings (), old_spot, toolbar->priv->move_index) && | 816 | if (!xpad_settings_move_toolbar_button (xpad_settings (), old_spot, toolbar->priv->move_index) && |
| 3072 | 644 | toolbar->priv->move_removed) | 817 | toolbar->priv->move_removed) |
| 3073 | 645 | { | 818 | { |
| 3074 | 646 | gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); | 819 | gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar->priv->move_button, toolbar->priv->move_index); |
| 3075 | 647 | } | 820 | } |
| 3078 | 648 | 821 | ||
| 3079 | 649 | g_object_unref (toolbar->priv->move_button); | 822 | // g_object_unref (toolbar->priv->move_button); |
| 3080 | 650 | toolbar->priv->move_button = NULL; | 823 | toolbar->priv->move_button = NULL; |
| 3082 | 651 | 824 | ||
| 3083 | 652 | gtk_grab_remove (GTK_WIDGET (toolbar)); | 825 | gtk_grab_remove (GTK_WIDGET (toolbar)); |
| 3084 | 653 | gdk_pointer_ungrab (gtk_get_current_event_time ()); | 826 | gdk_pointer_ungrab (gtk_get_current_event_time ()); |
| 3085 | 654 | return TRUE; | 827 | return TRUE; |
| 3086 | 655 | } | 828 | } |
| 3087 | 656 | 829 | ||
| 3265 | 657 | static void | 830 | */ |
| 3089 | 658 | move_menu_item_activated (GtkWidget *button) | ||
| 3090 | 659 | { | ||
| 3091 | 660 | XpadToolbar *toolbar; | ||
| 3092 | 661 | |||
| 3093 | 662 | toolbar = XPAD_TOOLBAR (g_object_get_data (G_OBJECT (button), "xpad-toolbar")); | ||
| 3094 | 663 | |||
| 3095 | 664 | xpad_toolbar_move_button_start (toolbar, button); | ||
| 3096 | 665 | } | ||
| 3097 | 666 | |||
| 3098 | 667 | static void | ||
| 3099 | 668 | menu_deactivated (GtkWidget *menu, GtkToolbar *toolbar) | ||
| 3100 | 669 | { | ||
| 3101 | 670 | g_signal_emit (toolbar, signals[POPDOWN], 0, menu); | ||
| 3102 | 671 | } | ||
| 3103 | 672 | |||
| 3104 | 673 | static gboolean | ||
| 3105 | 674 | xpad_toolbar_popup_button_menu (GtkWidget *button, GdkEventButton *event, XpadToolbar *toolbar) | ||
| 3106 | 675 | { | ||
| 3107 | 676 | GtkWidget *menu; | ||
| 3108 | 677 | GtkWidget *item, *image; | ||
| 3109 | 678 | |||
| 3110 | 679 | menu = gtk_menu_new (); | ||
| 3111 | 680 | |||
| 3112 | 681 | |||
| 3113 | 682 | item = gtk_image_menu_item_new_with_mnemonic (_("_Remove From Toolbar")); | ||
| 3114 | 683 | |||
| 3115 | 684 | image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); | ||
| 3116 | 685 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 3117 | 686 | |||
| 3118 | 687 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_button), button); | ||
| 3119 | 688 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 0, 1); | ||
| 3120 | 689 | gtk_widget_show (item); | ||
| 3121 | 690 | |||
| 3122 | 691 | |||
| 3123 | 692 | item = gtk_menu_item_new_with_mnemonic (_("_Move")); | ||
| 3124 | 693 | g_signal_connect_swapped (item, "activate", G_CALLBACK (move_menu_item_activated), button); | ||
| 3125 | 694 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, 1, 2); | ||
| 3126 | 695 | gtk_widget_show (item); | ||
| 3127 | 696 | |||
| 3128 | 697 | |||
| 3129 | 698 | g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar); | ||
| 3130 | 699 | |||
| 3131 | 700 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event ? event->button : 0, gtk_get_current_event_time ()); | ||
| 3132 | 701 | |||
| 3133 | 702 | g_signal_emit (toolbar, signals[POPUP], 0, menu); | ||
| 3134 | 703 | |||
| 3135 | 704 | return TRUE; | ||
| 3136 | 705 | } | ||
| 3137 | 706 | |||
| 3138 | 707 | static gboolean | ||
| 3139 | 708 | xpad_toolbar_popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button) | ||
| 3140 | 709 | { | ||
| 3141 | 710 | GtkWidget *menu; | ||
| 3142 | 711 | const GSList *current_buttons; | ||
| 3143 | 712 | gint i; | ||
| 3144 | 713 | |||
| 3145 | 714 | menu = gtk_menu_new (); | ||
| 3146 | 715 | |||
| 3147 | 716 | current_buttons = xpad_settings_get_toolbar_buttons (xpad_settings ()); | ||
| 3148 | 717 | |||
| 3149 | 718 | gboolean is_button = FALSE; | ||
| 3150 | 719 | |||
| 3151 | 720 | for (i = 0; i < G_N_ELEMENTS (buttons); i++) | ||
| 3152 | 721 | { | ||
| 3153 | 722 | const GSList *j; | ||
| 3154 | 723 | GtkWidget *item, *image; | ||
| 3155 | 724 | |||
| 3156 | 725 | if (strcmp (buttons[i].name, "sep") != 0) | ||
| 3157 | 726 | { | ||
| 3158 | 727 | for (j = current_buttons; j; j = j->next) | ||
| 3159 | 728 | if (!g_ascii_strcasecmp (j->data, buttons[i].name)) | ||
| 3160 | 729 | break; | ||
| 3161 | 730 | |||
| 3162 | 731 | if (j) | ||
| 3163 | 732 | { | ||
| 3164 | 733 | is_button = TRUE; | ||
| 3165 | 734 | continue; | ||
| 3166 | 735 | } | ||
| 3167 | 736 | } | ||
| 3168 | 737 | else | ||
| 3169 | 738 | { | ||
| 3170 | 739 | /* Don't let user add separators until we can allow clicks on them. */ | ||
| 3171 | 740 | continue; | ||
| 3172 | 741 | } | ||
| 3173 | 742 | |||
| 3174 | 743 | item = gtk_image_menu_item_new_with_mnemonic (buttons[i].menu_desc); | ||
| 3175 | 744 | |||
| 3176 | 745 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 3177 | 746 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 3178 | 747 | |||
| 3179 | 748 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_add_button), (gpointer) buttons[i].name); | ||
| 3180 | 749 | |||
| 3181 | 750 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 3182 | 751 | gtk_widget_show (item); | ||
| 3183 | 752 | } | ||
| 3184 | 753 | |||
| 3185 | 754 | if (is_button) | ||
| 3186 | 755 | { | ||
| 3187 | 756 | GtkWidget *item, *image; | ||
| 3188 | 757 | |||
| 3189 | 758 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remove All _Buttons")); | ||
| 3190 | 759 | |||
| 3191 | 760 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 3192 | 761 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 3193 | 762 | |||
| 3194 | 763 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_all_buttons), NULL); | ||
| 3195 | 764 | |||
| 3196 | 765 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 3197 | 766 | gtk_widget_show (item); | ||
| 3198 | 767 | |||
| 3199 | 768 | i++; | ||
| 3200 | 769 | |||
| 3201 | 770 | item = gtk_image_menu_item_new_with_mnemonic (N_("Remo_ve Last Button")); | ||
| 3202 | 771 | |||
| 3203 | 772 | image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU); | ||
| 3204 | 773 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); | ||
| 3205 | 774 | |||
| 3206 | 775 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_toolbar_remove_last_button), NULL); | ||
| 3207 | 776 | |||
| 3208 | 777 | gtk_menu_attach (GTK_MENU (menu), item, 0, 1, i, i + 1); | ||
| 3209 | 778 | gtk_widget_show (item); | ||
| 3210 | 779 | } | ||
| 3211 | 780 | |||
| 3212 | 781 | g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar); | ||
| 3213 | 782 | |||
| 3214 | 783 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, (button < 0) ? 0 : button, gtk_get_current_event_time ()); | ||
| 3215 | 784 | |||
| 3216 | 785 | g_signal_emit (toolbar, signals[POPUP], 0, menu); | ||
| 3217 | 786 | |||
| 3218 | 787 | return TRUE; | ||
| 3219 | 788 | } | ||
| 3220 | 789 | |||
| 3221 | 790 | static void | ||
| 3222 | 791 | xpad_toolbar_enable_button (XpadToolbar *toolbar, const XpadToolbarButton *button, gboolean enable) | ||
| 3223 | 792 | { | ||
| 3224 | 793 | g_return_if_fail (button); | ||
| 3225 | 794 | GtkToolItem *item = xpad_toolbar_button_to_item (toolbar, button); | ||
| 3226 | 795 | if (item) | ||
| 3227 | 796 | gtk_widget_set_sensitive (GTK_WIDGET (item), enable); | ||
| 3228 | 797 | } | ||
| 3229 | 798 | |||
| 3230 | 799 | void | ||
| 3231 | 800 | xpad_toolbar_enable_undo_button (XpadToolbar *toolbar, gboolean enable) | ||
| 3232 | 801 | { | ||
| 3233 | 802 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Undo"); | ||
| 3234 | 803 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 3235 | 804 | } | ||
| 3236 | 805 | |||
| 3237 | 806 | void | ||
| 3238 | 807 | xpad_toolbar_enable_redo_button (XpadToolbar *toolbar, gboolean enable) | ||
| 3239 | 808 | { | ||
| 3240 | 809 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Redo"); | ||
| 3241 | 810 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 3242 | 811 | } | ||
| 3243 | 812 | |||
| 3244 | 813 | void | ||
| 3245 | 814 | xpad_toolbar_enable_cut_button (XpadToolbar *toolbar, gboolean enable) | ||
| 3246 | 815 | { | ||
| 3247 | 816 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Cut"); | ||
| 3248 | 817 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 3249 | 818 | } | ||
| 3250 | 819 | |||
| 3251 | 820 | void | ||
| 3252 | 821 | xpad_toolbar_enable_copy_button (XpadToolbar *toolbar, gboolean enable) | ||
| 3253 | 822 | { | ||
| 3254 | 823 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Copy"); | ||
| 3255 | 824 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 3256 | 825 | } | ||
| 3257 | 826 | |||
| 3258 | 827 | void | ||
| 3259 | 828 | xpad_toolbar_enable_paste_button (XpadToolbar *toolbar, gboolean enable) | ||
| 3260 | 829 | { | ||
| 3261 | 830 | const XpadToolbarButton *button = xpad_toolbar_button_lookup (toolbar, "Paste"); | ||
| 3262 | 831 | xpad_toolbar_enable_button (toolbar, button, enable); | ||
| 3263 | 832 | } | ||
| 3264 | 833 | |||
| 3266 | 834 | 831 | ||
| 3267 | === modified file 'src/xpad-tray.c' | |||
| 3268 | --- src/xpad-tray.c 2013-10-09 14:46:10 +0000 | |||
| 3269 | +++ src/xpad-tray.c 2013-10-18 18:35:35 +0000 | |||
| 3270 | @@ -33,17 +33,19 @@ | |||
| 3271 | 33 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); | 33 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); |
| 3272 | 34 | 34 | ||
| 3273 | 35 | static GtkStatusIcon *docklet = NULL; | 35 | static GtkStatusIcon *docklet = NULL; |
| 3274 | 36 | static GtkWidget *menu = NULL; | ||
| 3275 | 36 | 37 | ||
| 3276 | 37 | void | 38 | void |
| 3277 | 38 | xpad_tray_open (void) | 39 | xpad_tray_open (void) |
| 3278 | 39 | { | 40 | { |
| 3279 | 40 | GtkIconTheme *theme; | 41 | GtkIconTheme *theme; |
| 3282 | 41 | 42 | ||
| 3283 | 42 | xpad_tray_close (); | 43 | // xpad_tray_close (); |
| 3284 | 43 | 44 | ||
| 3285 | 44 | theme = gtk_icon_theme_get_default (); | 45 | theme = gtk_icon_theme_get_default (); |
| 3287 | 45 | if (!gtk_icon_theme_has_icon (theme, PACKAGE)) | 46 | if (!gtk_icon_theme_has_icon (theme, PACKAGE)) { |
| 3288 | 46 | return; | 47 | return; |
| 3289 | 48 | } | ||
| 3290 | 47 | 49 | ||
| 3291 | 48 | if (gtk_icon_theme_has_icon (theme, "xpad-panel")) | 50 | if (gtk_icon_theme_has_icon (theme, "xpad-panel")) |
| 3292 | 49 | { | 51 | { |
| 3293 | @@ -68,6 +70,9 @@ | |||
| 3294 | 68 | g_object_unref (docklet); | 70 | g_object_unref (docklet); |
| 3295 | 69 | docklet = NULL; | 71 | docklet = NULL; |
| 3296 | 70 | } | 72 | } |
| 3297 | 73 | |||
| 3298 | 74 | if (menu) | ||
| 3299 | 75 | gtk_widget_destroy(menu); | ||
| 3300 | 71 | } | 76 | } |
| 3301 | 72 | 77 | ||
| 3302 | 73 | gboolean | 78 | gboolean |
| 3303 | @@ -111,7 +116,7 @@ | |||
| 3304 | 111 | static void | 116 | static void |
| 3305 | 112 | xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time) | 117 | xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time) |
| 3306 | 113 | { | 118 | { |
| 3308 | 114 | GtkWidget *menu, *item; | 119 | GtkWidget *item; |
| 3309 | 115 | GSList *pads, *l; | 120 | GSList *pads, *l; |
| 3310 | 116 | gint n; | 121 | gint n; |
| 3311 | 117 | 122 | ||
| 3312 | @@ -126,7 +131,7 @@ | |||
| 3313 | 126 | item = gtk_separator_menu_item_new (); | 131 | item = gtk_separator_menu_item_new (); |
| 3314 | 127 | gtk_container_add (GTK_CONTAINER (menu), item); | 132 | gtk_container_add (GTK_CONTAINER (menu), item); |
| 3315 | 128 | gtk_widget_show (item); | 133 | gtk_widget_show (item); |
| 3317 | 129 | 134 | ||
| 3318 | 130 | item = gtk_menu_item_new_with_mnemonic (_("_Show All")); | 135 | item = gtk_menu_item_new_with_mnemonic (_("_Show All")); |
| 3319 | 131 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_show_all), xpad_app_get_pad_group ()); | 136 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_show_all), xpad_app_get_pad_group ()); |
| 3320 | 132 | gtk_container_add (GTK_CONTAINER (menu), item); | 137 | gtk_container_add (GTK_CONTAINER (menu), item); |
| 3321 | @@ -202,4 +207,3 @@ | |||
| 3322 | 202 | g_slist_foreach (pads, (GFunc) gtk_window_present, NULL); | 207 | g_slist_foreach (pads, (GFunc) gtk_window_present, NULL); |
| 3323 | 203 | g_slist_free (pads); | 208 | g_slist_free (pads); |
| 3324 | 204 | } | 209 | } |
| 3325 | 205 | |||
| 3326 | 206 | 210 | ||
| 3327 | === modified file 'src/xpad-undo.c' | |||
| 3328 | --- src/xpad-undo.c 2013-10-09 04:24:36 +0000 | |||
| 3329 | +++ src/xpad-undo.c 2013-10-18 18:35:35 +0000 | |||
| 3330 | @@ -26,8 +26,18 @@ | |||
| 3331 | 26 | #include "xpad-undo.h" | 26 | #include "xpad-undo.h" |
| 3332 | 27 | #include "xpad-text-buffer.h" | 27 | #include "xpad-text-buffer.h" |
| 3333 | 28 | 28 | ||
| 3336 | 29 | G_DEFINE_TYPE(XpadUndo, xpad_undo, G_TYPE_OBJECT) | 29 | struct XpadUndoPrivate |
| 3337 | 30 | #define XPAD_UNDO_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XPAD_TYPE_UNDO, XpadUndoPrivate)) | 30 | { |
| 3338 | 31 | XpadTextBuffer *buffer; | ||
| 3339 | 32 | /* We always redo the next element in the list but undo the current one. | ||
| 3340 | 33 | We insert this guard with NULL data in the beginning to ease coding all of this */ | ||
| 3341 | 34 | GList *history_start; | ||
| 3342 | 35 | GList *history_curr; | ||
| 3343 | 36 | guint user_action; | ||
| 3344 | 37 | gboolean frozen; | ||
| 3345 | 38 | }; | ||
| 3346 | 39 | |||
| 3347 | 40 | G_DEFINE_TYPE_WITH_PRIVATE(XpadUndo, xpad_undo, G_TYPE_OBJECT) | ||
| 3348 | 31 | 41 | ||
| 3349 | 32 | static GObject* xpad_undo_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties); | 42 | static GObject* xpad_undo_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties); |
| 3350 | 33 | static void xpad_undo_dispose (GObject *object); | 43 | static void xpad_undo_dispose (GObject *object); |
| 3351 | @@ -62,18 +72,6 @@ | |||
| 3352 | 62 | static void xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo); | 72 | static void xpad_undo_insert_text (GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, XpadUndo *undo); |
| 3353 | 63 | static void xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo); | 73 | static void xpad_undo_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, XpadUndo *undo); |
| 3354 | 64 | 74 | ||
| 3355 | 65 | struct XpadUndoPrivate | ||
| 3356 | 66 | { | ||
| 3357 | 67 | XpadTextBuffer *buffer; | ||
| 3358 | 68 | XpadPad *pad; | ||
| 3359 | 69 | /* We always redo the next element in the list but undo the current one. | ||
| 3360 | 70 | We insert this guard with NULL data in the beginning to ease coding all of this */ | ||
| 3361 | 71 | GList *history_start; | ||
| 3362 | 72 | GList *history_curr; | ||
| 3363 | 73 | guint user_action; | ||
| 3364 | 74 | gboolean frozen; | ||
| 3365 | 75 | }; | ||
| 3366 | 76 | |||
| 3367 | 77 | enum | 75 | enum |
| 3368 | 78 | { | 76 | { |
| 3369 | 79 | PROP_0, | 77 | PROP_0, |
| 3370 | @@ -92,8 +90,6 @@ | |||
| 3371 | 92 | { | 90 | { |
| 3372 | 93 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | 91 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 3373 | 94 | 92 | ||
| 3374 | 95 | /* TODO: neither dispose nor finalize neither in here nor in xpad-pad.c are | ||
| 3375 | 96 | actually called, have to fix cleaning up */ | ||
| 3376 | 97 | gobject_class->dispose = xpad_undo_dispose; | 93 | gobject_class->dispose = xpad_undo_dispose; |
| 3377 | 98 | gobject_class->finalize = xpad_undo_finalize; | 94 | gobject_class->finalize = xpad_undo_finalize; |
| 3378 | 99 | gobject_class->set_property = xpad_undo_set_property; | 95 | gobject_class->set_property = xpad_undo_set_property; |
| 3379 | @@ -106,18 +102,14 @@ | |||
| 3380 | 106 | "Pad Buffer", | 102 | "Pad Buffer", |
| 3381 | 107 | "Pad buffer connected to this undo", | 103 | "Pad buffer connected to this undo", |
| 3382 | 108 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); | 104 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
| 3383 | 109 | |||
| 3384 | 110 | g_type_class_add_private (gobject_class, sizeof (XpadUndoPrivate)); | ||
| 3385 | 111 | } | 105 | } |
| 3386 | 112 | 106 | ||
| 3387 | 113 | |||
| 3388 | 114 | static void | 107 | static void |
| 3389 | 115 | xpad_undo_init (XpadUndo *undo) | 108 | xpad_undo_init (XpadUndo *undo) |
| 3390 | 116 | { | 109 | { |
| 3392 | 117 | undo->priv = XPAD_UNDO_GET_PRIVATE (undo); | 110 | undo->priv = xpad_undo_get_instance_private(undo); |
| 3393 | 118 | 111 | ||
| 3394 | 119 | undo->priv->buffer = NULL; | 112 | undo->priv->buffer = NULL; |
| 3395 | 120 | undo->priv->buffer = NULL; | ||
| 3396 | 121 | undo->priv->history_start = g_list_append (NULL, NULL); | 113 | undo->priv->history_start = g_list_append (NULL, NULL); |
| 3397 | 122 | undo->priv->history_curr = undo->priv->history_start; | 114 | undo->priv->history_curr = undo->priv->history_start; |
| 3398 | 123 | undo->priv->user_action = 0; | 115 | undo->priv->user_action = 0; |
| 3399 | @@ -133,7 +125,7 @@ | |||
| 3400 | 133 | XpadUndo *undo = XPAD_UNDO (obj); | 125 | XpadUndo *undo = XPAD_UNDO (obj); |
| 3401 | 134 | 126 | ||
| 3402 | 135 | /* Assert user passed buffer and pad as construct parameter */ | 127 | /* Assert user passed buffer and pad as construct parameter */ |
| 3404 | 136 | gint i; | 128 | guint i; |
| 3405 | 137 | gboolean found_buffer = FALSE; | 129 | gboolean found_buffer = FALSE; |
| 3406 | 138 | for (i = 0; i < n_properties; i++) | 130 | for (i = 0; i < n_properties; i++) |
| 3407 | 139 | { | 131 | { |
| 3408 | @@ -148,7 +140,6 @@ | |||
| 3409 | 148 | if (!found_buffer) | 140 | if (!found_buffer) |
| 3410 | 149 | { | 141 | { |
| 3411 | 150 | undo->priv->buffer = NULL; | 142 | undo->priv->buffer = NULL; |
| 3412 | 151 | undo->priv->buffer = NULL; | ||
| 3413 | 152 | g_warning ("XpadTextBuffer is not passed to XpadUndo constructor, undo will not work!\n"); | 143 | g_warning ("XpadTextBuffer is not passed to XpadUndo constructor, undo will not work!\n"); |
| 3414 | 153 | } | 144 | } |
| 3415 | 154 | else | 145 | else |
| 3416 | @@ -168,9 +159,7 @@ | |||
| 3417 | 168 | { | 159 | { |
| 3418 | 169 | XpadUndo *undo = XPAD_UNDO (object); | 160 | XpadUndo *undo = XPAD_UNDO (object); |
| 3419 | 170 | 161 | ||
| 3423 | 171 | if (undo->priv->buffer && G_IS_OBJECT (undo->priv->buffer)) | 162 | if (undo->priv->buffer) { |
| 3421 | 172 | { | ||
| 3422 | 173 | g_object_unref (undo->priv->buffer); | ||
| 3424 | 174 | undo->priv->buffer = NULL; | 163 | undo->priv->buffer = NULL; |
| 3425 | 175 | } | 164 | } |
| 3426 | 176 | 165 | ||
| 3427 | @@ -186,7 +175,7 @@ | |||
| 3428 | 186 | xpad_undo_clear_history (undo); | 175 | xpad_undo_clear_history (undo); |
| 3429 | 187 | 176 | ||
| 3430 | 188 | /* remove left guard */ | 177 | /* remove left guard */ |
| 3432 | 189 | g_list_free (undo->priv->history_start); | 178 | g_list_free(undo->priv->history_start); |
| 3433 | 190 | 179 | ||
| 3434 | 191 | G_OBJECT_CLASS (xpad_undo_parent_class)->finalize (object); | 180 | G_OBJECT_CLASS (xpad_undo_parent_class)->finalize (object); |
| 3435 | 192 | } | 181 | } |
| 3436 | @@ -595,4 +584,3 @@ | |||
| 3437 | 595 | { | 584 | { |
| 3438 | 596 | undo->priv->frozen = FALSE; | 585 | undo->priv->frozen = FALSE; |
| 3439 | 597 | } | 586 | } |
| 3440 | 598 | |||
