aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--lib/ephy-state.c62
-rw-r--r--src/ephy-shell.c2
3 files changed, 67 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d9aa8512..f6e3d01e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2006-02-04 Peter Harvey <peter.a.harvey@gmail.com>
+ * lib/ephy-state.h
+ * lib/ephy-state.c
+ * src/ephy-shell.c
+
+ Forgotten files from previous two commits.
+
+2006-02-04 Peter Harvey <peter.a.harvey@gmail.com>
+
* lib/egg/egg-editable-toolbar.c
* lib/egg/egg-toolbar-editor.c
* lib/egg/egg-toolbars-model.c
diff --git a/lib/ephy-state.c b/lib/ephy-state.c
index d74ca4f7f..ce1dc75bb 100644
--- a/lib/ephy-state.c
+++ b/lib/ephy-state.c
@@ -32,6 +32,7 @@
#include <gtk/gtkwindow.h>
#include <gtk/gtkpaned.h>
#include <gtk/gtkexpander.h>
+#include <gtk/gtktogglebutton.h>
#define EPHY_STATES_XML_FILE "states.xml"
#define EPHY_STATES_XML_ROOT (const xmlChar *)"ephy_states"
@@ -47,7 +48,7 @@ enum
EPHY_NODE_STATE_PROP_POSITION_Y = 7,
EPHY_NODE_STATE_PROP_SIZE = 8,
EPHY_NODE_STATE_PROP_POSITION = 9,
- EPHY_NODE_STATE_PROP_EXPANDED = 10
+ EPHY_NODE_STATE_PROP_ACTIVE = 10
};
static EphyNode *states = NULL;
@@ -463,7 +464,7 @@ sync_expander_cb (GtkExpander *expander,
g_value_init (&value, G_TYPE_BOOLEAN);
g_value_set_boolean (&value, gtk_expander_get_expanded (expander));
- ephy_node_set_property (node, EPHY_NODE_STATE_PROP_EXPANDED, &value);
+ ephy_node_set_property (node, EPHY_NODE_STATE_PROP_ACTIVE, &value);
g_value_unset (&value);
}
@@ -494,12 +495,12 @@ ephy_state_add_expander (GtkWidget *expander,
g_value_init (&value, G_TYPE_BOOLEAN);
g_value_set_boolean (&value, default_state);
ephy_node_set_property
- (node, EPHY_NODE_STATE_PROP_EXPANDED, &value);
+ (node, EPHY_NODE_STATE_PROP_ACTIVE, &value);
g_value_unset (&value);
}
expanded = ephy_node_get_property_boolean
- (node, EPHY_NODE_STATE_PROP_EXPANDED);
+ (node, EPHY_NODE_STATE_PROP_ACTIVE);
gtk_expander_set_expanded (GTK_EXPANDER (expander), expanded);
@@ -507,6 +508,59 @@ ephy_state_add_expander (GtkWidget *expander,
G_CALLBACK (sync_expander_cb), node);
}
+static void
+sync_toggle_cb (GtkToggleButton *toggle,
+ GParamSpec *pspec,
+ EphyNode *node)
+{
+ GValue value = { 0, };
+
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, gtk_toggle_button_get_active (toggle));
+ ephy_node_set_property (node, EPHY_NODE_STATE_PROP_ACTIVE, &value);
+ g_value_unset (&value);
+}
+
+void
+ephy_state_add_toggle (GtkWidget *toggle,
+ const char *name,
+ gboolean default_state)
+{
+ EphyNode *node;
+ gboolean active;
+
+ ensure_states ();
+
+ node = find_by_name (name);
+ if (node == NULL)
+ {
+ GValue value = { 0, };
+
+ node = ephy_node_new (states_db);
+ ephy_node_add_child (states, node);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, name);
+ ephy_node_set_property (node, EPHY_NODE_STATE_PROP_NAME,
+ &value);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, default_state);
+ ephy_node_set_property
+ (node, EPHY_NODE_STATE_PROP_ACTIVE, &value);
+ g_value_unset (&value);
+ }
+
+ active = ephy_node_get_property_boolean
+ (node, EPHY_NODE_STATE_PROP_ACTIVE);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), active);
+
+ g_signal_connect (toggle, "notify::active",
+ G_CALLBACK (sync_toggle_cb), node);
+}
+
void
ephy_state_save (void)
{
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index acf8cf42a..5af43c5a0 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -675,7 +675,7 @@ ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen)
xml = ephy_file ("epiphany-fs-toolbar.xml");
g_return_val_if_fail (xml != NULL, NULL);
- success = egg_toolbars_model_load
+ success = egg_toolbars_model_load_toolbars
(shell->priv->fs_toolbars_model, xml);
g_return_val_if_fail (success, NULL);
}