forked from osmocom/wireshark
add "Save As" and "Save All" buttons to the dialog / stock_icons utils
use them in the export object dialog svn path=/trunk/; revision=25072
This commit is contained in:
parent
a18fefb91f
commit
45d5280ff1
|
@ -125,6 +125,8 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
|
|||
const gchar *ok = NULL;
|
||||
const gchar *print = NULL;
|
||||
const gchar *save = NULL;
|
||||
const gchar *save_as = NULL;
|
||||
const gchar *save_all = NULL;
|
||||
const gchar *stop = NULL;
|
||||
const gchar *yes = NULL;
|
||||
|
||||
|
@ -141,6 +143,10 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
|
|||
apply = stock_id;
|
||||
} else if (strcmp(stock_id, GTK_STOCK_SAVE) == 0) {
|
||||
save = stock_id;
|
||||
} else if (strcmp(stock_id, GTK_STOCK_SAVE_AS) == 0) {
|
||||
save_as = stock_id;
|
||||
} else if (strcmp(stock_id, WIRESHARK_STOCK_SAVE_ALL) == 0) {
|
||||
save_all = stock_id;
|
||||
} else if (strcmp(stock_id, WIRESHARK_STOCK_DONT_SAVE) == 0) {
|
||||
dont_save = stock_id;
|
||||
} else if (strcmp(stock_id, GTK_STOCK_CANCEL) == 0) {
|
||||
|
@ -356,6 +362,8 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
|
|||
if (yes != NULL) dlg_button_new(hbox, button_hbox, yes);
|
||||
if (no != NULL) dlg_button_new(hbox, button_hbox, no);
|
||||
if (save != NULL) dlg_button_new(hbox, button_hbox, save);
|
||||
if (save_as != NULL) dlg_button_new(hbox, button_hbox, save_as);
|
||||
if (save_all != NULL) dlg_button_new(hbox, button_hbox, save_all);
|
||||
if (dont_save != NULL) dlg_button_new(hbox, button_hbox, dont_save);
|
||||
if (cap_start != NULL) dlg_button_new(hbox, button_hbox, cap_start);
|
||||
if (cap_stop != NULL) dlg_button_new(hbox, button_hbox, cap_stop);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include <gtk/gui_utils.h>
|
||||
#include <gtk/help_dlg.h>
|
||||
#include <gtk/main.h>
|
||||
#include <gtk/stock_icons.h>
|
||||
#include "gtk/export_object.h"
|
||||
|
||||
enum {
|
||||
|
@ -266,7 +267,7 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_
|
|||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeSelection *selection;
|
||||
GtkWidget *vbox, *bbox, *help_bt, *close_bt, *save_bt, *save_all_bt;
|
||||
GtkWidget *vbox, *bbox, *help_bt, *cancel_bt, *save_bt, *save_all_bt;
|
||||
GtkTooltips *button_bar_tips;
|
||||
GString *error_msg;
|
||||
export_object_list_t *object_list;
|
||||
|
@ -370,48 +371,44 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_
|
|||
g_signal_connect(selection, "changed", G_CALLBACK(eo_remember_row_num), object_list);
|
||||
|
||||
|
||||
bbox = gtk_hbox_new(FALSE, 5);
|
||||
bbox = dlg_button_row_new(GTK_STOCK_HELP, WIRESHARK_STOCK_SAVE_ALL, GTK_STOCK_SAVE_AS, GTK_STOCK_CANCEL, NULL);
|
||||
|
||||
/* Help button */
|
||||
help_bt = gtk_button_new_from_stock(GTK_STOCK_HELP);
|
||||
help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP);
|
||||
g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_EXPORT_OBJECT_LIST);
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), help_bt,
|
||||
"Show help for this dialog.", NULL);
|
||||
gtk_box_pack_start(GTK_BOX(bbox), help_bt, FALSE, FALSE, 0);
|
||||
|
||||
/* Save All button */
|
||||
save_all_bt = gtk_button_new_with_mnemonic("Save A_ll");
|
||||
save_all_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_SAVE_ALL);
|
||||
g_signal_connect(save_all_bt, "clicked", G_CALLBACK(eo_save_all_clicked_cb),
|
||||
object_list);
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), save_all_bt,
|
||||
"Save all listed objects with their displayed "
|
||||
"filenames.", NULL);
|
||||
gtk_box_pack_end(GTK_BOX(bbox), save_all_bt, FALSE, FALSE, 0);
|
||||
|
||||
/* Save button */
|
||||
save_bt = gtk_button_new_from_stock(GTK_STOCK_SAVE_AS);
|
||||
/* Save As button */
|
||||
save_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_SAVE_AS);
|
||||
g_signal_connect(save_bt, "clicked", G_CALLBACK(eo_save_clicked_cb), object_list);
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), save_bt,
|
||||
"Saves the currently selected content to a file.",
|
||||
NULL);
|
||||
gtk_box_pack_end(GTK_BOX(bbox), save_bt, FALSE, FALSE, 0);
|
||||
|
||||
/* Close button */
|
||||
close_bt = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
|
||||
GTK_WIDGET_SET_FLAGS(close_bt, GTK_CAN_DEFAULT);
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), close_bt,
|
||||
"Close this dialog.", NULL);
|
||||
gtk_box_pack_end(GTK_BOX(bbox), close_bt, FALSE, FALSE, 0);
|
||||
/* Cancel button */
|
||||
cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), cancel_bt,
|
||||
"Cancel this dialog.", NULL);
|
||||
|
||||
|
||||
/* Pack the buttons into the "button box" */
|
||||
gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show(bbox);
|
||||
gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show(bbox);
|
||||
|
||||
/* Setup cancel/delete/destroy signal handlers */
|
||||
g_signal_connect(object_list->dlg, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
||||
g_signal_connect(object_list->dlg, "destroy",
|
||||
G_CALLBACK(eo_win_destroy_cb), object_list);
|
||||
window_set_cancel_button(object_list->dlg, close_bt,
|
||||
window_set_cancel_button(object_list->dlg, cancel_bt,
|
||||
window_cancel_button_cb);
|
||||
|
||||
/* Show the window */
|
||||
|
|
|
@ -112,6 +112,7 @@ void stock_icons_init(void) {
|
|||
{ WIRESHARK_STOCK_IMPORT, "_Import...", 0, 0, NULL },
|
||||
{ WIRESHARK_STOCK_EDIT, "_Edit...", 0, 0, NULL },
|
||||
{ WIRESHARK_STOCK_ADD_EXPRESSION, "_Expression..." , 0, 0, NULL }, /* plus sign coming from icon */
|
||||
{ WIRESHARK_STOCK_SAVE_ALL, "Save A_ll", 0, 0, NULL },
|
||||
{ WIRESHARK_STOCK_DONT_SAVE, "Continue _without Saving", 0, 0, NULL },
|
||||
{ WIRESHARK_STOCK_ABOUT, "_About", 0, 0, NULL },
|
||||
{ WIRESHARK_STOCK_COLORIZE, "_Colorize", 0, 0, NULL },
|
||||
|
@ -167,6 +168,7 @@ void stock_icons_init(void) {
|
|||
{ WIRESHARK_STOCK_EDIT, stock_properties_24_xpm },
|
||||
{ WIRESHARK_STOCK_ADD_EXPRESSION, stock_add_24_xpm },
|
||||
{ WIRESHARK_STOCK_DONT_SAVE, stock_clear_24_xpm },
|
||||
{ WIRESHARK_STOCK_SAVE_ALL, stock_save_24_xpm }, /* XXX: needs a better icon */
|
||||
{ WIRESHARK_STOCK_ABOUT, wsicon16_xpm },
|
||||
{ WIRESHARK_STOCK_COLORIZE, colorize_24_xpm },
|
||||
{ WIRESHARK_STOCK_AUTOSCROLL, autoscroll_24_xpm },
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define WIRESHARK_STOCK_EDIT "Wireshark_Stock_Edit"
|
||||
#define WIRESHARK_STOCK_ADD_EXPRESSION "Wireshark_Stock_Edit_Add_Expression"
|
||||
#define WIRESHARK_STOCK_DONT_SAVE "Wireshark_Stock_Continue_without_Saving"
|
||||
#define WIRESHARK_STOCK_SAVE_ALL "Wireshark_Stock_Save_All"
|
||||
#define WIRESHARK_STOCK_ABOUT "Wireshark_Stock_About"
|
||||
#define WIRESHARK_STOCK_COLORIZE "Wireshark_Stock_Colorize"
|
||||
#define WIRESHARK_STOCK_AUTOSCROLL "Wireshark_Stock_Autoscroll"
|
||||
|
|
Loading…
Reference in New Issue