[Gtk-sharp-list] Re: Action and UIManager

John Luke John Luke <john.luke@gmail.com>
Sun, 14 Nov 2004 15:38:14 -0500


------=_Part_215_33259816.1100464694068
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello,

I'm not sure the first message made it ...
but I went ahead and made a patch for the List and SList stuff.

Gtk.Action.Proxies states that "The list is owned by the action and
must not be modified."
so perhaps something more needs to be done to meet that requirement
but it seems to work now.

Ok to commit?

On Tue, 9 Nov 2004 23:01:10 -0500, John Luke <john.luke@gmail.com> wrote:
> Hey,
> 
>   For the bleedingedge-ers out there I just made a quick pass through
> the Gtk Action, ActionGroup, and UIManager classes in the docs.  Here
> are some things I noticed:
>  - some GLib.List and SList exposed
>  - Action.Name comes from get_name but there is also a name property
> which is read/write
> and should possibly be marked const-gchar*
> - should gettext stuff be exposed (ex. Gtk.ActionGroup.TranslationDomain, etc.)
> 
> Just in case someone wants to fix any of these before I do.
>

------=_Part_215_33259816.1100464694068
Content-Type: text/x-patch; name="action_stuff.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="action_stuff.patch"

Index: gtk/Action.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- gtk/Action.custom=09(revision 36107)
+++ gtk/Action.custom=09(working copy)
@@ -23,3 +23,17 @@
 =09public Action (string name, string label) : this (name, label, null, nu=
ll)
 =09{
 =09}
+
+=09=09[DllImport("libgtk-win32-2.0-0.dll")]
+        static extern IntPtr gtk_action_get_proxies (IntPtr raw);
+
+        public Gtk.Widget[] Proxies {
+            get {
+                IntPtr raw_ret =3D gtk_action_get_proxies (Handle);
+                GLib.SList list =3D new GLib.SList (raw_ret);
+ =09=09=09=09Widget[] result =3D new Widget [list.Count];
+            =09for (int i =3D 0; i < list.Count; i++)
+                =09result [i] =3D list [i] as Widget;
+            =09return result;
+            }
+        }
Index: gtk/ActionGroup.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- gtk/ActionGroup.custom=09(revision 0)
+++ gtk/ActionGroup.custom=09(revision 0)
@@ -0,0 +1,33 @@
+// Gtk.ActionGroup.custom - Gtk ActionGroup class customizations
+//
+// Author: John Luke  <john.luke@gmail.com>
+//
+// Copyright (C) 2004 Novell, Inc.
+//
+// This code is inserted after the automatically generated code.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program 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 program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+=09=09[DllImport ("libgtk-win32-2.0-0.dll")]
+=09=09static extern IntPtr gtk_action_group_list_actions (IntPtr raw);
+
+=09=09public Gtk.Action[] ListActions() {
+=09=09=09IntPtr raw_ret =3D gtk_action_group_list_actions (Handle);
+=09=09=09GLib.List list =3D new GLib.List (raw_ret);
+ =09=09=09Gtk.Action[] result =3D new Gtk.Action [list.Count];
+            for (int i =3D 0; i < list.Count; i++)
+               =09result [i] =3D list [i] as Gtk.Action;
+=09=09=09return result;
+=09=09}
Index: gtk/UIManager.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- gtk/UIManager.custom=09(revision 36107)
+++ gtk/UIManager.custom=09(working copy)
@@ -32,3 +32,29 @@
 =09=09return AddUiFromString (new System.IO.StreamReader (s).ReadToEnd ())=
;
 =09}=09
=20
+=09=09[DllImport ("libgtk-win32-2.0-0.dll")]
+=09=09static extern IntPtr gtk_ui_manager_get_toplevels (IntPtr raw, int t=
ypes);
+
+=09=09public Widget[] GetToplevels (Gtk.UIManagerItemType types) {
+=09=09=09IntPtr raw_ret =3D gtk_ui_manager_get_toplevels (Handle, (int) ty=
pes);
+=09=09=09GLib.SList list =3D new GLib.SList (raw_ret);
+ =09=09=09Widget[] result =3D new Widget [list.Count];
+            for (int i =3D 0; i < list.Count; i++)
+               =09result [i] =3D list [i] as Widget;
+=09=09=09return result;
+=09=09}
+
+=09=09[DllImport ("libgtk-win32-2.0-0.dll")]
+=09=09static extern IntPtr gtk_ui_manager_get_action_groups (IntPtr raw);
+
+=09=09public ActionGroup[] ActionGroups {=20
+=09=09=09get {
+=09=09=09=09IntPtr raw_ret =3D gtk_ui_manager_get_action_groups (Handle);
+=09=09=09=09GLib.List list =3D new GLib.List(raw_ret);
+ =09=09=09=09ActionGroup[] result =3D new ActionGroup [list.Count];
+            =09for (int i =3D 0; i < list.Count; i++)
+                =09result [i] =3D list [i] as ActionGroup;
+=09=09=09=09return result;
+=09=09=09}
+=09=09}
+
Index: gtk/Gtk.metadata
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- gtk/Gtk.metadata=09(revision 36107)
+++ gtk/Gtk.metadata=09(working copy)
@@ -86,6 +86,7 @@
   <attr path=3D"/api/namespace/interface[@cname=3D'GtkTreeSortable']/metho=
d[@name=3D'SortColumnChanged']" name=3D"name">ChangeSortColumn</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkAccelLabel']/constructo=
r[@cname=3D'gtk_accel_label_new']/*/*[@name=3D'string']" name=3D"property_n=
ame">label</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkAction']/signal[@name=
=3D'Activate']" name=3D"name">Activated</attr>
+  <attr path=3D"/api/namespace/object[@cname=3D'GtkAction']/method[@name=
=3D'GetProxies']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddAction']" name=3D"name">Add</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddActions']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddActionsFull']" name=3D"hidden">1</attr>
@@ -94,6 +95,7 @@
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddRadioActionsFull']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddToggleActions']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'AddToggleActionsFull']" name=3D"hidden">1</attr>
+  <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'ListActions']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkActionGroup']/method[@n=
ame=3D'RemoveAction']" name=3D"name">Remove</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkAdjustment']/constructo=
r[@cname=3D'gtk_adjustment_new']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkAdjustment']/method[@na=
me=3D'Changed']" name=3D"name">Change</attr>
@@ -329,6 +331,8 @@
   <attr path=3D"/api/namespace/object[@cname=3D'GtkTreeView']/method[@name=
=3D'ScrollToCell']/*/*[@type=3D'GtkTreeViewColumn*']" name=3D"null_ok">1</a=
ttr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkTreeView']/method[@name=
=3D'SetModel']/*/*[@type=3D'GtkTreeModel*']" name=3D"null_ok">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkTreeView']/signal[@name=
=3D'SetScrollAdjustments']" name=3D"name">ScrollAdjustmentsSet</attr>
+  <attr path=3D"/api/namespace/object[@cname=3D'GtkUIManager']/method[@cna=
me=3D'gtk_ui_manager_get_action_groups']" name=3D"hidden">1</attr>
+  <attr path=3D"/api/namespace/object[@cname=3D'GtkUIManager']/method[@nam=
e=3D'GetToplevels']" name=3D"hidden">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkViewport']/constructor[=
@cname=3D'gtk_viewport_new']/*/*[@type=3D'GtkAdjustment*']" name=3D"null_ok=
">1</attr>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkViewport']/method[@name=
=3D'SetHadjustment']/*/*[@type=3D'GtkAdjustment*']" name=3D"null_ok">1</att=
r>
   <attr path=3D"/api/namespace/object[@cname=3D'GtkViewport']/method[@name=
=3D'SetVadjustment']/*/*[@type=3D'GtkAdjustment*']" name=3D"null_ok">1</att=
r>
Index: gtk/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- gtk/Makefile.am=09(revision 36107)
+++ gtk/Makefile.am=09(working copy)
@@ -31,6 +31,7 @@
 =09Accel.custom=09=09=09\
 =09AccelKey.custom=09=09=09\
 =09Action.custom=09=09=09\
+=09ActionGroup.custom=09=09\
 =09Adjustment.custom=09=09\
 =09Bin.custom=09=09=09\
 =09Button.custom=09=09=09\

------=_Part_215_33259816.1100464694068--