зеркало из https://github.com/mono/mail-archives.git
378 строки
14 KiB
HTML
378 строки
14 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Gnome# Hello World
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:farrisg%40mala.bc.ca">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="000909.html">
|
|
<LINK REL="Next" HREF="000893.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Gnome# Hello World
|
|
</H1>
|
|
<B>George Farris
|
|
</B>
|
|
<A HREF="mailto:farrisg%40mala.bc.ca"
|
|
TITLE="[Gtk-sharp-list] Gnome# Hello World">farrisg@mala.bc.ca
|
|
</A><BR>
|
|
<I>05 Feb 2003 09:22:49 -0800</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="000909.html">[Gtk-sharp-list] Gnome# Hello World - Revised Version 2
|
|
</A></li>
|
|
<LI> Next message: <A HREF="000893.html">[Gtk-sharp-list] Gnome# Hello World
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#890">[ date ]</a>
|
|
<a href="thread.html#890">[ thread ]</a>
|
|
<a href="subject.html#890">[ subject ]</a>
|
|
<a href="author.html#890">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>How about something like this:
|
|
Possibly a smaller glade file for the example would be better.
|
|
|
|
|
|
Makefile ------------------------------------------------
|
|
|
|
MCS = mcs
|
|
RESOURCES = /resource:./hello.glade,hello.glade
|
|
REFERENCES = -r gnome-sharp -r gtk-sharp -r glib-sharp -r glade-sharp -r
|
|
gdk-sharp
|
|
SOURCES = hello.cs
|
|
|
|
all: hello.exe
|
|
|
|
hello.exe: $(SOURCES)
|
|
$(MCS) $(RESOURCES) -o $@ $(SOURCES) $(REFERENCES)
|
|
|
|
clean:
|
|
-rm *.exe *.bak *~
|
|
|
|
|
|
hello.cs file -------------------------------------------------
|
|
|
|
namespace hello {
|
|
using System;
|
|
using System.IO;
|
|
using GLib;
|
|
using Gtk;
|
|
using Gnome;
|
|
using Glade;
|
|
using GtkSharp;
|
|
|
|
public class hello : Program
|
|
{
|
|
Glade.XML gxml;
|
|
|
|
public static void Main (string[] args)
|
|
{
|
|
hello a = new hello (args);
|
|
|
|
}
|
|
|
|
public hello (string[] args)
|
|
: base ("hello", "0.1", Modules.UI, args, new object [0])
|
|
{
|
|
Application.Init ();
|
|
gxml = new Glade.XML (null, "hello.glade", "app1", null);
|
|
gxml.Autoconnect (this);
|
|
Application.Run ();
|
|
}
|
|
|
|
//
|
|
// Glade callbacks that are auto connected
|
|
//
|
|
private void on_quit1_activate (object o, EventArgs args)
|
|
{
|
|
Console.WriteLine("Goodbye...");
|
|
Application.Quit ();
|
|
}
|
|
|
|
private void on_app1_delete_event (object o, DeleteEventArgs args)
|
|
{
|
|
Application.Quit ();
|
|
args.RetVal = true;
|
|
}
|
|
|
|
private void on_about1_activate (object o, EventArgs args)
|
|
{
|
|
Gdk.Pixbuf icon = new Gdk.Pixbuf ("/usr/share/pixmaps" +
|
|
Path.DirectorySeparatorChar + "gnome-logo-icon.png");
|
|
string[] authors = new string[] { "Your Name <<A HREF="mailto:email@anon.com">email@anon.com</A>>" };
|
|
string[] documentors = new string[] {};
|
|
About about = new About ("", "", "Copyright (C) 2003 Your Name
|
|
<<A HREF="mailto:email@anon.com">email@anon.com</A>>", "A Test application for GNOME", authors, documentors,
|
|
"", icon);
|
|
about.Show ();
|
|
|
|
}
|
|
|
|
private void on_newButton_clicked (object o, EventArgs args)
|
|
{
|
|
Console.WriteLine("[New] button clicked");
|
|
}
|
|
|
|
private void on_openButton_clicked (object o, EventArgs args)
|
|
{
|
|
Console.WriteLine("[Open] button clicked");
|
|
}
|
|
|
|
private void on_saveButton_clicked (object o, EventArgs args)
|
|
{
|
|
Console.WriteLine("[Save] button clicked");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Glade file ------------------------------------------
|
|
|
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
|
<!DOCTYPE glade-interface SYSTEM "<A HREF="http://glade.gnome.org/glade-2.0.dtd"">http://glade.gnome.org/glade-2.0.dtd"</A>>
|
|
|
|
<glade-interface>
|
|
<requires lib="gnome"/>
|
|
<requires lib="bonobo"/>
|
|
|
|
<widget class="GnomeApp" id="app1">
|
|
<property name="visible">True</property>
|
|
<property name="title" translatable="yes">Test.glade</property>
|
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
|
<property name="modal">False</property>
|
|
<property name="resizable">True</property>
|
|
<property name="destroy_with_parent">False</property>
|
|
<property name="enable_layout_config">True</property>
|
|
<signal name="delete_event" handler="on_app1_delete_event"
|
|
last_modification_time="Mon, 27 Jan 2003 21:23:47 GMT"/>
|
|
|
|
<child internal-child="dock">
|
|
<widget class="BonoboDock" id="bonobodock1">
|
|
<property name="visible">True</property>
|
|
<property name="allow_floating">True</property>
|
|
|
|
<child>
|
|
<widget class="BonoboDockItem" id="bonobodockitem1">
|
|
<property name="visible">True</property>
|
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
|
|
|
<child>
|
|
<widget class="GtkMenuBar" id="menubar1">
|
|
<property name="visible">True</property>
|
|
|
|
<child>
|
|
<widget class="GtkMenuItem" id="file1">
|
|
<property name="visible">True</property>
|
|
<property name="stock_item">GNOMEUIINFO_MENU_FILE_TREE</property>
|
|
|
|
<child>
|
|
<widget class="GtkMenu" id="file1_menu">
|
|
|
|
<child>
|
|
<widget class="GtkMenuItem" id="separator1">
|
|
<property name="visible">True</property>
|
|
</widget>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="GtkImageMenuItem" id="quit1">
|
|
<property name="visible">True</property>
|
|
<property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property>
|
|
<signal name="activate" handler="on_quit1_activate"
|
|
last_modification_time="Mon, 27 Jan 2003 21:10:35 GMT"/>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="GtkMenuItem" id="help1">
|
|
<property name="visible">True</property>
|
|
<property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property>
|
|
|
|
<child>
|
|
<widget class="GtkMenu" id="help1_menu">
|
|
|
|
<child>
|
|
<widget class="GtkImageMenuItem" id="about1">
|
|
<property name="visible">True</property>
|
|
<property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
|
|
<signal name="activate" handler="on_about1_activate"
|
|
last_modification_time="Mon, 27 Jan 2003 21:10:35 GMT"/>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
<packing>
|
|
<property name="placement">BONOBO_DOCK_TOP</property>
|
|
<property name="band">0</property>
|
|
<property name="position">0</property>
|
|
<property name="offset">0</property>
|
|
<property
|
|
name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED</property>
|
|
</packing>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="BonoboDockItem" id="bonobodockitem2">
|
|
<property name="visible">True</property>
|
|
<property name="shadow_type">GTK_SHADOW_OUT</property>
|
|
|
|
<child>
|
|
<widget class="GtkToolbar" id="toolbar1">
|
|
<property name="border_width">1</property>
|
|
<property name="visible">True</property>
|
|
<property
|
|
name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
|
<property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
|
|
<property name="tooltips">True</property>
|
|
|
|
<child>
|
|
<widget class="button" id="newButton">
|
|
<property name="visible">True</property>
|
|
<property name="tooltip" translatable="yes">New File</property>
|
|
<property name="label">gtk-new</property>
|
|
<property name="use_stock">True</property>
|
|
<signal name="clicked" handler="on_newButton_clicked"
|
|
last_modification_time="Wed, 29 Jan 2003 04:31:30 GMT"/>
|
|
</widget>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="button" id="openButton">
|
|
<property name="visible">True</property>
|
|
<property name="tooltip" translatable="yes">Open File</property>
|
|
<property name="label">gtk-open</property>
|
|
<property name="use_stock">True</property>
|
|
<signal name="clicked" handler="on_openButton_clicked"
|
|
last_modification_time="Wed, 29 Jan 2003 04:31:08 GMT"/>
|
|
</widget>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="button" id="saveButton">
|
|
<property name="visible">True</property>
|
|
<property name="tooltip" translatable="yes">Save File</property>
|
|
<property name="label">gtk-save</property>
|
|
<property name="use_stock">True</property>
|
|
<signal name="clicked" handler="on_saveButton_clicked"
|
|
last_modification_time="Wed, 29 Jan 2003 04:31:49 GMT"/>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
<packing>
|
|
<property name="placement">BONOBO_DOCK_TOP</property>
|
|
<property name="band">1</property>
|
|
<property name="position">0</property>
|
|
<property name="offset">0</property>
|
|
<property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE</property>
|
|
</packing>
|
|
</child>
|
|
|
|
<child>
|
|
<widget class="GtkLabel" id="label1">
|
|
<property name="visible">True</property>
|
|
<property name="label" translatable="yes">Hello World</property>
|
|
<property name="use_underline">False</property>
|
|
<property name="use_markup">False</property>
|
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
<property name="wrap">False</property>
|
|
<property name="selectable">False</property>
|
|
<property name="xalign">0.5</property>
|
|
<property name="yalign">0.5</property>
|
|
<property name="xpad">0</property>
|
|
<property name="ypad">0</property>
|
|
</widget>
|
|
</child>
|
|
</widget>
|
|
<packing>
|
|
<property name="padding">0</property>
|
|
<property name="expand">True</property>
|
|
<property name="fill">True</property>
|
|
</packing>
|
|
</child>
|
|
|
|
<child internal-child="appbar">
|
|
<widget class="GnomeAppBar" id="appbar1">
|
|
<property name="visible">True</property>
|
|
<property name="has_progress">True</property>
|
|
<property name="has_status">True</property>
|
|
</widget>
|
|
<packing>
|
|
<property name="padding">0</property>
|
|
<property name="expand">True</property>
|
|
<property name="fill">True</property>
|
|
</packing>
|
|
</child>
|
|
</widget>
|
|
|
|
</glade-interface>
|
|
|
|
|
|
|
|
On Tue, 2003-02-04 at 23:52, Charles Iliya Krempeaux wrote:
|
|
><i> Hello,
|
|
</I>><i>
|
|
</I>><i> I don't know if anyone has done this yet (on the MonkeyGuide),
|
|
</I>><i> but they might find this useful. Also, people just getting
|
|
</I>><i> into Gtk# might find this useful too. It is a Hello World program
|
|
</I>><i> for Gnome#. (Similar to the Gtk# one.)
|
|
</I>><i>
|
|
</I>><i> class Hello
|
|
</I>><i> {
|
|
</I>><i> static Main()
|
|
</I>><i> {
|
|
</I>><i> Gtk.Application.Init();
|
|
</I>><i>
|
|
</I>><i> Gnome.App app = new Gnome.App("Hello World", "Hello World");
|
|
</I>><i> app.Show();
|
|
</I>><i>
|
|
</I>><i> Gtk.Application.Run();
|
|
</I>><i> }
|
|
</I>><i> }
|
|
</I>><i>
|
|
</I>><i>
|
|
</I>><i> Although I am not really sure if "Gtk.Application.Init()" and
|
|
</I>><i> "Gtk.Application.Run()" are suppose to be called. (Or if a
|
|
</I>><i> GNOME equivalent is suppose to be called.)
|
|
</I>><i>
|
|
</I>><i> (BTW, does anyone know when the GNOME 2 API docs are going to be
|
|
</I>><i> put on the developer.gnome.org website???)
|
|
</I>><i>
|
|
</I>><i>
|
|
</I>><i> See ya
|
|
</I>--
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="000909.html">[Gtk-sharp-list] Gnome# Hello World - Revised Version 2
|
|
</A></li>
|
|
<LI> Next message: <A HREF="000893.html">[Gtk-sharp-list] Gnome# Hello World
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#890">[ date ]</a>
|
|
<a href="thread.html#890">[ thread ]</a>
|
|
<a href="subject.html#890">[ subject ]</a>
|
|
<a href="author.html#890">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|