~ubuntu-branches/ubuntu/quantal/gnumeric/quantal

« back to all changes in this revision

Viewing changes to src/gnm-cell-combo.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2009-06-22 13:37:20 UTC
  • mfrom: (1.1.20 upstream) (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090622133720-rtdazsiz2lx5q8l7
Tags: 1.9.9-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Promoted gnumeric-doc to Recommends in gnumeric package for help to be
    installed automatically
  - gnumeric-gtk is a transitional package
  - gnumeric conflicts with gnumeric-gtk << 1.8.3-3ubuntu1
  - call initltool-update in po*
  - remove psiconv support (psiconv is in universe):
    o debian/control: remove B-D on libpsiconv-dev
    o debian/rules: don't pass --with-psiconv to ./configure
    o debian/gnumeric-plugins-extra.install: don't install the psiconv
      plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
/*
 
3
 * gnm-cell-combo.c: Base class the models of in cell combos (e.g. validation and sheetslicer)
 
4
 *
 
5
 * Copyright (C) Jody Goldberg <jody@gnome.org>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
20
 */
 
21
 
 
22
#include <gnumeric-config.h>
 
23
#include "gnumeric.h"
 
24
#include "gnm-cell-combo.h"
 
25
#include "sheet-view.h"
 
26
 
 
27
#include <gsf/gsf-impl-utils.h>
 
28
 
 
29
enum {
 
30
        PROP_0,
 
31
        PROP_SV,
 
32
};
 
33
 
 
34
static void
 
35
gnm_cell_combo_finalize (GObject *object)
 
36
{
 
37
        GnmCellCombo *ccombo = GNM_CELL_COMBO (object);
 
38
        GObjectClass *parent;
 
39
 
 
40
        if (NULL != ccombo->sv) {
 
41
                sv_weak_unref (&ccombo->sv);
 
42
                ccombo->sv = NULL;
 
43
        }
 
44
        parent = g_type_class_peek (SHEET_OBJECT_TYPE);
 
45
        parent->finalize (object);
 
46
}
 
47
 
 
48
static void
 
49
gnm_cell_combo_set_property (GObject *obj, guint property_id,
 
50
                                   GValue const *value, GParamSpec *pspec)
 
51
{
 
52
        GnmCellCombo *ccombo = (GnmCellCombo *)obj;
 
53
 
 
54
        switch (property_id) {
 
55
        case PROP_SV : {
 
56
                SheetView *sv = g_value_get_object (value);
 
57
                sv_weak_ref (ccombo->sv = sv, &ccombo->sv);
 
58
                break;
 
59
        }
 
60
 
 
61
        default:
 
62
                G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
 
63
        }
 
64
}
 
65
 
 
66
static void
 
67
gnm_cell_combo_get_property (GObject *obj, guint property_id,
 
68
                             GValue *value, GParamSpec *pspec)
 
69
{
 
70
        GnmCellCombo const *ccombo = (GnmCellCombo const *)obj;
 
71
 
 
72
        switch (property_id) {
 
73
        case PROP_SV : g_value_set_object (value, ccombo->sv); break;
 
74
        default:
 
75
                G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
 
76
        }
 
77
}
 
78
 
 
79
static void
 
80
gnm_cell_combo_init (SheetObject *so)
 
81
{
 
82
        /* keep the arrows from wandering with their cells */
 
83
        so->flags &= ~SHEET_OBJECT_MOVE_WITH_CELLS;
 
84
}
 
85
 
 
86
static void
 
87
gnm_cell_combo_class_init (GObjectClass *gobject_class)
 
88
{
 
89
        SheetObjectClass *so_class = SHEET_OBJECT_CLASS (gobject_class);
 
90
        gobject_class->finalize         = gnm_cell_combo_finalize;
 
91
        gobject_class->get_property     = gnm_cell_combo_get_property;
 
92
        gobject_class->set_property     = gnm_cell_combo_set_property;
 
93
        so_class->read_xml_dom          = NULL;
 
94
        so_class->write_xml_sax         = NULL;
 
95
        so_class->prep_sax_parser       = NULL;
 
96
        so_class->copy                  = NULL;
 
97
 
 
98
        g_object_class_install_property (gobject_class, PROP_SV,
 
99
                 g_param_spec_object ("sheet-view", NULL, NULL,
 
100
                        SHEET_VIEW_TYPE, GSF_PARAM_STATIC | G_PARAM_READWRITE));
 
101
}
 
102
 
 
103
GSF_CLASS_ABSTRACT (GnmCellCombo, gnm_cell_combo,
 
104
                    gnm_cell_combo_class_init, gnm_cell_combo_init,
 
105
                    SHEET_OBJECT_TYPE)
 
106