From: Jim Evins Date: Sun, 14 Dec 2003 04:26:46 +0000 (+0000) Subject: Added menu entry to toggle visibility of property toolbar. Also added entry to toggl... X-Git-Tag: glabels-2_3_0~521 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9485ecff9019ccd81087c0a65c99a006a7f0d761;p=glabels Added menu entry to toggle visibility of property toolbar. Also added entry to toggle its tooltips. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@373 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/glabels-ui.xml b/glabels2/src/glabels-ui.xml index b519b737..bea87739 100644 --- a/glabels2/src/glabels-ui.xml +++ b/glabels2/src/glabels-ui.xml @@ -178,6 +178,19 @@ type="toggle" state="1" /> + + + + + + + + + + + + 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 = diff --git a/glabels2/src/prefs-model.h b/glabels2/src/prefs-model.h index b8f3d9a3..8d94ba79 100644 --- a/glabels2/src/prefs-model.h +++ b/glabels2/src/prefs-model.h @@ -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; diff --git a/glabels2/src/ui.c b/glabels2/src/ui.c index eb0b60df..78961626 100644 --- a/glabels2/src/ui.c +++ b/glabels2/src/ui.c @@ -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. */ /*---------------------------------------------------------------------------*/