/gpump/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/gpump/trunk

« back to all changes in this revision

Viewing changes to src/preferences_ui.js

  • Committer: Gustav Hartvigsson
  • Date: 2014-06-13 21:51:09 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140613215109-1o4421hhbm8ztbei
* Changes a thing in the about dialoug.
* Changed the style of the close button in the prefs dialoug.
* Added, for future use, style.js...

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 */
7
7
 
8
8
const Gtk = imports.gi.Gtk;
 
9
const Lang = imports.lang;
9
10
const _ = imports.gettext.gettext;
10
 
const Lang = imports.lang;
11
11
 
12
12
const SettingsData = imports.settings_data;
13
13
 
19
19
    this.parent ({
20
20
      use_header_bar: true,
21
21
      modal: true,
22
 
      title: _("GPump preferences"),
23
 
      width_request: 550,
24
 
      height_request: 300
 
22
      title: _("GPump preferences")
25
23
    });
26
24
    
27
25
    this._prepare_header_bar ();
54
52
    /*this.get_content_area ().pack_start ()),
55
53
                                         true, true, 25);*/
56
54
    this.get_content_area ().set_center_widget (
57
 
      (this.layout = new Gtk.Box ({
58
 
        orientation: Gtk.Orientation.VERTICAL,
59
 
        spacing: 8,
60
 
        border_width: 8,
61
 
        margin: 50
62
 
      }))
63
 
    );
64
 
    
65
 
    
66
 
    this.layout.pack_start (
67
 
      new Gtk.Frame ({child:
68
 
        (this.list_box = new Gtk.ListBox ({
69
 
          width_request: 400,
70
 
          selection_mode: Gtk.SelectionMode.NONE,
71
 
          expand: false
72
 
        })),
73
 
        expand: false
74
 
      }),
75
 
      true,
76
 
      true,
77
 
      null
78
 
    );
 
55
                                          (this.list_box = new Gtk.ListBox ({
 
56
      width_request: 400,
 
57
      margin: 50,
 
58
      selection_mode: Gtk.SelectionMode.NONE
 
59
    })));
79
60
    
80
61
    let settings_object = SettingsData.get_settings ();
81
62
    
101
82
      settings_object.get_setting("main.use_dark").data
102
83
    );
103
84
    
104
 
    this.use_dark_switch.connect("notify::active",
105
 
                                                  Lang.bind (this, function () {
106
 
      var settings = Gtk.Settings.get_default ();
107
 
      var app_settings = SettingsData.get_settings ();
108
 
      if ( this.use_dark_switch.get_active () ) {
109
 
        settings["gtk_application_prefer_dark_theme"] = true;
110
 
        app_settings.set_setting ("main.use_dark", true);
111
 
      } else {
112
 
        settings["gtk_application_prefer_dark_theme"] = false;
113
 
        app_settings.set_setting ("main.use_dark", false);
114
 
      }
115
 
    }));
116
 
    
117
 
    this.use_dark_reset.connect ("clicked", Lang.bind (this,
118
 
                                                   this._reset_use_dark_theme));
119
 
    
120
85
    /*************************** Privacy settings *****************************/
121
86
    this.list_box.add ((new Gtk.Label ({label: _("Privacy settings")})));
122
87
    
168
133
    //this.list_box.add ((new Gtk.Label ()));
169
134
    
170
135
    /* Reset all settings */
171
 
    this.layout.pack_end (
172
 
      (this.reset_all_btn = new Gtk.Button ({
173
 
        label: _("Reset all settings")
174
 
      })),
175
 
      false,
176
 
      false,
177
 
      null
178
 
    );
179
 
    
180
 
    this.reset_all_btn.connect ("clicked", Lang.bind(this, this._reset_all));
181
 
  },
182
 
  
183
 
  _reset_all: function () {
184
 
    this._reset_use_dark_theme ();
185
 
  },
186
 
  
187
 
  _reset_use_dark_theme: function () {
188
 
    /* If the switch is active */
189
 
    if ((this.use_dark_switch.get_active ())) {
190
 
      this.use_dark_switch.set_active (false);
191
 
    }
192
 
    /* else we do nothing */
 
136
    this.list_box.add ((this.reset_all_btn = new Gtk.Button ({
 
137
      label: _("Reset all settings"),
 
138
      margin_left: 50,
 
139
      margin_right: 50,
 
140
      margin_top: 20
 
141
    })));
193
142
  }
194
143
  
 
144
  
195
145
});