Commit f7e6a0be authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Handle *.123

2004-10-21  Jody Goldberg <jody@gnome.org>

	* plugin.xml.in : Handle *.123

2004-10-29  Jody Goldberg <jody@gnome.org>

	* src/gnumeric-gconf.c (gnm_conf_init_extras) : typos in the broken
	  gconf case

2004-10-29  Jody Goldberg <jody@gnome.org>

	* src/format.c (append_hour) : be XL compat

2004-10-29  Jody Goldberg <jody@gnome.org>

	* src/file-autoft.c : clean up the handling of translations
	* src/format-template.c (format_template_new) : Name should be
	  translatable, not translated.

2004-10-29  Jody Goldberg <jody@gnome.org>

	* src/application.c (gnm_action_new) : new
	(gnm_action_free) : ditto
	(gnm_app_add_extra_ui) : ditto
	(gnm_app_remove_extra_ui) : ditto
	(gnm_app_foreach_extra_ui) : ditto

	* configure.in : enable the sample ui plugin
	* plugins/Makefile.am : ditto
	* plugins/python-loader/boot.c : ditto
	* plugins/python-loader/py-console.c : ditto
	* plugins/python-loader/python-loader.c : ditto

2004-10-27  Jody Goldberg <jody@gnome.org>

	* src/plugin-service.c : enable the ui service.
	* plugins/gnome-db/plugin-gnomedb.c : Use the new interface for the ui
	  plugin

	* src/sheet-object-graph.c (sheet_object_graph_default_size) : be
	  cheesy.  We're setting the bounds in so many places before this is
	  called that it's not safe to use the defaults from GogRenderer.  Not
	  a huge loss, those were pretty arbitrary.

2004-10-26  Jody Goldberg <jody@gnome.org>

	* src/libgnumeric.c (gnm_pre_parse_init) : Set the default
	  datadir/libdir based on the packge for WIN32
