Wrapped moo_glade_xml_fill_widget, moo_file_dialog, moo_bind_sensitive. Made xml.w_something be equivalent to xml.get_widget('something') for GladeXML.
parent
b2dfb96352
commit
43584b93fc
|
@ -106,9 +106,10 @@
|
|||
'("char*" "label")
|
||||
'("GdkPixbuf*" "icon")
|
||||
'("char*" "icon_stock_id")
|
||||
'("MooGladeXML*" "xml")
|
||||
'("GSList*" "widgets")
|
||||
'("gboolean" "auto_apply")
|
||||
;; xml may not be wrapped
|
||||
;; '("MooGladeXML*" "xml")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -219,79 +220,42 @@
|
|||
(in-module "Moo")
|
||||
(c-name "MooUIWidgetType")
|
||||
(gtype-id "MOO_TYPE_UI_WIDGET_TYPE")
|
||||
(values
|
||||
'("menubar" "MOO_UI_MENUBAR")
|
||||
'("menu" "MOO_UI_MENU")
|
||||
'("toolbar" "MOO_UI_TOOLBAR")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum FileDialogType
|
||||
(in-module "Moo")
|
||||
(c-name "MooFileDialogType")
|
||||
(gtype-id "MOO_TYPE_FILE_DIALOG_TYPE")
|
||||
(values
|
||||
'("file-open-existing" "MOO_DIALOG_FILE_OPEN_EXISTING")
|
||||
'("file-open-any" "MOO_DIALOG_FILE_OPEN_ANY")
|
||||
'("file-save" "MOO_DIALOG_FILE_SAVE")
|
||||
'("dir-open" "MOO_DIALOG_DIR_OPEN")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum FileWatchMethod
|
||||
(in-module "Moo")
|
||||
(c-name "MooFileWatchMethod")
|
||||
(gtype-id "MOO_TYPE_FILE_WATCH_METHOD")
|
||||
(values
|
||||
'("stat" "MOO_FILE_WATCH_STAT")
|
||||
'("fam" "MOO_FILE_WATCH_FAM")
|
||||
'("win32" "MOO_FILE_WATCH_WIN32")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum FileWatchEventCode
|
||||
(in-module "Moo")
|
||||
(c-name "MooFileWatchEventCode")
|
||||
(gtype-id "MOO_TYPE_FILE_WATCH_EVENT_CODE")
|
||||
(values
|
||||
'("changed" "MOO_FILE_WATCH_CHANGED")
|
||||
'("deleted" "MOO_FILE_WATCH_DELETED")
|
||||
'("created" "MOO_FILE_WATCH_CREATED")
|
||||
'("moved" "MOO_FILE_WATCH_MOVED")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum PanePosition
|
||||
(in-module "Moo")
|
||||
(c-name "MooPanePosition")
|
||||
(gtype-id "MOO_TYPE_PANE_POSITION")
|
||||
(values
|
||||
'("left" "MOO_PANE_POS_LEFT")
|
||||
'("right" "MOO_PANE_POS_RIGHT")
|
||||
'("top" "MOO_PANE_POS_TOP")
|
||||
'("bottom" "MOO_PANE_POS_BOTTOM")
|
||||
)
|
||||
)
|
||||
|
||||
(define-flags PrefsMatchType
|
||||
(in-module "Moo")
|
||||
(c-name "MooPrefsMatchType")
|
||||
(gtype-id "MOO_TYPE_PREFS_MATCH_TYPE")
|
||||
(values
|
||||
'("key" "MOO_PREFS_MATCH_KEY")
|
||||
'("prefix" "MOO_PREFS_MATCH_PREFIX")
|
||||
'("regex" "MOO_PREFS_MATCH_REGEX")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum DataDirType
|
||||
(in-module "Moo")
|
||||
(c-name "MooDataDirType")
|
||||
(gtype-id "MOO_TYPE_DATA_DIR_TYPE")
|
||||
(values
|
||||
'("share" "MOO_DATA_SHARE")
|
||||
'("lib" "MOO_DATA_LIB")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -813,7 +777,6 @@
|
|||
(parameters
|
||||
'("GtkWidget*" "target")
|
||||
'("const-char*" "buffer")
|
||||
'("int" "size" (null-ok) (default "-1"))
|
||||
'("const-char*" "target_name")
|
||||
'("GError**" "error")
|
||||
)
|
||||
|
@ -1265,7 +1228,7 @@
|
|||
(c-name "moo_prefs_dialog_run")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkWidget*" "parent")
|
||||
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1357,6 +1320,16 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-virtual init
|
||||
(of-object "MooPrefsDialogPage")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-virtual apply
|
||||
(of-object "MooPrefsDialogPage")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; From ../mooutils/moostock.h
|
||||
|
@ -2137,16 +2110,16 @@
|
|||
|
||||
;; From moo/mooutils/mooutils-gobject.h
|
||||
|
||||
;; (define-function moo_bind_sensitive
|
||||
;; (c-name "moo_bind_sensitive")
|
||||
;; (return-type "none")
|
||||
;; (parameters
|
||||
;; '("GtkWidget*" "toggle_btn")
|
||||
;; '("GtkWidget**" "dependent")
|
||||
;; '("int" "num_dependent")
|
||||
;; '("gboolean" "invert")
|
||||
;; )
|
||||
;; )
|
||||
(define-function bind_sensitive
|
||||
(c-name "moo_bind_sensitive")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkWidget*" "toggle_btn")
|
||||
'("GtkWidget*" "dependent")
|
||||
'("int" "num_dependent")
|
||||
'("gboolean" "invert")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function bind_bool_property
|
||||
(c-name "moo_bind_bool_property")
|
||||
|
@ -2156,7 +2129,7 @@
|
|||
'("const-char*" "target_prop")
|
||||
'("GObject*" "source")
|
||||
'("const-char*" "source_prop")
|
||||
'("gboolean" "invert")
|
||||
'("gboolean" "invert" (null-ok) (default "FALSE"))
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -2690,8 +2663,8 @@
|
|||
(c-name "moo_file_dialog")
|
||||
(return-type "const-char*")
|
||||
(parameters
|
||||
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
|
||||
'("MooFileDialogType" "type")
|
||||
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
|
||||
'("const-char*" "title" (null-ok) (default "NULL"))
|
||||
'("const-char*" "start_dir" (null-ok) (default "NULL"))
|
||||
)
|
||||
|
|
|
@ -519,3 +519,110 @@ _wrap_moo_file_watch_monitor_file (PyGObject *self, PyObject *args, PyObject *kw
|
|||
|
||||
return PyInt_FromLong (ret);
|
||||
}
|
||||
%%
|
||||
override moo_glade_xml_fill_widget kwargs
|
||||
static PyObject *
|
||||
_wrap_moo_glade_xml_fill_widget (PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { (char*) "target", (char*) "buffer", (char*) "target_name", NULL };
|
||||
PyGObject *target;
|
||||
char *buffer, *target_name;
|
||||
GError *error = NULL;
|
||||
int ret;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
(char*) "O!ss:MooGladeXML.fill_widget", kwlist,
|
||||
&PyGtkWidget_Type, &target,
|
||||
&buffer, &target_name))
|
||||
return NULL;
|
||||
|
||||
ret = moo_glade_xml_fill_widget (MOO_GLADE_XML(self->obj),
|
||||
GTK_WIDGET(target->obj),
|
||||
buffer, -1,
|
||||
target_name,
|
||||
&error);
|
||||
|
||||
if (pyg_error_check(&error))
|
||||
return NULL;
|
||||
|
||||
return PyBool_FromLong(ret);
|
||||
}
|
||||
%%
|
||||
override moo_file_dialog kwargs
|
||||
static PyObject *
|
||||
_wrap_moo_file_dialog (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { (char*) "type", (char*) "parent", (char*) "title", (char*) "start_dir", NULL };
|
||||
PyObject *py_type = NULL;
|
||||
int type;
|
||||
char *title = NULL, *start_dir = NULL;
|
||||
const gchar *ret;
|
||||
GtkWidget *parent = NULL;
|
||||
PyGObject *py_parent = NULL;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char*) "O|Ozz:file_dialog", kwlist,
|
||||
&py_type, &py_parent, &title, &start_dir))
|
||||
return NULL;
|
||||
|
||||
if (pyg_enum_get_value (MOO_TYPE_FILE_DIALOG_TYPE, py_type, &type))
|
||||
return NULL;
|
||||
|
||||
if ((PyObject*) py_parent == Py_None)
|
||||
{
|
||||
parent = NULL;
|
||||
}
|
||||
else if (py_parent && pygobject_check (py_parent, &PyGtkWidget_Type))
|
||||
{
|
||||
parent = GTK_WIDGET (py_parent->obj);
|
||||
}
|
||||
else if (py_parent)
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError, "parent should be a GtkWidget or None");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = moo_file_dialog (parent, type, title, start_dir);
|
||||
|
||||
if (ret)
|
||||
return PyString_FromString(ret);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override moo_bind_sensitive kwargs
|
||||
static PyObject *
|
||||
_wrap_moo_bind_sensitive (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { (char*) "toggle_btn", (char*) "dependent", (char*) "invert", NULL };
|
||||
PyGObject *toggle_btn, *dependent;
|
||||
int invert = FALSE;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char*) "O!O!|i:moo_bind_sensitive", kwlist,
|
||||
&PyGtkWidget_Type, &toggle_btn,
|
||||
&PyGtkWidget_Type, &dependent,
|
||||
&invert))
|
||||
return NULL;
|
||||
|
||||
moo_bind_sensitive (GTK_WIDGET (toggle_btn->obj),
|
||||
(GtkWidget**) &dependent->obj, 1,
|
||||
invert);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override-slot MooGladeXML.tp_getattr
|
||||
static PyObject *
|
||||
_wrap_moo_glade_xml_tp_getattr (PyObject *self, char *attr)
|
||||
{
|
||||
GObject *ret = NULL;
|
||||
|
||||
if (g_str_has_prefix (attr, "w_"))
|
||||
ret = moo_glade_xml_get_widget (MOO_GLADE_XML (pygobject_get (self)), attr + 2);
|
||||
|
||||
if (ret)
|
||||
return pygobject_new (ret);
|
||||
|
||||
return Py_FindMethod ((PyMethodDef*) _PyMooGladeXML_methods, self, attr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue