gnome-packagekit r128 - in trunk: data src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r128 - in trunk: data src
- Date: Tue, 25 Mar 2008 16:41:02 +0000 (GMT)
Author: rhughes
Date: Tue Mar 25 16:41:01 2008
New Revision: 128
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=128&view=rev
Log:
from git
Modified:
trunk/data/gnome-packagekit.schemas.in
trunk/data/pk-application.glade
trunk/data/pk-update-viewer.glade
trunk/src/pk-application.c
trunk/src/pk-common-gui.c
trunk/src/pk-common-gui.h
trunk/src/pk-install-file.c
trunk/src/pk-notify.c
trunk/src/pk-update-viewer.c
trunk/src/pk-watch.c
Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in (original)
+++ trunk/data/gnome-packagekit.schemas.in Tue Mar 25 16:41:01 2008
@@ -86,6 +86,18 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome-packagekit/notify_critical</key>
+ <applyto>/apps/gnome-packagekit/notify_critical</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Notify the user when security updates are available</short>
+ <long>Notify the user when security updates are available</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome-packagekit/autocomplete</key>
<applyto>/apps/gnome-packagekit/autocomplete</applyto>
<owner>gnome-packagekit</owner>
Modified: trunk/data/pk-application.glade
==============================================================================
--- trunk/data/pk-application.glade (original)
+++ trunk/data/pk-application.glade Tue Mar 25 16:41:01 2008
@@ -5,7 +5,6 @@
<widget class="GtkWindow" id="window_manager">
<property name="visible">True</property>
<property name="title" translatable="yes">Add/Remove Software</property>
- <property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="icon_name">gtk-info</property>
<child>
Modified: trunk/data/pk-update-viewer.glade
==============================================================================
--- trunk/data/pk-update-viewer.glade (original)
+++ trunk/data/pk-update-viewer.glade Tue Mar 25 16:41:01 2008
@@ -69,50 +69,40 @@
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <widget class="GtkLabel" id="label_last_update">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <widget class="GtkButton" id="button_history">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="label" translatable="yes">View History</property>
- <property name="response_id">0</property>
- </widget>
- </child>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Unknown....</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <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="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment_refresh">
+ <widget class="GtkLabel" id="label_last_refresh">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <placeholder/>
- </child>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Unknown....</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Last refresh:</property>
+ <property name="label" translatable="yes">Last update:</property>
</widget>
<packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
@@ -120,38 +110,48 @@
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Last update:</property>
+ <property name="label" translatable="yes">Last refresh:</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_last_refresh">
+ <widget class="GtkAlignment" id="alignment_refresh">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Unknown....</property>
+ <property name="xalign">1</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_last_update">
+ <widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Unknown....</property>
+ <property name="xalign">1</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkButton" id="button_history">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">View History</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
@@ -685,6 +685,51 @@
<placeholder/>
</child>
<child>
+ <widget class="GtkButton" id="button_overview2">
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="response_id">0</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-back</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Install more updates</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkButton" id="button_close4">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -694,7 +739,7 @@
<property name="response_id">0</property>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
Modified: trunk/src/pk-application.c
==============================================================================
--- trunk/src/pk-application.c (original)
+++ trunk/src/pk-application.c Tue Mar 25 16:41:01 2008
@@ -495,6 +495,11 @@
g_return_if_fail (application != NULL);
g_return_if_fail (PK_IS_APPLICATION (application));
+ /* obvious message, don't tell the user */
+ if (code == PK_ERROR_ENUM_TRANSACTION_CANCELLED) {
+ return;
+ }
+
pk_application_error_message (application,
pk_error_enum_to_localised_text (code), details);
}
@@ -1279,12 +1284,66 @@
return GTK_TREE_MODEL (store);
}
+
+/**
+ * * pk_application_about_dialog_url_cb:
+ * **/
+static void
+pk_application_about_dialog_url_cb (GtkAboutDialog *about, const char *address, gpointer data)
+{
+ GError *error = NULL;
+ gboolean ret;
+
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+ gchar *url;
+ gchar *protocol = (gchar*) data;
+
+ if (protocol != NULL)
+ url = g_strconcat (protocol, address, NULL);
+ else
+ url = g_strdup (address);
+
+ gscreen = gtk_window_get_screen (GTK_WINDOW (about));
+
+ cmdline = g_strconcat ("xdg-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret)
+ goto out;
+
+ g_error_free (error);
+ error = NULL;
+ cmdline = g_strconcat ("gnome-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == FALSE) {
+ error_dialog = gtk_message_dialog_new (GTK_WINDOW (about),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ _("Failed to show url"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
+ "%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
+ g_error_free (error);
+ }
+
+out:
+ g_free (url);
+}
+
/**
* pk_application_menu_about_cb:
**/
static void
pk_application_menu_about_cb (GtkAction *action, PkApplication *application)
{
+ static gboolean been_here = FALSE;
GtkWidget *main_window;
const char *authors[] = {
"Richard Hughes <richard hughsie com>",
@@ -1321,11 +1380,17 @@
license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n",
_(license[2]), "\n\n", _(license[3]), "\n", NULL);
+ if (!been_here) {
+ been_here = TRUE;
+ gtk_about_dialog_set_url_hook (pk_application_about_dialog_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (pk_application_about_dialog_url_cb, "mailto:", NULL);
+ }
+
/* use parent */
main_window = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
gtk_window_set_default_icon_name (PK_STOCK_APP_ICON);
- gtk_show_about_dialog (NULL,
+ gtk_show_about_dialog (GTK_WINDOW (main_window),
"version", PACKAGE_VERSION,
"copyright", "Copyright \xc2\xa9 2007-2008 Richard Hughes",
"license", license_trans,
@@ -1347,7 +1412,28 @@
static void
pk_application_menu_refresh_cb (GtkAction *action, PkApplication *application)
{
- pk_warning ("do a refresh-cache");
+ gboolean ret;
+ GError *error = NULL;
+
+ g_return_if_fail (application != NULL);
+ g_return_if_fail (PK_IS_APPLICATION (application));
+
+ /* can we cancel what we are doing? */
+ ret = pk_client_reset (application->priv->client_action, &error);
+ if (ret == FALSE) {
+ pk_application_error_message (application, _("Package list could not be refreshed"), error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* try to refresh the cache */
+ ret = pk_client_refresh_cache (application->priv->client_action, FALSE, &error);
+ if (ret == FALSE) {
+ pk_application_error_message (application, _("The package could not be installed"), error->message);
+ g_error_free (error);
+ return;
+ }
+ pk_debug ("should be refreshing...");
}
/**
@@ -1903,10 +1989,6 @@
widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
- /* FIXME: There's got to be a better way than this */
- gtk_widget_hide (GTK_WIDGET (widget));
- gtk_widget_show (GTK_WIDGET (widget));
-
/* use the in-statusbar for progress */
application->priv->statusbar = pk_statusbar_new ();
widget = glade_xml_get_widget (application->priv->glade_xml, "statusbar_status");
Modified: trunk/src/pk-common-gui.c
==============================================================================
--- trunk/src/pk-common-gui.c (original)
+++ trunk/src/pk-common-gui.c Tue Mar 25 16:41:01 2008
@@ -564,12 +564,6 @@
case PK_ERROR_ENUM_PROCESS_KILL:
text = _("The transaction was forcibly canceled");
break;
- case PK_ERROR_ENUM_FAILED_INITIALIZATION:
- text = _("Initialization of the package manager failed");
- break;
- case PK_ERROR_ENUM_FAILED_FINALISE:
- text = _("Unloading of the package manager failed");
- break;
case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
text = _("Reading the config file failed");
break;
@@ -659,14 +653,6 @@
text = _("The transaction was canceled successfully and no packages were changed.\n"
"The backend did not exit cleanly.");
break;
- case PK_ERROR_ENUM_FAILED_INITIALIZATION:
- text = _("The native package backend could not be initialised.\n"
- "Please make sure no other tools are accessing package information.");
- break;
- case PK_ERROR_ENUM_FAILED_FINALISE:
- text = _("The native package backend could not be closed.\n"
- "Please make sure no other tools are accessing package information.");
- break;
case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
text = _("The native package configuration file could not be opened.\n"
"Please make sure configuration is valid.");
Modified: trunk/src/pk-common-gui.h
==============================================================================
--- trunk/src/pk-common-gui.h (original)
+++ trunk/src/pk-common-gui.h Tue Mar 25 16:41:01 2008
@@ -32,6 +32,7 @@
#define PK_CONF_NOTIFY_COMPLETED "/apps/gnome-packagekit/notify_complete"
#define PK_CONF_NOTIFY_AVAILABLE "/apps/gnome-packagekit/notify_available"
+#define PK_CONF_NOTIFY_CRITICAL "/apps/gnome-packagekit/notify_critical"
#define PK_CONF_NOTIFY_ERROR "/apps/gnome-packagekit/notify_errors"
#define PK_CONF_NOTIFY_MESSAGE "/apps/gnome-packagekit/notify_message"
#define PK_CONF_NOTIFY_STARTED "/apps/gnome-packagekit/notify_started"
Modified: trunk/src/pk-install-file.c
==============================================================================
--- trunk/src/pk-install-file.c (original)
+++ trunk/src/pk-install-file.c Tue Mar 25 16:41:01 2008
@@ -63,6 +63,7 @@
gboolean verbose = FALSE;
gboolean program_version = FALSE;
gchar *tid;
+ GError *error;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -109,10 +110,18 @@
}
client = pk_client_new ();
- ret = pk_client_install_file (client, argv[1], NULL);
+ error = NULL;
+ ret = pk_client_install_file (client, argv[1], &error);
if (ret == FALSE) {
- pk_error_modal_dialog (_("Method not supported"),
- _("Installing local files is not supported"));
+ /* check if we got a permission denied */
+ if (g_str_has_prefix (error->message, "org.freedesktop.packagekit.localinstall")) {
+ pk_error_modal_dialog (_("Failed to install"),
+ _("You don't have the necessary privileges to install local packages"));
+ }
+ else {
+ pk_error_modal_dialog (_("Failed to install"),
+ error->message);
+ }
} else {
loop = g_main_loop_new (NULL, FALSE);
tid = pk_client_get_tid (client);
Modified: trunk/src/pk-notify.c
==============================================================================
--- trunk/src/pk-notify.c (original)
+++ trunk/src/pk-notify.c Tue Mar 25 16:41:01 2008
@@ -58,8 +58,6 @@
#define PK_NOTIFY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_NOTIFY, PkNotifyPrivate))
-#define PK_NOTIFY_ICON_STOCK "system-installer"
-
struct PkNotifyPrivate
{
PkSmartIcon *sicon;
@@ -156,8 +154,15 @@
g_free (cmdline);
if (ret == FALSE) {
- error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
+ error_dialog = gtk_message_dialog_new (GTK_WINDOW (about),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ _("Failed to show url"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
+ "%s", error->message);
gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
g_error_free (error);
}
@@ -178,8 +183,6 @@
const char *documenters[] = {
"Richard Hughes <richard hughsie com>",
NULL};
- const char *artists[] = {
- NULL};
const char *license[] = {
N_("Licensed under the GNU General Public License Version 2"),
N_("PackageKit is free software; you can redistribute it and/or\n"
@@ -213,7 +216,7 @@
gtk_about_dialog_set_email_hook (pk_notify_about_dialog_url_cb, "mailto:", NULL);
}
- gtk_window_set_default_icon_name ("system-installer");
+ gtk_window_set_default_icon_name ("system-software-installer");
gtk_show_about_dialog (NULL,
"version", VERSION,
"copyright", "Copyright \xc2\xa9 2007 Richard Hughes",
@@ -223,9 +226,8 @@
"comments", "PackageKit",
"authors", authors,
"documenters", documenters,
- "artists", artists,
"translator-credits", translators,
- "logo-icon-name", "system-installer",
+ "logo-icon-name", "system-software-installer",
NULL);
g_free (license_trans);
}
@@ -305,6 +307,7 @@
GString *message_text;
guint skipped_number = 0;
const gchar *message;
+ gboolean value;
g_return_if_fail (notify != NULL);
g_return_if_fail (PK_IS_NOTIFY (notify));
@@ -324,6 +327,13 @@
return;
}
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_MESSAGE, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
message_text = g_string_new ("");
/* find any we skipped */
@@ -495,10 +505,18 @@
{
const gchar *title;
gchar *message;
+ gboolean value;
g_return_if_fail (notify != NULL);
g_return_if_fail (PK_IS_NOTIFY (notify));
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_CRITICAL, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
title = ngettext ("Security update available", "Security updates available", number);
message = g_strdup_printf (ngettext ("The following important update is available for your computer:\n\n%s",
"The following important updates are available for your computer:\n\n%s", number), details);
@@ -507,7 +525,7 @@
pk_smart_icon_notify_new (notify->priv->sicon, title, message, "software-update-urgent",
PK_NOTIFY_URGENCY_CRITICAL, PK_NOTIFY_TIMEOUT_NEVER);
pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_UPDATE_COMPUTER, NULL);
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN, NULL);
+ pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN, PK_CONF_NOTIFY_CRITICAL);
pk_smart_icon_notify_show (notify->priv->sicon);
g_free (message);
@@ -519,9 +537,18 @@
static void
pk_notify_auto_update_message (PkNotify *notify)
{
+ gboolean value;
+
g_return_if_fail (notify != NULL);
g_return_if_fail (PK_IS_NOTIFY (notify));
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_MESSAGE, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
pk_smart_icon_notify_new (notify->priv->sicon,
_("Updates are being installed"),
_("Updates are being automatically installed on your computer"), "software-update-urgent",
@@ -611,6 +638,7 @@
{
gboolean on_battery;
gboolean conf_update_battery;
+ gboolean value;
g_return_val_if_fail (notify != NULL, FALSE);
g_return_val_if_fail (PK_IS_NOTIFY (notify), FALSE);
@@ -618,14 +646,18 @@
on_battery = pk_auto_refresh_get_on_battery (notify->priv->arefresh);
conf_update_battery = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_UPDATE_BATTERY, NULL);
if (!conf_update_battery && on_battery) {
- pk_smart_icon_notify_new (notify->priv->sicon,
- _("Will not install updates"),
- _("Automatic updates are not being installed as the computer is on battery power"),
- "dialog-information", PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
- pk_smart_icon_notify_button (notify->priv->sicon,
- PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN,
- PK_CONF_NOTIFY_BATTERY_UPDATE);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_BATTERY_UPDATE, NULL);
+ if (value) {
+ pk_smart_icon_notify_new (notify->priv->sicon,
+ _("Will not install updates"),
+ _("Automatic updates are not being installed as the computer is on battery power"),
+ "dialog-information", PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
+ pk_smart_icon_notify_button (notify->priv->sicon,
+ PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN,
+ PK_CONF_NOTIFY_BATTERY_UPDATE);
+ pk_smart_icon_notify_show (notify->priv->sicon);
+ }
return FALSE;
}
return TRUE;
@@ -792,6 +824,7 @@
pk_notify_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, PkNotify *notify)
{
const gchar *title;
+ gboolean value;
g_return_if_fail (notify != NULL);
g_return_if_fail (PK_IS_NOTIFY (notify));
@@ -805,6 +838,13 @@
return;
}
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_ERROR, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
pk_smart_icon_notify_new (notify->priv->sicon, title, details, "help-browser",
PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
Modified: trunk/src/pk-update-viewer.c
==============================================================================
--- trunk/src/pk-update-viewer.c (original)
+++ trunk/src/pk-update-viewer.c Tue Mar 25 16:41:01 2008
@@ -144,12 +144,30 @@
}
}
+static void
+pk_updates_update_system_cb (PolKitGnomeAction *action, gpointer data)
+{
+ GtkWidget *widget;
+
+ pk_debug ("Doing the system update");
+
+ widget = glade_xml_get_widget (glade_xml, "button_overview2");
+ gtk_widget_hide (widget);
+
+ /* set correct view */
+ pk_updates_set_page (PAGE_PROGRESS);
+
+ pk_client_reset (client, NULL);
+ pk_client_update_system (client, NULL);
+}
+
/**
* pk_updates_apply_cb:
**/
static void
-pk_updates_apply_cb (GtkWidget *widget, gpointer data)
+pk_updates_apply_cb (PolKitGnomeAction *action, gpointer data)
{
+ GtkWidget *widget;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid;
@@ -158,8 +176,11 @@
gboolean selected_any = FALSE;
gchar *package_id;
GPtrArray *array;
+ gchar **package_ids;
+ gboolean ret;
+ GError *error = NULL;
- pk_debug ("Doing the system update");
+ pk_debug ("Doing the package updates");
array = g_ptr_array_new ();
widget = glade_xml_get_widget (glade_xml, "treeview_updates");
@@ -196,33 +217,28 @@
return;
}
+ widget = glade_xml_get_widget (glade_xml, "button_overview2");
+ if (selected_all) {
+ gtk_widget_hide (widget);
+ }
+ else {
+ gtk_widget_show (widget);
+ }
+
/* set correct view */
pk_updates_set_page (PAGE_PROGRESS);
- /* send an singular list */
- if (!selected_all) {
- gchar **package_ids;
- gboolean ret;
- GError *error = NULL;
-
- package_ids = pk_package_ids_from_array (array);
- pk_client_reset (client, NULL);
- ret = pk_client_update_packages_strv (client, package_ids, &error);
- if (!ret) {
- pk_error_modal_dialog ("Individual updates failed", error->message);
- g_error_free (error);
- }
- g_strfreev (package_ids);
+ package_ids = pk_package_ids_from_array (array);
+ pk_client_reset (client, NULL);
+ ret = pk_client_update_packages_strv (client, package_ids, &error);
+ if (!ret) {
+ pk_error_modal_dialog ("Individual updates failed", error->message);
+ g_error_free (error);
}
+ g_strfreev (package_ids);
/* get rid of the array, and free the contents */
g_ptr_array_free (array, TRUE);
-
- /* the trivial case */
- if (selected_all) {
- pk_client_reset (client, NULL);
- pk_client_update_system (client, NULL);
- }
}
/**
@@ -1046,6 +1062,8 @@
pk_restart_system ();
}
+static void populate_preview (void);
+
/**
* pk_updates_finished_cb:
**/
@@ -1054,7 +1072,6 @@
{
GtkWidget *widget;
PkRoleEnum role;
- guint length;
PkRestartEnum restart;
pk_client_get_role (client, &role, NULL, NULL);
@@ -1109,16 +1126,39 @@
/* we don't need to do anything here */
if (role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
- /* clear existing list */
- gtk_list_store_clear (list_store_details);
- /* get the new update list */
- pk_client_reset (client, NULL);
- pk_client_set_use_buffer (client, TRUE, NULL);
- pk_client_get_updates (client, "basename", NULL);
+ /* set correct view */
+ pk_updates_set_page (PAGE_CONFIRM);
+
return;
}
+ populate_preview ();
+}
+
+static void
+pk_button_more_installs_cb (GtkWidget *button, gpointer data)
+{
+ /* clear existing list */
+ gtk_list_store_clear (list_store_details);
+
+ /* set correct view */
+ pk_updates_set_page (PAGE_PREVIEW);
+
+ /* get the new update list */
+ pk_client_reset (client, NULL);
+ pk_client_set_use_buffer (client, TRUE, NULL);
+ pk_client_get_updates (client, "basename", NULL);
+
+ populate_preview ();
+}
+
+static void
+populate_preview (void)
+{
+ GtkWidget *widget;
+ guint length;
+
/* clear existing lists */
gtk_list_store_clear (list_store_preview);
@@ -1475,6 +1515,11 @@
G_CALLBACK (pk_button_overview_cb), loop);
gtk_widget_set_tooltip_text(widget, _("Back to overview"));
+ widget = glade_xml_get_widget (glade_xml, "button_overview2");
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (pk_button_more_installs_cb), loop);
+ gtk_widget_set_tooltip_text (widget, _("Back to overview"));
+
pk_action = polkit_action_new ();
polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.update-package");
update_package_action = polkit_gnome_action_new_default ("update-package",
@@ -1509,7 +1554,7 @@
NULL);
polkit_action_unref (pk_action);
g_signal_connect (update_system_action, "activate",
- G_CALLBACK (pk_updates_apply_cb), loop);
+ G_CALLBACK (pk_updates_update_system_cb), loop);
button = polkit_gnome_action_create_button (update_system_action);
widget = glade_xml_get_widget (glade_xml, "buttonbox_overview");
gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
Modified: trunk/src/pk-watch.c
==============================================================================
--- trunk/src/pk-watch.c (original)
+++ trunk/src/pk-watch.c Tue Mar 25 16:41:01 2008
@@ -266,14 +266,26 @@
g_return_if_fail (watch != NULL);
g_return_if_fail (PK_IS_WATCH (watch));
+ /* get the role */
+ ret = pk_client_get_role (client, &role, &package_id, NULL);
+ if (ret == FALSE) {
+ pk_warning ("cannot get role");
+ return;
+ }
+ pk_debug ("role=%s, package=%s", pk_role_enum_to_text (role), package_id);
+
/* show an icon if the user needs to reboot */
- restart = pk_client_get_require_restart (client);
- if (restart == PK_RESTART_ENUM_SYSTEM ||
- restart == PK_RESTART_ENUM_SESSION) {
- restart_message = pk_restart_enum_to_localised_text (restart);
- icon_name = pk_restart_enum_to_icon_name (restart);
- pk_smart_icon_set_tooltip (watch->priv->sicon_restart, restart_message);
- pk_smart_icon_set_icon_name (watch->priv->sicon_restart, icon_name);
+ if (role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
+ role == PK_ROLE_ENUM_INSTALL_PACKAGE ||
+ role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
+ restart = pk_client_get_require_restart (client);
+ if (restart == PK_RESTART_ENUM_SYSTEM ||
+ restart == PK_RESTART_ENUM_SESSION) {
+ restart_message = pk_restart_enum_to_localised_text (restart);
+ icon_name = pk_restart_enum_to_icon_name (restart);
+ pk_smart_icon_set_tooltip (watch->priv->sicon_restart, restart_message);
+ pk_smart_icon_set_icon_name (watch->priv->sicon_restart, icon_name);
+ }
}
/* is it worth showing a UI? */
@@ -288,14 +300,6 @@
return;
}
- /* get the role */
- ret = pk_client_get_role (client, &role, &package_id, NULL);
- if (ret == FALSE) {
- pk_warning ("cannot get role");
- return;
- }
- pk_debug ("role=%s, package=%s", pk_role_enum_to_text (role), package_id);
-
/* are we accepting notifications */
value = gconf_client_get_bool (watch->priv->gconf_client, PK_CONF_NOTIFY_COMPLETED, NULL);
if (value == FALSE) {
@@ -338,6 +342,7 @@
gchar *escaped_details;
const gchar *title;
gboolean is_active;
+ gboolean value;
g_return_if_fail (watch != NULL);
g_return_if_fail (PK_IS_WATCH (watch));
@@ -362,6 +367,13 @@
return;
}
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (watch->priv->gconf_client, PK_CONF_NOTIFY_ERROR, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
/* we need to format this */
escaped_details = g_markup_escape_text (details, -1);
@@ -381,10 +393,18 @@
const gchar *title;
const gchar *filename;
gchar *escaped_details;
+ gboolean value;
g_return_if_fail (watch != NULL);
g_return_if_fail (PK_IS_WATCH (watch));
+ /* are we accepting notifications */
+ value = gconf_client_get_bool (watch->priv->gconf_client, PK_CONF_NOTIFY_MESSAGE, NULL);
+ if (value == FALSE) {
+ pk_debug ("not showing notification as prevented in gconf");
+ return;
+ }
+
title = pk_message_enum_to_localised_text (message);
filename = pk_message_enum_to_icon_name (message);
@@ -436,6 +456,7 @@
if (ret == FALSE) {
error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
g_error_free (error);
}
@@ -456,8 +477,6 @@
const char *documenters[] = {
"Richard Hughes <richard hughsie com>",
NULL};
- const char *artists[] = {
- NULL};
const char *license[] = {
N_("Licensed under the GNU General Public License Version 2"),
N_("PackageKit is free software; you can redistribute it and/or\n"
@@ -491,7 +510,7 @@
gtk_about_dialog_set_email_hook (pk_watch_about_dialog_url_cb, "mailto:", NULL);
}
- gtk_window_set_default_icon_name ("system-installer");
+ gtk_window_set_default_icon_name ("system-software-installer");
gtk_show_about_dialog (NULL,
"version", VERSION,
"copyright", "Copyright \xc2\xa9 2007 Richard Hughes",
@@ -501,9 +520,8 @@
"comments", "PackageKit",
"authors", authors,
"documenters", documenters,
- "artists", artists,
"translator-credits", translators,
- "logo-icon-name", "system-installer",
+ "logo-icon-name", "system-software-installer",
NULL);
g_free (license_trans);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]