glib

glib network connection example

做~自己de王妃 提交于 2019-12-10 08:57:21
问题 Can you advice some network connection example made with glib/gio libraries. There is quite a good reference manual, but no full example even for basic things. It will be used for simple sending and receiving files as a part of program. 回答1: How about like this? There is similar question at Fetch a file from web: in GTK using C #include <gio/gio.h> int main() { const gchar *uri = "https://stackoverflow.com/questions/5758770/"; GFile *in; GFile *out; GError *error = NULL; gboolean ret; g_type

Within Python, what is exactly a sequence of strings? (or else Glib bug?)

◇◆丶佛笑我妖孽 提交于 2019-12-10 06:37:20
问题 I know the question may looks stupid, but I am really not able to figure it out. I naively though a sequence of strings is a list of strings. However, this fails: (pid, stdin, stdout, stderr) = glib.spawn_async( argv=["foo", "bar"], envp=None, flags=glib.SPAWN_SEARCH_PATH + glib.SPAWN_CHILD_INHERITS_STDIN, standard_input=True, standard_output=True, standard_error=True) Fails with this error: TypeError: glib.spawn_async: first argument must be a sequence of strings I tried with a tuple, which

Is glib usable in an unobtrusive way?

瘦欲@ 提交于 2019-12-10 03:12:34
问题 I was looking for a good general-purpose library for C on top of the standard C library, and have seen several suggestions to use glib. How 'obtrusive' is it in your code? To explain what I mean by obtrusiveness, the first thing I noticed in the reference manual is the basic types section, thinking to myself, "what, am I going to start using gint , gchar , and gprefixing geverything gin gmy gcode gnow?" More generally, can you use it only locally without other functions or files in your code

How to use glib on iphone? [closed]

不问归期 提交于 2019-12-09 21:19:55
问题 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 2 years ago . I'm working on a project these days. A third party library was included in my project, and the library is based on glib. That really make me crazy. Can you everybody tell me what should I do? How to use glib on an iphone application? Dose apple allow us use glib for iphone

Possible to run multiple main loops?

我的梦境 提交于 2019-12-09 16:48:22
问题 I'm working with both libfuse and the glib event interface and I've run into an issue where I need to run multiple main loops concurrently (glib's g_main_loop_run and fuse_loop_mt ). I've already attempted to created a detached thread for glib's event loop under a secondary context, e.g.: static void * event_loop(void *arg) { GMainLoop *event_loop; GMainContext *context; context = g_main_context_new(); g_main_context_push_thread_default(context); event_loop = g_main_loop_new(context, FALSE);

Is it possible to define GTK+ type using gtkmm?

谁都会走 提交于 2019-12-08 20:45:35
I would like to define a new subclass of some gtkmm type, implementing interface of underlying GTK+ object. Then, i want to compile it into some kind of dll and use in pure C code (GTK+, no gtkmm) through this interface. Is it possible? The followings are required to use gtkmm widget in GTK+ : implement the desired custom widget in gtkmm create a library from the widget for Glade design the user interface containing the custom widget with Glade declare the C interface for the application written in GTK+ build the user interface from XML with GtkBuilder Details can be found in my blog post . 来源

How can I fix this error? Gtk-WARNING **: GModule … initialization check failed: GLib version too old (micro mismatch)

只谈情不闲聊 提交于 2019-12-08 17:28:42
问题 I'm writing a python program with matplotlib, and I'm getting this error: GLib-GIO-Message: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications. (python:6304): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so) initialization check failed: GLib >version too old (micro mismatch) (python:6304): Gtk-WARNING **: Loading IM context type 'ibus' failed (python:6304): Gtk-WARNING **: GModule (/usr/lib/x86_64

How do I register a profile with bluez using dbus/gio?

为君一笑 提交于 2019-12-08 11:25:57
问题 I'm trying to register a profile with bluez through D-Bus/Gio. When I call RegisterProfile everything goes OK. I check my GError and it's NULL and my return value is an empty GVariant. I've tried many things, but here is my latest code. When I run it, it prints "g_dbus_connection_call_sync succeeded", but I can't see my new profile in D-Bus using d-feet and I cannot connect to it using a my test device. I know the code on the test device works, or at least did work with straight bluez, but I

Pynotify runs fine interactively, but crashes when run programmatically (on Fedora 13)

梦想与她 提交于 2019-12-08 11:15:07
问题 I am attempting to use pynotify for a small project, but am having a strange problem on my Fedora 13 machine. It appears that when pynotify is run programmatically it crashes when show() is called - however if I type that line myself it runs fine! I have tested it also on my Ubuntu box, where it runs absolutely fine. My testing code is: import pynotify pynotify.init('someName') n = pynotify.Notification("Summary", "Body") n.show() And the results of running this: $ python -i test.py Traceback

can't get dbus signal listener to work in C with gnome multimedia keys

点点圈 提交于 2019-12-08 05:58:06
问题 I'm trying to make my own application that will listen to the media-keys in gnome using dbus. I have found a script that works in python and I'm trying to make it work by converting it to C. My c-code builds and runs correctly but it doesn't respond to the dbus signal. this python code works: #!/usr/bin/env python """Printing out gnome multi media keys via dbus-python. """ import gobject import dbus import dbus.service import dbus.mainloop.glib def on_mediakey(comes_from, what): """ gets