ali@24: /* ali@61: * Copyright (C) 2014, 2016 J. Ali Harlow ali@24: * ali@24: * This program is free software; you can redistribute it and/or modify ali@24: * it under the terms of the GNU General Public License as published by ali@24: * the Free Software Foundation; either version 2 of the License, or ali@24: * (at your option) any later version. ali@24: * ali@24: * This program is distributed in the hope that it will be useful, ali@24: * but WITHOUT ANY WARRANTY; without even the implied warranty of ali@24: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ali@24: * GNU General Public License for more details. ali@24: * ali@24: * You should have received a copy of the GNU General Public License along ali@24: * with this program; if not, write to the Free Software Foundation, Inc., ali@24: * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ali@24: */ ali@24: ali@24: #include "config.h" ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include ali@24: #include "app-manager.h" ali@24: ali@61: gboolean setup(const char *base) ali@24: { ali@24: gchar *s; ali@24: const char *prefix; ali@24: GError *error=NULL; ali@24: static PloverTransactionHelper *helper=NULL; ali@24: if (!helper) ali@24: { ali@24: helper=plover_transaction_helper_new(ui); ali@24: plover_transaction_helper_set_base(helper,base); ali@24: prefix=plover_transaction_helper_get_prefix(helper,&error); ali@24: if (error) ali@24: g_clear_error(&error); ali@24: else ali@24: { ali@24: s=g_strconcat(prefix?prefix:"","/var/log/setup",NULL); ali@24: plover_log_open(s); ali@24: g_free(s); ali@24: } ali@24: plover_transaction_helper_set_check_vendor(helper,TRUE); ali@24: g_signal_connect(helper,"close",G_CALLBACK(gtk_main_quit),NULL); ali@24: } ali@24: if (!plover_transaction_helper_get_visible(helper)) ali@24: { ali@24: if (!plover_transaction_helper_install_group(helper,"base",&error)) ali@24: { ali@24: if (g_error_matches(error,PLOVER_GENERAL_ERROR, ali@24: PLOVER_GENERAL_ERROR_NO_WORK)) ali@24: { ali@24: g_error_free(error); ali@24: error=g_error_new_literal(PLOVER_GENERAL_ERROR, ali@24: PLOVER_GENERAL_ERROR_NO_WORK, ali@24: "All packages already installed"); ali@24: plover_transaction_helper_set_error(helper,error, ali@24: "Software installation"); ali@24: } ali@24: else if (g_error_matches(error,PLOVER_GENERAL_ERROR, ali@24: PLOVER_GENERAL_ERROR_REQUIREMENTS_NOT_MET)) ali@24: { ali@24: g_error_free(error); ali@24: error=g_error_new_literal(PLOVER_GENERAL_ERROR, ali@24: PLOVER_GENERAL_ERROR_REQUIREMENTS_NOT_MET, ali@24: "Software cannot be installed because of missing updates. " ali@24: "Installing all updates first should resolve this problem"); ali@24: plover_transaction_helper_set_error(helper,error, ali@24: "Software installation failed"); ali@24: } ali@24: else ali@24: plover_transaction_helper_set_error(helper,error, ali@24: "Software installation failed"); ali@24: g_error_free(error); ali@24: } ali@24: } ali@24: plover_transaction_helper_present(helper); ali@24: return TRUE; ali@24: }