Files linked to dialog-search.glade

This commit is contained in:
Robert Fewell 2017-06-20 13:21:08 +01:00
parent fc2a688b15
commit 0d4635a5da
2 changed files with 113 additions and 92 deletions

View File

@ -719,15 +719,20 @@ attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
data = g_object_get_data (G_OBJECT (element), "data");
gtk_table_attach (GTK_TABLE (sw->criteria_table), element, 0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
gtk_grid_attach (GTK_GRID (sw->criteria_table), element, 0, row, 1, 1);
gtk_widget_set_hexpand (element, TRUE);
gtk_widget_set_halign (element, GTK_ALIGN_FILL);
g_object_set (element, "margin", 0, NULL);
remove = gtk_button_new_with_label (_("Remove"));
g_object_set_data (G_OBJECT (remove), "element", element);
g_signal_connect (G_OBJECT (remove), "clicked", G_CALLBACK (remove_element), sw);
gtk_table_attach (GTK_TABLE (sw->criteria_table), remove, 1, 2, row, row + 1,
0, 0, 0, 0);
gtk_grid_attach (GTK_GRID (sw->criteria_table), remove, 1, row, 1, 1);
gtk_widget_set_hexpand (remove, FALSE);
gtk_widget_set_halign (remove, GTK_ALIGN_CENTER);
g_object_set (remove, "margin", 0, NULL);
gtk_widget_show (remove);
data->button = remove; /* Save the button for later */
}
@ -943,10 +948,42 @@ gnc_search_dialog_book_option_changed (gpointer new_val, gpointer user_data)
gtk_widget_grab_focus(focused_widget);
}
struct grid_size
{
/** The grid being sized. */
GtkGrid *grid;
/** The number of columns and rows in the grid. */
gint cols, rows;
};
static void
get_grid_size (GtkWidget *child, gpointer data)
{
struct grid_size *gridsize = data;
gint top, left, height, width;
gtk_container_child_get(GTK_CONTAINER(gridsize->grid), child,
"left-attach", &left,
"top-attach", &top,
"height", &height,
"width", &width,
NULL);
if (left + width >= gridsize->cols)
gridsize->cols = left + width;
if (top + height >= gridsize->rows)
gridsize->rows = top + height;
}
static void
gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
{
GNCSearchCoreType *new_sct;
struct grid_size gridsize;
gridsize.cols = 0;
gridsize.rows = 0;
/* First, make sure that the last criterion is ok */
if (sw->crit_list)
@ -970,15 +1007,15 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
{
struct _crit_data *data;
GtkWidget *w;
int rows;
w = get_element_widget (sw, new_sct);
data = g_object_get_data (G_OBJECT (w), "data");
sw->crit_list = g_list_append (sw->crit_list, data);
gtk_table_get_size (GTK_TABLE (sw->criteria_table), &rows, NULL);
gtk_table_resize (GTK_TABLE (sw->criteria_table), rows + 1, 2);
attach_element (w, sw, rows);
gridsize.grid = GTK_GRID (sw->criteria_table);
gtk_container_foreach(GTK_CONTAINER(sw->criteria_table), get_grid_size, &gridsize);
attach_element (w, sw, gridsize.rows);
gnc_search_core_type_grab_focus (new_sct);
gnc_search_core_type_editable_enters (new_sct);
@ -1113,10 +1150,10 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
gboolean active;
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-search.glade", "Search Dialog");
gnc_builder_add_from_file (builder, "dialog-search.glade", "search_dialog");
/* Grab the dialog, save the dialog info */
sw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Search Dialog"));
sw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "search_dialog"));
gtk_window_set_title(GTK_WINDOW(sw->dialog), title);
g_object_set_data (G_OBJECT (sw->dialog), "dialog-info", sw);

View File

@ -1,67 +1,29 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="Search Dialog">
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="search_dialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox3">
<object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area3">
<object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="new_item_button">
<object class="GtkButton" id="help_button">
<property name="label" translatable="yes">_Help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox74">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-new</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label848">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_New item...</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -70,14 +32,13 @@
</packing>
</child>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<object class="GtkButton" id="new_item_button">
<property name="label" translatable="yes">_New item...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -86,14 +47,13 @@
</packing>
</child>
<child>
<object class="GtkButton" id="help_button">
<property name="label">gtk-help</property>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -103,13 +63,12 @@
</child>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -119,14 +78,13 @@
</child>
<child>
<object class="GtkButton" id="find_button">
<property name="label">gtk-find</property>
<property name="label" translatable="yes">_Find</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -143,15 +101,16 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox89">
<object class="GtkBox" id="vbox89">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkHBox" id="search_hbox">
<object class="GtkBox" id="search_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox72">
<object class="GtkBox" id="hbox72">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@ -201,17 +160,18 @@
<property name="border_width">6</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkVBox" id="vbox88">
<object class="GtkBox" id="vbox88">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkHBox" id="hbox73">
<object class="GtkBox" id="hbox73">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<child>
<object class="GtkHBox" id="add_button_box">
<object class="GtkBox" id="add_button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@ -225,7 +185,7 @@
</packing>
</child>
<child>
<object class="GtkHBox" id="type_menu_box">
<object class="GtkBox" id="type_menu_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@ -243,7 +203,6 @@
<object class="GtkLabel" id="label846">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Search for items where</property>
<property name="justify">right</property>
</object>
@ -276,13 +235,37 @@
</packing>
</child>
<child>
<object class="GtkTable" id="criteria_table">
<object class="GtkGrid" id="criteria_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -307,12 +290,12 @@
</packing>
</child>
<child>
<object class="GtkHBox" id="result_hbox">
<object class="GtkBox" id="result_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<child>
<object class="GtkHBox" id="hboxXXX">
<object class="GtkBox" id="hboxXXX">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@ -327,17 +310,18 @@
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkVBox" id="vbox24">
<object class="GtkBox" id="vbox24">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="new_search_radiobutton">
<property name="label" translatable="yes">New search</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
@ -354,7 +338,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">new_search_radiobutton</property>
@ -371,7 +355,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">new_search_radiobutton</property>
@ -388,7 +372,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">new_search_radiobutton</property>
@ -400,7 +384,7 @@
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator1">
<object class="GtkSeparator" id="hseparator1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@ -419,7 +403,7 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Choose whether to search all your data or only that marked as &amp;quot;active&amp;quot;.</property>
<property name="tooltip_text" translatable="yes">Choose whether to search all your data or only that marked as "active".</property>
<property name="use_action_appearance">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
@ -472,9 +456,9 @@
</object>
</child>
<action-widgets>
<action-widget response="-11">help_button</action-widget>
<action-widget response="0">new_item_button</action-widget>
<action-widget response="-7">close_button</action-widget>
<action-widget response="-11">help_button</action-widget>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="0">find_button</action-widget>
</action-widgets>