1 | /* rgfetchprogress.h |
---|
2 | * |
---|
3 | * Copyright (c) 2000, 2001 Conectiva S/A |
---|
4 | * |
---|
5 | * Author: Alfredo K. Kojima <kojima@conectiva.com.br> |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License as |
---|
9 | * published by the Free Software Foundation; either version 2 of the |
---|
10 | * License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
20 | * USA |
---|
21 | */ |
---|
22 | |
---|
23 | |
---|
24 | #ifndef _RGFETCHPROGRESS_H_ |
---|
25 | #define _RGFETCHPROGRESS_H_ |
---|
26 | |
---|
27 | #include <apt-pkg/acquire.h> |
---|
28 | |
---|
29 | #include <vector> |
---|
30 | #include <set> |
---|
31 | #include "rggladewindow.h" |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | class RGFetchProgress : public pkgAcquireStatus, public RGGladeWindow { |
---|
36 | |
---|
37 | struct Item { |
---|
38 | string descr; |
---|
39 | string uri; |
---|
40 | string size; |
---|
41 | int status; |
---|
42 | }; |
---|
43 | |
---|
44 | vector<Item> _items; |
---|
45 | |
---|
46 | GtkWidget *_table; |
---|
47 | GtkListStore *_tableListStore; |
---|
48 | set<int> _tableRows; |
---|
49 | |
---|
50 | GtkWidget *_mainProgressBar; // GtkProgressBar |
---|
51 | |
---|
52 | GtkWidget *_sock; |
---|
53 | |
---|
54 | PangoLayout *_layout; |
---|
55 | GtkTreeViewColumn *_statusColumn; |
---|
56 | GtkCellRenderer *_statusRenderer; |
---|
57 | bool _cancelled; |
---|
58 | |
---|
59 | void updateStatus(pkgAcquire::ItemDesc & Itm, int status); |
---|
60 | static void stopDownload(GtkWidget *self, void *data); |
---|
61 | |
---|
62 | static void cursorChanged(GtkTreeView *treeview, |
---|
63 | gpointer user_data); |
---|
64 | static void expanderActivate(GObject *object, |
---|
65 | GParamSpec *param_spec, |
---|
66 | gpointer user_data); |
---|
67 | bool _cursorDirty; |
---|
68 | |
---|
69 | void refreshTable(int row, bool append = false); |
---|
70 | GdkPixmap *statusDraw(int width, int height, int status); |
---|
71 | GdkGC *_barGC; |
---|
72 | GdkGC *_gc; |
---|
73 | GdkGC *_textGC; |
---|
74 | PangoFontDescription *_font; |
---|
75 | |
---|
76 | public: |
---|
77 | virtual bool MediaChange(string Media, string Drive); |
---|
78 | virtual void IMSHit(pkgAcquire::ItemDesc &Itm); |
---|
79 | virtual void Fetch(pkgAcquire::ItemDesc &Itm); |
---|
80 | virtual void Done(pkgAcquire::ItemDesc &Itm); |
---|
81 | virtual void Fail(pkgAcquire::ItemDesc &Itm); |
---|
82 | virtual void Start(); |
---|
83 | virtual void Stop(); |
---|
84 | virtual bool close(); |
---|
85 | |
---|
86 | bool Pulse(pkgAcquire * Owner); |
---|
87 | |
---|
88 | // set description of the current task (main and additonal explaination) |
---|
89 | void setDescription(string mainText, string secondText=""); |
---|
90 | |
---|
91 | |
---|
92 | RGFetchProgress(RGWindow *win); |
---|
93 | }; |
---|
94 | |
---|
95 | #endif |
---|