diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-05-02 04:47:00 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-05-02 04:47:00 +0800 |
commit | 7093f6ad148d62a9ddc77f8080cf9822d5d24f1f (patch) | |
tree | 672ab4fb4d9e9853b14903b6c9019e911773fd93 /src/ephy-encoding-dialog.c | |
parent | 8493f7c5d64b577b3f6b8de91e5bb6c82a8b96ae (diff) | |
download | gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.gz gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.bz2 gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.lz gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.xz gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.zst gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.zip |
Clean up encoding handling.
2004-05-01 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-embed.c: (ephy_embed_get_encoding),
(ephy_embed_has_automatic_encoding):
* embed/ephy-embed.h:
* embed/ephy-encodings.c:
* embed/ephy-encodings.h:
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/MozRegisterComponents.cpp:
* embed/mozilla/mozilla-embed.cpp:
* src/ephy-encoding-dialog.c: (sync_embed_cb), (activate_choice):
* src/ephy-encoding-menu.c: (update_encoding_menu_cb),
(encoding_activate_cb):
Clean up encoding handling.
Diffstat (limited to 'src/ephy-encoding-dialog.c')
-rw-r--r-- | src/ephy-encoding-dialog.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c index 3365fa5af..adf0f61f3 100644 --- a/src/ephy-encoding-dialog.c +++ b/src/ephy-encoding-dialog.c @@ -113,12 +113,12 @@ static void sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy) { EphyEmbed *embed; - EphyEncodingInfo *info; EphyNode *node; GtkTreeSelection *selection; GtkTreeModel *model; GList *rows; GtkWidget *button; + char *encoding; gboolean is_automatic; dialog->priv->update_tag = TRUE; @@ -126,10 +126,10 @@ sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy) embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog)); g_return_if_fail (EPHY_IS_EMBED (embed)); - info = ephy_embed_get_encoding_info (embed); - if (info == NULL) return; + encoding = ephy_embed_get_encoding (embed); + if (encoding == NULL) return; - node = ephy_encodings_get_node (dialog->priv->encodings, info->encoding, TRUE); + node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE); g_assert (EPHY_IS_NODE (node)); /* select the current encoding in the list view */ @@ -153,12 +153,12 @@ sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy) g_list_free (rows); } - is_automatic = ephy_encoding_info_is_automatic (info); + is_automatic = ephy_embed_has_automatic_encoding (embed); button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), is_automatic); - ephy_encoding_info_free (info); + g_free (encoding); dialog->priv->update_tag = FALSE; } @@ -199,27 +199,18 @@ static void activate_choice (EphyEncodingDialog *dialog) { EphyEmbed *embed; - EphyEncodingInfo *info; GtkWidget *button; gboolean is_automatic; embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog)); g_return_if_fail (EPHY_IS_EMBED (embed)); - info = ephy_embed_get_encoding_info (embed); - if (info == NULL) return; - button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id); is_automatic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); if (is_automatic) { - /* only unset if it was forced before */ - if ((info->forced_encoding != NULL && info->forced_encoding[0] != '\0') - || info->encoding_source >= EMBED_ENCODING_PARENT_FORCED) - { - ephy_embed_set_encoding (embed, ""); - } + ephy_embed_set_encoding (embed, ""); } else if (dialog->priv->selected_node != NULL) { @@ -228,16 +219,10 @@ activate_choice (EphyEncodingDialog *dialog) code = ephy_node_get_property_string (dialog->priv->selected_node, EPHY_NODE_ENCODING_PROP_ENCODING); - /* only force it if it's different from active */ - if (info->encoding && strcmp (info->encoding, code) != 0) - { - ephy_embed_set_encoding (embed, code); + ephy_embed_set_encoding (embed, code); - ephy_encodings_add_recent (dialog->priv->encodings, code); - } + ephy_encodings_add_recent (dialog->priv->encodings, code); } - - ephy_encoding_info_free (info); } void |