1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * gnm-sheet-slicer-combo.c: Model for in cell combo for data slicers
5 * Copyright (C) Jody Goldberg <jody@gnome.org>
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.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
21 #include <gnumeric-config.h>
23 #include "gnm-sheet-slicer-combo.h"
24 #include "go-data-slicer-field.h"
25 #include "widgets/gnm-cell-combo-view.h"
26 #include "widgets/gnm-sheet-slicer-combo-view.h"
28 #include <gsf/gsf-impl-utils.h>
35 static GObjectClass
*gssc_parent_klass
;
38 gnm_sheet_slicer_combo_finalize (GObject
*object
)
41 GnmSheetSlicerCombo
*sscombo
= GNM_SHEET_SLICER_COMBO (object
);
44 gssc_parent_klass
->finalize (object
);
48 gnm_sheet_slicer_combo_init (SheetObject
*so
)
52 static SheetObjectView
*
53 gnm_sheet_slicer_combo_foo_view_new (SheetObject
*so
, SheetObjectViewContainer
*container
)
55 return gnm_cell_combo_view_new (so
,
56 gnm_sheet_slicer_combo_view_get_type (), container
);
60 gnm_sheet_slicer_combo_set_property (GObject
*obj
, guint property_id
,
61 GValue
const *value
, GParamSpec
*pspec
)
63 GnmSheetSlicerCombo
*sscombo
= (GnmSheetSlicerCombo
*)obj
;
65 switch (property_id
) {
67 sscombo
->dsf
= g_value_get_object (value
);
70 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj
, property_id
, pspec
);
75 gnm_sheet_slicer_combo_get_property (GObject
*obj
, guint property_id
,
76 GValue
*value
, GParamSpec
*pspec
)
78 GnmSheetSlicerCombo
const *sscombo
= (GnmSheetSlicerCombo
const *)obj
;
79 switch (property_id
) {
81 g_value_set_object (value
, (GObject
*) (sscombo
->dsf
));
84 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj
, property_id
, pspec
);
89 gnm_sheet_slicer_combo_class_init (GObjectClass
*gobject_class
)
91 SheetObjectClass
*so_class
= GNM_SO_CLASS (gobject_class
);
93 gssc_parent_klass
= g_type_class_peek_parent (gobject_class
);
95 gobject_class
->set_property
= gnm_sheet_slicer_combo_set_property
;
96 gobject_class
->get_property
= gnm_sheet_slicer_combo_get_property
;
97 gobject_class
->finalize
= gnm_sheet_slicer_combo_finalize
;
98 so_class
->new_view
= gnm_sheet_slicer_combo_foo_view_new
;
100 g_object_class_install_property (gobject_class
, PROP_FIELD
,
101 g_param_spec_object ("field", NULL
, NULL
, GO_DATA_SLICER_FIELD_TYPE
,
102 GSF_PARAM_STATIC
| G_PARAM_READWRITE
));
105 typedef GnmCellComboClass GnmSheetSlicerComboClass
;
106 GSF_CLASS (GnmSheetSlicerCombo
, gnm_sheet_slicer_combo
,
107 gnm_sheet_slicer_combo_class_init
, gnm_sheet_slicer_combo_init
,
108 gnm_cell_combo_get_type ())