[nautilus/wip/apoos-maximus/gsoc2020: 42/73] properties-window : Inherit from GtkWindow instead of GtkDialog
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/apoos-maximus/gsoc2020: 42/73] properties-window : Inherit from GtkWindow instead of GtkDialog
- Date: Sun, 2 Aug 2020 12:33:39 +0000 (UTC)
commit ce5c0c54eb542a1b18ea48094bd521166190be4d
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date: Tue May 19 12:17:05 2020 +0530
properties-window : Inherit from GtkWindow instead of GtkDialog
The properties window was subclassing GtkDialog while conceptually,
properrties window should subclass GtkWindow. Moreover GtkDialog is a
composite widget with buttons and action area, and was not properly
utilised by the properties window. Subclassing GtkWindow fits the
use-case much better than subclassing GtkDialog.
src/nautilus-properties-window.c | 35 +++++++----------------------------
src/nautilus-properties-window.h | 2 +-
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);
@@ -5456,28 +5458,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)
{
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]