gnome-packagekit r271 - in trunk: . data po src



Author: rhughes
Date: Thu Aug 28 08:21:25 2008
New Revision: 271
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=271&view=rev

Log:
from git

Modified:
   trunk/NEWS
   trunk/configure.ac
   trunk/data/gnome-packagekit.schemas.in
   trunk/data/gpk-prefs.glade
   trunk/po/ChangeLog
   trunk/po/es.po
   trunk/po/pl.po
   trunk/src/gpk-auto-refresh.c
   trunk/src/gpk-check-update.c
   trunk/src/gpk-client-depends.c
   trunk/src/gpk-client-requires.c
   trunk/src/gpk-client.c
   trunk/src/gpk-client.h
   trunk/src/gpk-common.c
   trunk/src/gpk-common.h
   trunk/src/gpk-prefs.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Aug 28 08:21:25 2008
@@ -1,3 +1,17 @@
+Version 0.3.1
+~~~~~~~~~~~~~~
+Released: 2008-08-27
+
+New:
+ - Support all the PkMessage types (Richard Hughes)
+ - Add UI to set the interval for checking for distro upgrades (Richard Hughes)
+ - Detect when we need a distro upgrade (Richard Hughes)
+
+Bugfix:
+ - Fix a spelling error from Resolved to Resolving (Daniel Nicoletti)
+ - Fix the shadow in the refresh cache animation. Fixes fd#17236 (Michael Monreal)
+ - Add some new text for GetDistroUpgrades and the new group enums (Richard Hughes)
+
 Version 0.3.0
 ~~~~~~~~~~~~~~
 Released: 2008-08-18

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Aug 28 08:21:25 2008
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(gnome-packagekit, 0.3.1)
+AC_INIT(gnome-packagekit, 0.3.2)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)

Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in	(original)
+++ trunk/data/gnome-packagekit.schemas.in	Thu Aug 28 08:21:25 2008
@@ -134,6 +134,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/notify_distro_upgrades</key>
+      <applyto>/apps/gnome-packagekit/notify_distro_upgrades</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Notify the user when distribution upgrades are available</short>
+        <long>Notify the user when distribution upgrades are available</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/notify_critical</key>
       <applyto>/apps/gnome-packagekit/notify_critical</applyto>
       <owner>gnome-packagekit</owner>
@@ -182,6 +194,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/frequency_get_upgrades</key>
+      <applyto>/apps/gnome-packagekit/frequency_get_upgrades</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>string</type>
+      <default>weekly</default>
+      <locale name="C">
+        <short>How often we should check for distribution upgrades</short>
+        <long>How often we should check for distribution upgrades. Options are "daily", "weekly", "never"</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/frequency_refresh_cache</key>
       <applyto>/apps/gnome-packagekit/frequency_refresh_cache</applyto>
       <owner>gnome-packagekit</owner>

Modified: trunk/data/gpk-prefs.glade
==============================================================================
--- trunk/data/gpk-prefs.glade	(original)
+++ trunk/data/gpk-prefs.glade	Thu Aug 28 08:21:25 2008
@@ -42,33 +42,50 @@
                         <child>
                           <widget class="GtkTable" id="table1">
                             <property name="visible">True</property>
-                            <property name="n_rows">2</property>
+                            <property name="n_rows">3</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">20</property>
                             <property name="row_spacing">5</property>
                             <child>
-                              <widget class="GtkComboBox" id="combobox_check">
+                              <widget class="GtkComboBox" id="combobox_upgrade">
                                 <property name="visible">True</property>
                                 <property name="items"></property>
                               </widget>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
                                 <property name="x_options">GTK_FILL</property>
                                 <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkComboBox" id="combobox_install">
+                              <widget class="GtkLabel" id="label_upgrade">
                                 <property name="visible">True</property>
-                                <property name="items"></property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Check for major _upgrades:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">combobox_check</property>
                               </widget>
                               <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                                <property name="y_options">GTK_FILL</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label_check1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">C_heck for updates:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">combobox_check</property>
+                              </widget>
+                              <packing>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
                               </packing>
                             </child>
                             <child>
