예제 #1
0
static VALUE
rbclt_flow_layout_get_column_width (VALUE self)
{
  ClutterFlowLayout *flow_layout = CLUTTER_FLOW_LAYOUT (RVAL2GOBJ (self));
  gfloat min_width, max_width;
  VALUE answer = rb_hash_new();

  clutter_flow_layout_get_column_width (flow_layout, &min_width, &max_width);
  rb_hash_aset (answer, rb_intern("min"), rb_float_new (min_width));
  rb_hash_aset (answer, rb_intern("max"), rb_float_new (max_width));
  return answer;
}
static VALUE
rbclt_behaviour_rotate_get_center (VALUE self)
{
  ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
  ClutterVertex vertex;
  int x, y, z;
  clutter_behaviour_rotate_get_center (brotate, &x, &y, &z);
  vertex.x = CLUTTER_UNITS_FROM_INT (x);
  vertex.y = CLUTTER_UNITS_FROM_INT (y);
  vertex.z = CLUTTER_UNITS_FROM_INT (z);
  return BOXED2RVAL (&vertex, CLUTTER_TYPE_VERTEX);
}
예제 #3
0
static VALUE
WebNetworkResponse_uri_equals(VALUE self, VALUE __v_uri)
{
  char * uri; char * __orig_uri;
  WebKitNetworkResponse *_self = ((WebKitNetworkResponse*)RVAL2GOBJ(self));
  __orig_uri = uri = ( NIL_P(__v_uri) ? NULL : StringValuePtr(__v_uri) );

#line 214 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
  webkit_network_response_set_uri(_self, uri);
 
  return __v_uri;
}
예제 #4
0
static VALUE
rg_write_contents(int argc, VALUE *argv, VALUE self)
{
    VALUE stream, flags, rb_cancellable;
    GCancellable *cancellable;
    gboolean result;
    GError *error = NULL;

    rb_scan_args(argc, argv, "21", &stream, &flags, &rb_cancellable);
    cancellable = NIL_P(rb_cancellable) ? NULL : RVAL2GOBJ(rb_cancellable);

    result = vte_terminal_write_contents(_SELF(self),
                                        RVAL2GOBJ(stream),
                                        RVAL2GENUM(flags, VTE_TYPE_TERMINAL_WRITE_FLAGS),
                                        cancellable,
                                        &error);
    if (error)
        RAISE_GERROR(error);

    return CBOOL2RVAL(result);
}
예제 #5
0
static VALUE
WebView_set_custom_encoding(VALUE self, VALUE __v_encoding)
{
  char * encoding; char * __orig_encoding;
  WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
  __orig_encoding = encoding = ( NIL_P(__v_encoding) ? NULL : StringValuePtr(__v_encoding) );

#line 135 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
  webkit_web_view_set_custom_encoding(_self, encoding);
 
  return self;
}
static VALUE
rbclt_behaviour_rotate_get_bounds (VALUE self)
{
  ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
  gdouble angle_start, angle_end;

  clutter_behaviour_rotate_get_bounds (brotate,
                                       &angle_start,
                                       &angle_end);

  return rb_ary_new3 (2, rb_float_new (angle_start), rb_float_new (angle_end));
}
예제 #7
0
static VALUE
rg_m_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
    VALUE owner, selection, time, send_event;
    int ret;

    if (argc == 4){
        rb_scan_args(argc, argv, "40", &owner, &selection, &time, &send_event);
        ret = gdk_selection_owner_set(GDK_WINDOW(RVAL2GOBJ(owner)), 
                                      RVAL2ATOM(selection), 
                                      NUM2UINT(time), RVAL2CBOOL(send_event));
    } else {
      VALUE display = Qnil;
      rb_scan_args(argc, argv, "50", &display, &owner, &selection, &time, &send_event);
      ret = gdk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
                                                GDK_WINDOW(RVAL2GOBJ(owner)), 
                                                RVAL2ATOM(selection), 
                                                NUM2UINT(time), RVAL2CBOOL(send_event));
    }
    return CBOOL2RVAL(ret);
}
예제 #8
0
static VALUE
rb_gst_x_overlay_set_xwindow_id_with_buswatch(VALUE self, VALUE bus,
                                              VALUE x_window_id)
{
    struct xid_callback_data* xid_cb_data;
    GObject *sink;

    xid_cb_data = g_slice_new(struct xid_callback_data);
    xid_cb_data->xid = NUM2ULL(x_window_id);
    xid_cb_data->bus = RVAL2GOBJ(bus);

    sink = RVAL2GOBJ(self);
    g_object_set_qdata_full(sink, xoverlay_xid_data_quark,
                            xid_cb_data, xid_callback_data_destroy_cb);

    gst_bus_enable_sync_message_emission(GST_BUS(xid_cb_data->bus));
    xid_cb_data->cb_id =
        g_signal_connect_object(xid_cb_data->bus, "sync-message",
                                G_CALLBACK(bus_sync_func_cb), sink, 0);
    return self;
}
예제 #9
0
static VALUE
rbclt_behaviour_opacity_get_bounds (VALUE self)
{
  ClutterBehaviourOpacity *behaviour
    = CLUTTER_BEHAVIOUR_OPACITY (RVAL2GOBJ (self));
  guint8 opacity_start, opacity_end;

  clutter_behaviour_opacity_get_bounds (behaviour,
                                        &opacity_start, &opacity_end);

  return rb_ary_new3 (2, INT2NUM (opacity_start), INT2NUM (opacity_end));
}
예제 #10
0
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE arg1;
    GtkAdjustment *adj = NULL;

    rb_scan_args(argc, argv, "01", &arg1);
    if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));

    RBGTK_INITIALIZE(self, gtk_hscrollbar_new(adj));
    return Qnil;
}
예제 #11
0
static VALUE
WebView_load_uri(VALUE self, VALUE __v_uri)
{
  char * uri; char * __orig_uri;
  WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
  __orig_uri = uri = ( NIL_P(__v_uri) ? NULL : StringValuePtr(__v_uri) );

#line 111 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
  webkit_web_view_load_uri(_self, uri);
 
  return Qnil;
}
예제 #12
0
static VALUE
rg_set_colormap(VALUE self, VALUE colormap)
{
    VALUE old_colormap;

    old_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
    G_CHILD_REMOVE(self, old_colormap);

    G_CHILD_ADD(self, colormap);
    gdk_drawable_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
    return self;
}
예제 #13
0
static VALUE
WebView_execute_script(VALUE self, VALUE __v_script)
{
  char * script; char * __orig_script;
  WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
  __orig_script = script = ( NIL_P(__v_script) ? NULL : StringValuePtr(__v_script) );

#line 102 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
  webkit_web_view_execute_script(_self, script);
 
  return Qnil;
}
예제 #14
0
static VALUE
rbclt_container_child_get (int argc, VALUE *argv, VALUE self)
{
  ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
  ClutterActor *actor;
  VALUE ary = rb_ary_new ();
  int i;

  if (argc < 2)
    rb_raise (rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);

  if (!CLUTTER_IS_ACTOR (actor = (ClutterActor *) RVAL2GOBJ (argv[0])))
    rb_raise (rb_eArgError, "actor required");

  for (i = 1; i < argc; i++)
    {
      GValue value;
      const char *prop = StringValuePtr (argv[i]);
      GObjectClass *klass
        = G_OBJECT_CLASS (g_type_class_ref (G_TYPE_FROM_INSTANCE (container)));
      GParamSpec *pspec
        = clutter_container_class_find_child_property (klass, prop);

      g_type_class_unref (klass);

      if (pspec == NULL)
        rb_raise (rb_eArgError, "child property not found \"%s\"", prop);

      memset (&value, 0, sizeof (VALUE));
      g_value_init (&value, pspec->value_type);
      clutter_container_child_get_property (container, actor, prop, &value);
      rb_ary_push (ary, GVAL2RVAL (&value));
      g_value_unset (&value);
    }

  if (RARRAY_LEN (ary) == 1)
    return RARRAY_PTR (ary)[0];
  else
    return ary;
}
예제 #15
0
static VALUE
rbclt_container_child_set (int argc, VALUE *argv, VALUE self)
{
  ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
  ClutterActor *actor;
  int i;

  if (argc < 2)
    rb_raise (rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
  else if ((argc & 1) == 0)
    rb_raise (rb_eArgError, "wrong number of arguments "
              "(prop-value pairs needed)");

  if (!CLUTTER_IS_ACTOR (actor = (ClutterActor *) RVAL2GOBJ (argv[0])))
    rb_raise (rb_eArgError, "actor required");

  for (i = 1; i < argc; i += 2)
    {
      GValue value;
      const char *prop = StringValuePtr (argv[i]);
      GObjectClass *klass
        = G_OBJECT_CLASS (g_type_class_ref (G_TYPE_FROM_INSTANCE (container)));
      GParamSpec *pspec
        = clutter_container_class_find_child_property (klass, prop);

      g_type_class_unref (klass);

      if (pspec == NULL)
        rb_raise (rb_eArgError, "child property not found \"%s\"", prop);

      memset (&value, 0, sizeof (VALUE));
      g_value_init (&value, pspec->value_type);
      rbgobj_rvalue_to_gvalue (argv[i + 1], &value);
      clutter_container_child_set_property (container, actor, prop, &value);
      g_value_unset (&value);
    }

  return self;
}
예제 #16
0
static VALUE
rg_s_get_info(G_GNUC_UNUSED VALUE self, VALUE window)
{
    GtkTooltips* tooltips;
    GtkWidget* current_widget;
    gboolean ret = gtk_tooltips_get_info_from_tip_window(GTK_WINDOW(RVAL2GOBJ(window)),
                                                         &tooltips, 
                                                         &current_widget);
    if (ret)
        return rb_assoc_new(GOBJ2RVAL(tooltips), GOBJ2RVAL(current_widget));
    else
        return Qnil;
}
예제 #17
0
static VALUE
rbclt_behaviour_rotate_set_bounds (VALUE self,
                                   VALUE angle_start,
                                   VALUE angle_end)
{
  ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));

  clutter_behaviour_rotate_set_bounds (brotate,
                                       NUM2DBL (angle_start),
                                       NUM2DBL (angle_end));

  return self;
}
예제 #18
0
static VALUE
fraction_range_set_min(VALUE self, VALUE min)
{
    GValue *value;
    GValue min_value = G_VALUE_INIT;

    value = RVAL2GOBJ(self);
    rbgobj_initialize_gvalue(&min_value, min);
    gst_value_set_fraction_range(value,
                                 &min_value,
                                 gst_value_get_fraction_range_max(value));
    return Qnil;
}
예제 #19
0
static VALUE
pixbuf_render_to_drawable(int argc, VALUE *argv, VALUE self)
{
    VALUE gc, src_x, src_y, dest_x, dest_y, width, height,
        dither, x_dither, y_dither;

#if GTK_CHECK_VERSION(2,2,0)
    rb_warn("Gdk::Pixbuf#render_to_drawable is obsolete. Use Gdk::Drawable#draw_pixbuf instead.");
#endif

    rb_scan_args(argc, argv, "73", &gc, &src_x, &src_y, &dest_x, &dest_y,
                 &width, &height, &dither, &x_dither, &y_dither);

    if (NIL_P(gc))
        rb_raise(rb_eArgError, "arguments 1 must be non nil");
    if (NIL_P(src_x))
        rb_raise(rb_eArgError, "arguments 2 must be non nil");
    if (NIL_P(src_y))
        rb_raise(rb_eArgError, "arguments 3 must be non nil");
    if (NIL_P(dest_x))
        rb_raise(rb_eArgError, "arguments 4 must be non nil");
    if (NIL_P(dest_y))
        rb_raise(rb_eArgError, "arguments 5 must be non nil");
    if (NIL_P(width))
        rb_raise(rb_eArgError, "arguments 6 must be non nil");
    if (NIL_P(height))
        rb_raise(rb_eArgError, "arguments 7 must be non nil");

    gdk_pixbuf_render_to_drawable(_SELF(self),
				  GDK_DRAWABLE(RVAL2GOBJ(self)),
				  GDK_GC(RVAL2GOBJ(gc)),
				  NUM2INT(src_x), NUM2INT(src_y),
                                  NUM2INT(dest_x), NUM2INT(dest_y),
                                  NUM2INT(width), NUM2INT(height),
                                  NIL_P(dither) ? GDK_RGB_DITHER_NONE : RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                                  NIL_P(x_dither) ? 0 : NUM2INT(x_dither), 
                                  NIL_P(y_dither) ? 0 : NUM2INT(y_dither));
    return self;
}
예제 #20
0
static VALUE
term_set_background_image(VALUE self, VALUE image_or_path)
{
    if (RVAL2CBOOL(rb_obj_is_kind_of(image_or_path, rb_cString))) {
        vte_terminal_set_background_image_file(RVAL2TERM(self),
                                               RVAL2CSTR(image_or_path));
    } else {
        vte_terminal_set_background_image(RVAL2TERM(self),
                                          RVAL2GOBJ(image_or_path));
    }

    return Qnil;
}
예제 #21
0
static VALUE
fraction_range_set_max(VALUE self, VALUE max)
{
    GValue *value;
    GValue max_value = {0};

    value = RVAL2GOBJ(self);
    rbgobj_initialize_gvalue(&max_value, max);
    gst_value_set_fraction_range(value,
                                 gst_value_get_fraction_range_min(value),
                                 &max_value);
    return Qnil;
}
예제 #22
0
static VALUE
WebFrame_add_js_api(VALUE self, VALUE __v_name)
{
  char * name; char * __orig_name;
  WebKitWebFrame *_self = ((WebKitWebFrame*)RVAL2GOBJ(self));
  __orig_name = name = ( NIL_P(__v_name) ? NULL : StringValuePtr(__v_name) );
  VALUE block = rb_block_proc();

#line 244 "/home/ngl/Progetti/gtk-webkit-ruby/ext/webkit/webkit.cr"
  javascript_add_ruby_fn(webkit_web_frame_get_global_context(_self), name, block);
 
  return Qnil;
}
예제 #23
0
static VALUE
rbclt_behaviour_rotate_center_equals (VALUE self, VALUE center)
{
  ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
  ClutterVertex *vertex
    = (ClutterVertex *) RVAL2BOXED (center, CLUTTER_TYPE_VERTEX);

  clutter_behaviour_rotate_set_center (brotate,
                                       CLUTTER_UNITS_TO_INT (vertex->x),
                                       CLUTTER_UNITS_TO_INT (vertex->y),
                                       CLUTTER_UNITS_TO_INT (vertex->z));
  return center;
}
예제 #24
0
static VALUE
settings_s_install_property(VALUE self, VALUE spec)
{
    GParamSpec* pspec = G_PARAM_SPEC(RVAL2GOBJ(spec));
    if (rb_block_given_p()){
        VALUE func = rb_block_proc();
        rb_hash_aset(prop_func_table, spec, func);
        gtk_settings_install_property_parser(pspec, (GtkRcPropertyParser)rc_property_parser);
    } else {
        gtk_settings_install_property(pspec);
    }
    return self;
}
예제 #25
0
static VALUE
WebFrame_exec_js(VALUE self, VALUE __v_js)
{
  VALUE __p_retval = Qnil;
  char * js; char * __orig_js;
  WebKitWebFrame *_self = ((WebKitWebFrame*)RVAL2GOBJ(self));
  __orig_js = js = ( NIL_P(__v_js) ? NULL : StringValuePtr(__v_js) );

#line 238 "/home/ngl/Progetti/gtk-webkit-ruby/ext/webkit/webkit.cr"
  do { __p_retval = javascript_exec(webkit_web_frame_get_global_context(_self), js); goto out; } while(0);
out:
  return __p_retval;
}
예제 #26
0
static VALUE
rbclt_flow_layout_get_row_height (VALUE self)
{
  ClutterFlowLayout *flow_layout = CLUTTER_FLOW_LAYOUT (RVAL2GOBJ (self));
  gfloat min_height, max_height;
  VALUE answer = rb_hash_new ();

  clutter_flow_layout_get_row_height (flow_layout, &min_height, &max_height);
  rb_hash_aset (answer, rb_intern("min"), rb_float_new (min_height));
  rb_hash_aset (answer, rb_intern("max"), rb_float_new (max_height));
  
  return answer;
}
예제 #27
0
static VALUE
rg_append(int argc, VALUE *argv, VALUE self)
{
    GtkWidget* ret = NULL;
    VALUE type = Qnil;
    VALUE widget, stock_id, element_type, text, ttext, ptext, icon, func;

    if (argc > 0) type = argv[0];

    if (NIL_P(type) || TYPE(type) == T_STRING){
        rb_scan_args(argc, argv, "05", &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_append_item(_SELF(self), N_RVAL2CSTR(text),
                                      N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                      N_RVAL2WIDGET(icon),
                                      GTK_SIGNAL_FUNC(exec_callback),
                                      (gpointer)func);
    } else if (TYPE(type) == T_FIXNUM) {
        rb_scan_args(argc, argv, "07", &element_type, &widget, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_append_element(_SELF(self), 
                                         RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE), 
                                         N_RVAL2WIDGET(widget), N_RVAL2CSTR(text),
                                         N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                         N_RVAL2WIDGET(icon),
                                         GTK_SIGNAL_FUNC(exec_callback),
                                         (gpointer)func);
        if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) 
            ret = NULL;
    } else if (TYPE(type) == T_SYMBOL) {
        rb_scan_args(argc, argv, "13", &stock_id, &ttext, &ptext, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)),
                                       N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                       GTK_SIGNAL_FUNC(exec_callback),
                                       (gpointer)func, -1);
    } else {
        rb_scan_args(argc, argv, "12", &widget, &ttext, &ptext);
        gtk_toolbar_append_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)),
                                  N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext));
        return widget;
    }

    return ret ? GOBJ2RVAL(ret) : Qnil;
}
예제 #28
0
static VALUE
iview_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE model;
    rb_scan_args(argc, argv, "01", &model);
    if (NIL_P(model)){
        RBGTK_INITIALIZE(self, gtk_icon_view_new());
    } else {
        G_CHILD_SET(self, id_model, model);
        RBGTK_INITIALIZE(self, 
                         gtk_icon_view_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model))));
    }
    return Qnil;
}
예제 #29
0
static VALUE
rglyph_extents(int argc, VALUE *argv, VALUE self)
{
    VALUE font, start_index, end_index;
    PangoRectangle ink_rect;
    PangoRectangle logical_rect;

    rb_scan_args(argc, argv, "12", &font, &start_index, &end_index);

    if (NIL_P(start_index)){
        pango_glyph_string_extents(_SELF(self), 
                                   PANGO_FONT(RVAL2GOBJ(font)),
                                   &ink_rect, &logical_rect);
    } else {
        pango_glyph_string_extents_range(_SELF(self), 
                                         NUM2INT(start_index), NUM2INT(end_index),
                                         PANGO_FONT(RVAL2GOBJ(font)),
                                         &ink_rect, &logical_rect);
    }

    return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
                        BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
}
예제 #30
0
static VALUE
rcw_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE manager;
    GtkWidget* widget;
    rb_scan_args(argc, argv, "01", &manager);
    if (NIL_P(manager)){
      widget = gtk_recent_chooser_widget_new_for_manager(GTK_RECENT_MANAGER(RVAL2GOBJ(manager)));
    } else {
      widget = gtk_recent_chooser_widget_new();
    }
    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}