~ubuntu-branches/ubuntu/maverick/gnome-chemistry-utils/maverick

« back to all changes in this revision

Viewing changes to libs/gcp/application.cc

  • Committer: Bazaar Package Importer
  • Author(s): Micah Gersten
  • Date: 2010-03-29 10:49:13 UTC
  • mfrom: (1.1.6 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100329104913-o335elk75e3emtf8
Tags: 0.10.12-2ubuntu1
* Merge from debian testing (LP: #550972).  Remaining changes:
  - debian/patches/disable_check_omf.dpatch: Added to disable check-doc-omf
    as it requires Internet access
  - debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * GChemPaint library
5
5
 * application.cc 
6
6
 *
7
 
 * Copyright (C) 2004-2008 Jean Bréfort <jean.brefort@normalesup.org>
 
7
 * Copyright (C) 2004-2010 Jean Bréfort <jean.brefort@normalesup.org>
8
8
 *
9
9
 * This program is free software; you can redistribute it and/or 
10
10
 * modify it under the terms of the GNU General Public License as 
48
48
#include "zoomdlg.h"
49
49
#include <gcu/filechooser.h>
50
50
#include <gcu/loader.h>
 
51
#include <gcu/loader-error.h>
51
52
#include <goffice/goffice.h>
52
53
#ifndef GOFFICE_HAS_GLOBAL_HEADER
53
54
#   include <goffice/utils/go-file.h>
400
401
        m_ConfClient = gconf_client_get_default ();
401
402
#endif
402
403
        GCU_GCONF_GET ("compression", int, CompressionLevel, 0)
403
 
        GCU_GCONF_GET ("tearable-mendeleiev", bool, TearableMendeleiev, false)
404
404
        bool CopyAsText;
405
405
        GCU_GCONF_GET ("copy-as-text", bool, CopyAsText, false)
406
406
        ClipboardFormats = CopyAsText? GCP_CLIPBOARD_ALL: GCP_CLIPBOARD_NO_TEXT;
636
636
                        }
637
637
                }
638
638
                g_object_unref (file);
639
 
        } else  { //loading
 
639
        } else  try { //loading
640
640
                file = g_file_new_for_uri (filename);
641
641
                err = g_file_query_exists (file, NULL);
642
642
                g_object_unref (file);
664
664
                }
665
665
                pDoc->SetFileName(filename2, mime_type);
666
666
                if (Load (filename2, mime_type, pDoc)) {
 
667
                        pDoc->Loaded ();
667
668
                        pDoc->GetView ()->AddObject (pDoc);
668
669
                        pDoc->GetView ()->Update (pDoc);
669
670
                        pDoc->GetView ()->EnsureSize ();
682
683
                                OpenWithBabel (filename2, mime_type, pDoc);
683
684
                }
684
685
        }
 
686
        catch (LoaderError &e) {
 
687
                pDoc->Clear ();
 
688
                char *unescaped = g_uri_unescape_string (filename, NULL);
 
689
                string mess = _("Error in ");
 
690
                mess += unescaped;
 
691
                // Note to translator: add a space if needed before the semicolon
 
692
                mess += _(":\n");
 
693
                mess += e.what ();
 
694
                GtkWidget *message = gtk_message_dialog_new (NULL, (GtkDialogFlags) 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, mess.c_str (), NULL, NULL);
 
695
                g_free (unescaped);
 
696
                gtk_window_set_icon_name (GTK_WINDOW (message), "gchempaint");
 
697
                g_signal_connect_swapped (G_OBJECT (message), "response", G_CALLBACK (gtk_widget_destroy), G_OBJECT (message));
 
698
                gtk_widget_show (message);
 
699
        }
685
700
        return false;
686
701
}
687
702
 
1208
1223
                return; // we might want an error message?
1209
1224
#endif
1210
1225
        GCU_UPDATE_KEY ("compression", int, CompressionLevel, {})
1211
 
        GCU_UPDATE_KEY ("tearable-mendeleiev", bool, TearableMendeleiev,
1212
 
                                        {
1213
 
                                                Tools *ToolsBox = dynamic_cast<Tools*> (GetDialog ("tools"));
1214
 
                                                if (ToolsBox)
1215
 
                                                        ToolsBox->Update ();
1216
 
                                        })
1217
1226
        bool CopyAsText;
1218
1227
        GCU_UPDATE_KEY ("copy-as-text", bool, CopyAsText, ClipboardFormats = CopyAsText?GCP_CLIPBOARD_ALL: GCP_CLIPBOARD_NO_TEXT;)
1219
1228
}