glib

Read/write file pipes in vala/glib

霸气de小男生 提交于 2019-12-12 01:13:24
问题 I am using the glib vala function glib.process.spawn_async_with_pipes()(http://references.valadoc.org/#!api=glib-2.0/GLib.Process.spawn_async_with_pipes), which outputs some ints corresponding to stdin, stdout, and stderr. How would I use these pipes in Vala? 回答1: Modified example which also writes stuff to stdin: private static bool process_line (IOChannel channel, IOCondition condition, string stream_name) { if (condition == IOCondition.HUP) { stdout.printf ("%s: The fd has been closed.\n",

What is the gdbus library name? Technique to find it?

二次信任 提交于 2019-12-11 13:35:57
问题 What library do I need to include to use Bluez gdbus.h functions? I am getting alot of undefined reference errors for gdbus.h functions so I obviously I am missing a library. *Is there a way (in terminal or otherwise) I can find out what library a header file uses? For example; I can find where a header file resides using locate gdbus.h . Is there a way I can find out what library gdbus.h requires? My current pkg-config is: pkg-config --cflags gio-2.0 dbus-glib-1 dbus-1 glib-2.0 gthread-2.0

Glib — undefined reference to anything from glib? [duplicate]

柔情痞子 提交于 2019-12-11 08:53:07
问题 This question already has answers here : Undefined reference to 'pthread_create' — linker command option order (libraries before/after object files?) [duplicate] (2 answers) Closed 5 years ago . I have a problem with my S program. I need to compile it with this command: gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 \ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wextra -g -std=c99 -lm *.c \ -o generator1_1 I have many error messages like this: /home

How can I monitor the ~/.local directory using Vala?

允我心安 提交于 2019-12-11 06:28:25
问题 I am trying to monitor the ~/.local directory according to the Vala documentation I can monitor the home correctly. but I can't monitor the the ~/.local. initFileMonitor V1: public void initFileMonitor(){ try { string homePath = Environment.get_home_dir(); string filePath = homePath + "/.local"; File file = File.new_for_path(filePath); FileMonitor monitor = file.monitor_directory(FileMonitorFlags.NONE, null); print ("\nMonitoring: %s\n", file.get_path ()); monitor.changed.connect ((src, dest,

How to convert binary to hexadecimal string in C/glib?

喜你入骨 提交于 2019-12-11 06:13:12
问题 Is there a common way or good public domain code for converting binary (i.e. byte array or memory block) to hexadecimal string? I have a several applications that handle encryption keys and checksums and I need to use this function a lot. I written my own "quick and dirty" solution for this but it only works with binary objects of fixed size and I'm looking for something more universal. It seems pretty mundane task and I'm sure there should be some code or libraries for this. Could someone

Glib memory allocation error

本秂侑毒 提交于 2019-12-11 04:34:46
问题 I am using a library libfprint on ubuntu nd I am trying to call a function through my java code. API_EXPORTED struct fp_img *fpi_img_new(size_t length) { struct fp_img *img = g_malloc(sizeof(*img) + length); memset(img, 0, sizeof(*img)); fp_dbg("length=%zd", length); img->length = length; return img; } I am passing integer value 5 from my java code to this function. When I try to execute above function I got following errors: GLib-ERROR **: /build/buildd/glib2.0-2.30.0/./glib/gmem.c:170:

GLib GMainContext in a thread?

一笑奈何 提交于 2019-12-11 04:27:21
问题 I have searched on stack overflow to find answer relevant to my problem. But i didn't find any answer. I have a main thread (my main() function) which starts a thread. The new thread runs GMainLoop. In my main function, i keep adding sources by calling g_io_watch over some file descriptors. But i have getting garbage data if events are dispatched. Below is a small part of the code that i am trying: GMainLoop *loop; gpointer event_loop_thread(gpointer arg) { g_main_loop_run(loop); g_main_loop

Create a dynamic rescheduling GSource in JavaScript

会有一股神秘感。 提交于 2019-12-11 04:24:37
问题 GLib's main loop supports scheduling callback functions for periodic intervals, using g_timemout_source_new and related functions. The callback will repeatedly be called after the scheduled interval, until it returns false . I now want to modify this process with a dynamic interval. Instead of just true or false , the callback should be able to return a time value that should pass until its next invocation. Doing this in C is quite straightforward: A new GSource Type can be created, that only

Can not use gtk3 FileChooser on Mac OSX?

*爱你&永不变心* 提交于 2019-12-11 02:54:45
问题 I migrated my program built with gtk+3.0 from linux to Mac OS X(10.6.8). And I compiled the program without errors. However, after I started the program and I chose to open a file, the terminal shows following message. GLib-GIO-CRITICAL **: Settings schema 'org.gtk.Settings.FileChooser' is not installed Then, the program ends with Segmentation fault . How to solve it? Thanks for any helps. 回答1: Seems you're not the one having this problem, and it also happens on Windows on MinGW. Luckily,

Ghashtable storing double

不打扰是莪最后的温柔 提交于 2019-12-11 00:19:48
问题 Hello I was wondering if it was possible to store a double into a ghashtable considering there is no gdouble_to_pointer methdod. I am following a tutorial I found online by IBM http://www.ibm.com/developerworks/linux/tutorials/l-glib/section5.html , but I can't seem to find a way to use an int as a key and a double as the value being stored. Any help would be great thanks! 回答1: If you want to use an int as a key, you should use g_int_hash() and g_int_equal() when you create the GHashTable. As