Пример #1
0
        void Login()
        {
            try {
                fr = new FlickrRemote(token, current_service);
                fr.TryWebLogin();
                CurrentState = State.Connected;
            } catch (Exception e) {
                if (e is FlickrApiException && (e as FlickrApiException).Code == 98)
                {
                    Logout();
                    Login();
                }
                else
                {
                    var md =
                        new HigMessageDialog(Dialog,
                                             Gtk.DialogFlags.Modal |
                                             Gtk.DialogFlags.DestroyWithParent,
                                             Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                             Catalog.GetString("Unable to log on"), e.Message);

                    md.Run();
                    md.Destroy();
                    CurrentState = State.Disconnected;
                }
            }
        }
Пример #2
0
 void Logout()
 {
     token = null;
     fr    = new FlickrRemote(token, current_service);
     Preferences.Set(current_service.PreferencePath, string.Empty);
     CurrentState = State.Disconnected;
 }
Пример #3
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection  = selection;
            current_service = FlickrRemote.Service.FromSupported(service);

            var view = new TrayView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            builder = new GtkBeans.Builder(null, "flickr_export.ui", null);
            builder.Autoconnect(this);

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled    += HandlePublicChanged;
            tag_check.Toggled       += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged(null, null);
            HandleHierarchyChanged(null, null);

            Dialog.ShowAll();
            Dialog.Response       += HandleResponse;
            auth_flickr.Clicked   += HandleClicked;
            auth_text              = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text        = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(BROWSER_KEY);
            LoadPreference(TAGS_KEY);
            LoadPreference(TAG_HIERARCHY_KEY);
            LoadPreference(IGNORE_TOP_LEVEL_KEY);
            LoadPreference(PUBLIC_KEY);
            LoadPreference(FAMILY_KEY);
            LoadPreference(FRIENDS_KEY);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (token != null)
            {
                StartAuth();
            }
        }
 private void Logout()
 {
     token = null;
     auth = null;
     fr = new FlickrRemote (token, current_service);
     Preferences.Set (current_service.PreferencePath, String.Empty);
     CurrentState = State.Disconnected;
 }
        private void Login()
        {
            try {
                fr = new FlickrRemote (token, current_service);
                fr.TryWebLogin();
                CurrentState = State.Connected;
            } catch (Exception e) {
                if (e is FlickrApiException && (e as FlickrApiException).Code == 98) {
                    Logout ();
                    Login ();
                } else {
                    HigMessageDialog md =
                        new HigMessageDialog (Dialog,
                                      Gtk.DialogFlags.Modal |
                                      Gtk.DialogFlags.DestroyWithParent,
                                      Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                      Catalog.GetString ("Unable to log on"), e.Message);

                    md.Run ();
                    md.Destroy ();
                    CurrentState = State.Disconnected;
                }
            }
        }
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection = selection;
            this.current_service = FlickrRemote.Service.FromSupported (service);

            var view = new TrayView (selection);
            view.DisplayTags = display_tags;
            view.DisplayDates = false;

            builder = new GtkBeans.Builder (null, "flickr_export.ui", null);
            builder.Autoconnect (this);

            Dialog.Modal = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add (view);
            HandleSizeActive (null, null);

            public_radio.Toggled += HandlePublicChanged;
            tag_check.Toggled += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged (null, null);
            HandleHierarchyChanged (null, null);

            Dialog.ShowAll ();
            Dialog.Response += HandleResponse;
            auth_flickr.Clicked += HandleClicked;
            auth_text = string.Format (auth_label.Text, current_service.Name);
            auth_label.Text = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference (SCALE_KEY);
            LoadPreference (SIZE_KEY);
            LoadPreference (BROWSER_KEY);
            LoadPreference (TAGS_KEY);
            LoadPreference (TAG_HIERARCHY_KEY);
            LoadPreference (IGNORE_TOP_LEVEL_KEY);
            LoadPreference (PUBLIC_KEY);
            LoadPreference (FAMILY_KEY);
            LoadPreference (FRIENDS_KEY);
            LoadPreference (current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote (token, current_service);
            if (token != null && token.Length > 0) {
                StartAuth ();
            }
        }