~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

« back to all changes in this revision

Viewing changes to Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-28 14:11:49 UTC
  • mfrom: (1.3.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100128141149-snoxliun1ta8x8d2
Tags: 1.1.1-0ubuntu1
* New upstream version
* debian/control.in:
  - build-depends on cdbs to get strip-schema installed
  - updated cli build-depends for the new binary changes
* debian/rules:
  - set gettext domain in the desktop entry and run strip-schema on build

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
                // that supports a field, a username, and password.  This could be useful
15
15
                // in quickly building SshSyncServiceAddin, FtpSyncServiceAddin, etc.
16
16
 
17
 
                private Entry pathEntry;
 
17
                private FileChooserButton pathButton;
18
18
                private string path;
19
19
                private bool initialized = false;
20
20
 
81
81
                /// </summary>
82
82
                public override Gtk.Widget CreatePreferencesControl ()
83
83
                {
84
 
                        Gtk.Table table = new Gtk.Table (1, 3, false);
 
84
                        Gtk.Table table = new Gtk.Table (1, 2, false);
85
85
                        table.RowSpacing = 5;
86
86
                        table.ColumnSpacing = 10;
87
87
 
97
97
                                      Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
98
98
                                      0, 0);
99
99
 
100
 
                        pathEntry = new Entry ();
101
 
                        pathEntry.Text = syncPath;
102
 
                        table.Attach (pathEntry, 1, 2, 0, 1,
 
100
                        pathButton = new FileChooserButton (Catalog.GetString ("Select Synchronization Folder..."),
 
101
                                                            FileChooserAction.SelectFolder);
 
102
                        l.MnemonicWidget = pathButton;
 
103
                        pathButton.SetFilename (syncPath);
 
104
 
 
105
                        table.Attach (pathButton, 1, 2, 0, 1,
103
106
                                      Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
104
107
                                      Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
105
108
                                      0, 0);
106
 
                        l.MnemonicWidget = pathEntry;
107
 
 
108
 
                        Image browseImage = new Image (Stock.Open, IconSize.Button);
109
 
                        Label browseLabel = new Label (Catalog.GetString ("_Browse..."));
110
 
 
111
 
                        HBox browseBox = new HBox (false, 0);
112
 
                        browseBox.PackStart (browseImage);
113
 
                        browseBox.PackStart (browseLabel);
114
 
 
115
 
                        Button browseButton = new Button ();
116
 
                        browseButton.Add (browseBox);
117
 
                        browseLabel.MnemonicWidget = browseButton;
118
 
                        browseButton.Clicked += OnBrowseButtonClicked;
119
 
                        table.Attach (browseButton, 2, 3, 0, 1, AttachOptions.Shrink, AttachOptions.Expand, 0, 0);
120
109
 
121
110
                        table.ShowAll ();
122
111
                        return table;
123
112
                }
124
113
 
125
 
                private void OnBrowseButtonClicked (object sender, EventArgs args)
126
 
                {
127
 
                        FileChooserDialog chooserDlg =
128
 
                                new FileChooserDialog (Catalog.GetString ("Select Synchronization Folder..."),
129
 
                                                       null,
130
 
                                                       FileChooserAction.SelectFolder,
131
 
                                                       Stock.Cancel, ResponseType.Cancel,
132
 
                                                       Stock.Ok, ResponseType.Ok);
133
 
                        chooserDlg.DefaultResponse = ResponseType.Cancel;
134
 
                        chooserDlg.SetFilename (pathEntry.Text);
135
 
 
136
 
                        ResponseType response = (ResponseType) chooserDlg.Run ();
137
 
 
138
 
                        if (response == ResponseType.Ok)
139
 
                                pathEntry.Text = chooserDlg.Filename;
140
 
 
141
 
                        chooserDlg.Destroy ();
142
 
                }
143
 
 
144
114
                /// <summary>
145
115
                /// The Addin should verify and check the connection to the service
146
116
                /// when this is called.  If verification and connection is successful,
148
118
                /// </summary>
149
119
                public override bool SaveConfiguration ()
150
120
                {
151
 
                        string syncPath = pathEntry.Text.Trim ();
 
121
                        string syncPath = pathButton.Filename;
152
122
 
153
123
                        if (syncPath == string.Empty) {
154
124
                                // TODO: Figure out a way to send the error back to the client