]> git.sur5r.net Git - glabels/commitdiff
Added menu entry to toggle visibility of property toolbar. Also added entry to toggl...
authorJim Evins <evins@snaught.com>
Sun, 14 Dec 2003 04:26:46 +0000 (04:26 +0000)
committerJim Evins <evins@snaught.com>
Sun, 14 Dec 2003 04:26:46 +0000 (04:26 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@373 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/glabels-ui.xml
glabels2/src/prefs-model.c
glabels2/src/prefs-model.h
glabels2/src/ui.c

index b519b737b70baa2efdac6c82229ecec3af624895..bea87739946a7f68d8c52204f3643d242faea228 100644 (file)
                        type="toggle" state="1"
                />
 
+               <cmd name="ViewPropertyToolbar"
+                       _label="_Property Toolbar"
+                       _tip="Change the visibility of the property toolbar in the current window"
+                       type="toggle" state="0"
+               />
+
+               <cmd name="PropertyToolbarTooltips"
+                       id="PropertyToolbarTooltips"
+                       _label="Show _Tooltips"
+                       _tip="Show tooltips in the property toolbar"
+                       type="toggle" state="1"
+               />
+
                <cmd name="ViewGrid"
                        _label="_Grid"
                        _tip="Change the visibility of the grid in the current window"
                                verb=""
                        />
 
+                       <menuitem name="ViewPropertyToolbar"
+                               id="ViewPropertyToolbar"
+                               verb=""
+                       />
+
                        <separator />
 
                        <submenu name="CustomizeMainToolbar"
 
                        </submenu>
 
+                       <submenu name="CustomizePropertyToolbar"
+                               _label="Customize Property Toolbar"
+                       >
+
+                               <menuitem name="PropertyToolbarTooltips"
+                                       verb=""
+                               />
+
+                       </submenu>
+
                        <separator />
 
                        <menuitem name="ViewGrid"
index d1c42cca9cf03eebc98786fc91ec9fa37ae3d5aa..ab285780aee196d896fc6d211cb88aafa8254584 100644 (file)
@@ -60,6 +60,9 @@
 #define PREF_DRAWING_TOOLBAR_BUTTONS_STYLE  "/drawing-toolbar-buttons-style"
 #define PREF_DRAWING_TOOLBAR_VIEW_TOOLTIPS  "/drawing-toolbar-view-tooltips"
 
+#define PREF_PROPERTY_TOOLBAR_VISIBLE        "/property-toolbar-visible"
+#define PREF_PROPERTY_TOOLBAR_VIEW_TOOLTIPS  "/property-toolbar-view-tooltips"
+
 #define PREF_GRID_VISIBLE                   "/grid-visible"
 #define PREF_MARKUP_VISIBLE                 "/markup-visible"
 
@@ -349,6 +352,17 @@ gl_prefs_model_save_settings (glPrefsModel *prefs_model)
                               prefs_model->drawing_toolbar_view_tooltips,
                               NULL);
 
+       /* Property Toolbar */
+       gconf_client_set_bool (prefs_model->gconf_client,
+                              BASE_KEY PREF_PROPERTY_TOOLBAR_VISIBLE,
+                              prefs_model->property_toolbar_visible,
+                              NULL);
+
+       gconf_client_set_bool (prefs_model->gconf_client,
+                              BASE_KEY PREF_PROPERTY_TOOLBAR_VIEW_TOOLTIPS,
+                              prefs_model->property_toolbar_view_tooltips,
+                              NULL);
+
        /* View properties */
        gconf_client_set_bool (prefs_model->gconf_client,
                               BASE_KEY PREF_GRID_VISIBLE,
@@ -481,6 +495,17 @@ gl_prefs_model_load_settings (glPrefsModel *prefs_model)
                          BASE_KEY PREF_DRAWING_TOOLBAR_VIEW_TOOLTIPS,
                          TRUE);
 
+       /* User Inferface/Property Toolbar */
+       prefs_model->property_toolbar_visible =
+               get_bool (prefs_model->gconf_client,
+                         BASE_KEY PREF_PROPERTY_TOOLBAR_VISIBLE,
+                         TRUE);
+
+       prefs_model->property_toolbar_view_tooltips =
+               get_bool (prefs_model->gconf_client,
+                         BASE_KEY PREF_PROPERTY_TOOLBAR_VIEW_TOOLTIPS,
+                         TRUE);
+
 
        /* View properties */
        prefs_model->grid_visible =
