Esempio n. 1
0
            public ScreensaverConfigDialog()
                : base(Assembly.GetExecutingAssembly (), "ScreensaverConfigDialog.ui", "screensaver-config-dialog")
            {
                delay_adjustment = new Adjustment (default_delay, 1.0, 20.0, .5, 5, 0);
                LoadPreference (SCREENSAVER_DELAY);
                delay_scale.Adjustment = delay_adjustment;
                delay_adjustment.ValueChanged += HandleDelayChanged;

                tag_button = new MenuButton ();
                tag_button.SizeRequested += delegate (object sender, SizeRequestedArgs args) {
                    var req = args.Requisition;
                    req.Width += 100;
                    args.Requisition = req;
                };
                TagMenu menu = new TagMenu (null, MainWindow.Toplevel.Database.Tags);
                menu.Populate (false);
                menu.TagSelected += HandleTagSelected;
                tag_button.Menu = menu;
                tag_button.ShowAll ();
                table.Attach (tag_button, 2, 3, 1, 2);
                LoadPreference (SCREENSAVER_TAG);
                all_radio.Toggled += HandleTagRadioToggled;

                do_button.Clicked += HandleUseFSpot;
            }
Esempio n. 2
0
        public Sidebar()
        {
            ContextSwitchStrategy = new MRUSidebarContextSwitchStrategy();
            ContextChanged       += HandleContextChanged;

            button_box = new HBox();
            PackStart(button_box, false, false, 0);

            Notebook = new Notebook {
                ShowTabs   = false,
                ShowBorder = false
            };
            PackStart(Notebook, true, true, 0);

            var button = new Button {
                Image  = new Image("gtk-close", Gtk.IconSize.Button),
                Relief = ReliefStyle.None
            };

            button.Pressed += HandleCloseButtonPressed;
            button_box.PackEnd(button, false, true, 0);

            choose_button = new MenuButton {
                Relief = ReliefStyle.None
            };

            eventBox = new EventBox();
            eventBox.Add(choose_button);

            button_box.PackStart(eventBox, true, true, 0);

            choose_menu        = new Menu();
            choose_button.Menu = choose_menu;

            menu_list  = new List <string> ();
            image_list = new List <string> ();
        }
		public Sidebar () : base ()
		{
			ContextSwitchStrategy = new MRUSidebarContextSwitchStrategy (this);
			ContextChanged += HandleContextChanged;

			button_box = new HBox ();
			PackStart (button_box, false, false, 0);
			
			notebook = new Notebook ();
			notebook.ShowTabs = false;
			notebook.ShowBorder = false;
			PackStart (notebook, true, true, 0);
			
			Button button = new Button ();
			button.Image = new Image ("gtk-close", IconSize.Button);
			button.Relief = ReliefStyle.None;
			button.Pressed += HandleCloseButtonPressed;
			button_box.PackEnd (button, false, true, 0);
			
			choose_button = new MenuButton ();
			choose_button.Relief = ReliefStyle.None;
			
			eventBox = new EventBox ();
			eventBox.Add (choose_button);
			
			button_box.PackStart (eventBox, true, true, 0);
			
			choose_menu = new Menu ();
			choose_button.Menu = choose_menu;

			menu_list = new List<string> ();
			image_list = new List<string> ();
			pages = new List<SidebarPage> ();
		}
		public PreferenceDialog () : base ("main_preferences")
		{
			tag_button = new MenuButton ();
			LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
			LoadPreference (Preferences.COLOR_MANAGEMENT_ENABLED);
			LoadPreference (Preferences.COLOR_MANAGEMENT_USE_X_PROFILE);
			LoadPreference (Preferences.SCREENSAVER_TAG);
			LoadPreference (Preferences.GNOME_SCREENSAVER_THEME);
			if (Global.PhotoDirectory == Preferences.Get<string> (Preferences.STORAGE_PATH)) {
				photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged;
				photosdir_chooser.SetCurrentFolder (Global.PhotoDirectory);
			} else {
				photosdir_chooser.SetCurrentFolder(Global.PhotoDirectory);
				photosdir_chooser.Sensitive = false;
			}

			Gtk.CellRendererText name_cell = new Gtk.CellRendererText ();
			Gtk.CellRendererText desc_cell = new Gtk.CellRendererText ();
			
			use_x_profile_check.Sensitive = colormanagement_check.Active;
			
			display_combo.Sensitive = colormanagement_check.Active;
			display_combo.Model = new ProfileList ();                                                                                    
			display_combo.PackStart (desc_cell, false);
			display_combo.PackStart (name_cell, true);
			display_combo.SetCellDataFunc (name_cell, new CellLayoutDataFunc (ProfileList.ProfileNameDataFunc));
			//FIXME
			int it_ = 0;
			foreach (Cms.Profile profile in FSpot.ColorManagement.Profiles) {
				if (profile.ProductName == Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE))
					display_combo.Active = it_;
				it_++;
			}

			display_combo.Changed += HandleDisplayChanged;

			destination_combo.Sensitive = colormanagement_check.Active;
			destination_combo.Model = new ProfileList ();
			destination_combo.PackStart (desc_cell, false);
			destination_combo.PackStart (name_cell, true);
			destination_combo.SetCellDataFunc (name_cell, new CellLayoutDataFunc (ProfileList.ProfileNameDataFunc));
			destination_combo.Changed += HandleDestinationChanged;
			//FIXME
			it_ = 0;
			foreach (Cms.Profile profile in FSpot.ColorManagement.Profiles) {
				if (profile.ProductName ==  Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE))
					destination_combo.Active = it_;
				it_++;
			}

			TagMenu tagmenu = new TagMenu (null, MainWindow.Toplevel.Database.Tags);
	
			tagmenu.Populate (false);

			tag_button.Menu = tagmenu;
			tag_button.ShowAll ();
			tagselectionhbox.Add (tag_button);

			tagmenu.TagSelected += HandleTagMenuSelected;
			set_saver_button.Clicked += HandleUseFSpot;
			screensaverall_radio.Toggled += ToggleTagRadio;

			themenone_radio.Toggled += ToggleThemeRadio;
			themelist_combo = ComboBox.NewText ();
			theme_list = new Dictionary<string, string> ();
			string gtkrc = Path.Combine ("gtk-2.0", "gtkrc");
			string [] search = {Path.Combine (Global.HomeDirectory, ".themes"), "/usr/share/themes"};
			foreach (string path in search)
				if (Directory.Exists (path)) 
					foreach (string dir in Directory.GetDirectories (path))
						if (File.Exists (Path.Combine (dir, gtkrc)) && !theme_list.ContainsKey (Path.GetFileName (dir)))
							theme_list.Add (Path.GetFileName (dir), Path.Combine (dir, gtkrc));
			
			string active_theme = Preferences.Get<string> (Preferences.GTK_RC);
			int it = 0;
			foreach (string theme in theme_list.Keys) {
				themelist_combo.AppendText (Path.GetFileName (theme));
				if (active_theme.Contains (Path.DirectorySeparatorChar + Path.GetFileName (theme) + Path.DirectorySeparatorChar))
					themelist_combo.Active = it;
				it ++;
			}
			
			theme_table.Attach (themelist_combo, 2, 3, 0, 1);
			themelist_combo.Changed += HandleThemeComboChanged;
			themelist_combo.Show ();
			theme_filechooser.Visible = themefile_label.Visible = FSpot.Utils.Log.Debugging;

			themelist_combo.Sensitive = theme_filechooser.Sensitive = themecustom_radio.Active; 
			if (File.Exists (active_theme))
				theme_filechooser.SetFilename (Preferences.Get<string> (Preferences.GTK_RC));
			theme_filechooser.SelectionChanged += HandleThemeFileActivated;
			themecustom_radio.Active = (active_theme != String.Empty);	

#if GTK_2_12_2
			restartlabel.Visible = false;
#endif

#if DEBUGTHEMES
			refreshtheme_button = true;
#endif

			Preferences.SettingChanged += OnPreferencesChanged;
			this.Dialog.Destroyed += HandleDestroyed;
		}