Kevin Ryde > Glib-Ex-ObjectBits-16 > Glib::Ex::ObjectBits

Download:
Glib-Ex-ObjectBits-16.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 16   Source  

NAME ^

Glib::Ex::ObjectBits -- misc Glib object helpers

SYNOPSIS ^

 use Glib::Ex::ObjectBits;

FUNCTIONS ^

Display

Glib::Ex::ObjectBits::set_property_maybe ($obj, $pname1,$value1, $pname2,$value2, ...)

Set properties on $obj if they exist. Each $pname is a property name (a string) and those which exist on $obj are set to their $value with $obj->set_property().

This is a handy way to apply properties which might only exist in a new enough version of a library. For example Gtk2::Widget has a tooltip-text in Gtk 2.12 up,

    Glib::Ex::ObjectBits::set_property_maybe
      ($widget, tooltip_text => 'Some description.');

Things like this which are purely visual and don't affect actual operation are good for a set-maybe. Important things might want some sort of proper fallback.

Properties which do always exist can be included in set_property_maybe(), if a single call looks better. But be careful not to mis-spell a property name, since set_property_maybe() of course has no way to identify that.

EXPORTS ^

Nothing is exported by default, but the functions can be requested in usual Exporter style,

    use Glib::Ex::ObjectBits 'set_property_maybe';
    # "tearoff-title" new in Gtk 2.10
    set_property_maybe ($combobox, tearoff_title => 'My Menu');

Importing set_property_maybe() is good if making many such settings. The name is tolerably distinctive.

There's no :all tag since this module is meant as a grab-bag of functions and to import as-yet unknown things would be asking for name clashes.

SEE ALSO ^

Glib::Object

Glib::Ex::EnumBits, Glib::Ex::FreezeNotify, Glib::Ex::SignalBits, Glib::Ex::SignalIds, Glib::Ex::SourceIds, Glib::Ex::TieProperties

HOME PAGE ^

http://user42.tuxfamily.org/glib-ex-objectbits/index.html

LICENSE ^

Copyright 2010, 2011, 2012, 2014 Kevin Ryde

Glib-Ex-ObjectBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Glib-Ex-ObjectBits 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with Glib-Ex-ObjectBits. If not, see http://www.gnu.org/licenses/.

syntax highlighting: