예제 #1
0
static void
gth_search_read_from_doc (GthCatalog *base,
			  DomElement *root)
{
	GthSearch  *self;
	DomElement *node;

	g_return_if_fail (DOM_IS_ELEMENT (root));

	self = GTH_SEARCH (base);
	GTH_CATALOG_CLASS (parent_class)->read_from_doc (GTH_CATALOG (self), root);

	gth_search_set_test (self, NULL);
	for (node = root->first_child; node; node = node->next_sibling) {
		if (g_strcmp0 (node->tag_name, "folder") == 0) {
			GFile *folder;

			folder = g_file_new_for_uri (dom_element_get_attribute (node, "uri"));
			gth_search_set_folder (self, folder);
			g_object_unref (folder);

			gth_search_set_recursive (self, (g_strcmp0 (dom_element_get_attribute (node, "recursive"), "true") == 0));
		}
		else if (g_strcmp0 (node->tag_name, "tests") == 0) {
			GthTest *test;

			test = gth_test_chain_new (GTH_MATCH_TYPE_NONE, NULL);
			dom_domizable_load_from_element (DOM_DOMIZABLE (test), node);
			gth_search_set_test (self, GTH_TEST_CHAIN (test));
		}
	}
}
예제 #2
0
static void
gth_script_real_load_from_element (DomDomizable *base,
				   DomElement   *element)
{
	GthScript *self;

	g_return_if_fail (DOM_IS_ELEMENT (element));

	self = GTH_SCRIPT (base);
	g_object_set (self,
		      "id", dom_element_get_attribute (element, "id"),
		      "display-name", dom_element_get_attribute (element, "display-name"),
		      "command", dom_element_get_attribute (element, "command"),
		      "visible", (g_strcmp0 (dom_element_get_attribute (element, "display"), "none") != 0),
		      "shell-script", (g_strcmp0 (dom_element_get_attribute (element, "shell-script"), "true") == 0),
		      "for-each-file", (g_strcmp0 (dom_element_get_attribute (element, "for-each-file"), "true") == 0),
		      "wait-command", (g_strcmp0 (dom_element_get_attribute (element, "wait-command"), "true") == 0),
		      "shortcut", _gdk_keyval_from_name (dom_element_get_attribute (element, "shortcut")),
		      NULL);
}