parent ba5a0a79
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/gnumeric-gconf.c (gnm_conf_init_extras) : typos in the broken
gconf case
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/format.c (append_hour) : be XL compat
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/file-autoft.c : clean up the handling of translations
* src/format-template.c (format_template_new) : Name should be
translatable, not translated.
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/application.c (gnm_action_new) : new
(gnm_action_free) : ditto
(gnm_app_add_extra_ui) : ditto
(gnm_app_remove_extra_ui) : ditto
(gnm_app_foreach_extra_ui) : ditto
* configure.in : enable the sample ui plugin
* plugins/Makefile.am : ditto
* plugins/python-loader/boot.c : ditto
* plugins/python-loader/py-console.c : ditto
* plugins/python-loader/python-loader.c : ditto
2004-10-27 Jody Goldberg <jody@gnome.org>
* src/plugin-service.c : enable the ui service.
* plugins/gnome-db/plugin-gnomedb.c : Use the new interface for the ui
plugin
* src/sheet-object-graph.c (sheet_object_graph_default_size) : be
cheesy. We're setting the bounds in so many places before this is
called that it's not safe to use the defaults from GogRenderer. Not
a huge loss, those were pretty arbitrary.
2004-10-26 Jody Goldberg <jody@gnome.org>
* src/libgnumeric.c (gnm_pre_parse_init) : Set the default
datadir/libdir based on the packge for WIN32
2004-10-28 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
* plugins/excel/ms-chart.c (BC_R): handle dash_type property.
......
......@@ -34,6 +34,10 @@ Jody:
* Basic handling for XL 'Forms' Objects
* Fix handling of empty arguments in nested expressions
* Delay gnome-print init to decrease startup time
* Improve OOo import for styles
* Some support for newer Lotus-123 formats
* Translate autoformat categories and descriptions
* Re-enable the ui plugin service
Morten:
* Implement Edit->Select->Input. [#154735]
......
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/gnumeric-gconf.c (gnm_conf_init_extras) : typos in the broken
gconf case
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/format.c (append_hour) : be XL compat
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/file-autoft.c : clean up the handling of translations
* src/format-template.c (format_template_new) : Name should be
translatable, not translated.
2004-10-29 Jody Goldberg <jody@gnome.org>
* src/application.c (gnm_action_new) : new
(gnm_action_free) : ditto
(gnm_app_add_extra_ui) : ditto
(gnm_app_remove_extra_ui) : ditto
(gnm_app_foreach_extra_ui) : ditto
* configure.in : enable the sample ui plugin
* plugins/Makefile.am : ditto
* plugins/python-loader/boot.c : ditto
* plugins/python-loader/py-console.c : ditto
* plugins/python-loader/python-loader.c : ditto
2004-10-27 Jody Goldberg <jody@gnome.org>
* src/plugin-service.c : enable the ui service.
* plugins/gnome-db/plugin-gnomedb.c : Use the new interface for the ui
plugin
* src/sheet-object-graph.c (sheet_object_graph_default_size) : be
cheesy. We're setting the bounds in so many places before this is
called that it's not safe to use the defaults from GogRenderer. Not
a huge loss, those were pretty arbitrary.
2004-10-26 Jody Goldberg <jody@gnome.org>
* src/libgnumeric.c (gnm_pre_parse_init) : Set the default
datadir/libdir based on the packge for WIN32
2004-10-28 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
* plugins/excel/ms-chart.c (BC_R): handle dash_type property.
......
......@@ -873,6 +873,7 @@ gnumeric_version="${VERSION}"
gnumeric_prefix='${prefix}'
gnumeric_exec_prefix='${exec_prefix}'
gnumeric_sysconfdir='${sysconfdir}'
dnl These are changed in libgnumeric.c for WIN32 packages
gnumeric_datadir='${datadir}/gnumeric/${gnumeric_version}'
gnumeric_libdir='${libdir}/gnumeric/${gnumeric_version}'
gnumeric_plugindir='${gnumeric_libdir}/plugins'
......@@ -1008,6 +1009,7 @@ plugins/psiconv/Makefile
plugins/mps/Makefile
plugins/sample_datasource/Makefile
plugins/paradox/Makefile
plugins/uihello/Makefile
po/Makefile.in
schemas/Makefile
templates/Makefile
......
......@@ -77,8 +77,7 @@ SUBDIRS_LOADERS = $(PYTHON_LOADER_DIR) $(CORBA_DIR)
SUBDIRS_DATA_SOURCES = sample_datasource
SUBDIRS_EXAMPLES = $(GNOME_GLOSSARY_DIR) $(PYFUNC_DIR)
# SUBDIRS_EXAMPLES += uiplugins
SUBDIRS_EXAMPLES = $(GNOME_GLOSSARY_DIR) $(PYFUNC_DIR) uihello
## Don't put comment on an assignment line! It can trigger an automake bug.
if PLUGIN_LIST_GIVEN
......
#include <gnumeric-config.h>
#include <glib/gi18n.h>
#include <glib.h>
......@@ -11,7 +10,7 @@
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
static void
view_data_sources (WorkbookControlGUI *wbcg)
view_data_sources (GnmAction const *action, WorkbookControl *wbc)
{
char *argv[2];
......@@ -21,12 +20,12 @@ view_data_sources (WorkbookControlGUI *wbcg)
if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL))
gnumeric_notice (wbcg_toplevel (wbcg),
gnumeric_notice (wbcg_toplevel (WORKBOOK_CONTROL_GUI (wbcg)),
GTK_MESSAGE_INFO,
_("Could not run GNOME database configuration tool"));
}
const ModulePluginUIVerbInfo gnome_db_ui_verbs[] = {
ModulePluginUIActions const gnome_db_ui_actions[] = {
{"ViewDataSources", view_data_sources},
{NULL}
};
2004-10-21 Jody Goldberg <jody@gnome.org>
* plugin.xml.in : Handle *.123
2004-10-05 Jody Goldberg <jody@gnome.org>
* Release 1.3.91
......
......@@ -34,14 +34,25 @@ void lotus_file_open (GnmFileOpener const *fo, IOContext *io_context,
gboolean
lotus_file_probe (GnmFileOpener const *fo, GsfInput *input, FileProbeLevel pl)
{
char const *header = NULL;
char const *h = NULL;
if (!gsf_input_seek (input, 0, G_SEEK_SET))
header = gsf_input_read (input, 4, NULL);
return header != NULL &&
header[0] == (LOTUS_BOF & 0xff) &&
header[1] == ((LOTUS_BOF >> 8) & 0xff) &&
header[2] == (2 & 0xff) &&
header[3] == ((2 >> 8) & 0xff);
h = gsf_input_read (input, 6, NULL);
if (h == NULL &&
GSF_LE_GET_GUINT16 (h+0) != LOTUS_BOF)
return FALSE;
/* wk1 and wks */
if (GSF_LE_GET_GUINT16 (h+2) == 2 &&
(GSF_LE_GET_GUINT8 (h+4) == 4 || GSF_LE_GET_GUINT8 (h+4) == 6) &&
GSF_LE_GET_GUINT8 (h+5) == 4)
return TRUE;
/* 123 */
if (GSF_LE_GET_GUINT8 (h+3) == 0 &&
GSF_LE_GET_GUINT8 (h+4) == 3 &&
GSF_LE_GET_GUINT8 (h+5) == 0x10)
return TRUE;
return FALSE;
}
void
......@@ -57,7 +68,7 @@ lotus_file_open (GnmFileOpener const *fo, IOContext *io_context,
state.sheet = NULL;
state.converter = g_iconv_open ("UTF-8", "ISO-8859-1");
if (!lotus_wk1_read (&state))
if (!lotus_read (&state))
gnumeric_io_error_string (io_context,
_("Error while reading lotus workbook."));
......
......@@ -215,9 +215,8 @@ attach_sheet (Workbook *wb, int idx)
return sheet;
}
/* buf was old siag wb / sheet */
gboolean
lotus_wk1_read (LotusWk1Read *state)
lotus_read (LotusWk1Read *state)
{
gboolean result = TRUE;
int sheetidx = 0;
......
......@@ -14,6 +14,6 @@ typedef struct {
} LotusWk1Read;
GnmValue *lotus_new_string (LotusWk1Read *state, gchar const *data);
gboolean lotus_wk1_read (LotusWk1Read *state);
gboolean lotus_read (LotusWk1Read *state);
#endif
......@@ -10,11 +10,12 @@
<services>
<service type="file_opener" id="lotus" priority="50" probe="TRUE">
<information>
<_description>Lotus 123 (*.wk1, *.wks)</_description>
<_description>Lotus 123 (*.wk1, *.wks, *.123)</_description>
</information>
<suffixes>
<suffix>wk1</suffix>
<suffix>wks</suffix>
<suffix>123</suffix>
</suffixes>
</service>
</services>
......
......@@ -25,9 +25,9 @@ python_get_loader_type (ErrorInfo **ret_error)
return TYPE_GNM_PLUGIN_LOADER_PYTHON;
}
const ModulePluginUIVerbInfo console_ui_verbs[] = {
{"ShowConsole", show_python_console},
{NULL}
ModulePluginUIActions const console_ui_actions[] = {
{ "ShowConsole", show_python_console },
{ NULL }
};
void
......
......@@ -137,7 +137,7 @@ cb_clear (GtkButton *button, gpointer data)
}
void
show_python_console (WorkbookControlGUI *wbcg)
show_python_console (GnmAction const *action, WorkbookControl *wbc)
{
GtkWidget *vbox, *sc_win, *hbox, *sel, *cline, *w;
GtkTextIter enditer;
......@@ -151,7 +151,7 @@ show_python_console (WorkbookControlGUI *wbcg)
sel = gnm_py_interpreter_selector_new (&err);
if (err != NULL) {
gnm_cmd_context_error_info (GNM_CMD_CONTEXT (wbcg), err);
gnm_cmd_context_error_info (GNM_CMD_CONTEXT (wbc), err);
error_info_free (err);
return;
}
......
#ifndef PLUGIN_PY_CONSOLE_H
#define PLUGIN_PY_CONSOLE_H
#include <workbook-control-gui.h>
#include <application.h>
void show_python_console (WorkbookControlGUI *wbcg);
void show_python_console (GnmAction const *action, WorkbookControl *wbc);
#endif /* PLUGIN_PY_CONSOLE_H */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* python-loader.c: Support for Python plugins.
*
......@@ -211,9 +212,7 @@ gplp_class_init (GObjectClass *gobject_class)
loader_class->load_service_file_saver = gplp_load_service_file_saver;
loader_class->load_service_function_group = gplp_load_service_function_group;
loader_class->unload_service_function_group = gplp_unload_service_function_group;
#ifdef WITH_BONOBO
loader_class->load_service_ui = gplp_load_service_ui;
#endif
}
PLUGIN_CLASS (GnmPluginLoaderPython, gnm_plugin_loader_python,
......@@ -705,48 +704,43 @@ gplp_unload_service_function_group (GnmPluginLoader *loader,
Py_DECREF (loader_data->python_fn_info_dict);
}
#ifdef WITH_BONOBO
typedef struct {
PyObject *ui_verbs;
PyObject *ui_actions;
} ServiceLoaderDataUI;
static void
gplp_loader_data_ui_free (ServiceLoaderDataUI *loader_data)
{
Py_DECREF (loader_data->ui_verbs);
Py_DECREF (loader_data->ui_actions);
g_free (loader_data);
}
static void
gplp_func_exec_verb (GnmPluginService *service,
WorkbookControlGUI *wbcg,
BonoboUIComponent *uic,
const gchar *cname,
ErrorInfo **ret_error)
gplp_func_exec_action (GnmPluginService *service,
WorkbookControl *wbc,
GnmAction const *action,
ErrorInfo **ret_error)
{
ServiceLoaderDataUI *loader_data;
PyObject *fn, *ret;
g_return_if_fail (IS_GNM_PLUGIN_SERVICE_UI (service));
g_return_if_fail (cname != NULL);
g_return_if_fail (wbcg != NULL);
g_return_if_fail (_PyGObject_API != NULL);
GNM_INIT_RET_ERROR_INFO (ret_error);
loader_data = g_object_get_data (G_OBJECT (service), "loader_data");
SWITCH_TO_PLUGIN (plugin_service_get_plugin (service));
fn = PyDict_GetItemString (loader_data->ui_verbs, (char *) cname);
fn = PyDict_GetItemString (loader_data->ui_actions, action->id);
if (fn == NULL) {
*ret_error = error_info_new_printf (_("Unknown verb: %s"),
cname);
*ret_error = error_info_new_printf (_("Unknown action: %s"),
action->id);
return;
} else if (!PyFunction_Check (fn)) {
*ret_error = error_info_new_printf
(_("Not a valid function for verb: %s"), cname);
*ret_error = error_info_new_printf (
_("Not a valid function for action: %s"), action->id);
return;
}
ret = PyObject_CallFunction (fn, (char *) "N",
py_new_Gui_object (wbcg));
py_new_Gui_object (WORKBOOK_CONTROL_GUI (wbc)));
if (ret == NULL) {
*ret_error = error_info_new_str (py_exc_to_string ());
PyErr_Clear ();
......@@ -762,28 +756,28 @@ gplp_load_service_ui (GnmPluginLoader *loader,
{
GnmPluginLoaderPython *loader_python = GNM_PLUGIN_LOADER_PYTHON (loader);
gchar *ui_verb_names;
PyObject *ui_verbs;
gchar *ui_action_names;
PyObject *ui_actions;
g_return_if_fail (IS_GNM_PLUGIN_SERVICE_UI (service));
GNM_INIT_RET_ERROR_INFO (ret_error);
gnm_py_interpreter_switch_to (loader_python->py_interpreter_info);
ui_verb_names = g_strconcat (plugin_service_get_id (service),
ui_action_names = g_strconcat (plugin_service_get_id (service),
"_ui_verbs", NULL);
ui_verbs = PyDict_GetItemString (loader_python->main_module_dict,
ui_verb_names);
ui_actions = PyDict_GetItemString (loader_python->main_module_dict,
ui_action_names);
gnm_python_clear_error_if_needed (loader_python->py_object);
if (ui_verbs != NULL && PyDict_Check (ui_verbs)) {
if (ui_actions != NULL && PyDict_Check (ui_actions)) {
PluginServiceUICallbacks *cbs;
ServiceLoaderDataUI *loader_data;
cbs = plugin_service_get_cbs (service);
cbs->plugin_func_exec_verb = gplp_func_exec_verb;
cbs->plugin_func_exec_action = gplp_func_exec_action;
loader_data = g_new (ServiceLoaderDataUI, 1);
loader_data->ui_verbs = ui_verbs;
Py_INCREF (loader_data->ui_verbs);
loader_data->ui_actions = ui_actions;
Py_INCREF (loader_data->ui_actions);
g_object_set_data_full
(G_OBJECT (service), "loader_data", loader_data,
(GDestroyNotify) gplp_loader_data_ui_free);
......@@ -791,18 +785,17 @@ gplp_load_service_ui (GnmPluginLoader *loader,
*ret_error = error_info_new_printf (
_("Python file \"%s\" has invalid format."),
loader_python->module_name);
if (ui_verbs == NULL) {
if (ui_actions == NULL) {
error_info_add_details (*ret_error,
error_info_new_printf (
_("File doesn't contain \"%s\" dictionary."),
ui_verb_names));
} else if (!PyDict_Check (ui_verbs)) {
ui_action_names));
} else if (!PyDict_Check (ui_actions)) {
error_info_add_details (*ret_error,
error_info_new_printf (
_("Object \"%s\" is not a dictionary."),
ui_verb_names));
ui_action_names));
}
}
g_free (ui_verb_names);
g_free (ui_action_names);
}
#endif
<Root>
<commands>
<cmd name="HelloWorld"
_label="Hello World"
_tip="Hello World"/>
</commands>
<menu>
<submenu name="Tools">
<menuitem name="HelloWorld" verb=""/>
</submenu>
</menu>
</Root>
<ui>
<menubar>
<menu name="Tools" action="MenuTools">
<menuitem action="HelloWorld"/>
</menu>
</menubar>
</ui>
......@@ -10,9 +10,9 @@
</loader>
<services>
<service type="ui" id="hello" file="hello.xml">
<verbs>
<verb name="HelloWorld"/>
</verbs>
<actions>
<action name="HelloWorld" label="Testing Testing 123" icon="gtk-add" />
</actions>
</service>
</services>
</plugin>
......@@ -16,18 +16,16 @@
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
static void
hello_message (WorkbookControlGUI *wbcg)
hello_message (GnmAction const *action, WorkbookControl *wbc)
{
char *msg;
msg = g_strdup_printf (
char *msg = g_strdup_printf (
_("This is message from the \"%s\" plugin."),
gnm_plugin_get_name (PLUGIN));
gnumeric_notice (wbcg_toplevel (wbcg), GTK_MESSAGE_INFO, msg);
gnumeric_notice (wbcg_toplevel (WORKBOOK_CONTROL_GUI (wbc)), GTK_MESSAGE_INFO, msg);
g_free (msg);
}
const ModulePluginUIVerbInfo hello_ui_verbs[] = {
{"HelloWorld", hello_message},
{NULL}
ModulePluginUIActions const hello_ui_actions[] = {
{ "HelloWorld", hello_message},
{ NULL }
};
......@@ -14,6 +14,10 @@
* fr.po : Adjust some menu mnemonics to avoid conflict
2004-10-22 Jody Goldberg <jody@gnome.org>
* POTFILES.in : Add the category files
2004-10-24 Francisco Javier F. Serrador <serrador@cvs.gnome.org>
* es.po: Updated Spanih translation.
......
......@@ -47,6 +47,8 @@ enum {
WORKBOOK_ADDED,
WORKBOOK_REMOVED,
WINDOW_LIST_CHANGED,
CUSTOM_UI_ADDED,
CUSTOM_UI_REMOVED,
CLIPBOARD_MODIFIED,
LAST_SIGNAL
};
......@@ -78,8 +80,9 @@ typedef struct {
void (*workbook_added) (GnmApp *gnm_app, Workbook *wb);
void (*workbook_removed) (GnmApp *gnm_app, Workbook *wb);
void (*window_list_changed) (GnmApp *gnm_app);
void (*custom_ui_added) (GnmApp *gnm_app, GnmAppExtraUI *ui);
void (*custom_ui_removed) (GnmApp *gnm_app, GnmAppExtraUI *ui);
void (*clipboard_modified) (GnmApp *gnm_app);
} GnmAppClass;
static GObjectClass *parent_klass;
......@@ -135,8 +138,8 @@ gnm_app_workbook_list_add (Workbook *wb)
app->workbook_list = g_list_prepend (app->workbook_list, wb);
g_signal_connect (G_OBJECT (wb),
"filename_changed",
G_CALLBACK (gnm_app_flag_windows_changed), NULL);
gnm_app_flag_windows_changed ();
G_CALLBACK (_gnm_app_flag_windows_changed), NULL);
_gnm_app_flag_windows_changed ();
g_signal_emit (G_OBJECT (app), signals [WORKBOOK_ADDED], 0, wb);
}
......@@ -154,8 +157,8 @@ gnm_app_workbook_list_remove (Workbook *wb)
app->workbook_list = g_list_remove (app->workbook_list, wb);
g_signal_handlers_disconnect_by_func (G_OBJECT (wb),
G_CALLBACK (gnm_app_flag_windows_changed), NULL);
gnm_app_flag_windows_changed ();
G_CALLBACK (_gnm_app_flag_windows_changed), NULL);
_gnm_app_flag_windows_changed ();
g_signal_emit (G_OBJECT (app), signals [WORKBOOK_REMOVED], 0, wb);
}
......@@ -812,32 +815,42 @@ gnm_app_class_init (GObjectClass *gobject_klass)
G_STRUCT_OFFSET (GnmAppClass, workbook_added),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, WORKBOOK_TYPE);
G_TYPE_NONE, 1, WORKBOOK_TYPE);
signals [WORKBOOK_REMOVED] = g_signal_new ("workbook_removed",
GNM_APP_TYPE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnmAppClass, workbook_removed),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
G_TYPE_NONE, 1, G_TYPE_POINTER);
signals [WINDOW_LIST_CHANGED] = g_signal_new ("window-list-changed",
GNM_APP_TYPE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnmAppClass, window_list_changed),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
G_TYPE_NONE, 0);
signals [CUSTOM_UI_ADDED] = g_signal_new ("custom-ui-added",
GNM_APP_TYPE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnmAppClass, custom_ui_added),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
signals [CUSTOM_UI_REMOVED] = g_signal_new ("custom-ui-removed",
GNM_APP_TYPE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnmAppClass, custom_ui_removed),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
signals [CLIPBOARD_MODIFIED] = g_signal_new ("clipboard_modified",
GNM_APP_TYPE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnmAppClass, clipboard_modified),
(GSignalAccumulator) NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
G_TYPE_NONE, 0);
}
static void
......@@ -864,6 +877,62 @@ GSF_CLASS (GnmApp, gnm_app,
gnm_app_class_init, gnm_app_init,
G_TYPE_OBJECT);
/**********************************************************************/
static GSList *extra_uis = NULL;
GnmAction *
gnm_action_new (char const *id, char const *label,
char const *icon_name, gboolean always_available,
GnmActionHandler handler)
{
GnmAction *res = g_new0 (GnmAction, 1);
res->id = g_strdup (id);
res->label = g_strdup (label);
res->icon_name = g_strdup (icon_name);
res->always_available = always_available;
res->handler = handler;
return res;
}
void
gnm_action_free (GnmAction *action)
{
if (NULL != action) {
g_free (action->id);
g_free (action->label);
g_free (action->icon_name);
g_free (action);
}
}
GnmAppExtraUI *
gnm_app_add_extra_ui (GSList *actions, char *layout,
char const *domain,
gpointer user_data)
{
GnmAppExtraUI *extra_ui = g_new0 (GnmAppExtraUI, 1);
extra_uis = g_slist_prepend (extra_uis, extra_ui);
extra_ui->actions = actions;
extra_ui->layout = layout;
extra_ui->user_data = user_data;
g_signal_emit (G_OBJECT (app), signals [CUSTOM_UI_ADDED], 0, extra_ui);
return extra_ui;
}
void
gnm_app_remove_extra_ui (GnmAppExtraUI *extra_ui)
{
g_signal_emit (G_OBJECT (app), signals [CUSTOM_UI_REMOVED], 0, extra_ui);
}
void
gnm_app_foreach_extra_ui (GFunc func, gpointer data)
{
g_slist_foreach (extra_uis, func, data);
}
/**********************************************************************/
static gint windows_update_timer = -1;
static gboolean
cb_flag_windows_changed (void)
......@@ -874,14 +943,15 @@ cb_flag_windows_changed (void)
}
/**
* gnm_app_flag_windows_changed :
* _gnm_app_flag_windows_changed :
*
* An internal utility routine to flag a regeneration of the window lists
**/
void
gnm_app_flag_windows_changed (void)
_gnm_app_flag_windows_changed (void)
{
if (windows_update_timer < 0)
windows_update_timer = g_timeout_add (100,
(GSourceFunc)cb_flag_windows_changed, NULL);
}
......@@ -53,7 +53,49 @@ SheetView *gnm_app_clipboard_sheet_view_get (void);
GnmCellRegion *gnm_app_clipboard_contents_get (void);
GnmRange const *gnm_app_clipboard_area_get (void);
/**********************************************************************
* Temporary home for extra actions until we rework this in 1.5
* with libgoffice
**/
typedef struct _GnmAction GnmAction;
typedef void (*GnmActionHandler) (GnmAction const *action, WorkbookControl *wbc,
gpointer user_data);
struct _GnmAction {
char *id; /* id of the function that will handle this */
char *label; /* untranslated, gettext domain will be passed later */
char *icon_name; /* optionally NULL */
/* simplistic for now :
* is the action always available (File -> New) or only available
* when we are not editing (Cell -> Format)
* Later on this needs to be more comprehensive with things like
* per-sheetobject flags
**/
gboolean always_available;
GnmActionHandler handler;
};
typedef struct {
GSList *actions;
char *layout;
char const *domain;
gpointer user_data;
} GnmAppExtraUI;
GnmAction *gnm_action_new (char const *name, char const *label,
char const *icon, gboolean always_available,
GnmActionHandler handler);
void gnm_action_free (GnmAction *action);
GnmAppExtraUI *gnm_app_add_extra_ui (GSList *actions, char *layout,
char const *domain,
gpointer user_data);
void gnm_app_remove_extra_ui (GnmAppExtraUI *extra_ui);
void gnm_app_foreach_extra_ui (GFunc func, gpointer data);
/**********************************************************************/
/* internal implementation util */
void gnm_app_flag_windows_changed (void);
void _gnm_app_flag_windows_changed (void);
#endif /* GNUMERIC_APPLICATION_H */
......@@ -358,7 +358,7 @@ previews_load (AutoFormatState *state, int topindex)
gtk_tooltips_set_tip (state->tooltips,