gpet(Gui Policy Editor for TOMOYO Linux) repository
Revision | 8def10aec6e5991eefcf7156cddab7b1773e8164 (tree) |
---|---|
Zeit | 2011-08-21 00:31:48 |
Autor | yocto <yocto@user...> |
Commiter | yocto |
Ver. 0.3
@@ -1,3 +1,34 @@ | ||
1 | +2011/06/18 yocto <yocto@users.sourceforge.jp> | |
2 | + | |
3 | + 0.3 Released | |
4 | + | |
5 | + * Enter key is enabled in the dialog box | |
6 | + Domain window: profile list dialog | |
7 | + Profile window: profile edit dialog | |
8 | + Domain, ACL, Exception, Profile, Manager window: add dialog | |
9 | + | |
10 | + * Search dialog enhancement | |
11 | + Match case | |
12 | + Wrap around | |
13 | + Close dialog | |
14 | + | |
15 | + * Path name displayed as it is. | |
16 | + Domain, ACL, Exception window: display, search, add | |
17 | + The command name of the Process window is still octal. | |
18 | + When space and multi byte character, etc. are included in the path name | |
19 | + input by an additional dialog, it encloses it with single quotation [']. | |
20 | + Single quotes in the path name ['] may contain escaped with a backslash | |
21 | + [\'] should be. | |
22 | + | |
23 | + * Statistics window display was changed to display the local date and time. | |
24 | + | |
25 | + * Added support for copy of the cursor line.(Profile window) | |
26 | + | |
27 | + * Added a toolbar to the Manager window. | |
28 | + | |
29 | + * Added a toolbar and Apply button to the Statistics window. | |
30 | + | |
31 | + | |
1 | 32 | 2011/04/25 yocto <yocto@users.sourceforge.jp> |
2 | 33 | |
3 | 34 | 0.2.1 Update |
@@ -28,14 +59,14 @@ | ||
28 | 59 | * Added support for Extraction of redundant ACL entries. |
29 | 60 | Ctrl+O |
30 | 61 | |
31 | - * Added support for copy of the cursor line.(domain、ACL、exception) | |
62 | + * Added support for copy of the cursor line.(Domain, ACL, Exception window) | |
32 | 63 | Ctrl+C |
33 | 64 | |
34 | 65 | * Added support for search dialog. |
35 | 66 | |
36 | 67 | |
37 | 68 | |
38 | -2011/04/23 yocto <yocto@users.sourceforge.jp> | |
69 | +2010/12/18 yocto <yocto@users.sourceforge.jp> | |
39 | 70 | |
40 | 71 | 0.1 Released |
41 | 72 |
@@ -0,0 +1,77 @@ | ||
1 | +2011/06/18 yocto <yocto@users.sourceforge.jp> | |
2 | + | |
3 | + 0.3 Released | |
4 | + | |
5 | + * ダイアログでのenter key有効化 | |
6 | + domainウィンドウ:プロファイル設定ダイアログ | |
7 | + profileウィンドウ:プロファイル変更ダイアログ | |
8 | + domain, ACL, exception, profile, managerウィンドウ:追加ダイアログ | |
9 | + | |
10 | + * 検索ダイアログに機能追加 | |
11 | + 大文字と小文字を区別する (M)atch case | |
12 | + 折返しも対象にする (W)rap around | |
13 | + enterで閉じる Close (d)ialog | |
14 | + | |
15 | + * パス名の漢字等をそのまま表示 | |
16 | + domain, ACL, exceptionウィンドウの表示、検索、追加で有効 | |
17 | + processウィンドウのコマンド名は8進表記のまま | |
18 | + 追加ダイアログで入力するパス名にスペースや漢字等が含まれる場合は | |
19 | + シングルクォーテーション[']で囲む | |
20 | + パス名に[']が含まれる場合は\エスケープ[\']する | |
21 | + | |
22 | + * Statisticsの日時をローカルタイム表示に変更 | |
23 | + | |
24 | + * カーソル行データコピーを追加:profile | |
25 | + | |
26 | + * managerウィンドウにツールバーを追加 | |
27 | + | |
28 | + * Statisticsウィンドウにツールバー、適用ボタンを追加 | |
29 | + | |
30 | + | |
31 | +2011/04/25 yocto <yocto@users.sourceforge.jp> | |
32 | + | |
33 | + 0.2.1 Update | |
34 | + | |
35 | + * ドキュメントのインストールディレクトリを | |
36 | + 「/usr/doc/gpet/」から「/usr/share/doc/gpet/」に修正 | |
37 | + | |
38 | + | |
39 | +2011/04/23 yocto <yocto@users.sourceforge.jp> | |
40 | + | |
41 | + 0.2 Released | |
42 | + | |
43 | + * ベースとなるccs-editpolicyをccstools 1.8.1 20110401版 に変更 | |
44 | + | |
45 | + * ACLウィンドウの切離し機能を追加 | |
46 | + メニュー > 表示 > ACLウィンドウ切離し | |
47 | + | |
48 | + * メニューの memory usage を Statistics に変更 | |
49 | + ショーカットキー Ctrl+U を Ctrl+S に変更 | |
50 | + | |
51 | + * オフラインモードとネットワークモードに対応 | |
52 | + 現状はccs-editpolicy同様、起動引数で指定です。 | |
53 | + | |
54 | + * フォント及び色のリソースファイルに対応 gpetrc.sample 追加 | |
55 | + 下記のようにコピーして中身を変更してください | |
56 | + cp /usr/share/doc/gpetrc.sample ~/.gpetrc | |
57 | + | |
58 | + * プロセスモードのショーカットキーを Ctrl+O から Ctrl+@ に変更 | |
59 | + | |
60 | + * ACLの冗長エントリ抽出(パターン化支援)機能を追加 | |
61 | + ショーカットキー Ctrl+O | |
62 | + | |
63 | + * ウィンドウキャプションにモード表示を追加 | |
64 | + | |
65 | + * エントリ追加時にカーソルを追加項目に移動するように変更 | |
66 | + | |
67 | + * カーソル行データコピー domain、ACL、exception | |
68 | + コピー時にクリップボード(OSバッファ)にもコピーする | |
69 | + | |
70 | + * ダイアログ検索を追加 domain、ACL、exception、profile | |
71 | + | |
72 | + | |
73 | +2010/12/18 yocto <yocto@users.sourceforge.jp> | |
74 | + | |
75 | + 0.1 Released | |
76 | + | |
77 | + * 初期リリース |
@@ -1,4 +1,4 @@ | ||
1 | -gpet 0.2.1 2011-04-25 | |
1 | +gpet 0.3 2011-06-18 | |
2 | 2 | |
3 | 3 | gpet (Gui Policy Editor for TOMOYO Linux) |
4 | 4 | Build / Install / Run / Uninstall |
@@ -8,9 +8,9 @@ $ sudo apt-get install gcc make libncurses-dev | ||
8 | 8 | |
9 | 9 | $ sudo apt-get install intltool libgtk2.0-dev libgconf2-dev |
10 | 10 | |
11 | -$ tar xjvf gpet-0.2.1.tar.bz2 | |
11 | +$ tar xjvf gpet-0.3.tar.bz2 | |
12 | 12 | |
13 | -$ cd gpet-0.2.1 | |
13 | +$ cd gpet-0.3 | |
14 | 14 | $ ./configure --prefix /usr |
15 | 15 | |
16 | 16 | $ make |
@@ -37,26 +37,26 @@ $ cp /usr/share/doc/gpet/gpetrc.sample ~/.gpetrc | ||
37 | 37 | |
38 | 38 | |
39 | 39 | *** Instll location *** |
40 | -/usr | |
41 | -├── doc | |
42 | -│ └── gpet | |
43 | -│ ├── AUTHORS | |
44 | -│ ├── COPYING | |
45 | -│ ├── ChangeLog | |
46 | -│ ├── INSTALL | |
47 | -│ ├── NEWS | |
48 | -│ ├── README | |
49 | -│ └── gpetrc.sample | |
50 | -├── sbin | |
51 | -│ └── gpet | |
52 | -└── share | |
53 | - ├── gpet | |
54 | - │ └── pixmaps | |
55 | - │ └── tomoyo.png | |
56 | - └── locale | |
57 | - └── ja | |
58 | - └── LC_MESSAGES | |
59 | - └── gpet.mo | |
40 | +|-- sbin | |
41 | +| `-- gpet | |
42 | +`-- share | |
43 | + |-- doc | |
44 | + | `-- gpet | |
45 | + | |-- AUTHORS | |
46 | + | |-- COPYING | |
47 | + | |-- ChangeLog | |
48 | + | |-- ChangeLog.ja | |
49 | + | |-- INSTALL | |
50 | + | |-- NEWS | |
51 | + | |-- README | |
52 | + | `-- gpetrc.sample | |
53 | + |-- gpet | |
54 | + | `-- pixmaps | |
55 | + | `-- tomoyo.png | |
56 | + `-- locale | |
57 | + `-- ja | |
58 | + `-- LC_MESSAGES | |
59 | + `-- gpet.mo | |
60 | 60 | |
61 | 61 | |
62 | 62 | *** Uninstall *** |
@@ -11,7 +11,7 @@ gpetdoc_DATA = \ | ||
11 | 11 | COPYING\ |
12 | 12 | AUTHORS\ |
13 | 13 | ChangeLog\ |
14 | - ChangeLog.jp\ | |
14 | + ChangeLog.ja\ | |
15 | 15 | INSTALL\ |
16 | 16 | NEWS\ |
17 | 17 | gpetrc.sample |
@@ -1,7 +1,7 @@ | ||
1 | 1 | dnl Process this file with autoconf to produce a configure script. |
2 | 2 | dnl Created by Anjuta application wizard. |
3 | 3 | |
4 | -AC_INIT(gpet, 0.2.1) | |
4 | +AC_INIT(gpet, 0.3) | |
5 | 5 | |
6 | 6 | __GPET=gpet |
7 | 7 | AC_SUBST(__GPET) |
@@ -8,8 +8,8 @@ msgid "" | ||
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: 0.1\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2011-04-22 23:05+0900\n" | |
12 | -"PO-Revision-Date: 2011-04-22 23:04+0900\n" | |
11 | +"POT-Creation-Date: 2011-06-10 13:56+0900\n" | |
12 | +"PO-Revision-Date: 2011-06-10 13:56+0900\n" | |
13 | 13 | "Last-Translator: Yoshihiro Kusuno <yocto@users.sourceforge.jp>\n" |
14 | 14 | "Language-Team: Japanese < >\n" |
15 | 15 | "Language: \n" |
@@ -17,44 +17,44 @@ msgstr "" | ||
17 | 17 | "Content-Type: text/plain; charset=UTF-8\n" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | |
20 | -#: ../src/gpet.c:1135 | |
20 | +#: ../src/gpet.c:1193 | |
21 | 21 | msgid "offline" |
22 | 22 | msgstr "オフライン" |
23 | 23 | |
24 | -#: ../src/gpet.c:1135 | |
24 | +#: ../src/gpet.c:1193 | |
25 | 25 | msgid "nework" |
26 | 26 | msgstr "ネットワーク" |
27 | 27 | |
28 | -#: ../src/gpet.c:1135 | |
28 | +#: ../src/gpet.c:1193 | |
29 | 29 | msgid "online" |
30 | 30 | msgstr "オンライン" |
31 | 31 | |
32 | -#: ../src/gpet.c:1179 ../src/gpet.c:1184 ../src/menu.c:79 | |
32 | +#: ../src/gpet.c:1237 ../src/gpet.c:1242 ../src/menu.c:79 | |
33 | 33 | msgid "Statistics" |
34 | 34 | msgstr "統計情報" |
35 | 35 | |
36 | -#: ../src/gpet.c:1190 ../src/gpet.c:1194 ../src/gpet.c:1199 | |
36 | +#: ../src/gpet.c:1248 ../src/gpet.c:1252 ../src/gpet.c:1257 | |
37 | 37 | msgid "Manager Policy" |
38 | 38 | msgstr "マネージャ 一覧" |
39 | 39 | |
40 | -#: ../src/gpet.c:1205 ../src/gpet.c:1209 ../src/gpet.c:1214 | |
40 | +#: ../src/gpet.c:1263 ../src/gpet.c:1267 ../src/gpet.c:1272 | |
41 | 41 | msgid "Domain Policy Editor" |
42 | 42 | msgstr "ドメインポリシーエディタ" |
43 | 43 | |
44 | -#: ../src/gpet.c:1385 ../src/gpet.c:1410 | |
44 | +#: ../src/gpet.c:1443 ../src/gpet.c:1468 | |
45 | 45 | msgid "gpet" |
46 | 46 | msgstr "gpet" |
47 | 47 | |
48 | 48 | #. create tab |
49 | -#: ../src/gpet.c:1517 ../src/menu.c:352 | |
49 | +#: ../src/gpet.c:1575 ../src/menu.c:469 | |
50 | 50 | msgid "Domain Transition" |
51 | 51 | msgstr "ドメイン遷移 一覧" |
52 | 52 | |
53 | -#: ../src/gpet.c:1518 | |
53 | +#: ../src/gpet.c:1576 | |
54 | 54 | msgid "Exception Policy" |
55 | 55 | msgstr "例外ポリシー 一覧" |
56 | 56 | |
57 | -#: ../src/gpet.c:1519 | |
57 | +#: ../src/gpet.c:1577 | |
58 | 58 | msgid "Profile" |
59 | 59 | msgstr "プロファイル 一覧" |
60 | 60 |
@@ -62,7 +62,7 @@ msgstr "プロファイル 一覧" | ||
62 | 62 | msgid "_File" |
63 | 63 | msgstr "ファイル(_F)" |
64 | 64 | |
65 | -#: ../src/menu.c:47 ../src/other.c:47 | |
65 | +#: ../src/menu.c:47 ../src/other.c:48 | |
66 | 66 | msgid "_Edit" |
67 | 67 | msgstr "編集(_E)" |
68 | 68 |
@@ -90,19 +90,19 @@ msgstr "編集(_E)" | ||
90 | 90 | msgid "Set or Edit the selected line" |
91 | 91 | msgstr "選択した行を修正します。" |
92 | 92 | |
93 | -#: ../src/menu.c:56 ../src/other.c:49 | |
93 | +#: ../src/menu.c:56 ../src/other.c:50 | |
94 | 94 | msgid "_Add" |
95 | 95 | msgstr "追加(_A)" |
96 | 96 | |
97 | -#: ../src/menu.c:57 ../src/other.c:50 | |
97 | +#: ../src/menu.c:57 ../src/other.c:51 | |
98 | 98 | msgid "Append line" |
99 | 99 | msgstr "追加します。" |
100 | 100 | |
101 | -#: ../src/menu.c:58 ../src/other.c:51 | |
101 | +#: ../src/menu.c:58 ../src/other.c:52 | |
102 | 102 | msgid "_Delete" |
103 | 103 | msgstr "削除(_D)" |
104 | 104 | |
105 | -#: ../src/menu.c:59 ../src/other.c:52 | |
105 | +#: ../src/menu.c:59 ../src/other.c:53 | |
106 | 106 | msgid "Delete the selected line" |
107 | 107 | msgstr "選択した行を削除します。" |
108 | 108 |
@@ -123,8 +123,8 @@ msgid "Extraction of redundant ACL entries" | ||
123 | 123 | msgstr "冗長なACLエントリを削除するためのサポートをします。" |
124 | 124 | |
125 | 125 | #: ../src/menu.c:67 |
126 | -msgid "_Search" | |
127 | -msgstr "検索(_S)" | |
126 | +msgid "_Search..." | |
127 | +msgstr "検索...(_S)" | |
128 | 128 | |
129 | 129 | #: ../src/menu.c:68 |
130 | 130 | msgid "Search for text" |
@@ -155,16 +155,16 @@ msgid "Refresh to the latest information" | ||
155 | 155 | msgstr "再読み込みを行います。" |
156 | 156 | |
157 | 157 | #: ../src/menu.c:76 |
158 | -msgid "_Manager" | |
159 | -msgstr "マネージャ(_M)" | |
158 | +msgid "_Manager..." | |
159 | +msgstr "マネージャ...(_M)" | |
160 | 160 | |
161 | 161 | #: ../src/menu.c:77 |
162 | 162 | msgid "Manager Profile Editor" |
163 | 163 | msgstr "マネージャ 一覧" |
164 | 164 | |
165 | 165 | #: ../src/menu.c:78 |
166 | -msgid "_Statistics" | |
167 | -msgstr "統計情報(_S)" | |
166 | +msgid "_Statistics..." | |
167 | +msgstr "統計情報...(_S)" | |
168 | 168 | |
169 | 169 | #: ../src/menu.c:81 |
170 | 170 | msgid "_About" |
@@ -190,11 +190,11 @@ msgstr "ACLウィンドウ切離し" | ||
190 | 190 | msgid "Detach ACL window" |
191 | 191 | msgstr "ドメインポリシーを別ウィンドウで表示します。" |
192 | 192 | |
193 | -#: ../src/menu.c:349 | |
193 | +#: ../src/menu.c:466 | |
194 | 194 | msgid "Process State" |
195 | 195 | msgstr "プロセス 一覧" |
196 | 196 | |
197 | -#: ../src/menu.c:627 | |
197 | +#: ../src/menu.c:748 | |
198 | 198 | #, c-format |
199 | 199 | msgid "" |
200 | 200 | "<span foreground='red' size='x-large'><b>Delete</b> the %d selected " |
@@ -203,7 +203,7 @@ msgstr "" | ||
203 | 203 | "<span foreground='red' size='x-large'>選択した %d行の例外ポリシーを<b>削除</" |
204 | 204 | "b>します。</span>" |
205 | 205 | |
206 | -#: ../src/menu.c:630 | |
206 | +#: ../src/menu.c:751 | |
207 | 207 | #, c-format |
208 | 208 | msgid "" |
209 | 209 | "<span foreground='red' size='x-large'><b>Delete</b> the selected exception " |
@@ -212,7 +212,7 @@ msgstr "" | ||
212 | 212 | "<span foreground='red' size='x-large'>選択した 例外ポリシーを<b>削除</b>しま" |
213 | 213 | "す。</span>" |
214 | 214 | |
215 | -#: ../src/menu.c:647 | |
215 | +#: ../src/menu.c:768 | |
216 | 216 | #, c-format |
217 | 217 | msgid "" |
218 | 218 | "<span foreground='red' size='x-large'><b>Delete</b> the %d selected domains?" |
@@ -221,7 +221,7 @@ msgstr "" | ||
221 | 221 | "<span foreground='red' size='x-large'>選択した %d行のドメインを<b>削除</b>し" |
222 | 222 | "ます。</span>" |
223 | 223 | |
224 | -#: ../src/menu.c:650 | |
224 | +#: ../src/menu.c:771 | |
225 | 225 | #, c-format |
226 | 226 | msgid "" |
227 | 227 | "<span foreground='red' size='x-large'><b>Delete</b> the selected domain?</" |
@@ -230,7 +230,7 @@ msgstr "" | ||
230 | 230 | "<span foreground='red' size='x-large'>選択した ドメインを<b>削除</b>します。" |
231 | 231 | "</span>" |
232 | 232 | |
233 | -#: ../src/menu.c:669 | |
233 | +#: ../src/menu.c:790 | |
234 | 234 | #, c-format |
235 | 235 | msgid "" |
236 | 236 | "<span foreground='blue' size='x-large'><b>Delete</b> the %d selected " |
@@ -239,7 +239,7 @@ msgstr "" | ||
239 | 239 | "<span foreground='red' size='x-large'>選択した %d行のポリシーを<b>削除</b>し" |
240 | 240 | "ます。</span>" |
241 | 241 | |
242 | -#: ../src/menu.c:672 | |
242 | +#: ../src/menu.c:793 | |
243 | 243 | #, c-format |
244 | 244 | msgid "" |
245 | 245 | "<span foreground='blue' size='x-large'><b>Delete</b> the selected policy?</" |
@@ -248,101 +248,113 @@ msgstr "" | ||
248 | 248 | "<span foreground='red' size='x-large'>選択した ポリシーを<b>削除</b>します。" |
249 | 249 | "</span>" |
250 | 250 | |
251 | -#: ../src/menu.c:813 | |
251 | +#: ../src/menu.c:1027 | |
252 | 252 | msgid "Add Domain" |
253 | 253 | msgstr "ドメインを追加します。" |
254 | 254 | |
255 | -#: ../src/menu.c:820 | |
255 | +#: ../src/menu.c:1034 | |
256 | 256 | msgid "Add Acl" |
257 | 257 | msgstr "ドメインに対するアクセス許可を追加します。" |
258 | 258 | |
259 | -#: ../src/menu.c:832 | |
259 | +#: ../src/menu.c:1046 | |
260 | 260 | msgid "Add Exception" |
261 | 261 | msgstr "例外ポリシーを追加します。" |
262 | 262 | |
263 | -#: ../src/menu.c:840 | |
263 | +#: ../src/menu.c:1054 | |
264 | 264 | msgid "Add Profile (0 - 255)" |
265 | 265 | msgstr "プロファイルを追加します。 (0 - 255)" |
266 | 266 | |
267 | -#: ../src/menu.c:976 | |
267 | +#: ../src/menu.c:1196 | |
268 | 268 | msgid "Profile list" |
269 | 269 | msgstr "プロファイルを選択します。" |
270 | 270 | |
271 | -#: ../src/menu.c:1039 | |
271 | +#: ../src/menu.c:1271 | |
272 | 272 | msgid "Profile Edit" |
273 | 273 | msgstr "プロファイルを変更します。" |
274 | 274 | |
275 | -#: ../src/menu.c:1120 | |
275 | +#: ../src/menu.c:1355 | |
276 | 276 | msgid "Yoshihiro Kusuno <yocto@users.sourceforge.jp>" |
277 | 277 | msgstr "楠野 佳宏 <yocto@users.sourceforge.jp>" |
278 | 278 | |
279 | -#: ../src/menu.c:1121 | |
279 | +#: ../src/menu.c:1356 | |
280 | 280 | msgid "ccstools --- kumaneko san" |
281 | 281 | msgstr "ccstools --- 熊猫さん" |
282 | 282 | |
283 | -#: ../src/menu.c:1123 | |
283 | +#: ../src/menu.c:1358 | |
284 | 284 | msgid "Yoshihiro Kusuno" |
285 | 285 | msgstr "楠野 佳宏" |
286 | 286 | |
287 | -#: ../src/other.c:48 | |
287 | +#: ../src/other.c:49 | |
288 | 288 | msgid "Edit the selected line" |
289 | 289 | msgstr "選択した行を修正します。" |
290 | 290 | |
291 | -#: ../src/other.c:224 | |
291 | +#: ../src/other.c:228 | |
292 | 292 | msgid "File Selection Dialog" |
293 | 293 | msgstr "ファイルの選択" |
294 | 294 | |
295 | -#: ../src/other.c:264 | |
295 | +#: ../src/other.c:278 | |
296 | 296 | msgid "Manager Add" |
297 | 297 | msgstr "マネージャを追加します。" |
298 | 298 | |
299 | -#: ../src/other.c:342 | |
299 | +#: ../src/other.c:358 | |
300 | 300 | #, c-format |
301 | 301 | msgid "Delete the %d selected managers?" |
302 | 302 | msgstr "選択した %d行のマネージャ登録を削除します。" |
303 | 303 | |
304 | -#: ../src/other.c:343 | |
304 | +#: ../src/other.c:359 | |
305 | 305 | #, c-format |
306 | 306 | msgid "Delete the selected manager?" |
307 | 307 | msgstr "選択したマネージャ登録を削除します。" |
308 | 308 | |
309 | -#: ../src/other.c:560 | |
309 | +#: ../src/other.c:598 | |
310 | 310 | msgid " " |
311 | 311 | msgstr " " |
312 | 312 | |
313 | -#: ../src/other.c:567 | |
313 | +#: ../src/other.c:605 | |
314 | 314 | msgid "Now (bytes)" |
315 | 315 | msgstr "使用量(バイト)" |
316 | 316 | |
317 | -#: ../src/other.c:577 | |
317 | +#: ../src/other.c:615 | |
318 | 318 | msgid "Quota (bytes)" |
319 | 319 | msgstr "最大 (バイト)" |
320 | 320 | |
321 | -#: ../src/search.c:366 | |
321 | +#: ../src/search.c:424 | |
322 | 322 | msgid "Process Search for :" |
323 | 323 | msgstr "プロセス 一覧 検索文字列 :" |
324 | 324 | |
325 | -#: ../src/search.c:368 | |
325 | +#: ../src/search.c:426 | |
326 | 326 | msgid "Domain Search for :" |
327 | 327 | msgstr "ドメイン 一覧 検索文字列 :" |
328 | 328 | |
329 | -#: ../src/search.c:372 | |
329 | +#: ../src/search.c:430 | |
330 | 330 | msgid "ACL Search for :" |
331 | 331 | msgstr "ドメインポリシー 一覧 検索文字列 :" |
332 | 332 | |
333 | -#: ../src/search.c:375 | |
333 | +#: ../src/search.c:433 | |
334 | 334 | msgid "Exception Search for :" |
335 | 335 | msgstr "例外ポリシー 一覧 検索文字列 :" |
336 | 336 | |
337 | -#: ../src/search.c:378 | |
337 | +#: ../src/search.c:436 | |
338 | 338 | msgid "Profile Search for :" |
339 | 339 | msgstr "プロファイル 一覧 検索文字列 :" |
340 | 340 | |
341 | -#: ../src/search.c:382 | |
341 | +#: ../src/search.c:440 | |
342 | 342 | msgid "Search for :" |
343 | 343 | msgstr "検索文字列 :" |
344 | 344 | |
345 | -#: ../src/search.c:403 | |
345 | +#: ../src/search.c:475 | |
346 | +msgid "_Match case" | |
347 | +msgstr "大文字と小文字を区別する(_M)" | |
348 | + | |
349 | +#: ../src/search.c:481 | |
350 | +msgid "_Wrap around" | |
351 | +msgstr "折返しも対象にする(_W)" | |
352 | + | |
353 | +#: ../src/search.c:487 | |
354 | +msgid "Close _dialog" | |
355 | +msgstr "エンターで閉じる(_D)" | |
356 | + | |
357 | +#: ../src/search.c:516 | |
346 | 358 | msgid "Find" |
347 | 359 | msgstr "検索" |
348 | 360 |
@@ -46,6 +46,7 @@ gpet_SOURCES = \ | ||
46 | 46 | menu.c \ |
47 | 47 | g_undef.h \ |
48 | 48 | conf.c \ |
49 | + conf.h \ | |
49 | 50 | process.c \ |
50 | 51 | other.c \ |
51 | 52 | search.c \ |
@@ -29,14 +29,33 @@ | ||
29 | 29 | #include <glib/gi18n.h> |
30 | 30 | |
31 | 31 | #include "gpet.h" |
32 | +#include "conf.h" | |
32 | 33 | |
33 | 34 | #define PRINT_WARN(err) {g_warning("%s", err->message);g_error_free(err);err = NULL;} |
34 | 35 | |
35 | 36 | #define DIRECTORY "/apps/gpet" |
36 | -#define WINDOW_POSITION DIRECTORY"/window_position" | |
37 | +#define WINDOW_POSITION DIRECTORY"/window_position" | |
37 | 38 | #define WINDOW_SIZE DIRECTORY"/window_size" |
38 | -#define ACL_WINDOW_SIZE DIRECTORY"/acl_window_size" | |
39 | -#define PANED_POSITION DIRECTORY"/paned_position" | |
39 | +#define ACL_WINDOW_SIZE DIRECTORY"/acl_window_size" | |
40 | +#define PANED_POSITION DIRECTORY"/paned_position" | |
41 | + | |
42 | +#define SEARCH_DIR DIRECTORY"/search" | |
43 | +#define MATCH SEARCH_DIR"/match_case" | |
44 | +#define WRAP SEARCH_DIR"/wrap_around" | |
45 | +#define CLOSE SEARCH_DIR"/close_dialog" | |
46 | + | |
47 | + | |
48 | +static search_conf_t save_search = {TRUE, FALSE, FALSE}; | |
49 | + | |
50 | +void get_conf_search(search_conf_t *conf) | |
51 | +{ | |
52 | + *conf = save_search; | |
53 | +} | |
54 | + | |
55 | +void put_conf_search(search_conf_t *conf) | |
56 | +{ | |
57 | + save_search = *conf; | |
58 | +} | |
40 | 59 | |
41 | 60 | void read_config(transition_t *tran) |
42 | 61 | { |
@@ -45,6 +64,7 @@ void read_config(transition_t *tran) | ||
45 | 64 | gint x, y, w, h; |
46 | 65 | GtkPaned *paned; |
47 | 66 | gint paned_position; |
67 | + gboolean tmp_bool; | |
48 | 68 | |
49 | 69 | gtk_widget_set_size_request(tran->window, 640, 480); |
50 | 70 | gtk_widget_set_size_request(tran->acl_window, 600, 400); |
@@ -82,6 +102,29 @@ void read_config(transition_t *tran) | ||
82 | 102 | else |
83 | 103 | PRINT_WARN(err); |
84 | 104 | } |
105 | + | |
106 | + | |
107 | + if (!gconf_client_dir_exists(client, SEARCH_DIR, &err)) { | |
108 | + return; | |
109 | + } | |
110 | + | |
111 | + tmp_bool = gconf_client_get_bool(client, MATCH, &err); | |
112 | + if (!err) | |
113 | + save_search.match = tmp_bool; | |
114 | + else | |
115 | + PRINT_WARN(err); | |
116 | + | |
117 | + tmp_bool = gconf_client_get_bool(client, WRAP, &err); | |
118 | + if (!err) | |
119 | + save_search.wrap = tmp_bool; | |
120 | + else | |
121 | + PRINT_WARN(err); | |
122 | + | |
123 | + tmp_bool = gconf_client_get_bool(client, CLOSE, &err); | |
124 | + if (!err) | |
125 | + save_search.close = tmp_bool; | |
126 | + else | |
127 | + PRINT_WARN(err); | |
85 | 128 | } |
86 | 129 | |
87 | 130 | void write_config(transition_t *tran) |
@@ -128,5 +171,24 @@ void write_config(transition_t *tran) | ||
128 | 171 | PRINT_WARN(err); |
129 | 172 | } |
130 | 173 | } |
174 | + | |
175 | + | |
176 | + if (!gconf_client_dir_exists(client, SEARCH_DIR, &err)) { | |
177 | + gconf_client_add_dir(client, SEARCH_DIR, | |
178 | + GCONF_CLIENT_PRELOAD_NONE, &err); | |
179 | + } | |
180 | + if (err) { | |
181 | + PRINT_WARN(err); | |
182 | + return; | |
183 | + } | |
184 | + | |
185 | + if (!gconf_client_set_bool(client, MATCH, save_search.match, &err)) | |
186 | + PRINT_WARN(err); | |
187 | + | |
188 | + if (!gconf_client_set_bool(client, WRAP, save_search.wrap, &err)) | |
189 | + PRINT_WARN(err); | |
190 | + | |
191 | + if (!gconf_client_set_bool(client, CLOSE, save_search.close, &err)) | |
192 | + PRINT_WARN(err); | |
131 | 193 | } |
132 | 194 |
@@ -0,0 +1,37 @@ | ||
1 | +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ | |
2 | +/* | |
3 | + * Gui Policy Editor for TOMOYO Linux | |
4 | + * | |
5 | + * conf.h | |
6 | + * Copyright (C) Yoshihiro Kusuno 2011 <yocto@users.sourceforge.jp> | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or modify | |
9 | + * it under the terms of the GNU General Public License as published by | |
10 | + * the Free Software Foundation; either version 2 of the License, or | |
11 | + * (at your option) any later version. | |
12 | + * | |
13 | + * This program is distributed in the hope that it will be useful, | |
14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + * GNU Library General Public License for more details. | |
17 | + * | |
18 | + * You should have received a copy of the GNU General Public License | |
19 | + * along with this program; if not, write to the Free Software | |
20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA | |
21 | + */ | |
22 | + | |
23 | +#ifndef __CONF_H__ | |
24 | +#define __CONF_H__ | |
25 | + | |
26 | +typedef struct _search_conf_t { | |
27 | + gboolean match; | |
28 | + gboolean wrap; | |
29 | + gboolean close; | |
30 | +} search_conf_t; | |
31 | + | |
32 | + | |
33 | +void get_conf_search(search_conf_t *conf); | |
34 | +void put_conf_search(search_conf_t *conf); | |
35 | + | |
36 | + | |
37 | +#endif /* __CONF_H__ */ |
@@ -36,6 +36,42 @@ | ||
36 | 36 | #include "gpet.h" |
37 | 37 | |
38 | 38 | /*---------------------------------------------------------------------------*/ |
39 | +/* from util.c (ccs-patch-1.8.1-20110505) */ | |
40 | +static gboolean is_octal_char(const char *str) | |
41 | +{ | |
42 | + return *str >= '0' && *str++ <= '3' && | |
43 | + *str >= '0' && *str++ <= '7' && | |
44 | + *str >= '0' && *str <= '7'; | |
45 | +} | |
46 | +/* from util.c (ccs-patch-1.8.1-20110505) */ | |
47 | +static gchar octal_char_to_binary(const char *str) | |
48 | +{ | |
49 | + return ((str[0] - '0') << 6) + ((str[1] - '0') << 3) + (str[2] - '0'); | |
50 | +} | |
51 | + | |
52 | +gchar *decode_from_octal_str(const char *name) | |
53 | +{ | |
54 | + gchar *tmp, buff[strlen(name)+1]; | |
55 | + | |
56 | + if (!name) | |
57 | + return NULL; | |
58 | + | |
59 | + tmp = buff; | |
60 | + for( ; *name; name++, tmp++) { | |
61 | + if (*name == '\\' && is_octal_char(name + 1)) { | |
62 | + name++; | |
63 | + *tmp = octal_char_to_binary(name); | |
64 | + name += 2; | |
65 | + } else { | |
66 | + *tmp = *name; | |
67 | + } | |
68 | + } | |
69 | + *tmp = *name; | |
70 | + | |
71 | + return g_strdup(buff); | |
72 | +} | |
73 | + | |
74 | +/*---------------------------------------------------------------------------*/ | |
39 | 75 | enum tree_column_pos { |
40 | 76 | COLUMN_INDEX, // data index (invisible) |
41 | 77 | COLUMN_NUMBER, // n |
@@ -55,12 +91,14 @@ static int add_tree_store(GtkTreeStore *store, GtkTreeIter *parent_iter, | ||
55 | 91 | { |
56 | 92 | GtkTreeIter iter; |
57 | 93 | gchar *color = "black"; |
58 | - gchar *str_num, *str_prof; | |
94 | + gchar *str_num, *str_prof, *name; | |
59 | 95 | gchar *line = NULL, *is_dis = NULL, *domain; |
60 | 96 | const char *sp; |
61 | 97 | const struct ccs_transition_control_entry *transition_control; |
62 | 98 | int n, number, redirect_index = -1; |
63 | 99 | |
100 | +//g_print("add_tree_store index[%3d] nest[%2d]\n", *index, nest); | |
101 | + | |
64 | 102 | sp = ccs_domain_name(dp, *index); |
65 | 103 | for (n = 0; ; n++) { |
66 | 104 | const char *cp = strchr(sp, ' '); |
@@ -68,6 +106,7 @@ static int add_tree_store(GtkTreeStore *store, GtkTreeIter *parent_iter, | ||
68 | 106 | break; |
69 | 107 | sp = cp + 1; |
70 | 108 | } |
109 | + name = decode_from_octal_str(sp); | |
71 | 110 | |
72 | 111 | gtk_tree_store_append(store, &iter, parent_iter); |
73 | 112 | number = dp->list[*index].number; |
@@ -120,7 +159,7 @@ static int add_tree_store(GtkTreeStore *store, GtkTreeIter *parent_iter, | ||
120 | 159 | } |
121 | 160 | domain = g_strdup_printf("%s%s%s%s%s", |
122 | 161 | dp->list[*index].is_dd ? "( " : "", |
123 | - sp, | |
162 | + name, | |
124 | 163 | dp->list[*index].is_dd ? " )" : "", |
125 | 164 | line ? line : "", |
126 | 165 | is_dis ? is_dis : "" |
@@ -128,6 +167,7 @@ static int add_tree_store(GtkTreeStore *store, GtkTreeIter *parent_iter, | ||
128 | 167 | gtk_tree_store_set(store, &iter, COLUMN_DOMAIN_NAME, domain, |
129 | 168 | COLUMN_COLOR, color, |
130 | 169 | COLUMN_REDIRECT, redirect_index, -1); |
170 | + g_free(name); | |
131 | 171 | g_free(line); |
132 | 172 | g_free(is_dis); |
133 | 173 | g_free(domain); |
@@ -159,7 +199,7 @@ void add_tree_data(GtkTreeView *treeview, struct ccs_domain_policy *dp) | ||
159 | 199 | int index = 0, nest = -1; |
160 | 200 | |
161 | 201 | store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); |
162 | - gtk_tree_store_clear(store); | |
202 | + gtk_tree_store_clear(store); // TODO 遅い | |
163 | 203 | add_tree_store(store, iter, dp, &index, nest); |
164 | 204 | } |
165 | 205 | /*---------------------------------------------------------------------------*/ |
@@ -284,14 +324,19 @@ void add_list_data(generic_list_t *generic, gboolean alias_flag) | ||
284 | 324 | gtk_list_store_append(store, &iter); |
285 | 325 | |
286 | 326 | if (alias_flag) { |
327 | + gchar *ope = decode_from_octal_str( | |
328 | + generic->list[i].operand); | |
329 | + | |
287 | 330 | alias = (gchar *) |
288 | 331 | ccs_directives[generic->list[i].directive].alias; |
289 | 332 | gtk_list_store_set(store, &iter, |
290 | 333 | LIST_NUMBER, str_num, |
291 | 334 | LIST_COLON, ":", |
292 | 335 | LIST_ALIAS, alias, |
293 | - LIST_OPERAND, generic->list[i].operand, | |
336 | +// LIST_OPERAND, generic->list[i].operand, | |
337 | + LIST_OPERAND, ope, // test | |
294 | 338 | -1); |
339 | + g_free(ope); // test | |
295 | 340 | } else { |
296 | 341 | profile = g_strdup_printf("%3u-", |
297 | 342 | generic->list[i].directive); |
@@ -406,7 +451,7 @@ gint get_current_domain_index(transition_t *transition) | ||
406 | 451 | return index; |
407 | 452 | } |
408 | 453 | |
409 | -gchar *get_alias_and_operand(GtkWidget *view) | |
454 | +gchar *get_alias_and_operand(GtkWidget *view, gboolean alias_flag) | |
410 | 455 | { |
411 | 456 | GtkTreeSelection *selection; |
412 | 457 | GtkTreeIter iter; |
@@ -421,9 +466,17 @@ gchar *get_alias_and_operand(GtkWidget *view) | ||
421 | 466 | list = gtk_tree_selection_get_selected_rows(selection, NULL); |
422 | 467 | model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); |
423 | 468 | gtk_tree_model_get_iter(model, &iter, g_list_first(list)->data); |
424 | - gtk_tree_model_get(model, &iter, | |
469 | + if (alias_flag) { | |
470 | + gtk_tree_model_get(model, &iter, | |
425 | 471 | LIST_ALIAS, &alias, LIST_OPERAND, &operand, -1); |
426 | - str_buff = g_strdup_printf("%s %s", alias, operand); | |
472 | + str_buff = g_strdup_printf("%s %s", alias, operand); | |
473 | + g_free(alias); | |
474 | + g_free(operand); | |
475 | + } else { | |
476 | + gtk_tree_model_get(model, &iter, | |
477 | + LIST_OPERAND, &operand, -1); | |
478 | + str_buff = g_strchug(operand); | |
479 | + } | |
427 | 480 | } |
428 | 481 | |
429 | 482 | return str_buff; |
@@ -434,10 +487,9 @@ static gboolean move_pos_list(GtkTreeModel *model, GtkTreePath *path, | ||
434 | 487 | { |
435 | 488 | GtkWidget *view = NULL; |
436 | 489 | GtkTreeSelection *selection; |
437 | - const char *domain; | |
438 | 490 | gint index; |
439 | - gchar *alias = NULL, *operand = NULL, *str_buff = NULL; | |
440 | - gchar *entry; | |
491 | + gchar *alias = NULL, *operand = NULL; | |
492 | + gchar *entry, *str_buff = NULL; | |
441 | 493 | int cmp = -1; |
442 | 494 | |
443 | 495 |
@@ -447,8 +499,9 @@ static gboolean move_pos_list(GtkTreeModel *model, GtkTreePath *path, | ||
447 | 499 | case ADDENTRY_DOMAIN_LIST : |
448 | 500 | view = transition->treeview; |
449 | 501 | gtk_tree_model_get(model, iter, COLUMN_INDEX, &index, -1); |
450 | - domain = ccs_domain_name(transition->dp, index); | |
451 | - cmp = strcmp(entry, domain); | |
502 | + str_buff = decode_from_octal_str( | |
503 | + ccs_domain_name(transition->dp, index)); | |
504 | + cmp = strcmp(entry, str_buff); | |
452 | 505 | break; |
453 | 506 | case ADDENTRY_ACL_LIST : |
454 | 507 | view = transition->acl.listview; |
@@ -475,6 +528,7 @@ static gboolean move_pos_list(GtkTreeModel *model, GtkTreePath *path, | ||
475 | 528 | g_free(alias); |
476 | 529 | g_free(operand); |
477 | 530 | g_free(str_buff); |
531 | + g_free(entry); | |
478 | 532 | |
479 | 533 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); |
480 | 534 |
@@ -545,13 +599,14 @@ void set_position_addentry(transition_t *transition, GtkTreePath **path) | ||
545 | 599 | static void cb_selection(GtkTreeSelection *selection, |
546 | 600 | transition_t *transition) |
547 | 601 | { |
548 | - GtkTreeIter iter; | |
549 | - gint select_count; | |
550 | - GtkTreeModel *model; | |
551 | - GList *list; | |
552 | - gint index; | |
602 | + GtkTreeIter iter; | |
603 | + gint select_count; | |
604 | + GtkTreeModel *model; | |
605 | + GList *list; | |
606 | + gint index; | |
553 | 607 | GtkTreePath *path = NULL; |
554 | 608 | GtkTreeViewColumn *column = NULL; |
609 | + gchar *name; | |
555 | 610 | |
556 | 611 | DEBUG_PRINT("In **************************** \n"); |
557 | 612 | select_count = gtk_tree_selection_count_selected_rows(selection); |
@@ -567,8 +622,9 @@ static void cb_selection(GtkTreeSelection *selection, | ||
567 | 622 | g_list_free(list); |
568 | 623 | gtk_tree_model_get(model, &iter, COLUMN_INDEX, &index, -1); |
569 | 624 | DEBUG_PRINT("--- index [%4d] ---\n", index); |
570 | - gtk_entry_set_text(GTK_ENTRY(transition->domainbar), | |
571 | - ccs_domain_name(transition->dp, index)); | |
625 | + name = decode_from_octal_str(ccs_domain_name(transition->dp, index)); | |
626 | + gtk_entry_set_text(GTK_ENTRY(transition->domainbar), name); | |
627 | + g_free(name); | |
572 | 628 | |
573 | 629 | gtk_tree_view_get_cursor(GTK_TREE_VIEW( |
574 | 630 | transition->acl.listview), &path, &column); |
@@ -735,6 +791,7 @@ void set_sensitive(GtkActionGroup *actions, int task_flag, | ||
735 | 791 | case CCS_SCREEN_PROFILE_LIST : |
736 | 792 | sens_edt = TRUE; |
737 | 793 | sens_add = TRUE; |
794 | + sens_cpy = TRUE; | |
738 | 795 | break; |
739 | 796 | } |
740 | 797 |
@@ -1009,6 +1066,7 @@ g_free(str_path); | ||
1009 | 1066 | gtk_tree_selection_unselect_path(selection, path); |
1010 | 1067 | } |
1011 | 1068 | |
1069 | + g_free(str_num); | |
1012 | 1070 | return FALSE; |
1013 | 1071 | } |
1014 | 1072 |
@@ -129,10 +129,11 @@ const char *get_policy_dir(void); | ||
129 | 129 | const char *get_domain_last_name(const int index); |
130 | 130 | |
131 | 131 | // gpet.c |
132 | +gchar *decode_from_octal_str(const char *name); | |
132 | 133 | void add_tree_data(GtkTreeView *treeview, struct ccs_domain_policy *dp); |
133 | 134 | void add_list_data(generic_list_t *generic, gboolean alias_flag); |
134 | 135 | gint get_current_domain_index(transition_t *transition); |
135 | -gchar *get_alias_and_operand(GtkWidget *view); | |
136 | +gchar *get_alias_and_operand(GtkWidget *view, gboolean alias_flag); | |
136 | 137 | void set_position_addentry(transition_t *transition, GtkTreePath **path); |
137 | 138 | void set_sensitive(GtkActionGroup *actions, int task_flag, |
138 | 139 | enum ccs_screen_type current_page); |
@@ -155,6 +156,7 @@ int gpet_main(void); | ||
155 | 156 | GtkWidget *create_menu(GtkWidget *parent, transition_t *transition, |
156 | 157 | GtkWidget **toolbar); |
157 | 158 | void disp_statusbar(transition_t *transition, int scr); |
159 | +gchar *encode_to_octal_str(const char *str); | |
158 | 160 | void view_cursor_set(GtkWidget *view, |
159 | 161 | GtkTreePath *path, GtkTreeViewColumn *column); |
160 | 162 | void refresh_transition(GtkAction *action, transition_t *transition); |
@@ -94,6 +94,9 @@ static void generic_acl_copy(struct ccs_generic_acl **src, int src_cnt, | ||
94 | 94 | while (dst_cnt) |
95 | 95 | free((void *)((*dst)[--dst_cnt].operand)); |
96 | 96 | |
97 | + if (src_cnt < 1) | |
98 | + return; | |
99 | + | |
97 | 100 | *dst = realloc(*dst, src_cnt * sizeof(struct ccs_generic_acl)); |
98 | 101 | if (!(*dst)) |
99 | 102 | ccs_out_of_memory(); |
@@ -64,7 +64,7 @@ static GtkActionEntry entries[] = { | ||
64 | 64 | N_("_OptimizationSupport"), "<control>O", |
65 | 65 | N_("Extraction of redundant ACL entries"), G_CALLBACK(optimize_acl)}, |
66 | 66 | |
67 | - {"Search", GTK_STOCK_FIND, N_("_Search"), "<control>F", | |
67 | + {"Search", GTK_STOCK_FIND, N_("_Search..."), "<control>F", | |
68 | 68 | N_("Search for text"), G_CALLBACK(search_input)}, |
69 | 69 | {"SearchBack", GTK_STOCK_GO_BACK, N_("Search_Backwards"), "<control><shift>G", |
70 | 70 | N_("Search backwards for the same text"), G_CALLBACK(search_back)}, |
@@ -73,9 +73,9 @@ static GtkActionEntry entries[] = { | ||
73 | 73 | |
74 | 74 | {"Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "<control>R", |
75 | 75 | N_("Refresh to the latest information"), G_CALLBACK(refresh_transition)}, |
76 | - {"Manager", GTK_STOCK_DND, N_("_Manager"), "<control>M", | |
76 | + {"Manager", GTK_STOCK_DND, N_("_Manager..."), "<control>M", | |
77 | 77 | N_("Manager Profile Editor"), G_CALLBACK(manager_transition)}, |
78 | - {"Memory", GTK_STOCK_DND, N_("_Statistics"), "<control>S", | |
78 | + {"Memory", GTK_STOCK_DND, N_("_Statistics..."), "<control>S", | |
79 | 79 | N_("Statistics"), G_CALLBACK(memory_transition)}, |
80 | 80 | |
81 | 81 | {"About", GTK_STOCK_ABOUT, N_("_About"), "<alt>A", |
@@ -256,6 +256,123 @@ void disp_statusbar(transition_t *transition, int scr) | ||
256 | 256 | transition->contextid, status_str); |
257 | 257 | g_free(status_str); |
258 | 258 | } |
259 | +/*---------------------------------------------------------------------------*/ | |
260 | +/* from realpath.c (ccs-patch-1.8.1-20110505) */ | |
261 | +gchar *encode_to_octal_str(const char *str) | |
262 | +{ | |
263 | + int i; | |
264 | + int str_len; | |
265 | + int len = 0; | |
266 | + const char *p = str; | |
267 | + char *cp; | |
268 | + char *cp0; | |
269 | + | |
270 | + if (!p) | |
271 | + return NULL; | |
272 | + | |
273 | + str_len = strlen(str); | |
274 | + for (i = 0; i < str_len; i++) { | |
275 | + const unsigned char c = p[i]; | |
276 | + if (c == '\\') | |
277 | +// len += 2; | |
278 | + len++; | |
279 | + else if (c > ' ' && c < 127) | |
280 | + len++; | |
281 | + else | |
282 | + len += 4; | |
283 | + } | |
284 | + len++; | |
285 | + | |
286 | + /* Reserve space for appending "/". */ | |
287 | + cp = g_malloc0(len + 10); | |
288 | + if (!cp) | |
289 | + return NULL; | |
290 | + | |
291 | + cp0 = cp; | |
292 | + p = str; | |
293 | + for (i = 0; i < str_len; i++) { | |
294 | + const unsigned char c = p[i]; | |
295 | + if (c == '\\') { | |
296 | + *cp++ = '\\'; | |
297 | +// *cp++ = '\\'; | |
298 | + } else if (c > ' ' && c < 127) { | |
299 | + *cp++ = c; | |
300 | + } else { | |
301 | + *cp++ = '\\'; | |
302 | + *cp++ = (c >> 6) + '0'; | |
303 | + *cp++ = ((c >> 3) & 7) + '0'; | |
304 | + *cp++ = (c & 7) + '0'; | |
305 | + } | |
306 | + } | |
307 | + return cp0; | |
308 | +} | |
309 | + | |
310 | +static gint encode_copy(gchar *cp, gchar *buff) | |
311 | +{ | |
312 | + gchar *str; | |
313 | + gint len; | |
314 | + | |
315 | + if (!*cp) | |
316 | + return 0; | |
317 | + | |
318 | + str = encode_to_octal_str(cp); | |
319 | + strcpy(buff, str); | |
320 | + len = strlen(str) - 1; | |
321 | + g_free(str); | |
322 | + | |
323 | + return len; | |
324 | +} | |
325 | + | |
326 | +static gchar *escape_str_encode(const char *input) | |
327 | +{ | |
328 | + gchar *str, *cp0, *cp1; | |
329 | + gchar *tmp, buff[strlen(input)*3+1]; | |
330 | + gboolean match = FALSE; | |
331 | + | |
332 | + if (!input) | |
333 | + return NULL; | |
334 | + | |
335 | + cp0 = str = g_strdup(input); | |
336 | + tmp = buff; | |
337 | + for( ; *cp0; cp0++, tmp++) { | |
338 | + if (*cp0 == '\\' && *(cp0 + 1) == '\'') { | |
339 | + *tmp = *++cp0; | |
340 | + } else if (*cp0 == '\'') { // start " | |
341 | + cp1 = ++cp0; | |
342 | + for ( ; *cp0; cp0++) { | |
343 | + if (*cp0 == '\\' && *(cp0 + 1) == '\'') { | |
344 | + if (cp1 < cp0) { | |
345 | + *cp0 = '\0'; | |
346 | + tmp += encode_copy(cp1, tmp); | |
347 | + tmp++; | |
348 | + } else { | |
349 | + *tmp = *(cp0 + 1); | |
350 | + } | |
351 | + cp1 = ++cp0; | |
352 | + } else if (*cp0 == '\'') { // end " | |
353 | + *cp0 = '\0'; | |
354 | + match = TRUE; | |
355 | + break; | |
356 | + } | |
357 | + } | |
358 | + | |
359 | + if (match) { | |
360 | + tmp += encode_copy(cp1, tmp); | |
361 | + match = FALSE; | |
362 | + } else { | |
363 | + g_warning(" [\']pair not match!"); | |
364 | + cp0 = cp1; | |
365 | + *tmp = *cp0; | |
366 | + } | |
367 | + } else { | |
368 | + *tmp = *cp0; | |
369 | + } | |
370 | + } | |
371 | + *tmp = *cp0; | |
372 | + | |
373 | + g_free(str); | |
374 | + return g_strdup(buff); | |
375 | +} | |
259 | 376 | /*-------+---------+---------+---------+---------+---------+---------+--------*/ |
260 | 377 | static void terminate(GtkAction *action, transition_t *transition) |
261 | 378 | { |
@@ -494,16 +611,20 @@ static void copy_line(GtkAction *action, transition_t *transition) | ||
494 | 611 | index = get_current_domain_index(transition); |
495 | 612 | view = transition->treeview; |
496 | 613 | if (index >= 0) |
497 | - insert_history_buffer(view, g_strdup( | |
614 | + insert_history_buffer(view, decode_from_octal_str( | |
498 | 615 | ccs_domain_name(transition->dp, index))); |
499 | 616 | break; |
500 | 617 | case CCS_SCREEN_ACL_LIST : |
501 | 618 | view = transition->acl.listview; |
502 | - insert_history_buffer(view, get_alias_and_operand(view)); | |
619 | + insert_history_buffer(view, get_alias_and_operand(view, TRUE)); | |
503 | 620 | break; |
504 | 621 | case CCS_SCREEN_EXCEPTION_LIST : |
505 | 622 | view = transition->exp.listview; |
506 | - insert_history_buffer(view, get_alias_and_operand(view)); | |
623 | + insert_history_buffer(view, get_alias_and_operand(view, TRUE)); | |
624 | + break; | |
625 | + case CCS_SCREEN_PROFILE_LIST : | |
626 | + view = transition->prf.listview; | |
627 | + insert_history_buffer(view, get_alias_and_operand(view, FALSE)); | |
507 | 628 | break; |
508 | 629 | default : |
509 | 630 | break; |
@@ -693,7 +814,25 @@ static gchar *Last_entry_string = NULL; | ||
693 | 814 | |
694 | 815 | gchar *get_combo_entry_last(void) |
695 | 816 | { |
696 | - return Last_entry_string; | |
817 | + gchar *str, *buff; | |
818 | + gchar *cp; | |
819 | + | |
820 | + buff = g_malloc0(strlen(Last_entry_string) + 1); | |
821 | + if (!buff) | |
822 | + return NULL; | |
823 | + | |
824 | + str = buff; | |
825 | + for (cp = Last_entry_string; *cp; cp++) { | |
826 | + if (*cp == '\\' && *(cp + 1) == '\'') { | |
827 | + *str++ = *++cp; | |
828 | + } else if (*cp != '\'') { | |
829 | + *str++ = *cp; | |
830 | + } | |
831 | + } | |
832 | + *str = *cp; | |
833 | + | |
834 | +//g_print("[%s]\n", buff); | |
835 | + return buff; | |
697 | 836 | } |
698 | 837 | |
699 | 838 | static void insert_history_buffer(GtkWidget *view, gchar *entry) |
@@ -710,8 +849,10 @@ static void insert_history_buffer(GtkWidget *view, gchar *entry) | ||
710 | 849 | gtk_clipboard_set_text(clipboard, entry, -1); |
711 | 850 | |
712 | 851 | for (list = combolist; list; list = g_list_next(list)) { |
713 | - if (strcmp(entry, (gchar *)list->data) == 0) | |
852 | + if (strcmp(entry, (gchar *)list->data) == 0) { | |
853 | + g_free(entry); | |
714 | 854 | return; |
855 | + } | |
715 | 856 | } |
716 | 857 | |
717 | 858 | combolist = g_list_insert(combolist, entry, 0); |
@@ -723,7 +864,59 @@ static void insert_history_buffer(GtkWidget *view, gchar *entry) | ||
723 | 864 | } |
724 | 865 | } |
725 | 866 | |
726 | -static gint combo_entry_activate(GtkWidget *combo, gchar **new_text) | |
867 | +static gchar *normalize_strdup(gchar *input) | |
868 | +{ | |
869 | + gchar *cp; | |
870 | + gint len = strlen(input); | |
871 | + gchar *str, *buff; | |
872 | + gboolean match = FALSE; | |
873 | + | |
874 | + if (len < 1) | |
875 | + return NULL; | |
876 | + | |
877 | + cp = input + len - 1; | |
878 | + if (g_ascii_isspace(*cp)) { | |
879 | + while (len && g_ascii_isspace(*cp)) { | |
880 | + cp--; | |
881 | + len--; | |
882 | + } | |
883 | + } | |
884 | + | |
885 | + cp = input; | |
886 | + while (len && g_ascii_isspace(*cp)) { | |
887 | + cp++; | |
888 | + len--; | |
889 | + } | |
890 | + | |
891 | + buff = g_malloc0(len + 1); | |
892 | + if (!buff) | |
893 | + return NULL; | |
894 | + | |
895 | + str = buff; | |
896 | + while (len && *cp) { | |
897 | + if (*cp == '\\' && *(cp + 1) == '\'') { | |
898 | + *str++ = *cp++; | |
899 | + len--; | |
900 | + } else if (*cp == '\'') { | |
901 | + match = match ? FALSE : TRUE; | |
902 | + } else { | |
903 | + if (!match && g_ascii_isspace(*cp)) { | |
904 | + while (g_ascii_isspace(*(cp+1))) { | |
905 | + cp++; | |
906 | + len--; | |
907 | + } | |
908 | + } | |
909 | + } | |
910 | + *str++ = *cp++; | |
911 | + len--; | |
912 | + } | |
913 | + *str = '\0'; | |
914 | + | |
915 | +//g_print("%2d[%s]\n", len, buff); | |
916 | + return buff; | |
917 | +} | |
918 | + | |
919 | +static gint combo_entry_apply(GtkWidget *combo, gchar **new_text) | |
727 | 920 | { |
728 | 921 | GtkComboBox *combobox; |
729 | 922 | GList *list; |
@@ -735,7 +928,9 @@ static gint combo_entry_activate(GtkWidget *combo, gchar **new_text) | ||
735 | 928 | return 1; |
736 | 929 | |
737 | 930 | g_free(Last_entry_string); |
738 | - Last_entry_string = g_strdup(*new_text); | |
931 | + Last_entry_string = normalize_strdup(*new_text); | |
932 | + g_free(*new_text); | |
933 | + *new_text = g_strdup(Last_entry_string); | |
739 | 934 | |
740 | 935 | for (list = combolist; list; list = g_list_next(list)) { |
741 | 936 | if (strcmp(*new_text, (gchar *)list->data) == 0) { |
@@ -757,6 +952,17 @@ static gint combo_entry_activate(GtkWidget *combo, gchar **new_text) | ||
757 | 952 | return exist_flag ? 1 : 0; |
758 | 953 | } |
759 | 954 | |
955 | +static void cb_combo_entry_activate(GtkEntry *entry, GtkWidget *dialog) | |
956 | +{ | |
957 | + const gchar *input = gtk_entry_get_text(entry); | |
958 | + | |
959 | + if (!input || strcmp(input, "") == 0) | |
960 | + return; | |
961 | + | |
962 | + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); | |
963 | +} | |
964 | + | |
965 | +/*---------------------------------------------------------------------------*/ | |
760 | 966 | static gint append_dialog(transition_t *transition, |
761 | 967 | gchar *title, gchar **input) |
762 | 968 | { |
@@ -777,6 +983,9 @@ static gint append_dialog(transition_t *transition, | ||
777 | 983 | NULL); |
778 | 984 | |
779 | 985 | combo = gtk_combo_box_entry_new_text(); |
986 | + g_signal_connect(G_OBJECT(GTK_BIN(combo)->child) , "activate" , | |
987 | + G_CALLBACK(cb_combo_entry_activate), dialog); | |
988 | + | |
780 | 989 | gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); |
781 | 990 | |
782 | 991 | for (list = combolist; list; list = g_list_next(list)) { |
@@ -791,7 +1000,12 @@ static gint append_dialog(transition_t *transition, | ||
791 | 1000 | |
792 | 1001 | response = gtk_dialog_run(GTK_DIALOG(dialog)); |
793 | 1002 | if (response == GTK_RESPONSE_APPLY) { |
794 | - combo_entry_activate(combo, input); | |
1003 | + gchar *tmp; | |
1004 | + combo_entry_apply(combo, input); | |
1005 | + tmp = escape_str_encode(*input); | |
1006 | +// g_print("[%s]:[%s]\n", *input, tmp); | |
1007 | + g_free(*input); | |
1008 | + *input = tmp; | |
795 | 1009 | result = 0; |
796 | 1010 | } |
797 | 1011 | gtk_widget_destroy(dialog); |
@@ -955,6 +1169,12 @@ static gboolean apply_profile(transition_t *transition, | ||
955 | 1169 | } |
956 | 1170 | } |
957 | 1171 | |
1172 | +static void cb_profile_activate(GtkTreeView *treeview, GtkTreePath *treepath, | |
1173 | + GtkTreeViewColumn *treeviewcolumn, GtkWidget *dialog) | |
1174 | +{ | |
1175 | + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); | |
1176 | +} | |
1177 | + | |
958 | 1178 | static void set_domain(transition_t *transition) |
959 | 1179 | { |
960 | 1180 | GtkTreeSelection *domain_selection; |
@@ -981,6 +1201,8 @@ static void set_domain(transition_t *transition) | ||
981 | 1201 | NULL); |
982 | 1202 | |
983 | 1203 | listview = create_list_profile(); |
1204 | + g_signal_connect(G_OBJECT(listview), "row-activated", | |
1205 | + G_CALLBACK(cb_profile_activate), dialog); | |
984 | 1206 | add_list_profile(listview, &(transition->prf)); |
985 | 1207 | view_cursor_set(listview, NULL, NULL); |
986 | 1208 | gtk_container_add( |
@@ -1004,6 +1226,16 @@ retry_profile: | ||
1004 | 1226 | gtk_widget_destroy(dialog); |
1005 | 1227 | } |
1006 | 1228 | |
1229 | +static void cb_profile_entry_activate(GtkEntry *entry, GtkWidget *dialog) | |
1230 | +{ | |
1231 | + const gchar *input = gtk_entry_get_text(entry); | |
1232 | + | |
1233 | + if (!input || strcmp(input, "") == 0) | |
1234 | + return; | |
1235 | + | |
1236 | + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); | |
1237 | +} | |
1238 | + | |
1007 | 1239 | static void edit_profile(transition_t *transition) |
1008 | 1240 | { |
1009 | 1241 | GtkWidget *dialog; |
@@ -1043,6 +1275,9 @@ static void edit_profile(transition_t *transition) | ||
1043 | 1275 | GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, |
1044 | 1276 | NULL); |
1045 | 1277 | |
1278 | + g_signal_connect(G_OBJECT(entry) , "activate" , | |
1279 | + G_CALLBACK(cb_profile_entry_activate), dialog); | |
1280 | + | |
1046 | 1281 | hbox = gtk_hbox_new(FALSE, 5); |
1047 | 1282 | gtk_container_add( |
1048 | 1283 | GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
@@ -1133,8 +1368,8 @@ static void show_about_dialog(void) | ||
1133 | 1368 | gtk_about_dialog_set_copyright(about, |
1134 | 1369 | "Copyright(C) 2010,2011 TOMOYO Linux Project"); |
1135 | 1370 | gtk_about_dialog_set_comments(about, |
1136 | - "Gui Policy Editor for TOMOYO Linux 1.8" | |
1137 | - " or AKARI 1.0" | |
1371 | + "Gui Policy Editor for TOMOYO Linux 1.8.1" | |
1372 | + " or AKARI 1.0.11" | |
1138 | 1373 | "\n(based on ccs-editpolicy:ccstools)"); |
1139 | 1374 | gtk_about_dialog_set_website(about, "http://sourceforge.jp/projects/gpet/"); |
1140 | 1375 | // gtk_about_dialog_set_website_label(about, "http://tomoyo.sourceforge.jp/"); |
@@ -26,6 +26,7 @@ | ||
26 | 26 | |
27 | 27 | #include <gtk/gtk.h> |
28 | 28 | #include <glib/gi18n.h> |
29 | +#include <glib/gprintf.h> | |
29 | 30 | |
30 | 31 | #include "gpet.h" |
31 | 32 |
@@ -178,7 +179,8 @@ static void add_list_manager(generic_list_t *man) | ||
178 | 179 | gtk_widget_grab_focus(man->listview); |
179 | 180 | } |
180 | 181 | |
181 | -static void create_manager_view(GtkWidget *dialog, GtkWidget *listview) | |
182 | +static void create_manager_view(GtkWidget *dialog, GtkWidget *toolbar, | |
183 | + GtkWidget *listview) | |
182 | 184 | { |
183 | 185 | GtkWidget *scrolledwin; |
184 | 186 |
@@ -189,6 +191,8 @@ static void create_manager_view(GtkWidget *dialog, GtkWidget *listview) | ||
189 | 191 | GTK_SCROLLED_WINDOW(scrolledwin), GTK_SHADOW_IN); |
190 | 192 | |
191 | 193 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), |
194 | + toolbar, FALSE, FALSE, 0); | |
195 | + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), | |
192 | 196 | scrolledwin, TRUE, TRUE, 0); |
193 | 197 | gtk_container_add(GTK_CONTAINER(scrolledwin), listview); |
194 | 198 |
@@ -251,6 +255,16 @@ static void cb_button(GtkButton *button, gpointer data) | ||
251 | 255 | gtk_widget_destroy(dialog); |
252 | 256 | } |
253 | 257 | |
258 | +static void cb_manager_entry_activate(GtkEntry *entry, GtkWidget *dialog) | |
259 | +{ | |
260 | + const gchar *input = gtk_entry_get_text(entry); | |
261 | + | |
262 | + if (!input || strcmp(input, "") == 0) | |
263 | + return; | |
264 | + | |
265 | + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); | |
266 | +} | |
267 | + | |
254 | 268 | static void append_manager(GtkAction *action, other_t *data) |
255 | 269 | { |
256 | 270 | GtkWidget *dialog; |
@@ -273,6 +287,8 @@ static void append_manager(GtkAction *action, other_t *data) | ||
273 | 287 | GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
274 | 288 | |
275 | 289 | entry = gtk_entry_new(); |
290 | + g_signal_connect(G_OBJECT(entry) , "activate" , | |
291 | + G_CALLBACK(cb_manager_entry_activate), dialog); | |
276 | 292 | gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); |
277 | 293 | g_object_set_data(G_OBJECT(entry), "parent", (gpointer)dialog); |
278 | 294 |
@@ -369,6 +385,7 @@ void manager_main(transition_t *transition) | ||
369 | 385 | { |
370 | 386 | other_t data; |
371 | 387 | GtkWidget *dialog; |
388 | + GtkWidget *toolbar; | |
372 | 389 | GtkWidget *listview; |
373 | 390 | gchar *title; |
374 | 391 | gint response; |
@@ -381,9 +398,9 @@ void manager_main(transition_t *transition) | ||
381 | 398 | NULL); |
382 | 399 | g_free(title); |
383 | 400 | |
384 | - create_dialog_menu(dialog, &data); | |
401 | + toolbar = create_dialog_menu(dialog, &data); | |
385 | 402 | listview = create_list_manager(); |
386 | - create_manager_view(dialog, listview); | |
403 | + create_manager_view(dialog, toolbar, listview); | |
387 | 404 | |
388 | 405 | data.dialog = dialog; |
389 | 406 | data.manager.listview = listview; |
@@ -415,6 +432,25 @@ void manager_main(transition_t *transition) | ||
415 | 432 | transition->current_page = CCS_SCREEN_DOMAIN_LIST; |
416 | 433 | } |
417 | 434 | /*-------+---------+---------+---------+---------+---------+---------+--------*/ |
435 | +static void cnv_local_time(gchar *date, gchar *time) | |
436 | +{ | |
437 | + struct tm t, *lt; | |
438 | + time_t timet; | |
439 | + | |
440 | + memset(&t, 0, sizeof(t)); | |
441 | + sscanf(date, "%d/%d/%d", &(t.tm_year), &(t.tm_mon), &(t.tm_mday)); | |
442 | + sscanf(time, "%d:%d:%d", &(t.tm_hour), &(t.tm_min), &(t.tm_sec)); | |
443 | + | |
444 | + t.tm_year -= 1900; | |
445 | + t.tm_mon--; | |
446 | + timet = timegm(&t); | |
447 | + lt = localtime(&timet); | |
448 | + | |
449 | + g_sprintf(date, "%04d/%02d/%02d", | |
450 | + lt->tm_year+1900, lt->tm_mon+1, lt->tm_mday); | |
451 | + g_sprintf(time, "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); | |
452 | +} | |
453 | + | |
418 | 454 | static void get_disp_column(const char *data, gchar **head, |
419 | 455 | gchar **now_str, gchar **quota_str) |
420 | 456 | { |
@@ -427,19 +463,19 @@ static void get_disp_column(const char *data, gchar **head, | ||
427 | 463 | memset(name, 0, sizeof(name)); |
428 | 464 | memset(date, 0, sizeof(date)); |
429 | 465 | memset(time, 0, sizeof(time)); |
430 | - if ((cnt = sscanf(data, "Policy update: %u %s %s %s", | |
466 | + if ((cnt = sscanf(data, "Policy update: %u (%s %s %s)", | |
431 | 467 | &now, name, date, time)) >= 1) { |
432 | 468 | *head = "Policy update"; |
433 | 469 | } else if ((cnt = sscanf(data, |
434 | - "Policy violation in learning mode: %u %s %s %s", | |
470 | + "Policy violation in learning mode: %u (%s %s %s)", | |
435 | 471 | &now, name, date, time)) >= 1) { |
436 | 472 | *head = "Policy violation in learning mode"; |
437 | 473 | } else if ((cnt = sscanf(data, |
438 | - "Policy violation in permissive mode: %u %s %s %s", | |
474 | + "Policy violation in permissive mode: %u (%s %s %s)", | |
439 | 475 | &now, name, date, time)) >= 1) { |
440 | 476 | *head = "Policy violation in permissive mode"; |
441 | 477 | } else if ((cnt = sscanf(data, |
442 | - "Policy violation in enforcing mode: %u %s %s %s", | |
478 | + "Policy violation in enforcing mode: %u (%s %s %s)", | |
443 | 479 | &now, name, date, time)) >= 1) { |
444 | 480 | *head = "Policy violation in enforcing mode"; |
445 | 481 | } else if ((cnt = sscanf(data, |
@@ -467,10 +503,12 @@ static void get_disp_column(const char *data, gchar **head, | ||
467 | 503 | bQuota = FALSE; |
468 | 504 | |
469 | 505 | *now_str = bNow ? g_strdup_printf("%u", now) : g_strdup(""); |
470 | - if (strlen(name)) | |
506 | + if (strlen(name)) { | |
507 | + cnv_local_time(date, time); | |
471 | 508 | *quota_str = g_strdup_printf("%s %s %s", name, date, time); |
472 | - else | |
509 | + } else { | |
473 | 510 | *quota_str = bQuota ? g_strdup_printf("%u", quota) : g_strdup(""); |
511 | + } | |
474 | 512 | } |
475 | 513 | |
476 | 514 | enum mem_column_pos { |
@@ -584,7 +622,8 @@ static GtkWidget *create_list_memory(generic_list_t *mem) | ||
584 | 622 | return treeview; |
585 | 623 | } |
586 | 624 | |
587 | -static void create_memory_view(GtkWidget *dialog, GtkWidget *listview) | |
625 | +static void create_memory_view(GtkWidget *dialog, GtkWidget *toolbar, | |
626 | + GtkWidget *listview) | |
588 | 627 | { |
589 | 628 | GtkWidget *scrolledwin; |
590 | 629 |
@@ -595,6 +634,8 @@ static void create_memory_view(GtkWidget *dialog, GtkWidget *listview) | ||
595 | 634 | GTK_SCROLLED_WINDOW(scrolledwin), GTK_SHADOW_IN); |
596 | 635 | |
597 | 636 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), |
637 | + toolbar, FALSE, FALSE, 0); | |
638 | + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), | |
598 | 639 | scrolledwin, TRUE, TRUE, 0); |
599 | 640 | gtk_container_add(GTK_CONTAINER(scrolledwin), listview); |
600 | 641 |
@@ -623,6 +664,7 @@ void memory_main(transition_t *transition) | ||
623 | 664 | { |
624 | 665 | other_t data; |
625 | 666 | GtkWidget *dialog; |
667 | + GtkWidget *toolbar; | |
626 | 668 | GtkWidget *listview; |
627 | 669 | gchar *title; |
628 | 670 | gint response; |
@@ -631,18 +673,19 @@ void memory_main(transition_t *transition) | ||
631 | 673 | dialog = gtk_dialog_new_with_buttons(title, |
632 | 674 | GTK_WINDOW(transition->window), |
633 | 675 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, |
634 | - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
635 | 676 | GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, |
677 | + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
678 | + GTK_STOCK_OK, GTK_RESPONSE_OK, | |
636 | 679 | NULL); |
637 | 680 | g_free(title); |
638 | 681 | |
639 | 682 | data.dialog = dialog; |
640 | 683 | data.memory.count = 0; |
641 | 684 | data.memory.list = NULL; |
642 | - create_dialog_menu(dialog, &data); | |
685 | + toolbar = create_dialog_menu(dialog, &data); | |
643 | 686 | listview = create_list_memory(&(data.memory)); |
644 | 687 | data.memory.listview = listview; |
645 | - create_memory_view(dialog, listview); | |
688 | + create_memory_view(dialog, toolbar, listview); | |
646 | 689 | |
647 | 690 | add_list_memory(&(data.memory)); |
648 | 691 |
@@ -655,8 +698,9 @@ void memory_main(transition_t *transition) | ||
655 | 698 | gtk_widget_set_name(dialog, "GpetStatisticsDialog"); // .gpetrc |
656 | 699 | gtk_widget_show_all(dialog); |
657 | 700 | |
701 | +retry_memory: | |
658 | 702 | response = gtk_dialog_run(GTK_DIALOG(dialog)); |
659 | - if (response == GTK_RESPONSE_APPLY) { | |
703 | + if (response == GTK_RESPONSE_APPLY || response == GTK_RESPONSE_OK) { | |
660 | 704 | char *err_buff = NULL; |
661 | 705 | DEBUG_PRINT("Apply button was pressed.\n"); |
662 | 706 | if (set_memory(data.memory.list, |
@@ -664,6 +708,11 @@ void memory_main(transition_t *transition) | ||
664 | 708 | g_warning("%s", err_buff); |
665 | 709 | free(err_buff); |
666 | 710 | } |
711 | + | |
712 | + if (response == GTK_RESPONSE_APPLY) { | |
713 | + add_list_memory(&(data.memory)); | |
714 | + goto retry_memory; | |
715 | + } | |
667 | 716 | } else { |
668 | 717 | DEBUG_PRINT("Another response was recieved.\n"); |
669 | 718 | } |
@@ -30,11 +30,11 @@ | ||
30 | 30 | #include "gpet.h" |
31 | 31 | |
32 | 32 | enum task_column_pos { |
33 | - COLUMN_INDEX, // data index (invisible) | |
33 | + COLUMN_INDEX, // data index (invisible) | |
34 | 34 | COLUMN_NUMBER, // n |
35 | - COLUMN_COLON, // : | |
35 | + COLUMN_COLON, // : | |
36 | 36 | COLUMN_PROFILE, // profile |
37 | - COLUMN_NAME, // process name + pid + domain name | |
37 | + COLUMN_NAME, // process name + pid + domain name | |
38 | 38 | N_COLUMNS_TREE |
39 | 39 | }; |
40 | 40 |
@@ -45,6 +45,7 @@ static int add_task_tree_store(GtkTreeStore *store, | ||
45 | 45 | { |
46 | 46 | GtkTreeIter iter; |
47 | 47 | gchar *str_prof; |
48 | + gchar *str_domain; | |
48 | 49 | gchar *line; |
49 | 50 | int n = 0, index; |
50 | 51 |
@@ -52,18 +53,20 @@ static int add_task_tree_store(GtkTreeStore *store, | ||
52 | 53 | |
53 | 54 | index = tsk->task[*number].index; |
54 | 55 | str_prof = g_strdup_printf("%3u", tsk->task[*number].profile); |
56 | + str_domain = decode_from_octal_str(tsk->task[*number].domain); | |
55 | 57 | line = g_strdup_printf("%s (%u) %s", |
56 | 58 | tsk->task[*number].name, |
57 | 59 | tsk->task[*number].pid, |
58 | - tsk->task[*number].domain); | |
60 | + str_domain); | |
59 | 61 | gtk_tree_store_set(store, &iter, |
60 | 62 | COLUMN_INDEX, index, |
61 | 63 | COLUMN_NUMBER, *number, |
62 | 64 | COLUMN_COLON, ":", |
63 | - COLUMN_PROFILE, str_prof, | |
65 | + COLUMN_PROFILE, str_prof, | |
64 | 66 | COLUMN_NAME, line, |
65 | 67 | -1); |
66 | 68 | DEBUG_PRINT("[%3d]%3d(%d):%s %s\n", index, *number, nest, str_prof, line); |
69 | + g_free(str_domain); | |
67 | 70 | g_free(str_prof); |
68 | 71 | g_free(line); |
69 | 72 |
@@ -148,11 +151,12 @@ static gboolean cb_select_process(GtkTreeView *treeview, | ||
148 | 151 | static void cb_selection_proc(GtkTreeSelection *selection, |
149 | 152 | transition_t *transition) |
150 | 153 | { |
151 | - GtkTreeIter iter; | |
152 | - gint select_count; | |
153 | - GtkTreeModel *model; | |
154 | - GList *list; | |
155 | - gint index; | |
154 | + GtkTreeIter iter; | |
155 | + gint select_count; | |
156 | + GtkTreeModel *model; | |
157 | + GList *list; | |
158 | + gint index; | |
159 | + gchar *str_domain; | |
156 | 160 | GtkTreePath *path = NULL; |
157 | 161 | GtkTreeViewColumn *column = NULL; |
158 | 162 |
@@ -167,8 +171,10 @@ static void cb_selection_proc(GtkTreeSelection *selection, | ||
167 | 171 | g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL); |
168 | 172 | g_list_free(list); |
169 | 173 | gtk_tree_model_get(model, &iter, COLUMN_INDEX, &index, -1); |
170 | - gtk_entry_set_text(GTK_ENTRY(transition->domainbar), | |
171 | - transition->tsk.task[index].domain); | |
174 | + | |
175 | + str_domain = decode_from_octal_str(transition->tsk.task[index].domain); | |
176 | + gtk_entry_set_text(GTK_ENTRY(transition->domainbar), str_domain); | |
177 | + g_free(str_domain); | |
172 | 178 | |
173 | 179 | gtk_tree_view_get_cursor(GTK_TREE_VIEW( |
174 | 180 | transition->acl.listview), &path, &column); |
@@ -28,10 +28,12 @@ | ||
28 | 28 | #include <glib/gi18n.h> |
29 | 29 | |
30 | 30 | #include "gpet.h" |
31 | +#include "conf.h" | |
31 | 32 | |
32 | 33 | typedef struct _search_t { |
33 | 34 | transition_t *tran; |
34 | 35 | GtkWidget *combo; |
36 | + GtkWidget *dialog; | |
35 | 37 | } search_t; |
36 | 38 | |
37 | 39 | #define COMBO_LIST_LIMIT 10 |
@@ -217,14 +219,42 @@ static gint get_current_index(transition_t *transition) | ||
217 | 219 | static void search(transition_t *transition, gboolean forward) |
218 | 220 | { |
219 | 221 | GtkWidget *view = NULL; |
220 | - gint index, count; | |
222 | + gint index, start_index, count; | |
221 | 223 | gchar *str_p = NULL; |
224 | + gchar *haystack = NULL; | |
225 | + gchar *tmp_entry, *entry = NULL; | |
226 | + search_conf_t conf; | |
222 | 227 | |
223 | - index = get_current_index(transition); | |
228 | + if (!S_entry || strcmp(S_entry, "") == 0) | |
229 | + return; | |
230 | + | |
231 | + get_conf_search(&conf); | |
232 | + | |
233 | + tmp_entry = encode_to_octal_str(S_entry); | |
234 | + entry = conf.match ? g_strdup(tmp_entry) : g_ascii_strup(tmp_entry, -1); | |
235 | + g_free(tmp_entry); | |
236 | + | |
237 | + start_index = index = get_current_index(transition); | |
224 | 238 | count = get_list_count(transition); |
225 | - while (S_entry) { | |
226 | - forward ? index++ : index--; | |
227 | - if (index < 0 || count <= index) | |
239 | + while (entry) { | |
240 | + if (forward) { | |
241 | + index++; | |
242 | + if (count <= index) { | |
243 | + if (conf.wrap) | |
244 | + index = 0; | |
245 | + else | |
246 | + break; | |
247 | + } | |
248 | + } else { | |
249 | + index--; | |
250 | + if (index < 0) { | |
251 | + if (conf.wrap) | |
252 | + index = count - 1; | |
253 | + else | |
254 | + break; | |
255 | + } | |
256 | + } | |
257 | + if (index == start_index) | |
228 | 258 | break; |
229 | 259 | |
230 | 260 | switch((int)transition->current_page) { |
@@ -263,18 +293,25 @@ static void search(transition_t *transition, gboolean forward) | ||
263 | 293 | break; |
264 | 294 | } |
265 | 295 | |
266 | - if(g_strrstr(str_p, S_entry)) { | |
296 | + g_free(haystack); | |
297 | + haystack = conf.match ? | |
298 | + g_strdup(str_p) : g_ascii_strup(str_p, -1); | |
299 | + | |
300 | + if (transition->current_page != CCS_SCREEN_DOMAIN_LIST) | |
301 | + g_free(str_p); | |
302 | + | |
303 | + if(g_strrstr(haystack, entry)) { | |
267 | 304 | GtkTreeModel *model; |
268 | 305 | put_locate_index(transition, index); |
269 | 306 | model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); |
270 | 307 | gtk_tree_model_foreach(model, |
271 | 308 | (GtkTreeModelForeachFunc)search_pos_list, transition); |
309 | + g_free(haystack); | |
272 | 310 | break; |
273 | 311 | } |
274 | 312 | } |
275 | 313 | |
276 | - if (transition->current_page != CCS_SCREEN_DOMAIN_LIST) | |
277 | - g_free(str_p); | |
314 | + g_free(entry); | |
278 | 315 | |
279 | 316 | gtk_action_set_sensitive(gtk_action_group_get_action( |
280 | 317 | transition->actions, "SearchBack"), TRUE); |
@@ -298,7 +335,7 @@ static void cb_combo_changed(GtkComboBox *combobox, gpointer nothing) | ||
298 | 335 | } |
299 | 336 | } |
300 | 337 | |
301 | -static void cb_combo_entry_activate(GtkEntry *entry, search_t *srch) | |
338 | +static void cb_search_entry_activate(GtkEntry *entry, search_t *srch) | |
302 | 339 | { |
303 | 340 | GtkComboBox *combobox; |
304 | 341 | gchar *new_text; |
@@ -307,12 +344,13 @@ static void cb_combo_entry_activate(GtkEntry *entry, search_t *srch) | ||
307 | 344 | |
308 | 345 | combobox = GTK_COMBO_BOX(srch->combo); |
309 | 346 | new_text = gtk_combo_box_get_active_text(combobox); |
310 | - if(!new_text || strcmp(new_text, "") == 0) | |
347 | + if (!new_text || strcmp(new_text, "") == 0) { | |
311 | 348 | return; |
349 | + } | |
312 | 350 | |
313 | 351 | g_free(S_entry); |
314 | 352 | S_entry = g_strdup(new_text); |
315 | -// g_print("cb_combo_entry_activate[%s]\n", new_text); | |
353 | +// g_print("cb_search_entry_activate[%s]\n", new_text); | |
316 | 354 | |
317 | 355 | for (list = combolist; list; list = g_list_next(list)) { |
318 | 356 | if (strcmp(new_text, (gchar *)list->data) == 0) { |
@@ -330,20 +368,36 @@ static void cb_combo_entry_activate(GtkEntry *entry, search_t *srch) | ||
330 | 368 | } |
331 | 369 | } |
332 | 370 | |
333 | - if (entry) | |
371 | + if (entry) { | |
372 | + search_conf_t conf; | |
334 | 373 | search(srch->tran, TRUE); |
374 | + get_conf_search(&conf); | |
375 | + if (conf.close) | |
376 | + gtk_dialog_response(GTK_DIALOG(srch->dialog), | |
377 | + GTK_RESPONSE_CLOSE); | |
378 | + } | |
335 | 379 | } |
336 | 380 | |
337 | 381 | static void cb_btn_prev_clicked(GtkButton *widget , search_t *srch) |
338 | 382 | { |
339 | - cb_combo_entry_activate(NULL, srch); | |
383 | + search_conf_t conf; | |
384 | + cb_search_entry_activate(NULL, srch); | |
340 | 385 | search(srch->tran, FALSE); |
386 | + get_conf_search(&conf); | |
387 | + if (conf.close) | |
388 | + gtk_dialog_response(GTK_DIALOG(srch->dialog), | |
389 | + GTK_RESPONSE_CLOSE); | |
341 | 390 | } |
342 | 391 | |
343 | 392 | static void cb_btn_next_clicked(GtkButton *widget , search_t *srch) |
344 | 393 | { |
345 | - cb_combo_entry_activate(NULL, srch); | |
394 | + search_conf_t conf; | |
395 | + cb_search_entry_activate(NULL, srch); | |
346 | 396 | search(srch->tran, TRUE); |
397 | + get_conf_search(&conf); | |
398 | + if (conf.close) | |
399 | + gtk_dialog_response(GTK_DIALOG(srch->dialog), | |
400 | + GTK_RESPONSE_CLOSE); | |
347 | 401 | } |
348 | 402 | /*-------+---------+---------+---------+---------+---------+---------+--------*/ |
349 | 403 | GList *insert_item(GtkComboBox *combobox, |
@@ -389,6 +443,60 @@ static gchar *search_title(transition_t *transition) | ||
389 | 443 | return title; |
390 | 444 | } |
391 | 445 | |
446 | +static void cb_toggled_match(GtkToggleButton *widget, search_conf_t *conf) | |
447 | +{ | |
448 | + conf->match = gtk_toggle_button_get_active(widget); | |
449 | + put_conf_search(conf); | |
450 | +} | |
451 | +static void cb_toggled_wrap(GtkToggleButton *widget, search_conf_t *conf) | |
452 | +{ | |
453 | + conf->wrap = gtk_toggle_button_get_active(widget); | |
454 | + put_conf_search(conf); | |
455 | +} | |
456 | +static void cb_toggled_close(GtkToggleButton *widget, search_conf_t *conf) | |
457 | +{ | |
458 | + conf->close = gtk_toggle_button_get_active(widget); | |
459 | + put_conf_search(conf); | |
460 | +} | |
461 | + | |
462 | +static void create_check_box(GtkWidget *parent, search_conf_t *conf) | |
463 | +{ | |
464 | + GtkWidget *hbox, *vbox_l, *vbox_r; | |
465 | + GtkWidget *match, *wrap, *close; | |
466 | + | |
467 | + hbox = gtk_hbox_new(FALSE, 15); | |
468 | + gtk_box_pack_start(GTK_BOX(parent), hbox, TRUE, TRUE, 10); | |
469 | + | |
470 | + vbox_l = gtk_vbox_new(FALSE, 5); | |
471 | + gtk_box_pack_start(GTK_BOX(hbox), vbox_l, TRUE, FALSE, 0); | |
472 | + vbox_r = gtk_vbox_new(FALSE, 5); | |
473 | + gtk_box_pack_start(GTK_BOX(hbox), vbox_r, TRUE, FALSE, 0); | |
474 | + | |
475 | + match = gtk_check_button_new_with_mnemonic(_("_Match case")); | |
476 | + gtk_box_pack_start(GTK_BOX(vbox_l), match, TRUE, FALSE, 0); | |
477 | + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(match), conf->match); | |
478 | + g_signal_connect(G_OBJECT(match), "toggled", | |
479 | + G_CALLBACK(cb_toggled_match), conf); | |
480 | + | |
481 | + wrap = gtk_check_button_new_with_mnemonic(_("_Wrap around")); | |
482 | + gtk_box_pack_start(GTK_BOX(vbox_l), wrap, TRUE, FALSE, 0); | |
483 | + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wrap), conf->wrap); | |
484 | + g_signal_connect(G_OBJECT(wrap), "toggled", | |
485 | + G_CALLBACK(cb_toggled_wrap), conf); | |
486 | + | |
487 | + close = gtk_check_button_new_with_mnemonic(_("Close _dialog")); | |
488 | + gtk_box_pack_start(GTK_BOX(vbox_r), close, FALSE, FALSE, 0); | |
489 | + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(close), conf->close); | |
490 | + g_signal_connect(G_OBJECT(close), "toggled", | |
491 | + G_CALLBACK(cb_toggled_close), conf); | |
492 | + | |
493 | +/* | |
494 | + 大文字と小文字を区別する (M)atch case | |
495 | + 折返しも対象にする (W)rap around | |
496 | + enterで閉じる Close (d)ialog | |
497 | +*/ | |
498 | +} | |
499 | + | |
392 | 500 | void search_input(GtkAction *action, transition_t *transition) |
393 | 501 | { |
394 | 502 | GtkWidget *dialog, *parent; |
@@ -398,6 +506,7 @@ void search_input(GtkAction *action, transition_t *transition) | ||
398 | 506 | GtkWidget *btn_next, *btn_prev; |
399 | 507 | GList *list; |
400 | 508 | search_t srch; |
509 | + search_conf_t conf; | |
401 | 510 | gint response; |
402 | 511 | |
403 | 512 | parent = (transition->acl_detached && |
@@ -425,10 +534,11 @@ void search_input(GtkAction *action, transition_t *transition) | ||
425 | 534 | entry = gtk_combo_box_entry_new_text(); |
426 | 535 | srch.tran = transition; |
427 | 536 | srch.combo = entry; |
537 | + srch.dialog = dialog; | |
428 | 538 | g_signal_connect(G_OBJECT(entry) , "changed", |
429 | 539 | G_CALLBACK(cb_combo_changed), NULL); |
430 | 540 | g_signal_connect(G_OBJECT(GTK_BIN(entry)->child) , "activate" , |
431 | - G_CALLBACK(cb_combo_entry_activate), &srch); | |
541 | + G_CALLBACK(cb_search_entry_activate), &srch); | |
432 | 542 | gtk_box_pack_start(GTK_BOX(vbox_l), entry, FALSE, FALSE, 0); |
433 | 543 | |
434 | 544 | for (list = combolist; list; list = g_list_next(list)) { |
@@ -437,20 +547,23 @@ void search_input(GtkAction *action, transition_t *transition) | ||
437 | 547 | } |
438 | 548 | gtk_combo_box_set_active(GTK_COMBO_BOX(entry), 0); |
439 | 549 | |
550 | + get_conf_search(&conf); | |
551 | + create_check_box(vbox_l, &conf); | |
552 | + | |
440 | 553 | vbox_r = gtk_vbox_new(FALSE, 5); |
441 | 554 | gtk_box_pack_start(GTK_BOX(hbox), vbox_r, FALSE, FALSE, 0); |
442 | 555 | |
443 | 556 | btn_prev = gtk_button_new_from_stock(GTK_STOCK_GO_BACK); |
444 | - gtk_box_pack_start(GTK_BOX(vbox_r), btn_prev, FALSE, FALSE, 0); | |
557 | + gtk_box_pack_start(GTK_BOX(vbox_r), btn_prev, TRUE, TRUE, 0); | |
445 | 558 | g_signal_connect(G_OBJECT(btn_prev) , "clicked" , |
446 | 559 | G_CALLBACK (cb_btn_prev_clicked) , &srch); |
447 | 560 | |
448 | 561 | btn_next = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); |
449 | - gtk_box_pack_start(GTK_BOX(vbox_r), btn_next, FALSE, FALSE, 0); | |
562 | + gtk_box_pack_start(GTK_BOX(vbox_r), btn_next, TRUE, TRUE, 0); | |
450 | 563 | g_signal_connect(G_OBJECT(btn_next) , "clicked" , |
451 | 564 | G_CALLBACK (cb_btn_next_clicked) , &srch); |
452 | 565 | |
453 | - gtk_widget_set_size_request(dialog, 400, -1); | |
566 | + gtk_widget_set_size_request(dialog, 520, -1); | |
454 | 567 | put_locate_index(transition, get_current_index(transition)); |
455 | 568 | gtk_widget_show_all(dialog); |
456 | 569 |