/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/app.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:
5
5
 * in the file lgpl-3.0.txt in the root of this project.
6
6
 */
7
7
 
8
 
 
9
 
const Gettext = imports.gettext;
 
8
const cairo = imports.gi.cairo;
10
9
const Gio = imports.gi.Gio;
11
10
const GLib = imports.gi.GLib;
12
11
const GObject = imports.gi.GObject;
13
12
const Gtk = imports.gi.Gtk;
 
13
const Lang = imports.lang;
14
14
const _ = imports.gettext.gettext;
15
 
const Lang = imports.lang;
 
15
 
16
16
 
17
17
const SettingsData = imports.settings_data;
18
18
/* const Style = imports.style; */
19
19
const PreferencesUI = imports.preferences_ui;
20
 
const UserMenu = imports.user_menu;
21
20
 
22
21
const Application = new Lang.Class ({
23
22
  Name: "Application",
26
25
  _init: function () {
27
26
    this.settings = SettingsData.get_settings ();
28
27
    
29
 
    Gettext.bindtextdomain ("gpump", "./locale/"); //FIXME
30
 
    Gettext.textdomain ("gpump");
31
 
    GLib.set_prgname ("gpump");
32
 
    
33
28
    this.parent ({
34
29
      application_id: "org.gego.gpump",
35
30
      flags: Gio.ApplicationFlags.FLAGS_NONE,
36
31
      register_session: true,
37
32
    });
38
 
    GLib.set_application_name (_("GPump"));
 
33
   GLib.set_application_name (_("GPump"));
39
34
    
40
35
  },
41
36
  
74
69
    
75
70
    this.window.set_titlebar ((this.headerbar = new Gtk.HeaderBar({
76
71
      title: GLib.get_application_name (),
77
 
      subtitle: _("A Pump.io client"),
 
72
      subtitle: _('A Pump.io client'),
78
73
      show_close_button: true
79
74
    })));
80
75
    
81
76
    if (!(this.settings.get_setting ("ui.x").data < 0 &&
82
77
        this.settings.get_setting ("ui.y").data < 0)){
83
 
      this.window.move (this.settings.get_setting ("ui.x").data,
84
 
                                       this.settings.get_setting ("ui.y").data);
 
78
      this.window.move (this.settings.get_setting ("ui.x").data, this.settings.get_setting ("ui.y").data);
85
79
    }
86
80
    
87
 
    var gtk_settings = Gtk.Settings.get_default ();
88
 
      if ( this.settings.get_setting ("main.use_dark").data ) {
89
 
        gtk_settings["gtk_application_prefer_dark_theme"] = true;
90
 
      } else {
91
 
        gtk_settings["gtk_application_prefer_dark_theme"] = false;
92
 
      }
93
 
    
94
81
    print ("derp!\n");
95
82
    
96
83
    this.window.add (( this.scroll_view = new Gtk.ScrolledWindow () ));
110
97
    let menu = new Gio.Menu ();
111
98
    let section = new Gio.Menu ();
112
99
    
113
 
    section.append (_("Preferences"), "app.preferences");
 
100
    section.append ("Preferences", "app.preferences");
114
101
    menu.append_section (null, section);
115
102
    
116
103
    section = new Gio.Menu ();
123
110
    let about_action = new Gio.SimpleAction ({name: "about"});
124
111
    about_action.connect ('activate', Lang.bind (this, function () {
125
112
      let about_dialog = new Gtk.AboutDialog ({use_header_bar: true,
126
 
        transient_for: this.window,
127
 
        modal: true,
128
 
        version: "pre-alpha ~BZR~",
129
 
        program_name: GLib.get_application_name (),
130
 
        copyright: "Gustav \'Gego/XAREN\' Hartvigsson, 2014",
131
 
        license_type: Gtk.License.LGPL_3_0});
 
113
                                               transient_for: this.window,
 
114
                                               modal: true,
 
115
                                               version: "pre-alpha ~BZR~",
 
116
                                     program_name: GLib.get_application_name (),
 
117
                                 copyright: "Gustav \'Gego/XAREN\' Hartvigsson, 2014",
 
118
                                           license_type: Gtk.License.LGPL_3_0});
132
119
      
133
 
      about_dialog.authors =
134
 
                          ["Gustav Hartvigsson <gustav.hartvigsson@gmail.com>"];
 
120
      about_dialog.authors = ["Gustav Hartvigsson <gustav.hartvigsson@gmail.com>"];
135
121
      about_dialog.connect ("response", function () {
136
122
        about_dialog.destroy ();
137
123
      });
138
124
      about_dialog.run ();
139
 
    }));
 
125
    }))
140
126
    this.add_action (about_action);
141
127
    
142
128
    let quit_action = new Gio.SimpleAction ({name: "quit"});
159
145
      pref_dialog.set_transient_for (this.window);
160
146
      pref_dialog.run ();
161
147
    }));
162
 
    this.add_action (preferences_action);
 
148
    this.add_action (preferences_action)
163
149
  },
164
150
  
165
151
  /**
169
155
  _prepare_header_bar: function () {
170
156
    this.headerbar.pack_start ((this.new_post_btn = new Gtk.Button ({
171
157
      image: (new Gtk.Image ({icon_name: 'text-editor-symbolic'})),
172
 
      tooltip_text: _("Create new post")
 
158
      tooltip_text: _('Create new post')
173
159
    })));
174
160
    
175
161
    this.headerbar.pack_start ((this.refresh_btn = new Gtk.Button({
176
162
      image: (new Gtk.Image ({icon_name: 'emblem-synchronizing-symbolic'})),
177
 
      tooltip_text: _("Refresh the stream")
 
163
      tooltip_text: _('Refresh the stream')
178
164
    })));
179
165
    
180
 
    this.headerbar.pack_end ((this.user_menu_btn = new Gtk.MenuButton ({
 
166
    this.headerbar.pack_end ((this.user_menu_btn = new Gtk.Button ({
181
167
      image: (new Gtk.Image ({icon_name: 'emblem-system-symbolic'})),
182
 
      tooltip_text: _("Switch and manage users"),
183
 
      popover: (this.user_menu = new UserMenu.UserMenu ()),
 
168
      tooltip_text: _('Switch and manage users')
184
169
    })));
185
 
    
186
170
  }
187
171
  
188
172
});