@@ -87,16 +104,28 @@
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkLabel" id="label_check">
+                              <widget class="GtkComboBox" id="combobox_install">
                                 <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">C_heck for updates:</property>
-                                <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">combobox_check</property>
+                                <property name="items"></property>
+                              </widget>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkComboBox" id="combobox_check">
+                                <property name="visible">True</property>
+                                <property name="items"></property>
                               </widget>
                               <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
                                 <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                           </widget>
@@ -132,7 +161,7 @@
                     <property name="top_padding">6</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <widget class="GtkVBox" id="vbox7">
+                      <widget class="GtkVBox" id="vbox2">
                         <property name="visible">True</property>
                         <property name="spacing">6</property>
                         <child>

Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c	(original)
+++ trunk/src/gpk-auto-refresh.c	Thu Aug 28 08:21:25 2008
@@ -85,6 +85,7 @@
 enum {
 	REFRESH_CACHE,
 	GET_UPDATES,
+	GET_UPGRADES,
 	LAST_SIGNAL
 };
 
@@ -112,6 +113,11 @@
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
 			      0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
 			      G_TYPE_NONE, 0);
+	signals [GET_UPGRADES] =
+		g_signal_new ("get-upgrades",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
 }
 
 /**
@@ -141,6 +147,19 @@
 }
 
 /**
+ * gpk_auto_refresh_signal_get_upgrades:
+ **/
+static gboolean
+gpk_auto_refresh_signal_get_upgrades (GpkAutoRefresh *arefresh)
+{
+	g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
+
+	pk_debug ("emitting get-upgrades");
+	g_signal_emit (arefresh, signals [GET_UPGRADES], 0);
+	return TRUE;
+}
+
+/**
  * gpk_auto_refresh_convert_frequency:
  *
  * Return value: The number of seconds for the frequency period,
@@ -204,6 +223,13 @@
 
 	g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
 
+	/* if we don't want to auto check for updates, don't do this either */
+	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;
+	}
+
 	/* not on battery */
 	if (arefresh->priv->on_battery) {
 		pk_debug ("not when on battery");
@@ -279,15 +305,50 @@
 }
 
 /**
- * gpk_auto_refresh_change_state:
+ * gpk_auto_refresh_maybe_get_upgrades:
  **/
 static gboolean
-gpk_auto_refresh_change_state (GpkAutoRefresh *arefresh)
+gpk_auto_refresh_maybe_get_upgrades (GpkAutoRefresh *arefresh)
 {
+	guint time;
 	guint thresh;
+	gboolean ret;
 
 	g_return_val_if_fail (GPK_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_UPGRADES);
+	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_DISTRO_UPGRADES, &time, NULL);
+	if (ret == FALSE) {
+		pk_debug ("failed to get last time");
+		return FALSE;
+	}
+
+	/* have we passed the timout? */
+	if (time < thresh) {
+		pk_debug ("not before timeout, thresh=%u, now=%u", thresh, time);
+		return FALSE;
+	}
+
+	gpk_auto_refresh_signal_get_upgrades (arefresh);
+	return TRUE;
+}
+
+/**
+ * gpk_auto_refresh_change_state:
+ **/
+static gboolean
+gpk_auto_refresh_change_state (GpkAutoRefresh *arefresh)
+{
+	g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
+
 	/* we shouldn't do this early in the session startup */
 	if (arefresh->priv->session_delay == FALSE) {
 		pk_debug ("not when this early in the session");
@@ -300,16 +361,10 @@
 		return FALSE;
 	}
 
-	/* have we been told to never check for updates? */
-	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;
-	}
-
 	/* we do this to get an icon at startup */
 	if (arefresh->priv->sent_get_updates == FALSE) {
 		gpk_auto_refresh_signal_get_updates (arefresh);
+		gpk_auto_refresh_maybe_get_upgrades (arefresh);
 		arefresh->priv->sent_get_updates = TRUE;
 		return TRUE;
 	}
@@ -317,6 +372,7 @@
 	/* try to do both */
 	gpk_auto_refresh_maybe_refresh_cache (arefresh);
 	gpk_auto_refresh_maybe_get_updates (arefresh);
+	gpk_auto_refresh_maybe_get_upgrades (arefresh);
 
 	return TRUE;
 }

Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c	(original)
+++ trunk/src/gpk-check-update.c	Thu Aug 28 08:21:25 2008
@@ -914,6 +914,79 @@
 	g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
 }
 
+#include <pk-distro-upgrade-obj.h>
+
+/**
+ * gpk_check_update_auto_get_upgrades_cb:
+ **/
+static void
+gpk_check_update_auto_get_upgrades_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
+{
+	GError *error = NULL;
+	const GPtrArray	*array;
+	gboolean ret;
+	guint i;
+	PkDistroUpgradeObj *obj;
+	const gchar *title;
+	NotifyNotification *notification;
+	GString *string = NULL;
+	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
+
+	/* get updates */
+	gpk_client_set_interaction (cupdate->priv->gclient, GPK_CLIENT_INTERACT_ALWAYS);
+	array = gpk_client_get_distro_upgrades (cupdate->priv->gclient, &error);
+	if (array == NULL) {
+		pk_warning ("failed to get upgrades: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
+	/* any updates? */
+	if (array->len == 0) {
+		pk_debug ("no upgrades");
+		goto out;
+	}
+
+	/* do we do the notification? */
+	ret = gconf_client_get_bool (cupdate->priv->gconf_client, GPK_CONF_NOTIFY_DISTRO_UPGRADES, NULL);
+	if (!ret) {
+		pk_debug ("ignoring due to GConf");
+		goto out;
+	}
+
+	/* find the upgrade string */
+	string = g_string_new ("");
+	for (i=0; i < array->len; i++) {
+		obj = (PkDistroUpgradeObj *) g_ptr_array_index (array, i);
+		g_string_append_printf (string, "%s (%s)\n", obj->name, pk_distro_upgrade_enum_to_text (obj->state));
+	}
+	if (string->len != 0) {
+		g_string_set_size (string, string->len-1);
+	}
+
+	/* do the bubble */
+	title = _("Distribution upgrades available");
+	notification = notify_notification_new (title, string->str, "help-browser", NULL);
+	if (notification == NULL) {
+		pk_warning ("failed to get bubble");
+		return;
+	}
+	notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
+	notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
+	notify_notification_add_action (notification, "upgrade-info",
+					_("More information"), gpk_check_update_libnotify_cb, cupdate, NULL);
+	notify_notification_add_action (notification, "do-not-show-upgrade-available",
+					_("Do not show this again"), gpk_check_update_libnotify_cb, cupdate, NULL);
+	ret = notify_notification_show (notification, &error);
+	if (!ret) {
+		pk_warning ("error: %s", error->message);
+		g_error_free (error);
+	}
+out:
+	if (string != NULL)
+		g_string_free (string, TRUE);
+}
+
 /**
  * gpk_check_update_init:
  * @cupdate: This class instance
@@ -935,6 +1008,8 @@
 			  G_CALLBACK (gpk_check_update_auto_refresh_cache_cb), cupdate);
 	g_signal_connect (cupdate->priv->arefresh, "get-updates",
 			  G_CALLBACK (gpk_check_update_auto_get_updates_cb), cupdate);
+	g_signal_connect (cupdate->priv->arefresh, "get-upgrades",
+			  G_CALLBACK (gpk_check_update_auto_get_upgrades_cb), cupdate);
 
 	/* right click actions are common */
 	status_icon = GTK_STATUS_ICON (cupdate->priv->sicon);

Modified: trunk/src/gpk-client-depends.c
==============================================================================
--- trunk/src/gpk-client-depends.c	(original)
+++ trunk/src/gpk-client-depends.c	Thu Aug 28 08:21:25 2008
@@ -101,7 +101,7 @@
 	}
 
 	/* find out if this would drag in other packages */
-	ret = pk_client_get_depends (client, PK_FILTER_ENUM_NOT_INSTALLED, package_ids, TRUE, &error);
+	ret = pk_client_get_depends (client, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED), package_ids, TRUE, &error);
 	if (!ret) {
 		window = gpk_client_get_window (gclient);
 		gpk_error_dialog_modal (window, _("Failed to get depends"),

Modified: trunk/src/gpk-client-requires.c
==============================================================================
--- trunk/src/gpk-client-requires.c	(original)
+++ trunk/src/gpk-client-requires.c	Thu Aug 28 08:21:25 2008
@@ -92,7 +92,7 @@
 	}
 
 	/* find out if this would force removal of other packages */
-	ret = pk_client_get_requires (client, PK_FILTER_ENUM_INSTALLED, package_ids, TRUE, &error);
+	ret = pk_client_get_requires (client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_ids, TRUE, &error);
 	if (!ret) {
 		window = gpk_client_get_window (gclient);
 		gpk_error_dialog_modal (window, _("Failed to get requires"),

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Thu Aug 28 08:21:25 2008
@@ -47,6 +47,7 @@
 #include <pk-common.h>
 #include <pk-control.h>
 #include <pk-catalog.h>
+#include <pk-distro-upgrade-obj.h>
 
 #include <gpk-client.h>
 #include <gpk-client-eula.h>
@@ -95,6 +96,7 @@
 	gchar			**files_array;
 	PkExitEnum		 exit;
 	GtkWindow		*parent_window;
+	GPtrArray		*upgrade_array;
 };
 
 typedef enum {
@@ -737,6 +739,19 @@
 }
 
 /**
+ * pk_client_distro_upgrade_cb:
+ **/
+static void
+pk_client_distro_upgrade_cb (PkClient *client, const PkDistroUpgradeObj *obj, GpkClient *gclient)
+{
+	g_return_if_fail (GPK_IS_CLIENT (gclient));
+
+	/* copy into array */
+	g_ptr_array_add (gclient->priv->upgrade_array, pk_distro_upgrade_obj_copy (obj));
+	pk_debug ("%s, %s, %s", obj->name, pk_update_state_enum_to_text (obj->state), obj->summary);
+}
+
+/**
  * gpk_client_files_cb:
  **/
 static void
@@ -2195,6 +2210,63 @@
 }
 
 /**
+ * gpk_client_get_distro_upgrades:
+ **/
+const GPtrArray *
+gpk_client_get_distro_upgrades (GpkClient *gclient, GError **error)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+
+	/* check if we are already waiting */
+	if (gclient->priv->gtk_main_waiting) {
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+		return FALSE;
+	}
+
+	/* are we not able to do this? */
+	if (!pk_bitfield_contain (gclient->priv->roles, PK_ROLE_ENUM_GET_DISTRO_UPGRADES)) {
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Backend does not support GetDistroUpgrades");
+		return FALSE;
+	}
+
+	/* reset */
+	ret = pk_client_reset (gclient->priv->client_action, &error_local);
+	if (!ret) {
+		gpk_client_error_msg (gclient, _("Failed to reset client"), _("Failed to reset get-upgrades"), error_local->message);
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+		g_error_free (error_local);
+		return FALSE;
+	}
+
+	/* set title */
+	gpk_client_setup_window (gclient, _("Getting distribution upgrade information"));
+
+	/* clear old data */
+	g_ptr_array_foreach (gclient->priv->upgrade_array, (GFunc) pk_distro_upgrade_obj_free, NULL);
+	g_ptr_array_remove_range (gclient->priv->upgrade_array, 0, gclient->priv->upgrade_array->len);
+
+	/* wrap update, but handle all the GPG and EULA stuff */
+	ret = pk_client_get_distro_upgrades (gclient->priv->client_action, &error_local);
+	if (!ret) {
+		gpk_client_error_msg (gclient, _("Getting update lists failed"),
+				      _("Getting the list of distribution upgrades failed"), error_local->message);
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+		goto out;
+	}
+
+	/* setup the UI */
+	gpk_client_set_progress_files (gclient, FALSE);
+	gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
+
+	gpk_client_main_wait (gclient);
+out:
+	return gclient->priv->upgrade_array;
+}
+
+/**
  * gpk_client_get_file_list:
  **/
 gchar **
