2009-12-03 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / src / pipeline-ui.h
blob8f4773e7a76c75933a8d81829a9ec7e9ee64109d
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * pipeline-ui.h:
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
13 #ifndef __MOON_PIPELINE_UI_H__
14 #define __MOON_PIPELINE_UI_H__
16 #include <gtk/gtkwidget.h>
17 #include <gtk/gtk.h>
18 #include <glib.h>
20 #include "downloader.h"
21 #include "runtime.h"
22 #include "moonlightconfiguration.h"
24 class CodecDownloader : public EventObject {
25 private:
26 static bool running; // If there already is another CodecDownloader running
27 Surface *surface;
28 bool is_user_initiated;
29 // 0: initial, waiting for user input
30 // 1: install clicked, downloading eula
31 // 2: eula downloaded, waiting for user input
32 // 3: accept clicked, downloading codec
33 // 4: codecs downloaded
34 // 5: user clicked don't install (or that value was read from the configuration)
35 // 6: something went wrong (download failed for instance)
36 int state;
37 char *eula;
38 Downloader *dl;
39 MoonlightConfiguration configuration;
41 GtkWidget *dialog;
42 GtkWidget *vbox;
43 GtkWidget *header_label;
44 GtkWidget *message_label;
45 GtkWidget *progress_bar;
46 GtkWidget *eula_scrollwindow;
47 GtkWidget *eula_view;
48 GtkWidget *eula_evtbox;
49 GtkWidget *accept_button;
50 GtkWidget *cancel_button;
51 GtkWidget *icon;
52 GtkWidget *dont_ask;
54 static void ResponseEventHandler (GtkDialog *dialog, gint response, gpointer data);
55 void ResponseEvent (GtkDialog *dialog, GtkResponseType response);
57 static void DownloadProgressChangedHandler (EventObject *sender, EventArgs *args, gpointer closure);
58 static void DownloadCompletedHandler (EventObject *sender, EventArgs *args, gpointer closure);
59 static void DownloadFailedHandler (EventObject *sender, EventArgs *args, gpointer closure);
61 void DownloadProgressChanged (EventObject *sender, EventArgs *args);
62 void DownloadCompleted (EventObject *sender, EventArgs *args);
63 void DownloadFailed (EventObject *sender, EventArgs *args);
65 void CreateDownloader ();
66 void DestroyDownloader ();
68 void ToggleEula (bool show);
69 void ToggleProgress (bool show);
70 void SetHeader (const gchar *message);
71 void SetMessage (const gchar *message);
72 void HideMessage ();
73 void AdaptToParentWindow ();
75 void AcceptClicked ();
76 void Close (); // Closes the window and unrefs ourself
77 void Show ();// Shows the codec installation ui and refs ourself
79 bool VerifyDownload (const char *filename);
81 CodecDownloader (Surface *surface, bool is_user_initiated);
82 virtual ~CodecDownloader ();
85 public:
86 static void ShowUI (Surface *surface, bool is_user_initiated);
89 #endif /* __MOON_PIPELINE_UI_H__ */