diff --git a/stickynotes/org.mate.stickynotes.gschema.xml.in b/stickynotes/org.mate.stickynotes.gschema.xml.in
index eb5d3927e..d9da05246 100644
--- a/stickynotes/org.mate.stickynotes.gschema.xml.in
+++ b/stickynotes/org.mate.stickynotes.gschema.xml.in
@@ -65,5 +65,10 @@
Whether to ask for confirmation when deleting a note
Empty notes are always deleted without confirmation.
+
+ false
+ Whether to prevent note resizing on all notes
+ If this option is enabled, resizing is restricted on all notes.
+
diff --git a/stickynotes/sticky-notes-preferences.ui b/stickynotes/sticky-notes-preferences.ui
index 25ebfe33c..8b916f445 100644
--- a/stickynotes/sticky-notes-preferences.ui
+++ b/stickynotes/sticky-notes-preferences.ui
@@ -390,6 +390,23 @@
2
+
+
+
+ 0
+ 3
+ 2
+
+
False
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index 255fb677c..9bc487454 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -81,7 +81,7 @@ static void
buffer_changed (GtkTextBuffer *buffer,
StickyNote *note)
{
- if ( (note->h + note->y) > stickynotes->max_height )
+ if ( (note->h + note->y) > stickynotes->max_height && (!note->force_fixed_size) )
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (note->w_scroller),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -251,6 +251,8 @@ stickynote_new_aux (GdkScreen *screen,
stickynote_set_font (note, NULL, TRUE);
stickynote_set_locked (note, FALSE);
+ stickynote_set_fixed_size(note, stickynotes->force_fixed_size);
+
gtk_widget_realize (note->w_window);
/* Connect a popup menu to all buttons and title */
@@ -750,6 +752,46 @@ stickynote_set_visible (StickyNote *note,
}
}
+/* Set forced fixed size */
+void stickynote_set_fixed_size (StickyNote *note,
+ gboolean force_fixed_size)
+{
+ note->force_fixed_size = force_fixed_size;
+
+ if (force_fixed_size) {
+ gint w, h;
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (note->w_scroller),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW (note->w_body),
+ GTK_WRAP_CHAR);
+ gtk_widget_set_visible (note->w_resize_se, FALSE);
+ gtk_widget_set_visible (note->w_resize_sw, FALSE);
+ if (note->w == 0 || note->h == 0) {
+ w = g_settings_get_int (stickynotes->settings, "default-width");
+ h = g_settings_get_int (stickynotes->settings, "default-height");
+ }
+ else {
+ w = note->w;
+ h = note->h;
+ }
+ gtk_window_set_default_size (GTK_WINDOW (note->w_window), w, h);
+ gtk_window_resize (GTK_WINDOW (note->w_window), w, h);
+ gtk_window_set_resizable(GTK_WINDOW (note->w_window), FALSE);
+ }
+ else {
+ GtkScrollablePolicy vscroll_pol = GTK_POLICY_NEVER;
+ if ( (note->h + note->y) > stickynotes->max_height )
+ vscroll_pol = GTK_POLICY_AUTOMATIC;
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (note->w_scroller),
+ GTK_POLICY_NEVER, vscroll_pol);
+ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW (note->w_body),
+ GTK_WRAP_WORD);
+ gtk_widget_set_visible (note->w_resize_se, TRUE);
+ gtk_widget_set_visible (note->w_resize_sw, TRUE);
+ gtk_window_set_resizable(GTK_WINDOW (note->w_window), TRUE);
+ }
+}
+
/* Add a sticky note */
void
stickynotes_add (GdkScreen *screen)
diff --git a/stickynotes/stickynotes.h b/stickynotes/stickynotes.h
index 3a524189b..10a154ca4 100644
--- a/stickynotes/stickynotes.h
+++ b/stickynotes/stickynotes.h
@@ -63,6 +63,7 @@ typedef struct
gchar *font_color; /* Font color */
gchar *font; /* Note font */
gboolean locked; /* Note locked state */
+ gboolean force_fixed_size; /* Note resizing is restricted */
gint x; /* Note x-coordinate */
gint y; /* Note y-coordinate */
@@ -91,6 +92,8 @@ void stickynote_set_locked (StickyNote *note,
gboolean locked);
void stickynote_set_visible (StickyNote *note,
gboolean visible);
+void stickynote_set_fixed_size (StickyNote *note,
+ gboolean force_fixed_size);
void stickynote_change_properties (StickyNote *note);
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index fd903e1e9..e31ec4a27 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -262,6 +262,9 @@ stickynotes_applet_init_prefs (void)
stickynotes->w_prefs_desktop =
GTK_WIDGET (>K_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
"desktop_hide_check"))->toggle_button);
+ stickynotes->w_prefs_fixed_size =
+ GTK_WIDGET (>K_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+ "fixed_size_check"))->toggle_button);
g_signal_connect (stickynotes->w_prefs, "response",
G_CALLBACK (preferences_response_cb), NULL);
@@ -287,6 +290,8 @@ stickynotes_applet_init_prefs (void)
G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (stickynotes->w_prefs_desktop, "toggled",
G_CALLBACK (preferences_save_cb), NULL);
+ g_signal_connect_swapped (stickynotes->w_prefs_fixed_size, "toggled",
+ G_CALLBACK (preferences_save_cb), NULL);
{
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -346,6 +351,8 @@ stickynotes_applet_init_prefs (void)
gtk_widget_set_sensitive (stickynotes->w_prefs_sticky, FALSE);
if (!g_settings_is_writable (stickynotes->settings, "force-default"))
gtk_widget_set_sensitive (stickynotes->w_prefs_force, FALSE);
+ if (!g_settings_is_writable (stickynotes->settings, "fixed-size"))
+ gtk_widget_set_sensitive (stickynotes->w_prefs_fixed_size, FALSE);
stickynotes_applet_update_prefs ();
}
@@ -468,7 +475,7 @@ void
stickynotes_applet_update_prefs (void)
{
gint width, height;
- gboolean sys_color, sys_font, sticky, force_default, desktop_hide;
+ gboolean sys_color, sys_font, sticky, force_default, desktop_hide, fixed_size;
char *font_str;
char *color_str, *font_color_str;
GdkRGBA color, font_color;
@@ -490,6 +497,8 @@ stickynotes_applet_update_prefs (void)
"force-default");
desktop_hide = g_settings_get_boolean (stickynotes->settings,
"desktop-hide");
+ fixed_size = g_settings_get_boolean (stickynotes->settings,
+ "fixed-size");
font_str = g_settings_get_string (stickynotes->settings,
"default-font");
@@ -524,6 +533,9 @@ stickynotes_applet_update_prefs (void)
force_default);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop),
desktop_hide);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_fixed_size),
+ fixed_size);
+ stickynotes->force_fixed_size = fixed_size;
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color),
&color);
diff --git a/stickynotes/stickynotes_applet.h b/stickynotes/stickynotes_applet.h
index 072318d3a..e14f076ff 100644
--- a/stickynotes/stickynotes_applet.h
+++ b/stickynotes/stickynotes_applet.h
@@ -50,6 +50,7 @@ typedef struct
GtkWidget *w_prefs_sticky;
GtkWidget *w_prefs_force;
GtkWidget *w_prefs_desktop;
+ GtkWidget *w_prefs_fixed_size;
GList *notes; /* Linked-List of all the sticky notes */
GList *applets; /* Linked-List of all the applets */
@@ -63,6 +64,7 @@ typedef struct
guint last_timeout_data;
gboolean visible; /* Toggle show/hide notes */
+ gboolean force_fixed_size; /* Force fixed size notes */
} StickyNotes;
/* Sticky Notes Applet */
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index 6481bb82e..576cc478f 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -451,6 +451,7 @@ preferences_save_cb (gpointer data)
gboolean sticky;
gboolean force_default;
gboolean desktop_hide;
+ gboolean fixed_size;
gdouble adjustment_value;
adjustment_value = gtk_adjustment_get_value (stickynotes->w_prefs_width);
@@ -464,6 +465,7 @@ preferences_save_cb (gpointer data)
sticky = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sticky));
force_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_force));
desktop_hide = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop));
+ fixed_size = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_fixed_size));
if (g_settings_is_writable (stickynotes->settings,
"default-width"))
@@ -493,6 +495,10 @@ preferences_save_cb (gpointer data)
"desktop-hide"))
g_settings_set_boolean (stickynotes->settings,
"desktop-hide", desktop_hide);
+ if (g_settings_is_writable (stickynotes->settings,
+ "fixed-size"))
+ g_settings_set_boolean (stickynotes->settings,
+ "fixed-size", fixed_size);
}
/* Preferences Callback : Change color. */
@@ -599,6 +605,14 @@ preferences_apply_cb (GSettings *settings,
}
}
+ else if (!strcmp (key, "fixed-size")) {
+ for (l = stickynotes->notes; l; l = l->next) {
+ note = l->data;
+ stickynote_set_fixed_size (note,
+ stickynotes->force_fixed_size);
+ }
+ }
+
stickynotes_applet_update_prefs ();
stickynotes_applet_update_menus ();
}
diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c
index 3f22dab70..faf4ae4c8 100644
--- a/stickynotes/stickynotes_callbacks.c
+++ b/stickynotes/stickynotes_callbacks.c
@@ -45,6 +45,9 @@ gboolean stickynote_resize_cb (GtkWidget *widget,
GdkEventButton *event,
StickyNote *note)
{
+ if (note->force_fixed_size)
+ return FALSE;
+
if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
if (widget == note->w_resize_se)
gtk_window_begin_resize_drag (GTK_WINDOW (note->w_window),