[Xfce4-commits] r17207 - libxfcegui4/trunk/libxfcegui4

Brian J. Tarricone bjt23 at cornell.edu
Wed Aug 31 22:15:02 CEST 2005

Hash: SHA1

On 8/31/2005 1:37 AM, Benedikt Meurer wrote:
> Brian J. Tarricone wrote:
>>>>This looks pretty strange: add() and remove() will act on the internal
>>>>HBox, while all other GtkContainer methods will work on the frame
>>>>itself. Either XfceFramebox should be deprecated completely or we need
>>>>to override all of GtkContainer methods and forward the calls to the
>>>>internal HBox.
>>I wouldn't mind deprecating it in favor of a non-class helper/utility
>>function to create the framebox as we have it now.
>>Otherwise we can just leave it as-is.  The common use case is just to
>>add() something to it and be done with it.  I got rid of the remove()
>>implementation because it was causing weird problems that I don't have
>>the patience to try to debug.
> The implementation as it stands now is just broken. It claims to be a
> GtkContainer, but it isn't. I'd vote to revert that change to the 4.2
> implementation, which wasn't good, but atleast consistent. There's no
> need for XFC to wrap that widget at all, as Gtk::Frame and
> Gtk::Alignment will do just fine there, and thereby saving a few
> unneccesary PLT entries for XFC. ;-)

That's fine with me; I don't feel especially strongly about it.

As for your suggestion of a replacement in another thread:

> In this case, a simple xfce_create_framebox(const gchar *title,
> GtkWidget **box) would be the way to go.

I'm ok with that.  I assume you mean that it returns the actual GtkFrame
widget, and you pass a pointer to a GtkWidget* as box, which gets filled
in with the frame's 'new' container widget?  So something like this:

GtkWidget *
xfce_create_framebox(const gchar *title,
                     GtkWidget **frame_bin)
    GtkWidget *framebox;

    g_return_val_if_fail(frame_bin, NULL);

    framebox = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(framebox), GTK_SHADOW_NONE);
    gtk_frame_set_label_align(GTK_FRAME(framebox), 0.0, 1.0);

    if(title) {
        gchar *tmp = g_strdup_printf("<b>%s</b>", title);
        GtkWidget *label = gtk_label_new(tmp);
        gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
        gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
        gtk_frame_set_label_widget(GTK_FRAME(framebox), label);

    *frame_bin = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
    gtk_alignment_set_padding(GTK_ALIGNMENT(*frame_bin), 5, 5, 21, 5);
    gtk_container_add(GTK_CONTAINER(framebox), *frame_bin);

    return framebox;

Then the caller should add the return value to the parent widget, and
add children to frame_bin.


Version: GnuPG v1.4.1 (MingW32)


More information about the Xfce4-dev mailing list