2 * (GLABELS) Label and Business Card Creation program for GNOME
4 * mdi.c: gLabels MDI module
6 * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * This file is based on gedit-mdi.c from gedit2:
26 * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
27 * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
28 * Copyright (C) 2002 Paolo Maggi
33 #include <libgnome/libgnome.h>
34 #include <libgnomeui/libgnomeui.h>
35 #include <libgnomevfs/gnome-vfs.h>
40 #include "mdi-child.h"
48 #include "gnome-recent-view.h"
51 #include <bonobo/bonobo-ui-util.h>
52 #include <bonobo/bonobo-control.h>
54 #include <gconf/gconf-client.h>
56 /*========================================================*/
57 /* Private macros and constants. */
58 /*========================================================*/
60 #define DEFAULT_WINDOW_WIDTH 500
61 #define DEFAULT_WINDOW_HEIGHT 375
63 /*========================================================*/
65 /*========================================================*/
73 /*========================================================*/
74 /* Private globals. */
75 /*========================================================*/
77 static BonoboMDIClass *parent_class = NULL;
80 /*========================================================*/
81 /* Private function prototypes. */
82 /*========================================================*/
84 static void gl_mdi_class_init (glMDIClass *klass);
85 static void gl_mdi_init (glMDI *mdi);
86 static void gl_mdi_finalize (GObject *object);
88 static void gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win);
89 static void gl_mdi_set_app_toolbar_style (BonoboWindow *win);
90 static void gl_mdi_set_app_statusbar_style (BonoboWindow *win);
92 static gint gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child);
93 static gint gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view);
94 static gint gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child);
95 static gint gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view);
97 static void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view);
98 static void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child);
99 static void gl_mdi_child_state_changed_cb (glMDIChild *child);
101 static void gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi);
103 static void gl_mdi_view_menu_item_toggled_cb (
104 BonoboUIComponent *ui_component,
106 Bonobo_UIComponent_EventType type,
111 /*****************************************************************************/
112 /* Boilerplate object stuff. */
113 /*****************************************************************************/
115 gl_mdi_get_type (void)
117 static GType mdi_type = 0;
121 static const GTypeInfo our_info =
124 NULL, /* base_init */
125 NULL, /* base_finalize */
126 (GClassInitFunc) gl_mdi_class_init,
127 NULL, /* class_finalize */
128 NULL, /* class_data */
131 (GInstanceInitFunc) gl_mdi_init
134 mdi_type = g_type_register_static (BONOBO_TYPE_MDI,
144 gl_mdi_class_init (glMDIClass *klass)
146 GObjectClass *object_class = G_OBJECT_CLASS (klass);
148 gl_debug (DEBUG_MDI, "START");
150 parent_class = g_type_class_peek_parent (klass);
152 object_class->finalize = gl_mdi_finalize;
154 gl_debug (DEBUG_MDI, "END");
158 gl_mdi_init (glMDI *mdi)
160 gl_debug (DEBUG_MDI, "START");
162 bonobo_mdi_construct (BONOBO_MDI (mdi), "glabels", "gLabels",
163 DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
165 mdi->priv = g_new0 (glMDIPrivate, 1);
167 mdi->priv->untitled_number = 0;
169 bonobo_mdi_set_ui_template_file (BONOBO_MDI (mdi),
170 GLABELS_UI_DIR "glabels-ui.xml",
173 bonobo_mdi_set_child_list_path (BONOBO_MDI (mdi), "/menu/Documents/");
175 /* Connect signals */
176 g_signal_connect (G_OBJECT (mdi), "top_window_created",
177 G_CALLBACK (gl_mdi_app_created_cb), NULL);
179 g_signal_connect (G_OBJECT (mdi), "add_child",
180 G_CALLBACK (gl_mdi_add_child_cb), NULL);
181 g_signal_connect (G_OBJECT (mdi), "add_view",
182 G_CALLBACK (gl_mdi_add_view_cb), NULL);
184 g_signal_connect (G_OBJECT (mdi), "remove_child",
185 G_CALLBACK (gl_mdi_remove_child_cb), NULL);
186 g_signal_connect (G_OBJECT (mdi), "remove_view",
187 G_CALLBACK (gl_mdi_remove_view_cb), NULL);
189 g_signal_connect (G_OBJECT (mdi), "child_changed",
190 G_CALLBACK (gl_mdi_child_changed_cb), NULL);
191 g_signal_connect (G_OBJECT (mdi), "view_changed",
192 G_CALLBACK (gl_mdi_view_changed_cb), NULL);
194 g_signal_connect (G_OBJECT (mdi), "all_windows_destroyed",
195 G_CALLBACK (gl_file_exit), NULL);
197 gl_debug (DEBUG_MDI, "END");
201 gl_mdi_finalize (GObject *object)
205 gl_debug (DEBUG_MDI, "START");
207 g_return_if_fail (object != NULL);
209 mdi = GL_MDI (object);
211 g_return_if_fail (GL_IS_MDI (mdi));
212 g_return_if_fail (mdi->priv != NULL);
214 G_OBJECT_CLASS (parent_class)->finalize (object);
218 gl_debug (DEBUG_MDI, "END");
222 /*****************************************************************************/
223 /* NEW mdi objecg. */
224 /*****************************************************************************/
230 gl_debug (DEBUG_MDI, "START");
232 mdi = GL_MDI (g_object_new (GL_TYPE_MDI, NULL));
233 g_return_val_if_fail (mdi != NULL, NULL);
235 gl_debug (DEBUG_MDI, "END");
239 /*---------------------------------------------------------------------------*/
240 /* App created callback. */
241 /*---------------------------------------------------------------------------*/
243 gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win)
246 BonoboControl *control;
247 BonoboUIComponent *ui_component;
248 GnomeRecentView *view;
249 GnomeRecentModel *model;
251 static GtkTargetEntry drag_types[] =
253 { "text/uri-list", 0, 0 },
256 static gint n_drag_types =
257 sizeof (drag_types) / sizeof (drag_types [0]);
259 gl_debug (DEBUG_MDI, "START");
261 ui_component = bonobo_mdi_get_ui_component_from_window (win);
262 g_return_if_fail (ui_component != NULL);
264 /* Set the toolbar style according to prefs */
265 gl_mdi_set_app_toolbar_style (win);
267 /* Add listener fo the view menu */
268 bonobo_ui_component_add_listener (ui_component, "ViewToolbar",
269 (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
272 bonobo_ui_component_add_listener (ui_component, "ToolbarSystem",
273 (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
275 bonobo_ui_component_add_listener (ui_component, "ToolbarIcon",
276 (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
278 bonobo_ui_component_add_listener (ui_component, "ToolbarIconText",
279 (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
281 bonobo_ui_component_add_listener (ui_component, "ToolbarTooltips",
282 (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
286 gl_menus_set_verb_list_sensitive (ui_component,
287 gl_menus_no_docs_sensible_verbs,
290 /* add a GeditRecentView object */
291 model = gl_recent_get_model ();
292 view = GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component,
293 "/menu/File/Recents"));
294 gnome_recent_view_set_model (view, model);
296 g_signal_connect (G_OBJECT (view), "activate",
297 G_CALLBACK (gl_file_open_recent), win);
299 gl_debug (DEBUG_MDI, "END");
302 /*---------------------------------------------------------------------------*/
303 /* Menu item togglded callback. */
304 /*---------------------------------------------------------------------------*/
306 gl_mdi_view_menu_item_toggled_cb (
307 BonoboUIComponent *ui_component,
309 Bonobo_UIComponent_EventType type,
315 gl_debug (DEBUG_MDI, "%s toggled to '%s'", path, state);
317 s = (strcmp (state, "1") == 0);
319 if ((strcmp (path, "ViewToolbar") == 0) &&
320 (s != gl_prefs->toolbar_visible))
322 gl_prefs->toolbar_visible = s;
323 gl_mdi_set_app_toolbar_style (win);
328 if (s && (strcmp (path, "ToolbarSystem") == 0) &&
329 (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_SYSTEM))
331 gl_prefs->toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
332 gl_mdi_set_app_toolbar_style (win);
337 if (s && (strcmp (path, "ToolbarIcon") == 0) &&
338 (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS))
340 gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS;
341 gl_mdi_set_app_toolbar_style (win);
346 if (s && (strcmp (path, "ToolbarIconText") == 0) &&
347 (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT))
349 gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
350 gl_mdi_set_app_toolbar_style (win);
355 if ((strcmp (path, "ToolbarTooltips") == 0) &&
356 (s != gl_prefs->toolbar_view_tooltips))
358 gl_prefs->toolbar_view_tooltips = s;
359 gl_mdi_set_app_toolbar_style (win);
366 /*---------------------------------------------------------------------------*/
367 /* Set toolbar style. */
368 /*---------------------------------------------------------------------------*/
370 gl_mdi_set_app_toolbar_style (BonoboWindow *win)
372 BonoboUIComponent *ui_component;
376 gl_debug (DEBUG_MDI, "START");
378 g_return_if_fail (BONOBO_IS_WINDOW (win));
380 ui_component = bonobo_mdi_get_ui_component_from_window (win);
381 g_return_if_fail (ui_component != NULL);
383 bonobo_ui_component_freeze (ui_component, NULL);
385 /* Updated view menu */
386 gl_menus_set_verb_state (ui_component,
387 "/commands/ViewToolbar",
388 gl_prefs->toolbar_visible);
390 gl_menus_set_verb_sensitive (ui_component,
391 "/commands/ToolbarSystem",
392 gl_prefs->toolbar_visible);
393 gl_menus_set_verb_sensitive (ui_component,
394 "/commands/ToolbarIcon",
395 gl_prefs->toolbar_visible);
396 gl_menus_set_verb_sensitive (ui_component,
397 "/commands/ToolbarIconText",
398 gl_prefs->toolbar_visible);
399 gl_menus_set_verb_sensitive (ui_component,
400 "/commands/ToolbarTooltips",
401 gl_prefs->toolbar_visible);
403 gl_menus_set_verb_state (ui_component,
404 "/commands/ToolbarSystem",
405 gl_prefs->toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
407 gl_menus_set_verb_state (ui_component,
408 "/commands/ToolbarIcon",
409 gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS);
411 gl_menus_set_verb_state (ui_component,
412 "/commands/ToolbarIconText",
413 gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
415 gl_menus_set_verb_state (ui_component,
416 "/commands/ToolbarTooltips",
417 gl_prefs->toolbar_view_tooltips);
420 /* Actually update toolbar style */
421 bonobo_ui_component_set_prop (
422 ui_component, "/Toolbar",
423 "tips", gl_prefs->toolbar_view_tooltips ? "1" : "0",
426 switch (gl_prefs->toolbar_buttons_style)
428 case GL_TOOLBAR_SYSTEM:
430 client = gconf_client_get_default ();
434 labels = gconf_client_get_bool (client,
435 "/desktop/gnome/interface/toolbar-labels", NULL);
437 g_object_unref (G_OBJECT (client));
441 gl_debug (DEBUG_MDI, "SYSTEM: BOTH");
442 bonobo_ui_component_set_prop (
443 ui_component, "/Toolbar", "look", "both", NULL);
448 gl_debug (DEBUG_MDI, "SYSTEM: ICONS");
449 bonobo_ui_component_set_prop (
450 ui_component, "/Toolbar", "look", "icons", NULL);
455 case GL_TOOLBAR_ICONS:
456 gl_debug (DEBUG_MDI, "GLABELS: ICONS");
457 bonobo_ui_component_set_prop (
458 ui_component, "/Toolbar", "look", "icon", NULL);
462 case GL_TOOLBAR_ICONS_AND_TEXT:
463 gl_debug (DEBUG_MDI, "GLABELS: ICONS_AND_TEXT");
464 bonobo_ui_component_set_prop (
465 ui_component, "/Toolbar", "look", "both", NULL);
473 bonobo_ui_component_set_prop (
474 ui_component, "/Toolbar",
475 "hidden", gl_prefs->toolbar_visible ? "0":"1", NULL);
478 bonobo_ui_component_thaw (ui_component, NULL);
480 gl_debug (DEBUG_MDI, "END");
484 /*---------------------------------------------------------------------------*/
485 /* Child state changed callback. */
486 /*---------------------------------------------------------------------------*/
488 gl_mdi_child_state_changed_cb (glMDIChild *child)
490 gl_debug (DEBUG_MDI, "START");
492 if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child))
495 gl_mdi_set_active_window_title (BONOBO_MDI (glabels_mdi));
496 gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi));
498 gl_debug (DEBUG_MDI, "END");
501 /*---------------------------------------------------------------------------*/
502 /* Child undo/redo state changed callback. */
503 /*---------------------------------------------------------------------------*/
505 gl_mdi_child_undo_redo_state_changed_cb (glMDIChild *child)
507 gl_debug (DEBUG_MDI, "START");
509 if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child))
512 gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BONOBO_MDI (glabels_mdi));
513 gl_debug (DEBUG_MDI, "END");
516 /*---------------------------------------------------------------------------*/
517 /* Add child callback. */
518 /*---------------------------------------------------------------------------*/
520 gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child)
522 gl_debug (DEBUG_MDI, "START");
524 g_signal_connect (G_OBJECT (child), "state_changed",
525 G_CALLBACK (gl_mdi_child_state_changed_cb),
527 g_signal_connect (G_OBJECT (child), "undo_redo_state_changed",
528 G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb),
531 gl_debug (DEBUG_MDI, "END");
535 /*---------------------------------------------------------------------------*/
536 /* Add view callback. */
537 /*---------------------------------------------------------------------------*/
539 gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view)
541 gl_debug (DEBUG_MDI, "START");
542 gl_debug (DEBUG_MDI, "END");
546 /*---------------------------------------------------------------------------*/
547 /* Remove child callback. */
548 /*---------------------------------------------------------------------------*/
550 gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child)
553 gboolean close = TRUE;
555 gl_debug (DEBUG_MDI, "START");
557 g_return_val_if_fail (child != NULL, FALSE);
558 g_return_val_if_fail (GL_MDI_CHILD (child)->label != NULL, FALSE);
560 doc = GL_MDI_CHILD (child)->label;
562 if (gl_label_is_modified (doc))
564 GtkWidget *msgbox, *w;
565 gchar *fname = NULL, *msg = NULL;
569 w = GTK_WIDGET (g_list_nth_data (bonobo_mdi_child_get_views (child), 0));
572 bonobo_mdi_set_active_view (mdi, w);
574 fname = gl_label_get_short_name (doc);
576 msg = g_strdup_printf (_("Save changes to document \"%s\" before closing?"),
579 msgbox = gl_alert_dialog_new (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)),
580 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
584 _("Your changes will be lost if you don't save them."));
586 gtk_dialog_add_button (GTK_DIALOG (msgbox),
587 _("Close without saving"),
590 if (glabels_close_x_button_pressed)
592 else if (glabels_exit_button_pressed)
596 /* Delete event generated */
597 if (g_list_length (bonobo_mdi_get_windows (BONOBO_MDI (glabels_mdi))) == 1)
604 gtk_dialog_add_button (GTK_DIALOG (msgbox), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
606 gtk_dialog_add_button (GTK_DIALOG (msgbox),
610 gtk_dialog_set_default_response (GTK_DIALOG (msgbox), GTK_RESPONSE_YES);
612 gtk_window_set_resizable (GTK_WINDOW (msgbox), FALSE);
614 ret = gtk_dialog_run (GTK_DIALOG (msgbox));
616 gtk_widget_destroy (msgbox);
623 case GTK_RESPONSE_YES:
624 close = gl_file_save (GL_MDI_CHILD (child));
626 case GTK_RESPONSE_NO:
633 gl_debug (DEBUG_MDI, "CLOSE: %s", close ? "TRUE" : "FALSE");
636 /* FIXME: there is a bug if you "close all" >1 docs, don't save the document
637 * and then don't close the last one.
639 /* Disable to avoid the bug */
643 g_signal_handlers_disconnect_by_func (child,
644 G_CALLBACK (gl_mdi_child_state_changed_cb),
646 g_signal_handlers_disconnect_by_func (GTK_OBJECT (child),
647 G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb),
652 gl_debug (DEBUG_MDI, "END");
656 /*---------------------------------------------------------------------------*/
657 /* Remove view callback. */
658 /*---------------------------------------------------------------------------*/
660 gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view)
662 gl_debug (DEBUG_MDI, "");
663 gl_debug (DEBUG_MDI, "END");
668 /*****************************************************************************/
669 /* Set title of active window. */
670 /*****************************************************************************/
672 gl_mdi_set_active_window_title (BonoboMDI *mdi)
674 BonoboMDIChild* active_child = NULL;
676 gchar* docname = NULL;
679 gl_debug (DEBUG_MDI, "START");
682 active_child = bonobo_mdi_get_active_child (mdi);
683 if (active_child == NULL)
686 doc = GL_MDI_CHILD (active_child)->label;
687 g_return_if_fail (doc != NULL);
689 /* Set active window title */
690 docname = gl_label_get_short_name (doc);
691 g_return_if_fail (docname != NULL);
693 if (gl_label_is_modified (doc))
695 title = g_strdup_printf ("%s %s - glabels",
696 docname, _("(modified)"));
700 title = g_strdup_printf ("%s - glabels", docname);
704 gtk_window_set_title (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)), title);
709 gl_debug (DEBUG_MDI, "END");
712 /*---------------------------------------------------------------------------*/
713 /* Child changed callback. */
714 /*---------------------------------------------------------------------------*/
716 void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child)
718 gl_debug (DEBUG_MDI, "START");
720 gl_mdi_set_active_window_title (mdi);
722 gl_debug (DEBUG_MDI, "END");
725 /*---------------------------------------------------------------------------*/
726 /* View changed callback. */
727 /*---------------------------------------------------------------------------*/
729 void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view)
733 GtkWidget *active_view;
735 gl_debug (DEBUG_MDI, "START");
737 gl_mdi_set_active_window_verbs_sensitivity (mdi);
739 active_view = bonobo_mdi_get_active_view (mdi);
741 win = bonobo_mdi_get_active_window (mdi);
742 g_return_if_fail (win != NULL);
744 gl_debug (DEBUG_MDI, "END");
747 /*****************************************************************************/
748 /* Set sensitivity of verbs in active window. */
749 /*****************************************************************************/
751 gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi)
753 /* FIXME: it is too slooooooow! - Paolo */
755 BonoboWindow* active_window = NULL;
756 BonoboMDIChild* active_child = NULL;
758 BonoboUIComponent *ui_component;
760 gl_debug (DEBUG_MDI, "START");
762 active_window = bonobo_mdi_get_active_window (mdi);
764 if (active_window == NULL)
767 ui_component = bonobo_mdi_get_ui_component_from_window (active_window);
768 g_return_if_fail (ui_component != NULL);
770 active_child = bonobo_mdi_get_active_child (mdi);
772 bonobo_ui_component_freeze (ui_component, NULL);
774 if (active_child == NULL)
776 gl_menus_set_verb_list_sensitive (ui_component,
777 gl_menus_no_docs_sensible_verbs, FALSE);
782 gl_menus_set_verb_list_sensitive (ui_component,
783 gl_menus_all_sensible_verbs, TRUE);
786 doc = GL_MDI_CHILD (active_child)->label;
787 g_return_if_fail (doc != NULL);
789 if (!gl_label_can_undo (doc))
790 gl_menus_set_verb_sensitive (ui_component,
791 "/commands/EditUndo", FALSE);
793 if (!gl_label_can_redo (doc))
794 gl_menus_set_verb_sensitive (ui_component,
795 "/commands/EditRedo", FALSE);
797 if (!gl_label_is_modified (doc))
799 gl_menus_set_verb_list_sensitive (ui_component,
800 gl_menus_not_modified_doc_sensible_verbs,
806 bonobo_ui_component_thaw (ui_component, NULL);
808 gl_debug (DEBUG_MDI, "END");
812 /*****************************************************************************/
813 /* Set sensitivity of undo/redo verbs in active window. */
814 /*****************************************************************************/
816 gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi)
818 BonoboWindow* active_window = NULL;
819 BonoboMDIChild* active_child = NULL;
821 BonoboUIComponent *ui_component;
823 gl_debug (DEBUG_MDI, "START");
825 active_window = bonobo_mdi_get_active_window (mdi);
826 g_return_if_fail (active_window != NULL);
828 ui_component = bonobo_mdi_get_ui_component_from_window (active_window);
829 g_return_if_fail (ui_component != NULL);
831 active_child = bonobo_mdi_get_active_child (mdi);
832 doc = GL_MDI_CHILD (active_child)->label;
833 g_return_if_fail (doc != NULL);
835 bonobo_ui_component_freeze (ui_component, NULL);
837 gl_menus_set_verb_sensitive (ui_component, "/commands/EditUndo",
838 gl_label_can_undo (doc));
840 gl_menus_set_verb_sensitive (ui_component, "/commands/EditRedo",
841 gl_label_can_redo (doc));
843 bonobo_ui_component_thaw (ui_component, NULL);
845 gl_debug (DEBUG_MDI, "END");