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 ("FileOpen", gl_cmd_file_open),
56 BONOBO_UI_VERB ("FileSave", gl_cmd_file_save),
57 BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as),
58 BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print),
59 BONOBO_UI_VERB ("FileClose", gl_cmd_file_close),
60 BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit),
61 BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut),
62 BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy),
63 BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste),
64 BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete),
65 BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all),
66 BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all),
67 BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow),
68 BONOBO_UI_VERB ("ToolsText", gl_tools_text),
69 BONOBO_UI_VERB ("ToolsBox", gl_tools_box),
70 BONOBO_UI_VERB ("ToolsLine", gl_tools_line),
71 BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse),
72 BONOBO_UI_VERB ("ToolsImage", gl_tools_image),
73 BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode),
74 BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin),
75 BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout),
76 BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1),
77 BONOBO_UI_VERB ("ToolsZoomToFit", gl_tools_zoom_to_fit),
78 BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties),
79 BONOBO_UI_VERB ("ToolsRaiseObjects", gl_tools_raise_objects),
80 BONOBO_UI_VERB ("ToolsLowerObjects", gl_tools_lower_objects),
81 BONOBO_UI_VERB ("ToolsRotateLeft", gl_tools_rotate_objects_left),
82 BONOBO_UI_VERB ("ToolsRotateRight", gl_tools_rotate_objects_right),
83 BONOBO_UI_VERB ("ToolsFlipHorizontal", gl_tools_flip_objects_horiz),
84 BONOBO_UI_VERB ("ToolsFlipVertical", gl_tools_flip_objects_vert),
85 BONOBO_UI_VERB ("ToolsAlignLeft", gl_tools_align_objects_left),
86 BONOBO_UI_VERB ("ToolsAlignRight", gl_tools_align_objects_right),
87 BONOBO_UI_VERB ("ToolsAlignHCenter", gl_tools_align_objects_hcenter),
88 BONOBO_UI_VERB ("ToolsAlignTop", gl_tools_align_objects_top),
89 BONOBO_UI_VERB ("ToolsAlignBottom", gl_tools_align_objects_bottom),
90 BONOBO_UI_VERB ("ToolsAlignVCenter", gl_tools_align_objects_vcenter),
91 BONOBO_UI_VERB ("ToolsCenterHorizontal", gl_tools_center_objects_horiz),
92 BONOBO_UI_VERB ("ToolsCenterVertical", gl_tools_center_objects_vert),
93 BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences),
94 BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents),
95 BONOBO_UI_VERB ("About", gl_cmd_help_about),
100 static gchar* doc_verbs [] = {
101 "/commands/FileProperties",
102 "/commands/FileSave",
103 "/commands/FileSaveAs",
104 "/commands/FilePrint",
105 "/commands/FilePrintPreview",
106 "/commands/FileClose",
107 "/commands/FileCloseAll",
108 "/commands/EditUndo",
109 "/commands/EditRedo",
111 "/commands/EditCopy",
112 "/commands/EditPaste",
113 "/commands/EditDelete",
114 "/commands/EditSelectAll",
115 "/commands/EditUnSelectAll",
116 "/commands/ToolsArrow",
117 "/commands/ToolsText",
118 "/commands/ToolsLine",
119 "/commands/ToolsBox",
120 "/commands/ToolsEllipse",
121 "/commands/ToolsImage",
122 "/commands/ToolsBarcode",
123 "/commands/ToolsZoomIn",
124 "/commands/ToolsZoomOut",
125 "/commands/ToolsZoom1to1",
126 "/commands/ToolsZoomToFit",
127 "/commands/ToolsMergeProperties",
128 "/commands/ToolsRaiseObjects",
129 "/commands/ToolsLowerObjects",
130 "/commands/ToolsRotateLeft",
131 "/commands/ToolsRotateRight",
132 "/commands/ToolsFlipHorizontal",
133 "/commands/ToolsFlipVertical",
134 "/commands/ToolsAlignLeft",
135 "/commands/ToolsAlignRight",
136 "/commands/ToolsAlignHCenter",
137 "/commands/ToolsAlignTop",
138 "/commands/ToolsAlignBottom",
139 "/commands/ToolsAlignVCenter",
140 "/commands/ToolsCenterHorizontal",
141 "/commands/ToolsCenterVertical",
142 "/menu/Objects/CreateObjects",
143 "/menu/Objects/Order",
144 "/menu/Objects/RotateFlip",
145 "/menu/Objects/AlignHoriz",
146 "/menu/Objects/AlignVert",
147 "/commands/ViewGrid",
148 "/commands/ViewMarkup",
153 static gchar* doc_modified_verbs [] = {
154 "/commands/FileSave",
159 static gchar* selection_verbs [] = {
161 "/commands/EditCopy",
162 "/commands/EditDelete",
163 "/commands/EditUnSelectAll",
164 "/commands/ToolsRaiseObjects",
165 "/commands/ToolsLowerObjects",
166 "/commands/ToolsRotateLeft",
167 "/commands/ToolsRotateRight",
168 "/commands/ToolsFlipHorizontal",
169 "/commands/ToolsFlipVertical",
170 "/commands/ToolsCenterHorizontal",
171 "/commands/ToolsCenterVertical",
172 "/menu/Objects/Order",
173 "/menu/Objects/RotateFlip",
174 "/menu/Objects/AlignHoriz",
175 "/menu/Objects/AlignVert",
180 static gchar* atomic_selection_verbs [] = {
185 static gchar* multi_selection_verbs [] = {
186 "/commands/ToolsAlignLeft",
187 "/commands/ToolsAlignRight",
188 "/commands/ToolsAlignHCenter",
189 "/commands/ToolsAlignTop",
190 "/commands/ToolsAlignBottom",
191 "/commands/ToolsAlignVCenter",
197 /*==========================================================================*/
198 /* Local function prototypes */
199 /*==========================================================================*/
201 static void view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
203 Bonobo_UIComponent_EventType type,
207 static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
209 static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
211 static void set_app_property_toolbar_style (BonoboUIComponent *ui_component);
213 static void set_view_style (BonoboUIComponent *ui_component);
217 /*****************************************************************************/
218 /* Initialize UI component for given window. */
219 /*****************************************************************************/
221 gl_ui_init (BonoboUIComponent *ui_component,
223 GtkWidget *cursor_info_frame,
224 GtkWidget *zoom_info_frame)
226 EggRecentView *recent_view;
227 EggRecentModel *recent_model;
228 BonoboControl *control;
230 gl_debug (DEBUG_UI, "START");
232 gl_debug (DEBUG_UI, "window = %p", win);
234 g_return_if_fail (ui_component != NULL);
236 bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
237 "/glabels/UIConfig/kvps");
238 gl_debug (DEBUG_UI, "Path set");
240 bonobo_ui_util_set_ui (ui_component,
241 "", GLABELS_UI_XML, "gLabels", NULL);
242 gl_debug (DEBUG_UI, "UI set");
244 bonobo_ui_component_add_verb_list_with_data(ui_component,
246 gl_debug (DEBUG_UI, "verb list added");
248 /* Set the toolbar style according to prefs */
249 set_app_main_toolbar_style (ui_component);
251 /* Add listener for the view menu */
252 bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
253 (BonoboUIListenerFn)view_menu_item_toggled_cb,
256 bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
257 (BonoboUIListenerFn)view_menu_item_toggled_cb,
259 bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
260 (BonoboUIListenerFn)view_menu_item_toggled_cb,
262 bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
263 (BonoboUIListenerFn)view_menu_item_toggled_cb,
265 bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
266 (BonoboUIListenerFn)view_menu_item_toggled_cb,
269 /* Set the toolbar style according to prefs */
270 set_app_drawing_toolbar_style (ui_component);
272 /* Add listener for the view menu */
273 bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
274 (BonoboUIListenerFn)view_menu_item_toggled_cb,
277 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
278 (BonoboUIListenerFn)view_menu_item_toggled_cb,
280 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
281 (BonoboUIListenerFn)view_menu_item_toggled_cb,
283 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
284 (BonoboUIListenerFn)view_menu_item_toggled_cb,
286 bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
287 (BonoboUIListenerFn)view_menu_item_toggled_cb,
290 /* Set the toolbar style according to prefs */
291 set_app_property_toolbar_style (ui_component);
293 /* Add listener for the view menu */
294 bonobo_ui_component_add_listener (ui_component, "ViewPropertyToolbar",
295 (BonoboUIListenerFn)view_menu_item_toggled_cb,
298 bonobo_ui_component_add_listener (ui_component, "PropertyToolbarTooltips",
299 (BonoboUIListenerFn)view_menu_item_toggled_cb,
303 /* Set view grid and markup visibility according to prefs */
304 set_view_style (ui_component);
306 /* Add listener for the view grid & markup */
307 bonobo_ui_component_add_listener (ui_component, "ViewGrid",
308 (BonoboUIListenerFn)view_menu_item_toggled_cb,
310 bonobo_ui_component_add_listener (ui_component, "ViewMarkup",
311 (BonoboUIListenerFn)view_menu_item_toggled_cb,
314 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
317 gl_debug (DEBUG_UI, "START Setup status bar.");
319 bonobo_ui_component_set_prop (ui_component,
320 "/status", "hidden", "0", NULL);
322 control = bonobo_control_new (cursor_info_frame);
323 bonobo_ui_component_object_set (ui_component,
324 "/status/Cursor", BONOBO_OBJREF (control), NULL);
325 bonobo_object_unref (BONOBO_OBJECT (control));
326 bonobo_ui_component_set_prop (ui_component,
327 "/status/Cursor", "hidden", "0", NULL);
329 control = bonobo_control_new (zoom_info_frame);
330 bonobo_ui_component_object_set (ui_component,
331 "/status/Zoom", BONOBO_OBJREF (control), NULL);
332 bonobo_object_unref (BONOBO_OBJECT (control));
333 bonobo_ui_component_set_prop (ui_component,
334 "/status/Zoom", "hidden", "0", NULL);
336 gl_debug (DEBUG_UI, "END Setup status bar.");
339 /* add an eggRecentView object */
340 recent_model = gl_recent_get_model ();
342 EGG_RECENT_VIEW (egg_recent_view_bonobo_new (ui_component,
343 "/menu/File/Recents"));
344 egg_recent_view_set_model (recent_view, recent_model);
346 g_signal_connect (G_OBJECT (recent_view), "activate",
347 G_CALLBACK (gl_file_open_recent), win);
349 /* Squirrel away a copy to be unreferenced in gl_ui_unref() */
350 g_object_set_data (G_OBJECT (ui_component), "recent-view", recent_view);
352 gl_debug (DEBUG_UI, "END");
355 /*****************************************************************************/
357 /*****************************************************************************/
359 gl_ui_unref (BonoboUIComponent *ui_component)
361 EggRecentView *recent_view;
363 /* Pull out recent view to unreference. */
364 recent_view = g_object_get_data (G_OBJECT(ui_component), "recent-view");
366 g_object_unref (recent_view);
369 bonobo_object_unref(ui_component);
372 /*****************************************************************************/
373 /* Update all verbs of given UI component. */
374 /*****************************************************************************/
376 gl_ui_update_all (BonoboUIComponent *ui_component,
381 gl_debug (DEBUG_UI, "START");
383 bonobo_ui_component_freeze (ui_component, NULL);
385 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, TRUE);
388 g_return_if_fail (label != NULL);
390 gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditUndo",
391 gl_label_can_undo (label));
392 gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditRedo",
393 gl_label_can_redo (label));
395 gl_ui_util_set_verb_list_sensitive (ui_component,
397 gl_label_is_modified (label));
399 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
400 !gl_view_is_zoom_max (view));
401 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
402 !gl_view_is_zoom_min (view));
404 gl_ui_util_set_verb_list_sensitive (ui_component,
406 !gl_view_is_selection_empty (view));
408 gl_ui_util_set_verb_list_sensitive (ui_component,
409 atomic_selection_verbs,
410 gl_view_is_selection_atomic (view));
412 gl_ui_util_set_verb_list_sensitive (ui_component,
413 multi_selection_verbs,
414 !gl_view_is_selection_empty (view)
415 && !gl_view_is_selection_atomic (view));
417 bonobo_ui_component_thaw (ui_component, NULL);
419 gl_debug (DEBUG_UI, "END");
422 /*****************************************************************************/
423 /* Update all verbs of given UI component to "no document" state. */
424 /*****************************************************************************/
426 gl_ui_update_nodoc (BonoboUIComponent *ui_component)
428 gl_debug (DEBUG_UI, "START");
430 bonobo_ui_component_freeze (ui_component, NULL);
432 gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
434 bonobo_ui_component_thaw (ui_component, NULL);
436 gl_debug (DEBUG_UI, "END");
439 /*****************************************************************************/
440 /* Update label modified verbs of given UI component. */
441 /*****************************************************************************/
443 gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
446 gl_debug (DEBUG_UI, "START");
448 bonobo_ui_component_freeze (ui_component, NULL);
450 gl_ui_util_set_verb_list_sensitive (ui_component,
452 gl_label_is_modified (label));
454 bonobo_ui_component_thaw (ui_component, NULL);
456 gl_debug (DEBUG_UI, "END");
459 /*****************************************************************************/
460 /* Update verbs associated with selection state of given UI component. */
461 /*****************************************************************************/
463 gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
466 gl_debug (DEBUG_UI, "START");
468 bonobo_ui_component_freeze (ui_component, NULL);
470 gl_ui_util_set_verb_list_sensitive (ui_component,
472 !gl_view_is_selection_empty (view));
474 gl_ui_util_set_verb_list_sensitive (ui_component,
475 atomic_selection_verbs,
476 gl_view_is_selection_atomic (view));
478 gl_ui_util_set_verb_list_sensitive (ui_component,
479 multi_selection_verbs,
480 !gl_view_is_selection_empty (view)
481 && !gl_view_is_selection_atomic (view));
483 bonobo_ui_component_thaw (ui_component, NULL);
485 gl_debug (DEBUG_UI, "END");
488 /*****************************************************************************/
489 /* Update verbs associated with zoom level of given UI component. */
490 /*****************************************************************************/
492 gl_ui_update_zoom_verbs (BonoboUIComponent *ui_component,
495 gl_debug (DEBUG_UI, "START");
497 bonobo_ui_component_freeze (ui_component, NULL);
499 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
500 !gl_view_is_zoom_max (view));
501 gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
502 !gl_view_is_zoom_min (view));
504 bonobo_ui_component_thaw (ui_component, NULL);
506 gl_debug (DEBUG_UI, "END");
509 /*****************************************************************************/
510 /* Update undo/redo verbs of given UI component. */
511 /*****************************************************************************/
513 gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
516 gl_debug (DEBUG_UI, "START");
518 bonobo_ui_component_freeze (ui_component, NULL);
520 gl_ui_util_set_verb_sensitive (ui_component,
521 "/commands/EditUndo",
522 gl_label_can_undo (label));
524 gl_ui_util_set_verb_sensitive (ui_component,
525 "/commands/EditRedo",
526 gl_label_can_redo (label));
528 bonobo_ui_component_thaw (ui_component, NULL);
530 gl_debug (DEBUG_UI, "END");
533 /*---------------------------------------------------------------------------*/
534 /* PRIVATE. View menu item toggled callback. */
535 /*---------------------------------------------------------------------------*/
537 view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
539 Bonobo_UIComponent_EventType type,
545 gl_debug (DEBUG_UI, "");
547 s = (strcmp (state, "1") == 0);
549 if (strcmp (path, "ViewMainToolbar") == 0)
551 gl_prefs->main_toolbar_visible = s;
552 set_app_main_toolbar_style (ui_component);
553 gl_prefs_model_save_settings (gl_prefs);
558 if (s && (strcmp (path, "MainToolbarSystem") == 0))
560 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
561 set_app_main_toolbar_style (ui_component);
562 gl_prefs_model_save_settings (gl_prefs);
567 if (s && (strcmp (path, "MainToolbarIcon") == 0))
569 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
570 set_app_main_toolbar_style (ui_component);
571 gl_prefs_model_save_settings (gl_prefs);
576 if (s && (strcmp (path, "MainToolbarIconText") == 0))
578 gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
579 set_app_main_toolbar_style (ui_component);
580 gl_prefs_model_save_settings (gl_prefs);
585 if (strcmp (path, "MainToolbarTooltips") == 0)
587 gl_prefs->main_toolbar_view_tooltips = s;
588 set_app_main_toolbar_style (ui_component);
589 gl_prefs_model_save_settings (gl_prefs);
594 if (strcmp (path, "ViewDrawingToolbar") == 0)
596 gl_prefs->drawing_toolbar_visible = s;
597 set_app_drawing_toolbar_style (ui_component);
598 gl_prefs_model_save_settings (gl_prefs);
603 if (s && (strcmp (path, "DrawingToolbarSystem") == 0))
605 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
606 set_app_drawing_toolbar_style (ui_component);
607 gl_prefs_model_save_settings (gl_prefs);
612 if (s && (strcmp (path, "DrawingToolbarIcon") == 0))
614 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS;
615 set_app_drawing_toolbar_style (ui_component);
616 gl_prefs_model_save_settings (gl_prefs);
621 if (s && (strcmp (path, "DrawingToolbarIconText") == 0))
623 gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
624 set_app_drawing_toolbar_style (ui_component);
625 gl_prefs_model_save_settings (gl_prefs);
630 if (strcmp (path, "DrawingToolbarTooltips") == 0)
632 gl_prefs->drawing_toolbar_view_tooltips = s;
633 set_app_drawing_toolbar_style (ui_component);
634 gl_prefs_model_save_settings (gl_prefs);
639 if (strcmp (path, "ViewPropertyToolbar") == 0)
641 gl_prefs->property_toolbar_visible = s;
642 set_app_property_toolbar_style (ui_component);
643 gl_prefs_model_save_settings (gl_prefs);
648 if (strcmp (path, "PropertyToolbarTooltips") == 0)
650 gl_prefs->property_toolbar_view_tooltips = s;
651 set_app_property_toolbar_style (ui_component);
652 gl_prefs_model_save_settings (gl_prefs);
657 if (strcmp (path, "ViewGrid") == 0)
659 gl_prefs->grid_visible = s;
661 gl_view_show_grid (GL_VIEW(GL_WINDOW(win)->view));
663 gl_view_hide_grid (GL_VIEW(GL_WINDOW(win)->view));
665 gl_prefs_model_save_settings (gl_prefs);
670 if (strcmp (path, "ViewMarkup") == 0)
672 gl_prefs->markup_visible = s;
674 gl_view_show_markup (GL_VIEW(GL_WINDOW(win)->view));
676 gl_view_hide_markup (GL_VIEW(GL_WINDOW(win)->view));
678 gl_prefs_model_save_settings (gl_prefs);
685 /*---------------------------------------------------------------------------*/
686 /* PRIVATE. Set main toolbar style. */
687 /*---------------------------------------------------------------------------*/
689 set_app_main_toolbar_style (BonoboUIComponent *ui_component)
694 gl_debug (DEBUG_UI, "START");
696 g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
698 bonobo_ui_component_freeze (ui_component, NULL);
700 /* Updated view menu */
701 gl_ui_util_set_verb_state (ui_component,
702 "/commands/ViewMainToolbar",
703 gl_prefs->main_toolbar_visible);
705 gl_ui_util_set_verb_sensitive (ui_component,
706 "/commands/MainToolbarSystem",
707 gl_prefs->main_toolbar_visible);
708 gl_ui_util_set_verb_sensitive (ui_component,
709 "/commands/MainToolbarIcon",
710 gl_prefs->main_toolbar_visible);
711 gl_ui_util_set_verb_sensitive (ui_component,
712 "/commands/MainToolbarIconText",
713 gl_prefs->main_toolbar_visible);
714 gl_ui_util_set_verb_sensitive (ui_component,
715 "/commands/MainToolbarTooltips",
716 gl_prefs->main_toolbar_visible);
718 gl_ui_util_set_verb_state (ui_component,
719 "/commands/MainToolbarSystem",
720 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
722 gl_ui_util_set_verb_state (ui_component,
723 "/commands/MainToolbarIcon",
724 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
726 gl_ui_util_set_verb_state (ui_component,
727 "/commands/MainToolbarIconText",
728 gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
730 gl_ui_util_set_verb_state (ui_component,
731 "/commands/MainToolbarTooltips",
732 gl_prefs->main_toolbar_view_tooltips);
735 /* Actually update main_toolbar style */
736 bonobo_ui_component_set_prop (
737 ui_component, "/MainToolbar",
738 "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
741 switch (gl_prefs->main_toolbar_buttons_style)
743 case GL_TOOLBAR_SYSTEM:
745 client = gconf_client_get_default ();
749 labels = gconf_client_get_bool (client,
750 "/desktop/gnome/interface/toolbar-labels", NULL);
752 g_object_unref (G_OBJECT (client));
756 bonobo_ui_component_set_prop (
757 ui_component, "/MainToolbar", "look", "both", NULL);
762 bonobo_ui_component_set_prop (
763 ui_component, "/MainToolbar", "look", "icons", NULL);
768 case GL_TOOLBAR_ICONS:
769 bonobo_ui_component_set_prop (
770 ui_component, "/MainToolbar", "look", "icon", NULL);
774 case GL_TOOLBAR_ICONS_AND_TEXT:
775 bonobo_ui_component_set_prop (
776 ui_component, "/MainToolbar", "look", "both", NULL);
784 bonobo_ui_component_set_prop (
785 ui_component, "/MainToolbar",
786 "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
789 bonobo_ui_component_thaw (ui_component, NULL);
791 gl_debug (DEBUG_UI, "END");
795 /*---------------------------------------------------------------------------*/
796 /* PRIVATE. Set drawing toolbar style. */
797 /*---------------------------------------------------------------------------*/
799 set_app_drawing_toolbar_style (BonoboUIComponent *ui_component)
804 gl_debug (DEBUG_UI, "START");
806 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
808 bonobo_ui_component_freeze (ui_component, NULL);
810 /* Updated view menu */
811 gl_ui_util_set_verb_state (ui_component,
812 "/commands/ViewDrawingToolbar",
813 gl_prefs->drawing_toolbar_visible);
815 gl_ui_util_set_verb_sensitive (ui_component,
816 "/commands/DrawingToolbarSystem",
817 gl_prefs->drawing_toolbar_visible);
818 gl_ui_util_set_verb_sensitive (ui_component,
819 "/commands/DrawingToolbarIcon",
820 gl_prefs->drawing_toolbar_visible);
821 gl_ui_util_set_verb_sensitive (ui_component,
822 "/commands/DrawingToolbarIconText",
823 gl_prefs->drawing_toolbar_visible);
824 gl_ui_util_set_verb_sensitive (ui_component,
825 "/commands/DrawingToolbarTooltips",
826 gl_prefs->drawing_toolbar_visible);
828 gl_ui_util_set_verb_state (
830 "/commands/DrawingToolbarSystem",
831 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
833 gl_ui_util_set_verb_state (
835 "/commands/DrawingToolbarIcon",
836 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS);
838 gl_ui_util_set_verb_state (
840 "/commands/DrawingToolbarIconText",
841 gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
843 gl_ui_util_set_verb_state (ui_component,
844 "/commands/DrawingToolbarTooltips",
845 gl_prefs->drawing_toolbar_view_tooltips);
848 /* Actually update drawing_toolbar style */
849 bonobo_ui_component_set_prop (
850 ui_component, "/DrawingToolbar",
851 "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
854 switch (gl_prefs->drawing_toolbar_buttons_style)
856 case GL_TOOLBAR_SYSTEM:
858 client = gconf_client_get_default ();
862 labels = gconf_client_get_bool (client,
863 "/desktop/gnome/interface/toolbar-labels", NULL);
865 g_object_unref (G_OBJECT (client));
869 bonobo_ui_component_set_prop (
870 ui_component, "/DrawingToolbar", "look", "both", NULL);
875 bonobo_ui_component_set_prop (
876 ui_component, "/DrawingToolbar", "look", "icons", NULL);
881 case GL_TOOLBAR_ICONS:
882 bonobo_ui_component_set_prop (
883 ui_component, "/DrawingToolbar", "look", "icon", NULL);
887 case GL_TOOLBAR_ICONS_AND_TEXT:
888 bonobo_ui_component_set_prop (
889 ui_component, "/DrawingToolbar", "look", "both", NULL);
897 bonobo_ui_component_set_prop (
898 ui_component, "/DrawingToolbar",
899 "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
902 bonobo_ui_component_thaw (ui_component, NULL);
904 gl_debug (DEBUG_UI, "END");
907 /*---------------------------------------------------------------------------*/
908 /* PRIVATE. Set property toolbar style. */
909 /*---------------------------------------------------------------------------*/
911 set_app_property_toolbar_style (BonoboUIComponent *ui_component)
916 gl_debug (DEBUG_UI, "START");
918 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
920 bonobo_ui_component_freeze (ui_component, NULL);
922 /* Updated view menu */
923 gl_ui_util_set_verb_state (ui_component,
924 "/commands/ViewPropertyToolbar",
925 gl_prefs->property_toolbar_visible);
927 gl_ui_util_set_verb_sensitive (ui_component,
928 "/commands/PropertyToolbarTooltips",
929 gl_prefs->property_toolbar_visible);
931 gl_ui_util_set_verb_state (ui_component,
932 "/commands/PropertyToolbarTooltips",
933 gl_prefs->property_toolbar_view_tooltips);
936 /* Actually update property_toolbar style */
937 bonobo_ui_component_set_prop (
938 ui_component, "/PropertyToolbar",
939 "tips", gl_prefs->property_toolbar_view_tooltips ? "1" : "0",
942 bonobo_ui_component_set_prop (
943 ui_component, "/PropertyToolbar",
944 "hidden", gl_prefs->property_toolbar_visible ? "0":"1", NULL);
946 bonobo_ui_component_thaw (ui_component, NULL);
948 gl_debug (DEBUG_UI, "END");
951 /*---------------------------------------------------------------------------*/
952 /* PRIVATE. Set visibility of grid and markup. */
953 /*---------------------------------------------------------------------------*/
955 set_view_style (BonoboUIComponent *ui_component)
960 gl_debug (DEBUG_UI, "START");
962 g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
964 bonobo_ui_component_freeze (ui_component, NULL);
966 gl_ui_util_set_verb_state (ui_component,
967 "/commands/ViewGrid",
968 gl_prefs->grid_visible);
970 gl_ui_util_set_verb_state (ui_component,
971 "/commands/ViewMarkup",
972 gl_prefs->markup_visible);
975 bonobo_ui_component_thaw (ui_component, NULL);
977 gl_debug (DEBUG_UI, "END");