gnome-packagekit r178 - in trunk: data libpackagekit-gnome src



Author: rhughes
Date: Fri Apr 18 15:44:44 2008
New Revision: 178
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=178&view=rev

Log:
from git

Modified:
   trunk/data/gpk-application.glade
   trunk/libpackagekit-gnome/gpk-client.c
   trunk/libpackagekit-gnome/gpk-common.c
   trunk/libpackagekit-gnome/gpk-error.c
   trunk/src/gpk-application.c
   trunk/src/gpk-auto-refresh.c
   trunk/src/gpk-log.c

Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade	(original)
+++ trunk/data/gpk-application.glade	Fri Apr 18 15:44:44 2008
@@ -522,7 +522,7 @@
                           <widget class="GtkVBox" id="vbox_description">
                             <property name="visible">True</property>
                             <property name="border_width">5</property>
-                            <property name="spacing">5</property>
+                            <property name="spacing">6</property>
                             <child>
                               <widget class="GtkScrolledWindow" id="scrolledwindow2">
                                 <property name="visible">True</property>
@@ -543,76 +543,66 @@
                               </widget>
                             </child>
                             <child>
-                              <widget class="GtkHBox" id="hbox2">
+                              <widget class="GtkHBox" id="hbox_source">
                                 <property name="visible">True</property>
-                                <property name="spacing">12</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <widget class="GtkHBox" id="hbox_filesize">
+                                  <widget class="GtkLabel" id="label_source_text">
                                     <property name="visible">True</property>
-                                    <property name="border_width">5</property>
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <widget class="GtkLabel" id="label_filesize_text">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes">Package size:</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkLabel" id="label_filesize">
-                                        <property name="visible">True</property>
-                                        <property name="label">1.4 Mb</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
+                                    <property name="label" translatable="yes">Software source:</property>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkHBox" id="hbox_source">
+                                  <widget class="GtkLabel" id="label_source">
                                     <property name="visible">True</property>
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <widget class="GtkLabel" id="label_source_text">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes">Software source:</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkLabel" id="label_source">
-                                        <property name="visible">True</property>
-                                        <property name="label">rawhide</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
+                                    <property name="label">Fedora - Rawhide</property>
+                                    <property name="wrap">True</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </widget>
                               <packing>
-                                <property name="expand">False</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox_filesize">
+                                <property name="visible">True</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label_filesize_text">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Package size:</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label_filesize">
+                                    <property name="visible">True</property>
+                                    <property name="label">124kb</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
                           </widget>
                         </child>
                         <child>

Modified: trunk/libpackagekit-gnome/gpk-client.c
==============================================================================
--- trunk/libpackagekit-gnome/gpk-client.c	(original)
+++ trunk/libpackagekit-gnome/gpk-client.c	Fri Apr 18 15:44:44 2008
@@ -848,7 +848,7 @@
 	/* install signature */
 	pk_debug ("install signature %s", key_id);
 	ret = pk_client_reset (gclient->priv->client_signature, &error);
-	if (ret == FALSE) {
+	if (!ret) {
 		gpk_error_dialog (_("Failed to install signature"), _("The client could not be reset"), error->message);
 		g_error_free (error);
 		return;
@@ -870,6 +870,8 @@
 gpk_client_eula_required_cb (PkClient *client, const gchar *eula_id, const gchar *package_id,
 			     const gchar *vendor_name, const gchar *license_agreement, GpkClient *gclient)
 {
+	gboolean ret;
+	GError *error = NULL;
 	GtkWidget *widget;
 	GladeXML *glade_xml;
 	GtkTextBuffer *buffer;
@@ -916,6 +918,7 @@
 	gtk_widget_show (widget);
 
 	/* wait for button press */
+	gclient->priv->do_key_auth = FALSE;
 	gtk_main ();
 
 	/* hide window */
@@ -924,6 +927,28 @@
 	}
 	g_object_unref (glade_xml);
 	g_object_unref (buffer);
+
+	/* disagreed with auth */
+	if (!gclient->priv->do_key_auth) {
+		return;
+	}
+
+	/* install signature */
+	pk_debug ("accept EULA %s", eula_id);
+	ret = pk_client_reset (gclient->priv->client_signature, &error);
+	if (!ret) {
+		gpk_error_dialog (_("Failed to accept EULA"), _("The client could not be reset"), error->message);
+		g_error_free (error);
+		return;
+	}
+
+	/* this is asynchronous, else we get into livelock */
+	ret = pk_client_accept_eula (gclient->priv->client_signature, eula_id, &error);
+	if (!ret) {
+		gpk_error_dialog (_("Failed to accept EULA"), _("The method failed"), error->message);
+		g_error_free (error);
+		gclient->priv->do_key_auth = FALSE;
+	}
 }
 
 /**

Modified: trunk/libpackagekit-gnome/gpk-common.c
==============================================================================
--- trunk/libpackagekit-gnome/gpk-common.c	(original)
+++ trunk/libpackagekit-gnome/gpk-common.c	Fri Apr 18 15:44:44 2008
@@ -78,6 +78,12 @@
 	{PK_STATUS_ENUM_REQUEST,		"pk-package-search"},
 	{PK_STATUS_ENUM_FINISHED,		"pk-package-cleanup"}, /* TODO: need better icon */
 	{PK_STATUS_ENUM_CANCEL,			"pk-package-cleanup"}, /* TODO: need better icon */
+	{PK_STATUS_ENUM_DOWNLOAD_REPOSITORY,	"pk-refresh-cache"},
+	{PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST,	"pk-refresh-cache"},
+	{PK_STATUS_ENUM_DOWNLOAD_FILELIST,	"pk-refresh-cache"},
+	{PK_STATUS_ENUM_DOWNLOAD_CHANGELOG,	"pk-refresh-cache"},
+	{PK_STATUS_ENUM_DOWNLOAD_GROUP,		"pk-refresh-cache"},
+	{PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO,	"pk-refresh-cache"},
 	{0, NULL}
 };
 
