[280] | 1 | /* rgdebinstallprogress.h |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 2004 Canonical |
---|
| 4 | * |
---|
| 5 | * Author: Michael Vogt <mvo@debian.org> |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU General Public License as |
---|
| 9 | * published by the Free Software Foundation; either version 2 of the |
---|
| 10 | * License, or (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program; if not, write to the Free Software |
---|
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 20 | * USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #ifndef _RGDEBINSTALLPROGRESS_H_ |
---|
| 25 | #define _RGDEBINSTALLPROGRESS_H_ |
---|
| 26 | |
---|
| 27 | #include "config.h" |
---|
| 28 | |
---|
| 29 | #ifdef WITH_DPKG_STATUSFD |
---|
| 30 | |
---|
| 31 | #include "rinstallprogress.h" |
---|
| 32 | #include "rggladewindow.h" |
---|
| 33 | #include "rguserdialog.h" |
---|
| 34 | #include<map> |
---|
| 35 | #include <vte/reaper.h> |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | class RGMainWindow; |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | class RGDebInstallProgress:public RInstallProgress, public RGGladeWindow |
---|
| 42 | { |
---|
| 43 | // the various stages of dpkg |
---|
| 44 | static const int NR_REMOVE_STAGES=3; |
---|
| 45 | static char* remove_stages[NR_REMOVE_STAGES]; |
---|
| 46 | static char* remove_stages_translations[NR_REMOVE_STAGES]; |
---|
| 47 | |
---|
| 48 | static const int NR_PURGE_STAGES=4; |
---|
| 49 | static char *purge_stages[NR_PURGE_STAGES]; |
---|
| 50 | static char *purge_stages_translations[NR_PURGE_STAGES]; |
---|
| 51 | |
---|
| 52 | // purge a already removed pkg |
---|
| 53 | static const int NR_PURGE_ONLY_STAGES=2; |
---|
| 54 | static char *purge_only_stages[NR_PURGE_ONLY_STAGES]; |
---|
| 55 | static char *purge_only_stages_translations[NR_PURGE_ONLY_STAGES]; |
---|
| 56 | |
---|
| 57 | static const int NR_INSTALL_STAGES=4; |
---|
| 58 | static char *install_stages[NR_INSTALL_STAGES]; |
---|
| 59 | static char *install_stages_translations[NR_INSTALL_STAGES]; |
---|
| 60 | |
---|
| 61 | static const int NR_UPDATE_STAGES=5; |
---|
| 62 | static char *update_stages[NR_UPDATE_STAGES]; |
---|
| 63 | static char *update_stages_translations[NR_UPDATE_STAGES]; |
---|
| 64 | |
---|
| 65 | static const int NR_REINSTALL_STAGES=6; |
---|
| 66 | static char *reinstall_stages[NR_REINSTALL_STAGES]; |
---|
| 67 | static char *reinstall_stages_translations[NR_REINSTALL_STAGES]; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | // widgets |
---|
| 71 | GtkWidget *_label_status; |
---|
| 72 | GtkWidget *_labelSummary; |
---|
| 73 | |
---|
| 74 | GtkWidget *_pbarTotal; |
---|
| 75 | GtkWidget *_term; |
---|
| 76 | GtkWidget *_autoClose; // checkbutton |
---|
| 77 | |
---|
| 78 | // if we run embedded |
---|
| 79 | GtkWidget *_sock; |
---|
| 80 | |
---|
| 81 | bool _startCounting; |
---|
| 82 | |
---|
| 83 | RGUserDialog *_userDialog; |
---|
| 84 | |
---|
| 85 | int _progress; |
---|
| 86 | int _totalActions; |
---|
| 87 | |
---|
| 88 | // this map contains the name and a pointer to the stages arrays |
---|
| 89 | map<string, char**> _actionsMap; |
---|
| 90 | |
---|
| 91 | // this map contains the name and a pointer to the translation arrays |
---|
| 92 | map<string, char**> _translationsMap; |
---|
| 93 | |
---|
| 94 | // this map contains what stage is already completted |
---|
| 95 | map<string, int> _stagesMap; |
---|
| 96 | |
---|
| 97 | // last time something changed |
---|
| 98 | time_t last_term_action; |
---|
| 99 | |
---|
| 100 | pid_t _child_id; |
---|
| 101 | pkgPackageManager::OrderResult res; |
---|
| 102 | bool child_has_exited; |
---|
| 103 | static void child_exited(VteReaper *vtereaper,gint child_pid, gint ret, |
---|
| 104 | gpointer data); |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | protected: |
---|
| 108 | virtual void startUpdate(); |
---|
| 109 | virtual void updateInterface(); |
---|
| 110 | virtual void finishUpdate(); |
---|
| 111 | virtual bool close(); |
---|
| 112 | |
---|
| 113 | virtual pkgPackageManager::OrderResult start(RPackageManager *pm, |
---|
| 114 | int numPackages = 0, |
---|
| 115 | int totalPackages = 0); |
---|
| 116 | |
---|
| 117 | virtual void prepare(RPackageLister *lister); |
---|
| 118 | |
---|
| 119 | void conffile(gchar *conffile, gchar *status); |
---|
| 120 | |
---|
| 121 | // gtk stuff |
---|
| 122 | static void cbCancel(GtkWidget *self, void *data); |
---|
| 123 | static void cbClose(GtkWidget *self, void *data); |
---|
| 124 | static void content_changed(GObject *object, gpointer user_data); |
---|
| 125 | static void expander_callback(GObject *object,GParamSpec *param_spec, |
---|
| 126 | gpointer user_data); |
---|
| 127 | |
---|
| 128 | public: |
---|
| 129 | RGDebInstallProgress(RGMainWindow *main, RPackageLister *lister, |
---|
| 130 | RGUserDialog *userDialog); |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | }; |
---|
| 134 | |
---|
| 135 | #endif |
---|
| 136 | |
---|
| 137 | #endif |
---|