示例#1
0
void
init_license(void)
{
	int ret;

	ret = access("license", F_OK);
	set_license(ret == 0);
}
static void
champlain_map_source_desc_set_property (GObject *object,
    guint prop_id,
    const GValue *value,
    GParamSpec *pspec)
{
  ChamplainMapSourceDesc *desc = CHAMPLAIN_MAP_SOURCE_DESC (object);

  switch (prop_id)
    {
    case PROP_ID:
      set_id (desc, g_value_get_string (value));

    case PROP_NAME:
      set_name (desc, g_value_get_string (value));
      break;

    case PROP_LICENSE:
      set_license (desc, g_value_get_string (value));
      break;

    case PROP_LICENSE_URI:
      set_license_uri (desc, g_value_get_string (value));
      break;

    case PROP_URI_FORMAT:
      set_uri_format (desc, g_value_get_string (value));
      break;

    case PROP_MIN_ZOOM_LEVEL:
      set_min_zoom_level (desc, g_value_get_uint (value));
      break;

    case PROP_MAX_ZOOM_LEVEL:
      set_max_zoom_level (desc, g_value_get_uint (value));
      break;

    case PROP_TILE_SIZE:
      set_tile_size (desc, g_value_get_uint (value));
      break;

    case PROP_PROJECTION:
      set_projection (desc, g_value_get_enum (value));
      break;

    case PROP_CONSTRUCTOR:
      set_constructor (desc, g_value_get_pointer (value));
      break;

    case PROP_DATA:
      set_data (desc, g_value_get_pointer (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
    }
}
// glade/gtkbuilder needs this constructor
GscAboutDialog::GscAboutDialog(BaseObjectType* gtkcobj, const app_ui_res_ref_t& ref_ui)
		: AppUIResWidget<GscAboutDialog, false, Gtk::AboutDialog>(gtkcobj, ref_ui)
{
	// Connect callbacks

	// APP_GTKMM_CONNECT_VIRTUAL(delete_event);  // make sure the event handler is called

	APP_GTKMM_CONNECT_VIRTUAL(response);

	// Note: The dialogs have ESC accelerator attached by default.


	set_url_hook(sigc::mem_fun(*this, &GscAboutDialog::on_activate_url));
	set_email_hook(sigc::mem_fun(*this, &GscAboutDialog::on_activate_email));


	// Note: AboutDialog changed "name" property to "program-name" in gtk 2.12.
	// We don't set either, but rely on Glib::set_application_name() during init, which
	// works with both older and newer versions.

	set_version(VERSION);

	// set these properties here (after setting hooks) to make the links work.
	set_website("http://gsmartcontrol.berlios.de/");

	set_license(LicenseTextResData().get_string());

	// spammers go away
	set_copyright("Copyright (C) 2008 - 2009  Alexander Shaduri " "<ashaduri" "" "@" "" "" "gmail.com>");


	std::string authors_str = AuthorsTextResData().get_string();
	hz::string_any_to_unix(authors_str);

	std::list<Glib::ustring> authors;
	hz::string_split(authors_str, '\n', authors, true);

	for (std::list<Glib::ustring>::iterator iter = authors.begin(); iter != authors.end(); ++iter) {
		std::string s = *iter;
		hz::string_replace(s, " '@' ", "@");  // despammer
		hz::string_replace(s, " 'at' ", "@");  // despammer
		*iter = s;
	}

	set_authors(authors);

	set_documenters(authors);


// 	run();  // don't use run - it's difficult to exit it manually.
// 	show();  // shown by the caller to enable setting the parent window.
}
示例#4
0
文件: about.cpp 项目: Me-TV/Me-TV
/**
 * Construct the (Singleton) about dialogue.
 *
 * @return a pointer to the (Singleton) about dialogue.
 */
Gtk::AboutDialog * About::create() {
	auto about = new Gtk::AboutDialog;
	std::vector<Glib::ustring> authors;
	authors.push_back("Michael Lamothe <*****@*****.**>");
	authors.push_back("Russel Winder <*****@*****.**>");
	//std::vector<Glib::ustring> documentors;
	about->set_authors(authors);
	about->set_comments(APPLICATION_NAME " is a Digital Television (DVB) viewer for GTK+3.");
	about->set_copyright(u8"Copyright © 2010–2011 Michael Lamothe <[email protected]\nCopyright © 2014, 2016	Russel Winder <*****@*****.**>");
	//about->set_documenters(documentors);
	about->set_license("This program is licenced under GNU General Public Licence (GPL) version 3.");
	about->set_logo(Gdk::Pixbuf::create_from_resource("/me-tv/images/me-tv.png"));
	about->set_name(APPLICATION_NAME);
	about->set_translator_credits("Translator Credits");
	about->set_version(VERSION);
	return about;
}
示例#5
0
        MyAboutDialog(): Gtk::AboutDialog(),m_link(PACKAGE_URL,PACKAGE_URL){
            set_version(PACKAGE_VERSION);
            std::vector<Glib::ustring> authors;
            authors.push_back("Quentin Geissmann<*****@*****.**>");
            set_authors(authors);
            set_license("GPL_3_0");
            set_copyright("Quentin Geissmann 2012-2013");

            #if defined _WIN64 || defined _WIN32

            std::stringstream ss;
            ss<<ABOUT_TEXT<<std::endl<<PACKAGE_URL;
            set_comments(ss.str());
            #else
            set_website(PACKAGE_URL);
            set_website_label("Website");
            set_comments(ABOUT_TEXT);
            #endif

        set_logo(Gui_PixbufOpener::pixbufOpen(LOGO_IMG));

        }
示例#6
0
文件: mod.c 项目: chyyuu/ucore-driver
static noinline struct module *load_module(void __user * umod,
					   unsigned long len,
					   const char __user * uargs)
{
	struct elfhdr *hdr;
	struct secthdr *sechdrs;
	char *secstrings, *args, *modmagic, *strtab = NULL;
	//char *staging;

	unsigned int i;
	unsigned int symindex = 0;
	unsigned int strindex = 0;
	unsigned int modindex, versindex, infoindex, pcpuindex;
	struct module *mod;
	long err = 0;
	void *ptr = NULL;

	kprintf("load_module: umod=%p, len=%lu, uargs=%p\n", umod, len, uargs);

	if (len < sizeof(*hdr))
		return NULL;
	if (len > 64 * 1024 * 1024 || (hdr = kmalloc(len)) == NULL)
		return NULL;

	kprintf("load_module: copy_from_user\n");

	struct mm_struct *mm = current->mm;
	lock_mm(mm);
	if (!copy_from_user(mm, hdr, umod, len, 1)) {
		unlock_mm(mm);
		goto free_hdr;
	}
	unlock_mm(mm);

	kprintf("load_module: hdr:%p\n", hdr);
	// sanity check
	if (memcmp(&(hdr->e_magic), ELFMAG, SELFMAG) != 0
	    || hdr->e_type != ET_REL || !elf_check_arch(hdr)
	    || hdr->e_shentsize != sizeof(*sechdrs)) {
		kprintf("load_module: sanity check failed.\n");
		goto free_hdr;
	}

	if (len < hdr->e_shoff + hdr->e_shnum * sizeof(*sechdrs))
		goto truncated;

	sechdrs = (void *)hdr + hdr->e_shoff;
	secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
	sechdrs[0].sh_addr = 0;

	for (i = 1; i < hdr->e_shnum; i++) {
		if (sechdrs[i].sh_type != SHT_NOBITS
		    && len < sechdrs[i].sh_offset + sechdrs[i].sh_size)
			goto truncated;

		// mark sh_addr
		sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset;

		if (sechdrs[i].sh_type == SHT_SYMTAB) {
			symindex = i;
			strindex = sechdrs[i].sh_link;
			strtab = (char *)hdr + sechdrs[strindex].sh_offset;
		}

	}

	modindex =
	    find_sec(hdr, sechdrs, secstrings, ".gnu.linkonce.this_module");

	if (!modindex) {
		kprintf("load_module: No module found in object.\n");
		goto free_hdr;
	}
	// temp: point mod into copy of data
	mod = (void *)sechdrs[modindex].sh_addr;

	if (symindex == 0) {
		kprintf("load_module: %s module has no symbols (stripped?).\n",
			mod->name);
		goto free_hdr;
	}
	versindex = find_sec(hdr, sechdrs, secstrings, "__versions");
	infoindex = find_sec(hdr, sechdrs, secstrings, ".modinfo");
	pcpuindex = 0;//find_pcpusec(hdr, sechdrs, secstrings);

	// don't keep modinfo and version
	sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC;
	sechdrs[versindex].sh_flags &= ~(unsigned long)SHF_ALLOC;

	// keep symbol and string tables
	sechdrs[symindex].sh_flags |= SHF_ALLOC;
	sechdrs[strindex].sh_flags |= SHF_ALLOC;

	/*if (!check_modstruct_version(sechdrs, versindex, mod)) {
		goto free_hdr;
	}*/

	/*
	   modmagic = get_modinfo(sechdrs, infoindex, "vermagic");

	   if (!modmagic) {
	   kprintf("load_module: bad vermagic\n");
	   goto free_hdr;
	   } else if (!same_magic(modmagic, vermagic, versindex)) {
	   ; 
	   // TODO: module magic is left for future use.
	   }
	 */

	//staging = get_modinfo(sechdrs, infoindex, "staging");
	// TODO: staging is left for future use.

	if (find_module(mod->name)) {
		kprintf("load_module: module %s exists\n", mod->name);
		goto free_mod;
	}

	mod->state = MODULE_STATE_COMING;

	// err = module_frob_arch_sections(hdr, sechdrs, secstrings, mod);
	// TODO: we do not need it for x86 or arm

	// TODO: percpu is no longer needed.

	layout_sections(mod, hdr, sechdrs, secstrings);

	ptr = module_alloc_update_bounds(mod->core_size);

	if (!ptr) {
		goto free_percpu;
	}
	memset(ptr, 0, mod->core_size);
	mod->module_core = ptr;

	ptr = module_alloc_update_bounds(mod->init_size);

	if (!ptr && mod->init_size) {
		goto free_core;
	}
	memset(ptr, 0, mod->init_size);
	mod->module_init = ptr;

	kprintf("load_module: final section addresses:\n");
	for (i = 0; i < hdr->e_shnum; i++) {
		void *dest;
		if (!(sechdrs[i].sh_flags & SHF_ALLOC)) {
			kprintf("\tSkipped %s\n",
				secstrings + sechdrs[i].sh_name);
			continue;
		}
		if (sechdrs[i].sh_entsize & INIT_OFFSET_MASK)
			dest =
			    mod->module_init +
			    (sechdrs[i].sh_entsize & ~INIT_OFFSET_MASK);
		else
			dest = mod->module_core + sechdrs[i].sh_entsize;
		if (sechdrs[i].sh_type != SHT_NOBITS)
			memcpy(dest, (void *)sechdrs[i].sh_addr,
			       sechdrs[i].sh_size);
		sechdrs[i].sh_addr = (unsigned long)dest;
		kprintf("\t0x%lx %s\n", sechdrs[i].sh_addr,
			secstrings + sechdrs[i].sh_name);
	}
	/* Module has been moved. */
	mod = (void *)sechdrs[modindex].sh_addr;

	/* Now we've moved module, initialize linked lists, etc. */
	module_unload_init(mod);

	/* Set up license info based on the info section */
	set_license(mod, get_modinfo(sechdrs, infoindex, "license"));

	err = simplify_symbols(sechdrs, symindex, strtab, versindex, pcpuindex,
			       mod);

	if (err < 0)
		goto cleanup;

	mod->syms = section_objs(hdr, sechdrs, secstrings, "__ksymtab",
				 sizeof(*mod->syms), &mod->num_syms);
	mod->crcs = section_addr(hdr, sechdrs, secstrings, "__kcrctab");

	// relocations
	for (i = 1; i < hdr->e_shnum; i++) {
		const char *strtab = (char *)sechdrs[strindex].sh_addr;
		unsigned int info = sechdrs[i].sh_info;

		/* Not a valid relocation section */
		if (info >= hdr->e_shnum)
			continue;

		/* Don't bother with non-allocated sections */
		if (!(sechdrs[info].sh_flags & SHF_ALLOC))
			continue;

		if (sechdrs[i].sh_type == SHT_REL)
			err = apply_relocate(sechdrs, strtab, symindex, i, mod);
		else if (sechdrs[i].sh_type == SHT_RELA)
			err =
			    apply_relocate_add(sechdrs, strtab, symindex, i,
					       mod);

		if (err < 0)
			goto cleanup;
	}

	err = verify_export_symbols(mod);
	if (err < 0)
		goto cleanup;

	// TODO: kallsyms is left for future use.
	//add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);

	err = module_finalize(hdr, sechdrs, mod);
	if (err < 0)
		goto cleanup;

	list_add(&modules, &mod->list);

	kfree(hdr);
	return mod;

cleanup:
	module_unload_free(mod);

free_init:
	module_free(mod, mod->module_init);

free_core:
	module_free(mod, mod->module_core);

free_percpu:

free_mod:

free_hdr:
	kfree(hdr);
	return NULL;

truncated:
	kprintf("load_module: module len %lu truncated.\n");
	goto free_hdr;
}