diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index bfd964e..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "libgd"]
- path = libgd
- url = git://git.gnome.org/libgd
diff --git a/Makefile.am b/Makefile.am
index 2b60687..e14176e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,10 +1,10 @@
ACLOCAL_AMFLAGS = -I m4 -I libgd ${ACLOCAL_FLAGS}
NULL=
-SUBDIRS = libgd vapi src data po
+SUBDIRS = vapi src data po
if BUILD_MAN_PAGES
SUBDIRS += man
endif
-DIST_SUBDIRS = libgd vapi src data po man
+DIST_SUBDIRS = vapi src data po man
EXTRA_DIST = \
autogen.sh \
diff --git a/configure.ac b/configure.ac
index 6f2c039..ca85748 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,6 @@ AS_IF([test "x$enable_man_pages" != "xno"],
AM_CONDITIONAL([BUILD_MAN_PAGES], [test "x$have_manutils" = "xyes"])
AC_CONFIG_FILES([Makefile
- libgd/Makefile
vapi/Makefile
src/Makefile
man/Makefile
@@ -108,12 +107,4 @@ AC_CONFIG_FILES([Makefile
po/Makefile.in
])
-dnl libgd
-LIBGD_INIT([
- gtk-hacks
- notification
- static
- vapi
-])
-
AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
index 5e13654..0f52d3d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -36,8 +36,9 @@ EXTRA_DIST = \
contacts.gresource.xml \
ui/app-menu.ui \
ui/contacts-address-map.ui \
- ui/contacts-window.ui \
+ ui/contacts-in-app-notification.ui \
ui/contacts-list-pane.ui \
+ ui/contacts-window.ui \
ui/style.css \
$(NULL)
diff --git a/data/contacts.gresource.xml b/data/contacts.gresource.xml
index 98bfee4..9f29f00 100644
--- a/data/contacts.gresource.xml
+++ b/data/contacts.gresource.xml
@@ -4,7 +4,8 @@
ui/style.css
ui/app-menu.ui
ui/contacts-address-map.ui
- ui/contacts-window.ui
+ ui/contacts-in-app-notification.ui
ui/contacts-list-pane.ui
+ ui/contacts-window.ui
diff --git a/data/ui/contacts-in-app-notification.ui b/data/ui/contacts-in-app-notification.ui
new file mode 100644
index 0000000..76d71fe
--- /dev/null
+++ b/data/ui/contacts-in-app-notification.ui
@@ -0,0 +1,49 @@
+
+
+
+
+ True
+ center
+ start
+
+
+
+
+
diff --git a/libgd b/libgd
deleted file mode 160000
index 7f08098..0000000
--- a/libgd
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 7f080984bf6a92212def9fb8aa0f6c0f9979b57e
diff --git a/src/Makefile.am b/src/Makefile.am
index 642977e..637052f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,6 @@ NULL =
AM_CPPFLAGS = \
-include config.h \
$(CONTACTS_CFLAGS) \
- -I$(top_srcdir)/libgd \
-DLOCALEDIR=\""$(localedir)"\" \
-DPKGDATADIR=\""$(pkgdatadir)"\" \
-DPKGLIBDIR=\""$(pkglibdir)"\" \
@@ -11,7 +10,7 @@ AM_CPPFLAGS = \
$(NULL)
AM_VALAFLAGS = \
- --vapidir=../vapi --vapidir=../libgd --pkg config --pkg custom --pkg gd-1.0 \
+ --vapidir=../vapi --pkg config --pkg custom \
@CONTACTS_PACKAGES@ \
--target-glib=2.38 --gresources=$(top_srcdir)/data/contacts.gresource.xml \
$(NULL)
@@ -31,6 +30,7 @@ vala_sources = \
contacts-contact-editor.vala \
contacts-contact-pane.vala \
contacts-types.vala \
+ contacts-in-app-notification.vala \
contacts-list-pane.vala \
contacts-linked-accounts-dialog.vala \
contacts-linking.vala \
@@ -63,7 +63,7 @@ gnome_contacts_SOURCES = \
contacts-esd-setup.c \
$(NULL)
-gnome_contacts_LDADD = $(CONTACTS_LIBS) -lm $(top_builddir)/libgd/libgd.la
+gnome_contacts_LDADD = $(CONTACTS_LIBS) -lm
if BUILD_CHEESE
gnome_contacts_LDADD += $(CHEESE_LIBS)
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 89919a4..c5213b0 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -285,17 +285,8 @@ public class Contacts.App : Gtk.Application {
}
public void show_message (string message) {
- var notification = new Gd.Notification ();
- notification.timeout = 5;
-
- var g = new Grid ();
- g.set_column_spacing (8);
- var l = new Label (message);
- l.set_line_wrap (true);
- l.set_line_wrap_mode (Pango.WrapMode.WORD_CHAR);
- notification.add (l);
-
- notification.show_all ();
+ var notification = new InAppNotification (message);
+ notification.show ();
window.add_notification (notification);
}
diff --git a/src/contacts-in-app-notification.vala b/src/contacts-in-app-notification.vala
new file mode 100644
index 0000000..b3f9aea
--- /dev/null
+++ b/src/contacts-in-app-notification.vala
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 Niels De Graef
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+using Gtk;
+
+[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-in-app-notification.ui")]
+public class Contacts.InAppNotification : Revealer {
+ // Close the in-app notification after 5 seconds by default.
+ private const uint DEFAULT_KEEPALIVE = 5;
+
+ [GtkChild]
+ private Grid grid;
+
+ [GtkChild]
+ private Label label;
+ public Label message_label {
+ get { return this.label; }
+ }
+
+ /**
+ * Fired when the notification is completely dismissed (i.e. gone).
+ */
+ public signal void dismissed ();
+
+ /**
+ * Creates an in-app notification with the given message, and an accompanying button if not null.
+ */
+ public InAppNotification (string message, Button? button = null) {
+ this.label.label = message;
+
+ if (button != null) {
+ this.grid.attach (button, 1, 0);
+ button.show();
+ }
+
+ this.notify["child-revealed"].connect (on_child_revealed_changed);
+ }
+
+ public new void show () {
+ base.show ();
+ this.reveal_child = true;
+
+ Timeout.add_seconds (DEFAULT_KEEPALIVE, () => {
+ dismiss ();
+ return false;
+ });
+ }
+
+ public void dismiss () {
+ this.reveal_child = false;
+ }
+
+ private void on_child_revealed_changed (Object o, ParamSpec p) {
+ if (!this.child_revealed) {
+ dismissed ();
+ destroy ();
+ }
+ }
+
+ [GtkCallback]
+ private void on_close_button_clicked(Button close_button) {
+ dismiss();
+ }
+}
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 085da1a..0b6d89f 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -282,8 +282,9 @@ public class Contacts.Window : Gtk.ApplicationWindow {
}
}
- public void add_notification (Widget notification) {
- overlay.add_overlay (notification);
+ public void add_notification (InAppNotification notification) {
+ this.overlay.add_overlay (notification);
+ notification.show ();
}
public void set_shown_contact (Contact? c) {
@@ -401,31 +402,21 @@ public class Contacts.Window : Gtk.ApplicationWindow {
operation = link_contacts_list.end (result);
});
- var notification = new Gd.Notification ();
- notification.timeout = 5;
-
- var g = new Grid ();
- g.set_column_spacing (8);
- notification.add (g);
-
string msg = ngettext ("%d contacts linked",
"%d contacts linked",
contact_list.size).printf (contact_list.size);
var b = new Button.with_mnemonic (_("_Undo"));
- g.add (new Label (msg));
- g.add (b);
-
- notification.show_all ();
- add_notification (notification);
+ var notification = new InAppNotification (msg);
/* signal handlers */
b.clicked.connect ( () => {
/* here, we will unlink the thing in question */
operation.undo.begin ();
-
notification.dismiss ();
});
+
+ add_notification (notification);
}
void list_pane_delete_contacts_cb (LinkedList contact_list) {
@@ -433,89 +424,68 @@ public class Contacts.Window : Gtk.ApplicationWindow {
set_shown_contact (null);
select_button.set_active (false);
- var notification = new Gd.Notification ();
- notification.timeout = 5;
-
- var g = new Grid ();
- g.set_column_spacing (8);
- notification.add (g);
-
string msg = ngettext ("%d contact deleted",
"%d contacts deleted",
contact_list.size).printf (contact_list.size);
var b = new Button.with_mnemonic (_("_Undo"));
- g.add (new Label (msg));
- g.add (b);
- notification.show_all ();
- add_notification (notification);
+ var notification = new InAppNotification (msg, b);
/* signal handlers */
bool really_delete = true;
- notification.dismissed.connect ( () => {
- if (really_delete) {
- foreach (var c in contact_list) {
- c.remove_personas.begin ();
- }
- }
- });
b.clicked.connect ( () => {
really_delete = false;
notification.dismiss ();
+ });
+ notification.dismissed.connect ( () => {
+ if (really_delete)
+ foreach (var c in contact_list)
+ c.remove_personas.begin ();
+ });
+
+ add_notification (notification);
+
foreach (var c in contact_list) {
c.show ();
}
set_shown_contact (contact_list.last ());
- });
}
[GtkCallback]
void contact_pane_delete_contact_cb (Contact contact) {
/* unsetting edit-mode */
set_shown_contact (null);
- select_button.set_active (false);
+ this.select_button.active = false;
- var notification = new Gd.Notification ();
- notification.timeout = 5;
-
- var g = new Grid ();
- g.set_column_spacing (8);
- notification.add (g);
-
- var label = new Label (_("Contact deleted: ā%sā").printf (contact.display_name));
- label.set_max_width_chars (45);
- label.set_ellipsize (Pango.EllipsizeMode.END);
+ // XXX
+ var msg = _("Contact deleted: ā%sā").printf (contact.display_name);
var b = new Button.with_mnemonic (_("_Undo"));
- g.add (label);
- g.add (b);
+
+ var notification = new InAppNotification (msg, b);
+ // Don't wrap (default), but ellipsize
+ notification.message_label.wrap = false;
+ notification.message_label.max_width_chars = 45;
+ notification.message_label.ellipsize = Pango.EllipsizeMode.END;
bool really_delete = true;
- notification.show_all ();
notification.dismissed.connect ( () => {
if (really_delete)
contact.remove_personas.begin ( () => {
contact.show ();
});
});
+ add_notification (notification);
b.clicked.connect ( () => {
really_delete = false;
notification.dismiss ();
contact.show ();
set_shown_contact (contact);
});
- add_notification (notification);
}
[GtkCallback]
void contact_pane_contacts_linked_cb (string? main_contact, string linked_contact, LinkOperation operation) {
- var notification = new Gd.Notification ();
- notification.timeout = 5;
-
- var g = new Grid ();
- g.set_column_spacing (8);
- notification.add (g);
-
string msg;
if (main_contact != null)
msg = _("%s linked to %s").printf (main_contact, linked_contact);
@@ -523,14 +493,13 @@ public class Contacts.Window : Gtk.ApplicationWindow {
msg = _("%s linked to the contact").printf (linked_contact);
var b = new Button.with_mnemonic (_("_Undo"));
- g.add (new Label (msg));
- g.add (b);
+ var notification = new InAppNotification (msg, b);
- notification.show_all ();
b.clicked.connect ( () => {
- notification.dismiss ();
- operation.undo.begin ();
+ notification.dismiss ();
+ operation.undo.begin ();
});
+
add_notification (notification);
}
}