Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Deprecated gtk_color_selection_dialog_new with gtk_color_chooser_dialog_new #2340

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/tools.c
Expand Up @@ -792,7 +792,7 @@ static void on_color_dialog_response(GtkDialog *dialog, gint response, gpointer
{
GeanyDocument *doc = document_get_current();
g_return_if_fail(doc != NULL);
#if (gtk_major_version == 3)
#if (GTK_MAJOR_VERSION == 3)
GdkRGBA color;
char hex[8] = { 0 };

Expand Down Expand Up @@ -827,7 +827,7 @@ static void on_color_dialog_response(GtkDialog *dialog, gint response, gpointer
/* This shows the color selection dialog to choose a color. */
void tools_color_chooser(const gchar *color)
{
#if (gtk_major_version < 3)
#if (GTK_MAJOR_VERSION < 3)
GdkColor gc;
GtkWidget *colorsel;
#endif
Expand All @@ -842,7 +842,7 @@ void tools_color_chooser(const gchar *color)

if (ui_widgets.open_colorsel == NULL)
{
#if (gtk_major_version == 3)
#if (GTK_MAJOR_VERSION == 3)
ui_widgets.open_colorsel = gtk_color_chooser_dialog_new(_("Color Chooser"), GTK_WINDOW(main_widgets.window));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gtk_color_chooser_dialog_new() requires at least gtk version 3.4 not 3. You could use #if GTK_CHECK_VERSION(3, 4, 0) ... else ... endif for a correct version check.

#else
ui_widgets.open_colorsel = gtk_color_selection_dialog_new(_("Color Chooser"));
Expand All @@ -860,7 +860,7 @@ void tools_color_chooser(const gchar *color)
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
}

#if (gtk_major_version == 3)
#if (GTK_MAJOR_VERSION == 3)
g_object_set((gpointer)ui_widgets.open_colorsel, "show-editor", TRUE, NULL);
#else
else
Expand Down