/** * asb_context_write_xml: **/ static gboolean asb_context_write_xml (AsbContext *ctx, GError **error) { AsApp *app; AsbContextPrivate *priv = GET_PRIVATE (ctx); GList *l; g_autofree gchar *filename = NULL; g_autoptr(AsStore) store = NULL; g_autoptr(GFile) file = NULL; /* convert any vetod applications into dummy components */ for (l = priv->apps; l != NULL; l = l->next) { app = AS_APP (l->data); if (!ASB_IS_APP (app)) continue; if (as_app_get_vetos(app)->len == 0) continue; asb_context_add_app_ignore (ctx, asb_app_get_package (ASB_APP (app))); } /* add any non-vetoed applications */ store = as_store_new (); for (l = priv->apps; l != NULL; l = l->next) { app = AS_APP (l->data); if (as_app_get_vetos(app)->len > 0) continue; as_store_add_app (store, app); as_store_remove_app (priv->store_failed, app); /* remove from the ignore list if the application was useful */ if (ASB_IS_APP (app)) { AsbPackage *pkg = asb_app_get_package (ASB_APP (app)); g_autofree gchar *name_arch = NULL; name_arch = g_strdup_printf ("%s.%s", asb_package_get_name (pkg), asb_package_get_arch (pkg)); as_store_remove_app_by_id (priv->store_ignore, name_arch); } } filename = g_strdup_printf ("%s/%s.xml.gz", priv->output_dir, priv->basename); file = g_file_new_for_path (filename); g_print ("Writing %s...\n", filename); as_store_set_origin (store, priv->origin); as_store_set_api_version (store, priv->api_version); if (priv->flags & ASB_CONTEXT_FLAG_ADD_CACHE_ID) { g_autofree gchar *builder_id = asb_utils_get_builder_id (); as_store_set_builder_id (store, builder_id); } return as_store_to_file (store, file, AS_NODE_TO_XML_FLAG_ADD_HEADER | AS_NODE_TO_XML_FLAG_FORMAT_INDENT | AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE, NULL, error); }
static void gs_editor_button_remove_clicked_cb (GtkWidget *widget, GsEditor *self) { const gchar *name; g_autofree gchar *msg = NULL; if (self->selected_item == NULL) return; /* send notification */ name = as_app_get_name (self->selected_item, NULL); if (name == NULL) { AsApp *item_global = as_store_get_app_by_id (self->store_global, as_app_get_id (self->selected_item)); if (item_global != NULL) name = as_app_get_name (item_global, NULL); } if (name != NULL) { g_autofree gchar *name_markup = NULL; name_markup = g_strdup_printf ("<b>%s</b>", name); /* TRANSLATORS, the %s is the app name, e.g. 'Inkscape' */ msg = g_strdup_printf (_("%s banner design deleted."), name_markup); } else { /* TRANSLATORS, this is a notification */ msg = g_strdup (_("Banner design deleted.")); } gs_editor_show_notification (self, msg); /* save this so we can undo */ g_set_object (&self->deleted_item, self->selected_item); as_store_remove_app_by_id (self->store, as_app_get_id (self->selected_item)); self->pending_changes = TRUE; gs_editor_refresh_choice (self); /* set the appropriate page */ gs_editor_set_page (self, as_store_get_size (self->store) == 0 ? "none" : "choice"); }