Skip to content

Commit

Permalink
Merge pull request getting-things-gnome#301 from jscn/fix-search-spec…
Browse files Browse the repository at this point in the history
…ific-context-menu

Hide delete tag option in context menu for saved search
  • Loading branch information
diegogangl authored May 4, 2020
2 parents 9657570 + 3f42baa commit 5272cf7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions GTG/gtk/browser/tag_context_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,26 @@ def __build_menu(self):
# Color chooser FIXME: SHOULD BECOME A COLOR PICKER
self.mi_cc = Gtk.MenuItem()
self.mi_cc.set_label(_("Edit Tag..."))
self.append(self.mi_cc)
self.mi_cc.connect('activate', self.on_mi_cc_activate)

self.mi_ctag = Gtk.MenuItem()
self.mi_ctag.set_label(_("Generate Color"))
self.mi_del_tag = Gtk.MenuItem()
self.mi_del_tag.set_label(_("Delete Tag"))
self.append(self.mi_cc)
self.append(self.mi_ctag)
self.append(self.mi_del_tag)
self.mi_del_tag.connect(
'activate', self.app.browser.on_delete_tag_activate)
self.mi_cc.connect('activate', self.on_mi_cc_activate)
self.mi_ctag.connect('activate', self.on_mi_ctag_activate)

if self.tag.is_search_tag():
self.mi_del = Gtk.MenuItem()
self.mi_del.set_label(_("Delete"))
self.append(self.mi_del)
self.mi_del.connect('activate', self.on_mi_del_activate)
else:
self.mi_del_tag = Gtk.MenuItem()
self.mi_del_tag.set_label(_("Delete Tag"))
self.append(self.mi_del_tag)
self.mi_del_tag.connect(
'activate', self.app.browser.on_delete_tag_activate)

# Make it visible
self.show_all()

Expand All @@ -86,8 +90,8 @@ def on_mi_cc_activate(self, widget):
def on_mi_ctag_activate(self, widget):
random_color = generate_tag_color()
present_color = self.tag.get_attribute('color')
if(present_color is not None):
color_remove(present_color)
if present_color is not None:
color_remove(present_color)
self.tag.set_attribute('color', random_color)
color_add(random_color)

Expand Down

0 comments on commit 5272cf7

Please sign in to comment.