Slightly modified version of Custom Commands Dialog fix from David Chandler + fixes for GTK3

This commit is contained in:
Stephen Boddy 2015-02-25 15:25:41 +01:00
parent 5bdbc1ce20
commit 47e5baf76c
1 changed files with 15 additions and 10 deletions

View File

@ -64,7 +64,7 @@ class CustomCommandsMenu(plugin.MenuItem):
submenu = Gtk.Menu() submenu = Gtk.Menu()
item.set_submenu(submenu) item.set_submenu(submenu)
menuitem = Gtk.ImageMenuItem(Gtk.STOCK_PREFERENCES) menuitem = Gtk.MenuItem(_('Preferences'))
menuitem.connect("activate", self.configure) menuitem.connect("activate", self.configure)
submenu.append(menuitem) submenu.append(menuitem)
@ -157,56 +157,61 @@ class CustomCommandsMenu(plugin.MenuItem):
column = Gtk.TreeViewColumn("Command", renderer, text=CC_COL_COMMAND) column = Gtk.TreeViewColumn("Command", renderer, text=CC_COL_COMMAND)
treeview.append_column(column) treeview.append_column(column)
scroll_window = Gtk.ScrolledWindow()
scroll_window.set_size_request(500, 250)
scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scroll_window.add_with_viewport(treeview)
hbox = Gtk.HBox() hbox = Gtk.HBox()
hbox.pack_start(treeview, True, True, 0) hbox.pack_start(scroll_window, True, True, 0)
dbox.vbox.pack_start(hbox, True, True, 0) dbox.vbox.pack_start(hbox, True, True, 0)
button_box = Gtk.VBox() button_box = Gtk.VBox()
button = Gtk.Button(stock=Gtk.STOCK_GOTO_TOP) button = Gtk.Button(stock=Gtk.STOCK_GOTO_TOP)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_goto_top, ui) button.connect("clicked", self.on_goto_top, ui)
button.set_sensitive(False) button.set_sensitive(False)
ui['button_top'] = button ui['button_top'] = button
button = Gtk.Button(stock=Gtk.STOCK_GO_UP) button = Gtk.Button(stock=Gtk.STOCK_GO_UP)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_go_up, ui) button.connect("clicked", self.on_go_up, ui)
button.set_sensitive(False) button.set_sensitive(False)
ui['button_up'] = button ui['button_up'] = button
button = Gtk.Button(stock=Gtk.STOCK_GO_DOWN) button = Gtk.Button(stock=Gtk.STOCK_GO_DOWN)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_go_down, ui) button.connect("clicked", self.on_go_down, ui)
button.set_sensitive(False) button.set_sensitive(False)
ui['button_down'] = button ui['button_down'] = button
button = Gtk.Button(stock=Gtk.STOCK_GOTO_LAST) button = Gtk.Button(stock=Gtk.STOCK_GOTO_LAST)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_goto_last, ui) button.connect("clicked", self.on_goto_last, ui)
button.set_sensitive(False) button.set_sensitive(False)
ui['button_last'] = button ui['button_last'] = button
button = Gtk.Button(stock=Gtk.STOCK_NEW) button = Gtk.Button(stock=Gtk.STOCK_NEW)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_new, ui) button.connect("clicked", self.on_new, ui)
ui['button_new'] = button ui['button_new'] = button
button = Gtk.Button(stock=Gtk.STOCK_EDIT) button = Gtk.Button(stock=Gtk.STOCK_EDIT)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.set_sensitive(False) button.set_sensitive(False)
button.connect("clicked", self.on_edit, ui) button.connect("clicked", self.on_edit, ui)
ui['button_edit'] = button ui['button_edit'] = button
button = Gtk.Button(stock=Gtk.STOCK_DELETE) button = Gtk.Button(stock=Gtk.STOCK_DELETE)
button_box.pack_start(button, False, True) button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_delete, ui) button.connect("clicked", self.on_delete, ui)
button.set_sensitive(False) button.set_sensitive(False)
ui['button_delete'] = button ui['button_delete'] = button
hbox.pack_start(button_box, True, True, 0) hbox.pack_start(button_box, False, True, 0)
dbox.show_all() dbox.show_all()
res = dbox.run() res = dbox.run()
if res == Gtk.ResponseType.ACCEPT: if res == Gtk.ResponseType.ACCEPT: