gnome-packagekit r154 - in trunk: data/icons/16x16/status data/icons/22x22/status data/icons/24x24/status data/icons/48x48/status src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r154 - in trunk: data/icons/16x16/status data/icons/22x22/status data/icons/24x24/status data/icons/48x48/status src
- Date: Wed, 9 Apr 2008 01:31:44 +0100 (BST)
Author: rhughes
Date: Wed Apr 9 01:31:44 2008
New Revision: 154
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=154&view=rev
Log:
from git
Modified:
trunk/data/icons/16x16/status/pk-package-available.png
trunk/data/icons/16x16/status/pk-package-installed.png
trunk/data/icons/22x22/status/pk-package-available.png
trunk/data/icons/22x22/status/pk-package-installed.png
trunk/data/icons/24x24/status/pk-package-available.png
trunk/data/icons/24x24/status/pk-package-installed.png
trunk/data/icons/48x48/status/pk-package-available.png
trunk/data/icons/48x48/status/pk-package-installed.png
trunk/src/gpk-application.c
trunk/src/gpk-auto-refresh.c
trunk/src/gpk-backend-status.c
trunk/src/gpk-common.c
trunk/src/gpk-log.c
trunk/src/gpk-notify.c
trunk/src/gpk-prefs.c
trunk/src/gpk-progress.c
trunk/src/gpk-repo.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-watch.c
Modified: trunk/data/icons/16x16/status/pk-package-available.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/16x16/status/pk-package-installed.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/22x22/status/pk-package-available.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/22x22/status/pk-package-installed.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/24x24/status/pk-package-available.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/24x24/status/pk-package-installed.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/48x48/status/pk-package-available.png
==============================================================================
Binary files. No diff available.
Modified: trunk/data/icons/48x48/status/pk-package-installed.png
==============================================================================
Binary files. No diff available.
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Wed Apr 9 01:31:44 2008
@@ -35,6 +35,7 @@
#include <pk-debug.h>
#include <pk-client.h>
+#include <pk-control.h>
#include <pk-common.h>
#include <pk-connection.h>
#include <pk-package-id.h>
@@ -73,6 +74,7 @@
GConfClient *gconf_client;
GtkListStore *packages_store;
GtkListStore *groups_store;
+ PkControl *control;
PkClient *client_search;
PkClient *client_action;
PkClient *client_description;
@@ -1948,6 +1950,8 @@
/* use a sexy widget */
glade_set_custom_handler (gpk_application_create_custom_widget, application);
+ application->priv->control = pk_control_new ();
+
application->priv->client_search = pk_client_new ();
g_signal_connect (application->priv->client_search, "package",
G_CALLBACK (gpk_application_package_cb), application);
@@ -2006,15 +2010,15 @@
G_CALLBACK (gpk_application_allow_cancel_cb), application);
/* get actions */
- application->priv->role_list = pk_client_get_actions (application->priv->client_action);
+ application->priv->role_list = pk_control_get_actions (application->priv->control);
pk_debug ("actions=%s", pk_enum_list_to_string (application->priv->role_list));
/* get filters supported */
- application->priv->filter_list = pk_client_get_filters (application->priv->client_action);
+ application->priv->filter_list = pk_control_get_filters (application->priv->control);
pk_debug ("filter=%s", pk_enum_list_to_string (application->priv->filter_list));
/* get groups supported */
- application->priv->group_list = pk_client_get_groups (application->priv->client_action);
+ application->priv->group_list = pk_control_get_groups (application->priv->control);
pk_debug ("groups=%s", pk_enum_list_to_string (application->priv->group_list));
application->priv->pconnection = pk_connection_new ();
@@ -2414,6 +2418,7 @@
g_object_unref (application->priv->glade_xml);
g_object_unref (application->priv->packages_store);
+ g_object_unref (application->priv->control);
g_object_unref (application->priv->client_search);
g_object_unref (application->priv->client_action);
g_object_unref (application->priv->client_description);
Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c (original)
+++ trunk/src/gpk-auto-refresh.c Wed Apr 9 01:31:44 2008
@@ -38,7 +38,7 @@
#include <gconf/gconf-client.h>
#include <pk-debug.h>
-#include <pk-client.h>
+#include <pk-control.h>
#include <pk-network.h>
#include "gpk-common.h"
#include "gpk-auto-refresh.h"
@@ -70,7 +70,7 @@
DBusGProxy *proxy_gs;
DBusGProxy *proxy_gpm;
DBusGConnection *connection;
- PkClient *client;
+ PkControl *control;
PkNetwork *network;
};
@@ -208,7 +208,8 @@
}
/* get the time since the last refresh */
- ret = pk_client_get_time_since_action (arefresh->priv->client, PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
+ ret = pk_control_get_time_since_action (arefresh->priv->control,
+ PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
if (ret == FALSE) {
pk_warning ("failed to get last time");
return FALSE;
@@ -240,7 +241,8 @@
g_return_val_if_fail (PK_IS_AUTO_REFRESH (arefresh), FALSE);
/* get the time since the last refresh */
- ret = pk_client_get_time_since_action (arefresh->priv->client, PK_ROLE_ENUM_GET_UPDATES, &time, NULL);
+ ret = pk_control_get_time_since_action (arefresh->priv->control,
+ PK_ROLE_ENUM_GET_UPDATES, &time, NULL);
if (ret == FALSE) {
pk_warning ("failed to get last time");
return FALSE;
@@ -497,7 +499,7 @@
arefresh->priv->gconf_client = gconf_client_get_default ();
/* we need to query the last cache refresh time */
- arefresh->priv->client = pk_client_new ();
+ arefresh->priv->control = pk_control_new ();
/* connect to session bus */
arefresh->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
@@ -550,7 +552,7 @@
arefresh = GPK_AUTO_REFRESH (object);
g_return_if_fail (arefresh->priv != NULL);
- g_object_unref (arefresh->priv->client);
+ g_object_unref (arefresh->priv->control);
g_object_unref (arefresh->priv->network);
g_object_unref (arefresh->priv->gbus_gs);
g_object_unref (arefresh->priv->gbus_gpm);
Modified: trunk/src/gpk-backend-status.c
==============================================================================
--- trunk/src/gpk-backend-status.c (original)
+++ trunk/src/gpk-backend-status.c Wed Apr 9 01:31:44 2008
@@ -31,7 +31,7 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <pk-enum-list.h>
-#include <pk-client.h>
+#include <pk-control.h>
#include <locale.h>
#include <pk-debug.h>
@@ -74,7 +74,7 @@
gchar *author;
PkEnumList *role_list;
PkEnumList *filter_list;
- PkClient *client;
+ PkControl *control;
gboolean retval;
const GOptionEntry options[] = {
@@ -113,12 +113,12 @@
loop = g_main_loop_new (NULL, FALSE);
- client = pk_client_new ();
- role_list = pk_client_get_actions (client);
- filter_list = pk_client_get_filters (client);
+ control = pk_control_new ();
+ role_list = pk_control_get_actions (control);
+ filter_list = pk_control_get_filters (control);
/* general stuff */
- retval = pk_client_get_backend_detail (client, &name, &author, NULL);
+ retval = pk_control_get_backend_detail (control, &name, &author, NULL);
if (FALSE == retval) {
pk_warning (_("Exiting as backend details could not be retrieved"));
return 1;
@@ -265,7 +265,7 @@
}
g_object_unref (glade_xml);
- g_object_unref (client);
+ g_object_unref (control);
g_object_unref (role_list);
g_object_unref (filter_list);
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Wed Apr 9 01:31:44 2008
@@ -105,6 +105,7 @@
{PK_ROLE_ENUM_GET_REPO_LIST, "emblem-system"},
{PK_ROLE_ENUM_REPO_ENABLE, "emblem-system"},
{PK_ROLE_ENUM_REPO_SET_DATA, "emblem-system"},
+ {PK_ROLE_ENUM_INSTALL_SIGNATURE, "emblem-system"},
{0, NULL}
};
@@ -1059,7 +1060,7 @@
text = _("Refreshing package cache");
break;
case PK_ROLE_ENUM_UPDATE_PACKAGES:
- text = _("Updating package");
+ text = _("Updating packages");
break;
case PK_ROLE_ENUM_UPDATE_SYSTEM:
text = _("Updating system");
@@ -1083,14 +1084,17 @@
text = _("Resolved");
break;
case PK_ROLE_ENUM_GET_FILES:
- text = _("Got file list");
+ text = _("Getting file list");
break;
case PK_ROLE_ENUM_WHAT_PROVIDES:
- text = _("Got what provides");
+ text = _("Getting what provides");
break;
case PK_ROLE_ENUM_SERVICE_PACK:
text = _("Service pack");
break;
+ case PK_ROLE_ENUM_INSTALL_SIGNATURE:
+ text = _("Installing signature");
+ break;
default:
pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
}
@@ -1182,6 +1186,9 @@
case PK_ROLE_ENUM_WHAT_PROVIDES:
text = _("Got what provides");
break;
+ case PK_ROLE_ENUM_INSTALL_SIGNATURE:
+ text = _("Installed signature");
+ break;
default:
pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
}
@@ -1428,7 +1435,7 @@
guint i;
const gchar *string;
- if (libst_start (test, "PkCommonGui", CLASS_AUTO) == FALSE) {
+ if (libst_start (test, "GpkCommon", CLASS_AUTO) == FALSE) {
return;
}
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Wed Apr 9 01:31:44 2008
@@ -35,6 +35,7 @@
#include <pk-debug.h>
#include <pk-client.h>
+#include <pk-control.h>
#include <pk-connection.h>
#include <pk-package-id.h>
#include <pk-enum-list.h>
@@ -366,6 +367,7 @@
PkEnumList *role_list;
PolKitAction *pk_action;
GtkWidget *button;
+ PkControl *control;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -412,7 +414,9 @@
G_CALLBACK (pk_transaction_cb), NULL);
/* get actions */
- role_list = pk_client_get_actions (client);
+ control = pk_control_new ();
+ role_list = pk_control_get_actions (control);
+ g_object_unref (control);
/* save the description in a hash */
hash = g_hash_table_new (g_str_hash, g_str_equal);
Modified: trunk/src/gpk-notify.c
==============================================================================
--- trunk/src/gpk-notify.c (original)
+++ trunk/src/gpk-notify.c Wed Apr 9 01:31:44 2008
@@ -38,9 +38,8 @@
#include <gconf/gconf-client.h>
#include <pk-debug.h>
-#include <pk-job-list.h>
#include <pk-client.h>
-#include <pk-notify.h>
+#include <pk-control.h>
#include <pk-common.h>
#include <pk-task-list.h>
#include <pk-connection.h>
@@ -66,7 +65,7 @@
PkClient *client_update_system;
PkTaskList *tlist;
GpkAutoRefresh *arefresh;
- PkNotify *notify;
+ PkControl *control;
GConfClient *gconf_client;
gboolean cache_okay;
gboolean cache_update_in_progress;
@@ -1114,10 +1113,10 @@
g_signal_connect (notify->priv->client_update_system, "error-code",
G_CALLBACK (gpk_notify_error_code_cb), notify);
- notify->priv->notify = pk_notify_new ();
- g_signal_connect (notify->priv->notify, "updates-changed",
+ notify->priv->control = pk_control_new ();
+ g_signal_connect (notify->priv->control, "updates-changed",
G_CALLBACK (gpk_notify_updates_changed_cb), notify);
- g_signal_connect (notify->priv->notify, "restart-schedule",
+ g_signal_connect (notify->priv->control, "restart-schedule",
G_CALLBACK (gpk_notify_restart_schedule_cb), notify);
/* we need the task list so we can hide the update icon when we are doing the update */
@@ -1151,7 +1150,7 @@
g_object_unref (notify->priv->tlist);
g_object_unref (notify->priv->arefresh);
g_object_unref (notify->priv->gconf_client);
- g_object_unref (notify->priv->notify);
+ g_object_unref (notify->priv->control);
G_OBJECT_CLASS (gpk_notify_parent_class)->finalize (object);
}
Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c (original)
+++ trunk/src/gpk-prefs.c Wed Apr 9 01:31:44 2008
@@ -33,6 +33,7 @@
#include <gconf/gconf-client.h>
#include <pk-debug.h>
+#include <pk-control.h>
#include <pk-client.h>
#include <pk-enum-list.h>
#include "gpk-common.h"
@@ -290,6 +291,7 @@
GtkWidget *widget;
PkEnumList *role_list;
PkClient *client;
+ PkControl *control;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -330,7 +332,9 @@
client = pk_client_new ();
/* get actions */
- role_list = pk_client_get_actions (client);
+ control = pk_control_new ();
+ role_list = pk_control_get_actions (control);
+ g_object_unref (control);
glade_xml = glade_xml_new (PK_DATA "/gpk-prefs.glade", NULL, NULL);
main_window = glade_xml_get_widget (glade_xml, "window_prefs");
Modified: trunk/src/gpk-progress.c
==============================================================================
--- trunk/src/gpk-progress.c (original)
+++ trunk/src/gpk-progress.c Wed Apr 9 01:31:44 2008
@@ -31,9 +31,11 @@
#include <pk-debug.h>
#include <pk-client.h>
+#include <pk-control.h>
#include <pk-connection.h>
#include <pk-package-id.h>
#include <pk-common.h>
+#include <pk-enum-list.h>
#include "gpk-common.h"
#include "gpk-progress.h"
@@ -512,10 +514,16 @@
guint subpercentage;
guint elapsed;
guint remaining;
+ GError *error = NULL;
g_return_val_if_fail (PK_IS_PROGRESS (progress), FALSE);
- pk_client_set_tid (progress->priv->client, tid, NULL);
+ ret = pk_client_set_tid (progress->priv->client, tid, &error);
+ if (!ret) {
+ pk_warning ("could not set tid: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
/* fill in role */
text = pk_common_get_role_text (progress->priv->client);
@@ -570,6 +578,7 @@
GtkWidget *main_window;
GtkWidget *widget;
PkEnumList *role_list;
+ PkControl *control;
progress->priv = GPK_PROGRESS_GET_PRIVATE (progress);
progress->priv->task_ended = FALSE;
@@ -624,7 +633,9 @@
G_CALLBACK (gpk_progress_cancel_cb), progress);
/* get actions */
- role_list = pk_client_get_actions (progress->priv->client);
+ control = pk_control_new ();
+ role_list = pk_control_get_actions (control);
+ g_object_unref (control);
/* can we ever do the action? */
if (pk_enum_list_contains (role_list, PK_ROLE_ENUM_CANCEL) == FALSE) {
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Wed Apr 9 01:31:44 2008
@@ -33,7 +33,7 @@
#include <pk-debug.h>
#include <pk-client.h>
-#include <pk-notify.h>
+#include <pk-control.h>
#include <pk-connection.h>
#include <pk-enum-list.h>
#include "gpk-common.h"
@@ -240,7 +240,7 @@
* pk_repo_repo_list_changed_cb:
**/
static void
-pk_repo_repo_list_changed_cb (PkNotify *notify, gpointer data)
+pk_repo_repo_list_changed_cb (PkControl *control, gpointer data)
{
gboolean ret;
GError *error = NULL;
@@ -276,7 +276,7 @@
GtkWidget *widget;
GtkTreeSelection *selection;
GError *error = NULL;
- PkNotify *notify;
+ PkControl *control;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -324,12 +324,10 @@
g_signal_connect (client, "error-code",
G_CALLBACK (pk_repo_error_code_cb), NULL);
- notify = pk_notify_new ();
- g_signal_connect (notify, "repo-list-changed",
+ control = pk_control_new ();
+ g_signal_connect (control, "repo-list-changed",
G_CALLBACK (pk_repo_repo_list_changed_cb), NULL);
-
- /* get actions */
- role_list = pk_client_get_actions (client);
+ role_list = pk_control_get_actions (control);
glade_xml = glade_xml_new (PK_DATA "/gpk-repo.glade", NULL, NULL);
main_window = glade_xml_get_widget (glade_xml, "window_repo");
@@ -390,7 +388,7 @@
g_object_unref (glade_xml);
g_object_unref (list_store);
g_object_unref (client);
- g_object_unref (notify);
+ g_object_unref (control);
g_object_unref (role_list);
g_object_unref (statusbar);
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Wed Apr 9 01:31:44 2008
@@ -36,7 +36,7 @@
#include <pk-debug.h>
#include <pk-client.h>
-#include <pk-notify.h>
+#include <pk-control.h>
#include <pk-common.h>
#include <pk-task-list.h>
#include <pk-connection.h>
@@ -53,6 +53,7 @@
static GtkListStore *list_store_description = NULL;
static PkClient *client_action = NULL;
static PkClient *client_query = NULL;
+static PkControl *control = NULL;
static PkTaskList *tlist = NULL;
static gchar *cached_package_id = NULL;
@@ -1134,14 +1135,14 @@
* pk_update_update_last_refreshed_time:
**/
static gboolean
-pk_update_update_last_refreshed_time (PkClient *client)
+pk_update_update_last_refreshed_time (void)
{
GtkWidget *widget;
guint time;
const gchar *time_text;
/* get times from the daemon */
- pk_client_get_time_since_action (client, PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
+ pk_control_get_time_since_action (control, PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
time_text = pk_update_get_approx_time (time);
widget = glade_xml_get_widget (glade_xml, "label_last_refresh");
gtk_label_set_label (GTK_LABEL (widget), time_text);
@@ -1152,7 +1153,7 @@
* pk_update_update_last_updated_time:
**/
static gboolean
-pk_update_update_last_updated_time (PkClient *client)
+pk_update_update_last_updated_time (void)
{
GtkWidget *widget;
guint time;
@@ -1160,8 +1161,8 @@
const gchar *time_text;
/* get times from the daemon */
- pk_client_get_time_since_action (client, PK_ROLE_ENUM_UPDATE_SYSTEM, &time, NULL);
- pk_client_get_time_since_action (client, PK_ROLE_ENUM_UPDATE_PACKAGES, &time_new, NULL);
+ pk_control_get_time_since_action (control, PK_ROLE_ENUM_UPDATE_SYSTEM, &time, NULL);
+ pk_control_get_time_since_action (control, PK_ROLE_ENUM_UPDATE_PACKAGES, &time_new, NULL);
/* always use the shortest time */
if (time_new < time) {
@@ -1173,7 +1174,7 @@
return TRUE;
}
-static void
+static void
pk_updates_restart_cb (GtkWidget *widget, gpointer data)
{
gpk_restart_system ();
@@ -1256,10 +1257,10 @@
/* just update the preview page */
if (role == PK_ROLE_ENUM_REFRESH_CACHE) {
/* update last time in the UI */
- pk_update_update_last_refreshed_time (client);
+ pk_update_update_last_refreshed_time ();
} else if (role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
- pk_update_update_last_updated_time (client);
+ pk_update_update_last_updated_time ();
}
/* we don't need to do anything here */
@@ -1548,6 +1549,164 @@
}
/**
+ * pk_updates_detail_popup_menu_select_all:
+ **/
+void
+pk_updates_detail_popup_menu_select_all (GtkWidget *menuitem, gpointer userdata)
+{
+ GtkTreeView *treeview = GTK_TREE_VIEW (userdata);
+ gboolean valid;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ /* get the first iter in the list */
+ model = gtk_tree_view_get_model (treeview);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+ while (valid) {
+ gtk_tree_model_get (model, &iter, -1);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ PACKAGES_COLUMN_SELECT, TRUE, -1);
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
+/**
+ * pk_updates_detail_popup_menu_select_none:
+ **/
+void
+pk_updates_detail_popup_menu_select_none (GtkWidget *menuitem, gpointer userdata)
+{
+ GtkTreeView *treeview = GTK_TREE_VIEW (userdata);
+ gboolean valid;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ /* get the first iter in the list */
+ model = gtk_tree_view_get_model (treeview);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+ while (valid) {
+ gtk_tree_model_get (model, &iter, -1);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ PACKAGES_COLUMN_SELECT, FALSE, -1);
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
+/**
+ * pk_updates_get_checked_status:
+ **/
+void
+pk_updates_get_checked_status (gboolean *all_checked, gboolean *none_checked)
+{
+ GtkTreeView *treeview;
+ gboolean valid;
+ gboolean update;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ /* get the first iter in the list */
+ treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_updates"));
+ model = gtk_tree_view_get_model (treeview);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+ *all_checked = TRUE;
+ *none_checked = TRUE;
+ while (valid) {
+ gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_SELECT, &update, -1);
+ if (update) {
+ *none_checked = FALSE;
+ } else {
+ *all_checked = FALSE;
+ }
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
+/**
+ * pk_updates_detail_popup_menu_create:
+ **/
+void
+pk_updates_detail_popup_menu_create (GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
+{
+ GtkWidget *menu;
+ GtkWidget *menuitem;
+ gboolean all_checked;
+ gboolean none_checked;
+
+ menu = gtk_menu_new();
+
+ /* we don't want to show 'Select all' if they are all checked */
+ pk_updates_get_checked_status (&all_checked, &none_checked);
+
+ if (!all_checked) {
+ menuitem = gtk_menu_item_new_with_label ("Select all");
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (pk_updates_detail_popup_menu_select_all), treeview);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ }
+
+ if (!none_checked) {
+ menuitem = gtk_menu_item_new_with_label ("Unselect all");
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (pk_updates_detail_popup_menu_select_none), treeview);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ }
+
+ menuitem = gtk_menu_item_new_with_label ("Ignore this package");
+ gtk_widget_set_sensitive (GTK_WIDGET (menuitem), FALSE);
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (pk_updates_detail_popup_menu_select_all), treeview);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+
+ gtk_widget_show_all (menu);
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ (event != NULL) ? event->button : 0,
+ gdk_event_get_time((GdkEvent*)event));
+}
+
+/**
+ * pk_updates_detail_button_pressed:
+ **/
+gboolean
+pk_updates_detail_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
+{
+ GtkTreeSelection *selection;
+
+ /* single click with the right mouse button? */
+ if (event->type != GDK_BUTTON_PRESS || event->button != 3) {
+ /* we did not handle this */
+ return FALSE;
+ }
+
+ pk_debug ("Single right click on the tree view");
+
+ /* select the row */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
+ if (gtk_tree_selection_count_selected_rows (selection) <= 1) {
+ GtkTreePath *path;
+ /* Get tree path for row that was clicked */
+ if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) {
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+ }
+ }
+
+ /* create */
+ pk_updates_detail_popup_menu_create (treeview, event, userdata);
+ return TRUE;
+}
+
+/**
+ * pk_updates_detail_popup_menu:
+ **/
+gboolean
+pk_updates_detail_popup_menu (GtkWidget *treeview, gpointer userdata)
+{
+ pk_updates_detail_popup_menu_create (treeview, NULL, userdata);
+ return TRUE;
+}
+
+/**
* main:
**/
int
@@ -1567,7 +1726,6 @@
GtkWidget *button;
PolKitAction *pk_action;
GError *error = NULL;
- PkNotify *notify;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -1609,6 +1767,10 @@
loop = g_main_loop_new (NULL, FALSE);
+ control = pk_control_new ();
+ g_signal_connect (control, "repo-list-changed",
+ G_CALLBACK (pk_updates_changed_cb), NULL);
+
/* this is stuff we don't care about */
client_query = pk_client_new ();
pk_client_set_use_buffer (client_query, TRUE, NULL);
@@ -1642,12 +1804,8 @@
g_signal_connect (client_action, "allow-cancel",
G_CALLBACK (pk_updates_allow_cancel_cb), NULL);
- notify = pk_notify_new ();
- g_signal_connect (notify, "repo-list-changed",
- G_CALLBACK (pk_updates_changed_cb), NULL);
-
/* get actions */
- role_list = pk_client_get_actions (client_query);
+ role_list = pk_control_get_actions (control);
pconnection = pk_connection_new ();
g_signal_connect (pconnection, "connection-changed",
@@ -1840,6 +1998,10 @@
widget = glade_xml_get_widget (glade_xml, "treeview_updates");
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
GTK_TREE_MODEL (list_store_details));
+ g_signal_connect (widget, "popup-menu",
+ G_CALLBACK (pk_updates_detail_popup_menu), NULL);
+ g_signal_connect (widget, "button-press-event",
+ G_CALLBACK (pk_updates_detail_button_pressed), NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
@@ -1859,8 +2021,8 @@
gtk_widget_set_sensitive (widget, FALSE);
/* set the last updated text */
- pk_update_update_last_refreshed_time (client_query);
- pk_update_update_last_updated_time (client_query);
+ pk_update_update_last_refreshed_time ();
+ pk_update_update_last_updated_time ();
/* set the labels blank until we get a package */
widget = glade_xml_get_widget (glade_xml, "progress_part_label");
@@ -1894,9 +2056,9 @@
g_object_unref (list_store_preview);
g_object_unref (list_store_description);
g_object_unref (list_store_details);
+ g_object_unref (control);
g_object_unref (client_query);
g_object_unref (client_action);
- g_object_unref (notify);
g_object_unref (pconnection);
g_object_unref (role_list);
g_free (cached_package_id);
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Wed Apr 9 01:31:44 2008
@@ -40,12 +40,14 @@
#include <polkit-gnome/polkit-gnome.h>
#include <pk-debug.h>
-#include <pk-job-list.h>
+#include <pk-control.h>
#include <pk-client.h>
+#include <pk-task-list.h>
#include <pk-common.h>
#include <pk-task-list.h>
#include <pk-connection.h>
#include <pk-package-id.h>
+#include <pk-enum-list.h>
#include "gpk-common.h"
#include "gpk-watch.h"
@@ -62,7 +64,7 @@
struct GpkWatchPrivate
{
- PkClient *client;
+ PkControl *control;
GpkSmartIcon *sicon;
GpkSmartIcon *sicon_restart;
GpkInhibit *inhibit;
@@ -242,6 +244,7 @@
g_return_if_fail (GPK_IS_WATCH (watch));
if (pk_task_list_contains_role (tlist, PK_ROLE_ENUM_REFRESH_CACHE) ||
+ pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_PACKAGES) ||
pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
watch->priv->show_refresh_in_menu = FALSE;
} else {
@@ -256,7 +259,7 @@
* gpk_watch_finished_cb:
**/
static void
-gpk_watch_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, GpkWatch *watch)
+gpk_watch_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum exit, guint runtime, GpkWatch *watch)
{
gboolean ret;
gboolean value;
@@ -354,7 +357,7 @@
* gpk_watch_error_code_cb:
**/
static void
-gpk_watch_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, GpkWatch *watch)
+gpk_watch_error_code_cb (PkTaskList *tlist, PkClient *client, PkErrorCodeEnum error_code, const gchar *details, GpkWatch *watch)
{
gchar *escaped_details;
const gchar *title;
@@ -404,7 +407,7 @@
* gpk_watch_message_cb:
**/
static void
-gpk_watch_message_cb (PkClient *client, PkMessageEnum message, const gchar *details, GpkWatch *watch)
+gpk_watch_message_cb (PkTaskList *tlist, PkClient *client, PkMessageEnum message, const gchar *details, GpkWatch *watch)
{
const gchar *title;
const gchar *filename;
@@ -696,7 +699,8 @@
localised_status = gpk_status_enum_to_localised_text (item->status);
icon_name = gpk_status_enum_to_icon_name (item->status);
- if (pk_strzero (item->package_id) == FALSE) {
+ if (!pk_strzero (item->package_id) &&
+ item->role != PK_ROLE_ENUM_UPDATE_PACKAGES) {
package = gpk_package_get_name (item->package_id);
text = g_strdup_printf ("%s %s (%s)", localised_role, package, localised_status);
g_free (package);
@@ -864,16 +868,9 @@
watch->priv->sicon_restart = gpk_smart_icon_new ();
/* we need to get ::locked */
- watch->priv->client = pk_client_new ();
- pk_client_set_promiscuous (watch->priv->client, TRUE, NULL);
- g_signal_connect (watch->priv->client, "locked",
+ watch->priv->control = pk_control_new ();
+ g_signal_connect (watch->priv->control, "locked",
G_CALLBACK (gpk_watch_locked_cb), watch);
- g_signal_connect (watch->priv->client, "finished",
- G_CALLBACK (gpk_watch_finished_cb), watch);
- g_signal_connect (watch->priv->client, "error-code",
- G_CALLBACK (gpk_watch_error_code_cb), watch);
- g_signal_connect (watch->priv->client, "message",
- G_CALLBACK (gpk_watch_message_cb), watch);
/* do session inhibit */
watch->priv->inhibit = gpk_inhibit_new ();
@@ -893,6 +890,12 @@
watch->priv->tlist = pk_task_list_new ();
g_signal_connect (watch->priv->tlist, "task-list-changed",
G_CALLBACK (gpk_watch_task_list_changed_cb), watch);
+ g_signal_connect (watch->priv->tlist, "finished",
+ G_CALLBACK (gpk_watch_finished_cb), watch);
+ g_signal_connect (watch->priv->tlist, "error-code",
+ G_CALLBACK (gpk_watch_error_code_cb), watch);
+ g_signal_connect (watch->priv->tlist, "message",
+ G_CALLBACK (gpk_watch_message_cb), watch);
watch->priv->pconnection = pk_connection_new ();
g_signal_connect (watch->priv->pconnection, "connection-changed",
@@ -937,7 +940,7 @@
g_object_unref (watch->priv->sicon);
g_object_unref (watch->priv->inhibit);
g_object_unref (watch->priv->tlist);
- g_object_unref (watch->priv->client);
+ g_object_unref (watch->priv->control);
g_object_unref (watch->priv->pconnection);
g_object_unref (watch->priv->gconf_client);
g_object_unref (watch->priv->restart_action);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]