diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
| commit | ac16411f213f98407fc42c1d04eb4ae6c187e4a6 (patch) | |
| tree | b8fd94caee6b202043810a7366ab3f032882a48f /src/extension/dbus | |
| parent | add newly linked-in m4 files to .bzrignore (diff) | |
| parent | Fix for 170395 : Add Trace Bitmap to context menu of images : Focus fix (diff) | |
| download | inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.tar.gz inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.zip | |
merge from trunk (r11698)
(bzr r11668.1.10)
Diffstat (limited to 'src/extension/dbus')
| -rw-r--r-- | src/extension/dbus/application-interface.cpp | 41 | ||||
| -rw-r--r-- | src/extension/dbus/application-interface.h | 17 | ||||
| -rw-r--r-- | src/extension/dbus/dbus-init.cpp | 3 | ||||
| -rw-r--r-- | src/extension/dbus/dbus-init.h | 1 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.cpp | 57 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.h | 14 |
6 files changed, 75 insertions, 58 deletions
diff --git a/src/extension/dbus/application-interface.cpp b/src/extension/dbus/application-interface.cpp index a652b7c96..8ee7bd12f 100644 --- a/src/extension/dbus/application-interface.cpp +++ b/src/extension/dbus/application-interface.cpp @@ -39,6 +39,9 @@ application_interface_class_init (ApplicationInterfaceClass *klass) static void application_interface_init (ApplicationInterface *object) { + dbus_g_error_domain_register (INKSCAPE_ERROR, + NULL, + INKSCAPE_TYPE_ERROR); } @@ -48,6 +51,44 @@ application_interface_new (void) return (ApplicationInterface*)g_object_new (TYPE_APPLICATION_INTERFACE, NULL); } +/* + * Error stuff... + * + * To add a new error type, edit here and in the .h InkscapeError enum. + */ +GQuark +inkscape_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("inkscape_error"); + + return quark; +} + +#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } + +GType inkscape_error_get_type(void) +{ + static GType etype = 0; + + if (etype == 0) { + static const GEnumValue values[] = + { + + ENUM_ENTRY(INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), + ENUM_ENTRY(INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), + ENUM_ENTRY(INKSCAPE_ERROR_VERB, "Failed_Verb"), + ENUM_ENTRY(INKSCAPE_ERROR_OTHER, "Generic_Error"), + { 0, 0, 0 } + }; + + etype = g_enum_register_static("InkscapeError", values); + } + + return etype; +} + /**************************************************************************** DESKTOP FUNCTIONS ****************************************************************************/ diff --git a/src/extension/dbus/application-interface.h b/src/extension/dbus/application-interface.h index e782bd1ad..88219a6b0 100644 --- a/src/extension/dbus/application-interface.h +++ b/src/extension/dbus/application-interface.h @@ -45,6 +45,23 @@ struct _ApplicationInterfaceClass { GObjectClass parent; }; + +typedef enum +{ + INKSCAPE_ERROR_SELECTION, + INKSCAPE_ERROR_OBJECT, + INKSCAPE_ERROR_VERB, + INKSCAPE_ERROR_OTHER +} InkscapeError; + + + +#define INKSCAPE_ERROR (inkscape_error_quark ()) +#define INKSCAPE_TYPE_ERROR (inkscape_error_get_type ()) + +GQuark inkscape_error_quark (void); +GType inkscape_error_get_type (void); + /**************************************************************************** DESKTOP FUNCTIONS ****************************************************************************/ diff --git a/src/extension/dbus/dbus-init.cpp b/src/extension/dbus/dbus-init.cpp index 1b6baa979..9ff6897e5 100644 --- a/src/extension/dbus/dbus-init.cpp +++ b/src/extension/dbus/dbus-init.cpp @@ -128,9 +128,6 @@ dbus_init_desktop_interface (SPDesktop * dt) DBusGConnection *connection; DBusGProxy *proxy; DocumentInterface *obj; - dbus_g_error_domain_register (INKSCAPE_ERROR, - NULL, - INKSCAPE_TYPE_ERROR); std::string name("/org/inkscape/desktop_"); std::stringstream out; diff --git a/src/extension/dbus/dbus-init.h b/src/extension/dbus/dbus-init.h index 4b07acfb4..025011f28 100644 --- a/src/extension/dbus/dbus-init.h +++ b/src/extension/dbus/dbus-init.h @@ -12,6 +12,7 @@ #include "desktop.h" + namespace Inkscape { namespace Extension { namespace Dbus { diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index c67234b34..56d1dfdbd 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -17,6 +17,7 @@ #include "file.h" //IO #include "document-interface.h" +#include "application-interface.h" #include <string.h> #include <dbus/dbus-glib.h> #include "desktop-handles.h" //sp_desktop_document() @@ -222,11 +223,12 @@ dbus_create_node (SPDesktop *desk, const gchar *type) */ gchar *finish_create_shape (DocumentInterface *object, GError ** /*error*/, Inkscape::XML::Node *newNode, gchar *desc) { - SPCSSAttr *style = sp_desktop_get_style(object->desk, TRUE); if (style) { - newNode->setAttribute("style", sp_repr_css_write_string(style), TRUE); + Glib::ustring str; + sp_repr_css_write_string(style, str); + newNode->setAttribute("style", str.c_str(), TRUE); } else { newNode->setAttribute("style", "fill:#0000ff;fill-opacity:1;stroke:#c900b9;stroke-width:0;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none", TRUE); @@ -320,43 +322,7 @@ document_interface_new (void) return (DocumentInterface*)g_object_new (TYPE_DOCUMENT_INTERFACE, NULL); } -/* - * Error stuff... - * - * To add a new error type, edit here and in the .h InkscapeError enum. - */ -GQuark -inkscape_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("inkscape_error"); - - return quark; -} - -#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } -GType inkscape_error_get_type(void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = - { - - ENUM_ENTRY(INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), - ENUM_ENTRY(INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), - ENUM_ENTRY(INKSCAPE_ERROR_VERB, "Failed_Verb"), - ENUM_ENTRY(INKSCAPE_ERROR_OTHER, "Generic_Error"), - { 0, 0, 0 } - }; - - etype = g_enum_register_static("InkscapeError", values); - } - - return etype; -} /**************************************************************************** MISC FUNCTIONS @@ -565,7 +531,7 @@ gchar *document_interface_node(DocumentInterface *object, gchar *type, GError ** } /**************************************************************************** - ENVIORNMENT FUNCTIONS + ENVIRONMENT FUNCTIONS ****************************************************************************/ gdouble document_interface_document_get_width (DocumentInterface *object) @@ -582,7 +548,9 @@ document_interface_document_get_height (DocumentInterface *object) gchar *document_interface_document_get_css(DocumentInterface *object, GError ** /*error*/) { SPCSSAttr *current = (object->desk)->current; - return sp_repr_css_write_string(current); + Glib::ustring str; + sp_repr_css_write_string(current, str); + return (str.empty() ? NULL : g_strdup (str.c_str())); } gboolean document_interface_document_merge_css(DocumentInterface *object, @@ -803,7 +771,9 @@ document_interface_modify_css (DocumentInterface *object, gchar *shape, SPCSSAttr * oldstyle = sp_repr_css_attr (node, style); sp_repr_css_set_property(oldstyle, cssattrb, newval); - node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE); + Glib::ustring str; + sp_repr_css_write_string (oldstyle, str); + node->setAttribute (style, str.c_str(), TRUE); return TRUE; } @@ -826,7 +796,10 @@ document_interface_merge_css (DocumentInterface *object, gchar *shape, SPCSSAttr * oldstyle = sp_repr_css_attr (node, style); sp_repr_css_merge(oldstyle, newstyle); - node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE); + Glib::ustring str; + sp_repr_css_write_string (oldstyle, str); + node->setAttribute (style, str.c_str(), TRUE); + return TRUE; } diff --git a/src/extension/dbus/document-interface.h b/src/extension/dbus/document-interface.h index e7e55cb7d..5fcbb919b 100644 --- a/src/extension/dbus/document-interface.h +++ b/src/extension/dbus/document-interface.h @@ -56,19 +56,7 @@ struct _DocumentInterfaceClass { GObjectClass parent; }; -typedef enum -{ - INKSCAPE_ERROR_SELECTION, - INKSCAPE_ERROR_OBJECT, - INKSCAPE_ERROR_VERB, - INKSCAPE_ERROR_OTHER -} InkscapeError; - -#define INKSCAPE_ERROR (inkscape_error_quark ()) -#define INKSCAPE_TYPE_ERROR (inkscape_error_get_type ()) - -GQuark inkscape_error_quark (void); -GType inkscape_error_get_type (void); + struct DBUSPoint { int x; |
