summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-02-10 19:18:24 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-02-16 10:09:25 +0530
commitf5f3103187545952babf7b7efbdebc7d969f0974 (patch)
treeef7cc8b3caaa12294c49851362da4a19ba60fac2 /libreofficekit
parentce96c5957c38384f8911d6307605c502eca0c644 (diff)
gtktiledviewer: comment id can be a string too now
Change-Id: Ia94041884b7fde5f6c104a41c77c6a3aa96b7be1
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 542e63154b38..1bdb2560a172 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -291,11 +291,11 @@ static void editButtonClicked(GtkWidget* pWidget, gpointer userdata)
userPromptDialog(rWindow.m_pDocView, "Edit comment", aEntries);
- int *commentId = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+ gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
boost::property_tree::ptree aTree;
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
- aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentId));
+ aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
@@ -315,11 +315,11 @@ static void replyButtonClicked(GtkWidget* pWidget, gpointer userdata)
userPromptDialog(rWindow.m_pDocView, "Reply comment", aEntries);
- int *commentId = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+ gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
boost::property_tree::ptree aTree;
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
- aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentId));
+ aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
@@ -335,11 +335,11 @@ static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
{
TiledWindow& rWindow = lcl_getTiledWindow(pWidget);
- int *commentid = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+ gchar *commentid = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
boost::property_tree::ptree aTree;
aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
- aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentid));
+ aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentid));
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
@@ -351,12 +351,11 @@ static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
GtkWidget* CommentsSidebar::createCommentBox(const boost::property_tree::ptree& aComment)
{
GtkWidget* pCommentVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
- int *id = g_new(int, 1);
- *id = aComment.get<int>("id");
+ gchar *id = g_strndup(aComment.get<std::string>("id").c_str(), 20);
g_object_set_data_full(G_OBJECT(pCommentVBox), "id", id, g_free);
- // Set left-margin if its a reply comment
- if (aComment.get<int>("parent") > 0)
+ // Set background if its a reply comment
+ if (aComment.get("parent", -1) > 0)
{
GtkStyleContext* pStyleContext = gtk_widget_get_style_context(pCommentVBox);
GtkCssProvider* pCssProvider = gtk_css_provider_get_default();
@@ -1603,13 +1602,13 @@ static void commentCallback(LOKDocView* pLOKDocView, gchar* pComment, gpointer /
GtkWidget* pParent = nullptr;
for (GList* l = pChildren; l != nullptr; l = l->next)
{
- int *id = static_cast<int*>(g_object_get_data(G_OBJECT(l->data), "id"));
+ gchar *id = static_cast<gchar*>(g_object_get_data(G_OBJECT(l->data), "id"));
- if (*id == aComment.get<int>("id"))
+ if (g_strcmp0(id, aComment.get<std::string>("id").c_str()) == 0)
pSelf = GTK_WIDGET(l->data);
// There is no 'parent' in Remove callbacks
- if (*id == aComment.get("parent", -1))
+ if (g_strcmp0(id, aComment.get("parent", std::string("0")).c_str()) == 0)
pParent = GTK_WIDGET(l->data);
}