Re: Nautilus Extension Problem
- From: Colomban Wendling <lists ban herbesfolles org>
- To: nautilus-list gnome org
- Subject: Re: Nautilus Extension Problem
- Date: Tue, 15 Jan 2013 19:01:25 +0100
Hi,
Le 15/01/2013 18:51, Ozojie Chikelu a écrit :
> Hi
>
> I have this application that am developing and I want to integrate it to
> nautilus file manager on ubuntu 12.04 and am facing problems
>
> according to the guide here
> http://taschenorakel.de/svn/repos/bulldozer/tags/release-0.1.0/documentation/NautilusExtensions.html
> I should be able to build this
>
> [...]
You're writing C++ here, not C. It can work (I think), but you need to
take extra care for the symbols that Nautilus must see to have C linkage
(the extern C stuff). I suggest you to write your extension in plain C,
at least when you start, because it's highly likely to make it way harder.
> void test_stuff(NautilusMenuItem *item, gpointer user_data)
> {
> char* folders;
> folders = g_object_get_data(item, "folder");
>
> cout << folders;
> }
> but it doesn't build.
>
> I get this error:
>
> /home/zouga/DevStuffs/couttest/main.cpp:49: error: cannot convert
> 'NautilusMenuItem* {aka _NautilusMenuItem*}' to 'GObject* {aka
> _GObject*}' for argument '1' to 'void g_object_set_data(GObject*, const
> gchar*, gpointer)'
As said, it's supposed to be C, NautilusMenuItem is *not* a C++ class,
but a C struct, which happen to be a "substruct" of GObject (and
others). Take a look at the documentation for GObject for details how
it works.
Here, you should cast the first argument of g_object_get_data() to
GObject using the G_OBJECT() macro:
g_object_get_data(G_OBJECT(item), ...);
> please what am I doing wrong
A cast too few, but mostly using C++ rather than C.
Regards,
Colomban
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]