diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-11-18 02:41:29 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-11-18 02:41:29 +0800 |
commit | 5952680d6a09d98c301711e8188881f3a65a2e12 (patch) | |
tree | c0dfa32b7ba4c5a75b0ea4e8dee58603892a0fb8 /lib/ephy-state.c | |
parent | 5f152449ad08cd5d2d77e052aff3c40cf8ce5b9d (diff) | |
download | gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar.gz gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar.bz2 gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar.lz gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar.xz gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.tar.zst gsoc2013-epiphany-5952680d6a09d98c301711e8188881f3a65a2e12.zip |
Ported the Crispin's GtkNSSClientAuthDialogs from galeon. Changes: - use
2003-11-17 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/GtkNSSClientAuthDialogs.cpp:
* embed/mozilla/GtkNSSClientAuthDialogs.h:
* embed/mozilla/Makefile.am:
* embed/mozilla/MozRegisterComponents.cpp:
* lib/ephy-state.c: (ephy_state_add_paned), (expander_activate_cb),
(ephy_state_add_expander):
* lib/ephy-state.h:
Ported the Crispin's GtkNSSClientAuthDialogs from galeon.
Changes:
- use GtkExpander instead of the CDDB disclosure thingy
- persist state in ephy-state
- assing a mnemonic to expander label.
Diffstat (limited to 'lib/ephy-state.c')
-rw-r--r-- | lib/ephy-state.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/lib/ephy-state.c b/lib/ephy-state.c index 33edb87a5..fb214775f 100644 --- a/lib/ephy-state.c +++ b/lib/ephy-state.c @@ -27,6 +27,7 @@ #include <string.h> #include <gtk/gtkwindow.h> #include <gtk/gtkpaned.h> +#include <gtk/gtkexpander.h> #define EPHY_STATES_XML_FILE "states.xml" #define EPHY_STATES_XML_ROOT "ephy_states" @@ -41,7 +42,8 @@ enum EPHY_NODE_STATE_PROP_POSITION_X = 6, EPHY_NODE_STATE_PROP_POSITION_Y = 7, EPHY_NODE_STATE_PROP_SIZE = 8, - EPHY_NODE_STATE_PROP_POSITION = 9 + EPHY_NODE_STATE_PROP_POSITION = 9, + EPHY_NODE_STATE_PROP_EXPANDED = 10 }; static EphyNode *states = NULL; @@ -433,6 +435,58 @@ ephy_state_add_paned (GtkWidget *paned, G_CALLBACK (paned_size_allocate_cb), node); } +static void +expander_activate_cb (GtkExpander *expander, + EphyNode *node) +{ + GValue value = { 0, }; + + 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); + 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_EXPANDED, &value); + g_value_unset (&value); + } + + expanded = ephy_node_get_property_boolean + (node, EPHY_NODE_STATE_PROP_EXPANDED); + + gtk_expander_set_expanded (GTK_EXPANDER (expander), expanded); + + g_signal_connect (expander, "activate", + G_CALLBACK (expander_activate_cb), node); +} + void ephy_state_save (void) { |