plover-gtk/transactionhelper.h
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Jul 16 11:07:18 2016 +0100 (2016-07-16)
changeset 61 31fb35727621
parent 38 a29623b68ca2
child 98 71127797ca73
permissions -rw-r--r--
Support parallel installations. The idea is that for CAD screener, we want
to be able to install this on the same machine as a standard AVOT setup
(most notably for John's laptop). To allow for the possibility of a second
application that might have the same requirements, we add the concept of
vendor-specific distributions. Thus we can have one distribution for CAD
screener and one for The Next Big Thing. It doesn't seem trivial to have
both CAD screener and AVOT under the same vendor tag so we'll have to have
AVOT under "City Occupational" and CAD screener under "City Occupational Ltd"
or some such kludge.

Most of this is done although we are very short of test cases (in particular
we don't test that it's actually possible to install CAD screener in parallel
with AVOT or to update either of them once installed, which is fundamental).

We also have a lot of baggage left over, including an intercept of razor_set.
The problem that this was introduced to debug has been fixed but it looks
like there are a number of memory leaks which it might be useful to help
track down so it has been left in place for now.

There is still a lot of confusion in plover between path-based and URI-based
API. We should review the API, decide what we want and have a general clear up.

There is also confusion as to the purpose of RAZOR_ROOT (and meaning; path or
URI). This is not used at all in librazor (although it is used in razor.exe).
Ideally we shouldn't use it in plover or plover-gtk either although again, we
might want to support it or an equivalent in (some of) the various executables.

Work that would still to nice to do for CAD screener:

- uninstall (ideally as an installed program that hooks into Add/Remove programs
but even re-running the installer would be acceptable).
- xz support (smaller packages).
- repomd.xml and xml:base (would be needed for an Internet installer).
- graphical installer.
ali@24
     1
#ifndef __PLOVER_TRANSACTION_HELPER_H__
ali@24
     2
#define __PLOVER_TRANSACTION_HELPER_H__
ali@24
     3
ali@24
     4
#include <gtk/gtk.h>
ali@24
     5
#include <plover/packageset.h>
ali@24
     6
#include <plover/repository.h>
ali@24
     7
#include <plover/transaction.h>
ali@24
     8
ali@24
     9
#define PLOVER_TYPE_TRANSACTION_HELPER	plover_transaction_helper_get_type()
ali@24
    10
#define PLOVER_TRANSACTION_HELPER(obj)	G_TYPE_CHECK_INSTANCE_CAST(obj,\
ali@24
    11
					  PLOVER_TYPE_TRANSACTION_HELPER,\
ali@24
    12
					  PloverTransactionHelper)
ali@24
    13
#define PLOVER_TRANSACTION_HELPER_CLASS(klass) \
ali@24
    14
					G_TYPE_CHECK_CLASS_CAST(klass,\
ali@24
    15
					  PLOVER_TYPE_TRANSACTION_HELPER,\
ali@24
    16
					  PloverTransactionHelperClass)
ali@24
    17
#define PLOVER_IS_TRANSACTION_HELPER(obj) \
ali@24
    18
					G_TYPE_CHECK_INSTANCE_TYPE(obj,\
ali@24
    19
					  PLOVER_TYPE_TRANSACTION_HELPER)
ali@24
    20
#define PLOVER_IS_TRANSACTION_HELPER_CLASS(klass) \
ali@24
    21
					G_TYPE_CHECK_CLASS_TYPE(obj,\
ali@24
    22
					  PLOVER_TYPE_TRANSACTION_HELPER)
ali@24
    23
#define PLOVER_TRANSACTION_HELPER_GET_CLASS(obj) \
ali@24
    24
					G_TYPE_INSTANCE_GET_CLASS(obj,\
ali@24
    25
					  PLOVER_TYPE_TRANSACTION_HELPER,\
ali@24
    26
					  PloverTransactionHelperClass)
ali@24
    27
ali@38
    28
typedef enum {
ali@38
    29
    PLOVER_TRANSACTION_HELPER_REPORT_INSTALL=RAZOR_INSTALL_ACTION_ADD,
ali@38
    30
    PLOVER_TRANSACTION_HELPER_REPORT_REMOVE=RAZOR_INSTALL_ACTION_REMOVE,
ali@38
    31
    PLOVER_TRANSACTION_HELPER_REPORT_UPDATE
ali@38
    32
} PloverTransactionHelperReportAction;
ali@38
    33
ali@24
    34
typedef struct _PloverTransactionHelper {
ali@24
    35
    GObject parent_instance;
ali@61
    36
    PloverPackageSet *alternate_installed,*installed;
ali@24
    37
    PloverRepository *upstream;
ali@24
    38
    PloverPackageSet *relocated_upstream;
ali@24
    39
    gchar *base;
ali@24
    40
    gchar *unsatisfied;
ali@24
    41
    struct comps *comps;
ali@24
    42
    gboolean check_vendor;
ali@24
    43
    gboolean report_adding_dependencies;
ali@24
    44
    gboolean report_removing_dependants;
ali@24
    45
    struct plover_vector *report_adding,*report_removing;
ali@24
    46
    GSList *transactions;
ali@24
    47
    GtkBuilder *ui;
ali@24
    48
    GtkAssistant *assistant;
ali@24
    49
    guint pulse_handler;
ali@24
    50
    GError *error;
ali@24
    51
    gchar *error_primary_text;
ali@24
    52
    GtkWidget *error_dialog;
ali@24
    53
} PloverTransactionHelper;
ali@24
    54
ali@24
    55
typedef struct _PloverTransactionHelperClass {
ali@24
    56
    GObjectClass parent_class;
ali@24
    57
} PloverTransactionHelperClass;
ali@24
    58
ali@24
    59
GType plover_transaction_helper_get_type(void);
ali@24
    60
PloverTransactionHelper *plover_transaction_helper_new(GtkBuilder *ui);
ali@24
    61
PloverPackageSet *
ali@24
    62
  plover_transaction_helper_get_installed(PloverTransactionHelper *helper);
ali@24
    63
void plover_transaction_helper_set_installed(PloverTransactionHelper *helper,
ali@24
    64
  PloverPackageSet *installed);
ali@24
    65
PloverRepository *
ali@24
    66
  plover_transaction_helper_get_upstream(PloverTransactionHelper *helper,
ali@24
    67
  GError **error);
ali@24
    68
void plover_transaction_helper_set_upstream(PloverTransactionHelper *helper,
ali@24
    69
  PloverRepository *upstream);
ali@24
    70
const char *plover_transaction_helper_get_base(PloverTransactionHelper *helper);
ali@24
    71
void plover_transaction_helper_set_base(PloverTransactionHelper *helper,
ali@24
    72
  const char *base);
ali@24
    73
struct comps *
ali@24
    74
  plover_transaction_helper_get_comps(PloverTransactionHelper *helper,
ali@24
    75
  GError **error);
ali@24
    76
const char *
ali@24
    77
  plover_transaction_helper_get_prefix(PloverTransactionHelper *helper,
ali@24
    78
  GError **error);
ali@24
    79
void plover_transaction_helper_set_check_vendor(PloverTransactionHelper *helper,
ali@24
    80
  gboolean check_vendor);
ali@24
    81
const char *
ali@24
    82
  plover_transaction_helper_get_unsatisfied(PloverTransactionHelper *helper);
ali@24
    83
gboolean
ali@24
    84
  plover_transaction_helper_add_transaction(PloverTransactionHelper *helper,
ali@24
    85
  PloverTransaction *transaction,struct plover_vector *report_packages,
ali@38
    86
  PloverTransactionHelperReportAction report_action,GError **error);
ali@24
    87
struct plover_vector *plover_transaction_helper_group_get_default_packages(
ali@24
    88
  PloverTransactionHelper *helper,const char *group,GError **error);
ali@24
    89
gboolean
ali@24
    90
  plover_transaction_helper_install_packages(PloverTransactionHelper *helper,
ali@24
    91
  struct plover_vector *packages,GError **error);
ali@24
    92
gboolean
ali@24
    93
  plover_transaction_helper_install_group(PloverTransactionHelper *helper,
ali@24
    94
  const char *group,GError **error);
ali@24
    95
gboolean
ali@24
    96
  plover_transaction_helper_remove_group(PloverTransactionHelper *helper,
ali@24
    97
  const char *group,GError **error);
ali@24
    98
gboolean
ali@24
    99
  plover_transaction_helper_update(PloverTransactionHelper *helper,
ali@24
   100
  GError **error);
ali@24
   101
gboolean plover_transaction_helper_get_visible(PloverTransactionHelper *helper);
ali@24
   102
void plover_transaction_helper_present(PloverTransactionHelper *helper);
ali@24
   103
const char *plover_transaction_helper_get_error(PloverTransactionHelper *helper,
ali@24
   104
  const GError **error);
ali@24
   105
void plover_transaction_helper_set_error(PloverTransactionHelper *helper,
ali@24
   106
  const GError *error,const char *primary_text);
ali@24
   107
ali@24
   108
#endif /* __PLOVER_TRANSACTION_HELPER_H__ */