Commit 89aa026e authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

define G_OBJECT_GET_CLASS to simplify porting to 2.0

2001-12-24  Jody Goldberg <jody@gnome.org>

	* src/gnumeric.h : define G_OBJECT_GET_CLASS to simplify porting to 2.0

	For Yukihiro Nakai  <nakai@gnome.gr.jp>
	* src/stf-parse.c (stf_parse_is_valid_data) : check for multi-byte
	  before using locale specific isprint.
parent 406b416a
2001-12-24 Jody Goldberg <jody@gnome.org>
* src/gnumeric.h : define G_OBJECT_GET_CLASS to simplify porting to 2.0
For Yukihiro Nakai <nakai@gnome.gr.jp>
* src/stf-parse.c (stf_parse_is_valid_data) : check for multi-byte
before using locale specific isprint.
2001-12-24 Jody Goldberg <jody@gnome.org> 2001-12-24 Jody Goldberg <jody@gnome.org>
* src/style-condition.c (style_condition_expr_eval) : mark as needing * src/style-condition.c (style_condition_expr_eval) : mark as needing
......
2001-12-24 Jody Goldberg <jody@gnome.org>
* src/gnumeric.h : define G_OBJECT_GET_CLASS to simplify porting to 2.0
For Yukihiro Nakai <nakai@gnome.gr.jp>
* src/stf-parse.c (stf_parse_is_valid_data) : check for multi-byte
before using locale specific isprint.
2001-12-24 Jody Goldberg <jody@gnome.org> 2001-12-24 Jody Goldberg <jody@gnome.org>
* src/style-condition.c (style_condition_expr_eval) : mark as needing * src/style-condition.c (style_condition_expr_eval) : mark as needing
......
2001-12-24 Jody Goldberg <jody@gnome.org>
* src/gnumeric.h : define G_OBJECT_GET_CLASS to simplify porting to 2.0
For Yukihiro Nakai <nakai@gnome.gr.jp>
* src/stf-parse.c (stf_parse_is_valid_data) : check for multi-byte
before using locale specific isprint.
2001-12-24 Jody Goldberg <jody@gnome.org> 2001-12-24 Jody Goldberg <jody@gnome.org>
* src/style-condition.c (style_condition_expr_eval) : mark as needing * src/style-condition.c (style_condition_expr_eval) : mark as needing
......
2001-12-24 Jody Goldberg <jody@gnome.org>
* src/gnumeric.h : define G_OBJECT_GET_CLASS to simplify porting to 2.0
For Yukihiro Nakai <nakai@gnome.gr.jp>
* src/stf-parse.c (stf_parse_is_valid_data) : check for multi-byte
before using locale specific isprint.
2001-12-24 Jody Goldberg <jody@gnome.org> 2001-12-24 Jody Goldberg <jody@gnome.org>
* src/style-condition.c (style_condition_expr_eval) : mark as needing * src/style-condition.c (style_condition_expr_eval) : mark as needing
......
2001-12-24 Jody Goldberg <jody@gnome.org>
* boot.c (xbase_field_as_value) : be more picky about parsing dates.
The spec states that they must be in this format.
2001-12-15 Jody Goldberg <jody@gnome.org> 2001-12-15 Jody Goldberg <jody@gnome.org>
* Release 0.99.0 * Release 0.99.0
......
...@@ -108,7 +108,7 @@ xbase_field_as_value (guint8 *content, XBfield *field) ...@@ -108,7 +108,7 @@ xbase_field_as_value (guint8 *content, XBfield *field)
case 'D': { case 'D': {
/* double check that the date is stored according to spec */ /* double check that the date is stored according to spec */
int year, month, day; int year, month, day;
if (sscanf (s, "%4d%2d%2d", &year, &month, &day)) { if (sscanf (s, "%4d%2d%2d", &year, &month, &day) == 3) {
GDate *date = g_date_new_dmy (day, month, year); GDate *date = g_date_new_dmy (day, month, year);
val = value_new_int (datetime_g_to_serial (date)); val = value_new_int (datetime_g_to_serial (date));
g_date_free (date); g_date_free (date);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <gal/util/e-util.h> #include <gal/util/e-util.h>
#include <libgnome/gnome-i18n.h> #include <libgnome/gnome-i18n.h>
#define CC_CLASS(o) COMMAND_CONTEXT_CLASS (GTK_OBJECT (o)->klass) #define CC_CLASS(o) COMMAND_CONTEXT_CLASS (G_OBJECT_GET_CLASS (o))
/** /**
* command_context_format_message: * command_context_format_message:
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
#define GNUMERIC_COMMAND_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GNUMERIC_COMMAND_TYPE, GnumericCommandClass)) #define GNUMERIC_COMMAND_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GNUMERIC_COMMAND_TYPE, GnumericCommandClass))
#define IS_GNUMERIC_COMMAND(o) (GTK_CHECK_TYPE ((o), GNUMERIC_COMMAND_TYPE)) #define IS_GNUMERIC_COMMAND(o) (GTK_CHECK_TYPE ((o), GNUMERIC_COMMAND_TYPE))
#define IS_GNUMERIC_COMMAND_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GNUMERIC_COMMAND_TYPE)) #define IS_GNUMERIC_COMMAND_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GNUMERIC_COMMAND_TYPE))
#define CMD_CLASS(o) (GNUMERIC_COMMAND_CLASS (cmd->parent.klass))
typedef struct typedef struct
{ {
...@@ -280,7 +281,7 @@ command_undo (WorkbookControl *wbc) ...@@ -280,7 +281,7 @@ command_undo (WorkbookControl *wbc)
cmd = GNUMERIC_COMMAND (wb->undo_commands->data); cmd = GNUMERIC_COMMAND (wb->undo_commands->data);
g_return_if_fail (cmd != NULL); g_return_if_fail (cmd != NULL);
klass = GNUMERIC_COMMAND_CLASS (cmd->parent.klass); klass = CMD_CLASS (cmd);
g_return_if_fail (klass != NULL); g_return_if_fail (klass != NULL);
/* TRUE indicates a failure to undo. Leave the command where it is */ /* TRUE indicates a failure to undo. Leave the command where it is */
...@@ -321,7 +322,7 @@ command_redo (WorkbookControl *wbc) ...@@ -321,7 +322,7 @@ command_redo (WorkbookControl *wbc)
cmd = GNUMERIC_COMMAND (wb->redo_commands->data); cmd = GNUMERIC_COMMAND (wb->redo_commands->data);
g_return_if_fail (cmd != NULL); g_return_if_fail (cmd != NULL);
klass = GNUMERIC_COMMAND_CLASS (cmd->parent.klass); klass = CMD_CLASS (cmd);
g_return_if_fail (klass != NULL); g_return_if_fail (klass != NULL);
/* TRUE indicates a failure to redo. Leave the command where it is */ /* TRUE indicates a failure to redo. Leave the command where it is */
...@@ -533,7 +534,7 @@ command_push_undo (WorkbookControl *wbc, GtkObject *obj) ...@@ -533,7 +534,7 @@ command_push_undo (WorkbookControl *wbc, GtkObject *obj)
cmd = GNUMERIC_COMMAND (obj); cmd = GNUMERIC_COMMAND (obj);
g_return_val_if_fail (cmd != NULL, TRUE); g_return_val_if_fail (cmd != NULL, TRUE);
klass = GNUMERIC_COMMAND_CLASS (cmd->parent.klass); klass = CMD_CLASS (cmd);
g_return_val_if_fail (klass != NULL, TRUE); g_return_val_if_fail (klass != NULL, TRUE);
/* TRUE indicates a failure to do the command */ /* TRUE indicates a failure to do the command */
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#define PARENT_TYPE (gtk_object_get_type ()) #define PARENT_TYPE (gtk_object_get_type ())
#define ACC(o) (COMPLETE_CLASS (GTK_OBJECT (o)->klass)) #define ACC(o) (COMPLETE_CLASS (G_OBJECT_GET_CLASS (o)))
static GtkObjectClass *parent_class; static GtkObjectClass *parent_class;
......
...@@ -2019,12 +2019,14 @@ static void ...@@ -2019,12 +2019,14 @@ static void
validation_rebuild_validation (FormatState *state) validation_rebuild_validation (FormatState *state)
{ {
StyleCondition *sc = NULL; StyleCondition *sc = NULL;
int constraint = gnumeric_option_menu_get_selected_index (state->validation.constraint_type); int constraint;
if (!state->enable_edit) if (!state->enable_edit)
return; return;
state->validation.changed = FALSE; state->validation.changed = FALSE;
constraint = gnumeric_option_menu_get_selected_index (
state->validation.constraint_type);
if (constraint != 0) { if (constraint != 0) {
StyleCondition *scl = NULL; StyleCondition *scl = NULL;
int operator = gnumeric_option_menu_get_selected_index (state->validation.operator); int operator = gnumeric_option_menu_get_selected_index (state->validation.operator);
...@@ -2087,10 +2089,10 @@ validation_rebuild_validation (FormatState *state) ...@@ -2087,10 +2089,10 @@ validation_rebuild_validation (FormatState *state)
g_free (msg); g_free (msg);
g_free (title); g_free (title);
} else { } else {
if (mstyle_is_element_set (state->result, MSTYLE_VALIDATION)) if (!mstyle_is_element_set (state->result, MSTYLE_VALIDATION))
return;
mstyle_unset_element (state->result, MSTYLE_VALIDATION); mstyle_unset_element (state->result, MSTYLE_VALIDATION);
} }
fmt_dialog_changed (state); fmt_dialog_changed (state);
} }
...@@ -2489,8 +2491,10 @@ cb_fmt_dialog_set_focus (GtkWidget *window, GtkWidget *focus_widget, ...@@ -2489,8 +2491,10 @@ cb_fmt_dialog_set_focus (GtkWidget *window, GtkWidget *focus_widget,
GNUMERIC_EXPR_ENTRY (focus_widget)); GNUMERIC_EXPR_ENTRY (focus_widget));
flags = GNUM_EE_ABS_ROW | GNUM_EE_ABS_COL | GNUM_EE_SHEET_OPTIONAL; flags = GNUM_EE_ABS_ROW | GNUM_EE_ABS_COL | GNUM_EE_SHEET_OPTIONAL;
gnumeric_expr_entry_set_flags (state->validation.bound1.entry, flags, flags); gnumeric_expr_entry_set_flags (state->validation.bound1.entry,
gnumeric_expr_entry_set_flags (state->validation.bound2.entry, flags, flags); flags, flags | GNUM_EE_SINGLE_RANGE);
gnumeric_expr_entry_set_flags (state->validation.bound2.entry,
flags, flags | GNUM_EE_SINGLE_RANGE);
} else } else
wbcg_set_entry (state->wbcg, NULL); wbcg_set_entry (state->wbcg, NULL);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define IS_GNUM_FILE_OPENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_GNUM_FILE_OPENER)) #define IS_GNUM_FILE_OPENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_GNUM_FILE_OPENER))
#define GNUM_FILE_OPENER_METHOD(obj,name) \ #define GNUM_FILE_OPENER_METHOD(obj,name) \
((GNUM_FILE_OPENER_CLASS (GTK_OBJECT (obj)->klass))->name) ((GNUM_FILE_OPENER_CLASS (G_OBJECT_GET_CLASS (obj)))->name)
struct _GnumFileOpenerClass { struct _GnumFileOpenerClass {
GtkObjectClass parent_class; GtkObjectClass parent_class;
...@@ -45,7 +45,7 @@ void gnum_file_opener_setup (GnumFileOpener *fo, const gchar *id, ...@@ -45,7 +45,7 @@ void gnum_file_opener_setup (GnumFileOpener *fo, const gchar *id,
#define IS_GNUM_FILE_SAVER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_GNUM_FILE_SAVER)) #define IS_GNUM_FILE_SAVER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_GNUM_FILE_SAVER))
#define GNUM_FILE_SAVER_METHOD(obj,name) \ #define GNUM_FILE_SAVER_METHOD(obj,name) \
((GNUM_FILE_SAVER_CLASS (GTK_OBJECT (obj)->klass))->name) ((GNUM_FILE_SAVER_CLASS (G_OBJECT_GET_CLASS (obj)))->name)
struct _GnumFileSaverClass { struct _GnumFileSaverClass {
GtkObjectClass parent_class; GtkObjectClass parent_class;
......
...@@ -125,4 +125,7 @@ typedef enum _SpanCalcFlags { ...@@ -125,4 +125,7 @@ typedef enum _SpanCalcFlags {
typedef struct _SearchReplace SearchReplace; typedef struct _SearchReplace SearchReplace;
/* simplify porting to gtk-2 */
#define G_OBJECT_GET_CLASS(obj) (GTK_OBJECT(obj)->klass)
#endif /* GNUMERIC_H */ #endif /* GNUMERIC_H */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <gal/util/e-util.h> #include <gal/util/e-util.h>
#define PARENT_TYPE (gtk_object_get_type ()) #define PARENT_TYPE (gtk_object_get_type ())
#define PL_GET_CLASS(loader) GNUMERIC_PLUGIN_LOADER_CLASS (GTK_OBJECT (loader)->klass) #define PL_GET_CLASS(loader) GNUMERIC_PLUGIN_LOADER_CLASS (G_OBJECT_GET_CLASS (loader))
void gnumeric_plugin_loader_unload_service_general_real (GnumericPluginLoader *loader, void gnumeric_plugin_loader_unload_service_general_real (GnumericPluginLoader *loader,
PluginService *service, PluginService *service,
......
...@@ -1516,7 +1516,7 @@ scg_cursor_visible (SheetControlGUI *scg, gboolean is_visible) ...@@ -1516,7 +1516,7 @@ scg_cursor_visible (SheetControlGUI *scg, gboolean is_visible)
/***************************************************************************/ /***************************************************************************/
#define SO_CLASS(so) SHEET_OBJECT_CLASS(GTK_OBJECT(so)->klass) #define SO_CLASS(so) SHEET_OBJECT_CLASS (G_OBJECT_GET_CLASS(so))
static void static void
scg_object_stop_editing (SheetControlGUI *scg, SheetObject *so) scg_object_stop_editing (SheetControlGUI *scg, SheetObject *so)
...@@ -1635,7 +1635,7 @@ display_object_menu (SheetObject *so, GnomeCanvasItem *view, GdkEvent *event) ...@@ -1635,7 +1635,7 @@ display_object_menu (SheetObject *so, GnomeCanvasItem *view, GdkEvent *event)
scg_mode_edit_object (scg, so); scg_mode_edit_object (scg, so);
menu = GTK_MENU (gtk_menu_new ()); menu = GTK_MENU (gtk_menu_new ());
SHEET_OBJECT_CLASS (GTK_OBJECT(so)->klass)->populate_menu (so, GTK_OBJECT (view), menu); SHEET_OBJECT_CLASS (G_OBJECT_GET_CLASS(so))->populate_menu (so, GTK_OBJECT (view), menu);
gtk_widget_show_all (GTK_WIDGET (menu)); gtk_widget_show_all (GTK_WIDGET (menu));
gnumeric_popup_menu (menu, &event->button); gnumeric_popup_menu (menu, &event->button);
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
static SheetObjectClass *sheet_object_bonobo_parent_class; static SheetObjectClass *sheet_object_bonobo_parent_class;
#define SOB_CLASS(o) SHEET_OBJECT_CLASS (GTK_OBJECT (o)->klass) #define SOB_CLASS(o) SHEET_OBJECT_CLASS (G_OBJECT_GET_CLASS (o))
static void static void
sheet_object_bonobo_destroy (GtkObject *object) sheet_object_bonobo_destroy (GtkObject *object)
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#define SHEET_OBJECT_WIDGET(obj) (GTK_CHECK_CAST((obj), SHEET_OBJECT_WIDGET_TYPE, SheetObjectWidget)) #define SHEET_OBJECT_WIDGET(obj) (GTK_CHECK_CAST((obj), SHEET_OBJECT_WIDGET_TYPE, SheetObjectWidget))
#define SHEET_OBJECT_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SHEET_OBJECT_WIDGET_TYPE, SheetObjectWidgetClass)) #define SHEET_OBJECT_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SHEET_OBJECT_WIDGET_TYPE, SheetObjectWidgetClass))
#define IS_SHEET_WIDGET_OBJECT(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_WIDGET_TYPE)) #define IS_SHEET_WIDGET_OBJECT(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_WIDGET_TYPE))
#define SOW_CLASS(so) (SHEET_OBJECT_WIDGET_CLASS (GTK_OBJECT(so)->klass)) #define SOW_CLASS(so) (SHEET_OBJECT_WIDGET_CLASS (G_OBJECT_GET_CLASS(so)))
#define SOW_MAKE_TYPE(n1, n2, fn_config, fn_set_sheet, fn_clear_sheet,\ #define SOW_MAKE_TYPE(n1, n2, fn_config, fn_set_sheet, fn_clear_sheet,\
fn_clone, fn_write_xml, fn_read_xml) \ fn_clone, fn_write_xml, fn_read_xml) \
......
...@@ -30,12 +30,11 @@ ...@@ -30,12 +30,11 @@
#include <gal/util/e-util.h> #include <gal/util/e-util.h>
/* Returns the class for a SheetObject */ /* Returns the class for a SheetObject */
#define SO_CLASS(so) SHEET_OBJECT_CLASS(GTK_OBJECT(so)->klass) #define SO_CLASS(so) SHEET_OBJECT_CLASS(G_OBJECT_GET_CLASS(so))
#define SO_VIEW_SHEET_CONTROL_KEY "SheetControl" #define SO_VIEW_SHEET_CONTROL_KEY "SheetControl"
#define SO_VIEW_OBJECT_KEY "SheetObject" #define SO_VIEW_OBJECT_KEY "SheetObject"
GtkType sheet_object_get_type (void);
static GtkObjectClass *sheet_object_parent_class; static GtkObjectClass *sheet_object_parent_class;
static void static void
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "clipboard.h" #include "clipboard.h"
#include <ctype.h> #include <ctype.h>
#include <wctype.h>
#include <stdlib.h>
#define WARN_TOO_MANY_ROWS _("Too many rows in data to parse: %d") #define WARN_TOO_MANY_ROWS _("Too many rows in data to parse: %d")
#define WARN_TOO_MANY_COLS _("Too many columns in data to parse: %d") #define WARN_TOO_MANY_COLS _("Too many columns in data to parse: %d")
...@@ -860,10 +862,24 @@ char const * ...@@ -860,10 +862,24 @@ char const *
stf_parse_is_valid_data (char const *data) stf_parse_is_valid_data (char const *data)
{ {
unsigned char const *s; unsigned char const *s;
wchar_t wstr;
int len;
for (s = data; *s != '\0'; s++) for (s = data; *s != '\0';) {
len = mblen(s, MB_CUR_MAX);
if (len == -1)
return (char *)s;
if (len > 1) {
if (mbstowcs (&wstr, s, 1) == 1 &&
!iswprint (wstr) && !iswspace (wstr))
return (char *)s;
s += len;
} else {
if (!isprint (*s) && !isspace (*s)) if (!isprint (*s) && !isspace (*s))
return (char *)s; return (char *)s;
s++;
}
}
return NULL; return NULL;
} }
......
...@@ -521,7 +521,7 @@ cb_scg_destroy (SheetControlGUI *scg, GnumericExprEntry *expr_entry) ...@@ -521,7 +521,7 @@ cb_scg_destroy (SheetControlGUI *scg, GnumericExprEntry *expr_entry)
* %GNUM_EE_ABS_ROW Row reference must be absolute. * %GNUM_EE_ABS_ROW Row reference must be absolute.
* %GNUM_EE_FULL_COL Range consists of full columns. * %GNUM_EE_FULL_COL Range consists of full columns.
* %GNUM_EE_FULL_ROW Range consists of full rows. * %GNUM_EE_FULL_ROW Range consists of full rows.
* %GNUM_EE_SHEET_OPTIONAL Sheet must not be displayed if current sheet. * %GNUM_EE_SHEET_OPTIONAL Current sheet name not auto-added.
**/ **/
void void
gnumeric_expr_entry_set_flags (GnumericExprEntry *ee, gnumeric_expr_entry_set_flags (GnumericExprEntry *ee,
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "workbook-control-priv.h" #include "workbook-control-priv.h"
#include <gal/util/e-util.h> #include <gal/util/e-util.h>
#define CCG_CLASS(o) CMD_CONTEXT_CORBA_CLASS (GTK_OBJECT (o)->klass) #define CCG_CLASS(o) CMD_CONTEXT_CORBA_CLASS (G_OBJECT_GET_CLASS (o))
typedef struct { typedef struct {
WorkbookControl parent; WorkbookControl parent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment