[Sugar-devel] Widget to show a notification message with a link

Gustavo Duarte gus.duarte at gmail.com
Tue Dec 9 07:59:14 EST 2014


I checked this file, and there are these entries, already, as is showed bellow.

text/html                                  org.laptop.WebActivity
application/xhtml+xml             org.laptop.WebActivity
application/xml                        org.laptop.WebActivity

However, it doesn't work, Firefox is opened when I click on a link of
notification message.

May be this behaviour could be, due

1) Sugar is running in Ubuntu.

2) Only happens on links inside notification messages, no other way to
test open a link comes on my mind, at this moment.

I'll try on Sugar running on XO/Fedora

thanks

On Mon, Dec 8, 2014 at 1:58 PM, Gonzalo Odiard <godiard at sugarlabs.org> wrote:
> We have that file in sugar module in the data directory.
>
> Gonzalo
>
> On Mon, Dec 8, 2014 at 12:48 PM, Gustavo Duarte <gus.duarte at gmail.com>
> wrote:
>>
>> Ahh no, I didn't know this file, sound a good option, i'll try and let
>> you know the results.
>>
>> Thanks
>>
>> Gustavo.
>>
>> On Mon, Dec 8, 2014 at 11:17 AM, Walter Bender <walter.bender at gmail.com>
>> wrote:
>> > Did you try in /usr/share/sugar/data/mime-defaults by any chance?
>> >
>> > On Mon, Dec 8, 2014 at 7:27 AM, Gustavo Duarte <gus.duarte at gmail.com>
>> > wrote:
>> >> Unfortunately, this settings on activity.info doesn't work.
>> >>
>> >> Now i'm wonder, where should be the best place to configure these mime
>> >> entries, in which point of Sugar session starting procedure ?
>> >>
>> >> Inside sugar-session script, it would be a right place ?
>> >>
>> >> Because this mime types settings is valid only on Sugar desktop, when
>> >> the PC switch to Gnome, the mime types should be changed to Firefox.
>> >>
>> >> Thanks in advance.
>> >>
>> >> Gustavo.
>> >>
>> >>
>> >>
>> >> On Sun, Dec 7, 2014 at 12:01 PM, Gustavo Duarte <gus.duarte at gmail.com>
>> >> wrote:
>> >>> Good point, i'll try it and let you know.
>> >>>
>> >>> El 07/12/2014 02:38, "Jerry Vonau" <me at jvonau.ca> escribió:
>> >>>
>> >>>> Just a thought, wonder if adding x-scheme-handler/http to mime_types=
>> >>>> in
>> >>>> browse's activity.info file would allow sugar to override what the
>> >>>> system
>> >>>> is providing? Another place for that definition might be in
>> >>>> /usr/share/sugar/data/mime.defaults.
>> >>>>
>> >>>> Jerry
>> >>>>
>> >>>>
>> >>>> > On December 6, 2014 at 8:57 PM Gustavo Duarte
>> >>>> > <gus.duarte at gmail.com>
>> >>>> > wrote:
>> >>>> >
>> >>>> >
>> >>>> > Finally I found the setting needed to open links with Browser
>> >>>> > Activity
>> >>>> > by default.
>> >>>> >
>> >>>> > xdg-mime default sugar-browser.desktop x-scheme-handler/http
>> >>>> > and
>> >>>> >
>> >>>> > xdg-mime default sugar-browser.desktop x-scheme-handler/https
>> >>>> >
>> >>>> > Adding this settings, links on notifications messages should be
>> >>>> > opened
>> >>>> > by BrowserActivity.
>> >>>> >
>> >>>> > Offcourse a bash script to launch BrowserActivit  is needed.
>> >>>> > Something
>> >>>> > like:
>> >>>> >
>> >>>> > #!/bin/sh
>> >>>> > while [ -n "$2" ] ; do
>> >>>> >     case "$1" in
>> >>>> >
>> >>>> >         -u | --uri)         uri="$2"         ;;
>> >>>> >
>> >>>> >         *) echo unknown argument $1 $2 ;;
>> >>>> >
>> >>>> >     esac
>> >>>> >     shift;shift
>> >>>> > done
>> >>>> >
>> >>>> > sugar-launch org.laptop.WebActivity --uri "$uri"
>> >>>> >
>> >>>> > Thanks a lot for all your tips, were very helpfully.
>> >>>> >
>> >>>> > Gustavo.
>> >>>> >
>> >>>> > On Sat, Dec 6, 2014 at 3:59 PM, Jerry Vonau <me at jvonau.ca> wrote:
>> >>>> > > Hi Gustavo,
>> >>>> > >
>> >>>> > >> On December 6, 2014 at 10:42 AM Gustavo Duarte
>> >>>> > >> <gus.duarte at gmail.com>
>> >>>> > >> wrote:
>> >>>> > >>
>> >>>> > >>
>> >>>> > >> Add an actions, isn't an option, because the notification-daemon
>> >>>> > >> (Ubuntu 12.04 precise) does't support actions.
>> >>>> > >>
>> >>>> > >> From freedesktop specs
>> >>>> > >> https://developer.gnome.org/notification-spec/
>> >>>> > >> "
>> >>>> > >> Actions
>> >>>> > >>
>> >>>> > >> The actions send a request message back to the notification
>> >>>> > >> client
>> >>>> > >> when invoked. This functionality may not be implemented by the
>> >>>> > >> notification server, conforming clients should check if it is
>> >>>> > >> available before using it (see the GetCapabilities message in
>> >>>> > >> Protocol). An implementation is free to ignore any requested by
>> >>>> > >> the
>> >>>> > >> client. As an example one possible rendering of actions would be
>> >>>> > >> as
>> >>>> > >> buttons in the notification popup.
>> >>>> > >>
>> >>>> > >> Actions are sent over as a list of pairs. Each even element in
>> >>>> > >> the
>> >>>> > >> list (starting at index 0) represents the identifier for the
>> >>>> > >> action.
>> >>>> > >> Each odd element in the list is the localized string that will
>> >>>> > >> be
>> >>>> > >> displayed to the user."
>> >>>> > >>
>> >>>> > >>
>> >>>> > >> However hyperlinks is supported, if I add <a
>> >>>> > >> href="http://sugarlabs.org"> SugarLabs , works. Not exactly as I
>> >>>> > >> want .... :(
>> >>>> > >>
>> >>>> > >> When I do a click on the link, Firefox is opened.
>> >>>> > >>
>> >>>> > >> I tried change the system default browser setting with:
>> >>>> > >>
>> >>>> > >> gconftool-2 -s /desktop/gnome/applications/browser/exec --type
>> >>>> > >> string
>> >>>> > >> '/usr/local/bin/sugar-browser "%s"'
>> >>>> > >>
>> >>>> > >> Notice: sugar-browser is a bash script to launch
>> >>>> > >> BrowserActivity.
>> >>>> > >>
>> >>>> > >> But after that, Firefox still opened each doing click on link of
>> >>>> > >> notification message.
>> >>>> > >>
>> >>>> > >>
>> >>>> > >> So the problem now is, how change the default browser on Sugar.
>> >>>> > >>
>> >>>> > >
>> >>>> > > Hum, sounds like the system's default mime definitions might be
>> >>>> > > pointed
>> >>>> > > to
>> >>>> > > Firefox in /usr/share/applications/defaults.list. What does
>> >>>> > > "xdg-mime
>> >>>> > > query
>> >>>> > > default text/html" return? The XO here returns 'firefox.desktop'
>> >>>> > > even
>> >>>> > > without having the Firefox rpm installed. Not sure what the
>> >>>> > > correct
>> >>>> > > way
>> >>>> > > of
>> >>>> > > overriding this list would be, create
>> >>>> > > "~/.local/share/applications/mimeapps.list", or maybe using
>> >>>> > > "xdg-mime
>> >>>> > > default ..."? Both of those ideas would need a .desktop file for
>> >>>> > > browse
>> >>>> > > thou.
>> >>>> > >
>> >>>> > > Hope it helps,
>> >>>> > >
>> >>>> > > Jerry
>> >>>> > >
>> >>>> > >> Any idea ?
>> >>>> > >>
>> >>>> > >> Thanks in advance.
>> >>>> > >>
>> >>>> > >> Gustavo.
>> >>>> > >>
>> >>>> > >> On Fri, Dec 5, 2014 at 9:27 PM, Gustavo Duarte
>> >>>> > >> <gus.duarte at gmail.com>
>> >>>> > >> wrote:
>> >>>> > >> > Greats !! Thanks for these tips.
>> >>>> > >> >
>> >>>> > >> > El 05/12/2014 17:59, "Gonzalo Odiard" <godiard at sugarlabs.org>
>> >>>> > >> > escribió:
>> >>>> > >> >
>> >>>> > >> >> +1
>> >>>> > >> >>
>> >>>> > >> >> On Fri, Dec 5, 2014 at 4:57 PM, Sam P.
>> >>>> > >> >> <sam.parkinson3 at gmail.com>
>> >>>> > >> >> wrote:
>> >>>> > >> >>>
>> >>>> > >> >>> Hi,
>> >>>> > >> >>>
>> >>>> > >> >>> If my memory is right, the freedesktop notification spec
>> >>>> > >> >>> includes
>> >>>> > >> >>> "actions". You can have multiple of these and they are
>> >>>> > >> >>> displayed
>> >>>> > >> >>> like
>> >>>> > >> >>> buttons [1]. When they are clicked you get a callback event.
>> >>>> > >> >>>
>> >>>> > >> >>> I would prefer to implement the standard ranter than
>> >>>> > >> >>> something
>> >>>> > >> >>> proprietary. That is just my opinions.
>> >>>> > >> >>>
>> >>>> > >> >>> Thanks,
>> >>>> > >> >>> Sam
>> >>>> > >> >>>
>> >>>> > >> >>> [1]:  imgur.com/e8r9OZr
>> >>>> > >> >>
>> >>>> > >> >>
>> >>>> > >> >>
>> >>>> > >> >>
>> >>>> > >> >> --
>> >>>> > >> >> Gonzalo Odiard
>> >>>> > >> >>
>> >>>> > >> >> SugarLabs - Software for children learning
>> >>>> > >> _______________________________________________
>> >>>> > >> Sugar-devel mailing list
>> >>>> > >> Sugar-devel at lists.sugarlabs.org
>> >>>> > >> http://lists.sugarlabs.org/listinfo/sugar-devel
>> >> _______________________________________________
>> >> Sugar-devel mailing list
>> >> Sugar-devel at lists.sugarlabs.org
>> >> http://lists.sugarlabs.org/listinfo/sugar-devel
>> >
>> >
>> >
>> > --
>> > Walter Bender
>> > Sugar Labs
>> > http://www.sugarlabs.org
>
>
>
>
> --
> Gonzalo Odiard
>
> SugarLabs - Software for children learning


More information about the Sugar-devel mailing list