summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19efd01)
raw | patch | inline | side by side (parent: 19efd01)
author | glimmer07 <glimmer07@users.sourceforge.net> | |
Mon, 20 Jul 2009 20:34:13 +0000 (20:34 +0000) | ||
committer | glimmer07 <glimmer07@users.sourceforge.net> | |
Mon, 20 Jul 2009 20:34:13 +0000 (20:34 +0000) |
src/extension/dbus/document-interface.cpp | patch | blob | history | |
src/extension/dbus/document-interface.h | patch | blob | history | |
src/extension/dbus/document-interface.xml | patch | blob | history |
index 914303a91a3e7401632b7d9050ec6865a9fea615..b9d8848cc9a212fdb3bc030267bdd8d897351b48 100644 (file)
/****************************************************************************
- UPDATE FUNCTIONS
+ UPDATE FUNCTIONS FIXME: test update system again.
****************************************************************************/
void
sp_desktop_document(object->desk)->root->uflags = TRUE;
sp_desktop_document(object->desk)->root->mflags = TRUE;
//sp_desktop_document(object->desk)->_updateDocument();
+ //FIXME: use better verb than rect.
sp_document_done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions");
}
****************************************************************************/
gboolean
-document_interface_selection_get (DocumentInterface *object, GSList const * listy, GError **error)
+document_interface_selection_get (DocumentInterface *object, char ***out, GError **error)
{
Inkscape::Selection * sel = sp_desktop_selection(object->desk);
GSList const *oldsel = sel->list();
int size = g_slist_length((GSList *) oldsel);
- int i;
- printf("premalloc\n");
- gchar **list = (gchar **)malloc(size);
- printf("postmalloc\n");
- for(i = 0; i < size; i++)
- list[i] = (gchar *)malloc(sizeof(gchar) * 10);
- printf("postmalloc2\n");
- i=0;
- printf("prealloc\n");
+
+ *out = g_new0 (char *, size + 1);
+
+ int i = 0;
for (GSList const *iter = oldsel; iter != NULL; iter = iter->next) {
- strcpy (list[i], SP_OBJECT(iter->data)->repr->attribute("id"));
+ (*out)[i] = g_strdup(SP_OBJECT(iter->data)->repr->attribute("id"));
i++;
}
- printf("postalloc\n");
- for (i=0; i<size; i++) {
- printf("%d = %s\n", i, list[i]);
- }
-
- listy = oldsel;
+ (*out)[i] = NULL;
+
return TRUE;
}
@@ -741,13 +733,9 @@ document_interface_selection_add (DocumentInterface *object, char *name, GError
{
if (name == NULL)
return FALSE;
- SPDocument * doc = sp_desktop_document (object->desk);
Inkscape::Selection *selection = sp_desktop_selection(object->desk);
- /* WORKS
- Inkscape::XML::Node *repr2 = sp_repr_lookup_name((doc->root)->repr, name);
- selection->add(repr2, TRUE);
- */
- selection->add(doc->getObjectById(name));
+
+ selection->add(get_object_by_name(object->desk, name));
return TRUE;
}
document_interface_selection_add_list (DocumentInterface *object,
char **names, GError **error)
{
- //FIXME: implement.
- return FALSE;
+ int i;
+ for (i=0;names[i] != NULL;i++) {
+ //printf("NAME: %s\n", names[i]);
+ document_interface_selection_add(object, names[i], error);
+ }
+ return TRUE;
}
gboolean
document_interface_selection_set_list (DocumentInterface *object,
gchar **names, GError **error)
{
- //FIXME: broken array passing.
sp_desktop_selection(object->desk)->clear();
int i;
- for (i=0;((i<30000) && (names[i] != NULL));i++) {
- printf("NAME: %s\n", names[i]);
+ for (i=0;names[i] != NULL;i++) {
+ //printf("NAME: %s\n", names[i]);
document_interface_selection_add(object, names[i], error);
}
return TRUE;
index ba60a6599fa1df2c86f9ef3ce045ee61a9b5bf9e..53fcacaaa30dbfeb08586c17e1ecbca829e4308f 100644 (file)
SELECTION FUNCTIONS
****************************************************************************/
gboolean
-document_interface_selection_get (DocumentInterface *object, GSList const * listy, GError **error);
+document_interface_selection_get (DocumentInterface *object, char ***out, GError **error);
gboolean
document_interface_selection_add (DocumentInterface *object,
index 14be0312bb16ede3f0a538cb0f7695f43752a02a..5db3de763aa034cf501adb1a210ab8cd5f4d27f2 100644 (file)
<method name="selection_get">
<arg type="as" name="listy" direction="out" >
+ <!-- <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/> -->
<doc:doc>
<doc:summary>List of the ids of currently selected objects.</doc:summary>
</doc:doc>