[gnote] Add option to autosize note window



commit 15e1544998f40540a949a64257e0943c68fadd28
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jun 1 00:56:38 2014 +0300

    Add option to autosize note window
    
    Fixes Bug 709699.

 data/org.gnome.gnote.gschema.xml.in |    5 +++++
 src/notewindow.cpp                  |    3 +++
 src/preferences.cpp                 |    3 ++-
 src/preferences.hpp                 |    3 ++-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.gnote.gschema.xml.in b/data/org.gnome.gnote.gschema.xml.in
index eab1feb..1898eae 100644
--- a/data/org.gnome.gnote.gschema.xml.in
+++ b/data/org.gnome.gnote.gschema.xml.in
@@ -130,6 +130,11 @@
       <_summary>Open notes in new window</_summary>
       <_description>Open notes in new window instead of replacing active content of the same 
window</_description>
     </key>
+    <key name="autosize-note-window" type="b">
+      <default>true</default>
+      <_summary>Save note window size and autosize note window to it</_summary>
+      <_description>Saves note window size and automatically resizes main window to this size, when note is 
opened.</_description>
+    </key>
     <child name="global-keybindings" schema="org.gnome.gnote.global-keybindings" />
     <child name="export-html" schema="org.gnome.gnote.export-html" />
     <child name="sync" schema="org.gnome.gnote.sync" />
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index d8f8080..07afe78 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -204,8 +204,11 @@ namespace gnote {
 
   void NoteWindow::hint_size(int & width, int & height)
   {
+    if (Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(
+          Preferences::AUTOSIZE_NOTE_WINDOW)) {
     width = m_width;
     height = m_height;
+    }
   }
 
   void NoteWindow::size_internals()
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 2b02682..40cf028 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2013 Aurimas Cernius
+ * Copyright (C) 2011-2014 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -63,6 +63,7 @@ namespace gnote {
   const char * Preferences::NOTE_RENAME_BEHAVIOR = "note-rename-behavior";
   const char * Preferences::USE_STATUS_ICON = "use-status-icon";
   const char * Preferences::OPEN_NOTES_IN_NEW_WINDOW = "open-notes-in-new-window";
+  const char * Preferences::AUTOSIZE_NOTE_WINDOW = "autosize-note-window";
 
   const char * Preferences::MAIN_WINDOW_MAXIMIZED = "main-window-maximized";
   const char * Preferences::SEARCH_WINDOW_WIDTH = "search-window-width";
diff --git a/src/preferences.hpp b/src/preferences.hpp
index eca9843..2f6994f 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2013 Aurimas Cernius
+ * Copyright (C) 2011-2014 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -61,6 +61,7 @@ namespace gnote {
     static const char *NOTE_RENAME_BEHAVIOR;
     static const char *USE_STATUS_ICON;
     static const char *OPEN_NOTES_IN_NEW_WINDOW;
+    static const char *AUTOSIZE_NOTE_WINDOW;
 
     static const char *MAIN_WINDOW_MAXIMIZED;
     static const char *SEARCH_WINDOW_WIDTH;


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