[feat] add a searching textbox

This commit is contained in:
Julian Sparber
2017-10-01 16:16:01 +02:00
parent d14a58d242
commit daaf5ed988
2 changed files with 47 additions and 9 deletions

View File

@@ -21,6 +21,7 @@ struct _TeleportAppWindowPrivate
GtkWidget *gears;
GtkWidget *remote_devices_list;
GtkWidget *this_device_name_label;
GtkWidget *remote_no_devices;
};
G_DEFINE_TYPE_WITH_PRIVATE(TeleportAppWindow, teleport_app_window, GTK_TYPE_APPLICATION_WINDOW);
@@ -96,6 +97,8 @@ void update_remote_device_list(TeleportAppWindow *win, Peer *device) {
priv = teleport_app_window_get_instance_private (win);
gtk_widget_hide (priv->remote_no_devices);
builder_remote_list = gtk_builder_new_from_resource ("/com/frac_tion/teleport/remote_list.ui");
row = GTK_WIDGET (gtk_builder_get_object (builder_remote_list, "remote_device_row"));
@@ -131,6 +134,10 @@ void update_remote_device_list_remove(TeleportAppWindow *win, Peer *device) {
i++;
remote_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX(box), i);
}
// the last row got removed and we have to display the searching box
if (i <= 2) {
gtk_widget_show (priv->remote_no_devices);
}
}
GtkWidget *
@@ -183,6 +190,7 @@ teleport_app_window_class_init (TeleportAppWindowClass *class)
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, gears);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, this_device_name_label);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, remote_no_devices);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, remote_devices_list);
}

View File

@@ -65,12 +65,12 @@
<child>
<object class="GtkListBox" id="this-device-listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="this-device-row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="this-device-grid">
@@ -202,12 +202,42 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="remote_no_devices">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">50</property>
<property name="bottom_padding">50</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="spacing">20</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Searching for other devices...</property>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">true</property>
<property name="orientation">horizontal</property>
<object class="GtkSpinner">
<property name="visible">True</property>
<property name="active">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>