2011-11-07 13:46:58 -06:00
|
|
|
%%
|
|
|
|
headers
|
|
|
|
#define NO_IMPORT_PYGOBJECT
|
|
|
|
#define NO_IMPORT_PYGTK
|
|
|
|
#include <pygobject.h>
|
|
|
|
#include <pygtk/pygtk.h>
|
|
|
|
|
2011-11-07 16:52:18 -06:00
|
|
|
#include "pluma-utils.h"
|
2011-11-07 13:46:58 -06:00
|
|
|
|
2011-11-07 16:52:18 -06:00
|
|
|
void pyplumautils_register_classes (PyObject *d);
|
|
|
|
void pyplumautils_add_constants (PyObject *module, const gchar *strip_prefix);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
%%
|
2011-11-07 16:52:18 -06:00
|
|
|
modulename pluma.utils
|
2011-11-07 13:46:58 -06:00
|
|
|
%%
|
|
|
|
import gtk.Widget as PyGtkWidget_Type
|
|
|
|
import gtk.TreeView as PyGtkTreeView_Type
|
|
|
|
import gtk.Menu as PyGtkMenu_Type
|
|
|
|
%%
|
|
|
|
ignore-glob
|
|
|
|
_*
|
|
|
|
%%
|
2011-11-07 16:52:18 -06:00
|
|
|
override pluma_utils_menu_position_under_widget kwargs
|
2011-11-07 13:46:58 -06:00
|
|
|
static PyObject *
|
2011-11-07 16:52:18 -06:00
|
|
|
_wrap_pluma_utils_menu_position_under_widget (PyObject *self,
|
2011-11-07 13:46:58 -06:00
|
|
|
PyObject *args,
|
|
|
|
PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "menu", "widget", NULL };
|
|
|
|
PyObject *py_menu, *py_widget;
|
|
|
|
GtkMenu *menu;
|
|
|
|
GtkWidget *widget;
|
|
|
|
gint x, y;
|
|
|
|
gboolean push_in;
|
|
|
|
PyObject *tuple;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
|
|
|
"O!O!", kwlist,
|
|
|
|
&PyGtkMenu_Type, &py_menu,
|
|
|
|
&PyGtkWidget_Type, &py_widget))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
menu = GTK_MENU (pygobject_get (py_menu));
|
|
|
|
widget = GTK_WIDGET (pygobject_get (py_widget));
|
|
|
|
|
2011-11-07 16:52:18 -06:00
|
|
|
pluma_utils_menu_position_under_widget (menu, &x, &y, &push_in, widget);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
tuple = PyTuple_New (3);
|
|
|
|
PyTuple_SetItem (tuple, 0, PyInt_FromLong (x));
|
|
|
|
PyTuple_SetItem (tuple, 1, PyInt_FromLong (y));
|
|
|
|
PyTuple_SetItem (tuple, 2, PyBool_FromLong (push_in));
|
|
|
|
return tuple;
|
|
|
|
}
|
|
|
|
%%
|
2011-11-07 16:52:18 -06:00
|
|
|
override pluma_utils_menu_position_under_tree_view kwargs
|
2011-11-07 13:46:58 -06:00
|
|
|
static PyObject *
|
2011-11-07 16:52:18 -06:00
|
|
|
_wrap_pluma_utils_menu_position_under_tree_view (PyObject *self,
|
2011-11-07 13:46:58 -06:00
|
|
|
PyObject *args,
|
|
|
|
PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "menu", "tree_view", NULL };
|
|
|
|
PyObject *py_menu, *py_view;
|
|
|
|
GtkMenu *menu;
|
|
|
|
GtkTreeView *view;
|
|
|
|
gint x, y;
|
|
|
|
gboolean push_in;
|
|
|
|
PyObject *tuple;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
|
|
|
"O!O!", kwlist,
|
|
|
|
&PyGtkMenu_Type, &py_menu,
|
|
|
|
&PyGtkTreeView_Type, &py_view))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
menu = GTK_MENU (pygobject_get (py_menu));
|
|
|
|
view = GTK_TREE_VIEW (pygobject_get (py_view));
|
|
|
|
|
2011-11-07 16:52:18 -06:00
|
|
|
pluma_utils_menu_position_under_widget (menu, &x, &y, &push_in, view);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
tuple = PyTuple_New (3);
|
|
|
|
PyTuple_SetItem (tuple, 0, PyInt_FromLong (x));
|
|
|
|
PyTuple_SetItem (tuple, 1, PyInt_FromLong (y));
|
|
|
|
PyTuple_SetItem (tuple, 2, PyBool_FromLong (push_in));
|
|
|
|
return tuple;
|
|
|
|
}
|