// Maybe add a default map layer
if ( a_vik_get_add_default_map_layer () ) {
VikMapsLayer *vml = VIK_MAPS_LAYER ( vik_layer_create(VIK_LAYER_MAPS, vw->viking_vvp, NULL, FALSE) );
- vik_maps_layer_pretend_licence_shown ( vml );
vik_layer_rename ( VIK_LAYER(vml), _("Default Map") );
vik_aggregate_layer_add_layer ( vik_layers_panel_get_top_layer(vw->viking_vlp), VIK_LAYER(vml), TRUE );
while ( cur_file ) {
// Only open a new window if a viking file
gchar *file_name = cur_file->data;
- if (vw != NULL && check_file_magic_vik ( file_name ) ) {
+ if (vw != NULL && vw->filename && check_file_magic_vik ( file_name ) ) {
VikWindow *newvw = vik_window_new_window ();
if (newvw)
vik_window_open_file ( newvw, file_name, TRUE );
window_list = g_slist_remove ( window_list, vw );
gdk_cursor_unref ( vw->busy_cursor );
+ int tt;
+ for (tt = 0; tt < vw->vt->n_tools; tt++ )
+ if ( vw->vt->tools[tt].ti.destroy )
+ vw->vt->tools[tt].ti.destroy ( vw->vt->tools[tt].state );
+ g_free ( vw->vt->tools );
+ g_free ( vw->vt );
G_OBJECT_CLASS(parent_class)->finalize(gob);
}
gint entry_runner = 0;
gchar *entry = entries[entry_runner];
while (entry) {
- if ( g_strcmp0 ( entry, "" ) )
- filenames = g_slist_append ( filenames, entry );
+ if ( g_strcmp0 ( entry, "" ) ) {
+ // Drag+Drop gives URIs. And so in particular, %20 in place of spaces in filenames
+ // thus need to convert the text into a plain string
+ gchar *filename = g_filename_from_uri ( entry, NULL, NULL );
+ if ( filename )
+ filenames = g_slist_append ( filenames, filename );
+ }
entry_runner++;
entry = entries[entry_runner];
}
{
gdk_window_set_cursor ( gtk_widget_get_window(GTK_WIDGET(vw)), vw->busy_cursor );
// Viewport has a separate cursor
- gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw->busy_cursor );
+ gdk_window_set_cursor ( gtk_widget_get_window(GTK_WIDGET(vw->viking_vvp)), vw->busy_cursor );
// Ensure cursor updated before doing stuff
while( gtk_events_pending() )
gtk_main_iteration();
{
gdk_window_set_cursor ( gtk_widget_get_window(GTK_WIDGET(vw)), NULL );
// Restore viewport cursor
- gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw->viewport_cursor );
+ gdk_window_set_cursor ( gtk_widget_get_window(GTK_WIDGET(vw->viking_vvp)), vw->viewport_cursor );
}
void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean change_filename )
// Show some progress
if ( this_success ) {
export_count++;
- gchar *message = g_strconcat ( _("Exporting to file: "), fn, NULL );
+ gchar *message = g_strdup_printf ( _("Exporting to file: %s"), fn );
vik_statusbar_set_message ( vw->viking_vs, VIK_STATUSBAR_INFO, message );
while ( gtk_events_pending() )
gtk_main_iteration ();
return;
}
- GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Export to directory"),
+ GtkWidget *dialog = gtk_file_chooser_dialog_new ( _("Export to directory"),
GTK_WINDOW(vw),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL );
-
- GtkWidget *gw = gtk_file_chooser_widget_new ( GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
- gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), gw, TRUE, TRUE, 0 );
-
- // try to make it a nice size - otherwise seems to default to something impractically small
- gtk_window_set_default_size ( GTK_WINDOW(dialog), 600, 300 );
+ gtk_window_set_transient_for ( GTK_WINDOW(dialog), GTK_WINDOW(vw) );
+ gtk_window_set_destroy_with_parent ( GTK_WINDOW(dialog), TRUE );
+ gtk_window_set_modal ( GTK_WINDOW(dialog), TRUE );
gtk_widget_show_all ( dialog );
if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) {
- gchar *dir = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(gw) );
+ gchar *dir = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(dialog) );
gtk_widget_destroy ( dialog );
if ( dir ) {
if ( !export_to ( vw, gl, vft, dir, extension ) )
export_to_common ( vw, FILE_TYPE_KML, ".kml" );
}
+#if !GLIB_CHECK_VERSION(2,26,0)
+typedef struct stat GStatBuf;
+#endif
+
static void file_properties_cb ( GtkAction *a, VikWindow *vw )
{
gchar *message = NULL;
}
#endif
+static void acquire_from_url ( GtkAction *a, VikWindow *vw )
+{
+ vik_datasource_url_interface.mode = VIK_DATASOURCE_CREATENEWLAYER;
+ a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_url_interface, NULL, NULL );
+}
+
static void goto_default_location( GtkAction *a, VikWindow *vw)
{
struct LatLon ll;
VIK_LAYER_WIDGET_SPINBUTTON,
NULL,
NULL,
- NULL },
+ NULL,
+ NULL,
+ NULL,
+ },
};
VikLayerParam pref_lon[] = {
{ VIK_LAYER_NUM_TYPES,
VIK_LAYER_WIDGET_SPINBUTTON,
NULL,
NULL,
- NULL },
+ NULL,
+ NULL,
+ NULL,
+ },
};
/* Get current center */
png_radio = gtk_radio_button_new_with_label ( NULL, _("Save as PNG") );
jpeg_radio = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(png_radio), _("Save as JPEG") );
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), png_radio, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), jpeg_radio, FALSE, FALSE, 0);
+
if ( ! vw->draw_image_save_as_png )
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(jpeg_radio), TRUE );
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), win_warning_label, FALSE, FALSE, 0);
#endif
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), current_window_button, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), png_radio, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), jpeg_radio, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zoom_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zoom_combo, FALSE, FALSE, 0);
#ifdef VIK_CONFIG_GEOTAG
{ "AcquireGeotag", NULL, N_("From Geotagged _Images..."), NULL, N_("Create waypoints from geotagged images"), (GCallback)acquire_from_geotag },
#endif
+ { "AcquireURL", NULL, N_("From _URL..."), NULL, N_("Get a file from a URL"), (GCallback)acquire_from_url },
#ifdef VIK_CONFIG_GEONAMES
{ "AcquireWikipedia", NULL, N_("From _Wikipedia Waypoints"), NULL, N_("Create waypoints from Wikipedia items in the current view"), (GCallback)acquire_from_wikipedia },
#endif
action.callback = (GCallback)menu_addlayer_cb;
gtk_action_group_add_actions(action_group, &action, 1, window);
+ g_free ( (gchar*)action.label );
+
if ( vik_layer_get_interface(i)->tools_count ) {
gtk_ui_manager_add_ui(uim, mid, "/ui/MainMenu/Tools/", vik_layer_get_interface(i)->name, NULL, GTK_UI_MANAGER_SEPARATOR, FALSE);
gtk_ui_manager_add_ui(uim, mid, "/ui/MainToolbar/ToolItems/", vik_layer_get_interface(i)->name, NULL, GTK_UI_MANAGER_SEPARATOR, FALSE);
}
GtkActionEntry action_dl;
+ gchar *layername = g_strdup_printf ( "Layer%s", vik_layer_get_interface(i)->fixed_layer_name );
gtk_ui_manager_add_ui(uim, mid, "/ui/MainMenu/Edit/LayerDefaults",
vik_layer_get_interface(i)->name,
- g_strdup_printf("Layer%s", vik_layer_get_interface(i)->fixed_layer_name),
+ layername,
GTK_UI_MANAGER_MENUITEM, FALSE);
+ g_free (layername);
// For default layers use action names of the form 'Layer<LayerName>'
// This is to avoid clashing with just the layer name used above for the tool actions
action_dl.tooltip = NULL;
action_dl.callback = (GCallback)layer_defaults_cb;
gtk_action_group_add_actions(action_group, &action_dl, 1, window);
+ g_free ( (gchar*)action_dl.name );
+ g_free ( (gchar*)action_dl.label );
}
g_object_unref (icon_factory);