File gnome-packagekit-fate303359.patch of Package gnome-packagekit
--- src/gpk-update-icon.c
+++ src/gpk-update-icon.c
@@ -31,6 +31,7 @@
#include <gtk/gtk.h>
#include <locale.h>
#include <libnotify/notify.h>
+#include <gconf/gconf-client.h>
#include <packagekit-glib/packagekit.h>
#include "egg-debug.h"
@@ -103,6 +104,58 @@
gtk_main_quit ();
}
+static gboolean
+run_configure_idle_cb (gpointer data)
+{
+ gboolean retval = g_spawn_command_line_sync ("gnomesu -- /sbin/yast2 piwo", NULL, NULL, NULL, NULL);
+ if (!retval) {
+ egg_debug ("Failure launching online config program");
+ }
+ g_main_loop_quit ((GMainLoop*)data);
+ return FALSE;
+}
+
+static void
+check_for_online_update_configured ()
+{
+ if (! g_file_test ("/var/lib/YaST2/registrationDidRun", G_FILE_TEST_EXISTS)) {
+ const gchar* ask_key = "/apps/gnome-packagekit/updater_asked_to_configure";
+ GConfClient *gclient = gconf_client_get_default ();
+ gboolean already_asked = FALSE;
+ already_asked = gconf_client_get_bool (gclient, ask_key, NULL);
+ if (already_asked) {
+ g_object_unref (gclient);
+ return;
+ }
+ already_asked = TRUE;
+ gconf_client_set_bool (gclient, ask_key, already_asked, NULL);
+ g_object_unref (gclient);
+
+ egg_debug ("Online update not configured - will launch after short delay");
+ g_usleep (1000000 * 8); //sleep for x seconds so we dont show before the rest of the screen is done
+ GMainLoop * loop;
+ GtkWidget *dialog = gtk_message_dialog_new (
+ NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Install latest updates?"));
+ gtk_window_set_title (GTK_WINDOW(dialog), _("openSUSE Updater"));
+ gtk_window_set_default_icon_name ("system-software-installer");
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), _("Do you want to check online for updates?"));
+ gint result = gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ switch (result) {
+ case GTK_RESPONSE_YES:
+ loop = g_main_loop_new (NULL, FALSE);
+ g_idle_add_full (G_PRIORITY_LOW, run_configure_idle_cb, loop, NULL);
+ g_main_loop_run (loop); //do this so the first dialog goes away
+ g_main_loop_unref (loop);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ egg_debug ("Online update already configured");
+}
+
/**
* main:
**/
@@ -165,6 +218,8 @@
if (!ret)
return 1;
+ check_for_online_update_configured ();
+
/* add application specific icons to search path */
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
GPK_DATA G_DIR_SEPARATOR_S "icons");