Code

Really fix compile (patch by Krzysztof KosiƄski)
[inkscape.git] / src / widgets / calligraphic-profile-rename.cpp
1 /**\r
2  *\r
3  * \brief  Dialog for naming calligraphic profiles\r
4  *\r
5  * Author:\r
6  *   Aubanel MONNIER \r
7  *\r
8  * Copyright (C) 2007 Aubanel MONNIER\r
9  *\r
10  * Released under GNU GPL.  Read the file 'COPYING' for more information\r
11  */\r
12 \r
13 #ifdef HAVE_CONFIG_H\r
14 # include <config.h>\r
15 #endif\r
16 \r
17 #include <glibmm/i18n.h>\r
18 #include <gtkmm/stock.h>\r
19 \r
20 #include "desktop.h"\r
21 #include "calligraphic-profile-rename.h"\r
22 \r
23 \r
24 namespace Inkscape {\r
25 namespace UI {\r
26 namespace Dialogs {\r
27 CalligraphicProfileDialog::CalligraphicProfileDialog(): _applied(false){\r
28   Gtk::VBox *mainVBox = get_vbox();\r
29   _layout_table.set_spacings(4);\r
30   _layout_table.resize (1, 2);\r
31 \r
32   _profile_name_entry.set_activates_default(true);\r
33 \r
34   _profile_name_label.set_label(_("Profile name:"));\r
35   _profile_name_label.set_alignment(1.0, 0.5);\r
36   \r
37   _layout_table.attach(_profile_name_label,\r
38                        0, 1, 0, 1, Gtk::FILL, Gtk::FILL);\r
39   _layout_table.attach(_profile_name_entry,\r
40                        1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);\r
41   mainVBox->pack_start(_layout_table, false, false, 4);\r
42   // Buttons\r
43   _close_button.set_use_stock(true);\r
44   _close_button.set_label(Gtk::Stock::CANCEL.id);\r
45   _close_button.set_flags(Gtk::CAN_DEFAULT);\r
46   \r
47   _apply_button.set_use_underline(true);\r
48   _apply_button.set_label(_("Save"));\r
49   _apply_button.set_flags(Gtk::CAN_DEFAULT);\r
50   \r
51   _close_button.signal_clicked()\r
52     .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close));\r
53   _apply_button.signal_clicked()\r
54     .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_apply));\r
55   \r
56   signal_delete_event().connect(\r
57         sigc::bind_return(\r
58             sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close)),\r
59             true\r
60         )\r
61     );\r
62 \r
63   add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);\r
64   add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);\r
65 \r
66   _apply_button.grab_default();\r
67 \r
68   show_all_children();\r
69 \r
70 }\r
71 \r
72 void\r
73 CalligraphicProfileDialog::_apply()\r
74 {\r
75   _profile_name = _profile_name_entry.get_text();\r
76   _applied = true;\r
77   _close();\r
78 }\r
79 \r
80 void\r
81 CalligraphicProfileDialog::_close()\r
82 {\r
83   this->Gtk::Dialog::hide();\r
84   \r
85 }\r
86 \r
87 void CalligraphicProfileDialog::show(SPDesktop *desktop){\r
88   CalligraphicProfileDialog &dial = instance();\r
89   dial._applied=false;\r
90   dial.set_modal(true);\r
91   desktop->setWindowTransient (dial.gobj());\r
92   dial.property_destroy_with_parent() = true;\r
93   //  dial.Gtk::Dialog::show();\r
94   //dial.present();\r
95   dial.run();\r
96 }\r
97 \r
98 \r
99 }}}\r