2 * gnm-sheet-slicer-combo.c: Model for in cell combo for data slicers
4 * Copyright (C) Jody Goldberg <jody@gnome.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
20 #include <gnumeric-config.h>
22 #include <gnm-sheet-slicer-combo.h>
23 #include <go-data-slicer-field.h>
24 #include <widgets/gnm-cell-combo-view.h>
25 #include <widgets/gnm-sheet-slicer-combo-view.h>
27 #include <gsf/gsf-impl-utils.h>
34 static GObjectClass
*gssc_parent_klass
;
37 gnm_sheet_slicer_combo_finalize (GObject
*object
)
40 GnmSheetSlicerCombo
*sscombo
= GNM_SHEET_SLICER_COMBO (object
);
43 gssc_parent_klass
->finalize (object
);
47 gnm_sheet_slicer_combo_init (SheetObject
*so
)
51 static SheetObjectView
*
52 gnm_sheet_slicer_combo_foo_view_new (SheetObject
*so
, SheetObjectViewContainer
*container
)
54 return gnm_cell_combo_view_new (so
,
55 gnm_sheet_slicer_combo_view_get_type (), container
);
59 gnm_sheet_slicer_combo_set_property (GObject
*obj
, guint property_id
,
60 GValue
const *value
, GParamSpec
*pspec
)
62 GnmSheetSlicerCombo
*sscombo
= (GnmSheetSlicerCombo
*)obj
;
64 switch (property_id
) {
66 sscombo
->dsf
= g_value_get_object (value
);
69 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj
, property_id
, pspec
);
74 gnm_sheet_slicer_combo_get_property (GObject
*obj
, guint property_id
,
75 GValue
*value
, GParamSpec
*pspec
)
77 GnmSheetSlicerCombo
const *sscombo
= (GnmSheetSlicerCombo
const *)obj
;
78 switch (property_id
) {
80 g_value_set_object (value
, (GObject
*) (sscombo
->dsf
));
83 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj
, property_id
, pspec
);
88 gnm_sheet_slicer_combo_class_init (GObjectClass
*gobject_class
)
90 SheetObjectClass
*so_class
= GNM_SO_CLASS (gobject_class
);
92 gssc_parent_klass
= g_type_class_peek_parent (gobject_class
);
94 gobject_class
->set_property
= gnm_sheet_slicer_combo_set_property
;
95 gobject_class
->get_property
= gnm_sheet_slicer_combo_get_property
;
96 gobject_class
->finalize
= gnm_sheet_slicer_combo_finalize
;
97 so_class
->new_view
= gnm_sheet_slicer_combo_foo_view_new
;
99 g_object_class_install_property (gobject_class
, PROP_FIELD
,
100 g_param_spec_object ("field", NULL
, NULL
, GO_DATA_SLICER_FIELD_TYPE
,
101 GSF_PARAM_STATIC
| G_PARAM_READWRITE
));
104 typedef GnmCellComboClass GnmSheetSlicerComboClass
;
105 GSF_CLASS (GnmSheetSlicerCombo
, gnm_sheet_slicer_combo
,
106 gnm_sheet_slicer_combo_class_init
, gnm_sheet_slicer_combo_init
,
107 gnm_cell_combo_get_type ())