2 * (GLABELS) Label and Business Card Creation program for GNOME
4 * ui.c: GLabels ui 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 #include "recent-files/egg-recent-view.h"
25 #include "recent-files/egg-recent-view-bonobo.h"
26 #include <gconf/gconf-client.h>
38 /*==========================================================================*/
39 /* Private macros and constants. */
40 /*==========================================================================*/
41 #define GLABELS_UI_XML GLABELS_UI_DIR "glabels-ui.xml"
43 /*==========================================================================*/
45 /*==========================================================================*/
48 /*==========================================================================*/
50 /*==========================================================================*/
52 static BonoboUIVerb gl_ui_verbs [] = {
53 BONOBO_UI_VERB ("FileNew", gl_cmd_file_new),
54 BONOBO_UI_VERB ("FileProperties", gl_cmd_file_properties),
55 BONOBO_UI_VERB ("FileTemplateDesigner", gl_cmd_file_template_designer),
56 BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open),
57 BONOBO_UI_VERB ("FileSave", gl_cmd_file_save),
58 BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as),
59 BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print),
60 BONOBO_UI_VERB ("FileClose", gl_cmd_file_close),
61 BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit),
62 BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut),
63 BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy),
64 BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste),
65 BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete),
66 BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all),
67 BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all),
68 BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow),
69 BONOBO_UI_VERB ("ToolsText", gl_tools_text),
70 BONOBO_UI_VERB ("ToolsBox", gl_tools_box),
71 BONOBO_UI_VERB ("ToolsLine", gl_tools_line),
72 BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse),
73 BONOBO_UI_VERB ("ToolsImage", gl_tools_image),
74 BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode),
75 BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin),
76 BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout),
77 BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1),
78 BONOBO_UI_VERB ("ToolsZoomToFit", gl_tools_zoom_to_fit),
79 BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties),
80 BONOBO_UI_VERB ("ToolsRaiseObjects", gl_tools_raise_objects),
81 BONOBO_UI_VERB ("ToolsLowerObjects", gl_tools_lower_objects),
82 BONOBO_UI_VERB ("ToolsRotateLeft", gl_tools_rotate_objects_left),
83 BONOBO_UI_VERB ("ToolsRotateRight", gl_tools_rotate_objects_right),
84 BONOBO_UI_VERB ("ToolsFlipHorizontal", gl_tools_flip_objects_horiz),
85 BONOBO_UI_VERB ("ToolsFlipVertical", gl_tools_flip_objects_vert),
86 BONOBO_UI_VERB ("ToolsAlignLeft", gl_tools_align_objects_left),
87 BONOBO_UI_VERB ("ToolsAlignRight", gl_tools_align_objects_right),
88 BONOBO_UI_VERB ("ToolsAlignHCenter", gl_tools_align_objects_hcenter),
89 BONOBO_UI_VERB ("ToolsAlignTop", gl_tools_align_objects_top),
90 BONOBO_UI_VERB ("ToolsAlignBottom", gl_tools_align_objects_bottom),
91 BONOBO_UI_VERB ("ToolsAlignVCenter", gl_tools_align_objects_vcenter),
92 BONOBO_UI_VERB ("ToolsCenterHorizontal", gl_tools_center_objects_horiz),
93 BONOBO_UI_VERB ("ToolsCenterVertical", gl_tools_center_objects_vert),
94 BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences),
95 BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents),
96 BONOBO_UI_VERB ("About", gl_cmd_help_about),
101 static gchar* doc_verbs [] = {
102 "/commands/FileProperties",
103 "/commands/FileSave",
104 "/commands/FileSaveAs",
105 "/commands/FilePrint",
106 "/commands/FilePrintPreview",
107 "/commands/FileClose",
108 "/commands/FileCloseAll",
109 "/commands/EditUndo",
110 "/commands/EditRedo",
112 "/commands/EditCopy",
113 "/commands/EditPaste",
114 "/commands/EditDelete",
115 "/commands/EditSelectAll",
116 "/commands/EditUnSelectAll",
117 "/commands/ToolsArrow",
118 "/commands/ToolsText",
119 "/commands/ToolsLine",
120 "/commands/ToolsBox",
121 "/commands/ToolsEllipse",
122 "/commands/ToolsImage",
123 "/commands/ToolsBarcode",
124 "/commands/ToolsZoomIn",
125 "/commands/ToolsZoomOut",
126 "/commands/ToolsZoom1to1",
127 "/commands/ToolsZoomToFit",
128 "/commands/ToolsMergeProperties",
129 "/commands/ToolsRaiseObjects",
130 "/commands/ToolsLowerObjects",
131 "/commands/ToolsRotateLeft",
132 "/commands/ToolsRotateRight",
133 "/commands/ToolsFlipHorizontal",
134 "/commands/ToolsFlipVertical",
135 "/commands/ToolsAlignLeft",
136 "/commands/ToolsAlignRight",
137 "/commands/ToolsAlignHCenter",
138 "/commands/ToolsAlignTop",
139 "/commands/ToolsAlignBottom",
140 "/commands/ToolsAlignVCenter",
141 "/commands/ToolsCenterHorizontal",
142 "/commands/ToolsCenterVertical",
143 "/menu/Objects/CreateObjects",
144 "/menu/Objects/Order",
145 "/menu/Objects/RotateFlip",
146 "/menu/Objects/AlignHoriz",
147 "/menu/Objects/AlignVert",
148 "/commands/ViewGrid",
149 "/commands/ViewMarkup",
154 static gchar* doc_modified_verbs [] = {
155 "/commands/FileSave",
160 static gchar* selection_verbs [] = {
162 "/commands/EditCopy",
163 "/commands/EditDelete",
164 "/commands/EditUnSelectAll",
165 "/commands/ToolsRaiseObjects",
166 "/commands/ToolsLowerObjects",
167 "/commands/ToolsRotateLeft",
168 "/commands/ToolsRotateRight",
169 "/commands/ToolsFlipHorizontal",
170 "/commands/ToolsFlipVertical",
171 "/commands/ToolsCenterHorizontal",
172 "/commands/ToolsCenterVertical",
173 "/menu/Objects/Order",
174 "/menu/Objects/RotateFlip",
175 "/menu/Objects/AlignHoriz",
176 "/menu/Objects/AlignVert",
181 static gchar* atomic_selection_verbs [] = {
186 static gchar* multi_selection_verbs [] = {
187 "/commands/ToolsAlignLeft",
188 "/commands/ToolsAlignRight",
189 "/commands/ToolsAlignHCenter",
190 "/commands/ToolsAlignTop",
191 "/commands/ToolsAlignBottom",
192 "/commands/ToolsAlignVCenter",
198 /*==========================================================================*/
199 /* Local function prototypes */
200 /*==========================================================================*/
202 static void view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
204 Bonobo_UIComponent_EventType type,
208 static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
210 static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
212 static void set_app_property_toolbar_style (BonoboUIComponent *ui_component);
214 static void set_view_style (BonoboUIComponent *ui_component);
218 /*****************************************************************************/
219 /* Initialize UI component for given window. */
220 /*****************************************************************************/
222 gl_ui_init (BonoboUIComponent *ui_component,
224 GtkWidget *cursor_info_frame,
225 GtkWidget *zoom_info_frame)
227 EggRecentView *recent_view;
228 EggRecentModel *recent_model;
229 BonoboControl *control;
231 gl_debug (DEBUG_UI, "START");
233 gl_debug (DEBUG_UI, "window = %p", win);
235 g_return_if_fail (ui_component != NULL);
237 bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
238 "/glabels/UIConfig/kvps");
239 gl_debug (DEBUG_UI, "Path set");
241 bonobo_ui_util_set_ui (ui_component,
242 "", GLABELS_UI_XML, "gLabels", NULL);
243 gl_debug (DEBUG_UI, "UI set");
245 bonobo_ui_component_add_verb_list_with_data(ui_component,
247 gl_debug (DEBUG_UI, "verb list added");
249 /* Set the toolbar style according to prefs */
250 set_app_main_toolbar_style (ui_component);
252 /* Add listener for the view menu */
253 bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
254 (BonoboUIListenerFn)view_menu_item_toggled_cb,
257 bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
258 (BonoboUIListenerFn)view_menu_item_toggled_cb,
260 bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
261 (BonoboUIListenerFn)view_menu_item_toggled_cb,
263 bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
264 (BonoboUIListenerFn)view_menu_item_toggled_cb,
266 bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
267 (BonoboUIListenerFn)view_menu_item_toggled_cb,
270 /* Set the toolbar style according to prefs */
271 set_app_drawing_toolbar_style (ui_component);
273 /* Add listener for the view menu */
274 bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
275 (BonoboUIListenerFn)view_menu_item_toggled_cb,
278 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
279 (BonoboUIListenerFn)view_menu_item_toggled_cb,
281 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
282 (BonoboUIListenerFn)view_menu_item_toggled_cb,
284 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
285 (BonoboUIListenerFn)view_menu_item_toggled_cb,
287 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
288 (BonoboUIListenerFn)view_menu_item_toggled_cb,
291 /* Set the toolbar style according to prefs */
292 set_app_property_toolbar_style (ui_component);
294 /* Add listener for the view menu */
295 bonobo_ui_component_add_listener (ui_component, "ViewPropertyToolbar",
296 (BonoboUIListenerFn)view_menu_item_toggled_cb,
299 bonobo_ui_component_add_listener (ui_component, "PropertyToolbarTooltips",
300 (BonoboUIListenerFn)view_menu_item_toggled_cb,
304 /* Set view grid and markup visibility according to prefs */
305 set_view_style (ui_component);
307 /* Add listener for the view grid & markup */
308 bonobo_ui_component_add_listener (ui_component, "ViewGrid",
309 (BonoboUIListenerFn)view_menu_item_toggled_cb,
311 bonobo_ui_component_add_listener (ui_component, "ViewMarkup",
312 (BonoboUIListenerFn)view_menu_item_toggled_cb,
315 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
318 gl_debug (DEBUG_UI, "START Setup status bar.");
320 bonobo_ui_component_set_prop (ui_component,
321 "/status", "hidden", "0", NULL);
323 control = bonobo_control_new (cursor_info_frame);
324 bonobo_ui_component_object_set (ui_component,
325 "/status/Cursor", BONOBO_OBJREF (control), NULL);
326 bonobo_object_unref (BONOBO_OBJECT (control));
327 bonobo_ui_component_set_prop (ui_component,
328 "/status/Cursor", "hidden", "0", NULL);
330 control = bonobo_control_new (zoom_info_frame);
331 bonobo_ui_component_object_set (ui_component,
332 "/status/Zoom", BONOBO_OBJREF (control), NULL);
333 bonobo_object_unref (BONOBO_OBJECT (control));
334 bonobo_ui_component_set_prop (ui_component,
335 "/status/Zoom", "hidden", "0", NULL);
337 gl_debug (DEBUG_UI, "END Setup status bar.");
340 /* add an eggRecentView object */
341 recent_model = gl_recent_get_model ();
343 EGG_RECENT_VIEW (egg_recent_view_bonobo_new (ui_component,
344 "/menu/File/Recents"));
345 egg_recent_view_set_model (recent_view, recent_model);
347 g_signal_connect (G_OBJECT (recent_view), "activate",
348 G_CALLBACK (gl_file_open_recent), win);
350 /* Squirrel away a copy to be unreferenced in gl_ui_unref() */
351 g_object_set_data (G_OBJECT (ui_component), "recent-view", recent_view);
353 gl_debug (DEBUG_UI, "END");
356 /*****************************************************************************/
358 /*****************************************************************************/
360 gl_ui_unref (BonoboUIComponent *ui_component)
362 EggRecentView *recent_view;
364 /* Pull out recent view to unreference. */
365 recent_view = g_object_get_data (G_OBJECT(ui_component), "recent-view");
367 g_object_unref (recent_view);
370 bonobo_object_unref(ui_component);
373 /*****************************************************************************/
374 /* Update all verbs of given UI component. */
375 /*****************************************************************************/
377 gl_ui_update_all (BonoboUIComponent *ui_component,
382 gl_debug (DEBUG_UI, "START");
384 bonobo_ui_component_freeze (ui_component, NULL);
386 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, TRUE);
389 g_return_if_fail (label != NULL);
391 gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditUndo",
392 gl_label_can_undo (label));
393 gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditRedo",
394 gl_label_can_redo (label));
396 gl_ui_util_set_verb_list_sensitive (ui_component,
398 gl_label_is_modified (label));
400 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
401 !gl_view_is_zoom_max (view));
402 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
403 !gl_view_is_zoom_min (view));
405 gl_ui_util_set_verb_list_sensitive (ui_component,
407 !gl_view_is_selection_empty (view));
409 gl_ui_util_set_verb_list_sensitive (ui_component,
410 atomic_selection_verbs,
411 gl_view_is_selection_atomic (view));
413 gl_ui_util_set_verb_list_sensitive (ui_component,
414 multi_selection_verbs,
415 !gl_view_is_selection_empty (view)
416 && !gl_view_is_selection_atomic (view));
418 bonobo_ui_component_thaw (ui_component, NULL);
420 gl_debug (DEBUG_UI, "END");
423 /*****************************************************************************/
424 /* Update all verbs of given UI component to "no document" state. */
425 /*****************************************************************************/
427 gl_ui_update_nodoc (BonoboUIComponent *ui_component)
429 gl_debug (DEBUG_UI, "START");
431 bonobo_ui_component_freeze (ui_component, NULL);
433 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
435 bonobo_ui_component_thaw (ui_component, NULL);
437 gl_debug (DEBUG_UI, "END");
440 /*****************************************************************************/
441 /* Update label modified verbs of given UI component. */
442 /*****************************************************************************/
444 gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
447 gl_debug (DEBUG_UI, "START");
449 bonobo_ui_component_freeze (ui_component, NULL);
451 gl_ui_util_set_verb_list_sensitive (ui_component,
453 gl_label_is_modified (label));
455 bonobo_ui_component_thaw (ui_component, NULL);
457 gl_debug (DEBUG_UI, "END");
460 /*****************************************************************************/
461 /* Update verbs associated with selection state of given UI component. */
462 /*****************************************************************************/
464 gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
467 gl_debug (DEBUG_UI, "START");
469 bonobo_ui_component_freeze (ui_component, NULL);
471 gl_ui_util_set_verb_list_sensitive (ui_component,
473 !gl_view_is_selection_empty (view));
475 gl_ui_util_set_verb_list_sensitive (ui_component,
476 atomic_selection_verbs,
477 gl_view_is_selection_atomic (view));
479 gl_ui_util_set_verb_list_sensitive (ui_component,
480 multi_selection_verbs,
481 !gl_view_is_selection_empty (view)
482 && !gl_view_is_selection_atomic (view));
484 bonobo_ui_component_thaw (ui_component, NULL);
486 gl_debug (DEBUG_UI, "END");
489 /*****************************************************************************/
490 /* Update verbs associated with zoom level of given UI component. */
491 /*****************************************************************************/
493 gl_ui_update_zoom_verbs (BonoboUIComponent *ui_component,
496 gl_debug (DEBUG_UI, "START");
498 bonobo_ui_component_freeze (ui_component, NULL);
500 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
501 !gl_view_is_zoom_max (view));
502 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
503 !gl_view_is_zoom_min (view));
505 bonobo_ui_component_thaw (ui_component, NULL);
507 gl_debug (DEBUG_UI, "END");
510 /*****************************************************************************/
511 /* Update undo/redo verbs of given UI component. */
512 /*****************************************************************************/
514 gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
517 gl_debug (DEBUG_UI, "START");
519 bonobo_ui_component_freeze (ui_component, NULL);
521 gl_ui_util_set_verb_sensitive (ui_component,
522 "/commands/EditUndo",
523 gl_label_can_undo (label));
525 gl_ui_util_set_verb_sensitive (ui_component,
526 "/commands/EditRedo",
527 gl_label_can_redo (label));
529 bonobo_ui_component_thaw (ui_component, NULL);
531 gl_debug (DEBUG_UI, "END");
534 /*---------------------------------------------------------------------------*/
535 /* PRIVATE. View menu item toggled callback. */
536 /*---------------------------------------------------------------------------*/
538 view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
540 Bonobo_UIComponent_EventType type,
546 gl_debug (DEBUG_UI, "");
548 s = (strcmp (state, "1") == 0);
550 if (strcmp (path, "ViewMainToolbar") == 0)
552 gl_prefs->main_toolbar_visible = s;
553 set_app_main_toolbar_style (ui_component);
554 gl_prefs_model_save_settings (gl_prefs);
559 if (s && (strcmp (path, "MainToolbarSystem") == 0))
561 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
562 set_app_main_toolbar_style (ui_component);
563 gl_prefs_model_save_settings (gl_prefs);
568 if (s && (strcmp (path, "MainToolbarIcon") == 0))
570 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
571 set_app_main_toolbar_style (ui_component);
572 gl_prefs_model_save_settings (gl_prefs);
577 if (s && (strcmp (path, "MainToolbarIconText") == 0))
579 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
580 set_app_main_toolbar_style (ui_component);
581 gl_prefs_model_save_settings (gl_prefs);
586 if (strcmp (path, "MainToolbarTooltips") == 0)
588 gl_prefs->main_toolbar_view_tooltips = s;
589 set_app_main_toolbar_style (ui_component);
590 gl_prefs_model_save_settings (gl_prefs);
595 if (strcmp (path, "ViewDrawingToolbar") == 0)
597 gl_prefs->drawing_toolbar_visible = s;
598 set_app_drawing_toolbar_style (ui_component);
599 gl_prefs_model_save_settings (gl_prefs);
604 if (s && (strcmp (path, "DrawingToolbarSystem") == 0))
606 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
607 set_app_drawing_toolbar_style (ui_component);
608 gl_prefs_model_save_settings (gl_prefs);
613 if (s && (strcmp (path, "DrawingToolbarIcon") == 0))
615 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS;
616 set_app_drawing_toolbar_style (ui_component);
617 gl_prefs_model_save_settings (gl_prefs);
622 if (s && (strcmp (path, "DrawingToolbarIconText") == 0))
624 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
625 set_app_drawing_toolbar_style (ui_component);
626 gl_prefs_model_save_settings (gl_prefs);
631 if (strcmp (path, "DrawingToolbarTooltips") == 0)
633 gl_prefs->drawing_toolbar_view_tooltips = s;
634 set_app_drawing_toolbar_style (ui_component);
635 gl_prefs_model_save_settings (gl_prefs);
640 if (strcmp (path, "ViewPropertyToolbar") == 0)
642 gl_prefs->property_toolbar_visible = s;
643 set_app_property_toolbar_style (ui_component);
644 gl_prefs_model_save_settings (gl_prefs);
649 if (strcmp (path, "PropertyToolbarTooltips") == 0)
651 gl_prefs->property_toolbar_view_tooltips = s;
652 set_app_property_toolbar_style (ui_component);
653 gl_prefs_model_save_settings (gl_prefs);
658 if (strcmp (path, "ViewGrid") == 0)
660 gl_prefs->grid_visible = s;
662 gl_view_show_grid (GL_VIEW(GL_WINDOW(win)->view));
664 gl_view_hide_grid (GL_VIEW(GL_WINDOW(win)->view));
666 gl_prefs_model_save_settings (gl_prefs);
671 if (strcmp (path, "ViewMarkup") == 0)
673 gl_prefs->markup_visible = s;
675 gl_view_show_markup (GL_VIEW(GL_WINDOW(win)->view));
677 gl_view_hide_markup (GL_VIEW(GL_WINDOW(win)->view));
679 gl_prefs_model_save_settings (gl_prefs);
686 /*---------------------------------------------------------------------------*/
687 /* PRIVATE. Set main toolbar style. */
688 /*---------------------------------------------------------------------------*/
690 set_app_main_toolbar_style (BonoboUIComponent *ui_component)
695 gl_debug (DEBUG_UI, "START");
697 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
699 bonobo_ui_component_freeze (ui_component, NULL);
701 /* Updated view menu */
702 gl_ui_util_set_verb_state (ui_component,
703 "/commands/ViewMainToolbar",
704 gl_prefs->main_toolbar_visible);
706 gl_ui_util_set_verb_sensitive (ui_component,
707 "/commands/MainToolbarSystem",
708 gl_prefs->main_toolbar_visible);
709 gl_ui_util_set_verb_sensitive (ui_component,
710 "/commands/MainToolbarIcon",
711 gl_prefs->main_toolbar_visible);
712 gl_ui_util_set_verb_sensitive (ui_component,
713 "/commands/MainToolbarIconText",
714 gl_prefs->main_toolbar_visible);
715 gl_ui_util_set_verb_sensitive (ui_component,
716 "/commands/MainToolbarTooltips",
717 gl_prefs->main_toolbar_visible);
719 gl_ui_util_set_verb_state (ui_component,
720 "/commands/MainToolbarSystem",
721 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
723 gl_ui_util_set_verb_state (ui_component,
724 "/commands/MainToolbarIcon",
725 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
727 gl_ui_util_set_verb_state (ui_component,
728 "/commands/MainToolbarIconText",
729 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
731 gl_ui_util_set_verb_state (ui_component,
732 "/commands/MainToolbarTooltips",
733 gl_prefs->main_toolbar_view_tooltips);
736 /* Actually update main_toolbar style */
737 bonobo_ui_component_set_prop (
738 ui_component, "/MainToolbar",
739 "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
742 switch (gl_prefs->main_toolbar_buttons_style)
744 case GL_TOOLBAR_SYSTEM:
746 client = gconf_client_get_default ();
750 labels = gconf_client_get_bool (client,
751 "/desktop/gnome/interface/toolbar-labels", NULL);
753 g_object_unref (G_OBJECT (client));
757 bonobo_ui_component_set_prop (
758 ui_component, "/MainToolbar", "look", "both", NULL);
763 bonobo_ui_component_set_prop (
764 ui_component, "/MainToolbar", "look", "icons", NULL);
769 case GL_TOOLBAR_ICONS:
770 bonobo_ui_component_set_prop (
771 ui_component, "/MainToolbar", "look", "icon", NULL);
775 case GL_TOOLBAR_ICONS_AND_TEXT:
776 bonobo_ui_component_set_prop (
777 ui_component, "/MainToolbar", "look", "both", NULL);
785 bonobo_ui_component_set_prop (
786 ui_component, "/MainToolbar",
787 "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
790 bonobo_ui_component_thaw (ui_component, NULL);
792 gl_debug (DEBUG_UI, "END");
796 /*---------------------------------------------------------------------------*/
797 /* PRIVATE. Set drawing toolbar style. */
798 /*---------------------------------------------------------------------------*/
800 set_app_drawing_toolbar_style (BonoboUIComponent *ui_component)
805 gl_debug (DEBUG_UI, "START");
807 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
809 bonobo_ui_component_freeze (ui_component, NULL);
811 /* Updated view menu */
812 gl_ui_util_set_verb_state (ui_component,
813 "/commands/ViewDrawingToolbar",
814 gl_prefs->drawing_toolbar_visible);
816 gl_ui_util_set_verb_sensitive (ui_component,
817 "/commands/DrawingToolbarSystem",
818 gl_prefs->drawing_toolbar_visible);
819 gl_ui_util_set_verb_sensitive (ui_component,
820 "/commands/DrawingToolbarIcon",
821 gl_prefs->drawing_toolbar_visible);
822 gl_ui_util_set_verb_sensitive (ui_component,
823 "/commands/DrawingToolbarIconText",
824 gl_prefs->drawing_toolbar_visible);
825 gl_ui_util_set_verb_sensitive (ui_component,
826 "/commands/DrawingToolbarTooltips",
827 gl_prefs->drawing_toolbar_visible);
829 gl_ui_util_set_verb_state (
831 "/commands/DrawingToolbarSystem",
832 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
834 gl_ui_util_set_verb_state (
836 "/commands/DrawingToolbarIcon",
837 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS);
839 gl_ui_util_set_verb_state (
841 "/commands/DrawingToolbarIconText",
842 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
844 gl_ui_util_set_verb_state (ui_component,
845 "/commands/DrawingToolbarTooltips",
846 gl_prefs->drawing_toolbar_view_tooltips);
849 /* Actually update drawing_toolbar style */
850 bonobo_ui_component_set_prop (
851 ui_component, "/DrawingToolbar",
852 "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
855 switch (gl_prefs->drawing_toolbar_buttons_style)
857 case GL_TOOLBAR_SYSTEM:
859 client = gconf_client_get_default ();
863 labels = gconf_client_get_bool (client,
864 "/desktop/gnome/interface/toolbar-labels", NULL);
866 g_object_unref (G_OBJECT (client));
870 bonobo_ui_component_set_prop (
871 ui_component, "/DrawingToolbar", "look", "both", NULL);
876 bonobo_ui_component_set_prop (
877 ui_component, "/DrawingToolbar", "look", "icons", NULL);
882 case GL_TOOLBAR_ICONS:
883 bonobo_ui_component_set_prop (
884 ui_component, "/DrawingToolbar", "look", "icon", NULL);
888 case GL_TOOLBAR_ICONS_AND_TEXT:
889 bonobo_ui_component_set_prop (
890 ui_component, "/DrawingToolbar", "look", "both", NULL);
898 bonobo_ui_component_set_prop (
899 ui_component, "/DrawingToolbar",
900 "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
903 bonobo_ui_component_thaw (ui_component, NULL);
905 gl_debug (DEBUG_UI, "END");
908 /*---------------------------------------------------------------------------*/
909 /* PRIVATE. Set property toolbar style. */
910 /*---------------------------------------------------------------------------*/
912 set_app_property_toolbar_style (BonoboUIComponent *ui_component)
917 gl_debug (DEBUG_UI, "START");
919 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
921 bonobo_ui_component_freeze (ui_component, NULL);
923 /* Updated view menu */
924 gl_ui_util_set_verb_state (ui_component,
925 "/commands/ViewPropertyToolbar",
926 gl_prefs->property_toolbar_visible);
928 gl_ui_util_set_verb_sensitive (ui_component,
929 "/commands/PropertyToolbarTooltips",
930 gl_prefs->property_toolbar_visible);
932 gl_ui_util_set_verb_state (ui_component,
933 "/commands/PropertyToolbarTooltips",
934 gl_prefs->property_toolbar_view_tooltips);
937 /* Actually update property_toolbar style */
938 bonobo_ui_component_set_prop (
939 ui_component, "/PropertyToolbar",
940 "tips", gl_prefs->property_toolbar_view_tooltips ? "1" : "0",
943 bonobo_ui_component_set_prop (
944 ui_component, "/PropertyToolbar",
945 "hidden", gl_prefs->property_toolbar_visible ? "0":"1", NULL);
947 bonobo_ui_component_thaw (ui_component, NULL);
949 gl_debug (DEBUG_UI, "END");
952 /*---------------------------------------------------------------------------*/
953 /* PRIVATE. Set visibility of grid and markup. */
954 /*---------------------------------------------------------------------------*/
956 set_view_style (BonoboUIComponent *ui_component)
961 gl_debug (DEBUG_UI, "START");
963 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
965 bonobo_ui_component_freeze (ui_component, NULL);
967 gl_ui_util_set_verb_state (ui_component,
968 "/commands/ViewGrid",
969 gl_prefs->grid_visible);
971 gl_ui_util_set_verb_state (ui_component,
972 "/commands/ViewMarkup",
973 gl_prefs->markup_visible);
976 bonobo_ui_component_thaw (ui_component, NULL);
978 gl_debug (DEBUG_UI, "END");