Commit c351703f authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

New functions.

2005-06-14  Morten Welinder  <terra@gnome.org>

	* src/gnumeric-gconf.c (gnm_gconf_get_toolbar_visible,
	gnm_gconf_set_toolbar_visible): New functions.

	* src/wbc-gtk.c (cb_add_menus_toolbars): Set toolbar visibility.
	(cb_handlebox_visible): Make changes to visibility permanent.
	(wbc_gtk_init): Don't set everything visible.
parent 9fa2e09e
2005-06-14 Morten Welinder <terra@gnome.org>
* src/gnumeric-gconf.c (gnm_gconf_get_toolbar_visible,
gnm_gconf_set_toolbar_visible): New functions.
* src/wbc-gtk.c (cb_add_menus_toolbars): Set toolbar visibility.
(cb_handlebox_visible): Make changes to visibility permanent.
(wbc_gtk_init): Don't set everything visible.
2005-06-13 Jody Goldberg <jody@gnome.org>
* configure.in : post release bump
......
Gnumeric 1.5.3
Morten:
* Make changes to toolbar visibility permanent.
--------------------------------------------------------------------------
Gnumeric 1.5.2
Andreas:
......
2005-06-14 Morten Welinder <terra@gnome.org>
* src/gnumeric-gconf.c (gnm_gconf_get_toolbar_visible,
gnm_gconf_set_toolbar_visible): New functions.
* src/wbc-gtk.c (cb_add_menus_toolbars): Set toolbar visibility.
(cb_handlebox_visible): Make changes to visibility permanent.
(wbc_gtk_init): Don't set everything visible.
2005-06-13 Jody Goldberg <jody@gnome.org>
* configure.in : post release bump
......
......@@ -156,6 +156,39 @@
<long>Screen resolution in the vertical direction.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/gui/toolbars/StandardToolbar</key>
<applyto>/apps/gnumeric/core/gui/toolbars/StandardToolbar</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Standard toolbar visible</short>
<long>This variable determines whether the standard toolbar should be visible initially.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/gui/toolbars/FormatToolbar</key>
<applyto>/apps/gnumeric/core/gui/toolbars/FormatToolbar</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Format toolbar visible</short>
<long>This variable determines whether the format toolbar should be visible initially.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/gui/toolbars/ObjectToolbar</key>
<applyto>/apps/gnumeric/core/gui/toolbars/ObjectToolbar</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Object toolbar visible</short>
<long>This variable determines whether the object toolbar should be visible initially.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/gui/editing/autocomplete</key>
<applyto>/apps/gnumeric/core/gui/editing/autocomplete</applyto>
......
......@@ -99,6 +99,7 @@
#define GNM_CONF_GUI_WINDOW_X "window/x"
#define GNM_CONF_GUI_WINDOW_Y "window/y"
#define GNM_CONF_GUI_ZOOM "window/zoom"
#define GNM_CONF_GUI_TOOLBARS "toolbars"
#define GNM_CONF_XML_COMPRESSION "core/xml/compression-level"
......
......@@ -1289,6 +1289,10 @@ gnm_conf_init_essential (void)
node, GNM_CONF_GUI_ED_AUTOCOMPLETE, TRUE);
prefs.live_scrolling = go_conf_load_bool (
node, GNM_CONF_GUI_ED_LIVESCROLLING, TRUE);
prefs.toolbars = g_hash_table_new_full
(g_str_hash, g_str_equal,
(GDestroyNotify)g_free,
NULL);
go_conf_free_node (node);
/* Unfortunately we need the printing stuff in essentials since the */
......@@ -1449,6 +1453,7 @@ gnm_conf_shutdown (void)
mstyle_unref (prefs.printer_decoration_font);
prefs.printer_decoration_font = NULL;
}
g_hash_table_destroy (prefs.toolbars);
go_conf_free_node (root);
go_conf_shutdown ();
}
......@@ -1920,6 +1925,45 @@ gnm_gconf_set_gui_resolution_v (gnm_float val)
root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_RES_V, val);
}
gboolean
gnm_gconf_get_toolbar_visible (const char *name)
{
gpointer pval;
char *key = g_strconcat (GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_TOOLBARS "/",
name,
NULL);
gboolean found, vis;
found = g_hash_table_lookup_extended (prefs.toolbars,
key,
NULL, &pval);
if (found) {
vis = GPOINTER_TO_INT (pval);
} else {
vis = go_conf_load_bool (root, key, TRUE);
g_hash_table_insert (prefs.toolbars,
g_strdup (name),
GINT_TO_POINTER (vis));
}
g_free (key);
return vis;
}
void
gnm_gconf_set_toolbar_visible (const char *name, gboolean vis)
{
char *key = g_strconcat (GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_TOOLBARS "/",
name,
NULL);
vis = !!vis;
g_hash_table_replace (prefs.toolbars,
g_strdup (name),
GINT_TO_POINTER (vis));
go_conf_set_bool (root, key, vis);
g_free (key);
}
void
gnm_gconf_set_unfocused_rs (gboolean val)
{
......
......@@ -75,6 +75,7 @@ typedef struct {
gboolean auto_complete;
gboolean transition_keys;
gboolean live_scrolling;
GHashTable *toolbars;
gint recalc_lag;
gboolean unfocused_range_selection;
gboolean prefer_clipboard_selection; /* As opposed to "primary". */
......@@ -152,6 +153,8 @@ void gnm_gconf_set_gui_transition_keys (gboolean value);
void gnm_gconf_set_gui_livescrolling (gboolean value);
void gnm_gconf_set_gui_resolution_h (gnm_float val);
void gnm_gconf_set_gui_resolution_v (gnm_float val);
gboolean gnm_gconf_get_toolbar_visible (const char *name);
void gnm_gconf_set_toolbar_visible (const char *name, gboolean vis);
/* default font */
void gnm_gconf_set_default_font_size (gnm_float val);
......
......@@ -34,6 +34,7 @@
#include "history.h"
#include "style-color.h"
#include "workbook-edit.h"
#include "gnumeric-gconf.h"
#include <goffice/gtk/go-action-combo-stack.h>
#include <goffice/gtk/go-action-combo-color.h>
......@@ -1185,7 +1186,11 @@ cb_handlebox_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
{
GtkToggleAction *toggle_action = g_object_get_data (
G_OBJECT (box), "toggle_action");
gtk_toggle_action_set_active (toggle_action, GTK_WIDGET_VISIBLE (box));
const char *name = g_object_get_data (G_OBJECT (box), "name");
gboolean visible = GTK_WIDGET_VISIBLE (box);
gtk_toggle_action_set_active (toggle_action, visible);
gnm_gconf_set_toolbar_visible (name, visible);
}
static void
......@@ -1199,16 +1204,20 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
char const *name = gtk_widget_get_name (w);
char *toggle_name = g_strdup_printf ("ViewMenuToolbar%s", name);
char *tooltip = g_strdup_printf (_("Show/Hide toolbar %s"), _(name));
gboolean visible = gnm_gconf_get_toolbar_visible (name);
gtk_container_add (GTK_CONTAINER (box), w);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (w), TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (w), GTK_TOOLBAR_ICONS);
gtk_widget_show_all (box);
if (!visible)
gtk_widget_hide (box);
gtk_box_pack_start (GTK_BOX (gtk->toolbar_zone), box, FALSE, FALSE, 0);
g_object_connect (box,
"signal::notify::visible", G_CALLBACK (cb_handlebox_visible), wbcg,
"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
"signal::child_detached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (FALSE),
NULL);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (w), TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (w), GTK_TOOLBAR_ICONS);
gtk_box_pack_start (GTK_BOX (gtk->toolbar_zone), box, FALSE, FALSE, 0);
entry.name = toggle_name;
entry.stock_id = NULL;
......@@ -1216,7 +1225,7 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
entry.accelerator = (0 == strcmp (name, "StandardToolbar")) ? "<control>7" : NULL;
entry.tooltip = tooltip;
entry.callback = G_CALLBACK (cb_toolbar_activate);
entry.is_active = TRUE;
entry.is_active = visible;
gtk_action_group_add_toggle_actions (gtk->toolbar.actions,
&entry, 1, (WorkbookControlGUI *)wbcg);
gtk_ui_manager_add_ui (gtk->ui, gtk->toolbar.merge_id,
......@@ -1224,6 +1233,9 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
toggle_name, toggle_name, GTK_UI_MANAGER_AUTO, FALSE);
g_object_set_data (G_OBJECT (box), "toggle_action",
gtk_action_group_get_action (gtk->toolbar.actions, toggle_name));
g_object_set_data_full (G_OBJECT (box), "name",
g_strdup (name),
(GDestroyNotify)g_free);
g_hash_table_insert (wbcg->visibility_widgets,
g_strdup (toggle_name), g_object_ref (box));
......@@ -1234,9 +1246,10 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
g_free (tooltip);
g_free (toggle_name);
} else
} else {
gtk_box_pack_start (GTK_BOX (gtk->menu_zone), w, FALSE, TRUE, 0);
gtk_widget_show_all (w);
gtk_widget_show_all (w);
}
}
static void
......@@ -1366,12 +1379,12 @@ wbc_gtk_init (GObject *obj)
gtk->menu_zone, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (gtk->everything),
gtk->toolbar_zone, FALSE, TRUE, 0);
gtk_widget_show_all (gtk->everything);
#if 0
bonobo_dock_set_client_area (BONOBO_DOCK (gtk->dock), wbcg->table);
#endif
gtk_box_pack_start (GTK_BOX (gtk->everything),
wbcg->table, TRUE, TRUE, 0);
gtk_widget_show_all (gtk->everything);
#warning "TODO split into smaller chunks"
gtk->permanent_actions = gtk_action_group_new ("PermanentActions");
......@@ -1443,7 +1456,6 @@ wbc_gtk_init (GObject *obj)
NULL);
gtk_ui_manager_ensure_update (gtk->ui);
gtk_widget_show_all (gtk->everything);
gtk_container_add (GTK_CONTAINER (wbcg->toplevel), gtk->everything);
#ifdef CHECK_MENU_UNDERLINES
......
......@@ -1245,8 +1245,8 @@ wbcg_error_error_info (GOCmdContext *cc, ErrorInfo *error)
*/
int
wbcg_close_if_user_permits (WorkbookControlGUI *wbcg,
WorkbookView *wb_view, gboolean close_clean,
gboolean exiting, gboolean ask_user)
WorkbookView *wb_view, gboolean close_clean,
gboolean exiting, gboolean ask_user)
{
gboolean can_close = TRUE;
gboolean done = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment