[gnome-software] Add a confirmation dialog for updates
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a confirmation dialog for updates
- Date: Thu, 22 Aug 2013 19:57:38 +0000 (UTC)
commit 769e88283c72e0fe60edf50fdfdec7817c4781dc
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 22 15:57:24 2013 -0400
Add a confirmation dialog for updates
This is temporary until we have a shell modal dialog, and
can also be used as fallback when not running under the shell.
We're not triggering any offline update yet.
src/gs-shell-updates.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 0140b3d..dd54839 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -21,6 +21,8 @@
#include "config.h"
+#include <glib/gi18n.h>
+
#include "gs-shell-updates.h"
#include "gs-app.h"
#include "gs-app-widget.h"
@@ -371,6 +373,32 @@ gs_shell_updates_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
gs_shell_updates_invalidate (shell_updates);
}
+static void
+gs_shell_updates_button_update_all_cb (GtkButton *button,
+ GsShellUpdates *updates)
+{
+ GtkWindow *window;
+ GtkWidget *dialog;
+ gint response;
+
+ window = GTK_WINDOW (gtk_builder_get_object (updates->priv->builder, "window_software"));
+ dialog = gtk_message_dialog_new (window,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_CANCEL,
+ _("Restart & Install"));
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Restart & Install"), GTK_RESPONSE_OK);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("Make sure you have no unsaved documents before
proceeding."));
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+
+ if (response == GTK_RESPONSE_OK) {
+ /* do something */
+ }
+}
+
/**
* gs_shell_updates_setup:
*/
@@ -432,6 +460,9 @@ gs_shell_updates_setup (GsShellUpdates *shell_updates,
G_CALLBACK (gs_shell_updates_row_activated_cb),
shell_updates);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_all"));
+ g_signal_connect (widget, "clicked", G_CALLBACK (gs_shell_updates_button_update_all_cb),
shell_updates);
+
/* setup update details window */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_close"));
g_signal_connect (widget, "clicked",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]