diff options
Diffstat (limited to 'dialogs.c')
-rw-r--r-- | dialogs.c | 138 |
1 files changed, 102 insertions, 36 deletions
@@ -1,6 +1,7 @@ #include <gtk/gtk.h> #include "dialogs.h" +/** Signature level type */ typedef enum lvl { NOT_USED = 0, @@ -10,6 +11,7 @@ typedef enum lvl REQUIRED } TLevel; +/** Signature leve combo box text */ gchar *sig_level_texts[] = { "Do not use signature level", @@ -19,7 +21,9 @@ gchar *sig_level_texts[] = "Level 3 - required" }; - +/** +* Save options to cmd_params +*/ void save_options_to_cmdparams() { gint tmp; @@ -43,32 +47,36 @@ void save_options_to_cmdparams() /* ComboBox */ switch(tmp) { - case NEVER: - g_free(cmd_params.level); - cmd_params.level = g_strdup("0"); - break; - case SUPPORTED: - g_free(cmd_params.level); - cmd_params.level = g_strdup("1"); - break; - case PREFERED: - g_free(cmd_params.level); - cmd_params.level = g_strdup("2"); - break; - case REQUIRED: - g_free(cmd_params.level); - cmd_params.level = g_strdup("3"); - break; - default: - if(cmd_params.level != NULL) - { - g_free(cmd_params.level); - cmd_params.level = NULL; - } - break; + case NEVER: + g_free(cmd_params.level); + cmd_params.level = g_strdup("0"); + break; + case SUPPORTED: + g_free(cmd_params.level); + cmd_params.level = g_strdup("1"); + break; + case PREFERED: + g_free(cmd_params.level); + cmd_params.level = g_strdup("2"); + break; + case REQUIRED: + g_free(cmd_params.level); + cmd_params.level = g_strdup("3"); + break; + default: + if(cmd_params.level != NULL) + { + g_free(cmd_params.level); + cmd_params.level = NULL; + } + break; } } + +/** +* Prefill set options to dialog +*/ static void set_options_from_cmdparams () { @@ -126,8 +134,10 @@ set_options_from_cmdparams () -/* Function to open a dialog box displaying the message provided. */ -void options_dialog () +/** +* Function opens option dialog box +*/ +void show_options_dialog () { GtkWidget *label, *content_area, *halign, *hsep, *table; gint result, row; @@ -143,8 +153,6 @@ void options_dialog () content_area = gtk_dialog_get_content_area (GTK_DIALOG (options.dialog)); - - /* Page OTIONS */ table = gtk_table_new (21, 2, FALSE); gtk_container_add (GTK_CONTAINER (content_area), table); @@ -301,7 +309,7 @@ void options_dialog () row++; - + /* Prefill set options */ set_options_from_cmdparams(); gtk_widget_show_all (table); @@ -325,17 +333,75 @@ show_message (GtkMessageType type, const gchar *format, gchar *msgtxt, const gch GtkWidget *dialog; dialog = gtk_message_dialog_new ( GTK_WINDOW (gui.win), - GTK_DIALOG_DESTROY_WITH_PARENT, - type, - GTK_BUTTONS_OK, - format, - msgtxt); + GTK_DIALOG_DESTROY_WITH_PARENT, + type, + GTK_BUTTONS_OK, + format, + msgtxt); gtk_window_set_title (GTK_WINDOW (dialog), GUI_TITLE ); gtk_message_dialog_format_secondary_text ( GTK_MESSAGE_DIALOG (dialog), - format_sec, - msgtxt_sec); + format_sec, + msgtxt_sec); gtk_dialog_run ( GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } + + + +/** +* Function shows ncpmount command with set options +*/ +void show_ncpmount_command () +{ + GtkWidget *dialog, *label, *content_area, *halign, *hsep, *entry_command, *vbox; + + gint strlen; + + gchar *command = get_ncpmount_command(&strlen); + + /* Create the widgets */ + dialog = gtk_dialog_new_with_buttons ("Show ncpmount command", + GTK_WINDOW (gui.win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); + + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + + vbox = gtk_vbox_new(FALSE,6); + gtk_container_add (GTK_CONTAINER (content_area), vbox); + + gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); + + halign = gtk_alignment_new(0, 0, 0, 1); + label = gtk_label_new ("ncpmount command with selected options:"); + gtk_container_add(GTK_CONTAINER(halign), label); + gtk_box_pack_start (GTK_BOX (vbox), halign, FALSE, TRUE, 0); + + + /* ----- */ + hsep = gtk_hseparator_new(); + gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0); + + + entry_command = gtk_entry_new (); + gtk_box_pack_start (GTK_BOX (vbox), entry_command, FALSE, TRUE, 0); + gtk_entry_set_editable (GTK_ENTRY(entry_command), FALSE); + gtk_entry_set_text (GTK_ENTRY(entry_command), command); + gtk_entry_set_width_chars (GTK_ENTRY(entry_command), strlen); + + /* ----- */ + hsep = gtk_hseparator_new(); + gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0); + + + + + gtk_widget_show_all(dialog); + + gtk_dialog_run ( GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + +} |