VM selection: expand models for tooltip column

Add a new column in the list models for the VM selection dialog, and use
this new column to hold the tooltip of the items in the list.

At the moment nothing is set in the new column, so there is no behavior
change.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
Pino Toscano 2020-07-24 10:54:08 +02:00 committed by Pino Toscano
parent 2e46ffc08d
commit e2abe953ed
4 changed files with 14 additions and 9 deletions

View File

@ -608,8 +608,8 @@ choose_vm(GtkWindow *main_window,
g_return_val_if_fail(vm_name != NULL, NULL);
free(*vm_name);
/* UI name , key */
model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
/* UI name , key , tooltip */
model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
vms = ovirt_collection_get_resources(vms_collection);
g_hash_table_iter_init(&vms_iter, vms);

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="vm-connection-dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -21,7 +22,7 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button-cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -64,6 +65,7 @@
<property name="headers_visible">False</property>
<property name="search_column">0</property>
<property name="enable_grid_lines">horizontal</property>
<property name="tooltip_column">2</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
@ -90,12 +92,12 @@
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes">Available virtual machines</property>
<property name="ellipsize">end</property>
<property name="width_chars">26</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -113,5 +115,8 @@
<action-widget response="-6">button-cancel</action-widget>
<action-widget response="-3">button-connect</action-widget>
</action-widgets>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@ -65,7 +65,7 @@ virt_viewer_vm_connection_choose_name_dialog(GtkWindow *main_window,
return NULL;
}
g_assert(gtk_tree_model_get_n_columns(model) == 2);
g_assert(gtk_tree_model_get_n_columns(model) == 3);
vm_connection = virt_viewer_util_load_ui("virt-viewer-vm-connection.ui");
g_return_val_if_fail(vm_connection != NULL, NULL);

View File

@ -823,8 +823,8 @@ choose_vm(GtkWindow *main_window,
g_return_val_if_fail(vm_name != NULL, NULL);
free(*vm_name);
/* UI name , key */
model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
/* UI name , key , tooltip */
model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
vms_running = virConnectListAllDomains(conn, &domains, flags);
for (i = 0; i < vms_running; i++) {