gnome-packagekit r144 - in trunk: data help/C po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r144 - in trunk: data help/C po src
- Date: Mon, 31 Mar 2008 14:07:13 +0100 (BST)
Author: rhughes
Date: Mon Mar 31 14:07:13 2008
New Revision: 144
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=144&view=rev
Log:
from git
Modified:
trunk/data/Makefile.am
trunk/data/gpk-application.glade
trunk/help/C/gnome-packagekit.xml
trunk/po/POTFILES.in
trunk/src/.gitignore
trunk/src/Makefile.am
trunk/src/gpk-application.c
trunk/src/gpk-install-package.c
trunk/src/gpk-notify.c
trunk/src/gpk-notify.h
trunk/src/gpk-progress.c
trunk/src/gpk-repo.c
trunk/src/gpk-smart-icon.c
trunk/src/gpk-smart-icon.h
trunk/src/gpk-update-icon.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-watch.c
trunk/src/gpk-watch.h
Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am (original)
+++ trunk/data/Makefile.am Mon Mar 31 14:07:13 2008
@@ -15,7 +15,7 @@
gpk-application.desktop.in \
gpk-update-viewer.desktop.in \
gpk-repo.desktop.in \
- gpk-transaction-viewer.desktop.in \
+ gpk-log.desktop.in \
$(NULL)
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@@ -32,7 +32,7 @@
gpk-progress.glade \
gpk-prefs.glade \
gpk-signature.glade \
- gpk-transactions.glade \
+ gpk-log.glade \
gpk-backend-status.glade \
gpk-install-file.glade \
$(NULL)
@@ -64,7 +64,7 @@
gpk-prefs.desktop \
gpk-update-viewer.desktop \
gpk-install-file.desktop \
- gpk-transaction-viewer.desktop \
+ gpk-log.desktop \
gpk-update-icon.desktop \
gpk-application.desktop \
gnome-packagekit.schemas \
Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade (original)
+++ trunk/data/gpk-application.glade Mon Mar 31 14:07:13 2008
@@ -35,6 +35,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-cdrom</property>
+ <property name="icon_size">1</property>
</widget>
</child>
</widget>
Modified: trunk/help/C/gnome-packagekit.xml
==============================================================================
--- trunk/help/C/gnome-packagekit.xml (original)
+++ trunk/help/C/gnome-packagekit.xml Mon Mar 31 14:07:13 2008
@@ -11,7 +11,7 @@
<!--
(Do not remove this comment block.)
Template Maintained by the GNOME Documentation Project:
- http://developer.gnome.org/projects/gdp
+ http://developer.gnome.org/projects/gdp
Template version: 2.0 beta
Template last modified Feb 12, 2002
-->
@@ -58,7 +58,7 @@
<author role="maintainer">
<firstname>Richard</firstname>
<surname>Hughes</surname>
- <email>richard hughsie com</email>
+ <email>richard hughsie com</email>
</author>
<!-- This is appropriate place for other contributors: translators,
maintainers, etc. Commented out by default.
@@ -93,7 +93,7 @@
To report a bug or make a suggestion regarding the &app; application or
this manual, follow the directions in the
<ulink url="http://live.gnome.org/PackageKit/"
- type="http">&application; Contact Page</ulink>.
+ type="http">&application; Contact Page</ulink>.
</para>
<!-- Translators may also add here feedback address for translations -->
</legalnotice>
@@ -135,8 +135,8 @@
<varlistentry>
<term>Command line</term>
<listitem>
- <para>
- Type <command>pk-application --verbose --no-daemon</command>,
+ <para>
+ Type <command>pk-application --verbose --no-daemon</command>,
then press <keycap>Return</keycap>:
</para>
</listitem>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Mon Mar 31 14:07:13 2008
@@ -7,32 +7,31 @@
data/gpk-backend-status.glade
data/gpk-install-file.desktop.in
data/gpk-install-file.glade
-data/gpk-repo.desktop.in
-data/gpk-repo.glade
+data/gpk-log.desktop.in
+data/gpk-log.glade
data/gpk-prefs.desktop.in
data/gpk-prefs.glade
data/gpk-progress.glade
-data/gpk-transactions.glade
-data/gpk-transactions.glade
-data/gpk-transaction-viewer.desktop.in
+data/gpk-repo.desktop.in
+data/gpk-repo.glade
+data/gpk-signature.glade
data/gpk-update-icon.desktop.in
data/gpk-update-viewer.desktop.in
data/gpk-update-viewer.glade
-data/gpk-signature.glade
src/gpk-application.c
src/gpk-application-main.c
src/gpk-backend-status.c
src/gpk-common.c
+src/gpk-inhibit.c
src/gpk-install-file.c
src/gpk-install-package.c
+src/gpk-log.c
src/gpk-notify.c
-src/gpk-repo.c
src/gpk-prefs.c
-src/gpk-transaction-viewer.c
+src/gpk-repo.c
+src/gpk-smart-icon.c
+src/gpk-statusbar.c
src/gpk-update-icon.c
src/gpk-update-viewer.c
src/gpk-watch.c
-src/gpk-inhibit.c
-src/gpk-statusbar.c
-src/gpk-smart-icon.c
Modified: trunk/src/.gitignore
==============================================================================
--- trunk/src/.gitignore (original)
+++ trunk/src/.gitignore Mon Mar 31 14:07:13 2008
@@ -13,6 +13,6 @@
gpk-prefs
gpk-update-viewer
gpk-backend-status
-gpk-transaction-viewer
+gpk-log
.svn
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Mar 31 14:07:13 2008
@@ -41,7 +41,7 @@
gpk-install-package \
gpk-update-icon \
gpk-update-viewer \
- gpk-transaction-viewer \
+ gpk-log \
gpk-backend-status \
$(NULL)
@@ -186,13 +186,13 @@
$(POLKIT_GNOME_LIBS) \
$(NULL)
-gpk_transaction_viewer_SOURCES = \
- gpk-transaction-viewer.c \
+gpk_log_SOURCES = \
+ gpk-log.c \
gpk-common.c \
gpk-common.h \
$(NULL)
-gpk_transaction_viewer_LDADD = \
+gpk_log_LDADD = \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(LIBGLADE_LIBS) \
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Mon Mar 31 14:07:13 2008
@@ -1584,7 +1584,7 @@
g_return_if_fail (application != NULL);
g_return_if_fail (PK_IS_APPLICATION (application));
- ret = g_spawn_command_line_async ("pk-repo", NULL);
+ ret = g_spawn_command_line_async ("gpk-repo", NULL);
if (!ret) {
pk_warning ("spawn of pk-repo failed");
}
@@ -2195,7 +2195,7 @@
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_basename");
gtk_widget_hide (widget);
}
- if (TRUE) {
+ if (pk_enum_list_contains (application->priv->filter_list, PK_FILTER_ENUM_NEWEST) == FALSE) {
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_newest");
gtk_widget_hide (widget);
}
Modified: trunk/src/gpk-install-package.c
==============================================================================
--- trunk/src/gpk-install-package.c (original)
+++ trunk/src/gpk-install-package.c Mon Mar 31 14:07:13 2008
@@ -152,7 +152,7 @@
g_type_init ();
g_set_application_name (_("PackageKit Package Installer"));
- context = g_option_context_new ("pk-install-package");
+ context = g_option_context_new ("gpk-install-package");
g_option_context_set_summary (context, _("PackageKit Package Installer"));
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
Modified: trunk/src/gpk-notify.c
==============================================================================
--- trunk/src/gpk-notify.c (original)
+++ trunk/src/gpk-notify.c Mon Mar 31 14:07:13 2008
@@ -40,6 +40,7 @@
#include <pk-debug.h>
#include <pk-job-list.h>
#include <pk-client.h>
+#include <pk-notify.h>
#include <pk-common.h>
#include <pk-task-list.h>
#include <pk-connection.h>
@@ -52,77 +53,78 @@
#include "gpk-common.h"
#include "gpk-notify.h"
-static void pk_notify_class_init (PkNotifyClass *klass);
-static void pk_notify_init (PkNotify *notify);
-static void pk_notify_finalize (GObject *object);
+static void gpk_notify_class_init (GpkNotifyClass *klass);
+static void gpk_notify_init (GpkNotify *notify);
+static void gpk_notify_finalize (GObject *object);
-#define PK_NOTIFY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_NOTIFY, PkNotifyPrivate))
+#define GPK_NOTIFY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_NOTIFY, GpkNotifyPrivate))
-struct PkNotifyPrivate
+struct GpkNotifyPrivate
{
- PkSmartIcon *sicon;
+ GpkSmartIcon *sicon;
PkConnection *pconnection;
PkClient *client_update_system;
PkTaskList *tlist;
PkAutoRefresh *arefresh;
+ PkNotify *notify;
GConfClient *gconf_client;
gboolean cache_okay;
gboolean cache_update_in_progress;
};
-G_DEFINE_TYPE (PkNotify, pk_notify, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GpkNotify, gpk_notify, G_TYPE_OBJECT)
/**
- * pk_notify_class_init:
- * @klass: The PkNotifyClass
+ * gpk_notify_class_init:
+ * @klass: The GpkNotifyClass
**/
static void
-pk_notify_class_init (PkNotifyClass *klass)
+gpk_notify_class_init (GpkNotifyClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_notify_finalize;
+ object_class->finalize = gpk_notify_finalize;
- g_type_class_add_private (klass, sizeof (PkNotifyPrivate));
+ g_type_class_add_private (klass, sizeof (GpkNotifyPrivate));
}
#if 0
/* No help yet */
/**
- * pk_notify_show_help_cb:
+ * gpk_notify_show_help_cb:
**/
static void
-pk_notify_show_help_cb (GtkMenuItem *item, PkNotify *notify)
+gpk_notify_show_help_cb (GtkMenuItem *item, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
pk_debug ("show help");
- pk_smart_icon_notify_new (notify->priv->sicon,
+ gpk_smart_icon_notify_new (notify->priv->sicon,
_("Functionality incomplete"),
_("No help yet, sorry..."), "help-browser",
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_SHORT);
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_SHORT);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
#endif
/**
- * pk_notify_show_preferences_cb:
+ * gpk_notify_show_preferences_cb:
**/
static void
-pk_notify_show_preferences_cb (GtkMenuItem *item, PkNotify *notify)
+gpk_notify_show_preferences_cb (GtkMenuItem *item, GpkNotify *notify)
{
- const gchar *command = "pk-prefs";
+ const gchar *command = "gpk-prefs";
if (g_spawn_command_line_async (command, NULL) == FALSE) {
pk_warning ("Couldn't execute command: %s", command);
}
}
/**
- * pk_notify_about_dialog_url_cb:
+ * gpk_notify_about_dialog_url_cb:
**/
static void
-pk_notify_about_dialog_url_cb (GtkAboutDialog *about, const char *address, gpointer data)
+gpk_notify_about_dialog_url_cb (GtkAboutDialog *about, const char *address, gpointer data)
{
GError *error = NULL;
gboolean ret;
@@ -171,10 +173,10 @@
}
/**
- * pk_notify_show_about_cb:
+ * gpk_notify_show_about_cb:
**/
static void
-pk_notify_show_about_cb (GtkMenuItem *item, gpointer data)
+gpk_notify_show_about_cb (GtkMenuItem *item, gpointer data)
{
static gboolean been_here = FALSE;
const char *authors[] = {
@@ -212,8 +214,8 @@
/* FIXME: unnecessary with libgnomeui >= 2.16.0 */
if (!been_here) {
been_here = TRUE;
- gtk_about_dialog_set_url_hook (pk_notify_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (pk_notify_about_dialog_url_cb, "mailto:", NULL);
+ gtk_about_dialog_set_url_hook (gpk_notify_about_dialog_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (gpk_notify_about_dialog_url_cb, "mailto:", NULL);
}
gtk_window_set_default_icon_name ("system-software-installer");
@@ -233,15 +235,15 @@
}
/**
- * pk_notify_popup_menu_cb:
+ * gpk_notify_popup_menu_cb:
*
* Display the popup menu.
**/
static void
-pk_notify_popup_menu_cb (GtkStatusIcon *status_icon,
+gpk_notify_popup_menu_cb (GtkStatusIcon *status_icon,
guint button,
guint32 timestamp,
- PkNotify *icon)
+ GpkNotify *icon)
{
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
GtkWidget *item;
@@ -254,7 +256,7 @@
image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_notify_show_preferences_cb), icon);
+ G_CALLBACK (gpk_notify_show_preferences_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
/* Separator for HIG? */
@@ -267,7 +269,7 @@
image = gtk_image_new_from_icon_name (GTK_STOCK_HELP, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_notify_show_help_cb), icon);
+ G_CALLBACK (gpk_notify_show_help_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
#endif
@@ -276,7 +278,7 @@
image = gtk_image_new_from_icon_name (GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_notify_show_about_cb), icon);
+ G_CALLBACK (gpk_notify_show_about_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
/* show the menu */
@@ -289,15 +291,15 @@
}
}
-static gboolean pk_notify_check_for_updates_cb (PkNotify *notify);
-static void pk_notify_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, PkNotify *notify);
-static gboolean pk_notify_query_updates (PkNotify *notify);
+static gboolean gpk_notify_check_for_updates_cb (GpkNotify *notify);
+static void gpk_notify_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, GpkNotify *notify);
+static gboolean gpk_notify_query_updates (GpkNotify *notify);
/**
- * pk_notify_update_system_finished_cb:
+ * gpk_notify_update_system_finished_cb:
**/
static void
-pk_notify_update_system_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, PkNotify *notify)
+gpk_notify_update_system_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, GpkNotify *notify)
{
PkRestartEnum restart;
guint i;
@@ -310,13 +312,13 @@
gboolean value;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* we failed, show the icon */
if (exit_code != PK_EXIT_ENUM_SUCCESS) {
- pk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
/* we failed, so re-get the update list */
- pk_notify_query_updates (notify);
+ gpk_notify_query_updates (notify);
}
/* check we got some packages */
@@ -378,81 +380,81 @@
/* do the notify, and show the right buttons */
pk_debug ("Doing notification");
- pk_smart_icon_notify_new (notify->priv->sicon,
+ gpk_smart_icon_notify_new (notify->priv->sicon,
_("The system update has completed"), message_text->str,
"software-update-available",
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_LONG);
if (restart == PK_RESTART_ENUM_SYSTEM) {
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_RESTART_COMPUTER, NULL);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_RESTART_COMPUTER, NULL);
}
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_RESTART);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_RESTART);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
g_string_free (message_text, TRUE);
}
/**
- * pk_notify_update_system:
+ * gpk_notify_update_system:
**/
static gboolean
-pk_notify_update_system (PkNotify *notify)
+gpk_notify_update_system (GpkNotify *notify)
{
gboolean ret;
GError *error = NULL;
gchar *message;
g_return_val_if_fail (notify != NULL, FALSE);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), FALSE);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), FALSE);
pk_debug ("install updates");
ret = pk_client_update_system (notify->priv->client_update_system, &error);
if (ret) {
- pk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
} else {
pk_warning ("failed to update system: %s", error->message);
message = g_strdup_printf (_("Client action was refused: %s"), error->message);
g_error_free (error);
- pk_smart_icon_notify_new (notify->priv->sicon, _("Failed to update system"), message,
- "process-stop", PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_SHORT);
+ gpk_smart_icon_notify_new (notify->priv->sicon, _("Failed to update system"), message,
+ "process-stop", GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_SHORT);
g_free (message);
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
return ret;
}
/**
- * pk_notify_menuitem_update_system_cb:
+ * gpk_notify_menuitem_update_system_cb:
**/
static void
-pk_notify_menuitem_update_system_cb (GtkMenuItem *item, gpointer data)
+gpk_notify_menuitem_update_system_cb (GtkMenuItem *item, gpointer data)
{
- PkNotify *notify = PK_NOTIFY (data);
+ GpkNotify *notify = GPK_NOTIFY (data);
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
- pk_notify_update_system (notify);
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
+ gpk_notify_update_system (notify);
}
/**
- * pk_notify_menuitem_show_updates_cb:
+ * gpk_notify_menuitem_show_updates_cb:
**/
static void
-pk_notify_menuitem_show_updates_cb (GtkMenuItem *item, gpointer data)
+gpk_notify_menuitem_show_updates_cb (GtkMenuItem *item, gpointer data)
{
- const gchar *command = "pk-update-viewer";
+ const gchar *command = "gpk-update-viewer";
if (g_spawn_command_line_async (command, NULL) == FALSE) {
pk_warning ("Couldn't execute command: %s", command);
}
}
/**
- * pk_notify_activate_update_cb:
+ * gpk_notify_activate_update_cb:
* @button: Which buttons are pressed
*
* Callback when the icon is clicked
**/
static void
-pk_notify_activate_update_cb (GtkStatusIcon *status_icon,
- PkNotify *icon)
+gpk_notify_activate_update_cb (GtkStatusIcon *status_icon,
+ GpkNotify *icon)
{
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
GtkWidget *item;
@@ -465,7 +467,7 @@
image = gtk_image_new_from_icon_name ("system-software-update", GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_notify_menuitem_show_updates_cb), icon);
+ G_CALLBACK (gpk_notify_menuitem_show_updates_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
/* update system */
@@ -473,7 +475,7 @@
image = gtk_image_new_from_icon_name ("software-update-available", GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_notify_menuitem_update_system_cb), icon);
+ G_CALLBACK (gpk_notify_menuitem_update_system_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
/* show the menu */
@@ -487,25 +489,25 @@
* pk_connection_changed_cb:
**/
static void
-pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkNotify *notify)
+pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
pk_debug ("connected=%i", connected);
}
/**
- * pk_notify_critical_updates_warning:
+ * gpk_notify_critical_updates_warning:
**/
static void
-pk_notify_critical_updates_warning (PkNotify *notify, const gchar *details, guint number)
+gpk_notify_critical_updates_warning (GpkNotify *notify, const gchar *details, guint number)
{
const gchar *title;
gchar *message;
gboolean value;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* are we accepting notifications */
value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_CRITICAL, NULL);
@@ -519,25 +521,25 @@
"The following important updates are available for your computer:\n\n%s", number), details);
pk_debug ("Doing critical updates warning: %s", message);
- 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, PK_CONF_NOTIFY_CRITICAL);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ gpk_smart_icon_notify_new (notify->priv->sicon, title, message, "software-update-urgent",
+ GPK_NOTIFY_URGENCY_CRITICAL, GPK_NOTIFY_TIMEOUT_NEVER);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_UPDATE_COMPUTER, NULL);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN, PK_CONF_NOTIFY_CRITICAL);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
g_free (message);
}
/**
- * pk_notify_auto_update_message:
+ * gpk_notify_auto_update_message:
**/
static void
-pk_notify_auto_update_message (PkNotify *notify)
+gpk_notify_auto_update_message (GpkNotify *notify)
{
gboolean value;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* are we accepting notifications */
value = gconf_client_get_bool (notify->priv->gconf_client, PK_CONF_NOTIFY_MESSAGE, NULL);
@@ -546,20 +548,20 @@
return;
}
- pk_smart_icon_notify_new (notify->priv->sicon,
+ gpk_smart_icon_notify_new (notify->priv->sicon,
_("Updates are being installed"),
_("Updates are being automatically installed on your computer"), "software-update-urgent",
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_CANCEL_UPDATE, NULL);
- pk_smart_icon_notify_button (notify->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_STARTED);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_LONG);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_CANCEL_UPDATE, NULL);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_STARTED);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
/**
- * pk_notify_client_packages_to_enum_list:
+ * gpk_notify_client_packages_to_enum_list:
**/
static PkEnumList *
-pk_notify_client_packages_to_enum_list (PkNotify *notify, PkClient *client)
+gpk_notify_client_packages_to_enum_list (GpkNotify *notify, PkClient *client)
{
guint i;
guint length;
@@ -567,7 +569,7 @@
PkPackageItem *item;
g_return_val_if_fail (notify != NULL, NULL);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), NULL);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), NULL);
/* shortcut */
length = pk_client_package_buffer_get_size (client);
@@ -592,20 +594,20 @@
}
/**
- * pk_notify_get_best_update_icon:
+ * gpk_notify_get_best_update_icon:
**/
static const gchar *
-pk_notify_get_best_update_icon (PkNotify *notify, PkClient *client)
+gpk_notify_get_best_update_icon (GpkNotify *notify, PkClient *client)
{
gint value;
PkEnumList *elist;
const gchar *icon;
g_return_val_if_fail (notify != NULL, NULL);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), NULL);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), NULL);
/* get an enumerated list with all the update types */
- elist = pk_notify_client_packages_to_enum_list (notify, client);
+ elist = gpk_notify_client_packages_to_enum_list (notify, client);
/* get the most important icon */
value = pk_enum_list_contains_priority (elist,
@@ -628,17 +630,17 @@
}
/**
- * pk_notify_check_on_battery:
+ * gpk_notify_check_on_battery:
**/
static gboolean
-pk_notify_check_on_battery (PkNotify *notify)
+gpk_notify_check_on_battery (GpkNotify *notify)
{
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);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), FALSE);
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);
@@ -646,14 +648,14 @@
/* 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,
+ gpk_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,
+ "dialog-information", GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_LONG);
+ gpk_smart_icon_notify_button (notify->priv->sicon,
+ GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN,
PK_CONF_NOTIFY_BATTERY_UPDATE);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
return FALSE;
}
@@ -661,16 +663,16 @@
}
/**
- * pk_notify_get_update_policy:
+ * gpk_notify_get_update_policy:
**/
static PkUpdateEnum
-pk_notify_get_update_policy (PkNotify *notify)
+gpk_notify_get_update_policy (GpkNotify *notify)
{
PkUpdateEnum update;
gchar *updates;
g_return_val_if_fail (notify != NULL, FALSE);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), FALSE);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), FALSE);
updates = gconf_client_get_string (notify->priv->gconf_client, PK_CONF_AUTO_UPDATE, NULL);
if (updates == NULL) {
@@ -683,10 +685,10 @@
}
/**
- * pk_notify_query_updates_finished_cb:
+ * gpk_notify_query_updates_finished_cb:
**/
static void
-pk_notify_query_updates_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, PkNotify *notify)
+gpk_notify_query_updates_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, GpkNotify *notify)
{
PkPackageItem *item;
guint length;
@@ -699,7 +701,7 @@
GPtrArray *security_array;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
status_security = g_string_new ("");
status_tooltip = g_string_new ("");
@@ -712,7 +714,7 @@
/* we have no updates */
if (length == 0) {
pk_debug ("no updates");
- pk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
goto out;
}
@@ -735,7 +737,7 @@
g_object_unref (client);
/* do we do the automatic updates? */
- update = pk_notify_get_update_policy (notify);
+ update = gpk_notify_get_update_policy (notify);
if (update == PK_UPDATE_ENUM_UNKNOWN) {
pk_warning ("policy unknown");
goto out;
@@ -747,7 +749,7 @@
pk_debug ("not updating as policy NONE");
/* work out icon */
- icon = pk_notify_get_best_update_icon (notify, client);
+ icon = gpk_notify_get_best_update_icon (notify, client);
/* trim off extra newlines */
if (status_security->len != 0) {
@@ -758,29 +760,34 @@
g_string_append_printf (status_tooltip, ngettext ("There is %d update pending",
"There are %d updates pending", length), length);
- pk_smart_icon_set_icon_name (notify->priv->sicon, icon);
- pk_smart_icon_set_tooltip (notify->priv->sicon, status_tooltip->str);
+ gpk_smart_icon_set_icon_name (notify->priv->sicon, icon);
+ gpk_smart_icon_set_tooltip (notify->priv->sicon, status_tooltip->str);
/* do we warn the user? */
if (security_array->len > 0) {
- pk_notify_critical_updates_warning (notify, status_security->str, length);
+ gpk_notify_critical_updates_warning (notify, status_security->str, length);
}
goto out;
}
/* are we on battery and configured to skip the action */
- ret = pk_notify_check_on_battery (notify);
+ ret = gpk_notify_check_on_battery (notify);
if (!ret) {
pk_debug ("on battery so not doing update");
goto out;
}
/* just do security updates */
- if (update == PK_UPDATE_ENUM_SECURITY && security_array->len > 0) {
+ if (update == PK_UPDATE_ENUM_SECURITY) {
gchar **package_ids;
gboolean ret;
GError *error = NULL;
+ if (security_array->len == 0) {
+ pk_debug ("policy security, but none available");
+ goto out;
+ }
+
pk_debug ("just process security updates");
package_ids = pk_package_ids_from_array (security_array);
ret = pk_client_update_packages_strv (notify->priv->client_update_system, package_ids, &error);
@@ -795,9 +802,9 @@
/* just do everything */
if (update == PK_UPDATE_ENUM_ALL) {
pk_debug ("we should do the update automatically!");
- ret = pk_notify_update_system (notify);
+ ret = gpk_notify_update_system (notify);
if (ret) {
- pk_notify_auto_update_message (notify);
+ gpk_notify_auto_update_message (notify);
} else {
pk_warning ("update failed");
}
@@ -815,16 +822,16 @@
}
/**
- * pk_notify_error_code_cb:
+ * gpk_notify_error_code_cb:
**/
static void
-pk_notify_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, PkNotify *notify)
+gpk_notify_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, GpkNotify *notify)
{
const gchar *title;
gboolean value;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
title = pk_error_enum_to_localised_text (error_code);
@@ -842,24 +849,24 @@
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);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ gpk_smart_icon_notify_new (notify->priv->sicon, title, details, "help-browser",
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_LONG);
+ gpk_smart_icon_notify_button (notify->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
/**
- * pk_notify_query_updates:
+ * gpk_notify_query_updates:
**/
static gboolean
-pk_notify_query_updates (PkNotify *notify)
+gpk_notify_query_updates (GpkNotify *notify)
{
gboolean ret;
GError *error = NULL;
PkClient *client;
g_return_val_if_fail (notify != NULL, FALSE);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), FALSE);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), FALSE);
if (pk_task_list_contains_role (notify->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
pk_debug ("Not checking for updates as already in progress");
@@ -868,9 +875,9 @@
client = pk_client_new ();
g_signal_connect (client, "finished",
- G_CALLBACK (pk_notify_query_updates_finished_cb), notify);
+ G_CALLBACK (gpk_notify_query_updates_finished_cb), notify);
g_signal_connect (client, "error-code",
- G_CALLBACK (pk_notify_error_code_cb), notify);
+ G_CALLBACK (gpk_notify_error_code_cb), notify);
pk_client_set_use_buffer (client, TRUE, NULL);
/* get updates */
@@ -883,13 +890,13 @@
}
/**
- * pk_notify_refresh_cache_finished_cb:
+ * gpk_notify_refresh_cache_finished_cb:
**/
static void
-pk_notify_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, PkNotify *notify)
+gpk_notify_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
pk_debug ("finished refreshing cache :%s", pk_exit_enum_to_text (exit_code));
if (exit_code != PK_EXIT_ENUM_SUCCESS) {
@@ -901,24 +908,24 @@
/* now try to get updates */
pk_debug ("get updates");
- pk_notify_query_updates (notify);
+ gpk_notify_query_updates (notify);
}
notify->priv->cache_update_in_progress = FALSE;
g_object_unref (client);
}
/**
- * pk_notify_check_for_updates_cb:
+ * gpk_notify_check_for_updates_cb:
**/
static gboolean
-pk_notify_check_for_updates_cb (PkNotify *notify)
+gpk_notify_check_for_updates_cb (GpkNotify *notify)
{
gboolean ret;
PkClient *client;
pk_debug ("refresh cache");
g_return_val_if_fail (notify != NULL, FALSE);
- g_return_val_if_fail (PK_IS_NOTIFY (notify), FALSE);
+ g_return_val_if_fail (GPK_IS_NOTIFY (notify), FALSE);
/* got a cache, no need to poll */
if (notify->priv->cache_okay) {
@@ -934,9 +941,9 @@
notify->priv->cache_okay = TRUE;
client = pk_client_new ();
g_signal_connect (client, "finished",
- G_CALLBACK (pk_notify_refresh_cache_finished_cb), notify);
+ G_CALLBACK (gpk_notify_refresh_cache_finished_cb), notify);
g_signal_connect (client, "error-code",
- G_CALLBACK (pk_notify_error_code_cb), notify);
+ G_CALLBACK (gpk_notify_error_code_cb), notify);
ret = pk_client_refresh_cache (client, TRUE, NULL);
if (ret == FALSE) {
g_object_unref (client);
@@ -947,97 +954,97 @@
}
/**
- * pk_notify_updates_changed_cb:
+ * gpk_notify_updates_changed_cb:
**/
static void
-pk_notify_updates_changed_cb (PkClient *client, PkNotify *notify)
+gpk_notify_updates_changed_cb (PkClient *client, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* now try to get newest update list */
pk_debug ("get updates");
- pk_notify_query_updates (notify);
+ gpk_notify_query_updates (notify);
}
/**
- * pk_notify_task_list_changed_cb:
+ * gpk_notify_task_list_changed_cb:
**/
static void
-pk_notify_task_list_changed_cb (PkTaskList *tlist, PkNotify *notify)
+gpk_notify_task_list_changed_cb (PkTaskList *tlist, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* hide icon if we are updating */
if (pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
- pk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
}
}
/**
- * pk_notify_auto_refresh_cache_cb:
+ * gpk_notify_auto_refresh_cache_cb:
**/
static void
-pk_notify_auto_refresh_cache_cb (PkAutoRefresh *arefresh, PkNotify *notify)
+gpk_notify_auto_refresh_cache_cb (PkAutoRefresh *arefresh, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* schedule another update */
- pk_notify_check_for_updates_cb (notify);
+ gpk_notify_check_for_updates_cb (notify);
}
/**
- * pk_notify_auto_get_updates_cb:
+ * gpk_notify_auto_get_updates_cb:
**/
static void
-pk_notify_auto_get_updates_cb (PkAutoRefresh *arefresh, PkNotify *notify)
+gpk_notify_auto_get_updates_cb (PkAutoRefresh *arefresh, GpkNotify *notify)
{
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
/* show the icon at login time
* hopefully it just needs a quick network access, else we may have to
* make it a gconf variable */
- pk_notify_query_updates (notify);
+ gpk_notify_query_updates (notify);
}
/**
- * pk_notify_smart_icon_notify_button:
+ * gpk_notify_smart_icon_notify_button:
**/
static void
-pk_notify_smart_icon_notify_button (PkSmartIcon *sicon, PkNotifyButton button,
- const gchar *data, PkNotify *notify)
+gpk_notify_smart_icon_notify_button (GpkSmartIcon *sicon, GpkNotifyButton button,
+ const gchar *data, GpkNotify *notify)
{
gboolean ret;
g_return_if_fail (notify != NULL);
- g_return_if_fail (PK_IS_NOTIFY (notify));
+ g_return_if_fail (GPK_IS_NOTIFY (notify));
pk_debug ("got: %i with data %s", button, data);
/* find the localised text */
- if (button == PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN ||
- button == PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN) {
+ if (button == GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN ||
+ button == GPK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN) {
if (data == NULL) {
pk_warning ("data NULL");
} else {
pk_debug ("setting %s to FALSE", data);
gconf_client_set_bool (notify->priv->gconf_client, data, FALSE, NULL);
}
- } else if (button == PK_NOTIFY_BUTTON_CANCEL_UPDATE) {
+ } else if (button == GPK_NOTIFY_BUTTON_CANCEL_UPDATE) {
gboolean ret;
ret = pk_client_cancel (notify->priv->client_update_system, NULL);
if (ret == FALSE) {
pk_warning ("cancelling updates failed");
- pk_smart_icon_notify_new (notify->priv->sicon,
+ gpk_smart_icon_notify_new (notify->priv->sicon,
_("Could not stop"),
_("Could not cancel the system update"), "process-stop",
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_SHORT);
- pk_smart_icon_notify_show (notify->priv->sicon);
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_SHORT);
+ gpk_smart_icon_notify_show (notify->priv->sicon);
}
- } else if (button == PK_NOTIFY_BUTTON_UPDATE_COMPUTER) {
- pk_notify_update_system (notify);
- } else if (button == PK_NOTIFY_BUTTON_RESTART_COMPUTER) {
+ } else if (button == GPK_NOTIFY_BUTTON_UPDATE_COMPUTER) {
+ gpk_notify_update_system (notify);
+ } else if (button == GPK_NOTIFY_BUTTON_RESTART_COMPUTER) {
/* restart using gnome-power-manager */
ret = pk_restart_system ();
if (!ret) {
@@ -1047,35 +1054,35 @@
}
/**
- * pk_notify_init:
+ * gpk_notify_init:
* @notify: This class instance
**/
static void
-pk_notify_init (PkNotify *notify)
+gpk_notify_init (GpkNotify *notify)
{
GtkStatusIcon *status_icon;
- notify->priv = PK_NOTIFY_GET_PRIVATE (notify);
+ notify->priv = GPK_NOTIFY_GET_PRIVATE (notify);
- notify->priv->sicon = pk_smart_icon_new ();
+ notify->priv->sicon = gpk_smart_icon_new ();
g_signal_connect (notify->priv->sicon, "notification-button",
- G_CALLBACK (pk_notify_smart_icon_notify_button), notify);
+ G_CALLBACK (gpk_notify_smart_icon_notify_button), notify);
notify->priv->gconf_client = gconf_client_get_default ();
notify->priv->arefresh = pk_auto_refresh_new ();
g_signal_connect (notify->priv->arefresh, "refresh-cache",
- G_CALLBACK (pk_notify_auto_refresh_cache_cb), notify);
+ G_CALLBACK (gpk_notify_auto_refresh_cache_cb), notify);
g_signal_connect (notify->priv->arefresh, "get-updates",
- G_CALLBACK (pk_notify_auto_get_updates_cb), notify);
+ G_CALLBACK (gpk_notify_auto_get_updates_cb), notify);
/* right click actions are common */
- status_icon = pk_smart_icon_get_status_icon (notify->priv->sicon);
+ status_icon = gpk_smart_icon_get_status_icon (notify->priv->sicon);
g_signal_connect_object (G_OBJECT (status_icon),
"popup_menu",
- G_CALLBACK (pk_notify_popup_menu_cb),
+ G_CALLBACK (gpk_notify_popup_menu_cb),
notify, 0);
g_signal_connect_object (G_OBJECT (status_icon),
"activate",
- G_CALLBACK (pk_notify_activate_update_cb),
+ G_CALLBACK (gpk_notify_activate_update_cb),
notify, 0);
notify->priv->pconnection = pk_connection_new ();
@@ -1085,20 +1092,21 @@
pk_connection_changed_cb (notify->priv->pconnection, TRUE, notify);
}
- /* use a client to get the updates-changed signal */
notify->priv->client_update_system = pk_client_new ();
pk_client_set_use_buffer (notify->priv->client_update_system, TRUE, NULL);
- g_signal_connect (notify->priv->client_update_system, "updates-changed",
- G_CALLBACK (pk_notify_updates_changed_cb), notify);
g_signal_connect (notify->priv->client_update_system, "finished",
- G_CALLBACK (pk_notify_update_system_finished_cb), notify);
+ G_CALLBACK (gpk_notify_update_system_finished_cb), notify);
g_signal_connect (notify->priv->client_update_system, "error-code",
- G_CALLBACK (pk_notify_error_code_cb), notify);
+ G_CALLBACK (gpk_notify_error_code_cb), notify);
+
+ notify->priv->notify = pk_notify_new ();
+ g_signal_connect (notify->priv->notify, "updates-changed",
+ G_CALLBACK (gpk_notify_updates_changed_cb), notify);
/* we need the task list so we can hide the update icon when we are doing the update */
notify->priv->tlist = pk_task_list_new ();
g_signal_connect (notify->priv->tlist, "task-list-changed",
- G_CALLBACK (pk_notify_task_list_changed_cb), notify);
+ G_CALLBACK (gpk_notify_task_list_changed_cb), notify);
/* refresh the cache, and poll until we get a good refresh */
notify->priv->cache_okay = FALSE;
@@ -1106,18 +1114,18 @@
}
/**
- * pk_notify_finalize:
+ * gpk_notify_finalize:
* @object: The object to finalize
**/
static void
-pk_notify_finalize (GObject *object)
+gpk_notify_finalize (GObject *object)
{
- PkNotify *notify;
+ GpkNotify *notify;
g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_NOTIFY (object));
+ g_return_if_fail (GPK_IS_NOTIFY (object));
- notify = PK_NOTIFY (object);
+ notify = GPK_NOTIFY (object);
g_return_if_fail (notify->priv != NULL);
@@ -1127,20 +1135,21 @@
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_CLASS (pk_notify_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gpk_notify_parent_class)->finalize (object);
}
/**
- * pk_notify_new:
+ * gpk_notify_new:
*
- * Return value: a new PkNotify object.
+ * Return value: a new GpkNotify object.
**/
-PkNotify *
-pk_notify_new (void)
+GpkNotify *
+gpk_notify_new (void)
{
- PkNotify *notify;
- notify = g_object_new (PK_TYPE_NOTIFY, NULL);
- return PK_NOTIFY (notify);
+ GpkNotify *notify;
+ notify = g_object_new (GPK_TYPE_NOTIFY, NULL);
+ return GPK_NOTIFY (notify);
}
Modified: trunk/src/gpk-notify.h
==============================================================================
--- trunk/src/gpk-notify.h (original)
+++ trunk/src/gpk-notify.h Mon Mar 31 14:07:13 2008
@@ -19,38 +19,38 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __PK_NOTIFY_H
-#define __PK_NOTIFY_H
+#ifndef __GPK_NOTIFY_H
+#define __GPK_NOTIFY_H
#include <glib-object.h>
G_BEGIN_DECLS
-#define PK_TYPE_NOTIFY (pk_notify_get_type ())
-#define PK_NOTIFY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_NOTIFY, PkNotify))
-#define PK_NOTIFY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_NOTIFY, PkNotifyClass))
-#define PK_IS_NOTIFY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_NOTIFY))
-#define PK_IS_NOTIFY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_NOTIFY))
-#define PK_NOTIFY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_NOTIFY, PkNotifyClass))
-#define PK_NOTIFY_ERROR (pk_notify_error_quark ())
-#define PK_NOTIFY_TYPE_ERROR (pk_notify_error_get_type ())
+#define GPK_TYPE_NOTIFY (gpk_notify_get_type ())
+#define GPK_NOTIFY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPK_TYPE_NOTIFY, GpkNotify))
+#define GPK_NOTIFY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPK_TYPE_NOTIFY, GpkNotifyClass))
+#define GPK_IS_NOTIFY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPK_TYPE_NOTIFY))
+#define GPK_IS_NOTIFY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPK_TYPE_NOTIFY))
+#define GPK_NOTIFY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPK_TYPE_NOTIFY, GpkNotifyClass))
+#define GPK_NOTIFY_ERROR (gpk_notify_error_quark ())
+#define GPK_NOTIFY_TYPE_ERROR (gpk_notify_error_get_type ())
-typedef struct PkNotifyPrivate PkNotifyPrivate;
+typedef struct GpkNotifyPrivate GpkNotifyPrivate;
typedef struct
{
GObject parent;
- PkNotifyPrivate *priv;
-} PkNotify;
+ GpkNotifyPrivate *priv;
+} GpkNotify;
typedef struct
{
GObjectClass parent_class;
-} PkNotifyClass;
+} GpkNotifyClass;
-GType pk_notify_get_type (void);
-PkNotify *pk_notify_new (void);
+GType gpk_notify_get_type (void);
+GpkNotify *gpk_notify_new (void);
G_END_DECLS
-#endif /* __PK_NOTIFY_H */
+#endif /* __GPK_NOTIFY_H */
Modified: trunk/src/gpk-progress.c
==============================================================================
--- trunk/src/gpk-progress.c (original)
+++ trunk/src/gpk-progress.c Mon Mar 31 14:07:13 2008
@@ -198,9 +198,29 @@
* pk_progress_finished_cb:
**/
static void
-pk_progress_finished_cb (PkClient *client, PkStatusEnum status, guint runtime, PkProgress *progress)
+pk_progress_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, PkProgress *progress)
{
+ GtkWidget *widget;
pk_debug ("finished");
+
+ /* we were cancelled */
+ if (exit == PK_EXIT_ENUM_CANCELLED) {
+ widget = glade_xml_get_widget (progress->priv->glade_xml, "label_status");
+ gtk_label_set_label (GTK_LABEL (widget), _("The transaction was cancelled"));
+ gtk_widget_show (widget);
+ widget = glade_xml_get_widget (progress->priv->glade_xml, "label_package");
+ gtk_widget_hide (widget);
+ }
+
+ /* we failed */
+ if (exit == PK_EXIT_ENUM_FAILED) {
+ widget = glade_xml_get_widget (progress->priv->glade_xml, "label_status");
+ gtk_label_set_label (GTK_LABEL (widget), _("The transaction failed"));
+ gtk_widget_show (widget);
+ widget = glade_xml_get_widget (progress->priv->glade_xml, "label_package");
+ gtk_widget_hide (widget);
+ }
+
progress->priv->task_ended = TRUE;
/* wait 5 seconds */
progress->priv->no_percentage_evt = g_timeout_add_seconds (30, pk_progress_finished_timeout, progress);
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Mon Mar 31 14:07:13 2008
@@ -33,6 +33,7 @@
#include <pk-debug.h>
#include <pk-client.h>
+#include <pk-notify.h>
#include <pk-connection.h>
#include <pk-enum-list.h>
#include "gpk-common.h"
@@ -240,7 +241,7 @@
* pk_repo_repo_list_changed_cb:
**/
static void
-pk_repo_repo_list_changed_cb (PkClient *client, gpointer data)
+pk_repo_repo_list_changed_cb (PkNotify *notify, gpointer data)
{
gboolean ret;
GError *error = NULL;
@@ -254,7 +255,7 @@
return;
}
- ret = pk_client_get_repo_list (client, &error);
+ ret = pk_client_get_repo_list (client, "none", &error);
if (!ret) {
pk_warning ("failed to get repo list: %s", error->message);
g_error_free (error);
@@ -276,6 +277,7 @@
GtkWidget *widget;
GtkTreeSelection *selection;
GError *error = NULL;
+ PkNotify *notify;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -318,13 +320,15 @@
G_CALLBACK (pk_repo_detail_cb), NULL);
g_signal_connect (client, "status-changed",
G_CALLBACK (pk_repo_status_changed_cb), NULL);
- g_signal_connect (client, "repo-list-changed",
- G_CALLBACK (pk_repo_repo_list_changed_cb), NULL);
g_signal_connect (client, "finished",
G_CALLBACK (pk_repo_finished_cb), NULL);
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",
+ G_CALLBACK (pk_repo_repo_list_changed_cb), NULL);
+
/* get actions */
role_list = pk_client_get_actions (client);
@@ -371,7 +375,7 @@
if (pk_enum_list_contains (role_list, PK_ROLE_ENUM_GET_REPO_LIST)) {
/* get the update list */
- ret = pk_client_get_repo_list (client, &error);
+ ret = pk_client_get_repo_list (client, "none", &error);
if (!ret) {
pk_warning ("failed to get repo list: %s", error->message);
g_error_free (error);
@@ -389,6 +393,7 @@
g_object_unref (glade_xml);
g_object_unref (list_store);
g_object_unref (client);
+ g_object_unref (notify);
g_object_unref (role_list);
g_object_unref (statusbar);
Modified: trunk/src/gpk-smart-icon.c
==============================================================================
--- trunk/src/gpk-smart-icon.c (original)
+++ trunk/src/gpk-smart-icon.c Mon Mar 31 14:07:13 2008
@@ -45,14 +45,14 @@
#include "gpk-common.h"
#include "gpk-smart-icon.h"
-static void pk_smart_icon_class_init (PkSmartIconClass *klass);
-static void pk_smart_icon_init (PkSmartIcon *sicon);
-static void pk_smart_icon_finalize (GObject *object);
+static void gpk_smart_icon_class_init (GpkSmartIconClass *klass);
+static void gpk_smart_icon_init (GpkSmartIcon *sicon);
+static void gpk_smart_icon_finalize (GObject *object);
-#define PK_SMART_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_SMART_ICON, PkSmartIconPrivate))
+#define PK_SMART_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_SMART_ICON, GpkSmartIconPrivate))
#define PK_SMART_ICON_PERSIST_TIMEOUT 100
-struct PkSmartIconPrivate
+struct GpkSmartIconPrivate
{
GtkStatusIcon *status_icon;
NotifyNotification *dialog;
@@ -67,30 +67,30 @@
LAST_SIGNAL
};
-G_DEFINE_TYPE (PkSmartIcon, pk_smart_icon, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GpkSmartIcon, gpk_smart_icon, G_TYPE_OBJECT)
static guint signals [LAST_SIGNAL] = { 0 };
static PkEnumMatch enum_button_ids[] = {
- {PK_NOTIFY_BUTTON_UNKNOWN, "unknown"}, /* fall though value */
- {PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, "do-not-show-again"},
- {PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN, "do-not-warn-again"},
- {PK_NOTIFY_BUTTON_CANCEL_UPDATE, "cancel-update"},
- {PK_NOTIFY_BUTTON_UPDATE_COMPUTER, "update-computer"},
- {PK_NOTIFY_BUTTON_RESTART_COMPUTER, "restart-computer"},
+ {GPK_NOTIFY_BUTTON_UNKNOWN, "unknown"}, /* fall though value */
+ {GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, "do-not-show-again"},
+ {GPK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN, "do-not-warn-again"},
+ {GPK_NOTIFY_BUTTON_CANCEL_UPDATE, "cancel-update"},
+ {GPK_NOTIFY_BUTTON_UPDATE_COMPUTER, "update-computer"},
+ {GPK_NOTIFY_BUTTON_RESTART_COMPUTER, "restart-computer"},
{0, NULL}
};
/**
- * pk_smart_icon_class_init:
- * @klass: The PkSmartIconClass
+ * gpk_smart_icon_class_init:
+ * @klass: The GpkSmartIconClass
**/
static void
-pk_smart_icon_class_init (PkSmartIconClass *klass)
+gpk_smart_icon_class_init (GpkSmartIconClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_smart_icon_finalize;
- g_type_class_add_private (klass, sizeof (PkSmartIconPrivate));
+ object_class->finalize = gpk_smart_icon_finalize;
+ g_type_class_add_private (klass, sizeof (GpkSmartIconPrivate));
signals [NOTIFICATION_BUTTON] =
g_signal_new ("notification-button",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -99,9 +99,9 @@
}
static gboolean
-pk_smart_icon_set_icon_name_cb (gpointer data)
+gpk_smart_icon_set_icon_name_cb (gpointer data)
{
- PkSmartIcon *sicon = (PkSmartIcon *) data;
+ GpkSmartIcon *sicon = (GpkSmartIcon *) data;
/* no point setting the same */
if (sicon->priv->new != NULL &&
@@ -129,10 +129,10 @@
}
/**
- * pk_smart_icon_set_icon:
+ * gpk_smart_icon_set_icon:
**/
gboolean
-pk_smart_icon_set_icon_name (PkSmartIcon *sicon, const gchar *icon_name)
+gpk_smart_icon_set_icon_name (GpkSmartIcon *sicon, const gchar *icon_name)
{
g_return_val_if_fail (sicon != NULL, FALSE);
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), FALSE);
@@ -148,15 +148,15 @@
sicon->priv->new = g_strdup (icon_name);
/* wait a little while to see if it's worth displaying the icon */
- sicon->priv->event_source = g_timeout_add (PK_SMART_ICON_PERSIST_TIMEOUT, pk_smart_icon_set_icon_name_cb, sicon);
+ sicon->priv->event_source = g_timeout_add (PK_SMART_ICON_PERSIST_TIMEOUT, gpk_smart_icon_set_icon_name_cb, sicon);
return TRUE;
}
/**
- * pk_smart_icon_sync:
+ * gpk_smart_icon_sync:
**/
gboolean
-pk_smart_icon_sync (PkSmartIcon *sicon)
+gpk_smart_icon_sync (GpkSmartIcon *sicon)
{
g_return_val_if_fail (sicon != NULL, FALSE);
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), FALSE);
@@ -168,7 +168,7 @@
}
/* sync the icon now */
- pk_smart_icon_set_icon_name_cb (sicon);
+ gpk_smart_icon_set_icon_name_cb (sicon);
/* wait until we are in the panel.
* We should probably use gtk_status_icon_is_embedded if it worked... */
@@ -178,10 +178,10 @@
}
/**
- * pk_smart_icon_get_status_icon:
+ * gpk_smart_icon_get_status_icon:
**/
GtkStatusIcon *
-pk_smart_icon_get_status_icon (PkSmartIcon *sicon)
+gpk_smart_icon_get_status_icon (GpkSmartIcon *sicon)
{
g_return_val_if_fail (sicon != NULL, NULL);
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), NULL);
@@ -189,10 +189,10 @@
}
/**
- * pk_smart_icon_set_tooltip:
+ * gpk_smart_icon_set_tooltip:
**/
gboolean
-pk_smart_icon_set_tooltip (PkSmartIcon *sicon, const gchar *tooltip)
+gpk_smart_icon_set_tooltip (GpkSmartIcon *sicon, const gchar *tooltip)
{
g_return_val_if_fail (sicon != NULL, FALSE);
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), FALSE);
@@ -201,11 +201,11 @@
}
/**
- * pk_smart_icon_notify:
+ * gpk_smart_icon_notify:
**/
gboolean
-pk_smart_icon_notify_new (PkSmartIcon *sicon, const gchar *title, const gchar *message,
- const gchar *icon, PkNotifyUrgency urgency, PkNotifyTimeout timeout)
+gpk_smart_icon_notify_new (GpkSmartIcon *sicon, const gchar *title, const gchar *message,
+ const gchar *icon, GpkNotifyUrgency urgency, GpkNotifyTimeout timeout)
{
guint timeout_val = 0;
@@ -213,9 +213,9 @@
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), FALSE);
/* default values */
- if (timeout == PK_NOTIFY_TIMEOUT_SHORT) {
+ if (timeout == GPK_NOTIFY_TIMEOUT_SHORT) {
timeout_val = 5000;
- } else if (timeout == PK_NOTIFY_TIMEOUT_LONG) {
+ } else if (timeout == GPK_NOTIFY_TIMEOUT_LONG) {
timeout_val = 15000;
}
@@ -230,12 +230,12 @@
}
/**
- * pk_smart_icon_libnotify_cb:
+ * gpk_smart_icon_libnotify_cb:
**/
static void
-pk_smart_icon_libnotify_cb (NotifyNotification *dialog, gchar *action, PkSmartIcon *sicon)
+gpk_smart_icon_libnotify_cb (NotifyNotification *dialog, gchar *action, GpkSmartIcon *sicon)
{
- PkNotifyButton button;
+ GpkNotifyButton button;
g_return_if_fail (sicon != NULL);
g_return_if_fail (PK_IS_SMART_ICON (sicon));
@@ -249,10 +249,10 @@
}
/**
- * pk_smart_icon_notify_button:
+ * gpk_smart_icon_notify_button:
**/
gboolean
-pk_smart_icon_notify_button (PkSmartIcon *sicon, PkNotifyButton button, const gchar *data)
+gpk_smart_icon_notify_button (GpkSmartIcon *sicon, GpkNotifyButton button, const gchar *data)
{
const gchar *text = NULL;
const gchar *id = NULL;
@@ -264,15 +264,15 @@
id = pk_enum_find_string (enum_button_ids, button);
/* find the localised text */
- if (button == PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN) {
+ if (button == GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN) {
text = _("Do not show this notification again");
- } else if (button == PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN) {
+ } else if (button == GPK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN) {
text = _("Do not warn me again");
- } else if (button == PK_NOTIFY_BUTTON_CANCEL_UPDATE) {
+ } else if (button == GPK_NOTIFY_BUTTON_CANCEL_UPDATE) {
text = _("Cancel system update");
- } else if (button == PK_NOTIFY_BUTTON_UPDATE_COMPUTER) {
+ } else if (button == GPK_NOTIFY_BUTTON_UPDATE_COMPUTER) {
text = _("Update computer now");
- } else if (button == PK_NOTIFY_BUTTON_RESTART_COMPUTER) {
+ } else if (button == GPK_NOTIFY_BUTTON_RESTART_COMPUTER) {
text = _("Restart computer now");
}
@@ -280,15 +280,15 @@
sicon->priv->notify_data = g_strdup (data);
/* add a button to the UI */
- notify_notification_add_action (sicon->priv->dialog, id, text, (NotifyActionCallback) pk_smart_icon_libnotify_cb, sicon, NULL);
+ notify_notification_add_action (sicon->priv->dialog, id, text, (NotifyActionCallback) gpk_smart_icon_libnotify_cb, sicon, NULL);
return FALSE;
}
/**
- * pk_smart_icon_notify_show:
+ * gpk_smart_icon_notify_show:
**/
gboolean
-pk_smart_icon_notify_show (PkSmartIcon *sicon)
+gpk_smart_icon_notify_show (GpkSmartIcon *sicon)
{
GError *error = NULL;
@@ -307,10 +307,10 @@
}
/**
- * pk_smart_icon_notify_close:
+ * gpk_smart_icon_notify_close:
**/
gboolean
-pk_smart_icon_notify_close (PkSmartIcon *sicon)
+gpk_smart_icon_notify_close (GpkSmartIcon *sicon)
{
g_return_val_if_fail (sicon != NULL, FALSE);
g_return_val_if_fail (PK_IS_SMART_ICON (sicon), FALSE);
@@ -319,11 +319,11 @@
}
/**
- * pk_smart_icon_init:
+ * gpk_smart_icon_init:
* @smart_icon: This class instance
**/
static void
-pk_smart_icon_init (PkSmartIcon *sicon)
+gpk_smart_icon_init (GpkSmartIcon *sicon)
{
sicon->priv = PK_SMART_ICON_GET_PRIVATE (sicon);
sicon->priv->status_icon = gtk_status_icon_new ();
@@ -340,13 +340,13 @@
}
/**
- * pk_smart_icon_finalize:
+ * gpk_smart_icon_finalize:
* @object: The object to finalize
**/
static void
-pk_smart_icon_finalize (GObject *object)
+gpk_smart_icon_finalize (GObject *object)
{
- PkSmartIcon *sicon;
+ GpkSmartIcon *sicon;
g_return_if_fail (object != NULL);
g_return_if_fail (PK_IS_SMART_ICON (object));
@@ -364,18 +364,18 @@
g_free (sicon->priv->notify_data);
}
- G_OBJECT_CLASS (pk_smart_icon_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gpk_smart_icon_parent_class)->finalize (object);
}
/**
- * pk_smart_icon_new:
+ * gpk_smart_icon_new:
*
- * Return value: a new PkSmartIcon object.
+ * Return value: a new GpkSmartIcon object.
**/
-PkSmartIcon *
-pk_smart_icon_new (void)
+GpkSmartIcon *
+gpk_smart_icon_new (void)
{
- PkSmartIcon *sicon;
+ GpkSmartIcon *sicon;
sicon = g_object_new (PK_TYPE_SMART_ICON, NULL);
return PK_SMART_ICON (sicon);
}
Modified: trunk/src/gpk-smart-icon.h
==============================================================================
--- trunk/src/gpk-smart-icon.h (original)
+++ trunk/src/gpk-smart-icon.h Mon Mar 31 14:07:13 2008
@@ -26,71 +26,71 @@
G_BEGIN_DECLS
-#define PK_TYPE_SMART_ICON (pk_smart_icon_get_type ())
-#define PK_SMART_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_SMART_ICON, PkSmartIcon))
-#define PK_SMART_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_SMART_ICON, PkSmartIconClass))
+#define PK_TYPE_SMART_ICON (gpk_smart_icon_get_type ())
+#define PK_SMART_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_SMART_ICON, GpkSmartIcon))
+#define PK_SMART_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_SMART_ICON, GpkSmartIconClass))
#define PK_IS_SMART_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_SMART_ICON))
#define PK_IS_SMART_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_SMART_ICON))
-#define PK_SMART_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_SMART_ICON, PkSmartIconClass))
-#define PK_SMART_ICON_ERROR (pk_smart_icon_error_quark ())
-#define PK_SMART_ICON_TYPE_ERROR (pk_smart_icon_error_get_type ())
+#define PK_SMART_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_SMART_ICON, GpkSmartIconClass))
+#define PK_SMART_ICON_ERROR (gpk_smart_icon_error_quark ())
+#define PK_SMART_ICON_TYPE_ERROR (gpk_smart_icon_error_get_type ())
-typedef struct PkSmartIconPrivate PkSmartIconPrivate;
+typedef struct GpkSmartIconPrivate GpkSmartIconPrivate;
typedef struct
{
GObject parent;
- PkSmartIconPrivate *priv;
-} PkSmartIcon;
+ GpkSmartIconPrivate *priv;
+} GpkSmartIcon;
typedef struct
{
GObjectClass parent_class;
-} PkSmartIconClass;
+} GpkSmartIconClass;
typedef enum
{
- PK_NOTIFY_URGENCY_LOW,
- PK_NOTIFY_URGENCY_NORMAL,
- PK_NOTIFY_URGENCY_CRITICAL
-} PkNotifyUrgency;
+ GPK_NOTIFY_URGENCY_LOW,
+ GPK_NOTIFY_URGENCY_NORMAL,
+ GPK_NOTIFY_URGENCY_CRITICAL
+} GpkNotifyUrgency;
typedef enum
{
- PK_NOTIFY_TIMEOUT_SHORT,
- PK_NOTIFY_TIMEOUT_LONG,
- PK_NOTIFY_TIMEOUT_NEVER
-} PkNotifyTimeout;
+ GPK_NOTIFY_TIMEOUT_SHORT,
+ GPK_NOTIFY_TIMEOUT_LONG,
+ GPK_NOTIFY_TIMEOUT_NEVER
+} GpkNotifyTimeout;
typedef enum
{
- PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN,
- PK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN,
- PK_NOTIFY_BUTTON_CANCEL_UPDATE,
- PK_NOTIFY_BUTTON_UPDATE_COMPUTER,
- PK_NOTIFY_BUTTON_RESTART_COMPUTER,
- PK_NOTIFY_BUTTON_UNKNOWN
-} PkNotifyButton;
-
-GType pk_smart_icon_get_type (void);
-PkSmartIcon *pk_smart_icon_new (void);
-GtkStatusIcon *pk_smart_icon_get_status_icon (PkSmartIcon *sicon);
-gboolean pk_smart_icon_sync (PkSmartIcon *sicon);
-gboolean pk_smart_icon_set_icon_name (PkSmartIcon *sicon,
+ GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN,
+ GPK_NOTIFY_BUTTON_DO_NOT_WARN_AGAIN,
+ GPK_NOTIFY_BUTTON_CANCEL_UPDATE,
+ GPK_NOTIFY_BUTTON_UPDATE_COMPUTER,
+ GPK_NOTIFY_BUTTON_RESTART_COMPUTER,
+ GPK_NOTIFY_BUTTON_UNKNOWN
+} GpkNotifyButton;
+
+GType gpk_smart_icon_get_type (void);
+GpkSmartIcon *gpk_smart_icon_new (void);
+GtkStatusIcon *gpk_smart_icon_get_status_icon (GpkSmartIcon *sicon);
+gboolean gpk_smart_icon_sync (GpkSmartIcon *sicon);
+gboolean gpk_smart_icon_set_icon_name (GpkSmartIcon *sicon,
const gchar *icon_name);
-gboolean pk_smart_icon_set_tooltip (PkSmartIcon *sicon,
+gboolean gpk_smart_icon_set_tooltip (GpkSmartIcon *sicon,
const gchar *tooltip);
-gboolean pk_smart_icon_notify_new (PkSmartIcon *sicon,
+gboolean gpk_smart_icon_notify_new (GpkSmartIcon *sicon,
const gchar *title,
const gchar *message,
const gchar *icon,
- PkNotifyUrgency urgency,
- PkNotifyTimeout timeout);
-gboolean pk_smart_icon_notify_button (PkSmartIcon *sicon,
- PkNotifyButton button,
+ GpkNotifyUrgency urgency,
+ GpkNotifyTimeout timeout);
+gboolean gpk_smart_icon_notify_button (GpkSmartIcon *sicon,
+ GpkNotifyButton button,
const gchar *data);
-gboolean pk_smart_icon_notify_show (PkSmartIcon *sicon);
-gboolean pk_smart_icon_notify_close (PkSmartIcon *sicon);
+gboolean gpk_smart_icon_notify_show (GpkSmartIcon *sicon);
+gboolean gpk_smart_icon_notify_close (GpkSmartIcon *sicon);
G_END_DECLS
Modified: trunk/src/gpk-update-icon.c
==============================================================================
--- trunk/src/gpk-update-icon.c (original)
+++ trunk/src/gpk-update-icon.c Mon Mar 31 14:07:13 2008
@@ -45,8 +45,8 @@
GMainLoop *loop;
gboolean verbose = FALSE;
gboolean program_version = FALSE;
- PkNotify *notify = NULL;
- PkWatch *watch = NULL;
+ GpkNotify *notify = NULL;
+ GpkWatch *watch = NULL;
GOptionContext *context;
const GOptionEntry options[] = {
@@ -89,8 +89,8 @@
PK_DATA G_DIR_SEPARATOR_S "icons");
/* create a new notify object */
- notify = pk_notify_new ();
- watch = pk_watch_new ();
+ notify = gpk_notify_new ();
+ watch = gpk_watch_new ();
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
g_main_loop_unref (loop);
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Mon Mar 31 14:07:13 2008
@@ -36,6 +36,7 @@
#include <pk-debug.h>
#include <pk-client.h>
+#include <pk-notify.h>
#include <pk-common.h>
#include <pk-task-list.h>
#include <pk-connection.h>
@@ -522,8 +523,8 @@
GError *error = NULL;
/* FIXME: do this in process */
- if (!g_spawn_command_line_async ("pk-transaction-viewer", &error)) {
- pk_error_modal_dialog (_("Failed to launch transaction viewer"),
+ if (!g_spawn_command_line_async ("gpk-log", &error)) {
+ pk_error_modal_dialog (_("Failed to launch gpk-log"),
error->message);
g_error_free (error);
}
@@ -1522,6 +1523,7 @@
GtkWidget *button;
PolKitAction *pk_action;
GError *error = NULL;
+ PkNotify *notify;
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
@@ -1595,7 +1597,9 @@
G_CALLBACK (pk_updates_error_code_cb), NULL);
g_signal_connect (client_action, "allow-cancel",
G_CALLBACK (pk_updates_allow_cancel_cb), NULL);
- g_signal_connect (client_action, "updates-changed",
+
+ notify = pk_notify_new ();
+ g_signal_connect (notify, "repo-list-changed",
G_CALLBACK (pk_updates_changed_cb), NULL);
/* get actions */
@@ -1844,6 +1848,7 @@
g_object_unref (list_store_details);
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 Mon Mar 31 14:07:13 2008
@@ -53,18 +53,18 @@
#include "gpk-inhibit.h"
#include "gpk-smart-icon.h"
-static void pk_watch_class_init (PkWatchClass *klass);
-static void pk_watch_init (PkWatch *watch);
-static void pk_watch_finalize (GObject *object);
+static void gpk_watch_class_init (GpkWatchClass *klass);
+static void gpk_watch_init (GpkWatch *watch);
+static void gpk_watch_finalize (GObject *object);
-#define PK_WATCH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_WATCH, PkWatchPrivate))
-#define PK_WATCH_MAXIMUM_TOOLTIP_LINES 10
+#define GPK_WATCH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_WATCH, GpkWatchPrivate))
+#define GPK_WATCH_MAXIMUM_TOOLTIP_LINES 10
-struct PkWatchPrivate
+struct GpkWatchPrivate
{
PkClient *client;
- PkSmartIcon *sicon;
- PkSmartIcon *sicon_restart;
+ GpkSmartIcon *sicon;
+ GpkSmartIcon *sicon_restart;
PkInhibit *inhibit;
PkConnection *pconnection;
PkTaskList *tlist;
@@ -73,25 +73,25 @@
PolKitGnomeAction *restart_action;
};
-G_DEFINE_TYPE (PkWatch, pk_watch, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GpkWatch, gpk_watch, G_TYPE_OBJECT)
/**
- * pk_watch_class_init:
- * @klass: The PkWatchClass
+ * gpk_watch_class_init:
+ * @klass: The GpkWatchClass
**/
static void
-pk_watch_class_init (PkWatchClass *klass)
+gpk_watch_class_init (GpkWatchClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_watch_finalize;
- g_type_class_add_private (klass, sizeof (PkWatchPrivate));
+ object_class->finalize = gpk_watch_finalize;
+ g_type_class_add_private (klass, sizeof (GpkWatchPrivate));
}
/**
- * pk_watch_refresh_tooltip:
+ * gpk_watch_refresh_tooltip:
**/
static gboolean
-pk_watch_refresh_tooltip (PkWatch *watch)
+gpk_watch_refresh_tooltip (GpkWatch *watch)
{
guint i;
PkTaskListItem *item;
@@ -101,12 +101,12 @@
const gchar *localised_status;
g_return_val_if_fail (watch != NULL, FALSE);
- g_return_val_if_fail (PK_IS_WATCH (watch), FALSE);
+ g_return_val_if_fail (GPK_IS_WATCH (watch), FALSE);
length = pk_task_list_get_size (watch->priv->tlist);
pk_debug ("refresh tooltip %i", length);
if (length == 0) {
- pk_smart_icon_set_tooltip (watch->priv->sicon, "Doing nothing...");
+ gpk_smart_icon_set_tooltip (watch->priv->sicon, "Doing nothing...");
return TRUE;
}
status = g_string_new ("");
@@ -128,9 +128,9 @@
g_free (text);
}
/* don't fill the screen with a giant tooltip */
- if (i > PK_WATCH_MAXIMUM_TOOLTIP_LINES) {
+ if (i > GPK_WATCH_MAXIMUM_TOOLTIP_LINES) {
g_string_append_printf (status, _("(%i more transactions)\n"),
- i - PK_WATCH_MAXIMUM_TOOLTIP_LINES);
+ i - GPK_WATCH_MAXIMUM_TOOLTIP_LINES);
break;
}
}
@@ -139,16 +139,16 @@
} else {
g_string_set_size (status, status->len-1);
}
- pk_smart_icon_set_tooltip (watch->priv->sicon, status->str);
+ gpk_smart_icon_set_tooltip (watch->priv->sicon, status->str);
g_string_free (status, TRUE);
return TRUE;
}
/**
- * pk_watch_task_list_to_state_enum_list:
+ * gpk_watch_task_list_to_state_enum_list:
**/
static PkEnumList *
-pk_watch_task_list_to_state_enum_list (PkWatch *watch)
+gpk_watch_task_list_to_state_enum_list (GpkWatch *watch)
{
guint i;
guint length;
@@ -156,7 +156,7 @@
PkTaskListItem *item;
g_return_val_if_fail (watch != NULL, NULL);
- g_return_val_if_fail (PK_IS_WATCH (watch), NULL);
+ g_return_val_if_fail (GPK_IS_WATCH (watch), NULL);
/* shortcut */
length = pk_task_list_get_size (watch->priv->tlist);
@@ -182,25 +182,25 @@
}
/**
- * pk_watch_refresh_icon:
+ * gpk_watch_refresh_icon:
**/
static gboolean
-pk_watch_refresh_icon (PkWatch *watch)
+gpk_watch_refresh_icon (GpkWatch *watch)
{
const gchar *icon;
PkEnumList *elist;
gint value;
g_return_val_if_fail (watch != NULL, FALSE);
- g_return_val_if_fail (PK_IS_WATCH (watch), FALSE);
+ g_return_val_if_fail (GPK_IS_WATCH (watch), FALSE);
pk_debug ("rescan");
- elist = pk_watch_task_list_to_state_enum_list (watch);
+ elist = gpk_watch_task_list_to_state_enum_list (watch);
/* nothing in the list */
if (elist == NULL) {
pk_debug ("no activity");
- pk_smart_icon_set_icon_name (watch->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon, NULL);
return TRUE;
}
@@ -227,7 +227,7 @@
/* only set if in the list and not unknown */
if (value != PK_STATUS_ENUM_UNKNOWN && value != -1) {
icon = pk_status_enum_to_icon_name (value);
- pk_smart_icon_set_icon_name (watch->priv->sicon, icon);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon, icon);
}
g_object_unref (elist);
@@ -235,13 +235,13 @@
}
/**
- * pk_watch_task_list_changed_cb:
+ * gpk_watch_task_list_changed_cb:
**/
static void
-pk_watch_task_list_changed_cb (PkTaskList *tlist, PkWatch *watch)
+gpk_watch_task_list_changed_cb (PkTaskList *tlist, GpkWatch *watch)
{
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ 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_SYSTEM)) {
@@ -250,15 +250,15 @@
watch->priv->show_refresh_in_menu = TRUE;
}
- pk_watch_refresh_icon (watch);
- pk_watch_refresh_tooltip (watch);
+ gpk_watch_refresh_icon (watch);
+ gpk_watch_refresh_tooltip (watch);
}
/**
- * pk_watch_finished_cb:
+ * gpk_watch_finished_cb:
**/
static void
-pk_watch_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, PkWatch *watch)
+gpk_watch_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, GpkWatch *watch)
{
gboolean ret;
gboolean value;
@@ -271,7 +271,7 @@
const gchar *icon_name;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
/* get the role */
ret = pk_client_get_role (client, &role, &package_id, NULL);
@@ -290,8 +290,8 @@
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);
+ gpk_smart_icon_set_tooltip (watch->priv->sicon_restart, restart_message);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon_restart, icon_name);
}
}
@@ -332,19 +332,19 @@
}
/* libnotify dialog */
- pk_smart_icon_notify_new (watch->priv->sicon, _("Task completed"), message,
- "help-browser", PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_SHORT);
- pk_smart_icon_notify_button (watch->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_COMPLETED);
- pk_smart_icon_notify_show (watch->priv->sicon);
+ gpk_smart_icon_notify_new (watch->priv->sicon, _("Task completed"), message,
+ "help-browser", GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_SHORT);
+ gpk_smart_icon_notify_button (watch->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_COMPLETED);
+ gpk_smart_icon_notify_show (watch->priv->sicon);
g_free (message);
g_free (package_id);
}
/**
- * pk_watch_error_code_cb:
+ * gpk_watch_error_code_cb:
**/
static void
-pk_watch_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, PkWatch *watch)
+gpk_watch_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, GpkWatch *watch)
{
gchar *escaped_details;
const gchar *title;
@@ -352,7 +352,7 @@
gboolean value;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
title = pk_error_enum_to_localised_text (error_code);
@@ -384,18 +384,18 @@
/* we need to format this */
escaped_details = g_markup_escape_text (details, -1);
- pk_smart_icon_notify_new (watch->priv->sicon, title, escaped_details, "help-browser",
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_LONG);
- pk_smart_icon_notify_button (watch->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
- pk_smart_icon_notify_show (watch->priv->sicon);
+ gpk_smart_icon_notify_new (watch->priv->sicon, title, escaped_details, "help-browser",
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_LONG);
+ gpk_smart_icon_notify_button (watch->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_ERROR);
+ gpk_smart_icon_notify_show (watch->priv->sicon);
g_free (escaped_details);
}
/**
- * pk_watch_message_cb:
+ * gpk_watch_message_cb:
**/
static void
-pk_watch_message_cb (PkClient *client, PkMessageEnum message, const gchar *details, PkWatch *watch)
+gpk_watch_message_cb (PkClient *client, PkMessageEnum message, const gchar *details, GpkWatch *watch)
{
const gchar *title;
const gchar *filename;
@@ -403,7 +403,7 @@
gboolean value;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
/* are we accepting notifications */
value = gconf_client_get_bool (watch->priv->gconf_client, PK_CONF_NOTIFY_MESSAGE, NULL);
@@ -418,18 +418,18 @@
/* we need to format this */
escaped_details = g_markup_escape_text (details, -1);
- pk_smart_icon_notify_new (watch->priv->sicon, title, escaped_details, filename,
- PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_NEVER);
- pk_smart_icon_notify_button (watch->priv->sicon, PK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_MESSAGE);
- pk_smart_icon_notify_show (watch->priv->sicon);
+ gpk_smart_icon_notify_new (watch->priv->sicon, title, escaped_details, filename,
+ GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_NEVER);
+ gpk_smart_icon_notify_button (watch->priv->sicon, GPK_NOTIFY_BUTTON_DO_NOT_SHOW_AGAIN, PK_CONF_NOTIFY_MESSAGE);
+ gpk_smart_icon_notify_show (watch->priv->sicon);
g_free (escaped_details);
}
/**
- * pk_watch_about_dialog_url_cb:
+ * gpk_watch_about_dialog_url_cb:
**/
static void
-pk_watch_about_dialog_url_cb (GtkAboutDialog *about, const char *address, gpointer data)
+gpk_watch_about_dialog_url_cb (GtkAboutDialog *about, const char *address, gpointer data)
{
GError *error = NULL;
gboolean ret;
@@ -472,10 +472,10 @@
}
/**
- * pk_watch_show_about_cb:
+ * gpk_watch_show_about_cb:
**/
static void
-pk_watch_show_about_cb (GtkMenuItem *item, gpointer data)
+gpk_watch_show_about_cb (GtkMenuItem *item, gpointer data)
{
static gboolean been_here = FALSE;
const char *authors[] = {
@@ -513,8 +513,8 @@
/* FIXME: unnecessary with libgnomeui >= 2.16.0 */
if (!been_here) {
been_here = TRUE;
- gtk_about_dialog_set_url_hook (pk_watch_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (pk_watch_about_dialog_url_cb, "mailto:", NULL);
+ gtk_about_dialog_set_url_hook (gpk_watch_about_dialog_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (gpk_watch_about_dialog_url_cb, "mailto:", NULL);
}
gtk_window_set_default_icon_name ("system-software-installer");
@@ -534,22 +534,22 @@
}
/**
- * pk_watch_popup_menu_cb:
+ * gpk_watch_popup_menu_cb:
*
* Display the popup menu.
**/
static void
-pk_watch_popup_menu_cb (GtkStatusIcon *status_icon,
+gpk_watch_popup_menu_cb (GtkStatusIcon *status_icon,
guint button,
guint32 timestamp,
- PkWatch *watch)
+ GpkWatch *watch)
{
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
GtkWidget *item;
GtkWidget *image;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("icon right clicked");
/* About */
@@ -557,7 +557,7 @@
image = gtk_image_new_from_icon_name (GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (pk_watch_show_about_cb), watch);
+ G_CALLBACK (gpk_watch_show_about_cb), watch);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
/* show the menu */
@@ -571,45 +571,45 @@
}
/**
- * pk_watch_refresh_cache_finished_cb:
+ * gpk_watch_refresh_cache_finished_cb:
**/
static void
-pk_watch_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, PkWatch *watch)
+gpk_watch_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, GpkWatch *watch)
{
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("unreffing client %p", client);
g_object_unref (client);
}
/**
- * pk_watch_restart_cb:
+ * gpk_watch_restart_cb:
**/
static void
-pk_watch_restart_cb (PolKitGnomeAction *action, gpointer data)
+gpk_watch_restart_cb (PolKitGnomeAction *action, gpointer data)
{
pk_restart_system ();
}
/**
- * pk_watch_refresh_cache_cb:
+ * gpk_watch_refresh_cache_cb:
**/
static void
-pk_watch_refresh_cache_cb (GtkMenuItem *item, gpointer data)
+gpk_watch_refresh_cache_cb (GtkMenuItem *item, gpointer data)
{
gboolean ret;
- PkWatch *watch = PK_WATCH (data);
+ GpkWatch *watch = GPK_WATCH (data);
PkClient *client;
GError *error = NULL;
gchar *message;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("refresh cache");
client = pk_client_new ();
g_signal_connect (client, "finished",
- G_CALLBACK (pk_watch_refresh_cache_finished_cb), watch);
+ G_CALLBACK (gpk_watch_refresh_cache_finished_cb), watch);
ret = pk_client_refresh_cache (client, TRUE, NULL);
if (ret == FALSE) {
@@ -617,10 +617,10 @@
pk_warning ("failed to refresh cache: %s", error->message);
message = g_strdup_printf (_("Client action was refused: %s"), error->message);
g_error_free (error);
- pk_smart_icon_notify_new (watch->priv->sicon, _("Failed to refresh cache"), message,
- "process-stop", PK_NOTIFY_URGENCY_LOW, PK_NOTIFY_TIMEOUT_SHORT);
+ gpk_smart_icon_notify_new (watch->priv->sicon, _("Failed to refresh cache"), message,
+ "process-stop", GPK_NOTIFY_URGENCY_LOW, GPK_NOTIFY_TIMEOUT_SHORT);
g_free (message);
- pk_smart_icon_notify_show (watch->priv->sicon);
+ gpk_smart_icon_notify_show (watch->priv->sicon);
}
}
@@ -628,25 +628,25 @@
* pk_monitor_action_unref_cb:
**/
static void
-pk_monitor_action_unref_cb (PkProgress *progress, PkWatch *watch)
+pk_monitor_action_unref_cb (PkProgress *progress, GpkWatch *watch)
{
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
g_object_unref (progress);
}
/**
- * pk_watch_menu_job_status_cb:
+ * gpk_watch_menu_job_status_cb:
**/
static void
-pk_watch_menu_job_status_cb (GtkMenuItem *item, PkWatch *watch)
+gpk_watch_menu_job_status_cb (GtkMenuItem *item, GpkWatch *watch)
{
gchar *tid;
PkProgress *progress = NULL;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
/* find the job we should bind to */
tid = (gchar *) g_object_get_data (G_OBJECT (item), "tid");
@@ -659,10 +659,10 @@
}
/**
- * pk_watch_populate_menu_with_jobs:
+ * gpk_watch_populate_menu_with_jobs:
**/
static void
-pk_watch_populate_menu_with_jobs (PkWatch *watch, GtkMenu *menu)
+gpk_watch_populate_menu_with_jobs (GpkWatch *watch, GtkMenu *menu)
{
guint i;
PkTaskListItem *item;
@@ -676,7 +676,7 @@
guint length;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
length = pk_task_list_get_size (watch->priv->tlist);
if (length == 0) {
@@ -711,33 +711,33 @@
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
g_signal_connect (G_OBJECT (widget), "activate",
- G_CALLBACK (pk_watch_menu_job_status_cb), watch);
+ G_CALLBACK (gpk_watch_menu_job_status_cb), watch);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
g_free (text);
}
}
/**
- * pk_watch_activate_status_cb:
+ * gpk_watch_activate_status_cb:
* @button: Which buttons are pressed
*
* Callback when the icon is clicked
**/
static void
-pk_watch_activate_status_cb (GtkStatusIcon *status_icon,
- PkWatch *watch)
+gpk_watch_activate_status_cb (GtkStatusIcon *status_icon,
+ GpkWatch *watch)
{
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
GtkWidget *widget;
GtkWidget *image;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("icon left clicked");
/* add jobs as drop down */
- pk_watch_populate_menu_with_jobs (watch, menu);
+ gpk_watch_populate_menu_with_jobs (watch, menu);
/* force a refresh if we are not updating or refreshing */
if (watch->priv->show_refresh_in_menu) {
@@ -751,7 +751,7 @@
image = gtk_image_new_from_icon_name ("view-refresh", GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
g_signal_connect (G_OBJECT (widget), "activate",
- G_CALLBACK (pk_watch_refresh_cache_cb), watch);
+ G_CALLBACK (gpk_watch_refresh_cache_cb), watch);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
}
@@ -763,35 +763,35 @@
}
/**
- * pk_watch_hide_restart_cb:
+ * gpk_watch_hide_restart_cb:
**/
static void
-pk_watch_hide_restart_cb (GtkMenuItem *item, gpointer data)
+gpk_watch_hide_restart_cb (GtkMenuItem *item, gpointer data)
{
- PkWatch *watch = PK_WATCH (data);
+ GpkWatch *watch = GPK_WATCH (data);
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
/* just hide it */
- pk_smart_icon_set_icon_name (watch->priv->sicon_restart, NULL);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon_restart, NULL);
}
/**
- * pk_watch_activate_status_restart_cb:
+ * gpk_watch_activate_status_restart_cb:
* @button: Which buttons are pressed
*
* Callback when the icon is clicked
**/
static void
-pk_watch_activate_status_restart_cb (GtkStatusIcon *status_icon, PkWatch *watch)
+gpk_watch_activate_status_restart_cb (GtkStatusIcon *status_icon, GpkWatch *watch)
{
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
GtkWidget *widget;
GtkWidget *image;
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("icon left clicked");
@@ -804,7 +804,7 @@
image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
g_signal_connect (G_OBJECT (widget), "activate",
- G_CALLBACK (pk_watch_hide_restart_cb), watch);
+ G_CALLBACK (gpk_watch_hide_restart_cb), watch);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
/* show the menu */
@@ -818,27 +818,27 @@
* pk_connection_changed_cb:
**/
static void
-pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkWatch *watch)
+pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, GpkWatch *watch)
{
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("connected=%i", connected);
if (connected) {
- pk_watch_refresh_icon (watch);
- pk_watch_refresh_tooltip (watch);
+ gpk_watch_refresh_icon (watch);
+ gpk_watch_refresh_tooltip (watch);
} else {
- pk_smart_icon_set_icon_name (watch->priv->sicon, NULL);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon, NULL);
}
}
/**
- * pk_watch_locked_cb:
+ * gpk_watch_locked_cb:
**/
static void
-pk_watch_locked_cb (PkClient *client, gboolean is_locked, PkWatch *watch)
+gpk_watch_locked_cb (PkClient *client, gboolean is_locked, GpkWatch *watch)
{
g_return_if_fail (watch != NULL);
- g_return_if_fail (PK_IS_WATCH (watch));
+ g_return_if_fail (GPK_IS_WATCH (watch));
pk_debug ("setting locked %i, doing g-p-m (un)inhibit", is_locked);
if (is_locked) {
@@ -849,53 +849,53 @@
}
/**
- * pk_watch_init:
+ * gpk_watch_init:
* @watch: This class instance
**/
static void
-pk_watch_init (PkWatch *watch)
+gpk_watch_init (GpkWatch *watch)
{
GtkStatusIcon *status_icon;
PolKitAction *pk_action;
PolKitGnomeAction *restart_action;
- watch->priv = PK_WATCH_GET_PRIVATE (watch);
+ watch->priv = GPK_WATCH_GET_PRIVATE (watch);
watch->priv->show_refresh_in_menu = TRUE;
watch->priv->gconf_client = gconf_client_get_default ();
- watch->priv->sicon = pk_smart_icon_new ();
- watch->priv->sicon_restart = pk_smart_icon_new ();
+ watch->priv->sicon = gpk_smart_icon_new ();
+ 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",
- G_CALLBACK (pk_watch_locked_cb), watch);
+ G_CALLBACK (gpk_watch_locked_cb), watch);
g_signal_connect (watch->priv->client, "finished",
- G_CALLBACK (pk_watch_finished_cb), watch);
+ G_CALLBACK (gpk_watch_finished_cb), watch);
g_signal_connect (watch->priv->client, "error-code",
- G_CALLBACK (pk_watch_error_code_cb), watch);
+ G_CALLBACK (gpk_watch_error_code_cb), watch);
g_signal_connect (watch->priv->client, "message",
- G_CALLBACK (pk_watch_message_cb), watch);
+ G_CALLBACK (gpk_watch_message_cb), watch);
/* do session inhibit */
watch->priv->inhibit = pk_inhibit_new ();
/* right click actions are common */
- status_icon = pk_smart_icon_get_status_icon (watch->priv->sicon);
+ status_icon = gpk_smart_icon_get_status_icon (watch->priv->sicon);
g_signal_connect_object (G_OBJECT (status_icon),
- "popup_menu", G_CALLBACK (pk_watch_popup_menu_cb), watch, 0);
+ "popup_menu", G_CALLBACK (gpk_watch_popup_menu_cb), watch, 0);
g_signal_connect_object (G_OBJECT (status_icon),
- "activate", G_CALLBACK (pk_watch_activate_status_cb), watch, 0);
+ "activate", G_CALLBACK (gpk_watch_activate_status_cb), watch, 0);
/* provide the user with a way to restart */
- status_icon = pk_smart_icon_get_status_icon (watch->priv->sicon_restart);
+ status_icon = gpk_smart_icon_get_status_icon (watch->priv->sicon_restart);
g_signal_connect_object (G_OBJECT (status_icon),
- "activate", G_CALLBACK (pk_watch_activate_status_restart_cb), watch, 0);
+ "activate", G_CALLBACK (gpk_watch_activate_status_restart_cb), watch, 0);
watch->priv->tlist = pk_task_list_new ();
g_signal_connect (watch->priv->tlist, "task-list-changed",
- G_CALLBACK (pk_watch_task_list_changed_cb), watch);
+ G_CALLBACK (gpk_watch_task_list_changed_cb), watch);
watch->priv->pconnection = pk_connection_new ();
g_signal_connect (watch->priv->pconnection, "connection-changed",
@@ -919,23 +919,23 @@
NULL);
polkit_action_unref (pk_action);
g_signal_connect (restart_action, "activate",
- G_CALLBACK (pk_watch_restart_cb), NULL);
+ G_CALLBACK (gpk_watch_restart_cb), NULL);
watch->priv->restart_action = restart_action;
}
/**
- * pk_watch_finalize:
+ * gpk_watch_finalize:
* @object: The object to finalize
**/
static void
-pk_watch_finalize (GObject *object)
+gpk_watch_finalize (GObject *object)
{
- PkWatch *watch;
+ GpkWatch *watch;
g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_WATCH (object));
+ g_return_if_fail (GPK_IS_WATCH (object));
- watch = PK_WATCH (object);
+ watch = GPK_WATCH (object);
g_return_if_fail (watch->priv != NULL);
g_object_unref (watch->priv->sicon);
@@ -946,19 +946,19 @@
g_object_unref (watch->priv->gconf_client);
g_object_unref (watch->priv->restart_action);
- G_OBJECT_CLASS (pk_watch_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gpk_watch_parent_class)->finalize (object);
}
/**
- * pk_watch_new:
+ * gpk_watch_new:
*
- * Return value: a new PkWatch object.
+ * Return value: a new GpkWatch object.
**/
-PkWatch *
-pk_watch_new (void)
+GpkWatch *
+gpk_watch_new (void)
{
- PkWatch *watch;
- watch = g_object_new (PK_TYPE_WATCH, NULL);
- return PK_WATCH (watch);
+ GpkWatch *watch;
+ watch = g_object_new (GPK_TYPE_WATCH, NULL);
+ return GPK_WATCH (watch);
}
Modified: trunk/src/gpk-watch.h
==============================================================================
--- trunk/src/gpk-watch.h (original)
+++ trunk/src/gpk-watch.h Mon Mar 31 14:07:13 2008
@@ -19,38 +19,38 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __PK_WATCH_H
-#define __PK_WATCH_H
+#ifndef __GPK_WATCH_H
+#define __GPK_WATCH_H
#include <glib-object.h>
G_BEGIN_DECLS
-#define PK_TYPE_WATCH (pk_watch_get_type ())
-#define PK_WATCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_WATCH, PkWatch))
-#define PK_WATCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_WATCH, PkWatchClass))
-#define PK_IS_WATCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_WATCH))
-#define PK_IS_WATCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_WATCH))
-#define PK_WATCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_WATCH, PkWatchClass))
-#define PK_WATCH_ERROR (pk_watch_error_quark ())
-#define PK_WATCH_TYPE_ERROR (pk_watch_error_get_type ())
+#define GPK_TYPE_WATCH (gpk_watch_get_type ())
+#define GPK_WATCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPK_TYPE_WATCH, GpkWatch))
+#define GPK_WATCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPK_TYPE_WATCH, GpkWatchClass))
+#define GPK_IS_WATCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPK_TYPE_WATCH))
+#define GPK_IS_WATCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPK_TYPE_WATCH))
+#define GPK_WATCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPK_TYPE_WATCH, GpkWatchClass))
+#define GPK_WATCH_ERROR (gpk_watch_error_quark ())
+#define GPK_WATCH_TYPE_ERROR (gpk_watch_error_get_type ())
-typedef struct PkWatchPrivate PkWatchPrivate;
+typedef struct GpkWatchPrivate GpkWatchPrivate;
typedef struct
{
GObject parent;
- PkWatchPrivate *priv;
-} PkWatch;
+ GpkWatchPrivate *priv;
+} GpkWatch;
typedef struct
{
GObjectClass parent_class;
-} PkWatchClass;
+} GpkWatchClass;
-GType pk_watch_get_type (void);
-PkWatch *pk_watch_new (void);
+GType gpk_watch_get_type (void);
+GpkWatch *gpk_watch_new (void);
G_END_DECLS
-#endif /* __PK_WATCH_H */
+#endif /* __GPK_WATCH_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]