mirror of
https://github.com/flatpak/flatpak.git
synced 2026-10-25 17:09:36 -04:00
Add public API: implement the other getters required by GNOME Software
Implemented the following functions along with the required internal APIs: * flatpak_installation_get_id () * flatpak_installation_get_display_name () * flatpak_installation_get_priority () * flatpak_installation_get_storage_type ()
This commit is contained in:
1 parent
34cf626029
commit
a663e5ba73
4 files changed
+142
-4
No files matched your search
+30
-3
@@ -718,6 +718,12 @@ flatpak_dir_get_path (FlatpakDir *self)
|
||||
return self->basedir;
|
||||
}
|
||||
|
||||
GFile *
|
||||
flatpak_dir_get_changed_path (FlatpakDir *self)
|
||||
{
|
||||
return g_file_get_child (self->basedir, ".changed");
|
||||
}
|
||||
|
||||
const char *
|
||||
flatpak_dir_get_id (FlatpakDir *self)
|
||||
{
|
||||
@@ -727,10 +733,31 @@ flatpak_dir_get_id (FlatpakDir *self)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GFile *
|
||||
flatpak_dir_get_changed_path (FlatpakDir *self)
|
||||
const char *
|
||||
flatpak_dir_get_display_name (FlatpakDir *self)
|
||||
{
|
||||
return g_file_get_child (self->basedir, ".changed");
|
||||
if (self->extra_data != NULL)
|
||||
return self->extra_data->display_name;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gint
|
||||
flatpak_dir_get_priority (FlatpakDir *self)
|
||||
{
|
||||
if (self->extra_data != NULL)
|
||||
return self->extra_data->priority;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FlatpakDirStorageType
|
||||
flatpak_dir_get_storage_type (FlatpakDir *self)
|
||||
{
|
||||
if (self->extra_data != NULL)
|
||||
return self->extra_data->storage_type;
|
||||
|
||||
return FLATPAK_DIR_STORAGE_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@@ -162,8 +162,11 @@ gboolean flatpak_dir_is_user (FlatpakDir *self);
|
||||
void flatpak_dir_set_no_system_helper (FlatpakDir *self,
|
||||
gboolean no_system_helper);
|
||||
GFile * flatpak_dir_get_path (FlatpakDir *self);
|
||||
const char *flatpak_dir_get_id (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_changed_path (FlatpakDir *self);
|
||||
const char *flatpak_dir_get_id (FlatpakDir *self);
|
||||
const char *flatpak_dir_get_display_name (FlatpakDir *self);
|
||||
gint flatpak_dir_get_priority (FlatpakDir *self);
|
||||
FlatpakDirStorageType flatpak_dir_get_storage_type (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_deploy_dir (FlatpakDir *self,
|
||||
const char *ref);
|
||||
GFile * flatpak_dir_get_unmaintained_extension_dir (FlatpakDir *self,
|
||||
|
||||
@@ -405,6 +405,92 @@ flatpak_installation_get_path (FlatpakInstallation *self)
|
||||
return g_object_ref (flatpak_dir_get_path (dir));
|
||||
}
|
||||
|
||||
/**
|
||||
* flatpak_installation_get_id:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Returns the ID of the system installation for @self.
|
||||
*
|
||||
* Returns: (transfer none): a string with the installation's ID
|
||||
*
|
||||
* Since: 0.6.15
|
||||
*/
|
||||
const char *
|
||||
flatpak_installation_get_id (FlatpakInstallation *self)
|
||||
{
|
||||
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
|
||||
|
||||
return flatpak_dir_get_id (dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* flatpak_installation_get_display_name:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Returns the display name of the system installation for @self.
|
||||
*
|
||||
* Returns: (transfer none): a string with the installation's display name
|
||||
*
|
||||
* Since: 0.6.15
|
||||
*/
|
||||
const char *
|
||||
flatpak_installation_get_display_name (FlatpakInstallation *self)
|
||||
{
|
||||
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
|
||||
|
||||
return flatpak_dir_get_display_name (dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* flatpak_installation_get_priority:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Returns the numeric priority of the system installation for @self.
|
||||
*
|
||||
* Returns: an integer with the configured priority value
|
||||
*
|
||||
* Since: 0.6.15
|
||||
*/
|
||||
gint
|
||||
flatpak_installation_get_priority (FlatpakInstallation *self)
|
||||
{
|
||||
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
|
||||
|
||||
return flatpak_dir_get_priority (dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* flatpak_installation_get_storage_type:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Returns the type of storage of the system installation for @self.
|
||||
*
|
||||
* Returns: a #FlatpakStorageType
|
||||
*
|
||||
* Since: 0.6.15
|
||||
*/FlatpakStorageType
|
||||
flatpak_installation_get_storage_type (FlatpakInstallation *self)
|
||||
{
|
||||
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
|
||||
|
||||
switch (flatpak_dir_get_storage_type (dir))
|
||||
{
|
||||
case FLATPAK_DIR_STORAGE_TYPE_HARD_DISK:
|
||||
return FLATPAK_STORAGE_TYPE_HARD_DISK;
|
||||
|
||||
case FLATPAK_DIR_STORAGE_TYPE_SDCARD:
|
||||
return FLATPAK_STORAGE_TYPE_SDCARD;
|
||||
|
||||
case FLATPAK_DIR_STORAGE_TYPE_MMC:
|
||||
return FLATPAK_STORAGE_TYPE_MMC;
|
||||
|
||||
default:
|
||||
return FLATPAK_STORAGE_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
return FLATPAK_STORAGE_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* flatpak_installation_launch:
|
||||
* @self: a #FlatpakInstallation
|
||||
|
||||
@@ -71,6 +71,24 @@ typedef enum {
|
||||
FLATPAK_INSTALL_FLAGS_NONE = 0,
|
||||
} FlatpakInstallFlags;
|
||||
|
||||
/**
|
||||
* FlatpakStorageType:
|
||||
* @FLATPAK_STORAGE_TYPE_DEFAULT: default
|
||||
* @FLATPAK_STORAGE_TYPE_HARD_DISK: installation is on a hard disk
|
||||
* @FLATPAK_STORAGE_TYPE_SDCARD: installation is on a SD card
|
||||
* @FLATPAK_STORAGE_TYPE_MMC: installation is on an MMC
|
||||
*
|
||||
* Flags to alter the behavior of flatpak_installation_install_full().
|
||||
*
|
||||
* Since: 0.6.15
|
||||
*/
|
||||
typedef enum {
|
||||
FLATPAK_STORAGE_TYPE_DEFAULT = 0,
|
||||
FLATPAK_STORAGE_TYPE_HARD_DISK = 1 << 0,
|
||||
FLATPAK_STORAGE_TYPE_SDCARD = 1 << 1,
|
||||
FLATPAK_STORAGE_TYPE_MMC = 1 << 2,
|
||||
} FlatpakStorageType;
|
||||
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstallation, g_object_unref)
|
||||
@@ -117,6 +135,10 @@ FLATPAK_EXTERN gboolean flatpak_installation_drop_caches (FlatpakIns
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_get_is_user (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN GFile *flatpak_installation_get_path (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN const char *flatpak_installation_get_id (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN const char *flatpak_installation_get_display_name (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN gint flatpak_installation_get_priority (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN FlatpakStorageType flatpak_installation_get_storage_type (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_launch (FlatpakInstallation *self,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
|
||||
Reference in new issue
Block a user