Awn

You shouldn't be able to add the same theme twice

Bug #246753 reported by black
4
Affects Status Importance Assigned to Milestone
Awn
Fix Released
Low
Unassigned

Bug Description

You can add twice the same theme in awn-manager. There isn't a new directory created, so the 2 themes are an exact copy of each other. On the other hand, if you delete one theme, the directory is deleted. If you delete the copy, you will get an error (because the directory of the theme is already removed).

So we have 2 possible solutions:
- add the theme under a new name
- don't add the theme but show a warning (that they are adding an exact theme)

Revision history for this message
Matt (mjz) wrote :

Another possible solution:
Update/replace the old theme, and notify the user of doing do. (My vote goes to this solution)
Makes sense since :) there's a 'Version' parameter available when saving a theme.

I think this is how it's done for applets, also.

Revision history for this message
black (blackborn) wrote :

I agree with the third solution

Revision history for this message
Michael Rooney (mrooney) wrote :

Okay, can we clarify what defines the "same" theme? Name, contents, etc? I see nothing wrong with adding a theme twice so that I can tweak one a little and still have the default version of that theme, for example. Or similarly I might tweak a theme, and then re-add it to get a version without my changes.

Why not just check the name and if it matches something that already exists, pop up a box saying "A theme by this name already exists. Do you want to add it again?" With a Yes | No option. Most users just making a mistake will realize "Oops, I already have this one!" and click No, and any user who knows what they are doing will of course click Yes. If the user clicks No course nothing happens, if the user clicks Yes it will figure out a new name (and directory etc) for it and add it:

  i = 2
  name = theme_name + " %i"
  while theme_exists(name%i):
      i += 1

So you can add "Dark Theme", then again as "Dark Theme 2", and again as "Dark Theme 3", et cetera. What about that?

Revision history for this message
Michael Rooney (mrooney) wrote :

Actually with more thought, I realized an Update option should exist like Matt said. If there is a conflict, FIRST calculate the new name as above. Then have a dialog saying perhaps 'The theme "Dark Theme" already exists. What would you like to do?' with options 'Cancel', 'Update "Dark Theme"', and 'Add again as "Dark Theme 2"'.

What about that! I don't think we need to do any version checking forcefully, because there is nothing necessarily wrong with wanting to revert to an older version. However if they click update and the version is older than the current, perhaps a dialog saying "This theme is older than the current version. Do you still want to replace it?" or something. A lot to consider, huh?

Revision history for this message
black (blackborn) wrote :

So if you add a theme with the same name, it gives you a dialog with some information (You have this theme already installed,...) and 3 options:
- replace
- add as '... 2'
- cancel

I this OK by everybody?

ps: I should leave the versions unnoticed, because the numbering is not consistent (1 vs 1.0 vs v1) between different themes. The user knows what he is installing (he probably have seen a sceenshot of the theme) and what version it is, he doesn't care (because he just want the theme that matches the screenshot).

Revision history for this message
Matt (mjz) wrote :

The above seems good, but I think instead of add as '... 2', there should be 'Add with new name', which will offer an entry, with '... 2' as the default text.
It also needs to check if '... 2' exists, and use '... 3', 4, 5, etc.

Michal Hruby (mhr3)
Changed in awn:
importance: Undecided → Low
milestone: none → 0.4.0
status: New → Triaged
Mark Lee (malept)
summary: - You shouldn't be able to add twice the same theme
+ You shouldn't be able to add the same theme twice
Michal Hruby (mhr3)
Changed in awn:
status: Triaged → Fix Committed
moonbeam (rcryderman)
Changed in awn:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.