Merge lp:~joakim-verona/inkscape/dbus-fixes into lp:~inkscape.dev/inkscape/trunk

Proposed by joakim@verona.se
Status: Merged
Approved by: jazzynico
Approved revision: 10016
Merged at revision: 10114
Proposed branch: lp:~joakim-verona/inkscape/dbus-fixes
Merge into: lp:~inkscape.dev/inkscape/trunk
Diff against target: 250 lines (+89/-21)
8 files modified
src/display/canvas-text.h (+1/-0)
src/document.cpp (+5/-1)
src/extension/dbus/dbus-init.cpp (+0/-3)
src/extension/dbus/document-interface.cpp (+44/-12)
src/extension/dbus/document-interface.h (+5/-2)
src/extension/dbus/document-interface.xml (+29/-0)
src/extension/dbus/wrapper/inkscape-dbus-wrapper.c (+4/-2)
src/extension/dbus/wrapper/inkscape-dbus-wrapper.h (+1/-1)
To merge this branch: bzr merge lp:~joakim-verona/inkscape/dbus-fixes
Reviewer Review Type Date Requested Status
jazzynico (community) Approve
Yury V. Zaytsev supeficial Needs Fixing
Review via email: mp+50526@code.launchpad.net

Description of the change

fixes some dbus bugs. ive used this branch for a while and it seems ok.

To post a comment you must log in.
Revision history for this message
Yury V. Zaytsev (zyv) wrote :

The branch contains an unclean merge in file:

=== modified file 'src/extension/dbus/document-interface.cpp'

review: Needs Fixing (supeficial)
10016. By joakim@verona.se

merge upstream

Revision history for this message
joakim@verona.se (joakim-verona) wrote :

> The branch contains an unclean merge in file:
>
> === modified file 'src/extension/dbus/document-interface.cpp'

new try.

Revision history for this message
jazzynico (jazzynico) wrote :

