summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-08-19 16:59:24 +0100
committerRichard Hughes <richard@hughsie.com>2008-08-19 16:59:24 +0100
commitdce415d8991ebe55e94f76ea48adad9c7557f12f (patch)
tree97d4a5ceb412112ef111c9c997d324f5d1b7f447
parentbc0134575b589de353d2bf15845034dc44160300 (diff)
Make PkMessages into proper enumerated types with localised descriptions
-rw-r--r--TODO4
-rwxr-xr-xbackends/apt/aptDBUSBackend.py2
-rw-r--r--backends/poldek/pk-backend-poldek.c2
-rw-r--r--backends/yum/helpers/yumBackend.py8
-rwxr-xr-xbackends/yum2/helpers/yumDBUSBackend.py18
-rw-r--r--backends/zypp/pk-backend-zypp.cpp6
-rw-r--r--libpackagekit/pk-client.c2
-rw-r--r--libpackagekit/pk-enum.c14
-rw-r--r--libpackagekit/pk-enum.h14
-rw-r--r--libpackagekit/pk-task-list.c2
-rw-r--r--python/packagekit/backend.py2
-rw-r--r--src/pk-backend-dbus.c6
-rw-r--r--src/pk-backend-spawn.c18
-rw-r--r--src/pk-backend.c20
-rw-r--r--src/pk-transaction.c7
15 files changed, 69 insertions, 56 deletions
diff --git a/TODO b/TODO
index 11bb2d93..7d56c6c9 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,3 @@
-*** Timeframe: 0.2.x ***
-
-* Make PkMessages into proper enumerated types with localised descriptions
-
*** Timeframe: 0.3.x ***
* Enable GetUpdateDetail to handle arrays for 'updates' and 'obsoletes'
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index a4fad012..f7f643a7 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -214,7 +214,7 @@ class PackageKitInstallProgress(apt.progress.InstallProgress):
def finishUpdate(self):
pklog.debug("finishUpdate()")
if self.conffile_prompts:
- self._backend.Message(MESSAGE_NOTICE, "The following conffile prompts were found and need investiagtion: %s" % "\n".join(self.conffile_prompts))
+ self._backend.Message(MESSAGE_CONFIG_FILES_CHANGED, "The following conffile prompts were found and need investiagtion: %s" % "\n".join(self.conffile_prompts))
def sigquit(signum, frame):
pklog.error("Was killed")
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index d2517112..8db89c9f 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1643,7 +1643,7 @@ poldek_backend_log (void *data, int pri, char *message)
pberror->vfffmsg = g_strdup (message);
// 'vfff: unable to connect to ftp.pld-linux.org:21: Connection refused'
- pk_backend_message (backend, PK_MESSAGE_ENUM_WARNING, "%s", message);
+ pk_backend_message (backend, PK_MESSAGE_ENUM_CONNECTION_REFUSED, "%s", message);
} else {
if (pri & LOGERR) {
g_string_append_printf (pberror->tslog, "error: %s", message);
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 0d832c35..9905761d 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -390,7 +390,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
# if we couldn't map package_id -> pkg
if len(packs) == 0:
- self.message(MESSAGE_WARNING,"Could not find a match for package %s" % package)
+ self.message(MESSAGE_COULD_NOT_FIND_PACKAGE,"Could not find a match for package %s" % package)
continue
# should have only one...
@@ -833,7 +833,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if pkg and not inst:
repo = self.yumbase.repos.getRepo(pkg.repoid)
if not already_warned and not repo.gpgcheck:
- self.message(MESSAGE_WARNING,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
+ self.message(MESSAGE_UNTRUSTED_PACKAGE,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
already_warned = True
txmbr = self.yumbase.install(po=pkg)
txmbrs.extend(txmbr)
@@ -849,7 +849,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if pkgs:
newest = pkgs[0]
if newest.EVR > po.EVR:
- self.message(MESSAGE_WARNING,"A newer version of %s is available online." % po.name)
+ self.message(MESSAGE_NEWER_PACKAGE_EXISTS,"A newer version of %s is available online." % po.name)
def install_files(self,trusted,inst_files):
'''
@@ -1588,7 +1588,7 @@ class PackageKitCallback(RPMBaseCallback):
self.base.status(self.state_actions[action])
self._showName(self.info_actions[action])
except exceptions.KeyError,e:
- self.base.message(MESSAGE_WARNING,"The constant '%s' was unknown, please report" % action)
+ self.base.message(MESSAGE_BACKEND_ERROR,"The constant '%s' was unknown, please report" % action)
pct = self._calcTotalPct(ts_current,ts_total)
self.base.percentage(pct)
val = (ts_current*100L)/ts_total
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index c7c0bfe2..33707cf7 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -477,7 +477,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.ErrorCode(ERROR_GROUP_NOT_FOUND, str(e))
self.Finished(EXIT_FAILED)
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -534,7 +534,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self._show_package(pkg, INFO_AVAILABLE)
found[str(pkg)] = 1
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -801,7 +801,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self._show_package(pkg,INFO_AVAILABLE)
break
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -831,7 +831,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if pkg and not inst:
repo = self.yumbase.repos.getRepo(pkg.repoid)
if not already_warned and not repo.gpgcheck:
- self.message(MESSAGE_WARNING,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
+ self.message(MESSAGE_UNTRUSTED_PACKAGE,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
already_warned = True
txmbr = self.yumbase.install(po=pkg)
txmbrs.extend(txmbr)
@@ -1106,7 +1106,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
self._show_package(pkg,INFO_NORMAL)
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -1163,7 +1163,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if showDesc:
self._show_package_details(pkg)
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -1453,7 +1453,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
package_list.append((pkg,INFO_AVAILABLE))
seen_nevra.append(self._get_nevra(pkg))
except yum.Errors.RepoError,e:
- self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
+ self.Message(MESSAGE_CACHE_BEING_REBUILT, "The package cache is invalid and is being rebuilt.")
self._refresh_yum_cache()
self._unlock_yum()
self.Finished(EXIT_FAILED)
@@ -1609,7 +1609,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
newest = pkgs[0]
if newest.EVR > po.EVR:
#TODO Add code to send a message here
- self.Message(MESSAGE_WARNING,"Newer version of %s, exist in the repositories " % po.name)
+ self.Message(MESSAGE_NEWER_PACKAGE_EXISTS,"Newer version of %s, exist in the repositories " % po.name)
@@ -2174,7 +2174,7 @@ class PackageKitCallback(RPMBaseCallback):
self.base.StatusChanged(self.state_actions[action])
self._showName(self.info_actions[action])
except exceptions.KeyError,e:
- self.base.Message(MESSAGE_WARNING,"The constant '%s' was unknown, please report" % action)
+ self.base.Message(MESSAGE_BACKEND_ERROR,"The constant '%s' was unknown, please report" % action)
pct = self._calcTotalPct(ts_current, ts_total)
self.base.PercentageChanged(pct)
val = (ts_current*100L)/ts_total
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 3e8bcec5..a5babb40 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1618,7 +1618,7 @@ backend_repo_set_data_thread (PkBackend *backend)
}else if (g_ascii_strcasecmp (value, "false") == 0) {
repo.setAutorefresh (FALSE);
} else {
- pk_backend_message (backend, PK_MESSAGE_ENUM_NOTICE, "Autorefresh a repo: Enter true or false");
+ pk_backend_message (backend, PK_MESSAGE_ENUM_PARAMETER_INVALID, "Autorefresh a repo: Enter true or false");
bReturn = FALSE;
}
@@ -1629,14 +1629,14 @@ backend_repo_set_data_thread (PkBackend *backend)
gint length = strlen (value);
if (length > 2) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_NOTICE, "Priorities has to be between 1 (highest) and 99");
+ pk_backend_message (backend, PK_MESSAGE_ENUM_PRIORITY_INVALID, "Priorities has to be between 1 (highest) and 99");
bReturn = false;
} else {
for (gint i = 0; i < length; i++) {
gint tmp = g_ascii_digit_value (value[i]);
if (tmp == -1) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_NOTICE, "Priorities has to be a number between 1 (highest) and 99");
+ pk_backend_message (backend, PK_MESSAGE_ENUM_PRIORITY_INVALID, "Priorities has to be a number between 1 (highest) and 99");
bReturn = FALSE;
prio = 0;
break;
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 6675c874..ff7b5365 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -3568,7 +3568,7 @@ pk_client_class_init (PkClientClass *klass)
/**
* PkClient::message:
* @client: the #PkClient instance that emitted the signal
- * @message: the PkMessageEnum type of the message, e.g. PK_MESSAGE_ENUM_WARNING
+ * @message: the PkMessageEnum type of the message, e.g. %PK_MESSAGE_ENUM_BROKEN_MIRROR
* @details: the non-localised message details
*
* The ::message signal is emitted when the transaction wants to tell
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index d51bb786..1a1c2393 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -170,9 +170,17 @@ static PkEnumMatch enum_restart[] = {
static PkEnumMatch enum_message[] = {
{PK_MESSAGE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
- {PK_MESSAGE_ENUM_NOTICE, "notice"},
- {PK_MESSAGE_ENUM_WARNING, "warning"},
- {PK_MESSAGE_ENUM_DAEMON, "daemon"},
+ {PK_MESSAGE_ENUM_BROKEN_MIRROR, "broken-mirror"},
+ {PK_MESSAGE_ENUM_CONNECTION_REFUSED, "connection-refused"},
+ {PK_MESSAGE_ENUM_PARAMETER_INVALID, "parameter-invalid"},
+ {PK_MESSAGE_ENUM_PRIORITY_INVALID, "priority-invalid"},
+ {PK_MESSAGE_ENUM_BACKEND_ERROR, "backend-error"},
+ {PK_MESSAGE_ENUM_DAEMON_ERROR, "daemon-error"},
+ {PK_MESSAGE_ENUM_CACHE_BEING_REBUILT, "cache-being-rebuilt"},
+ {PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE, "untrusted-package"},
+ {PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS, "newer-package-exists"},
+ {PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,"could-not-find-package"},
+ {PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED, "config-files-changed"},
{0, NULL}
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 1d046372..505c2bf5 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -204,9 +204,17 @@ typedef enum {
* What message type we need to show
**/
typedef enum {
- PK_MESSAGE_ENUM_NOTICE,
- PK_MESSAGE_ENUM_WARNING,
- PK_MESSAGE_ENUM_DAEMON,
+ PK_MESSAGE_ENUM_BROKEN_MIRROR,
+ PK_MESSAGE_ENUM_CONNECTION_REFUSED,
+ PK_MESSAGE_ENUM_PARAMETER_INVALID,
+ PK_MESSAGE_ENUM_PRIORITY_INVALID,
+ PK_MESSAGE_ENUM_BACKEND_ERROR,
+ PK_MESSAGE_ENUM_DAEMON_ERROR,
+ PK_MESSAGE_ENUM_CACHE_BEING_REBUILT,
+ PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE,
+ PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS,
+ PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,
+ PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
PK_MESSAGE_ENUM_UNKNOWN
} PkMessageEnum;
diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index d374f081..1bfe59e2 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -373,7 +373,7 @@ pk_task_list_class_init (PkTaskListClass *klass)
* PkTaskList::message:
* @tlist: the #PkTaskList instance that emitted the signal
* @client: the #PkClient instance that caused the signal
- * @message: the PkMessageEnum type of the message, e.g. PK_MESSAGE_ENUM_WARNING
+ * @message: the PkMessageEnum type of the message, e.g. %PK_MESSAGE_ENUM_BROKEN_MIRROR
* @details: the non-localised message details
*
* The ::message signal is emitted when the transaction wants to tell
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 1337d1db..f025f312 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -87,7 +87,7 @@ class PackageKitBaseBackend:
def message(self,typ,msg):
'''
send 'message' signal
- @param typ: MESSAGE_WARNING, MESSAGE_NOTICE, MESSAGE_DEAMON
+ @param typ: MESSAGE_BROKEN_MIRROR
'''
print "message\t%s\t%s" % (typ,msg)
sys.stdout.flush()
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index be2651c9..74e7da8f 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -414,7 +414,7 @@ pk_backend_dbus_startup (PkBackendDbus *backend_dbus)
if (!ret) {
pk_warning ("%s", error->message);
/* cannot use ErrorCode as not in transaction */
- pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON, error->message);
+ pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON_ERROR, error->message);
g_error_free (error);
goto out;
}
@@ -1416,11 +1416,11 @@ pk_backend_dbus_monitor_changed_cb (PkDbusMonitor *pk_dbus_monitor, gboolean is_
if (!is_active) {
pk_warning ("DBUS backend disconnected");
- pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON, "DBUS backend has exited");
+ pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON_ERROR, "DBUS backend has exited");
/* Init() */
ret = pk_backend_dbus_startup (backend_dbus);
if (!ret) {
- pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON, "DBUS backend will not start");
+ pk_backend_message (backend_dbus->priv->backend, PK_MESSAGE_ENUM_DAEMON_ERROR, "DBUS backend will not start");
}
}
}
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 17d6c895..4e8988d4 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -120,7 +120,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
info = pk_info_enum_from_text (sections[1]);
if (info == PK_INFO_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Info enum not recognised, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
@@ -177,7 +177,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
restart = pk_restart_enum_from_text (sections[7]);
if (restart == PK_RESTART_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Restart enum not recognised, and hence ignored: '%s'", sections[7]);
ret = FALSE;
goto out;
@@ -230,7 +230,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
error_enum = pk_error_enum_from_text (sections[1]);
if (error_enum == PK_ERROR_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Error enum not recognised, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
@@ -254,7 +254,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
restart_enum = pk_restart_enum_from_text (sections[1]);
if (restart_enum == PK_RESTART_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Restart enum not recognised, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
@@ -268,7 +268,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
message_enum = pk_message_enum_from_text (sections[1]);
if (message_enum == PK_MESSAGE_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Message enum not recognised, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
@@ -293,7 +293,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
}
status_enum = pk_status_enum_from_text (sections[1]);
if (status_enum == PK_STATUS_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Status enum not recognised, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
@@ -331,19 +331,19 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
sig_type = pk_sig_type_enum_from_text (sections[8]);
if (sig_type == PK_SIGTYPE_ENUM_UNKNOWN) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Sig enum not recognised, and hence ignored: '%s'", sections[8]);
ret = FALSE;
goto out;
}
if (pk_strzero (sections[1])) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"package_id blank, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
}
if (pk_strzero (sections[2])) {
- pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend_spawn->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"repository name blank, and hence ignored: '%s'", sections[2]);
ret = FALSE;
goto out;
diff --git a/src/pk-backend.c b/src/pk-backend.c
index d5166cfb..462ac81b 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -758,7 +758,7 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
/* check over */
if (percentage > PK_BACKEND_PERCENTAGE_INVALID) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"percentage value is invalid: %i", percentage);
return FALSE;
}
@@ -767,7 +767,7 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
if (percentage < 100 &&
backend->priv->last_percentage < 100 &&
percentage < backend->priv->last_percentage) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"percentage value is going down to %i from %i",
percentage, backend->priv->last_percentage);
return FALSE;
@@ -868,7 +868,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
/* backends don't do this */
if (status == PK_STATUS_ENUM_WAIT) {
pk_warning ("backend tried to WAIT, only the runner should set this value");
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"backends shouldn't use STATUS_WAIT");
return FALSE;
}
@@ -876,7 +876,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
/* sanity check */
if (status == PK_STATUS_ENUM_SETUP && backend->priv->status != PK_STATUS_ENUM_WAIT) {
pk_warning ("backend tried to SETUP, but should be in WAIT");
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Tried to SETUP when not in WAIT");
return FALSE;
}
@@ -1087,7 +1087,7 @@ pk_backend_message (PkBackend *backend, PkMessageEnum message, const gchar *form
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* have we already set an error? */
- if (backend->priv->set_error && message != PK_MESSAGE_ENUM_DAEMON) {
+ if (backend->priv->set_error && message != PK_MESSAGE_ENUM_BACKEND_ERROR) {
pk_warning ("already set error, cannot process");
return FALSE;
}
@@ -1366,7 +1366,7 @@ pk_backend_error_timeout_delay_cb (gpointer data)
/* warn the backend developer that they've done something worng
* - we can't use pk_backend_message here as we have already set
* backend->priv->set_error to TRUE and hence the message would be ignored */
- message = PK_MESSAGE_ENUM_DAEMON;
+ message = PK_MESSAGE_ENUM_BACKEND_ERROR;
buffer = "ErrorCode() has to be followed with Finished()!";
pk_warning ("emit message %i, %s", message, buffer);
g_signal_emit (backend, signals [PK_BACKEND_MESSAGE], 0, message, buffer);
@@ -1567,14 +1567,14 @@ pk_backend_finished (PkBackend *backend)
/* are we trying to finish in init? */
if (backend->priv->during_initialize) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"You can't call pk_backend_finished in backend_initialize!");
return FALSE;
}
/* check we have not already finished */
if (backend->priv->finished) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Backends cannot request Finished more than once!");
return FALSE;
}
@@ -1585,7 +1585,7 @@ pk_backend_finished (PkBackend *backend)
(backend->priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES ||
backend->priv->role == PK_ROLE_ENUM_REMOVE_PACKAGES ||
backend->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES)) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Backends should send a Package() for this role!");
}
@@ -1598,7 +1598,7 @@ pk_backend_finished (PkBackend *backend)
/* check we sent at least one status calls */
if (backend->priv->set_error == FALSE &&
backend->priv->status == PK_STATUS_ENUM_SETUP) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"Backends should send status <value> signals for %s!", role_text);
pk_warning ("GUI will remain unchanged!");
}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index dda37c43..600bab1c 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -419,7 +419,7 @@ pk_transaction_error_code_cb (PkBackend *backend, PkErrorCodeEnum code,
g_return_if_fail (transaction->priv->tid != NULL);
if (code == PK_ERROR_ENUM_UNKNOWN) {
- pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"backend emitted 'unknown error' rather than a specific error "
"- this is a backend problem and should be fixed!");
}
@@ -570,7 +570,8 @@ pk_transaction_message_cb (PkBackend *backend, PkMessageEnum message, const gcha
g_return_if_fail (transaction->priv->tid != NULL);
#ifndef PK_IS_DEVELOPER
- if (message == PK_MESSAGE_ENUM_DAEMON) {
+ if (message == PK_MESSAGE_ENUM_BACKEND_ERROR ||
+ message == PK_MESSAGE_ENUM_DAEMON_ERROR) {
pk_warning ("ignoring message: %s", details);
return;
}
@@ -603,7 +604,7 @@ pk_transaction_package_cb (PkBackend *backend, const PkPackageObj *obj, PkTransa
transaction->priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES ||
transaction->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
if (obj->info == PK_INFO_ENUM_INSTALLED) {
- pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+ pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"backend emitted 'installed' rather than 'installing' "
"- you need to do the package *before* you do the action");
return;