[gthumb] edit metadata dialogs: use the header bar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] edit metadata dialogs: use the header bar
- Date: Wed, 29 Jan 2020 07:45:52 +0000 (UTC)
commit edbf446d215da8dc25aee4bb7fc72979690ef508
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Jan 28 16:24:10 2020 +0100
edit metadata dialogs: use the header bar
extensions/edit_metadata/dlg-edit-metadata.c | 16 ++++++++++---
extensions/edit_metadata/gth-edit-comment-dialog.c | 18 +++++++++++----
.../edit_metadata/gth-edit-metadata-dialog.c | 7 ++++++
.../edit_metadata/gth-edit-metadata-dialog.h | 10 +++++----
extensions/edit_metadata/gth-edit-tags-dialog.c | 26 +++++++++++++++++-----
5 files changed, 61 insertions(+), 16 deletions(-)
---
diff --git a/extensions/edit_metadata/dlg-edit-metadata.c b/extensions/edit_metadata/dlg-edit-metadata.c
index 245bcb74..422b8503 100644
--- a/extensions/edit_metadata/dlg-edit-metadata.c
+++ b/extensions/edit_metadata/dlg-edit-metadata.c
@@ -154,7 +154,7 @@ edit_metadata_dialog__response_cb (GtkDialog *dialog,
GList *scan;
GthTask *task;
- if ((response != GTK_RESPONSE_OK) && (response != GTK_RESPONSE_APPLY)) {
+ if (response != GTK_RESPONSE_OK) {
cancel_file_list_loading (data);
close_dialog (data);
return;
@@ -163,7 +163,7 @@ edit_metadata_dialog__response_cb (GtkDialog *dialog,
if (data->file_list == NULL)
return;
- data->close_dialog = (response == GTK_RESPONSE_OK);
+ data->close_dialog = ! gth_edit_metadata_dialog_get_keep_open (GTH_EDIT_METADATA_DIALOG
(data->dialog));
/* get the parents list */
@@ -310,10 +310,20 @@ dlg_edit_metadata (GthBrowser *browser,
data = g_new0 (DialogData, 1);
data->ref = 1;
data->browser = browser;
- data->dialog = g_object_new (dialog_type, 0);
+ data->dialog = g_object_new (dialog_type,
+ "transient-for", GTK_WINDOW (browser),
+ "modal", FALSE,
+ "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+ NULL);
data->dialog_name = g_strdup (dialog_name);
data->never_shown = TRUE;
+ gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
+ _GTK_LABEL_CLOSE, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_SAVE, GTK_RESPONSE_OK,
+ NULL);
+
+ _gtk_dialog_add_class_to_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK,
GTK_STYLE_CLASS_SUGGESTED_ACTION);
gth_browser_set_dialog (browser, data->dialog_name, data->dialog);
g_signal_connect (G_OBJECT (data->dialog),
diff --git a/extensions/edit_metadata/gth-edit-comment-dialog.c
b/extensions/edit_metadata/gth-edit-comment-dialog.c
index 2f31ca13..0d2f76f2 100644
--- a/extensions/edit_metadata/gth-edit-comment-dialog.c
+++ b/extensions/edit_metadata/gth-edit-comment-dialog.c
@@ -28,6 +28,7 @@
struct _GthEditCommentDialogPrivate {
GtkWidget *notebook;
GtkWidget *save_changed_checkbutton;
+ GtkWidget *keep_open_check_button;
};
@@ -112,11 +113,20 @@ gth_edit_comment_dialog_update_info (GthEditMetadataDialog *base,
}
+static gboolean
+gth_edit_comment_dialog_get_keep_open (GthEditMetadataDialog *base)
+{
+ GthEditCommentDialog *self = GTH_EDIT_COMMENT_DIALOG (base);
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->keep_open_check_button));
+}
+
+
static void
gth_edit_comment_dialog_gth_edit_metadata_dialog_interface_init (GthEditMetadataDialogInterface *iface)
{
iface->set_file_list = gth_edit_comment_dialog_set_file_list;
iface->update_info = gth_edit_comment_dialog_update_info;
+ iface->get_keep_open = gth_edit_comment_dialog_get_keep_open;
}
@@ -140,10 +150,6 @@ gth_edit_comment_dialog_init (GthEditCommentDialog *self)
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
- gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_SAVE, GTK_RESPONSE_APPLY);
- gtk_dialog_add_button (GTK_DIALOG (self), _("Sa_ve and Close"), GTK_RESPONSE_OK);
-
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_widget_show (vbox);
@@ -157,6 +163,10 @@ gth_edit_comment_dialog_init (GthEditCommentDialog *self)
gtk_widget_show (self->priv->save_changed_checkbutton);
gtk_box_pack_start (GTK_BOX (vbox), self->priv->save_changed_checkbutton, FALSE, FALSE, 0);
+ self->priv->keep_open_check_button = gtk_check_button_new_with_mnemonic (_("_Keep the dialog open"));
+ gtk_widget_show (self->priv->keep_open_check_button);
+ gtk_box_pack_start (GTK_BOX (vbox), self->priv->keep_open_check_button, FALSE, FALSE, 0);
+
pages = gth_main_get_type_set ("edit-comment-dialog-page");
if (pages == NULL)
return;
diff --git a/extensions/edit_metadata/gth-edit-metadata-dialog.c
b/extensions/edit_metadata/gth-edit-metadata-dialog.c
index 6621ec58..c5673639 100644
--- a/extensions/edit_metadata/gth-edit-metadata-dialog.c
+++ b/extensions/edit_metadata/gth-edit-metadata-dialog.c
@@ -47,3 +47,10 @@ gth_edit_metadata_dialog_update_info (GthEditMetadataDialog *self,
{
GTH_EDIT_METADATA_DIALOG_GET_INTERFACE (self)->update_info (self, file_list);
}
+
+
+gboolean
+gth_edit_metadata_dialog_get_keep_open (GthEditMetadataDialog *self)
+{
+ return GTH_EDIT_METADATA_DIALOG_GET_INTERFACE (self)->get_keep_open (self);
+}
diff --git a/extensions/edit_metadata/gth-edit-metadata-dialog.h
b/extensions/edit_metadata/gth-edit-metadata-dialog.h
index b7ed3c6f..bef2464c 100644
--- a/extensions/edit_metadata/gth-edit-metadata-dialog.h
+++ b/extensions/edit_metadata/gth-edit-metadata-dialog.h
@@ -37,10 +37,11 @@ typedef struct _GthEditMetadataDialogInterface GthEditMetadataDialogInterface;
struct _GthEditMetadataDialogInterface {
GTypeInterface parent_iface;
- void (*set_file_list) (GthEditMetadataDialog *dialog,
- GList *file_list /* GthFileData list */);
- void (*update_info) (GthEditMetadataDialog *dialog,
- GList *file_list /* GthFileData list */);
+ void (*set_file_list) (GthEditMetadataDialog *dialog,
+ GList *file_list /* GthFileData list */);
+ void (*update_info) (GthEditMetadataDialog *dialog,
+ GList *file_list /* GthFileData list */);
+ gboolean (*get_keep_open) (GthEditMetadataDialog *dialog);
};
/* GthEditMetadataDialog */
@@ -50,6 +51,7 @@ void gth_edit_metadata_dialog_set_file_list (GthEditMetadataDialog *d
GList *file_list /* GthFileData list
*/);
void gth_edit_metadata_dialog_update_info (GthEditMetadataDialog *dialog,
GList *file_list /* GthFileData list
*/);
+gboolean gth_edit_metadata_dialog_get_keep_open (GthEditMetadataDialog *dialog);
G_END_DECLS
diff --git a/extensions/edit_metadata/gth-edit-tags-dialog.c b/extensions/edit_metadata/gth-edit-tags-dialog.c
index c4bdf73d..a775d0e1 100644
--- a/extensions/edit_metadata/gth-edit-tags-dialog.c
+++ b/extensions/edit_metadata/gth-edit-tags-dialog.c
@@ -32,6 +32,7 @@
struct _GthEditTagsDialogPrivate {
GtkBuilder *builder;
GtkWidget *tags_entry;
+ GtkWidget *keep_open_check_button;
};
@@ -161,11 +162,20 @@ gth_edit_tags_dialog_update_info (GthEditMetadataDialog *base,
}
+static gboolean
+gth_edit_tags_dialog_get_keep_open (GthEditMetadataDialog *base)
+{
+ GthEditTagsDialog *self = GTH_EDIT_TAGS_DIALOG (base);
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->keep_open_check_button));
+}
+
+
static void
gth_edit_tags_dialog_gth_edit_metadata_dialog_interface_init (GthEditMetadataDialogInterface *iface)
{
iface->set_file_list = gth_edit_tags_dialog_set_file_list;
iface->update_info = gth_edit_tags_dialog_update_info;
+ iface->get_keep_open = gth_edit_tags_dialog_get_keep_open;
}
@@ -182,6 +192,8 @@ gth_edit_tags_dialog_class_init (GthEditTagsDialogClass *klass)
static void
gth_edit_tags_dialog_init (GthEditTagsDialog *self)
{
+ GtkWidget *box;
+
self->priv = gth_edit_tags_dialog_get_instance_private (self);
self->priv->builder = _gtk_builder_new_from_file ("tag-chooser.ui", "edit_metadata");
@@ -191,15 +203,19 @@ gth_edit_tags_dialog_init (GthEditTagsDialog *self)
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
- gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_SAVE, GTK_RESPONSE_APPLY);
- gtk_dialog_add_button (GTK_DIALOG (self), _("Sa_ve and Close"), GTK_RESPONSE_OK);
-
self->priv->tags_entry = gth_tags_entry_new (GTH_TAGS_ENTRY_MODE_INLINE);
gth_tags_entry_set_list_visible (GTH_TAGS_ENTRY (self->priv->tags_entry), TRUE);
+ gtk_widget_set_size_request (self->priv->tags_entry, 400, -1);
gtk_widget_show (self->priv->tags_entry);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("tag_entry_box")), self->priv->tags_entry, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (GET_WIDGET ("content")), 5);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET
("content"), TRUE, TRUE, 0);
+
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (box), GET_WIDGET ("content"), TRUE, TRUE, 0);
+ self->priv->keep_open_check_button = gtk_check_button_new_with_mnemonic (_("_Keep the dialog open"));
+ gtk_widget_show (self->priv->keep_open_check_button);
+ gtk_box_pack_start (GTK_BOX (box), self->priv->keep_open_check_button, FALSE, FALSE, 0);
+ gtk_widget_show (box);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), box, TRUE, TRUE, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]