Commit cb706825 authored by APOORV SACHAN's avatar APOORV SACHAN 🦋

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.
parent 6cb1715c
......@@ -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,
......
......@@ -29,7 +29,7 @@
G_DECLARE_FINAL_TYPE (NautilusPropertiesWindow, nautilus_properties_window,
NAUTILUS, PROPERTIES_WINDOW,
GtkDialog)
GtkWindow)
typedef void (* NautilusPropertiesWindowCallback) (gpointer callback_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment