From e92425f179ee806eb27c10b47709b7ea2833a90b Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 4 Feb 2013 12:09:24 +0000 Subject: Clean up the SettingsDialog class a little --- tikzit/src/gtk/SettingsDialog.h | 8 +++----- tikzit/src/gtk/SettingsDialog.m | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tikzit/src/gtk/SettingsDialog.h b/tikzit/src/gtk/SettingsDialog.h index d937774..22d0d17 100644 --- a/tikzit/src/gtk/SettingsDialog.h +++ b/tikzit/src/gtk/SettingsDialog.h @@ -30,17 +30,15 @@ GtkEntry *pdflatexPathEntry; } -@property (retain) Configuration* configuration; +@property (retain) Configuration *configuration; +@property (assign) GtkWindow *parentWindow; +@property (assign,getter=isVisible) BOOL visible; - (id) initWithConfiguration:(Configuration*)c; -- (void) setParentWindow:(GtkWindow*)parent; - - (void) present; - (void) show; - (void) hide; -- (BOOL) isVisible; -- (void) setVisible:(BOOL)visible; @end diff --git a/tikzit/src/gtk/SettingsDialog.m b/tikzit/src/gtk/SettingsDialog.m index 11a0d0d..a70a412 100644 --- a/tikzit/src/gtk/SettingsDialog.m +++ b/tikzit/src/gtk/SettingsDialog.m @@ -50,13 +50,24 @@ static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) if (self) { configuration = [c retain]; - parentWindow = NULL; - window = NULL; } return self; } +- (void) dealloc { + if (window) { + gtk_widget_destroy (GTK_WIDGET (window)); + } + if (parentWindow) { + g_object_unref (parentWindow); + } + + [configuration release]; + + [super dealloc]; +} + - (Configuration*) configuration { return configuration; } @@ -68,6 +79,10 @@ static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) [self revert]; } +- (GtkWindow*) parentWindow { + return parentWindow; +} + - (void) setParentWindow:(GtkWindow*)parent { GtkWindow *oldParent = parentWindow; @@ -118,21 +133,6 @@ static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) } } -- (void) dealloc { - [configuration release]; - configuration = nil; - - if (window) { - gtk_widget_destroy (GTK_WIDGET (window)); - window = NULL; - } - if (parentWindow) { - g_object_ref (parentWindow); - } - - [super dealloc]; -} - @end // }}} -- cgit v1.2.3