gnome-packagekit r416 - in trunk: data src



Author: rhughes
Date: Thu Nov  6 08:33:49 2008
New Revision: 416
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=416&view=rev

Log:
new code from git

Modified:
   trunk/data/gnome-packagekit.schemas.in
   trunk/data/gpk-application.glade
   trunk/src/gpk-application.c
   trunk/src/gpk-client-eula.c
   trunk/src/gpk-client-signature.c
   trunk/src/gpk-client-signature.h
   trunk/src/gpk-client.c
   trunk/src/gpk-common.c
   trunk/src/gpk-common.h

Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in	(original)
+++ trunk/data/gnome-packagekit.schemas.in	Thu Nov  6 08:33:49 2008
@@ -14,18 +14,6 @@
     </schema>
 
     <schema>
-      <key>/schemas/apps/gnome-packagekit/skip_confirm_no_deps</key>
-      <applyto>/apps/gnome-packagekit/skip_confirm_no_deps</applyto>
-      <owner>gnome-packagekit</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Skip the confirmation dialog if there are no additional dependencies</short>
-        <long>Skip the confirmation dialog when installing and removing packages if there are no additional dependencies to be installed</long>
-      </locale>
-    </schema>
-
-    <schema>
       <key>/schemas/apps/gnome-packagekit/banned_firmware</key>
       <applyto>/apps/gnome-packagekit/banned_firmware</applyto>
       <owner>gnome-packagekit</owner>
@@ -62,6 +50,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/show_copy_confirm</key>
+      <applyto>/apps/gnome-packagekit/show_copy_confirm</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Ask the user if files should be copied to a non-private directory</short>
+        <long>Ask the user if files should be copied to a non-private directory when installing from a FUSE mount</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/notify_update_failed</key>
       <applyto>/apps/gnome-packagekit/notify_update_failed</applyto>
       <owner>gnome-packagekit</owner>

Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade	(original)
+++ trunk/data/gpk-application.glade	Thu Nov  6 08:33:49 2008
@@ -50,6 +50,20 @@
                         </child>
                       </widget>
                     </child>
+                    <child>
+                      <widget class="GtkImageMenuItem" id="menuitem_quit">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Quit</property>
+                        <property name="use_underline">True</property>
+                        <child internal-child="image">
+                          <widget class="GtkImage" id="menu-item-image10">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-quit</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -465,9 +479,14 @@
                       <widget class="GtkImageMenuItem" id="menuitem_help">
                         <property name="visible">True</property>
                         <property name="tooltip" translatable="yes">Help with this software</property>
-                        <property name="label">gtk-help</property>
+                        <property name="label" translatable="yes">_Contents</property>
                         <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
+                        <child internal-child="image">
+                          <widget class="GtkImage" id="menu-item-image11">
+                            <property name="stock">gtk-help</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
                       </widget>
                     </child>
                     <child>

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Thu Nov  6 08:33:49 2008
@@ -1521,6 +1521,15 @@
 }
 
 /**
+ * gpk_application_menu_quit_cb:
+ **/
+static void
+gpk_application_menu_quit_cb (GtkAction *action, GpkApplication *application)
+{
+	gpk_application_quit (application);
+}
+
+/**
  * gpk_application_text_changed_cb:
  **/
 static gboolean
@@ -3163,6 +3172,10 @@
 	g_signal_connect (widget, "activate",
 			  G_CALLBACK (gpk_application_menu_run_cb), application);
 
+	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_quit");
+	g_signal_connect (widget, "activate",
+			  G_CALLBACK (gpk_application_menu_quit_cb), application);
+
 	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_selection");
 	gtk_widget_hide (widget);
 
@@ -3364,23 +3377,6 @@
 		gtk_widget_hide (widget);
 	}
 
