glib

g_timeout_add inside a GThread

北慕城南 提交于 2019-12-06 10:36:01
I'm trying to add a timeout source specific to a particular GThread. In the main thread, I can create a GMainContext ( g_main_context_new ) and add a timeout ( g_timeout_add ). However, when I try to do it in a thread created with g_thread_create it simply doesn't work, the GSourceFunc is never called and I have no clue why. For the moment I've only got this the documentation: Callbacks require a bit of attention. Callbacks from GTK+ (signals) are made within the GTK+ lock. However callbacks from GLib (timeouts, IO callbacks, and idle functions) are made outside of the GTK+ lock. So, within a

Gnome glib status for Windows/OSX/Unix-like and binaries [closed]

十年热恋 提交于 2019-12-06 10:25:06
Closed . This question needs to be more focused . It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 11 months ago . I am trying to understand which is the current situation of glib regarding Windows, Unix-Like (not necessary Linux) and OSX. I am analyzing if I could use glib for a project and I will need all those OS working. I am searching the binaries of Windows and the last I found are very old (from 2010 and 2011). Does this mean that windows support is being dropped by Gnome glib? I

GLib: Graceful termination of GApplication on Unix SIGINT

五迷三道 提交于 2019-12-06 10:12:29
When the user hits Ctrl + C in a Posix / Linux shell with a program running, that program recieves a SIGINT signal. When running a program based on GApplication, this means that the program gets terminated immediately. How can I overcome this and have GApplication shut down gracefully? You can use g_unix_signal_add() . This function takes a callback that is called once the program recieves the signal you specify. (SIGINT in this case) That callback should then call g_application_release() until the GApplication's use count dropped to zero. Once that is the case, the Main Loop will terminate

Glib-GIO-ERROR when opening an file chooser dialog

