File: rbgtk20.c

package info (click to toggle)
ruby-gnome2 0.15.0-1.1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,692 kB
  • ctags: 8,558
  • sloc: ansic: 69,912; ruby: 19,511; makefile: 97; xml: 35; sql: 13
file content (91 lines) | stat: -rw-r--r-- 2,396 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgtk20.c -

  $Author: mutoh $
  $Date: 2005/01/29 11:44:15 $

  Copyright (C) 2003 KUBO Takehiro
                but many codes are copyed from src/rbgtkclipboard.c
                and src/rbgtktreerowreference.c.

************************************************/
#include "global.h"
#include "rbgtk.h"
#include <gtk/gtk.h>

static GtkClipboard*
clipboard_copy(const GtkClipboard *clipboard)
{
    /* I don't know how to copy this object ... */
    return (GtkClipboard*)clipboard;
}

static GType
clipboard_get_type()
{
    static GType our_type = 0;
    if(our_type == 0)
        our_type = g_boxed_type_register_static("GtkClipboard",
                                                (GBoxedCopyFunc)clipboard_copy,
                                                (GBoxedFreeFunc)g_free);
    return our_type;
}

static GtkClipboard* 
get_clipboard(obj)
    VALUE obj;
{
    return (GtkClipboard*)RVAL2BOXED(obj, RBGTK_TYPE_CLIPBOARD);
}

static VALUE
make_clipboard(gobj)
    GtkClipboard* gobj;
{
    return BOXED2RVAL(gobj, RBGTK_TYPE_CLIPBOARD);
}

/*****************************************/
static GtkTreeRowReference*
treerowref_copy(ref)
    const GtkTreeRowReference* ref;
{ 
/* XXXX This code is broken, Is GtkTreeRowReference not available ?
  GtkTreeRowReference* new_ref;
  g_return_val_if_fail (ref != NULL, NULL);
  new_ref = g_new(GtkTreeRowReference, 1);
  *new_ref = *ref;
  return new_ref;
*/
  return (GtkTreeRowReference*)ref;
}

static GType
tree_row_reference_get_type(void)
{ 
  static GType our_type = 0;
  if (our_type == 0)
    our_type = g_boxed_type_register_static ("GtkTreeRowReference",
                    (GBoxedCopyFunc)treerowref_copy,
                    (GBoxedFreeFunc)gtk_tree_row_reference_free);
  return our_type;
}

static GtkTreeRowReference *
get_tree_row_reference(obj)
    VALUE obj;
{
    return (GtkTreeRowReference*)RVAL2BOXED(obj, RBGTK_TYPE_TREE_ROW_REFERENCE);
}

void
Init_gtk20()
{
    rbgtk_clipboard_get_type = clipboard_get_type;
    rbgtk_get_clipboard = (RBGtkClipboardGetFunc)get_clipboard;
    rbgtk_make_clipboard = (RBGtkClipboardMakeFunc)make_clipboard;
    rbgtk_tree_row_reference_get_type = tree_row_reference_get_type;
    rbgtk_get_tree_row_reference = (RBGtkTreeRowReferenceGetFunc)get_tree_row_reference;
}