Issue #25: Add select all button to GUI and connect callback.

This commit is contained in:
Mario Hüttel 2019-08-25 22:11:36 +02:00
parent dc0520e9d3
commit c77c08299f
2 changed files with 43 additions and 10 deletions

View File

@ -62,6 +62,7 @@ struct _GdsRenderGui {
GtkWidget *open_button; GtkWidget *open_button;
GtkWidget *load_layer_button; GtkWidget *load_layer_button;
GtkWidget *save_layer_button; GtkWidget *save_layer_button;
GtkWidget *select_all_button;
GtkTreeStore *cell_tree_store; GtkTreeStore *cell_tree_store;
GtkWidget *cell_search_entry; GtkWidget *cell_search_entry;
LayerSelector *layer_selector; LayerSelector *layer_selector;
@ -540,6 +541,7 @@ static void gds_render_gui_dispose(GObject *gobject)
g_clear_object(&self->load_layer_button); g_clear_object(&self->load_layer_button);
g_clear_object(&self->save_layer_button); g_clear_object(&self->save_layer_button);
g_clear_object(&self->open_button); g_clear_object(&self->open_button);
g_clear_object(&self->select_all_button);
if (self->main_window) { if (self->main_window) {
g_signal_handlers_destroy(self->main_window); g_signal_handlers_destroy(self->main_window);
@ -569,6 +571,13 @@ static void gds_render_gui_class_init(GdsRenderGuiClass *klass)
gobject_class->dispose = gds_render_gui_dispose; gobject_class->dispose = gds_render_gui_dispose;
} }
static void on_select_all_layers_clicked(GtkWidget *button, gpointer user_data)
{
GdsRenderGui *gui;
gui = RENDERER_GUI(user_data);
}
GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui) GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui)
{ {
return gui->main_window; return gui->main_window;
@ -651,6 +660,10 @@ static void gds_render_gui_init(GdsRenderGui *self)
self->render_dialog_settings.tex_pdf_layers = FALSE; self->render_dialog_settings.tex_pdf_layers = FALSE;
self->render_dialog_settings.tex_standalone = FALSE; self->render_dialog_settings.tex_standalone = FALSE;
/* Get select all button and connect callback */
self->select_all_button = GTK_WIDGET(gtk_builder_get_object(main_builder, "button-select-all"));
g_signal_connect(self->select_all_button, "clicked", G_CALLBACK(on_select_all_layers_clicked), self);
g_object_unref(main_builder); g_object_unref(main_builder);
/* Setup default button sensibility data */ /* Setup default button sensibility data */
@ -669,6 +682,7 @@ static void gds_render_gui_init(GdsRenderGui *self)
g_object_ref(self->open_button); g_object_ref(self->open_button);
g_object_ref(self->load_layer_button); g_object_ref(self->load_layer_button);
g_object_ref(self->save_layer_button); g_object_ref(self->save_layer_button);
g_object_ref(self->select_all_button);
} }
GdsRenderGui *gds_render_gui_new() GdsRenderGui *gds_render_gui_new()

View File

@ -17,6 +17,21 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="stock">gtk-save-as</property> <property name="stock">gtk-save-as</property>
</object> </object>
<object class="GtkImage" id="select-all-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-apply</property>
</object>
<object class="GtkImage" id="sort-down-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-ascending</property>
</object>
<object class="GtkImage" id="sort-up-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-descending</property>
</object>
<object class="GtkWindow" id="main-window"> <object class="GtkWindow" id="main-window">
<property name="height_request">250</property> <property name="height_request">250</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -205,6 +220,20 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button-select-all">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">select-all-img</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -270,14 +299,4 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkImage" id="sort-down-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-ascending</property>
</object>
<object class="GtkImage" id="sort-up-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-descending</property>
</object>
</interface> </interface>