Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add a save as dialog

darcs-hash:20060809071206-4b390-0b7fdf5c34fe4aac9fb4f58dd5a34056258a0dda.gz
  • Loading branch information...
commit a68008e5363e5dfc5f18e4b0b0d4a26ce9522e41 1 parent a685595
@kfish authored
Showing with 79 additions and 0 deletions.
  1. +68 −0 data/main.glade
  2. +11 −0 src/cairo-appbase.hs
View
68 data/main.glade
@@ -287,4 +287,72 @@
</child>
</widget>
+<widget class="GtkFileChooserDialog" id="savedialog">
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SAVE</property>
+ <property name="local_only">True</property>
+ <property name="select_multiple">False</property>
+ <property name="show_hidden">False</property>
+ <property name="do_overwrite_confirmation">False</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">24</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-save</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
View
11 src/cairo-appbase.hs
@@ -48,6 +48,14 @@ main = do
G.onActivateLeaf open1 $ G.widgetShow openDialog
G.onResponse openDialog $ myFileOpen openDialog
+ -- set up the File->Save_As dialog
+ save1 <- get G.castToMenuItem "save1"
+ save_as1 <- get G.castToMenuItem "save_as1"
+ saveDialog <- get G.castToFileChooserDialog "savedialog"
+ G.onActivateLeaf save_as1 $ G.widgetShow saveDialog
+ G.onActivateLeaf save1 $ G.widgetShow saveDialog
+ G.onResponse saveDialog $ myFileSave saveDialog
+
-- set up the Help->About dialog
about1 <- get G.castToMenuItem "about1"
aboutdialog1 <- get G.castToAboutDialog "aboutdialog1"
@@ -78,6 +86,9 @@ myFileOpen fcdialog response = do
G.ResponseClose -> putStrLn "Closed!"
G.widgetHide fcdialog
+myFileSave :: G.FileChooserDialog -> G.ResponseId -> IO ()
+myFileSave = myFileOpen
+
updateCanvas :: G.DrawingArea -> IO Bool
updateCanvas canvas = do
win <- G.drawingAreaGetDrawWindow canvas
Please sign in to comment.
Something went wrong with that request. Please try again.