After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611894 - Add option to make chatroom "always urgent"
Add option to make chatroom "always urgent"
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Chat
2.29.x
Other Linux
: Normal enhancement
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2010-03-05 12:11 UTC by Jonas Bonn
Modified: 2011-08-29 10:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add option to make chatroom "always urgent" (8.75 KB, patch)
2010-03-05 12:11 UTC, Jonas Bonn
reviewed Details | Review
Add function ensure_chatroom (2.53 KB, patch)
2010-03-05 16:10 UTC, Jonas Bonn
none Details | Review
Use ensure_chatroom in favorites cb (1.22 KB, patch)
2010-03-05 16:11 UTC, Jonas Bonn
none Details | Review
Add option to make chatroom "always urgent" (9.62 KB, patch)
2010-03-05 16:11 UTC, Jonas Bonn
none Details | Review
Retain always_urgent state (3.69 KB, patch)
2010-03-05 16:12 UTC, Jonas Bonn
none Details | Review
Use ensure_chatroom in favorites cb (1.33 KB, patch)
2010-03-05 16:29 UTC, Jonas Bonn
none Details | Review
Add option to make chatroom "always urgent" (9.40 KB, patch)
2010-03-05 16:30 UTC, Jonas Bonn
none Details | Review
Make chatroom manager retain room's always_urgent state (3.51 KB, patch)
2010-03-08 10:22 UTC, Jonas Bonn
none Details | Review
Bug fix (1.04 KB, patch)
2010-03-08 10:24 UTC, Jonas Bonn
none Details | Review

Description Jonas Bonn 2010-03-05 12:11:46 UTC
Created attachment 155298 [details] [review]
Add option to make chatroom "always urgent"

Often a user wants to be immediately notified of posts to a chatroom even when
    the post does not address them directly by name.  This patch adds a room
    option to make all posts to the room "urgent", meaning that the system-specific
    urgency action should be taken -- notification, window urgency hint, etc.
    
    Two specific use cases for when one may want this:
    
    i)  Low-traffic rooms (so that one does not have to go check the room all the
    time)
    ii)  Error-logging room (room to which errors from some other system(s) are
    logged)
    
    The "always urgent" option is off by default when joining a room.
Comment 1 Guillaume Desmottes 2010-03-05 13:18:18 UTC
Review of attachment 155298 [details] [review]:

Hi Jonas,

Thanks a lot for your contribution.

You introduced some coding style regressions. You should ensure that "make check" still pass with your patch.

I inlined some comments:

::: libempathy/empathy-chatroom.c
@@ +127,3 @@
+					 g_param_spec_boolean ("always_urgent",
+							       "Always Urgent",
+							       "TRUE if all posts to the chatroom should be considered urgent",

This line is too long.

@@ +703,3 @@
+	priv = GET_PRIV (chatroom);
+
+	if (priv->always_urgent == always_urgent) {

No need for { }

::: src/empathy-chat-window.c
@@ +856,3 @@
+
+	if (chatroom == NULL) {
+		const gchar *name;

This code has been copied from the favorite cb. It would be good to have a ensure_chatroom function doing that and returning a ref to the chatroom.

@@ +1363,1 @@
 	 * alias. */

This comment should be updated.

::: src/empathy-chat-window.ui
@@ +35,3 @@
+          <object class="GtkToggleAction" id="menu_conv_always_urgent">
+            <property name="name">menu_conv_always_urgent</property>
+            <property name="label" translatable="yes">Always _Urgent</property>

This option isn't very clear. Any idea of a better phrasing?
Comment 2 Jonas Bonn 2010-03-05 16:09:56 UTC
I've gone through your comments and made the necessary changes.  I split up the patches a bit, too, for easier review.

i)  I added a function "chatroom_manager_ensure_chatroom" as per your suggestion.
ii)  I added some code to the chatroom manager so that it saves a rooms always_urgent state
iii)  Settled on the wording "Notify Always" for the menu... not sure what would be better and still short enough to fit in the menu.

