mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2026-01-06 19:41:41 +00:00
vv-file: Refactor virt_viewer_file_check_min_version
Reorganize the code a bit so that it's easier to extend it.
This commit is contained in:
parent
7a69a239e7
commit
f94a64d759
@ -710,23 +710,26 @@ spice_hotkey_set_accel(const gchar *accel_path, const gchar *key)
|
||||
static gboolean
|
||||
virt_viewer_file_check_min_version(VirtViewerFile *self, GError **error)
|
||||
{
|
||||
gchar *min_version = NULL;
|
||||
gint version_cmp;
|
||||
|
||||
if (virt_viewer_file_is_set(self, "version")) {
|
||||
gchar *val = virt_viewer_file_get_version(self);
|
||||
|
||||
if (virt_viewer_compare_version(val, PACKAGE_VERSION) > 0) {
|
||||
g_set_error(error,
|
||||
VIRT_VIEWER_ERROR,
|
||||
VIRT_VIEWER_ERROR_FAILED,
|
||||
_("At least %s version %s is required to setup this connection"),
|
||||
g_get_application_name(), val);
|
||||
|
||||
g_free(val);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_free(val);
|
||||
min_version = virt_viewer_file_get_version(self);
|
||||
}
|
||||
|
||||
version_cmp = virt_viewer_compare_version(min_version, PACKAGE_VERSION);
|
||||
|
||||
if (version_cmp > 0) {
|
||||
g_set_error(error,
|
||||
VIRT_VIEWER_ERROR,
|
||||
VIRT_VIEWER_ERROR_FAILED,
|
||||
_("At least %s version %s is required to setup this connection"),
|
||||
g_get_application_name(), min_version);
|
||||
g_free(min_version);
|
||||
return FALSE;
|
||||
}
|
||||
g_free(min_version);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user