gtklean

cleaner, safer C API for GTK+ generated directly from GTK+ headers


What is gtklean? | Features | Supported Versions | Documentation | Download | Mailing Lists

What is gtklean?

gtklean is a C header file that is generated directly from the GTK+ header files. The standard GTK+ C API contains much visual clutter and is too error prone. gtklean.h provides a cleaner, safer C API for GTK+.

gtklean is freely available under the GNU General Public License.

Features

In short, gtklean lets you write code like this:

    #include "gtklean.h"
    
    void destroy_handler(GtkWidget *widget, gpointer data)
    {
        gtk_main_quit();
    }
    
    int delete_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
    {
        return 0;
    }
    
    int main(int ac, char **av)
    {
        GtkWidget *top_widget, *box, *label, *separator_item;
        GtkWidget *menu_bar, *file_item, *file_menu, *exit_item;
    
        gtk_init(&ac, &av);
    
        top_widget = window_new(GTK_WINDOW_TOPLEVEL);
        box = vbox_new(0, 0);
        menu_bar = menu_bar_new();
        file_item = menu_item_new_with_label("File");
        file_menu = menu_new();
        separator_item = menu_item_new();
        exit_item = menu_item_new_with_label("Exit");
        label = label_new("GTK+ is fun");
        widget_set_usize(label, 400, 350);
    
        window_set_title(top_widget, "new_gtkfun");
        container_set_border_width(top_widget, 0);
        widget_set_name(top_widget, "new_gtkfun");
    
        signal_connect(exit_item, activate, destroy_handler, NULL);
        signal_connect(top_widget, delete_event, delete_handler, NULL);
        signal_connect(top_widget, destroy, destroy_handler, NULL);
    
        container_add(top_widget, box);
        box_pack_start_defaults(box, menu_bar);
        box_pack_start_defaults(box, label);
    
        menu_bar_append(menu_bar, file_item);
        menu_item_set_submenu(file_item, file_menu);
        menu_append(file_menu, separator_item);
        menu_append(file_menu, exit_item);
    
        widget_show_all(top_widget);
    
        gtk_main();
    
        return 0;
    }

Instead of code like this:

    #include <gtk/gtk.h>
    
    void destroy_handler(GtkWidget *widget, gpointer data)
    {
        gtk_main_quit();
    }
    
    int delete_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
    {
        return 0;
    }
    
    int main(int ac, char **av)
    {
        GtkWidget *top_widget, *box, *label, *separator_item;
        GtkWidget *menu_bar, *file_item, *file_menu, *exit_item;
    
        gtk_init(&ac, &av);
    
        top_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        box = gtk_vbox_new(0, 0);
        menu_bar = gtk_menu_bar_new();
        file_item = gtk_menu_item_new_with_label("File");
        file_menu = gtk_menu_new();
        separator_item = gtk_menu_item_new();
        exit_item = gtk_menu_item_new_with_label("Exit");
        label = gtk_label_new("GTK+ is fun");
        gtk_widget_set_usize(GTK_WIDGET(label), 400, 350);
    
        gtk_window_set_title(GTK_WINDOW(top_widget), "new_gtkfun");
        gtk_container_set_border_width(GTK_CONTAINER(top_widget), 0);
        gtk_widget_set_name(GTK_WIDGET(top_widget), "new_gtkfun");
    
        gtk_signal_connect(GTK_OBJECT(exit_item), "activate", GTK_SIGNAL_FUNC(destroy_handler), NULL);
        gtk_signal_connect(GTK_OBJECT(top_widget), "delete_event", GTK_SIGNAL_FUNC(delete_handler), NULL);
        gtk_signal_connect(GTK_OBJECT(top_widget), "destroy", GTK_SIGNAL_FUNC(destroy_handler), NULL);
    
        gtk_container_add(GTK_CONTAINER(top_widget), GTK_WIDGET(box));
        gtk_box_pack_start_defaults(GTK_BOX(box), GTK_WIDGET(menu_bar));
        gtk_box_pack_start_defaults(GTK_BOX(box), GTK_WIDGET(label));
    
        gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), GTK_WIDGET(file_item));
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), GTK_WIDGET(file_menu));
        gtk_menu_append(GTK_MENU(file_menu), GTK_WIDGET(separator_item));
        gtk_menu_append(GTK_MENU(file_menu), GTK_WIDGET(exit_item));
    
        gtk_widget_show_all(GTK_WIDGET(top_widget));
    
        gtk_main();
    
        return 0;
    }

For more information read the Documentation section.

Supported Versions

Currently, gtklean is only known to work with GTK+ 1.2.8 and 1.2.10 but it probably works with 2.x as well (although there will probably be missing signal names).

Documentation

There is a README file and the manpage for make_gtklean.

README - Description, Install, Requirements, Copying, History, Bugs, TODO
make_gtklean(1) - generate gtklean.h directly from installed GTK+ header files

Download

Latest: gtklean-20010623.tar.gz (MD5 0d65740bacab72596d788aed4c58612e)
gtklean-20000621.tar.gz (MD5 672b415e2d1734b0c68f0ea44552ebc3)

Mailing Lists

If you'd like to be kept up to date with gtklean releases or have questions or suggestions, you can join one or more of the following mailing lists.

  gtklean-announce@raf.org (Announcements)
gtklean-users@raf.org (User forum)
gtklean-dev@raf.org (Development forum)

To subscribe to any of these mailing lists, send a mail message to listname-request@raf.org with subscribe as the message body.

E.g.

    $ echo subscribe | mail gtklean-announce-request@raf.org
    $ echo subscribe | mail gtklean-users-request@raf.org
    $ echo subscribe | mail gtklean-dev-request@raf.org

Or you can send a mail message to majordomo@raf.org with subscribe listname in the message body. This way, you can include multiple subscribe commands to subscribe to multiple lists at the same time.

E.g.

    $ mail majordomo@raf.org
    subscribe gtklean-announce
    subscribe gtklean-users
    subscribe gtklean-dev
    .

A digest version of each mailing list is also available. Subscribe to digests as above but append -digest to the listname.

E.g.

    $ echo subscribe | mail gtklean-announce-digest-request@raf.org
    $ echo subscribe | mail gtklean-users-digest-request@raf.org
    $ echo subscribe | mail gtklean-dev-digest-request@raf.org

Or

    $ mail majordomo@raf.org
    subscribe gtklean-announce-digest
    subscribe gtklean-users-digest
    subscribe gtklean-dev-digest
    .

What is gtklean? | Features | Supported Versions | Documentation | Download | Mailing Lists

Last modified by raf at Sat Jun 23 14:04:59 EST 2001
v