Patches (4) attached.

PS:  Any good way to use tools like git-email and have the patches end up here or somewhere where they're visible to Empathy developers???
Comment 3 Jonas Bonn 2010-03-05 16:10:43 UTC
Created attachment 155322 [details] [review]
Add function ensure_chatroom
Comment 4 Jonas Bonn 2010-03-05 16:11:16 UTC
Created attachment 155323 [details] [review]
Use ensure_chatroom in favorites cb
Comment 5 Jonas Bonn 2010-03-05 16:11:51 UTC
Created attachment 155324 [details] [review]
Add option to make chatroom "always urgent"
Comment 6 Jonas Bonn 2010-03-05 16:12:23 UTC
Created attachment 155325 [details] [review]
Retain always_urgent state
Comment 7 Jonas Bonn 2010-03-05 16:29:52 UTC
Created attachment 155327 [details] [review]
Use ensure_chatroom in favorites cb
Comment 8 Jonas Bonn 2010-03-05 16:30:43 UTC
Created attachment 155328 [details] [review]
Add option to make chatroom "always urgent"

Previous patch got a bit garbled when I tried to split in Git...  better now.
Comment 9 Jonas Bonn 2010-03-05 16:38:05 UTC
You can pull these patches from my git repo if it makes it any easier for you:

git://git.southpole.se/~jonas/git/empathy.git
Comment 10 Guillaume Desmottes 2010-03-08 07:50:28 UTC
Convention for _ensure function is to always return a new reference to the object.
Also, you mixed conding styles in this function. You should use tabs as this file still use the old coding style.

chatroom_manager_parse_chatroom: use tp_strdiff instead of strcmp (I know old code doesn't use but let's get the new code right. :)

-                       (const xmlChar *) empathy_chatroom_get_name (chatroom));
+                       (const xmlChar *) empathy_chatroom_get_room (chatroom));

I guess this was a bug, right? Ideally this should have been recoreded in a separated patch but I'm nipticking.

Except that it looks pretty good to me. Nice job at splitting work in different patches. :)

Matthew, Nick: any suggestion for a better name for this option?
Comment 11 Jonas Bonn 2010-03-08 10:13:54 UTC
> Convention for _ensure function is to always return a new reference to
> the object.

Not sure I under this comment... do you mean like this?

EmpathyChatroom *
empathy_chatroom_manager_ensure_chatroom (EmpathyChatroomManager *manager,
                                          TpAccount *account,
                                          const gchar *room,
                                          const gchar *name)
{
        EmpathyChatroom *chatroom;

        chatroom = empathy_chatroom_manager_find (manager, account, room);

        if (chatroom) {
                return g_object_ref(chatroom);
        } else {
                chatroom = empathy_chatroom_new_full (account,
                        room,
                        name,
                        FALSE);
                empathy_chatroom_manager_add (manager, chatroom);
                return chatroom;
        }
}
Comment 12 Jonas Bonn 2010-03-08 10:22:50 UTC
Created attachment 155544 [details] [review]
Make chatroom manager retain room's always_urgent state

i) use tp_strdiff instead of strcmp
ii)  pull out unrelated bug fix that snuck into this patch
Comment 13 Jonas Bonn 2010-03-08 10:24:21 UTC
Created attachment 155545 [details] [review]
Bug fix

