[Glade-devel] GladeBinding + Actions patch



from glade-binding.c

GladeBindings are glade's modules to add support for others languages.
The principal objective is to be able to support widgets written in
other language than C.

The bindings modules provides this functionality to the core trought a
couple of obligatory functions.

GladeBindingInitFunc glade_binding_init() to initialize the binding and
GladeBindingLibraryLoadFunc glade_binding_library_load() to load a
library written in language supported by the binding.

You can add Scripting capability to the core by providing 
GladeBindingRunScriptFunc glade_binding_run_script() and/or
GladeBindingConsoleNewFunc glade_binding_console_new()

The core will search for script in two different directories,
datadir/package/scripts/ and g_get_user_config_dir()/package/scripts/

The hierarchy in those directories should be binding_name/gtype_name/ *
For example if you want to add a python script to GtkContainers you can
do it by installing the script file in 
g_get_user_config_dir()/glade3/scripts/python/GtkContainer/Delete_Children.py

This will add a context menu item for any GtkContainer called "Delete
Children" that will trigger GtkContainer's widget adaptor
"action-activated::Delete_Children" signal.

********
Also you can specify actions in the catalog file :)

<action id="action" label="Action" stock="stock-id"/>
<action-group id="group-id" label="Label" stock="stock-id">
  <action id="action2" label="Action 2" stock="stock-id"/>
</action-group>

This was you can connect to the adaptor's "action-activated::action-id"
signal to perform such action :)

hmmm may i could split the path in two, GladeBinding and GWAAction but i
am to lazy to do it if it is not entirely necessary :)

greets

Juan Pablo

pd:
ChangeLog

* configure.in: Added python/pygtk checks.

* src/Makefile.am: added glade-binding.[ch] and BUILD_PYTHON rules

* src/glade-app.[ch]:
  o added glade_scripts_dir and glade_bindings_dir globals
  o added new function glade_app_get_project_by_name()
  o loading / unloading bindings.

* src/glade-catalog.c: support for loading catalogs supported by
  bindings, added language member to GladeCatalog.

* src/glade-paths.sh.in: added GLADE_BINDINGSDIR and GLADE_SCRIPTSDIR.

* src/glade-popup.c: added support for GWAAction
  (shows context actions as menu items)

* src/glade-project-window.c: added window which a console for each
  GladeBinding that provide a console.

* glade-python-support.[defs override]: files used by pygtk-codegen-2.0
  to create glade-python-support.c (GladeWidgetAdaptor wrappers)

* glade-python.c GladeBinding plugin for python language.

* src/glade-widget-adaptor.[ch]:
  o added "action-activated" signal
  o added GWAAction support.
  o added glade_create_reason_get_type() so the enum can be exposed in
    bindings as a GEnum.
  o gwa_derive_adaptor_for_type() now checks if the adaptor is already
    registered, because catalogs plugins could register adaptors when
    are loaded. (This is how python's catalog works)
  o setup binding scripts as actions.
  o added glade_widget_adaptor_emit_action_activated()
    (used in glade-popup.c)

* src/glade.h: added GLADE_TAG_LANGUAGE, GLADE_TAG_ACTION_GROUP,
  GLADE_TAG_ACTION, GLADE_TAG_STOCK, glade_scripts_dir and
  glade_bindings_dir.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binding_actions.patch.gz
Type: application/x-gzip
Size: 18797 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/glade-devel/attachments/20061114/3d2d7c5e/attachment-0001.gz 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pythontest.xml
Type: application/xml
Size: 413 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/glade-devel/attachments/20061114/3d2d7c5e/attachment-0001.rdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pythontest.py
Type: text/x-python
Size: 961 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/glade-devel/attachments/20061114/3d2d7c5e/attachment-0001.py 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]