src/cmd/fsexam/src/fsexam-dialog.c
author yz157939@agc105
Fri, 25 Apr 2008 17:02:23 +0800
changeset 147 8c4ef02c14b8
permissions -rw-r--r--
replace new version of fsexam, old version 0.3.1 is not used any more
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
147
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     1
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     2
 * CDDL HEADER START
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     3
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     7
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    11
 * and limitations under the License.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    12
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    18
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    19
 * CDDL HEADER END
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    20
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    21
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    22
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    23
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    24
 * Use is subject to license terms.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    25
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    26
#include <glib.h>
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    27
#include <glib/gi18n.h>
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    28
#include <gtk/gtk.h>
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    29
#include <glade/glade.h>
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    30
#include <gconf/gconf-client.h>
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    31
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    32
#include "fsexam-header.h"
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    33
#include "fsexam-dialog.h"
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    34
#include "fsexam-ui.h"
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    35
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    36
extern gint indexg;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    37
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    38
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    39
 *  Callback for 'toggled' signal of GtkRadioButton
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    40
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    41
void
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    42
fsexam_convert_candidate_set (GtkWidget *widget,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    43
                              gpointer user_data)
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    44
{
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    45
    indexg = (gint)user_data;  /* the user_data is the real index in GList */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    46
}
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    47
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    48
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    49
 *  Iterate function for Encoding List
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    50
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    51
 *  Add one element of Encoding list into candidate dialog as one candidate.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    52
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    53
static gboolean
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    54
fsexam_construct_index_ui (Encoding *encode,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    55
                           gint index,     /* the index in encode_list */ 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    56
                           va_list args)
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    57
{
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    58
    GtkWidget *table = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    59
    GtkWidget *entry = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    60
    GtkWidget *radio = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    61
    GtkWidget **radio_group = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    62
    gboolean  name_conversion;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    63
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    64
    table = va_arg (args, GtkWidget *);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    65
    radio_group = va_arg (args, GtkWidget **);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    66
    name_conversion = va_arg (args, gboolean);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    67
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    68
    /* Radio button */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    69
    if (*radio_group == NULL) { /* is NULL for the first element */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    70
        radio = gtk_radio_button_new_with_label (NULL,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    71
                                        id2encoding (encode->encodingID));
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    72
        *radio_group = radio;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    73
    } else {
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    74
        radio = gtk_radio_button_new_with_label_from_widget (
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    75
                                        GTK_RADIO_BUTTON (*radio_group),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    76
                                        id2encoding (encode->encodingID));
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    77
    }
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    78
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    79
    gtk_table_attach (GTK_TABLE (table),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    80
                      radio, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    81
                      0, 1, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    82
                      index, index+1,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    83
                      GTK_FILL | GTK_SHRINK, /* GtkAttachOptions xoption */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    84
                      GTK_SHRINK,            /* GtkAttachOptions yoption */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    85
                      0,                     /* xpadding */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    86
                      0);                    /* ypadding */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    87
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    88
    /* Text Entry */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    89
    entry = gtk_entry_new ();
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    90
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    91
    if (name_conversion) {
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    92
        gtk_entry_set_text (GTK_ENTRY (entry), encode->u.converted_text);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    93
    }else{
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    94
        gtk_entry_set_text (GTK_ENTRY (entry), encode->u.contents);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    95
    }
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    96
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    97
    gtk_table_attach (GTK_TABLE (table),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    98
                      entry,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    99
                      1, 2, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   100
                      index, index+1,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   101
                      GTK_EXPAND | GTK_FILL,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   102
                      GTK_SHRINK | GTK_FILL,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   103
                      0,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   104
                      0);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   105
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   106
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   107
    g_signal_connect (G_OBJECT (radio),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   108
                      "toggled",
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   109
                      G_CALLBACK (fsexam_convert_candidate_set),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   110
                      (gpointer)index); /* this is the index in encode list */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   111
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   112
    return TRUE;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   113
}
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   114
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   115
#define BOX_SPACE  8
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   116
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   117
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   118
 * Create candidates list dialog for user to select
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   119
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   120
GtkWidget *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   121
fsexam_dialog_candidate (GList *encoding, gboolean forname)
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   122
{
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   123
    GtkWidget   *dialog = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   124
    GtkWidget   *hbox = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   125
    GtkWidget   *vbox = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   126
    GtkWidget   *stock = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   127
    GtkWidget   *table = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   128
    GtkWidget   *button_ask = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   129
    GtkWidget   *radio_group = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   130
    gint        num_encoding;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   131
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   132
    num_encoding = fsexam_encoding_get_length (encoding);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   133
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   134
    dialog = gtk_dialog_new_with_buttons (
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   135
                            _("Please select candidate"),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   136
                            GTK_WINDOW (view->mainwin),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   137
                            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   138
                            GTK_STOCK_CANCEL,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   139
                            GTK_RESPONSE_CANCEL,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   140
                            GTK_STOCK_OK,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   141
                            GTK_RESPONSE_OK,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   142
                            NULL);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   143
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   144
    /* The main container for Dialog content */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   145
    hbox = gtk_hbox_new (FALSE, BOX_SPACE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   146
    gtk_container_set_border_width (GTK_CONTAINER (hbox), BOX_SPACE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   147
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   148
                        hbox,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   149
                        TRUE,   /* expand */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   150
                        TRUE,   /* fill */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   151
                        0);     /* padding */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   152
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   153
    /* Left part */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   154
    vbox = gtk_vbox_new (FALSE, BOX_SPACE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   155
    gtk_box_pack_start (GTK_BOX (hbox), 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   156
                        vbox, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   157
                        FALSE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   158
                        FALSE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   159
                        0);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   160
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   161
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   162
    /* Add Quesiton stock ICON into HBox */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   163
    stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   164
                                      GTK_ICON_SIZE_DIALOG);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   165
    gtk_box_pack_start (GTK_BOX (vbox), 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   166
                        stock, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   167
                        TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   168
                        TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   169
                        0);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   170
    /* Ask me button */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   171
    button_ask = gtk_check_button_new_with_label (_("Don't ask me again"));
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   172
    g_object_set_data (G_OBJECT (dialog), "chkbtn_ask", button_ask);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   173
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_ask), FALSE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   174
    gtk_box_pack_start (GTK_BOX (vbox),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   175
                        button_ask,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   176
                        FALSE,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   177
                        FALSE,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   178
                        0);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   179
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   180
    /* Create table */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   181
    table = gtk_table_new (num_encoding,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   182
                           2, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   183
                           FALSE);     /* homogouse */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   184
    gtk_table_set_row_spacings (GTK_TABLE (table), 4);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   185
    gtk_table_set_col_spacings (GTK_TABLE (table), 4);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   186
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   187
    if (num_encoding > 10) {
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   188
        /* add scrollwindow */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   189
        GtkWidget   *scroll_window = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   190
        GtkWidget   *view_port = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   191
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   192
        view_port = gtk_viewport_new (NULL, NULL);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   193
        gtk_viewport_set_shadow_type (GTK_VIEWPORT (view_port),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   194
                                       GTK_SHADOW_NONE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   195
        gtk_container_add (GTK_CONTAINER (view_port), table);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   196
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   197
        scroll_window = gtk_scrolled_window_new (NULL, NULL);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   198
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_window),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   199
                                        GTK_POLICY_AUTOMATIC,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   200
                                        GTK_POLICY_AUTOMATIC);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   201
        gtk_scrolled_window_set_shadow_type (
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   202
                            GTK_SCROLLED_WINDOW (scroll_window),
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   203
                            GTK_SHADOW_NONE);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   204
        gtk_container_add (GTK_CONTAINER (scroll_window), view_port);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   205
        
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   206
        gtk_box_pack_start (GTK_BOX (hbox), 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   207
                            scroll_window, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   208
                            TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   209
                            TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   210
                            5);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   211
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   212
        gtk_window_resize (GTK_WINDOW (dialog), 550, 400);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   213
    }else{
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   214
        gint height;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   215
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   216
        gtk_box_pack_start (GTK_BOX (hbox), 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   217
                        table, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   218
                        TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   219
                        TRUE, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   220
                        0);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   221
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   222
        gtk_window_get_size (GTK_WINDOW (dialog), NULL, &height);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   223
        gtk_window_resize (GTK_WINDOW (dialog), 450, height);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   224
    }
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   225
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   226
    fsexam_encoding_iterate_with_func (encoding, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   227
                                       fsexam_construct_index_ui,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   228
                                       table, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   229
                                       &radio_group, 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   230
                                       forname);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   231
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   232
    gtk_widget_show_all (dialog);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   233
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   234
    return dialog;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   235
}