Exemplo n.º 1
0
static GObject*  
cryptui_keyset_constructor (GType type, guint n_props, GObjectConstructParam* props)
{
    DBusGConnection *bus;
    CryptUIKeyset *keyset;
    GError *error = NULL;
    GObject *obj;
    gchar *path;
    
    obj = G_OBJECT_CLASS (cryptui_keyset_parent_class)->constructor (type, n_props, props);
    keyset = CRYPTUI_KEYSET (obj);

    if (!keyset->priv->keytype) {
        g_warning ("no keytype was set on the keyset");
        goto finally;
    }
    
    bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
    if (!bus) {
        g_critical ("couldn't get the session bus: %s", error->message);
        g_clear_error (&error);
        goto finally;
    }
    
    path = g_strdup_printf("/org/gnome/seahorse/keys/%s", keyset->priv->keytype);

    keyset->priv->remote_keyset = dbus_g_proxy_new_for_name (bus,
                    "org.gnome.seahorse", path, "org.gnome.seahorse.Keys");
    keyset->priv->remote_service = dbus_g_proxy_new_for_name (bus,
                    "org.gnome.seahorse", "/org/gnome/seahorse/keys", "org.gnome.seahorse.KeyService");
    
    g_free (path);
            
    if (!keyset->priv->remote_keyset || !keyset->priv->remote_service) {
        g_critical ("couldn't connect to the dbus service");
        goto finally;
    }
    
    cryptui_keyset_refresh (keyset);

    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyAdded", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyRemoved", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyChanged", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyAdded", 
                                 G_CALLBACK (key_added), keyset, NULL);
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyRemoved", 
                                 G_CALLBACK (key_removed), keyset, NULL);
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyChanged", 
                                 G_CALLBACK (key_changed), keyset, NULL);

finally:    
    return obj;
}
Exemplo n.º 2
0
/* Refilter the tree */
static gboolean
refilter_now (CryptUIKeyStore* ckstore)
{
    cryptui_keyset_refresh (ckstore->ckset);

    gtk_tree_model_filter_refilter (ckstore->priv->filter);
    ckstore->priv->filter_stag = 0;

    g_object_unref (ckstore);
    return FALSE;
}
Exemplo n.º 3
0
static void
cryptui_keyset_set_property (GObject *object, guint prop_id, const GValue *value, 
                              GParamSpec *pspec)
{
    CryptUIKeyset *keyset = CRYPTUI_KEYSET (object);

    switch (prop_id) {
    case PROP_KEYTYPE:
        g_assert (keyset->priv->keytype == NULL);
        keyset->priv->keytype = g_strdup (g_value_get_string (value));
        break;
    case PROP_EXPAND_KEYS:
        keyset->priv->expand_keys = g_value_get_boolean (value);
        cryptui_keyset_refresh (keyset);
    };
}