admin: Add API to OtBootloader to get name

https://bugzilla.gnome.org/show_bug.cgi?id=706548
This commit is contained in:
Colin Walters 2013-08-22 06:33:04 -04:00
parent 6f6c87877e
commit 000dd5add3
4 changed files with 30 additions and 0 deletions

View File

@ -49,6 +49,12 @@ ot_bootloader_syslinux_query (OtBootloader *bootloader)
return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK; return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK;
} }
static const char *
ot_bootloader_syslinux_get_name (OtBootloader *bootloader)
{
return "syslinux";
}
static gboolean static gboolean
append_config_from_boot_loader_entries (OtBootloaderSyslinux *self, append_config_from_boot_loader_entries (OtBootloaderSyslinux *self,
gboolean regenerate_default, gboolean regenerate_default,
@ -267,6 +273,7 @@ static void
ot_bootloader_syslinux_bootloader_iface_init (OtBootloaderInterface *iface) ot_bootloader_syslinux_bootloader_iface_init (OtBootloaderInterface *iface)
{ {
iface->query = ot_bootloader_syslinux_query; iface->query = ot_bootloader_syslinux_query;
iface->get_name = ot_bootloader_syslinux_get_name;
iface->write_config = ot_bootloader_syslinux_write_config; iface->write_config = ot_bootloader_syslinux_write_config;
} }

View File

@ -53,6 +53,12 @@ ot_bootloader_uboot_query (OtBootloader *bootloader)
return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK; return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK;
} }
static const char *
ot_bootloader_uboot_get_name (OtBootloader *bootloader)
{
return "U-Boot";
}
static gboolean static gboolean
create_config_from_boot_loader_entries (OtBootloaderUboot *self, create_config_from_boot_loader_entries (OtBootloaderUboot *self,
int bootversion, int bootversion,
@ -153,6 +159,7 @@ static void
ot_bootloader_uboot_bootloader_iface_init (OtBootloaderInterface *iface) ot_bootloader_uboot_bootloader_iface_init (OtBootloaderInterface *iface)
{ {
iface->query = ot_bootloader_uboot_query; iface->query = ot_bootloader_uboot_query;
iface->get_name = ot_bootloader_uboot_get_name;
iface->write_config = ot_bootloader_uboot_write_config; iface->write_config = ot_bootloader_uboot_write_config;
} }

View File

@ -37,6 +37,19 @@ ot_bootloader_query (OtBootloader *self)
return OT_BOOTLOADER_GET_IFACE (self)->query (self); return OT_BOOTLOADER_GET_IFACE (self)->query (self);
} }
/**
* ot_bootloader_get_name:
*
* Returns: (transfer none): Name of this bootloader
*/
const char *
ot_bootloader_get_name (OtBootloader *self)
{
g_return_val_if_fail (OT_IS_BOOTLOADER (self), NULL);
return OT_BOOTLOADER_GET_IFACE (self)->get_name (self);
}
gboolean gboolean
ot_bootloader_write_config (OtBootloader *self, ot_bootloader_write_config (OtBootloader *self,
int bootversion, int bootversion,

View File

@ -38,6 +38,7 @@ struct _OtBootloaderInterface
/* virtual functions */ /* virtual functions */
gboolean (* query) (OtBootloader *self); gboolean (* query) (OtBootloader *self);
const char * (* get_name) (OtBootloader *self);
gboolean (* write_config) (OtBootloader *self, gboolean (* write_config) (OtBootloader *self,
int bootversion, int bootversion,
GCancellable *cancellable, GCancellable *cancellable,
@ -48,6 +49,8 @@ GType ot_bootloader_get_type (void) G_GNUC_CONST;
gboolean ot_bootloader_query (OtBootloader *self); gboolean ot_bootloader_query (OtBootloader *self);
const char *ot_bootloader_get_name (OtBootloader *self);
gboolean ot_bootloader_write_config (OtBootloader *self, gboolean ot_bootloader_write_config (OtBootloader *self,
int bootversion, int bootversion,
GCancellable *cancellable, GCancellable *cancellable,