1 diff --git a/Makefile.am b/Makefile.am
2 index 23b69e4..f320cb5 100644
6 +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
11 @@ -9,13 +11,21 @@ SUBDIRS = \
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)
43 diff --git a/README.md b/README.md
45 index 0000000..2126a0f
49 +[![License](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin/-/blob/master/COPYING)
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.
61 +[xfce4-notes-plugin documentation](https://docs.xfce.org/panel-plugins/xfce4-notes-plugin)
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.
67 +### Source Code Repository
69 +[Xfce4-notes-plugin source code](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin)
71 +### Download a Release Tarball
73 +[Xfce4-notes-plugin archive](https://archive.xfce.org/src/panel-plugins/xfce4-notes-plugin)
75 +[Xfce4-notes-plugin tags](https://gitlab.xfce.org/panel-plugins/xfce4-notes-plugin/-/tags)
79 +From source code repository:
81 + % cd xfce4-notes-plugin
86 +From release tarball:
88 + % tar xf xfce4-notes-plugin-<version>.tar.bz2
89 + % cd xfce4-notes-plugin-<version>
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.
98 diff --git a/configure.ac b/configure.ac
99 index 1f15797..f5d80ad 100644
102 @@ -2,20 +2,20 @@ dnl
103 dnl xfce4-notes-plugin - Notes plugin for the Xfce4 panel
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>
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()])])
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])
131 LT_INIT([disable-static])
133 -AM_INIT_AUTOMAKE([1.13 dist-bzip2 no-dist-gzip])
134 +AM_INIT_AUTOMAKE([1.13 dist-bzip2 no-dist-gzip foreign])
136 AM_SILENT_RULES([yes])
137 +AC_CONFIG_MACRO_DIRS([m4])
139 dnl Check for basic programs
141 @@ -41,40 +42,19 @@ AC_SUBST([MATH_LIBS], [" -lm"])
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])
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])
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])
165 -AM_CONDITIONAL([ENABLE_GTK3], [test "x$enable_gtk3" = "xyes"])
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])
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])
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])
186 - XDT_CHECK_PACKAGE([XFCE4VALA], [xfce4-vala], [4.10])
190 @@ -87,9 +67,7 @@ XDT_FEATURE_DEBUG()
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
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
204 echo " * Vala: $VALAC $am__vala_version"
205 -if test "x$enable_gtk3" = "xno" ; then
206 -echo " * Xfce4-vala: $XFCE4VALA_VERSION"
210 echo "* GTK+: $GTK_VERSION"
211 -if test "x$enable_gtk3" = "xyes" ; then
213 -echo "* W GTK3 support is only experimental, don't use for production."
217 -if test "x$enable_gtk3" = "xno" ; then
218 echo "* Xfce Panel: $LIBXFCE4PANEL_VERSION"
220 echo "* Debug Support: $enable_debug"
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
234 diff --git a/data/gtk-3.0/Makefile.am b/data/gtk-3.0/Makefile.am
236 index 0000000..a6a4c3a
238 +++ b/data/gtk-3.0/Makefile.am
240 +notesgtkcssdir = $(pkgdatadir)/gtk-3.0
241 +dist_notesgtkcss_DATA = \
243 diff --git a/data/gtk-3.0/gtk-main.css b/data/gtk-3.0/gtk-main.css
244 index 0000000..9628dfd
246 +++ b/data/gtk-3.0/gtk-main.css
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);
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);
266 +/* window and frame */
268 + background-image: linear-gradient(to bottom,
269 + shade (@theme_base_color, 0.8),
270 + shade (@theme_base_color, 0.95) 87px);
274 + padding: 1px 2px 4px 2px;
275 + border: 1px solid shade (@theme_base_color, 0.7);
278 +/* icon buttons in window title bar */
279 +window widget#notes-icon-button {
281 + background-color: transparent;
283 +window widget#notes-icon-button:active {
284 + color: darker (@theme_fg_color);
285 + text-shadow: 1px 1px lighter (@theme_bg_color);
287 +window widget#notes-icon-button:disabled {
288 + color: shade (@insensitive_fg_color, 1.2);
290 +window widget#notes-icon-button:hover {
291 + color: shade (@insensitive_fg_color, 0.8);
296 + background: transparent;
298 +notebook > header.top {
299 + border-bottom: 2px solid @theme_selected_bg_color;
301 +notebook > header.bottom {
302 + border-top: 2px solid @theme_selected_bg_color;
304 +notebook > header.left {
305 + border-right: 2px solid @theme_selected_bg_color;
307 +notebook > header.right {
308 + border-left: 2px solid @theme_selected_bg_color;
311 +/* notebook tab style */
312 +notebook > header.top tab, notebook > header.bottom tab {
315 +notebook > header.right tab, notebook > header.left tab {
319 +notebook > header tab {
321 + color: @insensitive_fg_color;
322 + background: transparent;
324 +notebook > header tab:checked {
325 + color: shade (@theme_text_color, 0.8);
327 +notebook > header tab.dnd {
328 + background: @theme_selected_bg_color;
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;
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 */
338 +notebook > header.top > tabs > tab:hover {
339 + box-shadow: inset 0px -2px shade (@theme_selected_bg_color, 1.3);
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;
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;
349 +notebook > header.bottom > tabs > tab:hover {
350 + box-shadow: inset 0px 2px shade (@theme_selected_bg_color, 1.3);
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;
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;
360 +notebook > header.left > tabs > tab:hover {
361 + box-shadow: inset -2px 0px shade (@theme_selected_bg_color, 1.3);
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;
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;
371 +notebook > header.right > tabs > tab:hover {
372 + box-shadow: inset 2px 0px shade (@theme_selected_bg_color, 1.3);
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);
382 +textview > text > selection {
383 + color: @theme_selected_fg_color;
384 + background-color: @theme_selected_bg_color;
388 + background-color: transparent;
391 + background-color: shade (@theme_bg_color, 0.55);
394 +scrollbar slider:hover {
395 + background-color: shade (@theme_bg_color, 0.7);
398 +scrollbar slider:hover:active {
399 + background-color: shade (@theme_bg_color, 0.55);
403 +tooltip, tooltip * {
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) \
416 - --pkg=libxfce4util-1.0
419 -libnotes_la_VALAFLAGS += \
421 + --pkg=libxfce4util-1.0 \
424 -libnotes_la_VALAFLAGS += \
426 - --pkg=theme-gtkrc \
430 libnotes_la_SOURCES = \
432 @@ -26,17 +16,8 @@ libnotes_la_SOURCES = \
439 -libnotes_la_SOURCES += \
443 -libnotes_la_SOURCES += \
449 libnotes_la_CFLAGS = \
450 -DPKGDATADIR=\""$(pkgdatadir)"\" \
451 @@ -56,17 +37,6 @@ libnotes_la_LIBADD = \
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;
478 - var notesgtkrc = "%s/xfce4/xfce4-notes.gtkrc".printf (GLib.Environment.get_user_config_dir ());
479 - Gtk.rc_parse (notesgtkrc);
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);
490 catch (GLib.Error e) {
491 critical ("Unable to connect to UNIX signals. %s", e.message);
492 @@ -48,7 +43,7 @@ namespace Xnp {
496 - catch (Xfconf.Error e) {
497 + catch (GLib.Error e) {
498 critical ("%s", e.message);
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+") {
506 // TODO: Read from StyleContext with default CssProvider
509 - var style_widget = new Gtk.Invisible ();
510 - color = style_widget.get_style ().bg[Gtk.StateType.NORMAL].to_string ();
513 Xnp.Theme.set_background_color (color);
515 @@ -231,9 +221,9 @@ namespace Xnp {
516 window_monitor_list_add (window);
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");
526 /* Connect signals */
527 @@ -268,7 +258,7 @@ namespace Xnp {
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");
535 string path = "%s/%s/%s".printf (notes_path, win.name, note.name);
536 @@ -318,7 +308,7 @@ namespace Xnp {
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");
544 catch (FileError e) {
545 @@ -433,20 +423,13 @@ namespace Xnp {
547 private void rename_window (Xnp.Window window) {
548 var dialog = new Gtk.Dialog.with_buttons (_("Rename group"), window,
550 Gtk.DialogFlags.DESTROY_WITH_PARENT,
552 - Gtk.DialogFlags.DESTROY_WITH_PARENT|Gtk.DialogFlags.NO_SEPARATOR,
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;
563 - content_area.border_width = 6;
566 var entry = new Gtk.Entry ();
567 entry.text = window.name;
568 @@ -730,24 +713,6 @@ namespace Xnp {
569 * Open the about dialog.
571 public void open_about_dialog () {
573 - Gtk.AboutDialog.set_url_hook ((dialog, uri) => {
576 - command = "exo-open %s".printf (uri);
577 - GLib.Process.spawn_command_line_async (command);
579 - } catch (GLib.Error e) {
582 - command = "firefox %s".printf (uri);
583 - GLib.Process.spawn_command_line_async (command);
585 - } catch (GLib.Error e) {
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",
605 "translator-credits", _("translator-credits"),
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 ();
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);
622 diff --git a/lib/config.vapi b/lib/config.vapi
623 index 0000000..ed99c17 100644
625 +++ b/lib/config.vapi
626 @@ -0,0 +1,21 @@ namespace Xnp {
627 +[CCode (cprefix = "", lower_case_prefix = "", cheader_filename = "config.h")]
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;
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 {
654 public class HypertextView : Gtk.TextView {
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);
661 private bool cursor_over_link = false;
663 @@ -45,7 +45,7 @@ namespace Xnp {
666 Pango.FontDescription font_descr = Pango.FontDescription.from_string (value);
667 - modify_font (font_descr);
668 + override_font (font_descr);
672 @@ -107,7 +107,7 @@ namespace Xnp {
673 if (iter.has_tag (this.tag_link)) {
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);
681 @@ -220,7 +220,7 @@ namespace Xnp {
682 Gtk.TextIter start, end;
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)) {
688 start.backward_to_tag_toggle (this.tag_link);
690 @@ -406,7 +406,7 @@ namespace Xnp {
691 while (iter.forward_search ("http://", Gtk.TextSearchFlags.TEXT_ONLY, out start, out end, null)) {
694 - if (start.begins_tag (this.tag_link))
695 + if (start.starts_tag (this.tag_link))
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 ();
707 + ((Gtk.Widget)this).name = "notes-icon-button";
708 set_visible_window (false);
709 set_above_child (true);
710 set_size_request (22, 22);
712 - set_border_width (2);
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);
720 protected void set_widget_source_color (Cairo.Context cr) {
722 var style_context = get_style_context ();
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));
728 Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.INSENSITIVE));
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]);
739 public override void add (Gtk.Widget widget) {
740 warning ("This object doesn't allow packing child widgets.");
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 {
752 - public override bool expose_event (Gdk.EventExpose event) {
753 - Gtk.Allocation allocation;
754 - get_allocation (out allocation);
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;
761 - var cr = Gdk.cairo_create (get_window ());
762 - cr.rectangle (x, y, width, height);
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);
775 private bool on_enter_notify_event (Gdk.EventCrossing event) {
777 diff --git a/lib/note.vala b/lib/note.vala
778 index 3d4266e..148d470 100644
781 @@ -104,7 +104,8 @@ namespace Xnp {
785 -/*public class GtkSample : Window {
787 +public class GtkSample : Window {
789 public GtkSample () {
790 this.title = "Sample Window";
791 @@ -122,5 +123,6 @@ namespace Xnp {
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
804 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
810 public class ThemeGtkcss : GLib.Object {
811 @@ -40,7 +39,7 @@ namespace Xnp {
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);
820 @@ -49,5 +48,4 @@ namespace Xnp {
826 diff --git a/lib/theme.vala b/lib/theme.vala
827 index d6b50ef..e0c821d 100644
830 @@ -28,13 +28,8 @@ namespace Xnp {
835 Xnp.ThemeGtkcss.update_css (gdkcolor);
836 Xnp.ThemeGtkcss.update_style_context ();
838 - Xnp.ThemeGtkrc.update_gtkrc (gdkcolor);
839 - Gtk.rc_reparse_all ();
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;
853 private Gtk.Box content_box;
855 - private Gtk.VBox content_box;
857 private Gtk.Notebook notebook;
859 private Gtk.UIManager ui;
860 @@ -78,13 +74,13 @@ namespace Xnp {
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);
875 - private unowned SList<unowned Xnp.Window> window_list;
876 + private unowned SList<Xnp.Window> window_list;
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);
885 var vbox_frame = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
887 - var vbox_frame = new Gtk.VBox (false, 0);
890 vbox_frame.spacing = 1;
892 frame.add (vbox_frame);
894 /* Build title bar */
896 var title_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
898 - var title_box = new Gtk.HBox (false, 0);
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);
906 /* Build content box */
908 this.content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
910 - this.content_box = new Gtk.VBox (false, 0);
912 this.content_box.show ();
913 vbox_frame.pack_start (this.content_box, true, true, 0);
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;
920 - this.notebook.tab_border = 4;
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;
930 get_window ().get_geometry (out winx, out winy, out width, out height);
931 menu.get_preferred_size (out requisition, null);
933 - get_window ().get_geometry (out winx, out winy, out width, out height, null);
934 - menu.size_request (out requisition);
936 get_window ().get_origin (out x, out y);
939 @@ -667,13 +643,9 @@ namespace Xnp {
941 if (x + requisition.width > Gdk.Screen.width ()) {
942 /* Adjust menu left */
945 menu.get_preferred_width (out menu_width, null);
946 x = x - menu_width + allocation.y;
948 - x = x - menu.requisition.width + content_box.allocation.y;
953 @@ -699,24 +671,22 @@ namespace Xnp {
954 mi = new Gtk.SeparatorMenuItem ();
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);
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);
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);
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);
982 @@ -739,11 +709,11 @@ namespace Xnp {
983 mi = new Gtk.SeparatorMenuItem ();
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"); });
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"); });
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);
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 {
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);
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);
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);
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.
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;
1045 @@ -1057,16 +1017,12 @@ namespace Xnp {
1046 var note = (Xnp.Note)(this.notebook.get_nth_page (page));
1048 var dialog = new Gtk.Dialog.with_buttons (_("Rename note"), (Gtk.Window)get_toplevel (),
1050 Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT,
1052 - Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT|Gtk.DialogFlags.NO_SEPARATOR,
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;
1064 @@ -1079,7 +1035,7 @@ namespace Xnp {
1065 int res = dialog.run ();
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 {
1075 var note = (Xnp.Note)(this.notebook.get_nth_page (page));
1078 var dialog = new Gtk.FontChooserDialog ("Choose current note font", this);
1079 dialog.set_font (note.text_view.font);
1081 - var dialog = new Gtk.FontSelectionDialog ("Choose current note font");
1082 - dialog.set_font_name (note.text_view.font);
1084 int res = dialog.run ();
1086 if (res == Gtk.ResponseType.OK) {
1088 note.text_view.font = dialog.get_font ();
1090 - note.text_view.font = dialog.get_font_name ();
1095 @@ -1179,7 +1126,8 @@ namespace Xnp {
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 {
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 = \
1121 bin_PROGRAMS = xfce4-popup-notes
1125 xfce4_popup_notes_VALAFLAGS = \
1127 @@ -31,19 +30,6 @@ xfce4_popup_notes_CFLAGS = \
1129 xfce4_popup_notes_LDADD = \
1132 -xfce4_popup_notes_SOURCES = \
1133 - $(top_srcdir)/lib/popup.h \
1134 - xfce4-popup-notes.c
1136 -xfce4_popup_notes_CFLAGS = \
1140 -xfce4_popup_notes_LDADD = \
1147 @@ -59,43 +45,31 @@ xfce4_notes_settings_CFLAGS = \
1150 @LIBXFCE4UI_CFLAGS@ \
1155 xfce4_notes_settings_LDADD = \
1156 $(top_builddir)/lib/libnotes.la \
1169 -# REM Xfce Panel is not yet built with GTK3 support
1170 -# hence it's impossible to build a panel plugin yet
1174 - --vapidir=$(top_srcdir)/lib \
1176 + --vapidir=$(top_srcdir)/lib \
1179 - --pkg=libxfce4panel-1.0 \
1180 + --pkg=libxfce4panel-2.0 \
1182 --pkg=libxfce4util-1.0
1185 notes_VALAFLAGS += \
1189 -notes_VALAFLAGS += \
1194 BUILT_SOURCES += main-panel-plugin.c
1195 main-panel-plugin.c: main-panel-plugin.vala
1196 @@ -104,30 +78,30 @@ endif
1198 plugindir = $(libdir)/xfce4/panel/plugins
1199 plugin_LTLIBRARIES = libnotes.la
1202 libnotes_la_SOURCES = \
1206 libnotes_la_CFLAGS = \
1208 @LIBXFCE4PANEL_CFLAGS@ \
1209 @LIBXFCE4UTIL_CFLAGS@ \
1213 libnotes_la_LIBADD = \
1214 $(top_builddir)/lib/libnotes.la \
1216 @LIBXFCE4PANEL_LIBS@ \
1217 @LIBXFCE4UTIL_LIBS@ \
1221 libnotes_la_LDFLAGS = \
1225 -export-symbols-regex '^xfce_panel_module_(preinit|init|construct)' \
1232 @@ -143,18 +117,8 @@ xfce4_notes_VALAFLAGS = \
1234 --pkg=xfce-autostart \
1236 - --pkg=libxfce4util-1.0
1239 -xfce4_notes_VALAFLAGS += \
1241 + --pkg=libxfce4util-1.0 \
1244 -xfce4_notes_VALAFLAGS += \
1246 - --pkg=unique-1.0 \
1250 BUILT_SOURCES += main-status-icon.c
1251 main-status-icon.c: main-status-icon.vala
1252 @@ -170,22 +134,20 @@ xfce4_notes_CFLAGS = \
1255 @LIBXFCE4UTIL_CFLAGS@ \
1260 xfce4_notes_LDADD = \
1261 $(top_builddir)/lib/libnotes.la \
1264 @LIBXFCE4UTIL_LIBS@ \
1270 # Plugin desktop file
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
1280 main-panel-plugin.vala \
1281 main-status-icon.vala \
1283 $(desktop_in_files) \
1284 $(applications_in_files) \
1285 $(autostart_in_files)
1289 - xfce4-popup-notes.c
1294 $(applications_DATA) \
1295 diff --git a/src/defines.h b/src/defines.h
1296 index 678fc47..cc68b78 100644
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"
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 {
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;
1320 public NotesPlugin () {
1321 @@ -33,11 +33,11 @@ public class NotesPlugin : Xfce.PanelPlugin {
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));
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);
1333 button.clicked.connect (() => { application.show_hide_notes (); });
1335 @@ -54,11 +54,11 @@ public class NotesPlugin : Xfce.PanelPlugin {
1337 menu_insert_item (mi);
1339 - set_x_selection ();
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);
1348 save.connect (() => { application.save_windows_configuration (); });
1349 @@ -71,28 +71,6 @@ public class NotesPlugin : Xfce.PanelPlugin {
1350 destroy.connect (() => { Gtk.main_quit (); });
1354 - * set_x_selection:
1356 - * Set an X selection to listen to for the popup command.
1358 - private bool set_x_selection () {
1360 - invisible = new Gtk.Invisible ();
1361 - if (!Xnp.Popup.set_x_selection (invisible)) {
1364 - invisible.client_event.connect ((w, event) => {
1365 - if (Xnp.Popup.get_message_from_event (event) == "SHOW_HIDE") {
1366 - application.show_hide_notes ();
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
1386 -#ifndef ENABLE_GTK3
1387 -#include <unique/unique.h>
1389 #include <xfconf/xfconf.h>
1390 #include <gtk/gtk.h>
1391 #include <libxfce4util/libxfce4util.h>
1392 #include <libxfce4ui/libxfce4ui.h>
1394 #include "defines.h"
1395 -#include "ext-gdk.h"
1398 static GtkWidget *notes_path_button_new ();
1399 @@ -46,7 +42,7 @@ enum
1403 -static GtkWidget *tabs_combo_box_new ();
1404 +static GtkWidget *tabs_combo_box_new (void);
1408 @@ -55,10 +51,10 @@ enum
1409 COMBOBOX_SIZE_LARGE,
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);
1416 -#ifndef ENABLE_GTK3
1420 COMBOBOX_BACKGROUND_YELLOW,
1421 @@ -88,7 +84,7 @@ static gboolean cb_color_button_pressed (GtkButton *button, GdkEventButton *even
1423 static GtkWidget *parent_window = NULL;
1424 static XfconfChannel *xfconf_channel = NULL;
1425 -#ifndef ENABLE_GTK3
1427 static GtkWidget *color_combobox = NULL;
1428 static GtkWidget *color_button = NULL;
1430 @@ -105,11 +101,7 @@ prop_dialog_new (void)
1432 parent_window = dialog =
1433 xfce_titled_dialog_new_with_buttons (_("Notes"), NULL,
1435 GTK_DIALOG_DESTROY_WITH_PARENT,
1437 - GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
1439 GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
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);
1447 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
1449 - vbox = gtk_vbox_new (FALSE, 0);
1451 gtk_container_add (GTK_CONTAINER (notebook), vbox);
1453 /* === Global settings === */
1455 box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER);
1457 - box = gtk_vbox_new (FALSE, BORDER);
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
1467 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
1469 - hbox = gtk_hbox_new (FALSE, BORDER);
1471 gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
1473 label = gtk_label_new (_("Notes path:"));
1474 @@ -174,11 +154,7 @@ prop_dialog_new (void)
1479 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
1481 - hbox = gtk_hbox_new (FALSE, BORDER);
1483 gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
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);
1490 -#ifndef ENABLE_GTK3
1492 /* Background color */
1494 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
1496 - hbox = gtk_hbox_new (FALSE, BORDER);
1498 gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
1500 label = gtk_label_new (_("Background:"));
1501 @@ -207,11 +179,7 @@ prop_dialog_new (void)
1504 /* Font description */
1506 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
1508 - hbox = gtk_hbox_new (FALSE, BORDER);
1510 gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
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);
1516 /* === New window settings === */
1518 box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER);
1520 - box = gtk_vbox_new (FALSE, BORDER);
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);
1530 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
1532 - hbox = gtk_hbox_new (FALSE, BORDER);
1534 gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
1536 label = gtk_label_new (_("Size:"));
1537 @@ -323,21 +283,12 @@ tabs_combo_box_new (void)
1539 GtkWidget *combobox;
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"));
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"));
1556 gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
1558 xfconf_g_property_bind (xfconf_channel, "/global/tabs-position",
1559 @@ -352,17 +303,10 @@ size_combo_box_new (void)
1560 GtkWidget *combobox;
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"));
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"));
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);
1581 -#ifndef ENABLE_GTK3
1584 background_combo_box_new (void)
1586 @@ -420,7 +364,6 @@ background_combo_box_new (void)
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..."));
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..."));
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)
1618 button = gtk_color_button_new_with_color (&gdkcolor);
1619 -#ifndef ENABLE_GTK3
1620 - gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
1623 g_signal_connect (button, "button-press-event", G_CALLBACK (cb_color_button_pressed), NULL);
1625 @@ -666,38 +592,16 @@ cb_color_button_pressed (GtkButton *button,
1629 -#ifndef ENABLE_GTK3
1630 -static UniqueResponse
1631 -cb_unique_app (UniqueApp *app,
1633 - UniqueMessageData *message_data,
1635 - gpointer user_data)
1637 - GtkWidget *dialog = user_data;
1638 - if (command != UNIQUE_ACTIVATE)
1640 - return UNIQUE_RESPONSE_PASSTHROUGH;
1642 - gtk_window_present (GTK_WINDOW (dialog));
1643 - return UNIQUE_RESPONSE_OK;
1647 gint main (gint argc,
1652 GtkApplication *app;
1653 GError *error = NULL;
1657 xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, NULL);
1659 gtk_init (&argc, &argv);
1662 app = gtk_application_new ("org.xfce.NotesSettings", 0);
1664 g_application_register (G_APPLICATION (app), NULL, &error);
1665 @@ -714,25 +618,10 @@ gint main (gint argc,
1666 g_object_unref (app);
1670 - app = unique_app_new ("org.xfce.NotesSettings", NULL);
1671 - if (unique_app_is_running (app))
1673 - if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK)
1675 - g_object_unref (app);
1681 dialog = prop_dialog_new ();
1684 g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), dialog);
1686 - g_signal_connect (app, "message-received", G_CALLBACK (cb_unique_app), dialog);
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;
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 ());
1710 - set_x_selection ();
1713 static Gtk.Menu build_context_menu () {
1714 @@ -58,18 +57,18 @@ static Gtk.Menu build_context_menu () {
1715 mi = new Gtk.SeparatorMenuItem ();
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 (); });
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 (); });
1728 mi = new Gtk.SeparatorMenuItem ();
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 () {
1740 -static bool set_x_selection () {
1742 - invisible = new Gtk.Invisible ();
1743 - if (!Xnp.Popup.set_x_selection (invisible)) {
1746 - invisible.client_event.connect ((w, event) => {
1747 - if (Xnp.Popup.get_message_from_event (event) == "SHOW_HIDE") {
1748 - application.show_hide_notes ();
1757 static int main (string[] args) {
1758 Gtk.init (ref args);
1760 Gtk.Application app = new Gtk.Application ("org.xfce.Notes", 0);
1763 @@ -118,21 +99,7 @@ static int main (string[] args) {
1764 app.activate.connect (() => {
1765 application.show_hide_notes ();
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) {
1775 - app.message_received.connect ((command, message_data, time_) => {
1776 - if (command != Unique.Command.ACTIVATE) {
1777 - return Unique.Response.PASSTHROUGH;
1779 - return Unique.Response.OK;
1783 GLib.Environment.set_application_name (_("Notes"));
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
1793 X-XFCE-Internal=FALSE
1795 diff --git a/src/main-popup.vala b/src/main-popup.vala
1796 new file mode 100644
1797 index 0000000..e52f7ac
1799 +++ b/src/main-popup.vala
1802 + * Notes - panel plugin for Xfce Desktop Environment
1803 + * Copyright (C) 2006-2013 Mike Massonnet <mmassonnet@xfce.org>
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.
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.
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
1820 +static int main (string[] args) {
1821 + Gtk.init (ref args);
1822 + var app = new GLib.Application ("org.xfce.Notes", 0);
1825 + } catch (GLib.Error e) {
1826 + warning ("Unable to register: %s", e.message);
1829 + if (!app.get_is_remote ()) {
1830 + // We are the primary instance, in that case start xfce4-notes
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);
1839 + // Send an activate signal which is used to show/hide the notes
1844 diff --git a/src/xfce-autostart.vapi b/src/xfce-autostart.vapi
1845 new file mode 100644
1846 index 0000000..87eb24c
1848 +++ b/src/xfce-autostart.vapi
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);