@@ -2684,6 +2756,8 @@
 			  G_CALLBACK (gpk_client_eula_required_cb), gclient);
 	g_signal_connect (gclient->priv->client_action, "files",
 			  G_CALLBACK (gpk_client_files_cb), gclient);
+	g_signal_connect (gclient->priv->client_action, "distro-upgrade",
+			  G_CALLBACK (pk_client_distro_upgrade_cb), gclient);
 
 	gclient->priv->client_resolve = pk_client_new ();
 	g_signal_connect (gclient->priv->client_resolve, "status-changed",
@@ -2723,6 +2797,9 @@
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_client_button_help_cb), gclient);
 
+	/* cache the upgrade array */
+	gclient->priv->upgrade_array = g_ptr_array_new ();
+
 	/* set the label blank initially */
 	widget = glade_xml_get_widget (gclient->priv->glade_xml, "progress_part_label");
 	gtk_label_set_label (GTK_LABEL (widget), "");
@@ -2750,6 +2827,8 @@
 		g_source_remove (gclient->priv->pulse_timer_id);
 	}
 
+	g_ptr_array_foreach (gclient->priv->upgrade_array, (GFunc) pk_distro_upgrade_obj_free, NULL);
+	g_ptr_array_free (gclient->priv->upgrade_array, TRUE);
 	g_strfreev (gclient->priv->files_array);
 	g_object_unref (gclient->priv->client_action);
 	g_object_unref (gclient->priv->client_resolve);

