1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
%{C_TEMPLATE}
/*** gnomehello-menus */
#include <config.h>
#include "menus.h"
#include "%{APPNAMELC}.h"
static void nothing_cb(GtkWidget* widget, gpointer data);
static void new_app_cb(GtkWidget* widget, gpointer data);
static void close_cb (GtkWidget* widget, gpointer data);
static void exit_cb (GtkWidget* widget, gpointer data);
static void about_cb (GtkWidget* widget, gpointer data);
static GnomeUIInfo file_menu [] = {
GNOMEUIINFO_MENU_NEW_ITEM(N_("_New %{APPNAME}"),
N_("Create a new %{APPNAME}"),
new_app_cb, NULL),
GNOMEUIINFO_MENU_OPEN_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_SAVE_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_SAVE_AS_ITEM(nothing_cb, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_CLOSE_ITEM(close_cb, NULL),
GNOMEUIINFO_MENU_EXIT_ITEM(exit_cb, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo edit_menu [] = {
GNOMEUIINFO_MENU_CUT_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_COPY_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_PASTE_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_SELECT_ALL_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_CLEAR_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_UNDO_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_REDO_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_FIND_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_FIND_AGAIN_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_REPLACE_ITEM(nothing_cb, NULL),
GNOMEUIINFO_MENU_PROPERTIES_ITEM(nothing_cb, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo help_menu [] = {
GNOMEUIINFO_HELP ("gnome-hello"),
GNOMEUIINFO_MENU_ABOUT_ITEM(about_cb, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo menu [] = {
GNOMEUIINFO_MENU_FILE_TREE(file_menu),
GNOMEUIINFO_MENU_EDIT_TREE(edit_menu),
GNOMEUIINFO_MENU_HELP_TREE(help_menu),
GNOMEUIINFO_END
};
static GnomeUIInfo toolbar [] = {
GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new %{APPNAME}"), nothing_cb, GNOME_STOCK_PIXMAP_NEW),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Previous hello"), nothing_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Next hello"), nothing_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_END
};
void
hello_install_menus_and_toolbar(GtkWidget* app)
{
gnome_app_create_toolbar_with_data(GNOME_APP(app), toolbar, app);
gnome_app_create_menus_with_data(GNOME_APP(app), menu, app);
gnome_app_install_menu_hints(GNOME_APP(app), menu);
}
static void
nothing_cb(GtkWidget* widget, gpointer data)
{
GtkWidget* dialog;
GtkWidget* app;
app = (GtkWidget*) data;
dialog = gnome_ok_dialog_parented(
_("This does nothing; it is only a demonstration."),
GTK_WINDOW(app));
}
static void
new_app_cb(GtkWidget* widget, gpointer data)
{
GtkWidget* app;
app = hello_app_new(_("Hello, World!"), NULL, NULL);
gtk_widget_show_all(app);
}
static void
close_cb(GtkWidget* widget, gpointer data)
{
GtkWidget* app;
app = (GtkWidget*) data;
hello_app_close(app);
}
static void
exit_cb(GtkWidget* widget, gpointer data)
{
gtk_main_quit();
}
static void
about_cb(GtkWidget* widget, gpointer data)
{
static GtkWidget* dialog = NULL;
GtkWidget* app;
app = (GtkWidget*) data;
if (dialog != NULL)
{
g_assert(GTK_WIDGET_REALIZED(dialog));
gdk_window_show(dialog->window);
gdk_window_raise(dialog->window);
}
else
{
const gchar *authors[] = {
"%{AUTHOR} <%{EMAIL}>",
NULL
};
gchar* logo = gnome_pixmap_file("%{APPNAMELC}.png");
dialog = gnome_about_new (_("%{APPNAME}"), VERSION,
"(C) %{AUTHOR}",
authors,
_("A sample GNOME application."),
logo);
g_free(logo);
gtk_signal_connect(GTK_OBJECT(dialog),
"destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
&dialog);
gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(app));
gtk_widget_show(dialog);
}
}
/* gnomehello-menus ***/
|