From 924aad8f38e277547b104977dd48ef2be7c702f8 Mon Sep 17 00:00:00 2001 From: randomguy3 Date: Tue, 10 Jan 2012 18:27:19 +0000 Subject: GTK: Allow the path to pdflatex to be configured git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@377 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64 --- tikzit/NEWS | 1 + tikzit/src/Makefile.am | 3 +- tikzit/src/linux/MainWindow.h | 8 +- tikzit/src/linux/MainWindow.m | 19 ++- tikzit/src/linux/Menu.m | 15 ++ tikzit/src/linux/PreambleEditor.h | 2 +- tikzit/src/linux/PreambleEditor.m | 35 +++-- tikzit/src/linux/PreviewRenderer.h | 23 ++-- tikzit/src/linux/PreviewRenderer.m | 67 ++++++--- tikzit/src/linux/PreviewWindow.h | 3 +- tikzit/src/linux/PreviewWindow.m | 4 +- tikzit/src/linux/SettingsDialog.h | 46 +++++++ tikzit/src/linux/SettingsDialog.m | 273 +++++++++++++++++++++++++++++++++++++ 13 files changed, 446 insertions(+), 53 deletions(-) create mode 100644 tikzit/src/linux/SettingsDialog.h create mode 100644 tikzit/src/linux/SettingsDialog.m diff --git a/tikzit/NEWS b/tikzit/NEWS index c348ea2..06fe57d 100644 --- a/tikzit/NEWS +++ b/tikzit/NEWS @@ -4,6 +4,7 @@ tikzit 0.8 (2012-01-??): * Add support for scale to node styles * Add support for editing edge styles * Add support for multiple custom preambles + * The path to pdflatex is now configurable * Make everything look a bit better tikzit 0.7 (2011-12-06): diff --git a/tikzit/src/Makefile.am b/tikzit/src/Makefile.am index cbd9cfc..3c5f6b0 100644 --- a/tikzit/src/Makefile.am +++ b/tikzit/src/Makefile.am @@ -95,7 +95,8 @@ tikzit_SOURCES += \ linux/PreambleEditor.m \ linux/Preambles+Storage.m \ linux/PreviewRenderer.m \ - linux/PreviewWindow.m + linux/PreviewWindow.m \ + linux/SettingsDialog.m endif if WINDOWS diff --git a/tikzit/src/linux/MainWindow.h b/tikzit/src/linux/MainWindow.h index 09e531e..27ce46d 100644 --- a/tikzit/src/linux/MainWindow.h +++ b/tikzit/src/linux/MainWindow.h @@ -27,6 +27,7 @@ @class Preambles; @class PreambleEditor; @class PreviewWindow; +@class SettingsDialog; @class StyleManager; @class StylesPane; @class TikzDocument; @@ -36,7 +37,7 @@ */ @interface MainWindow: NSObject { // the main application configuration - Configuration *configFile; + Configuration *configFile; // maintains the known (user-defined) styles StyleManager *styleManager; // maintains the preambles used for previews @@ -60,6 +61,7 @@ PropertyPane *propertyPane; PreambleEditor *preambleWindow; PreviewWindow *previewWindow; + SettingsDialog *settingsDialog; WidgetSurface *surface; @@ -130,6 +132,10 @@ * Show or update the preview window. */ - (void) showPreview; +/** + * Show the settings dialog. + */ +- (void) showSettingsDialog; /** * The graph input handler diff --git a/tikzit/src/linux/MainWindow.m b/tikzit/src/linux/MainWindow.m index 1feb922..c391ea5 100644 --- a/tikzit/src/linux/MainWindow.m +++ b/tikzit/src/linux/MainWindow.m @@ -34,8 +34,11 @@ #endif #import "PropertyPane.h" #import "RecentManager.h" -#import "StyleManager.h" +#ifdef HAVE_POPPLER +#import "SettingsDialog.h" +#endif #import "Shape.h" +#import "StyleManager.h" #import "StyleManager+Storage.h" #import "StylesPane.h" #import "SupportDir.h" @@ -125,6 +128,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc preambles = nil; preambleWindow = nil; previewWindow = nil; + settingsDialog = nil; suppressTikzUpdates = NO; hasParseError = NO; @@ -156,6 +160,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc [propertyPane release]; [preambleWindow release]; [previewWindow release]; + [settingsDialog release]; [surface release]; [lastFolder release]; [document release]; @@ -352,7 +357,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) showPreview { #ifdef HAVE_POPPLER if (previewWindow == nil) { - previewWindow = [[PreviewWindow alloc] initWithPreambles:preambles]; + previewWindow = [[PreviewWindow alloc] initWithPreambles:preambles config:configFile]; [previewWindow setParentWindow:mainWindow]; [previewWindow setDocument:document]; } @@ -360,6 +365,16 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc #endif } +- (void) showSettingsDialog { +#ifdef HAVE_POPPLER + if (settingsDialog == nil) { + settingsDialog = [[SettingsDialog alloc] initWithConfiguration:configFile]; + [settingsDialog setParentWindow:mainWindow]; + } + [settingsDialog show]; +#endif +} + - (GraphInputHandler*) graphInputHandler { return inputHandler; } diff --git a/tikzit/src/linux/Menu.m b/tikzit/src/linux/Menu.m index 660f9e2..d326d8b 100644 --- a/tikzit/src/linux/Menu.m +++ b/tikzit/src/linux/Menu.m @@ -225,6 +225,12 @@ static void flip_vert_cb (GtkAction *action, MainWindow *window) { } #ifdef HAVE_POPPLER +static void show_preferences_cb (GtkAction *action, MainWindow *window) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [window showSettingsDialog]; + [pool drain]; +} + static void show_preamble_cb (GtkAction *action, MainWindow *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [window editPreambles]; @@ -345,6 +351,10 @@ static const gchar ui_info[] = " " " " " " +#ifdef HAVE_POPPLER +" " +" " +#endif " " " " " " @@ -436,6 +446,11 @@ static GtkActionEntry static_entries[] = { /* EditMenu */ { "Tool", NULL, N_("_Tool") }, +#ifdef HAVE_POPPLER + { "ShowPreferences", GTK_STOCK_PREFERENCES, NULL, NULL, + N_("Edit the TikZiT preferences"), G_CALLBACK (show_preferences_cb) }, +#endif + /* ViewMenu */ { "ToolbarStyle", NULL, N_("_Toolbar style") }, diff --git a/tikzit/src/linux/PreambleEditor.h b/tikzit/src/linux/PreambleEditor.h index 6849d74..b081e00 100644 --- a/tikzit/src/linux/PreambleEditor.h +++ b/tikzit/src/linux/PreambleEditor.h @@ -47,4 +47,4 @@ @end -// vim:ft=objc:ts=8:et:sts=4:sw=4 +// vim:ft=objc:ts=8:et:sts=4:sw=4:foldmethod=marker diff --git a/tikzit/src/linux/PreambleEditor.m b/tikzit/src/linux/PreambleEditor.m index 82880c7..7b299c3 100644 --- a/tikzit/src/linux/PreambleEditor.m +++ b/tikzit/src/linux/PreambleEditor.m @@ -101,10 +101,17 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, } - (void) setParentWindow:(GtkWindow*)parent { - parentWindow = parent; - if (window) { - gtk_window_set_transient_for (window, parentWindow); - } + GtkWindow *oldParent = parentWindow; + + if (parent) + g_object_ref (parentWindow); + parentWindow = parent; + if (oldParent) + g_object_unref (oldParent); + + if (window) { + gtk_window_set_transient_for (window, parentWindow); + } } - (void) show { @@ -141,8 +148,13 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, - (void) dealloc { [preambles release]; preambles = nil; - gtk_widget_destroy (GTK_WIDGET (window)); - window = NULL; + if (window) { + gtk_widget_destroy (GTK_WIDGET (window)); + window = NULL; + } + if (parentWindow) { + g_object_ref (parentWindow); + } [super dealloc]; } @@ -220,9 +232,8 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, G_CALLBACK (window_focus_out_event_cb), self); - GtkWidget *mainBox = gtk_vbox_new (FALSE, 0); + GtkWidget *mainBox = gtk_vbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (mainBox), 12); - gtk_box_set_spacing (GTK_BOX (mainBox), 18); gtk_container_add (GTK_CONTAINER (window), mainBox); GtkPaned *paned = GTK_PANED (gtk_hpaned_new ()); @@ -234,12 +245,10 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, GtkWidget *listFrame = gtk_frame_new (NULL); gtk_container_add (GTK_CONTAINER (listFrame), listWidget); - GtkBox *listBox = GTK_BOX (gtk_vbox_new (FALSE, 0)); - gtk_box_set_spacing (listBox, 6); + GtkBox *listBox = GTK_BOX (gtk_vbox_new (FALSE, 6)); gtk_box_pack_start (listBox, listFrame, TRUE, TRUE, 0); - GtkContainer *listButtonBox = GTK_CONTAINER (gtk_hbox_new (FALSE, 0)); - gtk_box_set_spacing (GTK_BOX (listButtonBox), 6); + GtkContainer *listButtonBox = GTK_CONTAINER (gtk_hbox_new (FALSE, 6)); gtk_box_pack_start (listBox, GTK_WIDGET (listButtonBox), FALSE, TRUE, 0); GtkWidget *addButton = gtk_button_new_from_stock (GTK_STOCK_ADD); g_signal_connect (addButton, @@ -544,4 +553,4 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, // }}} -// vim:ft=objc:ts=4:noet:sts=4:sw=4:foldmethod=marker +// vim:ft=objc:ts=4:et:sts=4:sw=4:foldmethod=marker diff --git a/tikzit/src/linux/PreviewRenderer.h b/tikzit/src/linux/PreviewRenderer.h index da617b3..d691722 100644 --- a/tikzit/src/linux/PreviewRenderer.h +++ b/tikzit/src/linux/PreviewRenderer.h @@ -17,31 +17,32 @@ #import "TZFoundation.h" #import -#import "Preambles.h" + #import "Surface.h" -#import "TikzDocument.h" + +@class Configuration; +@class Preambles; +@class TikzDocument; @interface PreviewRenderer: NSObject { + Configuration *config; Preambles *preambles; TikzDocument *document; PopplerDocument *pdfDocument; PopplerPage *pdfPage; } -- (id) initWithPreambles:(Preambles*)p; +@property (readonly) Preambles *preambles; +@property (retain) TikzDocument *document; +@property (readonly) double height; +@property (readonly) double width; + +- (id) initWithPreambles:(Preambles*)p config:(Configuration*)c; - (BOOL) updateWithError:(NSError**)error; - (BOOL) update; - (BOOL) isValid; -- (Preambles*) preambles; - -- (TikzDocument*) document; -- (void) setDocument:(TikzDocument*)doc; - -- (double) width; -- (double) height; - @end // vim:ft=objc:ts=8:et:sts=4:sw=4 diff --git a/tikzit/src/linux/PreviewRenderer.m b/tikzit/src/linux/PreviewRenderer.m index 6f80982..98c328e 100644 --- a/tikzit/src/linux/PreviewRenderer.m +++ b/tikzit/src/linux/PreviewRenderer.m @@ -16,21 +16,28 @@ */ #import "PreviewRenderer.h" + #import "CairoRenderContext.h" +#import "Configuration.h" +#import "Preambles.h" +#import "TikzDocument.h" @implementation PreviewRenderer +@synthesize preambles,document; + - (id) init { [self release]; self = nil; return nil; } -- (id) initWithPreambles:(Preambles*)p { +- (id) initWithPreambles:(Preambles*)p config:(Configuration*)c { self = [super init]; if (self) { document = nil; + config = [c retain]; preambles = [p retain]; pdfDocument = NULL; pdfPage = NULL; @@ -39,6 +46,23 @@ return self; } +- (void) dealloc { + [document release]; + [config release]; + [preambles release]; + + if (pdfDocument) { + g_object_unref (pdfDocument); + pdfDocument = NULL; + } + if (pdfPage) { + g_object_unref (pdfPage); + pdfPage = NULL; + } + + [super dealloc]; +} + - (BOOL) update { NSError *error = nil; BOOL result = [self updateWithError:&error]; @@ -85,11 +109,14 @@ NSString *pdfFile = [NSString stringWithFormat:@"file://%@/tikzit.pdf", tempDir]; [tex writeToFile:texFile atomically:YES]; - // run pdflatex in a bash shell NSTask *latexTask = [[NSTask alloc] init]; [latexTask setCurrentDirectoryPath:tempDir]; + // GNUStep is clever enough to use PATH - [latexTask setLaunchPath:@"pdflatex"]; + NSString *path = [config stringEntry:@"pdflatex" + inGroup:@"Previews" + withDefault:@"pdflatex"]; + [latexTask setLaunchPath:path]; NSArray *args = [NSArray arrayWithObjects: @"-fmt=latex", @@ -105,15 +132,27 @@ NSFileHandle *latexOut = [pout fileHandleForReading]; - [latexTask launch]; - [latexTask waitUntilExit]; + BOOL success = NO; + + NS_DURING { + [latexTask launch]; + [latexTask waitUntilExit]; + } NS_HANDLER { + NSString *desc = [NSString stringWithFormat:@"Failed to run '%@'", path]; + NSMutableDictionary *errorDetail = [NSMutableDictionary dictionaryWithCapacity:2]; + [errorDetail setValue:desc forKey:NSLocalizedDescriptionKey]; + *error = [NSError errorWithDomain:TZErrorDomain code:TZ_ERR_IO userInfo:errorDetail]; + + // remove all temporary files + [[NSFileManager defaultManager] removeFileAtPath:tempDir handler:NULL]; + + return NO; + } NS_ENDHANDLER NSData *data = [latexOut readDataToEndOfFile]; NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - BOOL success = NO; - if ([latexTask terminationStatus] != 0) { if (error) { NSMutableDictionary *errorDetail = [NSMutableDictionary dictionaryWithCapacity:2]; @@ -156,20 +195,6 @@ return pdfPage ? YES : NO; } -- (Preambles*) preambles { - return preambles; -} - -- (TikzDocument*) document { - return document; -} - -- (void) setDocument:(TikzDocument*)doc { - [doc retain]; - [document release]; - document = doc; -} - - (double) width { double w = 0.0; if (pdfPage) diff --git a/tikzit/src/linux/PreviewWindow.h b/tikzit/src/linux/PreviewWindow.h index d59954e..ca6b30c 100644 --- a/tikzit/src/linux/PreviewWindow.h +++ b/tikzit/src/linux/PreviewWindow.h @@ -18,6 +18,7 @@ #import "TZFoundation.h" #import +@class Configuration; @class Preambles; @class PreviewRenderer; @class TikzDocument; @@ -30,7 +31,7 @@ GtkWindow *parent; } -- (id) initWithPreambles:(Preambles*)p; +- (id) initWithPreambles:(Preambles*)p config:(Configuration*)c; - (void) setParentWindow:(GtkWindow*)parent; diff --git a/tikzit/src/linux/PreviewWindow.m b/tikzit/src/linux/PreviewWindow.m index 7bbcf18..418886e 100644 --- a/tikzit/src/linux/PreviewWindow.m +++ b/tikzit/src/linux/PreviewWindow.m @@ -37,12 +37,12 @@ return nil; } -- (id) initWithPreambles:(Preambles*)p { +- (id) initWithPreambles:(Preambles*)p config:(Configuration*)c { self = [super init]; if (self) { parent = NULL; - previewer = [[PreviewRenderer alloc] initWithPreambles:p]; + previewer = [[PreviewRenderer alloc] initWithPreambles:p config:c]; window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); gtk_window_set_title (window, "Preview"); diff --git a/tikzit/src/linux/SettingsDialog.h b/tikzit/src/linux/SettingsDialog.h new file mode 100644 index 0000000..a159afb --- /dev/null +++ b/tikzit/src/linux/SettingsDialog.h @@ -0,0 +1,46 @@ +/* + * Copyright 2012 Alex Merry + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#import "TZFoundation.h" +#import + +@class Configuration; + +@interface SettingsDialog: NSObject { + Configuration *configuration; + + // we don't keep any refs, as we control + // the top window + GtkWindow *parentWindow; + GtkWindow *window; + GtkEntry *pdflatexPathEntry; +} + +@property (retain) Configuration* configuration; + +- (id) initWithConfiguration:(Configuration*)c; + +- (void) setParentWindow:(GtkWindow*)parent; + +- (void) show; +- (void) hide; +- (BOOL) isVisible; +- (void) setVisible:(BOOL)visible; + +@end + +// vim:ft=objc:ts=8:et:sts=4:sw=4:foldmethod=marker diff --git a/tikzit/src/linux/SettingsDialog.m b/tikzit/src/linux/SettingsDialog.m new file mode 100644 index 0000000..88c66d2 --- /dev/null +++ b/tikzit/src/linux/SettingsDialog.m @@ -0,0 +1,273 @@ +/* + * Copyright 2012 Alex Merry + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#import "SettingsDialog.h" + +#import "Configuration.h" + +// {{{ Internal interfaces +// {{{ Signals +static gboolean window_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + SettingsDialog *dialog); +static void ok_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog); +static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog); +// }}} + +@interface SettingsDialog (Private) +- (void) loadUi; +- (void) save; +- (void) revert; +@end + +// }}} +// {{{ API + +@implementation SettingsDialog + +- (id) init { + [self release]; + self = nil; + return nil; +} + +- (id) initWithConfiguration:(Configuration*)c { + self = [super init]; + + if (self) { + configuration = [c retain]; + parentWindow = NULL; + window = NULL; + } + + return self; +} + +- (Configuration*) configuration { + return configuration; +} + +- (void) setConfiguration:(Configuration*)c { + [c retain]; + [configuration release]; + configuration = c; + [self revert]; +} + +- (void) setParentWindow:(GtkWindow*)parent { + GtkWindow *oldParent = parentWindow; + + if (parent) + g_object_ref (parentWindow); + parentWindow = parent; + if (oldParent) + g_object_unref (oldParent); + + if (window) { + gtk_window_set_transient_for (window, parentWindow); + } +} + +- (void) show { + [self loadUi]; + [self revert]; + gtk_widget_show (GTK_WIDGET (window)); +} + +- (void) hide { + if (!window) { + return; + } + gtk_widget_hide (GTK_WIDGET (window)); +} + +- (BOOL) isVisible { + if (!window) { + return NO; + } + gboolean visible; + g_object_get (G_OBJECT (window), "visible", &visible, NULL); + return visible ? YES : NO; +} + +- (void) setVisible:(BOOL)visible { + if (visible) { + [self show]; + } else { + [self hide]; + } +} + +- (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 + +// }}} +// {{{ Private + +@implementation SettingsDialog (Private) +- (void) loadUi { + if (window) { + return; + } + + window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); + gtk_window_set_title (window, "Preamble editor"); + gtk_window_set_modal (window, TRUE); + gtk_window_set_position (window, GTK_WIN_POS_CENTER_ON_PARENT); + gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG); + if (parentWindow) { + gtk_window_set_transient_for (window, parentWindow); + } + g_signal_connect (window, + "delete-event", + G_CALLBACK (window_delete_event_cb), + self); + + GtkWidget *mainBox = gtk_vbox_new (FALSE, 18); + gtk_container_set_border_width (GTK_CONTAINER (mainBox), 12); + gtk_container_add (GTK_CONTAINER (window), mainBox); + +#ifdef HAVE_POPPLER + /* + * Path for pdflatex + */ + + GtkWidget *pdflatexFrame = gtk_frame_new ("Previews"); + gtk_box_pack_start (GTK_BOX (mainBox), pdflatexFrame, TRUE, TRUE, 0); + + GtkBox *pdflatexBox = GTK_BOX (gtk_hbox_new (FALSE, 6)); + gtk_container_add (GTK_CONTAINER (pdflatexFrame), GTK_WIDGET (pdflatexBox)); + gtk_container_set_border_width (GTK_CONTAINER (pdflatexBox), 6); + + GtkWidget *pdflatexLabel = gtk_label_new ("Path to pdflatex:"); + gtk_misc_set_alignment (GTK_MISC (pdflatexLabel), 0, 0.5); + gtk_box_pack_start (pdflatexBox, + pdflatexLabel, + FALSE, TRUE, 0); + + pdflatexPathEntry = GTK_ENTRY (gtk_entry_new ()); + gtk_box_pack_start (pdflatexBox, + GTK_WIDGET (pdflatexPathEntry), + TRUE, TRUE, 0); +#else + pdflatexPathEntry = NULL; +#endif + + + /* + * Bottom buttons + */ + + GtkContainer *buttonBox = GTK_CONTAINER (gtk_hbutton_box_new ()); + gtk_box_set_spacing (GTK_BOX (buttonBox), 6); + gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonBox), GTK_BUTTONBOX_END); + gtk_box_pack_start (GTK_BOX (mainBox), + GTK_WIDGET (buttonBox), + FALSE, TRUE, 0); + + GtkWidget *okButton = gtk_button_new_from_stock (GTK_STOCK_OK); + gtk_container_add (buttonBox, okButton); + g_signal_connect (okButton, + "clicked", + G_CALLBACK (ok_button_clicked_cb), + self); + + GtkWidget *cancelButton = gtk_button_new_from_stock (GTK_STOCK_CANCEL); + gtk_container_add (buttonBox, cancelButton); + g_signal_connect (cancelButton, + "clicked", + G_CALLBACK (cancel_button_clicked_cb), + self); + + [self revert]; + + gtk_widget_show_all (mainBox); +} + +- (void) save { + if (!window) + return; + +#ifdef HAVE_POPPLER + const gchar *path = gtk_entry_get_text (pdflatexPathEntry); + if (path && *path) { + [configuration setStringEntry:@"pdflatex" + inGroup:@"Previews" + value:[NSString stringWithUTF8String:path]]; + } +#endif + + [[NSNotificationCenter defaultCenter] + postNotificationName:@"ConfigurationChanged" + object:configuration]; +} + +- (void) revert { + if (!window) + return; + +#ifdef HAVE_POPPLER + NSString *path = [configuration stringEntry:@"pdflatex" + inGroup:@"Previews" + withDefault:@"pdflatex"]; + gtk_entry_set_text (pdflatexPathEntry, [path UTF8String]); +#endif +} +@end + +// }}} +// {{{ GTK+ callbacks + +static gboolean window_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + SettingsDialog *dialog) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [dialog hide]; + [pool drain]; + return TRUE; // we dealt with this event +} + +static void ok_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [dialog save]; + [dialog hide]; + [pool drain]; +} + +static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [dialog hide]; + [pool drain]; +} + +// }}} + +// vim:ft=objc:ts=4:et:sts=4:sw=4:foldmethod=marker -- cgit v1.2.3