/* -*- Mode: C; c-basic-offset: 4 -*- * pygtk- Python bindings for the GTK toolkit. * Copyright (C) 2007 Paul Pogonyshev * * gtkrcstyle.override: overrides for the gtk.RcStyle object. * * 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 */ %% override-attr GtkRcStyle.name static int _wrap_gtk_rc_style__set_name(PyGObject *self, PyObject *value, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); gchar *name; PyObject *as_string; if (value == Py_None) name = NULL; else if ((as_string = PyObject_Str(value)) != NULL) { name = g_strdup(PyString_AsString(as_string)); Py_DECREF(as_string); } else return -1; g_free(rc_style->name); rc_style->name = name; return 0; } %% override-attr GtkRcStyle.bg_pixmap_name static PyObject * _wrap_gtk_rc_style__get_bg_pixmap_name(PyGObject *self, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); return _pygtk_rc_style_helper_new(rc_style, RC_STYLE_STRING_ARRAY, rc_style->bg_pixmap_name, 0); } %% override-attr GtkRcStyle.font_desc static int _wrap_gtk_rc_style__set_font_desc(PyGObject *self, PyObject *value, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); PangoFontDescription *font_desc; if (value == Py_None) font_desc = NULL; else if (pyg_boxed_check(value, PANGO_TYPE_FONT_DESCRIPTION)) font_desc = pango_font_description_copy(pyg_boxed_get(value, PangoFontDescription)); else { PyErr_SetString(PyExc_TypeError, "can only assign a pango.FontDescription or None"); return -1; } pango_font_description_free(rc_style->font_desc); rc_style->font_desc = font_desc; return 0; } %% override-attr GtkRcStyle.fg static PyObject * _wrap_gtk_rc_style__get_fg(PyGObject *self, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); return _pygtk_rc_style_helper_new(rc_style, RC_STYLE_COLOUR_ARRAY, rc_style->fg, GTK_RC_FG); } %% override-attr GtkRcStyle.bg static PyObject * _wrap_gtk_rc_style__get_bg(PyGObject *self, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); return _pygtk_rc_style_helper_new(rc_style, RC_STYLE_COLOUR_ARRAY, rc_style->bg, GTK_RC_BG); } %% override-attr GtkRcStyle.text static PyObject * _wrap_gtk_rc_style__get_text(PyGObject *self, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); return _pygtk_rc_style_helper_new(rc_style, RC_STYLE_COLOUR_ARRAY, rc_style->text, GTK_RC_TEXT); } %% override-attr GtkRcStyle.base static PyObject * _wrap_gtk_rc_style__get_base(PyGObject *self, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); return _pygtk_rc_style_helper_new(rc_style, RC_STYLE_COLOUR_ARRAY, rc_style->base, GTK_RC_BASE); } %% override-attr GtkRcStyle.xthickness static int _wrap_gtk_rc_style__set_xthickness(PyGObject *self, PyObject *value, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); if (PyInt_Check(value)) { rc_style->xthickness = PyInt_AsLong(value); return 0; } else { PyErr_SetString(PyExc_TypeError, "can only assign an int"); return -1; } } %% override-attr GtkRcStyle.ythickness static int _wrap_gtk_rc_style__set_ythickness(PyGObject *self, PyObject *value, void *closure) { GtkRcStyle *rc_style = GTK_RC_STYLE(self->obj); if (PyInt_Check(value)) { rc_style->ythickness = PyInt_AsLong(value); return 0; } else { PyErr_SetString(PyExc_TypeError, "can only assign an int"); return -1; } }