gnome-packagekit r493 - in trunk: data src



Author: rhughes
Date: Mon Feb 23 09:54:50 2009
New Revision: 493
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=493&view=rev

Log:
from git

Modified:
   trunk/data/gnome-packagekit.schemas.in
   trunk/src/gpk-check-update.c
   trunk/src/gpk-common.h
   trunk/src/gpk-enum.c
   trunk/src/gpk-enum.h
   trunk/src/gpk-update-viewer.c
   trunk/src/gpk-watch.c

Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in	(original)
+++ trunk/data/gnome-packagekit.schemas.in	Mon Feb 23 09:54:50 2009
@@ -26,6 +26,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/ignored_messages</key>
+      <applyto>/apps/gnome-packagekit/ignored_messages</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>string</type>
+      <default>backend-*,untrusted-package</default>
+      <locale name="C">
+        <short>Messages that should be ignored</short>
+        <long>Messages that should be ignored, separated by commas. These can include '*' and '?' characters</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/enable_check_hardware</key>
       <applyto>/apps/gnome-packagekit/enable_check_hardware</applyto>
       <owner>gnome-packagekit</owner>

Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c	(original)
+++ trunk/src/gpk-check-update.c	Mon Feb 23 09:54:50 2009
@@ -773,8 +773,8 @@
 	if (status_security->len != 0)
 		g_string_set_size (status_security, status_security->len-1);
 	/* TRANSLATORS: tooltip: how many updates are waiting to be applied */
-	g_string_append_printf (status_tooltip, ngettext ("There is %d update pending",
-							  "There are %d updates pending", length), length);
+	g_string_append_printf (status_tooltip, ngettext ("There is %d update available",
+							  "There are %d updates available", length), length);
 #if GTK_CHECK_VERSION(2,15,0)
 	gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (cupdate->priv->sicon), status_tooltip->str);
 #else
@@ -1044,6 +1044,19 @@
 }
 
 /**
+ * gpk_check_update_network_status_changed_cb:
+ **/
+static void
+gpk_check_update_network_status_changed_cb (PkControl *control, PkNetworkEnum state, GpkCheckUpdate *cupdate)
+{
+	//TODO: check that set_visible (TRUE) on a unset icon doesn't cause an icon to show
+	if (state == PK_NETWORK_ENUM_OFFLINE)
+		gtk_status_icon_set_visible (GTK_STATUS_ICON(cupdate->priv->sicon), FALSE);
+	else
+		gtk_status_icon_set_visible (GTK_STATUS_ICON(cupdate->priv->sicon), TRUE);
+}
+
+/**
  * gpk_check_update_init:
  * @cupdate: This class instance
  **/
@@ -1096,6 +1109,8 @@
 			  G_CALLBACK (gpk_check_update_updates_changed_cb), cupdate);
 	g_signal_connect (cupdate->priv->control, "restart-schedule",
 			  G_CALLBACK (gpk_check_update_restart_schedule_cb), cupdate);
+	g_signal_connect (cupdate->priv->control, "network-state-changed",
+			  G_CALLBACK (gpk_check_update_network_status_changed_cb), cupdate);
 
 	/* we need the task list so we can hide the update icon when we are doing the update */
 	cupdate->priv->tlist = pk_task_list_new ();

Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h	(original)
+++ trunk/src/gpk-common.h	Mon Feb 23 09:54:50 2009
@@ -63,6 +63,7 @@
 #define GPK_CONF_APPLICATION_CATEGORY_GROUPS	"/apps/gnome-packagekit/application/category_groups"
 #define GPK_CONF_APPLICATION_SEARCH_MODE	"/apps/gnome-packagekit/application/search_mode"
 #define GPK_CONF_UPDATE_VIEWER_PRECACHE_DETAILS	"/apps/gnome-packagekit/update_viewer/precache_details"
+#define GPK_CONF_IGNORED_MESSAGES		"/apps/gnome-packagekit/ignored_messages"
 
 #define GPK_CONF_ENABLE_FONT_HELPER		"/apps/gnome-packagekit/enable_font_helper"
 #define GPK_CONF_ENABLE_CODEC_HELPER		"/apps/gnome-packagekit/enable_codec_helper"

Modified: trunk/src/gpk-enum.c
==============================================================================
--- trunk/src/gpk-enum.c	(original)
+++ trunk/src/gpk-enum.c	Mon Feb 23 09:54:50 2009
@@ -202,6 +202,15 @@
 
 static const PkEnumMatch enum_restart_icon_name[] = {
 	{PK_RESTART_ENUM_UNKNOWN,		"help-browser"},	/* fall though value */
+	{PK_RESTART_ENUM_NONE,			""},
+	{PK_RESTART_ENUM_SYSTEM,		"view-refresh"},
+	{PK_RESTART_ENUM_SESSION,		"view-refresh"},
+	{PK_RESTART_ENUM_APPLICATION,		"view-refresh"},
+	{0, NULL}
+};
+
+static const PkEnumMatch enum_restart_dialog_icon_name[] = {
+	{PK_RESTART_ENUM_UNKNOWN,		"help-browser"},	/* fall though value */
 	{PK_RESTART_ENUM_NONE,			"dialog-information"},
 	{PK_RESTART_ENUM_SYSTEM,		"dialog-error"},
 	{PK_RESTART_ENUM_SESSION,		"dialog-warning"},
@@ -1563,6 +1572,15 @@
 }
 
 /**
+ * gpk_restart_enum_to_dialog_icon_name:
+ **/
+const gchar *
+gpk_restart_enum_to_dialog_icon_name (PkRestartEnum restart)
+{
+	return pk_enum_find_string (enum_restart_dialog_icon_name, restart);
+}
+
+/**
  * gpk_message_enum_to_icon_name:
  **/
 const gchar *

