summaryrefslogtreecommitdiff
path: root/stickynotes
diff options
context:
space:
mode:
authorCallum McKenzie <callum@spooky-possum.org>2009-04-29 21:18:31 +1200
committerCallum McKenzie <callum@spooky-possum.org>2009-04-29 21:18:31 +1200
commitaa1b99fe4d0b958e9ae61e6f8159395a339cff5f (patch)
treef69803df67308059aed81b6824fc68fd680fb877 /stickynotes
parent1c27452fd2c4b2f84ffe4a35f3c4b8fa2a517f47 (diff)
Prevent sticky notes getting too large
Patch from Dennis Hilmar to add a scroll bar when the note gets more than 80% of the screen size. See bug 121883.
Diffstat (limited to 'stickynotes')
-rw-r--r--stickynotes/ChangeLog9
-rw-r--r--stickynotes/stickynotes.c9
-rw-r--r--stickynotes/stickynotes.h1
-rw-r--r--stickynotes/stickynotes.ui17
-rw-r--r--stickynotes/stickynotes_applet.c3
-rw-r--r--stickynotes/stickynotes_applet.h1
6 files changed, 33 insertions, 7 deletions
diff --git a/stickynotes/ChangeLog b/stickynotes/ChangeLog
index 8eb14467e..4d4e517c9 100644
--- a/stickynotes/ChangeLog
+++ b/stickynotes/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-29 Callum McKenzie <callum@spooky-possum.org>
+
+ * stickynotes.ui:
+ * stickynotes_applet.c:
+ * stickynotes_applet.h:
+ * stickynotes.c:
+ * sticknotes.h: Patch from Dennis Hilmar to add scroll bars if the
+ note gets too large. (Bug: 121883)
+
2009-04-06 Callum McKenzie <callum@spooky-possum.org>
* stickynotes.glade:
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index bd7e9a9cc..fab5f8743 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -73,8 +73,12 @@ timeout_happened (gpointer data)
/* Called when a text buffer is changed. */
static void
-buffer_changed (GtkTextBuffer *buffer, gpointer data)
+buffer_changed (GtkTextBuffer *buffer, StickyNote *note)
{
+ if ( (note->h + note->y) > stickynotes->max_height )
+ gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW(note->w_scroller),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
/* When a buffer is changed, we set a 10 second timer. When
the timer triggers, we will save the buffer if there have
been no subsequent changes. */
@@ -106,6 +110,7 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
note->w_title = GTK_WIDGET (gtk_builder_get_object (builder, "title_label"));
note->w_body = GTK_WIDGET (gtk_builder_get_object (builder, "body_text"));
+ note->w_scroller = GTK_WIDGET (gtk_builder_get_object (builder, "body_scroller"));
note->w_lock = GTK_WIDGET (gtk_builder_get_object (builder, "lock_button"));
gtk_widget_add_events (note->w_lock, GDK_BUTTON_PRESS_MASK);
@@ -284,7 +289,7 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
g_signal_connect (gtk_text_view_get_buffer(GTK_TEXT_VIEW(note->w_body)),
"changed",
- G_CALLBACK (buffer_changed), NULL);
+ G_CALLBACK (buffer_changed), note);
return note;
}
diff --git a/stickynotes/stickynotes.h b/stickynotes/stickynotes.h
index bffe28a41..1339571d0 100644
--- a/stickynotes/stickynotes.h
+++ b/stickynotes/stickynotes.h
@@ -42,6 +42,7 @@ typedef struct
GtkWidget *w_title; /* Sticky Note title */
GtkWidget *w_body; /* Sticky Note text body */
+ GtkWidget *w_scroller; /* Sticky Note scroller */
GtkWidget *w_lock; /* Sticky Note lock button */
GtkWidget *w_close; /* Sticky Note close button */
GtkWidget *w_resize_se; /* Sticky Note resize button (south east) */
diff --git a/stickynotes/stickynotes.ui b/stickynotes/stickynotes.ui
index 2381bff97..06a99d129 100644
--- a/stickynotes/stickynotes.ui
+++ b/stickynotes/stickynotes.ui
@@ -731,13 +731,20 @@ This cannot be undone.</property>
</packing>
</child>
<child>
- <object class="GtkTextView" id="body_text">
+ <object class="GtkScrolledWindow" id="body_scroller">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="left_margin">4</property>
- <property name="right_margin">4</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <child>
+ <object class="GtkTextView" id="body_text">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="wrap_mode">GTK_WRAP_WORD</property>
+ <property name="left_margin">4</property>
+ <property name="right_margin">4</property>
+ </object>
+ </child>
</object>
<packing>
<property name="position">1</property>
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 45ca8df0d..5c275789a 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -163,6 +163,9 @@ stickynotes_applet_init (PanelApplet *panel_applet)
gconf_client_notify_add (stickynotes->gconf, GCONF_PATH "/settings",
(GConfClientNotifyFunc) preferences_apply_cb,
NULL, NULL, NULL);
+
+ /* Max height for large notes*/
+ stickynotes->max_height = 0.8*gdk_screen_get_height( gdk_screen_get_default() );
/* Load sticky notes */
stickynotes_load (gtk_widget_get_screen (GTK_WIDGET (panel_applet)));
diff --git a/stickynotes/stickynotes_applet.h b/stickynotes/stickynotes_applet.h
index 92a64283e..ddc2028ad 100644
--- a/stickynotes/stickynotes_applet.h
+++ b/stickynotes/stickynotes_applet.h
@@ -62,6 +62,7 @@ typedef struct
GConfClient *gconf; /* GConf Client */
+ gint max_height;
guint last_timeout_data;
gboolean visible; /* Toggle show/hide notes */