Modified: trunk/src/gpk-client.h
==============================================================================
--- trunk/src/gpk-client.h	(original)
+++ trunk/src/gpk-client.h	Thu Aug 28 08:21:25 2008
@@ -115,6 +115,8 @@
 							 GpkClientInteract interact);
 PkPackageList	*gpk_client_get_updates			(GpkClient	*gclient,
 							 GError		**error);
+const GPtrArray	*gpk_client_get_distro_upgrades		(GpkClient	*gclient,
+							 GError		**error);
 gchar		**gpk_client_get_file_list		(GpkClient	*gclient,
 							 const gchar	*package_id,
 							 GError		**error);

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Thu Aug 28 08:21:25 2008
@@ -178,6 +178,7 @@
 	{PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS,	"dialog-information"},
 	{PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,"dialog-error"},
 	{PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,	"dialog-information"},
+	{PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED,	"dialog-information"},
 	{0, NULL}
 };
 
@@ -440,6 +441,9 @@
 	case PK_ERROR_ENUM_PACKAGE_CORRUPT:
 		text = _("Package is corrupt");
 		break;
+	case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
+		text = _("All packages are already installed");
+		break;
 	default:
 		pk_warning ("Unknown error");
 	}
@@ -597,6 +601,9 @@
 	case PK_ERROR_ENUM_PACKAGE_CORRUPT:
 		text = _("The package that was downloaded is corrupt and needs to be downloaded again.");
 		break;
+	case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
+		text = _("All of the packages selected for install are already installed on the system.");
+		break;
 	default:
 		pk_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
 			    "More information is available in the detailed report.");
@@ -720,6 +727,10 @@
 	case PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED:
 		text = _("Configuration files were changed");
 		break;
+	case PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED:
+		text = _("Package is already installed");
+		break;
+
 	default:
 		pk_warning ("message unrecognised: %i", message);
 	}
@@ -1036,7 +1047,7 @@
 		text = _("Setting repository data");
 		break;
 	case PK_ROLE_ENUM_RESOLVE:
-		text = _("Resolved");
+		text = _("Resolving");
 		break;
 	case PK_ROLE_ENUM_GET_FILES:
 		text = _("Getting file list");
@@ -1059,6 +1070,9 @@
 	case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
 		text = _("Downloading packages");
 		break;
+	case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
+		text = _("Getting distribution upgrade information");
+		break;
 	default:
 		pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
 	}