蹲街弑〆低调 提交于 2019-12-06 09:37:35
I use GTK3 , codeblcks IDE, glade3 in windows 7... In my application i have a button which when clicked should open a gtk_file_chooser_dialog... But gives the fillowing error.. Glib-GIO-ERROR** : No GSettings schemas are installed on the system static void on_save_clicked(GtkWidget *widget,gpointer data) { GtkWidget *dialog; //dialog=gtk_file_chooser_dialog_new("Save it",GTK_WINDOW(gtk_builder_get_object(builder,"mainwindow")),GTK_FILE_CHOOSER_ACTION_SAVE,GTK_STOCK_OK,GTK_RESPONSE_OK,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL); //dialog=GTK_FILE_CHOOSER_DIALOG(gtk_builder_get_object(builder,

交叉编译D-Bus之备忘录

荒凉一梦 提交于 2019-12-06 08:42:32
安装包命令: ./configure CC=arm-unknown-linux-gnu-gcc --prefix=/home/qudc/nfs --host=arm-linux --cache-file=arm-linux.cache 指定交叉编译工具 指定安装路径 指定目标平台 make make install 1. 把"export PATH=$PATH:/home/qudc/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin (不要加/)" 加入/home/qudc/.bashrc export交叉编译工具链接路径. 2. 用root apt-get install gcc 3. 解压交叉编译工具和linux kernel 使kernel 中make menuconfig 成功. 会遇到头文件报错问题: 安装libc6-dev 和 libncurses5-dev 这两个包. make menuconfig 成功. 4. 安装pkg-config (只能是0.9版, 系统debian4是0.21版, 不然dbus编译不过) 为glib做准备. apt-get install pkg-config 5. 解决安装glib的编译错误 stack pointer 问题: echo ac_cv_type_long_long=yes>arm

dbus实例讲解(四下):使用dbus-glib

怎甘沉沦 提交于 2019-12-06 08:19:05
4、复杂的数据类型 在dbus中怎样处理复杂的数据类型?第一个建议是尽量不要使用复杂的数据类型。但如果确实需要呢?有的网友 建议 用GArray作为容器,不管什么参数,在客户端都手工放入GArray,在服务器端再自己取出来。这确实是个思路,比较适合服务器和客户端都是自己开发的情况。还有一篇" How to pass a variant with dbus-glib " 介绍了怎样用GValue传递复杂的数据类型,读者可以参考。 下面看看在我们的例子中是怎样处理a{sv}参数的: $ cat sms_features.h #ifndef SMS_FEATURES_H #define SMS_FEATURES_H #include <glib-object.h> GHashTable *sms_create_features(const char * alphabet, int csm_num, int csm_seq); GType sms_get_features_type(void); void sms_release_features(GHashTable *features); void sms_show_features(GHashTable *features); #endif sms_features.h声明了几个函数。这个例子的服务器、客户端都会调用

D-Bus 体系

99封情书 提交于 2019-12-06 08:18:33
有很多种IPC或者网络通信系统,如:CORBA, DCE, DCOM, DCOP, XML-RPC, SOAP, MBUS, Internet Communications Engine (ICE)等等,可能会有数百种,dbus的目的主要是下面两点: 1.在同一个桌面会话中,进行桌面应用程序之间的通讯 2.桌面程序与内核或者守护进程的通信。 Dbus是一套进程通信体系,它有以下几层: 1.libdbus库,提供给各个应用程序调用,使应用程序具有通信和数据交换的能力,两个应用程序可以直接进行通信,就像是一条socket通道,两个程序之间建立通道之后,就可以通讯了。 2.消息守护进程,在libdbus的基础上创建,可以管理多个应用程序之间的通信。每个应用程序都和消息守护进程建立dbus的链接,然后由消息守护进程进行消息的分派。 3.各种包装库,有libdbus-glib,libdbus-qt等等,目的是将dbus的底层api进行一下封装。 下面有一张图可以很方便说明dbus的体系结构。 dbus中的消息由一个消息头(标识是哪一种消息)和消息数据组成,比socket的流式数据更方便一些。bus daemon 就像是一个路由器,与各个应用程序进行连接,分派这些消息。bus daemon 在一台机器上有多个实例,第一个实例是全局的实例,类似于sendmail和或者apache

DBus glib 实现和使用object

試著忘記壹切 提交于 2019-12-06 08:17:41
为了学习DBUS,写的练习程序。修改了gtk指南中tictactoe的代码, tictactoe上有三行三列9个按键,三个连成行列或斜线的按钮被按下后则reset。在其中加入DBUS server,使其他程序可以通过DBUS控制tictactoe中的按键。 实现一个 Object: tictactoe.c中包含了tictactoe类定义,ttt_test.c中则创建了一个实例。 实现一个描述 object 的XML文件,其中定义了interface和method, <?xml version="1.0" encoding="UTF-8" ?> <node name="/com/lp/tictactoe"> <interface name="com.lp.tictactoe"> <method name="keypad"> <arg type="u" name="x" direction="in" /> </method> </interface> </node> 并使用 dbus-binding-tool 产生头文件 dbus-binding-tool --mode=glib-server --prefix=tictactoe tictactoe.xml > tictactoe-glue2.h 调用 dbus_g_object_type_install_info 函数安装

DBus-glib环境的搭建

时光总嘲笑我的痴心妄想 提交于 2019-12-06 08:17:22
我的操作系统是Ubuntu 14.04 安装Dbus及其相关库: sudo apt-get install dbus sudo apt-get install d-feet sudo apt-get install libgtk2.0-dev sudo apt-get install libdbus-glib-1-dev 编译dbus代码时需要指定相关头文件及库文件,因此编写如下简单的Makefile: CC=gcc RM=rm -fr CFLAGS += `pkg-config --cflags dbus-glib-1 dbus-1 glib-2.0` LIBS += `pkg-config --libs dbus-glib-1 dbus-1 glib-2.0` APP=mybus SRC=$(APP).c OBJ=$(APP).o all: clean build build: $(CC) -c $(SRC) $(CFLAGS) $(CC) -o $(APP) $(OBJ) $(LIBS) $(RM) $(OBJ) clean: $(RM) $(APP) $(OBJ) 其中APP=mydbus可以修改为自己的.c文件名 对于DBus学习推荐下面的博客: http://blog.csdn.net/flowingflying/article/details/5410820 水平有限