Fix edit icon and move Add Variable button inside table as last row

This commit is contained in:
Pavel Baksy 2025-12-31 00:26:05 +01:00
parent f4e8f0cca9
commit f91c9f318a
3 changed files with 31 additions and 38 deletions

View File

@ -77,41 +77,6 @@
</child>
</object>
</child>
<!-- Add Variable Button at Bottom -->
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">12</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="width-request">150</property>
<child>
<object class="GtkButton" id="add_variable_button">
<property name="icon-name">list-add-symbolic</property>
<property name="tooltip-text">Add variable</property>
<signal name="clicked" handler="on_add_variable_clicked"/>
<style>
<class name="flat"/>
<class name="circular"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@ -31,7 +31,6 @@ class EnvironmentsDialog(Adw.Dialog):
__gtype_name__ = 'EnvironmentsDialog'
table_container = Gtk.Template.Child()
add_variable_button = Gtk.Template.Child()
add_environment_button = Gtk.Template.Child()
__gsignals__ = {
@ -87,7 +86,36 @@ class EnvironmentsDialog(Adw.Dialog):
self.table_container.append(row)
self.data_rows.append(row)
@Gtk.Template.Callback()
# Add "Add Variable" button row at the bottom
add_var_row = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12)
add_var_row.set_margin_start(12)
add_var_row.set_margin_end(12)
add_var_row.set_margin_top(6)
add_var_row.set_margin_bottom(6)
# Variable cell with add button
var_cell = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
var_cell.set_size_request(150, -1)
if self.size_group:
self.size_group.add_widget(var_cell)
add_variable_button = Gtk.Button()
add_variable_button.set_icon_name("list-add-symbolic")
add_variable_button.set_tooltip_text("Add variable")
add_variable_button.connect('clicked', self.on_add_variable_clicked)
add_variable_button.add_css_class("flat")
add_variable_button.add_css_class("circular")
var_cell.append(add_variable_button)
add_var_row.append(var_cell)
# Empty space for value columns
empty_space = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
empty_space.set_hexpand(True)
add_var_row.append(empty_space)
self.table_container.append(add_var_row)
def on_add_variable_clicked(self, button):
"""Add new variable."""
dialog = Adw.AlertDialog()

View File

@ -25,7 +25,7 @@
<child>
<object class="GtkButton" id="edit_button">
<property name="icon-name">edit-symbolic</property>
<property name="icon-name">accessories-text-editor-symbolic</property>
<property name="tooltip-text">Edit environment</property>
<signal name="clicked" handler="on_edit_clicked"/>
<style>