@@ -1162,6 +1176,9 @@
 	case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
 		text = _("Downloaded packages");
 		break;
+	case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
+		text = _("Got distribution upgrades");
+		break;
 	default:
 		pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
 	}
@@ -1260,15 +1277,15 @@
 	case PK_GROUP_ENUM_REPOS:
 		text = _("Software sources");
 		break;
-//	case PK_GROUP_ENUM_SCIENCE:
-//		text = _("Science");
-//		break;
-//	case PK_GROUP_ENUM_DOCUMENTATION:
-//		text = _("Documentation");
-//		break;
-//	case PK_GROUP_ENUM_ELECTRONICS:
-//		text = _("Electronics");
-//		break;
+	case PK_GROUP_ENUM_SCIENCE:
+		text = _("Science");
+		break;
+	case PK_GROUP_ENUM_DOCUMENTATION:
+		text = _("Documentation");
+		break;
+	case PK_GROUP_ENUM_ELECTRONICS:
+		text = _("Electronics");
+		break;
 	case PK_GROUP_ENUM_UNKNOWN:
 		text = _("Unknown group");
 		break;

Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h	(original)
+++ trunk/src/gpk-common.h	Thu Aug 28 08:21:25 2008
@@ -31,6 +31,7 @@
 
 #define GPK_CONF_NOTIFY_COMPLETED		"/apps/gnome-packagekit/notify_complete"
 #define GPK_CONF_NOTIFY_AVAILABLE		"/apps/gnome-packagekit/notify_available"
+#define GPK_CONF_NOTIFY_DISTRO_UPGRADES		"/apps/gnome-packagekit/notify_distro_upgrades"
 #define GPK_CONF_NOTIFY_CRITICAL		"/apps/gnome-packagekit/notify_critical"
 #define GPK_CONF_NOTIFY_ERROR			"/apps/gnome-packagekit/notify_errors"
 #define GPK_CONF_NOTIFY_MESSAGE			"/apps/gnome-packagekit/notify_message"
@@ -42,6 +43,7 @@
 #define GPK_CONF_AUTOCOMPLETE			"/apps/gnome-packagekit/autocomplete"
 #define GPK_CONF_SESSION_STARTUP_TIMEOUT	"/apps/gnome-packagekit/session_startup_timeout"
 #define GPK_CONF_FREQUENCY_GET_UPDATES		"/apps/gnome-packagekit/frequency_get_updates"
+#define GPK_CONF_FREQUENCY_GET_UPGRADES		"/apps/gnome-packagekit/frequency_get_upgrades"
 #define GPK_CONF_FREQUENCY_REFRESH_CACHE	"/apps/gnome-packagekit/frequency_refresh_cache"
 #define GPK_CONF_AUTO_UPDATE			"/apps/gnome-packagekit/auto_update"
 #define GPK_CONF_UPDATE_BATTERY			"/apps/gnome-packagekit/update_battery"

Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c	(original)
+++ trunk/src/gpk-prefs.c	Thu Aug 28 08:21:25 2008
@@ -83,10 +83,10 @@
 }
 
 /**
- * pk_prefs_freq_combo_changed:
+ * pk_prefs_update_freq_combo_changed:
  **/
 static void
-pk_prefs_freq_combo_changed (GtkWidget *widget, gpointer data)
+pk_prefs_update_freq_combo_changed (GtkWidget *widget, gpointer data)
 {
 	gchar *value;
 	const gchar *action;
@@ -115,6 +115,36 @@
 }
 
 /**
+ * pk_prefs_upgrade_freq_combo_changed:
+ **/
+static void
+pk_prefs_upgrade_freq_combo_changed (GtkWidget *widget, gpointer data)
+{
+	gchar *value;
+	const gchar *action;
+	PkFreqEnum freq = PK_FREQ_ENUM_UNKNOWN;
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
+	value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+	if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0) {
+		freq = PK_FREQ_ENUM_DAILY;
+	} else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0) {
+		freq = PK_FREQ_ENUM_WEEKLY;
+	} else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0) {
+		freq = PK_FREQ_ENUM_NEVER;
+	} else {
+		g_assert (FALSE);
+	}
+
+	action = pk_freq_enum_to_text (freq);
+	pk_debug ("Changing %s to %s", GPK_CONF_FREQUENCY_GET_UPGRADES, action);
+	gconf_client_set_string (client, GPK_CONF_FREQUENCY_GET_UPGRADES, action, NULL);
+	g_free (value);
+	g_object_unref (client);
+}
+
+/**
  * pk_prefs_update_combo_changed:
  **/
 static void
