Commit Graph

76 Commits

Author SHA1 Message Date
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
033277b68f Define externally accessible contants with 'var' instead of 'const'
Just as we did with classes, define other constants that are (or
may be) used from other modules with 'var' to cut down on warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
b4df747464 telepathyClient: Gracefully handle missing telepathy deps
Telepathy's role has been diminishing continuously over the last
couple of years, so while chat integration is a nice feature for
those who use it, it is hard to justify keeping it as a hard
dependency. To address this, split out the component from the
client so we can handle missing typelibs gracefully by not
providing any chat integration.

https://bugzilla.gnome.org/show_bug.cgi?id=779878
2017-03-13 16:23:08 +01:00
Florian Müllner
7c96b39bef telepathyClient: Implement Tp.BaseClient directly
The telepathy integration was written at a time where gjs didn't
allow to inherit from GObject classes, which is why we needed a
C helper class. This hasn't been the case for a while now, so cut
out the middle man and implement Tp.BaseClient directly.

https://bugzilla.gnome.org/show_bug.cgi?id=771721
2017-03-10 17:02:18 +01:00
Florian Müllner
645aa01efd telepathyClient: Use a single update for text and timestamp
Commit c6f22826cf added a call to update() to refresh the notification
time for sent and received messages. However as it omits the bannerMarkup
parameter, escaped text like ''' now makes it through verbatim.
Rather than adding the parameter, we can just refresh the timestamp in
the existing update() call to fix the issue - it means the notification
timestamp is only refreshed for received messages, but that reflects
the text shown in the notification, which isn't updated for sent
messages either.

https://bugzilla.gnome.org/show_bug.cgi?id=779435
2017-03-01 20:46:58 +01:00
Florian Müllner
c6f22826cf telepathyClient: Update notification time from message
As the telepathy integration picks up existing channels on startup,
ChatNotifications are another case where the real time the message
was received may be before the time it is picked up by the shell.
While this is less of an annoyance than restored GNotifications, as
it generally only affects restarts from the run dialog, it's an
easy fix now ...

https://bugzilla.gnome.org/show_bug.cgi?id=775799
2017-02-27 20:04:09 +01:00
Florian Müllner
06d0e7d74a telepathyClient: Always clear pending messages on destroy
Since commit 82950ecea, we acknowledge pending messages when closing a
chat notification for a channel we are handling to prevent the channel
from popping up again immediately. While this isn't an issue for channels
we don't handle, the unread messages of the destroyed notification are
still considered for the messages indicator in the top bar, which is
clearly confusing (in particular when we end up showing the indicator
without any notifications in the list). As it's arguably correct to not
meddle with a channel handled by someone else, just reset the cache of
pending messages to address this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=770888
2016-09-09 23:54:28 +02:00
Florian Müllner
82950ecea0 telepathyClient: Acknowledge messages before closing
While a channel has pending messages, it will pop up again when
dismissed. That is clearly not what users expect, so clear them
out first before closing a channel.

https://bugzilla.gnome.org/show_bug.cgi?id=747991
2016-03-16 18:59:44 +01:00
Florian Müllner
ee8fd1e613 calendar: Split out message list base classes
Currently both the base classes for messages/sections and the message
list itself that instantiates the available sections are located in
the same module. As a result, it isn't possible to define sections
in a different module without introducing circular dependencies. The
Calendar module is already unwieldily large, so split it up a bit to
avoid it growing even bigger in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=756491
2016-02-17 14:56:52 +01:00
Florian Müllner
58905bd01a telepathyClient: Use protocol-specific policy
Since commit 79c04c93e4, we launch Polari instead of Empathy when
activating a chat notification for an IRC channel. It therefore makes
sense to follow Polari's notification policy for those notifications
rather than Empathy's.

https://bugzilla.gnome.org/show_bug.cgi?id=752881
2015-08-05 17:22:10 +02:00
Florian Müllner
a0868bac6b telepathyClient: Keep source alive while channel is open
Sources are destroyed with their last notification. This is usually the
correct behavior, however in case of chat sources, the corresponding
telepathy channel might still be open, and any further messages that
should trigger a notification are lost because chat sources are only
created when telepathy's channel dispatcher notifies us about a channel
(via ObserveChannels).
Loosing messages like this is unexpected, so keep chat sources around
even without notifications while the channel is open.

https://bugzilla.gnome.org/show_bug.cgi?id=747636
2015-04-11 22:53:42 +02:00
Florian Müllner
265b1f0292 telepathyClient: Disentangle source and notification
Currently the lifetime of a chat source and its single notification
are tied together. While this apparently makes sense, it means we
will lose all follow-up notifications when a source is destroyed
with the corresponding telepathy channel left open. We will fix this
soon by tying the source to the channel's lifetime rather than the
notification, prepare for this by recreating the notification if
necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=747636
2015-04-11 22:53:35 +02:00
Florian Müllner
2c12f3a509 telepathyClient: Fix removal of timestamp timeout source
Timestamps were always handled by the notification rather than the source,
so that code never worked.
2015-04-10 16:10:02 +02:00
Giovanni Campagna
d8926b96e2 Telepathy: hide chat notifications when focusing the app
When the chat app is focused, we should hide all banners immediately.
A good way to do so, without tracking which app is focused, is
to look for messages that are acked when the banner is unexpanded,
which implies they were acked by some other telepathy client.

https://bugzilla.gnome.org/show_bug.cgi?id=746364
2015-03-27 13:10:52 -07:00
Florian Müllner
bb61dd4b44 telepathyClient: Provide a custom banner implementation
Since we stopped special-casing chat notifications to use the old
notification actor, we need to provide a notification banner to
maintain the inline chat functionality, so split out the UI from
the existing ChatNotification class.

https://bugzilla.gnome.org/show_bug.cgi?id=746343
2015-03-17 16:06:52 +01:00
Florian Müllner
0ee762263a telepathyClient: Don't remove body on updates
Passing null as body always meant clearing the existing one. While this
mattered less with the old message tray which used the expanded actor,
the new message list in the calendar uses the unexpanded body. We clearly
don't want that to disappear on icon changes, so pass the existing one.

https://bugzilla.gnome.org/show_bug.cgi?id=746343
2015-03-17 15:48:37 +01:00
Florian Müllner
a25d2dc256 telepathyClient: Remove some more dead code 2015-03-17 04:14:44 +01:00
Florian Müllner
b2ae945cf2 telepathyClient: Remove some dead code
This has been unused ever since we stopped logging presence changes in
commit 4448b65a18 ...
2015-03-17 03:29:42 +01:00
Florian Müllner
82479db084 telepathyClient: Close overview and panel when activated
There's a strong expectation that delegating or presenting a channel
will result in a window being activated, so close both overview and
calendar as we do elsewhere.
2015-03-11 01:17:57 +01:00
Florian Müllner
d8505934e8 Use createTimeLabel() where appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=745111
2015-03-04 13:55:01 +01:00
Florian Müllner
1c36ade125 Use formatTime() for timestamps
Replace the time formatting in notifications and events with the
new utility method - this makes sure that all times are now following
the clock-format setting and use LC_TIME.

https://bugzilla.gnome.org/show_bug.cgi?id=745111
2015-03-04 13:55:01 +01:00
Giovanni Campagna
707cc9e315 TelepathyClient: stop handling room invitations
Let empathy deal with these

https://bugzilla.gnome.org/show_bug.cgi?id=745503
2015-03-03 14:20:48 -08:00
Giovanni Campagna
fab25e18da TelepathyClient: remove call and file transfer approval
Let empathy deal with these.

https://bugzilla.gnome.org/show_bug.cgi?id=745503
2015-03-03 14:20:48 -08:00
Giovanni Campagna
e01076a48b TelepathyClient: remove account status notifications
These notifications are annoying for the most part: presence
changes happen inside an app (empathy or polari), and that app
should have in app notifications for errors, instead of spamming
the global notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=745503
2015-03-03 14:20:48 -08:00
Giovanni Campagna
38a2f26e44 TelepathyClient: remove subscription request notifications
The ones handled by empathy are just fine

https://bugzilla.gnome.org/show_bug.cgi?id=745503
2015-03-03 14:20:48 -08:00
Giovanni Campagna
79c04c93e4 TelepathyClient: use polari for IRC channels
polari is the GNOME app for IRC, empathy is for everything else
So prefer polari to empathy for IRC channels. We don't need
to check that either exists (even though polari is not a core
app) because mission control tries every handler if the preferred
one fails.
Depends on bug 745418 for polari to be mission control activatable.

https://bugzilla.gnome.org/show_bug.cgi?id=745431
2015-03-02 16:21:38 -08:00
Florian Müllner
67eade6482 telepathyClient: Provide createBanner() implementation
Chat notifications are king of custom, so we'll leave them out for now
and keep using the old banner. However we can port the subscription
notification.
2015-02-20 17:41:57 +01:00
Florian Müllner
87ae45a12f telepathyClient: Don't use customContent notifications gratuitously
Nothing except for the chat notification is really custom, so stop
specifying the flag for anything else - it will soon become a bit
harder to create non-standard notifications, so don't do it for no
good reason (discouraging this is of course the reason for making it
harder in the first place) ...
2015-02-20 17:41:56 +01:00
Florian Müllner
4a709792cd overviewControls: Remove message indicator
The message tray is now empty and about to be removed, so an indication
at the bottom edge of the overview becomes an odd location to convey the
status of the summary. We will eventually display an indication in the
top bar that unseen messages are available, for now just remove the
existing indicator.

https://bugzilla.gnome.org/show_bug.cgi?id=744850
2015-02-20 17:40:21 +01:00
Florian Müllner
485cd0f278 messageTray: Remove UI bits from Source
Since the summary area was removed from the message tray, Source are not
longer represented in the UI, so right-click menus and summary icons are
no longer a thing.

https://bugzilla.gnome.org/show_bug.cgi?id=744850
2015-02-20 17:39:59 +01:00
Florian Müllner
65a5baa902 messageTray: Make Notification._onClicked handler public
When we will start to show notifications in the date drop-down, we
will not use the actual notification actor, but construct our own UI
based on Calendar.Message. This is similar to what we already do in
the lock screen, except that in this case clicking the notification
should activate the default action.
So rename the existing _onClicked() method to activate() to make it
clear that such use is acceptable. While not strictly necessary, also
rename the corresponding signal to match.

https://bugzilla.gnome.org/show_bug.cgi?id=744817
2015-02-20 17:39:25 +01:00
Florian Müllner
2f554e27f2 telepathyClient: Fix a translator comment
Ouch, classy - we are telling translators to use a '24h' time
format for the '12h' time format string.
Luckily, only a handful of translations actually followed the
comment (de,hu,id,is,kk,nb,nl), and most of the corresponding
locales do not support 12-hour format anyway (only is_IS, at
least on Fedora).
2015-02-14 18:27:49 +01:00
Florian Müllner
eb3fc7815e Use LC_TIME locale for strftime format string translations
We commonly mark strftime format strings for translation to account
for date/time representations without an existing strftime shortcut
("Yesterday %H%p"). As those translations are looked up according to
the locale defined by LC_MESSAGES, while the conversion characters
themselves are resolved according to LC_TIME, the result can be
rather odd when mixing locales ("Den 27. January"). The correct
solution would be to install translations for format strings in
the LC_TIME catalogue and look them up with dcgettext(), but we
don't have the infrastructure to do that easily. Work around this
by adding a helper method that looks up a string in LC_MESSAGES
using the locale defined by LC_TIME and use that to translate
format strings, which has the same result.

https://bugzilla.gnome.org/show_bug.cgi?id=738640
2014-10-16 23:41:51 +02:00
Cosimo Cecchi
328bb1c21b st: always use GFile internally
We're moving the theme infrastructure towards GResource, so as a first
step move all the loading to use GFiles instead of URIs or paths.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:53:39 -07:00
Giovanni Campagna
7c9d90b0aa TelepathyClient: fix history trimming
We need to put the actual actors in the history, not just the labels,
otherwise all emptyLine (which are not messages but are not empty
either) and all lines with a timestamp will get stuck in the scrollback.

https://bugzilla.gnome.org/show_bug.cgi?id=733899
2014-08-19 16:48:13 +02:00
Jasper St. Pierre
83cb26d70e js: Adapt to GSettings API change
The 'schema' property has been deprecated for a long time. Even though
this will likely be reverted in glib, let's stop using it.
2014-06-24 15:17:09 -04:00
Florian Müllner
b8f0d0f0dc telepathyClient: Only use 12-hour format when supported by the locale
It is a bit odd to request AM/PM format when the locale selected
by LC_TIME lacks the concept. We ignore the format setting in that
case elsewhere and assume 24-hour format, let's do the same for
chat timestamps for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=728271
2014-05-28 22:01:53 +02:00
Jasper St. Pierre
df1bed941d telepathyClient: Remove unused variable 2014-05-28 13:09:43 -04:00
Bastien Nocera
cd2bd7685a js: Name all the timeouts and idles
With very uninventive names. Names now, good names later.

https://bugzilla.gnome.org/show_bug.cgi?id=727983
2014-04-10 21:08:16 +02:00
Cosimo Cecchi
9c88fec4fc texture-cache: use scale factor for load_uri_async()
https://bugzilla.gnome.org/show_bug.cgi?id=726907
2014-03-28 10:53:01 -07:00
Giovanni Campagna
6ce6e86318 TelepathyClient: destroy an existing account notification when the user goes offline
We already filter new notifications caused by the explicit
user action, but we don't do so for changes to existing
notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=723976
2014-03-12 19:26:42 +01:00
Carlos Soriano
58191ea66b telepathyClient: Use locale format for timestamps
Until now the timestamps were using 24h format.
Check gsetting clock-format to know when
the user is using 12h format or 24h format and
make the timestamp acordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=715158
2014-02-18 11:27:34 +01:00
Carlos Soriano
fa4c481aed telepathyClient: Use ratio char for timestamps 2014-02-17 20:52:51 +01:00
Carlos Soriano
fff2ca6f26 telephatyIdle: Time stamps next conversation line
To give more context to the chat notification bubble, put the
time stamp next to the last conversation line instead of
a new line.

https://bugzilla.gnome.org/show_bug.cgi?id=708031
2014-02-17 20:00:00 +01:00
Giovanni Campagna
ccfc9f3ab0 TelepathyClient: disconnect signals from destroyed ChatSources
Otherwise they keep firing if the source is destroyed by the user
and they trigger Clutter warnings from touching invalid actors.

https://bugzilla.gnome.org/show_bug.cgi?id=722660
2014-01-28 21:50:07 +01:00
Giovanni Campagna
3227d4f3ed ShellApp+ShellGlobal: unify app launch context code
Extend shell_global_create_app_launch_context() with the required
parameters and use that for shell_app_launch() too.

https://bugzilla.gnome.org/show_bug.cgi?id=669603
2014-01-19 18:51:48 +01:00
Florian Müllner
751a3f0e94 js: Use SOURCE_CONTINUE/SOURCE_REMOVE constants in source functions
With support for boolean constants in g-i, we can finally use the
more readable constants instead of true/false.

https://bugzilla.gnome.org/show_bug.cgi?id=719567
2013-12-16 18:27:19 +01:00
Florian Müllner
554d5aeb7c More invalid source fixes
https://bugzilla.gnome.org/show_bug.cgi?id=711732
2013-11-09 17:58:59 +01:00
Jasper St. Pierre
8ee0ef2cde messageTray: Don't always open the source when clicking on the notification
Some consumers may not always want to open the app, so make clients that
want to do this explicitly connect to the 'clicked' signal.

https://bugzilla.gnome.org/show_bug.cgi?id=710137
2013-10-21 12:30:25 -04:00