handlers.c File Reference

question handlers of the GTK+ frontend More...

#include "handlers.h"
#include <string.h>
#include <gtk/gtk.h>
#include "frontend.h"
#include "question.h"
#include "fe_gtk.h"
#include "fe_data.h"
#include "ui.h"

Include dependency graph for handlers.c:

Go to the source code of this file.

Functions

static void set_value_from_toggle_button (struct question *question, GtkToggleButton *toggle_button)
 Update a boolean question value from the status of a toggle button.
static int handle_boolean_radio (struct frontend *fe, struct question *question, GtkWidget *question_box)
 The handler for boolean questions implemented as radio buttons.
static void handle_false_button (GtkWidget *widget, struct frontend *fe)
 Handle activation of the "false" button.
static void handle_true_button (GtkWidget *widget, struct frontend *fe)
 Handle activation of the "true" button.
static int handle_boolean_buttons (struct frontend *fe, struct question *question, GtkWidget *question_box)
 An handler for boolean questions implemented as Yes/No buttons in the action box.
int fe_gtk_handle_boolean (struct frontend *fe, struct question *question, GtkWidget *question_box)
 Handler for question of boolean type.
int fe_gtk_handle_note (struct frontend *fe, struct question *question, GtkWidget *question_box)
 Handler for "question" of note type.
int fe_gtk_handle_text (struct frontend *fe, struct question *question, GtkWidget *question_box)
 Handler for "question" of text type.
static void set_value_from_entry (struct question *question, GtkEntry *entry)
 Setter function for handler based on GtkEntry.
static GtkWidget * create_entry_alignment (GtkWidget *entry)
 Create a GtkAlignment widget to correctly align entry widget inside the question box.
int fe_gtk_handle_password (struct frontend *fe, struct question *question, GtkWidget *question_box)
 Handler for question of password type.
int fe_gtk_handle_string (struct frontend *fe, struct question *question, GtkWidget *question_box)
 Handler for question of string type.


Detailed Description

question handlers of the GTK+ frontend

See also:
select_handlers.c

Definition in file handlers.c.


Function Documentation

static GtkWidget* create_entry_alignment ( GtkWidget *  entry  )  [static]

Create a GtkAlignment widget to correctly align entry widget inside the question box.

Parameters:
entry an entry widget
Returns:
a widget containing the entry

Definition at line 279 of file handlers.c.

Referenced by fe_gtk_handle_password(), and fe_gtk_handle_string().

int fe_gtk_handle_boolean ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
)

Handler for question of boolean type.

This will register the corresponding setter.

Parameters:
fe cdebconf frontend
question handled question
question_box container for handler's widgets
Returns:
DC_OK if everything is fine, DC_NOTOK otherwise

Definition at line 221 of file handlers.c.

References handle_boolean_buttons(), handle_boolean_radio(), and IS_QUESTION_SINGLE.

int fe_gtk_handle_note ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
)

Handler for "question" of note type.

Parameters:
fe cdebconf frontend
question handled question
question_box container for handler's widgets
Returns:
DC_OK if everything is fine, DC_NOTOK otherwise

Definition at line 238 of file handlers.c.

References DEFAULT_PADDING, and fe_gtk_add_common_layout().

Referenced by fe_gtk_handle_text().

int fe_gtk_handle_password ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
)

Handler for question of password type.

Parameters:
fe cdebconf frontend
question handled question
question_box container for handler's widgets
Returns:
DC_OK if everything is fine, DC_NOTOK otherwise

Definition at line 298 of file handlers.c.

References create_entry_alignment(), fe_gtk_add_common_layout(), fe_gtk_is_first_question(), fe_gtk_register_setter(), set_value_from_entry(), and SETTER_FUNCTION.

int fe_gtk_handle_string ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
)

Handler for question of string type.

Parameters:
fe cdebconf frontend
question handled question
question_box container for handler's widgets
Returns:
DC_OK if everything is fine, DC_NOTOK otherwise

Definition at line 330 of file handlers.c.

References create_entry_alignment(), fe_gtk_add_common_layout(), fe_gtk_is_first_question(), fe_gtk_register_setter(), set_value_from_entry(), and SETTER_FUNCTION.

int fe_gtk_handle_text ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
)

Handler for "question" of text type.

This currently just calls fe_gtk_handle_note()

Parameters:
fe cdebconf frontend
question handled question
question_box container for handler's widgets
Returns:
DC_OK if everything is fine, DC_NOTOK otherwise

Definition at line 256 of file handlers.c.

References fe_gtk_handle_note().

static int handle_boolean_buttons ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
) [static]

An handler for boolean questions implemented as Yes/No buttons in the action box.

This handler will be used when only a single question has been asked.

Parameters:
fe cdebconf frontend
question question being handled
question_box container for question widgets
Returns:
DC_NOTOK in case of errors, DC_OK otherwise

Definition at line 173 of file handlers.c.

References fe_gtk_add_button(), fe_gtk_add_common_layout(), fe_gtk_get_text(), handle_false_button(), and handle_true_button().

Referenced by fe_gtk_handle_boolean().

static int handle_boolean_radio ( struct frontend *  fe,
struct question *  question,
GtkWidget *  question_box 
) [static]

The handler for boolean questions implemented as radio buttons.

This handler is used when multiple questions are used in a row.

Parameters:
fe cdebconf frontend
question question being handled
question_box container for question widgets
Returns:
DC_NOTOK if an error happened, DC_OK otherwise

Definition at line 77 of file handlers.c.

References DEFAULT_PADDING, fe_gtk_add_common_layout(), fe_gtk_get_text(), fe_gtk_is_first_question(), fe_gtk_register_setter(), set_value_from_toggle_button(), and SETTER_FUNCTION.

Referenced by fe_gtk_handle_boolean().

static void handle_false_button ( GtkWidget *  widget,
struct frontend *  fe 
) [static]

Handle activation of the "false" button.

This will set the value of the corresponding question.

Parameters:
widget the activated button
fe cdebconf frontend
See also:
handle_boolean_buttons()

Definition at line 139 of file handlers.c.

References fe_gtk_set_answer_ok().

Referenced by handle_boolean_buttons().

static void handle_true_button ( GtkWidget *  widget,
struct frontend *  fe 
) [static]

Handle activation of the "true" button.

This will set the value of the corresponding question.

Parameters:
widget the activated button
fe cdebconf frontend
See also:
handle_boolean_buttons()

Definition at line 155 of file handlers.c.

References fe_gtk_set_answer_ok().

Referenced by handle_boolean_buttons().

static void set_value_from_entry ( struct question *  question,
GtkEntry *  entry 
) [static]

Setter function for handler based on GtkEntry.

Parameters:
question handled question
entry entry where the value will be read
See also:
setter_function

Definition at line 268 of file handlers.c.

Referenced by fe_gtk_handle_password(), and fe_gtk_handle_string().

static void set_value_from_toggle_button ( struct question *  question,
GtkToggleButton *  toggle_button 
) [static]

Update a boolean question value from the status of a toggle button.

Parameters:
question question to set
toggle_button associated toggle button

Definition at line 59 of file handlers.c.

Referenced by handle_boolean_radio().


Generated on Sat Jul 7 23:41:42 2007 for fe_gtk by  doxygen 1.5.1