Commit 9c0c292a authored by Morten Welinder's avatar Morten Welinder

Compilation: excise gnome/bonobo.

parent 3056edad
......@@ -164,17 +164,6 @@ libspreadsheet_gtk_reqs="
gnumeric_gtk_reqs="$libspreadsheet_gtk_reqs"
libspreadsheet_gnome_reqs="
libbonobo-2.0 >= 2.2.0
"
gnumeric_gnome_reqs="$libspreadsheet_gnome_reqs
libgnomeui-2.0 >= 2.0.0
libbonoboui-2.0 >= 2.2.0
libgnome-2.0 >= 2.0.0
libgsf-gnome-1 >= 1.14.2
"
ui_msg=
with_win32=no
......@@ -206,37 +195,7 @@ if test "x$gnumeric_with_gtk" = xtrue ; then
gnumeric_reqs="$gnumeric_reqs $gnumeric_gtk_reqs"
fi
gnumeric_with_gnome=false
if test "x$gnumeric_with_gtk" = xtrue -a "x$with_win32" = xno ; then
dnl ************************************
dnl Are the GNOME extensions available ?
dnl ************************************
ui_msg="Gtk+ (Gnome disabled)"
AC_ARG_WITH(gnome,
AS_HELP_STRING([--with-gnome], [Use GNOME extensions]),
if test "x$withval" == xyes; then
ui_msg="Gnome"
gnumeric_with_gnome=true
fi
)
if test "x$gnumeric_with_gnome" = xtrue; then
PKG_CHECK_MODULES(GNOME, [$libspreadsheet_gnome_reqs],
[ui_msg="Gnome"],
[ui_msg="Gtk (missing Gnome dependencies)" ; gnumeric_with_gnome=false])
PKG_CHECK_MODULES(GNOME, [$gnumeric_gnome_reqs],
[ui_msg="Gnome"],
[ui_msg="Gtk (missing Gnome dependencies)" ; gnumeric_with_gnome=false])
fi
if test "x$gnumeric_with_gnome" = xtrue; then
AC_DEFINE(GNM_WITH_GNOME, 1, [Define if GNOME extensions are available])
libspreadsheet_reqs="$libspreadsheet_reqs $libspreadsheet_gnome_reqs"
gnumeric_reqs="$gnumeric_reqs $gnumeric_gnome_reqs"
fi
fi
AM_CONDITIONAL(WITH_GTK, $gnumeric_with_gtk)
AM_CONDITIONAL(WITH_GNOME, $gnumeric_with_gnome)
dnl ****************************
dnl now that we have selected out libraries the whole collection in one
......@@ -281,11 +240,6 @@ if test $gnumeric_devel = yes; then
CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED"
# CFLAGS="$CFLAGS -DGSEAL_ENABLE"
fi
if test "x$gnumeric_with_gnome" = xtrue; then
CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED"
CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED"
CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED"
fi
fi
dnl ==============================================
......@@ -1082,7 +1036,7 @@ AC_SUBST(MONO_LIBS)
])
dnl **************************************************
dnl * Config defaults (Must be after bonobo)
dnl * Config defaults
dnl **************************************************
dnl
dnl These are changed in gutils.c for WIN32 packages
......
......@@ -15,8 +15,6 @@
/* The version number of this release, with optional extra suffix */
#undef GNM_VERSION_FULL
/* Define if GNOME extensions are available */
#undef GNM_WITH_GNOME
/* Define if UI is built */
#undef GNM_WITH_GTK
/* Build with Maemo/Hildon support */
......
......@@ -474,11 +474,3 @@ GNOME_Gnumeric-gtk.xml: GNOME_Gnumeric-gtk.xml.in
sed -e 's/ _name *=/ name=/' <$< >$@
DISTCLEANFILES = GNOME_Gnumeric-gtk.xml
endif
##check_PROGRAMS += number-match
##number_match_SOURCES = number-match.c formats.c dates.c number-match-test.c
##number_match_LDADD = \
## $(GNOME_LIBDIR) \
## $(GNOMEUI_LIBS) \
## $(GNOME_XML_LIB) \
## $(INTLLIBS)
......@@ -46,14 +46,6 @@
#include <string.h>
#include <locale.h>
#ifdef GNM_WITH_GNOME
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-main.h>
#include <libgnome/gnome-program.h>
#include <libgnome/gnome-init.h>
#include <libgnomeui/gnome-ui-init.h>
#endif
#ifdef GNM_USE_HILDON
#include <libosso.h>
#endif
......@@ -182,43 +174,9 @@ gnumeric_arg_parse (int argc, char **argv)
g_option_context_set_delocalize (ocontext, FALSE);
#endif
#ifdef GNM_WITH_GNOME
#ifndef GNOME_PARAM_GOPTION_CONTEXT
/*
* Bummer. We cannot make gnome_program_init handle our args so
* we do it ourselves. That, in turn, means we don't handle
* libgnome[ui]'s args.
*
* Upgrade to libgnome 2.13 or better to solve this.
*/
if (!funcdump)
g_option_context_add_group (ocontext, gtk_get_option_group (TRUE));
g_option_context_parse (ocontext, &argc, &argv, &error);
#endif
if (!error) {
program = (GObject *)
gnome_program_init (PACKAGE, VERSION,
funcdump ? LIBGNOME_MODULE : LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_APP_PREFIX, GNUMERIC_PREFIX,
GNOME_PARAM_APP_SYSCONFDIR, GNUMERIC_SYSCONFDIR,
GNOME_PARAM_APP_DATADIR, gnm_sys_data_dir (),
GNOME_PARAM_APP_LIBDIR, gnm_sys_lib_dir (),
#ifdef GNOME_PARAM_GOPTION_CONTEXT
GNOME_PARAM_GOPTION_CONTEXT, ocontext,
#endif
NULL);
#ifdef GNOME_PARAM_GOPTION_CONTEXT
ocontext = NULL;
#endif
}
#else /* therefore not gnome */
if (!funcdump)
g_option_context_add_group (ocontext, gtk_get_option_group (TRUE));
g_option_context_parse (ocontext, &argc, &argv, &error);
#endif
if (ocontext)
g_option_context_free (ocontext);
......@@ -282,11 +240,7 @@ static void
cb_workbook_removed (void)
{
if (gnm_app_workbook_list () == NULL) {
#ifdef GNM_WITH_GNOME
bonobo_main_quit ();
#else
gtk_main_quit ();
#endif
}
}
......@@ -375,9 +329,6 @@ main (int argc, char const **argv)
g_set_application_name (_("Gnumeric Spreadsheet"));
gnm_plugins_init (GO_CMD_CONTEXT (ioc));
#ifdef GNM_WITH_GNOME
bonobo_activate ();
#endif
if (startup_files) {
int i;
......@@ -452,11 +403,7 @@ main (int argc, char const **argv)
NULL);
g_idle_add ((GSourceFunc)pathetic_qt_workaround, NULL);
#ifdef GNM_WITH_GNOME
bonobo_main ();
#else
gtk_main ();
#endif
} else {
g_object_unref (ioc);
g_slist_foreach (wbcgs_to_kill, (GFunc)cb_kill_wbcg, NULL);
......@@ -471,9 +418,7 @@ main (int argc, char const **argv)
store_plugin_state ();
gnm_shutdown ();
#ifdef GNM_WITH_GNOME
bonobo_ui_debug_shutdown ();
#elif defined(G_OS_WIN32)
#if defined(G_OS_WIN32)
if (has_console) {
close(1);
close(2);
......
......@@ -20,240 +20,8 @@
#include <gnumeric-config.h>
#ifdef GNM_WITH_GNOME
#include "gnumeric.h"
#include <gtk/gtk.h>
#include <glib.h>
#include "session.h"
#include "application.h"
#include <workbook.h>
#include <workbook-priv.h>
#include <workbook-view.h>
#include <wbc-gtk.h>
#include <gui-file.h>
#include <gui-util.h>
#include <goffice/goffice.h>
#include <glib/gi18n-lib.h>
#include <libgnomeui/gnome-client.h>
static GnomeClient *master_client = NULL;
static char const *program_argv0 = NULL;
static char const *current_dir = NULL;
static void
set_clone_restart (GnomeClient *client)
{
GList *ptr, *workbooks;
char **argv;
int count = 1;
argv = g_new0 (char *,
2 + g_list_length (gnm_app_workbook_list ()));
argv[0] = (char *) program_argv0;
workbooks = g_list_copy (gnm_app_workbook_list ());
for (ptr = workbooks; ptr != NULL ; ptr = ptr->next) {
Workbook *wb = ptr->data;
if (wb->file_format_level == GO_FILE_FL_AUTO) {
argv[count] = g_strdup (go_doc_get_uri (GO_DOC (wb)));
count++;
}
}
gnome_client_set_clone_command (client, count, argv);
gnome_client_set_restart_command (client, count, argv);
g_free (argv);
}
static void
interaction_function (GnomeClient *client, gint key, GnomeDialogType dialog_type, gpointer shutdown)
{
GList *ptr, *workbooks;
gboolean ask_user = TRUE;
gboolean do_not_cancel = FALSE;
workbooks = g_list_copy (gnm_app_workbook_list ());
for (ptr = workbooks; ptr != NULL ; ptr = ptr->next) {
Workbook *wb = ptr->data;
WBCGtk *wbcg = NULL;
WorkbookView *wb_view = NULL;
guint i;
g_return_if_fail (IS_WORKBOOK (wb));
if (wb->wb_views == NULL || wb->wb_views->len == 0)
continue;
wb_view = g_ptr_array_index (wb->wb_views, 0);
if (wb_view == NULL)
continue;
for (i = 0; i < wb_view->wb_controls->len; i++)
if (IS_WBC_GTK (g_ptr_array_index (wb_view->wb_controls, i)))
wbcg = g_ptr_array_index (wb_view->wb_controls, i);
if (wbcg == NULL)
continue;
wbcg_edit_finish (wbcg, WBC_EDIT_REJECT, NULL);
if (!ask_user)
if (!gui_file_save (wbcg, wb_view)) {
do_not_cancel = TRUE;
goto finished;
}
if (go_doc_is_dirty (GO_DOC (wb))) {
GtkWidget *d;
char *msg;
int button = 0;
char const *wb_uri = go_doc_get_uri (GO_DOC (wb));
if (wb_uri) {
char *base = g_path_get_basename (wb_uri);
msg = g_strdup_printf (
_("Save changes to workbook '%s' before logging out?"),
base);
g_free (base);
} else
msg = g_strdup (_("Save changes to workbook before logging out?"));
gtk_window_deiconify (GTK_WINDOW (wbcg_toplevel (wbcg)));
d = gnumeric_message_dialog_new (wbcg_toplevel (wbcg),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
msg,
_("If you do not save, changes may be discarded."));
if (g_list_length (ptr) > 1) {
go_gtk_dialog_add_button (GTK_DIALOG(d), _("Do not save any"),
GTK_STOCK_DELETE, - GTK_RESPONSE_NO);
go_gtk_dialog_add_button (GTK_DIALOG(d), _("Do not save"),
GTK_STOCK_DELETE, GTK_RESPONSE_NO);
} else
go_gtk_dialog_add_button (GTK_DIALOG(d), _("Do not save"),
GTK_STOCK_DELETE, GTK_RESPONSE_NO);
go_gtk_dialog_add_button (GTK_DIALOG(d), _("Do not log out"),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG(d), GTK_STOCK_SAVE, GTK_RESPONSE_YES);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
#warning We are making these windows sticky to work around a session manager bug that may make them inaccessible
gtk_window_stick (GTK_WINDOW (wbcg_toplevel (wbcg)));
gtk_window_stick (GTK_WINDOW (d));
button = go_gtk_dialog_run (GTK_DIALOG (d), wbcg_toplevel (wbcg));
g_free (msg);
switch (button) {
case GTK_RESPONSE_YES:
if (!gui_file_save (wbcg, wb_view)) {
gtk_window_unstick (GTK_WINDOW (wbcg_toplevel (wbcg)));
do_not_cancel = TRUE;
goto finished;
}
break;
case (- GTK_RESPONSE_YES):
if (!gui_file_save (wbcg, wb_view)) {
gtk_window_unstick (GTK_WINDOW (wbcg_toplevel (wbcg)));
do_not_cancel = TRUE;
goto finished;
}
ask_user = FALSE;
break;
case GTK_RESPONSE_NO:
break;
case (- GTK_RESPONSE_NO):
gtk_window_unstick (GTK_WINDOW (wbcg_toplevel (wbcg)));
goto finished;
break;
default: /* CANCEL */
gtk_window_unstick (GTK_WINDOW (wbcg_toplevel (wbcg)));
do_not_cancel = TRUE;
goto finished;
break;
}
gtk_window_unstick (GTK_WINDOW (wbcg_toplevel (wbcg)));
}
}
finished:
g_list_free (workbooks);
set_clone_restart (client);
gnome_interaction_key_return (key, do_not_cancel);
}
static gboolean
cb_client_save_yourself (GnomeClient *client, int phase,
GnomeSaveStyle what_to_save,
gboolean end, GnomeInteractStyle interaction,
gboolean fast)
{
gboolean res = TRUE;
if (!end)
return TRUE; /* If we aren't shutting down, don't bother us any further. */
gnome_client_set_current_directory (client, current_dir);
if (!(interaction == GNOME_INTERACT_ANY))
res = FALSE;
else
gnome_client_request_interaction (client,
GNOME_DIALOG_NORMAL,
interaction_function,
NULL);
set_clone_restart (client);
return res;
}
static void
cb_client_die (GnomeClient *client)
{
GList *ptr, *workbooks;
workbooks = g_list_copy (gnm_app_workbook_list ());
for (ptr = workbooks; ptr != NULL ; ptr = ptr->next) {
go_doc_set_dirty (GO_DOC (ptr->data), FALSE);
g_object_unref (ptr->data);
}
g_list_free (workbooks);
}
/**
* gnm_session_init:
*
* Initializes session management support. This function should be called near
* the beginning of the program.
**/
void
gnm_session_init (char const *argv0)
{
if (master_client)
return;
program_argv0 = argv0;
master_client = gnome_master_client ();
current_dir = g_get_current_dir ();
g_signal_connect (master_client, "save_yourself",
G_CALLBACK (cb_client_save_yourself), NULL);
g_signal_connect (master_client, "die",
G_CALLBACK (cb_client_die), NULL);
}
#else
#include "session.h"
void
gnm_session_init (char const *argv0)
{
}
#endif /* GNM_WITH_GNOME */
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