static VALUE tbl_attach(int argc, VALUE *argv, VALUE self) { VALUE child, left, right, top, bottom; VALUE arg0, arg1, arg2, arg3; gint xspc, yspc; GtkAttachOptions xopt, yopt; xopt = yopt = GTK_EXPAND | GTK_FILL; xspc = yspc = 0; rb_scan_args(argc, argv, "54", &child, &left, &right, &top, &bottom, &arg0, &arg1, &arg2, &arg3); if (!NIL_P(arg0)) xopt = RVAL2GFLAGS(arg0, GTK_TYPE_ATTACH_OPTIONS); if (!NIL_P(arg1)) yopt = RVAL2GFLAGS(arg1, GTK_TYPE_ATTACH_OPTIONS); if (!NIL_P(arg2)) xspc = NUM2INT(arg2); if (!NIL_P(arg3)) yspc = NUM2INT(arg3); gtk_table_attach(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), NUM2INT(left),NUM2INT(right), NUM2INT(top),NUM2INT(bottom), xopt, yopt, xspc, yspc); G_CHILD_ADD(self, child); return self; }
/* * Method: get_assoc_entry(id, method, flags, format, value) { ... } * id: the ID of the index writer. * method: the lookup method to use (see Gst::Index::LookupMethod). * flags: flags for the entry (see Gst::Index::AssocFlags). * format: a Gst::Format object. * value: the value to find. * * Finds the given format/value in the index. If a block is given, it will be * called as a compare function, passing references to 2 Gst::IndexEntry objects, * and waiting for a boolean as the return value. * * Returns: the entry associated with the value (as a Gst::IndexEntry object), or nil * if the value is not found. */ static VALUE rb_gst_index_get_assoc_entry (VALUE self, VALUE id, VALUE method, VALUE flags, VALUE format, VALUE value) { GstIndexEntry *index_entry; if (rb_block_given_p () == Qfalse) index_entry = gst_index_get_assoc_entry (RGST_INDEX (self), FIX2INT (id), RVAL2GENUM (method, GST_TYPE_INDEX_LOOKUP_METHOD), RVAL2GFLAGS (flags, GST_TYPE_ASSOC_FLAGS), *RGST_FORMAT (format), NUM2ULL (value)); else index_entry = gst_index_get_assoc_entry_full (RGST_INDEX (self), FIX2INT (id), RVAL2GENUM (method, GST_TYPE_INDEX_LOOKUP_METHOD), RVAL2GFLAGS (flags, GST_TYPE_ASSOC_FLAGS), *RGST_FORMAT (format), NUM2ULL (value), __compare, (gpointer) rb_block_proc ()); return index_entry != NULL ? RGST_INDEX_ENTRY_NEW (index_entry) : Qnil; }
static VALUE iview_enable_model_drag_source(VALUE self, VALUE flags, VALUE targets, VALUE actions) { gtk_icon_view_enable_model_drag_source(_SELF(self), RVAL2GFLAGS(flags, GDK_TYPE_MODIFIER_TYPE), rbgtk_get_target_entry(targets), RARRAY_LEN(targets), RVAL2GFLAGS(actions, GDK_TYPE_DRAG_ACTION)); return self; }
static VALUE rg_add_accelerator(VALUE self, VALUE sig, VALUE accel, VALUE key, VALUE mod, VALUE flag) { gtk_widget_add_accelerator(_SELF(self), RVAL2CSTR(sig), GTK_ACCEL_GROUP(RVAL2GOBJ(accel)), NUM2INT(key), RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE), RVAL2GFLAGS(flag, GTK_TYPE_ACCEL_FLAGS)); return self; }
static VALUE rg_drag_motion(VALUE self, VALUE dest_window, VALUE protocol, VALUE x_root, VALUE y_root, VALUE suggested_action, VALUE possible_actions, VALUE time) { gboolean ret = gdk_drag_motion(_SELF(self), GDK_WINDOW(RVAL2GOBJ(dest_window)), RVAL2GENUM(protocol, GDK_TYPE_DRAG_PROTOCOL), NUM2INT(x_root), NUM2INT(y_root), RVAL2GFLAGS(suggested_action, GDK_TYPE_DRAG_ACTION), RVAL2GFLAGS(possible_actions, GDK_TYPE_DRAG_ACTION), NUM2UINT(time)); return CBOOL2RVAL(ret); }
static VALUE rg_m_dest_set(VALUE self, VALUE rbwidget, VALUE rbflags, VALUE rbtargets, VALUE rbactions) { GtkWidget *widget = RVAL2WIDGET(rbwidget); GtkDestDefaults flags = RVAL2GFLAGS(rbflags, GTK_TYPE_DEST_DEFAULTS); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(rbtargets, &n); gtk_drag_dest_set(widget, flags, targets, n, actions); g_free(targets); return self; }
static VALUE rg_enable_model_drag_source(VALUE self, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); GdkModifierType start_button_mask = RVAL2GFLAGS(rbstart_button_mask, GDK_TYPE_MODIFIER_TYPE); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_icon_view_enable_model_drag_source(icon_view, start_button_mask, targets, n, actions); g_free(targets); return self; }
static VALUE rg_m_source_set(VALUE self, VALUE rbwidget, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkWidget *widget = RVAL2WIDGET(rbwidget); GdkModifierType start_button_mask = RVAL2GFLAGS(rbstart_button_mask, GDK_TYPE_MODIFIER_TYPE); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_drag_source_set(widget, start_button_mask, targets, n, actions); g_free(targets); return self; }
/* * Method: add(id, *args) * id: the ID of the index writer. * args: additional parameters, see below. * * Adds an entry into the index. The type of the entry depends of * the number and kind of additional parameters. * * * For an ID type, args must be a String. * * For a FORMAT type, args must be a Gst::Format. * * For an ASSOCIATION type, args must contains an association flag (see Gst::Index::AssocFlags), a Gst::Format and a value for the format. * * For an OBJECT type, well you must wait, because it is not yet implemented. * * Returns: a reference to the newly allocated entry in the index, as a Gst::EntryIndex object. */ static VALUE rb_gst_index_add (int argc, VALUE * argv, VALUE self) { GstIndexEntry *index_entry; VALUE id; if (argc == 2) { VALUE var; rb_scan_args (argc, argv, "2", &id, &var); index_entry = CLASS2GTYPE (CLASS_OF (var)) == GST_TYPE_FORMAT2 ? gst_index_add_format (RGST_INDEX (self), FIX2INT (id), *RGST_FORMAT (var)) : gst_index_add_id (RGST_INDEX (self), FIX2INT (id), RVAL2CSTR (var)); } else { VALUE flags, format, value; rb_scan_args (argc, argv, "4", &id, &flags, &format, &value); index_entry = gst_index_add_association (RGST_INDEX (self), FIX2INT (id), RVAL2GFLAGS (flags, GST_TYPE_ASSOC_FLAGS), *RGST_FORMAT (format), NUM2ULL (value)); } return index_entry != NULL ? RGST_INDEX_ENTRY_NEW (index_entry) : Qnil; }
static VALUE rg_drag_status(VALUE self, VALUE action, VALUE time) { gdk_drag_status(_SELF(self), RVAL2GFLAGS(action, GDK_TYPE_DRAG_ACTION), NUM2UINT(time)); return self; }
static VALUE device_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers) { gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval), RVAL2GFLAGS(modifiers, GDK_TYPE_MODIFIER_TYPE)); return self; }
static VALUE gdkwin_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask) { gdk_window_set_geometry_hints(_SELF(self), NIL_P(geometry) ? (GdkGeometry*)NULL : (GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY), RVAL2GFLAGS(geom_mask, GDK_TYPE_WINDOW_HINTS)); return self; }
static VALUE rg_remove_accelerator(VALUE self, VALUE accel, VALUE key, VALUE mod) { return CBOOL2RVAL(gtk_widget_remove_accelerator(_SELF(self), GTK_ACCEL_GROUP(RVAL2GOBJ(accel)), NUM2INT(key), RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE))); }
static VALUE rg_set_display_options(VALUE self, VALUE flags) { gtk_calendar_set_display_options(_SELF(self), RVAL2GFLAGS(flags, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS)); return self; }
static VALUE ffil_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_file_filter_add_custom(_SELF(self), RVAL2GFLAGS(needed, GTK_TYPE_FILE_FILTER_FLAGS), (GtkFileFilterFunc)filter_func, (gpointer)func, NULL); return self; }
static VALUE rg_m_begin(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE target_list, VALUE actions, VALUE button, VALUE event) { return GOBJ2RVAL(gtk_drag_begin(RVAL2WIDGET(widget), RVAL2BOXED(target_list, GTK_TYPE_TARGET_LIST), RVAL2GFLAGS(actions, GDK_TYPE_DRAG_ACTION), NUM2INT(button), RVAL2GEV(event))); }
static VALUE gdkwin_s_constrain_size(VALUE self, VALUE geometry, VALUE flags, VALUE w, VALUE h) { gint new_width, new_height; gdk_window_constrain_size((GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY), RVAL2GFLAGS(flags, GDK_TYPE_WINDOW_HINTS), NUM2INT(w), NUM2INT(h), &new_width, &new_height); return rb_assoc_new(INT2NUM(new_width), INT2NUM(new_height)); }
static VALUE gdk_s_pointer_grab(VALUE self, VALUE win, VALUE owner_events, VALUE event_mask, VALUE confine_to, VALUE cursor, VALUE time) { return GENUM2RVAL(gdk_pointer_grab(GDK_WINDOW(RVAL2GOBJ(win)), RVAL2CBOOL(owner_events), RVAL2GFLAGS(event_mask, GDK_TYPE_EVENT_MASK), NIL_P(confine_to)?NULL:GDK_WINDOW(RVAL2GOBJ(confine_to)), NIL_P(cursor)?NULL:(GdkCursor*)RVAL2BOXED(cursor, GDK_TYPE_CURSOR), NUM2INT(time)), GDK_TYPE_GRAB_STATUS); }
static VALUE rg_start_editing(VALUE self, VALUE event, VALUE widget, VALUE path, VALUE background_area, VALUE cell_area, VALUE flags) { GtkCellEditable* edit = gtk_cell_renderer_start_editing(_SELF(self), (GdkEvent*)RVAL2GEV(event), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(path), RVAL2RECT(background_area), RVAL2RECT(cell_area), RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE)); return edit ? GOBJ2RVAL(edit) : Qnil; }
static VALUE rg_render(VALUE self, VALUE window, VALUE widget, VALUE background_area, VALUE cell_area, VALUE expose_area, VALUE flags) { gtk_cell_renderer_render(_SELF(self), GDK_WINDOW(RVAL2GOBJ(window)), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2RECT(background_area), RVAL2RECT(cell_area), RVAL2RECT(expose_area), RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE)); return self; }
static VALUE rg_activate(VALUE self, VALUE event, VALUE widget, VALUE path, VALUE background_area, VALUE cell_area, VALUE flags) { gboolean ret = gtk_cell_renderer_activate(_SELF(self), (GdkEvent*)RVAL2GEV(event), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(path), RVAL2RECT(background_area), RVAL2RECT(cell_area), RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE)); return CBOOL2RVAL(ret); }
static VALUE ffil_filter(VALUE self, VALUE contains, VALUE filename, VALUE uri, VALUE display_name, VALUE mime_type) { GtkFileFilterInfo info; info.contains = RVAL2GFLAGS(contains, GTK_TYPE_FILE_FILTER_FLAGS); info.filename = RVAL2CSTR(filename); info.uri = RVAL2CSTR(uri); info.display_name = RVAL2CSTR(display_name); info.mime_type = RVAL2CSTR(mime_type); return CBOOL2RVAL(gtk_file_filter_filter(_SELF(self), &info)); }
static VALUE rg_pty_new(VALUE self, VALUE flags) { VtePty *result; GError *error = NULL; result = vte_terminal_pty_new(_SELF(self), RVAL2GFLAGS(flags, VTE_TYPE_PTY_FLAGS), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(result); }
static VALUE gdkwin_initialize(VALUE self, VALUE parent, VALUE attributes, VALUE attributes_mask) { GdkWindow* win; win = gdk_window_new(NIL_P(parent) ? NULL : _SELF(parent), (GdkWindowAttr*)RVAL2BOXED(attributes, GDK_TYPE_WINDOW_ATTR), RVAL2GFLAGS(attributes_mask, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE)); G_INITIALIZE(self, win); return Qnil; }
static VALUE rg_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_CHILD_ADD(mGtk, func); gtk_recent_filter_add_custom(_SELF(self), RVAL2GFLAGS(needed, GTK_TYPE_RECENT_FILTER_FLAGS), (GtkRecentFilterFunc)filter_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; }
static VALUE rg_enable_model_drag_dest(VALUE self, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_icon_view_enable_model_drag_dest(icon_view, targets, n, actions); g_free(targets); return self; }
static VALUE rg_m_add(VALUE self, VALUE filedescriptor, VALUE gdk_input_condition) { VALUE id; VALUE func; func = rb_block_proc(); id = INT2FIX(gdk_input_add(NUM2INT(rb_funcall(filedescriptor, rb_intern("to_i"), 0)), RVAL2GFLAGS(gdk_input_condition, GDK_TYPE_INPUT_CONDITION), (GdkInputFunction)exec_input, (gpointer)func)); G_RELATIVE2(self, func, id_relative_callbacks, id); return id; }
static VALUE fork_command_full(int argc, VALUE *argv, VALUE self) { VALUE options, rb_pty_flags, rb_working_directory, rb_command_argv, rb_envv, rb_spawn_flags; int pty_flags, spawn_flags; char *working_directory; char **command_argv; char **envv; GPid child_pid; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "pty_flags", &rb_pty_flags, "working_directory", &rb_working_directory, "argv", &rb_command_argv, "envv", &rb_envv, "spawn_flags", &rb_spawn_flags, NULL); pty_flags = NIL_P(rb_pty_flags) ? VTE_PTY_DEFAULT : RVAL2GFLAGS(rb_pty_flags, VTE_TYPE_PTY_FLAGS); working_directory = NIL_P(rb_working_directory) ? NULL : RVAL2CSTR(rb_working_directory); command_argv = rval2cstrary(NIL_P(rb_command_argv) ? fork_command_default_argv() : rb_command_argv); envv = rval2cstrary(rb_envv); spawn_flags = NIL_P(rb_spawn_flags) ? G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH : NUM2INT(rb_spawn_flags); result = vte_terminal_fork_command_full(_SELF(self), pty_flags, working_directory, command_argv, envv, spawn_flags, NULL, NULL, &child_pid, &error); free_cstrary(command_argv); free_cstrary(envv); if (error) RAISE_GERROR(error); return INT2NUM(child_pid); }
static VALUE mdiag_initialize(int argc, VALUE *argv, VALUE self) { VALUE parent, flags, type, buttons, message; GtkWidget* w; rb_scan_args(argc, argv, "41", &parent, &flags, &type, &buttons, &message); w = gtk_message_dialog_new(NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent)), RVAL2GFLAGS(flags, GTK_TYPE_DIALOG_FLAGS), RVAL2GENUM(type, GTK_TYPE_MESSAGE_TYPE), RVAL2GENUM(buttons, GTK_TYPE_BUTTONS_TYPE), "%s", NIL_P(message) ? "": RVAL2CSTR(message)); RBGTK_INITIALIZE(self, w); return Qnil; }
static VALUE seek_initialize(VALUE self, VALUE rate, VALUE format, VALUE flags, VALUE start_type, VALUE start, VALUE stop_type, VALUE stop) { GstEvent *event; event = gst_event_new_seek(NUM2DBL(rate), RVAL2GST_FORMAT(format), RVAL2GFLAGS(flags, GST_TYPE_SEEK_FLAGS), RVAL2GENUM(start_type, GST_TYPE_SEEK_TYPE), NUM2ULL(start), RVAL2GENUM(stop_type, GST_TYPE_SEEK_TYPE), NUM2ULL(stop)); G_INITIALIZE(self, event); return Qnil; }