gnome-packagekit r364 - trunk/src



Author: rhughes
Date: Thu Oct 16 17:06:53 2008
New Revision: 364
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=364&view=rev

Log:
from git

Modified:
   trunk/src/Makefile.am
   trunk/src/gpk-application-main.c
   trunk/src/gpk-application.c
   trunk/src/gpk-check-update.c
   trunk/src/gpk-client.c
   trunk/src/gpk-common.c
   trunk/src/gpk-consolekit.c
   trunk/src/gpk-log.c
   trunk/src/gpk-service-pack.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Oct 16 17:06:53 2008
@@ -53,8 +53,6 @@
 	egg-string-list.h				\
 	egg-unique.c					\
 	egg-unique.h					\
-	egg-obj-list.c					\
-	egg-obj-list.h					\
 	egg-console-kit.c				\
 	egg-console-kit.h				\
 	egg-dbus-monitor.c				\

Modified: trunk/src/gpk-application-main.c
==============================================================================
--- trunk/src/gpk-application-main.c	(original)
+++ trunk/src/gpk-application-main.c	Thu Oct 16 17:06:53 2008
@@ -31,10 +31,9 @@
 #include <gtk/gtk.h>
 #include <locale.h>
 
-/* local .la */
-#include <egg-unique.h>
-
+#include "egg-unique.h"
 #include "egg-debug.h"
+
 #include "gpk-application.h"
 #include "gpk-common.h"
 

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Thu Oct 16 17:06:53 2008
@@ -35,7 +35,6 @@
 
 #include "egg-debug.h"
 #include "egg-string.h"
-#include "egg-obj-list.h"
 
 #include "gpk-client.h"
 #include "gpk-common.h"
@@ -1062,7 +1061,7 @@
 	application->priv->has_package = TRUE;
 
 	/* are we in the package list? */
-	in_queue = pk_package_list_contains_obj (application->priv->package_list, obj);
+	in_queue = pk_obj_list_exists (PK_OBJ_LIST(application->priv->package_list), obj);
 	installed = (obj->info == PK_INFO_ENUM_INSTALLED) || (obj->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
 
 	if (installed)
@@ -1619,7 +1618,7 @@
 		valid = gtk_tree_model_iter_next (model, &iter);
 	}
 
-	pk_package_list_clear (application->priv->package_list);
+	pk_obj_list_clear (PK_OBJ_LIST(application->priv->package_list));
 
 	/* force a button refresh */
 	widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
@@ -1668,7 +1667,7 @@
 	/* refresh the search as the items may have changed and the filter has not changed */
 	if (ret) {
 		/* clear if success */
-		pk_package_list_clear (application->priv->package_list);
+		pk_obj_list_clear (PK_OBJ_LIST(application->priv->package_list));
 		application->priv->action = PK_ACTION_NONE;
 		gpk_application_set_buttons_apply_clear (application);
 		gpk_application_refresh_search_results (application);
@@ -2766,8 +2765,7 @@
 static void
 gpk_application_categories_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, GpkApplication *application)
 {
-	const GPtrArray	*categories;
-	EggObjList *list;
+	PkObjList *list;
 	const PkCategoryObj *obj;
 	const PkCategoryObj *obj2;
 	GtkTreeIter iter;
@@ -2812,20 +2810,14 @@
 	}
 
 	/* get return values */
