grim/guifications2

Remove unnecessary GTK_CHECK_VERSION checks
draft
2 months ago, Gary Kramlich
fb28afae81c6
Parents 7f30676c7038
Children 1abbce8c82c8
Remove unnecessary GTK_CHECK_VERSION checks
--- a/src/gf_display.c Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_display.c Mon Apr 12 18:29:56 2021 -0500
@@ -91,9 +91,7 @@
static gboolean vertical, animate;
static GfDisplayPosition position;
-#if GTK_CHECK_VERSION(2,2,0)
static gint disp_screen = 0, disp_monitor = 0;
-#endif /* GTK_CHECK_VERSION(2,2,0) */
/*******************************************************************************
* Prototypes...
@@ -148,58 +146,9 @@
}
/*******************************************************************************
- * Gtk 2.0.0 stuff
- *
- * This is the default behavior of 2.0 and 1.x
- ******************************************************************************/
-#if !GTK_CHECK_VERSION(2,2,0)
-static void
-gf_display_get_geometry(gint *x, gint *y, gint *width, gint *height) {
- *x = *y = 0;
- *width = gdk_screen_width();
- *height = gdk_screen_height();
-}
-
-static void
-gf_display_shape(GfDisplay *display) {
- if(display->has_alpha) {
- GdkBitmap *bitmap = NULL;
- GdkPixbuf *pixbuf;
-
- if(display->state == GF_DISPLAY_STATE_SHOWING ||
- display->state == GF_DISPLAY_STATE_HIDING)
- {
- pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(display->image));
-
- if(!pixbuf) {
- /* image has no pixbuf.. so we have no business continuing */
- return;
- }
- } else {
- pixbuf = display->pixbuf;
- }
-
- gdk_pixbuf_render_pixmap_and_mask(pixbuf, NULL, &bitmap, 255);
- if(bitmap) {
- gtk_widget_shape_combine_mask(display->window, bitmap, 0, 0);
- g_object_unref(G_OBJECT(bitmap));
- }
- }
-}
-
-static void
-gf_display_move(GfDisplay *display) {
- gtk_window_move(GTK_WINDOW(display->window), display->x, display->y);
-}
-
-#else /* !GTK_CHECK_VERSION(2,2,0) */
-/*******************************************************************************
- * Gtk 2.2.0 and up stuff
- *
* Allows users to specify which screen to display the notifications on and
* in the case of xinerama, to position it correctly
******************************************************************************/
-
static void
gf_display_get_geometry(gint *x, gint *y, gint *width, gint *height) {
GdkDisplay *display;
@@ -317,8 +266,6 @@
return monitors - 1;
}
-#endif /* GTK_CHECK_VERSION(2,2,0) */
-
/*******************************************************************************
* The normal code (tm)
******************************************************************************/
@@ -981,7 +928,6 @@
/*******************************************************************************
* Pref callbacks for the display/screen/monitor stuff
******************************************************************************/
-#if GTK_CHECK_VERSION(2,2,0)
static void
gf_display_screen_changed_cb(const gchar *name, PurplePrefType type,
gconstpointer val, gpointer data)
@@ -1001,7 +947,6 @@
}
static guint scr_chg_id = 0, mon_chg_id = 0;
-#endif /* GTK_CHECK_VERSION(2,2,0) */
/*******************************************************************************
* Regular pref callbacks
@@ -1031,7 +976,6 @@
gf_display_animate_changed_cb,
NULL);
-#if GTK_CHECK_VERSION(2,2,0)
/* setup our multi screen prefs */
disp_screen = purple_prefs_get_int(GF_PREF_ADVANCED_SCREEN);
disp_monitor = purple_prefs_get_int(GF_PREF_ADVANCED_MONITOR);
@@ -1044,17 +988,14 @@
GF_PREF_ADVANCED_MONITOR,
gf_display_monitor_changed_cb,
NULL);
-#endif /* GTK_CHECK_VERSION(2,2,0) */
}
void
gf_display_uninit() {
purple_prefs_disconnect_callback(pos_chg_id);
purple_prefs_disconnect_callback(ver_chg_id);
-#if GTK_CHECK_VERSION(2,2,0)
purple_prefs_disconnect_callback(scr_chg_id);
purple_prefs_disconnect_callback(mon_chg_id);
-#endif /* GTK_CHECK_VERSION(2,2,0) */
}
gint
--- a/src/gf_display.h Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_display.h Mon Apr 12 18:29:56 2021 -0500
@@ -62,12 +62,10 @@
void gf_display_init(PurplePlugin *plugin);
void gf_display_uninit();
-#if GTK_CHECK_VERSION(2,2,0)
gint gf_display_get_default_screen();
gint gf_display_get_screen_count();
gint gf_display_get_default_monitor();
gint gf_display_get_monitor_count();
-#endif /* GTK_CHECK_VERSION(2,2,0) */
gboolean gf_display_screen_saver_is_running();
--- a/src/gf_item_text.c Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_item_text.c Mon Apr 12 18:29:56 2021 -0500
@@ -88,21 +88,17 @@
gf_item_text_init() {
#ifndef _WIN32
gdouble xdpi = 75, ydpi = 75;
-# if GTK_CHECK_VERSION(2,2,0)
GdkDisplay *display;
GdkScreen *screen;
-# endif
#endif
map = pango_ft2_font_map_new();
#ifndef _WIN32
-# if GTK_CHECK_VERSION(2,2,0)
display = gdk_display_get_default();
screen = gdk_display_get_screen(display, purple_prefs_get_int(GF_PREF_ADVANCED_SCREEN));
xdpi = (double)((float)gdk_screen_get_width(screen) / (float)gdk_screen_get_width_mm(screen) * 25.4);
ydpi = (double)((float)gdk_screen_get_height(screen) / (float)gdk_screen_get_height_mm(screen) * 25.4);
-# endif
pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(map), xdpi, ydpi);
#endif
--- a/src/gf_preferences.c Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_preferences.c Mon Apr 12 18:29:56 2021 -0500
@@ -1260,9 +1260,7 @@
make_advanced_page(GtkWidget *notebook) {
GtkWidget *vbox, *frame;
GtkSizeGroup *sg;
-#if GTK_CHECK_VERSION(2,2,0)
gint screen_count, monitor_count;
-#endif
sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
@@ -1273,7 +1271,7 @@
pidgin_prefs_labeled_spin_button(frame, _("Max _Visible Guifications:"),
GF_PREF_BEHAVIOR_THROTTLE,
0, 255, sg);
-#if GTK_CHECK_VERSION(2,2,0)
+
screen_count = gf_display_get_screen_count();
monitor_count = gf_display_get_monitor_count();
if(screen_count > 0 || monitor_count > 0) {
@@ -1293,7 +1291,6 @@
0, monitor_count, sg);
}
}
-#endif /* GTK_CHECK_VERSION(2,2,0) */
gtk_widget_show_all(vbox);
}
@@ -1367,7 +1364,6 @@
purple_prefs_add_bool(GF_PREF_ADVANCED_RELEASE_NOTIFICATION, TRUE);
purple_prefs_add_int(GF_PREF_ADVANCED_RELEASE_LAST_CHECK, 0);
-#if GTK_CHECK_VERSION(2,2,0)
purple_prefs_add_int(GF_PREF_ADVANCED_SCREEN, 0);
purple_prefs_add_int(GF_PREF_ADVANCED_MONITOR, 0);
@@ -1384,7 +1380,6 @@
purple_prefs_set_int(GF_PREF_ADVANCED_MONITOR,
gf_display_get_default_monitor());
}
-#endif /* GTK_CHECK_VERSION(2,2,0) */
/* clean up old prefs if they exist */
purple_prefs_remove("/plugins/gtk/amc_grim/guifications2/behavior/show_during_screen_saver");
--- a/src/gf_preferences.h Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_preferences.h Mon Apr 12 18:29:56 2021 -0500
@@ -46,10 +46,8 @@
#define GF_PREF_ADVANCED_RELEASE_NOTIFICATION "/plugins/gtk/amc_grim/guifications2/advanced/release_notification"
#define GF_PREF_ADVANCED_RELEASE_LAST_CHECK "/plugins/gtk/amc_grim/guifications2/advanced/release_last_check"
-#if GTK_CHECK_VERSION(2,2,0)
# define GF_PREF_ADVANCED_SCREEN "/plugins/gtk/amc_grim/guifications2/advanced/screen"
# define GF_PREF_ADVANCED_MONITOR "/plugins/gtk/amc_grim/guifications2/advanced/monitor"
-#endif /* GTK_CHECK_VERSION(2,2,0) */
G_BEGIN_DECLS
--- a/src/gf_theme_editor.c Mon Apr 12 18:23:57 2021 -0500
+++ b/src/gf_theme_editor.c Mon Apr 12 18:29:56 2021 -0500
@@ -407,34 +407,6 @@
return store;
}
-/* This was yanked from gtk 2.4.x, it's a wrapper to support this function on gtk 2.0 */
-static void
-gfte_tree_view_expand_to_path(GtkTreeView *tree, GtkTreePath *path) {
-#if GTK_CHECK_VERSION(2,2,0)
- gtk_tree_view_expand_to_path(tree, path);
-#else
- gint i, depth;
- gint *indices;
- GtkTreePath *tmp;
-
- g_return_if_fail(GTK_IS_TREE_VIEW(tree));
- g_return_if_fail(path != NULL);
-
- depth = gtk_tree_path_get_depth(path);
- indices = gtk_tree_path_get_indices(path);
-
- tmp = gtk_tree_path_new();
- g_return_if_fail(tmp != NULL);
-
- for(i = 0; i < depth; i++) {
- gtk_tree_path_append_index(tmp, indices[i]);
- gtk_tree_view_expand_row(tree, tmp, FALSE);
- }
-
- gtk_tree_path_free(tmp);
-#endif /* GTK 2.0 */
-}
-
static void
gfte_store_select_iter(GtkTreeIter *iter) {
GtkTreeModel *model;
@@ -443,7 +415,7 @@
model = gtk_tree_view_get_model(GTK_TREE_VIEW(editor.tree));
path = gtk_tree_model_get_path(model, iter);
- gfte_tree_view_expand_to_path(GTK_TREE_VIEW(editor.tree), path);
+ gtk_tree_view_expand_to_path(GTK_TREE_VIEW(editor.tree), path);
gtk_tree_path_free(path);
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(editor.tree));
@@ -1375,11 +1347,6 @@
gchar *a_title, *b_title;
gint a_page, b_page;
gpointer a_obj, b_obj;
-#if !GTK_CHECK_VERSION(2,2,0)
- gchar *title;
- gint page;
- gpointer obj;
-#endif /* !GTK_CHECK_VERSION(2,2,0) */
/* get 'em */
gtk_tree_model_get(GTK_TREE_MODEL(editor.store), a,
@@ -1399,35 +1366,7 @@
gf_items_swap(GF_ITEM(a_obj), GF_ITEM(b_obj));
}
-#if GTK_CHECK_VERSION(2,2,0)
gtk_tree_store_swap(editor.store, a, b);
-#else
- /* swap 'em */
- title = a_title;
- page = a_page;
- obj = a_obj;
-
- a_title = b_title;
- a_page = b_page;
- a_obj = b_obj;
-
- b_title = title;
- b_page = page;
- b_obj = obj;
-
- /* set 'em */
- gtk_tree_store_set(editor.store, a,
- GFTE_STORE_OBJECT, a_obj,
- GFTE_STORE_PAGE, a_page,
- GFTE_STORE_TITLE, a_title,
- -1);
- gtk_tree_store_set(editor.store, b,
- GFTE_STORE_OBJECT, b_obj,
- GFTE_STORE_PAGE, b_page,
- GFTE_STORE_TITLE, b_title,
- -1);
-
-#endif /* GTK_CHECK_VERSION(2,2,0) */
/* clean up */
g_free(a_title);