summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2010-05-13 20:25:01 -0700
committerDaniel Burrows <dburrows@debian.org>2010-05-13 20:25:01 -0700
commitdbccc316eabe236dd52844a8f3acad52c79f07cd (patch)
treed9d2e25c64d9c1788beb8b453447f069fee94fe9 /src/main.cc
parent0f99c8d7d931e5716c4fda4ccef9accd8609cdf7 (diff)
downloadaptitude-dbccc316eabe236dd52844a8f3acad52c79f07cd.tar.gz
Write a fully functional alternate initialization path.
This will be the foundation for the new top-level harness code. Eventually the old code will go away, but I don't want to disrupt it while I'm working on the new stuff. To activate the new code, pass --new-gui on the command-line.
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc
index 8ce0cdfe..1f232db2 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -86,6 +86,7 @@
#ifdef HAVE_GTK
#include "gtk/gui.h"
+#include "gtk/init.h"
#endif
#include "loggers.h"
@@ -259,6 +260,7 @@ enum {
OPTION_CLEAN_ON_STARTUP,
OPTION_GROUP_BY,
OPTION_SHOW_PACKAGE_NAMES,
+ OPTION_NEW_GUI,
};
int getopt_result;
@@ -312,6 +314,7 @@ option opts[]={
{"clean-on-startup", 0, &getopt_result, OPTION_CLEAN_ON_STARTUP},
{"group-by", 1, &getopt_result, OPTION_GROUP_BY},
{"show-package-names", 1, &getopt_result, OPTION_SHOW_PACKAGE_NAMES},
+ {"new-gui", 0, &getopt_result, OPTION_NEW_GUI},
{0,0,0,0}
};
@@ -626,6 +629,8 @@ int main(int argc, char *argv[])
#ifdef HAVE_GTK
// TODO: this should be a configuration option.
bool gui = aptcfg->FindB(PACKAGE "::Start-Gui", true);
+ // Use the in-progress new GUI harness instead of the old code.
+ bool use_new_gui = false;
#endif
int curopt;
@@ -905,6 +910,10 @@ int main(int argc, char *argv[])
show_package_names_mode_string = optarg;
break;
+ case OPTION_NEW_GUI:
+ use_new_gui = true;
+ break;
+
default:
fprintf(stderr, "%s",
_("WEIRDNESS: unknown option code received\n"));
@@ -914,6 +923,7 @@ int main(int argc, char *argv[])
getopt_result=0;
break;
+
default:
fprintf(stderr, "%s",
_("WEIRDNESS: unknown option code received\n"));
@@ -1182,7 +1192,12 @@ int main(int argc, char *argv[])
#ifdef HAVE_GTK
if(gui)
{
- if(gui::main(argc, argv))
+ if(use_new_gui)
+ {
+ if(gui::init(argc, argv))
+ return 0;
+ }
+ else if(gui::main(argc, argv))
return 0;
// Otherwise, fall back to trying to start a curses interface
// (assume that we can't contact the X server, or maybe that we