-	/* Group type, set, or hide */
-	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_group_type");
-	if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_CATEGORIES)) {
-		/* set from remembered state */
-		enabled = gconf_client_get_bool (application->priv->gconf_client,
-						 GPK_CONF_APPLICATION_CATEGORY_GROUPS, NULL);
-		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), enabled);
-	} else {
-		gtk_widget_hide (widget);
-	}
-
-	/* Set autocompletion */
-	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_autocomplete");
-	enabled = gconf_client_get_bool (application->priv->gconf_client,
-					 GPK_CONF_AUTOCOMPLETE, NULL);
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), enabled);
-
 	widget = glade_xml_get_widget (application->priv->glade_xml, "entry_text");
 	g_signal_connect (widget, "key-press-event",
 			  G_CALLBACK (gpk_application_text_changed_cb), application);

Modified: trunk/src/gpk-client-eula.c
==============================================================================
--- trunk/src/gpk-client-eula.c	(original)
+++ trunk/src/gpk-client-eula.c	Thu Nov  6 08:33:49 2008
@@ -112,9 +112,8 @@
 
 	/* make modal if window set */
 	widget = glade_xml_get_widget (glade_xml, "window_eula");
-	if (window != NULL) {
+	if (window != NULL)
 		gtk_window_set_transient_for (GTK_WINDOW (widget), window);
-	}
 
 	/* show window */
 	gtk_widget_show (widget);
@@ -124,9 +123,8 @@
 	gtk_main ();
 
 	/* hide window */
-	if (GTK_IS_WIDGET (widget)) {
+	if (GTK_IS_WIDGET (widget))
 		gtk_widget_hide (widget);
-	}
 	g_object_unref (glade_xml);
 	g_object_unref (buffer);
 

Modified: trunk/src/gpk-client-signature.c
==============================================================================
--- trunk/src/gpk-client-signature.c	(original)
+++ trunk/src/gpk-client-signature.c	Thu Nov  6 08:33:49 2008
@@ -61,7 +61,7 @@
  * Return value: if we agreed
  **/
 gboolean
