/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 11:43:17 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140613114317-b39077ndls9e8a4y
* added moar random information to the about dialoug.

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 ();
40
38
      label: _("close")
41
39
    })));
42
40
    
43
 
    /* Install a custom style */
44
 
    let special_btn_style_ctx = this.close_btn.get_style_context ();
45
 
    special_btn_style_ctx.add_class ("suggested-action");
46
 
    
47
41
    this.close_btn.connect ('clicked', Lang.bind (this, function () {
48
42
      this.destroy ();
49
43
    }));
54
48
    /*this.get_content_area ().pack_start ()),
55
49
                                         true, true, 25);*/
56
50
    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
 
    );
 
51
                                          (this.list_box = new Gtk.ListBox ({
 
52
      width_request: 400,
 
53
      margin: 50,
 
54
      selection_mode: Gtk.SelectionMode.NONE
 
55
    })));
79
56
    
80
57
    let settings_object = SettingsData.get_settings ();
81
58
    
101
78
      settings_object.get_setting("main.use_dark").data
102
79
    );
103
80
    
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
81
    /*************************** Privacy settings *****************************/
121
82
    this.list_box.add ((new Gtk.Label ({label: _("Privacy settings")})));
122
83
    
168
129
    //this.list_box.add ((new Gtk.Label ()));
169
130
    
170
131
    /* 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 */
 
132
    this.list_box.add ((this.reset_all_btn = new Gtk.Button ({
 
133
      label: _("Reset all settings"),
 
134
      margin_left: 50,
 
135
      margin_right: 50,
 
136
      margin_top: 20
 
137
    })));
193
138
  }
194
139
  
 
140
  
195
141
});