Branch tested successfully on Ubuntu 10.10, Inkscape revision 10113.
All the bugs listed here are fixed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/display/canvas-text.h'
--- src/display/canvas-text.h 2011-02-02 21:24:36 +0000
+++ src/display/canvas-text.h 2011-02-20 22:27:52 +0000
@@ -53,6 +53,7 @@
53#endif // SEEN_SP_CANVASTEXT_H53#endif // SEEN_SP_CANVASTEXT_H
5454
5555
56
56/*57/*
57 Local Variables:58 Local Variables:
58 mode:c++59 mode:c++
5960
=== modified file 'src/document.cpp'
--- src/document.cpp 2011-02-20 10:37:24 +0000
+++ src/document.cpp 2011-02-20 22:27:52 +0000
@@ -848,7 +848,11 @@
848 g_return_val_if_fail(id != NULL, NULL);848 g_return_val_if_fail(id != NULL, NULL);
849849
850 GQuark idq = g_quark_from_string(id);850 GQuark idq = g_quark_from_string(id);
851 return (SPObject*)g_hash_table_lookup(priv->iddef, GINT_TO_POINTER(idq));851 gpointer rv = g_hash_table_lookup(priv->iddef, GINT_TO_POINTER(idq));
852 if(rv != NULL)
853 return (SPObject*)rv;
854 else
855 return NULL;
852}856}
853857
854sigc::connection SPDocument::connectIdChanged(gchar const *id,858sigc::connection SPDocument::connectIdChanged(gchar const *id,
855859
=== modified file 'src/extension/dbus/dbus-init.cpp'
--- src/extension/dbus/dbus-init.cpp 2011-02-03 23:13:20 +0000
+++ src/extension/dbus/dbus-init.cpp 2011-02-20 22:27:52 +0000
@@ -86,7 +86,6 @@
86 GError *error = NULL;86 GError *error = NULL;
87 DBusGConnection *connection;87 DBusGConnection *connection;
88 DBusGProxy *proxy;88 DBusGProxy *proxy;
89 DocumentInterface *obj;
90 connection = dbus_get_connection();89 connection = dbus_get_connection();
91 proxy = dbus_get_proxy(connection);90 proxy = dbus_get_proxy(connection);
92 org_freedesktop_DBus_request_name (proxy,91 org_freedesktop_DBus_request_name (proxy,
@@ -102,8 +101,6 @@
102101
103gchar *102gchar *
104init_document (void) {103init_document (void) {
105 guint result;
106 GError *error = NULL;
107 DBusGConnection *connection;104 DBusGConnection *connection;
108 DBusGProxy *proxy;105 DBusGProxy *proxy;
109 SPDocument *doc;106 SPDocument *doc;
110107
=== modified file 'src/extension/dbus/document-interface.cpp'
--- src/extension/dbus/document-interface.cpp 2011-02-03 23:13:20 +0000
+++ src/extension/dbus/document-interface.cpp 2011-02-20 22:27:52 +0000
@@ -36,6 +36,20 @@
36#include "sp-ellipse.h"36#include "sp-ellipse.h"
37#include "sp-object.h"37#include "sp-object.h"
38#include "style.h" //style_write38#include "style.h" //style_write
39
40#include "file.h" //IO
41
42#include "extension/system.h" //IO
43
44#include "extension/output.h" //IO
45
46#include "print.h" //IO
47
48#include "live_effects/parameter/text.h" //text
49#include "display/canvas-text.h" //text
50
51#include "display/sp-canvas.h" //text
52#include "text-editing.h"
39#include "verbs.h"53#include "verbs.h"
40#include "xml/repr.h" //sp_repr_document_new54#include "xml/repr.h" //sp_repr_document_new
4155
@@ -61,13 +75,13 @@
61 /* ALTERNATIVE (is this faster if only repr is needed?)75 /* ALTERNATIVE (is this faster if only repr is needed?)
62 Inkscape::XML::Node *node = sp_repr_lookup_name((doc->root)->repr, name);76 Inkscape::XML::Node *node = sp_repr_lookup_name((doc->root)->repr, name);
63 */77 */
64 Inkscape::XML::Node * node = sp_desktop_document(desk)->getObjectById(name)->getRepr();78 SPObject * obj = sp_desktop_document(desk)->getObjectById(name);
65 if (!node)79 if (!obj)
66 {80 {
67 g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OBJECT, "Object '%s' not found in document.", name);81 g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OBJECT, "Object '%s' not found in document.", name);
68 return NULL;82 return NULL;
69 }83 }
70 return node;84 return obj->getRepr();
71}85}
7286
73/* 87/*
@@ -346,6 +360,7 @@
346 if (object->updates) {360 if (object->updates) {
347 Inkscape::DocumentUndo::done(sp_desktop_document(desk2), verb->get_code(), g_strdup(verb->get_tip()));361 Inkscape::DocumentUndo::done(sp_desktop_document(desk2), verb->get_code(), g_strdup(verb->get_tip()));
348 }362 }
363 return TRUE;
349 }364 }
350 }365 }
351 }366 }
@@ -470,17 +485,20 @@
470 return retval;485 return retval;
471}486}
472487
473gboolean488gchar*
474document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error)489document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error)
475{490{
476 //FIXME: Not selectable (aka broken). Needs to be rewritten completely.491
477492 Inkscape::XML::Node *text_node = dbus_create_node(object->desk, "svg:text");
478 SPDesktop *desktop = object->desk;493 sp_repr_set_int(text_node, "x", x);
479 SPCanvasText * canvas_text = (SPCanvasText *) sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, Geom::Point(0,0), "");494 sp_repr_set_int(text_node, "y", y);
480 sp_canvastext_set_text (canvas_text, text);495 //just a workaround so i can get an spitem from the name
481 sp_canvastext_set_coords (canvas_text, x, y);496 gchar *name = finish_create_shape (object, error, text_node, (gchar *)"create text");
482497
483 return TRUE;498 SPItem* text_obj=(SPItem* )get_object_by_name(object->desk, name, error);
499 sp_te_set_repr_text_multiline(text_obj, text);
500
501 return name;
484}502}
485503
486gchar *504gchar *
@@ -809,6 +827,20 @@
809}827}
810828
811829
830gboolean
831document_interface_set_text (DocumentInterface *object, gchar *name, gchar *text, GError **error)
832{
833
834 SPItem* text_obj=(SPItem* )get_object_by_name(object->desk, name, error);
835 //TODO verify object type
836 if (!text_obj)
837 return FALSE;
838 sp_te_set_repr_text_multiline(text_obj, text);
839 return TRUE;
840
841}
842
843
812/****************************************************************************844/****************************************************************************
813 FILE I/O FUNCTIONS845 FILE I/O FUNCTIONS
814****************************************************************************/846****************************************************************************/
815847
=== modified file 'src/extension/dbus/document-interface.h'
--- src/extension/dbus/document-interface.h 2011-02-03 23:13:20 +0000
+++ src/extension/dbus/document-interface.h 2011-02-20 22:27:52 +0000
@@ -115,10 +115,13 @@
115document_interface_line (DocumentInterface *object, int x, int y, 115document_interface_line (DocumentInterface *object, int x, int y,
116 int x2, int y2, GError **error);116 int x2, int y2, GError **error);
117117
118gboolean118gchar*
119document_interface_text (DocumentInterface *object, int x, int y, 119document_interface_text (DocumentInterface *object, int x, int y,
120 gchar *text, GError **error);120 gchar *text, GError **error);
121 121gboolean
122document_interface_set_text (DocumentInterface *object, gchar *name,
123 gchar *text, GError **error);
124
122gchar *125gchar *
123document_interface_image (DocumentInterface *object, int x, int y, 126document_interface_image (DocumentInterface *object, int x, int y,
124 gchar *filename, GError **error);127 gchar *filename, GError **error);
125128
=== modified file 'src/extension/dbus/document-interface.xml'
--- src/extension/dbus/document-interface.xml 2009-08-15 18:26:08 +0000
+++ src/extension/dbus/document-interface.xml 2011-02-20 22:27:52 +0000
@@ -310,6 +310,12 @@
310 <doc:summary>The text you want.</doc:summary>310 <doc:summary>The text you want.</doc:summary>
311 </doc:doc>311 </doc:doc>
312 </arg>312 </arg>
313 <arg type="s" name="object_name" direction="out" >
314 <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value="error"/>
315 <doc:doc>
316 <doc:summary>The name of the new text.</doc:summary>
317 </doc:doc>
318 </arg>
313 <doc:doc>319 <doc:doc>
314 <doc:description>320 <doc:description>
315 <doc:para>This method creates some text in the current layer.</doc:para>321 <doc:para>This method creates some text in the current layer.</doc:para>
@@ -472,6 +478,29 @@
472 </doc:doc>478 </doc:doc>
473 </method>479 </method>
474480
481
482 <method name="set_text">
483 <arg type="s" name="shape" direction="in" >
484 <doc:doc>
485 <doc:summary>The id of an object.</doc:summary>
486 </doc:doc>
487 </arg>
488
489 <arg type="s" name="text" direction="in" >
490 <doc:doc>
491 <doc:summary>The text you want.</doc:summary>
492 </doc:doc>
493 </arg>
494 <doc:doc>
495 <doc:description>
496 <doc:para>set text of text object.</doc:para>
497 </doc:description>
498 </doc:doc>
499 </method>
500
501
502
503
475 <method name="set_int_attribute">504 <method name="set_int_attribute">
476 <arg type="s" name="shape" direction="in" >505 <arg type="s" name="shape" direction="in" >
477 <doc:doc>506 <doc:doc>
478507
=== modified file 'src/extension/dbus/wrapper/inkscape-dbus-wrapper.c'
--- src/extension/dbus/wrapper/inkscape-dbus-wrapper.c 2010-01-01 04:38:19 +0000
+++ src/extension/dbus/wrapper/inkscape-dbus-wrapper.c 2011-02-20 22:27:52 +0000
@@ -198,11 +198,13 @@
198}198}
199199
200//static200//static
201gboolean201char *
202inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error)202inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error)
203{203{
204 char * OUT_object_name;
204 DBusGProxy *proxy = doc->proxy;205 DBusGProxy *proxy = doc->proxy;
205 return org_inkscape_document_text (proxy, IN_x, IN_y, IN_text, error);206 org_inkscape_document_text (proxy, IN_x, IN_y, IN_text, &OUT_object_name, error);
207 return OUT_object_name;
206}208}
207209
208//static210//static
209211
=== modified file 'src/extension/dbus/wrapper/inkscape-dbus-wrapper.h'
--- src/extension/dbus/wrapper/inkscape-dbus-wrapper.h 2009-08-13 20:53:03 +0000
+++ src/extension/dbus/wrapper/inkscape-dbus-wrapper.h 2011-02-20 22:27:52 +0000
@@ -72,7 +72,7 @@
72inkscape_line (DocumentInterface *doc, const gint IN_x, const gint IN_y, const gint IN_x2, const gint IN_y2, GError **error);72inkscape_line (DocumentInterface *doc, const gint IN_x, const gint IN_y, const gint IN_x2, const gint IN_y2, GError **error);
7373
74//static74//static
75gboolean75char *
76inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error);76inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error);
7777
78//static78//static