resurrected the runtime check for the required Gtk+ version. Depend on

2003-10-26  Michael Natterer  <mitch@gimp.org>

	* app/gui/gui.c (gui_libs_init): resurrected the runtime check for
	the required Gtk+ version. Depend on Gtk+ >= 2.2.2 and abort if
	the requirement is not met. This is mainly for catching packaging
	errors, as we already compile-time require Gtk+ 2.2.2.

	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainertreeview.c: removed #warnings and
	workarounds for bugs in Gtk+ < 2.2.2.

	* app/widgets/gimpcontainertreeview.c: replaced the #warning about
	the pending fix for bug #115871 by a #warning plus runtime check
	for Gtk+ >= 2.2.3. Did some general cleanups.
This commit is contained in:
Michael Natterer 2003-10-26 20:25:34 +00:00 committed by Michael Natterer
parent c08a8f8511
commit 09ae4b29cd
4 changed files with 65 additions and 90 deletions

View File

@ -1,3 +1,18 @@
2003-10-26 Michael Natterer <mitch@gimp.org>
* app/gui/gui.c (gui_libs_init): resurrected the runtime check for
the required Gtk+ version. Depend on Gtk+ >= 2.2.2 and abort if
the requirement is not met. This is mainly for catching packaging
errors, as we already compile-time require Gtk+ 2.2.2.
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainertreeview.c: removed #warnings and
workarounds for bugs in Gtk+ < 2.2.2.
* app/widgets/gimpcontainertreeview.c: replaced the #warning about
the pending fix for bug #115871 by a #warning plus runtime check
for Gtk+ >= 2.2.3. Did some general cleanups.
2003-10-26 Henrik Brix Andersen <brix@gimp.org>
* themes/Default/images/preferences/Makefile.am: really committed

View File

@ -119,7 +119,8 @@ gboolean
gui_libs_init (gint *argc,
gchar ***argv)
{
GimpWidgetsVTable vtable;
GimpWidgetsVTable vtable;
const gchar *mismatch;
g_return_val_if_fail (argc != NULL, FALSE);
g_return_val_if_fail (argv != NULL, FALSE);
@ -145,6 +146,37 @@ gui_libs_init (gint *argc,
g_type_class_ref (GIMP_TYPE_COLOR_SELECT);
#define REQUIRED_MAJOR 2
#define REQUIRED_MINOR 2
#define REQUIRED_MICRO 2
mismatch = gtk_check_version (REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO);
if (mismatch)
{
gchar *message;
message =
g_strdup_printf ("%s\n\n"
"The GIMP requires Gtk+ version %d.%d.%d or later.\n"
"Installed Gtk+ version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older Gtk+ version.\n\n"
"Please upgrade to Gtk+ version %d.%d.%d or later.",
mismatch,
REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO,
gtk_major_version, gtk_minor_version, gtk_micro_version,
REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO);
gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, message,
(GtkCallback) gtk_main_quit, NULL);
g_free (message);
gtk_main ();
exit (EXIT_FAILURE);
}
return TRUE;
}

View File

@ -90,8 +90,6 @@ static void gimp_container_grid_view_highlight_item (GimpContainerView *v
static void gimp_container_grid_view_viewport_resized (GtkWidget *widget,
GtkAllocation *allocation,
GimpContainerGridView *view);
static void gimp_container_grid_view_viewport_realize (GtkWidget *widget,
GimpContainerGridView *view);
static GimpContainerViewClass *parent_class = NULL;
@ -217,14 +215,6 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
G_CALLBACK (gimp_container_grid_view_viewport_resized),
grid_view);
#ifdef __GNUC__
#warning FIXME: remove realize callback once we depend on GTK+ 2.2.2
#endif
if (! GTK_CHECK_VERSION (2, 2, 2))
g_signal_connect (grid_view->wrap_box->parent, "realize",
G_CALLBACK (gimp_container_grid_view_viewport_realize),
grid_view);
GTK_WIDGET_SET_FLAGS (grid_view, GTK_CAN_FOCUS);
}
@ -710,23 +700,3 @@ gimp_container_grid_view_viewport_resized (GtkWidget *widget,
}
}
}
static void
gimp_container_grid_view_viewport_realize (GtkWidget *widget,
GimpContainerGridView *grid_view)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (grid_view);
if (view->container && grid_view->selected_item)
{
GimpPreview *preview;
preview = grid_view->selected_item;
gimp_container_grid_view_highlight_item (view,
preview->viewable,
preview);
}
}

View File