index b8f3d9a371113a308c8c5e291881c37b6ca52087..8d94ba799df47241e99e243ac74e61fcdc927695 100644 (file)
@@ -91,6 +91,10 @@ struct _glPrefsModel {
        glToolbarSetting  drawing_toolbar_buttons_style; 
        gboolean          drawing_toolbar_view_tooltips;
 
+       /* User Interface/Property Toolbar */
+       gboolean          property_toolbar_visible;
+       gboolean          property_toolbar_view_tooltips;
+
        /* View properties */
        gboolean          grid_visible;
        gboolean          markup_visible;
index eb0b60df2b162e1a9e06c3499801f50ac411dd34..789616264135bdcd5f86cab94d5c0de14d67f961 100644 (file)
@@ -208,6 +208,8 @@ static void set_app_main_toolbar_style        (BonoboUIComponent           *ui_compo
 
 static void set_app_drawing_toolbar_style (BonoboUIComponent           *ui_component);
 
+static void set_app_property_toolbar_style (BonoboUIComponent           *ui_component);
+
 static void set_view_style                (BonoboUIComponent           *ui_component);
 
 
@@ -285,6 +287,18 @@ gl_ui_init (BonoboUIComponent *ui_component,
                        (BonoboUIListenerFn)view_menu_item_toggled_cb, 
                        (gpointer)win);
 
+       /* Set the toolbar style according to prefs */
+       set_app_property_toolbar_style (ui_component);
+               
+       /* Add listener for the view menu */
+       bonobo_ui_component_add_listener (ui_component, "ViewPropertyToolbar", 
+                       (BonoboUIListenerFn)view_menu_item_toggled_cb, 
+                       (gpointer)win);
+
+       bonobo_ui_component_add_listener (ui_component, "PropertyToolbarTooltips", 
+                       (BonoboUIListenerFn)view_menu_item_toggled_cb, 
+                       (gpointer)win);
+
 
        /* Set view grid and markup visibility according to prefs */
        set_view_style (ui_component);
@@ -622,6 +636,24 @@ view_menu_item_toggled_cb (BonoboUIComponent           *ui_component,
                return;
        }
 
+       if (strcmp (path, "ViewPropertyToolbar") == 0)
+       {
+               gl_prefs->property_toolbar_visible = s;
+               set_app_property_toolbar_style (ui_component);
+               gl_prefs_model_save_settings (gl_prefs);
+
+               return;
+       }
+
+       if (strcmp (path, "PropertyToolbarTooltips") == 0)
+       {
+               gl_prefs->property_toolbar_view_tooltips = s;
+               set_app_property_toolbar_style (ui_component);
+               gl_prefs_model_save_settings (gl_prefs);
+
+               return;
+       }
+
        if (strcmp (path, "ViewGrid") == 0)
        {
                gl_prefs->grid_visible = s;
@@ -872,6 +904,50 @@ set_app_drawing_toolbar_style (BonoboUIComponent *ui_component)
        gl_debug (DEBUG_UI, "END");
 }
 
+/*---------------------------------------------------------------------------*/
+/* PRIVATE.  Set property toolbar style.                                     */
+/*---------------------------------------------------------------------------*/
+static void
+set_app_property_toolbar_style (BonoboUIComponent *ui_component)
+{
+       GConfClient *client;
+       gboolean labels;
+
+       gl_debug (DEBUG_UI, "START");
+
+       g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
+                       
+       bonobo_ui_component_freeze (ui_component, NULL);
+
+       /* Updated view menu */
+       gl_ui_util_set_verb_state (ui_component, 
+                                  "/commands/ViewPropertyToolbar",
+                                  gl_prefs->property_toolbar_visible);
+
+       gl_ui_util_set_verb_sensitive (ui_component, 
+                                      "/commands/PropertyToolbarTooltips",
+                                      gl_prefs->property_toolbar_visible);
+
+       gl_ui_util_set_verb_state (ui_component, 
+                       "/commands/PropertyToolbarTooltips",
+                       gl_prefs->property_toolbar_view_tooltips);
+
+       
+       /* Actually update property_toolbar style */
+       bonobo_ui_component_set_prop (
+               ui_component, "/PropertyToolbar",
+               "tips", gl_prefs->property_toolbar_view_tooltips ? "1" : "0",
+               NULL);
+       
+       bonobo_ui_component_set_prop (
+                       ui_component, "/PropertyToolbar",
+                       "hidden", gl_prefs->property_toolbar_visible ? "0":"1", NULL);
+
+       bonobo_ui_component_thaw (ui_component, NULL);
+
+       gl_debug (DEBUG_UI, "END");
+}
+
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  Set visibility of grid and markup.                              */
 /*---------------------------------------------------------------------------*/