diff options
-rw-r--r-- | ChangeLog | 74 | ||||
-rwxr-xr-x | build-aux/config.guess | 49 | ||||
-rwxr-xr-x | build-aux/config.sub | 65 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 110 | ||||
-rw-r--r-- | libindicator/indicator-object.c | 11 | ||||
-rw-r--r-- | libindicator/indicator-service.c | 4 | ||||
-rw-r--r-- | tests/test-well-formed.desktop | 10 |
9 files changed, 261 insertions, 84 deletions
@@ -1,5 +1,79 @@ # Generated by Makefile. Do not edit. +2012-03-07 Ted Gould <ted@gould.cx> + + 0.4.93 + +2012-03-05 Charles Kerr <charles.kerr@canonical.com> + + merge lp:~ted/libindicator/lp719457 for Bug #719457 + +2012-03-02 Ted Gould <ted@gould.cx> + + Attaching bug + +2012-03-02 Ted Gould <ted@gould.cx> + + Copying the name before using it to remove as it seems that the unwatch can cause the name to be free'd in some cases. Odd, but valgrind can find it + +2012-03-02 Ted Gould <ted@gould.cx> + + Support new FD.o Desktop Actions + +2012-02-27 Ted Gould <ted@gould.cx> + + Get the right group in exec too! + +2012-02-27 Ted Gould <ted@gould.cx> + + Handling the different group names when getting the name as well + +2012-02-27 Ted Gould <ted@gould.cx> + + Update test desktop file + +2012-02-27 Ted Gould <ted@gould.cx> + + Creating a warning for the legacy support + +2012-02-27 Ted Gould <ted@gould.cx> + + Adding a value for whether it should use the TargetEnvironment, I'm removing the warning because we don't care to fix old stuff anymore + +2012-02-27 Ted Gould <ted@gould.cx> + + Use the appropriate list of nicks and groups to find our data now + +2012-02-27 Ted Gould <ted@gould.cx> + + Figure out what kind of actions we have + +2012-02-27 Ted Gould <ted@gould.cx> + + Adding a state variable to track what kind of actions we have + +2012-02-27 Ted Gould <ted@gould.cx> + + Attaching bug + +2012-02-27 Ted Gould <ted@gould.cx> + + Changing our defines around to make sure to mark things the way that we think about them. + +2012-02-29 Charles Kerr <charles.kerr@canonical.com> + + lp:~charlesk/libindicator/fix-939061 + +2012-02-29 Charles Kerr <charles.kerr@canonical.com> + + silence Coverity warning "PW.BRANCH_PAST_INITIALIZATION - CID 10615" reported in Bug #939061 + + Coverity is unhappy that the local variable "priv" is uninitialized if one of the goto branches is followed in this function. Since we only use priv once, a fairly clean way of sidestepping this warning is removing the local variable "priv" and instead using INDICATOR_OBJECT_GET_PRIVATE()'s return pointer directly. + +2012-02-29 Charles Kerr <charles.kerr@canonical.com> + + tweak: use g_clear_object() instead of if-not-null-g_object_unref() + 2012-02-23 Ted Gould <ted@gould.cx> 0.4.92 diff --git a/build-aux/config.guess b/build-aux/config.guess index 40eaed4..d622a44 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,9 +2,9 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2011-05-11' +timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ timestamp='2011-05-11' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -57,8 +55,8 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -145,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -792,13 +790,12 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) @@ -807,6 +804,9 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 @@ -861,6 +861,13 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -895,13 +902,16 @@ EOF echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -943,7 +953,7 @@ EOF test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu @@ -978,13 +988,13 @@ EOF echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -1315,6 +1325,9 @@ EOF i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/build-aux/config.sub b/build-aux/config.sub index 30fdca8..c894da4 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,9 +2,9 @@ # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2011-03-23' +timestamp='2012-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,9 +21,7 @@ timestamp='2011-03-23' # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -76,8 +74,8 @@ version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -132,6 +130,10 @@ case $maybe_os in os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -247,17 +249,22 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ @@ -291,7 +298,7 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ @@ -300,7 +307,7 @@ case $basic_machine in | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -315,8 +322,7 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -329,7 +335,10 @@ case $basic_machine in strongarm | thumb | xscale) basic_machine=arm-unknown ;; - + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; xscaleeb) basic_machine=armeb-unknown ;; @@ -352,11 +361,13 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ @@ -365,8 +376,10 @@ case $basic_machine in | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ @@ -400,7 +413,7 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ @@ -408,10 +421,11 @@ case $basic_machine in | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -711,7 +725,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -808,10 +821,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -1120,13 +1141,8 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1336,7 +1352,7 @@ case $os in | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ @@ -1548,9 +1564,6 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for libindicator 0.4.92. +# Generated by GNU Autoconf 2.68 for libindicator 0.4.93. # # Report bugs to <http://bugs.launchpad.net/libindicator>. # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libindicator' PACKAGE_TARNAME='libindicator' -PACKAGE_VERSION='0.4.92' -PACKAGE_STRING='libindicator 0.4.92' +PACKAGE_VERSION='0.4.93' +PACKAGE_STRING='libindicator 0.4.93' PACKAGE_BUGREPORT='http://bugs.launchpad.net/libindicator' PACKAGE_URL='http://launchpad.net/libindicator' @@ -1330,7 +1330,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 libindicator 0.4.92 to adapt to many kinds of systems. +\`configure' configures libindicator 0.4.93 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libindicator 0.4.92:";; + short | recursive ) echo "Configuration of libindicator 0.4.93:";; esac cat <<\_ACEOF @@ -1520,7 +1520,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libindicator configure 0.4.92 +libindicator configure 0.4.93 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1798,7 +1798,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 libindicator $as_me 0.4.92, which was +It was created by libindicator $as_me 0.4.93, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2620,7 +2620,7 @@ fi # Define the identity of the package. PACKAGE='libindicator' - VERSION='0.4.92' + VERSION='0.4.93' cat >>confdefs.h <<_ACEOF @@ -13040,7 +13040,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 libindicator $as_me 0.4.92, which was +This file was extended by libindicator $as_me 0.4.93, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13107,7 +13107,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="\\ -libindicator config.status 0.4.92 +libindicator config.status 0.4.93 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index a3963c4..5bff63b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([libindicator], - [0.4.92], + [0.4.93], [http://bugs.launchpad.net/libindicator], [libindicator], [http://launchpad.net/libindicator]) diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index 2ae78f9..13c1667 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -28,15 +28,26 @@ License along with this library. If not, see #include <gio/gdesktopappinfo.h> #include "indicator-desktop-shortcuts.h" -#define GROUP_SUFFIX "Shortcut Group" -#define SHORTCUTS_KEY "X-Ayatana-Desktop-Shortcuts" -#define ENVIRON_KEY "TargetEnvironment" +#define ACTIONS_KEY "Actions" +#define ACTION_GROUP_PREFIX "Desktop Action" + +#define OLD_GROUP_SUFFIX "Shortcut Group" +#define OLD_SHORTCUTS_KEY "X-Ayatana-Desktop-Shortcuts" +#define OLD_ENVIRON_KEY "TargetEnvironment" #define PROP_DESKTOP_FILE_S "desktop-file" #define PROP_IDENTITY_S "identity" +typedef enum _actions_t actions_t; +enum _actions_t { + ACTIONS_NONE, + ACTIONS_XAYATANA, + ACTIONS_DESKTOP_SPEC +}; + typedef struct _IndicatorDesktopShortcutsPrivate IndicatorDesktopShortcutsPrivate; struct _IndicatorDesktopShortcutsPrivate { + actions_t actions; GKeyFile * keyfile; gchar * identity; GArray * nicks; @@ -104,6 +115,7 @@ indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self) priv->identity = NULL; priv->domain = NULL; priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *)); + priv->actions = ACTIONS_NONE; return; } @@ -162,6 +174,12 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec switch(prop_id) { case PROP_DESKTOP_FILE: { + if (priv->keyfile != NULL) { + g_key_file_free(priv->keyfile); + priv->keyfile = NULL; + priv->actions = ACTIONS_NONE; + } + GError * error = NULL; GKeyFile * keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, g_value_get_string(value), G_KEY_FILE_NONE, &error); @@ -173,7 +191,18 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec break; } - if (!g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, SHORTCUTS_KEY, NULL)) { + /* Always prefer the desktop spec if we can get it */ + if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, ACTIONS_KEY, NULL)) { + priv->actions = ACTIONS_DESKTOP_SPEC; + } + + /* But fallback if we can't */ + if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) { + priv->actions = ACTIONS_XAYATANA; + g_warning("Desktop file '%s' is using a depracted format for it's actions that will be dropped soon.", g_value_get_string(value)); + } + + if (priv->actions == ACTIONS_NONE) { g_key_file_free(keyfile); break; } @@ -253,16 +282,41 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL); } + /* We need to figure out what we're looking for and what we want to + look for in the rest of the file */ + const gchar * list_name = NULL; + const gchar * group_format = NULL; + gboolean should_have_target = FALSE; + + switch (priv->actions) { + case ACTIONS_NONE: + /* None, let's just get outta here */ + return; + case ACTIONS_XAYATANA: + list_name = OLD_SHORTCUTS_KEY; + group_format = "%s " OLD_GROUP_SUFFIX; + should_have_target = TRUE; + break; + case ACTIONS_DESKTOP_SPEC: + list_name = ACTIONS_KEY; + group_format = ACTION_GROUP_PREFIX " %s"; + should_have_target = FALSE; + break; + default: + g_assert_not_reached(); + return; + } + /* Okay, we've got everything we need. Let's get it on! */ gint i; gsize num_nicks = 0; - gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, SHORTCUTS_KEY, &num_nicks, NULL); + gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, list_name, &num_nicks, NULL); /* If there is an error from get_string_list num_nicks should still be zero, so this loop will drop out. */ for (i = 0; i < num_nicks; i++) { /* g_debug("Looking at group nick %s", nicks[i]); */ - gchar * groupname = g_strdup_printf("%s " GROUP_SUFFIX, nicks[i]); + gchar * groupname = g_strdup_printf(group_format, nicks[i]); if (!g_key_file_has_group(priv->keyfile, groupname)) { g_warning("Unable to find group '%s'", groupname); g_free(groupname); @@ -274,7 +328,7 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) continue; } - if (!should_show(priv->keyfile, groupname, priv->identity, TRUE)) { + if (!should_show(priv->keyfile, groupname, priv->identity, should_have_target)) { g_free(groupname); continue; } @@ -296,12 +350,12 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target) { - if (should_have_target && g_key_file_has_key(keyfile, group, ENVIRON_KEY, NULL)) { + if (should_have_target && g_key_file_has_key(keyfile, group, OLD_ENVIRON_KEY, NULL)) { /* If we've got this key, we're going to return here and not process the deprecated keys. */ gint j; gsize num_env = 0; - gchar ** envs = g_key_file_get_string_list(keyfile, group, ENVIRON_KEY, &num_env, NULL); + gchar ** envs = g_key_file_get_string_list(keyfile, group, OLD_ENVIRON_KEY, &num_env, NULL); for (j = 0; j < num_env; j++) { if (g_strcmp0(envs[j], identity) == 0) { @@ -317,10 +371,6 @@ should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gb return FALSE; } return TRUE; - } else { - if (should_have_target) { - g_warning(GROUP_SUFFIX " does not have key '" ENVIRON_KEY "' falling back to deprecated use of '" G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "' and '" G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "'."); - } } /* If there is a list of OnlyShowIn entries we need to check @@ -449,10 +499,25 @@ indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, cons g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); + g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL); g_return_val_if_fail(priv->keyfile != NULL, NULL); g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), NULL); - gchar * groupheader = g_strdup_printf("%s " GROUP_SUFFIX, nick); + const gchar * group_format = NULL; + + switch (priv->actions) { + case ACTIONS_XAYATANA: + group_format = "%s " OLD_GROUP_SUFFIX; + break; + case ACTIONS_DESKTOP_SPEC: + group_format = ACTION_GROUP_PREFIX " %s"; + break; + default: + g_assert_not_reached(); + return NULL; + } + + gchar * groupheader = g_strdup_printf(group_format, nick); if (!g_key_file_has_group(priv->keyfile, groupheader)) { g_warning("The group for nick '%s' doesn't exist anymore.", nick); g_free(groupheader); @@ -509,10 +574,25 @@ indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gc g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); + g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE); g_return_val_if_fail(priv->keyfile != NULL, FALSE); g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), FALSE); - gchar * groupheader = g_strdup_printf("%s " GROUP_SUFFIX, nick); + const gchar * group_format = NULL; + + switch (priv->actions) { + case ACTIONS_XAYATANA: + group_format = "%s " OLD_GROUP_SUFFIX; + break; + case ACTIONS_DESKTOP_SPEC: + group_format = ACTION_GROUP_PREFIX " %s"; + break; + default: + g_assert_not_reached(); + return FALSE; + } + + gchar * groupheader = g_strdup_printf(group_format, nick); if (!g_key_file_has_group(priv->keyfile, groupheader)) { g_warning("The group for nick '%s' doesn't exist anymore.", nick); g_free(groupheader); diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 17a6d1d..ca821af 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -464,21 +464,16 @@ indicator_object_new_from_file (const gchar * file) goto unrefandout; } - IndicatorObjectPrivate * priv = INDICATOR_OBJECT_GET_PRIVATE(object); /* Now we can track the module */ - priv->module = module; + INDICATOR_OBJECT_GET_PRIVATE(object)->module = module; return INDICATOR_OBJECT(object); /* Error, let's drop the object and return NULL. Sad when this happens. */ unrefandout: - if (object != NULL) { - g_object_unref(object); - } - if (module != NULL) { - g_object_unref(module); - } + g_clear_object (&object); + g_clear_object (&module); g_warning("Error building IndicatorObject from file: %s", file); return NULL; } diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index e9f3133..11171fc 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -588,7 +588,9 @@ unwatch_core (IndicatorService * service, const gchar * name) /* Remove us from the watcher list here */ gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { - g_hash_table_remove(priv->watchers, name); + gchar * safe_name = g_strdup(name); + g_hash_table_remove(priv->watchers, safe_name); + g_free(safe_name); } else { /* Odd that we couldn't find the person, but, eh */ g_warning("Unable to find watcher who is unwatching: %s", name); diff --git a/tests/test-well-formed.desktop b/tests/test-well-formed.desktop index 84e2e02..be20f8f 100644 --- a/tests/test-well-formed.desktop +++ b/tests/test-well-formed.desktop @@ -2,23 +2,23 @@ Name=My Application Exec=ls NotShowIn=Germany -X-Ayatana-Desktop-Shortcuts=bob;alvin;jim;touch +Actions=bob;alvin;jim;touch -[bob Shortcut Group] +[Desktop Action bob] Name=bob's shortcut Exec=ls bob -[alvin Shortcut Group] +[Desktop Action alvin] Name=alvin's shortcut Exec=ls alvin OnlyShowIn=France -[jim Shortcut Group] +[Desktop Action jim] Name=Jim's shortcut Exec=ls jim NotShowIn=France -[touch Shortcut Group] +[Desktop Action touch] Name=Touch Test Exec=touch test-desktop-shortcuts-touch-test OnlyShowIn=TouchTest |