Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2007-07-20 13:23:19 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2007-07-20 13:23:19 (GMT)
commitcb1b1546df981d4e3f0fbc4e4e1dacb64090a473 (patch)
tree246fdeb687b230df7ed526f21c93dcc1a288e5b7 /shell/ev-view.c
parent479ac9953cc364161b7ec1541e6234223079d988 (diff)
Update region for current selected items also for checkbox buttons, since
2007-07-20 Carlos Garcia Campos <carlosgc@gnome.org> * shell/ev-view.c: (ev_view_form_field_button_create_widget): Update region for current selected items also for checkbox buttons, since they can behave as radio buttons when they are in a set. svn path=/trunk/; revision=2576
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index d02d885..7432171 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -1642,55 +1642,47 @@ ev_view_form_field_button_create_widget (EvView *view,
switch (field_button->type) {
case EV_FORM_FIELD_BUTTON_PUSH:
return NULL;
- case EV_FORM_FIELD_BUTTON_CHECK: {
- gboolean state;
-
- field_region = ev_view_form_field_get_region (view, field);
-
- state = ev_document_forms_form_field_button_get_state (EV_DOCUMENT_FORMS (view->document),
- field);
- ev_document_forms_form_field_button_set_state (EV_DOCUMENT_FORMS (view->document),
- field, !state);
- }
- break;
-
+ case EV_FORM_FIELD_BUTTON_CHECK:
case EV_FORM_FIELD_BUTTON_RADIO: {
gboolean state;
GList *forms_mapping, *l;
state = ev_document_forms_form_field_button_get_state (EV_DOCUMENT_FORMS (view->document),
field);
- if (state && field_button->state)
+
+ /* FIXME: it actually depends on NoToggleToOff flags */
+ if (field_button->type == EV_FORM_FIELD_BUTTON_RADIO &&
+ state && field_button->state)
return NULL;
field_region = ev_view_form_field_get_region (view, field);
- /* For radio buttons we need to update also the region for the
- * current selected item
+ /* For radio buttons and checkbox buttons that are in a set
+ * we need to update also the region for the current selected item
*/
forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
field->page);
for (l = forms_mapping; l; l = g_list_next (l)) {
- EvFormField *radio = ((EvFormFieldMapping *)(l->data))->field;
- GdkRegion *radio_region;
+ EvFormField *button = ((EvFormFieldMapping *)(l->data))->field;
+ GdkRegion *button_region;
- if (radio->id == field->id)
+ if (button->id == field->id)
continue;
/* FIXME: only buttons in the same group should be updated */
- if (!EV_IS_FORM_FIELD_BUTTON (radio) ||
- EV_FORM_FIELD_BUTTON (radio)->type != EV_FORM_FIELD_BUTTON_RADIO ||
- EV_FORM_FIELD_BUTTON (radio)->state != TRUE)
+ if (!EV_IS_FORM_FIELD_BUTTON (button) ||
+ EV_FORM_FIELD_BUTTON (button)->type != field_button->type ||
+ EV_FORM_FIELD_BUTTON (button)->state != TRUE)
continue;
- radio_region = ev_view_form_field_get_region (view, radio);
- gdk_region_union (field_region, radio_region);
- gdk_region_destroy (radio_region);
+ button_region = ev_view_form_field_get_region (view, button);
+ gdk_region_union (field_region, button_region);
+ gdk_region_destroy (button_region);
}
ev_document_forms_form_field_button_set_state (EV_DOCUMENT_FORMS (view->document),
- field, TRUE);
- field_button->state = TRUE;
+ field, !state);
+ field_button->state = !state;
}
break;
}