2001-06-04 23:15:51 +00:00
|
|
|
/* Application main window
|
|
|
|
*
|
2005-06-19 03:20:07 +00:00
|
|
|
* Demonstrates a typical application window with menubar, toolbar, statusbar.
|
2001-06-04 23:15:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2005-10-12 13:23:10 +00:00
|
|
|
#include "config.h"
|
2001-11-23 21:46:44 +00:00
|
|
|
#include "demo-common.h"
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
static GtkWidget *window = NULL;
|
2009-06-05 18:56:08 +00:00
|
|
|
static GtkWidget *infobar = NULL;
|
|
|
|
static GtkWidget *messagelabel = NULL;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
static void
|
2003-08-24 19:58:30 +00:00
|
|
|
activate_action (GtkAction *action)
|
2001-06-04 23:15:51 +00:00
|
|
|
{
|
2003-08-24 19:58:30 +00:00
|
|
|
const gchar *name = gtk_action_get_name (action);
|
|
|
|
const gchar *typename = G_OBJECT_TYPE_NAME (action);
|
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
GtkWidget *dialog;
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
2001-06-04 23:15:51 +00:00
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_CLOSE,
|
2003-08-24 19:58:30 +00:00
|
|
|
"You activated action: \"%s\" of type \"%s\"",
|
|
|
|
name, typename);
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
/* Close dialog on user response */
|
2002-09-29 21:24:24 +00:00
|
|
|
g_signal_connect (dialog,
|
2001-06-29 16:30:25 +00:00
|
|
|
"response",
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
NULL);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
static void
|
|
|
|
activate_radio_action (GtkAction *action, GtkRadioAction *current)
|
|
|
|
{
|
|
|
|
const gchar *name = gtk_action_get_name (GTK_ACTION (current));
|
|
|
|
const gchar *typename = G_OBJECT_TYPE_NAME (GTK_ACTION (current));
|
|
|
|
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current));
|
|
|
|
gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
if (active)
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{
|
2009-06-05 18:56:08 +00:00
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
text = g_strdup_printf ("You activated radio action: \"%s\" of type \"%s\".\n"
|
|
|
|
"Current value: %d",
|
|
|
|
name, typename, value);
|
|
|
|
gtk_label_set_text (GTK_LABEL (messagelabel), text);
|
|
|
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), (GtkMessageType)value);
|
|
|
|
gtk_widget_show (infobar);
|
|
|
|
g_free (text);
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
static void
|
2004-07-12 21:50:18 +00:00
|
|
|
activate_email (GtkAboutDialog *about,
|
2004-08-19 00:25:27 +00:00
|
|
|
const gchar *link,
|
|
|
|
gpointer data)
|
2004-07-12 21:50:18 +00:00
|
|
|
{
|
2009-06-05 18:56:08 +00:00
|
|
|
gchar *text;
|
|
|
|
text = g_strdup_printf ("send mail to %s", link);
|
|
|
|
g_print ("%s\n", text);
|
|
|
|
g_free (text);
|
2004-07-12 21:50:18 +00:00
|
|
|
}
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
static void
|
2004-07-12 21:50:18 +00:00
|
|
|
activate_url (GtkAboutDialog *about,
|
2004-08-19 00:25:27 +00:00
|
|
|
const gchar *link,
|
|
|
|
gpointer data)
|
2004-07-12 21:50:18 +00:00
|
|
|
{
|
|
|
|
g_print ("show url %s\n", link);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
about_cb (GtkAction *action,
|
|
|
|
GtkWidget *window)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf, *transparent;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
const gchar *authors[] = {
|
|
|
|
"Peter Mattis",
|
|
|
|
"Spencer Kimball",
|
|
|
|
"Josh MacDonald",
|
|
|
|
"and many more...",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
const gchar *documentors[] = {
|
|
|
|
"Owen Taylor",
|
|
|
|
"Tony Gale",
|
|
|
|
"Matthias Clasen <mclasen@redhat.com>",
|
|
|
|
"and many more...",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
const gchar *license =
|
|
|
|
"This library is free software; you can redistribute it and/or\n"
|
|
|
|
"modify it under the terms of the GNU Library General Public License as\n"
|
|
|
|
"published by the Free Software Foundation; either version 2 of the\n"
|
|
|
|
"License, or (at your option) any later version.\n"
|
|
|
|
"\n"
|
|
|
|
"This library is distributed in the hope that it will be useful,\n"
|
|
|
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
|
|
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
|
|
|
|
"Library General Public License for more details.\n"
|
|
|
|
"\n"
|
|
|
|
"You should have received a copy of the GNU Library General Public\n"
|
|
|
|
"License along with the Gnome Library; see the file COPYING.LIB. If not,\n"
|
|
|
|
"write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"
|
|
|
|
"Boston, MA 02111-1307, USA.\n";
|
|
|
|
|
|
|
|
pixbuf = NULL;
|
|
|
|
transparent = NULL;
|
|
|
|
filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
|
|
|
|
if (filename)
|
|
|
|
{
|
|
|
|
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
|
|
|
g_free (filename);
|
|
|
|
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
|
2004-08-13 01:10:38 +00:00
|
|
|
gtk_about_dialog_set_email_hook (activate_email, NULL, NULL);
|
|
|
|
gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
|
2004-07-12 21:50:18 +00:00
|
|
|
gtk_show_about_dialog (GTK_WINDOW (window),
|
2009-03-01 05:19:42 +00:00
|
|
|
"program-name", "GTK+ Code Demos",
|
2005-10-12 13:23:10 +00:00
|
|
|
"version", PACKAGE_VERSION,
|
2009-03-01 05:19:42 +00:00
|
|
|
"copyright", "(C) 1997-2009 The GTK+ Team",
|
2004-07-12 21:50:18 +00:00
|
|
|
"license", license,
|
|
|
|
"website", "http://www.gtk.org",
|
|
|
|
"comments", "Program to demonstrate GTK+ functions.",
|
|
|
|
"authors", authors,
|
|
|
|
"documenters", documentors,
|
|
|
|
"logo", transparent,
|
2007-03-19 05:35:51 +00:00
|
|
|
"title", "About GTK+ Code Demos",
|
2004-07-12 21:50:18 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_object_unref (transparent);
|
|
|
|
}
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
typedef struct
|
2005-06-19 03:20:07 +00:00
|
|
|
{
|
|
|
|
GtkAction action;
|
|
|
|
} ToolMenuAction;
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
typedef struct
|
2005-06-19 03:20:07 +00:00
|
|
|
{
|
|
|
|
GtkActionClass parent_class;
|
|
|
|
} ToolMenuActionClass;
|
|
|
|
|
2006-10-08 05:07:55 +00:00
|
|
|
G_DEFINE_TYPE(ToolMenuAction, tool_menu_action, GTK_TYPE_ACTION)
|
2005-06-19 03:20:07 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
tool_menu_action_class_init (ToolMenuActionClass *class)
|
|
|
|
{
|
|
|
|
GTK_ACTION_CLASS (class)->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
tool_menu_action_init (ToolMenuAction *action)
|
|
|
|
{
|
|
|
|
}
|
2001-06-04 23:15:51 +00:00
|
|
|
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
static GtkActionEntry entries[] = {
|
|
|
|
{ "FileMenu", NULL, "_File" }, /* name, stock id, label */
|
2005-06-19 03:20:07 +00:00
|
|
|
{ "OpenMenu", NULL, "_Open" }, /* name, stock id, label */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "PreferencesMenu", NULL, "_Preferences" }, /* name, stock id, label */
|
|
|
|
{ "ColorMenu", NULL, "_Color" }, /* name, stock id, label */
|
|
|
|
{ "ShapeMenu", NULL, "_Shape" }, /* name, stock id, label */
|
|
|
|
{ "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
|
|
|
|
{ "New", GTK_STOCK_NEW, /* name, stock id */
|
|
|
|
"_New", "<control>N", /* label, accelerator */
|
2009-06-05 18:56:08 +00:00
|
|
|
"Create a new file", /* tooltip */
|
|
|
|
G_CALLBACK (activate_action) },
|
2005-06-19 03:20:07 +00:00
|
|
|
{ "File1", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"File1", NULL, /* label, accelerator */
|
2005-06-19 03:20:07 +00:00
|
|
|
"Open first file", /* tooltip */
|
2009-06-05 18:56:08 +00:00
|
|
|
G_CALLBACK (activate_action) },
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "Save", GTK_STOCK_SAVE, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Save","<control>S", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Save current file", /* tooltip */
|
2003-08-25 23:13:47 +00:00
|
|
|
G_CALLBACK (activate_action) },
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"Save _As...", NULL, /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Save to a file", /* tooltip */
|
2003-08-25 23:13:47 +00:00
|
|
|
G_CALLBACK (activate_action) },
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "Quit", GTK_STOCK_QUIT, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Quit", "<control>Q", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Quit", /* tooltip */
|
2003-08-25 23:13:47 +00:00
|
|
|
G_CALLBACK (activate_action) },
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "About", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_About", "<control>A", /* label, accelerator */
|
|
|
|
"About", /* tooltip */
|
2004-07-12 21:50:18 +00:00
|
|
|
G_CALLBACK (about_cb) },
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
{ "Logo", "demo-gtk-logo", /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
NULL, NULL, /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"GTK+", /* tooltip */
|
2003-08-25 23:13:47 +00:00
|
|
|
G_CALLBACK (activate_action) },
|
2001-06-04 23:15:51 +00:00
|
|
|
};
|
2003-08-24 19:58:30 +00:00
|
|
|
static guint n_entries = G_N_ELEMENTS (entries);
|
|
|
|
|
2003-09-15 19:51:55 +00:00
|
|
|
|
|
|
|
static GtkToggleActionEntry toggle_entries[] = {
|
|
|
|
{ "Bold", GTK_STOCK_BOLD, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Bold", "<control>B", /* label, accelerator */
|
2003-09-15 19:51:55 +00:00
|
|
|
"Bold", /* tooltip */
|
2009-06-05 18:56:08 +00:00
|
|
|
G_CALLBACK (activate_action),
|
2003-09-15 19:51:55 +00:00
|
|
|
TRUE }, /* is_active */
|
|
|
|
};
|
|
|
|
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
|
|
|
|
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
enum {
|
|
|
|
COLOR_RED,
|
|
|
|
COLOR_GREEN,
|
|
|
|
COLOR_BLUE
|
|
|
|
};
|
|
|
|
|
|
|
|
static GtkRadioActionEntry color_entries[] = {
|
|
|
|
{ "Red", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Red", "<control>R", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Blood", COLOR_RED }, /* tooltip, value */
|
|
|
|
{ "Green", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Green", "<control>G", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Grass", COLOR_GREEN }, /* tooltip, value */
|
|
|
|
{ "Blue", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Blue", "<control>B", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Sky", COLOR_BLUE }, /* tooltip, value */
|
|
|
|
};
|
|
|
|
static guint n_color_entries = G_N_ELEMENTS (color_entries);
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SHAPE_SQUARE,
|
|
|
|
SHAPE_RECTANGLE,
|
2004-07-21 02:30:19 +00:00
|
|
|
SHAPE_OVAL
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static GtkRadioActionEntry shape_entries[] = {
|
|
|
|
{ "Square", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Square", "<control>S", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Square", SHAPE_SQUARE }, /* tooltip, value */
|
|
|
|
{ "Rectangle", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Rectangle", "<control>R", /* label, accelerator */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
"Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
|
|
|
|
{ "Oval", NULL, /* name, stock id */
|
2009-06-05 18:56:08 +00:00
|
|
|
"_Oval", "<control>O", /* label, accelerator */
|
|
|
|
"Egg", SHAPE_OVAL }, /* tooltip, value */
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
};
|
|
|
|
static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
static const gchar *ui_info =
|
2003-08-26 00:13:59 +00:00
|
|
|
"<ui>"
|
|
|
|
" <menubar name='MenuBar'>"
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
" <menu action='FileMenu'>"
|
|
|
|
" <menuitem action='New'/>"
|
|
|
|
" <menuitem action='Open'/>"
|
|
|
|
" <menuitem action='Save'/>"
|
|
|
|
" <menuitem action='SaveAs'/>"
|
|
|
|
" <separator/>"
|
|
|
|
" <menuitem action='Quit'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </menu>"
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
" <menu action='PreferencesMenu'>"
|
|
|
|
" <menu action='ColorMenu'>"
|
|
|
|
" <menuitem action='Red'/>"
|
|
|
|
" <menuitem action='Green'/>"
|
|
|
|
" <menuitem action='Blue'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </menu>"
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
" <menu action='ShapeMenu'>"
|
|
|
|
" <menuitem action='Square'/>"
|
|
|
|
" <menuitem action='Rectangle'/>"
|
|
|
|
" <menuitem action='Oval'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </menu>"
|
2003-09-15 19:51:55 +00:00
|
|
|
" <menuitem action='Bold'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </menu>"
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
" <menu action='HelpMenu'>"
|
|
|
|
" <menuitem action='About'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </menu>"
|
|
|
|
" </menubar>"
|
2005-06-19 03:20:07 +00:00
|
|
|
" <toolbar name='ToolBar'>"
|
|
|
|
" <toolitem action='Open'>"
|
|
|
|
" <menu action='OpenMenu'>"
|
|
|
|
" <menuitem action='File1'/>"
|
2009-06-05 18:56:08 +00:00
|
|
|
" </menu>"
|
2005-06-19 03:20:07 +00:00
|
|
|
" </toolitem>"
|
Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Change the XML format:
<Root> element is replaced by <ui>,
<menu> element is replaced by <menubar>,
<submenu> element is replaced by <menu>,
<dockitem> element is replaced by <toolbar>,
<popups> element is gone,
verb attribute is replaced by action,
name defaults to action or the element name.
* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
and GtkRadioActionEntry. GtkActionEntry is simplified by removing
the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
further simplified by removing the callback. The user_data can now be
specified as an argument to gtk_action_group_add_actions(). There is
a new method gtk_action_group_add_radio_actions(), which is similar
to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
and a callback parameter in addition to the user_data. The callback
is connected to the ::changed signal of the first group member.
There are _full() variants taking a GDestroyNotify of
gtk_action_group_add_[radio_]actions().
* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
on every member of the radio group when the active member is changed.
Add an integer property "value", and a getter for the value of "value"
on the currently active group member.
* tests/testactions.c:
* tests/testmerge.c:
* tests/merge-[123].ui:
* demos/gtk-demo/appwindow.c: Adjust to these changes.
* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +00:00
|
|
|
" <toolitem action='Quit'/>"
|
|
|
|
" <separator action='Sep1'/>"
|
|
|
|
" <toolitem action='Logo'/>"
|
2003-08-26 00:13:59 +00:00
|
|
|
" </toolbar>"
|
|
|
|
"</ui>";
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This function registers our custom toolbar icons, so they can be themed.
|
|
|
|
*
|
|
|
|
* It's totally optional to do this, you could just manually insert icons
|
|
|
|
* and have them not be themeable, especially if you never expect people
|
|
|
|
* to theme your app.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
register_stock_icons (void)
|
|
|
|
{
|
|
|
|
static gboolean registered = FALSE;
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
if (!registered)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GtkIconFactory *factory;
|
2001-11-23 21:46:44 +00:00
|
|
|
char *filename;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
static GtkStockItem items[] = {
|
|
|
|
{ "demo-gtk-logo",
|
|
|
|
"_GTK!",
|
|
|
|
0, 0, NULL }
|
|
|
|
};
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
registered = TRUE;
|
|
|
|
|
|
|
|
/* Register our stock items */
|
|
|
|
gtk_stock_add (items, G_N_ELEMENTS (items));
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
/* Add our custom icon factory to the list of defaults */
|
|
|
|
factory = gtk_icon_factory_new ();
|
|
|
|
gtk_icon_factory_add_default (factory);
|
|
|
|
|
2006-09-25 14:48:31 +00:00
|
|
|
/* demo_find_file() looks in the current directory first,
|
2001-11-23 21:46:44 +00:00
|
|
|
* so you can run gtk-demo without installing GTK, then looks
|
|
|
|
* in the location where the file is installed.
|
|
|
|
*/
|
|
|
|
pixbuf = NULL;
|
|
|
|
filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
|
|
|
|
if (filename)
|
|
|
|
{
|
|
|
|
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
/* Register icon to accompany stock item */
|
|
|
|
if (pixbuf != NULL)
|
|
|
|
{
|
|
|
|
GtkIconSet *icon_set;
|
|
|
|
GdkPixbuf *transparent;
|
|
|
|
|
|
|
|
/* The gtk-logo-rgb icon has a white background, make it transparent */
|
|
|
|
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
icon_set = gtk_icon_set_new_from_pixbuf (transparent);
|
|
|
|
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
|
|
|
gtk_icon_set_unref (icon_set);
|
2002-09-29 21:24:24 +00:00
|
|
|
g_object_unref (pixbuf);
|
|
|
|
g_object_unref (transparent);
|
2001-06-04 23:15:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
g_warning ("failed to load GTK logo for toolbar");
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
/* Drop our reference to the factory, GTK will hold a reference. */
|
2002-09-29 21:24:24 +00:00
|
|
|
g_object_unref (factory);
|
2001-06-04 23:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_statusbar (GtkTextBuffer *buffer,
|
|
|
|
GtkStatusbar *statusbar)
|
|
|
|
{
|
|
|
|
gchar *msg;
|
|
|
|
gint row, col;
|
|
|
|
gint count;
|
|
|
|
GtkTextIter iter;
|
2009-06-05 18:56:08 +00:00
|
|
|
|
|
|
|
gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
|
|
|
|
* underflow is allowed
|
2005-07-04 05:51:08 +00:00
|
|
|
*/
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
count = gtk_text_buffer_get_char_count (buffer);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer,
|
|
|
|
&iter,
|
|
|
|
gtk_text_buffer_get_insert (buffer));
|
|
|
|
|
|
|
|
row = gtk_text_iter_get_line (&iter);
|
|
|
|
col = gtk_text_iter_get_line_offset (&iter);
|
|
|
|
|
|
|
|
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
|
|
|
|
row, col, count);
|
|
|
|
|
|
|
|
gtk_statusbar_push (statusbar, 0, msg);
|
|
|
|
|
|
|
|
g_free (msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_set_callback (GtkTextBuffer *buffer,
|
|
|
|
const GtkTextIter *new_location,
|
|
|
|
GtkTextMark *mark,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
update_statusbar (buffer, GTK_STATUSBAR (data));
|
|
|
|
}
|
|
|
|
|
2003-08-07 23:03:41 +00:00
|
|
|
static void
|
|
|
|
update_resize_grip (GtkWidget *widget,
|
|
|
|
GdkEventWindowState *event,
|
|
|
|
GtkStatusbar *statusbar)
|
|
|
|
{
|
2009-06-05 18:56:08 +00:00
|
|
|
if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED |
|
2005-07-04 05:51:08 +00:00
|
|
|
GDK_WINDOW_STATE_FULLSCREEN))
|
|
|
|
{
|
|
|
|
gboolean maximized;
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
maximized = event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
|
2005-07-04 05:51:08 +00:00
|
|
|
GDK_WINDOW_STATE_FULLSCREEN);
|
|
|
|
gtk_statusbar_set_has_resize_grip (statusbar, !maximized);
|
|
|
|
}
|
2003-08-07 23:03:41 +00:00
|
|
|
}
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2003-08-07 23:03:41 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
GtkWidget *
|
2003-11-08 22:08:05 +00:00
|
|
|
do_appwindow (GtkWidget *do_widget)
|
2009-06-05 18:56:08 +00:00
|
|
|
{
|
2001-06-04 23:15:51 +00:00
|
|
|
if (!window)
|
|
|
|
{
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *statusbar;
|
|
|
|
GtkWidget *contents;
|
|
|
|
GtkWidget *sw;
|
2003-08-25 23:13:47 +00:00
|
|
|
GtkWidget *bar;
|
2001-06-04 23:15:51 +00:00
|
|
|
GtkTextBuffer *buffer;
|
2003-08-24 19:58:30 +00:00
|
|
|
GtkActionGroup *action_group;
|
2005-06-19 03:20:07 +00:00
|
|
|
GtkAction *open_action;
|
2003-08-25 23:13:47 +00:00
|
|
|
GtkUIManager *merge;
|
2003-08-24 19:58:30 +00:00
|
|
|
GError *error = NULL;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
register_stock_icons ();
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
/* Create the toplevel window
|
|
|
|
*/
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
2003-11-08 22:08:05 +00:00
|
|
|
gtk_window_set_screen (GTK_WINDOW (window),
|
|
|
|
gtk_widget_get_screen (do_widget));
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
|
2005-05-25 20:01:47 +00:00
|
|
|
gtk_window_set_icon_name (GTK_WINDOW (window), "gtk-open");
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
/* NULL window variable when window is closed */
|
2002-09-29 21:24:24 +00:00
|
|
|
g_signal_connect (window, "destroy",
|
2001-06-29 16:30:25 +00:00
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&window);
|
2001-06-04 23:15:51 +00:00
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
table = gtk_table_new (1, 5, FALSE);
|
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), table);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/* Create the menubar and toolbar
|
2001-06-04 23:15:51 +00:00
|
|
|
*/
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
action_group = gtk_action_group_new ("AppWindowActions");
|
2009-06-05 18:56:08 +00:00
|
|
|
open_action = g_object_new (tool_menu_action_get_type (),
|
2005-06-19 03:20:07 +00:00
|
|
|
"name", "Open",
|
|
|
|
"label", "_Open",
|
|
|
|
"tooltip", "Open a file",
|
|
|
|
"stock-id", GTK_STOCK_OPEN,
|
|
|
|
NULL);
|
|
|
|
gtk_action_group_add_action (action_group, open_action);
|
2006-12-23 02:39:45 +00:00
|
|
|
g_object_unref (open_action);
|
2009-06-05 18:56:08 +00:00
|
|
|
gtk_action_group_add_actions (action_group,
|
|
|
|
entries, n_entries,
|
2004-07-12 21:50:18 +00:00
|
|
|
window);
|
2009-06-05 18:56:08 +00:00
|
|
|
gtk_action_group_add_toggle_actions (action_group,
|
|
|
|
toggle_entries, n_toggle_entries,
|
2003-09-15 19:51:55 +00:00
|
|
|
NULL);
|
2009-06-05 18:56:08 +00:00
|
|
|
gtk_action_group_add_radio_actions (action_group,
|
|
|
|
color_entries, n_color_entries,
|
2003-09-15 19:51:55 +00:00
|
|
|
COLOR_RED,
|
2009-06-05 18:56:08 +00:00
|
|
|
G_CALLBACK (activate_radio_action),
|
2003-09-15 19:51:55 +00:00
|
|
|
NULL);
|
2009-06-05 18:56:08 +00:00
|
|
|
gtk_action_group_add_radio_actions (action_group,
|
|
|
|
shape_entries, n_shape_entries,
|
2003-09-15 19:51:55 +00:00
|
|
|
SHAPE_SQUARE,
|
2009-06-05 18:56:08 +00:00
|
|
|
G_CALLBACK (activate_radio_action),
|
2003-09-15 19:51:55 +00:00
|
|
|
NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
merge = gtk_ui_manager_new ();
|
2009-06-05 18:56:08 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
|
2005-07-04 05:51:08 +00:00
|
|
|
g_object_unref);
|
2003-08-25 23:13:47 +00:00
|
|
|
gtk_ui_manager_insert_action_group (merge, action_group, 0);
|
2009-06-05 18:56:08 +00:00
|
|
|
gtk_window_add_accel_group (GTK_WINDOW (window),
|
2003-08-25 23:13:47 +00:00
|
|
|
gtk_ui_manager_get_accel_group (merge));
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
|
2003-08-24 19:58:30 +00:00
|
|
|
{
|
|
|
|
g_message ("building menus failed: %s", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
2001-06-04 23:15:51 +00:00
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
bar = gtk_ui_manager_get_widget (merge, "/MenuBar");
|
|
|
|
gtk_widget_show (bar);
|
|
|
|
gtk_table_attach (GTK_TABLE (table),
|
2009-06-05 18:56:08 +00:00
|
|
|
bar,
|
2003-08-25 23:13:47 +00:00
|
|
|
/* X direction */ /* Y direction */
|
|
|
|
0, 1, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, 0,
|
|
|
|
0, 0);
|
|
|
|
|
|
|
|
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
|
|
|
|
gtk_widget_show (bar);
|
|
|
|
gtk_table_attach (GTK_TABLE (table),
|
2009-06-05 18:56:08 +00:00
|
|
|
bar,
|
2003-08-25 23:13:47 +00:00
|
|
|
/* X direction */ /* Y direction */
|
|
|
|
0, 1, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, 0,
|
|
|
|
0, 0);
|
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
/* Create document
|
|
|
|
*/
|
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
infobar = gtk_info_bar_new ();
|
|
|
|
gtk_widget_set_no_show_all (infobar, TRUE);
|
|
|
|
messagelabel = gtk_label_new ("");
|
|
|
|
gtk_widget_show (messagelabel);
|
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar))),
|
|
|
|
messagelabel,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK);
|
|
|
|
g_signal_connect (infobar, "response",
|
|
|
|
G_CALLBACK (gtk_widget_hide), NULL);
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table),
|
|
|
|
infobar,
|
|
|
|
/* X direction */ /* Y direction */
|
|
|
|
0, 1, 2, 3,
|
|
|
|
GTK_EXPAND | GTK_FILL, 0,
|
|
|
|
0, 0);
|
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
|
|
|
GTK_SHADOW_IN);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_table_attach (GTK_TABLE (table),
|
|
|
|
sw,
|
|
|
|
/* X direction */ /* Y direction */
|
2009-06-05 18:56:08 +00:00
|
|
|
0, 1, 3, 4,
|
2001-06-04 23:15:51 +00:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window),
|
|
|
|
200, 200);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
contents = gtk_text_view_new ();
|
2003-08-27 17:18:50 +00:00
|
|
|
gtk_widget_grab_focus (contents);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (sw),
|
|
|
|
contents);
|
|
|
|
|
|
|
|
/* Create statusbar */
|
|
|
|
|
|
|
|
statusbar = gtk_statusbar_new ();
|
|
|
|
gtk_table_attach (GTK_TABLE (table),
|
|
|
|
statusbar,
|
|
|
|
/* X direction */ /* Y direction */
|
2009-06-05 18:56:08 +00:00
|
|
|
0, 1, 4, 5,
|
2001-06-04 23:15:51 +00:00
|
|
|
GTK_EXPAND | GTK_FILL, 0,
|
|
|
|
0, 0);
|
|
|
|
|
|
|
|
/* Show text widget info in the statusbar */
|
|
|
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
|
|
|
|
|
2001-08-28 20:31:16 +00:00
|
|
|
g_signal_connect_object (buffer,
|
|
|
|
"changed",
|
|
|
|
G_CALLBACK (update_statusbar),
|
|
|
|
statusbar,
|
|
|
|
0);
|
|
|
|
|
|
|
|
g_signal_connect_object (buffer,
|
|
|
|
"mark_set", /* cursor moved */
|
|
|
|
G_CALLBACK (mark_set_callback),
|
|
|
|
statusbar,
|
|
|
|
0);
|
2003-08-07 23:03:41 +00:00
|
|
|
|
2009-06-05 18:56:08 +00:00
|
|
|
g_signal_connect_object (window,
|
|
|
|
"window_state_event",
|
2003-08-07 23:03:41 +00:00
|
|
|
G_CALLBACK (update_resize_grip),
|
|
|
|
statusbar,
|
|
|
|
0);
|
2009-06-05 18:56:08 +00:00
|
|
|
|
2001-06-04 23:15:51 +00:00
|
|
|
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
|
|
|
|
}
|
|
|
|
|
2010-03-01 06:47:38 +00:00
|
|
|
if (!gtk_widget_get_visible (window))
|
2001-06-04 23:15:51 +00:00
|
|
|
{
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
}
|
|
|
|
else
|
2009-06-05 18:56:08 +00:00
|
|
|
{
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_widget_destroy (window);
|
|
|
|
window = NULL;
|
2009-06-05 18:56:08 +00:00
|
|
|
infobar = NULL;
|
|
|
|
messagelabel = NULL;
|
2001-06-04 23:15:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|