forked from Mirrors/flatpak-builder
lib: Add xdg_app_installation_create_monitor
This just returns a new file monitor for the .changes file.tingping/wmclass
parent
cd490d12a7
commit
25ef0aaeae
|
@ -14,6 +14,16 @@ progress_cb (const char *status,
|
|||
g_print ("status: %s, progress: %d estimating: %d, user_data: %p\n", status, progress, estimating, user_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
monitor_callback (GFileMonitor* monitor,
|
||||
GFile* child,
|
||||
GFile* other_file,
|
||||
GFileMonitorEvent eflags)
|
||||
{
|
||||
g_print ("Database changed\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
@ -32,6 +42,16 @@ main (int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 4)
|
||||
{
|
||||
GFileMonitor * monitor = xdg_app_installation_create_monitor (installation, NULL, NULL);
|
||||
GMainLoop *main_loop;
|
||||
|
||||
g_signal_connect (monitor, "changed", (GCallback)monitor_callback, NULL);
|
||||
main_loop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (main_loop);
|
||||
}
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
app1 = xdg_app_installation_install (installation,
|
||||
|
|
|
@ -1050,7 +1050,7 @@ xdg_app_installation_list_remote_refs_sync (XdgAppInstallation *self,
|
|||
|
||||
/**
|
||||
* xdg_app_installation_fetch_remote_ref_sync:
|
||||
* @self: a #XdgAppRemove
|
||||
* @self: a #XdgAppInstallation
|
||||
* @cancellable: (nullable): a #GCancellable
|
||||
* @error: return location for a #GError
|
||||
*
|
||||
|
@ -1101,3 +1101,27 @@ xdg_app_installation_fetch_remote_ref_sync (XdgAppInstallation *self,
|
|||
"Reference %s doesn't exist in remote\n", ref);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installation_create_monitor:
|
||||
* @self: a #XdgAppInstallation
|
||||
* @cancellable: (nullable): a #GCancellable
|
||||
* @error: return location for a #GError
|
||||
*
|
||||
* Gets the current remote branch of a ref in the remote.
|
||||
*
|
||||
* Returns: (transfer full): a new #GFileMonitor instance, or %NULL on error
|
||||
*/
|
||||
GFileMonitor *
|
||||
xdg_app_installation_create_monitor (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
XdgAppInstallationPrivate *priv = xdg_app_installation_get_instance_private (self);
|
||||
g_autoptr(GFile) path = NULL;
|
||||
|
||||
path = xdg_app_dir_get_changed_path (priv->dir);
|
||||
|
||||
return g_file_monitor_file (path, G_FILE_MONITOR_NONE,
|
||||
cancellable, error);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,9 @@ XDG_APP_EXTERN gboolean xdg_app_installation_launch
|
|||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GFileMonitor *xdg_app_installation_create_monitor (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray *xdg_app_installation_list_installed_refs (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
|
Loading…
Reference in New Issue