OPTIONCALLBACK(otu_toggle, visible_cols.otu)
OPTIONCALLBACK(sac_toggle, visible_cols.sac)
+OPTIONCALLBACK(nitrox_toggle, visible_cols.nitrox)
+OPTIONCALLBACK(temperature_toggle, visible_cols.temperature)
+OPTIONCALLBACK(cylinder_toggle, visible_cols.cylinder)
+
+static void event_toggle(GtkWidget *w, gpointer _data)
+{
+ gboolean *plot_ev = _data;
+
+ *plot_ev = GTK_TOGGLE_BUTTON(w)->active;
+}
static void preferences_dialog(GtkWidget *w, gpointer data)
{
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
+ button = gtk_check_button_new_with_label("Show Temp");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.temperature);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(temperature_toggle), NULL);
+
+ button = gtk_check_button_new_with_label("Show Cyl");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.cylinder);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(cylinder_toggle), NULL);
+
+ button = gtk_check_button_new_with_label("Show O" UTF8_SUBSCRIPT_2 "%");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.nitrox);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(nitrox_toggle), NULL);
+
button = gtk_check_button_new_with_label("Show SAC");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.sac);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
gconf_client_set_bool(gconf, GCONF_NAME(psi), output_units.pressure == PSI, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(cuft), output_units.volume == CUFT, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(fahrenheit), output_units.temperature == FAHRENHEIT, NULL);
- gconf_client_set_bool(gconf, GCONF_NAME(SAC), ! visible_cols.sac, NULL); /* inverted to get the correct default */
+ gconf_client_set_bool(gconf, GCONF_NAME(TEMPERATURE), visible_cols.temperature, NULL);
+ gconf_client_set_bool(gconf, GCONF_NAME(CYLINDER), visible_cols.cylinder, NULL);
+ gconf_client_set_bool(gconf, GCONF_NAME(NITROX), visible_cols.nitrox, NULL);
+ gconf_client_set_bool(gconf, GCONF_NAME(SAC), visible_cols.sac, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(OTU), visible_cols.otu, NULL);
gconf_client_set_string(gconf, GCONF_NAME(divelist_font), divelist_font, NULL);
}
gtk_widget_destroy(dialog);
}
+static void create_toggle(const char* label, int *on, void *_data)
+{
+ GtkWidget *button, *box = _data;
+
+ button = gtk_check_button_new_with_label(label);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *on);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(event_toggle), on);
+}
+
+static void selectevents_dialog(GtkWidget *w, gpointer data)
+{
+ int result;
+ GtkWidget *dialog, *frame, *vbox, *hbox;
+
+ dialog = gtk_dialog_new_with_buttons("SelectEvents",
+ GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ frame = gtk_frame_new("Enable / Disable Events");
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
+
+ hbox = gtk_hbox_new(FALSE, 6);
+ gtk_container_add(GTK_CONTAINER(frame), hbox);
+
+ evn_foreach(&create_toggle, hbox);
+
+ gtk_widget_show_all(dialog);
+ result = gtk_dialog_run(GTK_DIALOG(dialog));
+ if (result == GTK_RESPONSE_ACCEPT) {
+ repaint_dive();
+ }
+ gtk_widget_destroy(dialog);
+}
+
static void renumber_dialog(GtkWidget *w, gpointer data)
{
int result;
static GtkActionEntry menu_items[] = {
{ "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
{ "LogMenuAction", GTK_STOCK_FILE, "Log", NULL, NULL, NULL},
+ { "FilterMenuAction", GTK_STOCK_FILE, "Filter", NULL, NULL, NULL},
{ "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
{ "OpenFile", GTK_STOCK_OPEN, NULL, "<control>O", NULL, G_CALLBACK(file_open) },
{ "SaveFile", GTK_STOCK_SAVE, NULL, "<control>S", NULL, G_CALLBACK(file_save) },
{ "Import", NULL, "Import", NULL, NULL, G_CALLBACK(import_dialog) },
{ "Preferences", NULL, "Preferences", NULL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
+ { "SelectEvents", NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "Quit", GTK_STOCK_QUIT, NULL, "<control>Q", NULL, G_CALLBACK(quit) },
- { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
+ { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
<menu name=\"LogMenu\" action=\"LogMenuAction\"> \
<menuitem name=\"Renumber\" action=\"Renumber\" /> \
</menu> \
+ <menu name=\"FilterMenu\" action=\"FilterMenuAction\"> \
+ <menuitem name=\"SelectEvents\" action=\"SelectEvents\" /> \
+ </menu> \
<menu name=\"Help\" action=\"HelpMenuAction\"> \
<menuitem name=\"About\" action=\"About\" /> \
</menu> \
gtk_drag_dest_set(notebook, 0, NULL, 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 6);
gtk_widget_get_allocation(page, &allocation);
- gtk_widget_set_size_request(notebook, allocation.width, allocation.height);
+ gtk_window_set_default_size(GTK_WINDOW(win), allocation.width, allocation.height);
gtk_widget_show_all(win);
return GTK_NOTEBOOK(notebook);
output_units.volume = CUFT;
if (gconf_client_get_bool(gconf, GCONF_NAME(fahrenheit), NULL))
output_units.temperature = FAHRENHEIT;
- /* an unset key is FALSE - so in order to get the default behavior right we
- invert the meaning of the SAC key */
+ /* an unset key is FALSE - all these are hidden by default */
+ visible_cols.cylinder = gconf_client_get_bool(gconf, GCONF_NAME(CYLINDER), NULL);
+ visible_cols.temperature = gconf_client_get_bool(gconf, GCONF_NAME(TEMPERATURE), NULL);
+ visible_cols.nitrox = gconf_client_get_bool(gconf, GCONF_NAME(NITROX), NULL);
visible_cols.otu = gconf_client_get_bool(gconf, GCONF_NAME(OTU), NULL);
- visible_cols.sac = ! gconf_client_get_bool(gconf, GCONF_NAME(SAC), NULL);
+ visible_cols.sac = gconf_client_get_bool(gconf, GCONF_NAME(SAC), NULL);
divelist_font = gconf_client_get_string(gconf, GCONF_NAME(divelist_font), NULL);
if (!divelist_font)