summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2015-12-17 15:59:49 +0100
committerWolfgang Ulbrich <[email protected]>2015-12-17 15:59:49 +0100
commitd916ca590d2d325575d197ff2227c3d0df915cd5 (patch)
tree751fe99a695f39d05bf86d32a7a3a78bb9132a0f
parent1bfaf0fdedd90cba02cdefe26aaac75418b4371f (diff)
downloadmate-applets-d916ca590d2d325575d197ff2227c3d0df915cd5.tar.bz2
mate-applets-d916ca590d2d325575d197ff2227c3d0df915cd5.tar.xz
GTK3 stickynotes: several geprecated fixes
- don't use deprecated GdkColor - don't use deprecated gtkcolorbutton - don't use deprecated gtk_icon_size_register taken from: https://git.gnome.org/browse/gnome-applets/commit/?id=0e26a90 https://git.gnome.org/browse/gnome-applets/commit/?id=30805d8 https://git.gnome.org/browse/gnome-applets/commit/?id=15dbeb5
-rw-r--r--stickynotes/stickynotes.c35
-rw-r--r--stickynotes/stickynotes_applet.c6
-rw-r--r--stickynotes/stickynotes_applet_callbacks.c4
-rw-r--r--stickynotes/stickynotes_callbacks.c4
4 files changed, 41 insertions, 8 deletions
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index d6db6de2..acfa2b30 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -40,6 +40,9 @@
/* Stop gcc complaining about xmlChar's signedness */
#define XML_CHAR(str) ((xmlChar *) (str))
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define STICKYNOTES_ICON_SIZE 8
+#endif
static gboolean save_scheduled = FALSE;
@@ -104,7 +107,9 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
{
StickyNote *note;
GtkBuilder *builder;
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkIconSize size;
+#endif
note = g_new (StickyNote, 1);
@@ -197,6 +202,16 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
note->y);
/* Set the button images */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_image_set_from_icon_name (note->img_close, STICKYNOTES_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+ gtk_image_set_pixel_size (note->img_close, STICKYNOTES_ICON_SIZE);
+
+ gtk_image_set_from_stock (note->img_resize_se, STICKYNOTES_STOCK_RESIZE_SE, GTK_ICON_SIZE_MENU);
+ gtk_image_set_pixel_size (note->img_resize_se, STICKYNOTES_ICON_SIZE);
+
+ gtk_image_set_from_stock (note->img_resize_sw, STICKYNOTES_STOCK_RESIZE_SW, GTK_ICON_SIZE_MENU);
+ gtk_image_set_pixel_size (note->img_resize_sw, STICKYNOTES_ICON_SIZE);
+#else
size = gtk_icon_size_from_name ("stickynotes_icon_size");
gtk_image_set_from_stock (note->img_close,
STICKYNOTES_STOCK_CLOSE, size);
@@ -204,6 +219,7 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
STICKYNOTES_STOCK_RESIZE_SE, size);
gtk_image_set_from_stock (note->img_resize_sw,
STICKYNOTES_STOCK_RESIZE_SW, size);
+#endif
gtk_widget_show(note->w_lock);
gtk_widget_show(note->w_close);
gtk_widget_show(GTK_WIDGET (gtk_builder_get_object (builder, "resize_bar")));
@@ -344,7 +360,7 @@ void stickynote_change_properties (StickyNote *note)
#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
gdk_rgba_parse (&color, color_str);
- gtk_color_button_set_rgba (GTK_COLOR_BUTTON (note->w_color), &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_color), &color);
#else
GdkColor color;
gdk_color_parse (color_str, &color);
@@ -365,7 +381,7 @@ void stickynote_change_properties (StickyNote *note)
#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA font_color;
gdk_rgba_parse (&font_color, color_str);
- gtk_color_button_set_rgba (GTK_COLOR_BUTTON (note->w_font_color), &font_color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_font_color), &font_color);
#else
GdkColor font_color;
gdk_color_parse (color_str, &font_color);
@@ -676,25 +692,40 @@ stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save)
/* Lock/Unlock a sticky note from editing */
void stickynote_set_locked(StickyNote *note, gboolean locked)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkIconSize size;
+#endif
note->locked = locked;
/* Set cursor visibility and editability */
gtk_text_view_set_editable(GTK_TEXT_VIEW(note->w_body), !locked);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(note->w_body), !locked);
+#if !GTK_CHECK_VERSION (3, 0, 0)
size = gtk_icon_size_from_name ("stickynotes_icon_size");
+#endif
/* Show appropriate icon and tooltip */
if (locked) {
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_image_set_from_icon_name (note->img_lock, STICKYNOTES_STOCK_LOCKED, GTK_ICON_SIZE_MENU);
+ gtk_widget_set_tooltip_text(note->w_lock, _("This note is locked."));
+ }
+ else {
+ gtk_image_set_from_icon_name (note->img_lock, STICKYNOTES_STOCK_UNLOCKED, GTK_ICON_SIZE_MENU);
+#else
gtk_image_set_from_stock(note->img_lock, STICKYNOTES_STOCK_LOCKED, size);
gtk_widget_set_tooltip_text(note->w_lock, _("This note is locked."));
}
else {
gtk_image_set_from_stock(note->img_lock, STICKYNOTES_STOCK_UNLOCKED, size);
+#endif
gtk_widget_set_tooltip_text(note->w_lock, _("This note is unlocked."));
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_image_set_pixel_size (note->img_lock, STICKYNOTES_ICON_SIZE);
+#endif
gtk_toggle_action_set_active(note->ta_lock_toggle_item, locked);
stickynotes_applet_update_menus();
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 79085cad..ad4cf3ea 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -144,8 +144,10 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
g_set_application_name (_("Sticky Notes"));
+#if !GTK_CHECK_VERSION (3, 0, 0)
/* Register size for icons */
gtk_icon_size_register ("stickynotes_icon_size", 8,8);
+#endif
gtk_window_set_default_icon_name ("mate-sticky-notes-applet");
@@ -514,8 +516,8 @@ stickynotes_applet_update_prefs (void)
desktop_hide);
#if GTK_CHECK_VERSION (3, 0, 0)
- gtk_color_button_set_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
- gtk_color_button_set_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color), &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_font_color), &font_color);
#else
gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color);
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index 0300fbf8..791f02a1 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -423,8 +423,8 @@ preferences_color_cb (GtkWidget *button, gpointer data)
#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color, font_color;
- gtk_color_button_get_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
- gtk_color_button_get_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color), &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_font_color), &font_color);
color_str = gdk_rgba_to_string (&color);
font_color_str = gdk_rgba_to_string (&font_color);
diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c
index d25139a3..57404d97 100644
--- a/stickynotes/stickynotes_callbacks.c
+++ b/stickynotes/stickynotes_callbacks.c
@@ -146,8 +146,8 @@ void properties_apply_color_cb(StickyNote *note)
#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color, font_color;
- gtk_color_button_get_rgba (GTK_COLOR_BUTTON (note->w_color), &color);
- gtk_color_button_get_rgba (GTK_COLOR_BUTTON (note->w_font_color), &font_color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_color), &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_font_color), &font_color);
color_str = gdk_rgba_to_string (&color);
font_color_str = gdk_rgba_to_string (&font_color);