Sha256: 97ce1edb02c1d38b4046ade3e2335ab1ae40ea94731a72b243c9c8504f60dd8e

Contents?: true

Size: 1.52 KB

Versions: 15

Compression:

Stored size: 1.52 KB

Contents

/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgtklinkbutton.c -

  $Author: sakai $
  $Date: 2007/07/08 03:00:49 $

  Copyright (C) 2006 Masao Mutoh
************************************************/

#include "global.h"

#if GTK_CHECK_VERSION(2,10,0)

#define _SELF(self) (GTK_LINK_BUTTON(RVAL2GOBJ(self)))

static VALUE
lb_initialize(argc, argv, self)
    int argc;
    VALUE *argv;
    VALUE self;
{
    VALUE uri, label;
    GtkWidget *widget = NULL;

    rb_scan_args(argc, argv, "11", &uri, &label);
    if (NIL_P(label)){
        widget = gtk_link_button_new(RVAL2CSTR(uri));
    } else {
        widget = gtk_link_button_new_with_label(RVAL2CSTR(uri), RVAL2CSTR(label));
    }
    RBGTK_INITIALIZE(self, widget); 
    return Qnil;
}

static void
link_func(button, link, func)
    GtkLinkButton* button;
    const gchar* link;
    gpointer func;
{
    rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(button), CSTR2RVAL(link));
}

static VALUE
lb_set_uri_hook(self)
    VALUE self;
{
    VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    gtk_link_button_set_uri_hook((GtkLinkButtonUriFunc)link_func, (gpointer)func, (GDestroyNotify)NULL);
    return self;
}
#endif 

void 
Init_gtk_link_button()
{
#if GTK_CHECK_VERSION(2,10,0)
    VALUE button = G_DEF_CLASS(GTK_TYPE_LINK_BUTTON, "LinkButton", mGtk);

    rb_define_method(button, "initialize", lb_initialize, -1);
    rb_define_singleton_method(button, "set_uri_hook", lb_set_uri_hook, 0);

    G_DEF_SETTERS(button);
#endif
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gtk2-0.90.7-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.7 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.6 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.6-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.5 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.5-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.4 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.4-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.3 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.3-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.2 ext/gtk2/rbgtklinkbutton.c
gtk2-0.90.2-x86-mingw32 ext/gtk2/rbgtklinkbutton.c
gtk2-0.20.1 src/rbgtklinkbutton.c
gtk2-0.20.0.1 src/rbgtklinkbutton.c
gtk2-0.20.0 src/rbgtklinkbutton.c