gnome-packagekit r466 - in trunk: . data docs man po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r466 - in trunk: . data docs man po src
- Date: Thu, 8 Jan 2009 11:21:07 +0000 (UTC)
Author: rhughes
Date: Thu Jan 8 11:21:07 2009
New Revision: 466
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=466&view=rev
Log:
from git
Modified:
trunk/.gitignore
trunk/NEWS
trunk/configure.ac
trunk/data/gnome-packagekit.schemas.in
trunk/data/gpk-application.glade
trunk/data/gpk-prefs.glade
trunk/docs/Makefile.am
trunk/man/.gitignore
trunk/po/.gitignore
trunk/src/.gitignore
trunk/src/Makefile.am
trunk/src/egg-console-kit.c
trunk/src/egg-console-kit.h
trunk/src/egg-dbus-monitor.c
trunk/src/egg-debug.h
trunk/src/egg-test.c
trunk/src/egg-test.h
trunk/src/egg-unique.c
trunk/src/gpk-application.c
trunk/src/gpk-auto-refresh.c
trunk/src/gpk-check-update.c
trunk/src/gpk-client-chooser.c
trunk/src/gpk-client-dialog.c
trunk/src/gpk-client-eula.c
trunk/src/gpk-client-run.c
trunk/src/gpk-client-signature.c
trunk/src/gpk-client-untrusted.c
trunk/src/gpk-client.c
trunk/src/gpk-client.h
trunk/src/gpk-common.c
trunk/src/gpk-common.h
trunk/src/gpk-consolekit.c
trunk/src/gpk-dbus.c
trunk/src/gpk-dbus.h
trunk/src/gpk-error.c
trunk/src/gpk-firmware.c
trunk/src/gpk-gnome.c
trunk/src/gpk-hardware.c
trunk/src/gpk-inhibit.c
trunk/src/gpk-language.c
trunk/src/gpk-log.c
trunk/src/gpk-prefs.c
trunk/src/gpk-repo.c
trunk/src/gpk-self-test.c
trunk/src/gpk-smart-icon.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-vendor.c
trunk/src/gpk-watch.c
trunk/src/gpk-x11.c
trunk/src/org.freedesktop.PackageKit.xml
Modified: trunk/.gitignore
==============================================================================
--- trunk/.gitignore (original)
+++ trunk/.gitignore Thu Jan 8 11:21:07 2009
@@ -32,4 +32,6 @@
NEWS.new
packagekit-gnome.pc
gtk-doc.make
+py-compile
+*.patch
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Jan 8 11:21:07 2009
@@ -1,3 +1,40 @@
+Version 0.4.0
+~~~~~~~~~~~~~
+Released: 2008-12-09
+
+* Translations
+ - Added Traditional Chinese translation(Hong Kong) (Chao-Hsiung Liao)
+ - Added Traditional Chinese translation(Taiwan) (Chao-Hsiung Liao)
+ - Updated Swedish translation (Daniel Nylander)
+ - Updated Italian translation (Gianvito Cavasoli)
+ - Updated Catalan translation (Gil Forcada)
+ - Updated Brazilian Portuguese translation (Igor Pires Soares)
+ - Updated Danish translation (Kenneth Nielsen)
+
+* New Features:
+ - Add InstallFonts to the session DBUS interface (Richard Hughes)
+ - Add a key to gnome-settings-daemon GConf so we can load the gtk module (Richard Hughes)
+ - Add a fontconfig dep for the new font code (Richard Hughes)
+ - Show the menu path in Add/Remove programs when we install new software (Sylvain Baubeau)
+ - Add two prototype interfaces to make the session interface more sane (Richard Hughes)
+
+* Bugfix:
+ - Show the 'Force Install' button on the unsigned dialog UI (Richard Hughes)
+ - Fix the self tests in GpkCommon (Richard Hughes)
+ - Set the dialog type up in a setup function, and then present it like a normal
+ window -- fixes funny icons in different places (Richard Hughes)
+ - Don't clear the list in gpk-repo when the list is refreshed, just update it in place.
+ Use the same approach in gpk-log. Fixed first part of fd#18733 (Richard Hughes)
+ - Don't abort with an error if we are using small form factor mode (Richard Hughes)
+ - Convert the iso639 language codes to localised language names (Richard Hughes)
+ - Add ISO639-2B language names to the language hash also (Richard Hughes)
+ - Don't emit a critical warning if the desktop file contains invalid markup (Richard Hughes)
+ - Set the run window modal over the parent window to fix rh#475046 (Richard Hughes)
+ - Set an interaction mode in gpk-application when we refresh the package lists to
+ avoid getting an empty window (Richard Hughes)
+ - Set the run window modal over the parent window to fix rh#475046 (Richard Hughes)
+ - Don't send signal during object init - upper layers need to hook up first (Scott Reeves)
+
Version 0.3.11
~~~~~~~~~~~~~~
Released: 2008-11-24
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Jan 8 11:21:07 2009
@@ -4,6 +4,7 @@
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
+AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PROG_INSTALL
@@ -27,11 +28,31 @@
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------
if test "$GCC" = "yes"; then
- CPPFLAGS="$CPPFLAGS -Werror -Wcast-align -Wno-uninitialized"
- CPPFLAGS="$CPPFLAGS -Wall -Wformat-security"
# CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
CPPFLAGS="$CPPFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+ CPPFLAGS="$CPPFLAGS -Wall -Wreturn-type"
+ CPPFLAGS="$CPPFLAGS -Werror"
+# CPPFLAGS="$CPPFLAGS -Wextra"
+ CPPFLAGS="$CPPFLAGS -Wdeclaration-after-statement"
+# CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
+ CPPFLAGS="$CPPFLAGS -Wno-uninitialized"
+ CPPFLAGS="$CPPFLAGS -Wredundant-decls"
+ CPPFLAGS="$CPPFLAGS -Wmissing-noreturn"
+ CPPFLAGS="$CPPFLAGS -Wshadow"
+ CPPFLAGS="$CPPFLAGS -Wpointer-arith"
+ CPPFLAGS="$CPPFLAGS -Wcast-align"
+ CPPFLAGS="$CPPFLAGS -Wwrite-strings"
+ CPPFLAGS="$CPPFLAGS -Winline"
+ CPPFLAGS="$CPPFLAGS -Wformat-nonliteral"
+ CPPFLAGS="$CPPFLAGS -Wformat-security"
+# CPPFLAGS="$CPPFLAGS -Wswitch-enum"
+ CPPFLAGS="$CPPFLAGS -Wswitch-default"
+ CPPFLAGS="$CPPFLAGS -Winit-self"
+ CPPFLAGS="$CPPFLAGS -Wmissing-include-dirs"
+ CPPFLAGS="$CPPFLAGS -Wundef"
+ CPPFLAGS="$CPPFLAGS -Waggregate-return"
+ CPPFLAGS="$CPPFLAGS -Wmissing-format-attribute"
fi
dnl ---------------------------------------------------------------------------
@@ -41,6 +62,11 @@
CPPFLAGS="$CPPFLAGS -fexceptions"
dnl ---------------------------------------------------------------------------
+dnl - xsltproc
+dnl ---------------------------------------------------------------------------
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+dnl ---------------------------------------------------------------------------
dnl - gettext stuff
dnl ---------------------------------------------------------------------------
GETTEXT_PACKAGE=AC_PACKAGE_NAME
@@ -99,12 +125,6 @@
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
-OLDCPPFLAGS=$CPPFLAGS
-CPPFLAGS=$GIO_CFLAGS
-LIBS=$GIO_LIBS
-AC_CHECK_FUNCS(g_file_make_directory_with_parents)
-CPPFLAGS=$OLDCPPFLAGS
-
PKG_CHECK_MODULES(DBUS, \
dbus-glib-1 >= $DBUS_GLIB_REQUIRED \
dbus-1 >= $DBUS_REQUIRED \
@@ -142,6 +162,24 @@
AC_SUBST(GNOME_MENUS_CFLAGS)
AC_SUBST(GNOME_MENUS_LIBS)
+dnl ---------------------------------------------------------------------------
+dnl - Check for g_file_make_directory_with_parents
+dnl ---------------------------------------------------------------------------
+OLDCPPFLAGS=$CPPFLAGS
+CPPFLAGS=$GIO_CFLAGS
+LIBS=$GIO_LIBS
+AC_CHECK_FUNCS(g_file_make_directory_with_parents)
+CPPFLAGS=$OLDCPPFLAGS
+
+dnl ---------------------------------------------------------------------------
+dnl - Check for gtk_dialog_get_action_area
+dnl ---------------------------------------------------------------------------
+OLDCPPFLAGS=$CPPFLAGS
+CPPFLAGS=$GTK_CFLAGS
+LIBS=$GTK_LIBS
+AC_CHECK_FUNCS(gtk_dialog_get_action_area)
+CPPFLAGS=$OLDCPPFLAGS
+
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_GCONF_SOURCE_2
@@ -249,6 +287,7 @@
po/Makefile.in
data/Makefile
docs/Makefile
+docs/dbus/Makefile
data/icons/Makefile
data/icons/16x16/Makefile
data/icons/22x22/Makefile
Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in (original)
+++ trunk/data/gnome-packagekit.schemas.in Thu Jan 8 11:21:07 2009
@@ -194,6 +194,30 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome-packagekit/connection_use_mobile</key>
+ <applyto>/apps/gnome-packagekit/connection_use_mobile</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use mobile broadband connections</short>
+ <long>Use mobile broadband connections such as GSM and CDMA to check for updates</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-packagekit/connection_use_wifi</key>
+ <applyto>/apps/gnome-packagekit/connection_use_wifi</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Use WiFi connections</short>
+ <long>Use WiFi (wireless LAN) connections to check for updates</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome-packagekit/autocomplete</key>
<applyto>/apps/gnome-packagekit/autocomplete</applyto>
<owner>gnome-packagekit</owner>
@@ -329,6 +353,18 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome-packagekit/application/search_mode</key>
+ <applyto>/apps/gnome-packagekit/application/search_mode</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>string</type>
+ <default>details</default>
+ <locale name="C">
+ <short>The search mode used by default</short>
+ <long>The search mode used by default. Options are "name", "details", or "file"</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome-packagekit/repo/show_details</key>
<applyto>/apps/gnome-packagekit/repo/show_details</applyto>
<owner>gnome-packagekit</owner>
@@ -400,6 +436,30 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gnome-packagekit/dbus_default_interaction</key>
+ <applyto>/apps/gnome-packagekit/dbus_default_interaction</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>string</type>
+ <default>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</default>
+ <locale name="C">
+ <short>Interaction modes to use by default</short>
+ <long>When displaying UI from a session DBus request, automatically use these options by default</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-packagekit/dbus_enforced_interaction</key>
+ <applyto>/apps/gnome-packagekit/dbus_enforced_interaction</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>string</type>
+ <default>show-confirm-install</default>
+ <locale name="C">
+ <short>Interaction modes that must be used, overriding requests from client</short>
+ <long>When displaying UI from a session DBus request, force these options to be turned on</long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade (original)
+++ trunk/data/gpk-application.glade Thu Jan 8 11:21:07 2009
@@ -53,15 +53,9 @@
<child>
<widget class="GtkImageMenuItem" id="menuitem_quit">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Quit</property>
+ <property name="label" translatable="yes">gtk-quit</property>
<property name="use_underline">True</property>
- <child internal-child="image">
- <widget class="GtkImage" id="menu-item-image10">
- <property name="visible">True</property>
- <property name="stock">gtk-quit</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
+ <property name="use_stock">True</property>
</widget>
</child>
</widget>
@@ -466,7 +460,7 @@
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem_help">
+ <widget class="GtkMenuItem" id="menuitem_help_menu">
<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="label" translatable="yes">_Help</property>
Modified: trunk/data/gpk-prefs.glade
==============================================================================
--- trunk/data/gpk-prefs.glade (original)
+++ trunk/data/gpk-prefs.glade Thu Jan 8 11:21:07 2009
@@ -48,30 +48,41 @@
<property name="column_spacing">20</property>
<property name="row_spacing">5</property>
<child>
- <widget class="GtkComboBox" id="combobox_upgrade">
+ <widget class="GtkComboBox" id="combobox_check">
<property name="visible">True</property>
<property name="items"></property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_upgrade">
+ <widget class="GtkComboBox" id="combobox_install">
+ <property name="visible">True</property>
+ <property name="items"></property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_install">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Check for major _upgrades:</property>
+ <property name="label" translatable="yes">_Automatically install:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">combobox_check</property>
+ <property name="mnemonic_widget">combobox_install</property>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -90,46 +101,75 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_install">
+ <widget class="GtkLabel" id="label_upgrade">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Automatically install:</property>
+ <property name="label" translatable="yes">Check for major _upgrades:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">combobox_install</property>
+ <property name="mnemonic_widget">combobox_check</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="combobox_install">
+ <widget class="GtkComboBox" id="combobox_upgrade">
<property name="visible">True</property>
<property name="items"></property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_mobile_broadband">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Check for updates when using mobile broadband</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_mobile_broadband">
+ <property name="spacing">9</property>
<child>
- <widget class="GtkComboBox" id="combobox_check">
+ <widget class="GtkImage" id="image1">
<property name="visible">True</property>
- <property name="items"></property>
+ <property name="stock">gtk-dialog-info</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><i>Currently using mobile broadband</i></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
</child>
</widget>
</child>
Modified: trunk/docs/Makefile.am
==============================================================================
--- trunk/docs/Makefile.am (original)
+++ trunk/docs/Makefile.am Thu Jan 8 11:21:07 2009
@@ -1 +1,2 @@
+SUBDIRS = dbus
Modified: trunk/man/.gitignore
==============================================================================
--- trunk/man/.gitignore (original)
+++ trunk/man/.gitignore Thu Jan 8 11:21:07 2009
@@ -1,4 +1,5 @@
manpage.links
manpage.refs
+manpage.log
*.1
Modified: trunk/po/.gitignore
==============================================================================
--- trunk/po/.gitignore (original)
+++ trunk/po/.gitignore Thu Jan 8 11:21:07 2009
@@ -6,4 +6,5 @@
*.pot
*.gmo
.svn
+Makefile.in.in
Modified: trunk/src/.gitignore
==============================================================================
--- trunk/src/.gitignore (original)
+++ trunk/src/.gitignore Thu Jan 8 11:21:07 2009
@@ -12,7 +12,7 @@
.libs
gpk-marshal.c
gpk-marshal.h
-gpk-interface.h
+org.freedesktop.PackageKit*.h
gpk-repo
gpk-application
gpk-update-icon
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu Jan 8 11:21:07 2009
@@ -5,6 +5,7 @@
INCLUDES = \
$(GLIB_CFLAGS) \
+ $(GIO_CFLAGS) \
$(DBUS_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGLADE_CFLAGS) \
@@ -54,6 +55,8 @@
egg-string-list.h \
egg-unique.c \
egg-unique.h \
+ egg-markdown.c \
+ egg-markdown.h \
egg-console-kit.c \
egg-console-kit.h \
egg-dbus-monitor.c \
@@ -102,6 +105,7 @@
shared_LIBS = \
$(GLIB_LIBS) \
+ $(GIO_LIBS) \
$(DBUS_LIBS) \
$(GCONF_LIBS) \
$(LIBGLADE_LIBS) \
Modified: trunk/src/egg-console-kit.c
==============================================================================
--- trunk/src/egg-console-kit.c (original)
+++ trunk/src/egg-console-kit.c Thu Jan 8 11:21:07 2009
@@ -31,8 +31,6 @@
#include "egg-debug.h"
#include "egg-console-kit.h"
-static void egg_console_kit_class_init (EggConsoleKitClass *klass);
-static void egg_console_kit_init (EggConsoleKit *console_kit);
static void egg_console_kit_finalize (GObject *object);
#define EGG_CONSOLE_KIT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_TYPE_CONSOLE_KIT, EggConsoleKitPrivate))
@@ -63,6 +61,52 @@
G_DEFINE_TYPE (EggConsoleKit, egg_console_kit, G_TYPE_OBJECT)
/**
+ * egg_console_kit_restart:
+ **/
+gboolean
+egg_console_kit_restart (EggConsoleKit *console, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+
+ g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE);
+ g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE);
+
+ ret = dbus_g_proxy_call (console->priv->proxy_manager, "Restart", &error_local,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (!ret) {
+ egg_warning ("Couldn't restart: %s", error_local->message);
+ if (error != NULL)
+ *error = g_error_new (1, 0, "%s", error_local->message);
+ g_error_free (error_local);
+ }
+ return ret;
+}
+
+/**
+ * egg_console_kit_stop:
+ **/
+gboolean
+egg_console_kit_stop (EggConsoleKit *console, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+
+ g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE);
+ g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE);
+
+ ret = dbus_g_proxy_call (console->priv->proxy_manager, "Stop", &error_local,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (!ret) {
+ egg_warning ("Couldn't stop: %s", error_local->message);
+ if (error != NULL)
+ *error = g_error_new (1, 0, "%s", error_local->message);
+ g_error_free (error_local);
+ }
+ return ret;
+}
+
+/**
* egg_console_kit_is_local:
*
* Return value: Returns whether the session is local
Modified: trunk/src/egg-console-kit.h
==============================================================================
--- trunk/src/egg-console-kit.h (original)
+++ trunk/src/egg-console-kit.h Thu Jan 8 11:21:07 2009
@@ -54,6 +54,10 @@
EggConsoleKit *egg_console_kit_new (void);
gboolean egg_console_kit_is_local (EggConsoleKit *console);
gboolean egg_console_kit_is_active (EggConsoleKit *console);
+gboolean egg_console_kit_stop (EggConsoleKit *console,
+ GError **error);
+gboolean egg_console_kit_restart (EggConsoleKit *console,
+ GError **error);
G_END_DECLS
Modified: trunk/src/egg-dbus-monitor.c
==============================================================================
--- trunk/src/egg-dbus-monitor.c (original)
+++ trunk/src/egg-dbus-monitor.c Thu Jan 8 11:21:07 2009
@@ -32,8 +32,6 @@
#include "egg-debug.h"
#include "egg-dbus-monitor.h"
-static void egg_dbus_monitor_class_init (EggDbusMonitorClass *klass);
-static void egg_dbus_monitor_init (EggDbusMonitor *dbus_monitor);
static void egg_dbus_monitor_finalize (GObject *object);
#define EGG_DBUS_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_TYPE_DBUS_MONITOR, EggDbusMonitorPrivate))
Modified: trunk/src/egg-debug.h
==============================================================================
--- trunk/src/egg-debug.h (original)
+++ trunk/src/egg-debug.h Thu Jan 8 11:21:07 2009
@@ -76,7 +76,7 @@
void egg_error_real (const gchar *func,
const gchar *file,
int line,
- const gchar *format, ...) __attribute__((format (printf,4,5)));
+ const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5)));
G_END_DECLS
Modified: trunk/src/egg-test.c
==============================================================================
--- trunk/src/egg-test.c (original)
+++ trunk/src/egg-test.c Thu Jan 8 11:21:07 2009
@@ -158,9 +158,9 @@
guint
egg_test_elapsed (EggTest *test)
{
- gdouble time;
- time = g_timer_elapsed (test->timer, NULL);
- return (guint) (time * 1000.0f);
+ gdouble time_s;
+ time_s = g_timer_elapsed (test->timer, NULL);
+ return (guint) (time_s * 1000.0f);
}
/**
@@ -320,17 +320,23 @@
/* check to see if we are being run in the build root */
full = g_build_filename ("..", "data", "tests", filename, NULL);
ret = g_file_test (full, G_FILE_TEST_EXISTS);
- if (ret) {
+ if (ret)
return full;
- }
g_free (full);
- /* check to see if we are being run in make check */
+ /* check to see if we are being run in the build root */
full = g_build_filename ("..", "..", "data", "tests", filename, NULL);
ret = g_file_test (full, G_FILE_TEST_EXISTS);
- if (ret) {
+ if (ret)
return full;
- }
+ g_free (full);
+
+ /* check to see if we are being run in make check */
+ full = g_build_filename ("..", "..", "..", "data", "tests", filename, NULL);
+ ret = g_file_test (full, G_FILE_TEST_EXISTS);
+ if (ret)
+ return full;
+ g_print ("[WARN] failed to find '%s'\n", full);
g_free (full);
return NULL;
}
Modified: trunk/src/egg-test.h
==============================================================================
--- trunk/src/egg-test.h (original)
+++ trunk/src/egg-test.h Thu Jan 8 11:21:07 2009
@@ -33,7 +33,7 @@
void egg_test_title_assert (EggTest *test, const gchar *text, gboolean value);
void egg_test_assert (EggTest *test, gboolean value);
void egg_test_success (EggTest *test, const gchar *format, ...);
-void egg_test_failed (EggTest *test, const gchar *format, ...);
+void egg_test_failed (EggTest *test, const gchar *format, ...) G_GNUC_NORETURN;
EggTest *egg_test_init (void);
gint egg_test_finish (EggTest *test);
guint egg_test_elapsed (EggTest *test);
Modified: trunk/src/egg-unique.c
==============================================================================
--- trunk/src/egg-unique.c (original)
+++ trunk/src/egg-unique.c Thu Jan 8 11:21:07 2009
@@ -31,8 +31,6 @@
#include "egg-unique.h"
#include "egg-debug.h"
-static void egg_unique_class_init (EggUniqueClass *klass);
-static void egg_unique_init (EggUnique *unique);
static void egg_unique_finalize (GObject *object);
#define EGG_UNIQUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_UNIQUE_TYPE, EggUniquePrivate))
@@ -61,7 +59,7 @@
**/
static void
egg_unique_message_cb (UniqueApp *app, UniqueCommand command, UniqueMessageData *message_data,
- guint time, EggUnique *egg_unique)
+ guint time_ms, EggUnique *egg_unique)
{
g_return_if_fail (EGG_IS_UNIQUE (egg_unique));
if (command == UNIQUE_ACTIVATE)
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Thu Jan 8 11:21:07 2009
@@ -20,12 +20,12 @@
*/
#include "config.h"
-
#include <glib.h>
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
#include <gconf/gconf-client.h>
#include <libsexy/sexy-icon-entry.h>
#include <math.h>
@@ -35,6 +35,7 @@
#include "egg-debug.h"
#include "egg-string.h"
+#include "egg-markdown.h"
#include "gpk-client.h"
#include "gpk-common.h"
@@ -49,8 +50,6 @@
#include "gpk-cell-renderer-uri.h"
#include "gpk-desktop.h"
-static void gpk_application_class_init (GpkApplicationClass *klass);
-static void gpk_application_init (GpkApplication *application);
static void gpk_application_finalize (GObject *object);
#define GPK_APPLICATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_APPLICATION, GpkApplicationPrivate))
@@ -83,6 +82,7 @@
GtkListStore *packages_store;
GtkTreeStore *groups_store;
GtkListStore *details_store;
+ EggMarkdown *markdown;
PkControl *control;
PkClient *client_search;
PkClient *client_action;
@@ -188,7 +188,7 @@
/**
* gpk_application_state_get_icon:
**/
-const gchar *
+static const gchar *
gpk_application_state_get_icon (PkBitfield state)
{
if (state == 0)
@@ -221,7 +221,7 @@
/**
* gpk_application_state_get_checkbox:
**/
-gboolean
+static gboolean
gpk_application_state_get_checkbox (PkBitfield state)
{
PkBitfield state_local;
@@ -476,7 +476,7 @@
/**
* gpk_application_strcmp_indirect:
**/
-gint
+static gint
gpk_application_strcmp_indirect (gchar **a, gchar **b)
{
return strcmp (*a, *b);
@@ -870,7 +870,6 @@
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (tree_view));
}
-
/**
* gpk_application_clear_details_really:
**/
@@ -918,37 +917,20 @@
}
/**
- * egg_strreplace_indirect:
- **/
-static gboolean
-egg_strreplace_indirect (gchar **text, const gchar *find, const gchar *replace)
-{
- gchar *new;
-
- /* is needle even in string? */
- if (g_strrstr (*text, find) == NULL)
- return FALSE;
-
- /* replace */
- new = egg_strreplace (*text, find, replace);
-
- /* replace old string with new string */
- g_free (*text);
- *text = new;
- return TRUE;
-}
-
-/**
* gpk_application_text_format_display:
**/
static gchar *
-gpk_application_text_format_display (const gchar *ascii)
+gpk_application_text_format_display (GpkApplication *application, const gchar *ascii)
{
gchar *text;
- text = g_strdup (ascii);
- egg_strreplace_indirect (&text, "``", "â");
- egg_strreplace_indirect (&text, "''", "â");
- egg_strreplace_indirect (&text, "'", "â");
+ egg_markdown_set_output (application->priv->markdown, EGG_MARKDOWN_OUTPUT_TEXT);
+ text = egg_markdown_parse (application->priv->markdown, ascii);
+ if (egg_strlen (text, 1024) > 1023) {
+ text[1020] = '.';
+ text[1021] = '.';
+ text[1022] = '.';
+ text[1023] = '\0';
+ }
return text;
}
@@ -1027,7 +1009,7 @@
g_free (value);
/* set the description */
- text = gpk_application_text_format_display (details->description);
+ text = gpk_application_text_format_display (application, details->description);
widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");
gpk_application_set_text_buffer (widget, text);
g_free (text);
@@ -1087,7 +1069,8 @@
return;
/* format if required */
- summary = gpk_application_text_format_display (obj->summary);
+ egg_markdown_set_output (application->priv->markdown, EGG_MARKDOWN_OUTPUT_PANGO);
+ summary = egg_markdown_parse (application->priv->markdown, obj->summary);
/* mark as got so we don't warn */
application->priv->has_package = TRUE;
@@ -2033,6 +2016,9 @@
application->priv->search_type = PK_SEARCH_NAME;
egg_debug ("set search type=%i", application->priv->search_type);
+ /* save default to GConf */
+ gconf_client_set_string (application->priv->gconf_client, GPK_CONF_APPLICATION_SEARCH_MODE, "name", NULL);
+
/* set the new icon */
widget = glade_xml_get_widget (application->priv->glade_xml, "entry_text");
/* TRANSLATORS: entry tooltip: basic search */
@@ -2055,6 +2041,9 @@
application->priv->search_type = PK_SEARCH_DETAILS;
egg_debug ("set search type=%i", application->priv->search_type);
+ /* save default to GConf */
+ gconf_client_set_string (application->priv->gconf_client, GPK_CONF_APPLICATION_SEARCH_MODE, "details", NULL);
+
/* set the new icon */
widget = glade_xml_get_widget (application->priv->glade_xml, "entry_text");
/* TRANSLATORS: entry tooltip: detailed search */
@@ -2077,6 +2066,9 @@
application->priv->search_type = PK_SEARCH_FILE;
egg_debug ("set search type=%i", application->priv->search_type);
+ /* save default to GConf */
+ gconf_client_set_string (application->priv->gconf_client, GPK_CONF_APPLICATION_SEARCH_MODE, "file", NULL);
+
/* set the new icon */
widget = glade_xml_get_widget (application->priv->glade_xml, "entry_text");
/* TRANSLATORS: entry tooltip: file search */
@@ -2099,9 +2091,9 @@
g_return_if_fail (PK_IS_APPLICATION (application));
/* only respond to left button */
- if (button != 1) {
+ if (button != 1)
return;
- }
+
egg_debug ("icon_pos=%i", icon_pos);
if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_NAME)) {
@@ -2249,7 +2241,7 @@
if (!been_here) {
been_here = TRUE;
gtk_about_dialog_set_url_hook (gpk_application_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (gpk_application_about_dialog_url_cb, "mailto:", NULL);
+ gtk_about_dialog_set_email_hook (gpk_application_about_dialog_url_cb, (gpointer) "mailto:", NULL);
}
/* use parent */
@@ -2313,9 +2305,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2347,9 +2338,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2381,9 +2371,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2415,9 +2404,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2449,9 +2437,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2483,9 +2470,8 @@
name = gtk_widget_get_name (widget);
/* only care about new state */
- if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
+ if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return;
- }
/* set new filter */
if (g_str_has_suffix (name, "_yes")) {
@@ -2520,11 +2506,10 @@
GPK_CONF_APPLICATION_FILTER_BASENAME, enabled, NULL);
/* change the filter */
- if (enabled) {
+ if (enabled)
pk_bitfield_add (application->priv->filters_current, PK_FILTER_ENUM_BASENAME);
- } else {
+ else
pk_bitfield_remove (application->priv->filters_current, PK_FILTER_ENUM_BASENAME);
- }
/* refresh the search results */
gpk_application_perform_search (application);
@@ -2547,11 +2532,10 @@
GPK_CONF_APPLICATION_FILTER_NEWEST, enabled, NULL);
/* change the filter */
- if (enabled) {
+ if (enabled)
pk_bitfield_add (application->priv->filters_current, PK_FILTER_ENUM_NEWEST);
- } else {
+ else
pk_bitfield_remove (application->priv->filters_current, PK_FILTER_ENUM_NEWEST);
- }
/* refresh the search results */
gpk_application_perform_search (application);
@@ -2605,9 +2589,9 @@
/**
* gpk_application_package_row_activated_cb:
**/
-void
+static void
gpk_application_package_row_activated_cb (GtkTreeView *treeview, GtkTreePath *path,
- GtkTreeViewColumn *col, GpkApplication *application)
+ GtkTreeViewColumn *col, GpkApplication *application)
{
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2985,6 +2969,7 @@
GtkTreeSelection *selection;
gboolean enabled;
gboolean ret;
+ gchar *mode;
GError *error = NULL;
application->priv = GPK_APPLICATION_GET_PRIVATE (application);
@@ -3003,6 +2988,9 @@
application->priv->search_mode = PK_MODE_UNKNOWN;
application->priv->filters_current = PK_FILTER_ENUM_NONE;
+ application->priv->markdown = egg_markdown_new ();
+ egg_markdown_set_max_lines (application->priv->markdown, 50);
+
/* watch gnome-packagekit keys */
gconf_client_add_dir (application->priv->gconf_client, GPK_CONF_DIR,
GCONF_CLIENT_PRELOAD_NONE, NULL);
@@ -3132,6 +3120,15 @@
g_signal_connect (widget, "clicked",
G_CALLBACK (gpk_application_button_help_cb), application);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menu_about");
+ gtk_menu_set_accel_group (GTK_MENU (widget),
+ GTK_ACCEL_GROUP (gtk_accel_groups_from_object (G_OBJECT (main_window))->data));
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_help");
+ gtk_menu_item_set_accel_path (GTK_MENU_ITEM (widget),
+ "<gpk-application>/menuitem_help");
+ gtk_accel_map_add_entry ("<gpk-application>/menuitem_help", GDK_F1, 0);
+
/* install */
widget = glade_xml_get_widget (application->priv->glade_xml, "button_apply");
g_signal_connect (widget, "clicked",
@@ -3475,8 +3472,43 @@
/* hide details */
gpk_application_clear_details (application);
- /* coldplug icon to default to search by name*/
- gpk_application_menu_search_by_name (NULL, application);
+ /* set the search mode */
+ mode = gconf_client_get_string (application->priv->gconf_client, GPK_CONF_APPLICATION_SEARCH_MODE, NULL);
+ if (mode == NULL) {
+ egg_warning ("search mode not set, using name");
+ mode = g_strdup ("name");
+ }
+
+ /* search by name */
+ if (egg_strequal (mode, "name")) {
+ gpk_application_menu_search_by_name (NULL, application);
+
+ /* set to details if we can we do the action? */
+ } else if (egg_strequal (mode, "details")) {
+ if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_DETAILS)) {
+ gpk_application_menu_search_by_description (NULL, application);
+ } else {
+ egg_warning ("cannont use mode %s as not capable, using name", mode);
+ gpk_application_menu_search_by_name (NULL, application);
+ }
+
+ /* set to file if we can we do the action? */
+ } else if (egg_strequal (mode, "file")) {
+ gpk_application_menu_search_by_file (NULL, application);
+
+ if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_FILE)) {
+ gpk_application_menu_search_by_file (NULL, application);
+ } else {
+ egg_warning ("cannont use mode %s as not capable, using name", mode);
+ gpk_application_menu_search_by_name (NULL, application);
+ }
+
+ /* mode not recognised */
+ } else {
+ egg_warning ("cannot recognise mode %s, using name", mode);
+ gpk_application_menu_search_by_name (NULL, application);
+ }
+ g_free (mode);
/* welcome */
gpk_application_add_welcome (application);
@@ -3511,6 +3543,7 @@
g_object_unref (application->priv->gconf_client);
g_object_unref (application->priv->gclient);
g_object_unref (application->priv->package_list);
+ g_object_unref (application->priv->markdown);
g_free (application->priv->url);
g_free (application->priv->group);
Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c (original)
+++ trunk/src/gpk-auto-refresh.c Thu Jan 8 11:21:07 2009
@@ -45,8 +45,6 @@
#include "gpk-auto-refresh.h"
#include "gpk-enum.h"
-static void gpk_auto_refresh_class_init (GpkAutoRefreshClass *klass);
-static void gpk_auto_refresh_init (GpkAutoRefresh *arefresh);
static void gpk_auto_refresh_finalize (GObject *object);
#define GPK_AUTO_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_AUTO_REFRESH, GpkAutoRefreshPrivate))
@@ -219,7 +217,7 @@
static gboolean
gpk_auto_refresh_maybe_refresh_cache (GpkAutoRefresh *arefresh)
{
- guint time;
+ guint time_s;
guint thresh;
gboolean ret;
@@ -253,15 +251,15 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
- PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
+ PK_ROLE_ENUM_REFRESH_CACHE, &time_s, NULL);
if (!ret) {
egg_warning ("failed to get last time");
return FALSE;
}
/* have we passed the timout? */
- if (time < thresh) {
- egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time);
+ if (time_s < thresh) {
+ egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time_s);
return FALSE;
}
@@ -275,7 +273,7 @@
static gboolean
gpk_auto_refresh_maybe_get_updates (GpkAutoRefresh *arefresh)
{
- guint time;
+ guint time_s;
guint thresh;
gboolean ret;
@@ -299,15 +297,15 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
- PK_ROLE_ENUM_GET_UPDATES, &time, NULL);
+ PK_ROLE_ENUM_GET_UPDATES, &time_s, NULL);
if (!ret) {
egg_warning ("failed to get last time");
return FALSE;
}
/* have we passed the timout? */
- if (time < thresh) {
- egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time);
+ if (time_s < thresh) {
+ egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time_s);
return FALSE;
}
@@ -321,7 +319,7 @@
static gboolean
gpk_auto_refresh_maybe_get_upgrades (GpkAutoRefresh *arefresh)
{
- guint time;
+ guint time_s;
guint thresh;
gboolean ret;
@@ -336,15 +334,15 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
- PK_ROLE_ENUM_GET_DISTRO_UPGRADES, &time, NULL);
+ PK_ROLE_ENUM_GET_DISTRO_UPGRADES, &time_s, NULL);
if (!ret) {
egg_debug ("failed to get last time");
return FALSE;
}
/* have we passed the timout? */
- if (time < thresh) {
- egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time);
+ if (time_s < thresh) {
+ egg_debug ("not before timeout, thresh=%u, now=%u", thresh, time_s);
return FALSE;
}
@@ -463,6 +461,34 @@
}
/**
+ * gpk_auto_refresh_convert_network_state:
+ **/
+static gboolean
+gpk_auto_refresh_convert_network_state (GpkAutoRefresh *arefresh, PkNetworkEnum state)
+{
+ /* offline */
+ if (state == PK_NETWORK_ENUM_OFFLINE)
+ return FALSE;
+
+ /* online */
+ if (state == PK_NETWORK_ENUM_ONLINE ||
+ state == PK_NETWORK_ENUM_WIRED)
+ return TRUE;
+
+ /* check policy */
+ if (state == PK_NETWORK_ENUM_MOBILE)
+ return gconf_client_get_bool (arefresh->priv->gconf_client, GPK_CONF_CONNECTION_USE_MOBILE, NULL);
+
+ /* check policy */
+ if (state == PK_NETWORK_ENUM_WIFI)
+ return gconf_client_get_bool (arefresh->priv->gconf_client, GPK_CONF_CONNECTION_USE_WIFI, NULL);
+
+ /* not recognised */
+ egg_warning ("state unknown: %i", state);
+ return TRUE;
+}
+
+/**
* gpk_auto_refresh_network_status_changed_cb:
**/
static void
@@ -470,7 +496,7 @@
{
g_return_if_fail (GPK_IS_AUTO_REFRESH (arefresh));
- arefresh->priv->network_active = (state == PK_NETWORK_ENUM_ONLINE);
+ arefresh->priv->network_active = gpk_auto_refresh_convert_network_state (arefresh, state);
egg_debug ("setting online %i", arefresh->priv->network_active);
if (arefresh->priv->network_active)
gpk_auto_refresh_change_state (arefresh);
@@ -623,8 +649,7 @@
g_signal_connect (arefresh->priv->control, "network-state-changed",
G_CALLBACK (gpk_auto_refresh_network_status_changed_cb), arefresh);
state = pk_control_get_network_state (arefresh->priv->control, NULL);
- if (state == PK_NETWORK_ENUM_ONLINE)
- arefresh->priv->network_active = TRUE;
+ arefresh->priv->network_active = gpk_auto_refresh_convert_network_state (arefresh, state);
/* connect to session bus */
arefresh->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Thu Jan 8 11:21:07 2009
@@ -50,8 +50,6 @@
#include "gpk-check-update.h"
#include "gpk-enum.h"
-static void gpk_check_update_class_init (GpkCheckUpdateClass *klass);
-static void gpk_check_update_init (GpkCheckUpdate *cupdate);
static void gpk_check_update_finalize (GObject *object);
#define GPK_CHECK_UPDATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CHECK_UPDATE, GpkCheckUpdatePrivate))
@@ -207,7 +205,7 @@
_(license[2]), "\n\n", _(license[3]), "\n", NULL);
gtk_about_dialog_set_url_hook (gpk_check_update_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (gpk_check_update_about_dialog_url_cb, "mailto:", NULL);
+ gtk_about_dialog_set_email_hook (gpk_check_update_about_dialog_url_cb, (gpointer) "mailto:", NULL);
gtk_window_set_default_icon_name (GPK_ICON_SOFTWARE_UPDATE);
gtk_show_about_dialog (NULL,
@@ -666,6 +664,7 @@
guint length;
guint i;
guint more;
+ guint showing = 0;
gboolean ret = FALSE;
GString *status_security;
GString *status_tooltip;
@@ -726,20 +725,27 @@
goto out;
}
- /* find the security updates */
+ /* find the security updates first */
for (i=0; i<length; i++) {
obj = pk_package_list_get_obj (list, i);
if (obj->info == PK_INFO_ENUM_SECURITY) {
/* add to array */
package_id = pk_package_id_to_string (obj->id);
g_ptr_array_add (security_array, package_id);
- g_string_append_printf (status_security, "<b>%s</b> - %s\n",
- obj->id->name, obj->summary);
}
+ }
+
+ /* get the security update text */
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (list, i);
+ if (obj->info != PK_INFO_ENUM_SECURITY)
+ continue;
- /* don't have a huge notification that won't fit on the screen */
- if (security_array->len > GPK_CHECK_UPDATE_MAX_NUMBER_SECURITY_ENTRIES) {
- more = length - security_array->len;
+ /* don't use a huge notification that won't fit on the screen */
+ g_string_append_printf (status_security, "<b>%s</b> - %s\n",
+ obj->id->name, obj->summary);
+ if (++showing == GPK_CHECK_UPDATE_MAX_NUMBER_SECURITY_ENTRIES) {
+ more = security_array->len - showing;
/* TRANSLATORS: we have a notification that won't fit, so append on how many other we are not showing */
g_string_append_printf (status_security, ngettext ("and %d other security update",
"and %d other security updates", more), more);
Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c (original)
+++ trunk/src/gpk-client-chooser.c Thu Jan 8 11:21:07 2009
@@ -34,6 +34,7 @@
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-client-chooser.h"
#include "gpk-enum.h"
#include "gpk-desktop.h"
Modified: trunk/src/gpk-client-dialog.c
==============================================================================
--- trunk/src/gpk-client-dialog.c (original)
+++ trunk/src/gpk-client-dialog.c Thu Jan 8 11:21:07 2009
@@ -47,8 +47,6 @@
#include "gpk-enum.h"
#include "gpk-desktop.h"
-static void gpk_client_dialog_class_init (GpkClientDialogClass *klass);
-static void gpk_client_dialog_init (GpkClientDialog *dialog);
static void gpk_client_dialog_finalize (GObject *object);
#define GPK_CLIENT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CLIENT_DIALOG, GpkClientDialogPrivate))
@@ -634,7 +632,7 @@
GtkTreeIter iter;
const PkPackageObj *obj;
PkDesktop *desktop;
- const gchar *icon;
+ gchar *icon;
gchar *package_id;
gchar *text;
guint length;
@@ -662,7 +660,7 @@
/* get the icon */
icon = gpk_desktop_guess_icon_name (desktop, obj->id->name);
if (icon == NULL)
- icon = gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED);
+ icon = g_strdup (gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED));
gtk_list_store_append (dialog->priv->store, &iter);
gtk_list_store_set (dialog->priv->store, &iter,
@@ -670,6 +668,7 @@
GPK_CLIENT_DIALOG_STORE_ID, package_id,
GPK_CLIENT_DIALOG_STORE_TEXT, text,
-1);
+ g_free (icon);
g_free (text);
g_free (package_id);
}
Modified: trunk/src/gpk-client-eula.c
==============================================================================
--- trunk/src/gpk-client-eula.c (original)
+++ trunk/src/gpk-client-eula.c Thu Jan 8 11:21:07 2009
@@ -32,6 +32,7 @@
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-client-eula.h"
static gboolean has_agreed_eula = FALSE;
Modified: trunk/src/gpk-client-run.c
==============================================================================
--- trunk/src/gpk-client-run.c (original)
+++ trunk/src/gpk-client-run.c Thu Jan 8 11:21:07 2009
@@ -33,12 +33,15 @@
#include "gpk-gnome.h"
#include "gpk-client.h"
+#include "gpk-client-run.h"
#include "gpk-common.h"
#include "gpk-enum.h"
#include "gpk-desktop.h"
-static GtkListStore *list_store = NULL;
-static gchar *full_path = NULL;
+typedef struct {
+ GtkListStore *list_store;
+ gchar *full_path;
+} GpkClientRunPriv;
enum
{
@@ -52,7 +55,7 @@
* gpk_client_run_button_help_cb:
**/
static void
-gpk_client_run_button_help_cb (GtkWidget *widget, gpointer data)
+gpk_client_run_button_help_cb (GtkWidget *widget, GpkClientRunPriv *priv)
{
gpk_gnome_help ("application-run");
}
@@ -61,11 +64,11 @@
* gpk_client_run_button_close_cb:
**/
static void
-gpk_client_run_button_close_cb (GtkWidget *widget, gpointer data)
+gpk_client_run_button_close_cb (GtkWidget *widget, GpkClientRunPriv *priv)
{
/* clear full_path */
- g_free (full_path);
- full_path = NULL;
+ g_free (priv->full_path);
+ priv->full_path = NULL;
gtk_main_quit ();
}
@@ -73,11 +76,11 @@
* gpk_client_run_delete_event_cb:
**/
static gboolean
-gpk_client_run_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
+gpk_client_run_delete_event_cb (GtkWidget *widget, GdkEvent *event, GpkClientRunPriv *priv)
{
/* clear full_path */
- g_free (full_path);
- full_path = NULL;
+ g_free (priv->full_path);
+ priv->full_path = NULL;
gtk_main_quit ();
return FALSE;
}
@@ -86,7 +89,7 @@
* gpk_client_run_button_action_cb:
**/
static void
-gpk_client_run_button_action_cb (GtkWidget *widget, gpointer data)
+gpk_client_run_button_action_cb (GtkWidget *widget, GpkClientRunPriv *priv)
{
gtk_main_quit ();
}
@@ -95,18 +98,18 @@
* gpk_client_run_treeview_clicked_cb:
**/
static void
-gpk_client_run_treeview_clicked_cb (GtkTreeSelection *selection, gboolean data)
+gpk_client_run_treeview_clicked_cb (GtkTreeSelection *selection, GpkClientRunPriv *priv)
{
GtkTreeModel *model;
GtkTreeIter iter;
/* This will only work in single or browse selection mode! */
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- g_free (full_path);
- gtk_tree_model_get (model, &iter, GPK_CHOOSER_COLUMN_FULL_PATH, &full_path, -1);
+ g_free (priv->full_path);
+ gtk_tree_model_get (model, &iter, GPK_CHOOSER_COLUMN_FULL_PATH, &priv->full_path, -1);
- /* show full_path */
- egg_debug ("selected row is: %s", full_path);
+ /* show full path */
+ egg_debug ("selected row is: %s", priv->full_path);
} else {
egg_debug ("no row selected");
}
@@ -115,9 +118,9 @@
/**
* gpk_client_run_row_activated_cb:
**/
-void
+static void
gpk_client_run_row_activated_cb (GtkTreeView *treeview, GtkTreePath *path,
- GtkTreeViewColumn *col, gpointer user_data)
+ GtkTreeViewColumn *col, GpkClientRunPriv *priv)
{
GtkTreeModel *model;
GtkTreeIter iter;
@@ -131,8 +134,8 @@
return;
}
- g_free (full_path);
- gtk_tree_model_get (model, &iter, GPK_CHOOSER_COLUMN_FULL_PATH, &full_path, -1);
+ g_free (priv->full_path);
+ gtk_tree_model_get (model, &iter, GPK_CHOOSER_COLUMN_FULL_PATH, &priv->full_path, -1);
gtk_main_quit ();
}
@@ -182,7 +185,7 @@
* gpk_client_run_add_desktop_file:
**/
static gboolean
-gpk_client_run_add_desktop_file (const gchar *package_id, const gchar *filename)
+gpk_client_run_add_desktop_file (GpkClientRunPriv *priv, const gchar *package_id, const gchar *filename)
{
gboolean ret;
gchar *icon = NULL;
@@ -252,7 +255,7 @@
g_free (text);
/* put formatted text into treeview */
- gtk_list_store_append (list_store, &iter);
+ gtk_list_store_append (priv->list_store, &iter);
joint = g_strdup_printf ("%s - %s", name, summary);
id = pk_package_id_new_from_string (package_id);
text = gpk_package_id_format_twoline (id, joint);
@@ -264,7 +267,7 @@
}
pk_package_id_free (id);
- gtk_list_store_set (list_store, &iter,
+ gtk_list_store_set (priv->list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, fulltext,
GPK_CHOOSER_COLUMN_FULL_PATH, exec,
GPK_CHOOSER_COLUMN_ICON, icon, -1);
@@ -286,7 +289,7 @@
* gpk_client_run_add_package_ids:
**/
static guint
-gpk_client_run_add_package_ids (gchar **package_ids)
+gpk_client_run_add_package_ids (GpkClientRunPriv *priv, gchar **package_ids)
{
guint i, j;
guint length;
@@ -313,7 +316,7 @@
if (array != NULL) {
for (j=0; j<array->len; j++) {
filename = g_ptr_array_index (array, j);
- ret = gpk_client_run_add_desktop_file (package_ids[i], filename);
+ ret = gpk_client_run_add_desktop_file (priv, package_ids[i], filename);
if (ret)
added++;
}
@@ -339,6 +342,7 @@
GtkWidget *widget;
GtkTreeSelection *selection;
guint len;
+ GpkClientRunPriv priv;
g_return_val_if_fail (package_ids != NULL, FALSE);
@@ -347,20 +351,23 @@
glade_xml = glade_xml_new (GPK_DATA "/gpk-log.glade", NULL, NULL);
+ /* initially nothing */
+ priv.full_path = NULL;
+
/* connect up default actions */
widget = glade_xml_get_widget (glade_xml, "dialog_simple");
- g_signal_connect (widget, "delete_event", G_CALLBACK (gpk_client_run_delete_event_cb), NULL);
+ g_signal_connect (widget, "delete_event", G_CALLBACK (gpk_client_run_delete_event_cb), &priv);
/* set a size, if the screen allows */
gpk_window_set_size_request (GTK_WINDOW (widget), 600, 300);
/* connect up buttons */
widget = glade_xml_get_widget (glade_xml, "button_help");
- g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_help_cb), NULL);
+ g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_help_cb), &priv);
widget = glade_xml_get_widget (glade_xml, "button_close");
- g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_close_cb), NULL);
+ g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_close_cb), &priv);
widget = glade_xml_get_widget (glade_xml, "button_action");
- g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_action_cb), NULL);
+ g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_run_button_action_cb), &priv);
gtk_widget_show (widget);
/* hide the filter box */
@@ -378,19 +385,19 @@
gtk_window_set_title (GTK_WINDOW (widget), _("Run new application?"));
/* create list stores */
- list_store = gtk_list_store_new (GPK_CHOOSER_COLUMN_LAST, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ priv.list_store = gtk_list_store_new (GPK_CHOOSER_COLUMN_LAST, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
/* create package_id tree view */
widget = glade_xml_get_widget (glade_xml, "treeview_simple");
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
- GTK_TREE_MODEL (list_store));
+ GTK_TREE_MODEL (priv.list_store));
g_signal_connect (GTK_TREE_VIEW (widget), "row-activated",
- G_CALLBACK (gpk_client_run_row_activated_cb), NULL);
+ G_CALLBACK (gpk_client_run_row_activated_cb), &priv);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (selection, "changed",
- G_CALLBACK (gpk_client_run_treeview_clicked_cb), NULL);
+ G_CALLBACK (gpk_client_run_treeview_clicked_cb), &priv);
/* add columns to the tree view */
pk_treeview_add_general_columns (GTK_TREE_VIEW (widget));
@@ -398,7 +405,7 @@
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), FALSE);
/* add all the apps */
- len = gpk_client_run_add_package_ids (package_ids);
+ len = gpk_client_run_add_package_ids (&priv, package_ids);
if (len == 0) {
egg_debug ("no executable file for %s", package_ids[0]);
goto out;
@@ -424,8 +431,9 @@
gtk_widget_hide (widget);
//g_object_unref (glade_xml);
+ g_object_unref (priv.list_store);
- return full_path;
+ return priv.full_path;
}
/***************************************************************************
Modified: trunk/src/gpk-client-signature.c
==============================================================================
--- trunk/src/gpk-client-signature.c (original)
+++ trunk/src/gpk-client-signature.c Thu Jan 8 11:21:07 2009
@@ -32,6 +32,7 @@
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-client-signature.h"
static gboolean has_imported_signature = FALSE;
Modified: trunk/src/gpk-client-untrusted.c
==============================================================================
--- trunk/src/gpk-client-untrusted.c (original)
+++ trunk/src/gpk-client-untrusted.c Thu Jan 8 11:21:07 2009
@@ -33,6 +33,7 @@
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-client-untrusted.h"
#include "gpk-enum.h"
static gboolean retry_untrusted = FALSE;
@@ -123,7 +124,11 @@
/* add to box */
widget = glade_xml_get_widget (glade_xml, "dialog_error");
+#ifdef HAVE_GTK_DIALOG_GET_ACTION_AREA
widget = gtk_dialog_get_action_area (GTK_DIALOG(widget));
+#else
+ widget = GTK_DIALOG(widget)->action_area;
+#endif
gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
/* show window */
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Thu Jan 8 11:21:07 2009
@@ -63,8 +63,6 @@
#include "gpk-x11.h"
#include "gpk-desktop.h"
-static void gpk_client_class_init (GpkClientClass *klass);
-static void gpk_client_init (GpkClient *gclient);
static void gpk_client_finalize (GObject *object);
#define GPK_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CLIENT, GpkClientPrivate))
@@ -89,7 +87,9 @@
PkBitfield roles;
gboolean using_secondary_client;
gboolean retry_untrusted_value;
- gboolean show_confirm;
+ gboolean show_confirm_search;
+ gboolean show_confirm_deps;
+ gboolean show_confirm_install;
gboolean show_progress;
gboolean show_finished;
gboolean show_warning;
@@ -101,6 +101,7 @@
gchar *parent_title;
gchar *parent_icon_name;
gchar *error_details;
+ gint timeout;
GMainLoop *loop;
};
@@ -139,6 +140,10 @@
static const GEnumValue values[] =
{
ENUM_ENTRY (GPK_CLIENT_ERROR_FAILED, "Failed"),
+ ENUM_ENTRY (GPK_CLIENT_ERROR_INTERNAL_ERROR, "InternalError"),
+ ENUM_ENTRY (GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "NoPackagesFound"),
+ ENUM_ENTRY (GPK_CLIENT_ERROR_FORBIDDEN, "Forbidden"),
+ ENUM_ENTRY (GPK_CLIENT_ERROR_CANCELLED, "Cancelled"),
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("PkClientError", values);
@@ -175,13 +180,25 @@
gpk_client_set_interaction (GpkClient *gclient, PkBitfield interact)
{
g_return_if_fail (GPK_IS_CLIENT (gclient));
- gclient->priv->show_confirm = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM);
+ gclient->priv->show_confirm_search = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_SEARCH);
+ gclient->priv->show_confirm_deps = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_DEPS);
+ gclient->priv->show_confirm_install = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_CONFIRM_INSTALL);
gclient->priv->show_progress = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_PROGRESS);
gclient->priv->show_finished = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_FINISHED);
gclient->priv->show_warning = pk_bitfield_contain (interact, GPK_CLIENT_INTERACT_WARNING);
}
/**
+ * gpk_client_set_timeout:
+ **/
+void
+gpk_client_set_timeout (GpkClient *gclient, gint timeout)
+{
+ g_return_if_fail (GPK_IS_CLIENT (gclient));
+ gclient->priv->timeout = timeout;
+}
+
+/**
* gpk_client_libnotify_cb:
**/
static void
@@ -716,11 +733,14 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
return FALSE;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* install local file */
ret = pk_client_install_files (gclient->priv->client_action, trusted, files_rel, &error_local);
if (ret)
@@ -730,7 +750,7 @@
/* TRANSLATORS: title: detailed internal error why the file install failed */
title = ngettext ("Failed to install file", "Failed to install files", length);
gpk_client_error_msg (gclient, title, error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
return FALSE;
}
@@ -749,13 +769,13 @@
if (exit == PK_EXIT_ENUM_FAILED)
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Unspecified failure");
else if (exit == PK_EXIT_ENUM_CANCELLED)
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Transaction was cancelled");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "Transaction was cancelled");
else if (exit == PK_EXIT_ENUM_KEY_REQUIRED)
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "A key was required but not provided");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "A key was required but not provided");
else if (exit == PK_EXIT_ENUM_EULA_REQUIRED)
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "A EULA was not agreed to");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "A EULA was not agreed to");
else if (exit == PK_EXIT_ENUM_KILLED)
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "The transaction was killed");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "The transaction was killed");
else
egg_error ("unknown exit code");
return FALSE;
@@ -997,7 +1017,7 @@
button = gpk_client_dialog_run (gclient->priv->dialog);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Aborted the copy");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "Aborted the copy");
ret = FALSE;
goto out;
}
@@ -1106,7 +1126,7 @@
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Aborted");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "Aborted");
ret = FALSE;
goto out;
}
@@ -1185,7 +1205,7 @@
gchar *title_name;
/* check the user wanted to call this method */
- if (!gclient->priv->show_confirm)
+ if (!gclient->priv->show_confirm_search)
return TRUE;
/* make title */
@@ -1248,7 +1268,7 @@
array = pk_strv_to_ptr_array (files_rel);
/* check the user wanted to call this method */
- if (gclient->priv->show_confirm) {
+ if (gclient->priv->show_confirm_search) {
ret = gpk_client_install_local_files_verify (gclient, array, error);
if (!ret)
goto out;
@@ -1298,7 +1318,7 @@
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
/* optional, and only when successfull */
- if (ret && gclient->priv->show_confirm) {
+ if (ret && gclient->priv->show_finished) {
/* TRANSLATORS: title: we have installed the local file OK */
title = ngettext ("File was installed successfully",
"Files were installed successfully", array->len);
@@ -1345,7 +1365,7 @@
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1364,17 +1384,20 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* find out if this would force removal of other packages */
ret = pk_client_get_requires (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_ids, TRUE, &error_local);
if (!ret) {
/* TRANSLATORS: we could not work out what other packages have to be removed to remove this package */
gpk_client_error_msg (gclient, _("Could not work out what packages would also be removed"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1420,7 +1443,7 @@
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
gpk_client_dialog_close (gclient->priv->dialog);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to additional requires");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to additional requires");
ret = FALSE;
goto out;
}
@@ -1437,17 +1460,20 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* try to remove the package_ids */
ret = pk_client_remove_packages (gclient->priv->client_action, package_ids, TRUE, FALSE, &error_local);
if (!ret) {
/* TRANSLATORS: error: failed to remove the package we tried to remove */
gpk_client_error_msg (gclient, _("Failed to remove package"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1499,7 +1525,7 @@
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1518,17 +1544,20 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* find out if this would drag in other packages */
ret = pk_client_get_depends (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED), package_ids, TRUE, &error_local);
if (!ret) {
/* TRANSLATORS: error: could not get the extra package list when installing a package */
gpk_client_error_msg (gclient, _("Could not work out what packages would be also installed"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1565,7 +1594,7 @@
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
gpk_client_dialog_close (gclient->priv->dialog);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to additional deps");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to additional deps");
ret = FALSE;
goto out;
}
@@ -1582,16 +1611,19 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
ret = pk_client_install_packages (gclient->priv->client_action, package_ids, &error_local);
if (!ret) {
/* TRANSLATORS: error: failed to install, detailed error follows */
gpk_client_error_msg (gclient, _("Failed to install package"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1639,7 +1671,7 @@
g_return_val_if_fail (packages != NULL, FALSE);
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_install) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1669,7 +1701,7 @@
g_free (text);
g_free (message);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to search");
ret = FALSE;
goto out;
}
@@ -1688,17 +1720,20 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* find out if we can find a package */
ret = pk_client_resolve (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, packages, &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Incorrect response from search"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1732,7 +1767,7 @@
g_free (text);
g_free (title);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "no package found");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "no package found");
ret = FALSE;
goto out;
}
@@ -1781,7 +1816,7 @@
gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "package already found");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, "incorrect response from search");
ret = FALSE;
goto out;
}
@@ -1794,7 +1829,7 @@
ret = gpk_client_install_package_ids (gclient, package_ids, &error_local);
if (!ret) {
/* copy error message */
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, error_local->code, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1836,7 +1871,7 @@
g_return_val_if_fail (full_path != NULL, FALSE);
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -1852,7 +1887,7 @@
ret = gpk_client_confirm_action (gclient, _("wants to install a file"), message, _("Install"));
g_free (message);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to search");
ret = FALSE;
goto out;
}
@@ -1867,17 +1902,20 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* do search */
ret = pk_client_search_file (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, full_path, &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to search for file"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -1906,7 +1944,7 @@
gpk_gnome_open (info_url);
g_free (info_url);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "no files found");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "no files found");
ret = FALSE;
goto out;
}
@@ -1956,7 +1994,7 @@
/**
* gpk_client_install_gstreamer_codec_part:
**/
-PkPackageObj *
+static PkPackageObj *
gpk_client_install_gstreamer_codec_part (GpkClient *gclient, const gchar *codec_name, const gchar *codec_desc, GError **error)
{
PkPackageList *list = NULL;
@@ -1971,6 +2009,9 @@
if (!ret)
return NULL;
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* TRANSLATORS: title, searching for codecs */
title = g_strdup_printf (_("Searching for plugin: %s"), codec_name);
gpk_client_dialog_set_message (gclient->priv->dialog, title);
@@ -1986,7 +2027,7 @@
/* found nothing? */
if (len == 0) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "failed to find: %s", codec_desc);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "failed to find: %s", codec_desc);
goto out;
}
@@ -2090,13 +2131,13 @@
/* check it's not session wide banned in gconf */
ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_ENABLE_CODEC_HELPER, NULL);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "not enabled in GConf : %s", GPK_CONF_ENABLE_CODEC_HELPER);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_CODEC_HELPER);
ret = FALSE;
goto out;
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2104,7 +2145,7 @@
/* confirm */
ret = gpk_client_install_gstreamer_codecs_confirm (gclient, codec_name_strings);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to search");
ret = FALSE;
goto out;
}
@@ -2150,7 +2191,7 @@
gpk_gnome_open (info_url);
g_free (info_url);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, error_local->code, error_local->message);
g_error_free (error_local);
ret = FALSE;
}
@@ -2169,7 +2210,7 @@
goto out;
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks2;
}
@@ -2190,7 +2231,7 @@
/* close, we're going to fail the method */
if (button != GTK_RESPONSE_OK) {
gpk_client_dialog_close (gclient->priv->dialog);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to download");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to download");
ret = FALSE;
goto out;
}
@@ -2239,13 +2280,13 @@
/* check it's not session wide banned in gconf */
ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_ENABLE_MIME_TYPE_HELPER, NULL);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "not enabled in GConf : %s", GPK_CONF_ENABLE_MIME_TYPE_HELPER);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_MIME_TYPE_HELPER);
ret = FALSE;
goto out;
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2262,7 +2303,7 @@
ret = gpk_client_confirm_action (gclient, _("requires a new mime type"), message, _("Search"));
g_free (message);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to search");
ret = FALSE;
goto out;
}
@@ -2283,18 +2324,21 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* action */
ret = pk_client_what_provides (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
PK_PROVIDES_ENUM_MIMETYPE, mime_type, &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to search for provides"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -2323,7 +2367,7 @@
gpk_gnome_open (info_url);
g_free (info_url);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "nothing was found to handle mime type");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "nothing was found to handle mime type");
ret = FALSE;
goto out;
}
@@ -2344,7 +2388,7 @@
gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "user chose nothing");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "user chose nothing");
ret = FALSE;
goto out;
}
@@ -2475,18 +2519,18 @@
g_return_val_if_fail (fonts != NULL, FALSE);
/* get number of fonts to install */
- len = g_strv_length (fonts);
+ len = g_strv_length ((gchar **)fonts);
/* check it's not session wide banned in gconf */
ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_ENABLE_FONT_HELPER, NULL);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "not enabled in GConf : %s", GPK_CONF_ENABLE_FONT_HELPER);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FORBIDDEN, "not enabled in GConf : %s", GPK_CONF_ENABLE_FONT_HELPER);
ret = FALSE;
goto out;
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2518,6 +2562,7 @@
/* check user wanted operation */
message = g_strdup_printf ("%s\n\n%s\n%s", title, text, title_part);
+ g_free (text);
/* TRANSLATORS: generic confirm, the application name is used as a prefix */
title = ngettext ("wants to install a font", "wants to install fonts", len);
@@ -2526,7 +2571,7 @@
ret = gpk_client_confirm_action (gclient, title, message, _("Search"));
g_free (message);
if (!ret) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to search");
ret = FALSE;
goto out;
}
@@ -2552,18 +2597,21 @@
if (!ret) {
/* TRANSLATORS: this is an internal error, and should not be seen */
gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* action */
ret = pk_client_what_provides (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
PK_PROVIDES_ENUM_FONT, fonts[i], &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to search for provides"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -2598,13 +2646,13 @@
gpk_gnome_open (info_url);
g_free (info_url);
}
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "failed to find font");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "failed to find font");
ret = FALSE;
goto out;
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks2;
}
@@ -2624,7 +2672,7 @@
/* close, we're going to fail the method */
if (button != GTK_RESPONSE_OK) {
gpk_client_dialog_close (gclient->priv->dialog);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to download");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "did not agree to download");
ret = FALSE;
goto out;
}
@@ -2690,7 +2738,7 @@
len = g_strv_length (filenames);
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_search) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks;
}
@@ -2749,7 +2797,7 @@
}
/* optional */
- if (!gclient->priv->show_confirm) {
+ if (!gclient->priv->show_confirm_deps) {
egg_debug ("skip confirm as not allowed to interact with user");
goto skip_checks2;
}
@@ -2785,7 +2833,7 @@
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Action was cancelled");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_CANCELLED, "Action was cancelled");
ret = FALSE;
goto out;
}
@@ -2821,11 +2869,14 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title: update all pending updates */
gpk_client_dialog_set_title (gclient->priv->dialog, _("System update"));
@@ -2836,7 +2887,7 @@
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to update system"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -2899,11 +2950,14 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: refresh the lists of packages */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Refresh package lists"));
@@ -2914,7 +2968,7 @@
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to update package lists"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -2952,17 +3006,20 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* wrap update, but handle all the GPG and EULA stuff */
ret = pk_client_get_updates (gclient->priv->client_action, PK_FILTER_ENUM_NONE, &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to get updates"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -3006,11 +3063,14 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
return NULL;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* clear old data */
if (gclient->priv->upgrade_array->len > 0) {
g_ptr_array_foreach (gclient->priv->upgrade_array, (GFunc) pk_distro_upgrade_obj_free, NULL);
@@ -3022,7 +3082,7 @@
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Getting update lists failed"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -3057,11 +3117,14 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
return NULL;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* wrap get files */
package_ids = pk_package_ids_from_id (package_id);
ret = pk_client_get_files (gclient->priv->client_action, package_ids, &error_local);
@@ -3069,7 +3132,7 @@
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Getting file list failed"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
return NULL;
}
@@ -3090,7 +3153,7 @@
/* no files? */
if (gclient->priv->files_array == NULL) {
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "no files were found");
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_NO_PACKAGES_FOUND, "no files were found");
return NULL;
}
@@ -3114,17 +3177,20 @@
if (!ret) {
/* TRANSLATORS: this should never happen, low level failure */
gpk_client_error_msg (gclient, _("Failed to reset client to perform action"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_action, gclient->priv->timeout, NULL);
+
/* wrap update, but handle all the GPG and EULA stuff */
ret = pk_client_update_packages (gclient->priv->client_action, package_ids, &error_local);
if (!ret) {
/* TRANSLATORS: we failed to find the package, this shouldn't happen */
gpk_client_error_msg (gclient, _("Failed to update packages"), error_local);
- gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_INTERNAL_ERROR, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -3443,6 +3509,9 @@
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (gclient->priv->client_resolve, gclient->priv->timeout, NULL);
+
/* find the package name */
ret = pk_client_search_file (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), exec, &error);
if (!ret) {
@@ -3507,7 +3576,7 @@
gpk_client_set_parent_exec (GpkClient *gclient, const gchar *exec)
{
GpkX11 *x11;
- gchar *package;
+ gchar *package = NULL;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
@@ -3549,6 +3618,7 @@
gclient->priv->parent_title = g_path_get_basename (exec);
}
out:
+ g_free (package);
egg_debug ("got name=%s, icon=%s", gclient->priv->parent_title, gclient->priv->parent_icon_name);
return TRUE;
}
@@ -3637,12 +3707,15 @@
gclient->priv->error_details = NULL;
gclient->priv->using_secondary_client = FALSE;
gclient->priv->exit = PK_EXIT_ENUM_FAILED;
- gclient->priv->show_confirm = TRUE;
+ gclient->priv->show_confirm_search = TRUE;
+ gclient->priv->show_confirm_deps = TRUE;
+ gclient->priv->show_confirm_install = TRUE;
gclient->priv->show_progress = TRUE;
gclient->priv->show_finished = TRUE;
gclient->priv->show_warning = TRUE;
gclient->priv->finished_timer_id = 0;
gclient->priv->timestamp = 0;
+ gclient->priv->timeout = -1;
gclient->priv->loop = g_main_loop_new (NULL, FALSE);
/* add application specific icons to search path */
@@ -3784,7 +3857,7 @@
gchar *language;
gchar *package;
gboolean ret;
- gchar *fonts[] = { ":lang=mn", NULL };
+ const gchar *fonts[] = { ":lang=mn", NULL };
GError *error;
if (egg_test_start (test, "GpkChooser") == FALSE)
@@ -3853,7 +3926,7 @@
egg_test_title (test, "install fonts (no UI)");
error = NULL;
gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_NEVER);
- ret = gpk_client_install_fonts (gclient, fonts, &error);
+ ret = gpk_client_install_fonts (gclient, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
@@ -3865,8 +3938,8 @@
/************************************************************/
egg_test_title (test, "install fonts (if found)");
error = NULL;
- gpk_client_set_interaction (gclient, pk_bitfield_from_enums (GPK_CLIENT_INTERACT_CONFIRM, GPK_CLIENT_INTERACT_FINISHED, -1));
- ret = gpk_client_install_fonts (gclient, fonts, &error);
+ gpk_client_set_interaction (gclient, pk_bitfield_from_enums (GPK_CLIENT_INTERACT_CONFIRM_SEARCH, GPK_CLIENT_INTERACT_FINISHED, -1));
+ ret = gpk_client_install_fonts (gclient, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
@@ -3879,7 +3952,7 @@
egg_test_title (test, "install fonts (always)");
error = NULL;
gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_ALWAYS);
- ret = gpk_client_install_fonts (gclient, fonts, &error);
+ ret = gpk_client_install_fonts (gclient, (gchar**)fonts, &error);
if (ret)
egg_test_success (test, NULL);
else {
Modified: trunk/src/gpk-client.h
==============================================================================
--- trunk/src/gpk-client.h (original)
+++ trunk/src/gpk-client.h Thu Jan 8 11:21:07 2009
@@ -45,7 +45,12 @@
*/
typedef enum
{
- GPK_CLIENT_ERROR_FAILED
+ GPK_CLIENT_ERROR_FAILED,
+ GPK_CLIENT_ERROR_INTERNAL_ERROR,
+ GPK_CLIENT_ERROR_NO_PACKAGES_FOUND,
+ GPK_CLIENT_ERROR_FORBIDDEN,
+ GPK_CLIENT_ERROR_CANCELLED,
+ GPK_CLIENT_ERROR_LAST
} GpkClientError;
/**
@@ -53,7 +58,9 @@
*/
typedef enum
{
- GPK_CLIENT_INTERACT_CONFIRM,
+ GPK_CLIENT_INTERACT_CONFIRM_SEARCH,
+ GPK_CLIENT_INTERACT_CONFIRM_DEPS,
+ GPK_CLIENT_INTERACT_CONFIRM_INSTALL,
GPK_CLIENT_INTERACT_PROGRESS,
GPK_CLIENT_INTERACT_FINISHED,
GPK_CLIENT_INTERACT_WARNING,
@@ -61,10 +68,20 @@
} GpkClientInteract;
#define GPK_CLIENT_INTERACT_NEVER 0
-#define GPK_CLIENT_INTERACT_ALWAYS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, GPK_CLIENT_INTERACT_CONFIRM, GPK_CLIENT_INTERACT_PROGRESS, GPK_CLIENT_INTERACT_FINISHED, -1)
-#define GPK_CLIENT_INTERACT_WARNING_CONFIRM_PROGRESS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, GPK_CLIENT_INTERACT_CONFIRM, GPK_CLIENT_INTERACT_PROGRESS, -1)
+#define GPK_CLIENT_INTERACT_ALWAYS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, \
+ GPK_CLIENT_INTERACT_CONFIRM_SEARCH, \
+ GPK_CLIENT_INTERACT_CONFIRM_DEPS, \
+ GPK_CLIENT_INTERACT_CONFIRM_INSTALL, \
+ GPK_CLIENT_INTERACT_PROGRESS, \
+ GPK_CLIENT_INTERACT_FINISHED, -1)
+#define GPK_CLIENT_INTERACT_WARNING_CONFIRM_PROGRESS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, \
+ GPK_CLIENT_INTERACT_CONFIRM_SEARCH, \
+ GPK_CLIENT_INTERACT_CONFIRM_DEPS, \
+ GPK_CLIENT_INTERACT_CONFIRM_INSTALL, \
+ GPK_CLIENT_INTERACT_PROGRESS, -1)
#define GPK_CLIENT_INTERACT_WARNING pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, -1)
-#define GPK_CLIENT_INTERACT_WARNING_PROGRESS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, GPK_CLIENT_INTERACT_PROGRESS, -1)
+#define GPK_CLIENT_INTERACT_WARNING_PROGRESS pk_bitfield_from_enums (GPK_CLIENT_INTERACT_WARNING, \
+ GPK_CLIENT_INTERACT_PROGRESS, -1)
typedef struct _GpkClientPrivate GpkClientPrivate;
typedef struct _GpkClient GpkClient;
@@ -83,6 +100,7 @@
GQuark gpk_client_error_quark (void);
GType gpk_client_get_type (void) G_GNUC_CONST;
+GType gpk_client_error_get_type (void);
GpkClient *gpk_client_new (void);
gboolean gpk_client_install_local_files (GpkClient *gclient,
@@ -121,6 +139,8 @@
GError **error);
void gpk_client_set_interaction (GpkClient *gclient,
PkBitfield interact);
+void gpk_client_set_timeout (GpkClient *gclient,
+ gint timeout);
PkPackageList *gpk_client_get_updates (GpkClient *gclient,
GError **error);
const GPtrArray *gpk_client_get_distro_upgrades (GpkClient *gclient,
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Thu Jan 8 11:21:07 2009
@@ -41,6 +41,52 @@
#include "gpk-common.h"
#include "gpk-error.h"
+#define GNOME_SESSION_MANAGER_NAME "org.gnome.SessionManager"
+#define GNOME_SESSION_MANAGER_PATH "/org/gnome/SessionManager"
+#define GNOME_SESSION_MANAGER_INTERFACE "org.gnome.SessionManager"
+
+/**
+ * gpk_session_logout:
+ **/
+gboolean
+gpk_session_logout (void)
+{
+ DBusGConnection *connection;
+ DBusGProxy *proxy = NULL;
+ gboolean ret = FALSE;
+ GError *error = NULL;
+
+ /* connect to DBus */
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ if (connection == NULL) {
+ egg_warning ("Failed to connect to DBus: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* connect to SessionManager */
+ proxy = dbus_g_proxy_new_for_name (connection, GNOME_SESSION_MANAGER_NAME,
+ GNOME_SESSION_MANAGER_PATH,
+ GNOME_SESSION_MANAGER_INTERFACE);
+ if (proxy == NULL) {
+ egg_warning ("cannot connect to session manager");
+ goto out;
+ }
+ ret = dbus_g_proxy_call (proxy, "Logout", &error,
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (!ret) {
+ egg_warning ("Failed to logout: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+out:
+ if (proxy != NULL)
+ g_object_unref (proxy);
+ return ret;
+}
+
/**
* gpk_window_set_size_request:
**/
Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h (original)
+++ trunk/src/gpk-common.h Thu Jan 8 11:21:07 2009
@@ -42,6 +42,8 @@
#define GPK_CONF_NOTIFY_UPDATE_FAILED "/apps/gnome-packagekit/notify_update_failed"
#define GPK_CONF_NOTIFY_UPDATE_COMPLETE "/apps/gnome-packagekit/notify_update_complete"
#define GPK_CONF_NOTIFY_UPDATE_COMPLETE_RESTART "/apps/gnome-packagekit/notify_update_complete_restart"
+#define GPK_CONF_CONNECTION_USE_MOBILE "/apps/gnome-packagekit/connection_use_mobile"
+#define GPK_CONF_CONNECTION_USE_WIFI "/apps/gnome-packagekit/connection_use_wifi"
#define GPK_CONF_AUTOCOMPLETE "/apps/gnome-packagekit/autocomplete"
#define GPK_CONF_SESSION_STARTUP_TIMEOUT "/apps/gnome-packagekit/session_startup_timeout"
#define GPK_CONF_FORCE_GET_UPDATES_LOGIN "/apps/gnome-packagekit/force_get_updates_login"
@@ -53,11 +55,13 @@
#define GPK_CONF_SHOW_DEPENDS "/apps/gnome-packagekit/show_depends"
#define GPK_CONF_SHOW_COPY_CONFIRM "/apps/gnome-packagekit/show_copy_confirm"
#define GPK_CONF_BANNED_FIRMWARE "/apps/gnome-packagekit/banned_firmware"
-
+#define GPK_CONF_DBUS_DEFAULT_INTERACTION "/apps/gnome-packagekit/dbus_default_interaction"
+#define GPK_CONF_DBUS_ENFORCED_INTERACTION "/apps/gnome-packagekit/dbus_enforced_interaction"
#define GPK_CONF_REPO_SHOW_DETAILS "/apps/gnome-packagekit/repo/show_details"
#define GPK_CONF_APPLICATION_FILTER_BASENAME "/apps/gnome-packagekit/application/filter_basename"
#define GPK_CONF_APPLICATION_FILTER_NEWEST "/apps/gnome-packagekit/application/filter_newest"
#define GPK_CONF_APPLICATION_CATEGORY_GROUPS "/apps/gnome-packagekit/application/category_groups"
+#define GPK_CONF_APPLICATION_SEARCH_MODE "/apps/gnome-packagekit/application/search_mode"
#define GPK_CONF_UPDATE_VIEWER_PRECACHE_DETAILS "/apps/gnome-packagekit/update_viewer/precache_details"
#define GPK_CONF_ENABLE_FONT_HELPER "/apps/gnome-packagekit/enable_font_helper"
@@ -95,6 +99,7 @@
gboolean gpk_window_set_size_request (GtkWindow *window,
guint width,
guint height);
+gboolean gpk_session_logout (void);
G_END_DECLS
Modified: trunk/src/gpk-consolekit.c
==============================================================================
--- trunk/src/gpk-consolekit.c (original)
+++ trunk/src/gpk-consolekit.c Thu Jan 8 11:21:07 2009
@@ -30,6 +30,7 @@
#include "egg-debug.h"
#include "gpk-common.h"
+#include "gpk-consolekit.h"
#include "gpk-error.h"
/**
Modified: trunk/src/gpk-dbus.c
==============================================================================
--- trunk/src/gpk-dbus.c (original)
+++ trunk/src/gpk-dbus.c Thu Jan 8 11:21:07 2009
@@ -41,15 +41,16 @@
#include <polkit/polkit.h>
#include <polkit-dbus/polkit-dbus.h>
#include <packagekit-glib/packagekit.h>
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
+#include "egg-string.h"
#include "gpk-dbus.h"
#include "gpk-x11.h"
#include "gpk-client.h"
+#include "gpk-common.h"
-static void gpk_dbus_class_init (GpkDbusClass *klass);
-static void gpk_dbus_init (GpkDbus *dbus);
static void gpk_dbus_finalize (GObject *object);
#define GPK_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_DBUS, GpkDbusPrivate))
@@ -58,6 +59,8 @@
{
GpkClient *gclient;
PkClient *client;
+ GConfClient *gconf_client;
+ gint timeout;
};
G_DEFINE_TYPE (GpkDbus, gpk_dbus, G_TYPE_OBJECT)
@@ -87,7 +90,11 @@
if (etype == 0) {
static const GEnumValue values[] =
{
- ENUM_ENTRY (GPK_DBUS_ERROR_DENIED, "PermissionDenied"),
+ ENUM_ENTRY (GPK_DBUS_ERROR_FAILED, "Failed"),
+ ENUM_ENTRY (GPK_DBUS_ERROR_INTERNAL_ERROR, "InternalError"),
+ ENUM_ENTRY (GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "NoPackagesFound"),
+ ENUM_ENTRY (GPK_DBUS_ERROR_FORBIDDEN, "Forbidden"),
+ ENUM_ENTRY (GPK_DBUS_ERROR_CANCELLED, "Cancelled"),
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GpkDbusError", values);
@@ -147,7 +154,7 @@
/**
* gpk_dbus_set_parent_window:
**/
-void
+static void
gpk_dbus_set_parent_window (GpkDbus *dbus, guint32 xid, guint32 timestamp)
{
GpkX11 *x11;
@@ -201,7 +208,7 @@
ret = gpk_client_install_local_files (dbus->priv->gclient, full_paths, &error_local);
g_strfreev (full_paths);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -240,7 +247,7 @@
/* do the action */
ret = gpk_client_install_provide_file (dbus->priv->gclient, full_path, &error_local);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -285,7 +292,7 @@
g_strfreev (package_names);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -295,6 +302,7 @@
dbus_g_method_return (context);
}
+#if 0
/**
* gpk_dbus_install_package_names:
**/
@@ -323,7 +331,7 @@
/* do the action */
ret = gpk_client_install_package_names (dbus->priv->gclient, package_names, &error_local);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -332,6 +340,7 @@
dbus_g_method_return (context);
}
+#endif
/**
* gpk_dbus_install_mime_type:
@@ -362,7 +371,7 @@
/* do the action */
ret = gpk_client_install_mime_type (dbus->priv->gclient, mime_type, &error_local);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -383,9 +392,6 @@
GError *error_local = NULL;
gchar *sender;
gchar *exec;
-
- g_return_if_fail (PK_IS_DBUS (dbus));
-
guint i;
GValue *value;
gchar *description;
@@ -395,6 +401,8 @@
GValueArray *varray;
gchar **codec_strings;
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
egg_debug ("InstallGStreamerCodecs method called");
/* set modality */
@@ -431,7 +439,7 @@
g_strfreev (codec_strings);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -455,7 +463,7 @@
g_return_if_fail (PK_IS_DBUS (dbus));
- egg_debug ("InstallPackageNames method called: %s", fonts[0]);
+ egg_debug ("InstallFonts method called: %s", fonts[0]);
gpk_dbus_set_parent_window (dbus, xid, timestamp);
@@ -469,7 +477,7 @@
/* do the action */
ret = gpk_client_install_fonts (dbus->priv->gclient, fonts, &error_local);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -511,7 +519,7 @@
ret = gpk_client_install_fonts (dbus->priv->gclient, fonts, &error_local);
g_strfreev (fonts);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -556,7 +564,7 @@
g_strfreev (catalog_files);
if (!ret) {
- error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
"Method failed: %s", error_local->message);
g_error_free (error_local);
dbus_g_method_return_error (context, error);
@@ -567,6 +575,121 @@
}
/**
+ * gpk_dbus_set_interaction_from_text:
+ **/
+static void
+gpk_dbus_set_interaction_from_text (PkBitfield *interact, gint *timeout, const gchar *interaction)
+{
+ guint i;
+ guint len;
+ gchar **interactions;
+ interactions = g_strsplit (interaction, ",", -1);
+ len = g_strv_length (interactions);
+
+ /* do special keys first */
+ for (i=0; i<len; i++) {
+ if (egg_strequal (interactions[i], "always"))
+ *interact = GPK_CLIENT_INTERACT_ALWAYS;
+ else if (egg_strequal (interactions[i], "never"))
+ *interact = GPK_CLIENT_INTERACT_NEVER;
+ }
+
+ /* add or remove from defaults */
+ for (i=0; i<len; i++) {
+ /* show */
+ if (egg_strequal (interactions[i], "show-confirm-search"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_CONFIRM_SEARCH);
+ else if (egg_strequal (interactions[i], "show-confirm-deps"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_CONFIRM_DEPS);
+ else if (egg_strequal (interactions[i], "show-confirm-install"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_CONFIRM_INSTALL);
+ else if (egg_strequal (interactions[i], "show-progress"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_PROGRESS);
+ else if (egg_strequal (interactions[i], "show-finished"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_FINISHED);
+ else if (egg_strequal (interactions[i], "show-warning"))
+ pk_bitfield_add (*interact, GPK_CLIENT_INTERACT_WARNING);
+ /* hide */
+ else if (egg_strequal (interactions[i], "hide-confirm-search"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_CONFIRM_SEARCH);
+ else if (egg_strequal (interactions[i], "hide-confirm-deps"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_CONFIRM_DEPS);
+ else if (egg_strequal (interactions[i], "hide-confirm-install"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_CONFIRM_INSTALL);
+ else if (egg_strequal (interactions[i], "hide-progress"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_PROGRESS);
+ else if (egg_strequal (interactions[i], "hide-finished"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_FINISHED);
+ else if (egg_strequal (interactions[i], "hide-warning"))
+ pk_bitfield_remove (*interact, GPK_CLIENT_INTERACT_WARNING);
+ /* wait */
+ else if (g_str_has_prefix (interactions[i], "timeout="))
+ *timeout = atoi (&interactions[i][8]);
+ }
+ g_strfreev (interactions);
+}
+
+/**
+ * gpk_dbus_set_interaction:
+ **/
+static void
+gpk_dbus_set_interaction (GpkDbus *dbus, const gchar *interaction)
+{
+ PkBitfield interact = 0;
+ gchar *policy;
+
+ /* set default */
+ dbus->priv->timeout = -1;
+
+ /* get default policy from gconf */
+ policy = gconf_client_get_string (dbus->priv->gconf_client, GPK_CONF_DBUS_DEFAULT_INTERACTION, NULL);
+ if (policy != NULL) {
+ egg_debug ("default is %s", policy);
+ gpk_dbus_set_interaction_from_text (&interact, &dbus->priv->timeout, policy);
+ }
+ g_free (policy);
+
+ /* now override with policy from client */
+ gpk_dbus_set_interaction_from_text (&interact, &dbus->priv->timeout, interaction);
+ egg_debug ("client is %s", interaction);
+
+ /* now override with enforced policy from gconf */
+ policy = gconf_client_get_string (dbus->priv->gconf_client, GPK_CONF_DBUS_ENFORCED_INTERACTION, NULL);
+ if (policy != NULL) {
+ egg_debug ("enforced is %s", policy);
+ gpk_dbus_set_interaction_from_text (&interact, &dbus->priv->timeout, policy);
+ }
+ g_free (policy);
+
+ /* set the interaction mode */
+ egg_debug ("interact=%i", (gint) interact);
+ gpk_client_set_interaction (dbus->priv->gclient, interact);
+
+ /* set the timeout locally and in the helper client */
+ egg_debug ("timeout=%i", dbus->priv->timeout);
+ gpk_client_set_timeout (dbus->priv->gclient, dbus->priv->timeout);
+}
+
+/**
+ * gpk_dbus_set_context:
+ **/
+static void
+gpk_dbus_set_context (GpkDbus *dbus, DBusGMethodInvocation *context)
+{
+ gchar *sender;
+ gchar *exec;
+
+ /* get the program name and set */
+ sender = dbus_g_method_get_sender (context);
+ exec = gpk_dbus_get_exec_for_sender (sender);
+ gpk_client_set_parent_exec (dbus->priv->gclient, exec);
+
+ g_free (sender);
+ g_free (exec);
+}
+
+#if 0
+/**
* gpk_dbus_is_package_installed:
**/
gboolean
@@ -582,16 +705,66 @@
/* reset */
ret = pk_client_reset (dbus->priv->client, &error_local);
if (!ret) {
- *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED, "failed to get installed status: %s", error_local->message);
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to get installed status: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* set timeout */
+ pk_client_set_timeout (dbus->priv->client, dbus->priv->timeout, NULL);
+
+ /* get the package list for the installed packages */
+ package_names = g_strsplit (package_name, "|", 1);
+ ret = pk_client_resolve (dbus->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_names, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to get installed status: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* more than one entry? */
+ list = pk_client_get_package_list (dbus->priv->client);
+ *installed = (PK_OBJ_LIST(list)->len > 0);
+out:
+ if (list != NULL)
+ g_object_unref (list);
+ g_strfreev (package_names);
+ return ret;
+}
+#endif
+
+/**
+ * gpk_dbus_is_installed:
+ **/
+gboolean
+gpk_dbus_is_installed (GpkDbus *dbus, const gchar *package_name, const gchar *interaction, gboolean *installed, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ PkPackageList *list = NULL;
+ gchar **package_names = NULL;
+
+ g_return_val_if_fail (PK_IS_DBUS (dbus), FALSE);
+
+ /* process wait command */
+ gpk_dbus_set_interaction (dbus, interaction);
+
+ /* reset */
+ ret = pk_client_reset (dbus->priv->client, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to get installed status: %s", error_local->message);
g_error_free (error_local);
goto out;
}
+ /* set timeout */
+ pk_client_set_timeout (dbus->priv->client, dbus->priv->timeout, NULL);
+
/* get the package list for the installed packages */
package_names = g_strsplit (package_name, "|", 1);
ret = pk_client_resolve (dbus->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_names, &error_local);
if (!ret) {
- *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED, "failed to get installed status: %s", error_local->message);
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to get installed status: %s", error_local->message);
g_error_free (error_local);
goto out;
}
@@ -607,6 +780,252 @@
}
/**
+ * gpk_dbus_search_file:
+ **/
+gboolean
+gpk_dbus_search_file (GpkDbus *dbus, const gchar *file_name, const gchar *interaction, gboolean *installed, gchar **package_name, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ PkPackageList *list = NULL;
+ const PkPackageObj *obj;
+
+ g_return_val_if_fail (PK_IS_DBUS (dbus), FALSE);
+
+ /* process wait command */
+ gpk_dbus_set_interaction (dbus, interaction);
+
+ /* reset */
+ ret = pk_client_reset (dbus->priv->client, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to get installed status: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* set timeout */
+ pk_client_set_timeout (dbus->priv->client, dbus->priv->timeout, NULL);
+
+ /* get the package list for the installed packages */
+ ret = pk_client_search_file (dbus->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), file_name, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_INTERNAL_ERROR, "failed to search for file: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* more than one entry? */
+ list = pk_client_get_package_list (dbus->priv->client);
+ if (PK_OBJ_LIST(list)->len < 1) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_NO_PACKAGES_FOUND, "could not find package providing file");
+ ret = FALSE;
+ goto out;
+ }
+
+ /* get the package name too */
+ *installed = TRUE;
+ obj = pk_package_list_get_obj (list, 0);
+ *package_name = g_strdup (obj->id->name);
+
+out:
+ if (list != NULL)
+ g_object_unref (list);
+ return ret;
+}
+
+/**
+ * gpk_dbus_install_provide_files:
+ **/
+void
+gpk_dbus_install_provide_files (GpkDbus *dbus, guint32 xid, gchar **files, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallProvideFiles method called: %s", files[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_provide_file (dbus->priv->gclient, files[0], &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
+ * gpk_dbus_install_package_files:
+ **/
+void
+gpk_dbus_install_package_files (GpkDbus *dbus, guint32 xid, gchar **files, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallPackageFiles method called: %s", files[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_local_files (dbus->priv->gclient, files, &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
+ * gpk_dbus_install_package_names:
+ **/
+void
+gpk_dbus_install_package_names (GpkDbus *dbus, guint32 xid, gchar **packages, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallPackageNames method called: %s", packages[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_package_names (dbus->priv->gclient, packages, &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
+ * gpk_dbus_install_mime_types:
+ **/
+void
+gpk_dbus_install_mime_types (GpkDbus *dbus, guint32 xid, gchar **mime_types, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallMimeTypes method called: %s", mime_types[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_mime_type (dbus->priv->gclient, mime_types[0], &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
+ * gpk_dbus_install_fontconfig_resources:
+ **/
+void
+gpk_dbus_install_fontconfig_resources (GpkDbus *dbus, guint32 xid, gchar **resources, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallFontconfigResources method called: %s", resources[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_fonts (dbus->priv->gclient, resources, &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
+ * gpk_dbus_install_gstreamer_resources:
+ **/
+void
+gpk_dbus_install_gstreamer_resources (GpkDbus *dbus, guint32 xid, gchar **resources, const gchar *interaction, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallGStreamerResources method called: %s", resources[0]);
+
+ /* set common parameters */
+ gpk_dbus_set_parent_window (dbus, xid, 0);
+ gpk_dbus_set_interaction (dbus, interaction);
+ gpk_dbus_set_context (dbus, context);
+
+ /* do the action */
+ ret = gpk_client_install_gstreamer_codecs (dbus->priv->gclient, resources, &error_local);
+ if (!ret) {
+ error = g_error_new (GPK_DBUS_ERROR, error_local->code,
+ "Method failed: %s", error_local->message);
+ g_error_free (error_local);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ dbus_g_method_return (context);
+}
+
+/**
* gpk_dbus_class_init:
* @klass: The GpkDbusClass
**/
@@ -626,9 +1045,12 @@
gpk_dbus_init (GpkDbus *dbus)
{
dbus->priv = GPK_DBUS_GET_PRIVATE (dbus);
+ dbus->priv->timeout = -1;
+ dbus->priv->gconf_client = gconf_client_get_default ();
dbus->priv->client = pk_client_new ();
pk_client_set_use_buffer (dbus->priv->client, TRUE, NULL);
pk_client_set_synchronous (dbus->priv->client, TRUE, NULL);
+
dbus->priv->gclient = gpk_client_new ();
gpk_client_set_interaction (dbus->priv->gclient, GPK_CLIENT_INTERACT_WARNING_CONFIRM_PROGRESS);
}
@@ -647,6 +1069,7 @@
g_return_if_fail (dbus->priv != NULL);
g_object_unref (dbus->priv->client);
g_object_unref (dbus->priv->gclient);
+ g_object_unref (dbus->priv->gconf_client);
G_OBJECT_CLASS (gpk_dbus_parent_class)->finalize (object);
}
Modified: trunk/src/gpk-dbus.h
==============================================================================
--- trunk/src/gpk-dbus.h (original)
+++ trunk/src/gpk-dbus.h Thu Jan 8 11:21:07 2009
@@ -51,7 +51,11 @@
typedef enum
{
- GPK_DBUS_ERROR_DENIED,
+ GPK_DBUS_ERROR_FAILED,
+ GPK_DBUS_ERROR_INTERNAL_ERROR,
+ GPK_DBUS_ERROR_NO_PACKAGES_FOUND,
+ GPK_DBUS_ERROR_FORBIDDEN,
+ GPK_DBUS_ERROR_CANCELLED,
GPK_DBUS_ERROR_LAST
} GpkDbusError;
@@ -75,11 +79,13 @@
guint32 timestamp,
const gchar *package_name,
DBusGMethodInvocation *context);
+#if 0
void gpk_dbus_install_package_names (GpkDbus *dbus,
guint32 xid,
guint32 timestamp,
gchar **package_names,
DBusGMethodInvocation *context);
+#endif
void gpk_dbus_install_mime_type (GpkDbus *dbus,
guint32 xid,
guint32 timestamp,
@@ -105,10 +111,57 @@
guint32 timestamp,
const gchar *catalog_file,
DBusGMethodInvocation *context);
+#if 0
gboolean gpk_dbus_is_package_installed (GpkDbus *dbus,
const gchar *package_name,
gboolean *installed,
GError **error);
+#endif
+
+/* org.freedesktop.PackageKit.Query */
+gboolean gpk_dbus_is_installed (GpkDbus *dbus,
+ const gchar *package_name,
+ const gchar *interaction,
+ gboolean *installed,
+ GError **error);
+gboolean gpk_dbus_search_file (GpkDbus *dbus,
+ const gchar *file_name,
+ const gchar *interaction,
+ gboolean *installed,
+ gchar **package_name,
+ GError **error);
+
+/* org.freedesktop.PackageKit.Modify */
+void gpk_dbus_install_provide_files (GpkDbus *dbus,
+ guint32 xid,
+ gchar **files,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
+void gpk_dbus_install_package_files (GpkDbus *dbus,
+ guint32 xid,
+ gchar **files,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
+void gpk_dbus_install_package_names (GpkDbus *dbus,
+ guint32 xid,
+ gchar **packages,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
+void gpk_dbus_install_mime_types (GpkDbus *dbus,
+ guint32 xid,
+ gchar **mime_types,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
+void gpk_dbus_install_fontconfig_resources (GpkDbus *dbus,
+ guint32 xid,
+ gchar **fonts,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
+void gpk_dbus_install_gstreamer_resources (GpkDbus *dbus,
+ guint32 xid,
+ gchar **codecs,
+ const gchar *interaction,
+ DBusGMethodInvocation *context);
G_END_DECLS
Modified: trunk/src/gpk-error.c
==============================================================================
--- trunk/src/gpk-error.c (original)
+++ trunk/src/gpk-error.c Thu Jan 8 11:21:07 2009
@@ -33,6 +33,7 @@
#include "egg-string.h"
#include "gpk-common.h"
+#include "gpk-error.h"
/**
* gpk_error_dialog_modal_with_time:
Modified: trunk/src/gpk-firmware.c
==============================================================================
--- trunk/src/gpk-firmware.c (original)
+++ trunk/src/gpk-firmware.c Thu Jan 8 11:21:07 2009
@@ -46,8 +46,6 @@
#include "gpk-common.h"
#include "gpk-firmware.h"
-static void gpk_firmware_class_init (GpkFirmwareClass *klass);
-static void gpk_firmware_init (GpkFirmware *firmware);
static void gpk_firmware_finalize (GObject *object);
#define GPK_FIRMWARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_FIRMWARE, GpkFirmwarePrivate))
Modified: trunk/src/gpk-gnome.c
==============================================================================
--- trunk/src/gpk-gnome.c (original)
+++ trunk/src/gpk-gnome.c Thu Jan 8 11:21:07 2009
@@ -26,6 +26,7 @@
#include <string.h>
#include "egg-debug.h"
+#include "gpk-gnome.h"
/**
* gpk_gnome_open:
Modified: trunk/src/gpk-hardware.c
==============================================================================
--- trunk/src/gpk-hardware.c (original)
+++ trunk/src/gpk-hardware.c Thu Jan 8 11:21:07 2009
@@ -49,8 +49,6 @@
#include "gpk-common.h"
#include "gpk-hardware.h"
-static void gpk_hardware_class_init (GpkHardwareClass *klass);
-static void gpk_hardware_init (GpkHardware *hardware);
static void gpk_hardware_finalize (GObject *object);
#define GPK_HARDWARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_HARDWARE, GpkHardwarePrivate))
Modified: trunk/src/gpk-inhibit.c
==============================================================================
--- trunk/src/gpk-inhibit.c (original)
+++ trunk/src/gpk-inhibit.c Thu Jan 8 11:21:07 2009
@@ -41,8 +41,6 @@
#include "gpk-inhibit.h"
#include "gpk-common.h"
-static void gpk_inhibit_class_init (GpkInhibitClass *klass);
-static void gpk_inhibit_init (GpkInhibit *inhibit);
static void gpk_inhibit_finalize (GObject *object);
#define GPK_INHIBIT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_INHIBIT, GpkInhibitPrivate))
Modified: trunk/src/gpk-language.c
==============================================================================
--- trunk/src/gpk-language.c (original)
+++ trunk/src/gpk-language.c Thu Jan 8 11:21:07 2009
@@ -28,8 +28,6 @@
#include "gpk-language.h"
-static void gpk_language_class_init (GpkLanguageClass *klass);
-static void gpk_language_init (GpkLanguage *language);
static void gpk_language_finalize (GObject *object);
#define GPK_LANGUAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_LANGUAGE, GpkLanguagePrivate))
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Thu Jan 8 11:21:07 2009
@@ -286,6 +286,20 @@
}
/**
+ * gpk_log_treeview_size_allocate_cb:
+ **/
+static void
+gpk_log_treeview_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, GtkCellRenderer *cell)
+{
+ GtkTreeViewColumn *column;
+ gint width;
+
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(widget), 2);
+ width = gtk_tree_view_column_get_width (column);
+ g_object_set (cell, "wrap-width", width - 10, NULL);
+}
+
+/**
* pk_treeview_add_general_columns:
**/
static void
@@ -332,6 +346,7 @@
g_object_set (renderer, "yalign", 0.0, NULL);
g_object_set(renderer, "wrap-mode", PANGO_WRAP_WORD, NULL);
g_object_set(renderer, "wrap-width", 400, NULL);
+ g_signal_connect (treeview, "size-allocate", G_CALLBACK (gpk_log_treeview_size_allocate_cb), renderer);
/* TRANSLATORS: column for what packages were upgraded */
column = gtk_tree_view_column_new_with_attributes (_("Details"), renderer,
"markup", GPK_LOG_COLUMN_DETAILS, NULL);
Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c (original)
+++ trunk/src/gpk-prefs.c Thu Jan 8 11:21:07 2009
@@ -336,6 +336,22 @@
}
/**
+ * gpk_prefs_network_status_changed_cb:
+ **/
+static void
+gpk_prefs_network_status_changed_cb (PkControl *control, PkNetworkEnum state, gpointer data)
+{
+ GtkWidget *widget;
+
+ /* only show label on mobile broadband */
+ widget = glade_xml_get_widget (glade_xml, "hbox_mobile_broadband");
+ if (state == PK_NETWORK_ENUM_MOBILE)
+ gtk_widget_show (widget);
+ else
+ gtk_widget_hide (widget);
+}
+
+/**
* main:
**/
int
@@ -349,6 +365,7 @@
PkBitfield roles;
PkControl *control;
EggUnique *egg_unique;
+ PkNetworkEnum state;
gboolean ret;
const GOptionEntry options[] = {
@@ -395,8 +412,10 @@
/* get actions */
control = pk_control_new ();
+ g_signal_connect (control, "network-state-changed",
+ G_CALLBACK (gpk_prefs_network_status_changed_cb), NULL);
roles = pk_control_get_actions (control, NULL);
- g_object_unref (control);
+ state = pk_control_get_network_state (control, NULL);
glade_xml = glade_xml_new (GPK_DATA "/gpk-prefs.glade", NULL, NULL);
main_window = glade_xml_get_widget (glade_xml, "dialog_prefs");
@@ -414,12 +433,21 @@
widget = glade_xml_get_widget (glade_xml, "checkbutton_notify_completed");
pk_prefs_notify_checkbutton_setup (widget, GPK_CONF_NOTIFY_COMPLETED);
+ widget = glade_xml_get_widget (glade_xml, "checkbutton_mobile_broadband");
+ pk_prefs_notify_checkbutton_setup (widget, GPK_CONF_CONNECTION_USE_MOBILE);
+
widget = glade_xml_get_widget (glade_xml, "button_close");
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL);
widget = glade_xml_get_widget (glade_xml, "button_help");
g_signal_connect (widget, "clicked",
G_CALLBACK (pk_button_help_cb), NULL);
+ /* only show label on mobile broadband */
+ if (state == PK_NETWORK_ENUM_MOBILE) {
+ widget = glade_xml_get_widget (glade_xml, "hbox_mobile_broadband");
+ gtk_widget_show (widget);
+ }
+
/* update the combo boxes */
pk_prefs_update_freq_combo_setup ();
pk_prefs_upgrade_freq_combo_setup ();
@@ -438,6 +466,7 @@
/* wait */
gtk_main ();
+ g_object_unref (control);
g_object_unref (glade_xml);
unique_out:
g_object_unref (egg_unique);
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Thu Jan 8 11:21:07 2009
@@ -210,7 +210,7 @@
* gpk_repo_detail_cb:
**/
static void
-gpk_repo_detail_cb (PkClient *client, const gchar *repo_id,
+gpk_repo_detail_cb (PkClient *client_, const gchar *repo_id,
const gchar *description, gboolean enabled, gpointer data)
{
GtkTreeIter iter;
@@ -283,7 +283,7 @@
* gpk_repo_finished_cb:
**/
static void
-gpk_repo_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpointer data)
+gpk_repo_finished_cb (PkClient *client_, PkExitEnum exit, guint runtime, gpointer data)
{
GtkTreeView *treeview;
GtkTreeModel *model;
@@ -303,7 +303,7 @@
* gpk_repo_status_changed_cb:
**/
static void
-gpk_repo_status_changed_cb (PkClient *client, PkStatusEnum status, gpointer data)
+gpk_repo_status_changed_cb (PkClient *client_, PkStatusEnum status, gpointer data)
{
const gchar *text;
GtkWidget *widget;
@@ -332,7 +332,7 @@
* gpk_repo_error_code_cb:
**/
static void
-gpk_repo_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, gpointer data)
+gpk_repo_error_code_cb (PkClient *client_, PkErrorCodeEnum code, const gchar *details, gpointer data)
{
GtkWidget *widget;
widget = glade_xml_get_widget (glade_xml, "dialog_repo");
Modified: trunk/src/gpk-self-test.c
==============================================================================
--- trunk/src/gpk-self-test.c (original)
+++ trunk/src/gpk-self-test.c Thu Jan 8 11:21:07 2009
@@ -26,6 +26,7 @@
#include "gpk-common.h"
#include "gpk-enum.h"
+void egg_markdown_test (EggTest *test);
void egg_string_test (EggTest *test);
void egg_string_list_test (EggTest *test);
void gpk_dbus_test (EggTest *test);
@@ -46,6 +47,7 @@
egg_debug_init (TRUE);
/* tests go here */
+ egg_markdown_test (test);
egg_string_test (test);
egg_string_list_test (test);
gpk_enum_test (test);
Modified: trunk/src/gpk-smart-icon.c
==============================================================================
--- trunk/src/gpk-smart-icon.c (original)
+++ trunk/src/gpk-smart-icon.c Thu Jan 8 11:21:07 2009
@@ -42,8 +42,6 @@
#include "gpk-common.h"
#include "gpk-smart-icon.h"
-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 GPK_SMART_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_SMART_ICON, GpkSmartIconPrivate))
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Thu Jan 8 11:21:07 2009
@@ -40,6 +40,7 @@
#include "egg-debug.h"
#include "egg-string.h"
#include "egg-unique.h"
+#include "egg-markdown.h"
#include "gpk-common.h"
#include "gpk-gnome.h"
@@ -62,7 +63,7 @@
static GpkClient *gclient = NULL;
static gboolean are_updates_available = FALSE;
static guint description_event_id = 0;
-
+static EggMarkdown *markdown = NULL;
static PolKitGnomeAction *refresh_action = NULL;
static PolKitGnomeAction *update_system_action = NULL;
static PolKitGnomeAction *update_packages_action = NULL;
@@ -824,48 +825,6 @@
}
/**
- * gpk_update_viewer_pretty_description:
- **/
-static gchar *
-gpk_update_viewer_pretty_description (const gchar *description)
-{
- gchar **lines;
- GString *string;
- gchar *line;
- gchar *line2;
- guint len;
- guint i;
-
- /* process each line */
- lines = g_strsplit (description, "\n", 0);
- string = g_string_new ("");
- len = g_strv_length (lines);
- for (i=0; i<len; i++) {
- /* do not free this */
- line = g_strstrip (lines[i]);
-
- /* common prefixes */
- if (g_str_has_prefix (line, "- ") ||
- g_str_has_prefix (line, "* "))
- line2 = g_strdup_printf ("â %s", line+2);
- else
- line2 = g_strdup (line);
-
- /* if not null then append back */
- if (!egg_strzero (line2))
- g_string_append_printf (string, "%s\n", line2);
- g_free (line2);
- }
- /* remove trailing \n */
- if (string->len > 0)
- g_string_set_size (string, string->len - 1);
- line = g_string_free (string, FALSE);
- g_strfreev (lines);
-
- return line;
-}
-
-/**
* gpk_update_viewer_update_detail_cb:
**/
static void
@@ -950,9 +909,11 @@
if (!egg_strzero (obj->update_text)) {
/* convert the bullets */
- line = gpk_update_viewer_pretty_description (obj->update_text);
- /* TRANSLATORS: this is the package description */
- gpk_update_viewer_add_description_item (_("Description"), line, NULL);
+ line = egg_markdown_parse (markdown, obj->update_text);
+ if (!egg_strzero (line)) {
+ /* TRANSLATORS: this is the package description */
+ gpk_update_viewer_add_description_item (_("Description"), line, NULL);
+ }
g_free (line);
}
@@ -1068,6 +1029,20 @@
}
/**
+ * gpk_update_viewer_treeview_description_size_allocate_cb:
+ **/
+static void
+gpk_update_viewer_treeview_description_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, GtkCellRenderer *cell)
+{
+ GtkTreeViewColumn *column;
+ gint width;
+
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(widget), 0);
+ width = gtk_tree_view_column_get_width (column);
+ g_object_set (cell, "wrap-width", allocation->width - width - 10, NULL);
+}
+
+/**
* gpk_update_viewer_treeview_add_columns_description:
**/
static void
@@ -1079,16 +1054,20 @@
/* title */
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer, "yalign", 0.0, NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_add_attribute (column, renderer, "markup", DESC_COLUMN_TITLE);
gtk_tree_view_append_column (treeview, column);
/* column for uris */
renderer = gpk_cell_renderer_uri_new ();
+ g_object_set (renderer, "yalign", 0.0, NULL);
+ g_object_set (renderer, "wrap-mode", PANGO_WRAP_WORD, NULL);
+ g_signal_connect (treeview, "size-allocate", G_CALLBACK (gpk_update_viewer_treeview_description_size_allocate_cb), renderer);
g_signal_connect (renderer, "clicked", G_CALLBACK (gpk_update_viewer_treeview_renderer_clicked), NULL);
/* TRANSLATORS: The information about the update, not currently shown */
column = gtk_tree_view_column_new_with_attributes (_("Text"), renderer,
- "text", DESC_COLUMN_TEXT,
+ "markup", DESC_COLUMN_TEXT,
"uri", DESC_COLUMN_URI, NULL);
gtk_tree_view_append_column (treeview, column);
}
@@ -1208,16 +1187,16 @@
* pk_update_get_approx_time:
**/
static const gchar *
-pk_update_get_approx_time (guint time)
+pk_update_get_approx_time (guint time_s)
{
- if (time < 60)
+ if (time_s < 60)
/* TRANSLATORS: less than 60 seconds, a short time */
return _("Less than a minute ago");
- else if (time < 60*60)
+ else if (time_s < 60*60)
return _("Less than an hour ago");
- else if (time < 24*60*60)
+ else if (time_s < 24*60*60)
return _("A few hours ago");
- else if (time < 7*24*60*60)
+ else if (time_s < 7*24*60*60)
return _("A few days ago");
return _("Over a week ago");
}
@@ -1229,12 +1208,12 @@
pk_update_viewer_set_last_refreshed_time (void)
{
GtkWidget *widget;
- guint time;
+ guint time_s;
const gchar *time_text;
/* get times from the daemon */
- pk_control_get_time_since_action (control, PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
- if (time < 60*60*24) {
+ pk_control_get_time_since_action (control, PK_ROLE_ENUM_REFRESH_CACHE, &time_s, NULL);
+ if (time_s < 60*60*24) {
widget = glade_xml_get_widget (glade_xml, "label_last_refresh_title");
gtk_widget_hide (widget);
widget = glade_xml_get_widget (glade_xml, "label_last_refresh");
@@ -1244,7 +1223,7 @@
widget = glade_xml_get_widget (glade_xml, "label_last_refresh_title");
gtk_widget_show (widget);
- time_text = pk_update_get_approx_time (time);
+ time_text = pk_update_get_approx_time (time_s);
widget = glade_xml_get_widget (glade_xml, "label_last_refresh");
gtk_label_set_label (GTK_LABEL (widget), time_text);
gtk_widget_show (widget);
@@ -1258,18 +1237,18 @@
pk_update_viewer_set_last_updated_time (void)
{
GtkWidget *widget;
- guint time;
+ guint time_s;
guint time_new;
const gchar *time_text;
/* get times from the daemon */
- 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_SYSTEM, &time_s, 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)
- time = time_new;
- time_text = pk_update_get_approx_time (time);
+ if (time_new < time_s)
+ time_s = time_new;
+ time_text = pk_update_get_approx_time (time_s);
widget = glade_xml_get_widget (glade_xml, "label_last_update");
gtk_label_set_label (GTK_LABEL (widget), time_text);
return TRUE;
@@ -1281,8 +1260,6 @@
gpk_restart_system ();
}
-static void gpk_update_viewer_populate_preview (PkPackageList *list);
-
/**
* gpk_update_viewer_check_blocked_packages:
**/
@@ -1360,7 +1337,7 @@
/* we don't need to do anything here */
if (role == PK_ROLE_ENUM_GET_UPDATE_DETAIL ||
role == PK_ROLE_ENUM_REFRESH_CACHE) {
- return;
+ gpk_update_viewer_description_animation_stop ();
}
/* stop the throbber */
@@ -1449,7 +1426,7 @@
* gpk_update_viewer_task_list_changed_cb:
**/
static void
-gpk_update_viewer_task_list_changed_cb (PkTaskList *tlist, gpointer data)
+gpk_update_viewer_task_list_changed_cb (PkTaskList *tlist_, gpointer data)
{
GtkWidget *widget;
@@ -1510,7 +1487,7 @@
/**
* gpk_update_viewer_detail_popup_menu_select_all:
**/
-void
+static void
gpk_update_viewer_detail_popup_menu_select_all (GtkWidget *menuitem, gpointer userdata)
{
GtkTreeView *treeview = GTK_TREE_VIEW (userdata);
@@ -1534,7 +1511,7 @@
/**
* gpk_update_viewer_detail_popup_menu_select_none:
**/
-void
+static void
gpk_update_viewer_detail_popup_menu_select_none (GtkWidget *menuitem, gpointer userdata)
{
GtkTreeView *treeview = GTK_TREE_VIEW (userdata);
@@ -1556,7 +1533,7 @@
/**
* gpk_update_viewer_get_checked_status:
**/
-void
+static void
gpk_update_viewer_get_checked_status (gboolean *all_checked, gboolean *none_checked)
{
GtkTreeView *treeview;
@@ -1584,7 +1561,7 @@
/**
* gpk_update_viewer_detail_popup_menu_create:
**/
-void
+static void
gpk_update_viewer_detail_popup_menu_create (GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
GtkWidget *menu;
@@ -1629,7 +1606,7 @@
/**
* gpk_update_viewer_detail_button_pressed:
**/
-gboolean
+static gboolean
gpk_update_viewer_detail_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
GtkTreeSelection *selection;
@@ -1664,7 +1641,7 @@
/**
* gpk_update_viewer_detail_popup_menu:
**/
-gboolean
+static gboolean
gpk_update_viewer_detail_popup_menu (GtkWidget *treeview, gpointer userdata)
{
gpk_update_viewer_detail_popup_menu_create (treeview, NULL, userdata);
@@ -1675,8 +1652,8 @@
* gpk_update_viewer_task_list_finished_cb:
**/
static void
-gpk_update_viewer_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum exit,
- guint runtime, gpointer userdata)
+gpk_update_viewer_task_list_finished_cb (PkTaskList *tlist_, PkClient *client, PkExitEnum exit_enum,
+ guint runtime, gpointer userdata)
{
PkRoleEnum role;
gboolean ret;
@@ -1879,6 +1856,10 @@
/* we have to do this before we connect up the glade file */
gpk_update_viewer_setup_policykit ();
+ markdown = egg_markdown_new ();
+ egg_markdown_set_output (markdown, EGG_MARKDOWN_OUTPUT_PANGO);
+ egg_markdown_set_escape (markdown, TRUE);
+
control = pk_control_new ();
g_signal_connect (control, "repo-list-changed",
G_CALLBACK (gpk_update_viewer_repo_list_changed_cb), NULL);
@@ -1982,11 +1963,11 @@
widget = glade_xml_get_widget (glade_xml, "button_help");
g_signal_connect (widget, "clicked",
- G_CALLBACK (pk_button_help_cb), "update-viewer");
+ G_CALLBACK (pk_button_help_cb), (gpointer)"update-viewer");
widget = glade_xml_get_widget (glade_xml, "button_help2");
g_signal_connect (widget, "clicked",
- G_CALLBACK (pk_button_help_cb), "update-viewer-details");
+ G_CALLBACK (pk_button_help_cb), (gpointer)"update-viewer-details");
/* create list stores */
list_store_details = gtk_list_store_new (PACKAGES_COLUMN_LAST, G_TYPE_STRING,
@@ -2070,6 +2051,7 @@
g_object_unref (list_store_details);
g_object_unref (gclient);
g_object_unref (control);
+ g_object_unref (markdown);
g_object_unref (client_query);
g_object_unref (client_action);
g_free (cached_package_id);
Modified: trunk/src/gpk-vendor.c
==============================================================================
--- trunk/src/gpk-vendor.c (original)
+++ trunk/src/gpk-vendor.c Thu Jan 8 11:21:07 2009
@@ -27,8 +27,6 @@
#include "egg-string.h"
#include "gpk-vendor.h"
-static void gpk_vendor_class_init (GpkVendorClass *klass);
-static void gpk_vendor_init (GpkVendor *vendor);
static void gpk_vendor_finalize (GObject *object);
#define GPK_VENDOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_VENDOR, GpkVendorPrivate))
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Thu Jan 8 11:21:07 2009
@@ -52,8 +52,6 @@
#include "gpk-consolekit.h"
#include "gpk-enum.h"
-static void gpk_watch_class_init (GpkWatchClass *klass);
-static void gpk_watch_init (GpkWatch *watch);
static void gpk_watch_finalize (GObject *object);
#define GPK_WATCH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_WATCH, GpkWatchPrivate))
@@ -66,11 +64,12 @@
{
PkControl *control;
GpkSmartIcon *sicon;
- GpkSmartIcon *sicon_restart;
+ GpkSmartIcon *sicon_action;
GpkInhibit *inhibit;
GpkClient *gclient;
PkConnection *pconnection;
PkTaskList *tlist;
+ PkRestartEnum restart;
GConfClient *gconf_client;
gboolean show_refresh_in_menu;
PolKitGnomeAction *restart_action;
@@ -289,7 +288,7 @@
* gpk_watch_finished_cb:
**/
static void
-gpk_watch_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum exit, guint runtime, GpkWatch *watch)
+gpk_watch_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum exit_enum, guint runtime, GpkWatch *watch)
{
gboolean ret;
gboolean value;
@@ -316,13 +315,16 @@
if (role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
role == PK_ROLE_ENUM_INSTALL_PACKAGES ||
role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
+ /* if more important than what we are already showing, then update the icon */
restart = pk_client_get_require_restart (client);
- if (restart == PK_RESTART_ENUM_SYSTEM ||
- restart == PK_RESTART_ENUM_SESSION) {
+ if (restart > watch->priv->restart) {
restart_message = gpk_restart_enum_to_localised_text (restart);
icon_name = gpk_restart_enum_to_icon_name (restart);
- gtk_status_icon_set_tooltip (GTK_STATUS_ICON (watch->priv->sicon_restart), restart_message);
- gpk_smart_icon_set_icon_name (watch->priv->sicon_restart, icon_name);
+ gtk_status_icon_set_tooltip (GTK_STATUS_ICON (watch->priv->sicon_action), restart_message);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon_action, icon_name);
+
+ /* save new restart */
+ watch->priv->restart = restart;
}
}
@@ -333,7 +335,7 @@
}
/* is it worth showing a UI? */
- if (exit != PK_EXIT_ENUM_SUCCESS) {
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
egg_debug ("not notifying, as didn't complete okay");
goto out;
}
@@ -586,7 +588,7 @@
_(license[2]), "\n\n", _(license[3]), "\n", 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_about_dialog_set_email_hook (gpk_watch_about_dialog_url_cb, (gpointer) "mailto:", NULL);
gtk_window_set_default_icon_name (GPK_ICON_SOFTWARE_LOG);
gtk_show_about_dialog (NULL,
@@ -813,7 +815,18 @@
g_return_if_fail (GPK_IS_WATCH (watch));
/* just hide it */
- gpk_smart_icon_set_icon_name (watch->priv->sicon_restart, NULL);
+ gpk_smart_icon_set_icon_name (watch->priv->sicon_action, NULL);
+}
+
+/**
+ * gpk_watch_log_out_cb:
+ **/
+static void
+gpk_watch_log_out_cb (GtkMenuItem *item, gpointer data)
+{
+ GpkWatch *watch = GPK_WATCH (data);
+ g_return_if_fail (GPK_IS_WATCH (watch));
+ gpk_session_logout ();
}
/**
@@ -833,9 +846,21 @@
egg_debug ("icon left clicked");
+ /* log off session */
+ if (watch->priv->restart == PK_RESTART_ENUM_SESSION) {
+ widget = gtk_image_menu_item_new_with_mnemonic (_("_Log out"));
+ image = gtk_image_new_from_icon_name ("system-log-out", 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 (gpk_watch_log_out_cb), watch);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
+ }
+
/* restart computer */
- widget = gtk_action_create_menu_item (GTK_ACTION (watch->priv->restart_action));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
+ if (watch->priv->restart == PK_RESTART_ENUM_SYSTEM) {
+ widget = gtk_action_create_menu_item (GTK_ACTION (watch->priv->restart_action));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), widget);
+ }
/* TRANSLATORS: This hides the 'restart required' icon */
widget = gtk_image_menu_item_new_with_mnemonic (_("_Hide this icon"));
@@ -926,7 +951,7 @@
* gpk_watch_get_proxy_ftp:
* Return value: username:password server lan:8080
**/
-gchar *
+static gchar *
gpk_watch_get_proxy_http (GpkWatch *watch)
{
gchar *mode = NULL;
@@ -1075,6 +1100,7 @@
watch->priv = GPK_WATCH_GET_PRIVATE (watch);
watch->priv->error_details = NULL;
+ watch->priv->restart = PK_RESTART_ENUM_NONE;
watch->priv->show_refresh_in_menu = TRUE;
watch->priv->gconf_client = gconf_client_get_default ();
@@ -1082,8 +1108,8 @@
watch->priv->sicon = gpk_smart_icon_new ();
gpk_smart_icon_set_priority (watch->priv->sicon, 1);
- watch->priv->sicon_restart = gpk_smart_icon_new ();
- gpk_smart_icon_set_priority (watch->priv->sicon_restart, 3);
+ watch->priv->sicon_action = gpk_smart_icon_new ();
+ gpk_smart_icon_set_priority (watch->priv->sicon_action, 3);
watch->priv->set_proxy_timeout = 0;
watch->priv->gclient = gpk_client_new ();
@@ -1104,7 +1130,7 @@
"activate", G_CALLBACK (gpk_watch_activate_status_cb), watch, 0);
/* provide the user with a way to restart */
- status_icon = GTK_STATUS_ICON (watch->priv->sicon_restart);
+ status_icon = GTK_STATUS_ICON (watch->priv->sicon_action);
g_signal_connect_object (G_OBJECT (status_icon),
"activate", G_CALLBACK (gpk_watch_activate_status_restart_cb), watch, 0);
Modified: trunk/src/gpk-x11.c
==============================================================================
--- trunk/src/gpk-x11.c (original)
+++ trunk/src/gpk-x11.c Thu Jan 8 11:21:07 2009
@@ -29,11 +29,8 @@
#include "egg-debug.h"
#include "egg-string.h"
-//#include "gpk-common.h"
#include "gpk-x11.h"
-static void gpk_x11_class_init (GpkX11Class *klass);
-static void gpk_x11_init (GpkX11 *x11);
static void gpk_x11_finalize (GObject *object);
#define GPK_X11_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_X11, GpkX11Private))
Modified: trunk/src/org.freedesktop.PackageKit.xml
==============================================================================
--- trunk/src/org.freedesktop.PackageKit.xml (original)
+++ trunk/src/org.freedesktop.PackageKit.xml Thu Jan 8 11:21:07 2009
@@ -1,10 +1,377 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<node name="/">
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" [
+ <!ENTITY ERROR_GENERAL "org.freedesktop.PackageKit.Denied">
+]>
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+
+ <!-- ######################################################################################### -->
+ <interface name="org.freedesktop.PackageKit.Query">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The interface used for quering the package database.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+
+ <!--*****************************************************************************************-->
+ <method name="IsInstalled">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Finds out if the package is installed.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="s" name="package_name" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ A package name, e.g. <doc:tt>hal-info</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>timeout=10</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="b" name="installed" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ If the package is installed.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="SearchFile">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Finds the package name for an installed or available file
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="s" name="file_name" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ A package name, e.g. <doc:tt>/usr/share/help/gimp/index.html</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>timeout=10</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="b" name="installed" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ If the package is installed.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="package_name" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The package name of the file, e.g. <doc:tt>hal-info</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+ </interface>
+
+ <!-- ######################################################################################### -->
+ <interface name="org.freedesktop.PackageKit.Modify">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The interface used for modifying the package database.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallPackageFiles">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs local package files or service packs.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="files" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of file names.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An interaction mode that specifies which UI elements should be shown
+ or hidden different from the user default, e.g.
+ <doc:tt>hide-confirm-search,hide-confirm-deps,hide-confirm-install,show-progress</doc:tt>.
+ The show options are:
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>.
+ The hide options are:
+ <doc:tt>hide-confirm-search,hide-confirm-deps,hide-confirm-install,hide-progress,hide-finished,hide-warning</doc:tt>.
+ Convenience options such as:
+ <doc:tt>never</doc:tt>, <doc:tt>defaults</doc:tt> or <doc:tt>always</doc:tt>.
+ are also available.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallProvideFiles">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs packages to provide files.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="files" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of file names.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallPackageNames">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs packages from a configured software source.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="packages" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of package names.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallMimeTypes">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs mimetype handlers from a configured software source.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="mime_types" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of mime types, e.g. <doc:tt>text/plain</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallFontconfigResources">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs fontconfig resources (usually fonts) from a configured software source.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="resources" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of font descriptors from fontconfig, e.g. <doc:tt>:lang=mn</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
+ <method name="InstallGStreamerResources">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs GStreamer fontconfig resources (usually codecs) from a configured software source.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="u" name="xid" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The X window handle ID, used for focus stealing prevention and setting modality.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="as" name="resources" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of codecs descriptors from <doc:tt>pk-gstreamer-install</doc:tt>, e.g.
+ <doc:tt>Advanced Streaming Format (ASF) demuxer|gstreamer0.10(decoder-video/x-ms-asf)</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="interaction" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An optional interaction mode, e.g.
+ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+ </interface>
+
+ <!-- ######################################################################################### -->
+ <!-- LEGACY INTERFACE -->
<interface name="org.freedesktop.PackageKit">
+<!--
<method name="IsPackageInstalled">
<arg type="s" name="package_name" direction="in"/>
<arg type="b" name="installed" direction="out"/>
</method>
+-->
<method name="InstallLocalFile">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg type="u" name="xid" direction="in"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]