1 /** @file
2 * @brief Dialog for naming calligraphic profiles
3 *
4 * @note This file is in the wrong directory because of link order issues -
5 * it is required by widgets/toolbox.cpp, and libspwidgets.a comes after
6 * libinkdialogs.a in the current link order.
7 */
8 /* Author:
9 * Aubanel MONNIER
10 *
11 * Copyright (C) 2007 Authors
12 * Released under GNU GPL. Read the file 'COPYING' for more information
13 */
15 #ifdef HAVE_CONFIG_H
16 # include <config.h>
17 #endif
19 #include <glibmm/i18n.h>
20 #include <gtkmm/stock.h>
22 #include "desktop.h"
23 #include "calligraphic-profile-rename.h"
25 namespace Inkscape {
26 namespace UI {
27 namespace Dialog {
29 CalligraphicProfileRename::CalligraphicProfileRename() :
30 _applied(false)
31 {
32 Gtk::VBox *mainVBox = get_vbox();
33 _layout_table.set_spacings(4);
34 _layout_table.resize (1, 2);
36 _profile_name_entry.set_activates_default(true);
38 _profile_name_label.set_label(_("Profile name:"));
39 _profile_name_label.set_alignment(1.0, 0.5);
41 _layout_table.attach(_profile_name_label,
42 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
43 _layout_table.attach(_profile_name_entry,
44 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
45 mainVBox->pack_start(_layout_table, false, false, 4);
46 // Buttons
47 _close_button.set_use_stock(true);
48 _close_button.set_label(Gtk::Stock::CANCEL.id);
49 _close_button.set_flags(Gtk::CAN_DEFAULT);
51 _apply_button.set_use_underline(true);
52 _apply_button.set_label(_("Save"));
53 _apply_button.set_flags(Gtk::CAN_DEFAULT);
55 _close_button.signal_clicked()
56 .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close));
57 _apply_button.signal_clicked()
58 .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply));
60 signal_delete_event().connect( sigc::bind_return(
61 sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)), true ) );
63 add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
64 add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);
66 _apply_button.grab_default();
68 show_all_children();
69 }
71 void CalligraphicProfileRename::_apply()
72 {
73 _profile_name = _profile_name_entry.get_text();
74 _applied = true;
75 _close();
76 }
78 void CalligraphicProfileRename::_close()
79 {
80 this->Gtk::Dialog::hide();
81 }
83 void CalligraphicProfileRename::show(SPDesktop *desktop)
84 {
85 CalligraphicProfileRename &dial = instance();
86 dial._applied=false;
87 dial.set_modal(true);
88 desktop->setWindowTransient (dial.gobj());
89 dial.property_destroy_with_parent() = true;
90 // dial.Gtk::Dialog::show();
91 //dial.present();
92 dial.run();
93 }
95 } // namespace Dialog
96 } // namespace UI
97 } // namespace Inkscape
99 /*
100 Local Variables:
101 mode:c++
102 c-file-style:"stroustrup"
103 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
104 indent-tabs-mode:nil
105 fill-column:99
106 End:
107 */
108 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :