Skip to content

Commit

Permalink
Merge branch 'PackageKit:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tnut committed Mar 30, 2024
2 parents 7a9c35a + a0a52ce commit b30e9c4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
36 changes: 20 additions & 16 deletions backends/apt/pk-debconf-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <packagekit-glib2/pk-client-helper.h>
#include <systemd/sd-daemon.h>

static GMainLoop *main_loop;
static PkClientHelper *helper;
static GMainLoop *main_loop = NULL;
static PkClientHelper *helper = NULL;

static gboolean exit_loop(gpointer user_data)
{
Expand All @@ -19,36 +19,40 @@ static gboolean exit_loop(gpointer user_data)

int main(void)
{
char **argv = NULL;
char **envp = NULL;
GSocket *socket = NULL;
GError *error = NULL;
g_auto(GStrv) argv = NULL;
g_auto(GStrv) envp = NULL;
g_autoptr(GSocket) socket = NULL;
g_autoptr(GError) error = NULL;
int fd = -1;

main_loop = g_main_loop_new(NULL, FALSE);
pk_client_create_helper_argv_envp(&argv, &envp);
main_loop = g_main_loop_new (NULL, FALSE);
pk_client_create_helper_argv_envp (&argv, &envp);


if (sd_listen_fds(0) != 1) {
if (sd_listen_fds (0) != 1) {
g_error("No or too many file descriptors received.\n");
exit(1);
}

fd = SD_LISTEN_FDS_START + 0;
socket = g_socket_new_from_fd(fd, &error);
socket = g_socket_new_from_fd (fd, &error);

if (error != NULL) {
g_error("%s\n", error->message);
g_error ("%s\n", error->message);
return 1;
}

helper = pk_client_helper_new();
if (!pk_client_helper_start_with_socket(helper, socket, argv, envp, &error)) {
g_error("%s\n", error->message);
helper = pk_client_helper_new ();
if (!pk_client_helper_start_with_socket (helper, socket, argv, envp, &error)) {
g_error ("%s\n", error->message);
return 1;
}

g_timeout_add_seconds(60, exit_loop, NULL);
g_timeout_add_seconds (60, exit_loop, NULL);

g_main_loop_run(main_loop);
g_main_loop_run (main_loop);

g_object_unref (helper);
g_object_unref (main_loop);
return 0;
}
7 changes: 3 additions & 4 deletions client/pk-offline-update.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ pk_offline_update_progress_cb (PkProgress *progress,
PkStatusEnum status;
gint percentage;
g_autofree gchar *msg = NULL;
g_autofree gchar *tmp_perc = NULL;
g_autoptr(PkPackage) pkg = NULL;

switch (type) {
Expand Down Expand Up @@ -145,8 +146,6 @@ pk_offline_update_progress_cb (PkProgress *progress,
pk_package_get_data (pkg));
break;
case PK_PROGRESS_TYPE_PERCENTAGE:
g_autofree gchar *tmp_perc = NULL;

g_object_get (progress, "percentage", &percentage, NULL);
if (percentage < 0)
return;
Expand All @@ -159,11 +158,11 @@ pk_offline_update_progress_cb (PkProgress *progress,
if (role == PK_ROLE_ENUM_UPGRADE_SYSTEM) {
/* TRANSLATORS: this is the message we send plymouth to
* advise of the new percentage completion when installing system upgrades */
msg = g_strdup_printf ("%s %s", _("Installing System Upgrade"), tmp_perc);
msg = g_strdup_printf ("%s %s", _("Installing System Upgrade"), tmp_perc);
} else {
/* TRANSLATORS: this is the message we send plymouth to
* advise of the new percentage completion when installing updates */
msg = g_strdup_printf ("%s %s", _("Installing Updates"), tmp_perc);
msg = g_strdup_printf ("%s %s", _("Installing Updates"), tmp_perc);
}
if (percentage > 10)
pk_offline_update_set_plymouth_msg (msg);
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ contrib/command-not-found/pk-command-not-found.c
lib/packagekit-glib2/pk-console-shared.c
lib/packagekit-glib2/pk-debug.c
lib/packagekit-glib2/pk-enum.c
lib/packagekit-glib2/pk-progress-bar.c
lib/packagekit-glib2/pk-task-text.c
policy/org.freedesktop.packagekit.policy.in
src/pk-direct.c
Expand Down

0 comments on commit b30e9c4

Please sign in to comment.