[tepl] close-confirm-dialog-single: skeleton
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] close-confirm-dialog-single: skeleton
- Date: Sat, 25 Nov 2017 13:23:33 +0000 (UTC)
commit c54cf7782e548c3b311dbdfb311cffd53bf9b754
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Nov 25 05:09:16 2017 +0100
close-confirm-dialog-single: skeleton
docs/reference/Makefile.am | 1 +
po/POTFILES.in | 1 +
tepl/Makefile.am | 2 +
tepl/tepl-close-confirm-dialog-single.c | 49 +++++++++++++++++++++++++++++++
tepl/tepl-close-confirm-dialog-single.h | 37 +++++++++++++++++++++++
5 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 4787497..35780a5 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -27,6 +27,7 @@ IGNORE_HFILES = \
amtk.h \
tepl.h \
tepl-buffer-input-stream.h \
+ tepl-close-confirm-dialog-single.h \
tepl-encoding-converter.h \
tepl-encoding-private.h \
tepl-file-content.h \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5a0b12e..9725967 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,6 +15,7 @@ tepl/tepl-application.c
tepl/tepl-application-window.c
tepl/tepl-buffer.c
tepl/tepl-buffer-input-stream.c
+tepl/tepl-close-confirm-dialog-single.c
tepl/tepl-encoding.c
tepl/tepl-encoding-converter.c
tepl/tepl-file.c
diff --git a/tepl/Makefile.am b/tepl/Makefile.am
index ec6a810..1e69d83 100644
--- a/tepl/Makefile.am
+++ b/tepl/Makefile.am
@@ -64,6 +64,7 @@ tepl_public_c_files = \
tepl_private_headers = \
tepl-buffer-input-stream.h \
+ tepl-close-confirm-dialog-single.h \
tepl-encoding-converter.h \
tepl-encoding-private.h \
tepl-file-content.h \
@@ -75,6 +76,7 @@ tepl_private_headers = \
tepl_private_c_files = \
tepl-buffer-input-stream.c \
+ tepl-close-confirm-dialog-single.c \
tepl-encoding-converter.c \
tepl-file-content.c \
tepl-file-content-loader.c \
diff --git a/tepl/tepl-close-confirm-dialog-single.c b/tepl/tepl-close-confirm-dialog-single.c
new file mode 100644
index 0000000..797743d
--- /dev/null
+++ b/tepl/tepl-close-confirm-dialog-single.c
@@ -0,0 +1,49 @@
+/*
+ * This file is part of Tepl, a text editor library.
+ *
+ * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Tepl is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Tepl 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tepl-close-confirm-dialog-single.h"
+#include "tepl-tab.h"
+
+/* When closing a TeplTab, show a message dialog if the buffer is modified. */
+
+void
+_tepl_close_confirm_dialog_single_async (TeplTab *tab,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GTask *task;
+
+ g_return_if_fail (TEPL_IS_TAB (tab));
+
+ task = g_task_new (tab, NULL, callback, user_data);
+
+ g_task_return_boolean (task, FALSE);
+ g_object_unref (task);
+}
+
+/* Returns: %TRUE if @tab can be closed, %FALSE otherwise. */
+gboolean
+_tepl_close_confirm_dialog_single_finish (TeplTab *tab,
+ GAsyncResult *result)
+{
+ g_return_val_if_fail (TEPL_IS_TAB (tab), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, tab), FALSE);
+
+ return g_task_propagate_boolean (G_TASK (result), NULL);
+}
diff --git a/tepl/tepl-close-confirm-dialog-single.h b/tepl/tepl-close-confirm-dialog-single.h
new file mode 100644
index 0000000..4d332ce
--- /dev/null
+++ b/tepl/tepl-close-confirm-dialog-single.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Tepl, a text editor library.
+ *
+ * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Tepl is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Tepl 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H
+#define TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H
+
+#include <gtk/gtk.h>
+#include "tepl-types.h"
+
+G_BEGIN_DECLS
+
+void _tepl_close_confirm_dialog_single_async (TeplTab *tab,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean _tepl_close_confirm_dialog_single_finish (TeplTab *tab,
+ GAsyncResult *result);
+
+G_END_DECLS
+
+#endif /* TEPL_CLOSE_CONFIRM_DIALOG_SINGLE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]