~vcs-imports/chmsee/trunk

« back to all changes in this revision

Viewing changes to src/models/chmfile.c

  • Committer: Ji YongGang
  • Date: 2010-03-29 15:13:42 UTC
  • Revision ID: git-v1:3f9b3c7a35ed10e5cb1221fce2dba358dd38456a
Call default browser to launch external link

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
                LONGINT64 len, remain = ui->length;
239
239
                LONGUINT64 offset = 0;
240
240
 
241
 
                gchar *file_ext = g_strrstr(g_path_get_basename(ui->path), ".");
242
 
 
243
241
                if ((fout = fopen(fname, "wb")) == NULL) {
244
242
                        /* make sure that it isn't just a missing directory before we abort */
245
243
                        char newbuf[32768];
784
782
 
785
783
        g_debug("CS_CHMFILE >>> read bookinfo file = %s", bookinfo_file);
786
784
 
787
 
        GError     *error = NULL;
788
785
        GKeyFile *keyfile = g_key_file_new();
789
786
 
790
787
        gboolean rv = g_key_file_load_from_file(keyfile, bookinfo_file, G_KEY_FILE_NONE, NULL);
796
793
        rv = g_key_file_load_from_file(keyfile, bookinfo_file, G_KEY_FILE_NONE, NULL);
797
794
 
798
795
        if (rv) {
799
 
                priv->hhc           = g_key_file_get_string(keyfile, "Bookinfo", "hhc", &error);
800
 
                priv->hhk           = g_key_file_get_string(keyfile, "Bookinfo", "hhk", &error);
801
 
                priv->homepage      = g_key_file_get_string(keyfile, "Bookinfo", "homepage", &error);
802
 
                priv->bookname      = g_key_file_get_string(keyfile, "Bookinfo", "bookname", &error);
803
 
                priv->encoding      = g_key_file_get_string(keyfile, "Bookinfo", "encoding", &error);
804
 
                priv->variable_font = g_key_file_get_string(keyfile, "Bookinfo", "variable_font", &error);
805
 
                priv->fixed_font    = g_key_file_get_string(keyfile, "Bookinfo", "fixed_font", &error);
 
796
                priv->hhc           = g_key_file_get_string(keyfile, "Bookinfo", "hhc", NULL);
 
797
                priv->hhk           = g_key_file_get_string(keyfile, "Bookinfo", "hhk", NULL);
 
798
                priv->homepage      = g_key_file_get_string(keyfile, "Bookinfo", "homepage", NULL);
 
799
                priv->bookname      = g_key_file_get_string(keyfile, "Bookinfo", "bookname", NULL);
 
800
                priv->encoding      = g_key_file_get_string(keyfile, "Bookinfo", "encoding", NULL);
 
801
                priv->variable_font = g_key_file_get_string(keyfile, "Bookinfo", "variable_font", NULL);
 
802
                priv->fixed_font    = g_key_file_get_string(keyfile, "Bookinfo", "fixed_font", NULL);
806
803
        }
807
804
 
808
805
        g_key_file_free(keyfile);
833
830
        g_key_file_set_string(keyfile, "Bookinfo", "fixed_font", priv->fixed_font);
834
831
 
835
832
        gsize    length = 0;
836
 
        GError   *error = NULL;
837
 
        gchar *contents = g_key_file_to_data(keyfile, &length, &error);
838
 
        g_file_set_contents(bookinfo_file, contents, length, &error);
 
833
        gchar *contents = g_key_file_to_data(keyfile, &length, NULL);
 
834
        g_file_set_contents(bookinfo_file, contents, length, NULL);
839
835
 
840
836
        g_key_file_free(keyfile);
841
837
        g_free(contents);