Project save as dialog: file chooser for project path
This commit is contained in:
parent
6e2e650bb5
commit
03ad8a4cc0
111
gui/gladish.ui
111
gui/gladish.ui
|
@ -1635,23 +1635,12 @@ along with LADI Session Handler; if not, write to the Free Software Foundation,
|
|||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="project_save_as_path_entry">
|
||||
<property name="activates_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="project_save_as_name_entry">
|
||||
<property name="activates_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="tooltip_text" translatable="yes">Default is project directory name</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -1661,6 +1650,40 @@ along with LADI Session Handler; if not, write to the Free Software Foundation,
|
|||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="project_save_as_path_hbox">
|
||||
<property name="spacing">3</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="project_save_as_path_entry">
|
||||
<property name="activates_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="tooltip_text" translatable="yes">Default is ~/ladish-projects</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="project_save_as_path_button">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="image">image_save_project_open_dir</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -1873,4 +1896,68 @@ along with LADI Session Handler; if not, write to the Free Software Foundation,
|
|||
<property name="stock">gtk-preferences</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<object class="GtkFileChooserDialog" id="project_save_as_dir_sel_dialog">
|
||||
<property name="action">select-folder</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="do_overwrite_confirmation">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="project_save_as_dir_sel_dialog_vbox">
|
||||
<property name="spacing">2</property>
|
||||
<property name="visible">True</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="project_save_as_dir_sel_dialog-action_area">
|
||||
<property name="layout_style">end</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="project_save_as_dir_sel_cancel_button">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="project_save_as_dir_sel_ok_button">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">project_save_as_dir_sel_cancel_button</action-widget>
|
||||
<action-widget response="-5">project_save_as_dir_sel_ok_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkImage" id="image_save_project_open_dir">
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -27,19 +27,50 @@
|
|||
#include "save_project_dialog.h"
|
||||
#include "gtk_builder.h"
|
||||
|
||||
void ladish_run_save_project_dialog(ladish_room_proxy_handle room)
|
||||
static GtkEntry * path = NULL;
|
||||
|
||||
static void on_path_button_clicked(void)
|
||||
{
|
||||
GtkWidget * dialog;
|
||||
GtkEntry * path;
|
||||
GtkEntry * name;
|
||||
GtkResponseType response;
|
||||
|
||||
static bool runing;
|
||||
if(runing) return;
|
||||
runing = true;
|
||||
|
||||
dialog = get_gtk_builder_widget("project_save_as_dir_sel_dialog");
|
||||
|
||||
gtk_widget_show(dialog);
|
||||
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_hide(dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_entry_set_text(
|
||||
path,
|
||||
gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dialog)) );
|
||||
}
|
||||
|
||||
runing = false;
|
||||
}
|
||||
|
||||
void ladish_run_save_project_dialog(ladish_room_proxy_handle room)
|
||||
{
|
||||
GtkWidget * dialog = NULL;
|
||||
GtkWidget * path_button = NULL;
|
||||
GtkEntry * name = NULL;
|
||||
GtkResponseType response;
|
||||
|
||||
char * project_dir;
|
||||
char * project_name;
|
||||
|
||||
dialog = get_gtk_builder_widget("project_save_as_dialog");
|
||||
path_button = get_gtk_builder_widget("project_save_as_path_button");
|
||||
path = GTK_ENTRY(get_gtk_builder_widget("project_save_as_path_entry"));
|
||||
name = GTK_ENTRY(get_gtk_builder_widget("project_save_as_name_entry"));
|
||||
|
||||
g_signal_connect( G_OBJECT(path_button), "clicked", G_CALLBACK(on_path_button_clicked), NULL);
|
||||
|
||||
if (!ladish_room_proxy_get_project_properties(room, &project_dir, &project_name))
|
||||
{
|
||||
error_message_box("Get project properties failed, please inspect logs.");
|
||||
|
|
Loading…
Reference in New Issue