[geany/geany-plugins] 283d76: markdown: Use document's encoding for preview

Matthew Brush git-noreply at xxxxx
Sun Aug 26 09:16:22 UTC 2012


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Sun, 15 Jul 2012 20:53:50
Commit:      283d76a07b6f2ced8d67e7ef5ee3fd978df7a1ad
             https://github.com/geany/geany-plugins/commit/283d76a07b6f2ced8d67e7ef5ee3fd978df7a1ad

Log Message:
-----------
markdown: Use document's encoding for preview


Modified Paths:
--------------
    markdown/src/plugin.c
    markdown/src/viewer.c
    markdown/src/viewer.h

Modified: markdown/src/plugin.c
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -228,14 +228,14 @@ static gboolean on_idle_handler(MarkdownPlugin *plugin)
   /* Only handle valid Markdown documents */
   if (!DOC_VALID(doc) || g_strcmp0(doc->file_type->name, "Markdown") != 0) {
     markdown_viewer_update_content(plugin->viewer,
-      _("The current document does not have a Markdown filetype."));
+      _("The current document does not have a Markdown filetype."), "UTF-8");
     plugin->handler_ids.update_view = 0;
     return FALSE;
   }
 
   md_text = (gchar*) scintilla_send_message(doc->editor->sci,
     SCI_GETCHARACTERPOINTER, 0, 0);
-  markdown_viewer_update_content(plugin->viewer, md_text);
+  markdown_viewer_update_content(plugin->viewer, md_text, doc->encoding);
 
   plugin->handler_ids.update_view = 0;
 


Modified: markdown/src/viewer.c
6 files changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -109,7 +109,8 @@ void on_viewer_load_status_notify(GObject *obj, GParamSpec *pspec, MarkdownViewe
   }
 }
 
-void markdown_viewer_update_content(MarkdownViewer *viewer, const gchar *text)
+void markdown_viewer_update_content(MarkdownViewer *viewer, const gchar *text,
+  const gchar *encoding)
 {
   g_return_if_fail(viewer);
   gchar *html = markdown_to_html(text);
@@ -122,7 +123,8 @@ void markdown_viewer_update_content(MarkdownViewer *viewer, const gchar *text)
       markdown_template_get_filename(viewer->template));
     g_signal_connect(viewer->webview, "notify::load-status",
       G_CALLBACK(on_viewer_load_status_notify), viewer);
-    webkit_web_view_load_string(viewer->webview, new_text, "text/html", "UTF-8", base_uri);
+    webkit_web_view_load_string(viewer->webview, new_text, "text/html",
+      encoding, base_uri);
     g_free(new_text);
     g_free(base_uri);
   }


Modified: markdown/src/viewer.h
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -41,7 +41,8 @@
 void markdown_viewer_show(MarkdownViewer *viewer);
 void markdown_viewer_hide(MarkdownViewer *viewer);
 
-void markdown_viewer_update_content(MarkdownViewer *viewer, const gchar *text);
+void markdown_viewer_update_content(MarkdownViewer *viewer, const gchar *text,
+  const gchar *encoding);
 
 G_END_DECLS
 


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Plugins-Commits mailing list