Пример #1
0
static void
_changed_cb (GFileMonitor       *monitor,
             GFile              *file,
             GFile              *other_file,
             GFileMonitorEvent   event_type,
             IBusBus            *bus)
{
    // g_debug ("changed %x", event_type);
    if (ibus_bus_is_connected (bus))
        return;
    if (event_type == G_FILE_MONITOR_EVENT_CHANGED) {
        ibus_bus_connect (bus);
    }
}
Пример #2
0
static void
_changed_cb (GFileMonitor       *monitor,
             GFile              *file,
             GFile              *other_file,
             GFileMonitorEvent   event_type,
             IBusBus            *bus)
{
    if (event_type != G_FILE_MONITOR_EVENT_CHANGED &&
        event_type != G_FILE_MONITOR_EVENT_CREATED &&
        event_type != G_FILE_MONITOR_EVENT_DELETED)
        return;

    if (ibus_bus_is_connected (bus))
        return;
    
    ibus_bus_connect (bus);
}
Пример #3
0
static void
ibus_bus_init (IBusBus *bus)
{
    struct stat buf;
    gchar *path;
    GFile *file;

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    priv->config = NULL;
    priv->connection = NULL;
    priv->watch_dbus_signal = FALSE;

    path = g_path_get_dirname (ibus_get_socket_path ());

    if (stat (path, &buf) == 0) {
        if (buf.st_uid != ibus_get_daemon_uid ()) {
            g_warning ("The owner of %s is not %s!", path, ibus_get_user_name ());
            return;
        }
    }
#if 0
    else {
        if (getuid () == ibus_get_daemon_uid ()) {
            mkdir (path, 0700);
            chmod (path, 0700);
        }
    }
#endif

    ibus_bus_connect (bus);


    file = g_file_new_for_path (ibus_get_socket_path ());
    priv->monitor = g_file_monitor_file (file, 0, NULL, NULL);

    g_signal_connect (priv->monitor, "changed", (GCallback) _changed_cb, bus);

    g_object_unref (file);
    g_free (path);
}