[gnome-contacts/new-design] Move new contacts dialog to its own file
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Move new contacts dialog to its own file
- Date: Fri, 16 Dec 2011 17:02:00 +0000 (UTC)
commit cf3cd1921752cb5aae9f7ee420a850a53dd57a9d
Author: Alexander Larsson <alexl redhat com>
Date: Fri Dec 16 14:49:41 2011 +0100
Move new contacts dialog to its own file
src/Makefile.am | 1 +
src/contacts-app.vala | 3 +-
src/contacts-contact-pane.vala | 3 --
src/contacts-new-contact-dialog.vala | 58 ++++++++++++++++++++++++++++++++++
4 files changed, 61 insertions(+), 4 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index c44540b..b58f565 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,6 +31,7 @@ vala_sources = \
contacts-view.vala \
contacts-utils.vala \
contacts-clickable.vala \
+ contacts-new-contact-dialog.vala \
main.vala \
$(NULL)
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 4daf9d9..cbb6775 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -117,7 +117,8 @@ public class Contacts.App : Gtk.Application {
list_pane = new ListPane (contacts_store);
list_pane.selection_changed.connect (selection_changed);
list_pane.create_new.connect ( () => {
- contacts_pane.new_contact (list_pane);
+ var dialog = new NewContactDialog (window);
+ dialog.show_all ();
});
grid.attach (list_pane, 0, 0, 1, 2);
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index b3aef72..a746bf8 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -1949,9 +1949,6 @@ public class Contacts.ContactPane : ScrolledWindow {
update_buttons ();
}
- public void new_contact (ListPane list_pane) {
- }
-
public void enter_edit_mode (DataFieldRow row) {
if (editing_row != row) {
exit_edit_mode (true);
diff --git a/src/contacts-new-contact-dialog.vala b/src/contacts-new-contact-dialog.vala
new file mode 100644
index 0000000..585e2ba
--- /dev/null
+++ b/src/contacts-new-contact-dialog.vala
@@ -0,0 +1,58 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2011 Alexander Larsson <alexl redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gtk;
+using Folks;
+
+public class Contacts.NewContactDialog : Dialog {
+
+ public NewContactDialog(Window parent) {
+ set_title (_("New contact"));
+ set_destroy_with_parent (true);
+ set_transient_for (parent);
+
+ add_buttons (Stock.CANCEL, ResponseType.CANCEL,
+ _("Create Contact"), ResponseType.OK);
+
+ set_default_response (ResponseType.OK);
+
+ var box = get_content_area () as Box;
+
+ var scrolled = new ScrolledWindow(null, null);
+ scrolled.set_size_request (340, 300);
+ scrolled.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);
+ scrolled.set_vexpand (true);
+ scrolled.set_hexpand (true);
+ scrolled.set_shadow_type (ShadowType.IN);
+ scrolled.set_border_width (6);
+
+ box.pack_start (scrolled, true, true, 0);
+
+ var grid = new Grid ();
+ scrolled.add_with_viewport (grid);
+
+ var entry = new Entry ();
+ grid.add (entry);
+ }
+
+ public override void response (int response_id) {
+ if (response_id == ResponseType.OK) {
+ }
+ this.destroy ();
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]