diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-07-15 05:51:35 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-07-15 05:51:35 +0000 |
| commit | 24194964c2c833cf325c5c75dd39f2934fc5ab0e (patch) | |
| tree | e5fbc38eb88502dc0a434b4e655613caee2316b1 /src/ui/dialog/document-properties.cpp | |
| parent | Fix for bug #1024325 (DXF output, Python script error: No translation file fo... (diff) | |
| download | inkscape-24194964c2c833cf325c5c75dd39f2934fc5ab0e.tar.gz inkscape-24194964c2c833cf325c5c75dd39f2934fc5ab0e.zip | |
Fix for 1023655 : Improvments to Embedded script UI
(bzr r11549)
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 71fc3ac1f..2d79c6dd7 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -617,7 +617,7 @@ void DocumentProperties::build_scripting() Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("<b>External script files:</b>")); - _external_add_btn.set_tooltip_text(_("Link")); + _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); _external_add_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); _external_remove_btn.set_tooltip_text(_("Remove")); @@ -872,8 +872,9 @@ void DocumentProperties::browseExternalScript() { Inkscape::UI::Dialog::FileOpenDialog::create( *desktop->getToplevel(), open_path, - Inkscape::UI::Dialog::SVG_TYPES, + Inkscape::UI::Dialog::CUSTOM_TYPE, _("Select a script to load")); + selectPrefsFileInstance->addFilterMenu("Javascript Files", "*.js"); } //# Show the dialog @@ -920,17 +921,19 @@ void DocumentProperties::removeExternalScript(){ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); while ( current ) { - SPObject* obj = SP_OBJECT(current->data); - SPScript* script = (SPScript*) obj; - if (name == script->xlinkhref){ - - //XML Tree being used directly here while it shouldn't be. - Inkscape::XML::Node *repr = obj->getRepr(); - if (repr){ - sp_repr_unparent(repr); - - // inform the document, so we can undo - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + if (current->data && SP_IS_OBJECT(current->data)) { + SPObject* obj = SP_OBJECT(current->data); + SPScript* script = (SPScript*) obj; + if (name == script->xlinkhref){ + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + } } } current = g_slist_next(current); |