@ -160,9 +160,7 @@ gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass)
static void
gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (tree_view);
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
tree_view->n_model_columns = NUM_COLUMNS;
@ -424,9 +422,7 @@ static void
gimp_container_tree_view_set_container (GimpContainerView *view,
GimpContainer *container)
{
GimpContainerTreeView *tree_view;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
if (view->container)
{
@ -490,11 +486,9 @@ gimp_container_tree_view_insert_item (GimpContainerView *view,
GimpViewable *viewable,
gint index)
{
GimpContainerTreeView *tree_view;
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
iter = g_new0 (GtkTreeIter, 1);
if (index == -1)
@ -512,11 +506,9 @@ gimp_container_tree_view_remove_item (GimpContainerView *view,
GimpViewable *viewable,
gpointer insert_data)
{
GimpContainerTreeView *tree_view;
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
iter = (GtkTreeIter *) insert_data;
if (iter)
@ -529,11 +521,9 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
gint new_index,
gpointer insert_data)
{
GimpContainerTreeView *tree_view;
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
iter = (GtkTreeIter *) insert_data;
if (iter)
@ -603,11 +593,9 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
GimpViewable *viewable,
gpointer insert_data)
{
GimpContainerTreeView *tree_view;
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
iter = (GtkTreeIter *) insert_data;
if (iter)
@ -620,20 +608,14 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
gimp_container_tree_view_selection_changed,
tree_view);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.2.2
#endif
if (! GTK_CHECK_VERSION (2, 2, 2) &&
tree_view->main_column->editable_widget)
gtk_cell_editable_remove_widget (tree_view->main_column->editable_widget);
gtk_tree_view_set_cursor (tree_view->view, path, NULL, FALSE);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as #115871 is fixed
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.2.3
#endif
/* gtk_tree_view_set_cursor() should be sufficient actually... */
gtk_tree_selection_select_iter (tree_view->selection, iter);
if (gtk_check_version (2, 2, 3) != NULL)
gtk_tree_selection_select_iter (tree_view->selection, iter);
g_signal_handlers_unblock_by_func (tree_view->selection,
gimp_container_tree_view_selection_changed,
@ -655,9 +637,7 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
static void
gimp_container_tree_view_clear_items (GimpContainerView *view)
{
GimpContainerTreeView *tree_view;
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
gtk_list_store_clear (GTK_LIST_STORE (tree_view->model));
@ -750,15 +730,13 @@ gimp_container_tree_view_find_click_cell (GList *cells,
gint tree_x,
gint tree_y)
{
GtkCellRenderer *renderer;
GList *list;
GList *list;
for (list = cells; list; list = g_list_next (list))
{
gint start_pos;
gint width;
renderer = (GtkCellRenderer *) list->data;
GtkCellRenderer *renderer = list->data;
gint start_pos;
gint width;
if (renderer->visible &&
gtk_tree_view_column_cell_get_position (column, renderer,
@ -854,13 +832,6 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
{
gboolean success = TRUE;
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.2.2
#endif
if (! GTK_CHECK_VERSION (2, 2, 2) &&
tree_view->main_column->editable_widget)
gtk_cell_editable_remove_widget (tree_view->main_column->editable_widget);
/* don't select item if a toggle was clicked */
if (! toggled_cell)
success = gimp_container_view_item_selected (container_view,
@ -914,13 +885,6 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
if (edit_cell)
{
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.2.2
#endif
if (! GTK_CHECK_VERSION (2, 2, 2) &&
column->editable_widget)
gtk_cell_editable_remove_widget (column->editable_widget);
#ifdef __GNUC__
#warning FIXME: make sure the orig text gets restored when cancelling editing
#endif
if (edit_cell == tree_view->name_cell)
@ -979,11 +943,9 @@ static void
gimp_container_tree_view_renderer_update (GimpPreviewRenderer *renderer,
GimpContainerTreeView *tree_view)
{
GimpContainerView *view;
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
GtkTreeIter *iter;
view = GIMP_CONTAINER_VIEW (tree_view);
iter = g_hash_table_lookup (view->hash_table, renderer->viewable);
if (iter)
@ -1002,11 +964,9 @@ static void
gimp_container_tree_view_name_changed (GimpObject *object,
GimpContainerTreeView *tree_view)
{
GimpContainerView *view;
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
GtkTreeIter *iter;
view = GIMP_CONTAINER_VIEW (tree_view);
iter = g_hash_table_lookup (view->hash_table, object);
if (iter)
@ -1027,9 +987,7 @@ static GimpViewable *
gimp_container_tree_view_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpContainerTreeView *tree_view;
tree_view = GIMP_CONTAINER_TREE_VIEW (data);
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data);
return tree_view->dnd_viewable;
}