1 | /* rgmisc.h |
---|
2 | * |
---|
3 | * Copyright (c) 2003 Michael Vogt |
---|
4 | * |
---|
5 | * Author: Michael Vogt <mvo@debian.org> |
---|
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 | #ifndef _RGMISC_H_ |
---|
24 | #define _RGMISC_H_ |
---|
25 | |
---|
26 | #include <apt-pkg/configuration.h> |
---|
27 | #include "rpackage.h" |
---|
28 | |
---|
29 | enum { |
---|
30 | PIXMAP_COLUMN, |
---|
31 | SUPPORTED_COLUMN, |
---|
32 | NAME_COLUMN, |
---|
33 | COMPONENT_COLUMN, |
---|
34 | SECTION_COLUMN, |
---|
35 | PKG_SIZE_COLUMN, |
---|
36 | PKG_DOWNLOAD_SIZE_COLUMN, |
---|
37 | INSTALLED_VERSION_COLUMN, |
---|
38 | AVAILABLE_VERSION_COLUMN, |
---|
39 | DESCR_COLUMN, |
---|
40 | COLOR_COLUMN, |
---|
41 | PKG_COLUMN, |
---|
42 | N_COLUMNS |
---|
43 | }; |
---|
44 | |
---|
45 | void RGFlushInterface(); |
---|
46 | |
---|
47 | bool is_binary_in_path(const char *program); |
---|
48 | |
---|
49 | char *gtk_get_string_from_color(GdkColor * colp); |
---|
50 | void gtk_get_color_from_string(const char *cpp, GdkColor ** colp); |
---|
51 | |
---|
52 | const char *utf8_to_locale(const char *str); |
---|
53 | const char *utf8(const char *str); |
---|
54 | |
---|
55 | GtkWidget *get_gtk_image(const char *name); |
---|
56 | |
---|
57 | string SizeToStr(double Bytes); |
---|
58 | |
---|
59 | class RGPackageStatus : public RPackageStatus { |
---|
60 | protected: |
---|
61 | GdkPixbuf *StatusPixbuf[N_STATUS_COUNT]; |
---|
62 | GdkColor *StatusColors[N_STATUS_COUNT]; |
---|
63 | |
---|
64 | GdkPixbuf *supportedPix; |
---|
65 | |
---|
66 | void initColors(); |
---|
67 | void initPixbufs(); |
---|
68 | |
---|
69 | public: |
---|
70 | // this static object is used for all access |
---|
71 | static RGPackageStatus pkgStatus; |
---|
72 | |
---|
73 | virtual void init(); |
---|
74 | |
---|
75 | // this is what the package listers use |
---|
76 | GdkColor *getBgColor(RPackage *pkg); |
---|
77 | GdkPixbuf *getSupportedPix(RPackage *pkg); |
---|
78 | GdkPixbuf *getPixbuf(RPackage *pkg); |
---|
79 | GdkPixbuf *getPixbuf(int i) { |
---|
80 | return StatusPixbuf[i]; |
---|
81 | } |
---|
82 | |
---|
83 | // this is for the configuration of the colors |
---|
84 | void setColor(int i, GdkColor * new_color); |
---|
85 | GdkColor *getColor(int i) { |
---|
86 | return StatusColors[i]; |
---|
87 | }; |
---|
88 | // save color configuration to disk |
---|
89 | void saveColors(); |
---|
90 | }; |
---|
91 | |
---|
92 | #endif |
---|