From: gouldtj Date: Wed, 27 Jun 2007 06:29:59 +0000 (+0000) Subject: r15631@tres: ted | 2007-06-26 22:34:54 -0700 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a481b31bb2f2b4a3574dca4aae41cee3406cd01c;p=inkscape.git r15631@tres: ted | 2007-06-26 22:34:54 -0700 Cleaning up the ::effect function to use more Glib:: --- diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 898391e84..c877a827f 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -752,50 +752,24 @@ Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *do return; } - gchar *tmpname; - // FIXME: process the GError instead of passing NULL - gint tempfd_in = g_file_open_tmp("ink_ext_XXXXXX", &tmpname, NULL); - if (tempfd_in == -1) { - /* Error, couldn't create temporary filename */ - if (errno == EINVAL) { - /* The last six characters of template were not XXXXXX. Now template is unchanged. */ - perror("Extension::Script: template for filenames is misconfigured.\n"); - exit(-1); - } else if (errno == EEXIST) { - /* Now the contents of template are undefined. */ - perror("Extension::Script: Could not create a unique temporary filename\n"); - return; - } else { - perror("Extension::Script: Unknown error creating temporary filename\n"); - exit(-1); - } + std::string tempfilename_in; + int tempfd_in = 0; + try { + tempfd_in = Glib::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg"); + } catch (...) { + /// \todo Popup dialog here + return; } - Glib::ustring tempfilename_in = tmpname; - g_free(tmpname); - - - // FIXME: process the GError instead of passing NULL - gint tempfd_out = g_file_open_tmp("ink_ext_XXXXXX", &tmpname, NULL); - if (tempfd_out == -1) { - /* Error, couldn't create temporary filename */ - if (errno == EINVAL) { - /* The last six characters of template were not XXXXXX. Now template is unchanged. */ - perror("Extension::Script: template for filenames is misconfigured.\n"); - exit(-1); - } else if (errno == EEXIST) { - /* Now the contents of template are undefined. */ - perror("Extension::Script: Could not create a unique temporary filename\n"); - return; - } else { - perror("Extension::Script: Unknown error creating temporary filename\n"); - exit(-1); - } + std::string tempfilename_out; + int tempfd_out = 0; + try { + tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); + } catch (...) { + /// \todo Popup dialog here + return; } - Glib::ustring tempfilename_out= tmpname; - g_free(tmpname); - SPDesktop *desktop = (SPDesktop *) doc; sp_namedview_document_from_window(desktop);