summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d38c2b)
raw | patch | inline | side by side (parent: 1d38c2b)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 5 Jul 2008 20:11:12 +0000 (20:11 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 5 Jul 2008 20:11:12 +0000 (20:11 +0000) |
src/dialogs/xml-tree.cpp | patch | blob | history |
index 2d1b4c4b17e983baf1f8aea978e38af5dbc8e09e..33ac02a9b0df915c5dd9347bc771dd1a8ce5002c 100644 (file)
--- a/src/dialogs/xml-tree.cpp
+++ b/src/dialogs/xml-tree.cpp
dest->text = gtk_editable_get_chars(dest->editable, 0, -1);
}
-
+gboolean
+quit_on_esc (GtkWidget *w, GdkEventKey *event, GObject */*tbl*/)
+{
+ switch (get_group0_keyval (event)) {
+ case GDK_Escape: // defocus
+ gtk_widget_destroy(w);
+ return TRUE;
+ }
+ return FALSE;
+}
void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/)
{
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(dlg));
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
gtk_signal_connect(GTK_OBJECT(window), "destroy", gtk_main_quit, NULL);
+ gtk_signal_connect(GTK_OBJECT(window), "key-press-event", G_CALLBACK(quit_on_esc), window);
vbox = gtk_vbox_new(FALSE, 4);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
cancel = gtk_button_new_with_label(_("Cancel"));
+ GTK_WIDGET_SET_FLAGS( GTK_WIDGET(cancel),
+ GTK_CAN_DEFAULT );
gtk_signal_connect_object( GTK_OBJECT(cancel), "clicked",
G_CALLBACK(gtk_widget_destroy),
GTK_OBJECT(window) );
gtk_main();
- g_assert(selected_repr != NULL);
-
- if (name.text) {
+ if (selected_repr != NULL && name.text) {
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
Inkscape::XML::Node *new_repr;
new_repr = xml_doc->createElement(name.text);