@@ -669,6 +675,24 @@
 	case PK_STATUS_ENUM_CANCEL:
 		text = _("Cancelling");
 		break;
+	case PK_STATUS_ENUM_DOWNLOAD_REPOSITORY:
+		text = _("Downloading repository information");
+		break;
+	case PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST:
+		text = _("Downloading list of packages");
+		break;
+	case PK_STATUS_ENUM_DOWNLOAD_FILELIST:
+		text = _("Downloading file lists");
+		break;
+	case PK_STATUS_ENUM_DOWNLOAD_CHANGELOG:
+		text = _("Downloading lists of changes");
+		break;
+	case PK_STATUS_ENUM_DOWNLOAD_GROUP:
+		text = _("Downloading groups");
+		break;
+	case PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO:
+		text = _("Downloading update information");
+		break;
 	default:
 		pk_warning ("status unrecognised: %s", pk_status_enum_to_text (status));
 	}

Modified: trunk/libpackagekit-gnome/gpk-error.c
==============================================================================
--- trunk/libpackagekit-gnome/gpk-error.c	(original)
+++ trunk/libpackagekit-gnome/gpk-error.c	Fri Apr 18 15:44:44 2008
@@ -30,6 +30,8 @@
 #include <pk-debug.h>
 #include <pk-common.h>
 
+#define PK_STOCK_WINDOW_ICON		"system-software-installer"
+
 /**
  * gpk_error_dialog:
  * @title: the localised text to put in bold as a title
@@ -51,6 +53,11 @@
 	/* connect up actions */
 	widget = glade_xml_get_widget (glade_xml, "window_error");
 	g_signal_connect_swapped (widget, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+	/* set icon name */
+	gtk_window_set_icon_name (GTK_WINDOW (widget), PK_STOCK_WINDOW_ICON);
+
+	/* close button */
 	widget = glade_xml_get_widget (glade_xml, "button_close");
 	g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL);
 

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Fri Apr 18 15:44:44 2008
@@ -88,6 +88,7 @@
 	gchar			*package;
 	gchar			*group;
 	gchar			*url;
+	GHashTable		*repos;
 	PkRoleEnum		 roles;
 	PkFilterEnum		 filters;
 	PkGroupEnum		 groups;
@@ -477,6 +478,7 @@
 	GtkWidget *widget;
 	gchar *text;
 	PkPackageId *ident;
+	const gchar *repo_name;
 
 	g_return_if_fail (PK_IS_APPLICATION (application));
 
@@ -530,7 +532,14 @@
 		widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_source");
 		gtk_widget_show (widget);
 		widget = glade_xml_get_widget (application->priv->glade_xml, "label_source");
-		gtk_label_set_label (GTK_LABEL (widget), ident->data);
+
+		/* see if we can get the full name of the repo from the repo_id */
+		repo_name = (const gchar *) g_hash_table_lookup (application->priv->repos, ident->data);
+		if (repo_name == NULL) {
+			pk_warning ("no repo name, falling back to %s", ident->data);
+			repo_name = ident->data;
+		}
+		gtk_label_set_label (GTK_LABEL (widget), repo_name);
 	}
 	pk_package_id_free (ident);
 }
