summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorApoorv Sachan <apoorv.99.sachan@gmail.com>2020-05-19 12:17:05 +0530
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2020-08-05 13:48:10 +0000
commitc4e9dcd466b0ae7abd3d2536dd5903881aea8c56 (patch)
treee65765949eca19901ff77821dd1c16dd23694c5c
parent9c7afea7192a6c1af59092e5839789145abe9296 (diff)
downloadnautilus-c4e9dcd466b0ae7abd3d2536dd5903881aea8c56.tar.gz
properties-window: Inherit from GtkWindow instead of GtkDialog
The properties window has been subclassing GtkDialog since long ago. GtkDialog features an action area where, historically, the properties window added Help and Close action buttons. These action were dropped when a headerbar was adopted.[1] Moreover, we want to port the Properties window to a GtkBuilder UI definition, which GtkDialog makes harder to achive. Subclassing GtkWindow fits this use case much better. [1] d8a8ab3b66a0a4849e2f9cd17e96f86f85541dee
-rw-r--r--src/nautilus-properties-window.c35
-rw-r--r--src/nautilus-properties-window.h2
2 files changed, 8 insertions, 29 deletions
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 90fd5dc6c..4a4b0f435 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -75,7 +75,7 @@ typedef struct
struct _NautilusPropertiesWindow
{
- GtkDialog parent_instance;
+ GtkWindow parent_instance;
GList *original_files;
GList *target_files;
@@ -214,7 +214,7 @@ static GtkLabel *attach_ellipsizing_value_label (GtkGrid *grid,
static GtkWidget *create_pie_widget (NautilusPropertiesWindow *window);
-G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, GTK_TYPE_WINDOW);
static gboolean
is_multi_file_window (NautilusPropertiesWindow *window)
@@ -5047,9 +5047,9 @@ create_properties_window (StartupData *startup_data)
{
NautilusPropertiesWindow *window;
GList *l;
+ GtkWidget *content_box;
window = NAUTILUS_PROPERTIES_WINDOW (gtk_widget_new (NAUTILUS_TYPE_PROPERTIES_WINDOW,
- "use-header-bar", TRUE,
"type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
"modal", TRUE,
NULL));
@@ -5134,13 +5134,15 @@ create_properties_window (StartupData *startup_data)
}
/* Create the notebook tabs. */
+ content_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
window->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
gtk_notebook_set_show_border (window->notebook, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), 0);
+ gtk_container_add (GTK_CONTAINER (window), content_box);
gtk_widget_show (GTK_WIDGET (window->notebook));
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))),
+ gtk_box_pack_start (GTK_BOX (content_box),
GTK_WIDGET (window->notebook),
TRUE, TRUE, 0);
+ gtk_widget_show (GTK_WIDGET (content_box));
/* Create the pages. */
create_basic_page (window);
@@ -5457,28 +5459,6 @@ nautilus_properties_window_present (GList *original_f
}
static void
-real_response (GtkDialog *dialog,
- int response)
-{
- switch (response)
- {
- case GTK_RESPONSE_NONE:
- case GTK_RESPONSE_CLOSE:
- case GTK_RESPONSE_DELETE_EVENT:
- {
- gtk_widget_destroy (GTK_WIDGET (dialog));
- }
- break;
-
- default:
- {
- g_assert_not_reached ();
- }
- break;
- }
-}
-
-static void
real_destroy (GtkWidget *object)
{
NautilusPropertiesWindow *window;
@@ -5804,7 +5784,6 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *class)
G_OBJECT_CLASS (class)->finalize = real_finalize;
GTK_WIDGET_CLASS (class)->destroy = real_destroy;
- GTK_DIALOG_CLASS (class)->response = real_response;
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
diff --git a/src/nautilus-properties-window.h b/src/nautilus-properties-window.h
index b3f1a8dbb..c1b44a103 100644
--- a/src/nautilus-properties-window.h
+++ b/src/nautilus-properties-window.h
@@ -29,7 +29,7 @@
G_DECLARE_FINAL_TYPE (NautilusPropertiesWindow, nautilus_properties_window,
NAUTILUS, PROPERTIES_WINDOW,
- GtkDialog)
+ GtkWindow)
typedef void (* NautilusPropertiesWindowCallback) (gpointer callback_data);