/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-12-02 21:02:12 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20141202210212-z7zgxamjnenwakcv
* Also: merged some branch local branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    let w_list = this.get_windows ();
50
50
    if (w_list.length) {
51
51
      w_list[0].present ();
52
 
      w_list[0].move (this.settings.get_setting ("ui.x").data,
53
 
                             this.settings.get_setting ("ui.y").data);
 
52
      if (!(this._is_shown ())) {
 
53
        if (!(this.settings.get_setting ("ui.x").data < 0 &&
 
54
            this.settings.get_setting ("ui.y").data < 0)){
 
55
          this.window.move (this.settings.get_setting ("ui.x").data,
 
56
                                           this.settings.get_setting ("ui.y").data);
 
57
        }
 
58
      }
54
59
      return;
55
60
    }
56
61
    
144
149
    /* * Hide the window so, so we can show it later */
145
150
    this.window.connect ('delete_event',
146
151
                         Lang.bind (this, function () {
147
 
      print ("balls to it!");
148
152
      this._save_settings ();
149
 
      this.window.hide ();
150
 
      /* To Prevent the widow from rely being destroyed? */
151
 
      return true;
 
153
      this.window.hide_on_delete ();
152
154
    }));
153
155
    
154
156
    this.add_window (this.window);
199
201
    
200
202
    let preferences_action = new Gio.SimpleAction ({name: "preferences"});
201
203
    preferences_action.connect ('activate', Lang.bind (this, function (){
202
 
      let pref_dialog = new PreferencesUI.PreferencesUI ({
203
 
        transient_for: this.window
204
 
      });
 
204
      let pref_dialog = new PreferencesUI.PreferencesUI ();
 
205
      pref_dialog.set_transient_for (this.window);
205
206
      pref_dialog.run ();
206
207
    }));
207
208
    this.add_action (preferences_action);
213
214
   */
214
215
  _prepare_header_bar: function () {
215
216
    
216
 
    this.headerbar.pack_start ((this.new_post_btn = new Gtk.Button ({
 
217
    let button_container = new Gtk.Box ({orientation: Gtk.Orientation.HORIZONTAL});
 
218
    
 
219
    button_container.pack_start ((this.new_post_btn = new Gtk.Button ({
217
220
      image: (new Gtk.Image ({icon_name: 'text-editor-symbolic'})),
218
221
      tooltip_text: _("Create new post"),
219
 
    })));
220
 
    
221
 
   this.new_post_btn.get_style_context ().add_class ("image-button");
222
 
    
223
 
    this.headerbar.pack_start ((this.refresh_btn = new Gtk.Button({
 
222
    })), false, false, null);
 
223
    
 
224
    button_container.pack_start ((this.refresh_btn = new Gtk.Button({
224
225
      image: (new Gtk.Image ({icon_name: 'emblem-synchronizing-symbolic'})),
225
226
      tooltip_text: _("Refresh the stream"),
226
 
    })));
227
 
    
228
 
    this.refresh_btn.get_style_context ().add_class ("image-button");
 
227
    })), false, false, null);
 
228
    
 
229
    let special_btn_container_style_ctx = button_container.get_style_context ();
 
230
    special_btn_container_style_ctx.add_class ("linked");
 
231
    
 
232
    this.headerbar.pack_start (button_container);
229
233
    
230
234
    this.headerbar.pack_end ((this.user_menu_btn = new UserButton.UserButton ({
231
235
      image: (new Gtk.Image ({icon_name: 'mail-send-symbolic'})),
244
248
    this.settings.set_setting ("ui.x", win_pos[0]);
245
249
    this.settings.set_setting ("ui.y", win_pos[1]);
246
250
    this.settings.commit_to_file ();
 
251
  },
 
252
  
 
253
  _is_shown: function () {
 
254
    let win_pos = this.window.get_position ();
 
255
    if (win_pos[0] == undefined || win_pos[1] == undefined) {
 
256
      return false;
 
257
    } else {
 
258
      return true;
 
259
    }
247
260
  }
248
261
  
249
262
});