glib

How to convert a 4-byte “string” to an uint32_t?

陌路散爱 提交于 2019-12-08 05:44:11
问题 Basically, I have a byte-string of data like: \x00\x00\x00\x00 \x08\x00\x00\x00 \x05\x00\x00\x00 (spaces are used only for visibility, there are no space bytes in the actual byte-string). The data is little-endian. Now, I need to extract the second 4-byte group ( \x08\x00\x00\x00 , which is 128 ) and turn them it an unsigned long. So, uint32_t type. Basically, what I'm doing is: moveBlock(&gdata->str[4], &second_group, 4); Where moveBlock is a macro: #define moveBlock(src,dest,size) memmove

How to reply a D-Bus message

*爱你&永不变心* 提交于 2019-12-08 02:05:54
问题 I got the D-Bus server.c and client.c code, and made some modification. I want the result that when type for example "hi" from client.c server will print "receive message hi", and reply "reply_content!!!!!!" to client.c But it seems that now client.c cannot get the reply message. Anyone have the idea? Thanks in advance. "server.c" /* server.c */ #include <dbus/dbus.h> #include <stdbool.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> static DBusHandlerResult filter_func

GStreamer C++ on Visual Studio 2010?

妖精的绣舞 提交于 2019-12-08 01:59:53
问题 Following instructions on http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows to install GStreamer and compile tutorials/examples on Windows 7, for compilation using Visual Studio 2010. After installing the SDKs, I try to compile the "hello world" example... Cannot open include file: 'gst/gst.h': No such file or directory. Odd - the tutorials were supposedly configured with the paths to these files. Nevertheless, we can manually add them... Add C:\gstreamer-sdk\0.10\x86\include

Difference between gst_bus_add_watch() and g_signal_connect()

放肆的年华 提交于 2019-12-08 00:00:03
问题 I'm reading the GStreamer application developer manual, which talks about the pipeline bus in the context of message handling / event handling, they talk about 2 functions: gst_bus_add_watch() and g_signal_connect(). It appears that these 2 functions are interchangeable. The application manual says: Note that if you’re using the default GLib mainloop integration, you can, instead of attaching a watch, connect to the “message” signal on the bus. In page 27. What's the difference between these

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

北慕城南 提交于 2019-12-07 23:01:44
问题 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

How can I work with a GLib.Array in Python?

ε祈祈猫儿з 提交于 2019-12-07 08:07:35
问题 I am writing a plugin for Rhythmbox, wherein a signal raised is passing in an object of type GArray . The documentation for GLib Arrays shows me a few methods I am interested in, but am unable to access. For example, g_array_index can get me the nth item in a GArray, but I am unable to call it. The GArray object doesn't show me any useful methods either. To see what I mean, do this in a Python console: from gi.repository.GLib import Array x = Array() dir(x) Here is the output of dir(x) ['_

Gnome shell extensions: how to run a command with pipes

回眸只為那壹抹淺笑 提交于 2019-12-07 05:15:26
问题 So I'm making a Gnome Shell extension. And I want to be able to run some command with a pipe. (The command is actually "xrandr --query | awk 'something'" , but that is off topic) So, what I have done so far is GLib.spawn_async_with_pipes(null, ['/usr/bin/xrandr', '--query', '|', 'awk...'], null, GLib.SpawnFlags.DO_NOT_REAP_CHILD, null); But it doesn't work! I can't find any example of running a command in a gnome extensions with a pipe. Do I have to write "|" in the command like I did ? 回答1:

detect/remove unpaired surrogate character in Python 2 + GTK

牧云@^-^@ 提交于 2019-12-07 00:28:26
问题 In Python 2.7 I can successfully convert the Unicode string "abc\udc34xyz" to UTF-8 (result is "abc\xed\xb0\xb4xyz" ). But when I pass the UTF-8 string to eg. pango_parse_markup() or g_convert_with_fallback() , I get errors like "Invalid byte sequence in conversion input". Apparently the GTK/Pango functions detect the "unpaired surrogate" in the string and (correctly?) reject it. Python 3 doesn't even allow conversion of the Unicode string to UTF-8 (error: "'utf-8' codec can't encode

meld - gi._glib.GError: Icon 'meld-change-apply-right' not present in theme. What is wrong with the installation?

十年热恋 提交于 2019-12-06 20:58:03
问题 I have managed to install the meld 3.14.2 and all the dependency packages, by compiling each package from source and all are installed on a NFS share with --prefix=<base>/meld for the meld tool && --prefix=<base>/meld/deps for the dependencies. Finally, I invoked the tool and I can see the GUI. But when I try to do some functionality testing, it throws me errors. I have never used the tool. So, I don't know how it is supposed to work exactly. But users have pointed out the following error,

Why is it better to use Glib data types (e.g. `gint` instead of `int`)? [duplicate]

风格不统一 提交于 2019-12-06 17:21:43
问题 This question already has an answer here : Closed 6 years ago . Possible Duplicate: Why does glib redefine types? In the GTK+ 2.0 tutorial, I can read here the following statement about data types: There are a few things you probably noticed in the previous examples that need explaining. The gint, gchar, etc. that you see are typedefs to int and char, respectively, that are part of the GLib system. This is done to get around that nasty dependency on the size of simple data types when doing