summaryrefslogtreecommitdiff
path: root/tests/testcalendar.c
diff options
context:
space:
mode:
authorMathias Hasselmann <hasselmm@src.gnome.org>2007-12-28 09:36:21 +0000
committerMathias Hasselmann <hasselmm@src.gnome.org>2007-12-28 09:36:21 +0000
commitfcf3e712923cd7cb9e9b19c43b3759af8d7da74f (patch)
treeccf23b30b7bda342f82011fde0486c53d3b2cb9c /tests/testcalendar.c
parentdbac73cfb1eac11754a0acd76583c870dea9ca7a (diff)
downloadgdk-pixbuf-fcf3e712923cd7cb9e9b19c43b3759af8d7da74f.tar.gz
Restructure testcalendar for testing calendar details. (#339540)
* tests/testcalendar.c: Push code arround for testing calendar details. svn path=/trunk/; revision=19264
Diffstat (limited to 'tests/testcalendar.c')
-rw-r--r--tests/testcalendar.c522
1 files changed, 398 insertions, 124 deletions
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index 0ab4409ee..7ac0f8c0c 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -23,12 +23,14 @@
#include <string.h>
#include <gtk/gtk.h>
-#define DEF_PAD 10
-#define DEF_PAD_SMALL 5
+#define DEF_PAD 12
+#define DEF_PAD_SMALL 6
#define TM_YEAR_BASE 1900
-typedef struct _CalendarData {
+typedef struct _CalendarData
+{
+ GtkWidget *calendar_widget;
GtkWidget *flag_checkboxes[5];
gboolean settings[5];
GtkWidget *font_dialog;
@@ -37,9 +39,14 @@ typedef struct _CalendarData {
GtkWidget *prev_sig;
GtkWidget *last_sig;
GtkWidget *month;
+
+ GHashTable *details_table;
+ GtkTextBuffer *details_buffer;
+ guint details_changed;
} CalendarData;
-enum {
+enum
+{
calendar_show_header,
calendar_show_days,
calendar_month_change,
@@ -66,7 +73,49 @@ void calendar_date_to_string (CalendarData *data,
g_date_free (date);
}
-void calendar_set_signal_strings (char *sig_str,
+static void
+calendar_set_detail (CalendarData *data,
+ guint year,
+ guint month,
+ guint day,
+ gchar *detail)
+{
+ gchar *key = g_strdup_printf ("%04d-%02d-%02d", year, month + 1, day);
+ g_hash_table_replace (data->details_table, key, detail);
+}
+
+static G_CONST_RETURN gchar*
+calendar_get_detail (CalendarData *data,
+ guint year,
+ guint month,
+ guint day)
+{
+ const gchar *detail;
+ gchar *key;
+
+ key = g_strdup_printf ("%04d-%02d-%02d", year, month + 1, day);
+ detail = g_hash_table_lookup (data->details_table, key);
+ g_free (key);
+
+ return detail;
+}
+
+static void
+calendar_update_details (CalendarData *data)
+{
+ guint year, month, day;
+ const gchar *detail;
+
+ gtk_calendar_get_date (GTK_CALENDAR (data->calendar_widget), &year, &month, &day);
+ detail = calendar_get_detail (data, year, month, day);
+
+ g_signal_handler_block (data->details_buffer, data->details_changed);
+ gtk_text_buffer_set_text (data->details_buffer, detail ? detail : "", -1);
+ g_signal_handler_unblock (data->details_buffer, data->details_changed);
+}
+
+static void
+calendar_set_signal_strings (char *sig_str,
CalendarData *data)
{
const gchar *prev_sig;
@@ -95,6 +144,8 @@ void calendar_day_selected (GtkWidget *widget,
calendar_date_to_string (data, buffer+14, 256-14);
calendar_set_signal_strings (buffer, data);
+
+ calendar_update_details (data);
}
void calendar_day_selected_double_click (GtkWidget *widget,
@@ -153,155 +204,258 @@ void calendar_next_year( GtkWidget *widget,
}
-void calendar_set_flags( CalendarData *calendar )
+static void
+calendar_set_flags (CalendarData *calendar)
{
- gint i;
- gint options=0;
- for (i=0;i<5;i++)
+ gint options = 0, i;
+
+ for (i = 0; i < G_N_ELEMENTS (calendar->settings); i++)
if (calendar->settings[i])
- {
- options=options + (1<<i);
- }
+ options=options + (1 << i);
+
if (calendar->window)
gtk_calendar_set_display_options (GTK_CALENDAR (calendar->window), options);
}
-void calendar_toggle_flag( GtkWidget *toggle,
- CalendarData *calendar )
+static void
+calendar_toggle_flag (GtkWidget *toggle,
+ CalendarData *calendar)
{
gint i;
- gint j;
- j=0;
- for (i=0; i<5; i++)
+
+ for (i = 0; i < G_N_ELEMENTS (calendar->flag_checkboxes); i++)
if (calendar->flag_checkboxes[i] == toggle)
- j = i;
+ calendar->settings[i] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
- calendar->settings[j]=!calendar->settings[j];
calendar_set_flags(calendar);
}
-void calendar_font_selection_ok (GtkWidget *button,
- CalendarData *calendar)
+void
+calendar_select_font (GtkWidget *button,
+ CalendarData *calendar)
{
+ const char *font = NULL;
GtkRcStyle *style;
- char *font_name;
if (calendar->window)
- {
- font_name = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
- if (font_name)
+ font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
+
+ if (font)
{
style = gtk_rc_style_new ();
pango_font_description_free (style->font_desc);
- style->font_desc = pango_font_description_from_string (font_name);
+ style->font_desc = pango_font_description_from_string (font);
gtk_widget_modify_style (calendar->window, style);
- g_free (font_name);
}
+}
+
+static G_CONST_RETURN gchar*
+calendar_detail_cb (GtkCalendar *calendar,
+ guint year,
+ guint month,
+ guint day,
+ gpointer data)
+{
+ return calendar_get_detail (data, year, month, day);
+}
+
+static void
+calendar_details_changed (GtkTextBuffer *buffer,
+ CalendarData *data)
+{
+ GtkTextIter start, end;
+ guint year, month, day;
+ gchar *detail;
+
+ gtk_text_buffer_get_start_iter(buffer, &start);
+ gtk_text_buffer_get_end_iter(buffer, &end);
+
+ gtk_calendar_get_date (GTK_CALENDAR (data->calendar_widget), &year, &month, &day);
+ detail = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+
+ if (!detail[0])
+ {
+ g_free (detail);
+ detail = NULL;
}
- gtk_widget_destroy (calendar->font_dialog);
+ calendar_set_detail (data, year, month, day, detail);
+ gtk_widget_queue_resize (data->calendar_widget);
}
-void calendar_select_font( GtkWidget *button,
- CalendarData *calendar )
+static void
+demonstrate_details (CalendarData *data)
{
- GtkWidget *window;
+ static char *rainbow[] = { "#900", "#980", "#390", "#095", "#059", "#309", "#908" };
+ GtkCalendar *calendar = GTK_CALENDAR (data->calendar_widget);
+ gint row, col;
- if (!calendar->font_dialog) {
- window = gtk_font_selection_dialog_new ("Font Selection Dialog");
- g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
- calendar->font_dialog = window;
-
- gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
+ for (row = 0; row < 6; ++row)
+ for (col = 0; col < 7; ++col)
+ {
+ gint year, month, day;
+ gchar *detail;
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &calendar->font_dialog);
+ year = calendar->year;
+ month = calendar->month;
+ month += calendar->day_month[row][col];
+ day = calendar->day[row][col];
- g_signal_connect (GTK_FONT_SELECTION_DIALOG (window)->ok_button,
- "clicked", G_CALLBACK (calendar_font_selection_ok),
- calendar);
- g_signal_connect_swapped (GTK_FONT_SELECTION_DIALOG (window)->cancel_button,
- "clicked", G_CALLBACK (gtk_widget_destroy),
- calendar->font_dialog);
+ if (month < 1)
+ {
+ month += 12;
+ year -= 1;
+ }
+ else if (month > 12)
+ {
+ month -= 12;
+ year += 1;
}
- window=calendar->font_dialog;
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
+
+ detail = g_strdup_printf ("<span color='%s'>yadda\n"
+ "(%04d-%02d-%02d)</span>",
+ rainbow[(day - 1) % 7],
+ year, month, day);
+
+ calendar_set_detail (data, year, month - 1, day, detail);
+ }
+
+ gtk_widget_queue_resize (data->calendar_widget);
+ calendar_update_details (data);
+}
+
+static void
+reset_details (CalendarData *data)
+{
+ g_hash_table_remove_all (data->details_table);
+ gtk_widget_queue_resize (data->calendar_widget);
+ calendar_update_details (data);
+}
+
+static void
+calendar_toggle_details (GtkWidget *widget,
+ CalendarData *data)
+{
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ gtk_calendar_set_detail_func (GTK_CALENDAR (data->calendar_widget),
+ calendar_detail_cb, data, NULL);
else
- gtk_widget_destroy (window);
+ gtk_calendar_set_detail_func (GTK_CALENDAR (data->calendar_widget),
+ NULL, NULL, NULL);
+}
+
+static GtkWidget*
+create_expander (const char *caption,
+ GtkWidget *child,
+ gdouble xscale,
+ gdouble yscale)
+{
+ GtkWidget *expander = gtk_expander_new ("");
+ GtkWidget *label = gtk_expander_get_label_widget (GTK_EXPANDER (expander));
+ GtkWidget *align = gtk_alignment_new (0, 0, xscale, yscale);
+
+ gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 18, 0);
+ gtk_label_set_markup (GTK_LABEL (label), caption);
+
+ gtk_container_add (GTK_CONTAINER (expander), align);
+ gtk_container_add (GTK_CONTAINER (align), child);
+ return expander;
}
-void create_calendar(void)
+static GtkWidget*
+create_frame (const char *caption,
+ GtkWidget *child,
+ gdouble xscale,
+ gdouble yscale)
+{
+ GtkWidget *frame = gtk_frame_new ("");
+ GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (frame));
+ GtkWidget *align = gtk_alignment_new (0, 0, xscale, yscale);
+
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 18, 0);
+ gtk_label_set_markup (GTK_LABEL (label), caption);
+
+ gtk_container_add (GTK_CONTAINER (frame), align);
+ gtk_container_add (GTK_CONTAINER (align), child);
+
+ return frame;
+}
+
+static void
+detail_width_changed (GtkSpinButton *button,
+ CalendarData *data)
+{
+ gint value = (gint) gtk_spin_button_get_value (button);
+ gtk_calendar_set_detail_width_chars (GTK_CALENDAR (data->calendar_widget), value);
+}
+
+static void
+detail_height_changed (GtkSpinButton *button,
+ CalendarData *data)
+{
+ gint value = (gint) gtk_spin_button_get_value (button);
+ gtk_calendar_set_detail_height_rows (GTK_CALENDAR (data->calendar_widget), value);
+}
+
+static void
+create_calendar(void)
{
- GtkWidget *window;
- GtkWidget *vbox, *vbox2, *vbox3;
- GtkWidget *hbox;
- GtkWidget *hbbox;
- GtkWidget *calendar;
- GtkWidget *toggle;
- GtkWidget *button;
- GtkWidget *frame;
- GtkWidget *separator;
- GtkWidget *label;
- GtkWidget *bbox;
static CalendarData calendar_data;
+
+ GtkWidget *window, *hpaned, *vbox, *rpane, *hbox;
+ GtkWidget *calendar, *toggle, *scroller, *button;
+ GtkWidget *frame, *label, *bbox, *align, *details;
+
+ GtkSizeGroup *size;
+ GtkStyle *style;
+ gchar *font;
gint i;
struct {
+ gboolean init;
char *label;
} flags[] =
{
- { "Show Heading" },
- { "Show Day Names" },
- { "No Month Change" },
- { "Show Week Numbers" },
- { "Week Start Monday" }
+ { TRUE, "Show _Heading" },
+ { TRUE, "Show Day _Names" },
+ { FALSE, "No Month _Change" },
+ { TRUE, "Show _Week Numbers" },
+ { FALSE, "Week Start _Monday" },
};
-
calendar_data.window = NULL;
calendar_data.font_dialog = NULL;
+ calendar_data.details_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- for (i=0; i<5; i++) {
- calendar_data.settings[i]=0;
- }
+ for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++)
+ calendar_data.settings[i] = 0;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GtkCalendar Example");
- gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 12);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_signal_connect (window, "delete-event",
G_CALLBACK (gtk_false),
NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- vbox = gtk_vbox_new (FALSE, DEF_PAD);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ hpaned = gtk_hpaned_new ();
- /*
- * The top part of the window, Calendar, flags and fontsel.
- */
+ /* Calendar widget */
- hbox = gtk_hbox_new(FALSE, DEF_PAD);
- gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
- hbbox = gtk_hbutton_box_new();
- gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
- gtk_box_set_spacing(GTK_BOX(hbbox), 5);
+ calendar = gtk_calendar_new ();
+ calendar_data.calendar_widget = calendar;
+ frame = create_frame ("<b>Calendar</b>", calendar, 0, 0);
+ gtk_paned_pack1 (GTK_PANED (hpaned), frame, TRUE, FALSE);
- /* Calendar widget */
- frame = gtk_frame_new("Calendar");
- gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
- calendar=gtk_calendar_new();
calendar_data.window = calendar;
calendar_set_flags(&calendar_data);
gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
- gtk_container_add (GTK_CONTAINER (frame), calendar);
+
g_signal_connect (calendar, "month_changed",
G_CALLBACK (calendar_month_changed),
&calendar_data);
@@ -324,82 +478,202 @@ void create_calendar(void)
G_CALLBACK (calendar_next_year),
&calendar_data);
+ rpane = gtk_vbox_new (FALSE, DEF_PAD_SMALL);
+ gtk_paned_pack2 (GTK_PANED (hpaned), rpane, FALSE, FALSE);
+
+ /* Build the right font-button */
+
+ vbox = gtk_vbox_new(FALSE, DEF_PAD_SMALL);
+ frame = create_frame ("<b>Options</b>", vbox, 1, 0);
+ gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0);
+ size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ gtk_widget_ensure_style (calendar);
+ style = gtk_widget_get_style (calendar);
+ font = pango_font_description_to_string (style->font_desc);
+ button = gtk_font_button_new_with_font (font);
+ g_free (font);
+
+ g_signal_connect (button, "font-set",
+ G_CALLBACK(calendar_select_font),
+ &calendar_data);
+
+ label = gtk_label_new_with_mnemonic ("_Font:");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_size_group_add_widget (size, label);
+
+ hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ /* Build the width entry */
+
+ button = gtk_spin_button_new_with_range (0, 127, 1);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (button),
+ gtk_calendar_get_detail_width_chars (GTK_CALENDAR (calendar)));
+
+ g_signal_connect (button, "value-changed",
+ G_CALLBACK (detail_width_changed),
+ &calendar_data);
+
+ label = gtk_label_new_with_mnemonic ("Details W_idth:");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_size_group_add_widget (size, label);
+
+ hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ /* Build the height entry */
+
+ button = gtk_spin_button_new_with_range (0, 127, 1);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (button),
+ gtk_calendar_get_detail_height_rows (GTK_CALENDAR (calendar)));
- separator = gtk_vseparator_new ();
- gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
+ g_signal_connect (button, "value-changed",
+ G_CALLBACK (detail_height_changed),
+ &calendar_data);
- vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
- gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
+ label = gtk_label_new_with_mnemonic ("Details H_eight:");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_size_group_add_widget (size, label);
+
+ hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ /* Build the right details frame */
+
+ vbox = gtk_vbox_new(FALSE, DEF_PAD_SMALL);
+ frame = create_frame ("<b>Details</b>", vbox, 1, 1);
+ gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0);
+
+ details = gtk_text_view_new();
+ calendar_data.details_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (details));
+
+ calendar_data.details_changed = g_signal_connect (calendar_data.details_buffer, "changed",
+ G_CALLBACK (calendar_details_changed),
+ &calendar_data);
+
+ scroller = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (scroller), details);
+
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_box_pack_start (GTK_BOX (vbox), scroller, FALSE, TRUE, 0);
+
+ hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL);
+ align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
+ gtk_container_add (GTK_CONTAINER (align), hbox);
+ gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, TRUE, 0);
+
+ button = gtk_button_new_with_mnemonic ("Demonstrate _Details");
+
+ g_signal_connect_swapped (button,
+ "clicked",
+ G_CALLBACK (demonstrate_details),
+ &calendar_data);
+
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+
+ button = gtk_button_new_with_mnemonic ("_Reset Details");
+
+ g_signal_connect_swapped (button,
+ "clicked",
+ G_CALLBACK (reset_details),
+ &calendar_data);
+
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+
+ toggle = gtk_check_button_new_with_mnemonic ("_Show Details");
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK(calendar_toggle_details),
+ &calendar_data);
+ gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0);
/* Build the Right frame with the flags in */
- frame = gtk_frame_new("Flags");
- gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
- vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
- gtk_container_add(GTK_CONTAINER(frame), vbox3);
+ vbox = gtk_vbox_new(FALSE, DEF_PAD_SMALL);
+ frame = create_expander ("<b>Flags</b>", vbox, 1, 0);
+ gtk_box_pack_start (GTK_BOX (rpane), frame, TRUE, TRUE, 0);
- for (i = 0; i < 5; i++)
+ for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++)
{
- toggle = gtk_check_button_new_with_label(flags[i].label);
- g_signal_connect (toggle,
- "toggled",
- G_CALLBACK(calendar_toggle_flag),
+ toggle = gtk_check_button_new_with_mnemonic(flags[i].label);
+ gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0);
+ calendar_data.flag_checkboxes[i] = toggle;
+
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (calendar_toggle_flag),
&calendar_data);
- gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
- calendar_data.flag_checkboxes[i]=toggle;
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), flags[i].init);
}
- /* Build the right font-button */
- button = gtk_button_new_with_label("Font...");
- g_signal_connect (button,
- "clicked",
- G_CALLBACK(calendar_select_font),
- &calendar_data);
- gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
/*
* Build the Signal-event part.
*/
- frame = gtk_frame_new("Signal events");
- gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
-
- vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
- gtk_container_add(GTK_CONTAINER(frame), vbox2);
+ vbox = gtk_vbox_new (TRUE, DEF_PAD_SMALL);
+ frame = create_frame ("<b>Signal Events</b>", vbox, 1, 0);
hbox = gtk_hbox_new (FALSE, 3);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Signal:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.last_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 3);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Previous signal:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.prev_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 3);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Second previous signal:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.prev2_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0);
+ /*
+ * Glue everything together
+ */
+
bbox = gtk_hbutton_box_new ();
- gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
button = gtk_button_new_with_label ("Close");
- g_signal_connect (button, "clicked",
- G_CALLBACK (gtk_main_quit),
- NULL);
+ g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
gtk_container_add (GTK_CONTAINER (bbox), button);
+
+ vbox = gtk_vbox_new (FALSE, DEF_PAD_SMALL);
+
+ gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
- gtk_widget_show_all(window);
+ gtk_window_set_default_size (GTK_WINDOW (window), 600, 0);
+ gtk_widget_show_all (window);
}