f-spot r3867 - in trunk: . src
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r3867 - in trunk: . src
- Date: Mon, 5 May 2008 14:51:42 +0100 (BST)
Author: sdelcroix
Date: Mon May 5 13:51:41 2008
New Revision: 3867
URL: http://svn.gnome.org/viewvc/f-spot?rev=3867&view=rev
Log:
2008-05-05 Stephane Delcroix <sdelcroix novell com>
* src/f-spot.glade:
* src/PreferenceDialog.cs:
* src/main.cs:
* src/Preferences.cs: add a preference for loading a custom theme from a
gtkrc file. No theme list yet. Restart needed.
Modified:
trunk/ChangeLog
trunk/src/PreferenceDialog.cs
trunk/src/Preferences.cs
trunk/src/f-spot.glade
trunk/src/main.cs
Modified: trunk/src/PreferenceDialog.cs
==============================================================================
--- trunk/src/PreferenceDialog.cs (original)
+++ trunk/src/PreferenceDialog.cs Mon May 5 13:51:41 2008
@@ -1,8 +1,18 @@
+/*
+ * FSpot.UI.Dialog.PreferenceDialog.cs
+ *
+ * Authors(s):
+ * Larry Ewing <lewing novell com>
+ * Stephane Delcroix <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ */
+
using System;
using Gtk;
-using Cms;
-namespace FSpot {
+namespace FSpot.UI.Dialog {
+#if FALSE
public class ProfileList : TreeStore {
public ProfileList () : base (typeof (Profile))
{
@@ -22,17 +32,27 @@
(renderer as Gtk.CellRendererText).Text = profile.ProductDescription;
}
}
-
+#endif
public class PreferenceDialog : GladeDialog {
[Glade.Widget] private CheckButton metadata_check;
+#if FALSE
[Glade.Widget] private ComboBox display_combo;
[Glade.Widget] private ComboBox destination_combo;
+#endif
[Glade.Widget] private OptionMenu tag_option;
[Glade.Widget] private Button set_saver_button;
[Glade.Widget] private FileChooserButton photosdir_chooser;
[Glade.Widget] private RadioButton screensaverall_radio;
[Glade.Widget] private RadioButton screensavertagged_radio;
[Glade.Widget] private CheckButton dbus_check;
+ [Glade.Widget] private RadioButton themenone_radio;
+ [Glade.Widget] private RadioButton themecustom_radio;
+ [Glade.Widget] private ComboBox themelist_combo;
+ [Glade.Widget] private Label themelist_label;
+ [Glade.Widget] private FileChooserButton theme_filechooser;
+
+
+
private static PreferenceDialog prefs = null;
int screensaver_tag;
private const string SaverCommand = "screensavers-f-spot-screensaver";
@@ -55,6 +75,7 @@
Gtk.CellRendererText name_cell = new Gtk.CellRendererText ();
Gtk.CellRendererText desc_cell = new Gtk.CellRendererText ();
+#if FALSE
display_combo.Model = new ProfileList ();
display_combo.PackStart (desc_cell, false);
display_combo.PackStart (name_cell, true);
@@ -68,7 +89,7 @@
destination_combo.SetCellDataFunc (name_cell, new CellLayoutDataFunc (ProfileList.ProfileNameDataFunc));
destination_combo.SetCellDataFunc (desc_cell, new CellLayoutDataFunc (ProfileList.ProfileDescriptionDataFunc));
destination_combo.Changed += HandleDisplayChanged;
-
+#endif
Tag t = MainWindow.Toplevel.Database.Tags.GetTagById (screensaver_tag);
TagMenu tagmenu = new TagMenu (null, MainWindow.Toplevel.Database.Tags);
@@ -83,10 +104,19 @@
set_saver_button.Clicked += HandleUseFSpot;
screensaverall_radio.Toggled += ToggleTagRadio;
+ themenone_radio.Toggled += ToggleThemeRadio;
+ themelist_combo.Sensitive = theme_filechooser.Sensitive = themecustom_radio.Active;
+ if (System.IO.File.Exists (Preferences.Get (Preferences.GTK_RC) as string))
+ theme_filechooser.SetFilename (Preferences.Get (Preferences.GTK_RC) as string);
+ theme_filechooser.SelectionChanged += HandleThemeFileActivated;
+ themecustom_radio.Active = (Preferences.Get (Preferences.GTK_RC) as string != String.Empty);
+ themelist_label.Visible = themelist_combo.Visible = false;
+
Preferences.SettingChanged += OnPreferencesChanged;
this.Dialog.Destroyed += HandleDestroyed;
}
+#if FALSE
private void HandleDisplayChanged (object sender, System.EventArgs args)
{
TreeIter iter;
@@ -100,7 +130,7 @@
if (destination_combo.GetActiveIter (out iter))
FSpot.Global.DestinationProfile = (Profile) destination_combo.Model.GetValue (iter, 0);
}
-
+#endif
private void HandleTagMenuSelected (Tag t)
{
screensaver_tag = (int) t.Id;
@@ -122,6 +152,22 @@
HandleTagMenuSelected (((tag_option.Menu as Menu).Active as TagMenu.TagMenuItem).Value);
}
+ void ToggleThemeRadio (object o, EventArgs e)
+ {
+ themelist_combo.Sensitive = theme_filechooser.Sensitive = themecustom_radio.Active;
+ if (themenone_radio.Active) {
+ Preferences.Set (Preferences.GTK_RC, String.Empty);
+ //Gtk.Rc.DefaultFiles = String.Empty;
+ //Gtk.Rc.ReparseAll ();
+ }
+ }
+
+ void HandleThemeFileActivated (object o, EventArgs e)
+ {
+ if (theme_filechooser.Filename != null && theme_filechooser.Filename != Preferences.Get (Preferences.GTK_RC))
+ Preferences.Set (Preferences.GTK_RC, theme_filechooser.Filename);
+ }
+
void OnPreferencesChanged (object sender, NotifyEventArgs args)
{
LoadPreference (args.Key);
@@ -186,6 +232,11 @@
case Preferences.DBUS_READ_ONLY:
dbus_check.Active = !((bool)val);
break;
+ case Preferences.GTK_RC:
+ themenone_radio.Active = (val as string == String.Empty);
+ themecustom_radio.Active = (val as string != String.Empty);
+ theme_filechooser.SetFilename (val as string);
+ break;
}
}
Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs (original)
+++ trunk/src/Preferences.cs Mon May 5 13:51:41 2008
@@ -11,8 +11,9 @@
public const string APP_FSPOT_EXPORT = APP_FSPOT + "export/";
public const string APP_FSPOT_EXPORT_TOKENS = APP_FSPOT_EXPORT + "tokens/";
- public const string MAIN_WINDOW_MAXIMIZED = "/apps/f-spot/ui/maximized";
+ public const string GTK_RC = "/apps/f-spot/ui/gtkrc";
+ public const string MAIN_WINDOW_MAXIMIZED = "/apps/f-spot/ui/maximized";
public const string MAIN_WINDOW_X = "/apps/f-spot/ui/main_window_x";
public const string MAIN_WINDOW_Y = "/apps/f-spot/ui/main_window_y";
public const string MAIN_WINDOW_WIDTH = "/apps/f-spot/ui/main_window_width";
@@ -175,6 +176,7 @@
return 0;
case PROXY_USER:
case PROXY_PASSWORD:
+ case GTK_RC:
return String.Empty;
default:
return null;
@@ -190,14 +192,11 @@
try {
val = Backend.Get (key);
- cache.Add (key, val);
} catch (NoSuchKeyException) {
val = GetDefault (key);
-
- if (val != null)
- Set (key, val);
}
-
+
+ cache.Add (key, val);
return val;
}
}
@@ -208,8 +207,9 @@
try {
cache [key] = value;
Backend.Set (key, value);
- } catch {
- Console.WriteLine ("Unable to write this gconf key :"+key);
+ } catch (Exception e){
+ Console.WriteLine (e);
+ Console.WriteLine ("Unable to set this :"+key);
}
}
}
Modified: trunk/src/f-spot.glade
==============================================================================
--- trunk/src/f-spot.glade (original)
+++ trunk/src/f-spot.glade Mon May 5 13:51:41 2008
@@ -6621,6 +6621,139 @@
</packing>
</child>
<child>
+ <widget class="GtkFrame" id="frame9">
+ <property name="visible">True</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment13">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkRadioButton" id="themenone_radio">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">System Theme</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="themecustom_radio">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Custom Theme</property>
+ <property name="yalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">themenone_radio</property>
+ </widget>
+ <packing>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"> From gtkrc File :</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="themelist_label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"> From List :</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="theme_filechooser">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Select A gtkrc File</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="themelist_combo">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">12</property>
+ <property name="label" translatable="yes"><small><i>You'll have to restart f-spot to load the new theme.</i></small></property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">12</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Theming</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
</widget>
Modified: trunk/src/main.cs
==============================================================================
--- trunk/src/main.cs (original)
+++ trunk/src/main.cs Mon May 5 13:51:41 2008
@@ -211,6 +211,9 @@
if (control == null && create) {
create = false;
Gnome.Vfs.Vfs.Initialize ();
+
+ if (File.Exists (Preferences.Get (Preferences.GTK_RC) as string))
+ Gtk.Rc.AddDefaultFile (Preferences.Get (Preferences.GTK_RC) as string);
Catalog.Init ("f-spot", Defines.LOCALE_DIR);
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]