@@ -2044,6 +2053,24 @@
 }
 
 /**
+ * pk_application_repo_detail_cb:
+ **/
+static void
+pk_application_repo_detail_cb (PkClient *client, const gchar *repo_id,
+			       const gchar *description, gboolean enabled,
+			       GpkApplication *application)
+{
+	g_return_if_fail (PK_IS_APPLICATION (application));
+
+	pk_debug ("repo = %s:%s", repo_id, description);
+	/* no problem, just no point adding as we will fallback to the repo_id */
+	if (description == NULL) {
+		return;
+	}
+	g_hash_table_insert (application->priv->repos, g_strdup (repo_id), g_strdup (description));
+}
+
+/**
  * gpk_application_init:
  **/
 static void
@@ -2064,6 +2091,7 @@
 	PolKitAction *pk_action;
 	GtkWidget *button;
 	GtkWidget *item;
+	GError *error = NULL;
 
 	application->priv = GPK_APPLICATION_GET_PRIVATE (application);
 	application->priv->package = NULL;
@@ -2071,6 +2099,7 @@
 	application->priv->url = NULL;
 	application->priv->has_package = FALSE;
 	application->priv->gconf_client = gconf_client_get_default ();
+	application->priv->repos = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
 	application->priv->search_type = PK_SEARCH_UNKNOWN;
 	application->priv->search_mode = PK_MODE_UNKNOWN;
@@ -2112,6 +2141,8 @@
 			  G_CALLBACK (gpk_application_status_changed_cb), application);
 	g_signal_connect (application->priv->client_action, "allow-cancel",
 			  G_CALLBACK (gpk_application_allow_cancel_cb), application);
+	g_signal_connect (application->priv->client_action, "repo-detail",
+			  G_CALLBACK (pk_application_repo_detail_cb), application);
 
 	application->priv->client_description = pk_client_new ();
 	g_signal_connect (application->priv->client_description, "description",
@@ -2151,7 +2182,7 @@
 	g_signal_connect (application->priv->pconnection, "connection-changed",
 			  G_CALLBACK (gpk_application_connection_changed_cb), application);
 
-	/* single instance, so this is valid */
+	/* get localised data from sqlite database */
 	application->priv->extra = pk_extra_new ();
 	ret = pk_extra_set_database (application->priv->extra, NULL);
 	if (!ret) {
@@ -2305,6 +2336,9 @@
 	widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
 	gtk_widget_hide (widget);
 
+	widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_source");
+	gtk_widget_hide (widget);
+
 	/* basename filter */
 	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_basename");
 	g_signal_connect (widget, "toggled",
@@ -2543,6 +2577,13 @@
 	/* use a seporator */
 	gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget),
 					      gpk_application_group_row_separator_func, NULL, NULL);
+
+	/* get repos, so we can show the full name in the software source box */
+	ret = pk_client_get_repo_list (application->priv->client_action, PK_FILTER_ENUM_NONE, &error);
+	if (!ret) {
+		pk_warning ("failed to get repo list: %s", error->message);
+		g_error_free (error);
+	}
 }
 
 /**
@@ -2576,6 +2617,7 @@
 	g_free (application->priv->url);
 	g_free (application->priv->group);
 	g_free (application->priv->package);
+	g_hash_table_destroy (application->priv->repos);
 
 	G_OBJECT_CLASS (gpk_application_parent_class)->finalize (object);
 }

Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c	(original)
+++ trunk/src/gpk-auto-refresh.c	Fri Apr 18 15:44:44 2008
@@ -145,7 +145,8 @@
 /**
  * gpk_auto_refresh_convert_frequency:
  *
- * Return value: The number of seconds for the frequency period
+ * Return value: The number of seconds for the frequency period,
+ * or zero for never or no schema
  **/
 static guint
 gpk_auto_refresh_convert_frequency (PkFreqEnum freq)
@@ -155,7 +156,7 @@
 		return 0;
 	}
 	if (freq == PK_FREQ_ENUM_NEVER) {
-		return G_MAXUINT;
+		return 0;
 	}
 	if (freq == PK_FREQ_ENUM_HOURLY) {
 		return 60*60;
@@ -184,7 +185,7 @@
 	/* get from gconf */
 	freq_text = gconf_client_get_string (arefresh->priv->gconf_client, key, NULL);
 	if (freq_text == NULL) {
-		pk_warning ("no schema");
+		pk_warning ("no schema for %s", key);
 		return 0;
 	}
 
@@ -217,6 +218,13 @@
 		return FALSE;
 	}
 
+	/* get this each time, as it may have changed behind out back */
+	thresh = gpk_auto_refresh_convert_frequency_text (arefresh, GPK_CONF_FREQUENCY_REFRESH_CACHE);
+	if (thresh == 0) {
+		pk_debug ("not when policy is to never refresh");
+		return FALSE;
+	}
+
 	/* get the time since the last refresh */
 	ret = pk_control_get_time_since_action (arefresh->priv->control,
 						PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
@@ -225,9 +233,6 @@
 		return FALSE;
 	}
 
