]>
Commit | Line | Data |
---|---|---|
90788a8b JR |
1 | diff --git a/Makefile.am b/Makefile.am |
2 | index 23b69e4..f320cb5 100644 | |
3 | --- a/Makefile.am | |
4 | +++ b/Makefile.am | |
5 | @@ -1,3 +1,5 @@ | |
6 | +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} | |
7 | + | |
8 | @SET_MAKE@ | |
9 | ||
10 | SUBDIRS = \ | |
11 | @@ -9,13 +11,21 @@ SUBDIRS = \ | |
12 | distclean-local: | |
13 | rm -rf *.cache *~ | |
14 | ||
15 | +.PHONY: ChangeLog | |
16 | + | |
17 | +ChangeLog: Makefile | |
18 | + (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp \ | |
19 | + && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) \ | |
20 | + || (touch ChangeLog; echo 'Git directory not found: installing possibly empty changelog.' >&2) | |
21 | + | |
22 | +dist-hook: ChangeLog | |
23 | + | |
24 | EXTRA_DIST = \ | |
25 | AUTHORS \ | |
26 | ChangeLog \ | |
27 | COPYING \ | |
28 | - INSTALL \ | |
29 | NEWS \ | |
30 | - README \ | |
31 | + README.md \ | |
32 | intltool-extract.in \ | |
33 | intltool-merge.in \ | |
34 | intltool-update.in \ | |
35 | @@ -38,7 +38,6 @@ | |
36 | config.h.in \ | |
37 | config.sub \ | |
38 | configure \ | |
39 | - configure.ac \ | |
40 | depcomp \ | |
41 | install-sh \ | |
42 | ltmain.sh \ | |
43 | diff --git a/README.md b/README.md | |
44 | new file mode 100644 | |
45 | index 0000000..2126a0f | |
46 | --- /dev/null | |
47 | +++ b/README.md | |
48 | @@ -0,0 +1,49 @@ | |
49 | +[![License](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin/-/blob/master/COPYING) | |
50 | + | |
51 | +# xfce4-notes-plugin | |
52 | + | |
53 | +The notes plugin provides you a quick way to write down a todo list, | |
54 | +to paste a piece of code, to leave a note to your friend, or whatever | |
55 | +else you had like to do with a Post-It note. | |
56 | + | |
57 | +---- | |
58 | + | |
59 | +### Homepage | |
60 | + | |
61 | +[xfce4-notes-plugin documentation](https://docs.xfce.org/panel-plugins/xfce4-notes-plugin) | |
62 | + | |
63 | +### Changelog | |
64 | + | |
65 | +See [NEWS](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin/-/blob/master/NEWS) for details on changes and fixes made in the current release. | |
66 | + | |
67 | +### Source Code Repository | |
68 | + | |
69 | +[Xfce4-notes-plugin source code](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin) | |
70 | + | |
71 | +### Download a Release Tarball | |
72 | + | |
73 | +[Xfce4-notes-plugin archive](https://archive.xfce.org/src/panel-plugins/xfce4-notes-plugin) | |
74 | + or | |
75 | +[Xfce4-notes-plugin tags](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin/-/tags) | |
76 | + | |
77 | +### Installation | |
78 | + | |
79 | +From source code repository: | |
80 | + | |
81 | + % cd xfce4-notes-plugin | |
82 | + % ./autogen.sh | |
83 | + % make | |
84 | + % make install | |
85 | + | |
86 | +From release tarball: | |
87 | + | |
88 | + % tar xf xfce4-notes-plugin-<version>.tar.bz2 | |
89 | + % cd xfce4-notes-plugin-<version> | |
90 | + % ./configure | |
91 | + % make | |
92 | + % make install | |
93 | + | |
94 | +### Reporting Bugs | |
95 | + | |
96 | +Visit the [reporting bugs](https://docs.xfce.org/panel-plugins/xfce4-notes-plugin/bugs) page to view currently open bug reports and instructions on reporting new bugs or submitting bugfixes. | |
97 | + | |
98 | diff --git a/configure.ac b/configure.ac | |
99 | index 1f15797..f5d80ad 100644 | |
100 | --- a/configure.ac | |
101 | +++ b/configure.ac | |
102 | @@ -2,20 +2,20 @@ dnl | |
103 | dnl xfce4-notes-plugin - Notes plugin for the Xfce4 panel | |
104 | dnl | |
105 | dnl 2003 Jakob Henriksson <b0kaj+dev@lysator.liu.se> | |
106 | -dnl 2006-2012 Mike Massonnet <mmassonnet@gmail.com> | |
107 | +dnl 2006-2016 Mike Massonnet <mmassonnet@xfce.org> | |
108 | dnl | |
109 | ||
110 | m4_define([xfce4_notes_plugin_version_major], [1]) | |
111 | -m4_define([xfce4_notes_plugin_version_minor], [8]) | |
112 | -m4_define([xfce4_notes_plugin_version_micro], [1]) | |
113 | +m4_define([xfce4_notes_plugin_version_minor], [9]) | |
114 | +m4_define([xfce4_notes_plugin_version_micro], [0]) | |
115 | m4_define([xfce4_notes_plugin_version_nano], []) | |
116 | m4_define([xfce4_notes_plugin_version_build], [c48ff8b]) | |
117 | -m4_define([xfce4_notes_plugin_version_tag], []) # Leave empty for releases | |
118 | +m4_define([xfce4_notes_plugin_version_tag], [git]) # Leave empty for releases | |
119 | m4_define([xfce4_notes_plugin_version], [xfce4_notes_plugin_version_major().xfce4_notes_plugin_version_minor().xfce4_notes_plugin_version_micro()ifelse(xfce4_notes_plugin_version_nano(), [], [], [.xfce4_notes_plugin_version_nano()])ifelse(xfce4_notes_plugin_version_tag(), [git], [xfce4_notes_plugin_version_tag()-xfce4_notes_plugin_version_build()], [xfce4_notes_plugin_version_tag()])]) | |
120 | ||
121 | AC_PREREQ([2.50]) | |
122 | -AC_INIT([Notes], [xfce4_notes_plugin_version], [http://bugzilla.xfce.org/], [xfce4-notes-plugin], | |
123 | - [http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin]) | |
124 | +AC_INIT([Notes], [xfce4_notes_plugin_version], [https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin], [xfce4-notes-plugin], | |
125 | + [https://docs.xfce.org/panel-plugins/xfce4-notes-plugin]) | |
126 | AC_REVISION([xfce4_notes_plugin_version_build]) | |
127 | AC_CANONICAL_TARGET() | |
128 | AC_CONFIG_HEADERS([config.h]) | |
129 | @@ -23,9 +23,10 @@ AC_CONFIG_HEADERS([config.h]) | |
130 | LT_PREREQ([2.2.6]) | |
131 | LT_INIT([disable-static]) | |
132 | ||
133 | -AM_INIT_AUTOMAKE([1.13 dist-bzip2 no-dist-gzip]) | |
134 | +AM_INIT_AUTOMAKE([1.13 dist-bzip2 no-dist-gzip foreign]) | |
135 | AM_MAINTAINER_MODE() | |
136 | AM_SILENT_RULES([yes]) | |
137 | +AC_CONFIG_MACRO_DIRS([m4]) | |
138 | ||
139 | dnl Check for basic programs | |
140 | AM_PROG_CC_C_O() | |
141 | @@ -41,40 +42,19 @@ AC_SUBST([MATH_LIBS], [" -lm"]) | |
142 | ||
143 | dnl Check for required packages | |
144 | XDT_CHECK_LIBX11_REQUIRE() | |
145 | -XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0]) | |
146 | -XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0]) | |
147 | -XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0]) | |
148 | - | |
149 | -dnl Check for GTK | |
150 | -AC_ARG_ENABLE([gtk3], | |
151 | - [AC_HELP_STRING([--enable-gtk3], [Build with GTK3])], | |
152 | - [enable_gtk3=$enableval], [enable_gtk3=no]) | |
153 | -if test "x$enable_gtk3" = "xyes"; then | |
154 | - dnl GIO 2.28 for GApplication | |
155 | - XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.28.0]) | |
156 | - XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.2.0]) | |
157 | - XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.10.0]) | |
158 | - AC_DEFINE([ENABLE_GTK3], [1], [Defined if build with GTK3 is enabled]) | |
159 | -else | |
160 | - XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.24.0]) | |
161 | - XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0]) | |
162 | - XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.10.0]) | |
163 | - XDT_CHECK_PACKAGE([UNIQUE], [unique-1.0], [1.0.0]) | |
164 | -fi | |
165 | -AM_CONDITIONAL([ENABLE_GTK3], [test "x$enable_gtk3" = "xyes"]) | |
166 | - | |
167 | -dnl Check for Xfce Panel | |
168 | -if test "x$enable_gtk3" = "xno" ; then | |
169 | -XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.10.0]) | |
170 | -fi | |
171 | - | |
172 | +XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.30.0]) | |
173 | +XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.30.0]) | |
174 | +XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.22.0]) | |
175 | +XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.14.0]) | |
176 | +XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.14.0]) | |
177 | +XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.14.0]) | |
178 | +XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.14.0]) | |
179 | dnl Check for valac | |
180 | if test "x$USE_MAINTAINER_MODE" = "xyes" ; then | |
181 | - AM_PROG_VALAC([0.16.0]) | |
182 | + AM_PROG_VALAC([0.46.0]) | |
183 | if test "x$VALAC" = "x" ; then | |
184 | AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH]) | |
185 | fi | |
186 | - XDT_CHECK_PACKAGE([XFCE4VALA], [xfce4-vala], [4.10]) | |
187 | fi | |
188 | ||
189 | dnl Translations | |
190 | @@ -87,9 +67,7 @@ XDT_FEATURE_DEBUG() | |
191 | AC_OUTPUT([ | |
192 | Makefile | |
193 | data/Makefile | |
194 | -data/gtk-2.0/Makefile | |
195 | -data/gtk-2.0/tabs/Makefile | |
196 | -data/gtk-2.0/scrollbars/Makefile | |
197 | +data/gtk-3.0/Makefile | |
198 | data/icons/Makefile | |
199 | data/icons/16x16/Makefile | |
200 | data/icons/22x22/Makefile | |
201 | @@ -112,21 +90,10 @@ echo "* Maintainer Mode: $USE_MAINTAINER_MODE" | |
202 | if test "x$USE_MAINTAINER_MODE" = "xyes" ; then | |
203 | echo | |
204 | echo " * Vala: $VALAC $am__vala_version" | |
205 | -if test "x$enable_gtk3" = "xno" ; then | |
206 | -echo " * Xfce4-vala: $XFCE4VALA_VERSION" | |
207 | -fi | |
208 | echo | |
209 | fi | |
210 | echo "* GTK+: $GTK_VERSION" | |
211 | -if test "x$enable_gtk3" = "xyes" ; then | |
212 | -echo "* W" | |
213 | -echo "* W GTK3 support is only experimental, don't use for production." | |
214 | -echo "* W" | |
215 | -echo | |
216 | -fi | |
217 | -if test "x$enable_gtk3" = "xno" ; then | |
218 | echo "* Xfce Panel: $LIBXFCE4PANEL_VERSION" | |
219 | -fi | |
220 | echo "* Debug Support: $enable_debug" | |
221 | echo | |
222 | ||
223 | diff --git a/data/Makefile.am b/data/Makefile.am | |
224 | index c081716..e01936e 100644 | |
225 | --- a/data/Makefile.am | |
226 | +++ b/data/Makefile.am | |
227 | @@ -1,5 +1,5 @@ | |
228 | SUBDIRS = \ | |
229 | - gtk-2.0 \ | |
230 | + gtk-3.0 \ | |
231 | icons \ | |
232 | pixmaps | |
233 | ||
234 | diff --git a/data/gtk-3.0/Makefile.am b/data/gtk-3.0/Makefile.am | |
235 | new file mode 100644 | |
236 | index 0000000..a6a4c3a | |
237 | --- /dev/null | |
238 | +++ b/data/gtk-3.0/Makefile.am | |
239 | @@ -0,0 +1,3 @@ | |
240 | +notesgtkcssdir = $(pkgdatadir)/gtk-3.0 | |
241 | +dist_notesgtkcss_DATA = \ | |
242 | + gtk-main.css | |
243 | diff --git a/data/gtk-3.0/gtk-main.css b/data/gtk-3.0/gtk-main.css | |
244 | index 0000000..9628dfd | |
245 | --- /dev/null | |
246 | +++ b/data/gtk-3.0/gtk-main.css | |
247 | @@ -0,0 +1,160 @@ | |
248 | +@define-color theme_base_color @notes_bg_color; | |
249 | +@define-color theme_text_color shade (@theme_base_color, 0.4); | |
250 | +@define-color theme_bg_color @theme_base_color; | |
251 | +@define-color theme_fg_color shade (@theme_base_color, 0.3); | |
252 | +@define-color theme_selected_bg_color shade (@theme_base_color, 0.8); | |
253 | +@define-color theme_selected_fg_color shade (@theme_base_color, 1.4); | |
254 | +@define-color insensitive_bg_color shade (@theme_bg_color, 1.1); | |
255 | +@define-color insensitive_fg_color shade (@theme_fg_color, 1.8); | |
256 | + | |
257 | +@define-color borders shade (@theme_base_color, 0.8); | |
258 | +@define-color frame_color shade (@theme_base_color, 0.7); | |
259 | +@define-color notebook_active_tab_border shade (@theme_base_color, 1.1); | |
260 | +@define-color notebook_selected_tab_color shade (@theme_base_color, 0.9); | |
261 | + | |
262 | +* { | |
263 | + border-width: 0px; | |
264 | +} | |
265 | + | |
266 | +/* window and frame */ | |
267 | +window { | |
268 | + background-image: linear-gradient(to bottom, | |
269 | + shade (@theme_base_color, 0.8), | |
270 | + shade (@theme_base_color, 0.95) 87px); | |
271 | +} | |
272 | + | |
273 | +window frame { | |
274 | + padding: 1px 2px 4px 2px; | |
275 | + border: 1px solid shade (@theme_base_color, 0.7); | |
276 | +} | |
277 | + | |
278 | +/* icon buttons in window title bar */ | |
279 | +window widget#notes-icon-button { | |
280 | + color: black; | |
281 | + background-color: transparent; | |
282 | +} | |
283 | +window widget#notes-icon-button:active { | |
284 | + color: darker (@theme_fg_color); | |
285 | + text-shadow: 1px 1px lighter (@theme_bg_color); | |
286 | +} | |
287 | +window widget#notes-icon-button:disabled { | |
288 | + color: shade (@insensitive_fg_color, 1.2); | |
289 | +} | |
290 | +window widget#notes-icon-button:hover { | |
291 | + color: shade (@insensitive_fg_color, 0.8); | |
292 | +} | |
293 | + | |
294 | +/* notebook */ | |
295 | +notebook > header { | |
296 | + background: transparent; | |
297 | +} | |
298 | +notebook > header.top { | |
299 | + border-bottom: 2px solid @theme_selected_bg_color; | |
300 | +} | |
301 | +notebook > header.bottom { | |
302 | + border-top: 2px solid @theme_selected_bg_color; | |
303 | +} | |
304 | +notebook > header.left { | |
305 | + border-right: 2px solid @theme_selected_bg_color; | |
306 | +} | |
307 | +notebook > header.right { | |
308 | + border-left: 2px solid @theme_selected_bg_color; | |
309 | +} | |
310 | + | |
311 | +/* notebook tab style */ | |
312 | +notebook > header.top tab, notebook > header.bottom tab { | |
313 | + padding: 0px 4px; | |
314 | +} | |
315 | +notebook > header.right tab, notebook > header.left tab { | |
316 | + padding: 4px 0px; | |
317 | +} | |
318 | + | |
319 | +notebook > header tab { | |
320 | + box-shadow: none; | |
321 | + color: @insensitive_fg_color; | |
322 | + background: transparent; | |
323 | +} | |
324 | +notebook > header tab:checked { | |
325 | + color: shade (@theme_text_color, 0.8); | |
326 | +} | |
327 | +notebook > header tab.dnd { | |
328 | + background: @theme_selected_bg_color; | |
329 | +} | |
330 | + | |
331 | +notebook > header.top > tabs > tab:checked { | |
332 | + box-shadow: inset 0px -3px shade (@theme_selected_bg_color, 1.3), 0px 2px 3px @theme_selected_bg_color; | |
333 | +} | |
334 | +notebook > header.top > tabs > tab:checked:hover { | |
335 | + box-shadow: inset 0px -2px shade (@theme_selected_bg_color, 1.3), 0px 2px 3px @theme_selected_bg_color; | |
336 | + background: @theme_selected_bg_color; /* NOTE: must be set before .dnd */ | |
337 | +} | |
338 | +notebook > header.top > tabs > tab:hover { | |
339 | + box-shadow: inset 0px -2px shade (@theme_selected_bg_color, 1.3); | |
340 | +} | |
341 | + | |
342 | +notebook > header.bottom > tabs > tab:checked { | |
343 | + box-shadow: inset 0px 3px shade (@theme_selected_bg_color, 1.3), 0px -2px 3px @theme_selected_bg_color; | |
344 | +} | |
345 | +notebook > header.bottom > tabs > tab:checked:hover { | |
346 | + box-shadow: inset 0px 2px shade (@theme_selected_bg_color, 1.3), 0px -2px 3px @theme_selected_bg_color; | |
347 | + background: @theme_selected_bg_color; | |
348 | +} | |
349 | +notebook > header.bottom > tabs > tab:hover { | |
350 | + box-shadow: inset 0px 2px shade (@theme_selected_bg_color, 1.3); | |
351 | +} | |
352 | + | |
353 | +notebook > header.left > tabs > tab:checked { | |
354 | + box-shadow: inset -3px 0px shade (@theme_selected_bg_color, 1.3), 0px 0px 3px @theme_selected_bg_color; | |
355 | +} | |
356 | +notebook > header.left > tabs > tab:checked:hover { | |
357 | + box-shadow: inset -2px 0px shade (@theme_selected_bg_color, 1.3), 0px 0px 3px @theme_selected_bg_color; | |
358 | + background: @theme_selected_bg_color; | |
359 | +} | |
360 | +notebook > header.left > tabs > tab:hover { | |
361 | + box-shadow: inset -2px 0px shade (@theme_selected_bg_color, 1.3); | |
362 | +} | |
363 | + | |
364 | +notebook > header.right > tabs > tab:checked { | |
365 | + box-shadow: inset 3px 0px shade (@theme_selected_bg_color, 1.3), 0px 0px 3px @theme_selected_bg_color; | |
366 | +} | |
367 | +notebook > header.right > tabs > tab:checked:hover { | |
368 | + box-shadow: inset 2px 0px shade (@theme_selected_bg_color, 1.3), 0px 0px 3px @theme_selected_bg_color; | |
369 | + background: @theme_selected_bg_color; | |
370 | +} | |
371 | +notebook > header.right > tabs > tab:hover { | |
372 | + box-shadow: inset 2px 0px shade (@theme_selected_bg_color, 1.3); | |
373 | +} | |
374 | + | |
375 | +textview > text { | |
376 | + color: @theme_text_color; | |
377 | + background-image: linear-gradient(to bottom, | |
378 | + shade (@theme_bg_color, 1.2), | |
379 | + shade (@theme_bg_color, 1.3) 20em); | |
380 | +} | |
381 | + | |
382 | +textview > text > selection { | |
383 | + color: @theme_selected_fg_color; | |
384 | + background-color: @theme_selected_bg_color; | |
385 | +} | |
386 | + | |
387 | +scrollbar { | |
388 | + background-color: transparent; | |
389 | +} | |
390 | +scrollbar slider { | |
391 | + background-color: shade (@theme_bg_color, 0.55); | |
392 | + min-width: 8px; | |
393 | +} | |
394 | +scrollbar slider:hover { | |
395 | + background-color: shade (@theme_bg_color, 0.7); | |
396 | + transition: 400ms; | |
397 | +} | |
398 | +scrollbar slider:hover:active { | |
399 | + background-color: shade (@theme_bg_color, 0.55); | |
400 | + transition: 200ms; | |
401 | +} | |
402 | + | |
403 | +tooltip, tooltip * { | |
404 | + margin: 0px; | |
405 | + padding: 0px; | |
406 | +} | |
407 | + | |
408 | diff --git a/lib/Makefile.am b/lib/Makefile.am | |
409 | index 118582a..c971e9c 100644 | |
410 | --- a/lib/Makefile.am | |
411 | +++ b/lib/Makefile.am | |
412 | @@ -6,18 +6,8 @@ libnotes_la_VALAFLAGS = \ | |
413 | --vapidir=$(srcdir) \ | |
414 | --pkg=config \ | |
415 | --pkg=libxfconf-0 \ | |
416 | - --pkg=libxfce4util-1.0 | |
417 | - | |
418 | -if ENABLE_GTK3 | |
419 | -libnotes_la_VALAFLAGS += \ | |
420 | - -D ENABLE_GTK3 \ | |
421 | + --pkg=libxfce4util-1.0 \ | |
422 | --pkg=gtk+-3.0 | |
423 | -else | |
424 | -libnotes_la_VALAFLAGS += \ | |
425 | - --pkg=ext-gdk \ | |
426 | - --pkg=theme-gtkrc \ | |
427 | - --pkg=gtk+-2.0 | |
428 | -endif | |
429 | ||
430 | libnotes_la_SOURCES = \ | |
431 | icon-button.vala \ | |
432 | @@ -26,17 +16,8 @@ libnotes_la_SOURCES = \ | |
433 | hypertextview.vala \ | |
434 | note.vala \ | |
435 | window.vala \ | |
436 | - theme.vala | |
437 | - | |
438 | -if ENABLE_GTK3 | |
439 | -libnotes_la_SOURCES += \ | |
440 | + theme.vala \ | |
441 | theme-gtkcss.vala | |
442 | -else | |
443 | -libnotes_la_SOURCES += \ | |
444 | - popup.c \ | |
445 | - ext-gdk.c \ | |
446 | - theme-gtkrc.c | |
447 | -endif | |
448 | ||
449 | libnotes_la_CFLAGS = \ | |
450 | -DPKGDATADIR=\""$(pkgdatadir)"\" \ | |
451 | @@ -56,17 +37,6 @@ libnotes_la_LIBADD = \ | |
452 | @XFCONF_LIBS@ | |
453 | ||
454 | EXTRA_DIST = \ | |
455 | - ext-gdk.h \ | |
456 | - theme-gtkrc.h \ | |
457 | - popup.h \ | |
458 | libnotes.vapi \ | |
459 | libnotes.h | |
460 | ||
461 | -if ENABLE_GTK3 | |
462 | -EXTRA_DIST += \ | |
463 | - ext-gdk.c \ | |
464 | - theme-gtkrc.c \ | |
465 | - popup.c | |
466 | -else | |
467 | -endif | |
468 | - | |
469 | diff --git a/lib/application.vala b/lib/application.vala | |
470 | index 243f80e..ebee595 100644 | |
471 | --- a/lib/application.vala | |
472 | +++ b/lib/application.vala | |
473 | @@ -31,15 +31,10 @@ namespace Xnp { | |
474 | private Xfconf.Channel xfconf_channel; | |
475 | ||
476 | construct { | |
477 | -#if !ENABLE_GTK3 | |
478 | - var notesgtkrc = "%s/xfce4/xfce4-notes.gtkrc".printf (GLib.Environment.get_user_config_dir ()); | |
479 | - Gtk.rc_parse (notesgtkrc); | |
480 | -#endif | |
481 | - | |
482 | try { | |
483 | - Xfce.PosixSignalHandler.init (); | |
484 | - Xfce.PosixSignalHandler.set_handler(ProcessSignal.TERM, quit); | |
485 | - Xfce.PosixSignalHandler.set_handler(ProcessSignal.INT, quit); | |
486 | + Xfce.posix_signal_handler_init (); | |
487 | + Xfce.posix_signal_handler_set_handler(ProcessSignal.TERM, quit); | |
488 | + Xfce.posix_signal_handler_set_handler(ProcessSignal.INT, quit); | |
489 | } | |
490 | catch (GLib.Error e) { | |
491 | critical ("Unable to connect to UNIX signals. %s", e.message); | |
492 | @@ -48,7 +43,7 @@ namespace Xnp { | |
493 | try { | |
494 | Xfconf.init (); | |
495 | } | |
496 | - catch (Xfconf.Error e) { | |
497 | + catch (GLib.Error e) { | |
498 | critical ("%s", e.message); | |
499 | } | |
500 | ||
501 | @@ -145,13 +140,8 @@ namespace Xnp { | |
502 | private void update_color () { | |
503 | string color = xfconf_channel.get_string ("/global/background-color", "#F7EB96"); | |
504 | if (color == "GTK+") { | |
505 | -#if ENABLE_GTK3 | |
506 | // TODO: Read from StyleContext with default CssProvider | |
507 | return; | |
508 | -#else | |
509 | - var style_widget = new Gtk.Invisible (); | |
510 | - color = style_widget.get_style ().bg[Gtk.StateType.NORMAL].to_string (); | |
511 | -#endif | |
512 | } | |
513 | Xnp.Theme.set_background_color (color); | |
514 | } | |
515 | @@ -231,9 +221,9 @@ namespace Xnp { | |
516 | window_monitor_list_add (window); | |
517 | ||
518 | /* Global settings */ | |
519 | - Xfconf.Property.bind (xfconf_channel, "/global/skip-taskbar-hint", | |
520 | + Xfconf.property_bind (xfconf_channel, "/global/skip-taskbar-hint", | |
521 | typeof (bool), window, "skip-taskbar-hint"); | |
522 | - Xfconf.Property.bind (xfconf_channel, "/global/tabs-position", | |
523 | + Xfconf.property_bind (xfconf_channel, "/global/tabs-position", | |
524 | typeof (int), window, "tabs-position"); | |
525 | ||
526 | /* Connect signals */ | |
527 | @@ -268,7 +258,7 @@ namespace Xnp { | |
528 | } | |
529 | }); | |
530 | window.note_inserted.connect ((win, note) => { | |
531 | - Xfconf.Property.bind (xfconf_channel, "/global/font-description", | |
532 | + Xfconf.property_bind (xfconf_channel, "/global/font-description", | |
533 | typeof (string), note.text_view, "font"); | |
534 | ||
535 | string path = "%s/%s/%s".printf (notes_path, win.name, note.name); | |
536 | @@ -318,7 +308,7 @@ namespace Xnp { | |
537 | note.name = name; | |
538 | var buffer = note.text_view.get_buffer (); | |
539 | buffer.set_text (contents, -1); | |
540 | - Xfconf.Property.bind (xfconf_channel, "/global/font-description", | |
541 | + Xfconf.property_bind (xfconf_channel, "/global/font-description", | |
542 | typeof (string), note.text_view, "font"); | |
543 | } | |
544 | catch (FileError e) { | |
545 | @@ -433,20 +423,13 @@ namespace Xnp { | |
546 | */ | |
547 | private void rename_window (Xnp.Window window) { | |
548 | var dialog = new Gtk.Dialog.with_buttons (_("Rename group"), window, | |
549 | -#if ENABLE_GTK3 | |
550 | Gtk.DialogFlags.DESTROY_WITH_PARENT, | |
551 | -#else | |
552 | - Gtk.DialogFlags.DESTROY_WITH_PARENT|Gtk.DialogFlags.NO_SEPARATOR, | |
553 | -#endif | |
554 | - Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL, Gtk.Stock.OK, Gtk.ResponseType.OK); | |
555 | + "_Cancel", Gtk.ResponseType.CANCEL, "_OK", Gtk.ResponseType.OK); | |
556 | Gtk.Box content_area = (Gtk.Box)dialog.get_content_area (); | |
557 | dialog.set_default_response (Gtk.ResponseType.OK); | |
558 | dialog.resizable = false; | |
559 | - dialog.icon_name = Gtk.Stock.EDIT; | |
560 | + dialog.icon_name = "gtk-edit"; | |
561 | dialog.border_width = 4; | |
562 | -#if !ENABLE_GTK3 | |
563 | - content_area.border_width = 6; | |
564 | -#endif | |
565 | ||
566 | var entry = new Gtk.Entry (); | |
567 | entry.text = window.name; | |
568 | @@ -730,24 +713,6 @@ namespace Xnp { | |
569 | * Open the about dialog. | |
570 | */ | |
571 | public void open_about_dialog () { | |
572 | -#if !ENABLE_GTK3 | |
573 | - Gtk.AboutDialog.set_url_hook ((dialog, uri) => { | |
574 | - string command; | |
575 | - try { | |
576 | - command = "exo-open %s".printf (uri); | |
577 | - GLib.Process.spawn_command_line_async (command); | |
578 | - return; | |
579 | - } catch (GLib.Error e) { | |
580 | - } | |
581 | - try { | |
582 | - command = "firefox %s".printf (uri); | |
583 | - GLib.Process.spawn_command_line_async (command); | |
584 | - return; | |
585 | - } catch (GLib.Error e) { | |
586 | - } | |
587 | - }); | |
588 | -#endif | |
589 | - | |
590 | string[] authors = { | |
591 | "(c) 2006-2010 Mike Massonnet", | |
592 | "(c) 2003 Jakob Henriksson", | |
593 | @@ -759,10 +724,10 @@ namespace Xnp { | |
594 | "logo-icon-name", "xfce4-notes-plugin", | |
595 | "comments", _("Ideal for your quick notes"), | |
596 | "version", Config.PACKAGE_VERSION, | |
597 | - "copyright", "Copyright © 2003-2010 The Xfce development team", | |
598 | + "copyright", "Copyright © 2003-2020 The Xfce development team", | |
599 | "license", Xfce.get_license_text (Xfce.LicenseTextType.GPL), | |
600 | - "website", "http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin", | |
601 | - "website-label", "goodies.xfce.org", | |
602 | + "website", "https://docs.xfce.org/panel-plugins/xfce4-notes-plugin", | |
603 | + "website-label", "docs.xfce.org", | |
604 | "authors", authors, | |
605 | "translator-credits", _("translator-credits"), | |
606 | null); | |
607 | @@ -799,13 +764,11 @@ namespace Xnp { | |
608 | // New group menu item | |
609 | var mi_sep = new Gtk.SeparatorMenuItem (); | |
610 | menu.append (mi_sep); | |
611 | - var mi_add = new Gtk.ImageMenuItem.with_mnemonic (_("_Add a new group")); | |
612 | + var mi_add = new Gtk.MenuItem.with_mnemonic (_("_Add a new group")); | |
613 | mi_add.activate.connect (() => { | |
614 | var new_win = create_window (); | |
615 | new_win.show (); | |
616 | }); | |
617 | - var image = new Gtk.Image.from_stock (Gtk.Stock.ADD, Gtk.IconSize.MENU); | |
618 | - mi_add.set_image (image); | |
619 | menu.append (mi_add); | |
620 | ||
621 | // Show all items | |
622 | diff --git a/lib/config.vapi b/lib/config.vapi | |
623 | index 0000000..ed99c17 100644 | |
624 | --- /dev/null | |
625 | +++ b/lib/config.vapi | |
626 | @@ -0,0 +1,21 @@ namespace Xnp { | |
627 | +[CCode (cprefix = "", lower_case_prefix = "", cheader_filename = "config.h")] | |
628 | +namespace Config { | |
629 | + [CCode (cname = "GETTEXT_PACKAGE")] | |
630 | + public const string GETTEXT_PACKAGE; | |
631 | + [CCode (cname = "PACKAGE_LOCALE_DIR")] | |
632 | + public const string PACKAGE_LOCALE_DIR; | |
633 | + [CCode (cname = "PACKAGE")] | |
634 | + public const string PACKAGE; | |
635 | + [CCode (cname = "PACKAGE_BUGREPORT")] | |
636 | + public const string PACKAGE_BUGREPORT; | |
637 | + [CCode (cname = "PACKAGE_NAME")] | |
638 | + public const string PACKAGE_NAME; | |
639 | + [CCode (cname = "PACKAGE_STRING")] | |
640 | + public const string PACKAGE_STRING; | |
641 | + [CCode (cname = "PACKAGE_TARNAME")] | |
642 | + public const string PACKAGE_TARNAME; | |
643 | + [CCode (cname = "PACKAGE_VERSION")] | |
644 | + public const string PACKAGE_VERSION; | |
645 | + [CCode (cname = "PKGDATADIR")] | |
646 | + public const string PKGDATADIR; | |
647 | +} | |
648 | diff --git a/lib/hypertextview.vala b/lib/hypertextview.vala | |
649 | index ffb2c64..ed99c17 100644 | |
650 | --- a/lib/hypertextview.vala | |
651 | +++ b/lib/hypertextview.vala | |
652 | @@ -24,8 +24,8 @@ namespace Xnp { | |
653 | ||
654 | public class HypertextView : Gtk.TextView { | |
655 | ||
656 | - private Gdk.Cursor hand_cursor = new Gdk.Cursor (Gdk.CursorType.HAND2); | |
657 | - private Gdk.Cursor regular_cursor = new Gdk.Cursor (Gdk.CursorType.XTERM); | |
658 | + private Gdk.Cursor hand_cursor = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.HAND2); | |
659 | + private Gdk.Cursor regular_cursor = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.XTERM); | |
660 | ||
661 | private bool cursor_over_link = false; | |
662 | ||
663 | @@ -45,7 +45,7 @@ namespace Xnp { | |
664 | set { | |
665 | this._font = value; | |
666 | Pango.FontDescription font_descr = Pango.FontDescription.from_string (value); | |
667 | - modify_font (font_descr); | |
668 | + override_font (font_descr); | |
669 | } | |
670 | } | |
671 | ||
672 | @@ -107,7 +107,7 @@ namespace Xnp { | |
673 | if (iter.has_tag (this.tag_link)) { | |
674 | start = end = iter; | |
675 | ||
676 | - if (!start.begins_tag (this.tag_link)) { | |
677 | + if (!start.starts_tag (this.tag_link)) { | |
678 | start.backward_to_tag_toggle (this.tag_link); | |
679 | } | |
680 | ||
681 | @@ -220,7 +220,7 @@ namespace Xnp { | |
682 | Gtk.TextIter start, end; | |
683 | ||
684 | /* Text is inserted inside a tag */ | |
685 | - if (location.has_tag (this.tag_link) && !location.begins_tag (this.tag_link)) { | |
686 | + if (location.has_tag (this.tag_link) && !location.starts_tag (this.tag_link)) { | |
687 | start = location; | |
688 | start.backward_to_tag_toggle (this.tag_link); | |
689 | ||
690 | @@ -406,7 +406,7 @@ namespace Xnp { | |
691 | while (iter.forward_search ("http://", Gtk.TextSearchFlags.TEXT_ONLY, out start, out end, null)) { | |
692 | iter = end; | |
693 | ||
694 | - if (start.begins_tag (this.tag_link)) | |
695 | + if (start.starts_tag (this.tag_link)) | |
696 | continue; | |
697 | ||
698 | if (!iter.forward_search (" ", Gtk.TextSearchFlags.TEXT_ONLY, out end, null, null)) { | |
699 | diff --git a/lib/icon-button.vala b/lib/icon-button.vala | |
700 | index 07b6b14..1ec0b16 100644 | |
701 | --- a/lib/icon-button.vala | |
702 | +++ b/lib/icon-button.vala | |
703 | @@ -28,12 +28,10 @@ namespace Xnp { | |
704 | public signal void clicked (); | |
705 | ||
706 | construct { | |
707 | + ((Gtk.Widget)this).name = "notes-icon-button"; | |
708 | set_visible_window (false); | |
709 | set_above_child (true); | |
710 | set_size_request (22, 22); | |
711 | -#if !ENABLE_GTK3 | |
712 | - set_border_width (2); | |
713 | -#endif | |
714 | ||
715 | enter_notify_event.connect (on_enter_notify_event); | |
716 | leave_notify_event.connect (on_leave_notify_event); | |
717 | @@ -43,7 +41,6 @@ namespace Xnp { | |
718 | protected abstract void draw_icon (Cairo.Context cr, int width, int height); | |
719 | ||
720 | protected void set_widget_source_color (Cairo.Context cr) { | |
721 | -#if ENABLE_GTK3 | |
722 | var style_context = get_style_context (); | |
723 | ||
724 | if (sensitive && active) { | |
725 | @@ -53,21 +50,12 @@ namespace Xnp { | |
726 | Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.NORMAL)); | |
727 | else if (!sensitive) | |
728 | Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.INSENSITIVE)); | |
729 | -#else | |
730 | - if (sensitive && active) | |
731 | - Gdk.cairo_set_source_color (cr, style.base[Gtk.StateType.NORMAL]); | |
732 | - else if (sensitive && !active) | |
733 | - Gdk.cairo_set_source_color (cr, style.fg[Gtk.StateType.INSENSITIVE]); | |
734 | - else if (!sensitive) | |
735 | - Gdk.cairo_set_source_color (cr, style.text[Gtk.StateType.INSENSITIVE]); | |
736 | -#endif | |
737 | } | |
738 | ||
739 | public override void add (Gtk.Widget widget) { | |
740 | warning ("This object doesn't allow packing child widgets."); | |
741 | } | |
742 | ||
743 | -#if ENABLE_GTK3 | |
744 | public override bool draw (Cairo.Context cr) { | |
745 | int width = get_allocated_width (); | |
746 | int height = get_allocated_height (); | |
747 | @@ -86,29 +74,6 @@ namespace Xnp { | |
748 | ||
749 | return false; | |
750 | } | |
751 | -#else | |
752 | - public override bool expose_event (Gdk.EventExpose event) { | |
753 | - Gtk.Allocation allocation; | |
754 | - get_allocation (out allocation); | |
755 | - | |
756 | - int width = allocation.width - (int)border_width * 2; | |
757 | - int height = allocation.height - (int)border_width * 2; | |
758 | - int x = allocation.width / 2 - width / 2 + allocation.x; | |
759 | - int y = allocation.height / 2 - height / 2 + allocation.y; | |
760 | - | |
761 | - var cr = Gdk.cairo_create (get_window ()); | |
762 | - cr.rectangle (x, y, width, height); | |
763 | - cr.clip (); | |
764 | - | |
765 | - var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height); | |
766 | - var cr_ = new Cairo.Context (surface); | |
767 | - draw_icon (cr_, width, height); | |
768 | - cr.set_source_surface (surface, x, y); | |
769 | - cr.paint (); | |
770 | - | |
771 | - return false; | |
772 | - } | |
773 | -#endif | |
774 | ||
775 | private bool on_enter_notify_event (Gdk.EventCrossing event) { | |
776 | active = true; | |
777 | diff --git a/lib/note.vala b/lib/note.vala | |
778 | index 3d4266e..148d470 100644 | |
779 | --- a/lib/note.vala | |
780 | +++ b/lib/note.vala | |
781 | @@ -104,7 +104,8 @@ namespace Xnp { | |
782 | ||
783 | } | |
784 | ||
785 | -/*public class GtkSample : Window { | |
786 | +#if DEBUG_XNP_NOTE | |
787 | +public class GtkSample : Window { | |
788 | ||
789 | public GtkSample () { | |
790 | this.title = "Sample Window"; | |
791 | @@ -122,5 +123,6 @@ namespace Xnp { | |
792 | return 0; | |
793 | } | |
794 | ||
795 | -}*/ | |
796 | +} | |
797 | +#endif | |
798 | ||
799 | diff --git a/lib/theme-gtkcss.vala b/lib/theme-gtkcss.vala | |
800 | index becd371..93a17cb 100644 | |
801 | --- a/lib/theme-gtkcss.vala | |
802 | +++ b/lib/theme-gtkcss.vala | |
803 | @@ -17,7 +17,6 @@ | |
804 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | |
805 | */ | |
806 | ||
807 | -#if ENABLE_GTK3 | |
808 | namespace Xnp { | |
809 | ||
810 | public class ThemeGtkcss : GLib.Object { | |
811 | @@ -40,7 +39,7 @@ namespace Xnp { | |
812 | try { | |
813 | var cssprovider = new Gtk.CssProvider (); | |
814 | cssprovider.load_from_path (get_css_path ()); | |
815 | - Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), cssprovider, 255); | |
816 | + Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), cssprovider, Gtk.STYLE_PROVIDER_PRIORITY_USER); | |
817 | } catch (GLib.Error e) { | |
818 | warning ("%s", e.message); | |
819 | } | |
820 | @@ -49,5 +48,4 @@ namespace Xnp { | |
821 | } | |
822 | ||
823 | } | |
824 | -#endif | |
825 | ||
826 | diff --git a/lib/theme.vala b/lib/theme.vala | |
827 | index d6b50ef..e0c821d 100644 | |
828 | --- a/lib/theme.vala | |
829 | +++ b/lib/theme.vala | |
830 | @@ -28,13 +28,8 @@ namespace Xnp { | |
831 | return; | |
832 | } | |
833 | ||
834 | -#if ENABLE_GTK3 | |
835 | Xnp.ThemeGtkcss.update_css (gdkcolor); | |
836 | Xnp.ThemeGtkcss.update_style_context (); | |
837 | -#else | |
838 | - Xnp.ThemeGtkrc.update_gtkrc (gdkcolor); | |
839 | - Gtk.rc_reparse_all (); | |
840 | -#endif | |
841 | } | |
842 | ||
843 | } | |
844 | diff --git a/lib/window.vala b/lib/window.vala | |
845 | index a930327..1fb5a4d 100644 | |
846 | --- a/lib/window.vala | |
847 | +++ b/lib/window.vala | |
848 | @@ -40,11 +40,7 @@ namespace Xnp { | |
849 | private Xnp.TitleBarButton left_arrow_button; | |
850 | private Xnp.TitleBarButton right_arrow_button; | |
851 | private Xnp.TitleBarButton close_button; | |
852 | -#if ENABLE_GTK3 | |
853 | private Gtk.Box content_box; | |
854 | -#else | |
855 | - private Gtk.VBox content_box; | |
856 | -#endif | |
857 | private Gtk.Notebook notebook; | |
858 | ||
859 | private Gtk.UIManager ui; | |
860 | @@ -78,13 +74,13 @@ namespace Xnp { | |
861 | }; | |
862 | ||
863 | private int CORNER_MARGIN = 20; | |
864 | - private Gdk.Cursor CURSOR_RIGHT = new Gdk.Cursor (Gdk.CursorType.RIGHT_SIDE); | |
865 | - private Gdk.Cursor CURSOR_LEFT = new Gdk.Cursor (Gdk.CursorType.LEFT_SIDE); | |
866 | - private Gdk.Cursor CURSOR_BOTTOM_RC = new Gdk.Cursor (Gdk.CursorType.BOTTOM_RIGHT_CORNER); | |
867 | - private Gdk.Cursor CURSOR_BOTTOM = new Gdk.Cursor (Gdk.CursorType.BOTTOM_SIDE); | |
868 | - private Gdk.Cursor CURSOR_BOTTOM_LC = new Gdk.Cursor (Gdk.CursorType.BOTTOM_LEFT_CORNER); | |
869 | + private Gdk.Cursor CURSOR_RIGHT = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.RIGHT_SIDE); | |
870 | + private Gdk.Cursor CURSOR_LEFT = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.LEFT_SIDE); | |
871 | + private Gdk.Cursor CURSOR_BOTTOM_RC = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.BOTTOM_RIGHT_CORNER); | |
872 | + private Gdk.Cursor CURSOR_BOTTOM = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.BOTTOM_SIDE); | |
873 | + private Gdk.Cursor CURSOR_BOTTOM_LC = new Gdk.Cursor.for_display (Gdk.Display.get_default(), Gdk.CursorType.BOTTOM_LEFT_CORNER); | |
874 | ||
875 | - private unowned SList<unowned Xnp.Window> window_list; | |
876 | + private unowned SList<Xnp.Window> window_list; | |
877 | ||
878 | public new string name { default = _("Notes"); get; set; } | |
879 | public int n_pages { get; set; } | |
880 | @@ -219,22 +215,14 @@ namespace Xnp { | |
881 | frame.modify_style (style); | |
882 | frame.show (); | |
883 | add (frame); | |
884 | -#if ENABLE_GTK3 | |
885 | var vbox_frame = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | |
886 | -#else | |
887 | - var vbox_frame = new Gtk.VBox (false, 0); | |
888 | -#endif | |
889 | ||
890 | vbox_frame.spacing = 1; | |
891 | vbox_frame.show (); | |
892 | frame.add (vbox_frame); | |
893 | ||
894 | /* Build title bar */ | |
895 | -#if ENABLE_GTK3 | |
896 | var title_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); | |
897 | -#else | |
898 | - var title_box = new Gtk.HBox (false, 0); | |
899 | -#endif | |
900 | var menu_evbox = new Gtk.EventBox (); | |
901 | menu_evbox.tooltip_text = _("Menu"); | |
902 | menu_evbox.set_visible_window (false); | |
903 | @@ -284,11 +272,7 @@ namespace Xnp { | |
904 | vbox_frame.pack_start (title_box, false, false, 0); | |
905 | ||
906 | /* Build content box */ | |
907 | -#if ENABLE_GTK3 | |
908 | this.content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | |
909 | -#else | |
910 | - this.content_box = new Gtk.VBox (false, 0); | |
911 | -#endif | |
912 | this.content_box.show (); | |
913 | vbox_frame.pack_start (this.content_box, true, true, 0); | |
914 | ||
915 | @@ -298,9 +282,6 @@ namespace Xnp { | |
916 | this.notebook.show_border = true; | |
917 | this.notebook.show_tabs = false; | |
918 | this.notebook.tab_pos = Gtk.PositionType.TOP; | |
919 | -#if !ENABLE_GTK3 | |
920 | - this.notebook.tab_border = 4; | |
921 | -#endif | |
922 | this.notebook.scrollable = true; | |
923 | this.notebook.show (); | |
924 | this.content_box.pack_start (this.notebook, true, true, 0); | |
925 | @@ -645,13 +626,8 @@ namespace Xnp { | |
926 | Gtk.Requisition requisition; | |
927 | Gtk.Allocation allocation; | |
928 | ||
929 | -#if ENABLE_GTK3 | |
930 | get_window ().get_geometry (out winx, out winy, out width, out height); | |
931 | menu.get_preferred_size (out requisition, null); | |
932 | -#else | |
933 | - get_window ().get_geometry (out winx, out winy, out width, out height, null); | |
934 | - menu.size_request (out requisition); | |
935 | -#endif | |
936 | get_window ().get_origin (out x, out y); | |
937 | push_in = false; | |
938 | ||
939 | @@ -667,13 +643,9 @@ namespace Xnp { | |
940 | } | |
941 | if (x + requisition.width > Gdk.Screen.width ()) { | |
942 | /* Adjust menu left */ | |
943 | -#if ENABLE_GTK3 | |
944 | int menu_width; | |
945 | menu.get_preferred_width (out menu_width, null); | |
946 | x = x - menu_width + allocation.y; | |
947 | -#else | |
948 | - x = x - menu.requisition.width + content_box.allocation.y; | |
949 | -#endif | |
950 | } | |
951 | } | |
952 | ||
953 | @@ -699,24 +671,22 @@ namespace Xnp { | |
954 | mi = new Gtk.SeparatorMenuItem (); | |
955 | menu.append (mi); | |
956 | ||
957 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.NEW, null); | |
958 | + mi = new Gtk.MenuItem.with_mnemonic (_("_New")); | |
959 | mi.set_accel_path (this.action_group.get_action ("new-note").get_accel_path ()); | |
960 | mi.activate.connect (action_new_note); | |
961 | menu.append (mi); | |
962 | ||
963 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.DELETE, null); | |
964 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Delete")); | |
965 | mi.set_accel_path (this.action_group.get_action ("delete-note").get_accel_path ()); | |
966 | mi.activate.connect (action_delete_note); | |
967 | menu.append (mi); | |
968 | ||
969 | - mi = new Gtk.ImageMenuItem.with_mnemonic (_("_Rename")); | |
970 | - var image = new Gtk.Image.from_stock (Gtk.Stock.EDIT, Gtk.IconSize.MENU); | |
971 | - ((Gtk.ImageMenuItem)mi).set_image (image); | |
972 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Rename")); | |
973 | mi.set_accel_path (this.action_group.get_action ("rename-note").get_accel_path ()); | |
974 | mi.activate.connect (action_rename_note); | |
975 | menu.append (mi); | |
976 | ||
977 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.UNDO, null); | |
978 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Undo")); | |
979 | mi.set_accel_path (this.action_group.get_action ("cancel").get_accel_path ()); | |
980 | mi.activate.connect (action_cancel); | |
981 | menu.append (mi); | |
982 | @@ -739,11 +709,11 @@ namespace Xnp { | |
983 | mi = new Gtk.SeparatorMenuItem (); | |
984 | menu.append (mi); | |
985 | ||
986 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.PROPERTIES, null); | |
987 | + mi = new Gtk.MenuItem.with_mnemonic ("_Properties"); | |
988 | mi.activate.connect (() => { action ("properties"); }); | |
989 | menu.append (mi); | |
990 | ||
991 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.ABOUT, null); | |
992 | + mi = new Gtk.MenuItem.with_mnemonic ("_About"); | |
993 | mi.activate.connect (() => { action ("about"); }); | |
994 | menu.append (mi); | |
995 | ||
996 | @@ -775,11 +745,7 @@ namespace Xnp { | |
997 | int n_pages = this.notebook.get_n_pages (); | |
998 | for (int p = 0; p < n_pages; p++) { | |
999 | var note = (Xnp.Note)(this.notebook.get_nth_page (p)); | |
1000 | - mi = new Gtk.ImageMenuItem.with_label (note.name); | |
1001 | - if (note == current_note) { | |
1002 | - image = new Gtk.Image.from_stock (Gtk.Stock.GO_FORWARD, Gtk.IconSize.MENU); | |
1003 | - ((Gtk.ImageMenuItem)mi).set_image (image); | |
1004 | - } | |
1005 | + mi = new Gtk.MenuItem.with_label (note.name); | |
1006 | mi.set_data ("page", p.to_pointer ()); | |
1007 | mi.activate.connect ((i) => { | |
1008 | int page = i.get_data<int> ("page"); | |
1009 | @@ -805,23 +771,17 @@ namespace Xnp { | |
1010 | } | |
1011 | } | |
1012 | ||
1013 | - mi = new Gtk.ImageMenuItem.with_mnemonic (_("_Rename group")); | |
1014 | - image = new Gtk.Image.from_stock (Gtk.Stock.EDIT, Gtk.IconSize.MENU); | |
1015 | - ((Gtk.ImageMenuItem)mi).set_image (image); | |
1016 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Rename group")); | |
1017 | mi.set_accel_path (this.action_group.get_action ("rename-window").get_accel_path ()); | |
1018 | mi.activate.connect (action_rename_window); | |
1019 | menu.append (mi); | |
1020 | ||
1021 | - mi = new Gtk.ImageMenuItem.with_mnemonic (_("_Delete group")); | |
1022 | - image = new Gtk.Image.from_stock (Gtk.Stock.REMOVE, Gtk.IconSize.MENU); | |
1023 | - ((Gtk.ImageMenuItem)mi).set_image (image); | |
1024 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Delete group")); | |
1025 | mi.set_accel_path (this.action_group.get_action ("delete-window").get_accel_path ()); | |
1026 | mi.activate.connect (action_delete_window); | |
1027 | menu.append (mi); | |
1028 | ||
1029 | - mi = new Gtk.ImageMenuItem.with_mnemonic (_("_Add a new group")); | |
1030 | - image = new Gtk.Image.from_stock (Gtk.Stock.ADD, Gtk.IconSize.MENU); | |
1031 | - ((Gtk.ImageMenuItem)mi).set_image (image); | |
1032 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Add a new group")); | |
1033 | mi.set_accel_path (this.action_group.get_action ("new-window").get_accel_path ()); | |
1034 | mi.activate.connect (action_new_window); | |
1035 | menu.append (mi); | |
1036 | @@ -853,7 +813,7 @@ namespace Xnp { | |
1037 | * Saves a list of window inside window.window_list to be shown | |
1038 | * within the window menu. | |
1039 | */ | |
1040 | - public void set_window_list (SList<Xnp.Window> list) { | |
1041 | + public void set_window_list (SList <Xnp.Window> list) { | |
1042 | this.window_list = list; | |
1043 | } | |
1044 | ||
1045 | @@ -1057,16 +1017,12 @@ namespace Xnp { | |
1046 | var note = (Xnp.Note)(this.notebook.get_nth_page (page)); | |
1047 | ||
1048 | var dialog = new Gtk.Dialog.with_buttons (_("Rename note"), (Gtk.Window)get_toplevel (), | |
1049 | -#if ENABLE_GTK3 | |
1050 | Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT, | |
1051 | -#else | |
1052 | - Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT|Gtk.DialogFlags.NO_SEPARATOR, | |
1053 | -#endif | |
1054 | - Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL, Gtk.Stock.OK, Gtk.ResponseType.OK); | |
1055 | + "_Cancel", Gtk.ResponseType.CANCEL, "_OK", Gtk.ResponseType.OK); | |
1056 | Gtk.Box content_area = (Gtk.Box)dialog.get_content_area (); | |
1057 | dialog.set_default_response (Gtk.ResponseType.OK); | |
1058 | dialog.resizable = false; | |
1059 | - dialog.icon_name = Gtk.Stock.EDIT; | |
1060 | + dialog.icon_name = "gtk-edit"; | |
1061 | dialog.border_width = 4; | |
1062 | content_area.border_width = 6; | |
1063 | ||
1064 | @@ -1079,7 +1035,7 @@ namespace Xnp { | |
1065 | int res = dialog.run (); | |
1066 | dialog.hide (); | |
1067 | if (res == Gtk.ResponseType.OK) { | |
1068 | - weak string name = entry.text; | |
1069 | + string name = entry.text; | |
1070 | if (note_name_exists (name)) { | |
1071 | var error_dialog = new Gtk.MessageDialog (this, Gtk.DialogFlags.DESTROY_WITH_PARENT, | |
1072 | Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, _("The name %s is already in use"), name); | |
1073 | @@ -1106,21 +1062,12 @@ namespace Xnp { | |
1074 | return; | |
1075 | var note = (Xnp.Note)(this.notebook.get_nth_page (page)); | |
1076 | ||
1077 | -#if ENABLE_GTK3 | |
1078 | var dialog = new Gtk.FontChooserDialog ("Choose current note font", this); | |
1079 | dialog.set_font (note.text_view.font); | |
1080 | -#else | |
1081 | - var dialog = new Gtk.FontSelectionDialog ("Choose current note font"); | |
1082 | - dialog.set_font_name (note.text_view.font); | |
1083 | -#endif | |
1084 | int res = dialog.run (); | |
1085 | dialog.hide (); | |
1086 | if (res == Gtk.ResponseType.OK) { | |
1087 | -#if ENABLE_GTK3 | |
1088 | note.text_view.font = dialog.get_font (); | |
1089 | -#else | |
1090 | - note.text_view.font = dialog.get_font_name (); | |
1091 | -#endif | |
1092 | } | |
1093 | dialog.destroy (); | |
1094 | } | |
1095 | @@ -1179,7 +1126,8 @@ namespace Xnp { | |
1096 | } | |
1097 | } | |
1098 | ||
1099 | -/* valac -X '-I..' -X '-DGETTEXT_PACKAGE="xfce4-notes-plugin"' -X '-DPKGDATADIR="../data"' -D ENABLE_GTK3 --pkg=gtk+-3.0 --pkg=libxfce4util-1.0 --pkg=libxfconf-0 --pkg=color --pkg=config --vapidir=.. --vapidir=. window.vala note.vala hypertextview.vala icon-button.vala | |
1100 | +/* valac -X '-I..' -X '-DGETTEXT_PACKAGE="xfce4-notes-plugin"' -X '-DPKGDATADIR="../data"' -D DEBUG_XNP_WINDOW --pkg=gtk+-3.0 --pkg=libxfce4util-1.0 --pkg=libxfconf-0 --pkg=color --pkg=config --vapidir=.. --vapidir=. window.vala note.vala hypertextview.vala icon-button.vala */ | |
1101 | +#if DEBUG_XNP_WINDOW | |
1102 | static int main (string[] args) { | |
1103 | Gtk.init (ref args); | |
1104 | var sample = new Xnp.Window (); | |
1105 | @@ -1187,8 +1135,7 @@ namespace Xnp { | |
1106 | Gtk.main (); | |
1107 | return 0; | |
1108 | } | |
1109 | -// */ | |
1110 | - | |
1111 | +#endif | |
1112 | } | |
1113 | ||
1114 | } | |
1115 | diff --git a/src/Makefile.am b/src/Makefile.am | |
1116 | index 9ce0ebf..be01afa 100644 | |
1117 | --- a/src/Makefile.am | |
1118 | +++ b/src/Makefile.am | |
1119 | @@ -13,7 +13,6 @@ AM_CPPFLAGS = \ | |
1120 | ||
1121 | bin_PROGRAMS = xfce4-popup-notes | |
1122 | ||
1123 | -if ENABLE_GTK3 | |
1124 | if MAINTAINER_MODE | |
1125 | xfce4_popup_notes_VALAFLAGS = \ | |
1126 | --pkg=gtk+-3.0 | |
1127 | @@ -31,19 +30,6 @@ xfce4_popup_notes_CFLAGS = \ | |
1128 | ||
1129 | xfce4_popup_notes_LDADD = \ | |
1130 | @GTK_LIBS@ | |
1131 | -else | |
1132 | -xfce4_popup_notes_SOURCES = \ | |
1133 | - $(top_srcdir)/lib/popup.h \ | |
1134 | - xfce4-popup-notes.c | |
1135 | - | |
1136 | -xfce4_popup_notes_CFLAGS = \ | |
1137 | - @LIBX11_CFLAGS@ \ | |
1138 | - @GTK_CFLAGS@ | |
1139 | - | |
1140 | -xfce4_popup_notes_LDADD = \ | |
1141 | - @LIBX11_LIBS@ \ | |
1142 | - @GTK_LIBS@ | |
1143 | -endif | |
1144 | ||
1145 | # | |
1146 | # Settings dialog | |
1147 | @@ -59,43 +45,31 @@ xfce4_notes_settings_CFLAGS = \ | |
1148 | @LIBX11_CFLAGS@ \ | |
1149 | @GTK_CFLAGS@ \ | |
1150 | @LIBXFCE4UI_CFLAGS@ \ | |
1151 | - @XFCONF_CFLAGS@ \ | |
1152 | - @UNIQUE_CFLAGS@ | |
1153 | + @XFCONF_CFLAGS@ | |
1154 | ||
1155 | xfce4_notes_settings_LDADD = \ | |
1156 | $(top_builddir)/lib/libnotes.la \ | |
1157 | @LIBX11_LIBS@ \ | |
1158 | @GTK_LIBS@ \ | |
1159 | @LIBXFCE4UI_LIBS@ \ | |
1160 | - @XFCONF_LIBS@ \ | |
1161 | - @UNIQUE_LIBS@ | |
1162 | + @XFCONF_LIBS@ | |
1163 | ||
1164 | # | |
1165 | # Panel plugin | |
1166 | # | |
1167 | ||
1168 | -if !ENABLE_GTK3 | |
1169 | -# REM Xfce Panel is not yet built with GTK3 support | |
1170 | -# hence it's impossible to build a panel plugin yet | |
1171 | - | |
1172 | if MAINTAINER_MODE | |
1173 | notes_VALAFLAGS = \ | |
1174 | - --vapidir=$(top_srcdir)/lib \ | |
1175 | - --pkg=libnotes \ | |
1176 | + --vapidir=$(top_srcdir)/lib \ | |
1177 | + --pkg=libnotes \ | |
1178 | --pkg=config \ | |
1179 | - --pkg=libxfce4panel-1.0 \ | |
1180 | + --pkg=libxfce4panel-2.0 \ | |
1181 | --pkg=libxfconf-0 \ | |
1182 | --pkg=libxfce4util-1.0 | |
1183 | ||
1184 | -if ENABLE_GTK3 | |
1185 | notes_VALAFLAGS += \ | |
1186 | -D ENABLE_GTK3 \ | |
1187 | --pkg=gtk+-3.0 | |
1188 | -else | |
1189 | -notes_VALAFLAGS += \ | |
1190 | - --pkg=popup \ | |
1191 | - --pkg=gtk+-2.0 | |
1192 | -endif | |
1193 | ||
1194 | BUILT_SOURCES += main-panel-plugin.c | |
1195 | main-panel-plugin.c: main-panel-plugin.vala | |
1196 | @@ -104,30 +78,30 @@ endif | |
1197 | ||
1198 | plugindir = $(libdir)/xfce4/panel/plugins | |
1199 | plugin_LTLIBRARIES = libnotes.la | |
1200 | - | |
1201 | +# | |
1202 | libnotes_la_SOURCES = \ | |
1203 | main-panel-plugin.c | |
1204 | - | |
1205 | +# | |
1206 | libnotes_la_CFLAGS = \ | |
1207 | @LIBX11_CFLAGS@ \ | |
1208 | @LIBXFCE4PANEL_CFLAGS@ \ | |
1209 | @LIBXFCE4UTIL_CFLAGS@ \ | |
1210 | @XFCONF_CFLAGS@ | |
1211 | - | |
1212 | +# | |
1213 | libnotes_la_LIBADD = \ | |
1214 | $(top_builddir)/lib/libnotes.la \ | |
1215 | @LIBX11_LIBS@ \ | |
1216 | @LIBXFCE4PANEL_LIBS@ \ | |
1217 | @LIBXFCE4UTIL_LIBS@ \ | |
1218 | @XFCONF_LIBS@ | |
1219 | - | |
1220 | +# | |
1221 | libnotes_la_LDFLAGS = \ | |
1222 | -avoid-version \ | |
1223 | -module \ | |
1224 | -no-undefined \ | |
1225 | -export-symbols-regex '^xfce_panel_module_(preinit|init|construct)' \ | |
1226 | $(PLATFORM_LDFLAGS) | |
1227 | -endif | |
1228 | +#endif | |
1229 | ||
1230 | # | |
1231 | # Status icon | |
1232 | @@ -143,18 +117,8 @@ xfce4_notes_VALAFLAGS = \ | |
1233 | --vapidir=. \ | |
1234 | --pkg=xfce-autostart \ | |
1235 | --pkg=libxfconf-0 \ | |
1236 | - --pkg=libxfce4util-1.0 | |
1237 | - | |
1238 | -if ENABLE_GTK3 | |
1239 | -xfce4_notes_VALAFLAGS += \ | |
1240 | - -D ENABLE_GTK3 \ | |
1241 | + --pkg=libxfce4util-1.0 \ | |
1242 | --pkg=gtk+-3.0 | |
1243 | -else | |
1244 | -xfce4_notes_VALAFLAGS += \ | |
1245 | - --pkg=popup \ | |
1246 | - --pkg=unique-1.0 \ | |
1247 | - --pkg=gtk+-2.0 | |
1248 | -endif | |
1249 | ||
1250 | BUILT_SOURCES += main-status-icon.c | |
1251 | main-status-icon.c: main-status-icon.vala | |
1252 | @@ -170,22 +134,20 @@ xfce4_notes_CFLAGS = \ | |
1253 | @LIBX11_CFLAGS@ \ | |
1254 | @GTK_CFLAGS@ \ | |
1255 | @LIBXFCE4UTIL_CFLAGS@ \ | |
1256 | - @XFCONF_CFLAGS@ \ | |
1257 | - @UNIQUE_CFLAGS@ | |
1258 | + @XFCONF_CFLAGS@ | |
1259 | ||
1260 | xfce4_notes_LDADD = \ | |
1261 | $(top_builddir)/lib/libnotes.la \ | |
1262 | @LIBX11_LIBS@ \ | |
1263 | @GTK_LIBS@ \ | |
1264 | @LIBXFCE4UTIL_LIBS@ \ | |
1265 | - @XFCONF_LIBS@ \ | |
1266 | - @UNIQUE_LIBS@ | |
1267 | + @XFCONF_LIBS@ | |
1268 | ||
1269 | # | |
1270 | # Plugin desktop file | |
1271 | # | |
1272 | ||
1273 | -desktopdir = $(datadir)/xfce4/panel-plugins | |
1274 | +desktopdir = $(datadir)/xfce4/panel/plugins | |
1275 | desktop_in_files = xfce4-notes-plugin.desktop.in | |
1276 | desktop_DATA = xfce4-notes-plugin.desktop | |
1277 | @INTLTOOL_DESKTOP_RULE@ | |
1278 | @@ -215,15 +177,11 @@ autostart_DATA = xfce4-notes-autostart.desktop | |
1279 | EXTRA_DIST = \ | |
1280 | main-panel-plugin.vala \ | |
1281 | main-status-icon.vala \ | |
1282 | + main-popup.vala \ | |
1283 | $(desktop_in_files) \ | |
1284 | $(applications_in_files) \ | |
1285 | $(autostart_in_files) | |
1286 | ||
1287 | -if ENABLE_GTK3 | |
1288 | -EXTRA_DIST += \ | |
1289 | - xfce4-popup-notes.c | |
1290 | -endif | |
1291 | - | |
1292 | DISTCLEANFILES = \ | |
1293 | $(desktop_DATA) \ | |
1294 | $(applications_DATA) \ | |
1295 | diff --git a/src/defines.h b/src/defines.h | |
1296 | index 678fc47..cc68b78 100644 | |
1297 | --- a/src/defines.h | |
1298 | +++ b/src/defines.h | |
1299 | @@ -19,7 +19,7 @@ | |
1300 | #ifndef DEFINES_H | |
1301 | #define DEFINES_H | |
1302 | ||
1303 | -#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin" | |
1304 | +#define PLUGIN_WEBSITE "https://docs.xfce.org/panel-plugins/xfce4-notes-plugin" | |
1305 | #define PLUGIN_XFCONF_CHANNEL "xfce4-notes-plugin" | |
1306 | ||
1307 | #define BORDER 6 | |
1308 | diff --git a/src/main-panel-plugin.vala b/src/main-panel-plugin.vala | |
1309 | index 9b09c0b..5117d7d 100644 | |
1310 | --- a/src/main-panel-plugin.vala | |
1311 | +++ b/src/main-panel-plugin.vala | |
1312 | @@ -25,7 +25,7 @@ public class NotesPlugin : Xfce.PanelPlugin { | |
1313 | ||
1314 | private Gtk.Invisible invisible; | |
1315 | private Gtk.Button button; | |
1316 | - private Xfce.PanelImage image; | |
1317 | + private Gtk.Image image; | |
1318 | private Xnp.Application application; | |
1319 | ||
1320 | public NotesPlugin () { | |
1321 | @@ -33,11 +33,11 @@ public class NotesPlugin : Xfce.PanelPlugin { | |
1322 | } | |
1323 | ||
1324 | public override void @construct () { | |
1325 | - Xfce.textdomain (Config.GETTEXT_PACKAGE, Config.PACKAGE_LOCALE_DIR); | |
1326 | + Xfce.textdomain (Config.GETTEXT_PACKAGE, Config.PACKAGE_LOCALE_DIR, "UTF-8"); | |
1327 | application = new Xnp.Application (save_location (true)); | |
1328 | ||
1329 | button = (Gtk.Button)Xfce.panel_create_button (); | |
1330 | - image = new Xfce.PanelImage.from_source ("xfce4-notes-plugin"); | |
1331 | + image = new Gtk.Image.from_icon_name ("xfce4-notes-plugin", BUTTON); | |
1332 | button.add (image); | |
1333 | button.clicked.connect (() => { application.show_hide_notes (); }); | |
1334 | button.show_all (); | |
1335 | @@ -54,11 +54,11 @@ public class NotesPlugin : Xfce.PanelPlugin { | |
1336 | mi.show_all (); | |
1337 | menu_insert_item (mi); | |
1338 | ||
1339 | - set_x_selection (); | |
1340 | - | |
1341 | size_changed.connect ((p, size) => { | |
1342 | size = size / (int)nrows; | |
1343 | button.set_size_request (size, size); | |
1344 | + var icon_size = p.get_icon_size(); | |
1345 | + image.set_pixel_size(icon_size); | |
1346 | return true; | |
1347 | }); | |
1348 | save.connect (() => { application.save_windows_configuration (); }); | |
1349 | @@ -71,28 +71,6 @@ public class NotesPlugin : Xfce.PanelPlugin { | |
1350 | destroy.connect (() => { Gtk.main_quit (); }); | |
1351 | } | |
1352 | ||
1353 | - /** | |
1354 | - * set_x_selection: | |
1355 | - * | |
1356 | - * Set an X selection to listen to for the popup command. | |
1357 | - */ | |
1358 | - private bool set_x_selection () { | |
1359 | -#if !ENABLE_GTK3 | |
1360 | - invisible = new Gtk.Invisible (); | |
1361 | - if (!Xnp.Popup.set_x_selection (invisible)) { | |
1362 | - return false; | |
1363 | - } | |
1364 | - invisible.client_event.connect ((w, event) => { | |
1365 | - if (Xnp.Popup.get_message_from_event (event) == "SHOW_HIDE") { | |
1366 | - application.show_hide_notes (); | |
1367 | - return true; | |
1368 | - } | |
1369 | - return false; | |
1370 | - }); | |
1371 | -#endif | |
1372 | - return true; | |
1373 | - } | |
1374 | - | |
1375 | } | |
1376 | ||
1377 | [ModuleInit] | |
1378 | diff --git a/src/main-settings-dialog.c b/src/main-settings-dialog.c | |
1379 | index ae8ed44..0dce94e 100644 | |
1380 | --- a/src/main-settings-dialog.c | |
1381 | +++ b/src/main-settings-dialog.c | |
1382 | @@ -21,16 +21,12 @@ | |
1383 | #include <config.h> | |
1384 | #endif | |
1385 | ||
1386 | -#ifndef ENABLE_GTK3 | |
1387 | -#include <unique/unique.h> | |
1388 | -#endif | |
1389 | #include <xfconf/xfconf.h> | |
1390 | #include <gtk/gtk.h> | |
1391 | #include <libxfce4util/libxfce4util.h> | |
1392 | #include <libxfce4ui/libxfce4ui.h> | |
1393 | ||
1394 | #include "defines.h" | |
1395 | -#include "ext-gdk.h" | |
1396 | ||
1397 | #if 0 | |
1398 | static GtkWidget *notes_path_button_new (); | |
1399 | @@ -46,7 +42,7 @@ enum | |
1400 | COMBOBOX_TABS_LEFT, | |
1401 | }; | |
1402 | ||
1403 | -static GtkWidget *tabs_combo_box_new (); | |
1404 | +static GtkWidget *tabs_combo_box_new (void); | |
1405 | ||
1406 | enum | |
1407 | { | |
1408 | @@ -55,10 +51,10 @@ enum | |
1409 | COMBOBOX_SIZE_LARGE, | |
1410 | }; | |
1411 | ||
1412 | -static GtkWidget *size_combo_box_new (); | |
1413 | +static GtkWidget *size_combo_box_new (void); | |
1414 | static void cb_size_combobox_changed (GtkComboBox *combobox, gpointer data); | |
1415 | ||
1416 | -#ifndef ENABLE_GTK3 | |
1417 | +#if 0 | |
1418 | enum | |
1419 | { | |
1420 | COMBOBOX_BACKGROUND_YELLOW, | |
1421 | @@ -88,7 +84,7 @@ static gboolean cb_color_button_pressed (GtkButton *button, GdkEventButton *even | |
1422 | ||
1423 | static GtkWidget *parent_window = NULL; | |
1424 | static XfconfChannel *xfconf_channel = NULL; | |
1425 | -#ifndef ENABLE_GTK3 | |
1426 | +#if 0 | |
1427 | static GtkWidget *color_combobox = NULL; | |
1428 | static GtkWidget *color_button = NULL; | |
1429 | #endif | |
1430 | @@ -105,11 +101,7 @@ prop_dialog_new (void) | |
1431 | /* Dialog */ | |
1432 | parent_window = dialog = | |
1433 | xfce_titled_dialog_new_with_buttons (_("Notes"), NULL, | |
1434 | -#ifdef ENABLE_GTK3 | |
1435 | GTK_DIALOG_DESTROY_WITH_PARENT, | |
1436 | -#else | |
1437 | - GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR, | |
1438 | -#endif | |
1439 | GTK_STOCK_CLOSE, GTK_RESPONSE_OK, | |
1440 | NULL); | |
1441 | xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Configure the plugin")); | |
1442 | @@ -126,19 +118,11 @@ prop_dialog_new (void) | |
1443 | gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), notebook); | |
1444 | ||
1445 | /* VBox */ | |
1446 | -#ifdef ENABLE_GTK3 | |
1447 | vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); | |
1448 | -#else | |
1449 | - vbox = gtk_vbox_new (FALSE, 0); | |
1450 | -#endif | |
1451 | gtk_container_add (GTK_CONTAINER (notebook), vbox); | |
1452 | ||
1453 | /* === Global settings === */ | |
1454 | -#ifdef ENABLE_GTK3 | |
1455 | box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER); | |
1456 | -#else | |
1457 | - box = gtk_vbox_new (FALSE, BORDER); | |
1458 | -#endif | |
1459 | frame = xfce_gtk_frame_box_new_with_content (_("Global settings"), box); | |
1460 | gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER); | |
1461 | gtk_container_add (GTK_CONTAINER (vbox), frame); | |
1462 | @@ -159,11 +143,7 @@ prop_dialog_new (void) | |
1463 | * to select an empty directory otherwise things might really get | |
1464 | * mixed up. | |
1465 | */ | |
1466 | -#ifdef ENABLE_GTK3 | |
1467 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER); | |
1468 | -#else | |
1469 | - hbox = gtk_hbox_new (FALSE, BORDER); | |
1470 | -#endif | |
1471 | gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0); | |
1472 | ||
1473 | label = gtk_label_new (_("Notes path:")); | |
1474 | @@ -174,11 +154,7 @@ prop_dialog_new (void) | |
1475 | #endif | |
1476 | ||
1477 | /* Tabs position */ | |
1478 | -#ifdef ENABLE_GTK3 | |
1479 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER); | |
1480 | -#else | |
1481 | - hbox = gtk_hbox_new (FALSE, BORDER); | |
1482 | -#endif | |
1483 | gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0); | |
1484 | ||
1485 | label = gtk_label_new (_("Tabs position:")); | |
1486 | @@ -187,13 +163,9 @@ prop_dialog_new (void) | |
1487 | button = tabs_combo_box_new (); | |
1488 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); | |
1489 | ||
1490 | -#ifndef ENABLE_GTK3 | |
1491 | +#if 0 | |
1492 | /* Background color */ | |
1493 | -#ifdef ENABLE_GTK3 | |
1494 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER); | |
1495 | -#else | |
1496 | - hbox = gtk_hbox_new (FALSE, BORDER); | |
1497 | -#endif | |
1498 | gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0); | |
1499 | ||
1500 | label = gtk_label_new (_("Background:")); | |
1501 | @@ -207,11 +179,7 @@ prop_dialog_new (void) | |
1502 | #endif | |
1503 | ||
1504 | /* Font description */ | |
1505 | -#ifdef ENABLE_GTK3 | |
1506 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER); | |
1507 | -#else | |
1508 | - hbox = gtk_hbox_new (FALSE, BORDER); | |
1509 | -#endif | |
1510 | gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0); | |
1511 | ||
1512 | label = gtk_label_new (_("Font:")); | |
1513 | @@ -223,11 +191,7 @@ prop_dialog_new (void) | |
1514 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); | |
1515 | ||
1516 | /* === New window settings === */ | |
1517 | -#ifdef ENABLE_GTK3 | |
1518 | box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER); | |
1519 | -#else | |
1520 | - box = gtk_vbox_new (FALSE, BORDER); | |
1521 | -#endif | |
1522 | frame = xfce_gtk_frame_box_new_with_content (_("New group settings"), box); | |
1523 | gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER); | |
1524 | gtk_container_add (GTK_CONTAINER (vbox), frame); | |
1525 | @@ -247,11 +211,7 @@ prop_dialog_new (void) | |
1526 | gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0); | |
1527 | ||
1528 | /* Size */ | |
1529 | -#ifdef ENABLE_GTK3 | |
1530 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER); | |
1531 | -#else | |
1532 | - hbox = gtk_hbox_new (FALSE, BORDER); | |
1533 | -#endif | |
1534 | gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0); | |
1535 | ||
1536 | label = gtk_label_new (_("Size:")); | |
1537 | @@ -323,21 +283,12 @@ tabs_combo_box_new (void) | |
1538 | { | |
1539 | GtkWidget *combobox; | |
1540 | ||
1541 | -#ifdef ENABLE_GTK3 | |
1542 | combobox = gtk_combo_box_text_new (); | |
1543 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("None")); | |
1544 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Top")); | |
1545 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Right")); | |
1546 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Bottom")); | |
1547 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Left")); | |
1548 | -#else | |
1549 | - combobox = gtk_combo_box_new_text (); | |
1550 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("None")); | |
1551 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Top")); | |
1552 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Right")); | |
1553 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Bottom")); | |
1554 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Left")); | |
1555 | -#endif | |
1556 | gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0); | |
1557 | ||
1558 | xfconf_g_property_bind (xfconf_channel, "/global/tabs-position", | |
1559 | @@ -352,17 +303,10 @@ size_combo_box_new (void) | |
1560 | GtkWidget *combobox; | |
1561 | gint size; | |
1562 | ||
1563 | -#ifdef ENABLE_GTK3 | |
1564 | combobox = gtk_combo_box_text_new (); | |
1565 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Small")); | |
1566 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Normal")); | |
1567 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Large")); | |
1568 | -#else | |
1569 | - combobox = gtk_combo_box_new_text (); | |
1570 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Small")); | |
1571 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Normal")); | |
1572 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Large")); | |
1573 | -#endif | |
1574 | ||
1575 | size = xfconf_channel_get_int (xfconf_channel, "/new-window/width", SIZE_NORMAL); | |
1576 | if (size == SIZE_SMALL) | |
1577 | @@ -412,7 +356,7 @@ cb_size_combobox_changed (GtkComboBox *combobox, | |
1578 | xfconf_channel_set_int (xfconf_channel, "/new-window/height", height); | |
1579 | } | |
1580 | ||
1581 | -#ifndef ENABLE_GTK3 | |
1582 | +#if 0 | |
1583 | static GtkWidget * | |
1584 | background_combo_box_new (void) | |
1585 | { | |
1586 | @@ -420,7 +364,6 @@ background_combo_box_new (void) | |
1587 | gchar *color; | |
1588 | gint id; | |
1589 | ||
1590 | -#ifdef ENABLE_GTK3 | |
1591 | combobox = gtk_combo_box_text_new (); | |
1592 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Yellow")); | |
1593 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Blue")); | |
1594 | @@ -433,20 +376,6 @@ background_combo_box_new (void) | |
1595 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Android")); | |
1596 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("GTK+")); | |
1597 | gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Custom...")); | |
1598 | -#else | |
1599 | - combobox = gtk_combo_box_new_text (); | |
1600 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Yellow")); | |
1601 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Blue")); | |
1602 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Green")); | |
1603 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Indigo")); | |
1604 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Olive")); | |
1605 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Carmine")); | |
1606 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Mimosa")); | |
1607 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("White")); | |
1608 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Android")); | |
1609 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("GTK+")); | |
1610 | - gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Custom...")); | |
1611 | -#endif | |
1612 | ||
1613 | color = xfconf_channel_get_string (xfconf_channel, "/global/background-color", GENERAL_BACKGROUND_COLOR); | |
1614 | if (!g_ascii_strcasecmp (color, BACKGROUND_YELLOW)) | |
1615 | @@ -634,9 +563,6 @@ color_button_new (void) | |
1616 | g_free (color); | |
1617 | ||
1618 | button = gtk_color_button_new_with_color (&gdkcolor); | |
1619 | -#ifndef ENABLE_GTK3 | |
1620 | - gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); | |
1621 | -#endif | |
1622 | ||
1623 | g_signal_connect (button, "button-press-event", G_CALLBACK (cb_color_button_pressed), NULL); | |
1624 | ||
1625 | @@ -666,38 +592,16 @@ cb_color_button_pressed (GtkButton *button, | |
1626 | ||
1627 | ||
1628 | ||
1629 | -#ifndef ENABLE_GTK3 | |
1630 | -static UniqueResponse | |
1631 | -cb_unique_app (UniqueApp *app, | |
1632 | - gint command, | |
1633 | - UniqueMessageData *message_data, | |
1634 | - guint time_, | |
1635 | - gpointer user_data) | |
1636 | -{ | |
1637 | - GtkWidget *dialog = user_data; | |
1638 | - if (command != UNIQUE_ACTIVATE) | |
1639 | - { | |
1640 | - return UNIQUE_RESPONSE_PASSTHROUGH; | |
1641 | - } | |
1642 | - gtk_window_present (GTK_WINDOW (dialog)); | |
1643 | - return UNIQUE_RESPONSE_OK; | |
1644 | -} | |
1645 | -#endif | |
1646 | - | |
1647 | gint main (gint argc, | |
1648 | gchar *argv[]) | |
1649 | { | |
1650 | GtkWidget *dialog; | |
1651 | -#ifdef ENABLE_GTK3 | |
1652 | GtkApplication *app; | |
1653 | GError *error = NULL; | |
1654 | -#else | |
1655 | - UniqueApp *app; | |
1656 | -#endif | |
1657 | xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, NULL); | |
1658 | xfconf_init (NULL); | |
1659 | gtk_init (&argc, &argv); | |
1660 | -#ifdef ENABLE_GTK3 | |
1661 | + | |
1662 | app = gtk_application_new ("org.xfce.NotesSettings", 0); | |
1663 | ||
1664 | g_application_register (G_APPLICATION (app), NULL, &error); | |
1665 | @@ -714,25 +618,10 @@ gint main (gint argc, | |
1666 | g_object_unref (app); | |
1667 | return 0; | |
1668 | } | |
1669 | -#else | |
1670 | - app = unique_app_new ("org.xfce.NotesSettings", NULL); | |
1671 | - if (unique_app_is_running (app)) | |
1672 | - { | |
1673 | - if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK) | |
1674 | - { | |
1675 | - g_object_unref (app); | |
1676 | - return 0; | |
1677 | - } | |
1678 | - } | |
1679 | -#endif | |
1680 | ||
1681 | dialog = prop_dialog_new (); | |
1682 | ||
1683 | -#ifdef ENABLE_GTK3 | |
1684 | g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), dialog); | |
1685 | -#else | |
1686 | - g_signal_connect (app, "message-received", G_CALLBACK (cb_unique_app), dialog); | |
1687 | -#endif | |
1688 | ||
1689 | gtk_dialog_run (GTK_DIALOG (dialog)); | |
1690 | gtk_widget_destroy (dialog); | |
1691 | diff --git a/src/main-status-icon.vala b/src/main-status-icon.vala | |
1692 | index 429b6d8..6c385ac 100644 | |
1693 | --- a/src/main-status-icon.vala | |
1694 | +++ b/src/main-status-icon.vala | |
1695 | @@ -27,8 +27,8 @@ static Gtk.StatusIcon status_icon; | |
1696 | static Gtk.Menu context_menu; | |
1697 | ||
1698 | static void build_plugin () { | |
1699 | - Xfce.textdomain (Config.GETTEXT_PACKAGE, Config.PACKAGE_LOCALE_DIR); | |
1700 | - var save_location = Xfce.Resource.save_location (Xfce.ResourceType.CONFIG, "xfce4/xfce4-notes.rc", true); | |
1701 | + Xfce.textdomain (Config.GETTEXT_PACKAGE, Config.PACKAGE_LOCALE_DIR, "UTF-8"); | |
1702 | + var save_location = Xfce.resource_save_location (Xfce.ResourceType.CONFIG, "xfce4/xfce4-notes.rc", true); | |
1703 | application = new Xnp.Application (save_location); | |
1704 | status_icon = new Gtk.StatusIcon.from_icon_name ("xfce4-notes-plugin"); | |
1705 | status_icon.set_tooltip_text (_("Notes")); | |
1706 | @@ -44,7 +44,6 @@ static void build_plugin () { | |
1707 | status_icon.popup_menu.connect (() => { | |
1708 | context_menu.popup (null, null, status_icon.position_menu, 0, Gtk.get_current_event_time ()); | |
1709 | }); | |
1710 | - set_x_selection (); | |
1711 | } | |
1712 | ||
1713 | static Gtk.Menu build_context_menu () { | |
1714 | @@ -58,18 +57,18 @@ static Gtk.Menu build_context_menu () { | |
1715 | mi = new Gtk.SeparatorMenuItem (); | |
1716 | menu.append (mi); | |
1717 | ||
1718 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.PROPERTIES, null); | |
1719 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Properties")); | |
1720 | mi.activate.connect (() => { application.open_settings_dialog (); }); | |
1721 | menu.append (mi); | |
1722 | ||
1723 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.ABOUT, null); | |
1724 | + mi = new Gtk.MenuItem.with_mnemonic (_("_About")); | |
1725 | mi.activate.connect (() => { application.open_about_dialog (); }); | |
1726 | menu.append (mi); | |
1727 | ||
1728 | mi = new Gtk.SeparatorMenuItem (); | |
1729 | menu.append (mi); | |
1730 | ||
1731 | - mi = new Gtk.ImageMenuItem.from_stock (Gtk.Stock.REMOVE, null); | |
1732 | + mi = new Gtk.MenuItem.with_mnemonic (_("_Remove")); | |
1733 | mi.activate.connect (() => { | |
1734 | application.save_notes (); | |
1735 | Xfce.Autostart.@set ("xfce4-notes-autostart", "xfce4-notes", true); | |
1736 | @@ -82,26 +81,8 @@ static Gtk.Menu build_context_menu () { | |
1737 | return menu; | |
1738 | } | |
1739 | ||
1740 | -static bool set_x_selection () { | |
1741 | -#if !ENABLE_GTK3 | |
1742 | - invisible = new Gtk.Invisible (); | |
1743 | - if (!Xnp.Popup.set_x_selection (invisible)) { | |
1744 | - return false; | |
1745 | - } | |
1746 | - invisible.client_event.connect ((w, event) => { | |
1747 | - if (Xnp.Popup.get_message_from_event (event) == "SHOW_HIDE") { | |
1748 | - application.show_hide_notes (); | |
1749 | - return true; | |
1750 | - } | |
1751 | - return false; | |
1752 | - }); | |
1753 | -#endif | |
1754 | - return true; | |
1755 | -} | |
1756 | - | |
1757 | static int main (string[] args) { | |
1758 | Gtk.init (ref args); | |
1759 | -#if ENABLE_GTK3 | |
1760 | Gtk.Application app = new Gtk.Application ("org.xfce.Notes", 0); | |
1761 | ||
1762 | try { | |
1763 | @@ -118,21 +99,7 @@ static int main (string[] args) { | |
1764 | app.activate.connect (() => { | |
1765 | application.show_hide_notes (); | |
1766 | }); | |
1767 | -#else | |
1768 | - Unique.App app = new Unique.App ("org.xfce.Notes", null); | |
1769 | - if (app.is_running) { | |
1770 | - if (app.send_message (Unique.Command.ACTIVATE, null) == Unique.Response.OK) { | |
1771 | - app = null; | |
1772 | - return 0; | |
1773 | - } | |
1774 | - } | |
1775 | - app.message_received.connect ((command, message_data, time_) => { | |
1776 | - if (command != Unique.Command.ACTIVATE) { | |
1777 | - return Unique.Response.PASSTHROUGH; | |
1778 | - } | |
1779 | - return Unique.Response.OK; | |
1780 | - }); | |
1781 | -#endif | |
1782 | + | |
1783 | GLib.Environment.set_application_name (_("Notes")); | |
1784 | build_plugin (); | |
1785 | Xfce.Autostart.@set ("xfce4-notes-autostart", "xfce4-notes", false); | |
1786 | diff --git a/src/xfce4-notes-plugin.desktop.in b/src/xfce4-notes-plugin.desktop.in | |
1787 | index 7da3981..0313d38 100644 | |
1788 | --- a/src/xfce4-notes-plugin.desktop.in | |
1789 | +++ b/src/xfce4-notes-plugin.desktop.in | |
1790 | @@ -7,3 +7,4 @@ Icon=xfce4-notes-plugin | |
1791 | X-XFCE-Unique=true | |
1792 | X-XFCE-Module=notes | |
1793 | X-XFCE-Internal=FALSE | |
1794 | +X-XFCE-API=2.0 | |
1795 | diff --git a/src/main-popup.vala b/src/main-popup.vala | |
1796 | new file mode 100644 | |
1797 | index 0000000..e52f7ac | |
1798 | --- /dev/null | |
1799 | +++ b/src/main-popup.vala | |
1800 | @@ -0,0 +1,43 @@ | |
1801 | +/* | |
1802 | + * Notes - panel plugin for Xfce Desktop Environment | |
1803 | + * Copyright (C) 2006-2013 Mike Massonnet <mmassonnet@xfce.org> | |
1804 | + * | |
1805 | + * This program is free software; you can redistribute it and/or modify | |
1806 | + * it under the terms of the GNU General Public License as published by | |
1807 | + * the Free Software Foundation; either version 2 of the License, or | |
1808 | + * (at your option) any later version. | |
1809 | + * | |
1810 | + * This program is distributed in the hope that it will be useful, | |
1811 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
1812 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
1813 | + * GNU General Public License for more details. | |
1814 | + * | |
1815 | + * You should have received a copy of the GNU General Public License | |
1816 | + * along with this program; if not, write to the Free Software | |
1817 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | |
1818 | + */ | |
1819 | + | |
1820 | +static int main (string[] args) { | |
1821 | + Gtk.init (ref args); | |
1822 | + var app = new GLib.Application ("org.xfce.Notes", 0); | |
1823 | + try { | |
1824 | + app.register (); | |
1825 | + } catch (GLib.Error e) { | |
1826 | + warning ("Unable to register: %s", e.message); | |
1827 | + return -1; | |
1828 | + } | |
1829 | + if (!app.get_is_remote ()) { | |
1830 | + // We are the primary instance, in that case start xfce4-notes | |
1831 | + try { | |
1832 | + message ("xfce4-notes isn't currently running, trying to start it..."); | |
1833 | + GLib.Process.spawn_command_line_async ("xfce4-notes"); | |
1834 | + } catch (GLib.Error e) { | |
1835 | + critical ("%s", e.message); | |
1836 | + return -1; | |
1837 | + } | |
1838 | + } else { | |
1839 | + // Send an activate signal which is used to show/hide the notes | |
1840 | + app.activate (); | |
1841 | + } | |
1842 | + return 0; | |
1843 | +} | |
1844 | diff --git a/src/xfce-autostart.vapi b/src/xfce-autostart.vapi | |
1845 | new file mode 100644 | |
1846 | index 0000000..87eb24c | |
1847 | --- /dev/null | |
1848 | +++ b/src/xfce-autostart.vapi | |
1849 | @@ -0,0 +1,5 @@ | |
1850 | +[CCode (cheader_filename = "xfce-autostart.h")] | |
1851 | +namespace Xfce.Autostart { | |
1852 | + public static void @set (string name, string exec, bool hidden); | |
1853 | + public static void set_full (string name, string exec, bool hidden, bool terminal, string? comment, string? icon); | |
1854 | +} |