[gnote] Do not save window position
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not save window position
- Date: Mon, 24 Jun 2013 16:41:18 +0000 (UTC)
commit 752770daec6bf55cf7b84636278d762ec763ce54
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Jun 24 19:38:31 2013 +0300
Do not save window position
Leave window position to window management.
data/org.gnome.gnote.gschema.xml.in | 10 ----------
src/note.cpp | 30 +-----------------------------
src/note.hpp | 20 +-------------------
src/notewindow.cpp | 17 +++--------------
src/notewindow.hpp | 8 --------
src/preferences.cpp | 2 --
src/preferences.hpp | 2 --
src/searchnoteswidget.cpp | 13 -------------
src/searchnoteswidget.hpp | 1 -
9 files changed, 5 insertions(+), 98 deletions(-)
---
diff --git a/data/org.gnome.gnote.gschema.xml.in b/data/org.gnome.gnote.gschema.xml.in
index c0fce03..28b0717 100644
--- a/data/org.gnome.gnote.gschema.xml.in
+++ b/data/org.gnome.gnote.gschema.xml.in
@@ -65,16 +65,6 @@
<_summary>Saved width of Search window</_summary>
<_description>Determines pixel width of Search window; stored on Gnote exit.</_description>
</key>
- <key name="search-window-x-pos" type="i">
- <default>0</default>
- <_summary>Saved horizontal position of Search window</_summary>
- <_description>Determines X coordinate of Search window; stored on Gnote exit.</_description>
- </key>
- <key name="search-window-y-pos" type="i">
- <default>0</default>
- <_summary>Saved vertical position of Search window</_summary>
- <_description>Determines Y coordinate of Search window; stored on Gnote exit.</_description>
- </key>
<key name="search-window-splitter-pos" type="i">
<default>150</default>
<_summary>Saved splitter position of Search window splitter.</_summary>
diff --git a/src/note.cpp b/src/note.cpp
index 479f98d..44e84f9 100644
--- a/src/note.cpp
+++ b/src/note.cpp
@@ -135,30 +135,19 @@ namespace gnote {
, m_selection_bound_pos(s_noPosition)
, m_width(0)
, m_height(0)
- , m_x(s_noPosition)
- , m_y(s_noPosition)
{
}
- void NoteData::set_position_extent(int _x, int _y, int _width, int _height)
+ void NoteData::set_extent(int _width, int _height)
{
- if (_x < 0 || _y < 0)
- return;
if (_width <= 0 || _height <= 0)
return;
- m_x = _x;
- m_y = _y;
m_width = _width;
m_height = _height;
}
- bool NoteData::has_position()
- {
- return (m_x != s_noPosition) && (m_y != s_noPosition);
- }
-
bool NoteData::has_extent()
{
return (m_width != 0) && (m_height != 0);
@@ -1023,9 +1012,6 @@ namespace gnote {
if(m_data.data().has_extent()) {
m_window->set_size(m_data.data().width(), m_data.data().height());
}
- if(m_data.data().has_position()) {
- m_window->set_position(m_data.data().x(), m_data.data().y());
- }
m_window->signal_embedded.connect(sigc::mem_fun(*this, &Note::on_note_window_embedded));
}
@@ -1204,12 +1190,6 @@ namespace gnote {
else if(name == "height") {
note->height() = boost::lexical_cast<int>(xml.read_string());
}
- else if(name == "x") {
- note->x() = boost::lexical_cast<int>(xml.read_string());
- }
- else if(name == "y") {
- note->y() = boost::lexical_cast<int>(xml.read_string());
- }
else if(name == "tags") {
xmlDocPtr doc2 = xmlParseDoc((const xmlChar*)xml.read_outer_xml().c_str());
@@ -1349,14 +1329,6 @@ namespace gnote {
xml.write_string(boost::lexical_cast<std::string>(note.height()));
xml.write_end_element();
- xml.write_start_element("", "x", "");
- xml.write_string (boost::lexical_cast<std::string>(note.x()));
- xml.write_end_element();
-
- xml.write_start_element ("", "y", "");
- xml.write_string (boost::lexical_cast<std::string>(note.y()));
- xml.write_end_element();
-
if (note.tags().size() > 0) {
xml.write_start_element ("", "tags", "");
for(NoteData::TagMap::const_iterator iter = note.tags().begin();
diff --git a/src/note.hpp b/src/note.hpp
index b515845..39b7c2e 100644
--- a/src/note.hpp
+++ b/src/note.hpp
@@ -137,22 +137,6 @@ public:
{
return m_height;
}
- int x() const
- {
- return m_x;
- }
- int & x()
- {
- return m_x;
- }
- int y() const
- {
- return m_y;
- }
- int & y()
- {
- return m_y;
- }
const TagMap & tags() const
{
return m_tags;
@@ -162,8 +146,7 @@ public:
return m_tags;
}
- void set_position_extent(int x, int y, int width, int height);
- bool has_position();
+ void set_extent(int width, int height);
bool has_extent();
private:
@@ -176,7 +159,6 @@ private:
int m_cursor_pos;
int m_selection_bound_pos;
int m_width, m_height;
- int m_x, m_y;
TagMap m_tags;
};
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 3efd680..436e91c 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -64,8 +64,6 @@ namespace gnote {
, m_name(note.get_title())
, m_height(360)
, m_width(450)
- , m_x(-1)
- , m_y(-1)
, m_find_handler(note)
, m_global_keys(NULL)
{
@@ -160,14 +158,11 @@ namespace gnote {
remove_accel_group(*parent);
if(parent->get_window() != 0
&& (parent->get_window()->get_state() & Gdk::WINDOW_STATE_MAXIMIZED) == 0) {
- int cur_x, cur_y, cur_width, cur_height;
- parent->get_position(cur_x, cur_y);
+ int cur_width, cur_height;
parent->get_size(cur_width, cur_height);
- if(!(m_note.data().x() == cur_x && m_note.data().y() == cur_y
- && m_note.data().width() == cur_width
- && m_note.data().height() == cur_height)) {
- m_note.data().set_position_extent(cur_x, cur_y, cur_width, cur_height);
+ if(!(m_note.data().width() == cur_width && m_note.data().height() == cur_height)) {
+ m_note.data().set_extent(cur_width, cur_height);
m_width = cur_width;
m_height = cur_height;
@@ -177,12 +172,6 @@ namespace gnote {
}
}
- void NoteWindow::hint_position(int & x, int & y)
- {
- x = m_x;
- y = m_y;
- }
-
void NoteWindow::hint_size(int & width, int & height)
{
width = m_width;
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 9241aed..e9a78c8 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -143,7 +143,6 @@ public:
void set_name(const std::string & name);
virtual void foreground();
virtual void background();
- virtual void hint_position(int & x, int & y);
virtual void hint_size(int & width, int & height);
virtual void size_internals();
@@ -165,11 +164,6 @@ public:
m_width = width;
m_height = height;
}
- void set_position(int x, int y)
- {
- m_x = x;
- m_y = y;
- }
Gtk::TextView * editor() const
{
return m_editor;
@@ -219,8 +213,6 @@ private:
std::string m_name;
int m_height;
int m_width;
- int m_x;
- int m_y;
Glib::RefPtr<Gtk::AccelGroup> m_accel_group;
Gtk::Grid *m_embeddable_toolbar;
Gtk::Image *m_pin_image;
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 43347d0..1b7a1c0 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -63,8 +63,6 @@ namespace gnote {
const char * Preferences::OPEN_NOTES_IN_NEW_WINDOW = "open-notes-in-new-window";
const char * Preferences::MAIN_WINDOW_MAXIMIZED = "main-window-maximized";
- const char * Preferences::SEARCH_WINDOW_X_POS = "search-window-x-pos";
- const char * Preferences::SEARCH_WINDOW_Y_POS = "search-window-y-pos";
const char * Preferences::SEARCH_WINDOW_WIDTH = "search-window-width";
const char * Preferences::SEARCH_WINDOW_HEIGHT = "search-window-height";
const char * Preferences::SEARCH_WINDOW_SPLITTER_POS = "search-window-splitter-pos";
diff --git a/src/preferences.hpp b/src/preferences.hpp
index 49e245a..014228c 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -61,8 +61,6 @@ namespace gnote {
static const char *OPEN_NOTES_IN_NEW_WINDOW;
static const char *MAIN_WINDOW_MAXIMIZED;
- static const char *SEARCH_WINDOW_X_POS;
- static const char *SEARCH_WINDOW_Y_POS;
static const char *SEARCH_WINDOW_WIDTH;
static const char *SEARCH_WINDOW_HEIGHT;
static const char *SEARCH_WINDOW_SPLITTER_POS;
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index d2a4856..ceedfc7 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -256,8 +256,6 @@ Gtk::Widget *SearchNotesWidget::make_notebooks_pane()
void SearchNotesWidget::save_position()
{
- int x;
- int y;
int width;
int height;
@@ -275,11 +273,8 @@ void SearchNotesWidget::save_position()
return;
}
- window->get_position(x, y);
window->get_size(width, height);
- settings->set_int(Preferences::SEARCH_WINDOW_X_POS, x);
- settings->set_int(Preferences::SEARCH_WINDOW_Y_POS, y);
settings->set_int(Preferences::SEARCH_WINDOW_WIDTH, width);
settings->set_int(Preferences::SEARCH_WINDOW_HEIGHT, height);
}
@@ -1386,14 +1381,6 @@ void SearchNotesWidget::background()
}
}
-void SearchNotesWidget::hint_position(int & x, int & y)
-{
- Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
- .get_schema_settings(Preferences::SCHEMA_GNOTE);
- x = settings->get_int(Preferences::SEARCH_WINDOW_X_POS);
- y = settings->get_int(Preferences::SEARCH_WINDOW_Y_POS);
-}
-
void SearchNotesWidget::hint_size(int & width, int & height)
{
Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index 0e3cc7a..3c2c5fb 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -50,7 +50,6 @@ public:
virtual std::string get_name() const;
virtual void foreground();
virtual void background();
- virtual void hint_position(int & x, int & y);
virtual void hint_size(int & width, int & height);
virtual void size_internals();
virtual void perform_search(const std::string & search_text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]