Пример #1
0
static void
book_shell_content_restore_state_cb (EShellWindow *shell_window,
                                     EShellView *shell_view,
                                     EShellContent *shell_content)
{
    EBookShellContentPrivate *priv;
    GConfBridge *bridge;
    GObject *object;
    const gchar *key;

    priv = E_BOOK_SHELL_CONTENT (shell_content)->priv;

    /* Bind GObject properties to GConf keys. */

    bridge = gconf_bridge_get ();

    object = G_OBJECT (priv->paned);
    key = "/apps/evolution/addressbook/display/hpane_position";
    gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");

    object = G_OBJECT (priv->paned);
    key = "/apps/evolution/addressbook/display/vpane_position";
    gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
}
Пример #2
0
int
main (int argc, char **argv)
{
        GConfBridge *bridge;
        GtkWidget *window, *vbox, *check, *entry, *label, *scale, *tree_view;
        GtkAdjustment *adjustment;
        GtkListStore *store;
        GtkCellRenderer *cell;
        
        gtk_init (&argc, &argv);

        bridge = gconf_bridge_get ();
        gconf_client_add_dir (gconf_bridge_get_client (bridge),
                              "/apps/gconf-bridge-test",
                              GCONF_CLIENT_PRELOAD_RECURSIVE,
                              NULL);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gconf_bridge_bind_window (bridge,
                                  "/apps/gconf-bridge-test/window",
                                  GTK_WINDOW (window), TRUE, TRUE);

        vbox = gtk_vbox_new (FALSE, 6);
        gtk_container_add (GTK_CONTAINER (window), vbox);

        check = gtk_check_button_new_with_label ("Check");
        gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);
        gconf_bridge_bind_property (bridge,
                                    "/apps/gconf-bridge-test/check",
                                    G_OBJECT (check), "active");

        entry = gtk_entry_new ();
        gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
        gconf_bridge_bind_property (bridge,
                                    "/apps/gconf-bridge-test/text",
                                    G_OBJECT (entry), "text");

        label = gtk_label_new ("Testing enums: Ellipsize mode");
        gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
        gconf_bridge_bind_property (bridge,
                                    "/apps/gconf-bridge-test/ellipsize",
                                    G_OBJECT (label), "ellipsize");

        scale = gtk_hscale_new_with_range (0.0, 10.0, 0.01);
        gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0);
        adjustment = gtk_range_get_adjustment (GTK_RANGE (scale));
        gconf_bridge_bind_property_delayed (bridge,
                                            "/apps/gconf-bridge-test/scale",
                                            G_OBJECT (adjustment), "value");

        store = gtk_list_store_new (1, G_TYPE_STRING);
        tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
        gconf_bridge_bind_string_list_store (bridge,
                                             "/apps/gconf-bridge-test/list",
                                             store);
        g_object_unref (store);

        cell = gtk_cell_renderer_text_new ();
        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
                                                     -1, "List",
                                                     cell, "text", 0, NULL);
        gtk_box_pack_start (GTK_BOX (vbox), tree_view, TRUE, TRUE, 0);

        gtk_widget_show_all (window);

        gtk_main ();

        return 0;
}