summaryrefslogtreecommitdiff
path: root/stickynotes
diff options
context:
space:
mode:
Diffstat (limited to 'stickynotes')
-rw-r--r--stickynotes/stickynotes.c118
-rw-r--r--stickynotes/stickynotes.h5
-rw-r--r--stickynotes/stickynotes_applet.c18
-rw-r--r--stickynotes/stickynotes_applet_callbacks.c16
-rw-r--r--stickynotes/stickynotes_callbacks.c16
5 files changed, 0 insertions, 173 deletions
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index 3ffc88dd..faed2de9 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -26,12 +26,7 @@
#include <libwnck/libwnck.h>
#include <string.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
-#else
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcebuffer.h>
-#endif
#include "stickynotes.h"
#include "stickynotes_callbacks.h"
@@ -343,15 +338,9 @@ void stickynote_change_properties (StickyNote *note)
if (color_str)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
gdk_rgba_parse (&color, color_str);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_color), &color);
-#else
- GdkColor color;
- gdk_color_parse (color_str, &color);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (note->w_color), &color);
-#endif
g_free (color_str);
}
@@ -364,15 +353,9 @@ void stickynote_change_properties (StickyNote *note)
if (color_str)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA font_color;
gdk_rgba_parse (&font_color, color_str);
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);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (note->w_font_color), &font_color);
-#endif
g_free (color_str);
}
@@ -486,129 +469,47 @@ stickynote_set_color (StickyNote *note,
else
font_color_str_actual = g_strdup (font_color_str);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkRcStyle *rc_style = gtk_widget_get_modifier_style (note->w_window);
-#endif
-
/* Do not use custom colors if "use_system_color" is enabled */
if (color_str_actual) {
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA colors[4];
-#else
- GdkColor colors[6];
-#endif
gint i;
for (i = 0; i <= 3; i++)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&colors[i], color_str_actual);
-#else
- gdk_color_parse (color_str_actual, &colors[i]);
-#endif
colors[i].red = (colors[i].red * (10 - i)) / 10;
colors[i].green = (colors[i].green * (10 - i)) / 10;
colors[i].blue = (colors[i].blue * (10 - i)) / 10;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_color_parse ("black", &colors[4]);
- gdk_color_parse ("white", &colors[5]);
-
- gboolean success[6];
-
- /* Allocate these colors */
- gdk_colormap_alloc_colors (gtk_widget_get_colormap (note->w_window),
- colors, 6, FALSE, TRUE, success);
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_background_color (note->w_window, GTK_STATE_NORMAL, &colors[0]);
gtk_widget_override_background_color (note->w_body, GTK_STATE_NORMAL, &colors[0]);
gtk_widget_override_background_color (note->w_lock, GTK_STATE_NORMAL, &colors[0]);
gtk_widget_override_background_color (note->w_close, GTK_STATE_NORMAL, &colors[0]);
gtk_widget_override_background_color (note->w_resize_se, GTK_STATE_NORMAL, &colors[0]);
gtk_widget_override_background_color (note->w_resize_sw, GTK_STATE_NORMAL, &colors[0]);
-#else
- /* Apply colors to style */
- rc_style->base[GTK_STATE_NORMAL] = colors[0];
- rc_style->bg[GTK_STATE_PRELIGHT] = colors[1];
- rc_style->bg[GTK_STATE_NORMAL] = colors[2];
- rc_style->bg[GTK_STATE_ACTIVE] = colors[3];
-
- rc_style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_BG;
- rc_style->color_flags[GTK_STATE_NORMAL] =
- GTK_RC_BG | GTK_RC_BASE;
- rc_style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_BG;
-#endif
} else {
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_background_color (note->w_window, GTK_STATE_NORMAL, NULL);
gtk_widget_override_background_color (note->w_body, GTK_STATE_NORMAL, NULL);
gtk_widget_override_background_color (note->w_lock, GTK_STATE_NORMAL, NULL);
gtk_widget_override_background_color (note->w_close, GTK_STATE_NORMAL, NULL);
gtk_widget_override_background_color (note->w_resize_se, GTK_STATE_NORMAL, NULL);
gtk_widget_override_background_color (note->w_resize_sw, GTK_STATE_NORMAL, NULL);
-#else
- rc_style->color_flags[GTK_STATE_PRELIGHT] = 0;
- rc_style->color_flags[GTK_STATE_NORMAL] = 0;
- rc_style->color_flags[GTK_STATE_ACTIVE] = 0;
-#endif
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_object_ref (G_OBJECT (rc_style));
-
- /* Apply the style to the widgets */
- gtk_widget_modify_style (note->w_window, rc_style);
- gtk_widget_modify_style (note->w_body, rc_style);
- gtk_widget_modify_style (note->w_lock, rc_style);
- gtk_widget_modify_style (note->w_close, rc_style);
- gtk_widget_modify_style (note->w_resize_se, rc_style);
- gtk_widget_modify_style (note->w_resize_sw, rc_style);
-
- g_object_unref (G_OBJECT (rc_style));
-#endif
-
if (font_color_str_actual)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
gdk_rgba_parse (&color, font_color_str_actual);
gtk_widget_override_color (note->w_window, GTK_STATE_NORMAL, &color);
gtk_widget_override_color (note->w_body, GTK_STATE_NORMAL, &color);
-#else
- GdkColor font_color;
-
- gdk_color_parse (font_color_str_actual, &font_color);
-
- gtk_widget_modify_text (note->w_window,
- GTK_STATE_NORMAL, &font_color);
- gtk_widget_modify_text (note->w_window,
- GTK_STATE_PRELIGHT, &font_color);
- gtk_widget_modify_text (note->w_body,
- GTK_STATE_NORMAL, &font_color);
- gtk_widget_modify_text (note->w_body,
- GTK_STATE_PRELIGHT, &font_color);
-#endif
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_color (note->w_window, GTK_STATE_NORMAL, NULL);
gtk_widget_override_color (note->w_body, GTK_STATE_NORMAL, NULL);
-#else
- gtk_widget_modify_text (note->w_window,
- GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (note->w_window,
- GTK_STATE_PRELIGHT, NULL);
- gtk_widget_modify_text (note->w_body,
- GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (note->w_body,
- GTK_STATE_PRELIGHT, NULL);
-#endif
}
if (color_str_actual)
@@ -621,11 +522,7 @@ stickynote_set_color (StickyNote *note,
void
stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
PangoFontDescription *font_desc;
-#else
- GtkRcStyle *rc_style = gtk_widget_get_modifier_style(note->w_window);
-#endif
gchar *font_str_actual;
if (save) {
@@ -649,30 +546,15 @@ stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save)
font_str_actual = g_strdup (font_str);
/* Do not use custom fonts if "use_system_font" is enabled */
-#if GTK_CHECK_VERSION (3, 0, 0)
font_desc = font_str_actual ?
-#else
- pango_font_description_free (rc_style->font_desc);
- rc_style->font_desc = font_str_actual ?
-#endif
pango_font_description_from_string (font_str_actual): NULL;
/* Apply the style to the widgets */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_font (note->w_window, font_desc);
gtk_widget_override_font (note->w_body, font_desc);
-#else
- g_object_ref (G_OBJECT (rc_style));
- gtk_widget_modify_style(note->w_window, rc_style);
- gtk_widget_modify_style(note->w_body, rc_style);
-#endif
g_free (font_str_actual);
-#if GTK_CHECK_VERSION (3, 0, 0)
pango_font_description_free (font_desc);
-#else
- g_object_unref (G_OBJECT(rc_style));
-#endif
}
/* Lock/Unlock a sticky note from editing */
diff --git a/stickynotes/stickynotes.h b/stickynotes/stickynotes.h
index 929c5ad0..e5a969b4 100644
--- a/stickynotes/stickynotes.h
+++ b/stickynotes/stickynotes.h
@@ -24,12 +24,7 @@
#include <libwnck/libwnck.h>
#include <stickynotes_applet.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
-#else
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcebuffer.h>
-#endif
typedef struct
{
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 6448b896..6f39b78b 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -444,11 +444,7 @@ stickynotes_applet_update_prefs (void)
gboolean sys_color, sys_font, sticky, force_default, desktop_hide;
char *font_str;
char *color_str, *font_color_str;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color, font_color;
-#else
- GdkColor color, font_color;
-#endif
width = g_settings_get_int (stickynotes->settings, "default-width");
width = MAX (width, 1);
@@ -478,13 +474,8 @@ stickynotes_applet_update_prefs (void)
font_color_str = g_strdup ("#000000");
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color, color_str);
gdk_rgba_parse (&font_color, font_color_str);
-#else
- gdk_color_parse (color_str, &color);
- gdk_color_parse (font_color_str, &font_color);
-#endif
g_free (color_str);
g_free (font_color_str);
@@ -507,13 +498,8 @@ stickynotes_applet_update_prefs (void)
GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop),
desktop_hide);
-#if GTK_CHECK_VERSION (3, 0, 0)
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);
-#endif
gtk_font_button_set_font_name (GTK_FONT_BUTTON (stickynotes->w_prefs_font), font_str);
g_free (font_str);
@@ -622,11 +608,7 @@ stickynotes_applet_panel_icon_get_geometry (int *x, int *y, int *width, int *hei
widget = GTK_WIDGET (applet->w_image);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (widget, NULL, &requisition);
-#else
- gtk_widget_size_request (widget, &requisition);
-#endif
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index 8c95ed2a..1bee855f 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -423,7 +423,6 @@ preferences_color_cb (GtkWidget *button, gpointer data)
{
char *color_str, *font_color_str;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color, font_color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color), &color);
@@ -431,21 +430,6 @@ preferences_color_cb (GtkWidget *button, gpointer data)
color_str = gdk_rgba_to_string (&color);
font_color_str = gdk_rgba_to_string (&font_color);
-#else
- GdkColor color, font_color;
-
- gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
- gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color);
-
- color_str = g_strdup_printf ("#%.2x%.2x%.2x",
- color.red / 256,
- color.green / 256,
- color.blue / 256);
- font_color_str = g_strdup_printf ("#%.2x%.2x%.2x",
- font_color.red / 256,
- font_color.green / 256,
- font_color.blue / 256);
-#endif
g_settings_set_string (stickynotes->settings, "default-color", color_str);
g_settings_set_string (stickynotes->settings, "default-font-color", font_color_str);
diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c
index d1e23dde..bd6a4577 100644
--- a/stickynotes/stickynotes_callbacks.c
+++ b/stickynotes/stickynotes_callbacks.c
@@ -143,7 +143,6 @@ void properties_apply_color_cb(StickyNote *note)
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(note->w_def_color)))
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color, font_color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_color), &color);
@@ -151,21 +150,6 @@ void properties_apply_color_cb(StickyNote *note)
color_str = gdk_rgba_to_string (&color);
font_color_str = gdk_rgba_to_string (&font_color);
-#else
- GdkColor color, font_color;
-
- gtk_color_button_get_color (GTK_COLOR_BUTTON (note->w_color), &color);
- gtk_color_button_get_color (GTK_COLOR_BUTTON (note->w_font_color), &font_color);
-
- color_str = g_strdup_printf ("#%.2x%.2x%.2x",
- color.red / 256,
- color.green / 256,
- color.blue / 256);
- font_color_str = g_strdup_printf ("#%.2x%.2x%.2x",
- font_color.red / 256,
- font_color.green / 256,
- font_color.blue / 256);
-#endif
}
stickynote_set_color (note, color_str, font_color_str, TRUE);