Does this need a new bug report or can it go via this bug?  It's a pretty trivial fix...
Comment 14 Guillaume Desmottes 2010-03-08 11:06:58 UTC
(In reply to comment #11)
> > Convention for _ensure function is to always return a new reference to
> > the object.
> 
> Not sure I under this comment... do you mean like this?

Yep. And the caller has to release the ref once it's done with it.
Comment 15 Guillaume Desmottes 2010-03-08 11:14:19 UTC
(In reply to comment #13)
> Created an attachment (id=155545) [details] [review]
> Bug fix
> 
> Does this need a new bug report or can it go via this bug?  It's a pretty
> trivial fix...

Can you please push this branch is its own branch so I can already merge this fix?
Comment 16 Jonas Bonn 2010-03-08 12:13:56 UTC
(In reply to comment #15)
> (In reply to comment #13)
> > Created an attachment (id=155545) [details] [review] [details] [review]
> > Bug fix
> > 
> > Does this need a new bug report or can it go via this bug?  It's a pretty
> > trivial fix...
> 
> Can you please push this branch is its own branch so I can already merge this
> fix?

Pushed to branch bug-611894 at git://git.southpole.se/~jonas/git/empathy.git
Comment 17 Jonas Bonn 2010-03-08 12:42:38 UTC
(In reply to comment #14)
> (In reply to comment #11)
> > > Convention for _ensure function is to always return a new reference to
> > > the object.
> > 
> > Not sure I under this comment... do you mean like this?
> 
> Yep. And the caller has to release the ref once it's done with it.

Pushed to branch always_urgent at git://git.southpole.se/~jonas/git/empathy.git
Comment 18 Guillaume Desmottes 2010-03-08 16:15:46 UTC
Please enter a more descriptive commit msg. "Bug fix" isn't really useful. :)
Comment 19 Guillaume Desmottes 2010-03-08 16:20:11 UTC
Your urgent branch looks good to me. I'll merge it once 2.30 is branched as we are now in UI freeze.
I'd still like to find a better phrasing for the menu item though.

Thanks a lot for your great work.
Comment 20 Jonas Bonn 2010-03-08 19:01:25 UTC
(In reply to comment #18)
> Please enter a more descriptive commit msg. "Bug fix" isn't really useful. :)

Fixed... it's a rather trivial (and obvious) fix, though.
Comment 21 Jonas Bonn 2010-03-08 19:01:52 UTC
(In reply to comment #19)
> Your urgent branch looks good to me. I'll merge it once 2.30 is branched as we
> are now in UI freeze.
> I'd still like to find a better phrasing for the menu item though.
> 
> Thanks a lot for your great work.

Great!  Thanks.
Comment 22 Guillaume Desmottes 2010-03-09 08:40:55 UTC
(In reply to comment #20)
> (In reply to comment #18)
> > Please enter a more descriptive commit msg. "Bug fix" isn't really useful. :)
> 
> Fixed... it's a rather trivial (and obvious) fix, though.

Merged to master; thanks!

I keep this bug open until the always_urgent branch is merged.
Comment 23 Matthew Paul Thomas (mpt) 2010-05-09 16:17:08 UTC
In answer to the question of how to label the option: Any time a checkbox label begins with "Always", it's a good sign that a pair of radio buttons should be used instead.

If I understand the purpose of this option correctly, I suggest showing it something like:

    In chat rooms, notify me of: ( ) Every message  (*) Messages mentioning me
Comment 24 Jonas Bonn 2010-05-10 07:16:08 UTC
> If I understand the purpose of this option correctly, I suggest showing it
> something like:
> 
>     In chat rooms, notify me of: ( ) Every message  (*) Messages mentioning me

I like this wording, but the current user interface doesn't really allow for radio buttons.  The chatroom preferences are limited to a drop-down menu and it will be tough to squeeze in radio buttons as it currently stands.  It's already tough getting in a text description that describes this option at all due to the lack of space in the menu.  I imagine the chatroom options could use a redesign in any case, and then these radio buttons should be incorporated.

By the bye, will this branch be merged to master???
Comment 25 Guillaume Desmottes 2010-05-10 14:23:51 UTC
Ok, what about naming this checkbox "Important" and add a tooltip explaning what it did? Just change that and rebase on top of master and I'll merge your branch right away. :)

Sorry for the delay.
Comment 26 Guillaume Desmottes 2010-05-27 15:03:56 UTC
I renamed the label and merged the branch. Thanks a lot!

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.