-gpk_client_signature_show (const gchar *package_id, const gchar *repository_name,
+gpk_client_signature_show (GtkWindow *window, const gchar *package_id, const gchar *repository_name,
 			   const gchar *key_url, const gchar *key_userid, const gchar *key_id,
 			   const gchar *key_fingerprint, const gchar *key_timestamp)
 {
@@ -98,6 +98,11 @@
 	widget = glade_xml_get_widget (glade_xml, "label_id");
 	gtk_label_set_label (GTK_LABEL (widget), key_id);
 
+	/* make modal if window set */
+	widget = glade_xml_get_widget (glade_xml, "window_gpg");
+	if (window != NULL)
+		gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+
 	/* show window */
 	widget = glade_xml_get_widget (glade_xml, "window_gpg");
 	gtk_widget_show (widget);
@@ -107,9 +112,8 @@
 	gtk_main ();
 
 	/* hide window */
-	if (GTK_IS_WIDGET (widget)) {
+	if (GTK_IS_WIDGET (widget))
 		gtk_widget_hide (widget);
-	}
 	g_object_unref (glade_xml);
 
 	return has_imported_signature;
@@ -126,9 +130,8 @@
 {
 	EggTest *test = (EggTest *) data;
 
-	if (egg_test_start (test, "GpkClientEula") == FALSE) {
+	if (egg_test_start (test, "GpkClientEula") == FALSE)
 		return;
-	}
 	egg_test_end (test);
 }
 #endif

Modified: trunk/src/gpk-client-signature.h
==============================================================================
--- trunk/src/gpk-client-signature.h	(original)
+++ trunk/src/gpk-client-signature.h	Thu Nov  6 08:33:49 2008
@@ -27,7 +27,8 @@
 G_BEGIN_DECLS
 
 void		 gpk_client_signature_self_test		(gpointer	 data);
-gboolean	 gpk_client_signature_show		(const gchar	*package_id,
+gboolean	 gpk_client_signature_show		(GtkWindow	*window,
+							 const gchar	*package_id,
 							 const gchar	*repository_name,
 							 const gchar	*key_url,
 							 const gchar	*key_userid,

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Thu Nov  6 08:33:49 2008
@@ -770,6 +770,14 @@
 	guint i;
 	gchar *text;
 
+	/* don't use a bullet for one item */
+	if (array->len == 1) {
+		if (prefix != NULL)
+			return g_strdup_printf ("%s\n\n%s", prefix, g_ptr_array_index (array, 0));
+		else
+			return g_strdup (g_ptr_array_index (array, 0));
+	}
+
 	string = g_string_new (prefix);
 	if (prefix != NULL)
 		g_string_append (string, "\n\n");
@@ -834,6 +842,38 @@
 }
 
 /**
+ * gpk_client_install_local_files_ready_callback:
+ **/
+static void
+gpk_client_install_local_files_ready_callback (GObject *source_object, GAsyncResult *res, GpkClient *gclient)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_if_fail (GPK_IS_CLIENT (gclient));
+
+	ret = g_file_copy_finish (G_FILE (source_object), res, &error_local);
+	if (!ret) {
+		egg_warning ("failed to copy file: %s", error_local->message);
+		g_error_free (error_local);
+	}
+
+	gtk_main_quit ();
+}
+
+/**
+ * gpk_client_install_local_files_progress_callback:
+ **/
+static void
+gpk_client_install_local_files_progress_callback (goffset current_num_bytes, goffset total_num_bytes, GpkClient *gclient)
+{
+	guint percentage;
+	g_return_if_fail (GPK_IS_CLIENT (gclient));
+	percentage = (current_num_bytes * 100) / total_num_bytes;
+	gpk_client_dialog_set_percentage (gclient->priv->dialog, percentage);
+}
+
+/**
  * gpk_client_install_local_files_copy_non_native:
  *
  * Copy the new file into a new file that can be read by packagekitd, and
@@ -851,6 +891,7 @@
 	gchar *new_path = NULL;
 	gchar *cache_path = NULL;
 	gboolean ret;
+	GAsyncResult *res;
 	GError *error_local = NULL;
 
 	/* create the non FUSE temp directory */
@@ -868,12 +909,10 @@
 
 	/* copy the file */
 	dest = g_file_new_for_path (dest_path);
-	ret = g_file_copy (file, dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error_local);
-	if (!ret) {
-		*error = g_error_new (1, 0, "failed to copy file '%s' to '%s': %s", filename, cache_path, error_local->message);
-		g_error_free (error_local);
-		goto out;
-	}
+	g_file_copy_async (file, dest, G_FILE_COPY_OVERWRITE, 0, NULL,
+			   (GFileProgressCallback) gpk_client_install_local_files_progress_callback, gclient,
+			   (GAsyncReadyCallback) gpk_client_install_local_files_ready_callback, gclient);
+	gtk_main ();
 
 	/* return the modified file item */
 	new_path = g_strdup (dest_path);
@@ -930,7 +969,8 @@
 	}
 
 	/* optional */
-	if (gclient->priv->show_confirm && array_missing->len > 0) {
+	ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_SHOW_COPY_CONFIRM, NULL);
+	if (ret && array_missing->len > 0) {
 		/* TRANSLATORS: title: we have to copy the private files to a public location */
 		title = ngettext ("Do you want to copy this file?",
 				  "Do you want to copy these files?", array_missing->len);
@@ -959,6 +999,16 @@
 		}
 	}
 
+	/* setup UI */
+	if (array_missing->len > 0) {
+		/* TRANSLATORS: title: we are about to copy files, which may take a few seconds */
+		title = ngettext ("Copying file",
+				  "Copying files", array_missing->len);
+		gpk_client_dialog_set_title (gclient->priv->dialog, title);
+		gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-installing-private-files");
+		gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
+	}
+
 	/* now we have the okay to copy the files, do so */
 	ret = TRUE;
 	for (i=0; i<array->len; i++) {
@@ -977,6 +1027,9 @@
 				break;
 			}
 
+			/* show progress */
+			gpk_client_dialog_set_message (gclient->priv->dialog, filename);
+
 			/* swap data in array */
 			g_free (array->pdata[i]);
 			array->pdata[i] = g_strdup (filename);
@@ -1316,8 +1369,7 @@
 
 	/* no deps */
 	length = pk_package_list_get_size (list);
-	ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_SKIP_CONFIRM_NO_DEPS, NULL);
-	if (length == 0 && ret)
+	if (length == 0)
 		goto skip_checks;
 
 	/* sort by package_id */
@@ -1471,8 +1523,7 @@
 	/* these are the new packages */
 	list = pk_client_get_package_list (gclient->priv->client_resolve);
 	length = pk_package_list_get_size (list);
-	ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_SKIP_CONFIRM_NO_DEPS, NULL);
-	if (length == 0 && ret)
+	if (length == 0)
 		goto skip_checks;
 
 	/* TRANSLATORS: title: tell the user we have to install additional packages */
@@ -1582,9 +1633,14 @@
 
 	string = g_string_new ("");
 	len = g_strv_length (packages);
-	for (i=0; i<len; i++)
-		g_string_append_printf (string, "â <i>%s</i>\n", packages[i]);
 
+	/* don't use a bullet for one item */
+	if (len == 1) {
+		g_string_append_printf (string, "%s\n", packages[0]);
+	} else {
+		for (i=0; i<len; i++)
+			g_string_append_printf (string, "â %s\n", packages[i]);
+	}
 	/* display messagebox  */
 	text = g_string_free (string, FALSE);
 
@@ -1776,7 +1832,7 @@
 	}
 
 	/* check user wanted operation */
-	message = g_strdup_printf ("%s\n\nâ %s\n\n%s",
+	message = g_strdup_printf ("%s\n\n%s\n\n%s",
 				   /* TRANSLATORS: a program wants to install a file, e.g. /lib/moo.so */
 				   _("The following file is required:"),
 				   full_path,
@@ -1900,19 +1956,16 @@
 	const PkPackageObj *obj;
 	guint len;
 	gchar *title;
-	gchar *codec_name_formatted;
 
 	/* reset */
 	ret = pk_client_reset (gclient->priv->client_resolve, error);
 	if (!ret)
 		return NULL;
 
-	codec_name_formatted = g_strdup_printf ("<i>%s</i>", codec_name);
 	/* TRANSLATORS: title, searching for codecs */
-	title = g_strdup_printf (_("Searching for plugin: %s"), codec_name_formatted);
+	title = g_strdup_printf (_("Searching for plugin: %s"), codec_name);
 	gpk_client_dialog_set_message (gclient->priv->dialog, title);
 	g_free (title);
-	g_free (codec_name_formatted);
 
 	/* get codec packages */
 	ret = pk_client_what_provides (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED), PK_PROVIDES_ENUM_CODEC, codec_desc, error);
@@ -1968,10 +2021,18 @@
 
 	string = g_string_new ("");
 	g_string_append_printf (string, "%s\n%s\n\n", title, message);
-	for (i=0; i<len; i++) {
-		parts = g_strsplit (codec_name_strings[i], "|", 2);
-		g_string_append_printf (string, "â <i>%s</i>\n", parts[0]);
+
+	/* don't use a bullet for one item */
+	if (len == 1) {
+		parts = g_strsplit (codec_name_strings[0], "|", 2);
+		g_string_append_printf (string, "%s\n", parts[0]);
 		g_strfreev (parts);
+	} else {
+		for (i=0; i<len; i++) {
+			parts = g_strsplit (codec_name_strings[i], "|", 2);
+			g_string_append_printf (string, "â %s\n", parts[0]);
+			g_strfreev (parts);
+		}
 	}
 
 	/* TRANSLATORS: ask for confirmation */
@@ -2184,7 +2245,7 @@
 	}
 
 	/* make sure the user wants to do action */
-	message = g_strdup_printf ("%s\n\nâ %s\n\n%s",
+	message = g_strdup_printf ("%s\n\n%s\n\n%s",
 				    /* TRANSLATORS: message: mime type opener required */
 				   _("An additional program is required to open this type of file:"),
 				   mime_type,
@@ -2961,7 +3022,8 @@
 
 	g_return_if_fail (GPK_IS_CLIENT (gclient));
 
-	ret = gpk_client_signature_show (package_id, repository_name, key_url, key_userid,
+	widget = GTK_WIDGET (gpk_client_dialog_get_window (gclient->priv->dialog));
+	ret = gpk_client_signature_show (GTK_WINDOW (widget), package_id, repository_name, key_url, key_userid,
 					 key_id, key_fingerprint, key_timestamp);
 	/* disagreed with auth */
 	if (!ret)

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Thu Nov  6 08:33:49 2008
@@ -176,6 +176,8 @@
 	gboolean ret = FALSE;
 	gchar *message;
 	gchar *title;
+	GtkResponseType result;
+	GtkWidget *dialog;
 
 	uid = getuid ();
 	if (uid == 0) {
@@ -187,14 +189,28 @@
 			title = g_strdup_printf (_("%s is running as a privileged user"), application_name);
 		message = g_strjoin ("\n",
 				     /* TRANSLATORS: tell the user off */
-				     _("Running graphical applications as a privileged user should be avoided for security reasons."),
+				     _("Package management applications are security sensitive."),
 				     /* TRANSLATORS: and explain why */
-				     _("Package management applications are security sensitive and therefore this application will now close."), NULL);
-		gpk_error_dialog (title, message, "");
+				     _("Running graphical applications as a privileged user should be avoided for security reasons."), NULL);
+
+		/* give the user a choice */
+		dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_WARNING, GTK_BUTTONS_CANCEL, "%s", title);
+		/* TRANSLATORS: button: allow the user to run this, even when insecure */
+		gtk_dialog_add_button (GTK_DIALOG(dialog), _("Continue Anyway"), GTK_RESPONSE_OK);
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), "%s", message);
+		gtk_window_set_icon_name (GTK_WINDOW(dialog), GPK_ICON_SOFTWARE_INSTALLER);
+		result = gtk_dialog_run (GTK_DIALOG(dialog));
+		gtk_widget_destroy (dialog);
+
 		g_free (title);
 		g_free (message);
-		egg_warning ("uid=%i so closing", uid);
-		goto out;
+
+		/* user did not agree to run insecure */
+		if (result != GTK_RESPONSE_OK) {
+			egg_warning ("uid=%i so closing", uid);
+			goto out;
+		}
 	}
 
 	/* talk to ConsoleKit */

Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h	(original)
+++ trunk/src/gpk-common.h	Thu Nov  6 08:33:49 2008
@@ -51,8 +51,8 @@
 #define GPK_CONF_AUTO_UPDATE			"/apps/gnome-packagekit/auto_update"
 #define GPK_CONF_UPDATE_BATTERY			"/apps/gnome-packagekit/update_battery"
 #define GPK_CONF_SHOW_DEPENDS			"/apps/gnome-packagekit/show_depends"
+#define GPK_CONF_SHOW_COPY_CONFIRM		"/apps/gnome-packagekit/show_copy_confirm"
 #define GPK_CONF_BANNED_FIRMWARE		"/apps/gnome-packagekit/banned_firmware"
-#define GPK_CONF_SKIP_CONFIRM_NO_DEPS		"/apps/gnome-packagekit/skip_confirm_no_deps"
 
 #define GPK_CONF_REPO_SHOW_DETAILS		"/apps/gnome-packagekit/repo/show_details"
 #define GPK_CONF_APPLICATION_FILTER_BASENAME	"/apps/gnome-packagekit/application/filter_basename"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]