Modified: trunk/src/gpk-enum.h
==============================================================================
--- trunk/src/gpk-enum.h	(original)
+++ trunk/src/gpk-enum.h	Mon Feb 23 09:54:50 2009
@@ -74,6 +74,7 @@
 const gchar	*gpk_status_enum_to_icon_name		(PkStatusEnum	 status);
 const gchar	*gpk_status_enum_to_animation		(PkStatusEnum	 status);
 const gchar	*gpk_restart_enum_to_icon_name		(PkRestartEnum	 restart);
+const gchar	*gpk_restart_enum_to_dialog_icon_name	(PkRestartEnum	 restart);
 const gchar	*gpk_error_enum_to_localised_text	(PkErrorCodeEnum code)
 							 G_GNUC_CONST;
 const gchar	*gpk_error_enum_to_localised_message	(PkErrorCodeEnum code);

Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c	(original)
+++ trunk/src/gpk-update-viewer.c	Mon Feb 23 09:54:50 2009
@@ -1640,8 +1640,8 @@
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 	}
 
-	/* TRANSLATORS: right click option, ignore this package name, not currently used */
-	menuitem = gtk_menu_item_new_with_label (_("Ignore this package"));
+	/* TRANSLATORS: right click option, ignore this update name, not currently used */
+	menuitem = gtk_menu_item_new_with_label (_("Ignore this update"));
 	gtk_widget_set_sensitive (GTK_WIDGET (menuitem), FALSE);
 	g_signal_connect (menuitem, "activate",
 			  G_CALLBACK (gpk_update_viewer_detail_popup_menu_select_all), treeview);
@@ -1799,9 +1799,9 @@
 	polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.system-update");
 	update_packages_action = polkit_gnome_action_new_default ("update-package", pk_action,
 								  /* TRANSLATORS: button label, apply all pending updates the user has selected */
-								  _("_Apply Updates"),
+								  _("_Install Updates"),
 								  /* TRANSLATORS: button tooltip */
-								  _("Apply the selected updates"));
+								  _("Install the selected updates"));
 	g_object_set (update_packages_action,
 		      "no-icon-name", GTK_STOCK_APPLY,
 		      "auth-icon-name", GTK_STOCK_APPLY,
@@ -1817,7 +1817,7 @@
 								/* TRANSLATORS: button label, update all packages pending */
 								_("_Update System"),
 								/* TRANSLATORS: button tooltip */
-								_("Apply all updates"));
+								_("Install all updates"));
 	g_object_set (update_system_action,
 		      "no-icon-name", GTK_STOCK_APPLY,
 		      "auth-icon-name", GTK_STOCK_APPLY,

Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c	(original)
+++ trunk/src/gpk-watch.c	Mon Feb 23 09:54:50 2009
@@ -316,7 +316,7 @@
 
 	/* any restart required? */
 	if (watch->priv->restart != PK_RESTART_ENUM_NONE) {
-		icon_name = gpk_restart_enum_to_icon_name (watch->priv->restart);
+		icon_name = gpk_restart_enum_to_dialog_icon_name (watch->priv->restart);
 		goto out;
 	}
 
@@ -553,6 +553,49 @@
 }
 
 /**
+ * gpk_watch_is_message_ignored:
+ **/
+static gboolean
+gpk_watch_is_message_ignored (GpkWatch *watch, PkMessageEnum message)
+{
+	guint i;
+	gboolean ret = FALSE;
+	gchar *ignored_str;
+	gchar **ignored = NULL;
+	const gchar *message_str;
+
+	/* get from gconf */
+	ignored_str = gconf_client_get_string (watch->priv->gconf_client, GPK_CONF_IGNORED_MESSAGES, NULL);
+	if (ignored_str == NULL) {
+		egg_warning ("could not read ignored list");
+		goto out;
+	}
+
+	/* nothing in list, common case */
+	if (egg_strzero (ignored_str)) {
+		egg_debug ("nothing in ignored list");
+		goto out;
+	}
+
+	/* split using "," */
+	ignored = g_strsplit (ignored_str, ",", 0);
+
+	/* remove any ignored pattern matches */
+	message_str = pk_message_enum_to_text (message);
+	for (i=0; ignored[i] != NULL; i++) {
+		ret = g_pattern_match_simple (ignored[i], message_str);
+		if (ret) {
+			egg_debug ("match %s for %s, ignoring", ignored[i], message_str);
+			break;
+		}
+	}
+out:
+	g_free (ignored_str);
+	g_strfreev (ignored);
+	return ret;
+}
+
+/**
  * gpk_watch_message_cb:
  **/
 static void
@@ -566,6 +609,13 @@
 
 	g_return_if_fail (GPK_IS_WATCH (watch));
 
+	/* is ignored */
+	ret = gpk_watch_is_message_ignored (watch, message);
+	if (ret) {
+		egg_debug ("igoring message");
+		return;
+	}
+
 	/* add to list */
 	cached_message = g_new0 (GpkWatchCachedMessage, 1);
 	cached_message->type = message;



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