summaryrefslogtreecommitdiff
path: root/progress.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-16 19:54:43 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-16 19:54:43 +0200
commit41e7d953fc641c3285f09b07f2210c2895003040 (patch)
treeb8424fc1e6878434f8e9a20dcfd219144491af1b /progress.c
parent97da31bb0e0b426f06eb8ba4c35d60b11ceca24a (diff)
added playlist_add abortion and progress window wrapper
Diffstat (limited to 'progress.c')
-rw-r--r--progress.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/progress.c b/progress.c
new file mode 100644
index 00000000..4eed4f06
--- /dev/null
+++ b/progress.c
@@ -0,0 +1,79 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009 Alexey Yakovenko
+
+ 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 3 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 <http://www.gnu.org/licenses/>.
+*/
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include "interface.h"
+#include "callbacks.h"
+#include "support.h"
+#include "progress.h"
+
+static GtkWidget *progressdlg;
+static GtkWidget *progressitem;
+static int progress_aborted;
+
+void
+progress_init (void) {
+ extern GtkWidget *mainwin;
+ progressdlg = create_addprogress ();
+ gtk_window_set_transient_for (GTK_WINDOW (progressdlg), GTK_WINDOW (mainwin));
+ progressitem = lookup_widget (progressdlg, "progresstitle");
+}
+
+void
+progress_show (void) {
+ progress_aborted = 0;
+ progress_settext ("");
+ gtk_widget_show_all (progressdlg);
+ gtk_window_present (GTK_WINDOW (progressdlg));
+}
+
+void
+progress_hide (void) {
+ printf ("progress_hide\n");
+ gtk_widget_hide (progressdlg);
+}
+
+void
+progress_settext (const char *text) {
+ gtk_entry_set_text (GTK_ENTRY (progressitem), text);
+}
+
+void
+on_progress_abort (GtkButton *button,
+ gpointer user_data)
+{
+ progress_aborted = 1;
+}
+
+int
+progress_is_aborted (void) {
+ return progress_aborted;
+}
+
+
+gboolean
+on_addprogress_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ progress_aborted = 1;
+ return gtk_widget_hide_on_delete (widget);
+}