Replace fitler entry with GtkSearchBar
This commit is contained in:
committed by
Simon Steinbeiß
parent
847ed1ad92
commit
19b888fcfe
@@ -54,6 +54,7 @@ struct _XtmProcessWindow
|
||||
GtkBuilder * builder;
|
||||
GtkWidget * window;
|
||||
GtkWidget * filter_entry;
|
||||
GtkWidget * filter_searchbar;
|
||||
GtkWidget * cpu_monitor;
|
||||
GtkWidget * mem_monitor;
|
||||
GtkWidget * vpaned;
|
||||
@@ -224,6 +225,16 @@ xtm_show_legend (XtmProcessWindow *window)
|
||||
gtk_widget_set_visible (GTK_WIDGET (gtk_builder_get_object (window->builder, "legend")), show_legend);
|
||||
}
|
||||
|
||||
static void
|
||||
show_filter_toggled_cb (GtkToggleButton *button, gpointer user_data)
|
||||
{
|
||||
XtmProcessWindow *window = user_data;
|
||||
gboolean active;
|
||||
|
||||
active = gtk_toggle_button_get_active (button);
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (gtk_bin_get_child (GTK_BIN (window->filter_searchbar))), active);
|
||||
}
|
||||
|
||||
static void
|
||||
xtm_process_window_init (XtmProcessWindow *window)
|
||||
{
|
||||
@@ -257,6 +268,15 @@ xtm_process_window_init (XtmProcessWindow *window)
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (xwininfo_clicked_cb), window);
|
||||
|
||||
window->filter_searchbar = GTK_WIDGET (gtk_builder_get_object (window->builder, "filter-searchbar"));
|
||||
button = GTK_WIDGET (gtk_builder_get_object (window->builder, "button-show-filter"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
gtk_revealer_get_reveal_child (GTK_REVEALER (gtk_bin_get_child (GTK_BIN (window->filter_searchbar)))));
|
||||
g_signal_connect (G_OBJECT (button), "toggled",
|
||||
G_CALLBACK (show_filter_toggled_cb), window);
|
||||
g_object_bind_property (G_OBJECT (gtk_bin_get_child (GTK_BIN (window->filter_searchbar))), "reveal-child",
|
||||
G_OBJECT (button), "active", G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
{
|
||||
GtkWidget *toolitem;
|
||||
guint refresh_rate;
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">preferences-system-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="process-window">
|
||||
<property name="can_focus">False</property>
|
||||
<child type="titlebar">
|
||||
@@ -42,7 +47,15 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkToggleButton" id="button-show-filter">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -50,22 +63,28 @@
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="filter-entry">
|
||||
<object class="GtkSearchBar" id="filter-searchbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="primary_icon_stock">gtk-find</property>
|
||||
<property name="secondary_icon_stock">gtk-clear</property>
|
||||
<property name="secondary_icon_sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="search_mode_enabled">True</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="filter-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="secondary_icon_name">edit-clear</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -108,7 +127,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -271,7 +290,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user