nd_dialog

Name

nd_dialog -- 

Synopsis



enum        ND_DialogType;
enum        ND_Base;
void        (*ND_NumberCallback)            (LND_Packet *packet,
                                             void *user_data,
                                             guint value);
void        (*ND_AddressCallback)           (guchar *address,
                                             int address_len,
                                             LND_Packet *packet,
                                             void *user_data);
void        (*ND_StringCallback)            (const char *string,
                                             void *user_data);
void        (*ND_DialogCallback)            (void *user_data);
void        nd_dialog_ync                   (const char *title,
                                             const char *message,
                                             ND_DialogCallback yes_cb,
                                             ND_DialogCallback no_cb,
                                             ND_DialogCallback cancel_cb,
                                             void *user_data);
void        nd_dialog_message               (const char *title,
                                             const char *message,
                                             gboolean modal);
void        nd_dialog_number                (const char *message,
                                             ND_Base base,
                                             guint value,
                                             guint max,
                                             ND_NumberCallback callback_okay,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);
void        nd_dialog_number_update         (void);
void        nd_dialog_number_set_base       (ND_Base base);
void        nd_dialog_number_ok             (GtkWidget *dialog);
void        nd_dialog_number_cancel         (GtkWidget *dialog);
void        nd_dialog_largenumber_ok        (GtkWidget *dialog);
void        nd_dialog_largenumber_up        (GtkWidget *dialog);
void        nd_dialog_largenumber_down      (GtkWidget *dialog);
void        nd_dialog_string                (const char *title,
                                             const char *message,
                                             ND_StringCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             void *user_data);
void        nd_dialog_string_ok             (GtkWidget *dialog);
void        nd_dialog_string_cancel         (GtkWidget *dialog);
void        nd_dialog_hardware_address      (const char *message,
                                             guchar *address,
                                             int address_len,
                                             ND_AddressCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);
void        nd_dialog_ip                    (const char *message,
                                             guchar *ip_address,
                                             ND_AddressCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);
void        nd_dialog_ip_ok                 (void);
void        nd_dialog_ip_cancel             (void);
void        nd_dialog_filesel               (const char *title,
                                             const char *file_name,
                                             ND_StringCallback callback_fname,
                                             void *user_data);
void        nd_dialog_filesel_close         ();
void        nd_dialog_filesel_ok            (GtkWidget *dialog);
void        nd_dialog_exit                  (void);
void        nd_dialog_generic               (ND_DialogType type,
                                             const char *title,
                                             const char *message,
                                             gboolean modal,
                                             GtkWidget *extra_area,
                                             void *user_data,
                                             int num_buttons,
                                             ...);
void        nd_dialog_about                 (void);
void        nd_dialog_fontsel               (const char *title,
                                             const char *font_name,
                                             ND_StringCallback callback_ok,
                                             void *user_data);
void        nd_dialog_fontsel_ok            (GtkFontSelectionDialog *dialog);
void        nd_dialog_fontsel_cancel        (GtkFontSelectionDialog *dialog);
void        nd_dialog_fontsel_apply         (GtkFontSelectionDialog *dialog);

Description

Details

enum ND_DialogType

typedef enum {
  ND_DIALOG_QUESTION,
  ND_DIALOG_WARNING
} ND_DialogType;


enum ND_Base

typedef enum {
  ND_BASE_DEC,
  ND_BASE_HEX
} ND_Base;


ND_NumberCallback ()

void        (*ND_NumberCallback)            (LND_Packet *packet,
                                             void *user_data,
                                             guint value);

This is the signature of callbacks that can be passed to nd_dialog_number() and that gets called when the user clicks "OK".

packet :

the packet edited when the dialog was opened.

user_data :

arbitrary user data.

value :

the numeric value the user selected.


ND_AddressCallback ()

void        (*ND_AddressCallback)           (guchar *address,
                                             int address_len,
                                             LND_Packet *packet,
                                             void *user_data);

This is the signature of callbacks that can be passed to nd_dialog_hardware_address() and that gets called when the user clicks "OK".

address :

input address data.

address_len :

length in bytes of address.

packet :

packet edited when address dialog was opened.

user_data :

arbitrary user data.


ND_StringCallback ()

void        (*ND_StringCallback)            (const char *string,
                                             void *user_data);

This is the signature of callbacks that can be passed to nd_dialog_string() and others, and that gets called when the user clicks "OK".

string :

the string the user provided.

user_data :

arbitrary user data.


ND_DialogCallback ()

void        (*ND_DialogCallback)            (void *user_data);

This is the signature of the generic callbacks used in the dialogs. Also used in the generic number and address dialogs for the "Cancel" callbacks, where the user can clean up any user_data if necessary.

user_data :

arbitrary user data.


nd_dialog_ync ()

void        nd_dialog_ync                   (const char *title,
                                             const char *message,
                                             ND_DialogCallback yes_cb,
                                             ND_DialogCallback no_cb,
                                             ND_DialogCallback cancel_cb,
                                             void *user_data);

Shows a yes-no-cancel dialog and calls the appriopriate callback when a button is clicked. The dialog is displayed and hidden automatically. You can pass NULL for callbacks you don't need.

title :

text to display in window title.

message :

message content.

yes_cb :

callback called when user clicks "yes"-button.

no_cb :

callback called when user clicks "no"-button.

cancel_cb :

callback called when user clicks "no"-button.

user_data :

arbitrary user data.


nd_dialog_message ()

void        nd_dialog_message               (const char *title,
                                             const char *message,
                                             gboolean modal);

The function shows a simple message dialog with an okay button. No callbacks. If modal is TRUE, no other windows will be active while the dialog is shown.

title :

text to display in window title.

message :

message content.

modal :

whether the dialog will be modal.


nd_dialog_number ()

void        nd_dialog_number                (const char *message,
                                             ND_Base base,
                                             guint value,
                                             guint max,
                                             ND_NumberCallback callback_okay,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);

The function shows a number-editing dialog with the given label and initial value. The largest possible value is given through max. You can pass NULL for callback_cancel if you don't need it. The dialog also handles 32-bit values nicely, in contrast to GTK's entry widget.

message :

message content.

base :

whether to initially use hex or decimal display.

value :

initial value to display.

max :

maximum value allowed.

callback_okay :

callback called when user clicks "okay"-button.

callback_cancel :

callback called when user clicks "cancel"-button.

packet :

currently edited packet, passed through to callbacks.

user_data :

arbitrary user data.


nd_dialog_number_update ()

void        nd_dialog_number_update         (void);


nd_dialog_number_set_base ()

void        nd_dialog_number_set_base       (ND_Base base);

base :


nd_dialog_number_ok ()

void        nd_dialog_number_ok             (GtkWidget *dialog);

dialog :


nd_dialog_number_cancel ()

void        nd_dialog_number_cancel         (GtkWidget *dialog);

dialog :


nd_dialog_largenumber_ok ()

void        nd_dialog_largenumber_ok        (GtkWidget *dialog);

dialog :


nd_dialog_largenumber_up ()

void        nd_dialog_largenumber_up        (GtkWidget *dialog);

dialog :


nd_dialog_largenumber_down ()

void        nd_dialog_largenumber_down      (GtkWidget *dialog);

dialog :


nd_dialog_string ()

void        nd_dialog_string                (const char *title,
                                             const char *message,
                                             ND_StringCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             void *user_data);

title :

message :

callback_ok :

callback_cancel :

user_data :


nd_dialog_string_ok ()

void        nd_dialog_string_ok             (GtkWidget *dialog);

dialog :


nd_dialog_string_cancel ()

void        nd_dialog_string_cancel         (GtkWidget *dialog);

dialog :


nd_dialog_hardware_address ()

void        nd_dialog_hardware_address      (const char *message,
                                             guchar *address,
                                             int address_len,
                                             ND_AddressCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);

The function shows a generic hardware address entry dialog that allows you to edit an address with the given address_len (in bytes, e.g. 6 for Ethernet). When the "okay"-button is clicked, callback_ok is called with the new value. You can pass NULL for callback_cancel if you don't need it.

