Exemplo n.º 1
0
/*
 * Register a stat that has a parameter dialog.
 * We register it both as a command-line stat and a menu item stat.
 */
void
register_param_stat(tap_param_dlg *info, const char *name,
    register_stat_group_t group)
{
    gchar *full_name;
    const gchar *stock_id = NULL;

    register_stat_cmd_arg(info->init_string, info->tap_init_cb, NULL);

    /*
     * This menu item will pop up a dialog box, so append "..."
     * to it.
     */
    full_name = g_strdup_printf("%s...", name);

    switch (group) {

    case REGISTER_ANALYZE_GROUP_UNSORTED:
    case REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER:
    case REGISTER_STAT_GROUP_UNSORTED:
    case REGISTER_STAT_GROUP_GENERIC:
        break;

    case REGISTER_STAT_GROUP_CONVERSATION_LIST:
        stock_id = WIRESHARK_STOCK_CONVERSATIONS;
        break;

    case REGISTER_STAT_GROUP_ENDPOINT_LIST:
        stock_id = WIRESHARK_STOCK_ENDPOINTS;
        break;

    case REGISTER_STAT_GROUP_RESPONSE_TIME:
        stock_id = WIRESHARK_STOCK_TIME;
        break;

    case REGISTER_STAT_GROUP_TELEPHONY:
    case REGISTER_STAT_GROUP_TELEPHONY_GSM:
    case REGISTER_STAT_GROUP_TELEPHONY_LTE:
    case REGISTER_STAT_GROUP_TELEPHONY_SCTP:
        break;

    case REGISTER_TOOLS_GROUP_UNSORTED:
        break;
    }

    register_menu_bar_menu_items(
        stat_group_name(group), /* GUI path to the place holder in the menu */
        name,                   /* Action name */
        stock_id,               /* Stock id */
        full_name,              /* label */
        NULL,                   /* Accelerator */
        NULL,                   /* Tooltip */
        tap_param_dlg_cb,       /* Callback */
        info,                   /* Callback data */
        TRUE,                   /* Enabled */
        NULL,
        NULL);
}
Exemplo n.º 2
0
/*
 * Register a stat that has a parameter dialog.
 * We register it both as a command-line stat and a menu item stat.
 */
void
register_param_stat(tap_param_dlg *info, const char *name,
    register_stat_group_t group)
{
    gchar *action_name;
    gchar *full_name;
    const gchar *stock_id = NULL;
    stat_tap_ui ui_info;
    size_t i;

    /* XXX We appear to leak memory here. */
    /*
     * This menu item will pop up a dialog box, so append "..."
     * to it.
     */
    full_name = g_strdup_printf("%s...", name);
    /*
     * Escape path separators for add_menu_item_to_main_menubar.
     */
    action_name = g_strdup(name);
    for (i = 0; i < strlen(action_name); i++) {
        if (action_name[i] == '/') {
            action_name[i] = '#';
        }
    }

    ui_info.group = group;
    ui_info.title = full_name;
    ui_info.cli_string = info->init_string;
    ui_info.tap_init_cb = info->tap_init_cb;
    ui_info.nparams = info->nparams;
    ui_info.params = info->params;
    register_stat_tap_ui(&ui_info, NULL);

    switch (group) {

    case REGISTER_ANALYZE_GROUP_UNSORTED:
    case REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER:
    case REGISTER_STAT_GROUP_UNSORTED:
    case REGISTER_STAT_GROUP_GENERIC:
        break;

    case REGISTER_STAT_GROUP_CONVERSATION_LIST:
        stock_id = WIRESHARK_STOCK_CONVERSATIONS;
        break;

    case REGISTER_STAT_GROUP_ENDPOINT_LIST:
        stock_id = WIRESHARK_STOCK_ENDPOINTS;
        break;

    case REGISTER_STAT_GROUP_RESPONSE_TIME:
        stock_id = WIRESHARK_STOCK_TIME;
        break;

    case REGISTER_STAT_GROUP_TELEPHONY:
    case REGISTER_STAT_GROUP_TELEPHONY_ANSI:
    case REGISTER_STAT_GROUP_TELEPHONY_GSM:
    case REGISTER_STAT_GROUP_TELEPHONY_LTE:
    case REGISTER_STAT_GROUP_TELEPHONY_SCTP:
        break;

    case REGISTER_TOOLS_GROUP_UNSORTED:
        break;
    }

    register_menu_bar_menu_items(
        stat_group_name(group), /* GUI path to the place holder in the menu */
        action_name,            /* Action name */
        stock_id,               /* Stock id */
        full_name,              /* label */
        NULL,                   /* Accelerator */
        NULL,                   /* Tooltip */
        tap_param_dlg_cb,       /* Callback */
        info,                   /* Callback data */
        TRUE,                   /* Enabled */
        NULL,
        NULL);
}