diff options
author | rbuj <[email protected]> | 2020-04-02 15:59:02 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-06-05 14:38:12 +0200 |
commit | c60e1cfb6c4296bcc9c4f05da3484f22e7f15770 (patch) | |
tree | 7eb0b2d21b9c589fa29fa6b30d6e9c41d7340352 /src/dlg-ask-password.c | |
parent | 1cbdb4442b82a58576f16b664e647755ff964037 (diff) | |
download | engrampa-c60e1cfb6c4296bcc9c4f05da3484f22e7f15770.tar.bz2 engrampa-c60e1cfb6c4296bcc9c4f05da3484f22e7f15770.tar.xz |
gtk-utils: Remove _gtk_builder_get_widget
Diffstat (limited to 'src/dlg-ask-password.c')
-rw-r--r-- | src/dlg-ask-password.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c index 292e465..9453376 100644 --- a/src/dlg-ask-password.c +++ b/src/dlg-ask-password.c @@ -29,6 +29,8 @@ #include "glib-utils.h" #include "gtk-utils.h" +#define GET_LABEL(x) (GTK_LABEL (gtk_builder_get_object (builder, (x)))) +#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x)))) typedef enum { FR_PASSWORD_TYPE_MAIN, @@ -36,7 +38,6 @@ typedef enum { } FrPasswordType; typedef struct { - GtkBuilder *builder; FrWindow *window; FrPasswordType pwd_type; GtkWidget *dialog; @@ -49,7 +50,6 @@ static void destroy_cb (GtkWidget *widget, DialogData *data) { - g_object_unref (data->builder); g_free (data); } @@ -91,22 +91,20 @@ static void dlg_ask_password__common (FrWindow *window, FrPasswordType pwd_type) { + GtkBuilder *builder; DialogData *data; - GtkWidget *label; char *text; char *name = NULL; data = g_new0 (DialogData, 1); - data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-password.ui"); + builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-password.ui"); data->window = window; data->pwd_type = pwd_type; /* Get the widgets. */ - data->dialog = _gtk_builder_get_widget (data->builder, "password_dialog"); - data->pw_password_entry = _gtk_builder_get_widget (data->builder, "pw_password_entry"); - - label = _gtk_builder_get_widget (data->builder, "pw_password_label"); + data->dialog = GET_WIDGET ("password_dialog"); + data->pw_password_entry = GET_WIDGET ("pw_password_entry"); /* Set widgets data. */ @@ -116,7 +114,7 @@ dlg_ask_password__common (FrWindow *window, name = g_uri_display_basename (fr_window_get_paste_archive_uri (window)); g_assert (name != NULL); text = g_strdup_printf (_("Enter the password for the archive '%s'."), name); - gtk_label_set_label (GTK_LABEL (label), text); + gtk_label_set_label (GET_LABEL ("pw_password_label"), text); g_free (text); if (fr_window_get_password (window) != NULL) @@ -135,6 +133,8 @@ dlg_ask_password__common (FrWindow *window, G_CALLBACK (ask_password__response_cb), data); + g_object_unref (builder); + /* Run dialog. */ gtk_widget_grab_focus (data->pw_password_entry); |