diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-03-20 18:47:21 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-03-20 18:47:21 +0100 |
commit | b36c109193793f388f52b1c557a2016e6599287f (patch) | |
tree | ced2f171ae560f41694710f4987617efab5c1b07 | |
parent | 85fc36ca17b8d908434c9e480a3240be72b1b6fa (diff) | |
parent | 34707262d29696d7178a05792b81ea3da3fd9855 (diff) | |
download | ayatana-indicator-printers-b36c109193793f388f52b1c557a2016e6599287f.tar.gz ayatana-indicator-printers-b36c109193793f388f52b1c557a2016e6599287f.tar.bz2 ayatana-indicator-printers-b36c109193793f388f52b1c557a2016e6599287f.zip |
Import upstream version 0.1.5
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/indicator-printers-service.c | 47 | ||||
-rw-r--r-- | src/indicator-printers.c | 5 |
4 files changed, 61 insertions, 13 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-printers 0.1.4. +# Generated by GNU Autoconf 2.68 for indicator-printers 0.1.5. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-printers' PACKAGE_TARNAME='indicator-printers' -PACKAGE_VERSION='0.1.4' -PACKAGE_STRING='indicator-printers 0.1.4' +PACKAGE_VERSION='0.1.5' +PACKAGE_STRING='indicator-printers 0.1.5' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1357,7 +1357,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-printers 0.1.4 to adapt to many kinds of systems. +\`configure' configures indicator-printers 0.1.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1428,7 +1428,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-printers 0.1.4:";; + short | recursive ) echo "Configuration of indicator-printers 0.1.5:";; esac cat <<\_ACEOF @@ -1545,7 +1545,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-printers configure 0.1.4 +indicator-printers configure 0.1.5 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1910,7 +1910,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-printers $as_me 0.1.4, which was +It was created by indicator-printers $as_me 0.1.5, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2727,7 +2727,7 @@ fi # Define the identity of the package. PACKAGE='indicator-printers' - VERSION='0.1.4' + VERSION='0.1.5' cat >>confdefs.h <<_ACEOF @@ -13777,7 +13777,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-printers $as_me 0.1.4, which was +This file was extended by indicator-printers $as_me 0.1.5, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13843,7 +13843,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-printers config.status 0.1.4 +indicator-printers config.status 0.1.5 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index f82a404..53b8543 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -AC_INIT(indicator-printers, 0.1.4) +AC_INIT(indicator-printers, 0.1.5) AC_PREREQ(2.53) AM_INIT_AUTOMAKE([]) diff --git a/src/indicator-printers-service.c b/src/indicator-printers-service.c index 5daf697..ad5ef88 100644 --- a/src/indicator-printers-service.c +++ b/src/indicator-printers-service.c @@ -26,6 +26,8 @@ #include "indicator-printers-menu.h" #include "indicator-printer-state-notifier.h" +#define NOTIFY_LEASE_DURATION (15 * 60) + static int create_subscription () @@ -43,7 +45,7 @@ create_subscription () ippAddString (req, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI, "notify-recipient-uri", NULL, "dbus://"); ippAddInteger (req, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, - "notify-lease-duration", 0); + "notify-lease-duration", NOTIFY_LEASE_DURATION); resp = cupsDoRequest (CUPS_HTTP_DEFAULT, req, "/"); if (!resp || cupsLastError() != IPP_OK) { @@ -64,6 +66,46 @@ create_subscription () } +static gboolean +renew_subscription (int id) +{ + ipp_t *req; + ipp_t *resp; + + req = ippNewRequest (IPP_RENEW_SUBSCRIPTION); + ippAddInteger (req, IPP_TAG_OPERATION, IPP_TAG_INTEGER, + "notify-subscription-id", id); + ippAddString (req, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, "/"); + ippAddString (req, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI, + "notify-recipient-uri", NULL, "dbus://"); + ippAddInteger (req, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, + "notify-lease-duration", NOTIFY_LEASE_DURATION); + + resp = cupsDoRequest (CUPS_HTTP_DEFAULT, req, "/"); + if (!resp || cupsLastError() != IPP_OK) { + g_warning ("Error renewing CUPS subscription %d: %s\n", + id, cupsLastErrorString ()); + return FALSE; + } + + ippDelete (resp); + return TRUE; +} + + +static gboolean +renew_subscription_timeout (gpointer userdata) +{ + int *subscription_id = userdata; + + if (*subscription_id <= 0 || !renew_subscription (*subscription_id)) + *subscription_id = create_subscription (); + + return TRUE; +} + + void cancel_subscription (int id) { @@ -115,6 +157,9 @@ int main (int argc, char *argv[]) gtk_init (&argc, &argv); subscription_id = create_subscription (); + g_timeout_add_seconds (NOTIFY_LEASE_DURATION - 60, + renew_subscription_timeout, + &subscription_id); service = indicator_service_new_version (INDICATOR_PRINTERS_DBUS_NAME, INDICATOR_PRINTERS_DBUS_VERSION); diff --git a/src/indicator-printers.c b/src/indicator-printers.c index 78f36da..7acfdce 100644 --- a/src/indicator-printers.c +++ b/src/indicator-printers.c @@ -22,7 +22,7 @@ #include "indicator-menu-item.h" #include "dbus-names.h" -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <libindicator/indicator.h> @@ -175,6 +175,9 @@ indicator_prop_change_cb (DbusmenuMenuitem *mi, else if (properties_match (prop, "visible", value, G_VARIANT_TYPE_BOOLEAN)) gtk_widget_set_visible (GTK_WIDGET (menuitem), g_variant_get_boolean (value)); + + else if (properties_match (prop, "indicator-right-is-lozenge", value, G_VARIANT_TYPE_BOOLEAN)) + indicator_menu_item_set_right_is_lozenge (menuitem, g_variant_get_boolean (value)); } |