Verified Commit 5fcae386 authored by Zander's avatar Zander 💥

Remove fallback code for unsupported glib/gtk

parent a3110818
......@@ -656,11 +656,6 @@ app_init (int argc, char **argv)
argv0 = (argc > 0) ? argv[0] : "(none)";
#if GTK_CHECK_VERSION(2,24,0)
/* ... use setlocale directly? */
#else
gtk_set_locale();
#endif
setlocale(LC_NUMERIC, "C");
_setup_textdomains ();
......@@ -729,9 +724,6 @@ app_init (int argc, char **argv)
if (argv && dia_is_interactive) {
GdkPixbuf *pixbuf;
# if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2,32,0)
g_thread_init (NULL);
# endif
g_set_application_name (_("Dia Diagram Editor"));
gtk_init(&argc, &argv);
......@@ -749,12 +741,6 @@ app_init (int argc, char **argv)
}
}
else {
#if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2,32,0)
g_thread_init (NULL);
#endif
#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();
#endif
/*
* On Windows there is no command line without display so that gtk_init is harmless.
* On X11 we need gtk_init_check() to avoid exit() just because there is no display
......@@ -1013,11 +999,7 @@ app_exit(void)
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
#else
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
#endif
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
button = gtk_button_new_from_stock (GTK_STOCK_QUIT);
......
......@@ -61,9 +61,13 @@ static const gchar *authors[] = {
"Alexander Larsson <alexl@redhat.com>",
/* current maintainer */
"Zander Brown <zbrown@gnome.org>",
/* "out for lunch" maintainer */
"Hans Breuer <hans@breuer.org>",
/* other author(s) */
"Eduard Nicodei <eddnicodei@gmail.com>",
"Lars R. Clausen <lrclause@cs.uiuc.edu>",
"Cyrille Chépélov <cyrille@chepelov.org>",
"James Henstridge <james@daa.com.au>",
......
......@@ -39,6 +39,7 @@
#include "confirm.h"
#include "dia-application.h"
#include "menus.h"
#include "widgets.h"
/** Functions called on menu selects.
* Note that GTK (at least up to 2.12) doesn't disable the keyboard shortcuts
......@@ -1032,9 +1033,7 @@ help_about_callback (GtkAction *action)
"along with this program; if not, write to the Free Software\n"
"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n");
gchar *dirname = dia_get_data_directory("");
gchar *filename = g_build_filename (dirname, "dia-splash.png", NULL);
GdkPixbuf *logo = gdk_pixbuf_new_from_file(filename, NULL);
GdkPixbuf *logo = pixbuf_from_resource ("/org/gnome/Dia/dia-splash.png");
gtk_show_about_dialog (NULL,
"logo", logo,
......@@ -1050,8 +1049,6 @@ help_about_callback (GtkAction *action)
? translators : NULL,
"license", license,
NULL);
g_free (dirname);
g_free (filename);
if (logo)
g_object_unref (logo);
}
......
......@@ -25,12 +25,12 @@
#include "confirm.h"
#include "intl.h"
static gint
static gint
confirm_respond (GtkWidget *widget, gint response_id, gpointer data)
{
/* just close it in any case */
gtk_widget_hide (widget);
return 0;
return 0;
}
/*!
......@@ -44,7 +44,7 @@ confirm_export_size (Diagram *dia, GtkWindow *parent, guint flags)
gint64 bytes = 0;
gchar *size, *msg;
gboolean ret;
pages = ceil((dia->data->extents.right - dia->data->extents.left) / dia->data->paper.width)
* ceil((dia->data->extents.bottom - dia->data->extents.top) / dia->data->paper.height);
/* three guesses: 4 bytes per pixel, 20 pixels per cm; using * dia->data->paper.scaling */
......@@ -58,13 +58,9 @@ confirm_export_size (Diagram *dia, GtkWindow *parent, guint flags)
return TRUE; /* smaller than 100MB */
else if ((flags & CONFIRM_PAGES) && (pages < 50))
return TRUE;
/* message and limits depend on the flags give */
#if GLIB_CHECK_VERSION(2,30,0)
size = g_format_size (bytes);
#else
size = g_format_size_for_display (bytes);
#endif
/* See: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals */
if (flags & CONFIRM_PRINT)
msg = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
......@@ -84,7 +80,7 @@ confirm_export_size (Diagram *dia, GtkWindow *parent, guint flags)
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK_CANCEL,
"%s", msg);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("You can adjust the size of the diagram by changing "
"the 'Scaling' in the 'Page Setup' dialog.\n"
"Alternatively use 'Best Fit' "
......
......@@ -23,5 +23,6 @@
<file>icons/dia-layer-rename.png</file>
<file>icons/dia-layer-move-above.png</file>
<file>icons/dia-layer-move-below.png</file>
<file>dia-splash.png</file>
</gresource>
</gresources>
\ No newline at end of file
</gresources>
......@@ -571,11 +571,7 @@ diagram_tree_show (void)
gtk_window_set_role (GTK_WINDOW (window), "diagram_tree");
#if GTK_CHECK_VERSION(2,20,0)
if (!gtk_widget_get_visible (window))
#else
if (!GTK_WIDGET_VISIBLE (window))
#endif
gtk_widget_show_all (window);
/* FIXME: remove flicker by removing gtk_widget_show from persistence_register_window() */
......
......@@ -56,7 +56,7 @@ typedef struct {
static HoldTimeoutData hold_data = {NULL, NULL, 0};
static void
object_menu_item_proxy(GtkWidget *widget, gpointer data)
......@@ -99,7 +99,7 @@ object_menu_item_proxy(GtkWidget *widget, gpointer data)
}
static void
dia_menu_free(DiaMenu *dia_menu)
dia_menu_free(DiaMenu *dia_menu)
{
if (dia_menu->app_data)
gtk_object_destroy((GtkObject *)dia_menu->app_data);
......@@ -114,8 +114,8 @@ dia_menu_free(DiaMenu *dia_menu)
pass TRUE in separator if you want to insert a separator before the poperty
menu item.
*/
static void
add_properties_menu_item (GtkMenu *menu, gboolean separator)
static void
add_properties_menu_item (GtkMenu *menu, gboolean separator)
{
GtkWidget *menu_item = NULL;
......@@ -148,7 +148,7 @@ _follow_link_callback (GtkAction *action, gpointer data)
if (strstr (url, "://") == NULL) {
if (!g_path_is_absolute(url)) {
gchar *p = NULL;
if (ddisp->diagram->filename)
p = dia_absolutize_filename (ddisp->diagram->filename, url);
if (p) {
......@@ -259,10 +259,10 @@ add_combine_to_path_menu_items (GtkMenu *menu)
const gchar *name;
PathCombineMode mode;
} _ops[] = {
{ N_("Union"), PATH_UNION },
{ N_("Difference"), PATH_DIFFERENCE },
{ N_("Intersection"), PATH_INTERSECTION },
{ N_("Exclusion"), PATH_EXCLUSION },
{ N_("Union"), PATH_UNION },
{ N_("Difference"), PATH_DIFFERENCE },
{ N_("Intersection"), PATH_INTERSECTION },
{ N_("Exclusion"), PATH_EXCLUSION },
};
int i;
for (i = 0; i < G_N_ELEMENTS (_ops); ++i) {
......@@ -323,15 +323,15 @@ create_object_menu(DiaMenu *dia_menu, gboolean root_menu, gboolean combining)
/* only connect signal handler if there is actually a callback */
g_signal_connect (G_OBJECT (menu_item), "activate",
G_CALLBACK (object_menu_item_proxy), &dia_menu->items[i]);
} else {
if ( item->callback_data ) {
} else {
if ( item->callback_data ) {
/* This menu item is a submenu if it has no callback, but does
* Have callback_data. In this case the callback_data is a
* DiaMenu pointer for the submenu. */
if ( ((DiaMenu*)item->callback_data)->app_data == NULL ) {
/* Create the popup menu items for the submenu. */
create_object_menu((DiaMenu*)(item->callback_data), FALSE, FALSE) ;
gtk_menu_item_set_submenu( GTK_MENU_ITEM (menu_item),
gtk_menu_item_set_submenu( GTK_MENU_ITEM (menu_item),
GTK_WIDGET(((DiaMenu*)(item->callback_data))->app_data));
}
}
......@@ -371,23 +371,23 @@ popup_object_menu(DDisplay *ddisp, GdkEvent *event)
int i;
int num_items;
Point last_clicked_pos;
diagram = ddisp->diagram;
if (g_list_length (diagram->data->selected) < 1)
return;
selected_list = diagram->data->selected;
/* Have to have exactly one selected object */
if (selected_list == NULL) {
message_error("Selected list is %s while selected_count is %d\n",
(selected_list?"long":"empty"), g_list_length (diagram->data->selected));
return;
}
last_clicked_pos = ddisplay_get_clicked_position(ddisp);
obj = (DiaObject *)g_list_first(selected_list)->data;
/* Possibly react differently at a handle? */
/* Get its menu, and remember the # of object-generated items */
......@@ -444,7 +444,7 @@ popup_object_menu(DDisplay *ddisp, GdkEvent *event)
menu = GTK_MENU(dia_menu->app_data);
/* add the properties menu item to raise the properties from the contextual menu */
if (event->type == GDK_BUTTON_PRESS)
gtk_menu_popup(menu, NULL, NULL, NULL, NULL,
((GdkEventButton *)event)->button, ((GdkEventButton *)event)->time);
......@@ -465,14 +465,10 @@ ddisplay_focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
ddisp = (DDisplay *)data;
#if GTK_CHECK_VERSION(2,21,6)
g_assert (event->in == TRUE);
#else
GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
#endif
gtk_im_context_focus_in(GTK_IM_CONTEXT(ddisp->im_context));
return FALSE;
}
......@@ -481,7 +477,7 @@ ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
{
DDisplay *ddisp;
int return_val;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (data != NULL, FALSE);
......@@ -490,11 +486,7 @@ ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
ddisp = (DDisplay *)data;
#if GTK_CHECK_VERSION(2,21,6)
g_assert (event->in == FALSE);
#else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
#endif
gtk_im_context_focus_out(GTK_IM_CONTEXT(ddisp->im_context));
......@@ -519,7 +511,7 @@ void
ddisplay_unrealize (GtkWidget *widget, gpointer data)
{
DDisplay *ddisp;
g_return_if_fail (widget != NULL);
g_return_if_fail (data != NULL);
......@@ -540,10 +532,10 @@ ddisplay_popup_menu(DDisplay *ddisp, GdkEventButton *event)
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event->button, event->time);
}
static void
handle_key_event(DDisplay *ddisp, Focus *focus,
static void
handle_key_event(DDisplay *ddisp, Focus *focus,
guint keystate, guint keysym,
const gchar *str, int strlen)
const gchar *str, int strlen)
{
DiaObject *obj = focus_get_object(focus);
Point p = obj->position;
......@@ -551,15 +543,15 @@ handle_key_event(DDisplay *ddisp, Focus *focus,
gboolean modified;
object_add_updates(obj, ddisp->diagram);
modified = (focus->key_event)(focus, keystate, keysym, str, strlen,
&obj_change);
/* Make sure object updates its data and its connected: */
p = obj->position;
(obj->ops->move)(obj,&p);
(obj->ops->move)(obj,&p);
diagram_update_connections_object(ddisp->diagram,obj,TRUE);
object_add_updates(obj, ddisp->diagram);
if (modified) {
......@@ -573,11 +565,11 @@ handle_key_event(DDisplay *ddisp, Focus *focus,
diagram_flush(ddisp->diagram);
}
void
void
ddisplay_im_context_commit(GtkIMContext *context, const gchar *str,
DDisplay *ddisp)
DDisplay *ddisp)
{
/* When using IM, we'll not get many key events past the IM filter,
mostly IM Commits.
......@@ -585,24 +577,24 @@ ddisplay_im_context_commit(GtkIMContext *context, const gchar *str,
regardless of the platform, "str" should be a clean UTF8 string
(the default IM on X should perform the local->UTF8 conversion)
*/
Focus *focus = get_active_focus((DiagramData *) ddisp->diagram);
ddisplay_im_context_preedit_reset(ddisp, focus);
if (focus != NULL)
handle_key_event(ddisp, focus, 0, 0, str, g_utf8_strlen(str,-1));
}
void
void
ddisplay_im_context_preedit_changed(GtkIMContext *context,
DDisplay *ddisp)
DDisplay *ddisp)
{
gint cursor_pos;
Focus *focus = get_active_focus((DiagramData *) ddisp->diagram);
ddisplay_im_context_preedit_reset(ddisp, focus);
gtk_im_context_get_preedit_string(context, &ddisp->preedit_string,
&ddisp->preedit_attrs, &cursor_pos);
if (ddisp->preedit_string != NULL) {
......@@ -665,8 +657,8 @@ _scroll_step (DDisplay *ddisp, guint keyval)
/** Cleanup/Remove Timeout Handler for Button Press and Hold
*/
static void
hold_remove_handler(void)
static void
hold_remove_handler(void)
{
if (hold_data.tag != 0) {
g_source_remove(hold_data.tag);
......@@ -681,8 +673,8 @@ hold_remove_handler(void)
* the pointer (mouse).
* Dynamic data is cleaned up in ddisplay_canvas_events
*/
static gboolean
hold_timeout_handler(gpointer data)
static gboolean
hold_timeout_handler(gpointer data)
{
if (active_tool->button_hold_func)
(*active_tool->button_hold_func) (active_tool, (GdkEventButton *)(hold_data.event), hold_data.ddisp);
......@@ -713,10 +705,10 @@ ddisplay_canvas_events (GtkWidget *canvas,
int key_handled;
int im_context_used;
static gboolean moving = FALSE;
return_val = FALSE;
if (!gtk_widget_get_window(canvas))
if (!gtk_widget_get_window(canvas))
return FALSE;
switch (event->type)
......@@ -734,13 +726,13 @@ ddisplay_canvas_events (GtkWidget *canvas,
/* zooming with the wheel in small steps 1^(1/8) */
ddisplay_zoom_centered(ddisp, &middle, 1.090508);
}
else
else
ddisplay_scroll_up(ddisp);
break;
case GDK_SCROLL_DOWN:
if (sevent->state & GDK_SHIFT_MASK)
ddisplay_scroll_right(ddisp);
else if (sevent->state & GDK_CONTROL_MASK) {
else if (sevent->state & GDK_CONTROL_MASK) {
ddisplay_untransform_coords(ddisp, (int)sevent->x, (int)sevent->y, &middle.x, &middle.y);
/* zooming with the wheel in small steps 1/(1^(1/8)) */
ddisplay_zoom_centered(ddisp, &middle, 0.917004);
......@@ -858,7 +850,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
{
case 1:
if (moving)
moving = FALSE;
moving = FALSE;
if (active_tool->button_release_func)
(*active_tool->button_release_func) (active_tool,
bevent, ddisp);
......@@ -870,7 +862,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
if (transient_tool) {
(*transient_tool->button_release_func) (transient_tool,
bevent, ddisp);
tool_free(transient_tool);
transient_tool = NULL;
}
......@@ -897,14 +889,14 @@ ddisplay_canvas_events (GtkWidget *canvas,
mevent->state = tmask;
mevent->is_hint = FALSE;
}
if (transient_tool && (*transient_tool->motion_func))
if (transient_tool && (*transient_tool->motion_func))
(*transient_tool->motion_func) (transient_tool, mevent, ddisp);
else if (active_tool->motion_func)
(*active_tool->motion_func) (active_tool, mevent, ddisp);
break;
case GDK_KEY_PRESS:
if (moving) /*Disable Keyboard accels whilst draggin an object*/
if (moving) /*Disable Keyboard accels whilst draggin an object*/
break;
display_set_active(ddisp);
kevent = (GdkEventKey *)event;
......@@ -922,7 +914,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
if (!gtk_im_context_filter_keypress(
GTK_IM_CONTEXT(ddisp->im_context), kevent)) {
switch (kevent->keyval) {
case GDK_Tab:
focus = textedit_move_focus(ddisp, focus,
......@@ -938,7 +930,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
/*! key event not swallowed by the input method ? */
handle_key_event(ddisp, focus, kevent->state, kevent->keyval,
kevent->string, kevent->length);
diagram_flush(ddisp->diagram);
}
}
......@@ -950,12 +942,12 @@ ddisplay_canvas_events (GtkWidget *canvas,
* shouldn't break im_context handling. How to test? --hb
*/
if (!key_handled && (state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) {
#else
#else
if (!key_handled) {
#endif
/* IM doesn't need receive keys, take care of it ourselves. */
return_val = TRUE;
switch(kevent->keyval) {
case GDK_Home :
case GDK_KP_Home :
......@@ -968,8 +960,8 @@ ddisplay_canvas_events (GtkWidget *canvas,
case GDK_KP_End :
/* match lower right corner of the diagram with it's view */
visible = &ddisp->visible;
ddisplay_set_origo(ddisp,
ddisp->diagram->data->extents.right - (visible->right - visible->left),
ddisplay_set_origo(ddisp,
ddisp->diagram->data->extents.right - (visible->right - visible->left),
ddisp->diagram->data->extents.bottom - (visible->bottom - visible->top));
ddisplay_update_scrollbars(ddisp);
ddisplay_add_update_all(ddisp);
......@@ -993,13 +985,13 @@ ddisplay_canvas_events (GtkWidget *canvas,
GDK_Down == kevent->keyval ? DIR_DOWN :
GDK_Right == kevent->keyval ? DIR_RIGHT : DIR_LEFT;
object_add_updates_list(objects, dia);
object_list_nudge(objects, dia, dir,
object_list_nudge(objects, dia, dir,
/* step one pixel or more with <ctrl> */
ddisplay_untransform_length (ddisp, (state & GDK_SHIFT_MASK) ? 10 : 1));
diagram_update_connections_selection(dia);
object_add_updates_list(objects, dia);
diagram_modified(dia);
diagram_flush(dia);
diagram_flush(dia);
undo_set_transactionpoint(dia->undo);
} else {
......@@ -1032,7 +1024,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
default:
if (kevent->string && kevent->keyval == ' ') {
tool_select_former();
} else if ((kevent->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0 &&
} else if ((kevent->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0 &&
kevent->length != 0) {
/* Find first editable? */
}
......@@ -1041,7 +1033,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
if (!im_context_used)
gtk_im_context_reset(GTK_IM_CONTEXT(ddisp->im_context));
break;
case GDK_KEY_RELEASE:
......@@ -1061,11 +1053,11 @@ ddisplay_canvas_events (GtkWidget *canvas,
}
}
break;
default:
break;
}
return return_val;
}
......@@ -1095,7 +1087,7 @@ ddisplay_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
DDisplay *ddisp;
ddisp = (DDisplay *)data;
ddisplay_close(ddisp);
return TRUE;
}
......@@ -1104,7 +1096,7 @@ void
ddisplay_destroy (GtkWidget *widget, gpointer data)
{
DDisplay *ddisp;
ddisp = (DDisplay *) data;
ddisplay_really_destroy(ddisp);
......
......@@ -1119,11 +1119,7 @@ ddisplay_close(DDisplay *ddisp)
/* button = gtk_button_new_with_label (_("Save and Close")); */
button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
#else
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
#endif
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
g_signal_connect (G_OBJECT (dialog), "response",
......@@ -1150,29 +1146,25 @@ display_update_menu_state(DDisplay *ddisp)
antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased"));
gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"),
g_type_from_name ("DiaCairoInteractiveRenderer") != 0);
g_type_from_name ("DiaCairoInteractiveRenderer") != 0);
ddisplay_do_update_menu_sensitivity (ddisp);
gtk_toggle_action_set_active (rulers, display_get_rulers_showing(ddisp));
#if GTK_CHECK_VERSION(2,20,0)
scrollbars_shown = gtk_widget_get_visible (ddisp->hsb);
#else
scrollbars_shown = GTK_WIDGET_VISIBLE (ddisp->hsb);
#endif
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (menus_get_action ("ViewShowscrollbars")),
scrollbars_shown);
scrollbars_shown);
gtk_toggle_action_set_active (visible_grid,
ddisp->grid.visible);
ddisp->grid.visible);
gtk_toggle_action_set_active (snap_to_grid,
ddisp->grid.snap);
ddisp->grid.snap);
gtk_toggle_action_set_active (show_cx_pts,
ddisp->show_cx_pts);
ddisp->show_cx_pts);
gtk_toggle_action_set_active (antialiased,
ddisp->aa_renderer);
ddisp->aa_renderer);
}
void
......@@ -1327,11 +1319,7 @@ void display_rulers_show (DDisplay *ddisp)
gtk_widget_show (ddisp->hrule);
gtk_widget_show (ddisp->vrule);
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_visible (parent))
#else
if (GTK_WIDGET_VISIBLE (parent))
#endif
gtk_widget_queue_resize (parent);
ddisp->rulers_are_showing = TRUE;
......@@ -1355,11 +1343,7 @@ void display_rulers_hide (DDisplay *ddisp)
gtk_widget_hide (ddisp->hrule);
gtk_widget_hide (ddisp->vrule);
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_visible (parent))
#else
if (GTK_WIDGET_VISIBLE (parent))
#endif
gtk_widget_queue_resize (parent);
ddisp->rulers_are_showing = FALSE;
......
......@@ -80,7 +80,7 @@ ifilter_by_index (int index, const char* filename)
return ifilter;
}
typedef void* (* FilterGuessFunc) (const gchar* filename);
typedef void* (* FilterGuessFunc) (const gchar* filename);
/**
* Respond to the file chooser filter facility, that is match
......@@ -132,7 +132,7 @@ build_gtk_file_filter_from_index (int index)
if (ifilter) {
GString *pattern = g_string_new ("*.");
int i = 0;
filter = gtk_file_filter_new ();
while (ifilter->extensions[i] != NULL) {
......@@ -159,7 +159,7 @@ build_gtk_file_filter_from_index (int index)
static void
import_adapt_extension_callback(GtkWidget *widget)
{
int index = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
int index = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
GtkFileFilter *former = NULL;
GSList *list, *elem;
......@@ -186,19 +186,11 @@ create_open_menu(void)
{
GtkWidget *menu;
GList *tmp;
#if GTK_CHECK_VERSION(2,24,0)
menu = gtk_combo_box_text_new ();
#else
menu = gtk_combo_box_new_text ();
#endif
#if GTK_CHECK_VERSION(2,24,0)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), _("By extension"));
#else
gtk_combo_box_append_text(GTK_COMBO_BOX(menu), _("By extension"));
#endif
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), _("By extension"));
for (tmp = filter_get_import_filters(); tmp != NULL; tmp = tmp->next) {
DiaImportFilter *ifilter = tmp->data;
gchar *filter_label;
......@@ -206,24 +198,20 @@ create_open_menu(void)
if (!ifilter)
continue;
filter_label = filter_get_import_filter_label(ifilter);
#if GTK_CHECK_VERSION(2,24,0)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
#else
gtk_combo_box_append_text (GTK_COMBO_BOX(menu), filter_label);
#endif
g_free(filter_label);
}
g_signal_connect(G_OBJECT(menu), "changed",
G_CALLBACK(import_adapt_extension_callback), NULL);
g_signal_connect (G_OBJECT (menu), "changed",
G_CALLBACK (import_adapt_extension_callback), NULL);
return menu;
}
/**
* Respond to the user finishing the Open Dialog either accept or cancel/destroy
* Respond to the user finishing the Open Dialog either accept or cancel/destroy
*/
static void
file_open_response_callback(GtkWidget *fs,
gint response,
file_open_response_callback(GtkWidget *fs,
gint response,
gpointer user_data)
{
char *filename;
......@@ -235,15 +223,15 @@ file_open_response_callback(GtkWidget *fs,
if (index >= 0) /* remember it */
persistence_set_integer ("import-filter", index);
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
diagram = diagram_load(filename, ifilter_by_index (index - 1, filename));
g_free (filename);
if (diagram != NULL) {
diagram_update_extents(diagram);
layer_dialog_set_diagram(diagram);
if (diagram->displays == NULL) {
/* GSList *displays = diagram->displays;
GSList *displays_head = displays;
......@@ -276,10 +264,10 @@ file_open_callback(GtkAction *action)
Diagram *dia = NULL;
GtkWindow *parent_window;
gchar *filename = NULL;
/* FIXME: we should not use ddisp_active but instead get the current diagram
* from caller. Thus we could offer the option to "load into" if invoked by
* <Display/File/Open. It wouldn't make any sense if invoked by
* <Display/File/Open. It wouldn't make any sense if invoked by