summaryrefslogtreecommitdiff
path: root/tikzit/src/linux/NodeStyleSelector.m
diff options
context:
space:
mode:
Diffstat (limited to 'tikzit/src/linux/NodeStyleSelector.m')
-rw-r--r--tikzit/src/linux/NodeStyleSelector.m48
1 files changed, 22 insertions, 26 deletions
diff --git a/tikzit/src/linux/NodeStyleSelector.m b/tikzit/src/linux/NodeStyleSelector.m
index 5539b93..395d9ca 100644
--- a/tikzit/src/linux/NodeStyleSelector.m
+++ b/tikzit/src/linux/NodeStyleSelector.m
@@ -23,8 +23,9 @@
#import "ShapeNames.h"
#import "StyleManager.h"
-#import "gdk-pixbuf/gdk-pixbuf.h"
+#import <gdk-pixbuf/gdk-pixbuf.h>
+// {{{ Internal interfaces
// {{{ Signals
static void selection_changed_cb (GtkIconView *widget, NodeStyleSelector *mgr);
// }}}
@@ -56,7 +57,9 @@ enum {
- (void) reloadStyles;
@end
+// }}}
// {{{ API
+
@implementation NodeStyleSelector
- (id) init {
@@ -64,17 +67,7 @@ enum {
return self;
}
-- (id) initWithIconView:(GtkIconView*)view {
- self = [self initWithIconView:GTK_ICON_VIEW (gtk_icon_view_new ()) andStyleManager:[StyleManager manager]];
- return self;
-}
-
- (id) initWithStyleManager:(StyleManager*)m {
- self = [self initWithIconView:GTK_ICON_VIEW (gtk_icon_view_new ()) andStyleManager:m];
- return self;
-}
-
-- (id) initWithIconView:(GtkIconView*)v andStyleManager:(StyleManager*)m {
self = [super init];
if (self) {
@@ -87,7 +80,7 @@ enum {
G_TYPE_POINTER);
g_object_ref (store);
- view = v;
+ view = GTK_ICON_VIEW (gtk_icon_view_new ());
g_object_ref (view);
gtk_icon_view_set_model (view, GTK_TREE_MODEL (store));
@@ -115,6 +108,16 @@ enum {
return self;
}
+- (void) dealloc {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ g_object_unref (view);
+ [self clearModel];
+ g_object_unref (store);
+ [styleManager release];
+
+ [super dealloc];
+}
+
- (void) clearModel {
[self setSelectedStyle:nil];
GtkTreeModel *model = GTK_TREE_MODEL (store);
@@ -226,20 +229,11 @@ enum {
}
}
-- (void) dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- g_object_unref (view);
- [self clearModel];
- g_object_unref (store);
- [styleManager release];
-
- [super dealloc];
-}
-
@end
-// }}}
+// }}}
// {{{ Notifications
+
@implementation NodeStyleSelector (Notifications)
- (void) stylesReplaced:(NSNotification*)notification {
@@ -313,9 +307,10 @@ enum {
[self postSelectedStyleChanged];
}
@end
-// }}}
+// }}}
// {{{ Private
+
@implementation NodeStyleSelector (Private)
- (cairo_surface_t*) createNodeIconSurface {
return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 24, 24);
@@ -416,9 +411,10 @@ enum {
}
}
@end
-// }}}
+// }}}
// {{{ GTK+ callbacks
+
static void selection_changed_cb (GtkIconView *view, NodeStyleSelector *mgr) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[mgr selectionChanged];
@@ -426,4 +422,4 @@ static void selection_changed_cb (GtkIconView *view, NodeStyleSelector *mgr) {
}
// }}}
-// vim:ft=objc:ts=8:et:sts=4:sw=4
+// vim:ft=objc:ts=8:et:sts=4:sw=4:foldmethod=marker