[Java-gnome-developer] Glade.XML.CustomHandler is implemented?
Brought to you by:
afcowie
From: Khiraly <khi...@gm...> - 2006-05-11 18:44:37
|
Hi! Is Glade.XML.CustomHandler implemented? I want to port an application to what is written in C# and glade and using custom widgets. I have looked into the libglade-java source and not found anything related to this method. Here are some C# sourcecode what is using this glade method call: http://svn.myrealbox.com/source/trunk/stetic/stetic/Stetic.cs http://svn.navi.cx/misc/trunk/fyre/src/PipelineEditor.cs There is a workaround for this? Best regards, Khiraly ps: And the sourcecode what Im looking in: /* * Copyright (C) 2006 Eskil Bylund <es...@le...> * * This program 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 2 of the License, or * (at your option) any later version. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ using System; using Gtk; using Mono.Unix; namespace DCSharp.GUI { public class GUI { #region Constructors static GUI() { Application.Init(); string localeDir = Environment.GetEnvironmentVariable("DCSHARP_LOCALE"); if (localeDir == null) { localeDir = "./locale"; } Catalog.Init("dcsharp", localeDir); InitIcons(); #if GNOME Gnome.Vfs.Vfs.Initialize(); AboutDialog.SetUrlHook(OpenUrl); #endif Glade.XML.CustomHandler = new Glade.XMLCustomWidgetHandler(CustomWidgetHandler); } public GUI() { mainWindow = new MainWindow(); mainWindow.Show(); } #endregion #region Properties private MainWindow mainWindow; public MainWindow MainWindow { get { return mainWindow; } } #endregion #region Methods public void Run() { Application.Run(); } private static void InitIcons() { Invisible widget = new Invisible(); //Window.DefaultIcon = Gdk.Pixbuf.LoadFromResource("Logo.png"); Window.DefaultIconList = new Gdk.Pixbuf[] { widget.RenderIcon(Stock.Network, IconSize.Menu, null), widget.RenderIcon(Stock.Network, IconSize.Dialog, null) }; IconFactory iconFactory = new IconFactory(); string[] icons = {"user-online", "user-offline", "user-passive"}; foreach (string icon in icons) { IconSource source = new IconSource(); source.Pixbuf = Gdk.Pixbuf.LoadFromResource(icon + ".png"); IconSet iconSet = new IconSet(); iconSet.AddSource(source); iconFactory.Add(icon, iconSet); } iconFactory.AddDefault(); } #if GNOME private static void OpenUrl(Gtk.AboutDialog about, string url) { Gnome.Url.Show(url); } #endif private static Widget CustomWidgetHandler(Glade.XML xml, string funcName, string name, string string1, string string2, int int1, int int2) { switch (funcName) { case "ChatView": return new ChatView(); case "HistoryEntry": return new HistoryEntry(); case "SearchFileTypeComboBox": return new SearchFileTypeComboBox(); case "SearchResultView": return new SearchResultView(); case "UserView": return new UserView(); default: return null; } } #endregion } } |