* Add a help facility for UATs

* export help_topic_html()


svn path=/trunk/; revision=20717
This commit is contained in:
Luis Ontanon 2007-02-05 05:06:21 +00:00
parent b7a16926d7
commit 2b22bcb1a3
8 changed files with 31 additions and 3 deletions

View File

@ -473,6 +473,7 @@ void dfilter_macro_init(void) {
DFILTER_MACRO_FILENAME,
(void**) &macros,
&num_macros,
"ChDisplayFilterMacrosSection",
macro_copy,
macro_update,
macro_free,

View File

@ -318,6 +318,7 @@ proto_register_k12(void)
"k12_protos",
(void**) &k12_handles,
&nk12_handles,
"ChK12ProtocolsSection",
k12_copy_cb,
k12_update_cb,
k12_free_cb,

View File

@ -49,6 +49,7 @@ struct _uat_t {
char* name;
size_t record_size;
char* filename;
char* help;
void** user_ptr;
guint* nrows_p;
uat_copy_cb_t copy_cb;
@ -59,7 +60,6 @@ struct _uat_t {
guint ncols;
GArray* user_data;
gboolean changed;
uat_rep_t* rep;
uat_rep_free_cb_t free_rep;
};

View File

@ -56,6 +56,7 @@ uat_t* uat_new(const char* name,
char* filename,
void** data_ptr,
guint* numitems_ptr,
char* help,
uat_copy_cb_t copy_cb,
uat_update_cb_t update_cb,
uat_free_cb_t free_cb,
@ -83,6 +84,7 @@ uat_t* uat_new(const char* name,
uat->changed = FALSE;
uat->rep = NULL;
uat->free_rep = NULL;
uat->help = help;
for (i=0;flds_array[i].name;i++) {
fld_data_t* f = g_malloc(sizeof(fld_data_t));

View File

@ -229,6 +229,7 @@ uat_t* uat_new(const char* name,
char* filename,
void** data_ptr,
guint* num_items,
char* help,
uat_copy_cb_t copy_cb,
uat_update_cb_t update_cb,
uat_free_cb_t free_cb,

View File

@ -231,7 +231,7 @@ gboolean topic_available(topic_action_e action) {
/*
* Open the help dialog and show a specific HTML help page.
*/
static void help_topic_html(const gchar *topic) {
void help_topic_html(const gchar *topic) {
GString *url;

View File

@ -112,4 +112,12 @@ gboolean topic_available(topic_action_e action);
/** Redraw all the help dialog text widgets, to use a new font. */
void help_redraw(void);
/*
* Open the help dialog and show a specific HTML help page.
*/
#if (GLIB_MAJOR_VERSION >= 2)
void help_topic_html(const gchar *topic);
#endif
#endif

View File

@ -42,6 +42,7 @@
#include "gtkglobals.h"
#include "gui_utils.h"
#include "dlg_utils.h"
#include "help_dlg.h"
#include "compat_macros.h"
#include <epan/uat-int.h>
@ -586,6 +587,11 @@ static gboolean unsaved_dialog(GtkWindow *w _U_, GdkEvent* e _U_, gpointer u) {
return TRUE;
}
#if (GLIB_MAJOR_VERSION >= 2)
static void uat_help_cb(GtkWidget* w _U_, gpointer u) {
help_topic_html(ep_strdup_printf("%s.html",((uat_t*)u)->help));
}
#endif
GtkWidget* uat_window(void* u) {
uat_t* uat = u;
@ -688,7 +694,16 @@ GtkWidget* uat_window(void* u) {
gtk_box_pack_end(GTK_BOX(c_hbox), rep->bt_delete, TRUE, TRUE, 0);
gtk_widget_show(rep->bt_delete);
#if (GLIB_MAJOR_VERSION >= 2)
if(uat->help) {
GtkWidget* help_btn;
help_btn = BUTTON_NEW_FROM_STOCK(GTK_STOCK_HELP);
gtk_box_pack_start(GTK_BOX(r_hbox), help_btn, TRUE, TRUE, 0);
gtk_widget_show(help_btn);
SIGNAL_CONNECT(help_btn, "clicked", uat_help_cb, uat);
}
#endif
rep->bt_save = BUTTON_NEW_FROM_STOCK(GTK_STOCK_SAVE);
gtk_box_pack_end(GTK_BOX(r_hbox), rep->bt_save, TRUE, TRUE, 0);
gtk_widget_show(rep->bt_save);