aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Harvey <peter.a.harvey@gmail.com>2006-02-04 21:57:43 +0800
committerPeter Anthony Harvey <paharvey@src.gnome.org>2006-02-04 21:57:43 +0800
commit30269a7fcdcd0a0eb82535f1af96df5059e0ba43 (patch)
treeeecbc3a3985864c8d619ad1e45dac07fef7699de
parent1bdd082560bc963b535935d9e0bf06e19cd08d17 (diff)
downloadgsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar.gz
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar.bz2
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar.lz
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar.xz
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.tar.zst
gsoc2013-epiphany-30269a7fcdcd0a0eb82535f1af96df5059e0ba43.zip
lib/ephy-state.h lib/ephy-state.c src/epiphany.defs
2006-02-04 Peter Harvey <peter.a.harvey@gmail.com> * lib/ephy-state.h * lib/ephy-state.c * src/epiphany.defs * src/bookmarks/ephy-bookmark-properties.c Combined very similar functions into one. Made the 'similar' bookmark count update immediately at start.
-rw-r--r--ChangeLog10
-rw-r--r--lib/ephy-state.c62
-rw-r--r--lib/ephy-state.h6
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c4
-rw-r--r--src/epiphany.defs2
5 files changed, 29 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index f6e3d01e6..5b766b8e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,16 @@
* lib/ephy-state.h
* lib/ephy-state.c
+ * src/epiphany.defs
+ * src/bookmarks/ephy-bookmark-properties.c
+
+ Combined very similar functions into one.
+ Made the 'similar' bookmark count update immediately at start.
+
+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.
diff --git a/lib/ephy-state.c b/lib/ephy-state.c
index ce1dc75bb..7f260a627 100644
--- a/lib/ephy-state.c
+++ b/lib/ephy-state.c
@@ -468,46 +468,6 @@ sync_expander_cb (GtkExpander *expander,
g_value_unset (&value);
}
-void
-ephy_state_add_expander (GtkWidget *expander,
- const char *name,
- gboolean default_state)
-{
- EphyNode *node;
- gboolean expanded;
-
- 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);
- }
-
- expanded = ephy_node_get_property_boolean
- (node, EPHY_NODE_STATE_PROP_ACTIVE);
-
- gtk_expander_set_expanded (GTK_EXPANDER (expander), expanded);
-
- g_signal_connect (expander, "notify::expanded",
- G_CALLBACK (sync_expander_cb), node);
-}
-
static void
sync_toggle_cb (GtkToggleButton *toggle,
GParamSpec *pspec,
@@ -522,9 +482,9 @@ sync_toggle_cb (GtkToggleButton *toggle,
}
void
-ephy_state_add_toggle (GtkWidget *toggle,
- const char *name,
- gboolean default_state)
+ephy_state_add_expander (GtkWidget *widget,
+ const char *name,
+ gboolean default_state)
{
EphyNode *node;
gboolean active;
@@ -555,10 +515,18 @@ ephy_state_add_toggle (GtkWidget *toggle,
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);
+ if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
+ g_signal_connect (widget, "notify::active",
+ G_CALLBACK (sync_toggle_cb), node);
+ }
+ else if (GTK_IS_EXPANDER (widget))
+ {
+ gtk_expander_set_expanded (GTK_EXPANDER (widget), active);
+ g_signal_connect (widget, "notify::expanded",
+ G_CALLBACK (sync_expander_cb), node);
+ }
}
void
diff --git a/lib/ephy-state.h b/lib/ephy-state.h
index 3388b396f..f8669c07b 100644
--- a/lib/ephy-state.h
+++ b/lib/ephy-state.h
@@ -45,11 +45,7 @@ void ephy_state_add_paned (GtkWidget *paned,
const char *name,
int default_width);
-void ephy_state_add_expander (GtkWidget *expander,
- const char *name,
- gboolean default_state);
-
-void ephy_state_add_toggle (GtkWidget *toggle,
+void ephy_state_add_expander (GtkWidget *widget,
const char *name,
gboolean default_state);
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index 9182462ab..3758bd8da 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -605,7 +605,7 @@ ephy_bookmark_properties_constructor (GType type,
gtk_widget_show (widget);
button = gtk_toggle_button_new_with_label ("");
gtk_button_set_image (GTK_BUTTON (button), widget);
- ephy_state_add_toggle (button, "bookmark_properties_list", FALSE);
+ ephy_state_add_expander (button, "bookmark_properties_list", FALSE);
g_signal_connect (button, "toggled", G_CALLBACK (list_toggled_cb), properties);
list_toggled_cb (GTK_TOGGLE_BUTTON (button), properties);
gtk_widget_show (button);
@@ -658,7 +658,7 @@ ephy_bookmark_properties_constructor (GType type,
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CLOSE);
}
- update_warning_idle (properties);
+ update_warning (properties);
return object;
}
diff --git a/src/epiphany.defs b/src/epiphany.defs
index 33157fe16..f81bd2c8f 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -2411,7 +2411,7 @@
(c-name "ephy_state_add_expander")
(return-type "none")
(parameters
- '("GtkWidget*" "expander")
+ '("GtkWidget*" "widget")
'("const-char*" "name")
'("gboolean" "default_state")
)