-	categories = pk_client_get_cached_objects (client);
-	if (categories->len == 0) {
+	list = pk_client_get_cached_objects (client);
+	if (list->len == 0) {
 		egg_warning ("no results from GetCategories");
 		goto out;
 	}
 
-	/* copy the categories into a list so we can remove then */
-	list = egg_obj_list_new ();
-	egg_obj_list_set_copy (list, (EggObjListCopyFunc) pk_category_obj_copy);
-	egg_obj_list_set_free (list, (EggObjListFreeFunc) pk_category_obj_free);
-	egg_obj_list_add_array (list, categories);
-
 	for (i=0; i < list->len; i++) {
-		obj = egg_obj_list_index (list, i);
+		obj = pk_obj_list_index (list, i);
 
 		gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
 		gtk_tree_store_set (application->priv->groups_store, &iter,
@@ -2838,7 +2830,7 @@
 		j = 0;
 		do {
 			/* only allows groups two layers deep */
-			obj2 = egg_obj_list_index (list, j);
+			obj2 = pk_obj_list_index (list, j);
 			if (egg_strequal (obj2->parent_id, obj->cat_id)) {
 				gtk_tree_store_append (application->priv->groups_store, &iter2, &iter);
 				gtk_tree_store_set (application->priv->groups_store, &iter2,
@@ -2848,7 +2840,7 @@
 						    GROUPS_COLUMN_ICON, obj2->icon,
 						    GROUPS_COLUMN_ACTIVE, TRUE,
 						    -1);
-				egg_obj_list_remove (list, obj2);
+				pk_obj_list_remove (list, obj2);
 			} else
 				j++;
 		} while (j < list->len);

Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c	(original)
+++ trunk/src/gpk-check-update.c	Thu Oct 16 17:06:53 2008
@@ -56,6 +56,9 @@
 
 #define GPK_CHECK_UPDATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CHECK_UPDATE, GpkCheckUpdatePrivate))
 
+/* the maximum number of lines of data on the libnotify widget */
+#define GPK_CHECK_UPDATE_MAX_NUMBER_SECURITY_ENTRIES	7
+
 struct GpkCheckUpdatePrivate
 {
 	GpkSmartIcon		*sicon;
@@ -71,6 +74,7 @@
 	gboolean		 cache_okay;
 	gboolean		 cache_update_in_progress;
 	gboolean		 get_updates_in_progress;
+	guint			 number_updates_critical_last_shown;
 	NotifyNotification	*notification_updates_available;
 	GPtrArray		*important_updates_array;
 };
@@ -297,6 +301,10 @@
 	gboolean ret;
 	ret = gpk_client_update_system (cupdate->priv->gclient_update_system, NULL);
 
+	/* this isn't valid anymore */
+	if (ret)
+		cupdate->priv->number_updates_critical_last_shown = 0;
+
 	/* we failed, show the icon */
 	if (!ret) {
 		gpk_smart_icon_set_icon_name (cupdate->priv->sicon, NULL);
@@ -401,6 +409,9 @@
 			egg_warning ("Individual updates failed: %s", error->message);
 			g_error_free (error);
 		}
+		/* this isn't valid anymore */
+		if (ret)
+			cupdate->priv->number_updates_critical_last_shown = 0;
 		g_strfreev (package_ids);
 
 	} else if (egg_strequal (action, "do-not-show-notify-critical")) {
@@ -438,6 +449,16 @@
 		return;
 	}
 
+	/* if the number of critical updates is the same as the last notification,
+	 * then skip the notifcation as we don't want to bombard the user every hour */
+	if (array->len == cupdate->priv->number_updates_critical_last_shown) {
+		egg_debug ("ignoring as user ignored last warning");
+		return;
+	}
+
+	/* save for comparison later */
+	cupdate->priv->number_updates_critical_last_shown = array->len;
+
 	/* save for later */
 	if (cupdate->priv->important_updates_array != NULL) {
 		g_ptr_array_foreach (cupdate->priv->important_updates_array, (GFunc) g_free, NULL);
@@ -701,7 +722,7 @@
 		}
 
 		/* don't have a huge notification that won't fit on the screen */
-		if (security_array->len > 10) {
+		if (security_array->len > GPK_CHECK_UPDATE_MAX_NUMBER_SECURITY_ENTRIES) {
 			more = length - security_array->len;
 			g_string_append_printf (status_security, ngettext ("and %d other security update",
 									   "and %d other security updates", more), more);
@@ -765,6 +786,9 @@
 			egg_warning ("Individual updates failed: %s", error->message);
 			g_error_free (error);
 		}
+		/* this isn't valid anymore */
+		if (ret)
+			cupdate->priv->number_updates_critical_last_shown = 0;
 		g_strfreev (package_ids);
 		goto out;
 	}
@@ -986,6 +1010,7 @@
 
 	cupdate->priv->notification_updates_available = NULL;
 	cupdate->priv->important_updates_array = NULL;
+	cupdate->priv->number_updates_critical_last_shown = 0;
 	cupdate->priv->sicon = gpk_smart_icon_new ();
 	gpk_smart_icon_set_priority (cupdate->priv->sicon, 2);
 

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Thu Oct 16 17:06:53 2008
@@ -1963,7 +1963,7 @@
 			ret = FALSE;
 		}
 		if (obj_new != NULL)
-			pk_package_list_add_obj (list, obj_new);
+			pk_obj_list_add (PK_OBJ_LIST(list), obj_new);
 
 		pk_package_obj_free (obj_new);
 		g_strfreev (parts);

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Thu Oct 16 17:06:53 2008
@@ -402,7 +402,7 @@
 	store = gtk_list_store_new (1, G_TYPE_STRING);
 	hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	list = pk_package_list_new ();
-	ret = pk_package_list_add_file (list, PK_SYSTEM_PACKAGE_LIST_FILENAME);
+	ret = pk_obj_list_from_file (PK_OBJ_LIST(list), PK_SYSTEM_PACKAGE_LIST_FILENAME);
 	if (!ret) {
 		egg_warning ("no package list, try refreshing");
 		return NULL;

Modified: trunk/src/gpk-consolekit.c
==============================================================================
--- trunk/src/gpk-consolekit.c	(original)
+++ trunk/src/gpk-consolekit.c	Thu Oct 16 17:06:53 2008
@@ -29,8 +29,8 @@
 #include <polkit-gnome/polkit-gnome.h>
 
 #include "egg-debug.h"
-#include <gpk-common.h>
-#include <gpk-error.h>
+#include "gpk-common.h"
+#include "gpk-error.h"
 
 /**
  * gpk_consolekit_try_system_restart:

Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c	(original)
+++ trunk/src/gpk-log.c	Thu Oct 16 17:06:53 2008
@@ -249,8 +249,7 @@
  * gpk_log_transaction_cb:
  **/
 static void
-gpk_log_transaction_cb (PkClient *client, const gchar *tid, const gchar *timespec,
-			gboolean succeeded, PkRoleEnum role, guint duration, const gchar *data, gpointer user_data)
+gpk_log_transaction_cb (PkClient *client, const PkTransactionObj *obj, gpointer user_data)
 {
 	GtkTreeIter iter;
 	gchar *details;
@@ -262,29 +261,29 @@
 	const gchar *role_text;
 
 	/* only show transactions that succeeded */
-	if (!succeeded) {
-		egg_debug ("tid %s did not succeed, so not adding", tid);
+	if (!obj->succeeded) {
+		egg_debug ("tid %s did not succeed, so not adding", obj->tid);
 		return;
 	}
 
 	/* filter */
-	ret = gpk_log_filter (data);
+	ret = gpk_log_filter (obj->data);
 	if (!ret) {
-		egg_debug ("tid %s did not match, so not adding", tid);
+		egg_debug ("tid %s did not match, so not adding", obj->tid);
 		return;
 	}
 
 	/* put formatted text into treeview */
-	details = gpk_log_get_details_localised (timespec, data);
-	date = gpk_log_get_localised_date (timespec);
+	details = gpk_log_get_details_localised (obj->timespec, obj->data);
+	date = gpk_log_get_localised_date (obj->timespec);
 	date_part = g_strsplit (date, ", ", 2);
 
-	if (duration > 0)
-		time = gpk_time_to_localised_string (duration / 1000);
+	if (obj->duration > 0)
+		time = gpk_time_to_localised_string (obj->duration / 1000);
 	else
 		time = g_strdup (_("No data"));
-	icon_name = gpk_role_enum_to_icon_name (role);
-	role_text = gpk_role_enum_to_localised_past (role);
+	icon_name = gpk_role_enum_to_icon_name (obj->role);
+	role_text = gpk_role_enum_to_localised_past (obj->role);
 
 	gtk_list_store_append (list_store, &iter);
 	gtk_list_store_set (list_store, &iter,
@@ -294,7 +293,7 @@
 			    GPK_LOG_COLUMN_ROLE, role_text,
 			    GPK_LOG_COLUMN_DURATION, time,
 			    GPK_LOG_COLUMN_DETAILS, details,
-			    GPK_LOG_COLUMN_ID, tid, -1);
+			    GPK_LOG_COLUMN_ID, obj->tid, -1);
 
 	/* spin the gui */
 	while (gtk_events_pending ())

Modified: trunk/src/gpk-service-pack.c
==============================================================================
--- trunk/src/gpk-service-pack.c	(original)
+++ trunk/src/gpk-service-pack.c	Thu Oct 16 17:06:53 2008
@@ -322,7 +322,7 @@
 
 	/* open the list */
 	system = pk_package_list_new ();
-	ret = pk_package_list_add_file (system, PK_SYSTEM_PACKAGE_LIST_FILENAME);
+	ret = pk_obj_list_from_file (PK_OBJ_LIST(system), PK_SYSTEM_PACKAGE_LIST_FILENAME);
 	if (!ret) {
 		*error = g_error_new (0, 0, _("Could not read package list"));
 		goto out;
@@ -334,14 +334,14 @@
 	for (i=0; i<length; i++) {
 		obj = pk_package_list_get_obj (system, i);
 		if (obj->info == PK_INFO_ENUM_INSTALLED)
-			pk_package_list_add_obj (installed, obj);
+			pk_obj_list_add (PK_OBJ_LIST(installed), obj);
 		/* don't hang the GUI */
 		while (gtk_events_pending ())
 			gtk_main_iteration ();
 	}
 
 	/* write new file */
-	ret = pk_package_list_to_file (installed, filename);
+	ret = pk_obj_list_to_file (PK_OBJ_LIST(installed), filename);
 	if (!ret) {
 		*error = g_error_new (0, 0, _("Could not write package list"));
 		goto out;
@@ -417,7 +417,7 @@
 
 	/* add the exclude list */
 	list = pk_package_list_new ();
-	ret = pk_package_list_add_file (list, exclude);
+	ret = pk_obj_list_from_file (PK_OBJ_LIST(list), exclude);
 	if (!ret) {
 		widget = glade_xml_get_widget (glade_xml, "window_pack");
 		gpk_error_dialog_modal (GTK_WINDOW (widget), _("Create error"), _("Cannot read destination package list"), NULL);



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