-	/* get this each time, as it may have changed behind out back */
-	thresh = gpk_auto_refresh_convert_frequency_text (arefresh, GPK_CONF_FREQUENCY_REFRESH_CACHE);
-
 	/* have we passed the timout? */
 	if (time < thresh) {
 		pk_debug ("not before timeout, thresh=%u, now=%u", thresh, time);
@@ -250,6 +255,13 @@
 
 	g_return_val_if_fail (PK_IS_AUTO_REFRESH (arefresh), FALSE);
 
+	/* get this each time, as it may have changed behind out back */
+	thresh = gpk_auto_refresh_convert_frequency_text (arefresh, GPK_CONF_FREQUENCY_GET_UPDATES);
+	if (thresh == 0) {
+		pk_debug ("not when policy is to never refresh");
+		return FALSE;
+	}
+
 	/* get the time since the last refresh */
 	ret = pk_control_get_time_since_action (arefresh->priv->control,
 						PK_ROLE_ENUM_GET_UPDATES, &time, NULL);
@@ -258,9 +270,6 @@
 		return FALSE;
 	}
 
-	/* get this each time, as it may have changed behind out back */
-	thresh = gpk_auto_refresh_convert_frequency_text (arefresh, GPK_CONF_FREQUENCY_GET_UPDATES);
-
 	/* have we passed the timout? */
 	if (time < thresh) {
 		pk_debug ("not before timeout, thresh=%u, now=%u", thresh, time);

Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c	(original)
+++ trunk/src/gpk-log.c	Fri Apr 18 15:44:44 2008
@@ -55,7 +55,6 @@
 {
 	PACKAGES_COLUMN_GENERAL_ICON,
 	PACKAGES_COLUMN_GENERAL_TEXT,
-	PACKAGES_COLUMN_GENERAL_SUCCEEDED,
 	PACKAGES_COLUMN_GENERAL_ID,
 	PACKAGES_COLUMN_GENERAL_LAST
 };
@@ -152,6 +151,12 @@
 	const gchar *icon_name;
 	const gchar *role_text;
 
+	/* only show transactions that succeeded */
+	if (!succeeded) {
+		pk_debug ("tid %s did not succeed, so not adding", tid);
+		return;
+	}
+
 	/* we save this */
 	g_hash_table_insert (hash, g_strdup (tid), g_strdup (data));
 
@@ -169,13 +174,6 @@
 
 	icon_name = gpk_role_enum_to_icon_name (role);
 	gtk_list_store_set (list_store_general, &iter, PACKAGES_COLUMN_GENERAL_ICON, icon_name, -1);
-
-	if (succeeded) {
-		icon_name = "document-new";
-	} else {
-		icon_name = "dialog-error";
-	}
-	gtk_list_store_set (list_store_general, &iter, PACKAGES_COLUMN_GENERAL_SUCCEEDED, icon_name, -1);
 }
 
 /**
@@ -215,13 +213,6 @@
 	gtk_tree_view_column_set_sort_column_id (column, PACKAGES_COLUMN_GENERAL_TEXT);
 	gtk_tree_view_append_column (treeview, column);
 	gtk_tree_view_column_set_expand (column, TRUE);
-
-	/* image */
-	renderer = gtk_cell_renderer_pixbuf_new ();
-        g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
-	column = gtk_tree_view_column_new_with_attributes (_("Succeeded"), renderer,
-							   "icon-name", PACKAGES_COLUMN_GENERAL_SUCCEEDED, NULL);
-	gtk_tree_view_append_column (treeview, column);
 }
 
 /**
@@ -235,7 +226,7 @@
 
 	/* image */
 	renderer = gtk_cell_renderer_pixbuf_new ();
-        g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
+        g_object_set (renderer, "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
 	column = gtk_tree_view_column_new_with_attributes (_("Type"), renderer,
 							   "icon-name", PACKAGES_COLUMN_DETAILS_ICON, NULL);
 	gtk_tree_view_append_column (treeview, column);
@@ -304,7 +295,11 @@
 	for (i=0; i<size; i++) {
 		sections = g_strsplit (array[i], "\t", 0);
 		info = pk_info_enum_from_text (sections[0]);
-		pk_details_item_add (list_store_details, info, sections[1], sections[2]);
+		if (info == PK_INFO_ENUM_UPDATING ||
+		    info == PK_INFO_ENUM_INSTALLING ||
+		    info == PK_INFO_ENUM_REMOVING) {
+			pk_details_item_add (list_store_details, info, sections[1], sections[2]);
+		}
 		g_strfreev (sections);
 	}
 	g_strfreev (array);



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