[280] | 1 | /* rgfiltermanager.cc |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 2000, 2001 Conectiva S/A |
---|
| 4 | * 2002,2003 Michael Vogt <mvo@debian.org> |
---|
| 5 | * |
---|
| 6 | * Author: Alfredo K. Kojima <kojima@conectiva.com.br> |
---|
| 7 | * Michael Vogt <mvo@debian.org> |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License as |
---|
| 11 | * published by the Free Software Foundation; either version 2 of the |
---|
| 12 | * License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 22 | * USA |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include <stdio.h> |
---|
| 27 | #include <cassert> |
---|
| 28 | #include "config.h" |
---|
| 29 | #include "rpackageview.h" |
---|
| 30 | #include "rgfiltermanager.h" |
---|
| 31 | |
---|
| 32 | #include "i18n.h" |
---|
| 33 | |
---|
| 34 | RGFilterManagerWindow::RGFilterManagerWindow(RGWindow *win, |
---|
| 35 | RPackageViewFilter *filterview) |
---|
| 36 | : RGGladeWindow(win, "filters"), _selectedPath(NULL), |
---|
| 37 | _selectedFilter(NULL), _filterview(filterview) |
---|
| 38 | { |
---|
| 39 | setTitle(_("Filters")); |
---|
| 40 | |
---|
| 41 | _busyCursor = gdk_cursor_new(GDK_WATCH); |
---|
| 42 | |
---|
| 43 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 44 | "on_button_filters_add_clicked", |
---|
| 45 | G_CALLBACK(addFilterAction), this); |
---|
| 46 | |
---|
| 47 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 48 | "on_button_filters_remove_clicked", |
---|
| 49 | G_CALLBACK(removeFilterAction), this); |
---|
| 50 | |
---|
| 51 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 52 | "on_button_ok_clicked", |
---|
| 53 | G_CALLBACK(okAction), this); |
---|
| 54 | |
---|
| 55 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 56 | "on_button_cancel_clicked", |
---|
| 57 | G_CALLBACK(cancelAction), this); |
---|
| 58 | |
---|
| 59 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 60 | "on_entry_pattern_text_changed", |
---|
| 61 | G_CALLBACK(patternChanged), this); |
---|
| 62 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 63 | "on_optionmenu_pattern_do_changed", |
---|
| 64 | G_CALLBACK(patternChanged), this); |
---|
| 65 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 66 | "on_optionmenu_pattern_what_changed", |
---|
| 67 | G_CALLBACK(patternChanged), this); |
---|
| 68 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 69 | "on_button_pattern_new_clicked", |
---|
| 70 | G_CALLBACK(patternNew), this); |
---|
| 71 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 72 | "on_button_pattern_delete_clicked", |
---|
| 73 | G_CALLBACK(patternDelete), this); |
---|
| 74 | |
---|
| 75 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 76 | "on_button_status_select_all_clicked", |
---|
| 77 | G_CALLBACK(statusAllClicked), this); |
---|
| 78 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 79 | "on_button_status_select_none_clicked", |
---|
| 80 | G_CALLBACK(statusNoneClicked), this); |
---|
| 81 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 82 | "on_button_status_invert_clicked", |
---|
| 83 | G_CALLBACK(statusInvertClicked), this); |
---|
| 84 | |
---|
| 85 | glade_xml_signal_connect_data(_gladeXML, |
---|
| 86 | "on_entry_filters_changed", |
---|
| 87 | G_CALLBACK(filterNameChanged), this); |
---|
| 88 | |
---|
| 89 | gtk_signal_connect(GTK_OBJECT(_win), "delete_event", |
---|
| 90 | GTK_SIGNAL_FUNC(deleteEventAction), this); |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | _filterDetailsBox = glade_xml_get_widget(_gladeXML, "vbox_filter_details"); |
---|
| 94 | assert(_filterDetailsBox); |
---|
| 95 | |
---|
| 96 | // filter list view |
---|
| 97 | _filterEntry = glade_xml_get_widget(_gladeXML, "entry_filters"); |
---|
| 98 | _filterList = glade_xml_get_widget(_gladeXML, "treeview_filters"); |
---|
| 99 | _filterListStore = gtk_list_store_new(N_COLUMNS, |
---|
| 100 | G_TYPE_STRING, G_TYPE_POINTER); |
---|
| 101 | GtkCellRenderer *renderer; |
---|
| 102 | GtkTreeViewColumn *column; |
---|
| 103 | |
---|
| 104 | renderer = gtk_cell_renderer_text_new(); |
---|
| 105 | //g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); |
---|
| 106 | column = gtk_tree_view_column_new_with_attributes("Name", |
---|
| 107 | renderer, |
---|
| 108 | "text", NAME_COLUMN, |
---|
| 109 | NULL); |
---|
| 110 | gtk_tree_view_append_column(GTK_TREE_VIEW(_filterList), column); |
---|
| 111 | gtk_tree_view_set_model(GTK_TREE_VIEW(_filterList), |
---|
| 112 | GTK_TREE_MODEL(_filterListStore)); |
---|
| 113 | /* Setup the selection handler */ |
---|
| 114 | GtkTreeSelection *select; |
---|
| 115 | select = gtk_tree_view_get_selection(GTK_TREE_VIEW(_filterList)); |
---|
| 116 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
---|
| 117 | g_signal_connect(G_OBJECT(select), "changed", |
---|
| 118 | G_CALLBACK(selectAction), this); |
---|
| 119 | |
---|
| 120 | // section list |
---|
| 121 | const set<string> §ions = _filterview->getSections(); |
---|
| 122 | _sectionList = glade_xml_get_widget(_gladeXML, "treeview_sections"); |
---|
| 123 | _sectionListStore = gtk_list_store_new(SECTION_N_COLUMNS, G_TYPE_STRING); |
---|
| 124 | renderer = gtk_cell_renderer_text_new(); |
---|
| 125 | column = gtk_tree_view_column_new_with_attributes("Name", |
---|
| 126 | renderer, |
---|
| 127 | "text", SECTION_COLUMN, |
---|
| 128 | NULL); |
---|
| 129 | gtk_tree_view_append_column(GTK_TREE_VIEW(_sectionList), column); |
---|
| 130 | gtk_tree_view_set_model(GTK_TREE_VIEW(_sectionList), |
---|
| 131 | GTK_TREE_MODEL(_sectionListStore)); |
---|
| 132 | /* Setup the selection handler */ |
---|
| 133 | select = gtk_tree_view_get_selection(GTK_TREE_VIEW(_sectionList)); |
---|
| 134 | gtk_tree_selection_set_mode(select, GTK_SELECTION_MULTIPLE); |
---|
| 135 | |
---|
| 136 | // fill selections dialog |
---|
| 137 | GtkTreeIter iter; |
---|
| 138 | for (set<string>::iterator I=sections.begin(); I != sections.end(); I++) { |
---|
| 139 | gtk_list_store_append(_sectionListStore, &iter); |
---|
| 140 | gtk_list_store_set(_sectionListStore, &iter, |
---|
| 141 | SECTION_COLUMN, (*I).c_str(), -1); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | // build pkg status dialog |
---|
| 145 | char *s; |
---|
| 146 | for (int i = 0; i < NrOfStatusBits; i++) { |
---|
| 147 | s = g_strdup_printf("checkbutton_status%i", i + 1); |
---|
| 148 | _statusB[i] = glade_xml_get_widget(_gladeXML, s); |
---|
| 149 | //cout << "loaded: " << s << endl; |
---|
| 150 | assert(_statusB[i]); |
---|
| 151 | #ifdef HAVE_RPM // hide debian only boxes |
---|
| 152 | if(i == 9 || i == 10) |
---|
| 153 | gtk_widget_hide(_statusB[i]); |
---|
| 154 | #endif |
---|
| 155 | g_free(s); |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | // pattern stuff |
---|
| 159 | _patternList = glade_xml_get_widget(_gladeXML, "treeview_pattern"); |
---|
| 160 | _patternListStore = gtk_list_store_new(PATTERN_N_COLUMNS, |
---|
| 161 | G_TYPE_STRING, |
---|
| 162 | G_TYPE_STRING, G_TYPE_STRING); |
---|
| 163 | renderer = gtk_cell_renderer_text_new(); |
---|
| 164 | column = gtk_tree_view_column_new_with_attributes(_("Field"), |
---|
| 165 | renderer, |
---|
| 166 | "text", |
---|
| 167 | PATTERN_WHAT_COLUMN, |
---|
| 168 | NULL); |
---|
| 169 | gtk_tree_view_append_column(GTK_TREE_VIEW(_patternList), column); |
---|
| 170 | |
---|
| 171 | column = gtk_tree_view_column_new_with_attributes(_("Operator"), |
---|
| 172 | renderer, |
---|
| 173 | "text", PATTERN_DO_COLUMN, |
---|
| 174 | NULL); |
---|
| 175 | gtk_tree_view_append_column(GTK_TREE_VIEW(_patternList), column); |
---|
| 176 | |
---|
| 177 | renderer = gtk_cell_renderer_text_new(); |
---|
| 178 | //g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); |
---|
| 179 | column = gtk_tree_view_column_new_with_attributes(_("Pattern"), |
---|
| 180 | renderer, |
---|
| 181 | "text", |
---|
| 182 | PATTERN_TEXT_COLUMN, |
---|
| 183 | NULL); |
---|
| 184 | gtk_tree_view_append_column(GTK_TREE_VIEW(_patternList), column); |
---|
| 185 | |
---|
| 186 | gtk_tree_view_set_model(GTK_TREE_VIEW(_patternList), |
---|
| 187 | GTK_TREE_MODEL(_patternListStore)); |
---|
| 188 | select = gtk_tree_view_get_selection(GTK_TREE_VIEW(_patternList)); |
---|
| 189 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
---|
| 190 | g_signal_connect(G_OBJECT(select), "changed", |
---|
| 191 | G_CALLBACK(patternSelectionChanged), this); |
---|
| 192 | |
---|
| 193 | // remove the debtags tab |
---|
| 194 | #ifndef HAVE_DEBTAGS |
---|
| 195 | GtkWidget *notebook = glade_xml_get_widget(_gladeXML, "notebook_details"); |
---|
| 196 | assert(notebook); |
---|
| 197 | //if(first_run) |
---|
| 198 | gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 3); |
---|
| 199 | #endif |
---|
| 200 | |
---|
| 201 | // set the details filter to not sesitive |
---|
| 202 | gtk_widget_set_sensitive(_filterDetailsBox, false); |
---|
| 203 | |
---|
| 204 | skipTaskbar(true); |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | void RGFilterManagerWindow::filterNameChanged(GObject *o, gpointer data) |
---|
| 208 | { |
---|
| 209 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 210 | //cout << "RGFilterManagerWindow::filterNameChanged()"<<endl; |
---|
| 211 | |
---|
| 212 | if (me->_selectedPath == NULL || me->_selectedFilter == NULL) |
---|
| 213 | return; |
---|
| 214 | |
---|
| 215 | const gchar *s = gtk_entry_get_text(GTK_ENTRY(me->_filterEntry)); |
---|
| 216 | // test for empty filtername |
---|
| 217 | if (s == NULL || !strcmp(s, "")) |
---|
| 218 | return; |
---|
| 219 | me->_selectedFilter->setName(s); |
---|
| 220 | |
---|
| 221 | GtkTreeIter iter; |
---|
| 222 | if (gtk_tree_model_get_iter(GTK_TREE_MODEL(me->_filterListStore), &iter, |
---|
| 223 | me->_selectedPath)) { |
---|
| 224 | gtk_list_store_set(me->_filterListStore, &iter, NAME_COLUMN, s, -1); |
---|
| 225 | } |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | void RGFilterManagerWindow::statusInvertClicked(GObject *o, gpointer data) |
---|
| 229 | { |
---|
| 230 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 231 | //cout << "RGFilterManagerWindow::statusInvertClicked()"<<endl; |
---|
| 232 | |
---|
| 233 | gboolean x; |
---|
| 234 | for (int i = 0; i < NrOfStatusBits; i++) { |
---|
| 235 | x = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(me->_statusB[i])); |
---|
| 236 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(me->_statusB[i]), !x); |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | void RGFilterManagerWindow::statusAllClicked(GObject *o, gpointer data) |
---|
| 242 | { |
---|
| 243 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 244 | //cout << "RGFilterManagerWindow::statusAllClicked()"<<endl; |
---|
| 245 | |
---|
| 246 | for (int i = 0; i < NrOfStatusBits; i++) { |
---|
| 247 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(me->_statusB[i]), TRUE); |
---|
| 248 | } |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | void RGFilterManagerWindow::statusNoneClicked(GObject *o, gpointer data) |
---|
| 252 | { |
---|
| 253 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 254 | //cout << "RGFilterManagerWindow::statusNoneClicked()"<<endl; |
---|
| 255 | for (int i = 0; i < NrOfStatusBits; i++) { |
---|
| 256 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(me->_statusB[i]), FALSE); |
---|
| 257 | } |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | void RGFilterManagerWindow::patternNew(GObject *o, gpointer data) |
---|
| 262 | { |
---|
| 263 | //cout << "void RGFilterManagerWindow::patternNew()" << endl; |
---|
| 264 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 265 | |
---|
| 266 | me->setPatternRow(-1, false, (RPatternPackageFilter::DepType) 0, ""); |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | } |
---|
| 270 | |
---|
| 271 | void RGFilterManagerWindow::patternDelete(GObject *o, gpointer data) |
---|
| 272 | { |
---|
| 273 | //cout << "void RGFilterManagerWindow::patternDelete()" << endl; |
---|
| 274 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 275 | |
---|
| 276 | GtkTreeSelection *select; |
---|
| 277 | GtkTreeIter iter; |
---|
| 278 | GtkTreeModel *model; |
---|
| 279 | |
---|
| 280 | select = gtk_tree_view_get_selection(GTK_TREE_VIEW(me->_patternList)); |
---|
| 281 | if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
---|
| 282 | gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | |
---|
| 287 | void RGFilterManagerWindow::patternChanged(GObject *o, gpointer data) |
---|
| 288 | { |
---|
| 289 | RPatternPackageFilter::DepType type; |
---|
| 290 | bool exclude; |
---|
| 291 | int i; |
---|
| 292 | GtkWidget *item, *menu; |
---|
| 293 | |
---|
| 294 | |
---|
| 295 | //cout << "patternChanged" << endl; |
---|
| 296 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 297 | |
---|
| 298 | GtkWidget *w = glade_xml_get_widget(me->_gladeXML, "entry_pattern_text"); |
---|
| 299 | gtk_signal_handler_block_by_func(GTK_OBJECT(w), |
---|
| 300 | GTK_SIGNAL_FUNC(patternChanged), data); |
---|
| 301 | |
---|
| 302 | GtkWidget *menuDo = glade_xml_get_widget(me->_gladeXML, |
---|
| 303 | "optionmenu_pattern_do"); |
---|
| 304 | menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menuDo)); |
---|
| 305 | item = gtk_menu_get_active(GTK_MENU(menu)); |
---|
| 306 | if (strcmp("menuitem_excl", gtk_widget_get_name(item)) == 0) |
---|
| 307 | exclude = true; |
---|
| 308 | else |
---|
| 309 | exclude = false; |
---|
| 310 | |
---|
| 311 | GtkWidget *menuType = glade_xml_get_widget(me->_gladeXML, |
---|
| 312 | "optionmenu_pattern_what"); |
---|
| 313 | menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menuType)); |
---|
| 314 | item = gtk_menu_get_active(GTK_MENU(menu)); |
---|
| 315 | const gchar *name = gtk_widget_get_name(item); |
---|
| 316 | sscanf(name, "menuitem_type%i", &i); |
---|
| 317 | |
---|
| 318 | type = (RPatternPackageFilter::DepType) i; |
---|
| 319 | |
---|
| 320 | GtkWidget *patternEntry = glade_xml_get_widget(me->_gladeXML, |
---|
| 321 | "entry_pattern_text"); |
---|
| 322 | const gchar *str = gtk_entry_get_text(GTK_ENTRY(patternEntry)); |
---|
| 323 | |
---|
| 324 | // get path |
---|
| 325 | GtkTreeSelection *selection; |
---|
| 326 | GtkTreeIter iter; |
---|
| 327 | GtkTreeModel *model; |
---|
| 328 | int *indices; |
---|
| 329 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(me->_patternList)); |
---|
| 330 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) { |
---|
| 331 | GtkTreePath *path; |
---|
| 332 | path = gtk_tree_model_get_path(model, &iter); |
---|
| 333 | indices = gtk_tree_path_get_indices(path); |
---|
| 334 | // set pattern |
---|
| 335 | me->setPatternRow(indices[0], exclude, type, str); |
---|
| 336 | gtk_tree_path_free(path); |
---|
| 337 | } |
---|
| 338 | gtk_signal_handler_unblock_by_func(GTK_OBJECT(w), |
---|
| 339 | GTK_SIGNAL_FUNC(patternChanged), data); |
---|
| 340 | |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | void RGFilterManagerWindow::patternSelectionChanged(GtkTreeSelection * |
---|
| 344 | selection, gpointer data) |
---|
| 345 | { |
---|
| 346 | //cout << "RGFilterManagerWindow::patternSelectionChanged()" << endl; |
---|
| 347 | |
---|
| 348 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 349 | GtkTreeIter iter; |
---|
| 350 | GtkTreeModel *model; |
---|
| 351 | RPatternPackageFilter::DepType type; |
---|
| 352 | bool exclude; |
---|
| 353 | gchar *dopatt, *what, *text; |
---|
| 354 | |
---|
| 355 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) { |
---|
| 356 | gtk_widget_set_sensitive(glade_xml_get_widget |
---|
| 357 | (me->_gladeXML, "hbox_pattern"), TRUE); |
---|
| 358 | gtk_tree_model_get(model, &iter, PATTERN_DO_COLUMN, &dopatt, |
---|
| 359 | PATTERN_WHAT_COLUMN, &what, PATTERN_TEXT_COLUMN, |
---|
| 360 | &text, -1); |
---|
| 361 | |
---|
| 362 | if (strcmp(dopatt, ActOptions[0]) == 0) |
---|
| 363 | exclude = false; |
---|
| 364 | else |
---|
| 365 | exclude = true; |
---|
| 366 | GtkWidget *doPattern = glade_xml_get_widget(me->_gladeXML, |
---|
| 367 | "optionmenu_pattern_do"); |
---|
| 368 | gtk_option_menu_set_history(GTK_OPTION_MENU(doPattern), exclude ? 1 : 0); |
---|
| 369 | |
---|
| 370 | GtkWidget *typePattern = glade_xml_get_widget(me->_gladeXML, |
---|
| 371 | "optionmenu_pattern_what"); |
---|
| 372 | for (int j = 0; DepOptions[j]; j++) { |
---|
| 373 | if (strcmp(what, DepOptions[j]) == 0) { |
---|
| 374 | type = (RPatternPackageFilter::DepType) j; |
---|
| 375 | break; |
---|
| 376 | } |
---|
| 377 | } |
---|
| 378 | gtk_option_menu_set_history(GTK_OPTION_MENU(typePattern), (int)type); |
---|
| 379 | |
---|
| 380 | GtkWidget *patternText = glade_xml_get_widget(me->_gladeXML, |
---|
| 381 | "entry_pattern_text"); |
---|
| 382 | gtk_entry_set_text(GTK_ENTRY(patternText), text); |
---|
| 383 | g_free(dopatt); |
---|
| 384 | g_free(what); |
---|
| 385 | g_free(text); |
---|
| 386 | } else { |
---|
| 387 | gtk_widget_set_sensitive(glade_xml_get_widget |
---|
| 388 | (me->_gladeXML, "hbox_pattern"), FALSE); |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | gint RGFilterManagerWindow::deleteEventAction(GtkWidget *widget, |
---|
| 393 | GdkEvent * event, gpointer data) |
---|
| 394 | { |
---|
| 395 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 396 | me->cancelAction(widget, data); |
---|
| 397 | |
---|
| 398 | return (TRUE); |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | void RGFilterManagerWindow::readFilters() |
---|
| 403 | { |
---|
| 404 | _selectedFilter = NULL; |
---|
| 405 | |
---|
| 406 | vector<string> filters = _filterview->getFilterNames(); |
---|
| 407 | GtkTreeIter iter; |
---|
| 408 | |
---|
| 409 | gtk_list_store_clear(_filterListStore); |
---|
| 410 | |
---|
| 411 | for (unsigned int i = 0; i < filters.size(); i++) { |
---|
| 412 | RFilter *filter = _filterview->findFilter(i); |
---|
| 413 | gtk_list_store_append(_filterListStore, &iter); |
---|
| 414 | gtk_list_store_set(_filterListStore, &iter, |
---|
| 415 | NAME_COLUMN, filter->getName().c_str(), |
---|
| 416 | FILTER_COLUMN, filter, -1); |
---|
| 417 | } |
---|
| 418 | |
---|
| 419 | GtkTreeSelection *selection; |
---|
| 420 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(_filterList)); |
---|
| 421 | if (_selectedPath != NULL) { |
---|
| 422 | gtk_tree_selection_select_path(selection, _selectedPath); |
---|
| 423 | editFilter(); |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | gtk_entry_set_text(GTK_ENTRY(_filterEntry), ""); |
---|
| 427 | |
---|
| 428 | // save filter list (do a real copy, needed for cancel) |
---|
| 429 | _saveFilters.clear(); |
---|
| 430 | for (guint i = 0; i < _filterview->nrOfFilters(); i++) { |
---|
| 431 | RFilter *filter = _filterview->findFilter(i); |
---|
| 432 | _saveFilters.push_back(new RFilter(*filter)); |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | |
---|
| 436 | |
---|
| 437 | RGWindow::show(); |
---|
| 438 | } |
---|
| 439 | |
---|
| 440 | |
---|
| 441 | void RGFilterManagerWindow::selectAction(GtkTreeSelection *selection, |
---|
| 442 | gpointer data) |
---|
| 443 | { |
---|
| 444 | //cout << "selectAction"<<endl; |
---|
| 445 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 446 | GtkTreeIter iter; |
---|
| 447 | GtkTreeModel *model; |
---|
| 448 | RFilter *filter; |
---|
| 449 | gchar *filtername; |
---|
| 450 | |
---|
| 451 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) { |
---|
| 452 | gtk_widget_set_sensitive(me->_filterDetailsBox, true); |
---|
| 453 | |
---|
| 454 | if (me->_selectedPath != NULL) { |
---|
| 455 | applyFilterAction(NULL, me); |
---|
| 456 | gtk_tree_path_free(me->_selectedPath); |
---|
| 457 | } |
---|
| 458 | |
---|
| 459 | gtk_tree_model_get(model, &iter, |
---|
| 460 | NAME_COLUMN, &filtername, FILTER_COLUMN, &filter, -1); |
---|
| 461 | me->_selectedPath = gtk_tree_model_get_path(model, &iter); |
---|
| 462 | //cout << "path is " << gtk_tree_path_to_string(me->_selectedPath) << endl; |
---|
| 463 | me->_selectedFilter = filter; |
---|
| 464 | //cout << "You selected" << filter << endl; |
---|
| 465 | gtk_entry_set_text(GTK_ENTRY(me->_filterEntry), filtername); |
---|
| 466 | g_free(filtername); |
---|
| 467 | |
---|
| 468 | me->editFilter(); |
---|
| 469 | |
---|
| 470 | // make sure that the pattern stuff is only available if something |
---|
| 471 | // is selected in the patternList |
---|
| 472 | GtkTreeSelection *select; |
---|
| 473 | select = gtk_tree_view_get_selection(GTK_TREE_VIEW(me->_patternList)); |
---|
| 474 | gtk_tree_selection_unselect_all(select); |
---|
| 475 | gtk_widget_set_sensitive(glade_xml_get_widget |
---|
| 476 | (me->_gladeXML, "hbox_pattern"), false); |
---|
| 477 | } else { |
---|
| 478 | gtk_widget_set_sensitive(me->_filterDetailsBox, false); |
---|
| 479 | } |
---|
| 480 | } |
---|
| 481 | |
---|
| 482 | |
---|
| 483 | // mvo: helper function |
---|
| 484 | GtkTreePath *RGFilterManagerWindow::treeview_find_path_from_text(GtkTreeModel * |
---|
| 485 | model, |
---|
| 486 | char *text) |
---|
| 487 | { |
---|
| 488 | GtkTreeIter iter; |
---|
| 489 | GtkTreePath *path; |
---|
| 490 | int i = 0; |
---|
| 491 | char *s; |
---|
| 492 | |
---|
| 493 | if (!gtk_tree_model_get_iter_first(model, &iter)) |
---|
| 494 | return NULL; |
---|
| 495 | |
---|
| 496 | do { |
---|
| 497 | gtk_tree_model_get(model, &iter, SECTION_COLUMN, &s, -1); |
---|
| 498 | if (s != NULL) |
---|
| 499 | if (strcmp(s, text) == 0) { |
---|
| 500 | path = gtk_tree_path_new(); |
---|
| 501 | gtk_tree_path_append_index(path, i); |
---|
| 502 | return path; |
---|
| 503 | } |
---|
| 504 | g_free(s); |
---|
| 505 | i++; |
---|
| 506 | } while (gtk_tree_model_iter_next(model, &iter)); |
---|
| 507 | |
---|
| 508 | return NULL; |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | |
---|
| 512 | void RGFilterManagerWindow::setSectionFilter(RSectionPackageFilter & f) |
---|
| 513 | { |
---|
| 514 | //cout << "RGFilterEditor::setSectionFilter()"<<endl; |
---|
| 515 | GtkWidget *treeView; |
---|
| 516 | GtkTreeSelection *selection; |
---|
| 517 | GtkTreeModel *model; |
---|
| 518 | GtkTreePath *path; |
---|
| 519 | string section; |
---|
| 520 | |
---|
| 521 | treeView = glade_xml_get_widget(_gladeXML, "treeview_sections"); |
---|
| 522 | model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeView)); |
---|
| 523 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView)); |
---|
| 524 | gtk_tree_selection_unselect_all(selection); |
---|
| 525 | |
---|
| 526 | for (int i=0; i < f.count(); i++) { |
---|
| 527 | section = f.section(i); |
---|
| 528 | path = treeview_find_path_from_text(model, (char *)section.c_str()); |
---|
| 529 | if (path != NULL) { |
---|
| 530 | gtk_tree_selection_select_path(selection, path); |
---|
| 531 | gtk_tree_path_free(path); |
---|
| 532 | } |
---|
| 533 | } |
---|
| 534 | |
---|
| 535 | GtkWidget *_inclGB = glade_xml_get_widget(_gladeXML, "radiobutton_incl"); |
---|
| 536 | assert(_inclGB); |
---|
| 537 | GtkWidget *_exclGB = glade_xml_get_widget(_gladeXML, "radiobutton_excl"); |
---|
| 538 | assert(_exclGB); |
---|
| 539 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_inclGB), FALSE); |
---|
| 540 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_exclGB), FALSE); |
---|
| 541 | if (f.inclusive()) { |
---|
| 542 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_inclGB), TRUE); |
---|
| 543 | } else { |
---|
| 544 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_exclGB), TRUE); |
---|
| 545 | } |
---|
| 546 | } |
---|
| 547 | |
---|
| 548 | |
---|
| 549 | |
---|
| 550 | void RGFilterManagerWindow::setStatusFilter(RStatusPackageFilter & f) |
---|
| 551 | { |
---|
| 552 | //cout << "RGFilterEditor::setStatusFilter(RStatusPackageFilter &f)"<<endl; |
---|
| 553 | |
---|
| 554 | int i; |
---|
| 555 | int type = f.status(); |
---|
| 556 | |
---|
| 557 | for (i = 0; i < NrOfStatusBits; i++) { |
---|
| 558 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_statusB[i]), |
---|
| 559 | (type & StatusMasks[i]) ? TRUE : FALSE); |
---|
| 560 | } |
---|
| 561 | |
---|
| 562 | } |
---|
| 563 | |
---|
| 564 | bool RGFilterManagerWindow::setPatternRow(int row, |
---|
| 565 | bool exclude, |
---|
| 566 | RPatternPackageFilter::DepType type, |
---|
| 567 | string pattern) |
---|
| 568 | { |
---|
| 569 | GtkTreeIter iter; |
---|
| 570 | char *array[3]; |
---|
| 571 | |
---|
| 572 | array[0] = ActOptions[exclude ? 1 : 0]; |
---|
| 573 | array[1] = DepOptions[(int)type]; |
---|
| 574 | array[2] = (char *)pattern.c_str(); |
---|
| 575 | |
---|
| 576 | if (row < 0) { |
---|
| 577 | gtk_list_store_append(GTK_LIST_STORE(_patternListStore), &iter); |
---|
| 578 | gtk_list_store_set(GTK_LIST_STORE(_patternListStore), &iter, |
---|
| 579 | 0, array[0], 1, _(array[1]), 2, array[2], -1); |
---|
| 580 | GtkTreeSelection *select = |
---|
| 581 | gtk_tree_view_get_selection(GTK_TREE_VIEW(_patternList)); |
---|
| 582 | gtk_tree_selection_select_iter(select, &iter); |
---|
| 583 | } else { |
---|
| 584 | GtkTreePath *path = gtk_tree_path_new(); |
---|
| 585 | gtk_tree_path_prepend_index(path, row); |
---|
| 586 | if (gtk_tree_model_get_iter(GTK_TREE_MODEL(_patternListStore), |
---|
| 587 | &iter, path)) { |
---|
| 588 | gtk_list_store_set(GTK_LIST_STORE(_patternListStore), |
---|
| 589 | &iter, 0, array[0], 1, _(array[1]), 2, |
---|
| 590 | array[2], -1); |
---|
| 591 | } |
---|
| 592 | gtk_tree_path_free(path); |
---|
| 593 | } |
---|
| 594 | |
---|
| 595 | return true; |
---|
| 596 | } |
---|
| 597 | |
---|
| 598 | |
---|
| 599 | void RGFilterManagerWindow::setPatternFilter(RPatternPackageFilter &f) |
---|
| 600 | { |
---|
| 601 | //cout << "RGFilterEditor::setPatternFilter()"<<endl; |
---|
| 602 | |
---|
| 603 | gtk_list_store_clear(_patternListStore); |
---|
| 604 | for (int i = 0; i < f.count(); i++) { |
---|
| 605 | RPatternPackageFilter::DepType type; |
---|
| 606 | string pattern, s; |
---|
| 607 | bool exclude; |
---|
| 608 | f.getPattern(i, type, pattern, exclude); |
---|
| 609 | setPatternRow(-1, exclude, type, utf8(pattern.c_str())); |
---|
| 610 | } |
---|
| 611 | if(f.getAndMode()) |
---|
| 612 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(_gladeXML, "radiobutton_properties_and")), TRUE); |
---|
| 613 | else |
---|
| 614 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(_gladeXML, "radiobutton_properties_or")), TRUE); |
---|
| 615 | } |
---|
| 616 | |
---|
| 617 | void RGFilterManagerWindow::getSectionFilter(RSectionPackageFilter & f) |
---|
| 618 | { |
---|
| 619 | //cout <<"RGFilterEditor::getSectionFilter()"<<endl; |
---|
| 620 | GtkTreeSelection *selection; |
---|
| 621 | GtkTreeIter iter; |
---|
| 622 | char *text; |
---|
| 623 | GList *list; |
---|
| 624 | |
---|
| 625 | GtkWidget *w = glade_xml_get_widget(_gladeXML, "radiobutton_incl"); |
---|
| 626 | assert(w); |
---|
| 627 | int inclusive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
---|
| 628 | f.setInclusive(inclusive == TRUE); |
---|
| 629 | f.clear(); |
---|
| 630 | |
---|
| 631 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(_sectionList)); |
---|
| 632 | list = gtk_tree_selection_get_selected_rows(selection, NULL); |
---|
| 633 | |
---|
| 634 | while (list) { |
---|
| 635 | if (gtk_tree_model_get_iter(GTK_TREE_MODEL(_sectionListStore), |
---|
| 636 | &iter, (GtkTreePath *) list->data)) { |
---|
| 637 | gtk_tree_model_get(GTK_TREE_MODEL(_sectionListStore), &iter, |
---|
| 638 | SECTION_COLUMN, &text, -1); |
---|
| 639 | f.addSection(string(text)); |
---|
| 640 | g_free(text); |
---|
| 641 | } |
---|
| 642 | list = g_list_next(list); |
---|
| 643 | } |
---|
| 644 | // free the list |
---|
| 645 | g_list_foreach(list, (void (*)(void *, void *))gtk_tree_path_free, NULL); |
---|
| 646 | g_list_free(list); |
---|
| 647 | } |
---|
| 648 | |
---|
| 649 | void RGFilterManagerWindow::getStatusFilter(RStatusPackageFilter & f) |
---|
| 650 | { |
---|
| 651 | //cout <<"RGFilterEditor::getStatusFilter()"<<endl; |
---|
| 652 | |
---|
| 653 | int i; |
---|
| 654 | int type = 0; |
---|
| 655 | for (i = 0; i < NrOfStatusBits; i++) { |
---|
| 656 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(_statusB[i]))) |
---|
| 657 | type |= StatusMasks[i]; |
---|
| 658 | } |
---|
| 659 | f.setStatus(type); |
---|
| 660 | } |
---|
| 661 | |
---|
| 662 | |
---|
| 663 | void RGFilterManagerWindow::getPatternFilter(RPatternPackageFilter &f) |
---|
| 664 | { |
---|
| 665 | GtkTreeIter iter; |
---|
| 666 | bool exclude; |
---|
| 667 | string pattern; |
---|
| 668 | RPatternPackageFilter::DepType type; |
---|
| 669 | gchar *dopatt, *what, *text; |
---|
| 670 | |
---|
| 671 | //cout << "RGFilterEditor::getPatternFilter()"<<endl; |
---|
| 672 | f.reset(); |
---|
| 673 | |
---|
| 674 | bool valid = |
---|
| 675 | gtk_tree_model_get_iter_first(GTK_TREE_MODEL(_patternListStore), |
---|
| 676 | &iter); |
---|
| 677 | while (valid) { |
---|
| 678 | /* Walk through the list, reading each row */ |
---|
| 679 | gtk_tree_model_get(GTK_TREE_MODEL(_patternListStore), |
---|
| 680 | &iter, |
---|
| 681 | PATTERN_DO_COLUMN, &dopatt, |
---|
| 682 | PATTERN_WHAT_COLUMN, &what, |
---|
| 683 | PATTERN_TEXT_COLUMN, &text, -1); |
---|
| 684 | // first look at the "act" code |
---|
| 685 | if (strcmp(dopatt, ActOptions[0]) == 0) |
---|
| 686 | exclude = false; |
---|
| 687 | else |
---|
| 688 | exclude = true; |
---|
| 689 | |
---|
| 690 | // then check the options |
---|
| 691 | for (int j = 0; DepOptions[j]; j++) { |
---|
| 692 | if (strcmp(what, _(DepOptions[j])) == 0) { |
---|
| 693 | type = (RPatternPackageFilter::DepType) j; |
---|
| 694 | break; |
---|
| 695 | } |
---|
| 696 | } |
---|
| 697 | // then do the pattern (we convert the text to locale to support |
---|
| 698 | // translated descriptions) |
---|
| 699 | f.addPattern(type, utf8_to_locale(text), exclude); |
---|
| 700 | |
---|
| 701 | valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(_patternListStore), |
---|
| 702 | &iter); |
---|
| 703 | g_free(dopatt); |
---|
| 704 | g_free(what); |
---|
| 705 | g_free(text); |
---|
| 706 | } |
---|
| 707 | |
---|
| 708 | f.setAndMode(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(_gladeXML, "radiobutton_properties_and")))); |
---|
| 709 | |
---|
| 710 | } |
---|
| 711 | |
---|
| 712 | void RGFilterManagerWindow::editFilter() |
---|
| 713 | { |
---|
| 714 | if (_selectedFilter != NULL) |
---|
| 715 | editFilter(_selectedFilter); |
---|
| 716 | } |
---|
| 717 | |
---|
| 718 | // set the filter setting |
---|
| 719 | void RGFilterManagerWindow::editFilter(RFilter *filter) |
---|
| 720 | { |
---|
| 721 | //cout << "void RGFilterManagerWindow::editFilter()" << endl; |
---|
| 722 | |
---|
| 723 | setSectionFilter(filter->section); |
---|
| 724 | setStatusFilter(filter->status); |
---|
| 725 | setPatternFilter(filter->pattern); |
---|
| 726 | } |
---|
| 727 | |
---|
| 728 | |
---|
| 729 | void RGFilterManagerWindow::applyChanges(RFilter *filter) |
---|
| 730 | { |
---|
| 731 | getSectionFilter(filter->section); |
---|
| 732 | getStatusFilter(filter->status); |
---|
| 733 | getPatternFilter(filter->pattern); |
---|
| 734 | } |
---|
| 735 | |
---|
| 736 | |
---|
| 737 | void RGFilterManagerWindow::addFilterAction(GtkWidget *self, void *data) |
---|
| 738 | { |
---|
| 739 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 740 | RFilter *filter; |
---|
| 741 | int i = 1; |
---|
| 742 | gchar *s; |
---|
| 743 | |
---|
| 744 | //cout << "void RGFilterManagerWindow::addFilterAction()" << endl; |
---|
| 745 | |
---|
| 746 | do { |
---|
| 747 | // no memleak, register filter takes care of it |
---|
| 748 | filter = new RFilter(); |
---|
| 749 | s = g_strdup_printf(_("New Filter %i"), i); |
---|
| 750 | filter->setName(s); |
---|
| 751 | g_free(s); |
---|
| 752 | i++; |
---|
| 753 | } while (!me->_filterview->registerFilter(filter)); |
---|
| 754 | |
---|
| 755 | GtkTreeIter iter; |
---|
| 756 | gtk_list_store_append(me->_filterListStore, &iter); |
---|
| 757 | gtk_list_store_set(me->_filterListStore, &iter, |
---|
| 758 | NAME_COLUMN, filter->getName().c_str(), |
---|
| 759 | FILTER_COLUMN, filter, -1); |
---|
| 760 | GtkTreeSelection *selection; |
---|
| 761 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(me->_filterList)); |
---|
| 762 | gtk_tree_selection_select_iter(selection, &iter); |
---|
| 763 | me->_selectedPath = |
---|
| 764 | gtk_tree_model_get_path(GTK_TREE_MODEL(me->_filterListStore), &iter); |
---|
| 765 | me->_selectedFilter = filter; |
---|
| 766 | |
---|
| 767 | me->editFilter(); |
---|
| 768 | } |
---|
| 769 | |
---|
| 770 | |
---|
| 771 | |
---|
| 772 | void RGFilterManagerWindow::applyFilterAction(GtkWidget *self, void *data) |
---|
| 773 | { |
---|
| 774 | |
---|
| 775 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 776 | |
---|
| 777 | GtkTreeIter iter; |
---|
| 778 | RFilter *filter; |
---|
| 779 | //cout << "void RGFilterManagerWindow::applyFilterAction()"<<endl; |
---|
| 780 | if (me->_selectedPath == NULL) { |
---|
| 781 | //cout << "_selctedPath == NULL" << endl; |
---|
| 782 | return; |
---|
| 783 | } |
---|
| 784 | if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(me->_filterListStore), |
---|
| 785 | &iter, me->_selectedPath)) { |
---|
| 786 | //cout << "applyFilterAction(): get_iter()==false" << endl; |
---|
| 787 | return; |
---|
| 788 | } |
---|
| 789 | gtk_tree_model_get(GTK_TREE_MODEL(me->_filterListStore), &iter, |
---|
| 790 | FILTER_COLUMN, &filter, -1); |
---|
| 791 | if (filter == NULL) { |
---|
| 792 | cout << "filter == NULL" << endl; |
---|
| 793 | return; |
---|
| 794 | } |
---|
| 795 | me->applyChanges(filter); |
---|
| 796 | } |
---|
| 797 | |
---|
| 798 | |
---|
| 799 | |
---|
| 800 | void RGFilterManagerWindow::removeFilterAction(GtkWidget *self, void *data) |
---|
| 801 | { |
---|
| 802 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 803 | GtkTreeIter iter; |
---|
| 804 | RFilter *filter; |
---|
| 805 | |
---|
| 806 | //cout << "void RGFilterManagerWindow::removeFilterAction()" << endl; |
---|
| 807 | |
---|
| 808 | if (me->_selectedPath == NULL) |
---|
| 809 | return; |
---|
| 810 | |
---|
| 811 | gtk_tree_model_get_iter(GTK_TREE_MODEL(me->_filterListStore), |
---|
| 812 | &iter, me->_selectedPath); |
---|
| 813 | gtk_tree_model_get(GTK_TREE_MODEL(me->_filterListStore), &iter, |
---|
| 814 | FILTER_COLUMN, &filter, -1); |
---|
| 815 | if (filter) { |
---|
| 816 | me->_filterview->unregisterFilter(filter); |
---|
| 817 | delete filter; |
---|
| 818 | gtk_list_store_remove(me->_filterListStore, &iter); |
---|
| 819 | me->_selectedPath = NULL; |
---|
| 820 | } |
---|
| 821 | } |
---|
| 822 | |
---|
| 823 | |
---|
| 824 | |
---|
| 825 | void RGFilterManagerWindow::cancelAction(GtkWidget *self, void *data) |
---|
| 826 | { |
---|
| 827 | unsigned int i; |
---|
| 828 | |
---|
| 829 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 830 | //cout << "void RGFilterManagerWindow::cancelAction()"<<endl; |
---|
| 831 | |
---|
| 832 | // unregister all old filters |
---|
| 833 | guint size = me->_filterview->nrOfFilters(); |
---|
| 834 | for (i = 0; i < size; i++) { |
---|
| 835 | RFilter *filter = me->_filterview->findFilter(0); |
---|
| 836 | me->_filterview->unregisterFilter(filter); |
---|
| 837 | delete filter; |
---|
| 838 | } |
---|
| 839 | |
---|
| 840 | // restore the old filters |
---|
| 841 | for (i = 0; i < me->_saveFilters.size(); i++) |
---|
| 842 | me->_filterview->registerFilter(me->_saveFilters[i]); |
---|
| 843 | |
---|
| 844 | me->close(); |
---|
| 845 | } |
---|
| 846 | |
---|
| 847 | void RGFilterManagerWindow::okAction(GtkWidget *self, void *data) |
---|
| 848 | { |
---|
| 849 | RGFilterManagerWindow *me = (RGFilterManagerWindow *) data; |
---|
| 850 | //cout << "void RGFilterManagerWindow::okAction()"<<endl; |
---|
| 851 | |
---|
| 852 | me->applyFilterAction(self, data); |
---|
| 853 | me->_filterview->storeFilters(); |
---|
| 854 | me->close(); |
---|
| 855 | } |
---|
| 856 | |
---|
| 857 | |
---|
| 858 | |
---|
| 859 | |
---|
| 860 | |
---|
| 861 | |
---|