1 | /* rgconfigwindow.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 | #include "rggladewindow.h" |
---|
24 | #include "rgmainwindow.h" |
---|
25 | |
---|
26 | class RGPreferencesWindow:public RGGladeWindow { |
---|
27 | bool _blockAction; |
---|
28 | |
---|
29 | enum {TREE_CHECKBOX_COLUMN, TREE_VISIBLE_NAME_COLUMN, TREE_NAME_COLUMN}; |
---|
30 | |
---|
31 | struct column_struct { |
---|
32 | gboolean visible; |
---|
33 | const char *name; |
---|
34 | const char *visible_name; |
---|
35 | }; |
---|
36 | |
---|
37 | // the names for the VisibleColumnsTreeView |
---|
38 | static const char *column_names[]; |
---|
39 | static const char *column_visible_names[]; |
---|
40 | static const gboolean column_visible_defaults[]; |
---|
41 | |
---|
42 | RGMainWindow *_mainWin; |
---|
43 | RPackageLister *_lister; |
---|
44 | // option buttons |
---|
45 | GtkWidget *_optionShowAllPkgInfoInMain; |
---|
46 | GtkWidget *_optionUseStatusColors; |
---|
47 | GtkWidget *_optionAskRelated; |
---|
48 | GtkWidget *_optionUseTerminal; |
---|
49 | GtkWidget *_optionCheckRecom; |
---|
50 | GtkWidget *_optionAskQuit; |
---|
51 | GtkWidget *_optionOneClick; |
---|
52 | |
---|
53 | // cache settings |
---|
54 | GtkWidget *_cacheLeave; |
---|
55 | GtkWidget *_cacheClean; |
---|
56 | GtkWidget *_cacheAutoClean; |
---|
57 | |
---|
58 | GtkWidget *_delHistory; |
---|
59 | GtkWidget *_keepHistory; |
---|
60 | GtkWidget *_spinDelHistory; |
---|
61 | |
---|
62 | GtkWidget *_pathT; |
---|
63 | GtkWidget *_sizeT; |
---|
64 | GtkWidget *_maxUndoE; |
---|
65 | GtkWidget *_optionmenuDel; |
---|
66 | GtkWidget *_useProxy; |
---|
67 | |
---|
68 | // policy settings |
---|
69 | GtkWidget *_comboDefaultDistro; |
---|
70 | string _defaultDistro; |
---|
71 | |
---|
72 | bool _dirty; |
---|
73 | |
---|
74 | int columnPos[6]; |
---|
75 | |
---|
76 | // distro selection |
---|
77 | static void cbArchiveSelection(GtkWidget *self, void *data); |
---|
78 | static void cbRadioDistributionChanged(GtkWidget *self, void *data); |
---|
79 | bool distroChanged; |
---|
80 | |
---|
81 | // treeview stuff |
---|
82 | void readTreeViewValues(); |
---|
83 | GtkListStore *_listColumns; |
---|
84 | GtkWidget *_treeView; |
---|
85 | static void cbMoveColumnUp(GtkWidget *self, void *data); |
---|
86 | static void cbMoveColumnDown(GtkWidget *self, void *data); |
---|
87 | static void cbToggleColumn(GtkWidget *self, char *path, void *data); |
---|
88 | |
---|
89 | // callbacks |
---|
90 | static void changeFontAction(GtkWidget *self, void *data); |
---|
91 | static void checkbuttonUserFontToggled(GtkWidget *self, void *data); |
---|
92 | static void checkbuttonUserTerminalFontToggled(GtkWidget *self, |
---|
93 | void *data); |
---|
94 | |
---|
95 | static void saveAction(GtkWidget *self, void *data); |
---|
96 | void saveGeneral(); |
---|
97 | void saveColumnsAndFonts(); |
---|
98 | void saveColors(); |
---|
99 | void saveFiles(); |
---|
100 | void saveNetwork(); |
---|
101 | void saveDistribution(); |
---|
102 | |
---|
103 | void readGeneral(); |
---|
104 | void readColumnsAndFonts(); |
---|
105 | void readColors(); |
---|
106 | void readFiles(); |
---|
107 | void readNetwork(); |
---|
108 | void readDistribution(); |
---|
109 | |
---|
110 | |
---|
111 | static void closeAction(GtkWidget *self, void *data); |
---|
112 | static void doneAction(GtkWidget *self, void *data); |
---|
113 | static void clearCacheAction(GtkWidget *self, void *data); |
---|
114 | |
---|
115 | static void colorClicked(GtkWidget *self, void *data); |
---|
116 | |
---|
117 | static void useProxyToggled(GtkWidget *self, void *data); |
---|
118 | |
---|
119 | public: |
---|
120 | RGPreferencesWindow(RGWindow *owner, RPackageLister *lister); |
---|
121 | virtual ~RGPreferencesWindow() {}; |
---|
122 | virtual void show(); |
---|
123 | |
---|
124 | // call this to set the proxy stuff for apt |
---|
125 | static void applyProxySettings(); |
---|
126 | }; |
---|