@@ -154,10 +184,10 @@
 }
 
 /**
- * pk_prefs_freq_combo_setup:
+ * pk_prefs_update_freq_combo_setup:
  **/
 static void
-pk_prefs_freq_combo_setup (void)
+pk_prefs_update_freq_combo_setup (void)
 {
 	gchar *value;
 	gboolean is_writable;
@@ -190,14 +220,53 @@
 
 	/* only do this after else we redraw the window */
 	g_signal_connect (G_OBJECT (widget), "changed",
-			  G_CALLBACK (pk_prefs_freq_combo_changed), NULL);
+			  G_CALLBACK (pk_prefs_update_freq_combo_changed), NULL);
 }
 
 /**
- * pk_prefs_update_combo_setup:
+ * pk_prefs_upgrade_freq_combo_setup:
  **/
 static void
-pk_prefs_update_combo_setup (void)
+pk_prefs_upgrade_freq_combo_setup (void)
+{
+	gchar *value;
+	gboolean is_writable;
+	GtkWidget *widget;
+	PkFreqEnum freq;
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
+	widget = glade_xml_get_widget (glade_xml, "combobox_upgrade");
+	is_writable = gconf_client_key_is_writable (client, GPK_CONF_FREQUENCY_GET_UPGRADES, NULL);
+	value = gconf_client_get_string (client, GPK_CONF_FREQUENCY_GET_UPGRADES, NULL);
+	if (value == NULL) {
+		pk_warning ("invalid schema, please re-install");
+		return;
+	}
+	pk_debug ("value from gconf %s", value);
+	freq = pk_freq_enum_from_text (value);
+	g_free (value);
+	g_object_unref (client);
+
+	/* do we have permission to write? */
+	gtk_widget_set_sensitive (widget, is_writable);
+
+	gtk_combo_box_append_text (GTK_COMBO_BOX (widget), PK_FREQ_DAILY_TEXT);
+	gtk_combo_box_append_text (GTK_COMBO_BOX (widget), PK_FREQ_WEEKLY_TEXT);
+	gtk_combo_box_append_text (GTK_COMBO_BOX (widget), PK_FREQ_NEVER_TEXT);
+	/* don't do daily */
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), freq - 1);
+
+	/* only do this after else we redraw the window */
+	g_signal_connect (G_OBJECT (widget), "changed",
+			  G_CALLBACK (pk_prefs_upgrade_freq_combo_changed), NULL);
+}
+
+/**
+ * pk_prefs_auto_update_combo_setup:
+ **/
+static void
+pk_prefs_auto_update_combo_setup (void)
 {
 	gchar *value;
 	gboolean is_writable;
@@ -352,8 +421,17 @@
 			  G_CALLBACK (pk_button_help_cb), NULL);
 
 	/* update the combo boxes */
-	pk_prefs_freq_combo_setup ();
-	pk_prefs_update_combo_setup ();
+	pk_prefs_update_freq_combo_setup ();
+	pk_prefs_upgrade_freq_combo_setup ();
+	pk_prefs_auto_update_combo_setup ();
+
+	/* hide if not supported */
+	if (!pk_bitfield_contain (roles, PK_ROLE_ENUM_GET_DISTRO_UPGRADES)) {
+		widget = glade_xml_get_widget (glade_xml, "label_upgrade");
+		gtk_widget_hide (widget);
+		widget = glade_xml_get_widget (glade_xml, "combobox_upgrade");
+		gtk_widget_hide (widget);
+	}
 
 	gtk_widget_show (main_window);
 



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