OK, you are right in some points, I started to read all the warnings and try
to correct
them, some tough work.
I really cant find any other place then this to ask questions about GTK,
most Forums only have QT people and GTK questions often are unanswered.

One thing beside this that bothers me is that i now kicked the idea of
having buttons in the table, now I use a list and have only one pair of
buttons for all of them.
I got the Images changing whit a timeout in the old version, but in my
Treeview
i have to use pixbuf and I havent been able to change the pixbuf with my
timeout,
I wouldnt ask, but im reading and trying for 5 hours now...


/*  just to have it near
       enum {
        INIT_COLUMN,
        MOUNT_COLUMN,
        DEVICE_COLUMN,
        NAME_COLUMN,
        MOUNTPOINT_COLUMN,
        PASSKEY_COLUMN,
        N_COLUMNS
         };
   */



        GtkListStore *store;
        GtkTreeView *tree;
        GtkTreeIter   iter, toplevel;
        GdkPixbuf    *pixbuf_mapper, *pixbuf_mount;


        store = gtk_list_store_new(6, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

        pixbuf_mapper = gdk_pixbuf_new_from_file("pics/no.png", NULL);

        if(crypto_mount_check(pixbuf_mount))
        pixbuf_mount = gdk_pixbuf_new_from_file("pics/mount.png", NULL);
        else
        pixbuf_mount = gdk_pixbuf_new_from_file("pics/unmount.png", NULL);

      //here the update callback gets a timeout
        g_timeout_add(100, crypto_mount_set_pixbuf, pixbuf_mount);

       gtk_list_store_append(store, &iter);
       gtk_list_store_set(store, &iter,
                            INIT_COLUMN, pixbuf_mapper,
                            MOUNT_COLUMN, pixbuf_mount,
                            DEVICE_COLUMN, "sda1",
                            NAME_COLUMN, "Daten",
                            MOUNTPOINT_COLUMN, "DATEN",
                            PASSKEY_COLUMN, "key",
                            -1);



        g_object_unref(pixbuf_mapper);
        g_object_unref(pixbuf_mount);

        tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
        g_object_unref (G_OBJECT (store));

        GtkCellRenderer *renderer, *pixrender;
        GtkTreeViewColumn *column_init, *column_mount, *column_device,
*column_name, *column_mountpoint, *column_passkey;

        renderer = gtk_cell_renderer_text_new();
        pixrender = gtk_cell_renderer_pixbuf_new();

         g_object_set(renderer, "editable", TRUE, NULL);

        column_init = gtk_tree_view_column_new_with_attributes ("Init",
pixrender, "pixbuf", INIT_COLUMN, NULL);
        column_mount= gtk_tree_view_column_new_with_attributes ("Mount",
pixrender, "pixbuf", MOUNT_COLUMN, NULL);
        column_device= gtk_tree_view_column_new_with_attributes ("Device",
renderer, "text", DEVICE_COLUMN, NULL);
        column_name= gtk_tree_view_column_new_with_attributes ("Mappername",
renderer, "text", NAME_COLUMN, NULL);
        column_mountpoint= gtk_tree_view_column_new_with_attributes
("Mountpoint", renderer, "text", MOUNTPOINT_COLUMN, NULL);
        column_passkey= gtk_tree_view_column_new_with_attributes ("Password
Keyfile", renderer, "text", PASSKEY_COLUMN, NULL);

         gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_init);
         gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_mount);
         gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_device);
         gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_name);
         gtk_tree_view_append_column (GTK_TREE_VIEW (tree),
column_mountpoint);
         gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_passkey);

         gtk_tree_view_set_model(GTK_TREE_VIEW(tree), store);

----

crypto_mount_set_pixbuf(gpointer data){

    FILE *fp = popen("grep DATEN /etc/mtab", "r");
    gchar buf[512];
  GdkPixbuf *pixbuf;

        if (fp)
        {
        size_t got = fread(buf, 1, sizeof(buf), fp);

                if(got != 0)
                {
            g_print("mounted");
           // gtk_image_set_from_file(data, "pics/mount.png");
            pixbuf = gdk_pixbuf_new_from_file("pics/mount.png", NULL);
            g_object_set(data, "pixbuf", pixbuf, NULL);
            g_object_unref(pixbuf);

                }else{

            g_print("not mounted");
            //gtk_image_set_from_file(data, "pics/unmount.png");
            pixbuf = gdk_pixbuf_new_from_file("pics/unmount.png", NULL);
            g_object_set(data, "pixbuf", pixbuf, NULL);
            g_object_unref(pixbuf);
                }
        }
}

thank for your patience
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to