Skip to content

Commit

Permalink
Addons: Remove obsolete GTK_CHECK_VERSION checks (#1358)
Browse files Browse the repository at this point in the history
  • Loading branch information
eht16 authored Jun 23, 2024
1 parent d8df495 commit 820fd93
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
4 changes: 0 additions & 4 deletions addons/src/addons.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,6 @@ static GtkWidget *plugin_addons_configure(G_GNUC_UNUSED GeanyPlugin *plugin, Gtk

gtk_widget_show_all(vbox);

#if ! GTK_CHECK_VERSION(2, 10, 0)
gtk_widget_hide(check_systray);
#endif

return vbox;
}

Expand Down
17 changes: 0 additions & 17 deletions addons/src/ao_doclist.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,8 @@ static void ao_popup_position_menu(GtkMenu *menu, gint *x, gint *y, gboolean *pu
/* Get the root coordinates of the toolbar's window */
int wx_root, wy_root, width;
window = gtk_widget_get_window (gtk_widget_get_ancestor(widget, GTK_TYPE_TOOLBAR));
#if GTK_CHECK_VERSION(3, 0, 0)
gdk_window_get_geometry(window, &wx, &wy, &width, NULL);
gtk_widget_get_preferred_size(widget, &widget_req, NULL);
#else
gdk_window_get_geometry(window, &wx, &wy, &width, NULL, NULL);
gtk_widget_size_request(widget, &widget_req);
#endif
gdk_window_get_root_coords(window, wx, wy, &wx_root, &wy_root);

/* Approximate the horizontal location of the overflow menu button */
Expand All @@ -173,11 +168,7 @@ static void ao_popup_position_menu(GtkMenu *menu, gint *x, gint *y, gboolean *pu
else
gdk_window_get_origin(window, &wx, &wy);
}
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_preferred_size(widget, &widget_req, NULL);
#else
gtk_widget_size_request(widget, &widget_req);
#endif
widget_height = widget_req.height; /* Better than allocation.height */

/* Calculate menu position */
Expand Down Expand Up @@ -270,13 +261,7 @@ static gboolean ao_create_proxy_menu_cb(GtkToolItem *widget, gpointer data)
/* Create the menu item if needed */
if (priv->overflow_menu_item == NULL)
{
#if GTK_CHECK_VERSION(3, 0, 0)
priv->overflow_menu_item = gtk_menu_item_new_with_label("Document List");
#else
GtkWidget *menu_image = gtk_image_new_from_icon_name(GTK_STOCK_INDEX, GTK_ICON_SIZE_MENU);
priv->overflow_menu_item = gtk_image_menu_item_new_with_label("Document List");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(priv->overflow_menu_item), menu_image);
#endif
g_signal_connect(priv->overflow_menu_item, "activate",
G_CALLBACK(ao_toolbar_item_doclist_clicked_cb), data);
}
Expand Down Expand Up @@ -306,10 +291,8 @@ static void ao_toolbar_update(AoDocList *self)
if (priv->toolbar_doclist_button == NULL)
{
priv->toolbar_doclist_button = gtk_tool_button_new_from_stock(GTK_STOCK_INDEX);
#if GTK_CHECK_VERSION(2, 12, 0)
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(priv->toolbar_doclist_button),
_("Show Document List"));
#endif
plugin_add_toolbar_item(geany_plugin, priv->toolbar_doclist_button);
ui_add_document_sensitive(GTK_WIDGET(priv->toolbar_doclist_button));

Expand Down
16 changes: 1 addition & 15 deletions addons/src/ao_systray.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ struct _AoSystrayPrivate
gboolean enable_systray;

GtkWidget *popup_menu;
#if GTK_CHECK_VERSION(2, 10, 0)
GtkStatusIcon *icon;
#endif
};

enum
Expand All @@ -68,12 +66,10 @@ G_DEFINE_TYPE(AoSystray, ao_systray, G_TYPE_OBJECT)

static void ao_systray_finalize(GObject *object)
{
#if GTK_CHECK_VERSION(2, 10, 0)
AoSystrayPrivate *priv = AO_SYSTRAY_GET_PRIVATE(object);

g_object_unref(priv->icon);
g_object_unref(priv->popup_menu);
#endif

G_OBJECT_CLASS(ao_systray_parent_class)->finalize(object);
}
Expand All @@ -88,9 +84,7 @@ static void ao_systray_set_property(GObject *object, guint prop_id,
{
case PROP_ENABLE_SYSTRAY:
priv->enable_systray = g_value_get_boolean(value);
#if GTK_CHECK_VERSION(2, 10, 0)
gtk_status_icon_set_visible(priv->icon, priv->enable_systray);
#endif
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Expand Down Expand Up @@ -121,7 +115,6 @@ static void ao_systray_class_init(AoSystrayClass *klass)
}


#if GTK_CHECK_VERSION(2, 10, 0)
static void icon_activate_cb(GtkStatusIcon *status_icon, gpointer data)
{
if (gtk_window_is_active(GTK_WINDOW(geany->main_widgets->window)))
Expand All @@ -135,7 +128,7 @@ static void icon_popup_menu_cmd_clicked_cb(GtkMenuItem *item, gpointer data)
{
GtkWidget *widget;
const gchar *widget_name = NULL;

switch (GPOINTER_TO_INT(data))
{
case WIDGET_OPEN:
Expand Down Expand Up @@ -178,12 +171,10 @@ static void icon_popup_menu_cb(GtkStatusIcon *status_icon, guint button, guint a
if (button == 3)
gtk_menu_popup(GTK_MENU(priv->popup_menu), NULL, NULL, NULL, NULL, button, activate_time);
}
#endif


static void ao_systray_init(AoSystray *self)
{
#if GTK_CHECK_VERSION(2, 10, 0)
AoSystrayPrivate *priv = AO_SYSTRAY_GET_PRIVATE(self);
GtkWidget *item;
const gchar *icon_name;
Expand All @@ -196,11 +187,7 @@ static void ao_systray_init(AoSystray *self)
gtk_status_icon_set_from_pixbuf(priv->icon, gtk_window_get_icon(
GTK_WINDOW(geany->main_widgets->window)));

#if GTK_CHECK_VERSION(2, 16, 0)
gtk_status_icon_set_tooltip_text(priv->icon, "Geany");
#else
gtk_status_icon_set_tooltip(priv->icon, "Geany");
#endif

priv->popup_menu = gtk_menu_new();
g_object_ref_sink(priv->popup_menu);
Expand Down Expand Up @@ -238,7 +225,6 @@ static void ao_systray_init(AoSystray *self)

g_signal_connect(priv->icon, "activate", G_CALLBACK(icon_activate_cb), NULL);
g_signal_connect(priv->icon, "popup-menu", G_CALLBACK(icon_popup_menu_cb), self);
#endif
}


Expand Down

0 comments on commit 820fd93

Please sign in to comment.