PROP_MODEL
};
+static void
+gtk_sheet_set_row_geometry (GtkSheet *sheet, GSheetRow *geo)
+{
+ if ( sheet->row_geometry ) g_object_unref (sheet->row_geometry);
+
+ sheet->row_geometry = geo;
+
+ if ( sheet->row_geometry ) g_object_ref (sheet->row_geometry);
+}
+
+static void
+gtk_sheet_set_column_geometry (GtkSheet *sheet, GSheetColumn *geo)
+{
+ if ( sheet->column_geometry ) g_object_unref (sheet->column_geometry);
+
+ sheet->column_geometry = geo;
+
+ if ( sheet->column_geometry ) g_object_ref (sheet->column_geometry);
+}
+
+
static void
gtk_sheet_set_property (GObject *object,
guint prop_id,
switch (prop_id)
{
case PROP_ROW_GEO:
- sheet->row_geometry = g_value_get_pointer (value);
+ gtk_sheet_set_row_geometry (sheet, g_value_get_pointer (value));
break;
case PROP_COL_GEO:
- sheet->column_geometry = g_value_get_pointer (value);
+ gtk_sheet_set_column_geometry (sheet, g_value_get_pointer (value));
if ( sheet->column_geometry)
g_signal_connect (sheet->column_geometry, "columns_changed",
G_CALLBACK (column_titles_changed), sheet);
static void
gtk_sheet_init (GtkSheet *sheet)
{
+ sheet->model = NULL;
sheet->column_geometry = NULL;
sheet->row_geometry = NULL;
if ( model)
{
+ g_object_ref (model);
+
g_signal_connect (model, "range_changed",
G_CALLBACK (range_update_callback), sheet);
}
static void
-gtk_sheet_dispose (GObject * object)
+gtk_sheet_dispose (GObject *object)
{
GtkSheet *sheet = GTK_SHEET (object);
GList *children;
if ( sheet->dispose_has_run )
return ;
- if (sheet->model) g_object_unref (sheet->model);
sheet->dispose_has_run = TRUE;
+ if (sheet->model) g_object_unref (sheet->model);
+ if (sheet->row_geometry) g_object_unref (sheet->row_geometry);
+ if (sheet->column_geometry) g_object_unref (sheet->column_geometry);
+
g_object_unref (sheet->entry_container);
g_object_unref (sheet->button);
GDK_GC_FUNCTION |
GDK_GC_SUBWINDOW);
+
gtk_widget_set_parent_window (sheet->entry_widget, sheet->sheet_window);
gtk_widget_set_parent (sheet->entry_widget, GTK_WIDGET (sheet));
sheet->fg_gc = NULL;
sheet->bg_gc = NULL;
+ gtk_widget_unparent (sheet->entry_widget);
+ gtk_widget_unparent (sheet->button);
+
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
if (GTK_SHEET_IS_FROZEN (sheet)) return;
- row = ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + CELL_SPACING);
- if (!sheet->column_titles_visible)
- row = ROW_FROM_YPIXEL (sheet, CELL_SPACING);
+ row = ROW_FROM_YPIXEL (sheet, CELL_SPACING);
old_value = - sheet->voffset;
if (GTK_SHEET_IS_FROZEN (sheet)) return;
- column = COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + CELL_SPACING);
- if (!sheet->row_titles_visible)
- column = COLUMN_FROM_XPIXEL (sheet, CELL_SPACING);
+ column = COLUMN_FROM_XPIXEL (sheet, CELL_SPACING);
old_value = - sheet->hoffset;
gpointer data)
{
GtkSheet *sheet = GTK_SHEET (data);
+ if ( ! GTK_WIDGET_REALIZED (GTK_WIDGET (sheet)))
+ return;
+
gtk_sheet_real_unselect_range (sheet, NULL);
}