~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/sp-switch.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Authors:
7
7
 *   Andrius R. <knutux@gmail.com>
 
8
 *   MenTaLguY  <mental@rydia.net>
8
9
 *
9
10
 * Copyright (C) 2006 authors
10
11
 *
21
22
#include "display/nr-arena-group.h"
22
23
#include "conditions.h"
23
24
 
 
25
#include <sigc++/functors/ptr_fun.h>
 
26
#include <sigc++/adaptors/bind.h>
 
27
 
24
28
static void sp_switch_class_init (SPSwitchClass *klass);
25
29
static void sp_switch_init (SPSwitch *group);
26
30
 
60
64
    group->group = new CSwitch(group);
61
65
}
62
66
 
63
 
CSwitch::CSwitch(SPGroup *group) : CGroup(group), _cached_item(NULL), _release_handler_id(0) {
 
67
CSwitch::CSwitch(SPGroup *group) : CGroup(group), _cached_item(NULL) {
64
68
}
65
69
 
66
70
CSwitch::~CSwitch() {
75
79
    return NULL;
76
80
}
77
81
 
78
 
GSList *CSwitch::_childList(bool add_ref, Action action) {
79
 
    if ( ActionGeneral != action ) {
80
 
        return CGroup::_childList(add_ref, action);
 
82
GSList *CSwitch::_childList(bool add_ref, SPObject::Action action) {
 
83
    if ( action != SPObject::ActionGeneral ) {
 
84
        return _group->childList(add_ref, action);
81
85
    }
82
86
 
83
87
    SPObject *child = _evaluateFirst();
111
115
    _reevaluate();
112
116
}
113
117
 
114
 
void CSwitch::_reevaluate(bool add_to_arena) {
 
118
void CSwitch::_reevaluate(bool /*add_to_arena*/) {
115
119
    SPObject *evaluated_child = _evaluateFirst();
116
120
    if (!evaluated_child || _cached_item == evaluated_child) {
117
121
        return;
120
124
    _releaseLastItem(_cached_item);
121
125
 
122
126
    SPItem * child;
123
 
    for ( GSList *l = _childList(false, ActionShow);
 
127
    for ( GSList *l = _childList(false, SPObject::ActionShow);
124
128
            NULL != l ; l = g_slist_remove (l, l->data))
125
129
    {
126
130
        SPObject *o = SP_OBJECT (l->data);
133
137
    }
134
138
 
135
139
    _cached_item = evaluated_child;
136
 
    _release_handler_id = g_signal_connect(
137
 
                                    G_OBJECT(evaluated_child), "release",
138
 
                                    G_CALLBACK(&CSwitch::_releaseItem),
139
 
                                    this);
 
140
    _release_connection = evaluated_child->connectRelease(sigc::bind(sigc::ptr_fun(&CSwitch::_releaseItem), this));
140
141
 
141
142
    _group->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
142
143
}
151
152
    if (NULL == _cached_item || _cached_item != obj)
152
153
        return;
153
154
 
154
 
    g_signal_handler_disconnect(G_OBJECT(_cached_item), _release_handler_id);
155
 
    _release_handler_id = 0;
 
155
    _release_connection.disconnect();
156
156
    _cached_item = NULL;
157
157
}
158
158
 
162
162
    NRArenaItem *ac = NULL;
163
163
    NRArenaItem *ar = NULL;
164
164
    SPItem * child;
165
 
    GSList *l = _childList(false, ActionShow);
 
165
    GSList *l = _childList(false, SPObject::ActionShow);
166
166
    while (l) {
167
167
        SPObject *o = SP_OBJECT (l->data);
168
168
        if (SP_IS_ITEM (o)) {