message :

message content.

address :

pointer to initial address.

address_len :

length of initial address.

callback_ok :

callback called when user clicks "okay"-button.

callback_cancel :

callback called when user clicks "cancel"-button.

packet :

currently edited packet.

user_data :

arbitrary data.


nd_dialog_ip ()

void        nd_dialog_ip                    (const char *message,
                                             guchar *ip_address,
                                             ND_AddressCallback callback_ok,
                                             ND_DialogCallback callback_cancel,
                                             LND_Packet *packet,
                                             void *user_data);

The function shows a dialog to edit an IPv4 address. This is needed sufficiently often that it is provided withing Netdude itself, not by a plugin. The ip_address memory is not used internally. You can pass NULL for callback_cancel if you don't need it.

message :

message content.

ip_address :

pointer to initial IP address.

callback_ok :

callback called when user clicks "okay"-button.

callback_cancel :

callback called when user clicks "cancel"-button.

packet :

currently edited packet.

user_data :

arbitrary user data.


nd_dialog_ip_ok ()

void        nd_dialog_ip_ok                 (void);


nd_dialog_ip_cancel ()

void        nd_dialog_ip_cancel             (void);


nd_dialog_filesel ()

void        nd_dialog_filesel               (const char *title,
                                             const char *file_name,
                                             ND_StringCallback callback_fname,
                                             void *user_data);

The function shows a file selection dialog, initialized to file_name, if provided. You can also pass NULL for file_name. callback_fname if called when the user clicks the "okay"-button.

title :

text displayed in window title.

file_name :

initial file/directory name to display.

callback_fname :

callback called when user clicks "okay"-button.

user_data :

arbitrary user data.


nd_dialog_filesel_close ()

void        nd_dialog_filesel_close         ();


nd_dialog_filesel_ok ()

void        nd_dialog_filesel_ok            (GtkWidget *dialog);

dialog :


nd_dialog_exit ()

void        nd_dialog_exit                  (void);

This function opens the exit dialog, which shows a list of unsaved files, which the user can save directly from the dialog before Netdude exits.


nd_dialog_generic ()

void        nd_dialog_generic               (ND_DialogType type,
                                             const char *title,
                                             const char *message,
                                             gboolean modal,
                                             GtkWidget *extra_area,
                                             void *user_data,
                                             int num_buttons,
                                             ...);

This function is the most generic way to generate a dialog, allowing you to basically specify all parts of it. The varargs specify the buttons and must be a sequence of char*s for buttons labels and ND_DialogCallbacks for the button callbacks.

type :

type of the dialog, determines what icon is displayed in dialog.

title :

text displayed in window title.

message :

message content.

modal :

whether dialog is modal or not.

extra_area :

arbitrary widget that is hooked into the dialog.

user_data :

arbitrary user data passed through to callbacks.

num_buttons :

number of buttons passed as varargs.

... :

sequence of button labels and callbacks.


nd_dialog_about ()

void        nd_dialog_about                 (void);

The function displays Netdude's About-dialog, containing version and author info etc.


nd_dialog_fontsel ()

void        nd_dialog_fontsel               (const char *title,
                                             const char *font_name,
                                             ND_StringCallback callback_ok,
                                             void *user_data);

The function shows a font selection dialog, initialized to font_name, if provided. callback_ok is called when the user clicks the "okay"-button.

title :

text displayed in window title.

font_name :

initially selected font name, can be NULL.

callback_ok :

callback called when user clicks "okay"-button.

user_data :

arbitrary user data.


nd_dialog_fontsel_ok ()

void        nd_dialog_fontsel_ok            (GtkFontSelectionDialog *dialog);

dialog :


nd_dialog_fontsel_cancel ()

void        nd_dialog_fontsel_cancel        (GtkFontSelectionDialog *dialog);

dialog :


nd_dialog_fontsel_apply ()

void        nd_dialog_fontsel_apply         (GtkFontSelectionDialog *dialog);

dialog :