[rygel] ui: Tracker options to share type of media



commit c78b83fb7e3403862d1fc532e969140d651bac34
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jun 12 18:23:02 2009 +0300

    ui: Tracker options to share type of media
    
    Add options under Tracker plugin that allows user to select which type
    of items he wants to share: videos, music and/or pictures.

 data/rygel-preferences.ui              |   90 ++++++++++++++++++++++++++------
 src/ui/Makefile.am                     |    7 ++-
 src/ui/rygel-preferences-dialog.vala   |    5 +-
 src/ui/rygel-tracker-pref-section.vala |   78 +++++++++++++++++++++++++++
 4 files changed, 159 insertions(+), 21 deletions(-)
---
diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui
index 4621f04..aef38e9 100644
--- a/data/rygel-preferences.ui
+++ b/data/rygel-preferences.ui
@@ -240,7 +240,7 @@
                 <child>
                   <object class="GtkTable" id="table4">
                     <property name="visible">True</property>
-                    <property name="n_rows">7</property>
+                    <property name="n_rows">10</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">6</property>
                     <property name="row_spacing">6</property>
@@ -278,8 +278,8 @@
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
                       </packing>
                     </child>
                     <child>
@@ -291,8 +291,8 @@
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
                       </packing>
                     </child>
                     <child>
@@ -322,8 +322,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
                       </packing>
                     </child>
                     <child>
@@ -336,8 +336,8 @@
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">5</property>
-                        <property name="bottom_attach">6</property>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
                       </packing>
                     </child>
                     <child>
@@ -349,8 +349,8 @@
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
+                        <property name="top_attach">9</property>
+                        <property name="bottom_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -365,8 +365,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
+                        <property name="top_attach">9</property>
+                        <property name="bottom_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -379,8 +379,8 @@
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
                       </packing>
                     </child>
                     <child>
@@ -455,8 +455,57 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="share-videos-checkbutton">
+                        <property name="label" translatable="yes">Share _Videos</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="share-music-checkbutton">
+                        <property name="label" translatable="yes">Share M_usic</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0.54000002145767212</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="share-pictures-checkbutton">
+                        <property name="label" translatable="yes">Share _Pictures</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
                         <property name="top_attach">4</property>
                         <property name="bottom_attach">5</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
                       </packing>
                     </child>
                     <child>
@@ -468,6 +517,15 @@
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                 </child>
               </object>
@@ -540,9 +598,9 @@
     <property name="type_hint">dialog</property>
     <property name="transient_for">preferences-dialog</property>
     <property name="has_separator">False</property>
-    <property name="select_multiple">True</property>
     <property name="local_only">False</property>
     <property name="action">select-folder</property>
+    <property name="select_multiple">True</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index e33f02c..de37c0c 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -24,7 +24,8 @@ BUILT_SOURCES = rygel-preferences-dialog.c \
 		rygel-preferences-section.c \
 		rygel-general-pref-section.c \
 		rygel-plugin-pref-section.c \
-		rygel-media-export-pref-section.c
+		rygel-media-export-pref-section.c \
+		rygel-tracker-pref-section.c
 
 $(BUILT_SOURCES) : rygel.stamp
 
@@ -37,7 +38,9 @@ rygel_preferences_SOURCES = rygel-preferences-dialog.c \
 			    rygel-plugin-pref-section.c \
 			    rygel-plugin-pref-section.vala \
 			    rygel-media-export-pref-section.c \
-			    rygel-media-export-pref-section.vala
+			    rygel-media-export-pref-section.vala \
+			    rygel-tracker-pref-section.c \
+			    rygel-tracker-pref-section.vala
 
 rygel.stamp: $(filter %.vala,$(rygel_preferences_SOURCES))
 	$(VALAC) -C --vapidir=$(rygeldir) \
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index fa66dfa..adc49d2 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -44,9 +44,8 @@ public class Rygel.PreferencesDialog : GLib.Object {
 
         this.sections = new ArrayList<PreferencesSection> ();
         this.sections.add (new GeneralPrefSection (this.builder, config));
-        this.sections.add (new PluginPrefSection (this.builder,
-                                                  config,
-                                                  "Tracker"));
+        this.sections.add (new TrackerPrefSection (this.builder,
+                                                   config));
         this.sections.add (new PluginPrefSection (this.builder,
                                                   config,
                                                   "DVB"));
diff --git a/src/ui/rygel-tracker-pref-section.vala b/src/ui/rygel-tracker-pref-section.vala
new file mode 100644
index 0000000..c729ed7
--- /dev/null
+++ b/src/ui/rygel-tracker-pref-section.vala
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ *                               <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+using Gtk;
+using Gee;
+
+public class Rygel.TrackerPrefSection : Rygel.PluginPrefSection {
+    const string NAME = "Tracker";
+    const string VIDEOS_KEY = "share-videos";
+    const string MUSIC_KEY = "share-music";
+    const string PICTURES_KEY = "share-pictures";
+    const string TAG_KEY = "share-tagged";
+    const string VIDEOS_CHECK = VIDEOS_KEY + "-checkbutton";
+    const string MUSIC_CHECK = MUSIC_KEY + "-checkbutton";
+    const string PICTURES_CHECK = PICTURES_KEY + "-checkbutton";
+
+    private CheckButton videos_check;
+    private CheckButton music_check;
+    private CheckButton pictures_check;
+
+    public TrackerPrefSection (Builder builder, UserConfig config) {
+        base (builder, config, NAME);
+
+        this.videos_check = (CheckButton) builder.get_object (VIDEOS_CHECK);
+        assert (this.videos_check != null);
+        this.music_check = (CheckButton) builder.get_object (MUSIC_CHECK);
+        assert (this.music_check != null);
+        this.pictures_check = (CheckButton) builder.get_object (PICTURES_CHECK);
+        assert (this.pictures_check != null);
+
+        this.videos_check.active = true;
+        this.music_check.active = true;
+        this.pictures_check.active = true;
+
+        try {
+            this.videos_check.active = config.get_bool (this.name, VIDEOS_KEY);
+            this.music_check.active = config.get_bool (this.name, MUSIC_KEY);
+            this.pictures_check.active = config.get_bool (this.name,
+                                                          PICTURES_KEY);
+        } catch (Error err) {}
+    }
+
+    public override void save () {
+        base.save ();
+
+        config.set_bool (this.name, VIDEOS_KEY, this.videos_check.active);
+        config.set_bool (this.name, MUSIC_KEY, this.music_check.active);
+        config.set_bool (this.name, PICTURES_KEY, this.pictures_check.active);
+    }
+
+    protected override void on_enabled_check_toggled (
+                                        CheckButton enabled_check) {
+        base.on_enabled_check_toggled (enabled_check);
+
+        this.videos_check.sensitive = enabled_check.active;
+        this.music_check.sensitive = enabled_check.active;
+        this.pictures_check.sensitive = enabled_check.active;
+    }
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]