Repeat the previous refactoring for gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button))
which is another source of overlong lines in "gui.c". The new function is again used in both the connection dialog and the conversion dialog. Cc: Alban Lecorps <alban.leco...@ubisoft.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1792141 Signed-off-by: Laszlo Ersek <ler...@redhat.com> Reviewed-by: Richard W.M. Jones <rjo...@redhat.com> --- gui.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gui.c b/gui.c index 5c53883ff2ae..3c0f21ca87d0 100644 --- a/gui.c +++ b/gui.c @@ -160,6 +160,16 @@ entry_text_dup (GtkWidget *entry) return strdup (gtk_entry_get_text (GTK_ENTRY (entry))); } +/** + * Trivial helper (shorthand) function for getting the active/inactive state + * of a GTK_TOGGLE_BUTTON. + */ +static bool +tgl_btn_is_act (GtkWidget *toggle_button) +{ + return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button)); +} + /*----------------------------------------------------------------------*/ /* Connection dialog. */ @@ -360,7 +370,7 @@ username_changed_callback (GtkWidget *w, gpointer data) str = gtk_entry_get_text (GTK_ENTRY (username_entry)); username_is_root = str != NULL && STREQ (str, "root"); - sudo_is_set = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sudo_button)); + sudo_is_set = tgl_btn_is_act (sudo_button); /* The sudo button is sensitive if: * - The username is not "root", or @@ -470,7 +480,7 @@ test_connection_clicked (GtkWidget *w, gpointer data) config->auth.identity.url = NULL; config->auth.identity.file_needs_update = 1; - config->auth.sudo = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sudo_button)); + config->auth.sudo = tgl_btn_is_act (sudo_button); if (errors) return; @@ -1713,7 +1723,7 @@ vcpus_or_memory_check_callback (GtkWidget *w, gpointer data) static bool get_phys_topo_from_conv_dlg (void) { - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vcpu_topo)); + return tgl_btn_is_act (vcpu_topo); } static int _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs