diff --git a/tictactoe/config_dialog.ui b/tictactoe/config_dialog.ui
new file mode 100644
index 0000000000000000000000000000000000000000..60a2bb1b1d87dc2b2c6d0fb2fa6375844e4c03fb
--- /dev/null
+++ b/tictactoe/config_dialog.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkHBox" id="hbox2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkLabel" id="board_size_label">
+                <property name="width_request">133</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0.029999999329447746</property>
+                <property name="label" translatable="yes">Board size</property>
+                <property name="ellipsize">start</property>
+                <property name="single_line_mode">True</property>
+                <property name="track_visited_links">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="board_size">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_text" translatable="yes">Preview size(10-512)</property>
+                <property name="invisible_char">●</property>
+                <property name="width_chars">6</property>
+                <property name="snap_to_ticks">True</property>
+                <property name="numeric">True</property>
+                <signal name="value-changed" handler="board_size_value_changed" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/tictactoe/manifest.ini b/tictactoe/manifest.ini
index d9deb4a129b745ae14caecfee1d7ed08ef871d88..90208217331c066132e434186fbc805be99aaf60 100644
--- a/tictactoe/manifest.ini
+++ b/tictactoe/manifest.ini
@@ -1,7 +1,7 @@
 [info]
 name: Tic tac toe
 short_name: Tic tac toe
-version: 0.1
+version: 0.2
 description: Play tic tac toe
 authors = Yann Leboulanger <asterix@lagaule.org>
 homepage = www.gajim.org
diff --git a/tictactoe/plugin.py b/tictactoe/plugin.py
index c1d2cffe2e6847ce6c038e21d7d7d144bf71f694..fa29243800c1bbcde0b5e3f0cad59696ce444e5c 100644
--- a/tictactoe/plugin.py
+++ b/tictactoe/plugin.py
@@ -32,6 +32,7 @@ from common import gajim
 from plugins import GajimPlugin
 from plugins.plugin import GajimPluginException
 from plugins.helpers import log_calls, log
+from plugins.gui import GajimPluginConfigDialog
 import common.xmpp
 import gtk
 from gtk import gdk
@@ -51,7 +52,7 @@ class TictactoePlugin(GajimPlugin):
     @log_calls('TictactoePlugin')
     def init(self):
         self.description = _('Play Tictactoe.')
-        self.config_dialog = None
+        self.config_dialog = TictactoePluginConfigDialog(self)
         self.events_handlers = {
             'decrypted-message-received': (ged.GUI1,
                 self._nec_decrypted_message_received),
@@ -62,6 +63,9 @@ class TictactoePlugin(GajimPlugin):
             'chat_control_base_update_toolbar': (self.update_button_state,
                 None),
         }
+        self.config_default_values = {
+            'board_size': (5, ''),
+        }
         self.controls = []
 
     @log_calls('TictactoePlugin')
@@ -212,7 +216,8 @@ class Base(object):
 
     def stop_tictactoe(self, reason=None):
         self.tictactoe.end_game(reason)
-        self.tictactoe.board.win.destroy()
+        if hasattr(self.tictactoe, 'board'):
+            self.tictactoe.board.win.destroy()
         self.tictactoe = None
 
     def disconnect_from_chat_control(self):
@@ -229,15 +234,16 @@ class TicTacToeSession(stanza_session.StanzaSession):
             gajim.get_jid_without_resource(str(jid)))
         self.name = contact.get_shown_name()
         self.base = None
+        self.control = None
 
     # initiate a session
-    def begin(self, rows=3, cols=3, role_s='x'):
-        self.rows = rows
-        self.cols = cols
+    def begin(self, role_s='x'):
+        self.rows = self.base.plugin.config['board_size']
+        self.cols = self.base.plugin.config['board_size']
 
         self.role_s = role_s
 
-        self.strike = 3
+        self.strike = self.base.plugin.config['board_size']
 
         if self.role_s == 'x':
             self.role_o = 'o'
@@ -265,13 +271,13 @@ class TicTacToeSession(stanza_session.StanzaSession):
         f.setValue('x')
         f = x.setField('rows')
         f.setType('text-single')
-        f.setValue('3')
+        f.setValue(str(self.base.plugin.config['board_size']))
         f = x.setField('cols')
         f.setType('text-single')
-        f.setValue('3')
+        f.setValue(str(self.base.plugin.config['board_size']))
         f = x.setField('strike')
         f.setType('text-single')
-        f.setValue('3')
+        f.setValue(str(self.base.plugin.config['board_size']))
 
         game.addChild(node=x)
 
@@ -715,3 +721,24 @@ class TicTacToeBoard:
     def cheated(self):
         self.state == 'cheated'
         self.win.queue_draw()
+
+
+class TictactoePluginConfigDialog(GajimPluginConfigDialog):
+    def init(self):
+        self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
+            'config_dialog.ui')
+        self.xml = gtk.Builder()
+        self.xml.set_translation_domain('gajim_plugins')
+        self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox1'])
+        self.board_size_spinbutton = self.xml.get_object('board_size')
+        self.board_size_spinbutton.get_adjustment().set_all(3, 3, 10, 1, 1, 0)
+        vbox = self.xml.get_object('vbox1')
+        self.child.pack_start(vbox)
+
+        self.xml.connect_signals(self)
+
+    def on_run(self):
+        self.board_size_spinbutton.set_value(self.plugin.config['board_size'])
+
+    def board_size_value_changed(self, spinbutton):
+        self.plugin.config['board_size'] = int(spinbutton.get_value())