Skip to content

glade/oscplot: Fix runtime GTK3 warning when creating plot #524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions glade/oscplot.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adj_add_to_sample">
Expand Down Expand Up @@ -1608,19 +1608,16 @@
</object>
</child>
</object>
<object class="GtkFileChooserDialog" id="saveas_dialog">
<object class="GtkDialog" id="saveas_dialog">
<property name="can-focus">False</property>
<property name="border-width">5</property>
<property name="title" translatable="yes">ADI IIO oscilloscope - Save As</property>
<property name="role">GtkFileChooserDialog</property>
<property name="modal">True</property>
<property name="icon-name">adi-osc</property>
<property name="type-hint">dialog</property>
<property name="action">save</property>
<property name="do-overwrite-confirmation">True</property>
<child internal-child="vbox">
<object class="GtkBox" id="filechooserdialog-vbox3">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="filechooserdialog-action_area3">
Expand Down Expand Up @@ -1653,7 +1650,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">1</property>
</packing>
</child>
</object>
Expand All @@ -1663,6 +1660,20 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserWidget" id="saveas_filechooser_widget">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="action">select-folder</property>
<property name="do-overwrite-confirmation">True</property>
<property name="search-mode">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox_ch_sel_label">
<property name="visible">True</property>
Expand Down
14 changes: 8 additions & 6 deletions oscplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ struct _OscPlotPrivate
GtkWidget *phase_label;
GtkWidget *saveas_button;
GtkWidget *saveas_dialog;
GtkFileChooser *saveas_filechooser;
GtkWidget *saveas_type_dialog;
GtkWidget *title_edit_dialog;
GtkWidget *fullscreen_button;
Expand Down Expand Up @@ -4550,14 +4551,14 @@ static void saveas_dialog_show(GtkWidget *w, OscPlot *plot)
{
OscPlotPrivate *priv = plot->priv;

gtk_file_chooser_set_action(GTK_FILE_CHOOSER (priv->saveas_dialog), GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(priv->saveas_dialog), TRUE);
gtk_file_chooser_set_action(priv->saveas_filechooser, GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_file_chooser_set_do_overwrite_confirmation(priv->saveas_filechooser, TRUE);

if (!priv->saveas_filename) {
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (priv->saveas_dialog), getenv("HOME"));
gtk_file_chooser_set_current_folder(priv->saveas_filechooser, getenv("HOME"));
} else {
if (!gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (priv->saveas_dialog), priv->saveas_filename))
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (priv->saveas_dialog), getenv("HOME"));
if (!gtk_file_chooser_set_filename(priv->saveas_filechooser, priv->saveas_filename))
gtk_file_chooser_set_current_folder(priv->saveas_filechooser, getenv("HOME"));
g_free(priv->saveas_filename);
priv->saveas_filename = NULL;
}
Expand Down Expand Up @@ -4794,7 +4795,7 @@ void cb_saveas_response(GtkDialog *dialog, gint response_id, OscPlot *plot)
/* Save as Dialog */
OscPlotPrivate *priv = plot->priv;

priv->saveas_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->saveas_dialog));
priv->saveas_filename = gtk_file_chooser_get_filename(priv->saveas_filechooser);

if (response_id == GTK_RESPONSE_ACCEPT) {
gint type = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cmb_saveas_type));
Expand Down Expand Up @@ -6985,6 +6986,7 @@ static void create_plot(OscPlot *plot)
priv->phase_label = GTK_WIDGET(gtk_builder_get_object(builder, "phase_info"));
priv->saveas_button = GTK_WIDGET(gtk_builder_get_object(builder, "save_as"));
priv->saveas_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "saveas_dialog"));
priv->saveas_filechooser = GTK_FILE_CHOOSER(gtk_builder_get_object(builder, "saveas_filechooser_widget"));
priv->title_edit_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "dialog_plot_title_edit"));
priv->fullscreen_button = GTK_WIDGET(gtk_builder_get_object(builder, "fullscreen"));
priv->menu_fullscreen = GTK_WIDGET(gtk_builder_get_object(builder, "menuitem_fullscreen"));
Expand Down
Loading