libglade学习笔记

1。自动连接handler name相同的信号和函数。

The some_signal_handler_func function is not referenced anywhere in the program explicitely, but if any signals are defined in the interface description that use "some_signal_handler_func" as the handler name, then this function will automatically be connected. 

2.如果想自动连接,编译的时候需要加"-export-dynamic"或"pkg-config --cflags --libs gmodule-export-2.0"

If you wish to autoconnect handlers defined in the main executable (not a shared library), you will need to pass a linker flag to export the executable's symbols for dynamic linking. This flag is platform specific, but libtool can take care of this for you. Just add -export-dynamic argument to your link flags, and libtool will convert it to the correct format.

The easiest way to get the correct extra flags is to check for gmodule-export-2.0 with pkg-config.

3.使用自动编译工具时的配置

The pkg-config program is used to deduce the compiler and link flags necessary to compile various modules. If you are using automake or autoconf, you probably want to use the PKG_CHECK_MODULES macro. This can be used to check for the presence of a collection of a number of packages, and set some shell variables:

PKG_CHECK_MODULES(MYPROG, libglade-2.0 libgnomeui-2.0 >= 1.110.0)
AC_SUBST(MYPROG_CFLAGS)
AC_SUBST(MYPROG_LIBS)

4.目前libglade支持三种module,只有使用libgnomeui需要调用gnome_program_init进行初始化操作。

Currently there are libglade module support for libbonoboui libgnomecanvas and libgnomeui. Note that libglade can also handle widgets that implement the properties interfaces with no extra code.While no additional libglade initialisation is required to use a module, however, the underlying library might need initialisation. For instance, to use libgnomeui widgets from libglade, you must call gnome_program_init beforehand.

5.libglade支持...

Libglade also supports disambiguating properties by prefixing them with a |-separated context string, e.g. "Menu/Printer|Open" vs. "Menu/File|Open". You must tell Libglade that the property has a prefix by setting the context attribute of the <property> element to "yes". To learn more about this technique, read the chapter "How to use gettext in GUI programs" in the gettext manual, and see the GLib API documentation for g_strip_context()。



原文地址:https://www.cnblogs.com/niocai/p/2267647.html