summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-14 11:00:11 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-14 11:53:30 +0200
commitf9339d1ba316b11d00c235e9538ef0afde514443 (patch)
tree7841fe02f35cb34c6664e875500205785f964c53 /libreofficekit/source
parentbc892b04144d82507ccd59953c9f4da357c2e7b4 (diff)
lokdocview: implement LOK_CALLBACK_STATE_CHANGED
Change-Id: I239849056dd88f785dce239c4d53d6c905177b64
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 2e2313a14b21..2e6858cddedf 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -182,6 +182,8 @@ struct LOKDocView_Impl
static void callbackWorker(int nType, const char* pPayload, void* pData);
/// Implementation of the callback worder handler, invoked by callbackWorker().
void callbackWorkerImpl(int nType, const char* pPayload);
+ /// Command state (various buttons like bold are toggled or not) is changed.
+ void commandChanged(const std::string& rPayload);
};
LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPayload, LOKDocView* pDocView)
@@ -941,7 +943,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
}
case LOK_CALLBACK_STATE_CHANGED:
{
- g_info("%s", pCallback->m_aPayload.c_str());
+ commandChanged(pCallback->m_aPayload);
}
break;
default:
@@ -971,11 +973,17 @@ void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
enum
{
EDIT_CHANGED,
+ COMMAND_CHANGED,
LAST_SIGNAL
};
static guint docview_signals[LAST_SIGNAL] = { 0 };
+void LOKDocView_Impl::commandChanged(const std::string& rString)
+{
+ g_signal_emit(m_pDocView, docview_signals[COMMAND_CHANGED], 0, rString.c_str());
+}
+
static void lok_docview_class_init( gpointer ptr )
{
LOKDocViewClass* pClass = static_cast<LOKDocViewClass *>(ptr);
@@ -990,6 +998,16 @@ static void lok_docview_class_init( gpointer ptr )
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
+ pClass->command_changed = NULL;
+ docview_signals[COMMAND_CHANGED] =
+ g_signal_new("command-changed",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(LOKDocViewClass, command_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
}
static void lok_docview_init( GTypeInstance* pInstance, gpointer )