nautilus-python r52 - in trunk: . examples src
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus-python r52 - in trunk: . examples src
- Date: Fri, 11 Jan 2008 14:31:39 +0000 (GMT)
Author: johan
Date: Fri Jan 11 14:31:39 2008
New Revision: 52
URL: http://svn.gnome.org/viewvc/nautilus-python?rev=52&view=rev
Log:
2008-01-11 Johan Dahlin <johan gnome org>
* examples/Makefile.am:
* src/nautilus-python.c: (nautilus_python_init_python):
* src/nautilus-python.h:
* src/nautilus.defs:
* examples/submenu.py:
Add Menu wrapper which makes it possible to implement submenus.
#440026, LukÃÅ LalinskÃ, Sylvain Baubeau, Erik Wien
Added:
trunk/examples/submenu.py (contents, props changed)
Modified:
trunk/ChangeLog
trunk/examples/Makefile.am
trunk/src/nautilus-python.c
trunk/src/nautilus-python.h
trunk/src/nautilus.defs
Modified: trunk/examples/Makefile.am
==============================================================================
--- trunk/examples/Makefile.am (original)
+++ trunk/examples/Makefile.am Fri Jan 11 14:31:39 2008
@@ -8,7 +8,8 @@
background-image.py \
block-size-column.py \
open-terminal.py \
- md5sum-property-page.py
+ md5sum-property-page.py \
+ submenu.py
EXTRA_DIST += $(examples_DATA)
Added: trunk/examples/submenu.py
==============================================================================
--- (empty file)
+++ trunk/examples/submenu.py Fri Jan 11 14:31:39 2008
@@ -0,0 +1,25 @@
+import nautilus
+
+class ExampleMenuProvider(nautilus.MenuProvider):
+
+ def get_file_items(self, window, files):
+ menuitem = nautilus.MenuItem('ExampleMenuProvider::Foo', 'Foo', '')
+
+ submenu = nautilus.Menu()
+ menuitem.set_submenu(submenu)
+
+ menuitem = nautilus.MenuItem('ExampleMenuProvider::Bar', 'Bar', '')
+ submenu.append_item(menuitem)
+
+ return menuitem,
+
+ # FIXME: Why isn't this working?
+ def get_background_items(self, window, file):
+ submenu = nautilus.Menu()
+ submenu.append_item(nautilus.MenuItem('ExampleMenuProvider::Bar', 'Bar', ''))
+
+ menuitem = nautilus.MenuItem('ExampleMenuProvider::Foo', 'Foo', '')
+ menuitem.set_submenu(submenu)
+
+ return menuitem,
+
Modified: trunk/src/nautilus-python.c
==============================================================================
--- trunk/src/nautilus-python.c (original)
+++ trunk/src/nautilus-python.c Fri Jan 11 14:31:39 2008
@@ -303,6 +303,7 @@
IMPORT(Column, "Column");
IMPORT(ColumnProvider, "ColumnProvider");
IMPORT(InfoProvider, "InfoProvider");
+ IMPORT(Menu, "Menu");
IMPORT(MenuItem, "MenuItem");
IMPORT(MenuProvider, "MenuProvider");
IMPORT(PropertyPage, "PropertyPage");
Modified: trunk/src/nautilus-python.h
==============================================================================
--- trunk/src/nautilus-python.h (original)
+++ trunk/src/nautilus-python.h Fri Jan 11 14:31:39 2008
@@ -55,6 +55,9 @@
PyTypeObject *_PyNautilusInfoProvider_Type;
#define PyNautilusInfoProvider_Type (*_PyNautilusInfoProvider_Type)
+PyTypeObject *_PyNautilusMenu_Type;
+#define PyNautilusMenu_Type (*_PyNautilusMenu_Type)
+
PyTypeObject *_PyNautilusMenuItem_Type;
#define PyNautilusMenuItem_Type (*_PyNautilusMenuItem_Type)
Modified: trunk/src/nautilus.defs
==============================================================================
--- trunk/src/nautilus.defs (original)
+++ trunk/src/nautilus.defs Fri Jan 11 14:31:39 2008
@@ -25,6 +25,13 @@
(gtype-id "NAUTILUS_TYPE_INFO_PROVIDER")
)
+(define-object Menu
+ (in-module "Nautilus")
+ (parent "GObject")
+ (c-name "NautilusMenu")
+ (gtype-id "NAUTILUS_TYPE_MENU")
+)
+
(define-object MenuItem
(in-module "Nautilus")
(parent "GObject")
@@ -214,6 +221,35 @@
(return-type "GType")
)
+(define-function nautilus_menu_new
+ (c-name "nautilus_menu_new")
+ (is-constructor-of "NautilusMenu")
+ (return-type "NautilusMenu*")
+)
+
+(define-method append_item
+ (of-object "NautilusMenu")
+ (c-name "nautilus_menu_append_item")
+ (return-type "none")
+ (parameters
+ '("NautilusMenuItem*" "item")
+ )
+)
+
+(define-method get_items
+ (of-object "NautilusMenu")
+ (c-name "nautilus_menu_get_items")
+ (return-type "GList*")
+)
+
+(define-function nautilus_menu_item_list_free
+ (c-name "nautilus_menu_item_list_free")
+ (return-type "none")
+ (parameters
+ '("GList*", "item_list")
+ )
+)
+
(define-function nautilus_menu_item_new
(c-name "nautilus_menu_item_new")
(is-constructor-of "NautilusMenuItem")
@@ -226,13 +262,21 @@
)
)
+(define-method set_submenu
+ (of-object "NautilusMenuItem")
+ (c-name "nautilus_menu_item_set_submenu")
+ (return-type "none")
+ (parameters
+ '("NautilusMenu*" "menu")
+ )
+)
+
(define-method activate
(of-object "NautilusMenuItem")
(c-name "nautilus_menu_item_activate")
(return-type "none")
)
-
;; From /usr/include/nautilus/libnautilus-extension/nautilus-property-page.h
(define-function nautilus_property_page_get_type
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]