summaryrefslogtreecommitdiff
path: root/src/caja.override
blob: b968425e7d56958ba2efe98c858aa6eade36860b (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* -*- Mode: C; c-basic-offset: 4 -*-
 * Copyright (C) 2004  Johan Dahlin
 *
 *   caja.override: overrides for the caja extension library
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */
%%
headers
#define NO_IMPORT_PYGOBJECT
#include "pygobject.h"

#include <libcaja-extension/caja-file-info.h>
#include <libcaja-extension/caja-info-provider.h>
#include <libcaja-extension/caja-column-provider.h>
#include <libcaja-extension/caja-location-widget-provider.h>
#include <libcaja-extension/caja-menu-provider.h>
#include <libcaja-extension/caja-property-page-provider.h>
#include <libcaja-extension/caja-menu.h>

static PyObject *
_glist_to_pyobject (GList *list)
{
	GList *l;
	PyObject *item, *py_ret;

	py_ret = PyList_New (0);

	for (l = list; l != NULL; l = l->next)
	{
		item = pygobject_new ((GObject *)l->data);

		if (item == NULL)
		{
			Py_DECREF (py_ret);
			return NULL;
		}

		PyList_Append (py_ret, item);
		Py_DECREF (item);
	}

	return py_ret;
}

%%
modulename caja
%%
import gobject.GObject as PyGObject_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
%%
ignore-glob
  *_get_type
%%
define CajaMenu.get_items
static PyObject *
_wrap_caja_menu_get_items(PyGObject *self)
{
    GList *ret;
    
    if(self == NULL)
    {
        Py_INCREF(Py_None);
        return Py_None;
    }
    
    ret = caja_menu_get_items(CAJA_MENU(self->obj));
    if (ret) {
        PyObject *py_ret = _glist_to_pyobject(ret);
        return py_ret;
    }
    
    Py_INCREF(Py_None);
    return Py_None;
}
%%
define CajaInfoProvider.update_complete_invoke kwargs
static PyObject *
_wrap_caja_info_provider_update_complete_invoke(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "provider", "handle", "closure", "result", NULL };
    PyObject *py_closure, *py_handle, *py_result;
    PyGObject *py_provider;
    GClosure *closure;
    CajaOperationHandle *handle;
    CajaOperationResult result = CAJA_OPERATION_COMPLETE;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!OO|O:CajaInfoProvider.update_complete_invoke", kwlist,
            &PyCajaInfoProvider_Type, &py_provider, 
            &py_handle, &py_closure, &py_result))
    {
        Py_INCREF(Py_None);
        return Py_None;
    }

    closure = pyg_boxed_get(py_closure, GClosure);
    handle = pyg_pointer_get(py_handle, CajaOperationHandle);
    if (py_result != NULL)
        result = (CajaOperationResult)py_result;

    caja_info_provider_update_complete_invoke(closure, 
        CAJA_INFO_PROVIDER(py_provider->obj), handle, result);

    Py_INCREF(Py_None);
    return Py_None;
}
%%
define CajaMenuProvider.emit_items_updated_signal args
static PyObject *
_wrap_caja_menu_provider_emit_items_updated_signal(PyGObject *self, PyObject *args)
{
    PyGObject *py_provider;
    
    if (!PyArg_ParseTuple(args, "O!:CajaMenuProvider.emit_items_updated_signal",
            &PyCajaMenuProvider_Type, &py_provider))
    {
        Py_INCREF(Py_None);
        return Py_None;
    }
    
    caja_menu_provider_emit_items_updated_signal(CAJA_MENU_PROVIDER(py_provider->obj));

    Py_INCREF(Py_None);
    return Py_None;
}