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 "gnome-recent-view.h"
25 #include <gconf/gconf-client.h>
36 /*==========================================================================*/
37 /* Private macros and constants. */
38 /*==========================================================================*/
39 #define GLABELS_UI_XML GLABELS_UI_DIR "glabels-ui.xml"
41 /*==========================================================================*/
43 /*==========================================================================*/
46 /*==========================================================================*/
48 /*==========================================================================*/
50 static BonoboUIVerb gl_ui_verbs [] = {
51 BONOBO_UI_VERB ("FileNew", gl_cmd_file_new),
52 BONOBO_UI_VERB ("FileProperties", gl_cmd_file_properties),
53 BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open),
54 BONOBO_UI_VERB ("FileSave", gl_cmd_file_save),
55 BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as),
56 BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print),
57 BONOBO_UI_VERB ("FileClose", gl_cmd_file_close),
58 BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit),
59 BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut),
60 BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy),
61 BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste),
62 BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete),
63 BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all),
64 BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all),
65 BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow),
66 BONOBO_UI_VERB ("ToolsText", gl_tools_text),
67 BONOBO_UI_VERB ("ToolsBox", gl_tools_box),
68 BONOBO_UI_VERB ("ToolsLine", gl_tools_line),
69 BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse),
70 BONOBO_UI_VERB ("ToolsImage", gl_tools_image),
71 BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode),
72 BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin),
73 BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout),
74 BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1),
75 BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties),
76 BONOBO_UI_VERB ("ToolsObjectProperties", gl_tools_object_properties),
77 BONOBO_UI_VERB ("ToolsRaiseObjects", gl_tools_raise_objects),
78 BONOBO_UI_VERB ("ToolsLowerObjects", gl_tools_lower_objects),
79 BONOBO_UI_VERB ("ToolsRotateLeft", gl_tools_rotate_objects_left),
80 BONOBO_UI_VERB ("ToolsRotateRight", gl_tools_rotate_objects_right),
81 BONOBO_UI_VERB ("ToolsFlipHorizontal", gl_tools_flip_objects_horiz),
82 BONOBO_UI_VERB ("ToolsFlipVertical", gl_tools_flip_objects_vert),
83 BONOBO_UI_VERB ("ToolsAlignLeft", gl_tools_align_objects_left),
84 BONOBO_UI_VERB ("ToolsAlignRight", gl_tools_align_objects_right),
85 BONOBO_UI_VERB ("ToolsAlignHCenter", gl_tools_align_objects_hcenter),
86 BONOBO_UI_VERB ("ToolsAlignTop", gl_tools_align_objects_top),
87 BONOBO_UI_VERB ("ToolsAlignBottom", gl_tools_align_objects_bottom),
88 BONOBO_UI_VERB ("ToolsAlignVCenter", gl_tools_align_objects_vcenter),
89 BONOBO_UI_VERB ("ToolsCenterHorizontal", gl_tools_center_objects_horiz),
90 BONOBO_UI_VERB ("ToolsCenterVertical", gl_tools_center_objects_vert),
91 BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences),
92 BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents),
93 BONOBO_UI_VERB ("About", gl_cmd_help_about),
98 static gchar* doc_verbs [] = {
99 "/commands/FileProperties",
100 "/commands/FileSave",
101 "/commands/FileSaveAs",
102 "/commands/FilePrint",
103 "/commands/FilePrintPreview",
104 "/commands/FileClose",
105 "/commands/FileCloseAll",
106 "/commands/EditUndo",
107 "/commands/EditRedo",
109 "/commands/EditCopy",
110 "/commands/EditPaste",
111 "/commands/EditDelete",
112 "/commands/EditSelectAll",
113 "/commands/EditUnSelectAll",
114 "/commands/ToolsArrow",
115 "/commands/ToolsText",
116 "/commands/ToolsLine",
117 "/commands/ToolsBox",
118 "/commands/ToolsEllipse",
119 "/commands/ToolsImage",
120 "/commands/ToolsBarcode",
121 "/commands/ToolsZoomIn",
122 "/commands/ToolsZoomOut",
123 "/commands/ToolsZoom1to1",
124 "/commands/ToolsMergeProperties",
125 "/commands/ToolsObjectProperties",
126 "/commands/ToolsRaiseObjects",
127 "/commands/ToolsLowerObjects",
128 "/commands/ToolsRotateLeft",
129 "/commands/ToolsRotateRight",
130 "/commands/ToolsFlipHorizontal",
131 "/commands/ToolsFlipVertical",
132 "/commands/ToolsAlignLeft",
133 "/commands/ToolsAlignRight",
134 "/commands/ToolsAlignHCenter",
135 "/commands/ToolsAlignTop",
136 "/commands/ToolsAlignBottom",
137 "/commands/ToolsAlignVCenter",
138 "/commands/ToolsCenterHorizontal",
139 "/commands/ToolsCenterVertical",
140 "/menu/Objects/CreateObjects",
141 "/menu/Objects/Order",
142 "/menu/Objects/RotateFlip",
143 "/menu/Objects/AlignHoriz",
144 "/menu/Objects/AlignVert",
145 "/commands/ViewGrid",
146 "/commands/ViewMarkup",
151 static gchar* doc_modified_verbs [] = {
152 "/commands/FileSave",
157 static gchar* selection_verbs [] = {
159 "/commands/EditCopy",
160 "/commands/EditDelete",
161 "/commands/EditUnSelectAll",
162 "/commands/ToolsRaiseObjects",
163 "/commands/ToolsLowerObjects",
164 "/commands/ToolsRotateLeft",
165 "/commands/ToolsRotateRight",
166 "/commands/ToolsFlipHorizontal",
167 "/commands/ToolsFlipVertical",
168 "/commands/ToolsCenterHorizontal",
169 "/commands/ToolsCenterVertical",
170 "/menu/Objects/Order",
171 "/menu/Objects/RotateFlip",
172 "/menu/Objects/AlignHoriz",
173 "/menu/Objects/AlignVert",
178 static gchar* atomic_selection_verbs [] = {
179 "/commands/ToolsObjectProperties",
184 static gchar* multi_selection_verbs [] = {
185 "/commands/ToolsAlignLeft",
186 "/commands/ToolsAlignRight",
187 "/commands/ToolsAlignHCenter",
188 "/commands/ToolsAlignTop",
189 "/commands/ToolsAlignBottom",
190 "/commands/ToolsAlignVCenter",
196 /*==========================================================================*/
197 /* Local function prototypes */
198 /*==========================================================================*/
200 static void view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
202 Bonobo_UIComponent_EventType type,
206 static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
208 static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
210 static void set_view_style (BonoboUIComponent *ui_component);
212 static void set_verb_sensitive (BonoboUIComponent *ui_component,
216 static void set_verb_list_sensitive (BonoboUIComponent *ui_component,
220 static void set_verb_state (BonoboUIComponent *ui_component,
226 /*****************************************************************************/
227 /* Initialize UI component for given window. */
228 /*****************************************************************************/
230 gl_ui_init (BonoboUIComponent *ui_component,
232 GtkWidget *cursor_info_frame,
233 GtkWidget *zoom_info_frame)
235 GnomeRecentView *recent_view;
236 GnomeRecentModel *recent_model;
237 BonoboControl *control;
239 gl_debug (DEBUG_UI, "START");
241 gl_debug (DEBUG_UI, "window = %p", win);
243 g_return_if_fail (ui_component != NULL);
245 bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
246 "/glabels/UIConfig/kvps");
247 gl_debug (DEBUG_UI, "Path set");
249 bonobo_ui_util_set_ui (ui_component,
250 "", GLABELS_UI_XML, "gLabels", NULL);
251 gl_debug (DEBUG_UI, "UI set");
253 bonobo_ui_component_add_verb_list_with_data(ui_component,
255 gl_debug (DEBUG_UI, "verb list added");
257 /* Set the toolbar style according to prefs */
258 set_app_main_toolbar_style (ui_component);
260 /* Add listener for the view menu */
261 bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
262 (BonoboUIListenerFn)view_menu_item_toggled_cb,
265 bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
266 (BonoboUIListenerFn)view_menu_item_toggled_cb,
268 bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
269 (BonoboUIListenerFn)view_menu_item_toggled_cb,
271 bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
272 (BonoboUIListenerFn)view_menu_item_toggled_cb,
274 bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
275 (BonoboUIListenerFn)view_menu_item_toggled_cb,
278 /* Set the toolbar style according to prefs */
279 set_app_drawing_toolbar_style (ui_component);
281 /* Add listener for the view menu */
282 bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
283 (BonoboUIListenerFn)view_menu_item_toggled_cb,
286 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
287 (BonoboUIListenerFn)view_menu_item_toggled_cb,
289 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
290 (BonoboUIListenerFn)view_menu_item_toggled_cb,
292 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
293 (BonoboUIListenerFn)view_menu_item_toggled_cb,
295 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
296 (BonoboUIListenerFn)view_menu_item_toggled_cb,
300 /* Set view grid and markup visibility according to prefs */
301 set_view_style (ui_component);
303 /* Add listener for the view grid & markup */
304 bonobo_ui_component_add_listener (ui_component, "ViewGrid",
305 (BonoboUIListenerFn)view_menu_item_toggled_cb,
307 bonobo_ui_component_add_listener (ui_component, "ViewMarkup",
308 (BonoboUIListenerFn)view_menu_item_toggled_cb,
311 set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
314 bonobo_ui_component_set_prop (ui_component,
315 "/status", "hidden", "0", NULL);
317 control = bonobo_control_new (cursor_info_frame);
318 bonobo_ui_component_object_set (ui_component,
319 "/status/Cursor", BONOBO_OBJREF (control), NULL);
320 bonobo_object_unref (BONOBO_OBJECT (control));
321 bonobo_ui_component_set_prop (ui_component,
322 "/status/Cursor", "hidden", "0", NULL);
324 control = bonobo_control_new (zoom_info_frame);
325 bonobo_ui_component_object_set (ui_component,
326 "/status/Zoom", BONOBO_OBJREF (control), NULL);
327 bonobo_object_unref (BONOBO_OBJECT (control));
328 bonobo_ui_component_set_prop (ui_component,
329 "/status/Zoom", "hidden", "0", NULL);
332 /* add a GeditRecentView object */
333 recent_model = gl_recent_get_model ();
335 GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component,
336 "/menu/File/Recents"));
337 gnome_recent_view_set_model (recent_view, recent_model);
339 g_signal_connect (G_OBJECT (recent_view), "activate",
340 G_CALLBACK (gl_file_open_recent), win);
342 gl_debug (DEBUG_UI, "END");
345 /*****************************************************************************/
346 /* Update all verbs of given UI component. */
347 /*****************************************************************************/
349 gl_ui_update_all (BonoboUIComponent *ui_component,
354 gl_debug (DEBUG_UI, "START");
356 bonobo_ui_component_freeze (ui_component, NULL);
358 set_verb_list_sensitive (ui_component, doc_verbs, TRUE);
361 g_return_if_fail (label != NULL);
363 set_verb_sensitive (ui_component, "/commands/EditUndo",
364 gl_label_can_undo (label));
365 set_verb_sensitive (ui_component, "/commands/EditRedo",
366 gl_label_can_redo (label));
368 set_verb_list_sensitive (ui_component,
370 gl_label_is_modified (label));
372 set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
373 !gl_view_is_zoom_max (view));
374 set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
375 !gl_view_is_zoom_min (view));
377 set_verb_list_sensitive (ui_component,
379 !gl_view_is_selection_empty (view));
381 set_verb_list_sensitive (ui_component,
382 atomic_selection_verbs,
383 gl_view_is_selection_atomic (view));
385 set_verb_list_sensitive (ui_component,
386 multi_selection_verbs,
387 !gl_view_is_selection_empty (view)
388 && !gl_view_is_selection_atomic (view));
390 bonobo_ui_component_thaw (ui_component, NULL);
392 gl_debug (DEBUG_UI, "END");
395 /*****************************************************************************/
396 /* Update all verbs of given UI component to "no document" state. */
397 /*****************************************************************************/
399 gl_ui_update_nodoc (BonoboUIComponent *ui_component)
401 gl_debug (DEBUG_UI, "START");
403 bonobo_ui_component_freeze (ui_component, NULL);
405 set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
407 bonobo_ui_component_thaw (ui_component, NULL);
409 gl_debug (DEBUG_UI, "END");
412 /*****************************************************************************/
413 /* Update label modified verbs of given UI component. */
414 /*****************************************************************************/
416 gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
419 gl_debug (DEBUG_UI, "START");
421 bonobo_ui_component_freeze (ui_component, NULL);
423 set_verb_list_sensitive (ui_component,
425 gl_label_is_modified (label));
427 bonobo_ui_component_thaw (ui_component, NULL);
429 gl_debug (DEBUG_UI, "END");
432 /*****************************************************************************/
433 /* Update verbs associated with selection state of given UI component. */
434 /*****************************************************************************/
436 gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
439 gl_debug (DEBUG_UI, "START");
441 bonobo_ui_component_freeze (ui_component, NULL);
443 set_verb_list_sensitive (ui_component,
445 !gl_view_is_selection_empty (view));
447 set_verb_list_sensitive (ui_component,
448 atomic_selection_verbs,
449 gl_view_is_selection_atomic (view));
451 set_verb_list_sensitive (ui_component,
452 multi_selection_verbs,
453 !gl_view_is_selection_empty (view)
454 && !gl_view_is_selection_atomic (view));
456 bonobo_ui_component_thaw (ui_component, NULL);
458 gl_debug (DEBUG_UI, "END");
461 /*****************************************************************************/
462 /* Update verbs associated with zoom level of given UI component. */
463 /*****************************************************************************/
465 gl_ui_update_zoom_verbs (BonoboUIComponent *ui_component,
468 gl_debug (DEBUG_UI, "START");
470 bonobo_ui_component_freeze (ui_component, NULL);
472 set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
473 !gl_view_is_zoom_max (view));
474 set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
475 !gl_view_is_zoom_min (view));
477 bonobo_ui_component_thaw (ui_component, NULL);
479 gl_debug (DEBUG_UI, "END");
482 /*****************************************************************************/
483 /* Update undo/redo verbs of given UI component. */
484 /*****************************************************************************/
486 gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
489 gl_debug (DEBUG_UI, "START");
491 bonobo_ui_component_freeze (ui_component, NULL);
493 set_verb_sensitive (ui_component,
494 "/commands/EditUndo", gl_label_can_undo (label));
496 set_verb_sensitive (ui_component,
497 "/commands/EditRedo", gl_label_can_redo (label));
499 bonobo_ui_component_thaw (ui_component, NULL);
501 gl_debug (DEBUG_UI, "END");
504 /*---------------------------------------------------------------------------*/
505 /* PRIVATE. View menu item toggled callback. */
506 /*---------------------------------------------------------------------------*/
508 view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
510 Bonobo_UIComponent_EventType type,
516 gl_debug (DEBUG_UI, "");
518 s = (strcmp (state, "1") == 0);
520 if (strcmp (path, "ViewMainToolbar") == 0)
522 gl_prefs->main_toolbar_visible = s;
523 set_app_main_toolbar_style (ui_component);
524 gl_prefs_save_settings ();
529 if (s && (strcmp (path, "MainToolbarSystem") == 0))
531 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
532 set_app_main_toolbar_style (ui_component);
533 gl_prefs_save_settings ();
538 if (s && (strcmp (path, "MainToolbarIcon") == 0))
540 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
541 set_app_main_toolbar_style (ui_component);
542 gl_prefs_save_settings ();
547 if (s && (strcmp (path, "MainToolbarIconText") == 0))
549 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
550 set_app_main_toolbar_style (ui_component);
551 gl_prefs_save_settings ();
556 if (strcmp (path, "MainToolbarTooltips") == 0)
558 gl_prefs->main_toolbar_view_tooltips = s;
559 set_app_main_toolbar_style (ui_component);
560 gl_prefs_save_settings ();
565 if (strcmp (path, "ViewDrawingToolbar") == 0)
567 gl_prefs->drawing_toolbar_visible = s;
568 set_app_drawing_toolbar_style (ui_component);
569 gl_prefs_save_settings ();
574 if (s && (strcmp (path, "DrawingToolbarSystem") == 0))
576 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
577 set_app_drawing_toolbar_style (ui_component);
578 gl_prefs_save_settings ();
583 if (s && (strcmp (path, "DrawingToolbarIcon") == 0))
585 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS;
586 set_app_drawing_toolbar_style (ui_component);
587 gl_prefs_save_settings ();
592 if (s && (strcmp (path, "DrawingToolbarIconText") == 0))
594 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
595 set_app_drawing_toolbar_style (ui_component);
596 gl_prefs_save_settings ();
601 if (strcmp (path, "DrawingToolbarTooltips") == 0)
603 gl_prefs->drawing_toolbar_view_tooltips = s;
604 set_app_drawing_toolbar_style (ui_component);
605 gl_prefs_save_settings ();
610 if (strcmp (path, "ViewGrid") == 0)
612 gl_prefs->grid_visible = s;
614 gl_view_show_grid (GL_VIEW(GL_WINDOW(win)->view));
616 gl_view_hide_grid (GL_VIEW(GL_WINDOW(win)->view));
618 gl_prefs_save_settings ();
623 if (strcmp (path, "ViewMarkup") == 0)
625 gl_prefs->markup_visible = s;
627 gl_view_show_markup (GL_VIEW(GL_WINDOW(win)->view));
629 gl_view_hide_markup (GL_VIEW(GL_WINDOW(win)->view));
631 gl_prefs_save_settings ();
638 /*---------------------------------------------------------------------------*/
639 /* PRIVATE. Set main toolbar style. */
640 /*---------------------------------------------------------------------------*/
642 set_app_main_toolbar_style (BonoboUIComponent *ui_component)
647 gl_debug (DEBUG_UI, "START");
649 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
651 bonobo_ui_component_freeze (ui_component, NULL);
653 /* Updated view menu */
654 set_verb_state (ui_component,
655 "/commands/ViewMainToolbar",
656 gl_prefs->main_toolbar_visible);
658 set_verb_sensitive (ui_component,
659 "/commands/MainToolbarSystem",
660 gl_prefs->main_toolbar_visible);
661 set_verb_sensitive (ui_component,
662 "/commands/MainToolbarIcon",
663 gl_prefs->main_toolbar_visible);
664 set_verb_sensitive (ui_component,
665 "/commands/MainToolbarIconText",
666 gl_prefs->main_toolbar_visible);
667 set_verb_sensitive (ui_component,
668 "/commands/MainToolbarTooltips",
669 gl_prefs->main_toolbar_visible);
671 set_verb_state (ui_component,
672 "/commands/MainToolbarSystem",
673 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
675 set_verb_state (ui_component,
676 "/commands/MainToolbarIcon",
677 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
679 set_verb_state (ui_component,
680 "/commands/MainToolbarIconText",
681 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
683 set_verb_state (ui_component,
684 "/commands/MainToolbarTooltips",
685 gl_prefs->main_toolbar_view_tooltips);
688 /* Actually update main_toolbar style */
689 bonobo_ui_component_set_prop (
690 ui_component, "/MainToolbar",
691 "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
694 switch (gl_prefs->main_toolbar_buttons_style)
696 case GL_TOOLBAR_SYSTEM:
698 client = gconf_client_get_default ();
702 labels = gconf_client_get_bool (client,
703 "/desktop/gnome/interface/toolbar-labels", NULL);
705 g_object_unref (G_OBJECT (client));
709 bonobo_ui_component_set_prop (
710 ui_component, "/MainToolbar", "look", "both", NULL);
715 bonobo_ui_component_set_prop (
716 ui_component, "/MainToolbar", "look", "icons", NULL);
721 case GL_TOOLBAR_ICONS:
722 bonobo_ui_component_set_prop (
723 ui_component, "/MainToolbar", "look", "icon", NULL);
727 case GL_TOOLBAR_ICONS_AND_TEXT:
728 bonobo_ui_component_set_prop (
729 ui_component, "/MainToolbar", "look", "both", NULL);
737 bonobo_ui_component_set_prop (
738 ui_component, "/MainToolbar",
739 "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
742 bonobo_ui_component_thaw (ui_component, NULL);
744 gl_debug (DEBUG_UI, "END");
748 /*---------------------------------------------------------------------------*/
749 /* PRIVATE. Set drawing toolbar style. */
750 /*---------------------------------------------------------------------------*/
752 set_app_drawing_toolbar_style (BonoboUIComponent *ui_component)
757 gl_debug (DEBUG_UI, "START");
759 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
761 bonobo_ui_component_freeze (ui_component, NULL);
763 /* Updated view menu */
764 set_verb_state (ui_component,
765 "/commands/ViewDrawingToolbar",
766 gl_prefs->drawing_toolbar_visible);
768 set_verb_sensitive (ui_component,
769 "/commands/DrawingToolbarSystem",
770 gl_prefs->drawing_toolbar_visible);
771 set_verb_sensitive (ui_component,
772 "/commands/DrawingToolbarIcon",
773 gl_prefs->drawing_toolbar_visible);
774 set_verb_sensitive (ui_component,
775 "/commands/DrawingToolbarIconText",
776 gl_prefs->drawing_toolbar_visible);
777 set_verb_sensitive (ui_component,
778 "/commands/DrawingToolbarTooltips",
779 gl_prefs->drawing_toolbar_visible);
783 "/commands/DrawingToolbarSystem",
784 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
788 "/commands/DrawingToolbarIcon",
789 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS);
793 "/commands/DrawingToolbarIconText",
794 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
796 set_verb_state (ui_component,
797 "/commands/DrawingToolbarTooltips",
798 gl_prefs->drawing_toolbar_view_tooltips);
801 /* Actually update drawing_toolbar style */
802 bonobo_ui_component_set_prop (
803 ui_component, "/DrawingToolbar",
804 "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
807 switch (gl_prefs->drawing_toolbar_buttons_style)
809 case GL_TOOLBAR_SYSTEM:
811 client = gconf_client_get_default ();
815 labels = gconf_client_get_bool (client,
816 "/desktop/gnome/interface/toolbar-labels", NULL);
818 g_object_unref (G_OBJECT (client));
822 bonobo_ui_component_set_prop (
823 ui_component, "/DrawingToolbar", "look", "both", NULL);
828 bonobo_ui_component_set_prop (
829 ui_component, "/DrawingToolbar", "look", "icons", NULL);
834 case GL_TOOLBAR_ICONS:
835 bonobo_ui_component_set_prop (
836 ui_component, "/DrawingToolbar", "look", "icon", NULL);
840 case GL_TOOLBAR_ICONS_AND_TEXT:
841 bonobo_ui_component_set_prop (
842 ui_component, "/DrawingToolbar", "look", "both", NULL);
850 bonobo_ui_component_set_prop (
851 ui_component, "/DrawingToolbar",
852 "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
855 bonobo_ui_component_thaw (ui_component, NULL);
857 gl_debug (DEBUG_UI, "END");
860 /*---------------------------------------------------------------------------*/
861 /* PRIVATE. Set visibility of grid and markup. */
862 /*---------------------------------------------------------------------------*/
864 set_view_style (BonoboUIComponent *ui_component)
869 gl_debug (DEBUG_UI, "START");
871 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
873 bonobo_ui_component_freeze (ui_component, NULL);
875 set_verb_state (ui_component,
876 "/commands/ViewGrid",
877 gl_prefs->grid_visible);
879 set_verb_state (ui_component,
880 "/commands/ViewMarkup",
881 gl_prefs->markup_visible);
884 bonobo_ui_component_thaw (ui_component, NULL);
886 gl_debug (DEBUG_UI, "END");
890 /*---------------------------------------------------------------------------*/
891 /* Set sensitivity of verb. */
892 /*---------------------------------------------------------------------------*/
894 set_verb_sensitive (BonoboUIComponent *ui_component,
898 gl_debug (DEBUG_UI, "START");
900 g_return_if_fail (cname != NULL);
901 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
903 bonobo_ui_component_set_prop (ui_component,
906 sensitive ? "1" : "0",
909 gl_debug (DEBUG_UI, "END");
912 /*---------------------------------------------------------------------------*/
913 /* Set sensitivity of a list of verbs. */
914 /*---------------------------------------------------------------------------*/
916 set_verb_list_sensitive (BonoboUIComponent *ui_component,
920 gl_debug (DEBUG_UI, "START");
922 g_return_if_fail (vlist != NULL);
923 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
925 for ( ; *vlist; ++vlist)
927 bonobo_ui_component_set_prop (ui_component,
930 sensitive ? "1" : "0",
934 gl_debug (DEBUG_UI, "END");
937 /*---------------------------------------------------------------------------*/
938 /* Set state of a verb. */
939 /*---------------------------------------------------------------------------*/
941 set_verb_state (BonoboUIComponent *ui_component,
945 gl_debug (DEBUG_UI, "START");
947 g_return_if_fail (cname != NULL);
948 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
950 bonobo_ui_component_set_prop (ui_component,
956 gl_debug (DEBUG_UI, "END");