📄 menus.c
字号:
/* * menu and toolbar of the main gsms application window * * Authors: Gerhard Khueny <e9625442@student.tuwien.ac.at> * * TODO: * * Fixes: * * For license terms, see the file COPYING in the project directory. */#include <config.h>#include "menus.h"#include "app.h"#include "log.h"#include "abook.h"#include "dialog-pref.h"#include "dialog-plugin.h"static void nothing_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 void preferences_cb(GtkWidget * widget, gpointer data);static void plugins_cb(GtkWidget * widget, gpointer data);static void queue_sms_cb (GtkWidget * widget, gpointer data);static void send_sms_cb (GtkWidget * widget, gpointer data);static void log_cb (GtkWidget * widget, gpointer data);static void popup_edit_cb (GtkWidget * widget, gpointer data);static void popup_remove_cb(GtkWidget * widget, gpointer data);static void remove_queue_cb(GtkWidget * widget, gpointer data);static GnomeUIInfo file_menu[] = { GNOMEUIINFO_ITEM("Import ASCII Text", "Import ASCII Text to SMS Text", nothing_cb, NULL), GNOMEUIINFO_ITEM("Save SMS", "Save SMS as ASCII Text", nothing_cb, NULL), GNOMEUIINFO_ITEM("View Log", "View Logging Window", log_cb, NULL), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_MENU_CLOSE_ITEM(close_cb, NULL), GNOMEUIINFO_MENU_EXIT_ITEM(exit_cb, NULL), GNOMEUIINFO_END};static GnomeUIInfo conf_menu[] = { GNOMEUIINFO_ITEM("Addressbook", "Open Adressbook", abook_open, NULL), GNOMEUIINFO_ITEM("Preferences", "Show the Preferences Dialog", preferences_cb, NULL), GNOMEUIINFO_ITEM("Plugins", "Query/Configure loaded Plugins", plugins_cb, NULL), GNOMEUIINFO_END};static GnomeUIInfo help_menu[] = { GNOMEUIINFO_HELP("gsms"), GNOMEUIINFO_MENU_ABOUT_ITEM(about_cb, NULL), GNOMEUIINFO_END};static GnomeUIInfo menu[] = { GNOMEUIINFO_MENU_FILE_TREE(file_menu), GNOMEUIINFO_SUBTREE("Configuration", conf_menu), GNOMEUIINFO_MENU_HELP_TREE(help_menu), GNOMEUIINFO_END};static GnomeUIInfo toolbar[] = { GNOMEUIINFO_ITEM_STOCK(N_("Abook"), N_("Open Addressbook"), abook_open, GNOME_STOCK_PIXMAP_BOOK_OPEN), GNOMEUIINFO_ITEM_STOCK(N_("Log"), N_("Open/Close Logging Window"), log_cb, GNOME_STOCK_PIXMAP_BOOK_BLUE), GNOMEUIINFO_ITEM_STOCK(N_("Queue"), N_("Add the message to the queue"), queue_sms_cb, GNOME_STOCK_PIXMAP_MAIL_FWD), GNOMEUIINFO_ITEM_STOCK(N_("Send"), N_("Send all messsages from the queue"), send_sms_cb, GNOME_STOCK_PIXMAP_MAIL_SND), GNOMEUIINFO_ITEM_STOCK(N_("Clear"), N_("Clear the queue"), remove_queue_cb, GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_END};static GnomeUIInfo popup[] = { GNOMEUIINFO_ITEM( N_("Edit"), N_("Edit the message"), popup_edit_cb, NULL), GNOMEUIINFO_ITEM( N_("Remove"), N_("Romove recipient from list"), popup_remove_cb, NULL), GNOMEUIINFO_END};void sms_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);}GtkWidget* create_popup (void) { return (gnome_popup_menu_new(popup));}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 preferences_cb(GtkWidget * widget, gpointer data){ gsms_preferences_dialog();}static void plugins_cb(GtkWidget * widget, gpointer data){ gsms_plugin_dialog_new();}static void close_cb(GtkWidget * widget, gpointer data){ GtkWidget *app; app = (GtkWidget *) data; sms_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[] = { "Gerhard Khueny, Michael Jochum", NULL }; gchar *logo = gnome_pixmap_file("gnome-hello-logo.png"); dialog = gnome_about_new(_("SMS-Center"), VERSION, "(C) 2000 Snorre, Quantin", authors, _ ("The ultimaive SMS sending 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); }}static void log_cb (GtkWidget * widget, gpointer data) { log_on();}static void queue_sms_cb (GtkWidget * widget, gpointer data) { (void) app_queue_sms();}static void send_sms_cb (GtkWidget * widget, gpointer data) { app_send_sms();}static void popup_remove_cb (GtkWidget * widget, gpointer data) { app_popup_item_remove ();}static void popup_edit_cb (GtkWidget * widget, gpointer data) { app_popup_item_edit ();}static void remove_queue_cb (GtkWidget * widget, gpointer data) { app_clear_queue ();}/* gnomehello-menus ***/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -