Beispiel #1
0
static void
create_page (GKeyFile *key_file, GtkWidget *box)
{
    GtkWidget *grid;
    GList *entries;
    GtkSizeGroup *label_size_group;
    char *type;

    entries = NULL;

    type = g_key_file_get_string (key_file, MAIN_GROUP, "Type", NULL);

    if (g_strcmp0 (type, "Link") == 0)
    {
        entries = g_list_prepend (entries,
                                  item_entry_new ("Comment",
                                          _("Comment"), TRUE, FALSE));
        entries = g_list_prepend (entries,
                                  item_entry_new ("URL",
                                          _("URL"), FALSE, TRUE));
        entries = g_list_prepend (entries,
                                  item_entry_new ("GenericName",
                                          _("Description"), TRUE, FALSE));
    }
    else if (g_strcmp0 (type, "Application") == 0)
    {
        entries = g_list_prepend (entries,
                                  item_entry_new ("Comment",
                                          _("Comment"), TRUE, FALSE));
        entries = g_list_prepend (entries,
                                  item_entry_new ("Exec",
                                          _("Command"), FALSE, FALSE));
        entries = g_list_prepend (entries,
                                  item_entry_new ("GenericName",
                                          _("Description"), TRUE, FALSE));
    }
    else
    {
        /* we only handle launchers and links */

        /* ensure that we build an empty gid with a dummy row at the end */
        goto build_grid;
    }
    g_free (type);

build_grid:
    label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group");

    grid = build_grid (box, key_file, label_size_group, entries);
    g_list_free (entries);

    gtk_box_pack_start (GTK_BOX (box), grid, FALSE, TRUE, 0);

    gtk_widget_show_all (GTK_WIDGET (box));
}
Beispiel #2
0
void ParamsDialog::OnFromFile(wxCommandEvent&) {
	wxString prompt("Select Parameter File");
	wxFileDialog dialog(this, prompt, default_dir_, "xperimenter.csv",
		"CSV files (*.csv)|*.csv", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
	if (dialog.ShowModal() == wxID_CANCEL) return;
	const wxString pathname = dialog.GetPath();
	default_dir_ = ::get_path(pathname);
	params_.clear();
	init_params();
	params_.load(pathname);
	build_grid();
}
Beispiel #3
0
void ParamsDialog::InitializeControls() {
	if (params_.empty()) return;
	build_grid();
}